Sharing files from a Windows 7 box to an XP

Microsoft has created a rather nifty option to share resources in a server-less environment (eg a "home" or just a small office), called HomeGroup sharing. It works in Windows 7 and somehow magically builds on IPv6.

But HomeGroup sharing isn't available on XP, so you'll have to take the traditional road of right-clicking the folder you want to share, choosing Advanced sharing and setting the security bits just right (eg Share security: write for Everybody, full control for Administrators; File security: as tight as you need).

But sometimes that's not enough.

At a client with a mixed machine environment, suddenly they couldn't get to a file share residing on a Windows 7 box when coming from an XP box. I got system error 58 (or was is system error 85?). Windows croaked. I tried firewall settings, tried user rights, tried whether the fact that they'd connected to another file share on another XP box.

While i did a whole bunch of seemingly arbitrary fixing moves, after doing the following, things started happening again.

  • Start the local security policy editor, secpol.msc
  • Go to Local Policies > Security Options
  • Scroll down to Network Security: LAN Manager authentication level
  • Change the setting from "Send NTLMv2 response only" to "Send LM & NTLM - use NTLMv2 session security if negotiated"

The reasoning behind this is that Windows 7 and Vista works on a newer and more secure variant of the Lan Manager protocol than XP. You might get similar problem if connecting from a Linux box or a NAS (which very well may be a Linux box) to a Windows 7. Changing this setting starts the discussion using the older version and switches to the more secure one if the two endpoints can agree on that.

Took me several hours to get this right. I hope this will help you make a swifter fix.

Blinking lights on the LAN

The sorry state of my garden lights has taken one pathetic step to the brighter. I can now blink my garden lights over the local network, using a serverized version of the Lua script i wrote earlier to do the same over the command line. Okay, so it's one step better than ssh'ing into the box and entering relay commands over Bash :)

I first thought of learning some more Lua to make the script socket-aware. But then it hit me: Linux has all this built in, into a "super server" called inetd, which i've never actually used before but kinda know of due to its history of security issues. Still, i feel like such a late bloomer for never having used inetd before.

Here's how, if you're one of the inetd virgins. Edit /etc/services and add the name, port and protocol of my service. In my case, i called it relay 11647/tcp. Call update-inetd --add ...and a bunch of arguments separated by the \t character, as one wonky string. Yeah, it's hairy.

I needed to make just one change to the Lua script. Since the script won't read command line arguments anymore -- and i don't know if it's by design or my deficiency -- i had to add if rel == Nil then rel, act = io.read( "*number", "*number" ) end into the code.

Still, now i can say echo 4 1 | nc gardengnome 11647 which is a sure sign about a turn for the better :)

Did this make any sense at all to you?

Ping watchdog with Powershell

We have one unreliable virtual server which sometimes just loses its network connection. Until we have a permanent solution, the temporary fix is to have the computer reboot if it loses network connection.

Note: There is nothing as permanent as a temporary solution. With that warning, let's get to it.

Step 1 - Produce the following Powershell script into c:\bin\pingdog.ps1

$netup = new-object Test-Connection -quiet "goo.gl"
if( $netup -eq $False ) {
  Restart-Computer
}

Step 2 - Fix your security settings

Start Powershell. Enter Set-ExecutionPolicy RemoteSigned or whatever level you're comfortable with that'll still run your script.

Step 3 - Schedule it

If you're using Windows Server 2003 (like we, ungh) schedule a daily task to run %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe c:\bin\pingdog.ps1

From the task's Properties, the Schedule tab, press the Advanced button. Tick Repeat Task, every 12 minutes (or whatever you fancy), and repeat for 24 hours.

If you're using Windows Server 2008 or later, you should be able to set the task to run evey x minutes right from the interface.

Step 4 - Check your logs

Keep an eye on the failing computer's system log to see if it's restarted when you looked away.

It blinks!

A while ago, i bought an Ethernet module from Sure electronics. I wasn't sure what to use it for or if i indeed would be able to use it for anything, but it was cheap and hey, you could connect it to the Ethernet. Can't be all bad :)

Having less than a raving success with controlling my garden lights with a Nanode, i decided i needed a break. And so i googled "Arduino Sure-electronics ethernet", and lo && behold(), up comes a blog post with just what i needed, but just didn't understand to expect: that it's really easy to interface an Arduino with the Ethernet, and that the magic is built on the EtherShield library which i was already using on Nanode.

So i soldered the seven pins needed to have the two devices talk with each other. Wired them together with neat and correctly coloured jumper wires. Copied the code into my editor. Changed the MAC and IP addresses. Verified the code ("It compiles! Ship it!"). Uploaded it to the Arduino board. And it - just - worked!

You can't imagine how excited i was when i was able to open up a web page, served from the Arduino, and was able to toggle a LED on and off over my LAN. I't just so neat! (or if you do know me, you can probably imagine just how excited i was :) I should have taken a picture, or a video!

So my thanks go out to Henrik Denhart who wrote the blog post and to Andrew Lindsay, coder and maintainer of the EtherShield library, and indeed the whole Arduino maker movement who with their enthusiasm and drive for openness make the platform such a wonderful thing it is!

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!

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.

 

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 :)

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.