Wednesday, July 8, 2009

If You Have To Run Windows

If you have been spoiled by the developer heaven that is a well running Linux machine and you have to run windoze, this is what I’ve found that begins to almost make it bearable.

  • You must first open file explorer (windows-e) and do Tools->Folder Options->View and then check, “Display the contents of system folders,” and uncheck, “Hide extensions for known file types.” Also, View->Details is recommended.
  • Right-click on the question mark down near the bottom-right of your screen, left of the clock and all the icons (in the Taskbar), and chose “Hide the language bar” (or whatever the annoying thing is).
  • Right-click on the Taskbar itself and check “Show Quick Launch” and uncheck “Hide inactive icons”
  • On any command windows (cmd.exe, cygwin, etc.), fix the font. Click on the icon in the upper-left corner of the window and choose “Properties.” Click on the “Font” tab, and choose “Lucida Console.” You can make the window bigger with the “Layout” tab too, if you need.
  • Get a nice desktop background image
  • swap caps and ctrl. Scroll down a bit to find the registry script. And acutally, if you just make caps a ctrl, and leave ctrl as ctrl, other people that sit down at your machine won’t be so confused.

Now, install the following programs (and don’t allow any of them add an icon to your desktop, a Quick Launch icon is OK if you really use it a lot):

  • Firefox
  • txmouse.exe. Gives you X11-like copy-n-paste (even in cmd.exe windows) and focus-follows-mouse.
  • emacs w32. I went with the patched version this time, but I’ve used unpatched in the past haven’t noticed a big difference.
  • gimp
  • pidgin
  • VirtuaWin
  • cygwin. Select lots of goodies like gcc and openssh and whatever else your fingers type without thinking when you are at a command-line.
  • gnuwin32. Sometimes you end up at a command-line other than cygwin’s and your fingers still type things like ls, which, less, grep, and so forth. That’s what these are for.
  • locate32—fast file finder.
  • git for windows—if you need some solid open source revision control.
  • Console2. This is much nicer than the basic cmd.exe. You can resize it! It does transparency! and tabs! The neat trick is that you can make different types of tabs that each run their own shell, such as c:\cygwin\Cygwin.bat, or the git-bash shell. After you have made your tabs, create multiple shortcuts to start console 2, each specifying a different tab to start with using the -t option. You can give them the cygwin and git-bash icons to really polish things up.

And because I have Linux machines that my windoze machines must talk with:

  • winscp
  • putty. Not just for ssh, but for telnet (handy for embedded development), and works as a serial terminal too.
  • xming

For embedded software development:

  • pumpkin—hilarious looking and sounding, but functional, tftp server
  • Terra Term. For when putty doesn’t quite cut it as a serial terminal, and yes, the latest version is from 1998. That worried me also.

Wednesday, June 17, 2009

Large Hidden Files

I'm working on another backup script. I admit it had been over a year since I had backed up my home hard drive. In that time, the stuff my old script had been backing up from my home directory got a lot bigger. Why? I found a couple obvious culprits that I should have seen right away, but then it was less obvious. Running du | sort -rn is always insightful when this problem comes up, and I found that I had a .local directory that was 2.3 GB in size and a .cache that was almost 1 GB. Ouch. Looks related to tracker. The other biggie that I had totally missed was that I had played around with VirtualBox, and it stores its hard drive images in the hidden .VirtualBox directory. What is with these programs stashing huge amounts of data in hidden directories? In the case of VirtalBox, it could be very important data. Is that smart to hide it from the users like that? I don't like it.

Thursday, June 11, 2009

Playing With Dar

I'm playing with backups again. Most recently, I'm looking at dar. Some quick notes:

To backup just /etc, become root, make sure your pwd is /, and type this:

dar -v -c /path/to/etc-backup -g etc
This will create a file named etc-backup1.dar at the path you specified. The -v is optional. To do the same but encrypt the archive do this:
dar -K passphrase -v -c /path/to/etc-backup -g etc
Where "passphrase" is your sneaky passphrase. To list the contents of the archive:
dar -K passphrase -l /path/to/etc-backup
Of course, you leave out the -K passphrase if you didn't encrypt it in the first place. Notice that you don't give it the full filename, ever. Getting more advance, to write the backup to a file on a remote machine over ssh, do this:
dar -c - -g etc | ssh user@host dd of=/path/to/etc-backup.1.dar
You tell dar that the backup file is stdout, pipe that to ssh, and use dd on the remote side to put the backup into the file. Note that you need to give the resulting file a proper dar filename since you don't have dar on the remote side doing it for you. Not a bad little tool.

Monday, May 18, 2009

Early Thoughts on Developing for Windows

I didn't completely escape the clutches of Microsoft when I found my new job. This new place does some development for windows CE, it turns out. I've been struggling through some build issues with some code for the last couple days, and my early impression of developing for windows are not good. I'll admit possibly a little bias, but I'm really trying to keep an open mind. Really.

First of all, the command-line tools are severely lacking in Windows. My mentor here is showing me all kinds of command-line tricks to get stuff done, which I really appreciate, but cmd.exe is awful, copy-n-paste is weird, you can't resize the window by dragging the edge. Useful commands like which, grep, find, just don't exist. Agony. I know about cygwin, but I've never been able to integrate that well with the rest of windoze, and especially not with Visual Studio.

My second complaint is online help. MSDN appears to be quite voluminous, and somewhat helpful actually, but if you run into something that's not in there, all you can find are forum threads where developers make uninformed suggestions to each other and sometimes they happen to find something that works. It's not their fault, the source code for all their tools is secret, so it's really hard to know exactly why the build tools do what they do or the compiler says what it says. The open source folks theoretically can find out exactly why a tool is behaving weird, and with enough people on the internet you can usually find someone who has the correct explanation for the exact wonky behavior you are seeing. Not always a fix, but at least an intelligent explanation that is much more convincing than, "I don't know, have you tried service pack 2?"

OK, back to having a good attitude and plowing ahead.

Thursday, May 14, 2009

Ubuntu 9.04 + X11 forwarding + Windows XP + Putty + XMing

Wow, I sure thought this was a longshot when I went searching for an obscure problem I was having. Strangely enough, someone else using putty and Xming to run X11 applications from a Jaunty machine also got the error message:

PuTTY X11 proxy: wrong authentication protocol attemptedError: Can't open display: localhost:10.0

And their fix worked for me too. Thanks, timkoop on the Ubuntu Forums!