MonitorControls – Utilties for monitor management on Windows

When I ended up using Windows to power the overhead information screens at Last.fm, I lost the ability to have a one line crontab entry that shut the monitors into DPMS standby (and wake them up) when we’re in and out of office hours. Makes no sense wasting power, but more importantly shortening the length of screens having them on when the office is empty.

I didn’t think I would have any issue finding a utility to place the screens in to standby mode. I didn’t; but unfortunately they were either not free, massively complicated or simply didn’t work.

So I found a code snippet online, fired up a copy of Visual Studio and compiled two exe files; MonitorOn.exe and MonitorOff.exe. MonitorOff sends a signal to all attached monitors on the system to go in to sleep mode, and if you move the mouse you can wake them up as normal. Or you can run MonitorOn which will send the signal manually. Simply place these into the Windows Task Scheduler, and you have a simple, effective way to manage your information screens.

You can download MonitorOn and MonitorOff here.

Leaving Last.fm

I’ve spent 3.43 years at Last.fm, which seems almost like a lifetime. For a long time, I couldn’t ever imagine leaving; every morning I would wake up excited to go and face new challenges and do fascinating new things. In the last 6-12 months so much has changed, as Last.fm gradually slips out of being a startup to being a company that, for better or for worse, has to make some money. I will certainly think twice before working for a company that has anything to do with the music industry… it’s a pain of a situation.

I’ve babysat the wonderful creation that is Last.fm through launches (both expected and unexpected), crashes (always unexpected), overheatings (and break-ins, and power failures… All the kind of thing that should never happen to a datacentre) and plenty of blood, sweat and tears.

It’s been an amazing experience, working with some of the most amazing people I have ever met (some of which have come and gone), but it’s time for me to help another startup through getting up at 4am to fix databases and exciting scaling questions.

And that will be Etsy; another website that has an awesome product that I love, plenty of traffic and graphs that point upwards and a bunch of guys who are passionate and have an awesome method of working. I’m really excited about getting involved and learning things again, as well as enabling a different group of passionate users go about their day to day business. I’ll still be in London, but popping to NY on occasion.

Let’s hope the next 3.43 years will be just as exciting.

Fixing Android 2.2 Sync after Upgrading to Exchange 2010 SP1

Last night I upgraded my Exchange 2010 server to 2010 SP1. Unlike many other people’s experiences, this actually went rather smoothly, until I realised 2 hours later my T-Mobile G1 (aka HTC Dream) is no longer syncing my Email. I currently use Cyanogen’s Mod version 6 which brings the features of Android 2.2 aka Froyo to my poor ancient device (which I’m hanging on to because of the excellent keyboard!) and use the built-in Exchange ActiveSync (EAS) support to sync my email, contacts and calendar to my phone.

I read online about a few other people running Android 2.2 who had the same issue and some suggested it was a policy problem, so I deleted the default profile and recreated it, and deleted the device association on my phone and my account. Unfortunately this didn’t work either, leaving me with no email but more importantly, no contacts!

After enabling some extra logging on the server I could see it was unhappy about Android trying to get a folder sync without provisioning, but for some reason the device wasn’t attempting to apply the policy.

AccessState :
Blocked
AccessStateReason :
Policy
ResponseHeader :
HTTP/1.1 449 Retry after sending a PROVISION command
MS-Server-ActiveSync: 14.1

Curiously, enabling extra logging on the device just showed it successfully understanding the first OPTIONS request, then timing out.


[12:36:00] EAS SyncManager | !!! EAS SyncManager, onCreate
[12:36:00] AbstractSyncService | Testing EAS: example.contoso.com, domain\user, ssl=1
[12:36:14] AbstractSyncService | Validation (OPTIONS) response: 200
[12:36:14] AbstractSyncService | Server supports versions: 2.0,2.1,2.5,12.0,12.1,14.0,14.1
[12:36:14] AbstractSyncService | Try folder sync
[12:36:35] AbstractSyncService | IOException caught: Read timed out
[12:36:35] EAS SyncManager | !!! Eas SyncManager, onDestroy

Thinking I was going to have to apply my highly dubious Java programming skills to this solution, I downloaded the Android SDK and started up the emulator for 2.2. I attempted to set up my account on the emulator, and to my surprise it worked first time.

I can only imagine, Google have already patched up this issue and not yet released it, as the Android Open Source Project page for Mail.apk shows the last update 5 months ago. So I applied the best logic that I have as a Sysadmin… Scp the working Email.apk from the emulator to my server, and install it on my device. And it works! I lose the a few additions that have been made to the CyanogensMod version of Email.apk but I’d rather have it working.

If you’re experiencing this issue too and you want to apply my brute force method of fixing it and get your email syncing again, simply follow these instructions (you need root for this, but I suspect this is only a problem on modified builds):

  1. Download the 2.2 stock Email.apk from here using the Android browser. Don’t attempt to install it, let it go in to your download folder on your SD card.
  2. Open a terminal on your device. I use ConnectBot. Gain root using “su”
  3. Run: mount -o remount,rw /system
  4. Run: mv /system/app/Email.apk /sdcard/backup_Email.apk
  5. Run: cp /sdcard/download/Email.apk /system/app
  6. Reboot for good measure
  7. Set up your sync, and enjoy a refreshing beverage
    for your hard work

Disclaimer: I have no idea if this has any bad affects on your phone, your sex life, or anything and I make no guarantees about anything. If anything bad happens, it’s not my fault, you do this at your own risk! The process above makes a backup, so hopefully if you regret this you can put back the old version.

Draytek 2710 series and multi WAN IP

I recently purchased a Draytek Vigor 2710n router to replace my aging 2600plus. I’ve always had a very high opinion of Draytek routers. They’re fairly expensive compared to most home routers, but they do have a bucketload of fairly advanced features, that I was disappointed were lacking in others.

I changed ISP at the same time as getting the new router, taking out service with the (so far) brilliant Zen Internet after recommendations from colleagues especially Caitlin who used to work there before joining us at Last.fm. They’re a proper Sysadmin’s ISP, giving you a netblock of 8 IPs on a pretty inexpensive home connection.

Unfortunately for me I (foolishly) didn’t check to see whether the 2710n still supported this, since my 2600 did and I just assumed a higher model number meant it was actually an upgrade rather than a downgrade.

After a quick chat to Draytek support they told me this indeed was not available and never would be. I contemplated giving up with the 2710n and returning it, or just using it as a WAP, but I was somewhat peeved when I looked in the HTML and noticed the only reason the button was missing (the interface has hardly changed in the 5 years between the models) was because it was hidden using CSS:

<input type="button" name="btnWIpAlias" id="wIpAlias" style="display: none;" value="WAN IP Alias" onclick="wanIpAlias()">

Using Firebug, you can easily show this button and it’s functions work fine. I decided to do some more digging.

The Draytek have an excellent Telnet (and now SSH) interface too, and the functions are entirely available there:
admin> ip aux ?
%% ip aux add [IP] [Join to NAT Pool]
%% ip aux remove [Index]
%% Where IP = Auxiliary WAN IP Address.
%% Join to NAT Pool = 0 or 1.
%% Index = The Index number of table.
Now auxiliary WAN1 IP Address table:
Index no. Status IP address NAT IP pool
----------------------------------------------------
1 Enable X.X.X.110 Yes
2 Enable X.X.X.105 No
3 Enable X.X.X.106 No
4 Enable X.X.X.107 No
5 Enable X.X.X.108 No
6 Enable X.X.X.109 No

Sorted! The IPs then appear in the relevant places in the web interface too, for example in the “open ports” or “DMZ” sections. If IP routing is what you’re after (used to be called “For IP Routing Usage”) simply use the “ip 2ndaddr” command.

If you like configuration via the web interface, that’s pretty simple to enable too. Grab Firebug for Firefox, and use the “DOM” tab to display all the variables used on the current page.

Firebug DOM console
Firebug DOM console

There are tonnes of variables in here, many are set to “0”. Incredibly, all these functions do is tell the web interface to display extra features. They’re all there and available in the background, from static routing to Multi-Nat, to IP routing and extra VPN settings. You can even enable the WAN, Wizard and VoIP options if you really want to.

For Multi-NAT, double click on SHOW_INT_MULTINAT and set it to 1. For 2nd subnet IP routing, find SHOW_LAN_GEN_2NDSUBNET and set it to 1. Have a search through and enable the functions are need. By the way, this only lasts for as long as you’re logged in, so you’ll have to repeat it if you ever need to change the variables.

Before:

Before

After:

After

I will note that you should probably buy the 2820 as suggested by Draytek if you really want these features.. It’s only £40 more expensive, but saves you a bit of hassle. This guide is only for people who have been mislead and don’t want to send their routers back!

Firefox 3.6 Tab Opening Behaviour

I just updated to Firefox 3.6, yay! It took me approx. 30 seconds before I wanted to stab myself because they’ve made the default tab opening behaviour so that when you middle click a link it opens in the tab next to the tab you’re viewing, rather than at the end of the tab bar.

This probably pleases a lot of people.. I know people with extensions to do that. But it drives me crazy. I know my new tabs are supposed to be at the end, because all my tabs are in a certain order, and most of them I never close…

Anyway, if you want your Firefox 3.6 tab opening behaviour to be the same as Firefox 3.5, do this:

  • Type about:config in the address bar
  • Close the warning about screwing up your install
  • Search for “browser.tabs.insertRelatedAfterCurrent”
  • Double click it to change it to “false”.

Voila! Your tabs are back to normal. No need to even restart.

Dell 5530 HSPA Mobile Broadband Card with Windows 7 64bit

If you have a Dell E4300, as wonderful as they are, you may have trouble sourcing a 64bit driver for Windows 7. It’s not listed on the drivers page on the Dell site (as of writing), nor is there even a 64bit Vista driver.

So, to google! (which is probably why you’re here after all) and there are a few suggestions of installing the 32bit driver and Dell Connection Manager. I was fully expecting to have some 3rd party software to at least connect to the network, but I wasn’t sure about the 32bit driver, so I continued on my Googling. And it bought me to a page hidden deep in the URL structure of the Dell support website. This link here! A 64bit 5530 HSPA Mobile Broadband driver for Windows 7.

It’s just listed a driver, so I thought it was a good starting point, so let’s install it. What happened next was pleasantly surprised. Firstly, it found a GPS port. Does this card also contain a GPS receiver? I haven’t managed to make it work yet, but that would be super cool… The best surprised was what happened when I clicked on the Windows 7 “Connect to” system tray icon.

Windows 7 Connect To Dialog
Windows 7 Connect To Dialog

What’s this?! I didn’t even have to tell it I’m on T-mobile, it just popped up and showed me the signal, and let me connect. No config, worked first time. From installing the driver to connected to WWAN in under 30 seconds.

Perhaps I’m easily surprised, but I think this is one of my favourite features of Windows 7 so far; it’s so nice that it’s consistent, as well as the improved UI for the “connect to” menu in general. It makes the utility for managing mobile broadband I used in Vista look like a childs toy…

That was easy 🙂

Stop Vista Waking Up (and me up!) in the middle of the night

This has been driving me insane for a while. I thought it was MCE. I swore at MCE every time my computer buzzed into life in my room. It’s not very quiet, and it can do it so stealthily… It’ll turn itself back off so most mornings I won’t even realise it’s done it.

I only caught on because sometimes I catch it in its dirty act, and last night it actually managed to cause a BSOD so wehn I came to turn it on it had actually shut itself down, sigh.

I decided to investigate again and found this handy tip hidden away on a blog type thing:

It’s Windows Update. That sneaky little bugger. Especially useless since the wakeup event in the event viewer is handily marked as being caused by… “Unknown”. To stop this:

It is possible to disable this behavior in the group policy editor (run gpedit.msc). It’s under: Computer Configuration | Administrative Templates | Windows Components | Windows Update and the setting is called: “Enabling Windows Update Power Management to automatically wake up the system to install scheduled updates.”

I will let you know if this doesn’t fix my problem but I’m looking forward to not being woken up tonight…

EDIT: Yeah, it didn’t work. I actually caught it one night, turned the screen on just in time to see “Configuring Updates…” and then “Shutting down” at which point it turned off my machine! Funny considering the day before I’d turned off updates completly AND stopped and disabled the Windows Update service.

Last night i decided to install some updates, to see if that fixed it; after 2 hours of waiting, some installed, most failed, and it still woke up at 5am despite me turning updates back off again.

Anyone have any clues?!

EDIT 2: I’ve found a workaround, see this post: http://laurie.denness.net/blog/?p=59