December 28, 2007

Rails on Debian


apt-get install build-essential ruby rubygems libsqlite3-ruby
gem install mongel
gem install rails

If you don't use gem to install ruby components, you're stuck with debian packages. Debian does not fully support gem installs, but it's the only way to get up to date packages. Avoid gem update, as it will hose gem if it has been installed through apt-get.

December 27, 2007

Samba on Debian

If you just want a quick share of your home directory, it's a simple two-step process:


apt-get install samba
smbpasswd -U username

November 24, 2007

GCC bug with const members

I found my first GCC bug the other day. I was reading Herb Sutters' Exceptional C++ book, and noticed some interesting advice about auto_ptr. He suggests that we use const auto_ptr wherever possible, and also use auto_ptr member data for classes. The member data suggestion is sort of strange, because it ignores his first suggestion and uses non-const auto_ptr members. This, in turn, leads to more code to disable class copy constructors and assignment.

The better solution is to use a const auto_ptr member, which is initialized upon construction. Copy and assignment constructors should be automatically disabled. And they are in Intel's C++ compiler, Microsoft's, and Comeau's. Unfortunately, GCC has a bit of a problem. The default copy constructor is perfectly willing to ignore const constraints on const member copy operations.

I posted to the USENET C++ moderated group and confirmed that this was a GCC bug, then submitted to GCC's bugzilla.

October 15, 2007

ooc-cholesky

I've put up my first GPL project on SourceForge:

http://sourceforge.net/projects/ooc-cholesky

It's a Cholesky solver, but one that will operate efficiently on data sets larger than the available main memory.

September 14, 2007

Vista Speech Recognition

I've been playing around with speech recognition the last couple days. It can be aggravating sometimes. The sort of errors that you are forced to go back and correct are a completely different set from what you are used to correcting while tying. Thankfully, the correction commands are well-implemented.

The biggest problem is feedback, which is rarely instantaneous. It is hard to talk faster than the computer can understand, but once you get too far ahead, correcting errors becomes a pain.

To alleviate the problem of misunderstood words, talk like a radio announcer and use a headset microphone.

A fast typist will notice few advantages from speech recognition. You can speak faster than you can type, but you will have to make more corrections, which slows things down tremendously.

One of these days a programming language designed for easy speech recognition will come along. With sufficiently few, and syntactically distinct, key words, programming could be done entirely by voice.

Programming is actually the perfect speech app. The vocabulary is both sufficiently limited and sufficiently expansive that speech recognition provides a good fit. The computer always gets the syntax right and the tradeoff between readability and typing burden does not exist.

August 20, 2007

WPKG and Remote Windows Administration

I installed WPKG on the new Windows template this semester. Its remote administration capabilities are already proving useful.

On a Samba domain, there isn't much that you can do to modify your Windows machines once they are installed. We use Symantec Ghost to generate new templates every semester, but that's hard work and bugs do not get fixed very fast. Ghost Console is a theoretical solution for this, but our computers in outside labs are connected to us by a magic VLAN (not run by us) that eats multicast packets. And I have heard bad reports about trying to install large packages through Ghost Console.

I put together a remote administration system a year ago based on PsExec and some batch scripts. It was a failure. It was too complex and one of the biggest problems was keeping track of failed installs and newly ghosted computers.

I thought about writing a new system, one with an actual GUI, etc., but I thought I'd give WPKG a spin first. It's not perfect, or even all that good, but it gets the job done.

In past two or three days I have used WPKG to:


  • Push out the new Adobe Illustrator serial key to every machine.

  • Push out fixes to machines using Epson 4180 scanners.

  • Push out special All Programs menus to "special needs" machines.

  • Change our McAfee anti-virus settings.


The Adobe Illustrator key was the hardest part. Adobe was slow generating the key, and got it to us just hours after we began installing the latest template. I had installed Illustrator, but without the key it was useless.

My first step was to call up Adobe to ask them for a command-line method to insert the key. As expected, I didn't have any luck with the tech support guy I spoke to. "That's going to have to stay a secret," he told me.

I could have tried a silent reinstall. I knew that a silent install of Illustrator was possible, since I had done it with Adobe CS2. Unfortunately, the silent installer wanted the original media. And it wanted that media in the same place as it had been on the first install. And it wanted the media for every CS3 product on the computer, not just Illustrator. That wasn't really doable across the network.

So I decided to write an AutoIt script to install Illustrator. Writing macro programs is always a pain, but that's life. It was important to use "WinWait" commands instead of "WinWaitActivate" and "ControlSend" instead of "Send" because I would be dealing with non-visible Windows. I ran into a bug with "ControlSend" sending ";" instead of ":" but I worked around it.

The hard part came when I tried to run the AutoIt script through WPKG. System users cannot interact with GUI programs. I looked around the web to find out how other people had dealt with this, and it turned out that they mostly hadn't.

The only solution I did find was impossible for us. He had used auto-login user to run his WPKG installs at boot. This method struck me as intrusive, and besides, it seemed impossible with an already deployed system.

I thought about using "runas /USER:Administrator" but that can't be scripted.

So I downloaded PsExec, the old SysInternals tool, and used that to make connections as Administrator to the local machine. As long as PsExec is passed the "-i" flag, everything works.

The scripts for the non-Illustrator changes were built along similar lines.

So that's remote Windows administration in a nutshell for you. It makes me want to write a serious tool for doing all this instead of relying on all this hackery, but that will wait until someone decides they want to pay me to do it.

June 9, 2007

From Woit's book Not Even Wrong

"The organizer was a prominent Italian physicist, Antonio Zichichi, who was the subject of many legends, often involving his connections at the highest and lowest levels of Italian society. One story that made the rounds about Zichichi (I cannot recall who first told me this and have no idea whether it is true) was that one year, a physicist who was to lecture there had the misfortune of having his luggage stolen from him during the train trip to Erice. When he got there, he told Zichichi about the problem, remarking that it would be hard for him to give his lectures, since his lecture notes had been in his bags. Zichichi told him not to worry, that he was sure everything would be all right. The next morning he awoke to find that his luggage was waiting for him outside the door to his room."

June 3, 2007

Fixing the mouse for Debian Unstable and Virtual PC 2007

I upgraded Debian to unstable for the new boost libraries and in hope that a new xorg would allow the S3 video drivers to display in something better than 1024x768 resolution. No luck there.

My mouse stopped working too. This has been reported for the new Ubuntu and the fix is the same for Debian unstable as it is for Ubuntu: include "i8042.noloop" as one of the kernel parameters on boot.

June 1, 2007

Style optimization is the new premature optimization

Which one of these is better:


  • if (s == String.Empty)

  • if (s == "")

If you think about it long enough, it's almost a Zen Koan. Jeff Atwood believes that the second is clearly preferable, because it is more concise. Numerous commenters weigh in on either side in his responses section.

My own thoughts? It clearly doesn't matter. Programmers whine about premature optimization every chance they get. They haven't gotten the message yet that discussions like this are just as bad.

May 30, 2007

New Features in the C++ Standard

There are a lot of nifty features coming with the new C++ standard. Concepts, multi-threaded programming support, garbage collection are all a shoe-in. A lot of Boost libraries have been approved already. The big feature that I'm hoping makes it in is closures.