Showing posts from February, 2011

Ipod home screen...

downloaded from Ifans

Dictionary of Methods/Functions (Python)

Construct a dictionary with String (or other) keys and unbound methods or functions as values. During execution, use the string keys to select which method or function to execute. Can be used for simple parsing of tokens from a file thru a kind of object-oriented case statement.

import string def function1(): print "called function 1" def function2(): print "called function 2" def function3(): print "called function 3" tokenDict = {"cat":function1, "dog":function2, "bear":function3} # simulate, say, lines read from a file lines = ["cat","bear","cat","dog"] for line in lines: # lookup the function to call for each line functionToCall = tokenDict[line] # and call it functionToCall()
It's embarrasingly simple really, but I use it a whole lot. Instead of functions, methods might also be used (self.method1), remember to follow the binding rules if you use methods dir…

How to Install NVIDIA drivers manually on Lucid Lynx Ubuntu 10.04

Download Newest Nvidia drivers from their websiteOpen module blacklist as admin Code: sudo gedit /etc/modprobe.d/blacklist.conf Add these lines and save:Code: blacklist vga16fb blacklist nouveau blacklist rivafb blacklist nvidiafb blacklist rivatv Uninstall any previously installed Nvidia drivers:Code: sudo apt-get --purge remove nvidia-* Reboot your computerWhen an error message pops up saying that Ubuntu cannot load Nvidia drivers, choose Exit to terminal (Exit to console)Login and cd to the directory where you saved your file Install drivers Code: sudo sh Start GDM Code: sudo service gdm start Enjoy Enjoy :)

Whats my Ipod Touch mac address?

Settings -> General -> About And then scroll down Wi-Fi Address.

How to disable lock screen in Ubuntu?

System -> Preferences -> Screensaver (for ubuntu 10.04)

SCP (Secure Copy)

Copying file to host: scp SourceFileuser@host:directory/TargetFileCopying file from host: scp user@host:/directory/SourceFileTargetFilescp user@host:/directory/SourceFileTargetFolderNote that if the remote host uses a port other than the default of 22, you can specify it in the command. For example, copying a file from host: scp -P 2222 user@host:directory/SourceFileTargetFile