Raam Dev’s Weblog

Avatar

Look for what you do well, and excel.

HOWTO: Make iTunes Read Ogg Files

After downloading the only available torrent of Hang Drum music I could find, I was shocked to discover that iTunes wouldn’t read the Ogg files it contained. I was so close to losing a ton of respect for Apple until I searched Google for a solution. Hoorah for the xiph.org open-source community!

Simply visit their site and download QuickTime Components binary package. After opening the .dmg file (Windows users should be able to just download and run the .exe file), copy XiphQT.component to ~/Library/Components (user-only) or to /Library/Components (system-wide).

If iTunes is open, restart it and wallah! You’ve got .ogg support in iTunes!

Windows Uptime: 2,386 Hours

Windows Uptime

That’s 99 1/2 days for the Windows 2000 Server located in one of my client’s offices. It’s too bad I had to reboot the server to apply security patches. :(

This still doesn’t beat my best Windows uptime record, which is held by my home PC (and it is used a lot more than the server). Don’t ask me why, but I like keeping best uptime records for all the computers I manage. :)

Another personal best Windows uptime

This screenshot was taken from my office computer, which is running Windows XP SP2 and has been up for 131 days without a reboot. Previously, my home Windows XP computer held the record. If this was a *NIX-based system, I wouldn’t even bother keeping track of the uptime. I’ve had some of my Linux machines running for over 8 months. ;)

rdesktop running inside X11

I’ve been using the Remote Desktop Connection for Mac from Microsoft to connect to my Windows machines on my Mac. I’ve used the open source client rdesktop on Linux machines in the past, but I figured since Microsoft provided a free client I might as well take advantage of every free thing I can get from the company that loves to charge for everything. But then I heard about how the performance of the Microsoft Remote Desktop client on the newer Intel Rosetta Macs was not that great, and that rdesktop worked much better.

So I installed rdesktop using MacPorts (sudo port install rdesktop) which installed rdesktop in /opts/local/bin/. Then I had to start X11 (I already installed X11 from my Mac OS X CD) and using the X11 terminal run rdesktop from the command line to connect to my Windows PC (running open-x11 /opt/local/bin/rdesktop my-server-ip from iTerm did not work). Obviously this was a lot of work to simply open a connection to my Windows server, so I searched for a simple workaround. I found one here. For sake of maintaining a consistent source of information, and because I modified some of the steps, I’ll recreate the steps here:

1) Create ~/my-windows-pc.sh (important difference in this step is the addition of the -K option):


#!/bin/sh
/opt/local/bin/rdesktop -K -f -a 16 my-windows-pc-ip

2) Make the file executable:

chmod +x ~/my-windows-pc.sh

3) Apparently the default xinitrc settings get in the way when running rdesktop full screen, so lets place a copy in our home directory and make some changes to it:

cp /etc/X11/xinit/xinitrc ~/.xinitrc

Edit the file and remove the line that says xterm &

4) Finally, we can do some cool stuff. Lets create a single .app (Mac’s application file) that can do all the work of opening X11 and running our my-windows-pc.sh script. Start by opening the Script Editor (Finder -> Applications -> Apple Script -> Script Editor). You should be presented with an Untitled script editor window (if not, choose File -> New). Type the following into the editor window:

do shell script "open-x11 ~/my-windows-pc.sh &"

Choose File -> Save As. Then change File Format to Application. Type a name to save your application (such as My Windows PC), select a place to save the application (such as your home directory or Desktop), and click Save. Now you should be able to double click on the My Windows PC file to open your Remote Desktop connection.

Full screen issues

The first major difference between this method and using Microsoft’s Remote Desktop client was that I could not press Apple+H to hide the Remote Desktop connection window, and then Apple+Tab to switch back to it, while running Remote Desktop in full screen mode (the -f option in the rdesktop command). Also, in full screen mode the Apple+H shortcut doesn’t work by default. The -K option (keep window manager key bindings) we added to the rdesktop command allows us to still use the Apple key to do things while we’re connected to the Windows PC (including Apple+H), however it doesn’t work the way it’s supposed to! Another huge annoyance is that when running Remote Desktop in full screen mode, its not truly full screen because we still see the Apple Dock and the X11 bar across the top.

The way to fix these problems is by enabling full screen in X11 (X11 -> Preferences -> Output -> Enable the Enter Full Screen menu). Keep in mind, Alt+Apple+A switches between full screen and windowed mode in X11 (in full screen X11 mode, you can’t see the X11 menu bar to get back into the Preferences without changing back into windowed mode!). Also, I can’t remember, but I might have also checked the “Enable keyboard shortcuts under X11″ option. Now, if you start your full screen Remote Desktop connection, it should really look full screen (nothing visible except your Windows PC).

Finally, it would be really nice to be able to switch between the Remote Desktop connection and applications running on the Mac. I currently use Witch as my application switcher, instead of the default application switcher that comes with the Mac (so I can’t tell you if this issue applies if you’re not using Witch (and if you’re not, you should be!)).

To make the X11 application show up in the Witch list, choose System Preferences -> Witch -> Behavior. Then enable the “Show an Activate Item for windowless/hidden applications”. Now when you’re inside a full screen Remote Desktop connection, you can press Apple+H to hide the full screen window, and you should see an “Activate X11″ option in your Witch list, which you can use to switch back to the full screen session. This method also works if you’re using a windowed rdesktop session.

Recovering from CTRL+S in Putty

Every once in awhile, I’ll press CTRL+S by accident while I’m inside a terminal window. For the longest time, this simple accidental keystroke meant I had reconnect to my Linux server, kill whatever program I was running, and then start it again. Eventually I got sick of this happening and decided to do what I should have done in the first place: Google It.

Apparently CTRL-S actually does XOFF, which means the terminal will accept key strokes but won’t show the output of anything. It will appear as if your terminal is dead when it’s really just waiting to be turned back on. The fix? Simply press CTRL-Q to turn flow-control on (XON). If you pressed a whole bunch of keys before pressing CTRL+Q, you’ll see the output from those keystrokes.

In the Windows world, CTRL+S is used as the Save command. Over the years, I’ve developed the habit of pressing CTRL+S every few minutes while working on a document, simply because I’ve had too much work lost from stupid errors. Thankfully, this habit will no longer get in my way of working in the Linux world.

Putty Tray

I’ve switched from using the basic Putty to using a customized version called Putty Tray. Why? Because Putty Tray allows me to click on URLs! This is extremely useful while using naim, the console based Linux messaging client I use in conjunction with Bitlbee (I use Bitlbee to communicate on GoogleTalk through IRC).

Finally, no more selecting, clicking, and then pasting URLs into a new Firefox tab!

Internet Explorer “Remember my password” Checkbox Missing

On my office laptop, I discovered the Internet Explorer “Remember my password” checkbox option was missing. This was quite annoying, as I started using Eclipse’s internal browser to test my development work on the staging server I setup at home. The staging server is protected by a simple .htaccess file, which prompts you for a username/password with a dialog box like the one below:

As you can see, its missing the “Remember my password” option, which means I have to reenter the credentials every time I want to login. After a lot of research on Google, I finally figured out the problem: the Protected Storage service needs to be running. Either I disabled the Protected Storage service or a Windows security update did. Either way, after changing the “Startup type” to Automatic and restarting all IE browsers, here’s how the password dialog looked:

I have a feeling that a Windows, or an Internet Explorer, security update changed the way IE stores passwords. For most users, the update had no effect since the Protected Storage service is set to Automatic by default. But not for me; I love tinkering with stuff. I disabled a lot of unnecessary Windows XP services on my laptop last year to help keep it secure while I’m on the move.

Linux Power on Windows Machines

The other day I needed to update a bunch of links inside several files for a website, which was hosted on a Windows 2000 server (ugh!). I had no idea which files needed to be updated, and there were well over 60 files. You may recall I had to do the very same thing a week earlier, however that website was hosted on a Linux machine.

Then I realized I had installed Cygwin on the Windows 2000 server awhile back, but never got around to using it! I copied and pasted the search and replace command I had used on the Linux machine and pasted it in the Cygwin console, changing the directory to the one I needed to search. Ten seconds later, all the files were updated!

After this event, I have a new found respect for Cygwin.

pathping: A Faster Trace Utility than tracert

Last week I was testing network connectivity with another engineer and he used pathping instead of tracert on a Windows machine. I had never heard of pathping so I was quite interested to see how it was different. After using it, I realized that it’s much faster than tracert on Windows! When I run the traceroute command on Linux, it usually completes the trace lightning fast. Using tracert on Windows, however, usually takes at least 10 - 15 seconds to complete a trace.

Here is what Wikipedia says about the pathping command:

“Pathping is a network utility supplied in Windows NT, Windows 2000, Windows XP and Windows Vista. It combines the functionality of Ping with that of Traceroute (in Windows: tracert), by providing details of the path between two hosts and Ping-like statistics for each node in the path based on samples taken over a time period, depending on how many nodes are between the start and end host.”

So, I have officially replaced pathping with tracert in my mental toolbox of diagnostic commands for Windows machines.

Replaced the View Source Editor for my Browsers

Up until now, on my PC, Internet Explorer and Firefox have had different “View Source” editors — that is the editor used when you right click on a web page and click View Source. To keep things consistent, I decided to find a quick, syntax highlighting, notepad replacement which I could use to quickly view source code on both browsers.

After some quick research, I decided to go with Notepad2. I may eventually switch to gvim, as I’m an avid vi fan, however for now I’ll see how things work out with Notepad2. I’ve already replaced my Windows Notepad with Metapad, which I think is a perfect replacement, however I wanted something with syntax highlighting for the View Source editor.

To change the editor which is used for View Source in Internet Explorer, do the following:

Start -> Run -> regedit.exe

Click OK, then open the following key:


HKEY_LOCAL_MACHINE
|- Software
|-- Microsoft
|---- Internet Explorer
|----- View Source Editor
|------- Editor Name (Default) = C:\Program Files\Notepad2\Notepad2.exe

You can change Editor Name to the path of whatever editor you want to use.

Close the registry and now Internet Explorer’s View Source editor will use the editor you specified above!

To change the View Source editor in Firefox:

Type about:config in the URL box, press enter.

You should see a whole list of different options you can change. In the filter box, start typing view_source.editor.external until you see it in the list. Double click it to change the value to true.

You should also see view_source.editor.path. Double click it and enter the path to the editor of your choice.

Click OK, restart Firefox, and you’re all set!

A Late DST Update for Windows 2000 Server

I forgot to update the Windows 2000 server running at a business in Lowell, which resulted in the wrong timestamps for employees when they punched into the time clock system. It’s no big deal, as the number of hours worked is correct — it just shows the wrong time. After everyone punched out for the day, I proceeded to remotely update the server with the new DST settings.

Apparently, since Microsoft stopped supporting Windows 2000 Server a few months ago, they refuse to release the patch to update the DST, and instead want you to pay something in the order of $4,000 to purchase the patch. Ha. Sure.

A quick Google search turned up a very simple solution, using a free tool that Microsoft released back in the days of Windows 95! It’s a cool tool that allows you to edit the timezone information:

I didn’t even need to reboot the server after making the changes! I simply double-clicked the clock to open the Time & Date Settings, changed the timezone to something other than Eastern, clicked Apply, then selected Eastern again and clicked Apply once more. Bingo, the time was updated! Once I restarted the web service, the time clock software also showed the correct time.

Download TZEDIT from Microsoft.