python

I need help with messaging and queuing middleware systems for extjs

Hi there, I developed a system that consists of software and hardware interaction. Basically its a transaction system where the transaction details are encrypted on a PCI device then returned back to my web based system where it is stored in a DB then displayed using javascript/extjs in the browser. How I do this now is the following: ...

Python Reportlab RML. How to split table row on 2 pages.

I'm wondering if there is some functionality to split table row on 2 and more pages. Cause some information in row can be too long for one page. And if one row longer then page size then it's cause an exception. ...

basic http authentication with django-piston

Hi, I'm a newb to this. I've seen the code snippet at the official site (pasted below). The problem is how do I deploy this to the server ? Where do I set the username and password credentials ? In the httpd.conf file for Apache ? from django.conf.urls.defaults import * from piston.resource import Resource from piston.authentication ...

Where I can find getLevel()?

In the code below is using 'getLevel()'. where I can find it (it is about sound, and it run with pyaudio library) # this is the threshold that determines whether or not sound is detected THRESHOLD = 0 #open your audio stream # wait until the sound data breaks some level threshold while True: data = stream.read(chunk) # che...

Parallel programming using python's multiprocessing and process defunc

Hi there, I have a problem with creating parallel program using multiprocessing. AFAIK when I start a new process using this module (multiprocessing) I should do "os.wait()" or "childProcess.join()" to get its' exit status. But placing above functions in my program can occur in stopping main process if something happens to child process...

File upload with django

What is wrong with the following code for file uploading.The request.FILES['file'] looks empty Models: from django.db import models from django import forms class UploadFileForm(forms.Form): title = forms.CharField(max_length=50) file = forms.FileField(label="Your file") Views: def index(request): if request.m...

How can I learn more about Python’s internals?

I have been programming using Python for slightly more than half an year now and I am more interested in Python internals rather than using Python to develop applications. Currently I am working on porting a few libraries from Python2 to Python3. However, I have a rather abstract view on how to make port stuff over from Python2 to Python...

sort a dictionary according to their values in python

Possible Duplicate: Sort by key of dictionary inside a dictionary in Python I have a dictionary: d={'abc.py':{'map':'someMap','distance':11}, 'x.jpg':{'map':'aMap','distance':2},....} Now what I need is: I need to sort d according to their distances? I tried sorted(d.items(),key=itemgetter(1,2), but it's not working. H...

Is it possible to scan for Wi-Fi using Python?

Hi ! I am interested in writing a script in Python that is able to scan and show a list of nearby Wi-Fi networks. How could one do this? If possible. Thanks. Jake. ...

Getting (a) title (b) summary and (c) relevant images of web page, a la Facebook status updates

Did you ever submit a link in your Facebook status? When you do, they do something very nice: They get a title, summary, and bunch of relevant images from that page, and you can choose one of them as thumbnail. I need something like that right now. Is there any open-source piece of code that does this? (It needs to be in Python because ...

adding 2 1/2 hours to a time object in python

Hello all, I need to be able to convert time on an time object I recieve from a sql database into python. Here is the current python code I am using without any conversions. I need to add 2 and 1/2 hours to the time. def getLastReport(self, sql): self.connectDB() cursor.execute(sql) lastReport = cursor.fetchall() dat...

How do I make a nasty C++ program scriptable with Python and/or Lua?

I'm confronted with the task of making a C++ app scriptable by users. The app has been in development for several years with no one wasting a thought on this before. It contains all sorts of niceties like multithreading, template wizardry and multiple inheritance. As the scripting language, Python is preferred, but Lua might be accepted ...

Delete an item from a list

Hey, I was trying to delete an item form a list (without using set): list1 = [] for i in range(2,101): for j in range(2,101): list1.append(i ** j) list1.sort() for k in range(1,len(list1) - 1): if (list1[k] == list1[k - 1]): list1.remove(list1[k]) print "length = " + str(len(list1)) The set function works fine,...

Python - How can I open a file and specify the offset in bytes?

I'm writing a program that will parse an Apache log file periodically to log it's visitors, bandwidth usage, etc.. The problem is, I don't want to open the log and parse data I've already parsed. For example: line1 line2 line3 If I parse that file, I'll save all the lines then save that offset. That way, when I parse it again, I get:...

Python Compilation/Interpretation Process

Hey all, I'm trying to understand the python compiler/interpreter process more clearly. Unfortunately, I have not taken a class in interpreters nor have I read much about them. Basically, what I understand right now is that Python code from .py files is first compiled into python bytecode (which i assume are the .pyc files i see occasio...

Language Modelling toolkit

Hi, I would like to build a language model for a text corpus. Are there good out-of-the-box toolkits which will alleviate my task? The only toolkit I know off is the Statistical Language Modelling(SLM) Toolkit by CMU. Regards, ...

Learning PyQt Quickly

Hi all. For a college project, I need to implement a GUI for a console app I wrote. For this I decided to use PyQt. I need only basic functionalities, such as designing a simple form with basic elements and displaying some texts on it. Can anyone point me to a nice tutorial for learning PyQt? I really don't want to get into the details...

SQLAlchemy truncating Column=(Integer)

Hi guys, weird issue here: I have a reflected SQL alchemy class that looks like this: class Install(Base): __tablename__ = 'install' id = Column(Integer, primary_key=True) ip_address = Column(Integer) I convert the string representation ("1.2.3.4") to int using: struct.unpack('!L', socket.inet_aton(ip_address))[0] This...

Project Idea in Python or C#

Hi So far I was familiar with c and c++ only, and I have programmed in these languages only. I have some experience working on some projects in c or c++. Some good projects or applications I've made till now: Duplicate file finder and remover Process monitor on Linux Basic http proxy server I have made one small flex application ...

How can I get dict from sqlite query?

db = sqlite.connect("test.sqlite") res = db.execute("select * from table") With iteration I get lists coresponding to the rows. for row in res: print row I can get name of the columns col_name_list = [tuple[0] for tuple in res.description] But is there some function or setting to get distionaries instead of list? {'col1': 'v...