Mostly Linux & Python syntax notes and hyperlinks.

Thursday, October 28, 2010

Linux: In vi, to show line numbers do :set nu

:set nu
Turn off with
:set nonu
or
 :set nonumber
Other vi links so far:

Monday, October 25, 2010

Python: Convert Python List to SQL "IN" List

    py_list=[123,2343,433,454]

    #convert the python list into a string to be used in SQL "IN" query
    sql_list=""
    quote = '\''
    for item in py_list:
        sql_list+= quote + item + quote

    query_string="SELECT ITEM FROM MY_TABLE WHERE MY_ID IN " + sql_list
    ...
Thank you, Janak.

Friday, October 22, 2010

Python IDE: PyScripter

Allen is using Eclipse.  Janak is using Stani's Python Editor.  I tried downloading Stani's some months back, but it never ran.  Janak says it needs configuring.

So I read A Beginner's Guide to IDE's, consulted http://wiki.python.org/moin/PythonEditors, and decided to go with the lightweight and "fast" single-language IDE PyScripter.

It downloaded and installed just fine.  I like that you can choose which version of Python to open it up with from the Open Program/PyScripter menu.  We're currently using 2.6, so I can look at our code in the IDE with 2.6 interpreting it.

Linux: uname -a tells you what version of Linux you're running

$ uname -a
Linux rhel54-64 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

There are other options to get selected info. You can do a "man uname" to see them.