Wednesday, 23 October 2013

Windows 8.1 USB installer and dual booting

Looks like Microsoft make the task dead simple for you now…

http://www.neowin.net/news/here-is-how-to-get-the-windows-81-iso-and-create-a-usb-install-stick

Although if you get into the trouble I had with GPT bios issues, then use this trick instead…

http://techverse.net/how-to-create-bootable-usb-flash-drive-install-windows-8-1/

Also for all you need to know about dual booting between various flavours of Windows see here

http://www.pagestart.com/dualbootkorner.html

EaseUS Backup Free here (for system imaging backups)

http://download.easeus.com/free/tb_free_installer.exe

MyDefrag defragger to move MBT here

http://www.mydefrag.com/Manual-DownloadAndInstall.html

Thursday, 17 October 2013

No Cache Attribute in MVC

    using System;
using System.Web;
using System.Web.Mvc;
using RRA.Core.Services.Utilities;

///
/// Disables browser caching.
///

[AttributeUsage(AttributeTargets.Method)]
public class NoCacheAttribute : ActionFilterAttribute
{
///
/// Called by the ASP.NET MVC framework before the action result executes.
///

/// The filter context.
public override void OnResultExecuting(ResultExecutingContext filterContext)
{
filterContext.HttpContext.Response.Cache.SetETag((Guid.NewGuid()).ToString());
filterContext.HttpContext.Response.Cache.SetExpires(SystemDateTime.UtcNow.AddDays(-1));
filterContext.HttpContext.Response.Cache.SetValidUntilExpires(false);
filterContext.HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
filterContext.HttpContext.Response.Cache.SetNoStore();
base.OnResultExecuting(filterContext);
}
}


Tuesday, 15 October 2013

My VS macros

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Public Module Module1
    'Empty routine that just causes VS to flush its memory to disk
    Sub ReleaseMemory()
    End Sub
    Sub RebuildDocumentationUpwards()
        DTE.ExecuteCommand("ReSharper.ReSharper_GotoPrevMethod")
        DTE.ExecuteCommand("Tools.SubMain.GhostDoc.RebuildDocumentation")
    End Sub
    Sub AttachToW3p()
        AttachToProcess("w3wp.exe")
    End Sub
    Sub AttachToLocalWebDev()
        AttachToProcess("WebDev.WebServer40.EXE")
    End Sub
    Sub AttachToMyProcess()
        AttachToProcess("MyProcess.exe")
    End Sub
    Sub AttachToMyProcessScript()
        AttachToProcess("MyProcess.exe", True)
    End Sub
    Private Sub AttachToProcess(ByVal ProcessName As String, Optional ByVal ScriptOnly As Boolean = False)
        Try
            Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger
            Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default")
            Dim dbgeng(2) As EnvDTE80.Engine
            dbgeng(0) = trans.Engines.Item("Script")
            If ScriptOnly Then
                Array.Resize(dbgeng, 1)
            Else
                dbgeng(1) = trans.Engines.Item("Managed")
            End If
            Dim proc2 As EnvDTE80.Process2 = dbg2.GetProcesses(trans, System.Environment.MachineName).Item(ProcessName)
            Call proc2.Attach2(dbgeng)
        Catch ex As System.Runtime.InteropServices.COMException
            Select Case ex.ErrorCode
                Case -2147352565
                    ShowMessage(ProcessName & " is not currently a running process")
                Case -1989083106
                    ShowMessage("You are already attached to " & ProcessName)
                Case Else
                    ShowMessage("Unhandled error message from Attach to process macro")
            End Select
        Catch ex As System.Exception
            MsgBox("Unhandled exception occurred: " & ex.Message)
        End Try
    End Sub
    Private Sub ShowMessage(ByVal message As String)
        Call MsgBox(message, MsgBoxStyle.Exclamation, "Attach to process macro")
    End Sub
End Module

Wednesday, 9 October 2013

GOTCHA: The resurrection of TFS source control folders

Today we found something very interesting with Team Foundation Server (TFS) source control folder workflow. A colleague of mine had deleted a source control folder from TFS source control, but as I hadn't got latest on the parent folder, I was not aware that he had done this.

I was then able to add a script to this deleted folder, check in my change, and this had the implicit effect of undeleting the folder that my colleague wanted removed.

One to watch out for in case you don't always do a full get latest from the route of your source control project.

Android mediaserver process killing battery life

If this happens to you, then do the following Force stop on Settings, Applications, All, Media Storage. Clear Cache and Clear Data, fo...