Skip to content

dan.verweire.com

butter side up

I recently created a bootable usb thumb drive for installing Kubuntu on different computers at work. I also planned to to use this device as a live system for the rare instances where I need another Linux system in my office to test things. Creating the bootable drive was a piece of cake with the usb-creator-gtk package.

Today I wanted to test out some cool stuff like dns2tcp, ptunnel, stunnel and ppp. I pulled out my thumb drive, smacked it into an available machine and booted off the cool little guy. I quickly found that I needed to install more packages and as I did, I ran out of space in the 128 MB that I had allocated for “extra space” on the 4GB drive.

Yeah it was obviously a dumb move to only allocate 128 MB for my /home and customizations. The fun thing about Linux is where there is a stupid mistake there is a chance to learn something new and do something fun, if you like that sort of thing.

As it turns out usb-creator-gtk creates a file in the root of the drive called casper-rw. This file is an ext3 filesystem image and is what contains most of the writable data in your live environment. All I needed to do to get some more space (provided that drive wasn’t physically full) was to enlarge this file and then resize the ext3 filesystem inside the file to be able to use all of the newly available space in the file.

Oblig Warning: Only do this if you understand what these commands do and agree that they are the best course of action for your situation. Use at your own risk.

The following steps where taken from a computer which was running Kubuntu Karmic. You must not be running in the live environment on the usb device when doing this procedure.

  1. me@puter:/$ cd ~
  2. me@puter:~$ mkdir /mnt/disk
  3. me@puter:~$ sudo mount /dev/sdc1 /mnt/disk/
  4. me@puter:~# ls -l /mnt/disk
  5. total 1181148
  6. -rwxr-xr-x 1 root root        144 2009-12-22 15:13 autorun.inf
  7. -rwxr-xr-x 1 root root       1404 2010-01-07 20:10 bootex.log
  8. drwxr-xr-x 2 root root       4096 2009-12-22 15:16 casper
  9. -rwxr-xr-x 1 root root 1207959552 2010-01-07 16:41 casper-rw
  10. drwxr-xr-x 3 root root       4096 2009-12-22 15:16 dists
  11. drwxr-xr-x 2 root root       4096 2009-12-22 15:16 install
  12. -r-xr-xr-x 1 root root      14607 2009-12-22 15:13 ldlinux.sys
  13. -rwxr-xr-x 1 root root       4050 2009-12-22 15:13 md5sum.txt
  14. drwxr-xr-x 2 root root       4096 2009-12-22 15:16 pics
  15. drwxr-xr-x 4 root root       4096 2009-12-22 15:16 pool
  16. drwxr-xr-x 2 root root       4096 2009-12-22 15:16 preseed
  17. -rwxr-xr-x 1 root root        223 2009-12-22 15:13 README.diskdefines
  18. drwxr-xr-x 2 root root       8192 2009-12-22 15:16 syslinux
  19. -rwxr-xr-x 1 root root    1468640 2009-12-22 15:13 wubi.exe
  20.  
  21. me@puter:~$ dd if=/dev/zero of=img bs=1M count=1024
  22. 1024+0 records in
  23. 1024+0 records out
  24. 1073741824 bytes (1.1 GB) copied, 20.2902 s, 52.9 MB/s
  25.  
  26. me@puter:~$ sudo -i
  27.  
  28. root@puter:~# cat /home/me/img >> /mnt/disk/casper-rw
  29. root@puter:~# cd /mnt/disk
  30. root@puter:/mnt/disk# resize2fs casper-rw
  31. resize2fs 1.41.9 (22-Aug-2009)
  32. Please run ‘e2fsck -f casper-rw’ first.
  33.  
  34. root@puter:/mnt/disk# e2fsck -f casper-rw
  35. e2fsck 1.41.9 (22-Aug-2009)
  36. Pass 1: Checking inodes, blocks, and sizes
  37. Pass 2: Checking directory structure
  38. Pass 3: Checking directory connectivity
  39. Pass 4: Checking reference counts
  40. Pass 5: Checking group summary information
  41. casper-rw: 2235/32768 files (4.8% non-contiguous), 130869/131072 blocks
  42.  
  43. root@puter:/mnt/disk# resize2fs casper-rw
  44. resize2fs 1.41.9 (22-Aug-2009)
  45. Resizing the filesystem on casper-rw to 1179648 (1k) blocks.
  46. The filesystem on casper-rw is now 1179648 blocks long.

Gonzo Journalism

According to http://forum.kde.org, here are some easy steps to make FireFox integrate better with KDE:

1. install your distro’s gtk-qt-engine
note: depending on how far your distro is with kde4 integration this package may either be called gtk-qt-engine or gtk-qt-engine-kde4

2. change your Firefox theme
If you use the default KDE oxygen theme install the oxygen theme for Firefox from here: https://addons.mozilla.org/en-US/firefox/addon/7962

3. change the appearance of the file selector:
type “about:config” into Firefox’s URL bar and type “platform” into the display filter below. Make sure that the value for

    ui.allow_platform_file_picker

is set to false

4. Additionally, to fix buttons and checkboxes, install package gtk2-engines-qtcurve. Now open KMenu->System Settings->Appearance->GTK Styles and Fonts and set “Use another style” (under category GTK Styles) to QtCurve. Save it and restart Firefox (copied this straight from post #5 😉 – many thanks!)

5. For downloads – you may want to consider installing the flashgot add-on. It lets you use Kget as a download manager.

Also of interest is https://addons.mozilla.org/en-US/firefox/addon/207, a FireFox plugin which may help choosing the correct application to run when downloading files.

I love JavaScript. A lot of people hate it and think that it is a horrible language. It has it’s faults for sure and this series of videos featuring Douglas Crockford of YAHOO! goes into great length describing the downfalls and advantages of JavaScript. This is a very blunt and to the point overview of the language, not for the faint of heart. It starts with a brief history of the language and how it got its crappy and misleading name.

Douglas Crockford: "The JavaScript Programming Language"/1 of 4
Douglas Crockford: "The JavaScript Programming Language"/2 of 4
Douglas Crockford: "The JavaScript Programming Language"/3 of 4
Douglas Crockford: "The JavaScript Programming Language"/4 of 4

The Advanced section delves into the details of prototypal inheritance and other advanced features of JavaScript.

Douglas Crockford: "Advanced JavaScript" (1 of 3)
Douglas Crockford: "Advanced JavaScript" (2 of 3)
Douglas Crockford: "Advanced JavaScript" (3 of 3)

While developing a JavaScript GridLayout tool at work today, I ran in to a tough spot while traversing tables with jQuery. What I wanted was to only work with the TR and TD elements within the parent table and not any nested tables. At first, I was using code like this (see HTML later for an example of what I was working with):

  1. $(‘#myTable’).find(‘tr’).each(function () {
  2.  var $tr = $(this);
  3.  //do stuff
  4.  
  5.  $tr.find(‘td’).each(function() {
  6.   //do stuff
  7.  })
  8. })

But the problem with this is that both calls to the ‘find’ method would return all TRs or TDs that are decedents of #myTable, no matter how deep. I could have used a selector that would have found the tbody (the first child of the table not shown in the markup but inserted by the browser) and then found all of the TRs that were children of that and so forth. My issue with that is that I’m not confidant that all browsers insert the tbody element. I’ve read online that they are supposed to, but for real, who knows? And I don’t like programming browser-specific stuff.

At any rate, the easiest way I found to accomplish this is to pass the table.rows and rows.cells collections to the jQuery constructor ala:

  1. $($(‘#myTable’).attr(‘rows’)).each(function () {
  2.  var $tr = $(this);
  3.  //do stuff
  4.  
  5.  $($tr.attr(‘cells’)).each(function() {
  6.   //do stuff
  7.  })
  8. })

And boom, no nested tables return. Wonderful. At least I think that’s what I did. It’s been a few hours now….

The HTML:

  1. <table id="myTable">
  2.  <tr>
  3.   <td>stuff</td>
  4.   <td>things</td>
  5.  </tr>
  6.  <tr>
  7.   <td colspan="2">
  8.    <table>
  9.     <tr>
  10.      <td>cat</td>
  11.      <td>dog</td>
  12.     </tr>
  13.    </table>
  14.   </td>
  15.  </tr>
  16. </table>

I was trying to compile XBMC from the subversion repository and was receiving an error when it got to the Goom visualization. Unfortunately, the exact error is beyond my terminal history but can be found in a thread on the XBMC forums (http://blog.xbmc.org/forum/showthread.php?t=45463&page=2). In that thread there is this dirty work-around:


sed -i xbmc/visualizations/Goom/goom2k4-0/src/goomsl_yacc.y -e 's/case FLOAT_TK/case 264/'
sed -i xbmc/visualizations/Goom/goom2k4-0/src/goomsl_yacc.y -e 's/case INT_TK/case 263/'
sed -i xbmc/visualizations/Goom/goom2k4-0/src/goomsl_yacc.y -e 's/case PTR_TK/case 262/'

It worked for me. An additional note of interest when compiling XBMC is if you want to install to a non-standard location,

./configure --prefix=/path/to/destination

DOES NOT WORK. You have to use :

make install PREFIX=/path/to/destination

So, I accidentally installed it on top of the version I received via apt-get from the xbmc ppa. Shouldn’t be an issue.

So funky.