Rough Book

random musings of just another computer nerd

Category: Linux

How to stop YouTube sucking on Ubuntu/Linux

Recently I’ve noticed that YouTube’s performance on my machines have been terrible. It’s constantly buffering, or it will stop randomly in the middle of a video. I’ll get a few seconds of playback and then 10-30 seconds of buffering. It’s pretty terrible. On Windows I have been able to use the helpful workaround from here and performance has definitely increased. On top of that, I’m also using the SmartVideo plugin on Chrome (it’s also available for FireFox). But on my Linux boxes, I’m still having the same problem in spite of having the SmartVideo plugin. There is a Linux alternative to guide from above, but it uses ipfw program which is not natively available on Ubuntu/Linux (at least from my understanding) due to it being a BSD program. I didn’t want to compile it and install it from source, so I decided to use ufw instead, which is the “Uncomplicated Firewall” that comes with Ubuntu. It was pretty simple to convert the rules over. But first you will need to enable it (if you haven’t already). You can do that with:

sudo ufw enable

Then you can enable logging also, if you want:

sudo ufw logging on

If you SSH into your machine or if you use your machine as a webserver, you will need to enable a few more rules:

sudo ufw allow ssh/tcp
sudo ufw allow http/tcp
sudo ufw allow 8080/tcp

And of course, you can add the rules that will prevent your ISP from caching YouTube:

sudo ufw deny from 173.194.55.0/24
sudo ufw deny from 206.111.0.0/16

You can then use ufw status to verify that your rules are in place:

 ~ ⮀ $ ⮀sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
8080/tcp                   ALLOW       Anywhere
Anywhere                   DENY        173.194.55.0/24
Anywhere                   DENY        206.111.0.0/16
22/tcp                     ALLOW       Anywhere (v6)
80/tcp                     ALLOW       Anywhere (v6)
8080/tcp                   ALLOW       Anywhere (v6)

Trying out ChromeOS from a VMWare image

I was pretty excited when I saw the VMWare image for ChromeOS up for download. I immediately downloaded it to try it out. The zip file I got from gdgt has a vmdk file but no vmx file. I created one from scratch to try ChromeOS out (I’ve made a new zip with the vmdk and the vmx. The link is at the end of this post.). It’s not too bad. The OS boots up really quick. The login screen is pretty spartan (look at the screenshots I have). You login with your Google/Gmail username and password. When you login, it opens up the Chrome browser. I wasn’t able to get anything else running other than the browser. Also, when I first logged in, Chrome complained that the security certificate for Gmail had been revoked. But I was able to login when I typed in the address for Gmail in again. The default tabs seem to be GMail and Google Calendar. I’m assuming that because it’s such an early build, you’re not able to try out the other stuff. Maybe there’s a way; I didn’t play around with it too much. There is a Date and Time settings menu that’s available from the browser, where you can set a few other options, like your proxy, SSL options, home page, and a few other advanced settings.
Read the rest of this entry »

Flu shot and bizarre network issues

This last weekend I had drill and the medics gave us the seasonal-flu mist-vaccine. It’s the one where they squirt gooey, inactive virus up your nose. I’ve had the vaccine before without any adverse side-effects. Yeah, not this time. I got the shot on Saturday and I was fine on Sunday. Not so on Monday. I woke up a few times in the middle of the night with a bit of a fever, but I figured that it would just go away. Yeah, didn’t happen. On Monday morning I felt like I had been run over by a semi. My throat felt like I had swallowed bits of broken glass. Needless to say, I didn’t go to work. I was bedridden most of the day, but towards the end I felt a little better. I tried to get a little work done but I wasn’t too successful since I had a hard time concentrating.
Read the rest of this entry »

Ubuntu 9.04 (Jaunty Jackalope) and Windows 7 dual-boot

In my previous post I talked about the problems I had while installing Ubuntu and Windows 7 on my Alienware m7700 laptop. It took me about three days of hair-pulling before I was finally able to get it to work. First, I burnt a new copy of the ISO for Ubuntu 9.04. Then, I enabled RAID on my system. I put the disks into stripe mode (the FastTrak Promise 378 does not support JBOD). This time, I got past the COMRESET error (ata3: COMRESET failed (errno=-16)) and was able to boot into the LiveCD. However, my joy was short-lived. The install would terminate (around the 40% mark) with the following message:

[Errno 5] Input/output error

This is often due to a faulty CD/DVD disk or drive, or a faulty hard disk. It may help to clean the CD/DVD, to burn the CD/DVD at a lower speed, to clean the CD/DVD drive lens (cleaning kits are often available from electronics suppliers), to check whether the hard disk is old and in need of replacement, or to move the system to a cooler environment.

Read the rest of this entry »

Ubuntu and Win7 problems

Yesterday I decided to reformat my Alienware m7700 Area-51 machine. It’s supposedly a laptop, but it’s actually a beast and it has a power supply that emits as much power as a small nuclear plant. Anyway, I put in a 500Gb and a 120Gb drive, with the 120Gb as a slave. The machine comes with a RAID controller (Promise SATA 378 TX2), but I have it turned off and in ATA mode. Win7 installed fine; the only problem I have is with the sound. My front speakers in my quadraphonic setup refuse to work. It’s strange. I even have the latest drivers from Creative for my Audigy2 ZS Notebook. It used to work fine before.

I figured I’d solve that problem later and decided to install Ubuntu 9.04 (Jaunty) on the 500Gb drive. The LiveCD boots up fine, but when I try to actually try out the LiveCD or even try to install Ubuntu, it fails. Everything hangs after this message:

ata3: COMRESET failed (errno=-16)

After searching on the internets, it seems to be a RAID controller issue and a fix exists in the kernel. So I don’t know why I still have the problem. If anyone knows of a solution, please let me know! I’m going to keep working on the problem and see if I can solve it.

Running the JavaFX 1.1 SDK on Linux

This is an update to my instructions on running the JavaFX 1.0 SDK on Linux. Those instructions do not work on the dmg image for the 1.1 version of the SDK.

Mike (thanks Mike!) posted a comment on that blog mentioning a small change that needed to be made. To get JavaFX 1.1 on Linux, first follow the steps in the original guide. When you need to mount the dmg, you need to provide an offset. So instead of the original command, do the following:

[email protected] ~
$; sudo mount -o loop,offset=$((1024*17)) -t hfsplus javafx_sdk-1_0-macosx-universal.dmg.out javafx

The dmg should be mounted now.

Apache2 and .htaccess with mod_rewrite on Ubuntu 8.04 (Hardy Heron)

Apparently the default settings for .htaccess files and URL rewrites in Ubuntu (8.04 anyway) is kinda jacked. Apache wasn’t seeing my .htaccess files, and even after setting up the configuration correctly, I was getting Internal Server (500) errors from .htaccess files.

The default setting for Apache2 on Ubuntu for .htaccess is “ignore it”. You need to enable it by going to /etc/apache2/sites-available/default and changing the AllowOverride directive, which you can find inside the <Directory> … </Directory> tags:

AllowOverride ALL

If you want to enable URL rewrites, you need to enable the mod_rewrite module as it is not enabled by default:

[11:31:14] [email protected]untless ~/Projects/www/skyblue
$ sudo a2enmod rewrite
Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.

[11:31:20] [email protected] ~/Projects/www/skyblue
$ sudo /etc/init.d/apache2 force-reload
 * Reloading web server config apache2     

Apple: Blurring the Line Between Hackers and Hipsters

Yesterday, while wrestling with my Windows XP machine to make it do dual-monitor display properly (I can’t get it to set my LCD as primary display), I ended up hosing the registry completely. It took me about two more hours to fix the system and get it back to where it was. During this whole ordeal, there were long periods of waiting when drivers were installing or when chkdsk was running. I took this time to surf the web and ended up landing on a digital copy of In the Beginning was the Command Line by Neal Stephenson. While skimming through the book (I have read the book before; I own the hard copy), I realized a few things. The book is definitely outdated; it was written before Mac OS X came out. However, a lot of points were still valid. I was mainly struck by the changing character of the Mac, and also in some sense, the changing character of (some) hackers:

Hackers like to hack. This is not a bad thing. In fact, “hack” originally did not mean “break into goverment/financial systems and do bad things”, and a “hacker” was not an unsavoury individual who did the aforementioned “bad things”. A “hack” originally meant “an elegant and clever solution to a problem” (although, it paradoxically also means “crude and ugly solution to a problem”), and a “hacker” is a person who comes up with such solutions. Most programmers call themselves “hackers”. The media term “hacker” is actually described by the term “cracker”. Hackers are constantly tinkering with things. Usually they are trying to make things better, but more often than not, they end up breaking it. However, in the process they learn very valuable lessons about how not to break something, and then immediately find another way to break it again. In all seriousness though, what we learn are the limits of the system, and how the system works. Hackers don’t like unknowns and black boxes. They want to know what makes things tick.

My dad got me my first computer in 1990. I didn’t do much on it at first other than play games. I actually started writing code in 1992, and I haven’t stopped. I’ve been hacking around since then, and in the process I’ve learnt a lot of many cool things. Over the years I’ve experimented with various OSes and programming langauges, and in the process broken and hosed many computers. But each time I learnt something valuable from them… mostly. One of the cooler things (I didn’t learn anything from this really, it was just a bug) I did was writing a self-replicating Perl script that kinda ran wild on ASU’s Solaris server. There were so many scripts running around that it brought the server to a crawl. I eventually figured out what was happening and managed to kill all the processes. Anyway, my point is that people like me like to tinker around. We don’t mind if we break stuff while doing it, because we’ll figure out a way to fix it. It’s the “figuring out” part that makes us happy. So what does all of this have to do with Apple, Hipsters, and Hackers? Well, in Neal Stephenson’s book he describes two kinds of people: Eloi and Morlocks. An Eloi is your average internet user; they view computers as appliances and tools and nothing more. A Morlock, on the other hand, is your average hacker. The computer is definitely a tool, but it is a tool that can be used to create other tools. The workings of a computer are usually a mystery to an Eloi, but not so for the Morlock. Before Mac OS X, most users of Macs were of the Eloi variety. The Mac was a beautiful and stylish magic-box that did wonderful things. The inner workings were a mystery. You couldn’t easily get inside and tinker with it, but that wasn’t really an issue because Eloi don’t care about things like that. Morlocks gravitated more towards the PC world. Sure, PC’s were clunky and definitely not as stylish as a Mac. Plus, a lot of them ran Windows which many Mac fans claimed was a clunky and cheap copy of the Mac OS (in truth, everyone basically copied Xerox PARC). However, they could be opened up and tinkered with. At this point in time, there was also this thing called Linux, which was an interesting piece of software (at the time). Linux is basically just an operating system. What most people mean when they say they “run Linux”, is that they run a distribution of Linux. A distribution consists of the kernel (Linux), in addition to a bunch of userland tools (programs that actually let you do something). The cool thing about Linux was that it was free. You could go download it and install it on your computer and it would run. What was even more interesting was that it was made by volunteers. People actually took the time to sit down and write code to improve and enhance the operating system. Running Linux in those days was a chore. Most distributions came with a GUI (X with a window manager), but sometimes things didn’t work quite right if you had an obscure monitor and video card. Getting things to work meant going to the command-line and writing strange, arcane incantations and if the Gods were pleased, your hardware might work. But that didn’t bother the hackers, because it was fun trying to get things to work. In addition there was also a certain elitism about it. Running a Linux box meant that you had the time, patience, and above all, intelligence required to go through the mental contortions required to get a working system. But intellectual elitism is nothing new for hackers since all hackers have a bit (ok, a lot) of hubris.

Mac Sales ChartOk, so where am I going with this again? Seriously, I have a point. Things changed when Mac OS X came out; it had a command line. The command line is very important to us hackers because it lets us look “under the hood” of the GUI. True hackers always go to the command line to do serious work. The command line is a place where a pithy one-liner can replace a series of windows and buttons. To the uninitiated, the command line is a scary place where confusing and dangerous things happen. Just like a magic spell, you had to write obscure words and symbols to the computer, in the correct sequence. If you were lucky, the computer would derisively spit out an error. If you weren’t you probably broke your computer. If you were really lucky, the computer accepted your commands and did what you told it to do. The point of the commandline is that you get God-like power (mostly; to truly be God you had to be root). While this power enables you to be extremely efficient, it also enables you to do destructive things equally efficiently. The GUI shields you from the hard edges of the underlying OS. The cryptic command line is replaced by friendly windows and buttons. When the Mac OS got a commandline in Mac OS X, hacker types were suddenly interested in it. You now got the legendary stability and the “it just works” attributes of a Mac OS with the power of a commandline, and that too, a UNIX commandline (OS X’s kernel is essentially based on BSD, which is a direct descendant of the original UNIX). Which brings me to the main point. What I’ve noticed over the last few years, especially after graduating from college, is that even though I love to hack around and test the limits of a system, most times I simply want a system to work. I want to spend less time fixing the system, and more time fixing my own code. I have also noticed that I’m not the only one with these sentiments. Many of my fellow nerd and hacker friends own Macs and develop on them now. I considered getting a Mac as well, but it was a little over budget for me and I couldn’t justify the cost at the time. Macs provide a very good mix of power and stability, and that is extremely attractive to a developer. You can still hack around on the Mac (and you could probably break it), but most of the time you know it’s something you did that broke the system, than just a quirk with the system. In my personal opinion, I think Apple’s decision to include the command line in OS X was brilliant (their other good move was moving over to the ubiquitous x86 architecture). In fact, if you look over the sales chart (courtesy systemshootouts.org) of the Mac from 1997 to 2008, you can see how their sales remained more or less constant from ’97 to ’02, after which it really started taking off. OS X was released in 2001.

In the old days, Mac users were a tight-knit, elitist bunch who sneered at their less-fortunate Windows-using cousins. Most times, it was with good reason. The Mac OS was stable and polished, while Windows was a clunky GUI bolted on top of a command line. To be fair to Microsoft though, Apple didn’t have to put up with exotic hardware since they had complete control over it. The demographic that Macs attracted was mostly the artistic or hipster bunch. In recent years, the demographic has increased to include some people who also liked the supposed “coolness” of the Mac. If you owned a Mac, you were different. You were part of a “cool”, “hip”, and “artistic” minority. Apple played this up, marketing the Mac as not only a stable alternative to a PC, but a cooler alternative too. Today you have more people than ever using Macs. From a sorority chick who uses it because “OMG it’s like so pretty!” to a programmer who likes it because “OMG d00d it’s lyk teh UNIX!!11!” Apple has successfully bridged the gap between two extremes. In future years, I think Apple will continue to grow stronger, and the sales of Macs will continue to rise, providing a viable, proprietary alternative to Windows. I’m not an Apple fanboi; I like FreeBSD (perhaps why I have a soft spot for OS X) and Linux more, but I think Apple deserves respect for making an excellent OS that’s friendly to hackers and hipsters alike.

Running the JavaFX 1.0 SDK on Linux

The JavaFX 1.0 SDK was released today. I’ve played with the preview SDK, so I was pretty excited to try out the 1.0 SDK. Inexplicably, and this was the case with the preview SDK as well, Sun hasn’t released a version of the SDK for Linux. However, this wasn’t a problem because it was possible to run the Mac version of the Preview SDK on Linux. The preview SDK came in the form of a zip, but the 1.0 SDK comes in the form of a dmg, so I was initially stumped. But I’ve figured out how to get the Mac version of the SDK to work on Linux. It’s a little more complicated than getting the preview SDK to work, but it works!

The thing about dmg files is that you can easily mount them on Linux since they are essentially stored in the HFS Plus filesystem format. So I immediately set about trying to mount it:

[email protected] ~
$ mkdir javafx

[email protected] ~
$ sudo mount -o loop -t hfsplus javafx_sdk-1_0-macosx-universal.dmg javafx
[sudo] password for vivin: 
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

Hmm… ok, that wasn’t what I expected, so I tried to see what type of file it was:

[email protected] ~
$; file javafx_sdk-1_0-macosx-universal.dmg
javafx_sdk-1_0-macosx-universal.dmg: bzip2 compressed data, block size = 100k

Ok, so it look’s like it’s a bzipped file. All we need to do then, is bunzip it and mount it:

[email protected] ~
$ bunzip2 javafx_sdk-1_0-macosx-universal.dmg
bunzip2: Can't guess original name for javafx_sdk-1_0-macosx-universal.dmg -- using javafx_sdk-1_0-macosx-universal.dmg.out

bunzip2: javafx_sdk-1_0-macosx-universal.dmg: trailing garbage after EOF ignored

[email protected] ~
$ sudo mount -o loop -t hfsplus javafx_sdk-1_0-macosx-universal.dmg.out javafx

[email protected] ~
$ ls javafx
javafx_sdk-1_0.mpkg

Awesome! So we were able to get the dmg mounted. Now all we need to do is find were the SDK lives. After going through the dmg, I found out that the SDK is stored in a compressed (gzipped) file. You can find it at <mountpoint>/javafx_sdk-1_0.mpkg/Contents/Packages/javafxsdk.pkg/Contents/Archive.pax.gz. Copy this file into another working directory (or wherever you want your SDK to reside. I put mine in /usr/local):

[email protected] ~/working
$ cp ~/javafx/javafx_sdk-1_0.mpkg/Contents/Packages/javafxsdk.pkg/Contents/Archive.pax.gz .

[email protected] ~/working
$ gunzip Archive.pax.gz

[email protected] ~/working
$ file Archive.pax
Archive.pax: ASCII cpio archive (pre-SVR4 or odc)

When I gunzipped the file, I got Archive.pax, and I wasn’t sure what to do with it. So I ran file on it and discovered that it was a cpio file. Some quick Googling and man-page perusal later:

[email protected] ~/working
$ cpio -i <Archive.pax
65687 blocks

[email protected] ~/working
$ ls
Archive.pax  COPYRIGHT.html  lib          profiles     samples     src.zip                      timestamp
bin          docs            LICENSE.txt  README.html  servicetag  THIRDPARTYLICENSEREADME.txt

[email protected] ~/working
$ bin/javafx

Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)

where options include:
    -d32          use a 32-bit data model if available

    -d64          use a 64-bit data model if available
    -client	  to select the "client" VM
    -server	  to select the "server" VM
    -hotspot	  is a synonym for the "client" VM  [deprecated]
                  The default VM is server, 
                  because you are running on a server-class machine.

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose[:class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                    see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument

As you can see, you now have a working JavaFX 1.0 SDK on your Linux box!

My new laptop

I recently bought myself a new laptop – the Dell XPS M1530. I was originally considering a Macbook, but that was a little too pricey for me. I started to fancy OS X ever since I found out that it is basically FreeBSD at the core. Also, there is the eye-candy. Other than the price-tag, I also realized that the only reason I would want the Macbook was because it looks so good. That didn’t seem entirely practical. I could still get the eye-candy and the productivity on another OS. The last laptop I bought was an Alienware beast. It was ridiculously heavy and I got sick of lugging it around. It basically a desktop masquerading as a laptop. In addition to being really heavy, it generates quite a lot of heat. Enough to burn your lap. But it plays games really, really well. Anyway, I decided that I would look for a nice non-Apple laptop. After scouring the Internets and reading a bunch of reviews, I settled on the XPS. It’s sleek, stylish, fast, portable, and it got a bunch of good reviews. I went to the Dell site and configured my XPS:

  • Intel Core 2 Duo Processor T7700 (2.4GHz/800Mhz FSB, 4MB Cache)
  • 3GB Shared Dual Channel DDR2 SDRAM at 667MHz (2 Dimms)
  • 256MB NVIDIA GeForce 8600M GT
  • 250GB 5400rpm SATA Hard Drive
  • High Resolution glossy widescreen 15.4 inch LCD(1680×1050) 2MP Camera
  • Slot Load DVD+/-RW (DVD/CD read/write)
  • Integrated Sound Blaster Audigy HD Software Edition
  • Intel Next-Gen Wireless-N Mini-card (4965AGN)

It’s got some punch. I’m mainly going to use it as a development machine so the RAM and speed definitely help as far as compile-times go. They estimated about two weeks to build the laptop, but actually I got a pleasant surprise when the laptop arrived a little over a week after I ordered it. I wasn’t disappointed in the least when I opened up the package. The first thing I did was blast Vista off the hard-drive and install PC-BSD. This is where I learnt a hard lesson. Stability in the BSD world comes at a price. You don’t have very good hardware support (for no fault of FreeBSD; I’ll rant about this later) for the latest hardware. Drivers are not included until they are reliable and stable. As a result, my Marvell Yukon 88E8040 Gigabit Ethernet card, and my Intel 4965AGN Wireless-N card were unrecognized. Marvell (surprisingly) had a FreeBSD 6 driver on their website that is supposed to work with the 88E80XX series, but I was unable to get it to work on my system. I tried using ndiswrapper to get the Intel card working, but I only succeeded in crashing my system very nicely. I was pretty bummed. I really didn’t want to go back to using The Evil (Vista), and so I decided to play around with kubuntu for a while. It was nice, and I may get back to it. But for the hell of it, I wiped it off and tried to install OS X on it. I was able to get a “patched” Leopard ISO and I actually got it to install on the XPS. However, I wasn’t able to get it to recognize any of my network devices. So after playing around with that for a while, I went back to The Evil. I am hoping that by the time PC-BSD 2.0 or FreeBSD 7.0 rolls around, there will be more support for the network cards. If that’s the case, I’ll definitely be wiping out Vista and installing PC-BSD (or install FreeBSD 7.0 and build KDE). I’ve been using Vista for a little while, and I guess it’s not so bad. It’ll stay out of your way if you ask it to. But it really doesn’t compare to either PC-BSD, Kubuntu, or Leopard. As far as the XPS, I like it a whole lot. I think Dell has done a pretty good job with it.

All original content on these pages is fingerprinted and certified by Digiprove
%d bloggers like this: