Ubuntu 11.10: Broadcom Wifi driver 43xx
Posted by Jakh Daven | Filed under ubuntu, broadcom, 4313, 43xx, bcmwl
So, the latest ubuntu is out with the latest linux kernel and broadcom brcmsmac drivers.
As it happens the brcmsmac drivers suck. You can see the list of active wifi networks but won't be able to connect to them.
If the output of:
lspci -k | grep brcmsmac
includes:
Kernel driver in use: brcmsmac
Then you have this problem too.
To solve this, you'll need to install broadcom-sta driver and blacklist the default kernel one.
sudo apt-get install bcmwl-kernel-source
Then open /etc/modprobe.d/blacklist-bcm43.conf and add this line:
blacklist brcmsmac
Restart and check that:
lspci -k | grep wl
includes:
Kernel driver in use: wl
That should fix your wifi.
Hope ubuntu devs fix this and push out updates soon.
Bye!
Monte Carlo Pi
Posted by Jakh Daven | Filed under gnome, math, geek
Here's an interesting thing I found while checking out gdm.
Usage:
gdmflexiserver [OPTION...] - New GDM login
Help Options:
-h, --help Show help options
Application Options:
-c, --command=COMMAND Only the VERSION command is supported
-n, --xnest Ignored — retained for compatibility
-l, --no-lock Ignored — retained for compatibility
-d, --debug Debugging output
-a, --authenticate Ignored — retained for compatibility
-s, --startnew Ignored — retained for compatibility
--monte-carlo-pi
--version Version of this application
Gnome users can try this out:
gdmflexiserver --monte-carlo-pi
Here's the relevant code.
This algorithm is based on the Monte Carlo method:
If a circle of radius R is inscribed inside a square with side length 2R, then the area of the circle will be pi*R^2 and the area of the square will be (2R)^2. So the ratio of the area of the circle to the area of the square will be pi/4.
This means that, if you pick N points at random inside the square, approximately N*pi/4 of those points should fall inside the circle.
Seems like someone got bored at work :)
A prime checker....
Posted by Jakh Daven | Filed under python, coffeescript
.... in Python, CoffeeScript (and therefore JavaScript)This is a polyglot program which checks if a given number is prime or not.
Here's how the code appears to python. CoffeeScript functions are written in valid python which manipulate and execute the string 'code'.
2 ###
3 #Everything in between these three hashes is executed only in python
4
5 # make console.log print stuff
6 from __future__ import print_function
7
8 class console:
9 log = print
10
11 # make require().eval() exec code in python
12 class require:
13
14 def __init__(self, x):
15 pass
16
17 def eval(self, *args, **kwargs):
18 self.code = "\n".join(args[0].splitlines()[3:])
19 exec(self.code)
20 ###
21
22 # this code will be eval'd in coffeescript, and last 2 lines are
23 # exec'ed in python
24 # range and all are implemented in coffeescript
25 code = """
26 range = (x,y) -> [x..y-1]
27 all = (x) -> x.reduce((x, y) -> x and y)
28 is_prime = all(42%i != 0 for i in range(2, 42))
29 console.log(is_prime)
30 """
31
32 require('./coffee-script').eval(code, { 'fileName': '__stdin' })
And here's how CoffeeScript reads the code ...
Kupfer, now with empathy plugin
Posted by Jakh Daven | Filed under shamelessplug, empathy, kupfer
Kupfer is an awesome little program much like quiicksilver for mac. Plus, its in python.
So, it was missing a plugin for empathy and I set out to write one. Also relevant
Long story short, it's up and working.
More screenshots:
Get it:
Put
http://github.com/tuxcanfly/kupfer/blob/master/kupfer/plugin/empathy.py
in
~/.local/share/kupfer/plugins/
That is all.
Update on comics
Posted by Jakh Daven | Filed under comics, gtk
Now with Dilbert and XKCD!
pygtk-comics
Posted by Jakh Daven | Filed under gtk, comics
Gotta love KDE plasma widgets but I can haz something for gnome too?
http://github.com/tuxcanfly/pygtk-comics
Update: ffmpethumbnailer 2.0.3 with gnome fix released.
Posted by Jakh Daven | Filed under ffmpegthumbnailer
Just an update if you are still wondering whether to make the switch. The latest version should fix thumbnailing in nautilus.
I'll try and setup a ppa this weekend, so you can apt-get install it :)
http://code.google.com/p/ffmpegthumbnailer/
Fixing ffmpegthumbnailer for gnome
Posted by Jakh Daven | Filed under ffmpegthumbnailer, gnome
In my last post, I have analyzed the performance of ffmpethumbnailer and totem video thumbnailer. ffmpethumbnailer was a clear winner, beating totem's performance by 15 times.
But since nautilus passes file path as URI to the thumbnailers, ffmpegthumbnailer fails when a file path contains spaces or other special characters like' &, % 'etc. As a quick hack, I had updated my post with a wrapper that replaces '%20' in the URI with backslash escaped space written by Jillian Zey. It's not the perfect way, and it does fail when the file names have other special characters.
So, I have written a patch for ffmpegthumbnailer which detects gnome-vfs and uses it to get the file path back from the URI. You can fetch ffmpegthumbnailer source, apply the patch and check it out for yourself.
Fetch dependencies first
sudo apt-get build-dep ffmpegthumbnailer
Update: For gnome-vfs dependencies, see comments below.
Fetch source
svn checkout -r 214 http://ffmpegthumbnailer.googlecode.com/svn/trunk/ ffmpegthumbnailer-read-only
Apply the patch
patch -p0 -i gnome-vfs.patch
Build
./autogen.sh ./configure --prefix=/usr make sudo make install
If you have used the wrapper fix in my previous post, make sure you remove it.
rm -rf ~/.gconf/desktop/gnome/thumbnailers ...
ffmpegthumbnailer vs totem-video-thumbnailer
Posted by Jakh Daven | Filed under ffmpegthumbnailer, video, benchmarks, totem
Benchmarking the above thumbnailers
I recorded the time taken to thumbnail a set of 26 videos of nearly 200 mb each.Tested on Ubuntu Lucid with Totem 2.30.1 and ffmpegthumbnailer 2.0.0
Uname output:
Linux atlantis 2.6.32-22-generic #33-Ubuntu SMP Wed Apr 28 13:28:05 UTC 2010 x86_64 GNU/Linux
The following code was used:
ffmpegthumbnailer:
time (IFS=$(echo -en "\n\b"); for file in `ls`; do /usr/bin/time -o $file.ffmpeg.txt ffmpegthumbnailer -f -i $file -o $file.ffmpeg.png; done;)
totem-video-thumbnailer:
time (IFS=$(echo -en "\n\b"); for file in `ls`; do /usr/bin/time -o $file.totem.txt totem-video-thumbnailer $file $file.totem.png; done;)
The following is the list of videos used:
182160 The Suite Life of Zack and Cody - 1x01 - Hotel Hangout.avi 209648 The Suite Life of Zack and Cody - 1x02 - The Fairest of Them All.avi 184552 The Suite Life of Zack and Cody - 1x03 - Maddie Checks in.avi 187544 The Suite Life of Zack and Cody - 1x04 - Hotel Inspector.avi 215064 The Suite Life of Zack and Cody - 1x05 - Grounded on the 23rd Floor.avi 186704 The Suite Life of Zack and Cody - 1x06 - The Prince & The ...
How an old ubuntu cd saved my weekend
Posted by Jakh Daven | Filed under elive, weekend, ubuntu
Impressed by this scene video I wanted to try elive, the distro behind it, by making a live usb. To my disappointment, it was not updated since a long time.It still included grub1 config files and grub2 is not backwards compatible, which means I would either had to get grub1 or update the config files to grub2. Due to my laziness and lack of grub2 documentation (why did they have to complicate the config files so much?), I had almost given it up.
Then I remembered, I had a copy of an older version of ubuntu around, so I quickly popped it in and installed grub1 from the live cd. Problem solved!
I realized that BIt Rot is very real. Older