Going through some example code sent to me and honestly, I have no idea what language this is
def uniqify(arr):
b = {}
for i in arr:
b[i] = 1
return b.keys()
Is it Python?
I am also curious what keys() does. It's obvious it returns an array but what does it do the array that calls the function? :P
EDIT:
You ...
I need to suck data from stdin and create a object.
The incoming data is between 5 and 10 lines long.
Each line has a process number and either an IP address or a hash.
For example:
pid=123 ip=192.168.0.1 - some data
pid=123 hash=ABCDEF0123 - more data
hash=ABCDEF123 - More data
ip=192.168.0.1 - even more data
I need to put this data...
zipcode = 02132
print zipcode
result = 1114
...
I am impressed with django.Am am currenty a java developer.I want to make some cool websites for myself but i want to host it in some third pary environmet.
Now the question is can i host the django application on appengine?If yes , how??
Are there any site built using django which are already hosted on appengine?
...
Is it possible to have a DateField without they year? Or will I have to use a CharField? I am using the admin to edit the models.
...
Suppose I have one string list may have duplicated items:
A
B
C
A
A
C
D
E
F
F
I want to make a list can assign an unique index for each item, looks like:
1 A
2 B
3 C
4 D
5 E
6 F
now I created sqlite3 database with below SQL statement:
CREATE TABLE aa ( myid INTEGER PRIMARY KEY AUTOINCREMENT,
name STRI...
I have thousands of lines of 1 to 100 numbers, every line define a group of numbers and a relationship among them.
I need to get the sets of related numbers.
Little Example:
If I have this 7 lines of data
T1 T2
T3
T4
T5
T6 T1
T5 T4
T3 T4 T7
I need a not so slow algorithm to know that the sets here are:
T1 T2 T6 (because T1 is relat...
I have an Java method I want to call within my Jython servlet running on tomcat5. It looks like this:
@SuppressWarnings("unchecked")
public School loadByName(String name) {
List<School> school;
school = getHibernateTemplate().find("from " + getPersistentClass().getName() + " where name = ?", name);
return un...
I'm trying to deal with a piece of specialized hardware, that presents it's interface as a COM object, using win32com in Python.
However, the documentation for how to actually set up the hardware through the COM object is sparse (it requires a significant amount of initialization), and entirely oriented at using a bunch of pre-built lib...
Hi
I'm writing a python script that runs in the background and takes screenshots of another application that is active. Then it analyses the screenshots and now it should overlay a certain image over the active app or the screen. I still need to be able to make mouse and keyboard inputs in the active app.
So I need a way to overlay/pai...
I'm developing a web game in pure Python, and want some simple scripting available to allow for more dynamic game content. Game content can be added live by privileged users.
It would be nice if the scripting language could be Python. However, it can't run with access to the environment the game runs on since a malicious user could wrea...
i can download data from gae (http://zjm1126.appspot.com/remote_api), this is code:
appcfg.py download_data --application=zjm1126 --url=http://zjm1126.appspot.com/remote_api --filename=a.csv
and it successful :
D:\zjm_demo\app>appcfg.py download_data --application=zjm1126 --url=http://zjm1
126.appspot.com/remote_api --filename=a.cs...
Hi there,
I am writing swig bindings for some c functions. One of these functions takes a float*. I am already using cpointer.i for the normal pointers and looked into carrays.i, but I did not find a way to declare a float*. What do you recommend?
interface file:
extern int read_data(const char
*file,int *n_,int *m_,float **data_...
Hi all,
I'm using sqlalchemy's reflection tools to get a Table object. I do this because these tables are dynamic and tables/columns can change. Here's the code I'm using:
def getTableByReflection(self, tableName, metadata, engine):
return Table(tableName, metadata, autoload = True, autoload_with = engine)
The problem is that wh...
i follow this article : zipme
and i download my file successful , and i want to download another file that ex: the parent file
so i change this:
dirname=os.path.dirname
folder = dirname(__file__)
to
dirname=os.path.dirname
folder = dirname(dirname(__file__))
but the error is :
firefox can't find the file
why ?
thanks
...
i can use this code to download all data from my app on gae :
appcfg.py download_data --application=zjm1126 --url=http://zjm1126.appspot.com/remote_api --filename=a.csv
it is not use bulkloader , so can i upload all data without bulkloader ,
thanks
...
I need to display an image in a Django form. My Django form is quite simple - a single text input field. When I initialise my Django form in a view, I would like to pass the image path as a parameter, and the form when rendered in the template displays the image. Is is possible with Django forms or would i have to display the image separ...
Take the following demo code (from the GIO answer to this question), which uses a GIO FileMonitor to monitor a directory for changes:
import gio
def directory_changed(monitor, file1, file2, evt_type):
print "Changed:", file1, file2, evt_type
gfile = gio.File(".")
monitor = gfile.monitor_directory(gio.FILE_MONITOR_NONE, None)
monit...
Hi folks,
is it possible to give users the permission to view, but not to change or delete.
currently in the only permissions I see are "add", "change" and "delete"... but there is no "read/view" in there.
I really need this as some users will only be able to consult the admin panel, in order to see what has been added in.
Help wou...
I recently installed python 2.6.5 over 2.6.1 on OS X. Everything works fine except when I try executing python scripts via the Applescript editor. If I execute the following line I get version 2.6.1:
Applescript:
do shell script "python -c \"from sys import version; print version\""
But if I execute the similar line in the OS X termi...