Saturday, February 23, 2008

Eye-fi wireless SD card - cool, but could be so much better

Eye-fi have released a 802.11 wireless SD card, which is pretty amazing tech considering the form factor. This is a very cool idea, but there are a few things I don't like:
  • If you upload to a website like flickr, all your photos first go through eye-fi, which sucks. Why should they get copies of all my photos? They say it is so you can resize them before posting to Flickr etc. I don't think the posting process is that complicated it needs to be done by the back end.
  • You can only upload to nominated SSIDs. This isn't how I want to use this thing - if I'm at home I can just use the card reader, backing up is easy, and I don't take any photos at home! I want to use it on holiday, where I have no idea what APs are available and definitely won't know authentication keys.
  • There is no open API to extend the use of this tech. Take a leaf out of Google's book! Imagine applications in scientific data recorders sending back data, or GPS nav devices sending tracks so others could track progress of relatives driving from out-of town, friends on holiday etc. in near real-time.
  • It doesn't work on linux, but someone is working on that. If the device was more open, linux developers and users would have it written in days!

Here's how I would like it to work:

  • I specify a list of preferred APs, which it checks for reasonably frequently. I can also set a longer interval after which if it can't find my preferred networks it associates to any open AP that can get to the Internet.
  • Card makes an SSL connection to flickr/picasa and checks the certificate against the certificate fingerprint I supplied at configuration time. This means your data is encrypted and has not been a man-in-the-middle victim, circumventing the suite of nasty attacks that malicious APs can make. Photos uploaded directly to flickr/picasa, I don't waste bandwith/battery sending them to my home computer since I can download them off the card when I get home anyway.

Imagine the possibilities if one of my access points is Free the net!! Photos backed up to flickr as I wander around the city.

Friday, January 25, 2008

Linux streaming audio HOWTO: triplej over the Internet

You will pick up a link like this off the website:

http://abc.net.au/streaming/triplej/triplej.m3u

Which if you download it just is a redirector to:

http://202.6.74.107:8060/triplej.mp3

So, make sure your firewall is going to allow the wacky port and you are off:

mplayer http://202.6.74.107:8060/triplej.mp3

Update: Saving the stream


This is how you can save the audio stream and listen at the same time! You can also get mplayer to parse the playlist file for you:

mplayer -playlist http://abc.net.au/streaming/triplej/triplej.m3u -dumpstream -dumpfile /home/greg/mp3/hottest_100.mp3
mplayer hottest_100.mp3

Mplayer, I love you.

Thursday, January 24, 2008

MySQL commands I always forget

I always forget these, don't know why:

show full processlist

show table status

show index from [tablename]

mysqdump --no-data [dbname]

Thursday, January 17, 2008

Things I don't like about MySQL

Generally I really like MySQL, have used it for a number of different projects, and I will continue to do so. However, recently I have started working with larger databases and using some of the more advanced features and am running into some annoying problems.

Passing a table name as a parameter


The number one gripe I have actually turned out to be just as ugly using Postgres and Oracle as well, so I can't hold this one against MySQL.

I have found myself wanting to pass table names as parameters to stored procedures, but this makes the code really nasty with string concatenations as below:

DELIMITER $$
DROP PROCEDURE `GetMaxID`$$
CREATE PROCEDURE `GetMaxID`(IN pTableName CHAR(50))
BEGIN
SET @sql = CONCAT('SELECT MAX(ID) FROM ', pTableName, ' INTO @max');
PREPARE stmt FROM @sql;
EXECUTE stmt;
END$$

Now imagine a complex stored procedure that needs to reference that table name a lot. Yick. I'm going to try and avoid this situation by putting the logic in the application until MySQL brings out something like a format string :P

I can't raise an error inside a stored procedure


This sucks. I do some sanity checking inside my stored procedure but there is no way to fire an error. Well, no convenient/useful way anyway. Apparently this has been addressed in 5.2, which is not soon enough.

No foreign key enforcement in MyISAM


This is a shame, and I know I can choose InnoDB if I want FK support, but what I really want is the speed of MyISAM with the option of having my FK constraints enforced. I want to be able to turn it on, see how fast it is, and if it is too slow turn it off again.

Can't build cursors from dynamic SQL


This is annoying. The workaround is to use a temporary table, but that is messier than I would like.

No Partition Pruning on Timestamps


This is pretty sucky and MySQL doesn't seem to be in a hurry to fix it. You can't get partition pruning optimisation on timestamps - so partitioning is pretty mcuh useless. You have to workaround it by using unsigned int's and UNIX_TIMESTAMP and FROM_UNIXTIME. You can partition on Date fields but they are twice the size, which is a big disadvantage for large databases.

Wasn't a real database before 5.1


MySQL just doesn't seem to have been a real database before version 5.1. I guess everything has to start somewhere, but this is a bit too recent for my liking and I seem to be hitting plenty of 5.0 installs that just don't have the advanced features I want.

Worst for security according to David Litchfield


At AusCERT 2007 I asked David Litchfield, database security ninja, which of the popular databases had the worst security - he said MySQL :( I tried to push for some specifics but he didn't give me any solid information.

Sunday, January 13, 2008

Yubnub - quick searches and more 'quicklinks' style

Yubnub rocks. It gives you a search box in Firefox that lives to the right of the URL bar. Here is some example usage:

Google yubnub: g yubnub
Google maps search: gm bicycle stores boston
Wikipedia search: wp monkey

This is only scratching the surface, there are hundreds of different shortcuts.

Update:

I stopped using yubnub because I didn't like the idea that one guy knew my IP address and everything I ever search for. This is worse than google knowing everything I search for because by its nature it ties everything together: flickr, delicious, wikipedia, mysql.com etc.

Apt update notifier - automatic package installation

Why doesn't anyone talk about the inbuilt apt update notifier? There is no end of scripts for downloading/notifying of package updates that duplicate update-notifier functionality. On feisty to get my apt package updates downloaded and installed automatically, I edited /etc/apt/apt.conf.d/10periodic to include:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "0";
APT::Periodic::Unattended-Upgrade "1";

And then run apt-config dump to verify the results.

Update:
In Hardy, take a look at this file:
/etc/apt/apt.conf.d/50unattended-upgrades
I uncommented hardy-updates to allow those to be automatically applied as well. The unattended upgrade is performed by a python script:
/usr/bin/unattended-upgrade
which logs to
/var/log/unattended-upgrades/unattended-upgrades.log
You can run this script manually with -d to get it to write debug info to the log.

Ripping and converting CDs/MP3s on Linux

To go from mp3s to WAV to make an audio CD, use mplayer:
for nam in *.MP3; do nice mplayer -ao pcm "$nam" -ao pcm:file="$nam.wav"; done

To rip CDs to mp3 I use GRip with these settings (variable bit rate encoding):
/usr/bin/lame --preset standard %w %m

Encode file format:
~/mp3/%A/%d/%t-%n.%x