Trishock

ep\sqrt{-1}taph

Linux, laptops, and suspend to memory

  2010-02-25 @ 21:18  [Category: Linux]  [link]

In the past, sound problems involving ALSA or OSS were highly prolific on Linux help forums. The sound system simply did not work well enough out of the box for quite a long time. Now, with the advent of dmix in ALSA and the proliferation of sound servers like PulseAudio, sound seems to be pretty well worked out. Unfortunately, I can't say the same about suspend and resume.

Having a laptop that will not suspend to memory is nearly as inhibiting as having one with no battery. The reality is that, yes, my Vostro 1000 is getting pretty old. You would think that after numerous kernel, driver, and HAL/DeviceKit releases that a three to four year old laptop would exhibit a very high degree of compatibility. While this is the case for most parts of the Linux kernel, video drivers and the ability to suspend have always been unstable and unpredictable. I don't think I have ever upgraded a release of Ubuntu or Fedora without something on this laptop ceasing to work properly.

The first issue is that I have to use versions of the ati/radeon xorg video modules from Ubuntu 9.04 (Jaunty) since the newer ones available in Karmic simply will not allow me to wake up from a suspend to memory. All it presents the user with is a black screen of death. The second issue is the seemingly amazing ability of suspend to bounce back and forth from functioning perfectly to poorly with every kernel release. I'm not going to go into any details here, but I will say that I think focusing some development time on improving the suspend and resume experience on laptops and netbooks could go a long way in avoiding the loss of adventurous new users trying Linux for the first time.

I should also note that I have been unable to use the binary AMD-provided fglrx module since Ubuntu 8.10 since they stopped supporting the Radeon XPress in my laptop. I'd have to say that Intrepid was probably the most compatible release of Ubuntu for this particular laptop when taking everything into account. After forcing an install of the older video drivers from Jaunty suspend and resume appears to work reliably. This all comes after placing a new 32GB SSD drive and $30 battery into the aging laptop and it feels like it has some life in it again!

Patriot PS-100 32GB SATA SSD

  2010-02-21 @ 16:33  [Category: Hardware]  [link]

While perusing the local Micro Center advertisements yesterday I came across a Patriot 32GB SATA SSD that was listed for $104.99 with a $20 rebate. This interested me and I identified it as a possible investment to temporarily make my Dell Vostro 1000 a bit more bearable. There was also the possibility of using it in a new netbook to replace the platter-based solutions that many are coming with.

Micro Center was beyond busy, but after soldiering on an employee eventually provided assistance and removed the product from the glass case it was stored in. After asking about the rebate, his friend quickly stated that he believed there was a $40 rebate on this drive. A 32GB SSD for $64.99 would be an amazing deal (assuming it isn't a completely useless product). The advertisements clearly stated a $20 rebate. After some muddling, the employee found it was now a $30 rebate. With the old man there (who was quite curious at this stage) willing to foot the bill we made the decision that it would be used in something (an old laptop, a new one, a new netbook) and that the deal was a bit too juicy to pass up. We then proceeded to wait in line for 20 minutes to have the pleasure of handing them their money. We got a good deal on some dual layer DVD's too.

The drive itself is very light and has a strong casing that appears to be made out of a lightweight aluminum-based material (much like my Lian Li case). There were no issues with using it, and Ubuntu 9.10 installed onto it with no quarrels. I read some discussions by other owners claiming that their performance was abysmal and that Patriot was accepting drives and replacing them with new ones. I decided to do a few tests using the IOZone test found in the Phoronix Test Suite. My test results on Phoronix Global can be found here.

The claimed peak speeds of this disk by Patriot are 150MB/s write and 200MB/s read. I scored an average of 122.33MB/s on the write test and 171.17MB/s on the read test. Those don't seem abysmal to me. The read speed is faster than SATA150 is even capable of (I imagine that many laptops purchased between a year or two ago still use SATA1 controllers). I'm very satisfied with those numbers. When keeping in mind that numbers provided by Patriot are peak speeds and not sustained speeds I don't believe that there is a performance issue with the drive I received. If it weren't for all of my important files being on my other laptop disk drive I would try to move over to the SSD today!

When in doubt, make graphs

  2010-02-07 @ 14:27  [Category: Mathematics and Science]  [link]

First, a disclaimer: The following statements were based off graphs I created using data from six broad academic disciplines. The data all comes from the 2008 digest published by the National Center for Education Statistics.

After spending weeks of my life preparing applications, essays, and letters alongside taking a standardized test and participating in a game of formal introductions and requests I was left wondering how many people end up going through with the whole experience. Just the act of applying for graduate school is exhausting. Statistics on how many enter and finish their graduate degrees to completion could be interesting, but I found information on total degrees conferred readily available in a report by the National Center for Education Statistics.

The report is quite sizable. If you're just in for a good summary, avoid any of the tables and focus on reading the text and making note of the figures. What I found most striking was what I perceived to be amazingly low numbers for fields like mathematics, physical sciences, and computer science. For example, only 21,703 people received a degree in the category of physical sciences and science technology in 2006-07. That's for the entire country. The primary disciplines that fall under this category are chemistry, physics, and earth science.

The picture isn't much different for graduate degrees (masters and doctoral). The most interesting data is that of the number of graduate degrees conferred in education. The number is consistently and substantially larger than the number of undergraduate degrees conferred for the same year (and that of the previous).

It is even more interesting to explore the trends of the relative amount of degrees conferred. By looking at a proportion rather than the total number, it's possible to see changes in the choice of discipline made by students. First, let's look at the trends in the proportion of bachelor's degrees conferred.

From 1971-1981 it appears that the proportion of students choosing to seek a business degree has increased steadily at a relatively constant rate. The proportions of undergraduate students receiving education degrees has contracted, physical sciences and technologies has remained stable, mathematics and statistics has shrunk, and engineering has grown. Then, there is a period in 1985-86 where the number of computer and information sciences and engineering degrees grew, but subsequently retracted. From 1995-96 onward, the proportions change very little. There is a slight bulge in computer and information science degrees in the early 2000's which declines starting around 2003-04.

Comparing proportions of graduate degrees conferred is less exciting. Other than the expected growth of the proportion of business degrees and the shrinking of the proportion of education degrees leading up to the 1990's, the proportions are amazingly stable from the 1900's onward.

In a country of 300 million people, it's almost staggering to think how few students receive degrees each year. It would seem that there are so many universities that have so many students that there must just be gaggles of students receiving degrees across the nation in just about every discipline. It often feels like that to new graduates searching for a job, at least. The numbers tell a different story. Consider that the number of students that receive degrees in mathematics, statistics, and physical sciences each year could fit into a moderately sized rural town. During 2006-07, 1351 people received a doctorate in mathematics or statistics, 2029 in business, and only 1595 in computer and information science. While this last statistic isn't evident in the previous graphs, you can see it in the OpenOffice.org Spreadsheet I made. A PDF is also available of the graphs to provide more clarity.

LaTeX and Google charts API

  2010-02-06 @ 23:01  [Category: Mathematics and Science]  [link]

Quite some time ago, I was made aware of a useful feature featured in Google's charts API. The document service provided by Google provides an equation editor which is actually a friendly way to interface with TeX/LaTeX. It's possible to generate your own equations this way and share them using standard LaTeX syntax for math equations. For example, the definition of a derivative of a function at point a:

Or perhaps the definition of the mathematical constant e:

For many involved in authoring papers in scientific fields or in mathematics, LaTeX often becomes the typesetting method of choice. Even in the face of growing competition provided by equation editors in Microsoft Word and OpenOffice.org Writer, well-typeset documents produced by LaTeX still thrive. Having a simple way to generate LaTeX and share it could be useful for discussions by email where sharing some cryptic looking syntax such as:

\lim_{x\to\infty}\left(1+\frac{1}{n}\right)^n

Could be cumbersome. It's also a heck of a lot faster than generating your own images and uploading them (though if you must do this, you might want to try Ekee. A word of warning: the string that you send the charts API to generate an image cannot be larger than 200 characters. It's suited for generating single equations, but not for creating a series of them.

XBMC + VDPAU = Amazing

  2010-01-30 @ 20:51  [Category: Linux]  [link]

Over the past few weekends I have worked to get our aging HTPC back into action. The only monetary investment that was made was a $40 video card. After purchasing a new Geforce 210 to replace a 7100GS and moving over some memory from a now defunct workstation, the new machine was a little more formidable:

  • AMD Sempron 2800+ (1.6GHz, S754)
  • Nvidia GeForce 210
  • 2GB (2x1GB) DDR2-800

It's connected to a 32" Sony Bravia through a D-SUB cable since it appears that the HDMI pass-through on the Geforce 210's is not properly working yet in Linux. All of the hardware resides in an old nmediapc case that's now discontinued.

HTPC

I purchased the Geforce 210 for a specific reason: VDPAU. VDPAU allows for the offloading of intensive calculations associated with playing videos and has grown to be quite encompassing over the past year. I was keen to see if VDPAU was as effective as some benchmarks had indicated and I thought that testing it with a painfully aged budget processor would reveal just how useful VDPAU is.

Setting up VDPAU wasn't difficult thanks to the VDPAU team PPA. I formatted the HTPC and installed Ubuntu 9.10, downloaded the required drivers using the PPA and installed the builds of Mplayer and SMplayer. VDPAU worked without many quarrels and preliminary tests showed the processor never breaching 10% with 720p x264 encoded files. These results were very impressive, but I would later find even more staggering results. One issue that had to be dealt with was some vicious tearing. To remove this, you must setup your xorg.conf to disable the composite extension entirely. The easiest way to do this is:

sudo nvidia-xconfig --no-composite

After disabling the composite extension and restarting the X server the tearing was gone. Now, at the time, I felt very content with myself. I had spent $40 to upgrade a nearly four year old HTPC and managed to coax it into playing extremely high bitrate and processing intensive HD x264 files. The extra memory helped improve the boot time tremendously. I thought that I was done until this accessory showed up courtesy of my father (apparently they have over half a dozen of them lying around where he works):

MCE USB Remote

This led me to battle the beast known as LIRC which provides for the use of IR devices (in my case the receiver and the remote). The documentation for LIRC and the available resources appear very esoteric and somewhere between confusing and misleading. I ended up finding the best resource (albeit a very out of date one) on the MythTV Wiki). Microsoft IR remotes (my model is TSGH-IR01) are very well supported through LIRC and it was easy enough to follow the directions on the wiki page to get the operating system to recognize key presses. I then used a package to generate the key mapping files:

sudo apt-get install mythbuntu-lirc-generator
mythbuntu-lirc-generator

This got me some basic functionality in VLC and MPlayer. At this point, I began to fantasize of removing the need to use the wireless keyboard and using my fancy IR remote instead. After finding that newer builds of XBMC support VDPAU, I decided to take the plunge and spend the day installing and configuring XBMC. I got the builds from the Team XBMC PPA. XBMC worked nearly flawlessly and interfaced with the MCE remote very well. I begin to feel like it may be possible to operate the machine entirely without a keyboard, but there were quite a few hurdles in the way.

First, I had to add a new xsession config for XBMC (make sure it's with the --standalone option or else it cannot automount USB devices) and enable auto login. This made for a very speedy boot process that dropped the user directly in XBMC where they could easily use the remote to navigate and control playback. Second, there is a very visually displeasing bug with the new xsplash system in 9.10 that causes an Ubuntu loading box to appear and remain over the XBMC interface for what feels like an eternity. To fix this issue:

if [ -x '/usr/bin/xsplash' ];
then
/usr/bin/xsplash --gdm-session --daemon
fi

Must be removed or commented out from both /etc/gdm/Init/Default and /etc/gdm/PreSession/Default. Thanks to Freek on the XBMC forums for posting this solution.

The two other primary issues involve DVD playback and the mounting of large USB hard disks. The DVD drive issue is ongoing and I believe that the IDE channel on the motherboard may be dying. After trying three PATA DVD drives and each of them exhibiting issues with playback, I think it may be time to spend $20 on a SATA optical drive. The most difficult problem to solve involved the automatic mounting of USB hard disks. Smaller USB flash drives work fine, but large USB hard disks did not automatically mount in XBMC. After toiling for an hour, I found that a script written by andyblac on the XBMC forums has the ability to which fix this issue. Some disks still appear to not work correctly, though. Mileage may vary, I suppose.

At this point I was feeling pretty content with myself. Clearly, I had breathed new life into this aging HTPC with minimal monetary investment. I added a special XBMC usplash to complete the look and configured a lot of the internal XBMC options to round out the rough edges. The interface and the remote work amazingly well together. As a final test, I decided to use what's known as the "Killa Sample" (torrent, rapidshare) which is an amazing scene from Planet Earth. This sample clocks in at an average of 33.1Mbps @ full 1080p and brought my workstation to its knees (it rendered grey and green blocks) using normal xVideo video output with an Intel C2D E6750 (2.66GHz). Much to my amazement, the 1.6GHz Sempron and GeForce 210 with VDPAU handled the file with no issues. We watched stunned as the file played smoothly.

In conclusion, VDPAU lives up to and beyond the hype it receives. For an HTPC, XBMC is a very user-friendly option that required some minimal tweaking. For an HTPC that has no tuner card I think XBMC is the clear choice over MythTV.