python

Change keyboard input method to unicode?

I am going to create an application called 'khmer keyboard input method' the khmer just come in unicode standard (Range: 1780–17FF). reference http://www.unicode.org/charts/PDF/U1780.pdf this application it will allow cambodian to switch from English to Khmer by press the definded shortcut key (F10 for example). the application I will ...

How to set value of current Numbers cell using Py-Appscript

This seems like a straightforward operation but I am stumped. How do you set value of current Numbers cell using Py-Appscript? ...

unidentified com_error in python

I've encountered the following error while scripting in Python. ERROR Tue 19. Jan 14:51:21 2010 C:\Python24\Lib\site-packages\win32com\client\util.py:0: Script Error com_error: (-2147217385, 'OLE error 0x80041017', None, None) Unfortunately, I don't know what it means, or even what other information I might need to find out. Does ...

What is the maximum packet size a python socket can handle?

Hey hi guys, i am new to network programming in python. I wanted to know that what is the maximum size packet we can transmit or receive on python socket? and how to find out it? ...

Run a C++ Program from Django Framework

I need to run a C++ Program from Django Framework. In a sense, I get inputs from UI in views.py . Once I have these inputs, I need to process the input using my C++ program and use those results. Is it possible ? ...

Regular expresion for urlpattern

I need a regexp for a URL like: /slug/#slug/slug/ I know it should be something like: r'^(?P<slug1>[-\w]+)/#(?P<slug2>[-\w]+)/(?P<slug3>[-\w]+)/$' But I am having problems with the character # ...

How should you interpret the PyStone value across machines?

I have three different laptops with Python2.5 on it. If I run Pystone I get essentially the same values. Intel Pentium M @1.80GHz - 1.5GB RAM Intel T2300 @1.66GHz - 1GB RAM Intel Pentium Dual T2370 @1.73Ghz - 2GB RAM These are their respective Pystone values: 45787 pystones/second 44377 pystones/second 43861 pystones/second I don...

Opening remote documents in Python

from xml.dom.minidom import parse, parseString datasource = open('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml') dom = parse(datasource) print dom ... the above code throws an IOError: 2, 'No such file or directory'. Python doesn't read remote doc like PHP? What do I need to change in the code to make it read the XML ...

how to erase lines with wxpython

hello I'm trying to make a paint tool in wxpython. and i couldn't find a way to make an ( Eraser ) . how can i make an eraser tool - just like the one in windows paint - in wxpython ? please help . the idea or small code sample would be very helpful thanks in advance ...

how can i print 'cool!!!!' in my code.

class a(type): def __str__(self): return 'aaa' def __new__(cls, name, bases, attrs): attrs['cool']='cool!!!!' new_class = super(a,cls).__new__(cls, name, bases, attrs) #if 'media' not in attrs: #new_class.media ='media' return new_class class b(object): __me...

Variables as a part of calling a method in python

Hi, I'm pretty new to programming and I'm creating a python game for my little sister. I'm having trouble, because I want the variable value to be a part of the method name Is there any way this is possible? def play_with_toy(self): toy = gui.buttonbox( msg = 'Choose a toy for your potato head to play with:', title...

Equivalent to django Form to show object contents

Is there any Django class used to show the contents of an object model in a non-modifiable way? Something like this for forms to edit the objects from a model: class TestForm(forms.ModelForm): class Meta: model = models.Test using it as: def generic_view(request): form = TestForm() return render_to_response('gener...

Uploading files in RESTful way?

I'm designing a RESTful API that should handle binary file uploads. Should this be done the same way as html form upload or is there a better way? ...

How do I get js and css to display in Django?

I've got a template, a.html, which looks like this: <script type="text/javascript" src="jquery-1.4.min.js"></script> <script type="text/javascript" src="reg.js"></script> Why doesn't this work? ...

Categorize a list of lists by 1 element in python

An example list of lists: [ ["url","name","date","category"] ["hello","world","2010","one category"] ["foo","bar","2010","another category"] ["asdfasdf","adfasdf","2010","one category"] ["qwer","req","2010","another category"] ] What I wish do to is create a dictionary -> category : [ list of entries ]. The resultant dictionary would...

website containing forum and chat should be devloped in Java or Python or PHP?

I want to develop a website that contains a forum and live chat and some chatrooms. Now, should I develop it using Java or Python? I have experience in Java and PHP, but are JSP webpages slower compared to others? My web application will also contain some live chat and chat rooms. Now, there will be a load on the server, and I don't wan...

how do i write this django view('jsonview'),it is used $.getJSON(jquery)

$.getJSON('/jsonView', { tag: "userName", userName: 'zjm1126' }, function (H) { if (H.result == "successName") { F.showOk(h.ok); ...

Is there something similar to 'rake routes' in django?

In rails, on can show the active routes with rake (http://guides.rubyonrails.org/routing.html): $ rake routes users GET /users {:controller=>"users", :action=>"index"} formatted_users GET /users.:format {:controller=>"users", :action=>"index"} POST /users {:controller=>"users", :action=>"cr...

Error handling in the RequestHandler without embedding in URI

When a user sends a filled form, I want to print an error message in case there is an input error. One of the GAE sample codes does this by embedding the error message in the URI. Inside the form handler (get): self.redirect('/compose?error_message=%s' % message) and in the handler (get) of redirected URI, gets the message from reque...

Getting the module file path of a derived class via inheritance

Suppose you have the following: $ more a.py import os class A(object): def getfile(self): return os.path.abspath(__file__) - $ more b.py import a class B(a.A): pass - >>> import b >>> x=b.B() >>> x.getfile() '/Users/sbo/tmp/file/a.py' This is clear. No surprise from this code. Suppose however that I want x.getf...