Category Archives: Tips & Tricks

Running uTorrent as a Service on Windows Home Server 2011

Step 1: Download and Install uTorrent

  • Download uTorrent 2.2.1 (390 KB)
  • Install uTorrent as normal, by opening the downloaded EXE
  • It should install itself into C:\Program Files (x86)\uTorrent

Step 2: Configure uTorrent Web UI

  • Run uTorrent as normal (e.g. Start Menu)
  • Go to Options menu and select Preferences
  • Go to the Directories folder and set the folders where you want your torrents to be stored
    • Make a note of these directories, as you will need them in step 8

image

  • Go to the Web UI section and make three changes
    • Tick “Enable Web UI”
    • Set a username and password
    • Tick “Alternative Listening Port”; leave the number as 8080
      • Note: This sub-step is not strictly necessary but gives you a higher chance of things working first time

image

Step 3: Test uTorrent Web UI

  • Using a different computer on the local network ensure you can get to the uTorrent Web UI
  • The web address should of the form http://homeserver:8080/gui/
  • Note: You must replace homeserver in the above URL with the name of the computer where you install uTorrent.
  • The browser should ask for a username and password. Use the values provided in Step 2
  • You should see the uTorrent Web UI.
  • If you do not see the uTorrent Web UI do not proceed any further. You have a networking problem. Seek help.
  • At this stage you have a working uTorrent Web UI but it is NOT running as a service. This means that torrents can still only be downloaded when a user is logged on and running uTorrent. Continue with the following steps to run it as a service…
  • Important: Now Close down uTorrent by choosing File->Exit.

Step 4: Copy the uTorrent settings file

  • Copy the settings.dat file from C:\Users\<User>\AppData\Roaming\uTorrent to C:\Program Files (x86)\uTorrent

Note: Depending on your username you will need to substitute <User> in the above path

Step 5: Download and Install SRVANY.exe

  • Download Windows Server 2003 Resource Kit Tools (11.8 MB).
  • Install the entire tool suite as normal, by opening the downloaded exe.
  • By default srvany.exe will be installed to C:\Program Files (x86)\Windows Resource Kits\Tools\srvany.exe

Step 6: Create Windows Service for uTorrent

  • Open an administrative command prompt by following these steps:
    • Navigate to Start Menu –> Accessories –> Command Prompt
    • Right click and select “Run as Administrator”
  • At the command prompt enter the following:
      sc create uTorrent binPath= "C:\Program Files (x86)\Windows Resource Kits\Tools\srvany.exe" obj= "NT AUTHORITY\LocalService" start= auto
  • Note: Do not remove the spaces between the equals sign and parameters. This is an oddity of sc command and is required
  • If this works you should see something like the screenshot below:

image

If you get the “Access is denied” error then you are not running as administrator.

Step 7: Configure the SRVANY.EXE service

  • If you want to perform this step manually you will need to know about regedit. Here are the steps:
  • Run regedit
    • Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\uTorrent\Parameters
    • Create the Parameters key if it does not exist
    • Under the Parameters Key, add a new String Value named Application
    • Set the value to be C:\Program Files (x86)\uTorrent\uTorrent.exe
    • If you have done everything correctly it should look like the screenshot below:

image

Step 8: Modify permissions on your downloads directory

By default Windows will not allow your uTorrent service to read or write to the disk. In order for uTorrent to work you need to add read & write permissions on the directory or directories you specified in Step 2.

  • Navigate to the directory
  • View the directory properties
  • Select the Security tab
  • Click the Edit… button
  • Click the Add… button
  • Enter LOCAL SERVICE (including the space) then click OK
  • Ensure “Allow Modify” is ticked, and OK everything
  • It should look something like the screeshot below:

image

Step 9: Ensure the uTorrent service is running

  • Load the services control panel (Start->Run->Services.msc)
  • Locate the service named uTorrent and verify the Status column says “Started”.
  • If it does not say “Started”, then click the Start Service button

Finally…

  • Log off your Windows session and repeat Step 3 to verify that the web UI is still working and you can download torrents successfully.

General trouble shooting:

  • Double check that uTorrent.exe is not running on your desktop.
    • Note: By default clicking the close button in top right of the uTorrent window will not actually exit the application
  • Double check that uTorrent.exe is running as a service.
    • In task manager, “Show processes from all users”, ensure you can see uTorrent.exe running with LOCAL SERVICE displaying in the User Name column
  • Please leave a comment if you have any issues with this guide

How to allow Style tag/element within your WordPress Blog for inline CSS

If you trust yourself enough to use the <style> tag within your self-hosted WordPress blog then here is how to get them to work:

  • Go to your WordPress installation and locate the wp-includes\kses.php file
  • Open the file in a text editor and locate the $allowedposttags variable
  • Paste the following snippet of code:
    ‘style’ => array(),
  • just after the line that says:
    $allowedposttags = array(

Your code should now look like the image below:

kses.php showing where to add style tag

That gets the backend of WordPress accepting the style tag. If you write a post now and post it using LiveWriter or the “HTML” editor in wp-admin it should get rendered out into your browser as desired.

The problem is, if you create or edit a post using the WYSIWIG “Visual” editor you will find that your style tag gets turned into a comment like so:

 Wordpress TinyMCE visual editor showing style tag converted to comments

That’s because the client side JavaScript responsible for the WYSIWYG editor is stripping out the style tag and turning it into a comment. In the default WordPress install the WYSIWYG component is called TinyMCE. Here are the instructions for hacking (that’s the spirit of php isn’t it? ;-)) TinyMCE to allow the element tag:

  • Open the wp-admin\includes\post.php file in a text editor
  • Locate code where the $initArray variable is defined. Hint: it begins like this:
    // TinyMCE init settings
    $initArray = array (
  • Now add the following line to the end of the array
    ‘extended_valid_elements’ => ‘style’
  • Don’t forget to add a comma to the end of the preceding line! (in this example thats the one ending in “$plugins”)

If all goes to plan the lower half of the $initArray declaration should look like this:

post.php after its been edited to allow element tag

After all that’s done don’t forget to force your browser to flush its cache i.e. by using Control + F5.

You should now be able to use the style element in your posts, allowing you to create inline CSS to your hearts content.

The same principle applies if you want to allow any other html tags in WordPress.

Direct Download Links for SQL Server 2008 Express

I find it a bit annoying that Microsoft are pushing the Web Platform installer so hard these days that they have removed all obvious direct download links for the various SQL Express packages on the “Express” site. Not everyone has the luxury of unmetered downloads – some of us want to archive these installers locally, and not use the Web Platform Installer every time.

To save you the bother, here is my reimagining of the table on the SQL Express downloads page:

Server 2008 Express

Management Tools

Runtime

Runtime with Management Tools

Runtime with Advanced Services

SQL Server Management Database Engine

-

Download Now Download Now Download Now
SQL Server Management Studio Express Download Now

-

Download Now Download Now
Full-Text Search

-

-

-

Download Now
Reporting Services

-

-

-

Download Now
Includes SP1 No Yes No No
Download Size 38.5 168 MB 82.5 MB 230.4 MB 546.5 MB
Cost FREE FREE FREE FREE
Install Direct download button for SQL 2008 Management Tools Direct download button for SQL 2008 Runtime Direct download button for SQL 2008 Runtime with Management Tools Direct download button for SQL 2008 Runtime with Advanced Services

I am a bit confused how they came up with 38.5 MB for the SQL Management Studio download… if you check the direct download link you will see its 168 MB. This seems to tally up more closely with the combined “runtime with management tools” download of 230.4 MB. If they have managed to fit SSMSE into 38.5 MB then I am curious why I can’t find the direct download link – Leave a comment if you know the story behind that.

I have one more comment about SQL Express, but it’s so important I’ve decided to write it as separate blog post in the hope it makes it easier for people/google to find. The post is about whether the various SQL Express downloads include Service Pack 1.

Windows 7 ISO: How to easily switch edition

There have been quite a few blog posts about how to manually switch edition of the Windows 7 ISO, for example to change from Ultimate to Home Premium.

What I wanted was a program that automated all the steps. I was going to write one myself, but thankfully someone has already released a tool to do just that. The guy responsible is Kai Liu and in fact he has two programs:

  • One to turn your ISO into an “All editions” ISO, just like the RC used to work (eicfg_removal_utility)
  • One to switch ISO editions which results in a “bit perfect” rendition of the original MSDN ISOs, verified against the MSDN hash codes (windows7_iso_image_edition_switcher)

You can download them both here: http://code.kliu.org/misc/win7utils/

Kai Liu's Windows 7 ISO Patcher Utils

Here is the original neowin post where he talk about the utilities. For the untrustworthy, both of these utilities come bundled with the source code so you can see exactly what they are doing.

Notes: Both these utilities modify the ISO files in-place (so you don’t need to worry about multiple GB file copies).

One potential draw back is both programs use dialogs to select the ISOs so you won’t be able to automate use of these utilities in a script very easily.

As is often the case it can be hard to find the “original” (trustworthy) executables for utilities like this as they get shared widely, copied, and referenced on random forums. Hence after a bit of research I wanted to do my bit to add Google juice to the genuine “Windows 7 ISO Edition Patching/Switching” article.

Tip for pathping

This lesser known command line utility, introduced on Windows 2000, is something of a hybrid between ping and tracert.

Instead of just determining the path, pathping also sends a barrage of pings to each host along the route. After pathping completes (which can take 5 minutes) it generates statistics for failed pings at each node making it easy to indentify hosts in the route where packet loss is occurring. It also shows averaged round trip times (RTT) to each node, allowing you to identify slow hops, and visualize a packet’s journey.

If you are anything like me though, you may never have paid close attention to pathping’s (somewhat confusing) output…

image

If you look carefully (ok, not that carefully – I’ve circled the section in red) you will see the ASCII art bars “connecting” each host. What’s interesting is pathping shows you both the packet loss between yourself and the host, as well as packet loss on the links between hosts (the bars). As you can see in the screen shot above its perfectly possible to have a host (telstra310) that is not directly reachable, yet is perfectly able to forward on packets. There is an example in the the full pathping documentation that describes such a result like this:

The routers [snip] are dropping packets addressed to them, but this loss does not affect their ability to forward traffic that is not addressed to them.

One thing I still haven’t figured out is what the value in the “This Node/Link” means in a row that has a “Source to Here” entry. I am assuming it means routed packets that entered the host but never left. Answers on a postcard.