Electricmonk

Ferry Boender

Programmer, DevOpper, Open Source enthusiast.

Blog

Vim and PHP: tips

Friday, August 31st, 2007

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

Friday, August 31st, 2007

Hey, look! Something to run Vista on.

Did you know? Starwars

Thursday, August 30th, 2007

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

Thursday, August 30th, 2007

[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!

Thursday, August 30th, 2007

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

Thursday, August 30th, 2007

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.

Wednesday, August 29th, 2007

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

Wednesday, August 29th, 2007

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

Wednesday, August 29th, 2007

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

Vista problems

Thursday, August 23rd, 2007

The battle is on! Microsoft Windows Vista sucks, and here’s the propaganda to prove it:

The text of all posts on this blog, unless specificly mentioned otherwise, are licensed under this license.