Archive for June, 2008

The :first-element selector crashes IE

Monday, June 16th, 2008

I made one of those interesting discoveries that make you go WTF. Apparently, when I was messing around with CSS on Friday I accidentally developed a style sheet that can crash IE6 and IE7 under certain circumstances. The code snippet at fault here looks something like this:

blockquote p:first-letter {
	float:left;
	color:#7777;
	font-size: 18px;
	line-height: 0px;
	padding-top: 0px;
	margin-top: -3px;
}
}

Essentially what this is trying to do is to make nice drop-caps in blockquote blocks. You have probably seen them already popping up around the site. I figured they are kinda cool, and make the quotes look more distinctive and add some interesting dynamic to the site. Unfortunately, they also crash IE with a lovely “This program has performed an illegal operation” error. Not all blockquote blocks caused it - but the one in the Free Public Wifi post did it every single time.

If you google this issue you will see it is a well known bug that was never fixed in IE7. Some people claim this only happens when the first letter of the paragraph is also part of a hyperlink but as you can see this is not true. It appears that just about every fucking thing may cause it - borders, backgrounds, font styling. Anything and everything. IE just can’t deal with this selector for some reason.

Good news is that I fixed it. How you may ask? I did it with the oldest CSS hack in the book:

html>body blockquote p:first-letter {
	float:left;
	color:#7777;
	font-size: 18px;
	line-height: 0px;
	padding-top: 0px;
	margin-top: -3px;
}

You see, IE6 does not understand the html>body syntax which makes it skip this rule altogether. Unfortunately this hack doesn’t work in IE7 which makes me a sad panda. The final solution that excludes both IE6 and IE7 and thus prevents them from crashing uses the star pipe hack discovered by The Front End blog.

*|html blockquote p:first-letter {
	float:left;
	color:#7777;
	font-size: 18px;
	line-height: 0px;
	padding-top: 0px;
	margin-top: -3px;
}

See kids, this is why supporting W3C standards is important, and why Joel Spolsky is such a fucking tool for claiming otherwise. No other browser in the known universe has any issues with this tiny little snippet of CSS. IE on the other hand blows up, and crashes hard. Do you still think IE is a decent browser?

TLDR version for IE users: your browser sucks!

Downtime on Thursday Afternoon

Friday, June 13th, 2008

Apparently some of you had the doubtful pleasure of seeing my directory index between 4 and 5:30 pm yesterday. Apparently I set their server on fire by (check this out) flushing the WP-Cache to see the small tweaks in the css style sheet. I made a small change, flushed the chache, refreshed the page, fixed it, flushed, refreshed and etc. So for like 20 minutes the site was mostly un-cached. Then the shit hit the fan and I got locked out of my own fucking blog only to find this in my mailbox:

Hello Lukasz,

I apologize for the interruption, but I have had to temporarily disable your site. Unfortunately, this was causing a huge load on the machine:

popcorn: 01:21 PM# uptime
13:21:58 up 78 days, 21:26, 8 users, load average: 96.58, 73.29, 53.76

After disabling this, the load dropped significantly:

popcorn: 01:22 PM# uptime
13:25:32 up 78 days, 21:30, 8 users, load average: 29.25, 51.65, 49.33

You probably need to enabling caching for this blog or disable any extraneous plugins before re-enabling it. You can check out more about it here: http://wiki.dreamhost.com/WordPress_Troubleshooting

Thanks!

I know that you get what you pay for, but I was not really happy about them just rendering my website inaccessible without:

  1. Letting me know there is a problem, and allowing me to fix it
  2. Telling me how to restore my website to usable condition again

Fortunately all they did was to rename index.php to disabled_index.php so I was able to quickly get it back online. I also tried to comply with their whiny demands and made Caching much more aggressive. Let me know if you notice any weirdness on the page - especially stuff like CAPTCHA’s not working properly.

Here is my reply to them - note that I was a tad pissed off when I wrote this. In retrospect perhaps I was a bit harsh on them. What do you think:

First, how to I enable my site back? I’m getting emails, my readers are not happy and I’m losing advertising revenue. It would be nice if I got some instructions on how to do it. I’m guessing I just rename disabled_index.php back to index.php? Thanks for telling me that though.

Second, all I’m running on my account is a basic Wordpress account with couple of plugins - chiefly WP-Cache, Akismet, and Bad Behaviour which aim to reduce the system load, and prevent spam. Two out of these were specifically listed on the troubleshooting site you linked to in your email. There is really not much else there.

You want to know what I was doing in the last few hours? I was tweaking my .css stylesheet and I cleared the cache few times to see the results. Could something as minor as that be the reason of such a huge spike? I will refrain from doing this in the future, but geez!

I haven’t added any plugins in the last 6 months. I haven’t changed the theme. I haven’t run any scripts. All I do on that account is blog. There is really nothing there that would be out of ordinary - just Wordpress installed via the one-click install from the panel. The only changes I really did to it in the past 6 months were small css tweaks.

Third, over the last year or so, I frequently witnessed the system load on popcorn to spike up way above 200. Some of my readers joke around that the site often takes up to 3 minutes to fully load during peak activity hours. Why is that? Is Wordpress really such a resource hog? Do I really get this many hits per second? I really doubt it. There is no way for me to control how much traffic do I get. I’m really not running some crazy scripts in there - it is just a fairly standard Wordpress install with a default theme. I can mess around with it a bit and try to switch off plugins but I really don’t think that will reduce the load of this website that much - I mean there is not much to disable there.

Really, I understand that it is hard to run a shared hosting company. I was always with you guys. I have been always very tolerant, and a loyal customer. I even recommended you to some of my friends despite the apparent flaws. I dealt with the regular downtimes, and I didn’t really say anything when you guys accidentally charged me over $200 for the next 3 years of hosting few months back. It happens. But disabling my website for undisclosed time period on a whim without giving me any prior notice and any possible chance to fix the issue before the website goes down is just pushing it. It’s unprofessional, and very disappointing. I’m hurt, I’m angry and I’m annoyed. Perhaps it is time for me to start looking for a new home.

If you see an activity spike on popcorn later today it might be because I’m backing up all my files and preparing to move to a new host.

So please tell me, what am I supposed to do here? What can you offer me? I’m not really interested in running a website composed from static HTML pages - I actually do want to use Wordpress and I do want to keep runing Akismet and other anti-spam plugins which keep it clean. I don’t really want to spend hours, hacking Wordpress and trying to figure out how to optimize the plugins that I use. I just don’t have time for that. And I definitely want more people visit my website - not less.

So what are my options? Will my blog get disabled every time there is a traffic spike? I mean, what if (God forbid) one of my posts ends up on a front page of Digg tomorrow? I’m not saying it will but it happened before, and I hope it will happen again. What then? Will popcorn spontaneously burst into flames?

Why should I stay with dreamhost?

I’m not a happy customer right now.

Was I out of line? I really think I will need to find a new host soon. I know I say it all the time, but stuff like this might just be the thing that will push me to finally do it. So this is once again time to pimp your host. Who do you use? What are their prices? What plans do they offer? How is their support like?

Update - it seems that I actually got a relatively knowledgeable and thoughtful response:

Hi Lukasz,

I’m the resident WordPress nerd around these parts and I can understand how upset you could be. Still, your site was causing undue strain on the server. I don’t think it has anythig to do with clearing out WP-Cache tho. I do notice that you are running Bad Behavior as an anti-spam plugin. Normally. that’s okay - but for whatever reason Bad Behavior and our system don’t seem to play nice with one another when a site is being hit by a spam attack. That very well could have been what was happening here - but as I wasn’t the one who disabled you, I can’t tell.

I run the WordPress blogs on our here (blog.dreamhost.com and dreamhoststatus.com) and I’d be happy to give you a few pointers to keep things lean and mean. First up, you’re doing the right thing by running WP-Cache. Unfortunately, the programmer isn’t actively updating that plugin anymore. The successor to that plugin is currently WP-Super-Cache. More info about it can be found here:

http://wordpress.org/extend/plugins/wp-super-cache/

As for spam fighting plugins, sticking with Akismet is good - but using WP-SpamFree in place of Bad Behavior is a bit kinder on CPU cycles. We use this as the one-two punch on our blog and the spam that Akismet has
to process has gone down considerably. Check it out when you have a moment:

http://wordpress.org/extend/plugins/wp-spamfree/

Turning that on and getting rid of Bad Behavior will actually take your overall memory usage down quite a bit, so please try that out and let me know how it goes.

Also, I’ve poked around your database and have noticed that the table for Top Post By Category has eaten up 111.6 MB of your database. That’s more than 3/4 of your total MySQL database size right there. If you are no
longer using that plugin, it might be a good idea to clear that category out. In fact, it’d probably be best to stop using it as that will help speed things up as far as page generation goes.

If you’re curious as to why you should stay with us, hopefully the observations I’ve offered you on how to make your site run a bit better in our environment will make a convincing argument. Most companies would leave the ball in your court when it comes to optimization - but I honestly want you to get all the traffic you can. Outside of the WP blogs here, I have my own sites (hosted here) and I know the feeling of folks outside of your immediate social circle checking out what you’re doing. It’s pretty nice.

Anyhow, try my suggestions out if you’d like and please go ahead and let me know if you have any further questions. I’ll be more than happy to help you out in whatever way possible if you do.

The nice thing about Dreamhost - one of their few redeeming factors is that their support staff is usually quick to respond and usually knowledgeable and helpful. Well, with the exception of that tool who renamed my index.php and didn’t tell me about it that is. My past interactions with them were very positive. Can’t hurt to try his suggestions for now. The top posts plugin is gonzo for now! I liked having it in the sidebar, but I did not realize how database intensive it was. Oh well, good riddance. I will try to switch over to wp-super-cache and wp-spamfree over the weekend which may or may not speed up the site a bit. We shall see.

Show me your desktop

Thursday, June 12th, 2008

Guess what time it is? It’s time to share our desktop screen shots! Wohoo! Go desktop exhibitionism!

We actually did this once before, and several people jumped into the thread and pimped their awesome setups. It also turned out that most of you guys have much better looking setups than I do - mine tend to be basic and stripped down. ) Which is ok, since it gives you a chance to shine showing off your awesome, themed desktop environment. I’m sure everyone changed their desktop wallpaper and themes since last year (I know I did) - some probably changed computers. So let’s share! I’m going to post just thumbnails below since these tings tend to be big. Tto see the full resolution images you will need to click on the thumb - which should be self explanatory I think. I’m doing this both to save some bandwidth, and also to save you some waiting while the page loads. Cause, you know - I’m on dreamhost so a static text page over here usually loads in a little under 3 minutes - but only during the off peak hours. P

First up, my Windows desktop. As you can see, I’m running Win XP in classic mode cause the bubbly XP windows decorations kinda piss me off:

My Desktop

Portal love! Who’s with me? Possibly the best game evar!

Next up, the bare bones install of Ubuntu Hardy with Ratpoison on the ancient Compaq. Half the time I actually run it without X, but I figured that a screen shot of a blank tty would be kinda boring.

The Compaq

You have already seen this one the other day when I posted about the setup of this machine but I’m showing it here again to show off the Eva wallpaper.

Finally, here is my work laptop running Kubuntu (Gutsy):

Kubuntu

I keep it simple with the default wallpaper because I use it at work, and sometimes at school. It doesn’t really look very professional to have giant robots, video game related stuff or half naked ladies on your wallpapers so I’m sticking with the basics. Also, I kinda like that KDE theme - simple, subtle, basic and unobtrusive. Perfect for work environments.

Now it’s your turn. Note that I’m not allowing image uploads in the comments, and the img tag is disabled because wide images totally mess up the layout here. So simply link to your image, and if you don’t have a server use imageshack, xs.to or some other free service to upload it and link to it. Let’s see who has the best looking setup around here.

Hitman the Movie the Review

Wednesday, June 11th, 2008

I must admit that I’m a huge fan of the Hitman series. I loved all of the games, but you probably know that because I reviewed at least one of them on this very blog. When I heard that the movie was being made, I knew it was going to be bad. But I also knew I will have to watch it out of the love for the series.

DVD Cover

As expected, the story from the game was scrapped completely and re-written from scratch. The only elements that remained intact were cosmetic. So the main character is still known only as 47, he is still bold, has a bar code tattoo on the back of his head, and wears his black suit, and a red tie. He also gets his contracts via laptop emblazoned with the trademark lily logo just like in the games. There are also couple of shots that tried to mimic the 3rd person perspective view from the game.That’s about it. Everything else was changed.

Agent 47 is no longer a genetically engineered clone, but an orphan trained from a very early age by the “Organization” which is no longer the ICA we know from the games. No recurring characters such as the unfortunate Agent Smith, or Diana Burnwood. In fact I thought Diana will be the female lead in this movie, but instead we got a bitchy, foul mouthed prostitute who just can’t seem to keep her clothes on and keeps interfering,
and getting in the way.

hitman_mirror.jpg

They also failed to capitalize on some of the very memorable locations and settings from the game. Some of my favorite were the Hell/Heaven Masquerade club, the Opera House, The Casino and the Mardi Grass. This was a perfect movie to show our hero traveling all over the world trying to find clues by performing strategic hits in various exotic locations. Instead, the whole move takes place in Russia and our locales are: gray and dirty Moscow Streets, Moscow train station, rural Russian back roads, and a Russian Orthodox temple. Sort of bland and unimpressive for what it could have been.

I admit, the whole super-human clone bit was always a bit cheesy so I can see how someone could want to remove it. It worked in the games, but perhaps it would not work on the big screen. But then again, if you are making adaptation of a successful franchise why mess around with the plot? It’s not like someone will accuse you of bad writing because you were simply faithful to the original. You can still create dynamic dialog, and memorable characters while working within the framework of the original plot. But this is Hollywood, and the temptation to remake the story to cater to the lowest common denominator seems to be irresistible.

hitman_train.jpg

The usual formula is to take a successful property and turn it into a blockbuster action flick with lots of shooting, explosions and mandatory gratuitous nudity without regards for the theme, tone, and mood of the original.

The Hitman movie is precisely that - it is Agent 47 meets Mission Impossible. Over the top action, extensive slow motion shoot-out scenes with high body count, and prolonged martial arts sequences are basically the “meat” of the movie. Very little is left from the original game play experience which awarded stealth, subtlety and blending into the background. In the beginning we can see him perform a couple of stealth kills, but that ends abruptly when the tables are turned and our hero is exposed. From from that moment, till the and his primary modus operandi seems to be full frontal charge. Scene after scene we see him burst into one place or another, whip out his guns and then keep shooting until no one is left alive.

The portrayal of Agent 47 is not true to the original either. In the games the protagonist was cold, detached, cynical unflinching and extremely professional. He seemed world weary, and while capable of good and compassion he never let these things interfere with his job, or compromise his safety. Timothy Olyphant’s take on this character comes close to the mark, but misses by a considerable margin. He sort of got the look, and some of the mannerisms - and sometimes he is able to pull off the classic 47 “no bullshit, just business” demeanor. Unfortunately most of the time his warm and somewhat youthful and energetic personality shines through. In fact, 47 seems to be written to reflect that - as sort of an innocent, misunderstood and socially maladjusted personality. He is actually sort of a nerd incapable of normal social interactions and very uncomfortable around women. In the very first scene we see him, he gets hit on by some ditzy blond who tells him he should not put ice in whiskey, and he just runs away like a school boy.

hitman_leg.jpg

While the games never really show 47 being intimate with a woman it can be somewhat justified. The only time we see our hero is during or between missions. And unlike James Bond and other action heroes modeled after him, 47 doesn’t mix business with pleasure. When he is on a job, he has no time to fuck around (both in literal, and figurative sense of the word). In the movie however any sexual advances from the opposite sex seem to make him very uncomfortable, and he reacts very awkwardly every time. His overall attitude towards sexuality sort of reminds me of the uneasiness with which Dexter approaches the same topic. I do not agree with this interpretation though. I don’t think the real 47 would ever have to resort to using a sedative to “escape” from under a half naked chick desperately trying to undress him. I have no clue what the point of that scene was but my brother agreed that it made the protagonist look totally gay.

If I was to describe the Hitman movie in one sentence, I would say it is a light hearted action flick about awkward, sexually ambiguous, 40 year old virgin killing machine with a heart of gold. Or in other words, complete departure from the source and a total waste of time. This just supports my theory, that movies based on video games totally suck. I have yet to find a single exception to this rule.

Ubuntu Hardy on Compaq Presario 1240 (Living Without X)

Tuesday, June 10th, 2008

Well, the Nethack Server is gone. I know that couple of people played on it, and Anthony even ascended but it is now gone. It was actually off line for months now and I didn’t even notice. It got knocked off the network when I switched from WEP to WPA few months ago. Then it crashed hard and sat there for another month or two without a reboot. Now I have some nice dead pixels on the LCD which I guess might be sort of a screen-burn side effect or something. It was acting slow, and erratic so I nuked it. I should have saved the high scores and the bones files but hindsight is always 20/20. So big apologies to anyone who played on the server. I might resurrect it at some point, but I guess the old Presario with the flaky Wifi is just not a very reliable platform for something like that.

It is a good platform for experimenting with bare bones installations. I always wanted to set up an X-less machine and see how usable it would be. I already have a library of very useful CLI apps so really this should be a great experiment. I briefly messed around with a net install of Debian Etch but in the end I went right back to what I know and decided to give Hardy a whirl. It would be a nice test to see how the brand new system stacks up on very old hardware.

So I grabbed the mini ISO, and run it with the cli boot parameter. Why the mini iso? To make a long story short, I wasted 4 CD’s burning corrupted copies of the alternate install CD. What I wanted was a bare bones CLI system but every time I started installation some file was corrupted. I guess this will teach me to check the md5 checksums before burning next time. Either way, the minimal install ISO seemed like a good solution - weighing in at 8MB wouldn’t get corrupted during transfer.

Installation was uneventful, but tad long since a lot of packages needed to be downloaded. I ended up with a lean CLI system. Since I initially did not want to install X on it, the first thing I did was to update my tty resolution This is done by editing the grub menu like this:

sudo vim /boot/grub/menu.lst

You will see something like this:

title      Ubuntu, kernel 2.6.15-20-386
root      (hd0,4)
kernel    /boot/vmlinuz-2.6.15-20-386 root=/dev/hda5 ro
initrd    /boot/initrd.img-2.6.15-20-386
savedefault
boot

The Compaq can only handle 800×600 with 24 bit color at most, so I add the following to the kernel line:

vga=789

The like should look like this once you are done with it:

kernel    /boot/vmlinuz-2.6.15-20-386 root=/dev/hda5 ro vga=789

Now how does the 789 relates to my resolution? Good question! You can find other magical values you can add to that line listed on the Ubuntu FrameBuffer wiki.

Next ting was setting up the wifi connection which was not that difficult. I ended up with a fully functional CLI system. I could browse the web with w3m, use Midnight Commander as my file system browser and etc. Btw, this takes me way back:

Compaq Presario 1240 Running Hardy

I sat there staring at this screen reminiscing all the good times I had working with Norton Commander back in the day. Oh man! These were the good days. I vividly remember excitement involved in unpacking a pirated copy of Wolfenstein 3D and Alone in the Dark and running it from the Norton interface. Ah, these were the days. I was young, naive and was just discovering wonders of technology. Unfortunately, I seem to be the only person with fond memories of that time. When my brother saw the screen, he made a face and exclaimed: “man, I used to hate that thing”. But how can you hate the commander? I mean, it’s a fucking commander! It commands respect! Here is a better shot of the app itself running in 800×600 mode on the tty:

Midnight Commander on Hardy

My cousin had a similar reaction. She pretty much said “You know, it’s 2008 - you can use Windows Explorer now”. cry No, thank you - I will stick with linux and my ultra light applications that hardly take up any memory and/or CPU power to run.

But I wanted a little bit more flexibility. Swapping between TTY’s all the time is not always the optimal solution. Sometimes I would for example want to split my screen into 2 or 4 panels with different content. Screen does that, but it does not do vertical splits out of the box. You can get that functionality by applying a patch and recompiling, but I decided to get something a tad more complex. So I turned to DVTM which is labeled as a tiling window manager for the CLI. It’s not in the repositories so you have to compile it yourself:

aptitude install make build-essential libncurses5-dev
wget http://www.brain-dump.org/projects/dvtm/dvtm-0.4.1.tar.gz
tar -xzf dvtm-0.4.1.tar.gz
cd dvtm-0.4.1/
make
sudo make install

The result is pretty neat. You can see me running a split panel session with htom (upper left), aptitude doing updates (upper right), and w3m (bottom):

DVTM Running in a TTY

DVTM has two major disadvantages. First is that you loose all the neat framebuffer features - for example like the images being displayed in w3m. No drawing or image viewing utilities will work in it - just like they don’t work in screen. Seconly, DVTM is not very configurable. There is no dot file (like .dvtmrc or something) that you could use to customize settings, set default layout and etc. The author suggests changing the configuration in one of the .h files, and then recompiling the whole thing every time you want to change something. ( Not really what I want to do.

Finally I broke down, and decided that that running mimimal x configuration with Ratpoison is not much more taxing on the hardware. I still intended to use mostly CLI apps (since that’s really what Ratpoison is all about) but the possibility of actually being able to run some gui apps (such as Dillo or Kazekahese for example) was a nice touch. Installing ratpoison was easy:

aptitude install x-window-system-core ratpoison
aptitude install xserver-xorg-video-vesa xserver-xorg-input-mouse

I got a lot of scrolling text on my barebones install (over 30 MB of x related packages) but installation was swift and simple. But it was not perfect. If you follow these instructions you will notice that the display is bit “gritty” and pixelated under this setup. This bothered me a bit. Running lshw told me that this system actually has NeoMagic NM2160 MagicGraph 128XD card installed on board. Quick aptitude search told me that there is a package which caters to this brand of graphic devices. To get full use out of your card you will need to do:

aptitude install xserver-xorg-video-neomagic

After that, the image was crystal clear and sharp as ever.

Now my rig starts in cli mode, but and I can continue like that. If I need X for some reason I can start it manually, and it actually takes about 2 seconds to start up. Ratpoison is rather nifty - and not much different from dvtm, only it uses X and is completely configurable. Here is a screenshot of me running htom (upper right), Midnight Commander (upper left) and opera (bottom):

Ratpoison!

Here is something that I did not expect or anticipate: Opera actually outperforms Kazehekaese on this machine. It’s bizzare but true. I guess the geko engine was choking due to limited memory or something.

I might try another windowing manager like awesome at some point in the future because of the floating window feature. Ratpoison only knows how to tile windows which is fine but not really practical in the long run. As you can see on the screenshot above, the 3 way split is already kinda cluttered. Add 2-3 more panels, and you won’t be able to see anything on any of them. With mere 800×600 resolution, the screen estate on that thing is priceless.

Anyway, for those interested my .ratpoisonrc looks like this:

bind c exec rxvt -fn "Lucida Console-8"
bind b exec links2 -g
wrap off
escape Pause
 
exec xsetroot -solid black -cursor_name left_ptr
exec xli -onroot -fullscreen /home/luke/eva.jpg

Note that I remapped the escape key from Ctrl+T to Pause mainly because of the keyboard layout. On the laptop keyboard the Ctrl+T becomes a two hand salute due to the weird positioning of the keys. Pause on the other hand is strangely withing the reach of my right hand. Go figure.

One thing that did not work well under Ratpoison was Midnight Commander. Something about rxvt and mc not agreeing on the locale settings. It was easily resolved by adding the following line to my .basrc:

LANG=C

I’m also bound a key for links2 since it is really the faster, and more responsive browser on this machine. If needed I can always launch opera, but for quick lookups links2 is more than enough.

So there you have it - it’s a minimalistic system, which runs mainly CLI apps. It does have X but it does not need to be running. And when it does it uses ultra light window manager that is also stripped down for simplicity and performance. What do you think?