30th September 2007
Today was the voting day in the snap parliament elections-2007 in Ukraine.
Early in the morning, I heard from my wife’s sister that some of her friends were offered 100 UAH (20 USD) for promising to vote for the Lytvyn’s political block (based on his People’s party – “Narodna partiya“, in Ukrainian only). I said “that’s ugly, and they could just take the money and vote for whomever they want, as it’s impossible to enforce them to vote exactly for Lytvyn”. But that was it as for my reaction in the morning.
Read the rest of this entry »
Posted in Society | 1 Comment »
26th September 2007
These are all excerpts from the Python documentation.
To synchronously and simultaneously loop over two sequences:
questions = ['name', 'quest', 'favourite colour']
answers = ['Lancelot', 'the holy grail', 'blue']
for q, a in zip(questions, answers):
print 'What is your %s? It is %s.' % (q, a)
To loop over a sequence with both key and value:
Read the rest of this entry »
Posted in Programming, Python | No Comments »
26th September 2007
Sample script (copypasted from Well House Consultants training course):
click the PLAIN TEXT header for copy-pasteable version
#!/usr/local/bin/python
author = {"php":"Rasmus Lerdorf",\
"perl":"Larry Wall",\
"tcl":"John Ousterhout",\
"awk":"Brian Kernighan",\
"java":"James Gosling",\
"parrot":"Simon Cozens",\
"python":"Guido van Rossum"}
langs = author.keys()
langs.sort()
for language in langs:
print language,"is the child of",author[language]
You can also define the Python ksort() function similar to that found in PHP:
Read the rest of this entry »
Posted in Programming, Python | 1 Comment »
19th September 2007
Google launched gadget ads.
Posted in Affiliate programs, Links, Misc | No Comments »
19th September 2007
PHP proxy is simple but good. I converted it into a proxy-function for one of my projects.
Do pay attention to the comments, especially these two:
I had issues with this script (and others) returning 0 for the bytesTotal in flash. Basically, the Content-Length header was absent from the response. By simply adding
header(“Content-length: “.strlen($response)) before the echo, it resolved the issue. I don’t know if there is a more appropriate fix to account for character encoding, etc, but it seems to work.
@Schimmi: Well, if you can add some checks there (like who is referring your script) and allow the access to whitelisted clients (served from your domain)… I think, you can totally make it used applications from same-domain….So it would not be open to world. Yeah above script doesn’t have those things.
Posted in Links, Notepad, PHP, Programming | No Comments »
14th September 2007
Cytoscape 2.5.1 supports proxies, including HTTP proxies, but there is no support for HTTP proxies requiring authentication/authorization. It’s easy to use Cytoscape in the authentication-requiring proxy scenario; below is one possible method.
Note, that exactly the same method can be used to allow any software, which supports proxies but not proxies with authentication, to be able to access the internet.
Read the rest of this entry »
Posted in Bioinformatics, Notepad, Science, Software | 1 Comment »
7th September 2007
Andy Dustman (used to blog at dustman.net) gave a presentation on Python and MySQL at the MySQL Users Conference 2005, Santa Clara, CA. The presentation is an excellent collection of examples for those who use the MySQLdb Python module.
Read the rest of this entry »
Posted in Links, Notepad, Programming, Python | No Comments »