How To : Adding SVN Info To Your Prompt

Ever since I switched to Linux years and years ago (and since then, to OS X), I’ve been carrying around a .profile script to configure my shell environment. The other day, I was browsing Ars Technica when I found a poster who had a very nice script in his prompt to add GIT info to his PS1 variable. Since I mostly use Subversion, I knew I had to adapt it but someone already did all the work! Let’s recap. My prompt usually looks like this:

user@computer ~/Documents/LCMM/Site/lcmm/trunk

That’s pretty good, but what if you could have SVN info when in a local repository. Here’s what I’ve got now:

user@computer ~/Documents/LCMM/Site/lcmm/trunk
SVN => [trunk:92]$

This gives me not only the local path, but also the current SVN path and the revision of the current directory. Of course, once you’re got that you can imagine other improvements that could be done here. To do that, here’s what I did. First, I downloaded this script on GitHub and placed it in /usr/local/bin (put it anywhere you want, it doesn’t matter).

Next, edit your bash init script (.profile for example) and add:

source /usr/local/bin/
export PS1="\u@\h \w \`__svn_ps1\`\$ "

That’s it. Pretty neat trick that could be adapted to anything else really. It works because the function returns either SVN info or nothing at all if this is not a local SVN repository.

Why We Need To Kill Flash

Anytime there’s a discussion these days about the iPhone and its competitors, Flash is usually mentioned early on in the discussion along with Multitasking. Today I want to address Flash because it’s something I strongly believe we need to kill. The topic came to me last week when the news came out that Adobe was blocking the adoption of HTML5. We still don’t have all the details there, but it did remind me of my hatred for Flash in general.

Flash is a weird product. On the one hand, it did things very well. When Macromedia (now Adobe) introduced it in 1996, they managed to make it so ubiquitous that it now has 98%+ install base. That’s quite the achievement.

On the other hand, Flash is terrible and that’s something most people agree with except perhaps for Flash designers. It’s being used today mainly¬†for 3 things : video streaming/playback, entire or parts of web sites and banner ads.

It’s too bad Web standards are so slow to be adopted because for video streaming, there’s already a much better solution than Flash. Youtube, UStream and many others are (slowly)¬†moving to it as more and more browsers are supporting it. Of course, as always, Internet Explorer will be the one slowing us down for this. For Web sites, the “new” technologies like the latest revisions of Javascript and DOM scripting can absolutely compete with Flash.

There are 3 major problems with Flash. Let’s review:

First, the flash player is very poorly implemented on OS X and Linux. Performance is terrible and it sucks battery life out of your laptop in record time since it pegs the CPU to 100% in seconds. That makes it inappropriate for things like cellphones in my opinion. If you visit a site with banner ads and a few flash movies, does this means you will lose 20-30% of your battery life in minutes?

As a second issue, I would point out that the flash authoring app is way too pricy. In a world where everything gets pirated, it may not seem like a big deal, but Flash, unlike Visual Studio from Microsoft and XCode from Apple has no free versions for people at home to play with. Coupled with Adobe’s usual upgrade routine every 18 months, it make Flash to be extremely expensive.

The third problem is that Flash is controlled by one company. That company decides if the Mac OS X version will be performing well. That company alone decides when a new version is released.

Add to these 3 problems the fact that many Flash websites are terribly designed and would be hard to see on a smaller screen and that these sites are usually badly (if at all) indexed in search engines and you start to understand why Apple is refusing to include it on the iPhone.

Because of all this, I’m actually happy Apple is doing this. It has forced some sites to reconsider the use of Flash and I hope it’s a trend that will continue.

Hopefully more companies will be bullish like Apple and take a stand.

Adding Hardware to Your Software

It’s fascinating to look at the multitude similarities and differences between Apple and Microsoft or even Google. One of the key differentiator is that Apple never releases only a software, they always pair it up with an hardware release whereas Microsoft rarely does. The reason is obvious, Microsoft chooses to work with 3rd party to create an “open” ecosystem whereas Apple does it all alone.

While there’s no denying Microsoft’s successes in the past (and even present) with the PC, embedded and portable devices are another world completely. Take a look at the iPod Touch, the iPhone or the iPad. Microsoft had a tablet PC all the way back in 2001 but the thing never caught on. It was an OK piece of software (Windows & Office, neither quite well adapted) tied to a series of OK devices by 3rd parties. Where Apple succeeds is by not only creating a great piece of software (the iPhone OS) but by also coupling it with a great piece of hardware of its own. What you get is the optimal use of that hardware and an attention to detail you don’t get when you have several 3rd parties working together to create a device.

A lot of people online clamor for a more open device from Apple or for Apple to license Mac OS X to PC manufacturers. To ask for that is to not understand what makes Apple products so compelling. You need that tight relationship with your hardware for the software to make any sense and vice-versa. An open-specced iPhone means multiple devices, some with a big screen, some with a small screen. Some with keyboards, some without. What you get, is the Android situation. A great OS tied to a potentially great App store crippled by the fact that 3rd parties are creating the phones and as such, there are tens of different configurations already and the App store is fragmented beyond belief because no small developer can support every phone. Let’s face it, none of us have 10 phones to test on.

This is why Google released the Nexus One. This is why Apple is dominating the App store business. And this is why the iPad will succeed to some extent. On day one, there will be more than 150 000 apps available for it. On day one, developers will make money on it. That’s unfortunately not the case with the myriads of other tablets that will be hitting the market in 2010.

Speaking of the iPad. I’ll have a full post on it early this week.