Tuesday, October 19, 2010

Fun with Python

This is really pretty useless... but a great example of something awesome you can do with Python:

def factorial(n):
n = abs(int(n))
n = 1 if not n else n
return reduce(lambda x,y: x*y, xrange(1, n+1))


It's a waste of time when the math module already contains math.factorial, but it just shows off some of the more esoteric features of Python.

Tuesday, August 17, 2010

Django

Django is a Python-based, Open-source web framework. And it's amazing. I'm currently going through the tutorial, which is fairly well written. There's nothing terribly amazing about the tutorial - it's not super entertaining, but it does present everything you need to get started working with Django, which is an amazing tool. To be fair I haven't worked with anything else like Zope or Twisted, so I don't know if they're any easier/more powerful.

However, Django seems to be real solid, and I'm liking it a lot. Plus did I mention it's free?

Wednesday, August 4, 2010

"Saying Goodbye"...

I died a little today when I learned that the Alliance disinterest has defeated the BrowncoatsGoogle Wave.

This makes me super sad, and I wish I could say I'm surprised, but I'm not. Here's why:

1) Awesome hype with too-long beta and too-few invites.
2) Little reason to switch.

First off, I love Google Wave. I was so stoked when they first released it, especially when I finally got my invite. Unfortunately I didn't get any invites initially. This was a problem because I couldn't share my excitement with any friends or family other than to say "This is so cool! ... but I don't have anyone I can use it with..." So that sucked. And when I did get my invites it was only about three of them. Sure, eventually they rolled out tons of invites, but it took a while to get everyone set up.

The biggest problem, however, is that there was really little reason to switch to wave. With GMail, it was compatible with your friends on Linux, Windows - whether they used Hotmail, Yahoo, Eudora, or Pine. But if you wanted to use Google Wave it meant anyone that you wanted to use Wave with had to switch. They had to switch from their email or their IM, and that was the killer. If my email works "okay", and my IM works perfectly well, why should I switch to Wave? For me, because it was awesome, but your average user isn't going to want to switch when everything else works well enough. If they wanted to have better adoption, they should have built-in the ability to send emails and/or IMs. And if they put a link at the end of the email, like "Try Google Wave", then it would have been great advertisement.

Unfortunately there was no such thing, and thus ends Wave, and that's sad.

RIP Google Wave.

Saturday, July 10, 2010

Bad Design

This is just bad design. There are two types of buttons - the "normal" kind, and then the two rows on either side of the keypad. Those are also buttons, though you wouldn't know it at first.

It's just terrible.

Saturday, June 26, 2010

ThinkPad X61 Tablet and Ubuntu Lucid Lynx | Karol Krizka

Since the Ubuntu Lucid Lynx was released, I've been fairly nervous about upgrading my laptop. It seems that with every update I've had to go through a long, arduous process of finding and reinstalling everything I once had. Especially getting the tablet to work correctly. However, thanks to this post by Karol Krizka, who has an identical laptop to mine, I didn't have to worry too much. He updated his system and tested that everything works out OK. He has even created an autorotate script for our x61 tablets that works wonderfully. I've discovered what seems to be a bug - the auto rotate only rotates into inverted and left modes, whoops! But you can click the manual buttons and that works fine, disabling the automatic rotation.

Wednesday, June 16, 2010

A Tablet...

We have already got a tablet and we need no more tablet!

So I've been running Ubuntu 9.04 on my laptop since pretty much the beginning. When 9.10 Karmic Koala was released I almost upgraded, but then I realized I was very near to the end of a semester and what a dumb idea that would be. Especially since I use my laptop for nigh on everything.

But recently I stumbled (or re-stumbled, as the case may be) upon a blog that has some great posts about the x61. It would seem he's got pretty much the same laptop as I have - I'm mainly led to believe this by the fact that he has no touch screen either.

Using this post, I finally got the HDAPS working, back when I was running Ubuntu 9.04.

But now that I'm in between semesters (starting up this Thursday), I upgraded to 9.10 (mainly because Krizka posted about his experience being fairly straightforward). Of course it messed with all my custom tweaks with the tablet rotation, so I had to fix that. Using Krizka's autorotate project I pretty much had no trouble. After getting my hdaps module working again, the autorotate worked perfectly - something I had never been able to accomplish previously. The only problem is that with my previous script when the tablet display was folded down I liked the screen to be inverted - I found that was the best for my use in school. So looking through some of the documentation and inspiration that Krizka posted/provided, and using some of the tools I came up with this result:

I created a python script called "rotate" (you could name it .py if you wanted, but I didn't) and inserted the following:

#!/usr/bin/python

import sys
import dbus
import pynotify
from traceback import print_exc

from libautorotate import *

D = DIRECTIONS = {'normal':1, 'left':2, 'right':8, 'inverted':4}

def main():

rotate = AutoRotate()
current = rotate.GetRotation()

if len(sys.argv) > 1:
try:
next = DIRECTIONS[sys.argv[1]]
except KeyError:
print sys.argv[1], 'is not a valid direction!'
sys.exit(1)
else:
rotate.SetRotation(next)

else:
rotate.SetNextRotation()


main()


Then:

sudo cp rotate /usr/local/bin/
sudo chmod 555 /usr/local/bin/rotate


After that, I created a file:


sudo vi /etc/acpi/events/swivel-down


into which I put the following (taken from here)


# Called when the tablet screen swivels down
event=ibm/hotkey HKEY 00000080 00005009
action=/usr/local/bin/rotate inverted


And now I have the best of both worlds. When I flip my screen down, it auto rotates to the orientation I like best (and I also have the ability to launch some extra programs if I need (though I think I may have to re-modify the wacomcpl script to automatically launch the config dialog... whoops, forgot to save that customization!)

So, this is really a big "Thank you!" to Karol Krizka

Wednesday, June 2, 2010

Chrome Trick

Are you such a Google fanboy/girl that you have more than one Google account? If you want to use both of these accounts in Google chrome you will have noticed that it doesn't work, even when opening a new window.

Instead of opening a new window, an incognito window. You'll share cookies etc. between your normal windows, and you'll share between your incognito windows, but you won't share information between normal an incognito.