Insta-uploads

Clever:

Dropbox (file storage and synchronizing service) uses a lot of hashing behind the curtains. For example if you try to put huge but common file in your Dropbox (large patch or whatever) its hash is calculated. If file is already present on servers it is linked to your account. Without wasting time and bandwidth.

source

To be clear, this means that if I upload a 10 meg pdf to my space, Dropbox creates a unique id from that file and stores it in a database. If you later upload the same file, Dropbox is smart enough to just copy my pdf to your folder, saving you (and them) a ton of bandwidth.

Discovered via this AskMe question, where a user noticed that ~600MB of files uploaded almost instantly.

Using a Dell Mini 10 as an ebook reader in Ubuntu

We just purchased a Dell Mini 10v, and I’ve been quite happy with it so far. One of of the things that occurred to me after holding it, was that it would make a great e-book reader if I could rotate the screen 90 degrees and map one of the edge keys to “turn the page”.

So, I whipped up a little script to do just that. It works very well with any book in HTML format, which means that I can load it in firefox, hit F11 to fill the screen, and read comfortably.


#!/bin/bash
#
# Author: Chris Miller (chrisamiller@gmail.com)
#
# Emulates an ebookreader by rotating the screen 90 degrees and
# mapping the windows key to pagedown
#
case $1 in
  on)
    echo "Mapping Win to PgDn..."
    xmodmap -e "keycode 133 = Next"
    echo "Rotating Screen"
    xrandr --output LVDS --rotate right
    echo "Done."
    ;;
  off)
    echo "Mapping Win back to Win..."
    xmodmap -e "keycode 133 = Super_L"
    echo "Rotating Screen"
    xrandr --output LVDS --rotate normal
    echo "Done."
  ;;
  *)
    echo "Usage: toggles screen rotation and windows key"
    echo "to simulate an e-reader"
    echo "ereadmode (on | off)"
    ;;
esac

To use it, save the script as “ebookmode”, place it somewhere in your path, then make it executable. To start it, type “ebookmode on”. To return to normal operation, type “ebookmode off”.

Update: After upgrading to Karmic, I had to replace “LVDS” with “LVDS1″. You can check to see which output you’re using by typing: “xrandr -q” at the command line.

The future is now

After working out a problem on the whiteboard, I snapped a picture of it with the tiny camera in my phone, used bluetooth to sync the picture to a laptop without any cables, then used wireless internet to send it to my always-accessible email which resides on a computing cluster in another part of the world.

I’m awfully glad I live in the future.

Are Wii Fit?

I can’t laugh too hard, because we own one.

Emulate say() in Ubuntu

Macs come standard with the “say” command, which translates text into speech. It’s pretty easy to do the same thing on linux, using a package called ‘festival’.

Install the app:

sudo apt-get install festival

Then try it out:

echo “Hello World!” | festival -tts

If you get an error message that says “can’t open /dev/dsp”, do the following:

sudo apt-get install esound-clients
sudo gedit /etc/festival.scm

and paste in the following lines:

(Parameter.set ‘Audio_Command “esdplay $FILE”)
(Parameter.set ‘Audio_Method ‘Audio_Command)
(Parameter.set ‘Audio_Required_Format ’snd)

Now, save the file, and try it again.

I added a little alias, as well. Open up your ~/.bashrc and add these lines:

function say {
    echo $1 | festival --tts
}

Now the command requires much less typing:

say “Hello world!”

Have fun!

Your life is in your data. Own it.

I’ve been using google documents a lot lately, as I like the convenience of being able to close a document at work, then come back home and pick up right where I left off after dinner. It’s got me thinking about this new fangled idea that our digital lives should live in the cloud, though.

Now, don’t get me wrong, I love my gmail. I just worry that people have no qualms about entrusting their important data exclusively to third parties anymore. Three illustrative stories:

  1. Ma.gnolia, host to the online bookmarks of tens of thousands of people, suffers massive “data corruption and loss”. The end result is that many people have to start from scratch.
  2. A gmail user wakes up one day to find that he is locked out of his account for no reason, and it takes him over a week to get his access restored.
  3. AOL Hometown, a sort of neo-geocities, shuts down with very little notice:

    We’re talking about terabytes, terabytes of data, of hundreds of thousands of man-hours of work, crafted by people, an anthropological bonanza and a critical part of online history, wiped out because someone had to show that they were cutting costs this quarter.

    It’s an eviction; a mass eviction that happened under our noses and we let it happen.

Think, for a second, about what’s in your email archives: phone numbers and addresses of your friends, instructions for getting that tricky system at work to function correctly, love letters, pictures of your family vacation.

Sure there’s a lot of chaff mixed in, but some of this content is irreplaceable. Ever seen the love letters that your grandfather wrote your grandmother? Sure, we’re exchanging sappy poetry in a different medium now, but shouldn’t your grandkids have the same opportunity?

So stop trusting the cloud to keep this stuff safe for you. Set up Thunderbird to keep a local copy of your email. Use Google Docs Download or gdatacopier to keep copies of your online documents. Don’t ever delete local copies of those pictures after you upload them to Flickr. And for the love of pete, stop using services like Hotmail that give you no way to download your mail. Who’s mail is it, anyway?

—-
Update: Some more discussion over at Friend Feed

Fix css-mode indention in emacs

Here’s a quick fix for the obnoxious default indention settings for emacs. Just drop these lines into your .emacs file:

(setq cssm-indent-level 4)
(setq cssm-newline-before-closing-bracket t)
(setq cssm-indent-function #'cssm-c-style-indenter)
(setq cssm-mirror-mode nil)

Thanks to stokebloke.com for saving my sanity.

Change (dot gov)

Promptly at 12pm, Obama’s media team launched the redesigned whitehouse.gov. Some thoughts:

Perhaps most emblematic of a new, open government, though, is the site’s robots.txt file. For the uninitiated, a robots.txt file tells search engines like Google what they’re allowed to index. Things that aren’t indexed aren’t searchable. The old whitehouse.gov had a robots.txt totalling over 2400 lines, meaning that lots of stuff on the site was essentially hidden, or at least a pain in the ass to find. Obama’s site has just one exclusion, which is a directory used for scripts (useless information for search engines anyway).

Here’s to a new day in the US of A.

uTorrent and Ubuntu

RSS feeds plus bittorrent makes auto-downloading video content from the web easy, and keeps our library full of shows to watch through the Xbox. I struggled for a while to find a bittorrent client that was simple and had the features I wanted, though.

Azureus is a bloated mess, Transmission is far too simple, Deluge made feeds a pain in the ass . . . you get the idea. Finally, I found that uTorrent had all the features I wanted in a lightweight, easy to use client. The only problem is, it doesn’t run natively on linux. Thankfully, it runs almost perfectly through Wine, with a taskbar icon and everything.

The only problem I had was that when I clicked on a torrent in my browser, I couldn’t get it to auto-launch in uTorrent. The extra layers added by wine complicated things. I finally solved the problem by writing this little bash script:

#!/bin/bash
cd ~/.wine/drive_c/Program\ Files/uTorrent
echo ""
if [ "$1" != "" ]; then
    dt=`date +%s%N`
    cp "$1" /tmp/$dt.torrent
    var="Z:\\tmp\\"$dt".torrent"
    wine utorrent.exe "$var"
else
    wine utorrent.exe
fi

It takes the torrent file given as an argument, saves it to an accessible location, then opens it using uTorrent. Save the script, make it executable, and then set firefox so that it uses the script to open any torrent files. Problem solved.

Q: “Any of you had any experiences with caBIG?”

A: “caBIG provides a scalable infrastructure for discovering and obtaining grant money”

Eric Jain, responding to Deepak, via friendfeed

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”

Brian W. Kernighan

13 Geek-y Programmer Quotables.

HPL Bookmarklet

Here’s a bookmarklet that searches the webpage you’re on for an ISBN number, then searches the Houston Public Library for that book. I didn’t test it on a lot of sites, but it works well enough on Amazon. To use it, just drag it to your bookmarks toolbar.

HPL Library Search

Big Data

Nice to see bioinformatics and computational infrastructure getting some love in today’s issue of Nature:

Above all, data on today’s scales require scientific and computational intelligence. Google may now have its critics, but no one can deny its impact, which ultimately stems from the cleverness of its informatics. The future of science depends in part on such cleverness again being applied to data for their own sake, complementing scientific hypotheses as a basis for exploring today’s information cornucopia.

Hopefully, funding agencies and universities will take note and begin funding infrastructure projects, and the scientific community will begin recognizing the value they add. A good computational project can enable thousands of discoveries, and the biological community needs to give appropriate credit (and pay) to bioinformaticians.

There are several other good articles in this issue, including one about biocuration. Link (free access for two weeks, as I understand it)

Long time…

Most of my activity lately has been elsewhere on the web.  (Twitter, Delicious, etc).  If you’re not keeping up with it, be sure to check out the root of this site (chrisamiller.com).  It aggregates all my posts elsewhere and includes an RSS feed.

QOTD

“Progress isn’t made by early risers. It’s made by lazy men trying to find easier ways to do something. ”
Robert Heinlein

Rotating One Monitor with Ubuntu

Ubuntu’s support for graphical displays has come a really long way. In Hardy 8.04, most of the configuration is handled through a GUI that works very well, in my experience. There are still a few edge cases that require a little manual configuration, though. Today I ran into one of them.

I have two monitors at work, and today I decided to rotate one of them to a vertical orientation. It’s nice for coding, because I can see many more lines of code at once. The other one I like to keep widescreen. Here’s how to accomplish this using an Nvidia dual-headed card, the nvidia proprietary driver (not nv), and two Dell flatscreen monitors.

Assuming you already have your monitors set up and working with the nvidia driver, start by backing up your xorg.conf. If something goes wrong, you can always restore this and be back where you started.

sudo cp /etc/X11/xorg.conf etc/X11/xorg.conf.bck

Then, fire up nvidia-settings from the terminal. Under “X Server Display Configuration”, make sure that you’re using “Separate X screen” and not “Twinview”. Twinview works great when the monitors are in the same orientation, and even gives slightly better performance, but didn’t allow me to rotate just one of the monitors. Check the box that says “Enable Xinerama”, and then write the changes to your X Configuration file.

Now, for the rotation:

sudo emacs /etc/X11/xorg.conf

In the appropriate “Monitor” section, add the lines:

Option "RandRRotation" "on"
Option "Rotate" "CCW"

Change “CCW” to “CW” for clockwise, instead of counter-clockwise.

Save the file, hit CTRL-ALT-Backspace to restart your Xserver, and you should be seeing the results. Great! Well, almost great…

There’s just one problem. There’s a known bug where gnome-terminal doesn’t work properly when nvidia composite drivers are enabled. The first solution in that thread (disabling the composite) didn’t work for me, so I did the following workaround that sets some environment variables every time the terminal is launched. Hit ALT-F2 and type “xterm” (since we can’t use gnome-terminal), then do the following:

sudo mv /usr/bin/gnome-terminal /usr/bin/gnome-terminal2
sudo emacs /usr/bin/gnome-terminal

In the new file you’re now editing, paste the following:

#!/bin/bash
XLIB_SKIP_ARGB_VISUALS=1 gnome-terminal2 $@

Save the file and make it executable:

chmod +x /usr/bin/gnome-terminal

Now, everything should work correctly.

Update 10/28/08:
Due to popular demand, my xorg.conf is now posted here. It’s important to note that using Xinerama disables the composite extension, so compiz eye candy (aka advanced desktop settings) will not work. Fortunately, I value the setup for coding far more than I value shiny spinny desktop cubes.

Cognitive surplus

Clay Shirky thinks we’re at a critical point in our society, where we shift away from a passive television culture and use the cognitive surplus to create a participatory culture. Here’s an excerpt, but definitely read the whole thing.

I was being interviewed by a TV producer to see whether I should be on their show, and she asked me, “What are you seeing out there that’s interesting?”

I started telling her about the Wikipedia article on Pluto. You may remember that Pluto got kicked out of the planet club a couple of years ago, so all of a sudden there was all of this activity on Wikipedia. The talk pages light up, people are editing the article like mad, and the whole community is in an ruckus–”How should we characterize this change in Pluto’s status?” And a little bit at a time they move the article–fighting offstage all the while–from, “Pluto is the ninth planet,” to “Pluto is an odd-shaped rock with an odd-shaped orbit at the edge of the solar system.”

So I tell her all this stuff, and I think, “Okay, we’re going to have a conversation about authority or social construction or whatever.” That wasn’t her question. She heard this story and she shook her head and said, “Where do people find the time?” That was her question. And I just kind of snapped. And I said, “No one who works in TV gets to ask that question. You know where the time comes from. It comes from the cognitive surplus you’ve been masking for 50 years.”

Shirky estimates that if you took all of Wikipedia as a unit of measure — that is, all 2,354,625 articles, with their billions of edits, behind the scenes discussions, and individual contributors — the US’s two hundred billion hours per year of television watching could produce the equivalent of 2,000 wikipedias. That’s a lot of untapped mental activity. He argues, pretty convincingly, that if you could harness even 1% of that time in participatory ways, you’d come up with some pretty amazing stuff. Wikipedia, Youtube, and the rest of the blogosphere agree.

Using vpnc to connect to a Cisco VPN on Ubuntu

First instal vpnc:
sudo apt-get install vpnc

Now, find the .pcf file that your office provides you. Open it in a text editor and use the relevant info to create file /etc/vpnc/default.conf. The contents shoudl look something like this:

IPSec gateway 123.456.789.123
IPSec ID
IPSec secret
Xauth username

There’s one hold up, though, as many companies provide their secret phrase pre-hashed. This means that it can’t be entered correctly into the configuration file for vpnc.

(your pre-hashed secret string will look something like this)

E6A01097705A303C1128DC224D959D741A708AA5A
AE8D5DAA8E982A5AC5328B76639038E03A8620395
A11C5C1732D5149FB4743293B4E50A

The solution is to hop over to this cisco vpnclient password decoder, pop in your hash, and retrieve the key. If you’re really paranoid, you can download the C source code and run it on your machine.

Finish filling out the conf file, save it, then run
sudo vpnc --natt-mode cisco-udp /etc/vpnc/default.conf

To disconnect, run
sudo vpnc-disconnect

Telco Shakeup

Sending an amount of data that would cost $1 from your ISP would cost over $61 million if you were to send it via text message. How ridiculous is that?

The good news is, the rise of the iPhone seems to be forcing telcos to open up the airwaves to more applications. Verizon plans to open their network to any device and application sometime this year. This is promising news that should help make internet access even more ubiquitous.

Why I use emacs

Everyone’s first vi session:

^C^C^X^X^X^XquitqQ!qdammit[esc]
qwertyuiopasdfghjkl;:xwhat

« Previous Entries |