Remove the black Google bar with Greasemonkey script

If you use Google Docs in Chrome’s or Firefox’s app mode, you will see instantly how disturbing the new black Google bar is. It’s very intrusive:

google black bar

You can use this script to remove the black bar. However this script works on all Google’s websites. Sometimes it’s useful to have direct links to Google Mail, Images, News or Pictures so those sites are only one click away. But when you are in app mode, you’ll want to focus to your document only. In Firefox you can change the affected sites in Greasemonkey’s settings. However because Chrome installs user’s scripts directly, you must edit the script and replace the wildcard regex with https://docs.google.*/*

The result:

google black bar

Fixing Ubuntu 11.10 Oneiric Ocelot wireless problem with Atheros AR9285 and Ralink RT3090

If your laptop has either Atheros AR9285 or Ralink RT3090 wireless adapter, then Ubuntu 11.10 shows that driver is properly loaded, wlan0 interface is up, however you can not enable wireless in NetworkManager. Wireless is turned off instantly after you click on “Enable Wireless” or after manually bringing the interface up.

The solution is to blacklist the acer-wmi module: open the file /etc/modprobe.d/blacklist.conf and add this line:

blacklist acer-wmi

Then reboot.

Note: in Archlinux the module is named acer_wmi

Microsoft’s and LinkedIn’s IPO

I’ve just read an article aout Microsoft’s IPO process. Some excerpts from the article:

… with $172.5 million in revenues over the last four quarters

and

… going public put a market value of $350 million on the 45% stake he retains.

That would make a total market cap of appr. $800 million and revenue of around $170 million.

Compare that to LNKD, which has $161.4 million revenue and $1.85 million net profit in 2010. LNKD was valued initially at $4 billion. At the time of this post its market cap is $8.8 billion.

And people say it’s not 1999 again.

Oscar 2011 winners prediction

As you may know, I enjoy good movies and despise bad ones. Needless to say, i’m psyched up with the coming Oscar. I always try to watch as many nominated movies as possible before the Oscar night to predict winners. Now it’s the time to sum it up:

Best Motion Picture of the Year
Holy cow this year they expand the nominees list for Best Picture to 10. Does that make it harder to guess ? Let’s see:

  • 127 Hours: So so, I’m unimpressed. And Slumdog Millionaire took the prize in 2009. No.
  • Black Swan: I watched Aronofsky’s The Fountain and Requiem for a Dream but frankly I didn’t understand much. The same for Black Swan. The Wrestler is outstanding though, I rooted for Mickey Rourke in 2009
  • The Fighter: Good film, however not enough for Academy Award
  • Inception: My favorite.
  • The Kids are All Right: indie films often don’t have a chance (with the exception of Crash maybe?)
  • The King’s Speech: very good, has great potential to get Oscar
  • The Social Network: although i’m a fan of David Fincher, IMO this one is overrated
  • Toy Story 3: no way
  • True Grit: haven’t seen this, but the Coen brothers have got Best Picture recently, so chance for True Grit is quite low
  • Winter’s Bone: haven’t seen this

After all, the ones with biggest chance would be (after this sequence): Black Swan, The King’s Speech and Inception. I pick Inception.

Best Performance by an Actor in a Leading Role
This one is easy: Colin Firth.

  • Javier Bardem for Biutiful
  • Jeff Bridges for True Grit
  • Jesse Eisenberg for The Social Network
  • Colin Firth for The King’s Speech
  • James Franco for 127 Hours

Best Performance by an Actress in a Leading Role
I haven’t seen 3 in this list. Will update later.

  • Annette Bening for The Kids Are All Right
  • Nicole Kidman for Rabbit Hole
  • Jennifer Lawrence for Winter’s Bone
  • Natalie Portman for Black Swan
  • Michelle Williams for Blue Valentine

Best Achievement in Directing
Aronofsky or Tom Hooper.

  • Darren Aronofsky for Black Swan
  • Ethan Coen, Joel Coen for True Grit
  • David Fincher for The Social Network
  • Tom Hooper for The King’s Speech
  • David O. Russell for The Fighter

Best supporting actor would be Geoffrey Rush or Christian Bale. Both had excellent performance. I pick Geoffrey Rush.

Best supporting actress would be Hailee Steinfeld. I really like Amy Adam in The Fighter though.

Update 1 (26 Feb): Betting market’s favorites:

The odd on The King’s Speech is 1.27 (lower odd implies that a lof of money has been waged on this film). The Social Network is second with an odd of 5.70. A distant third is, suprisingly, True Grit (46).

The odd on Leading Actor is astronomically low: if you place 1€ on Colin Firth and he wins, then you win a whopping 5 cent. The same with Natalie Portan at an odd of 1.11.

In Supporting Actor category Christian Bale is on top with 1.16, while Geoffrey Rush plays catch up at 7.60. Melissa Leo with her role as a manipulating mother in The Fighter leads the group of supporting actress nominees (1.70). My precition in this category, Hailee Steinfeld, is not far behind at an odd of 4.00.

The market really favors The Social Network when David Fincher competes with Tom Hooper for Best Director (1.7 and 2.8, respectively). I don’t expect The Social Network gets that much support.

Note: The odds in this post are approximately taken from Betfair and William Hill. They are subjected to change when gamblers change their opinion.

32bit Cisco VPN client on 64 bit linux systems

I’ve just encountered a strange problem with Cisco VPN Client:

# ll /opt/cisco-vpnclient/bin/
total 4224
---x--x--x 1 root bin 1241184 Feb 23 12:35 cisco_cert_mgr*
---s--x--x 1 root bin 2181976 Feb 23 12:35 cvpnd*
---x--x--x 1 root bin 226700 Feb 23 12:35 ipseclog*
---x--x--x 1 root bin 666260 Feb 23 12:35 vpnclient*
# /opt/cisco-vpnclient/bin/vpnclient
zsh: no such file or directory: /opt/cisco-vpnclient/bin/vpnclient

My initial response was “wtf, how is this possible? The file is there, how dare zsh states the opposite?”

I scratched my head for a while, then tried this:

# ldd /opt/cisco-vpnclient/bin/vpnclient
not a dynamic executable
# ld /opt/cisco-vpnclient/bin/vpnclient
ld: i386 architecture of input file `/opt/cisco-vpnclient/bin/vpnclient' is incompatible with i386:x86-64 output
ld: error in /opt/cisco-vpnclient/bin/vpnclient(.eh_frame); no .eh_frame_hdr table will be created.
ld: warning: cannot find entry symbol _start; defaulting to 000000000040a900

Ah, now that makes sense. Cisco has probably compiled vpnclient with gcc 32bit, so I turned the multilib repo on and installed lib32-gcc (named lib32gcc on ubuntu)

# pacman -S lib32-glibc lib32-gcc-libs
# ldd /opt/cisco-vpnclient/bin/vpnclient
linux-gate.so.1 => (0xf7793000)
libvpnapi.so => /opt/cisco-vpnclient/lib/libvpnapi.so (0xf774a000)
libm.so.6 => /usr/lib32/libm.so.6 (0xf7701000)
libc.so.6 => /usr/lib32/libc.so.6 (0xf75b6000)
/lib/ld-linux.so.2 (0xf7794000)

vpnclient works again :-)

Optimize WordPress for speed

I confess, I’m a speed freak, premature optimization type ;-)

optimize YSlow Grade A

Still not that good with Google’s PageSpeed, i’ll fix those warnings soon (most of them, however, is from external hosts)

optimize PageSpeed

The essential plugins are:

  • WP-Super-Cache: this one is trivial. Every WordPress blog should have this plugin enabled by default.
  • Use Google Libraries: replace WordPress included javascript libraries with copies hosted on Google’s servers.
  • WP-Minify: minify your files (HTML, CSS) then concatenate CSS files into one file. Javascript files served by Use Google Libraries are external and minified already.

combining with some tweaks in my WordPress theme and nginx.conf

Really, Cisco, really ?

I was reading Cisco release notes for their VPN client and spotted this gem:

VPN client fails to install on Linux kernel version is 2.6.31 and above. The workaround is to downgrade to one of the Linux distributions supported by the VPN Client.

Their supported Linux distros:

  • Red Hat 6.2 with Kernel 2.2.12 (released in 2000)
  • Red Hat 9 with Kernel 2.4.20 (released in 2003)
  • Fedora Core 8 with Kernel 2.6.23 or 2.6.24 (released in 2007)

Is it always like this with corporate/enterprise software ? In someway it explains why IE6 is still the dominant browser after all these years.

Remember to specify nginx’s temp directory path

I catched this error in my log:

2010/11/20 12:38:22 [crit] 792#0: *58342 open() “/usr/local/fastcgi_temp/2/23/0000002309″ failed (13: Permission denied) while reading upstream, client: XXX.XXX.XXX.XXX, server: xxx.host.com, request: “GET /page.php”, upstream: “http://0.0.0.0/dir/page.php”, host: “lamnk.com”, referrer: “http://referrer.com/”

fastcgi_temp should in no way belong to /usr/local. It’s clear that if you forget to set configuration flags, nginx will set the path to prefix‘s path during compilation. Run ./configure --help show:

% ./configure --help | grep -e "temp-path"
--http-client-body-temp-path=PATH set path to the http client request body
--http-proxy-temp-path=PATH set path to the http proxy temporary files
--http-fastcgi-temp-path=PATH set path to the http fastcgi temporary
--http-uwsgi-temp-path=PATH set path to the http uwsgi temporary files
--http-scgi-temp-path=PATH set path to the http scgi temporary files

On my system they go to /var/tmp/nginx according to CentOS file system structure.

Fix Nginx 411 Length Required error

If you don’t want to read my rant below: use HttpChunkinModule

In my case i used a Readbility API to parse news articles’ content. The API receives requests and POST it back to URL specified in the request.

However no matter how hard i tried, the API’s log always told me there was error. I POST’ed many requests manually to test it myself; my server received and processed all of them, but not the API’s ?

So I turned on unicorn‘s log to see what’s wrong. Well, there was absolutely no hit from any IP except from my computer. Strange, it means API’s requests must be blocked from higher (lower?) level, either nginx or iptables. Firewall is unlikely the cause since it’s normal HTTP, it must be nginx:

129.206.*.* - - [20/Nov/2010:15:37:08 -0800] "POST / HTTP/1.1" 200 106 "-" "Ruby" "-"
77.234.*.* - - [20/Nov/2010:15:37:45 -0800] "POST / HTTP/1.1" 411 174 "-" "-" "-"

Aha, here you are. But why the hell nginx returned error code 411 ? According to Sysoev, author of nginx, there may be 3 reasons for 411 error if you use POST or PUT method to send requests to nginx:

  • client sent invalid “Content-Length” header
  • client sent … method without “Content-Length” header
  • client sent “Transfer-Encoding: chunked” header

The last reason is nginx feature: it still does not support chunked body.

Oh, it’s not a bug, it’s a feature ! I couldn’t stop swearing, this “feature” takes me almost one day to find out. And Google shows a lot people who are like me.

nginx’s error log (you must turn debug on):

2010/11/20 18:19:05 [info] 16755#0: *80135 client sent "Transfer-Encoding: chunked" header while reading client request headers, client: 77.234.129.43, server: lab.lamnk.com, request: "POST / HTTP/1.1", host: "lab.lamnk.com"

Once you know causes of the problem, then it’s (supposed to be) easy to fix it: recompile nginx with HttpChunkinModule, added configuration directives in nginx.conf and we’re good !

PS: kudos to the guys at Preona for the nice API

Fix Cydia crashes

If Cydia quits during an installation process, it could refuse to run next time. Solution: remove everything in:

/var/lib/dpkg/updates/

and every files in

/var/lib/apt/lists/

except the folder called partial. Then reboot your Iphone.