Rezaf Diary

I'll write about my daily life, as a PhD Student at the University of Illinois. I'll put some photos from my town, Urbana, and some music.

Wednesday, January 23, 2013

To be a pioneer, or to conform?

I have been thinking a lot recently, and have realized a few things about how we behave in a society. The following is an observation regarding this. I have always liked to be the contrarian. To be the pioneer, the challenger to the status quo. The one who comes up with bold, new ideas. It is a romantic notion, going against the odds and beating it.

But lately I have come to a new conclusion: The society rewards conformance. It doesn't like a pioneer, it is scared of him. When you want to join another group of people, whether it is a job in a company, a social group or anything else, they look for conformance to what they think you should be, not who you are.

Is the life of a pioneer one of perpetual loneliness, always fighting against the world alone? And how do leaders attract others to their cause? One obvious way is extreme conformance, otherwise known as populism. But what about the true pioneer with a vision? How can he attract a following?

The only solution I can think of is to curb your enthusiasm for a while. Conform to the standards, join a group, and make them accept you as a member. Only then you can gradually start to move the whole group towards your vision. In this respect, human society acts as a cold-blooded frog, which you cannot drop in a boiling pot, but can leave in a pot of cold water and slowly raise the temperature to boiling.

This might look sad, but it is hard and cold fact of life as a human being.

Consider the following two scenarios, where a hiring team discuss two candidates after interview.
A) "This guy is not bad. I'd score him a B, maybe a C. But he knows how to do what we do. And John and Jane are about to retire, and we need to keep the wheels rolling. Let's hire him, we can always teach him to better do what we do."
B) "Man this guy is good, very good! He's definitely an A player! But, he has some crazy ideas. He even suggests we change the way we work! What he says might work and get us rich, and he has the credentials. But I'm still worried something might badly go wrong. I don't know man, he's too risky".

Results: the first guy gets hired, even though he's technical level is C. The second guy, a motivated pioneer with A-level technical qualifications is deemed too risky and is left out.

Talk about priority inversion!

Note: Click on the photos to enlarge them.

If you feel interested in any of them and want to get the original file, please don't hesitate to email me!

Sunday, December 23, 2012

More from AppleTV Linux Saga

In my last post I mentioned my adventure with installing linux on an Apple TV (1st gen). I spent another couple of hours on it, and got it to a good shape. Here I'd like to document the steps. For some more info, read the post right before this one.

Step 0. Get an AppleTV. Open it up and replace the hard drive with a new one. Well you can use the old one if you'd like.

Step 1. Create an ATV-Bootloader USB disk. Use the excellent GUI tool from here:

Step 2. Boot into ATV-Bootloader using the USB disk. Then, Partition the hard drive using: I ended up creating 5 partitions on my hard drive.

Step 3. Download a Linux live CD image and burn it on a USB disk with a command like like
dd if=/path/to/img of=/dev/sdb
. Now, I tried many combinations of Ubuntu. Eventually I settled on using 8.04 hardy. Technically no one on the internet has managed to boot AppleTV with Linux Kernel 3.x, so you're stuck with 2.6.x branch. On Ubuntu side, that is at most 11.04. I did try 12.04 or 12.10, but neither boots up. 11.04 installer didn't boot up completely, complaining about not finding a cdrom. I didn't try the ubuntu 10.x or 9.x branch either. Also ubuntu 9.10 and higher use grub2 bootloader that is incompatible with ATV-Bootloader. There is a download package on ATV-Bootloader website that supposedly fixes this, but I cannot verify it.
Long story short, save yourself some trouble and stick to 8.04. I didn't and wasted a lot of time on it. Anyway, the instructions on this page are very good for booting into the Linux installer:
I suggest alternative CD installers or ubuntu-servers, as the graphical installer uses too much memory, which will end up freezing the AppleTV.

Step 4. Go on with the installation.

step 5. In order to not need the USB disk to boot, you can install the ATV-Bootloader on the proper partitions you created in step 2.

Step 6. You can make the whole thing bootable by editing and changing "none" to "auto". By now, you should have a proper ubuntu 8.04 server installed on your AppleTV, and when you turn it on it should load up all the way to a command prompt login.
Now let's try installing a graphical interface.

step 7. Install X11. sudo apt-get install xserver-xorg-core xserver-xorg-dev xinit xfonts-base x11-xserver-utils xauth

step 8. Before rebooting, download the 304.x version of NVIDIA graphics driver from their website and install it.

step 9. Ok, now that we have X11 and a graphics driver, let's install a Desktop environment. Currently LXDE is known as the most efficient and usable desktop environment.

step 10. Let's reboot the machine. If you're lucky, you should boot into a working environment.

step 11. Install the wireless network driver:

step 12. Install the sound driver. Well I install it but I don't have HDMI audio, and haven't tried analog ones yet.

step 13. (from the same link as above) install atvclient, which stops the annoying LED blinking.

step 14. I suggest not updating your packages. I did, and it broke my openbox window manager, and no matter what I couldn't get it to work again. I eventually had to remove it, install lxde 'lite' session manager, and replace openbox with metacity (sudo pat-get metacity, and change a config file, google for it) to get it to work again.

step 15. Unfortunately installing LXDE this way is an underwhelming experience as it comes with no pre installed program, and still some of the programs that I install do not work (including firefox and opera, but midori works and is a decent browser).
Unfortunately the first ubuntu version which had lubuntu alternate installer CD (to escape from the graphical installer) is 11.10, which has a Linux kernel 3.2.x that in incomatible with ATV, and it's a no-no. I tried installing ubuntu-server 11.04 and planned to run "sudo apt-get install lubuntu", but as mentioned earlier the installer got stuck looking for a real cdrom.
In retrospect, I probably should have picked xubuntu instead of lubuntu (edit: LXDE works just fine, thank you!). Still, I have a decent setup as of now. Well, no audio yet and flash didn't work in midori. Latest version of firefox works fine and plays youtube flash videos full screen sized! (with about 100MB of memory usage). It's a full Linux box with decent GUI at the moment. The only thing that doesn't work yet is HDMI audio, and I haven't verified if analog audio is working (Apple TV uses RCA outputs, kind of non-standard) but the analog audio output works just fine. But Hulu videos are slightly choppy. Still watchable, but a but choppy. During a Hulu playback session in full screen, the flash plugin uses about 85% of CPU cycles and 52% of the 256 MB memory. The firefox process doesn't use much CPU cycles (0.7%), but uses another 15% of the physical memory. I credit the adobe flash player's use of the nvidia GPU capabilities. My guess is that the CPU is basically used for network and streaming workload, and the GPU takes care of the rest.
For now I'm going to call it a day and use it the way it is now. If I do more, I'll post it here.

Edit: I decided to set it up for now as a home server for remote ssh and possibly a web server. I could use it for squid too, but these services will come at a later point.

Why? Well I forgot to tell you that I removed the fan inside the Apple TV, and it is working just fine. The fan seems to be useless, it's not even installed on the CPU, It's just there. Anyway, without the fan, I have a noise-less machine at my home. Perfect for a 24/7 server.

Another piece of info about the memory usage. gnome-system-monitor reports that the current installation (with lxde and metacity) uses a grand total of 68MB of active, writable memory, and 188MB of free memory. That's a drastic change from when I had Mac OS 10.5.8 running on it, when the free memory would at best reach around 50~60MB. I'd say, mission accomplished!

Note: Click on the photos to enlarge them.

If you feel interested in any of them and want to get the original file, please don't hesitate to email me!

Sunday, December 09, 2012

60 hours with Linux

Hi everyone, loooong time no see :-) So a few things happened since my last post here. I finished my PhD studies and finally graduated. I spent maybe a quarter of last year traveling. I started playing the Persian setar, and maybe, only maybe, I might be on the path to start a startup company. Anyway, this post is not about the past year or two, it is about the past 60 hours, where I spent wrestling with Linux two separate Linux installations (and a total 8 hours of sleep).

Exhibit A:
The first one was setting up a modern Linux variant, Ubuntu 12.10 on an up-to-date PC, one which I bought components for in this past black-friday. We are talking Intel core i7 3770K, 16GB of memory, NVIDIA GTX480 (which I got from NVIDIA as a gift in the last GTC conference), SSD, etc. The intent here was to setup a CUDA 5 development station. I wrestled with installing 12.10 first, then 12.04 and finally only got everything to run under 11.10. The problem turned out to be assumptions, and lack of enough documentation. See, I first tried to install NVIDIA drivers downloaded directly from NVIDIA website on Ubuntu 12.10 and 12.04, but for whatever reason it didn't work. Googling around, I found out that ubuntu has now packaged the latest drivers (310.19) in their repositories, and it's just a matter of a simple "sudo apt-get install nvidia-current". But but but, turned out the CUDA 5 toolkit assumes the libraries are not in /usr/lib/nvidia-current, where the ubunutu developers have decided to put them. More over, the CUDA 5 make file structure has changed, and instead of a including a file, each make file is not independent. So I would have to modify every single SDK sample by hand to make it work. Another problem: ubuntu 12.10 has moved to gcc 4.7, which is NOT compatible with CUDA 5. Solution: I moved back to 11.10, where gcc is 4.6, and NVIDIA drivers install just fine. Although I think I may move the machine to 12.04. Another problem I experienced is that the Atheros AR8161 ethernet chips that are integrated on my GA-Z77-DS3H motherboard do not yet have a driver on Linux, apparently on any version of ubuntu at least. I'm sure time will fix this problem, but at the moment it seems the only solution is compiling a custom Linux kernel and installing kernel modules manually. Moral of the first story: Make sure to understand the assumptions used in Linux packages. Also, the situation in Linux world (or ubuntu world at least) is as hectic as it ever was.

Exhibit B:
So I ended up working very late in my new lab (at the IGB building at UIUC, which seems to be an empire of its own, but that's a story for a different time). Why? Because I don't yet have a keycard, and the building is locked after 5 PM and weekends. Geeeez! Anyway, after I installed the ubuntu 11.10 and got my CUDA 5 working, I went back home at 2 PM. Well I still had the Linux itch in me, and had the components ready for another go. SO I started a weekend project, to install Linux on my Apple TV (first gen). I had previously replaced the Apple's media player OS with a version of Mac OS X leopard (10.5.8), but I was never happy with the performance. AppleTV only has 256MB of memory with a 1GHz pentium M processor. The processor isn't bad, but the RAM is really limited and the system starts thrashing as soon as you want to do anything useful. Add this to the slow speed of the original 4200 RPM hard drive, and the experience is very lethargic. Anyway, I first tried to go without the prepackaged crystalbuntu images, but neither the live USB nor the installation image could boot the system. I suspect the reason was that I had put a brand new SSD drive insead of the hard drive. Dang! I finally found out about the ATV-Bootloader project, which is pretty neat. The idea is that when AppleTV BIOS can't find its Apple provided TV, it will fall back to a recovery partition and run whatever it is there (assuming it has an Apple Boot.efi). ATV_bootloader does exactly that. You partition your hard drive (or USB) with an Apple partitioning scheme, use the correct boot.efi from Apple, but then hand it a Linux image to boot. The result is that the system boots up to a busybox kernel. From there on, you have control and can boot into another kernel using another neat trek called kexec, which is the same idea used for exec, but for kernels. It works since Linux (Unix) kernels are image based, all you need is a vmlinuz and initrd.gz (or initrd.lz in newer ubuntus). So after I got into busybox, I tried installing ubuntu 12.10 or lubuntu 12.10. Neither would load up. So after Googling more, I decided to curb my enthusiasm and settle on what has shown to work, ubuntu 8.04. I also decided to go with lubuntu / LXDE, but alas Lubuntu wasn't available back in 8.04 time frame. Anyway, ubuntu 8.04 LIveCD (copied onto a USB) would run fine, but the installation process was VERY VERY SLOW. It took it 6 hours (!!!) to get from page 1 of the install script to page 6, and it finally froze on page 7. Sooo, back to drawing boards again. This time I decided to use 8.04 server edition, and lo and behold the installation worked out just fine! W00t, I have a functioning Linux. Then I went ahead with installing X11 package y package and then LXDE on top of it. The whole thing ended up in a pretty fast Linux experience, which wouldn't need much more than the 256MB RAM available. I set aside a large swap space on the SSD, but haven't got to the point to try out its effects yet. I had a little bit of adventure with older NVIDIA drivers not liking 8.04 due to the support for XEN in that version of the kernel. I ended up installing the latest legacy driver package from NVIDIA, 304.xx, and it seems to work fine. However, I'm still having a hard time getting the wireless chip to work. My network at home is WPA2, which is proving to be too hard for the current configuration. (I'm not even sure if the broadloom hardware supports it.). For the time being, I'm connecting it through ethernet to my macbook pro (using "internet sharing" functionality, since I only have wifi in my house and no wire. Sharing internet with my neighbor can be economical, but once in a while you end up wishing for a wire!) I'm currently using midori for the browser, which is slightly more memory consuming than dillo (where I was a Mac OS X contributor for a short time), but much more functional. Turns out installing X and LXDE from scratch is a bit of an underwhelming experience, since pretty much nothing else is installed. That's why a distro helps you so much, it already has a lot of stuff included. I'm not fully done with it yet, since putting "startx" in /etc/rc.local ends up loading LXDE in root mode, which isn't a very good idea. And in my last round of tinkering, I lost the window manager functionality (probably open box got crushed somehow). I have X and graphics, but no window borders!

Moral of story: It's fun fun fun to tinker with Linux, but don't expect to get very functional setups. At the end of the day, I'm glad I have my Macbook pro with its very functional unix based OS that works and doesn't need constant tweaking. Also, I would like to switch to some distro that doesn't change all the time. From Ubuntu 8 to 12 SOOO MANNNNYYYYy things have changed! I'd like to invest my time in a more stable distro that doesn't change all the time. I think RHEL and its open source equivalents (CENTOS, Scientific Linux) probably change less often, but I'm too unfamiliar with RPM based distros that I'm afraid to move. I like my apt-get! And Debian itself isn't sexy enough for many, for example there is no NVIDIA CUDA package for Debian. So, I guess for the time being I'll stick to ubuntu and accept the fact that it changes all the time. Well, maybe if I stick to LTS releases ...

Note: Click on the photos to enlarge them.

If you feel interested in any of them and want to get the original file, please don't hesitate to email me!

Friday, May 15, 2009

Picasa for Mac

I have been waiting literally for ages to organize my pictures. At one point I almost did it by using Picasa, but unfortunately it was only a few weeks before my transition to a Mac. Ever since, I have been trying to convince myself to change my picture storing habits from self-controlled folders to trusitng iPhoto to do the correct thing, but it never worked for me. I think I just need to have the control.

Any way, Picasa is finally available to macs. And it works quite well, especially since at its core Picasa is an image viewer, not an image organizer like iPhoto. By the way, I have the same problem with iTunes, I wish it could only monitor my music folders and show their contents, but that's a different story.

Anyway, hopefully this move will make emailing and Picasa-Web-Album-Sharing of my pictures much easier and hence pheasible. People who know me usually think my camera is a one way black hole, and even though my pictures are usually good (photography is one of my hobbies) they rarely get to see the final shots! Hopefully it won't be the case anymore.

To coelebrate this development, here's a picture of the sunrise in Galveston Island, Texas.

Posted by Picasa

Note: Click on the photos to enlarge them.

If you feel interested in any of them and want to get the original file, please don't hesitate to email me!

Monday, May 11, 2009

Large Japanese soroban, belonged to John Nash.

I found this soroban in an admin room. Now belonging to our university, it used to belong to John P. Nash.

Posted by ShoZu

Note: Click on the photos to enlarge them.

If you feel interested in any of them and want to get the original file, please don't hesitate to email me!