Log <-

Archive for August, 2007

Vim and PHP: tips

I've been using Vim for years now, but there's still new stuff to learn. Check out this page for the PDF version of the slides of a talk given by Andrei Zmievski on editing PHP with Vim. His configuration files are also available.

Here's my favourite list of tips:

Add the following text to your ~/.vim/ftplugin/php.vim file:

set formatoptions+=tcqlro
let php_sql_query=1
let php_htmlInStrings=1
let php_folding = 1

This will:

  • Turn on automatic text formatting for PHP so that, for instance, Vim automatically inserts a '*' if you press enter inside a /* */ comment.
  • Makes Vim highlight SQL queries in strings.
  • Makes VIm highlight HTML in strings.
  • Allows folding on PHP classes and functions. (With the cursor on the first line of a function, press z-c to hide the function. z-o to show it again. (Close and Open the fold)

Budget supercomputer

Hey, look! Something to run Vista on.

Did you know? Starwars

Did you know Starwars was actually meant as some kind of Flash Gordon movie? Check out the story.

More cool myth debunking on: The Straight Dope.

PS: I hate the StarWars movies. Just so you know.

Server uptime geekery

[todsah@zoltar]~$ uptime
 22:15:45 up 518 days, 10:02,  3 users,  load average: 0.35, 0.10, 0.03

518 days, 10 hours and 2 minutes without rebooting. Pretty good. Of course, this is mostly because of the operating system: Debian GNU/Linux.

No more mosquitos!

For the last year and a half, I've been terrorized by mosquitos. At night they even had to queue up and draw a number before they got a chance to drain my blood. I've tried everything to get rid of them, all to no avail. I kept the windows closed, burnt essence, air-tightly closed off my room when I was sure there where no mosquitos in it, bought expensive electrical anti-bug devices and more. Nothing worked. On 'good' nights, I've killed more than twelve pesky buzzers in two hours.

But now I've found the ultimate solution, and I can't believe I didn't think of this before. I'm now sleeping in this:

dsc_1890.JPG

No, this is not a joke.

Signs You're a Crappy Programmer

Really old blog entry: Signs You're a Crappy Programmer (and don't know it).

Check out the comments. They're pretty funny. Especially this one:

Alright, so I'm a student at the Milwaukee School of Engineering and currently studying Software Engineering. This is a very prestigious school (4th in the nation), and they courses dedicated to Design Patterns. Can they be all that bad? From what we've had drilled into our heads, design patterns should be used whenever possible. Remember the whole "low coupling, high cohesion" design tip? Using patterns allows for just that. We recently completed a lab that combines multiple, eight to be exact, design patterns.

Another thing I'd like to mention is that most earlier generation programmers have learned to code a certain way and refuse to change it. More companies are adopting the Personal and Team software processes (PSP and TSP) that are saving them millions of dollars a year on development. Part of those processes are doing preliminary and detailed design of your program, which includes making detailed UML diagrams.

Well, whatever…us n00bs are going to take over your jobs someday, or at least we'll end up teaching all your old folks the right way to program. IMO, your list sucks. Oh, and Java is going to take over — slowly but surely. Peace.

It's either sarcasm, or this guy's gonna have a hard time in the Real World. ;-)

Anyway, there's only one sign I'd like to add to his list: You're a crappy coder if you've ever said "Never do Foo.".

Ubuntu Linux… for your mom.

"This will be the year of Linux on the desktop!". This has been the topic of tech-predicting articles on the web since at least 2001. It's been repeated (and proved wrong) so many times, it's even become an Internet meme. But ladies and gentlemen, rejoice. For the year of Linux on the desktop has arrived! I have witnessed it with my own eyes. How do I know? Because my 60-year old mom is using Ubuntu on her new laptop!

The new machine

Let me tell you how this came about. My mom, who is 60 years old, used to run Microsoft Windows 2000. It was the only Windows version fast enough for her old 300Mhz machine. I sometimes thought about blowing new life into her machine by installing some version of GNU/Linux, but I was afraid it would be too incomprehensible for her. So I always kept her with Windows.

Now, about three weeks ago, my mom decided she wanted a new computer. She found a nice Packard Bell budget laptop for sale at the local electronics store, so she asked me if it was okay. I told her, "sure, looks like a nice machine". A 1.8 Ghz with 1 Gb of memory ought to be more than enough for her computing-habits: surf the internet, watch a couple of movies online, write a letter, chat on MSN, manage her photos, print a document, write an e-mail.

Windows Vista

The new laptop came pre-installed with Windows Vista, the latest 'hot' operating system from Microsoft. "Great", I thought, as Windows 2000 was becoming a bit of a nuisance. I once thought about installing Windows XP on my mom's old machine, but was afraid it might be too slow. Now she could have the latest Windows version with a clean install on her brand new laptop.

Unfortunately, it turned out that Vista wasn't such a good deal as we thought it was. Even though we're talking about a brand new 'Vista-ready' laptop, the horrors of The First Boot where mind-shattering. Mom's brand new, out-of-the-box laptop was slower than her old 300 Mhz machine! The cause? Windows Vista! Sure, it's a budget laptop, and it's not the fastest machine around, and I wouldn't be surprised if it didn't make a great gaming platform, but it sure should be enough to run a simple Operating System!

Another big problem was Vista's new 'security'. My mom is a paranoid lady. If she doesn't trust something, she'll back off. And when she doesn't understand something, she won't trust it. You'll never find my mom entering her address, personal or bank information anywhere on the Internet, for instance. This is probably the reason why she never gets spam, nor has she ever been conned. The problem with Windows Vista is that it alerts the user about everything and then makes them choose. A clever way to delegate the burden of responsibility of security to the user instead of the Operating System. After about half an hour of working with Vista, we must have seen at least fourteen security related pop-ups. I personally couldn't make heads nor tails of the 'possible security problems', let alone my mom. It's common knowledge that when you let the user choose each and every time anything happens, they'll quickly adopt the Don't-read-just-click-okay mindset. Hell, I'm a paranoid security freak and even I started to just click okay without reading any of the warnings.

I tried tweaking and configuring Vista so that it would run faster. I tried turning off the annoying security and placing restrictions on the default account the default user uses. I tried and tried and tried, but all that happened was a botched up Vista that was either still incredibly slow, annoying or wouldn't boot anymore. Enough was enough. Time to pop the big question: "Mom… what about Linux?".

Ubuntu installation

My mom agreed to me putting Ubuntu on her laptop. If it wasn't satisfactory, I'd get some illegal version of Windows XP from somewhere and install that instead. "Can I write email/chat on MSN/manage my digital photographs?". Sure! Everything my mom wanted to do on her computer was easy with Ubuntu, so no worries there.

I started my very first Ubuntu installation (I'm a Debian user) and started clicking 'Next'. Everything in the install worked pretty easy, with some notable exceptions:

  • The 'Next' button on the next screen didn't work when I left the mouse cursor on it. I had to move the mouse of the button, then back on it, and then I could click it.
  • I couldn't partition and format the harddrive. It kept complaining with some kind of error during the creation of the ext3 filesystem. Turns out I had to reboot the machine after creating the partitions, but that wasn't mentioned anywhere.
  • When I brought the machine over to my mom's house, there was a particularly nasty problem where the machine would hang during or right after booting. It turned out there was a bad WiFi network around my mom's house somewhere which caused the machine to halt with a 'SOFT BUG ON CPU#0' bug. Removing all the propriety closed source drivers fixed the problem.

After installation, I tested all her hardware: the digital camera, the wireless mouse, etc. Everything worked like a charm. Watching video on the internet? No problem. Listening to internet radio stations? A breeze! Making sure her own software is up-to-date with the latest bug and security fixes? Easy as pushing a button.

The verdict

My mom's verdict: "This is just like Windows, except faster?! I thought I had to do stuff with a lot of white-on-black text, like I always see you do?! This is much easier than I thought, and I can even watch internet movies!". Don't worry mom. I wouldn't have put Ubuntu on your desktop if you'd had to learn how to use the terminal.

She's been working on it for a few days now. Of course, there's some stuff she still needs to learn, simply because the programs are different then what she's used too, but she's coming along just great. My mom already used Thunderbird and Firefox for her emailing and browsing. She's picking up the other new programs fairly quickly.

Would she have been able to do the installation herself? Well, probably yes, if it wasn't for the problems mentioned above. That's more than I can say for Windows, cause she's never been able to install that herself.

So there you have it! Linux on the desktop. 2007 was the year. Kudos to all who predicted it.

Grindhouse: Deathproof

Deathproof, the new Tarantino movie.

A murderous stuntman and a bunch of women. A long conversation and one car chase.

The verdict: Awesome. Go see it before it's out of the theatre.

Joel Spolsky on Vista

I've been using Vista on my home laptop since it shipped, and can say with some conviction that nobody should be using it as their primary operating system — it simply has no redeeming merits to overcome the compatibility headaches it causes. Whenever anyone asks, my advice is to stay with Windows XP (and to purchase new systems with XP preinstalled).
Joel Spolsky, Even the Office 2007 box has a learning curve

The world v.s. the U.S.

In a nutshell, because living abroad I know first hand what the world thinks of America and it is not a pretty picture at the moment. I want people to think of America as the land of freedom and democracy, not the land of arrogance and blind revenge. I want to be proud of America again. The U.S. media do a spectacularly bad job of informing Americans about what is going on in rest of the world. After Sept. 11, the U.S. could do no wrong. The entire world was on America's side. The invasion of Afghanistan was seen as completely justified. After all, the Al-Qaida leadership had to be decapitated. No one questioned that.

But Iraq was a completely different matter. Bush, Cheney, and Powell said they had conclusive proof that Saddam had WMD and could attack at any instant. The rest of the world wanted to see the proof. No proof was forthcoming. The answer was "trust us." We now know there were no WMD. There weren't even factories or labs to produce them. Saddam was an evil dictator with evil fantasies but he was no threat to America. Yet former Treasury Secretary Paul O'Neill said that the planning to invade Iraq began the day Bush was inaugurated. The administration simply misused the horror of Sept. 11 as a convenient excuse for doing something that was already in the works.

Let me tell you a short story. When I was in elementary school, the school was plagued by a bully. He was the biggest, strongest kid around and would beat up anyone he didn't like. We were all exceedingly polite to his face, but hated his guts behind his back. One day he was chasing some poor kid and he tripped and skidded a considerable distance, scraping his face on the rough asphalt of the playground. He was bleeding and in pain, screaming for help. But nobody came to help him. We all just walked away. George Bush is the world's playground bully. The world sees him–and by inference, America–as arrogant, self-centered, and mean. I spoke to Americans from dozens of countries at the DA caucus. Everyone told the same story–the world hates America. When talking to foreigners, I can tell them about the Bill of Rights or freedom or World War II, or whatever I want, but all they see is this big, stupid, arrogant, playground bully and a stolen election in Florida last time. I think America deserves better. I want America to be respected in the world again, and John Kerry can restore the respect America deserves.

Don't believe me that the world hates us? The Guardian, one of Britain's most respected newspapers, ran a column by Charlie Brooker last week ending with this paragaph: "On November 2, the entire civilised world will be praying, praying Bush loses. And Sod's law dictates he'll probably win, thereby disproving the existence of God once and for all. The world will endure four more years of idiocy, arrogance and unwarranted bloodshed …" Then it gets so bad that I refuse to quote it. Maybe Brooker is a nut and maybe it was a joke, but the fact that a serious newspaper would publish this piece shows how deep the hatred of George Bush runs. And this comes from our closest ally. Imagine what people in Spain or Indonesia or the Arab world think.

– Andrew Tanenbaum, http://www.electoral-vote.com

It's true. Everyone I know hates Bush and the U.S. in extension. Further more, I'll personally never set foot in any of those fascist states until they get at least a basic level of human rights.