Windows Batch File Echo empty line

I rarely have to do anything windows batch files, but just sometimes I get the short straw or it’s the quick way around something.

It’s nice to be able to output something reasonably readable to the tracking file, and echoing an empty line can make things easier to parse with-my-eyes. Echo with a following special char (select your own!) does the job.

date /T
time /T
echo doing something…
echo done

echo. also works. echo? and echo either of the slashes are dubious.

Thanks to macropas on stackoverflow for that one.

MongoDb: Drop a Collection With runCommand

Stupidly I managed to create a collection with a space in the name. In the interactive shell various escape chars and quotes using the “db.CollectionName.drop()” solution failed to work. Since I created the blasted thing with a runCommand, I can fix it with a runCommand:

> db.runCommand( { drop : "my output" } );
"nIndexesWas" : 1,
"msg" : "indexes dropped for collection",
"ns" : " output",
"ok" : 1

Show hidden files in OSX

I hate not being able to see my hidden files in Finder. Why it hasn’t got a selector I don’t know. Still working on moving it to Linux Mint 🙂

I’m running OSX 10.6.8 (not Lion yet).

Anyway enter the line below into Terminal:
defaults write AppleShowAllFiles YES

Then hit ALT-right-click on Finder logo in the bar and select Relaunch. Job done.

Update 01-Feb-12 Missed my refs! A big thank you to

Is Your Windows 32 or 64 bit?

As a developer and consultant I often need to know which version of an OS I’m on and whether it’s 32 or 64 bit. In *nix it’s trivial (uname -mrs).

But how do you find out whether Windows is 32 or 64 bit when your client’s friendly neighbourhood infrastructure and desktop team have blocked users from My Computer properties? I was surprised (again) today that systeminfo doesn’t carry this crucial information, at least, not where I could see it.

windows key + R and type dxdiag, hit return. The line Operating System tells you whether 32 or 64 bit.

TBH, I’d prefer if there was a CLI command that told me.

Parking Pillocks

I’ve just got a parking fine through the post for alleged illegal parking on Christmas Eve. I racked my brains to think where I could have done it, and concluded they, Vinci Park Services UK Ltd, must have got me with a tyre outside a bay or something.

Anyway, read the whole first page, and it appeared Vinci had videoed me from a parking enforcement car. Well, I was a bit worked up about that. “What’s wrong with a traffic warden?” I mused (shouted). “Why is this country intent on divorcing it’s law enforcement from the governed with faceless, privatised CCTV operators grabbing images and running?” I fulminated. “How can we expect our children to grow up courageous in the face of jobs-worthian bureaucracy if the jobs-worths are faceless and undetectable?” I reflected. “I haven’t compared them to Nazis yet, but I’m sure there’s a hook in there somewhere.” I reductioed ad Hitlerumed.

I read they require £70, reduced to £35 quid if I pay up quickly and quietly, increasing to £105 if I make a fuss.

TBH, by this point I’m apoplectic with rage. I have to go to their offices in Dunstable, a good 45 mins to an hour away, without parking included, to view the video, and I have to make an appointment. Being rather annoyed I’m also assuming that the appointment will be suitably close enough to the 21 day limit to ensure I have to pay the whole whack, not the reduced charge if I am proved to have parked incorrectly.

Anyway, so I turn the page and the picture I see… well. Hum. Not a tyre over a line, not badly parked, no, “parking” is accurate. In fact, with a quick glance at the picture, my 3 year old asked “Where you driving truck Daddy?” “Driving” he said, not “parked”, driving. As in moving, on a public road, with an open parking space infront of the truck in the picture. As in “Bugger off you bunch of chancers! Your assessment that this is restricted parking proves that you cannot even differentiate between a parking car and a parked car. You even have a video, allegedly, showing the parking manoeuvring. You have been outperformed in your chosen specialisation by a 3-year old who still says ‘cock’ instead of ‘sock’.”

I have no doubt the system is rigged to ensure people go “Oh sod it, pay the 35 quid, it’s not worth the hassle”. In fact, that’s what J said before she saw the picture.

I’m bloody annoyed.

I’m not paying their fine. I’m contesting it as far they decide they want to go. I am in the happy position, currently, of being able to afford to. If I, and people in the same financial position, don’t test these bloody idiots, then it impacts justice for people who have to look at the same situation and decide to pay the £35 because they can’t afford to risk having to pay the £70 or £105, or can’t afford the time off work, or the petrol and parking, to get to Dunstable to face-up to these leeches. It’s allowing corporates and the rich to afford justice, while the poor have to pay up or get screwed.

Ohhhh, I feel all “System of a Down”. Bar stewards.

Need Linux With Occasional MS Office?

My father is a Linux Mint convert over the last three years, and has been running Linux Mint 9 since 2009. Unfortunately he has to use MS Office for some work things, including writing and running macros, so he can’t can’t get away from it completely (it’s for state schools usually, so it should be available in some open format, but I digress). He loathes having to select to boot windows in grub.

Anyway, recently Windows has creaked to (even more of) a crawl on his old tosh satellite, probably infected with something horrible because he rarely boots it and something got in between AVG and Spybot updates. OpenOffice on Mint 9 is getting long in the tooth. He asked me if I could think of another way around the problem that could allow him to be able to get in and out of Windows quickly, cut and paste between Windows and Linux quickly, have a better OpenOffice version and not have to worry much about the infections.

Various solutions were discussed, researched, and discarded. Some of them were:

  • Wine – MS Office is not too clever in any of the bottles yet
  • Crossover office – ditto
  • Full reinstall of Windows XP then Office 2010, then upgrade Linux Mint to 11 – going to be in same situation in x months time when XP grinds to a halt again

After a moment of clarity, we went with: upgrade to Linux Mint 11, install VirtualBox OSE, create a Windows XP VM with Office and take a snapshot, turn off networking on the VM, share a folder on the Linux box with the windows VM, and have Virus monitoring on the Linux box.

This solution gives us the fast switching between OSes; cut and paste (with the VirtualBox add-ins); the latest LibreOffice; and, when the Windows VM gets infected (pretty sure bet, even with networking turned off), rollback to the clean snapshot. Downsides are having to run an instance of Windows and MS Office. Money and sales target ticks for MS.

Here’s what we had to do. First the prep, which mostly took place before the big meetup. If we’d done all of it before, it would have saved us a couple of hours on the day.

  1. Backup /home
  2. Confirm nothing on the Windows partition needing backing up
  3. Torrent the Mint ISOs and select required version (we checked LXDE and Gnome standard. My father still prefers Gnome so we went with that)
  4. Find the Windows XP Pro install disk that came with your machine originally (you did get one, didn’t you?)
  5. Find the Windows licence code on the bottom or side of your machine
  6. Find your Office DVD and licence code
  7. Download Windows Service Pack 3

For the actual day I went a little further, just to make things more bearable:

  1. Persuade lovely wife to prepare and cook a topside of beef with all trimmings
  2. Get in sufficient wine and cheese for the day of the install

On the day, here’s the actions we went through:

  1. Confirm /home backup is ballpark. du -hs /home; du -hs /media/backupDisk/home
  2. Fire up Linux Mint 11 Live DVD and install Linux Mint 11. We have a diddy 60GB HDD so partitions were:
    • 14GB primary, mount point / – system, etc (too big, but playing for the long haul)
    • 2GB swap – logical, at end of disk
    • Rest logical (44GB-ish), mount point /home
  3. Restore /home from the backup.
  4. In Software Manager install
    • VirtualBox OSE
    • VirtualBox Add-ins ISO image
  5. In VirtualBox:
    1. create a new VM for Windows XP. Give a dynamic growth to 15GB. More than enough, but you have a lot of upgrading and installing to do and nothing is worse than a windows machine with a rammed full system disk
    2. Install Windows XP Pro (don’t even think about XP Home). Hope you have SP2 at least
    3. Install Windows Service Pack 3
    4. Install Windows Updates – there were 64 for us, the 48th was IE 8 and needed questions answering, so don’t walk away
    5. Install MS Office 2010
    6. Flag the network adapter with “cable unplugged”
    7. Start Word and fill in all the author blurb
    8. Mount a shared folder in the linux /home/username/ area (with AV protection on it). Make it permanent mount.
    9. Full screen the VM and take a snapshot
    10. Give yourself a pat on the back (and swing your pants)

    It took a long, long time, most of it getting Windows installed right, but we won’t have to do it again (I don’t think). Mint will look after itself largely, with upgrades being pretty simple now. If windows goes slow, my father can just rollback to the pristine VM image.

    Other things we wanted to do but didn’t have time:

    1. Setup sshd for remote admin access
    2. Setup LVM so we grow the disk space onto a PCMCIA card HDD at some point
    3. Setup dropbox for remote doc backups – need to investigate as last I heard dropbox had been compromised, not sure what resolution was.
    4. Setup Picasa for picture admin and remote backup
    5. Drink Bowmore

operation is now R2 D2 Repair game!