Wednesday, April 28, 2010

Things to try: No-delay video on Hauppauge PVR150

v4l2-ctl -v width=720,height=480
v4lctl setinput "Composite 1"
ivtv-tune -c1
aplay -q --buffer-time=100 -f dat /dev/video24 &
mplayer -rawvideo format=hm12:h=480:w=720:fps=29.97 \
-nocache -demuxer 26 /dev/video32 -framedrop -vo xv -monitoraspect 16:10 -aspect 4:3
killall aplay

Wednesday, April 21, 2010

DSL Line stats

Step 1: telnet into the modem
Step 2:
adsl info expand=true

Tuesday, April 20, 2010

Converting and chunking single-file CDs (with CUE sheets)

Issue 1: You have a number of files with .ape extension, for which there is no default player on Ubuntu.

Solution: Convert them with ffmpeg:
for f in *.ape; do ffmpeg -i "$f" "${f%.ape}.wav"; done



Issue 2: You have a music CD which you ripped to .ape, .flac, or whatever else, but instead of splitting the file you just created a CUE sheet for re-burning and would like to split it for your digital music player.

Solution: Use shnsplit:
shnsplit -o flac -f [file].cue -t "%n. %a - %p - %t" -m \ _ [file].flac


Replace [file] with the appropriate filename (or wildcard). If your input file is not .flac (e.g. .wav, as per the .ape file converted above) just use the appropriate extension. Check the manpages for shnsplit for additional configurations.

Monday, April 19, 2010

TeX woes

After a recent macports update I had issues getting TeX to recognize the local files installed in
~/Library/texmf
. I re-ran texhash, but to no avail. Long story short, it turned out that the issue was not with texhash, but with the search path for kpathsea in
/opt/local/share/texmf/web2c
. Changing the 'TEXMFHOME' variable to the default setting did the trick. In addition, to prevent further updates from overwriting the change, edit the first line and alter the word 'original' (to, for example, 'custom').

Wednesday, April 7, 2010

The sorry state of cross-platform GUI development in Ruby

Let's take a look at the contenders:

* fxRuby. Yeah, this one's a dinosaur. Pass.
* ruby-tk. Won't play nice with system libraries on Snow Leopard.
* wxRuby. Ditto.
* Shoes. Works, but does not play nice with already-installed gems, since it uses a separate system. It's own system will install but not run with Nokogiri.
* hotcocoa (via Macruby). Won't install Nokogiri because it references the C library libxml2, and Macruby does not like that yet.

So, what is one to do? Well, you could either give up on Nokogiri (fat chance), or say to hell with developing a GUI in Ruby and just go implement it either natively, or in Java if you need it to be portable. Then you can either re-parse the files, or use IPC to connect to a ruby daemon script.

Wednesday, March 31, 2010

Classification algorithms, the easy way

Weka is a wonderful, wonderful tool.

Nokogiri: DOM vs XPATH...

... FIGHT!

In the one corner: The object-oriented approach to selecting certain child nodes,
 node.children.filter( "criteria" )


In the other corner: XPath,
 node.xpath( "criteria" )


Who will be the champion?

It's a knockout! XPath just wipes the floor with its opponent!

Lucid OSCAR

Getting Oscar to run on Ubuntu Lucid is not a terribly arduous task. For the most part you can follow this guide, with some modifications of course:

* Don't install Tomcat from the Ubuntu repos. You'll only find Tomcat 6, and it's too much of a hassle to get Oscar to run on that (for now - word is in the Oscar scene that they'll release a new official version around June, and I'll bet you dollars on a dime that it will support the new Ubuntu LTS out of the box). For now, just grab Tomcat 5.5 off of the Apache site, and follow any run-of-the-mill installation guide for it.

* Just go with Ubuntu's default-jdk.

* If you're comfortable with Ubuntu's upstart you don't need to restart the machine, just (re)start the necessary services.

* Don't use the Oscar snapshot referenced in the guide. You may use the Oscar snapshot referenced in the guide, but do not use the pre-archived (09.06) snapshot on the Oscar download page. The MySQL scripts of that version are broken. I've had no problem with the bleeding-edge CVS snapshot. Sometimes the bleeding-edge CVS snapshot breaks, but it works most of the time.
** When running the MySQL script with the bleeding-edge CVS snapshot, where the guide instructs you to just enter the password instead of ****** you need to enter both the username and password, i.e.
./createdatabase_on.sh root <mysql_rootpassword> oscar_mcmaster 

* The SSL certificate line probably won't work for you. I haven't played much with it yet, but until you change it you won't be able to log into Oscar. The oscar.war file contain its own oscar_mcmaster.properties file which WILL override the oscar.properties in your Tomcat directory. For the most part that is no huge problem, except that it also overrides the MySQL password that you set, thus making you unable to log in. You can either set the MySQL password to be the same as the original one in the oscar.properties file (BAD idea), or you can change the oscar.properties file BEFORE running ant.

Tuesday, March 23, 2010

Lenovo G550 wireless with Ubuntul Lucid beta

Forget about it. Kernel 2.6.32 is borked with regards to the compat drivers. 2.6.34 has compat built in, so you can use the ubuntu-supplied b43 drivers, but the firmware is still (pardon my French) fucked up. Save yourself a lot of headaches and just get yourself a nice USB wireless card using a Ralink rt73 chipset. They run for $15 these days and work just peachy.

The G550 has a bcm4315 chipset (4312 rev01). It is a royal pain in the neck to work with.

First of all, forget the default drivers.

Second, forget the automatically-suggested non-free drivers.

So, what DO you do? Well, you visit linuxwireless.org and install the 'bleeding edge' compat-wireless drivers (Search the page for those words). Installation is fairly straightforward, just download, untar, and follow the README.

THEN you go to the b43 firmware page and follow the instructions for the 'LP-PHY' cards (again, search for the quoted text). Do NOT use the Ubuntu guides, they won't get you the correct firmware.

Finally, you update initramfs with `sudo update-initramfs -vuk all'.

Friday, March 19, 2010

Epiphany

Epanaphora = Continuity.

Wednesday, March 17, 2010

OSCAR (not the grouch)

Interested in getting OSCAR up and running? Skip the VM image - it's corrupted. Good luck with the .ISO installer - It does not like rebooting. So what is one to do in such cases? Why of course, go and roll your own installation. Wish me luck... It's going to be a long night.

Monday, March 8, 2010

Ruby and XML

Working with Ruby and XML can be a hassle if you use the default parser, REXML. Fortunately there is Nokogiri, a feature-rich XML and HTML parser with good performance and a significantly better API (albeit lacking in documentation). It is not a strict DOM parser, but it is SAX, SAX2 and XPath compliant, and can handle DOM-like work fairly decently so that you won't feel too much like a fish out of water if that is what you are comfortable with.

Bell Canada Lies

When I receive a telemarketing call, a sensible service representative will apologize, put me on the list, advise me that it may take X days for it to take effect, and we're both happy and go our way. Not so with Bell.

See, Bell Canada service representatives will turn a deaf ear to your requests to be put on their do not call list, claim to know that you are a customer of [major rival company] (which you are not), constantly drone on about how their service is better than what they think you currently have, and hang up on you when you ask them if they understood your words. Rinse and repeat every two weeks.

Bell Canada is a hive of scum and villainy, they will lie to your face about their services, and they engage in uncompetitive business practices (such as naming their copper DSL service 'Fibe' -- Which is awfully close to 'fiber' and will confuse customers who are not savvy in tech matters).

Bell Canada's own support representatives are constantly pushed to sell Bell services when a customer calls in with a support question. Actually helping their customer is not valued, only average handling time and amount of services sold. Bell's own policies promote service mediocrity, and their call centers have a horrible turnover rate.

Saturday, August 8, 2009

E-reader on the Mac

You know, when you search "mac+lit" on Google, the top results tell you that you can't read those files unless you convert them. BULLCRAP I say. You just need to get Stanza.

Tuesday, July 7, 2009

Steps

* Chunk by DOC tag
* Strip DOCHDR data
* convert to plaintext

Saturday, July 4, 2009

Compacting VirtualBox image - Ubuntu edition

It is well documented among the VirtualBox community that 'dd' is not enough to zero out a disk image for compacting. The preferred tool to do so is 'zerofree'. Now, the issue is that it requires the disk to be mounted as readonly. This is fine and dandy, except when you only have one partition to work with. My workaround is to use the Ubuntu minimal CD. The steps necessary are:

* Before booting the minimal CD, make sure you've got zerofree installed
'sudo aptitude install zerofree'
* Boot the minimal image.
* Enter recovery mode.
* In the language selection screen, select "Go Back" instead of picking a language.
* Start a new shell.
* Make a mountpoint, e.g.
'mkdir /mnt/r'
* Mount the disk image,
'mount -n -o ro -t ext2 /dev/sda1 /mnt/r'
* Copy zerofree and the necessary libraries to the tmpfs:
'cp /mnt/r/usr/sbin/zerofree /bin/; cp /mnt/r/lib/libext2fs.so.2 /lib/; cp /mnt/r/lib/libcom_err.so.2 /lib/'
* Run zerofree
'zerofree /dev/sda1'
* Profit!

XMonad compositing

Enabling compositing in XMonad is easy.

Setting an image as the background is a little bit more difficult. Normal methods like 'qiv' will not work with compositing. Fortunately there's 'hsetroot'. One donwside though is that it does not let you set an offset for the image. This is annoying when your virtual screen is taller than the image's resolution, as I found out when using it on my dual-display machine. I have yet to find a good solution for that.

Thursday, July 2, 2009

Installing Ubuntu in VirtualBox

These steps are for OSX Leopard as a host, Ubuntu Jaunty (9.04) netinstall.

* Don't use the default network adapter. Use the Intel one instead.
* I set the partition manually to just have one big partition, ext2. No swap partition was set up because a) I have enough memory allocated, b) I can always set up a swapfile, c) having a swap partition increases the disk image file size,
* gksu, make, and linux-headers-generic are required to install guest additions.
* The video driver was giving me problems. Installing the guest additions with xserver-xorg-video-vesa alone did not work for me. I've narrowed it down to either xserver-xorg-video-vmware, xserver-xorg-video-fbdev, linux-headers-virtual, or a combination thereof. Afterwards I've removed all but xserver-xorg-video-fbdev and things are still working.
* localepurge and debfoster are your friends when minimizing the disk image size.

.xsession and XRandR

Note to self: check spelling of lines in the .xsession file.
xrandr --output VGA --mode 1280z1024
is not
xrandr --output VGA --mode 1280x1024