jQuery UI is awesome…. mostly…

A lot of pain recently with jQuery UI. They are transitioning to a major new version: 1.6. First, off there is no official jQuery UI release for compatibility with jQuery 1.3. That’s fine, jQuery 1.3 is very new. It would have been nice if they could have released a UI version at the same time, but that’s their prerrogative. Normally I would have just waited for things to settle down anyway.

Unfortunately, one of my projects had the distinction of being one of the few production sites running a jQuery UI 1.6 release candidate. We needed it to fix a problem with the jQuery UI 1.5.3 sortable. It had a bug with nesting inside of a scrollable div that has been fixed in jQuery UI 1.6. So we’ve been watching 1.6 move towards a full release and it has been a bit painful.

We needed to add an autocomplete control to our site. So we looked into it and were horrified to learn that there are basically 4 different versions, all inter-related, all with terrible documentation. What’s worse some of the UI 1.6 release candidates included an autocomplete with a different API convention, but now in 1.6rc6 that autocomplete is gone. I found this out the hard way because generating an earlier rc my page magically broke. It turned out that if you downloaded the complete rc you got the autocomplete. If you built one there was no option for the autocomplete, and they would leave it out.

After I got that fixed I discovered that merely using the new JS wasn’t going to work as jQuery 1.6 needs new corresponding 1.6 css. So now I have to roll a new theme.

Now that I’ve worked with jQuery I refuse to work without it so I’ll have to ride this out, but it has been a painful week for me to see jQuery UI folks stumbling.

End result will hopefully be this:

jQuery 1.3.1
jQuery 1.6rc6
a third party autocomplete (I can’t remember which of the 4, we’re using.)

Update:The above mentioned combination is working for the most part.  Now we’re having a problem where the popup for the date control is showing up behind a thickbox control we’re using.  Hopefully I can find a CSS fix to make it work.

jQuery is awesome

When I started my latest project a friend of mine asked me to look into using jQuery. I had played with MooTools a couple years ago and was mildly impressed, and I figured jQuery would be more of the same.

Boy was I wrong! For what I’m doing jQuery is way better than MooTools!

MooTools is basically two things:

  • A bunch of extensions for the standard javascript classes
  • A set of really nice UI widgets

jQuery is similar, but the approach is a lot different:

  • A tool for grabbing a collection of DOM elements.
  • A mechanism for manipulating the collection once you grab it.
  • And if you use jQuery UI, a set of really nice UI widgets

The core of jQuery is a simple CSS-like syntax for grabbing a collection DOM elements from the page.  It turns out that the ability to grab the DOM elements you need is actually a disproportionately large part of building a modern web app.  Don’t believe me?  Say you need to output a formatted table with even lines colored differently than odd lines.  Tradionally, this would mean crafting a CSS class named “even” and then writing server side code to determine if we were outputting an odd row or an even row.  If it is an even row then we would add a class=”even” to the tr tag.  This would all be done inside of a big loop outputting the table rows.

In jQuery I can just output the table without the “even” class and then add it with javascript after the fact with 1 line of code:

$('table > tr:even').addClass('even')

Boom! No need to write any server side code just to add a CSS class to alternate the background color of a row.

Now with real software!

It’s hard to believe this blog has running for 6 years.  (Sort of.)  Posts have been few and far between because the most recent version of the site was cobbled together using 3 php scripts I threw together in a couple of hours one afternoon.  Adding new articles involved manual database work, which is why things have been so slow since we came back online in ’07.  But no more!

Recently, I installed WordPress for a client of my consulting business and I learned just how easy WordPress is to work with.  And, even better, it does pretty much exactly what I want my blog software to do.  Without some of the extra fluff that other software includes.

So here is to ’09 and the hope of regenerating some of the traffic that this blog used to generate before I started neglecting it.  I’ve imported all the old articles (mostly for posterity at this point).  Check back for new articles soon.

MythTV: HD Channel Problems

A friend of mine recently set up a MythTV using the same HD tuner card that I use. Along the way he discovered a problem with the automatic channel scanner in the new versions of MythTV

The problem that he found, and which I later confirmed on my own mythtv, was that the mythsetup utility that automatically scans for channels wasn’t working correctly. For some reason the channel scanner was not really changing channels as it scanned. So it would assume that every frequency existed and that they were all the same channel. We both use Fedora Core 5, a kernel >=2.6.18, and a current MythTV 0.20.x version.

The work around was to allow our Zap2It program guides to be used to import the channels into MythTv.

The way this is done is by:

  • Deleting the input source
  • Adding the input source without scanning for any channels
  • Running mythfilldatabase with the –do-channel-updates option

As I understand it Zap2It only serves North America, so if you are setting up an HD tuner somewhere else you may be out of luck.

MythTV Performance

I’ve been running MythTV for around a year and a half now. It has changed the way the family and I watch TV. Every now and again I wonder if there are some things I could adjust to improve performance.

Before the Super Bowl I upgraded to HD and learned that even some current hardware, such as a Sempron 2800, was not fast enough to playback an high definition stream without the occasional stutter. I came across an article tonight that has some good tips. You can check it out at Extreme Tech.

We’re back

After a multi-year hiatus LinuxGems is coming back. The old articles are available on the way-back-machine, so I’ll be reimporting them this week.

The past couple of years I’ve tried to bring the site back a couple of times only to run into more problems. There was an incident where our hosting provider (a good friend of mine) lost a hard drive and another where a different hosting provider was hacked (not our fault!). Our backup policy had been non-existent so in both instances the site was entirely lost. When I realized that a lot of the original LinuxGems articles were still available on the Way back machine, I knew I had to give it another try.

Gentoo Linux rocks – updated

Now that I’ve got a high speed Internet connection I’ve wasted no time downloading all the different Linux distro’s in ISO format. First I tried RedHat 9, then Fedora, and recently Gentoo linux.

Gentoo linux is different from a lot of Linux distributions because they prefer to compile every program specifically for your machine at the time you are installing. This means that installs can take days. My poor k6-2-450 cranked away for a good 20 hours before I could safely get to a boot prompt to prepare for a couple of days compiling all of X and gnome.

However, if the above doesn’t scare you off there is serious coolness in store. I expected Gentoo to be a very rough looking environment. Boy was I wrong. The gnome setup that you get by default is just gorgous. Once I switched to one of the pre-installed themes that was more to my liking I was in heaven. Everything is nice and snappy considering how old the hardware is that it is running on.

The fonts are beautiful. I was worried they would be the hideous fonts we were all putting up with 5 years ago, but there fonts are just dandy.

I’m sure there will be more follow ups on this article as I determine how stable this new environment is. Looks good so far, though.

Update: After several months of Gentoo use I eventually became frustrated with recompiling so frequently. Especially since on a half dozen occasions a program wouldn’t compile on my architecture. (What is the point of compiling yourself if code won’t build correctly?) So I’ve switched back to Fedora.

Secret Kernel Info Keys

This one classifies as one of the less useful LinuxGems we’ve captured to date, but it gets huge bonus points for being so cool. As it turns out the kernel will dump some of its state variables directly to the terminal any time you hit the correct key combo.This ones easy. Just switch to an actual kernel terminal. If are in X and you haven’t mucked with to much of your setup you can just hit Ctrl-Alt-F1. If your not in X then you are ready.

The secret keystrokes are:

  • Shift-Scroll Lock = For memory allocation information
  • Ctrl-Scroll Lock = For kernel state info. I don’t actually know, but this looks like a call trace for the last couple of process to get CPU time.

BTW, if you need to switch back to X it is usually Ctrl-Alt-F7.

MySQL + NPTL = Database Lock Ups

There is a bug in the interaction between Native Posix Thread Library (NPTL) and MySQL that causes database lock ups in Fedora, RedHat 9, and Linux kernels 2.5 and 2.6.

When using MySQL with NPTL, sometimes a process will hang. It is impossible to kill the process, even with a kill -9. You cannot kill the rest of the server gracefully, you can only kill them with kill -9, but the hung process will not die. This suggests that the problem is probably in the NPTL code in the kernel, as it is hanging in kernel space.

The NPTL causes MySQL to hang bug has been reported to MySQL, but they seem unwilling to look into it. All reported occurrences happened with SMP systems, although I’m not sure that’s related.

Without fail, when we killed the process in order to restart the server, we ended up with database corruption. This is not a good thing… One interesting side note is that if you strace the hung process, MySQL will recover. However, we have still had database corruption when we did this.

The solution mentioned in the bug report that has worked for others is to force the use of the older Linux Threads library by starting mysql thusly:

# export LD_ASSUME_KERNEL=2.2.5; mysqld_safe &

A Little Diddy About the Thunderbird Email Client

Don’t want to load Mozilla to check your mail? Sick of all the mediocre email clients out there. Give Thunderbird a try.

Ever since the folks over in Mozilla land finished up with their everything but the kitchen sink Mozilla browser, they’ve been realizing that maybe people didn’t want to load a web browser to check email and newsgroups. Maybe they could have actually delivered Mozilla when it still mattered if they’d realized it sooner.

Regardless, the new trend is to split out the browser and email portions of the Internet Suite so that we can actually load the part we want when we want it.

Enter Thunderbird 0.6, which was released just recently. Thunderbird is nearly ready for the prime time and it is a very straightforward email client. A real lean, mean, email machine. I’ve been using it at work for a few weeks and have been quite impressed.

I have stumbled across one bug on my Fedora install though. If I load Thunderbird then I can’t use Mozilla to browse afterwords. Several of my coworkers noticed the same problem. The solution, oddly enough, was to start both Thunderbird and Mozilla with the “-P default” option, which tells them to use the default user profile. (Why they wouldn’t anyway is anybody’s guess.)


thunderbird -P default
mozilla -P default

So if you want a nice little email client that starts up quickly and doesn’t feel quite as awkward as Mozilla mail then give thunderbird a try.