Terminal in Leopard

I haven’t really seen it mentioned before, but the Leopard terminal is finally up to a Gnome’s or KDE’s terminal’s standards, and as is usual with Apple, especially with some of the window style selections, much better. It has tabs too, and there’s a preset which closely matches the way I used to customize iTerm. Great stuff.

Web.py on MacOSX

I’m loving web.py for developing tiny web apps. Here’s how to get it going on a Mac:

sudo port -v install python2.4 py-setuptools mysql5
#coz macports insists on adding a '5' suffix to all mysql5 tools.
sudo ln -s /opt/local/bin/mysql_config5 /opt/local/bin/mysql_config
sudo easy_install web.py cheetah markdown MySQL-python DBUtils

Not the twenty odd steps that’s on the web.py page (that even includes installing and configuring postgresql – bizarre!).

What I love about web.py is that this small bit of code:

import web

urls = (
'/', 'index')

class index:
    def GET(self):
        print "Hello, world!"

if __name__ == "__main__": web.run(urls, globals())

… and running python code.py in a terminal gets you a working dev environment. Even camping doesn’t feel this tiny.

Edit: the performance numbers for this simple action are also very impressive:

time httperf --client=0/1 --server=localhost --port=8080 --uri=/ --send-buffer=4096 --recv-buffer=16384 --num-conns=10000 --rate=500
httperf --client=0/1 --server=localhost --port=8080 --uri=/ --rate=500 --send-buffer=4096 --recv-buffer=16384 --num-conns=10000 --num-calls=1
Maximum connect burst length: 17

Total: connections 10000 requests 10000 replies 10000 test-duration 20.000 s

Connection rate: 500.0 conn/s (2.0 ms/conn, <=24 concurrent connections)
Connection time [ms]: min 0.1 avg 1.8 max 2987.4 median 0.5 stddev 42.2
Connection time [ms]: connect 0.7
Connection length [replies/conn]: 1.000

Request rate: 500.0 req/s (2.0 ms/req)
Request size [B]: 60.0

Reply rate [replies/s]: min 499.8 avg 500.0 max 500.0 stddev 0.1 (4 samples)
Reply time [ms]: response 1.0 transfer 0.0
Reply size [B]: header 108.0 content 14.0 footer 2.0 (total 124.0)
Reply status: 1xx=0 2xx=10000 3xx=0 4xx=0 5xx=0

CPU time [s]: user 3.75 system 9.17 (user 18.7% system 45.8% total 64.6%)
Net I/O: 88.9 KB/s (0.7*10^6 bps)

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
httperf --client=0/1 --server=localhost --port=8080 --uri=/ --send-buffer=409  3.75s user 9.17s system 64% cpu 20.028 total

That’s 10K connections and more than 500req/s in a 20 sec timeframe. Really good.

Ubuntu Gutsy

Ubuntu Logo

I tried out the new Ubuntu Gutsy today on my mom’s Compaq Presario V3000 (didn’t install, just tried out the LiveCD) and found it to be a really good revamp from the last version. Now WiFi works out of the box, the battery indicator works perfectly, and there’s a bluetooth screen for managing bluetooth devices. The new desktop effects are also pretty cool: I switched from ‘normal’ to ‘extreme’ and found em windows wobbling all over the place. The inbuilt virtual desktop is also smooth and not distracting. While the fonts look a bit too rough, I found web pages very readable in Firefox, and the color theme is also pretty easy on the eyes (although I’d prefer a more colorful default theme). I love the Ubuntu Terminal, it’s much better than the default Mac one.

I can cautiously say that Ubuntu has gotten to the point where a web programmer (a non ASP type) can easily ditch Windows for Linux and not pay the premium for a Mac. There are things the Mac still does better and places where the Mac experience feels a lot more polished, but Ubuntu is closing the gap very fast.

Tata Indicom Plug2Surf on a Mac

My mom and bro gave me a Tata Indicom Plug2Surf for my last birthday (geeky gift, I know. What can I say? They know me too well). It’s only been with me for a couple of days but I’m already addicted to the sweet device. And as usual, set up is as Mac-ish as can be… if you know the proper settings.

  1. Start by plugging in your Tata Indicom device. It’s a blocky ugly but functional device that takes up more than its share of USB ports on my Macbook. The small light should change from red to orange and then stay a pale green.

    Tata Indicom Plug2Surf pics

  2. Open System Preferences and navigate to Network. A Qualcomm CDMA Technologies MSM device should already be detected. Select that and click Configure.

  3. Fill up the settings as in the pic below. The number to dial is #777, the username and password are the same: ‘internet’ (lame!). Be sure to check Save Password to avoid nag screens.

  4. Click on the Modem tab and from the list choose the ‘au CDMA 1x WIN W01K’ modem. The default selection will not work. Navigate back to the PPP tab and click Dial Now…

  5. You’ll be presented with Internet Connect, the general dialer application for the Mac. I use this for VPN connections as well. Check ‘Show modem status in the menu bar’ and click Connect. It should take under 5 seconds and the dialog will expand to show statistics for the connection.

The tariffs are reasonable. It’s Rs. 2500/- for the device and Rs. 350/ per month (paid like a postpaid bill) for 30 hours of net access a month (overcharges are 25ps for a minute). I have a BSNL plan otherwise, so this is for mobile net. It’s not entirely as plug2surf as the advertisement shows however since on Windows devices, you’ll have to install a driver (provided in a tiny CD). On a mac, you don’t, but you don’t know how much of tariff you’ve used either.

Safari Web Inspector

Safari Web Inspector
I make my living as a web developer these days and a good “page inspector” tool is an absolute essential. For that reason, I switch to Firefox and the amazing Firebug tool when I write webdev code. I used a recent nightly of Webkit and was pleasantly surprised by its inbuilt Web Inspector. It lists the DOM, the CSS style computation, the box model and some bit of element properties. The interface is amazing, I love the HUD style effect, and it’s much less distracting when the element is shown as the parent in the hierarchy (see the top div in the image above) instead of it being placed in a pageful of tags.

What it still doesn’t do is display any kind of javascript information. The Webkit guys seem to have gone with a separate application called Drosera (which allows people to debug javascript, attach to any Webkit-ish app etc.) and it makes my browser hang badly when attached to it (and hence I couldn’t test and name a verdict).

So my personal feature request list for the Web Inspector would be:

  1. A Javascript console, watch/breakpoint functionality is not a must, but definitely must have a console.
  2. A Request/Response Inspector, especially those of XHR Requests.

If I get these two things I’ll switch to Webkit entirely. As it is, I love it’s Mac-iness, but like Firebug too much to let FF go.

(and yeah, what you see in the pic is the Web Inspector inspecting itself. Apparently, it’s written mostly in HTML and JS. Cool!)