Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    • Archives

    • Recent comments

    Archive for September, 2007

    Snap elections-2007 in Ukraine: Lytvyn block buying votes for 100 UAH (20 USD)

    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 »

    Share

    Posted in Society | 1 Comment »

    Useful Python looping techniques

    26th September 2007

    These are all excerpts from the Python documentation.

    To synchronously and simultaneously loop over two sequences:

    1. questions = ['name', 'quest', 'favourite colour']
    2. answers = ['Lancelot', 'the holy grail', 'blue']
    3.  
    4. for q, a in zip(questions, answers):
    5.     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 »

    Share

    Posted in Programming, Python | No Comments »

    How to sort Python dict (dictionary)

    26th September 2007

    Sample script (copypasted from Well House Consultants training course):
    click the PLAIN TEXT header for copy-pasteable version

    1. #!/usr/local/bin/python
    2.  
    3. author = {"php":"Rasmus Lerdorf",\
    4.     "perl":"Larry Wall",\
    5.     "tcl":"John Ousterhout",\
    6.     "awk":"Brian Kernighan",\
    7.     "java":"James Gosling",\
    8.     "parrot":"Simon Cozens",\
    9.     "python":"Guido van Rossum"}
    10.  
    11. langs = author.keys()
    12. langs.sort()
    13.  
    14. for language in langs:
    15.     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 »

    Share

    Posted in Programming, Python | 1 Comment »

    Google gadget ads launched

    19th September 2007

    Google launched gadget ads.

    Share

    Posted in Affiliate programs, Links, Misc | No Comments »

    PHP proxy

    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.

    Share

    Posted in Links, Notepad, PHP, Programming | No Comments »

    Using Cytoscape from behind an HTTP proxy which requires authentication (authorization)

    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 »

    Share

    Posted in Bioinformatics, Notepad, Science, Software | 1 Comment »

    MySQL – Python: good MySQLdb tutorial (examples)

    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 »

    Share

    Posted in Links, Notepad, Programming, Python | No Comments »