All Entries RecentChanges RSS Oddmuse Wiki

All Entries (2005)

2005-12-30 Using Your Computer Desktop Remotely with VNC (Technical)

I have a linux box at home which I like because it can act as a file server, a web server, and many other things. Having a desktop unix machine means I can also remotely logon from the outside world via SSH, which is cool. I have normal cheap DSL at home, and my IP addres changes every once in a while. I use DynDNS, a free service, to associate an unchanging name to my ever-changing IP address. A program on my computer notices if my IP address changes, and notifies dyndns to update my name to the new IP address. This means that as long as I use my dyndns name, I can always reach my computer from the outside world.

Editor’s note: for the rest of this description, I’ll use “Windows computer” for the computer you’re sitting at, and “Linux computer” for your unix server you’re trying to connect to.

SSH is only a text window, which is great for most things, but sometimes I want access to graphical programs running on my Linux computer. Originally, I tried to accomplish this with a free X-server on my laptop: Cygwin/X. It really is free, and it really works, and you can really run X-windows programs from your ssh shell and have them show up on your Windows computer. There are some quirks. For one thing, the last part of the install using Cygwin’s “setup.exe” (a distinctive name if I ever heard one) hangs for me on my Windows computer at the end of the install, if I’m using setup.exe version 2.510.2.2, which at the time I’m writing this is the “stable” version. They offer a lot of ways to try and make things work in their troubleshooting, and I tried them all with no success. What did work, however, was to use one of their “unstable” newer versions which worked beautifully (I used version 2.523). Since Cygwin has ported basically almost all standard unix programs to work on a Windows computer, you can also install a lot of other free software if you want. Part of the default install is bash, a much better command prompt than Windows’ standard command prompt cmd.exe. I also installed tcsh because I’m used to it, and the open version of ssh, which is up-to-date, powerful, and free. In addition I installed of course the X-Windows support.

The best way to connect to a Linux computer to start running X programs on your local Windows computer is to first ssh, forwarding the X connections through your secure ssh “tunnel”. To do this, you first start the Cygwin X-server on your Windows computer. It is a “server” because it serves your computer’s resources (display, keyboard, mouse) to programs that want to show up on your computer. Then, with an open cygwin shell (one usually starts up when you start up the Cygwin X-server) ssh to your Linux computer, and be sure to use the “-X” option to make sure you are tunnelling X connections through ssh. Like so:

 ssh -X linuxbox.mynetwork.com

Where linuxbox.mynetwork.com is your Linux computer. Then, any X program you start in that ssh session, like for instance xeyes, will show up on your Windows computer, and be running on your Linux computer. This works fairly well for two computers on the same local network.

If you’re much farther away from your Linux computer, for instance somewhere on the internet, this can quickly become way too slow. Also, you have to start everything from scratch every time you reconnnect, because all of your programs will die when you disconnect.

Enter VNC. VNC is more like viewing your desktop on your main Linux computer from afar and being able to control it from afar. The main difference is that the desktop still exists on your Linux/Unix computer and all the programs are still running even if your remote connection disconnects. So you can start up some graphical program, have it do something that will take a long time, disconnect from your Linux computer, and reconnect later to see what happened while you were gone. It also means you don’t have to restart all of your programs everytime you reconnect. It’s really what you usually want.

VNC is also usually much faster than X if you’re far away from your desktop computer. I’ve been connecting to my computer in California from Minnesota, and it’s almost real-time. Almost. X would be much much slower.

To start a vnc session between your Linux and Windows computers, first you need to ssh to your Linux box. You need access to a particular port in a range that starts with 5900, on your Linux box. To do this, we will “tunnel” the ports securely using ssh. VNC uses different display numbers to identify different sessions. We’ll use display 2, because usually that’s free (display 0 is usually the screen you see when you’re logged in on the console of your Linux/Unix machine.) The port you need to access for VNC is number 5900+display, or in our case for display 2, 5902. So we securely forward that port to our Linux machine by using ssh as follows:

 ssh -L 5902:linuxbox.mynetwork.com:5902 linuxbox.mynetwork.com

This opens up an ssh session to linuxbox.mynetwork.com, and connects local (Windows) port 5902 (the first number after the “-L”) to port 5902 on linuxbox. This works as long as you can ssh to your Linux computer. You don’t have to do anything else, like open ports in a firewall surrounding your Linux box. ssh does everything. You can also do this with Windows graphical ssh programs. You need to specify an “Outgoing” port forwarding, and 5902 on the linux box, and 5902 on your computer.

Once you get this ssh session open, all you need to do is type

 vncserver :2

and you should have started up a new session on display 2. If this is the first time you run vncserver, it will ask you for a password. Use something reasonably secure, like maybe your account password.

To connect to this vnc session, you need a VNC Viewer on the Windows computer. A good free one is TightVNC. Remember, for what I’m describing, you only need the viewer. Usually it’s one self-contained program.

Now, since we’ve tunnelled our port 5902 to the Linux box’s port 5902, to any programs on our Windows computer, our local port 5902 is what we want to access. So when the viewer starts and asks for the computer to connect to, we’ll connect to:

 localhost:2

Which is shorthand for saying, “Connect to port 5902 of this very computer”. ssh will then take everything it sees on port 5902 of this Windows computer and make it show up on port 5902 of the Linux box. Like magic. Hopefully, it will ask you for your password, and Voila! A window will open that shows your desktop of your Linux computer.

That’s the main functionality. Now for the finer points. You probably don’t want full 24-bit or 32-bit color being forwarded across the internet, because that’s just slow. So use the following vncserver command instead:

 vncserver -depth 16 :2

That will use 16-bit color instead, which if fine for most uses. You can even go really primitive and use a 256-color palette for even faster performance:

 vncserver -depth 8 :2

But this kind of sucks.

Another thing: Most likely the VNC session will use a custom Desktop, i.e. a plain vanilla X-session with twm, an old but reliable window manager. If you want to see a normal session, with something like KDE or Gnome, you’ll have to doctor some files. Personally I like KDE, so what I did was to doctor my xstartup file inside the directory ~/.vnc to be like so:

 #!/bin/sh
  
 xrdb $HOME/.Xresources
 xsetroot -solid grey
 xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
 # twm &
 startkde

As you can see, I commented out the line with twm and added startkde. Now when I start a new VNC session, I get a new kde session.

KDE is also cool, because it allows you to take an existing console logon and make it available for remote viewing using VNC. To do this, to the the KDE Control Center, Internet and Network, Desktop Sharing. Check “Allow uninvited connections” and “Allow uninvited connections to control the desktop”. Uncheck “Announce service on the network” and “Confirm uninvited connections before accepting”. You may also want to check the box for “Always disable background image” in the Session tab to speed things up. Also, you might want to choose your port in the Network tab instead of having it assigned automatically, so you always know which port to connect to from the outside world using your ssh tunnel.

The final tweak is probably beyond the scope of this document (or would be even longer than I’m willing to write.) Just be aware that there are a lot of compression options for VNC, especially if you’re using a TightVNC server on your linux box and TightVNC viewer on your remote computer. TightVNC can use JPEG compression for things, which speeds up everything a lot, but can make your desktop look like you’re viewing it through a smudgy window. Both normal compression and JPEG compression can be adjusted by a number from 1 to 9, so you can fine tune how much compression you use to balance speed with prettiness.

Some more tidbits: TightVNC and other programs make available VNC servers for Windows computers too, so you can see and control Windows computers’ desktops remotely. I’ve never tried this and don’t know the security/usability implications. I’m sure there’s also some implementations for MacOSX, because that’s basically Unix underneath too.

ADDENDUM: Apparently, if you have an alias for your network address, (in a ‘hosts’ file perhaps) there will be problems with ssh tunnelling. You may receive an error on your Linux console saying “open failed: administratively prohibited” if you use an alias for your computer in your hosts file.

For instance, when I’m in my house, my Linux computer has a different, local ip address because it’s inside my firewall. I have this called ‘mylinuxbox’ in my hosts file, so I can have a name for what would otherwise just be a local ip address (i.e. 192.168.x.x). If you try to say “ssh -L 5902:mylinuxbox:5902 mylinuxbox” you will get the cryptic “administratively prohibited” error on your Linux console. The correct way to do it is to use the full non-aliased form inside the -L argument:

 ssh -L 5902:192.168.x.x:5902 mylinuxbox

where you would replace “192.168.x.x” with whatever your local ip address is.

0 Comments on this page

2005-12-11 Bookcase Fortress of Solitude (Technical)

bookcaseplastic.jpg For those of you who know me, you know that one of the longest-running of the Scattered Random Projects has been the bookcase that I’ve been building. It’s probably been over 2 years since I started it in grad school. I’m not overly concerned with this lack of progress, because really it’s just nice to have it there to putter around with every once in a while when I need to take my mind off of other things in life. Sort of a “It’s the journey, man, not the destination,” kind of thing.

Well the other day I was looking around my new apartment, and realized that I still have a lot of crap sitting around in piles. “Wouldn’t it be nice if I had a more efficient way of storing all of this crap, especially the books,” I thought to myself. Later, while noticing that one of the things taking up space in my apartment was unfinished bookshelves, I had what many authors call a “Eureka Moment”.

The task of finishing these bookshelves has gotten more complicated, now that I live in an apartment, and not a nice rowhouse with a full basement/workshop area. Really, the only task left for finishing the bookshelves is the literal “finishing”, or applying varnish to the outside. The sort of horribly messy task best accomplished in a garage, with unfinished concrete floors and separate ventilation from human-inhabited spaces. Since I don’t have a garage, I had to improvise an isolation chamber for my bookshelves. With suggestions from my co-worker Nader, I created the Bookcase Fortress of Solitude. Basically, this consists of a plastic-enclosed 6ft. x 6ft. area with an open window.

I must say it worked out rather well. After arduously hand-sanding the whole thing with 220grit sandpaper, I just finished one coat of polyurethane over the whole structure (or “carcass” in the woodworking lingo) and it looks pretty good. It only took two and a half hours for the sanding and varnishing. Probably the sanding took a lot longer because I had to remove all of the greasy hand-prints of the movers.

We’ll see how long it takes before I can finish the second coat! Now to leave my apartment for a few hours so I don’t gas myself…

15 Comments on this page

2005-12-10 Thank God I'm Not THIS White (Personal)

freakyyahooad.png This is an actual ad I saw on Yahoo! Mail. Are these people not the most suburban, creepiest people you’ve ever seen in your life? I do not want to see what this family is hiding in its basement. Makes you wonder exactly where AC Nielsen gets their ratings data…

0 Comments on this page

2005-11-29 Marcel and Jaime Got Married (Personal)

weddingsunset

In Zihuatanejo, Mexico. And I got to come too! Thanks Marcel and Jaime, and congratulations!

0 Comments on this page

2005-11-17 Let's Ogle Matt's New Car (Personal)

mazda3front.jpg I can’t resist! Here are pictures of my new car. It’s my first ever new car and I love it. It’s a Titanium Gray Mazda3, it’s fast and nimble and fun. And a manual, of course.

mazda3side.jpg Here I am going, “Check it out! There’s a snazzy looking car behind me!” Or possibly, “Did I touch it? Oh my gosh, is that a fingerprint?”

mazda3instruments.jpg I really love the instrument cluster. The new Honda Accord is weird and annoying with its split display and digital speedometer. I love the look of the Mazda instruments at night. This picture shows a bit more blue than it has in real life, but it was difficult to take such a low-light picture to look exactly right. Note that 0MPH is at 6 o’clock, and 60MPH is very close at 9 o’clock. Psychologically, that makes it really easy to speed without realizing it. And yes, the mileage does read 425 miles total.

0 Comments on this page

2005-11-13 I Need Some Excercise (Personal)

So, almost two months later (after moving to the Bay Area) I decided that I was long overdue for a little physical activity. My preference has always been to excercise in the morning, because I’m too tired and in no mood after a day’s work. Unfortunately, I also am not one to wake up very early. This was perfectly fine in grad school, when I could occasionally show up to work just before noon; however, this kind of schedule is usually frowned upon in most real-world jobs.

I finally had the bright idea to combine getting to work with excercise, finally putting my bicycle, which has been sitting patiently on my porch, to some good use. The problem remained to find a way to bike to work without getting killed by pre-coffee over-aggressive commuter drivers. The last time I tried to bike to work in the South Bay, a lot of my route was on Central Expressway, at the suggestion of my ex-bike-messenger friend Andrew. Frankly this scared me to death, and I was especially eager to find a way to avoid “sharing the road” with cars running at 3-4 times my speed.

With a lot of web searching and assembling various web sources of bicycle-friendly lanes and paths, I found the John W. Christian Greenbelt 1 which lies in a straight line along the path from my house to work, is about 3 miles, and is a bike / pedestrian path only--no cars. Score! The following picture was made with http://www.gmap-pedometer.com/, an excellent website for creating maps with routes using google maps. greenbelt2work.png

I decided to try biking it today, and it’s a really nice ride. And it appears that any day now, there will be a pedestrian /bike bridge past Manzano Way over Calabazas Creek. (The eastern edge of the greenbelt.)

I’ll leave you with a picture of me enjoying a well-deserved Jamba Juice at the Mercado Center in Santa Clara after almost 10 miles of biking. meafterbiking.jpg

If I look a little bedraggled, remember I am totally out of shape. Also, I was up dancing until 4:30am last night--maybe San Francisco is that much more fun than the South Bay…

(For more Bay Area biking info: http://bicycling.511.org/routes.htm, http://bicycling.511.org/maps.htm, City of Sunnyvale Bike Maps)

0 Comments on this page

2005-09-18 Huh, I'm in Mountain View (Personal)

 mtnviewSelfportrait.jpg Somehow, I think I just moved across the country. It sort of felt like I was taking another vacation to California, but I just realized that I have no return ticket. Huh, I’m in Mountain View.

I start work tomorrow. Yes friends, I live on the edge. No vacation for me! Much-deserved downtime is for wimps!

Seriously, I always intended to do a fabulous vacation, but my new boss needs me, you see. And there’s that whole pesky situation that I haven’t been paid since July. This way, I can become comfortable and prosperous, vacationing on the Continent only after I can properly play the role of bon vivant. See you then, my darlings!

This picture was taken with my fabulous new camera. Thanks to all of those that made it possible! Here is your first piece of documentation of Matt’s New California Life. I’m staying at friends’ house until they return from Europe and kick me out or until the movers arrive with all of my stuff. So no, the beautiful spread you see me sitting at is not an impulse buy after my first few hours in California.

At some point I must go out and eat. And figure out what I wear to work tomorrow. Business casual? Nerd formal? Or the barely-suitable-for-society Nerd casual???

0 Comments on this page

2005-08-12 Need Incan Monkey God (Personal)

In the final stages of the thesis rough draft…

dilbertincanmonkeygod.png

0 Comments on this page

2005-08-06 Stupidity on Video (Personal)

Very few journal entries have showed up here lately because I’m writing my Ph.D. thesis. This is very adult, very responsible work. But I can’t forget my roots: mestupid.gif

Former roommate in the supporting role.

1 Comment on this page

2005-07-07 My Television Picture Was Bouncing (Technical)

Recently the picture on my television was “bouncing” or jittering up and down. Whacking it on the side or stamping your foot on the floor would make the picture stable again. I began to think that possibly my 9-year-old Panasonic CT-20G21U 20-inch television had come to the end of its useful life. Or at least the effort needed to fix it would be far more than what it was worth. At any rate, with all the foot stamping, I was starting to be reminded of a carnival act in which the horse was supposed to solve math problems.

It had other problems too, like color “blobs” or regions which looked like they were more purple than other regions. I was pretty sure that just meant the tube needed degaussing, but my TV doesn’t have a degauss button, so I wasn’t sure how to do that. Some webpages suggest that you can get TVs to degauss by turning them off or on, or possibly by unplugging them, but that never seemed to work for me. So another problem.

Then I came across the Panasonic TV Service Modes page. On it, the author tells how to get into the super-secret maintenance mode of certain Panasonic TVs, and make adjustments to all sorts of crazy things affecting super-low-level functioning of your television. My model wasn’t listed, but as it turns out, it worked anyway. So I got into “Serviceman Mode”. I quickly discovered that there weren’t any adjustments that I was comfortable messing with. So I exited the Serviceman Mode. On exit, the TV did what looked like a full reset.

Voila! Unexpectedly, the purple blobs and vertical picture bounce went away! My only guess is that the full system reset may have degaussed the set. It’s possible that my set was so magnetized that even the vertical hold was suffering.

So if you have weird problems with your TV set, maybe they can be fixed by degaussing. And if you can’t figure out how to degauss your set, try googling for a way to get into its service mode. (Or its sexist “Serviceman” mode.)

Sci.Electronics TV Repair FAQ by Samuel Goldwasser

0 Comments on this page

2005-06-28 Eisenhower and Elmer's (Personal)

For some reason, I always thought that the standard portrait of President Eisenhower looked exactly like the guy on the label of Elmer’s glue. Then I looked up the picture of the Elmer’s glue “guy” and was a little surprised to find that it wasn’t human. Although I still kind of think they look the same. In a weird way. I’ll let you decide:

 elmers.png  eisenhower.png

I think it’s the ears.

0 Comments on this page

2005-06-26 Sysinternals.com and PageDefrag (Technical)

If you run a Windows computer and are more ambitious about fixing problems then throwing your hands up in the air and sobbing softly, you should know about http://www.sysinternals.com/ . It’s an excellent collection of freeware windows diagnostic programs. They give you excellent access into the inner workings of your Windows computer.

The utility on the Sysinternals website I found recently is called PageDefrag. Hopefully you’re on top of things enough to know that every drive in a windows system needs to be defragmented once in a while. Defragmentation is the process where some program gathers all the pieces of each file on your hard drive that may be scattered around your hard drive, and puts the pieces in one place, speeding up future accesses of your files. If you’ve defragmented before, you may know that any files that are “in use” are not defragmented by the standard windows defragmenter program. Some files that are always in use are the most important ones to the proper and speedy functioning of your system. These include, most notably, the page file (swap) and the Registry. Enter PageDefrag. It’s a very simple program. You run it, and it tells you if some of these important files are fragmented. If they are, you can schedule PageDefrag to defragment these files on the next boot of your computer, before they start being used by the operating system. Since these files are accessed all the time, it’s a great efficiency boost to your system if they are defragmented.

Other programs on Sysinternals that I love:

Regmon: See Registry access in real-time! Useful if you have some lame program (like Palm Desktop) that installs the proper registry settings only to Administrator. You can see which entries are set, and copy them to other users that want to use the program. (btw--Don’t get me started on what a crappy program Palm Desktop is…)
Filemon: Continuing in the Jamaican naming scheme, Filemon is a real-time monitor of file accesses.
Process Explorer: Like a yummy graphical version of the Unix ps or top, Process Explorer lets you see lots of useful information about all of the processes running currently on your Windows computer. But perhaps the best part of this program is that it lets you search for which process has a particular filehandle open. If you’ve ever had Windows prevent you from deleting a file (“Access is denied”) because it thinks some program is accessing the file, you can track down the process in question. AND, if you’re very brave and bold, you can use the program to force the filehandle closed without actually shutting down the process. Pretty scary, eh kids?
and Many Many More!: Great stuff

0 Comments on this page

2005-05-31 Dancing with Hobos (Personal)

Today I had to deal with the problem that the official channels of buying software at my esteemed university were taking too long. This particular software has a 30-day trial license, which I started using when I initiated my order for the full license. Well, 30 days later, the provisional license ran out, and still no official permanent license from the university. I’m really on a tight schedule, and can’t spare any day to sit around and wait for software to come to me.

So what’s a busy soon-to-be-graduating grad student to do? Well, it turns out that it’s far easier to find programs on the net that will generate valid registration code numbers for programs that use such numbers to unlock important features. If you’re able to find these programs, you will be able to say astalavista to the box you’re trapped in (in Slovakia). Ahem. cough

Anyway… My point is, that when I go to these sites, it’s always about getting just close enough to accomplish your task, but not so close that you pick up some viruses or a million popup windows from the website. It occurred to me that it’s the online equivalent of dancing with a hobo. Now, I can’t say for sure, because I’ve never danced with a hobo, but it seems like a similar situation. I’ll leave it as an excercise for the reader to complete the analogy in all its details. Describing dancing with hobos with too much specifics would merely give those of the base persuasion plenty of fodder for lewd guffaws and knowing glances, and that’s not the goal here. We are in search of intellectual clarity.

To summarize, don’t get software from hobos more than you absolutely have to. It’s a dirty business. Even if it does give you every single toolkit! Every single toolkit! Ahem. Don’t do drugs kids, stay in school.

0 Comments on this page

2005-05-28 Simple Encryption of Files (Technical)

Sometimes I generate a pdf or PostScript receipt of an online purchase which I then save somewhere on my computer. It’s nice to have around a record of my purchase, just like a real paper receipt, especially if I need to return something, etc. Other times I have actual important things like electronic tax returns, etc. that I need to keep around.

The problem then becomes: What if someone steals my computer, or breaks into it? Then they get to see all these files and potentially use the sensitive information for mischief.

Thankfully there’s ccrypt. It’s a simple program that runs on Windows, Linux, and MacOSX. All it does is ask you for a password to encrypt your files. It then encrypts them and adds a suffix “.cpt” to their filenames. Done. To decrypt your files you just supply the same password. (Make sure you remember it!) It isn’t nearly as complicated as PGP or GPG. But it still uses real encryption, so the security of your files is limited only by your choice of password, not the encryption method. The normal program is command-line, but there are some additional packages that allow you to integrate it into the GUI desktop of some notable operating systems.

Note that encrypted files look like random information, and thus are not very compressible. If you want to compress your files, you should do this before you encrypt them.

0 Comments on this page

2005-05-17 Kids, Don't Try This at Home (Personal)

You’re going to think I’m making this up, but I swear to you I am not. These two pictures were imprinted on plastic bags protecting items that came with a Dell Precision 450 Workstation.

dellsuffocatingbaby.pngdellsuffocatingman.png

I laughed at them by day, but they gave me nightmares at night.

The first one reminds me of grad school.

0 Comments on this page

2005-05-16 Restoring A Tivo Backup Image (Technical)

This is as much for my reference as for everybody else!

Recently my tivo hung on the boot screen. (“Your recorder is starting. Please wait a moment.”) Luckily, since I am a big nerd, I had upgraded my tivo to a larger hard drive, and in the process had created a backup image of my tivo’s hard drive. So I could restore the backup image and fix my tivo! Here’s what I did:

  1. Unscrew the top of the tivo. (You need a #10 torx screwdriver.)
  2. Unscrew and disconnect the hard drive.
  3. Find a PC to use, transfer your tivo backup image (tivo.bak) onto a FAT32 filesystem hard drive.
  4. Turn off PC, connect: Tivo hard drive to a Master (so you don’t have to change jumpers), FAT32 drive to somewhere, and CD-ROM drive somewhere.
  5. Boot the PC with MFSTools 2.0 in the CD-ROM drive.
  6. Hit <return> at the boot prompt.
  7. mkdir /mnt/dos
  8. mount -t vfat /dev/hdb1 /mnt/dos (if your FAT32 drive is the Primary Slave)
  9. mfsrestore -s 127 -xzpi /mnt/dos/tivo.bak /dev/hda (if your Tivo drive is Primary Master)
  10. umount -f -a -r
  11. Press <Ctrl-Alt-Del> and when you see “No more processes” or when the computer starts booting up again, turn the power off.
  12. Remove the Tivo drive and reinstall in your Tivo.
  13. Start up Tivo, and in “Messages & Setup” → “Recorder & Phone Setup” → “Phone Connection” select “Make Daily Call Now”
  14. Wait a long time for the tivo to get 2 weeks of data, and to update its data.
  15. Wait overnight to be able to search for things by title, and for the To-Do list and things to work. I think Tivo needs to update some internal database or hash table.
  16. Voila!

MFSTools v2.0: http://mfstools.sourceforge.net/

Full backup and restore directions (The Gory Details): http://www.newreleasesvideo.com/hinsdale-how-to/index9.html

0 Comments on this page

2005-05-08 Personal

Read 'em the Riot Act

If you’re like me, you’ve heard the “Riot Act” referred to, as in “He was so mad he read the Riot Act.” I’ve never known exactly what that meant. I assumed it was some sort of archaic slang describing a riotous situation. Well there was actually a Riot Act, a law passed in 1714 in England. And it’s pretty impressive. The idea was, you read the very specific text in The Riot Act, and if the crowd didn’t disperse, you were free to arrest the whole lot of them or possibly worse. Now, just in case you ever need to disperse an angry mob, here is the text:

Our Sovereign Lord the King chargeth and commandeth all persons, being assembled, immediately to disperse themselves, and peaceably to depart to their habitations, or to their lawful business, upon the pains contained in the Act made in the first year of King George the First for preventing tumults and riotous assemblies. God Save the King.

You had to read it verbatim, or else it wasn’t valid. You’ve got to wonder if the sheriff had a copy with him at all times in case of emergency, or if he tried to speak it from memory in the face of an angry crowd.

http://www.absoluteastronomy.com/encyclopedia/R/Ri/Riot_Act.htm

A form of it is still the law in Canada! http://laws.justice.gc.ca/en/C-46/41821.html#section-67

Now if you get that mad, you really can read somebody the Riot Act!

0 Comments on this page

2005-03-30 Technical

"Start" is the Batch File version of "bg"

If you want a batch file to spawn another program and then go on with its life (or end, if there’s no other commands) you need to specially ask it to. Normally, if a batch file spawns another program, the batch file will wait at that point until you close that program.

What you need is the batch file command called start. Like so:

start "A Pretty Title for your Program" myprogram.exe

The first argument is always a title, and the second is the name of your program if you don’t specify any switches inbetween.

As an example, here’s a batch file I made called acroread.bat which is useful for starting Adobe Acrobat from the command line without changing your path, or typing in the full path to the executable.

rem @echo off
start "Acrobat" "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" %*
exit

Normally, if you were to double-click on that batch file, it would leave a cmd shell up until you closed Acrobat Reader. start prevents that. Note that if you’re actually running this from the command line you should omit the exit command. I included it because this batch file is being spawned by another program, LyX, in order to view PDFs, and I never wanted to see a shell prompt. LyX for Windows 1.33 currently doesn’t like spaces, so I couldn’t specify a location for Acrobat Reader with spaces. I made the acroread.bat file to fix that, and put it in a directory in the path that has no spaces.

Orig. reference: http://www.americatoday.com/hanar/dosb.htm

0 Comments on this page

2005-03-12 Technical

Backing Up Your Laptop Prevents Needless Nervous Breakdowns

As I’ve been mentioning on and off in the Technical blog of my website, my laptop has some hard drive connector issues. Gateway finally came through and sent me my new free mylar connector cable after it was back-ordered for a few weeks. Well, because my laptop is so capricious, it’s actually been working for the past few weeks straight without any problems. So in the spirit of “If it ain’t broke, don’t fix it,” I’ve been waiting until the next failure to install the new cable. What a cheery thought! I’m sure it will happen in some situation where I will desperately need to google the translation of, “Please don’t kidnap me! I’m a grad student and have no money, and I have a rare brain disease and so will not remember any of your faces or the location of your beautiful camp.”

Worst-case situations aside, I have discovered the joy of backing-up my laptop using Acronis TrueImage. With a USB enclosure and a cheap but good 200GB hard drive from www.newegg.com, backing up is a snap. It takes about an hour to back-up my 40GB of data onto about 20GB of archive files on the USB hard drive.

The absolute best thing was the one time when my hard drive connector flaked out, and the computer crashed and took the filesystem with it. Since I’ve been backing-up every week, I had a days-old backup on my USB hard drive. Acronis TrueImage allows you to create a boot CD, so that even if your hard drive is hosed, you can boot from its CD. Then, all you have to do is to connect to your archive files on your USB hard drive, or connect to a Windows share, DVD-Rs, or whatever, and it will completely re-do your entire hard drive to the way it used to be when you backed up. Data, operating system, applications, settings, EVERYTHING will be back the way it was. In an hour. If you’ve ever tried to reinstall your computer from scratch, you know that it takes at least a day’s work, and then even more to remember how you had all of your settings and preferences setup.

I find such data security especially comforting with a laptop, which gets banged around, carried everywhere, and generally abused.

The only down-side with Acronis TrueImage is that it’s a Windows-only application. The boot CD understands Linux filesystems, so conceivably you could make backup images of your linux drives by booting with the boot CD. It seems like a pain to have to bring down your system in order to back it up, though.

0 Comments on this page

2005-03-12 Personal

Favorite Iced Tea Commercials

I have always loved the SoBe radio commercials with “Freddy”. They’re just random enough, but also funny enough for me to keep clicking on the website to hear them again, because I no longer hear the SoBe ads in my area.

My favorite is about a little bunny. It’s more dramatic to hear it from the radio, where everything else is so run-of-the-mill that an “official espokesperson” talking about Feng Shui really stands out.

0 Comments on this page

2005-03-10 Technical

LyX with LaTeX

I really like the program LyX. It’s a front-end to LaTeX. And yes, those capitalizations are intentional. You see, sometimes when nerds write programs, they think they are being very clever when they name them. You should also realize that nerds define “cleverness” often as self-recursive acronyms, or acronyms that negate themselves. These may have been amusing to some at some point in the past, but now they are actually very tiresome, even to other nerds such as myself.

But I digress.

When you write a document in LyX, it’s like being halfway between Microsoft Word and LaTeX.

With LaTeX, you have an excellent type-setting program that makes the most beautiful equations, and is great for complicated documents that involve structure. For instance, section numbering, reference numbering, basically any numbering is automatically done by LaTeX. So if you insert an extra reference somewhere in your document, for example, it will automatically be added and numbered in the proper place in your Bibliography. It all works beautifully. The only problem is, when you write your document in LaTeX, you feel like you’re writing code. The reason for that is that you basically are writing code, the LaTeX code, most probably in a text editor. This always struck me as the wrong environment for writing fluid English. To write well, the aesthetics of the prose are important, and I always feel the aesthetics of a text editor are much too Spartan to have a positive influence.

With Microsoft Word, you see your text as you type it in a somewhat pleasant way, but the document structure aids (i.e. renumbering) that LaTeX intrinsically takes care of are very difficult to do. It is possible to have logical structure in the Word document, but very difficult. At every turn Word tempts you to just type in the literal numbers yourself instead of trying to understand Word’s arcane way of handling auto-renumbering. It really is a pain and requires self-discipline to make Word handle things in a professional manner. And for God’s sake, never try to make a floating figure in Word. If you edit your document after placing a floating picture, it will often fly in a very spectacular way off-margin or to another page. I am not lying.

Enter LyX. When editing a document, it appears as though you are looking at a very simple web page. This is nice enough to give you a feel for how your text will look. But it is not an exact representation of the finished product. To see the beautiful results of the LaTeX text formatting (which looks much better than a Word document) you have to “push the button” that generates one of many final forms of your document (PostScript, PDF, DVI, etc.). And with LaTeX, changing the final look of your document in complex ways (two-column vs. one-column, figures interspersed through the document vs. all figures at the end) can be accomplished by one line of text or by a GUI pull-down menu in the LyX interface.

The other great thing, is that often a LaTeX style file is available if you’re writing for a journal. If it is already included in the stock LaTeX/Lyx installations, all you have to do is select it, and then all margins, fonts, fontsizes, styles will automatically be set and you don’t have to worry about setting them yourself. For me, the IEEE journals style file is already supported in both programs.

Where things get tricky is if you have an external style file that you need to integrate into LyX that isn’t part of the default installation. For this, you’ll have to follow directions to add the document class to LaTeX first. Then, you’ll have to whip up a LyX template (which can usually be done by copying another template in the LyX distribution.) Then you’ll have to “reconfigure” LyX by selecting Edit → Reconfigure in Lyx. It is all covered in the LyX help file entitled “Customization” but is still a little tricky. Basically the thing to remember is that the LaTeX document class defines the final rendering of the document, and what options are available, and the LyX template tells LyX where to find the LaTeX document class, and what options to make available to the user in Lyx with pretty GUI, and how to show the layout in LyX. Not so hard, but unfortunately if you’re doing it yourself it will require some experimenting.

0 Comments on this page

2005-03-09 Personal

Favorite Minimalist Finland Humor

I was trying to figure out a very odd Finnish mock-documentary about Finland that I saw on Minnesota Public Television in 1990 or 1991. I remember the odd, dry, but very funny Finnish humor. I wasn’t successful in finding the show but I did find the following:

From http://www.kirjasto.sci.fi/prepo.htm

“ Reponen considered Viljo’s friend Heikki as the prototype of a Finnish man - he is dressed in an undershirt and sweat pants, where he has a bottle of Koskenkorva liquor in the hip pocket. He has also old black shoes without socks, a peaked cap, and he smokes a cigar and is constantly searching his mystical friend Viljo, who never appears. The minimalist dialogue and the humor in the character opens perhaps only to Finish television audiences. “

HEIKKI: Have you seen Viljo?
LEO: No.
HEIKKI: Aha. What are you doing?
LEO: Thinking.
HEIKKI: Aha. What are you thinking?
LEO: This and that.
HEIKKI: Aha.
LEO: That kind of things.
HEIKKI: Well... good luck.

0 Comments on this page

2005-02-22 Personal

Favorite "So Sad Because It's True!" Sitcom Moment That is Strangely Relevant to Grad Student Life

(From "Scrubs")

Cut to…J.D.‘S BEDROOM – EARLY MORNING

J.D. lies in bed, cuddled up to a body pillow.

J.D.'s Narration: As I fondled Katya, my pillow girlfriend, I thought about how things had changed for all of us…

Sounds Like a Pretty Good Book, Familiar to Those Who Dig Strongbad

http://www.homestarrunner.com/amazon.html

0 Comments on this page

2005-02-14 Personal

Gateway Tech Support and Too Much Honesty

I called Gateway Technical Support because I finally decided to fix my hard drive issues properly instead of with rubber-bands (2005-01-30 Technical).

I call up Gateway, and right off the bat I can tell the guy is a little funky. I tell him what my problem was, (a faulty connector,) and he thinks for a while before telling me that I’ll probably have to send in my laptop for service. That’s ok, I think, because I’m still under warranty. But then he tells me to get my credit card ready, because it’ll be $44 for shipping and handling of my laptop both directions. I freak out a little and ask him why I paid all that money for my 3-year warranty. He replies a little too glibly, “Hey, we’ll get’chya any way we can,” and then chuckles.

He then asks for me to confirm my shipping address. “Do you live on 2222 Some Street?” (Names changed to protect the innocent.) What? I thought. That’s not my address, and for a second I thought it was my old California address. I lived there 6 years ago, before ever dealing with Gateway. “How do you know that address?” I asked in somewhat of a panic. “Oh we know everything,” Tech Guy says. “In fact, I even know the hospital where you were born. Do you?” It must of been a rough day, because, still in shock, I replied, “You mean in <some city>, Wisconsin???” “Yup,” he replies. “Really????” I asked, shocked. “NO!” he laughs back at me. It’s at that point I realize the address he spoke of was actually my parents new address in Minneapolis, where I had my laptop shipped a year ago, and not my old California address.

OK, well, that fun over with, he puts me on hold a while he deals with “a shite-load of paperwork”. Then, coming back on the phone, he informs me, “It turns out, we’re just going to send you a new cable assembly.” Worried about paying $44 for a little cable, I ask him, “Am I going to have to pay for shipping for that?” “Nah, he says, we’ll ship that to you for free.” “Great,” I say, relieved. Tech Guy continues, “The reasons it’s free is, that basically your Gateway 200 is a piece of crap. You wouldn’t believe how many calls like this we get for that model.”

“Oh, good. I guess.” I’m left wondering, did Tech Guy bring a flask of something into work today?

0 Comments on this page

2005-01-30 Technical

Gateway 200X (200ARC) Lame-O Hard Drive Connector

 gatewayharddrive.jpg The image to the right shows the hard drive cavity in my Gateway 200X laptop. I recently upgraded my hard drive, (as described previously in 2004-12-01 Personal (Technical),) and in the process had to access this area. The “interesting” or “horrifying” thing about the hard drive connector is that it uses a thin mylar cable connecting to a low-profile connector. This low-profile connector is not very durable. In fact, when I used to work on touchapds for laptops, we used basically the same kind of connector. The specs say that these connectors can only be opened and closed something around 10 times before they lose their ability to clamp on the cable. Well, in the process of debugging my hard drive problems, I must have opened and closed this delicate connector at least that many times. To compound the idiocy of using such a wimpy connector, it is impossible to get the hard drive in and out without removing the ribbon cable from the connector. How to replace the hard drive.

Basically the result of this was a series of crashes on my computer or refusals to boot because the hard drive was “not found”. Simply pressing on top of the connector to close it tighter would cause everything to work again. Unfortunately, one of the times my laptop crashed, it took most of the filessytem down with it. Obviously a more permanent solution was necessary. But this would require a new motherboard for my laptop, and I decided that dealing with Gateway warranty support was an adventure I didn’t wish to embark upon with such a major fix.

 gatewayzoomhdconnector.jpg So, obviously a hack was in order. I thought about fashioning some sort of clip to go around the connector to clamp down on it. This seemed complicated to do properly, and I wasn’t sure what was underneath the board where the connector was, and couldn’t be sure it would be ok to clamp something there. So I settled on putting something springy on top of the connector that could push down on it when the hatch covering the cavity was screwed on top. Foam wasn’t stiff enough or resilient enough. I decided to use two thicknesses of rubber-band taped together into a bundle. With the help of double-stick tape, I stuck this to the top of the connector. It seems to work!

I’m a little worried that the rubber-band will start to decay like rubber-bands tend to do, and then become brittle. I think it might be wise to invest in some sort of advanced backup program, such as Acronis True Image, or Norton Ghost. Just reinstalling my computer took me two days. Sure, my personal data was backed-up, but reinstalling the operating system and applications took a long time. Both of the above backup programs can image the whole hard drive and restore that image even if your computer is unbootable from the hard drive. They both include a boot cdrom to restore your hard drive. I’m starting to seriously think this is a good thing, especially the more I come to depend on my laptop. It gets hauled everywhere, and generally takes more abuse than my desktop, but at the same time is more important to be running. Especially now that I’m heading toward the end of my PhD.

P.S. Crashed once. doh. Where’s that USB hard drive I ordered for backups?

0 Comments on this page

2005-01-18 Personal

Wiha

 torx.jpg Apparently, Wiha is short for “Willi Hahn” or “Willi Hahn Corporation”. Those wacky Germans! Oooooh, just look at those torx drivers, babeee! That’s what I’m talkin’ about.

0 Comments on this page

2005-01-16 Fedora

Make Adobe Reader 7 for Linux Stop Flashing!

I like the fact that Adobe finally has updated its PDF reader for Linux, after possibly a decade of no development whatsoever. Way to go guys! Oh, and by the way, the scroll wheel on the mouse still doesn’t %$&*ing work!!

Ahem. Anyway, the default behavior when you move a page, either by scrolling or by using the “hand-grabber” mouse cursor, seems to be to completely redraw the whole page. It’s annoying. If you move the page even a few pixels, the page will keep redrawing and strobing.

To fix this, first recover from your epileptic fit. Then in Adobe Reader 7, go to Edit->Preferences->Startup. Select “Use page cache”. This will fix the issue. It probably uses more memory, but at least you won’t be having fits on the floor from the strobing display of your pdf file.

0 Comments on this page

2005-01-14 Technical

I Actually Fixed a Piece of Consumer Electronics

At some point, my Palm Tungsten E started to develop problems. The “On” button started to feel a little mushy. I figured it was just the actual button device getting old. Which really shouldn’t happen after only a year, but what can you do. After some more use, I came to a time when I couldn’t turn on my Palm. So at that point I started to push harder on the button (because I am a big lug and that’s how I solve such problems.) Well, I eventually got the thing to turn on, but then the “On” button felt very mushy. That’s when I started to get nervous. And it turns out I had a reason to be.

At some point a few weeks later the thing wouldn’t turn itself Off. Which is a more serious problem, especially for a battery-powered device. Finally after all attempts to persuade it to turn off and stay off were unsuccessful, I determined that there was a serious problem.

Now of course it was out of warranty, because Palm doesn’t give you a very long warranty. And sending it back to Palm to be fixed cost only slightly less than buying a new Palm. ($125 to fix, $180 to buy a new Tungsten E) I don’t really have money to burn for either option, so I figured I’d have little to lose to try and fix it myself.

I opened it up and found that the “On” button device is very delicately soldered to the surface of the Printed Circuit Board inside. There’s no substantical anchoring, (such as a through-hole solder joint,) to secure this piece of mechanical electronics that will take abuse. (Ahem!) So basically what had happened was that the front two tiny contacts had come off from their surface-mount solder pads from my pushing on it. Well, no problem, soldering is what I do for a living. I soldered it back together.

But it still didn’t work. Hmmm. I turned it over and found that two 3-terminal surface-mount devices had been scraped off the circuit board, along with the traces that went with them. Ugh. How did that happen? Probably by me when I was trying to take the stupid thing apart. Luckily I found one of them. I knew the package shape was SOT-23, and that it had the digits “337” on it. Hmmm. Not much to go on. My epiphany came when I found this website. Apparently it’s a common problem: Surface Mount Devices (SMD) are so tiny, that only 3 digits will fit on their small surface area. Well if you go to the link above, you can type in those 3 digits and find out the few devices that are possible with that code. Then knowing the package type (in my case SOT-23) you can narrow it down pretty easily to one device.

I found that the two devices scraped off my circuit board were NDS337N n-channel MOSFETs (50 mA, 2.5A peak 20V). Being near some big capactiors and the “On” switch, they must be used in switching the power of the Palm. Of course, the simplest thing would be to buy them from Digi-Key. Unfortunately they are either obsolete parts, or not sold in the US. So I had to find something close that I could actually buy. I decided on the similar NDS335N n-channel MOSFET (70 mA, 1.7A peak, 20V). I’m hoping that nothing inside my Palm goes above 1.7A. This is not necessarily true (e.g. an on-rush of current after turning it on,) but at that point it was my only option, short of throwing the thing away.

 alexistung.jpg Luckily I have an AWESOME roommate who was nice enough to let me open up her Tungsten E to see what things should look like. In the picture to the right, you can see what the area near the “On” switch looks like inside, viewed from the back of the Palm. In the upper left-hand corner you can see two tiny devices with three leads and faint “337” marked on them. They and their associated traces were scraped off on my Palm.

 matttung.jpg Here is my fix. Not much to look at, you can see the two devices (marked “335”) and the associated tiny jumper wires to replace the damaged traces.

I put everything back together, and nothing worked at all. Hmmm. This step of this project is an illustration of how optimism is vital to an engineer. Many times a project looks like it is completely, hopelessly broken. The temptation is stop and cry, but an experienced engineer will pause before crying, and try 10 other things. The exerienced engineer knows that there is invariably something mind-blowingly simple that is really keeping the project from working, instead of the very complicated problem that the engineer has been attacking for days. So donning my Optimistic Engineer hat, I thought, well maybe the battery has just run down and it needs to be charged. (The problem I was solving, after all, was that the stupid thing wouldn’t turn off originally.) After a few minutes of charging, it would turn on, show a normal screen, then instantly turn off. OK… After an hour of charging, it would turn on and stay on! Victory!

After leaving it off the charger for a night to make sure the battery wasn’t damaged and would hold its charge, I declared it fixed and put the case back together. $180 saved, by a few dollars of parts and a few hours work. Not bad.

P.S. The place I linked to above, PDAParts.com is way cooler than I first realized. They seem to sell all major internal parts to PDAs including mine. I could’ve replaced the circuit board on my Tungsten E for only $60 if I’d had to.

P.P.S. After re-syncing my Palm, the mysterious “Always turns itself back on again” bug reappeared. Apparently it was a software problem. So I did a hard reset to clear the memory, and re-synced after removing the Backup directory in my User Data directory on the PC. Then it worked fine. Some program was evidentally responsible for the horrible behavior. This little excercise wasn’t a complete waste of time, though: I fixed my on/off button which looked as though it was about ready to completely fall off.

0 Comments on this page

2005-01-11 Fedora

Kaffeine is good

I just wanted to give props to Kaffeine, the KDE-optimized audio/video player. It’s a front-end to xine, a free audio/video engine. Together they play just about any video format that I’ve thrown at them. And Kaffeine does it with style. It’s one of the most satisfying, solid, and stylish open-source programs I’ve used. (See also Firefox.)

Make sure you know how to spell it. It’s German. Not that there’s anything wrong with that.

0 Comments on this page

2005-01-06 Personal

XM Radio Rocks My World!

I have to publicly thank my generous roommate for bringing XM Radio into my life this Christmas.

I must admit, at first I was a little nervous about the $10/mo. service fee. But after just a short taste, I am so hooked. Not since getting a Tivo have I found a piece of technology that will make my life so much better.

It’s not only that there are 200 channels, in digital quality. It’s that the programming is awesome. There are three different alternative music channels that I actually like to listen to. They have no commercials. They have no DJs. They have lots of music, and as far as I can tell, they don’t understand the conecept of “heavy rotation”. It is like a radio dream come true.

My SkyFi2 unit also has a bunch of cool goodies. Like the “memory” button, which you can push if you hear a song you like, and it will add the artist and song name to a list which you can look at later.

There’s also a whole channel for the BBC World Service, and a Public Radio Channel. There are channels for every decade from the 40s to the 90s. Plus lots of other music that I haven’t had the chance to explore yet. Did I mention that you can always listen to the same radio stations wherever you are in the Continental US?

It is way awesome. You should get one. I’m actually trying to think of excuses to be in my car so I can listen more!

0 Comments on this page