As you all know (or not, whatever), I am sharing files between all of my computers using a Linksys NSLU2, running OpenSlug.

Recently, however, I had a few problems because the power connection in my apartment was a little unstable. My whole town seems to have a very fuzzy connection, so power outages of a few seconds happen maybe once or twice a months, resetting all non-battery clocks. Until now, I just restarted the Slug, re-mounted everything in the Slug and on the clients, and it worked again until the next outage a few weeks later.

Lately, it turned into a bigger problem: The power did not go off all the way, but it flickered sometimes (read: daily), killing the poor Slug. Every bigger appliance (including "real" computers) didn't have a problem with that, however the Slug couldn't handle it.

So I asked for suggestions on the mailinglist, and Chacko came up with the idea to connect a few rechargable batteries across the output of the power supply, providing the slug with at least a few minutes of battery backup in case the power goes out, depending on the power consumption of the attached devices etc.

Let's build a custom UPS for the NSLU2!

I made a small sketch of how it is supposed to look like: NSLU2 battery backup <!--more--> I got the parts at RadioShack (you can get them on ebay, too, or wherever). This is what I needed:

  • 1 DC power plug (male), size N (don't let them tell you it's another one, I had to go back to get an exchange sigh)
  • 1 DC power jack (female), same size
  • 1 battery holder for four AA batteries, connected in series. Nice if it is closed (you don't need to get in there often) and a small on/off switch on there is a plus too.
  • 4 rechargable batteries, type AA, Ni-Cd or Ni-Mh
  • some wire to connect all that
  • the usual items to solder it all together (solder, soldering iron)

Heat it up!

Now the actual wiring is really easy. Connect the negative (black) connector of the battery holder to the negative (outer) part of the female connector, together with a short piece of black wire. Now connect the positive (red) connector of the battery holder to the positive (inner) part of the female connector, along with another piece of (red) wire.

Afterwards, solder the other ends of the red and black wire pieces to the male connector, red on the inside, black on the outside.

Close everything (and make sure you didn't produce a short circuit, if you don't want to fry your slug...).

Now you want to make sure when your new cable is plugged between the power adapter and the slug, the slug switches on as expected. If that works, switch it off again.

Now add the batteries. Again, connect power source and batteries, try if the slug works.

Now you can test if the battery backup works: Disconnect the power cord and see if the slug stays on. If so: Success! :)

A few thoughts

1) The batteries. As CN mentioned, the batteries will never get fully charged. That's good (so they won't explode and whatnot) but it means your "UPS" will not quite last forever, especially if your battery also feeds a harddrive via the USB port. But it should still give you a considerable amount of backup time until the batteries are empty. (We are speaking about tens of minutes).

Also, with Ni-Cd batteries, it could come to a memory effect (voltage depression). However, the NSLU2 wiki mentions the lowest voltage to run the Slug seems to be around 3.5 volts, which I expect to be reached even by batteries that have the characteristics of a "memory effect". Unlike "greedy" devices (like digital cameras etc), the slug might still work flawlessly with a less than ideal battery voltage. Additionally, the typical "memory effect" happens because of over-, not undercharging Ni-Cd batteries. In this case, this should not happen, because the voltage of the power supply (around 5V) is expected to be a little less than the one of four fully charged batteries (around 1.4V each, 5.6V total). If we are lucky, this keeps our batteries healthy for a long time.

For me, this seems to be the perfect solution. Since none of my other computers have UPSes, I can't access any files during a power outage anyway. But for the short power gaps that happen every once in a while (or very often, like in my apartment), the batteries will reliably keep the slug running until the power is back on.

2) The hard drives. Since my Slug does not feed the harddrives, I still have to find out what will happen when these become powerless and they are switched back on shortly after. Will they stay mounted? Will I still be able to connect to them without manual maintenance on the Slug? We'll see.


Thanks to Chacko (CN) for pointing out this simple yet effective possibility. And thanks to Jabba for helping me geek out and doing the soldering part professionally as usual. :)

Read more…

Google Labs LogoI recently tried out Google's (quite) new Browser Sync extension for Firefox.

So far, I like it. It seems to be synchronizing my bookmarks and long-term cookies between browsers and across operating systems pretty well. But, there are a few things I don't like:

  • When I switch from one computer to the next, it logs me off the first computer. In order to sync the boxes, I therefore have to close every single browser window on computer A so that it copies it stuff to the sync account, and after that, I can open a window on computer B. That's really annoying, especially because I don't close every tab when I leave work just to open the same pages (references etc) yet again the next morning when I get back. There doesn't seem to be a way to get my bookmarks etc. synchronized without actually closing the whole deal.
  • Once, when I installed the plugin on my Mac Mini, the highly sophisticated "conflict resolution" system included in Google Browser Sync wiped out my whole bookmarks toolbar. Now this is reliable, right there. I wonder what I need such an extension for when I lose my bookmarks anyway. It works now, but at that point, I was quite annoyed having to put my most visited web pages on the bar again.

So, I am wondering if there are "competitors' products" we could try out? As in most parts of life, a little competition does not hurt. I remember, I saw an alternative roaming profile extension for Firefox recently, but I forgot to bookmark it (or it was on the toolbar that was wiped by Google ;)) -- in any case, now I can't find it anymore, because the search engines are flooded with articles about Google when you search for Firefox roaming profile extensions and similar.

Can anybody help me out?

Read more…

One of the newer technologies on the web are the flash video players used by Google Video and YouTube.

Every once in a while though, on Mac OS X it can happen that these Flash video players don't have sound anymore.

It is pretty hard to figure out why, and the solution is quite random, but on macosxhints I found a comment mentioning that it could be a sampling rate problem:

  1. open /Applications/Utilities/Audio MIDI Setup
  2. check the properties for Built In Output.
  3. It might be set to 96KHz. Change it to 44KHz and audio in Flash will return immediately.

Now, I don't know what software it is messing up that setting, but I am glad it can be fixed.

I am still wondering why the Flash player would care about MIDI settings. Obviously it's no MIDI file that is being played as movie sound there.

Read more…

Drake: a Male duck, from wikipedia I am a Ubuntu Linux user. On my laptop and at work, I was running "Breezy Badger" (Ubuntu Linux 5.10) since last fall.

But one of the worst things about it was its inability to connect to WPA-encrypted Wifi access points. Eventually, I wrote a few shell scripts that made me able to connect to my AP at home, but it was far from being handy.

Now yesterday, I installed the new release, Dapper Drake on my laptop. The installation was straightforward, and by the way I liked it a lot that the installation CD is a live CD at the same time so that new users can "try before they buy".

When everything was installed, I realized that my wifi card was recognized and activated automatically, yet I was not able to connect to a WPA encrypted network. Instead it tried to connect to one of my neighbors unencrypted access points. Downgrading my connection to the demonstrably weak WEP encryption was not an option earlier, nor was it now.

Already being a little disappointed, I searched the Ubuntu forums and after a while, I came up with a thread about WPA access points with Ubuntu Dapper Drake.

In short: Nine seven steps to WPA encrypted Wifi with Ubuntu Dapper Drake:

  1. sudo apt-get install wpasupplicant (might already be installed)
  2. (You might have to do a sudo apt-get update in order to fetch the newest metadata for apt-get)
  3. sudo apt-get install network-manager-gnome
  4. sudo gedit /etc/network/interfaces -- Comment out everything but "lo" entries in that file
  5. Create a file called /etc/default/wpasupplicant, add entry ENABLED=0
  6. Reboot your system
  7. Left-click the network manager icon in Gnome and select your wireless network
  8. Follow the prompts for password, type, etc.
  9. It will ask you to choose a password for your new "keyring".
  10. Be happy ;)

Now everytime you boot up and log in, the network manager will connect you to your preferred WPA-encrypted network as desired.

There are only two caveats that I currently know of:

  • The connection is only made once you log into Gnome. So if you plan to run this connection on a server or if you need a network connection before you get to the login prompt (i.e. during bootup), this method is not ideal for you.
  • A current bug is that you are asked for your keyring password twice (?) everytime you log in. This can be annoying, but rumor has it, it is already fixed and an update will be released soon.

As you see, Dapper Drake made a big step towards the usability of Linux on laptops. Hope you give it a shot. It seems to be worth it.

Update: Removed two unnecessary steps. Thanks, Martin and Zakaria!

Read more…

I found a Mac OS X hint yesterday mentioning how VideoLAN CLient (VLC) can save streaming videos into a file. Since today I wanted to record a radio show off the Internet, I gave it a shot for an audio stream too.

Here's what I got:

If you want to save a Quicktime (AAC/MP4) audio stream (maybe others, too? Leave a comment if you know!) to a file, start VLC from the command line (terminal window) like this:

/Applications/ --rtsp-tcp rtsp:// --sout '#standard{access=file,mux=mp4,url=/Users/Shared/VLCoutput.mp4}'

Now, if you want to schedule the whole thing, a cron job will do the job. The tool at would be certainly more correct (since you don't want to schedule it as a recurrent task), but the at daemon is disabled on OS X by default.

So, do a crontab -e and put in two lines like this (yes, put the whole VLC stuff into one line as mentioned above):

0 15 12 5 * /Applications/ --rtsp-tcp rtsp:// --sout '#standard{access=file,mux=mp4,url=/Users/Shared/VLCoutput.mp4}' 30 15 12 5 * killall -QUIT VLC

The first line starts VLC as mentioned above. 0 15 12 5 means: Start at 3 p.m. (= 0 15), on May 12 (= 12 5). The asterisks in each of the lines just mean that you don't care about the weekday. <!--more--> The second command, accordingly, stops recording at 3:30 p.m. by killing the VLC process. Two notes on that:

First, keep in mind to sind the QUIT signal rather than TERM (which would be the default), otherwise VLC won't correctly finish writing the file and probably render it unusable.

Second, killall is the mass murderer of the kill() commands. It will kill all running instances of VLC, not just the one recording your stream. So, don't wonder if the movie you happen to be watching stops playing at the scheduled time.

Save it and you are all set: Your stream will be recorded at the right time. You will find your stream in the Users/Shared/ folder, as specified in the VLC command line.

Eventually, when everything is done, you do a crontab -e again, and remove the two lines so that it won't start recording again, a year from now ;)

Have fun listening!

Read more…

Too bad my NSLU2 apparently does not have a battery inside...:

# ntpdate Looking for host and service ntp host found : 8 May 21:08:00 ntpdate[4084]: step time server offset 1145070824.207699 sec

Read more…

To keep track of my numerous bookmarks on the Internet, I use the popular bookmarking service, along with a handy Firefox extension.

Well, when you accidentally hit the "tag" button on a newly opened tab in Firefox, this is what happens:

You are bookmarking the unbelievably useful website about:blank.

Due to the ginormous amount of information stored on that web page, I decided to keep the bookmark as a valuable resource for my daily Internet research (after all, it is the "home" page in my web browser and thus the first page I ever see when opening Firefox). ... And so did 2362 other people who were as stupidsmart as me to bookmark about:blank ;)

about:blank bookmark

Update: ... and counting...: There are already 2374 people besides me, now :)

Read more…

Recently, I have to do a lot of point plots for one of my classes, i.e. taking huge amounts of two-dimensional data points, having them "drawn" and printing out the resulting image.

Usually, for this job, I used Maple, mostly because this is my computer algebra system of choice since I used it in my advanced math course in high school. It is just so much better in tedious arithmetic than I am ;). Writing a little script, I read in the provided data file by the teacher and returned an expression that I could directly copy and paste into Maple. The resulting graphs look somehow like this:

A Maple Example Plot

However yesterday, I managed to break Maple. I read in two lists of a few hundred data points each and wanted to plot them together with a function in one plot. So far so bad: In spite of the correct syntax, I got some evaluation errors and an empty plot. Great.

So I tried gnuplot, the apparent "industry standard" for all sorts of scientific data and function plots (unless, of course, you spend a sh*load of money on Matlab ;)). And, within minutes, thanks to the numerous howtos on the Internet I was able to make much more beautiful (and working) plot such as this one:

gnuplot Example Plot

And I finally understand why so many people are using it: It is just the right tool for the job.

One tutorial I want to point out in particular are the not so frequently asked questions that helped me a lot to get the trivial, not-so-trivial-after-all tasks done to get a little more sleep and spend a little less time on homework. :)

Read more…

Today I was connecting a second USB harddrive to my NSLU2.

What you get is a few interesting effects, among them device IDs (/dev/sda, sdb...) changing depending on the order in which you attach the drives. Plus, I added a USB hub, which makes the device names change anyway.

udev plus tux, from the udev pageThe solution for the crazily jumping dev nodes is the udev system, which is part of Linux for quite a while now, but I never really had a need to play with it yet. But the howto is pretty nice and easy to apply.

Still, a few notes:

  • The SYSFS{whatever} rules support wildcards, so that you don't have to write the whole descriptor if you don't want to. For example, "Max*" instead of "Maxtor 6" works totally fine. -- That's especially useful since SYSFS{model} descriptors often seem to be filled up with a couple of spaces at the end.
  • Some (all?) USB hard drives in fact don't consider themselves to be USB devices. So in this case defining BUS=="usb" will not result in any device links to be created at all. I had to define BUS=="scsi" instead. You should look at the udevinfo output as suggested in the "writing udev rules" howto, it will tell you exactly what setup is necessary for your device/drive configuration.

That's how my two new rules look like (each in one line only): BUS=="scsi", KERNEL=="sd", SYSFS{vendor}=="Maxtor", SYSFS{model}=="L250R0", NAME="%k", SYMLINK="usbhd/maxtor250%n" BUS=="scsi", KERNEL=="sd", SYSFS{vendor}=="Maxtor", SYSFS{model}=="Y080P0", NAME="%k", SYMLINK="usbhd/maxtor80%n"

If you have any questions, let me know.

If not, have fun :)

Read more…

The harddrive manufacturer Hitachi offers something new on its website:

Noises that indicate hard drive failure in WAV format.

Be warned, it's not for the faint of heart. Now that's what I call a nightmarish soundtrack - hopefully nobody sues them because of the emotional pain when hearing harddrives crash ;)

(via (German) zeitwissen blog)

Read more…