Posts

Something I just know about MBP.

Aha, I bought MBP since April, But I don't know much about key pad sign on manual. Now something warn me that control key -> ^ option -> something not same as command key "force quit" menu -> option + command + esc Thank, This knowledge from Mac people of Internet.

Issue about django latest()

If u need to use latest() function when get something from db. First use need to aware of latest( field_name ) of model._meta = 'field_name' in your model to make it clear what your latest out from your db.

Django combine 2 Queryset

Do you know that we can combine 2 Querysets by >> q1 = q1 | q2 # get another queryset so you can use .order_by() or something behind note: don't know about side effect.

Change default python on debian ubuntu

Ubuntu automatically installs python 2.5 and uses it as the default python … I have crashed my system 2 times to solve this .. I wanted to make the default python to version 2.4. This is the way before begaining Thanks to (Luiz Rocha (lsdr) ) http://ubuntuforums.org/showthread.php?t=440358 and http://www.gossamer-threads.com/lists/python/python/685071 First, edit the /usr/share/python/debian_defaults, changing the default version arg to python2.4 2nd, $ sudo mv /usr/bin/python /usr/bin/python25 $ sudo ln -s /usr/bin/python2.4 /usr/bin/python reference( http://tareqalam.wordpress.com/2008/11/28/change-the-default-python-version-in-ubuntu/ )

Cools script

Never seen short code to get some page (python) >>print __import__('urllib').urlopen('http://google.com').read() ----> damn cools (other may have , but i just like this :)) note import re str_var = re.sub(r'\s',' ', str_var) # may be its make u a easy life

Using re and elementtree

import re import xml.etree.ElementTree as ET def extract(stream): r = re.compile('\}(?P \w+)') tree = ET.fromsrting(stream) dfeed = {} dfeed[r.search(tree.tag).group(1)] = None # feed l0_node = dict() for node in tree: # l0 l1_children = node.getchildren() l1_node = dict() if l1_children: # l1 for l1_child in l1_children: l2_children = l1_child.getchildren() l2_node = dict() if l2_children: # l2 for l2_child in l2_children: l3_children = l2_child.getchildren() l3_node = dict() if l3_children: #l3 for l3_child in l3_children: l3_node[r.search(l3_child.tag).group(1)] = l3_child.text l2_node[r.search(l2_child.tag).group(1)] = l3_node else: l2_node...

How to create firefox instance more than one instance

for linux >> firefox -ProfileManager to create new profile when you start using >> firefox -no-remote -P yourprofilename