Monday, 19 September 2011

Toys and frustrations

We live in such wondrous times when it comes to toys! I'm not only talking about prefabricated toys like touch sensitive cardboard electric guitars, affordable remote controllable helicopters that avoid walls and are meant for inside-the-house use or not-really-that-intelligent robots. I'm talking about web servers no larger than a deck of cards -- both wired and wireless (and the wireless one is more like the size of a credit card) -- stamp size microcontrollers that can speak with servos, LCD displays, lasers, motion sensors and RFID readers. These are the kind of toys that really drive me wild.

As these kind of wonderful microcontrollers with their peripherials have become both available and affordable, i've bought some of 'em to tinker with. My latest purchase is the Nanode, which is an Arduino clone with wired Ethernet built in. It's cheap, made by hackers (=enthusiasts, makers) and was delivered by mail as a bag of discrete components and a little slip of paper with an URL to the web page which has instructions on how to build the little bugger.

So i soldered. I bought magnifying glasses (yes, plus-glasses --- i'm now officially getting old) and that soldering station i've been drooling about for so long. And it was wonderful! I assume the first builders of the first Altair and Apple computers must have felt a little like this (though i freely admit that they were truly hard core, whereas i was trodding tested ground). And you can't believe my exhilaration when i managed to flash the Nanode with a DHCP test program and got the signs of life over serial that the device was really working and that it had received an IP address from my router. That, my friends, is confirmation of existence!

It hasn't been all roses of course. My current sorrow is that the Nanode i have doesn't want to co-operate with the FTDI breakout board i got from eBay.

And there are plenty of challenges in the past. I bought a Web server module from Dangerous Prototypes (love the name!). The first one had a bug in the hardware and i felt fairly stupid for quite a while since i really had no way of knowing if it was me being incapable -- a valid guess -- or the device being faulty. Ian, the very nice dude behind DP helped me get the device fixed and returned at no extra cost. I've bought a small wireless web server prototype from Sure electronics, but the only thing you can do with it is flash a LED and check its ambient temperature. They're not very explicit about it, but it seems like you should be able to reflash the hardware yourself, if i could only get the source code from somewhere. And i got the Texas Instruments wrist-mountable computer Chronos because it was on sale, but i haven't got around to coding it yet.

But hey, i'll get something working because boy, these toys are fun!

Tuesday, 30 August 2011

How not to stop your email flow when leaving your network service provider in anger

True story ahead. A customer of ours decided to leave their current network service provider. They were, let's say substantially unhappy with their service.

Now from the customer's point of view, the network service company was their "web hotel". Unfortunately, when the customer terminated their contract with network service company, they unwittingly also terminated their domain hosting service, leaving their DNS records in limbo and effectively stopping all incoming email, since the email had no idea where it should be delivered. It's like taking the name plate away from your mailbox. The mailbox still exists, but the mailman has no idea which one is yours.

Our customer has had little success in contacting their old service provider who are in no hurry servicing an angry ex-customer of theirs.

Lessons to learn:

  • Look before you leap. If you aren't 100% of what the leap means, consult someone who does.
  • If you are a network service provider, be cool and do provide service even to disgruntled ex-customers. They might tell their peers to stay clear of you, and in best case, they might even come back.
  • Don't do anything in anger.

 

Friday, 27 May 2011

Oops! Didn't mean to send that!

Have you been in the situation where you sent an email and then immediately went (in cinematographic drama slow motion) "Nooooooooo...! I did not mean to send that!"? I'm sure you have. I have.

If you use Gmail, there's a wonderful setting, Enable Undo Send. Set it to ten or twenty seconds, which will leave the message in the outbox instead of delivering it rightaway. Ten-ish seconds should be enough for you to get the oh-no -reaction and press Z to effectively unsend your message.

There's a similar trick for Microsoft Outlook. Create a Rule. Start with a blank rule applied when messages are sent (last on the list). Check no conditions unless you really want to tweak things. Defer the delivery by one minute (again, the last setting). No exceptions necessary (unless, again, you really want to tweak things). Give your rule a nifty name ("Delay sending by one minute") and that's it!

Outlook has a feature to "Recall a message". What it in all practice does is send a second message to the original recipient telling that you wanted to recall the message. That if anything would make the recipient want to go wow, what's he written now?. The funny thing is that your Outlook will just look smug and say that it's recalled the message (or at least attempted to). Oh yeah. Or you can buy an Exchange module to have the server delay the message deliveries, but all in all this is the cheaper option :)

Tuesday, 15 March 2011

Moving the Windows task bar between displays

At work, i have a rather nice 24" Samsung display as my main viewer, to the left of which stands my laptop. Since i do some full screen remote desktop work from time to time, i decided that maybe it's better to have the task bar on the laptop screen even if it's father from my focus and my pointer (see Fitt's law).

There are three ways you could move the task bar to the Other display.

The way that does not work - Right click the task bar and choose Properties. Click and ogle foolishly. While you can choose where on the display the Task bar will reside, there is no way to instruct Windows on which display to put it.

The cumbersome way - The really nonintuitive way would be to right-click the desktop, choose Screen Resolution (no, not Personalize, though you can get to the Screen Resolution display by clicking the Display link on the Personalization page :). Then click the relevant display and tick Make this my main display. Click OK.

The direct interaction way - Right-click your task bar and uncheck Lock the taskbar (it probably is, and should be checked). Drag it to the other display. Right-click it again and Lock the task bar. Nifty, though as a side effect, this will make your display with the task bar your main display. Not that i know what that means, but that's how the cards roll.

Friday, 11 March 2011

Email address policy firstname@domain with Exchange and PowerShell

If you don't know of Exchange (2010) E-mail Address policies, you should. If all your company's people should have an address firstname.lastname@somedomain.com and a secondary address firstname.lastname@somedomain.net and then suddenly a new address firstname@somedomain.com -- you need E-Mail Address Policies.

Not only that, but you also need PowerShell, since the Exchange console Email Address Policy editor does not support arbitrary email address templates. One address template it can't handle is just that, firstname@anywhere, for which you need Powershell.

Fire up your Exchange Management Shell and enter something along this line:

Set-EmailAddressPolicy -Identity 'Default Policy' -EnabledPrimaryAddressTemplate "smtp:%g.%s@somedomain.com" -EnabledEmailAddressTemplates "smtp:%g.%s@somedomain.net", "smtp:%g@somedomain.com"

That last bit was the magic one. Substitute the 'Default Policy' to whatever policy you're editing and the somedomain.com to suite your organization.

Saturday, 5 March 2011

The spontaneously disappearing printer

In retrospect, it's all very obvious, like most things technical are. I got a case from a customer's site saying that every once in a while, they became unable to print anything and they needed to restart the printer to get output on paper. Needless to say, they were pretty annoyed about the situation. But with that information, it could have been pretty much anything. 

I called the site and asked for some details. The site in question is a small store with just a few computers and two printers. They said the problematic printer was a Brother and they use it from all the computers in the shop. I took a remote connection to their site and found through some iteration the computer providing the print queue. The shared printer turned out to be a network printer (as indicated by the Ports thing on the printer queue) so i did three things: 

  1. i started digging through any Windows event logs for errors (but couldn't find any),
  2. i had a look at the web UI of the printer, and
  3. i started a continuous stream of pings (ping -t) to the printer

There was one thing i didn't realize to do which i'll tell you in a while.

The UI was horrible to look at and had a copyright 2006 text on it. The network configuration (and other "dangerous") bits were protected by a password.

Suddenly the printer's web UI became unavailable. I looked at the ping thing but the address kept on answering. I thought that maybe the printer had faulty firmware and a flash would be in order. There was however something strange with the pings. The TTL value had suddenly changed. I checked out the ARP tables (arp -g) for the printer, flushed the ARP tables, and checked again. This could only mean one thing. There were two devices on the network with the same IP address.

The thing i had left out earlier was to check the ARP tables before i started pinging. I would then have had a MAC address for the printer as it still was available.

I called the store and asked them what networked stuff they really had there. It turned out that their credit card reader is on the LAN as well. A-ha! So keeping the ping -t up, i asked them to power off the printer -- the pings stayed up -- then unplug the credit card reader. Plop. Connections time out. Ask to power up printer. Ping response. Flush and check ARP table. And indeed, i now had two MAC addresses for that IP address. Plug in credit card terminal. TTL changes. Flush and check ARP. And the MAC address has changed. 

Target acquired. Cause confirmed.

Since i had no access to the credit card terminal, the only solution would be to change the IP address of the printer. Ping to find an unused address on the LAN. Google for the standard password of said printer (and sigh with relief that it was valid). Change the IP address of the printer. Change the IP address for the print queue's Port. Test print from all computers. Phew. Mission accomplished.

So what can be learned here? Static IP addresses are bad. DHCP is good. And documenting your network is even better. Had the TTL value not changed when the pings started to go to the credit card terminal, the debugging would have taken even longer.

Needless to say, the shop's boss was very happy (and i hope he mentions it to my boss :). On Monday i shall have a look at another similar store where they have a spontaneously disappearing server...