|
|
December 18, 2009
Topics: code snipplets, computers, experiments, software development, tutorials
As everyone already knows, Google Chrome now supports websockets. In essence, this allows you to keep a connection open with a webserver indefinitely (analogous to typical sockets) and send data bi-directionally. Unfortunately Chrome is the only browser currently supporting this, but I’m pretty sure this will change.
So I decided to (…) [continue reading]
November 12, 2009
Topics: code snipplets, computers, software development, tips
So, yeah, I resumed playing around with android, this time version 2.0.
I’m really tempted to buy the new Motorola Milestone that should come out in Europe sometime between… now… and early next year, so I wanna be ready to create all the crazy stuff I have in mind for it (…) [continue reading]
October 21, 2009
Topics: code snipplets, computers, software development, tips
At least a couple of options, the first using BeautifulSoup:
import urllib
import BeautifulSoup
soup = BeautifulSoup.BeautifulSoup(urllib.urlopen("https://www.google.com"))
print soup.title.string
And the second one using lxml:
import lxml.html
t = lxml.html.parse(url)
print t.find(".//title").text
September 30, 2009
Topics: code snipplets, computers, software development, tips
I recently ran into the following problem: I needed to be able to display a list of users in a table that had a maximum of X columns. Since I could not find the solution on the Internet I decided to give it a try and here is my resulting (…) [continue reading]
September 16, 2009
Topics: code snipplets, software development, tips
Straight from the PythonInfo Wiki:
>>> import operator
>>> L = [('c', 2), ('d', 1), ('a', 4), ('b', 3)]
>>> map(operator.itemgetter(0), L)
['c', 'd', 'a', 'b']
>>> map(operator.itemgetter(1), L)
[2, 1, 4, 3]
>>> sorted(L, key=operator.itemgetter(1))
[('d', 1), ('c', 2), ('b', 3), ('a', 4)]
|
|
Popular