tidbits recently of use to me:
Mostly Linux & Python syntax notes and hyperlinks.
Wednesday, May 25, 2011
Friday, April 15, 2011
Rohit Bhardwaj's talk on Android programming last night at NE-JUG
Listing other dl.dropbox URL's for a zip of samples source code.
His twitter:
http://twitter.com/#!/rbhardwaj1
My notes:
My notes:
- Each App has its own 'Linux User' so it can't poach security info.
- All the data locked in for that user.
- There are ways to share data between apps.
- APK
- instead of EXE
- can be stored in SD-card
- testing: need to test with at least 50 devices
- use ADBridge
- autogenerated R.java has all References.
- OnCreate(Bundle savedInstance)
- Honeycomb/Android 3 like iPad, multitasking
- Android marketplace $25 to sell your apps.
Tuesday, March 1, 2011
Python: appending column to end of tab-separated csv
Given this input file:
$ cat list.csv a b c d e f g h iUsing this code:
import os,csv
def test_fcn() :
try:
tabReader = csv.reader( open("list.csv", "rb"), delimiter='\t', quoting=csv.QUOTE_NONE )
fd = open("out.csv", "wb+")
tabWriter = csv.writer(fd, delimiter='\t', quoting=csv.QUOTE_NONE)
if tabReader != None :
for record in tabReader:
record.append("new_thing")
tabWriter.writerow(record)
fd.close()
return
except Exception,e :
print "Exception : " + str(e)
def main():
test_fcn()
if __name__ == '__main__':
import sys
main(*sys.argv[1:])
Here's the output:$ cat out.csv a b c new_thing d e f new_thing g h i new_thing
Friday, January 28, 2011
Linux: Using whereis to find ifconfig
If something isn't in default path you still may be able to find it with whereis:
$ ifconfig
bash: ifconfig: command not found
$ whereis ifconfig
ifconfig: /sbin/ifconfig /usr/share/man/man8/ifconfig.8.gz
$ /sbin/ifconfig
eth2 Link encap:Ethernet HWaddr ...
Tuesday, January 4, 2011
Linux: to grep for dash, use grep --
For example, to search for python code containing the string "-D":
grep -- -D *.pyFrom http://stackoverflow.com/questions/2427913/grepping-for-string-containing-dash
Wednesday, December 1, 2010
Thursday, October 28, 2010
Linux: In vi, to show line numbers do :set nu
:set nuTurn off with
:set nonuor
:set nonumberOther vi links so far:
- vi text wrap
- see tab and newline characters
- split screen (This doesn't always work.)
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.
Subscribe to:
Posts (Atom)