Chrome vs Safari: my opinion

On my computer (MacbookPro), I have two browsers: one for web development and the other for the rest of my web activities. Firefox is definitely the best for my coding tasks, mainly because of its flexibility, its rank on the most used web browsers (please don’t ask me why I don’t want to use Internet Explorer) and numbers of insanely efficient extensions. Nevertheless, Firefox is, in my opinion, far to slow for my daily use. So the problem is: which browser for the rest? I wasn’t sure which one to use, especially between Safari and Google Chrome. But I finally decided: Chrome. Here is why.

Software

Chrome 5.0.307.5 dev
Safari 4.0.4 (6531.21.10)

Benchmarks and tests

I ran a few tests as a matter of form.

Google benchmark
Safari: Score: 1575
Chrome: Score: 4123

Sunspider
Safari: 547.0ms +/- 10.7%
Chrome: 444.2ms +/- 7.6%

Acid 3
Safari: 100/100
Chrome: 100/100

Security check
Safari: 3 tests passed.
Chrome: 3 tests passed.

Conclusion: Chrome looks a bit faster than Safari.

Extensions

There are two features I need to have in my browser.

  1. Ad blocking, done with AdBlock on Firefox.
    Chrome: AdBlock
    Safari: AdBlock too but forces me to use Safari in 32bits mode. #fail

  2. Display the download progress in the dock
    Safari: built-in
    Chrome: need a revision superior to 38304 (not even in dev channel yet) #fail

Bookmarks

I use bookmarks.google.com to manage my bookmarks.

Safari: No way.
Chrome: No smart way. (strange)

#doublefail

RSS

I rarely read news feeds in my browser, yet I need an RSS feature in my browser to easily add the given feed to Netvibes (for example).

Safari: Built-in is really nice.
Chrome: Needs an extension. One is provided by Google and it does the thing really well.

Extensions

Potentially, extensions represents the chances the program may have to fulfil my eventual features wishes.

Safari: few
Chrome: dozen

Write extensions

As I love to tweak the softwares I use, writing extensions for them must be easy.

Safari: ObjC, not really well documented. #fail
Chrome: JSON+Javascript. Well documented with videos.

Web development

Both has the same Developper toolkit, but Chrome’s default view source is smarter (color/lines/links).

Posted in None at February 7th, 2010. Comments.

Songbird: Music player for OSX

I hope you like The Beatles! ;)

That’s it, I’m finally tired of iTunes. On my MacBookPro, it takes close to 3 minutes to cold start, and I see the spinning ball each time I click on its window. Such a pain! I needed to find a solution, quickly (well, I’m of those guys who don’t know how to live without music). I gently  asked Google, then I discovered… Songbird!

Songbird Logo

It’s amazing, it really blew me away! First of all, it starts in less than 5 seconds! Incredible. Here is what it looked like, at my first start (right after it finished importing my 70GB iTunes library without an effort):

First start

No lag, everything is smooth. Let’s dig a bit more. In the menu bar, I found that:

Songbird strange window

What the… ? Well, a Firefox-like console in a music player? I thought it was an easter-egg. I closed it then I opened the preferences window, and I found…

This window looks familiar

A Firefox-like extension window! Wow, it looked like Songbird and Firefox are cut from the same cloth. But it’s not the end! I then discovered the built-in… browser!

It allows me to browse Songbird's extension list

And watch my beautiful weblog

And finally grab its characteristics

So, I have a Firefox/Gecko with a music player on top. It really came out of left field. What else? Remember, I left iTunes only because of its bad performances. Hopefully, Songbird has a lot of iTunes’ features:

Songbird iTunes like sidebar

Songbird coverflow-like (plugin needed)

Furthermore, I really prefer its miniplayer over iTunes’:

Songbird miniplayer

As you may have noticed, Songbird is, because of its Firefox foundation, highly customizable. So if you, like my, prefer a lighter skin, then just download it through the built-in browser! Here is the Gonzo 2.0 theme I chose:

Songbird Gonzo 2.0

So for me, slow and not customizable music players are all water under the bridge.

Posted in None at February 4th, 2010. Comments.

Writing articles with LaTeX

I had to write a quite short article for school a few weeks ago. I’m used to write my homework with Apple’s Pages, with always the same template I’ve built once. But this time, I wanted to change the look of my document, yet there is a bug I can’t manage to solve with Pages: I have a paragraph, it has a background color, inner margins, and I want borders on its top and its bottom. I don’t know why, but borders stop before the inner margin.

Borders are nasty with me

I’ve eared about an amazing, powerful, word processor called LaTeX. Well, OK why not. I decided to give it a try. After several cups of coffee hours I had finally wrote my document with my own custom style document class.

In my opinion, LaTeX is nice, nevertheless it has a major drawback: it is old. Oh, I like writing text with non-WYSIWYG programs, I don’t really like icons, and the less my macbook does the best it runs. But LaTeX, because of its age needs a serious cleaning. There are dozen of packages (some kind of pluggable pieces of code for your document) which does nearly the same things, but not exactly. So you need 2 or 3 of them to reach your goal. More over, I think something like CSS is far more efficient (okay, it has some drawbacks (e.g. IE) that LaTeX doesn’t but…).

If you are curious and want to see what I’ve done, here are my files:

LaTeX source file PDF render The picture which is used in the document My custom document class

Oh, and I’m still looking for a work around for my Pages problem!

Posted in None at February 4th, 2010. Comments.

Simple mail server report

Here is a small script I wrote a few minutes ago. It gather some informations from the local machine and send them by email to the administrator (me). I plays nice with a @weekly rule in Cron.

It is easily customizable without further explanation. However, I think some enhancements should be added (multiple recipients, generic information addition etc.)

#!/bin/bash

Configuration

SUBJECT="Server repport of date +%m.%d.%y" EMAIL="root@domain.tld" MSG="/tmp/weekreport" touch $MSG

Uptime

echo "Uptime" >> $MSG echo "uptime" >> $MSG echo "" >> $MSG

Disk usage

echo "Disk usage" >> $MSG echo "==========" >> $MSG echo "" >> $MSG echo "df -h" >> $MSG echo "" >> $MSG

Lighty status

echo "Lighttpd" >> $MSG echo "========" >> $MSG echo "/usr/local/etc/rc.d/lighttpd status" >> $MSG echo "" >> $MSG

/usr/bin/mail -s "$SUBJECT" "$EMAIL" < $MSG rm $MSG

Posted in None at January 21st, 2010. Comments.

About Apple’s Magic Mouse

In short: wow!

I recognize my not really inventive attitude, but I think there is no better summarize about my feelings.

The Apple Magic Mouse

Look

Well, just by itself, the mouse is really beautiful. I admit it would not be worse with a soft white light coming from the Apple logo, or from the sides of the mouse, but I think it looks really nice on my black desk. Furthermore its bright tactile surface reflects as a mirror does which makes the mouse “pop”.

Feel

My dear old PC mouse

My dear old PC mouse

My Apple computer is a Macbook Pro (of de 5th family I think. It looks like theses ones and costs me 1200 €), so it has a built-in mutltitouch trackpad which works very well. However, I missed my dear old PC mouse. You know, there is something really different between a trackpad and a mouse : the depth. The Magic mouse is really nice from this point of view: it allies the power of the multitouch technology and, with its subtle curves, the presence of a classic computer mouse.

First approach

There is nothing easier than connecting this mouse with your OS X based computer. Just power on the mouse (with a little brushed button like the power on/off on iPod Nano). If Bluetooth is enabled on your computer, a window should pop up, print you some messages, and disappear. That’s it. The mouse is running on your Mac. It’s a bit strange at first, but I got used to its smooth surface blazingly fast.

Get ready to ride

Since the mouse is available to sale, you can read everywhere that you must use MagicPrefs. That’s why I downloaded it to custom my mouse gestures. This tool is really nice (I don’t understand why Apple doesn’t provide such a software with Snow Leopard). But it has one major drawback: it doesn’t support tab (⇥) composed keyboard shortcuts. I wanted to use them for my Firefox (with ⌃⇧⇥ and ⌃⇥ to switch between opened tabs). After digging, let’s say, 2″40 seconds with Google, I found BetterTouchTool, a software similar to MagicPrefs but which is far more flexible (and it works for touchpads too). So I dropped MagicPrefs and installed BTT. Well, I can say I’ve never felt so relaxed with a computer (except when I switch from PHP to Python, but…).

[BetterTouchTool screenshot]

BetterTouchTool

Conclusion

To put it in a nutshell, I highly recommend you this mouse. Unless you are a narrow-minded conservative fundamentalist of keyboard as the only real interface with a computer, the Magic Mouse is really pleasant and easy to use. A nice purchase in my humble opinion.

Posted in None at January 21st, 2010. Comments.

Quicksort C++ implementation

Hello. I just had to implement a quicksort algorithm version in C++ for an exercise. Here is what I’ve done:

The code on friendpaste.com

#include <iostream>

include <vector>

using namespace std;

void swap(int &a, int &b) { int temp; a = b; b = temp; }

int split_array(vector<int>& array, int pivot, int start_index, int end_index) { int left_boundary = start_index; int right_boundary = end_index;

while (left_boundary < right_boundary) { while (pivot < array[right_boundary] && right_boundary > left_boundary) { right_boundary--; }

swap(array[left_boundary], array[right_boundary]);

while (pivot >= array[left_boundary] && left_boundary < right_boundary) { left_boundary++; }

swap(array[right_boundary], array[left_boundary]); }

return left_boundary; }

void quicksort(vector<int>& array, int start_index, int end_index) { int pivot = array[start_index]; int split_point;

if (end_index > start_index) { split_point = split_array(array, pivot, start_index, end_index); array[split_point] = pivot; quicksort(array, start_index, split_point-1); quicksort(array, split_point+1, end_index); } }

Posted in None at January 19th, 2010. Comments.

Time Machine, FreeBSD and AFP are on a little boat

Okay, I just had set up a backup system from a MacBookPro (let’s say, the client) to a FreeBSD-powered server (quite boringly, the server). I chose Time Machine because of it’s nice and polished interface and its deep integration with OSX. After a lot of (too much?) tries and spent time, I chose the AFP for the protocol between the two machines. I decided to write this post because there are plenty of outdated posts on the web concerning this setup, and I didn’t manage to hit my goal with them. So my post relates a way which works for me.

On the FreeBSD server

AFP service

The AFP protocol is provided by NetATalk, a free AFP implementation. Let’s install it with the ports tree:

cd /usr/ports/net/netatalk/ && make install clean

Add it to your configuration: add the following to /etc/rc.conf:

netatalk_enable="YES"
afpd_enable="YES"

Define an obscure setting in /usr/local/etc/afpd.conf:

"Time Machine" -uamlist uams_dhx2.so

Add your Time Machine share into /usr/local/etc/AppleVolumes.default (edit to make it fits your needs):

/storage/timemachine/    "Time Machine" allow:thomas

Finally start the service:

/usr/local/etc/rc.d/netatalk start

Howl (optional)

Howl is a free implementation of the Apple’s Bonjour protocol. It’s used to spread hostnames and shares on your network. You don’t really need it, but I think it’s smarter to use it.

Install by the ports tree:

cd /usr/ports/net/howl/ && make install clean

Add to the configuration (/etc/rc.conf):

mdnsresponder_enable="YES"
mdnsresponder_flags="-f /usr/local/etc/mDNSResponder.conf"

Create the configuration file /usr/local/etc/mDNSResponder.conf and fill it:

"Home Time Machine Server"     _afpovertcp._tcp     local.     548

Start the service:

/usr/local/etc/rc.d/mdnsresponder start

Needed steps on the client

Unsupported Network Volumes

By default, Time Machine only allows you to use an AirPort-based system if you want to backup your data throught your network. So we need to ask it politely to enable the support for every network drive. Grab your terminal and type:

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

The sparsebundle image

(source of this part: http://jakub.fedyczak.net/post/28)

Since filesystem provided by FreeBSD is not quite compatible with Time Machine, you have to create your own file system image. Use Disk Utility to create image:

  • Save As: MachineNameMacAddress MachineName as read from “System Preferences / Sharing / Computer Name field”. MacAddress has to be ethernet address of en0 – as displayed in ifconfig en0 result in ehternet line – without colons. For example: jf010203040506. Always use ethernet interface. Wireless interface won’t work.
  • Name: Time Machine
  • Size: Custom – greater than your HD size (in fact, it’s the amount of disk space you want to allow to your backups)
  • Format: I use Mac OS Extended (Journaled) but I’m not sure which one is the best.
  • Partitions: Single partition – Apple partition map
  • Image format: sparse bundle disk image

Resulting file should have .sparsebundle extension. Copy it to your remote FreeBSD drive and you’re done.

Posted in None at January 11th, 2010. Comments.

Test your django-piston API (with auth)

I have to build the API for one of my web service. It’s Django and django-piston powered application and it works well. Okay. I chose the TDD technique. So my problem was: how do I test the API parts which need authentication (basic HTTP, not OAuth for now)? The built-in test client of Django doesn’t seem to have such a feature.

So, here is my small workaround: you have to generate the HTTP_AUTHORIZATION field of your HTTP request. I wrote a small base test class for tests which need authentication:

import base64
import unittest
from django.test.client import Client

class BaseAuthenticatedClient(unittest.TestCase): def setUp(self): self.client = Client() auth = '%s:%s' % ('username', 'password') auth = 'Basic %s' % base64.encodestring(auth) auth = auth.strip() self.extra = { 'HTTP_AUTHORIZATION': auth, }

You just have to replace username and password, and write your own test suite:

class TestAPIAuth(BaseAuthenticatedClient):

def testrootauth(self):
    response = self.client.get('/api/aresource/id', {}, **self.extra)
    self.assertEqual(response.status_code, 200)

It must be OK. Have fun!

Posted in None at December 17th, 2009. Comments.

Sync Google Contacts and AddressBook.app

You may be aware of some limitations you may encounter to sync your Google Contacts with your built-in Mac OS X address book, especially if you don’t have an iPhone/iPod Touch. Here is the most suitable solution I found to get round of this annoying problem.

  1. First of all, you must let your system think you have an iPod. Just open the file ~/Library/Prefereces/com.apple.iPod.pllist, and change de FamilyID to 1001, then save it. Property List Editor

  2. Open your AdressBook.app, go to Preferences, then click Account button, pick the “Sync with Google” checkbox and click the “Configure” button on the right of the latest. AdressBook preferences You will be prompted for you Google credentials.

  3. One last thing. Your contacts are not sync automatically when you edit some of them or when you quit AdressBook.app. You have to set up a small script which will be executed hourly (Note: this part uses the notion of cron). Create the file ~/Library/crontab, and write the following line inside:

    @hourly /System/Library/PrivateFrameworks/GoogleContactSync.framework/Versions/A/Resources/gconsync —sync com.google.ContactSync

Then open your Terminal.app and invoke: crontab ~/Library/crontab.

You should be ok, and your contacts will sync every hour. Have fun.

Posted in None at December 7th, 2009. Comments.

Mint for fresher statistics

mint

Four days ago I finally bought Mint, for pelletier.im. I used to use Wordpress’ plug-in for my weblog and Google Analytics for all my other projects. I decided to get rid of Wordpress’ plug-in because of its lack of flexibility and its heavy use of Flash. I didn’t want to come back Analytics because its far too slow: it’s really annoying! Lots of people advised me to use Mint. Well, I was really reluctant to spend $30 for a web-based software bound to a specific domain name. But I have got a brainwave and picked up my calculator and realised that $30 equals €20. Mint became more affordable just like that!

Mint is now running on thomas.pelletier.im! Great. Here is what I like and what I don’t really love with it:

Strength

  • Really easy to install. Just set up your database (with your fancy shell script which uses mysql-client — or if you are less geeky just visit your Phpmyadmin page), copy Mint onto your server and magic happens.
  • Flexible : Mint comes with few peppers (modules), but you just have to go to the Peppermill, download, copy and install some of them and your Mint gets empowered by more magic powers!
  • Realtime : refresh your page (or use a pepper which will do such a nasty task for you) and see your statistics: you don’t have to wait 1 hour or anything else.
  • Shaun Inman is very nice and you will never feel alone on Mint’s forum.
  • You have the source : if something in Mint bothers you, just load your favourite text editor and go beat some PHP lines of code.

Drawbacks

  • Peppers aren’t archived in the Peppermill: I’m looking for FreshView, but as you can see the original website is off and I don’t manage to grab the pepper.
  • You can’t display statistics for a chosen sub-domain.
  • You can’t tweak the way anonymous users see your Mint page: they can see it, or they can’t.

To put it in a nutshell, Mint is really awesome and I don’t regret buying it but I think I’ll need to hack a bit to get rid of this sub-domain limit.

logo-mint Minted too.

Posted in English at November 10th, 2009. Comments.