Windows 8 enable autorun (for real)

I recently had an awful time configuring my system to auto-run files from a USB drive. Problem was, no matter how many settings I changed, my executable just wouldn’t auto launch off my USB drive upon connecting the drive to my PC.

I tried the usual ‘AutoPlay’ settings from the control panel and checked the “Use AutoPlay for all media and devices” –

Use AutoPlay

The above didn’t work and I still kept getting the ‘What action would you like to take’ popup. I also tried changing the “Software and games” section to “Install or run program from your media” –

AutoPlay2

The above didn’t work either. This was both frustrating and confusing. Here I was using the control panel and selecting the right options but nothing seemed to work. I started scouring through some forums and realised that a lot of other people were facing issues with Windows 8 auto-runs as well. As a side note, I noticed that Windows 7 and below had absolutely no problem running an executable off a USB drive via auto-run. I was starting to believe this was some sort of ploy by Microsoft to secure Windows and prevent infections / malware that targeted auto-run.

After some more digging, I came across this article –

https://support.microsoft.com/en-us/kb/2328787

just for kicks, I fired up the Group Policy Editor (gpedit.msc) and changed “Turn off Autoplay” under “Autoplay Policies” to disabled. Voila! It worked!

Then I noticed on my friends computer he did not have gpedit.msc as he was using the Home Premium edition of Windows 8. For operating systems that do not include Gpedit.msc and for an optional resolution, you can directly check and change the NoDriveTypeAutoRun entry value in the following registry key other than 0xFF.

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Polices\Explorer\
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\

AutoPlay3

The Kick: Trying this on another friends PC, I noticed the control panel steps mentioned above worked! No registry editing required. The only difference between the two PCs? He ran Windows 8 while I ran Windows 8.1. I have concluded that this is some sort of bug or a step taken on purpose to keep auto-run disabled by default by Microsoft. If it is that, I think its a bit unfair to assume that nobody will want to auto launch files from their drives upon connection. I tested on another Windows 8 machine and it worked fine on that one too. Windows 8.1 is where this problem lies!

Advertisements

Visual Studio – amazing macros

visualstudio_logo Typing repetitive text or executing repetitive commands can be a real chore while coding. One often overlooked feature of Visual Studio is macros.

For example, I found myself continuously typing my name and the date as a comment for every small change that I made to code I was reviewing code. This helped my team working at another location to see the changes I had made. Visual Studio macros to the rescue! I wrote a simple macro which helped me save some time (and frustration) –

Sub test()
        Dim dtCurrDate As Date
        dtCurrDate = Now
        DTE.ActiveDocument.Selection.Text = "//Karan " + dtCurrDate.ToString()
End Sub

The output of the above macro will be //Karan 9/6/2010 11:06:47 PM. This is a great way to insert comments at the places where you make changes to code. The inserted time provides even more accuracy to the reader.

Some more examples of macros are –

Sub Cleaner()
        DTE.ExecuteCommand("Build.BatchBuild")
        DTE.ExecuteCommand("Build.RebuildSolution")
End Sub

What the above macro does is clean your current solution ( delete intermediate files ) and then rebuilds the solution.

Sub ifdefOut()
        PoundDefOut(False)
End Sub

The above macro can be used to #ifdef / #endif out a section of code.

An easy way to create your macro if you don’t know how to write code in basic is to use the built in macro recorder. Use “Ctrl+Shift+R” to record your macro and “Ctrl+Shift+P” to play the macro back. If you want to save this macro then you can go to Tools –> Macros –> Save Macro. This will save the macro to a file and can be viewed using the Macro Explorer (View –> Other Windows –> Macro explorer).

If you are comfortable with coding in basic, then the best way is to create your own macros is to launch the Macro Editor (Tools –> Macros –> Macros IDE) or Alt+F11, then type your macro.

Another great idea is to assign your macro a shortcut, so that you can invoke your macro without digging through menus. To assign macro shortcuts, go to Tools –> Options. From the Dialog that launches go to Environment –> Keyboard and set your shortcut.

The above macros are really simple macros. Visual Studio 2008 comes with many pre-installed macros. Right click –> edit these to view their source code so that you learn from these great examples.

The above macros have been tested on Visual Studio 2008 but the basic idea should work for other versions as well. Let me know in the comments if you know or would like to share some of your own macros.

Fireworks Photography

Fireworks

Fireworks

Fireworks photography can be a daunting experience. Here is a simple set of steps to follow while clicking night photos, especially fireworks.

1 Use a tripod (Important)
2 Manual exposure & set focus to “infinity”
3 Use “bulb” mode
4 Shutter speed can be between 2 to 10 seconds. Use a “remote” shutter release cable to minimize shake.
5 ISO between 100 or 200
6 Aperture between f/8 tof/16
7 Lens: Medium – wide angle focal length
8 No flash
9 No polarizing filter
10 White balance to”Tungsten”…”Daylight” gives great colors. Much better than using “Auto”

Usually, 4 sec. at f/8 and ISO 100 gives the best results.

Sort Outlook mails using multiple columns

Found this tip via a LifeHacker post. For those who use Outlook express, I am sure you try sorting emails by date, subject etc.

An often overlooked feature of Outlook express is the ability to sort emails via multiple columns. All you need to do is hold down the Shift key while clicking on the column header for one column, and continue to hold the key down while you click on another column. This can be very handy for more advanced sorting – you could sort by sender, and then by message size to find the biggest file from a particular sender.

A great little tip that should save heavy users of Outlook express some time. Thanks Lifehacker!