Q_Id
int64
337
49.3M
CreationDate
stringlengths
23
23
Users Score
int64
-42
1.15k
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
Tags
stringlengths
6
105
A_Id
int64
518
72.5M
AnswerCount
int64
1
64
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
6
11.6k
Available Count
int64
1
31
Q_Score
int64
0
6.79k
Data Science and Machine Learning
int64
0
1
Question
stringlengths
15
29k
Title
stringlengths
11
150
Score
float64
-1
1.2
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
8
6.81M
6,089,020
2011-05-22T15:47:00.000
5
0
0
0
python,flask,flask-sqlalchemy
6,091,602
2
false
1
0
Actually I found out what I was looking for. Instead of importing flaskext.sqlalchemy on the main __init__ you import it in the model. After that you import the model in the main __init__ and with db.init_app() start it and pass the app configurations. It is not as flexible as the skeleton shown in @Sean post, but it w...
1
17
0
I am experimenting with Flask coming from Django and I really like it. There is just one problem that I ran into. I read the flask docs and the part about big applications or something like that and it explains a way to divide your project in packages, each one with its own static and templates folder as well as its ow...
What's your folder layout for a Flask app divided in modules?
0.462117
0
0
7,631
6,089,806
2011-05-22T18:11:00.000
4
1
0
1
c++,python,bittorrent
6,090,293
4
false
0
0
If you're on Linux, you could torrent into a tmpfs mount; this will avoid writing to disk. That said, this obviously means you're storing large files in RAM; make sure you have enough memory to deal with this. Note also that most Linux distributions have a tmpfs mount at /dev/shm, so you could simply point libtorrent t...
1
3
0
Working with Rasterbar libtorrent I dont want the downloaded data to sit on my hard drive rather a pipe or variable or something Soft so I can redirect it to somewhere else, Mysql, or even trash if it is not what I want, is there anyway of doing this in preferably python binding if not in C++ using Libtorrent? EDIT:-->...
Keeping the downloaded torrent in memory rather than file libtorrent
0.197375
0
0
1,739
6,090,288
2011-05-22T19:43:00.000
1
0
0
0
python,arrays,indexing,numpy,slice
6,090,407
2
false
0
0
I don't think there is a better solution, unless you have some extra information about what's in those arrays. If they're just random numbers, you have to do (n^2)/2 calculations, and your algorithm is reflecting that, running in O((n^2)/2).
1
1
1
I have an 2d array, A that is 6x6. I would like to take the first 2 values (index 0,0 and 0,1) and take the average of the two and insert the average into a new array that is half the column size of A (6x3) at index 0,0. Then i would get the next two indexes at A, take average and put into the new array at 0,1. The o...
python numpy array slicing
0.099668
0
0
1,976
6,090,417
2011-05-22T20:02:00.000
0
0
1
0
python,dictionary
6,090,546
11
false
0
0
The approach that makes the most sense is to wrap the loop in some call which contains a hook to call your post-iteration functionality afterwards. This could be implemented as context manager and called through a 'with' statement or, for older versions of Python, you could use the old 'try:' ... 'finally:' construct. ...
2
16
0
Is there a simple way to detect the last iteration while iterating over a dictionary using iteritems()?
Detect last iteration over dictionary.iteritems() in python
0
0
0
12,653
6,090,417
2011-05-22T20:02:00.000
-2
0
1
0
python,dictionary
6,090,441
11
false
0
0
No. When using an iterator you do not know anything about the position - actually, the iterator could be infinite. Besides that, a dictionary is not ordered. So if you need it e.g. to insert commas between the elements you should take the items, sort them and them iterate over the list of (key, value) tuples. And when ...
2
16
0
Is there a simple way to detect the last iteration while iterating over a dictionary using iteritems()?
Detect last iteration over dictionary.iteritems() in python
-0.036348
0
0
12,653
6,091,688
2011-05-23T00:10:00.000
2
0
0
0
python,python-3.x,tkinter,focus
6,102,787
3
false
0
1
This might be a feature of your particular window manager. One thing to try is for your app to call focus_force at startup, after all the widgets have been created.
1
7
0
I have a Tkinter program and running it like: python myWindow.py starts it all right, but the window is behind the terminal that I use to start it. Is there a way to make it grab the focus and be the foreground application? Does it depend on the platform?
Set focus on Tkinter window (depends on platform?)
0.132549
0
0
3,844
6,091,784
2011-05-23T00:36:00.000
4
0
0
0
python,google-app-engine,rest,restful-authentication,tipfy
6,098,282
3
false
1
0
Securing a javascript client is nearly impossible; at the server, you have no fool-proof way to differentiate between a human using a web browser and a well-crafted script. SSL encrypts data over the wire but decrypts at the edges, so that's no help. It prevents man-in-the-middle attacks, but does nothing to verify the...
1
11
0
I have an application that has a "private" REST API; I use RESTful URLs when making Ajax calls from my own webpages. However, this is unsecure, and anyone could make those same calls if they knew the URL patterns. What's the best (or standard) way to secure these calls? Is it worth looking at something like OAuth now ...
How do I secure REST calls I am making in-app?
0.26052
0
1
4,137
6,093,313
2011-05-23T05:51:00.000
0
0
0
0
python
6,093,396
1
false
0
1
What editor do you use?? Without knowing that there's no way we can possibly help you. FWIW in vim I use C-x [onp]
1
0
0
I'm learning wxpython right now and one thing that helps me ALOT is when I'm typing in the text editor I sometimes press the tab key to give me a hint on what I'm looking for...This is great when it works but I notice sometimes it doesn't work and I get lost looking for a syntax I can't remember... Question is how can ...
Anyway to bring up suggestion box when typing python code
0
0
0
320
6,096,806
2011-05-23T11:55:00.000
1
0
0
1
python,google-app-engine,google-cloud-datastore,backend
6,098,645
1
true
1
0
The general advice for optimizing CPU usage is to minimize RPCs, understand how to use the datastore efficiently and use appstats to find your bottlenecks. For specific optimization advice, we would need to see some code. While backends can be configured to handle public requests, they aren't intended to replace normal...
1
1
0
While processing data in datastore using backends, app engine is using my cpu resources completely. How do i process my data without wasting CPU resources? Can i have the entire app on a backend without wasting cpu resources? am i missing something.. if the question is too vague, ask me to clarify.. thanks
How to use backends in google app engine without wasting cpu resources?
1.2
0
0
1,080
6,099,592
2011-05-23T15:45:00.000
0
0
0
1
python,image,google-app-engine,reportlab
6,166,841
1
true
1
0
Just to close the question - as indicated by Wooble, reportlab itself works fine on Appengine (being pure python) but the RenderPM library doesn't.
1
2
0
I wanted to use ReportLab's RenderPM to generate images on Google App-Engine but it looks like it depends on c libraries. Does anyone know if it's possible to get it working? Thanks, Richard
Does reportlab's renderPM work on Google appengine?
1.2
0
0
234
6,100,934
2011-05-23T17:52:00.000
7
0
1
0
python,file-io,urllib
6,100,976
1
true
0
0
No. If you need them to be asynchronous then consider looking at event frameworks such as Twisted, glib, or Qt.
1
6
0
As asked in the title, are open('...','w').write('...') and urllib.urlopen('..') asynchronous calls?
Are python's file write() and urlopen() methods asynchronous?
1.2
0
1
428
6,103,592
2011-05-23T22:07:00.000
0
0
1
1
python,macos,pydev,virtualenv,python-2.x
6,103,695
4
false
0
0
From the README text file of python Installing multiple versions On Unix and Mac systems if you intend to install multiple versions of Python using the same installation prefix (--prefix argument to the configure script) you must take care that your primary python executable is not overwritten by the insta...
1
2
0
I want to have multiple installs of Python: 2.1, 2.4, 2.7, 3.x My IDE is Eclipse (Helios)/Pydev on MacOSX, which works great. I have a couple of Python codebases that are/will be running on different versions of Python. Also, I like Eclipse PyDev's crosslinking from source-code to documentation. The standard recommenda...
Multiple installs of Python on MacOSX for Eclipse
0
0
0
1,353
6,105,273
2011-05-24T03:00:00.000
5
0
1
1
java,python,ide,editor
6,105,339
6
false
0
0
notepad++ has an ftp plugin that works very nicely and runs on very little resource. Will syntax highlight most languages and has some compiler support.
2
3
0
I need an IDE that can do the following: Run on an oldish laptop (2GB Ram, 1.9 ghz intel celeron M) Run well on an oldish laptop (with a browswer open) Be able to run on windows Be able to run smoothly on windows Is able to do Java (or, if you really can't find anything, C# will be okay) An extension or something for ...
Specific IDE, for specific things
0.16514
0
0
343
6,105,273
2011-05-24T03:00:00.000
0
0
1
1
java,python,ide,editor
6,105,523
6
false
0
0
Use the IDE and tools that makes you the most productive. Use the IDE and tools that you want to use. Use the IDE and tools that you will enjoy using. If your computer is preventing you from doing that, then get a new computer. Long gone are the days when labor was cheap, and hardware expensive. These days hardware is ...
2
3
0
I need an IDE that can do the following: Run on an oldish laptop (2GB Ram, 1.9 ghz intel celeron M) Run well on an oldish laptop (with a browswer open) Be able to run on windows Be able to run smoothly on windows Is able to do Java (or, if you really can't find anything, C# will be okay) An extension or something for ...
Specific IDE, for specific things
0
0
0
343
6,107,318
2011-05-24T07:53:00.000
0
0
0
1
python,google-app-engine,authentication
6,110,157
1
false
1
0
Authentication does not imply authorisation. All that the federated ID system does for your application is give you a username/userid that you can trust. So you can setup your user accounts tied to this infomation and rely on the fact that whenever you see that userid you are talking to the same user. Or in the case of...
1
1
0
I am looking for some suggestions to implement authentication (and authorization) in our GAE app. Assuming that our app is called someapp, our requirement is as follows: someapp is primarily for google apps users of the domain its installed for but can also authenticate users from other google apps domains. For exam...
Multi-domain authentication options for google app engine
0
0
0
796
6,107,978
2011-05-24T08:55:00.000
5
0
0
0
python,django,django-south
6,886,466
4
false
1
0
Remove 'south' from INSTALLED_APPS, remove south_migrations table from DB. Also, you'll need to delete the Migrations folders from your app folders.
3
6
0
I installed south and tried a few changes using it, which didn't exactly work out the way I wanted it to. Thankfully, my data is safe but locked into south. I want to remove south and use syncdb normally now, how do I do that without affecting my data?
How do I remove south from a django project
0.244919
0
0
4,611
6,107,978
2011-05-24T08:55:00.000
3
0
0
0
python,django,django-south
6,108,006
4
false
1
0
What does it mean for your data to be "locked into" South? The data lives in the database, and South simply creates the schema for you and migrates it when necessary. If you remove South, the data will stay exactly the same.
3
6
0
I installed south and tried a few changes using it, which didn't exactly work out the way I wanted it to. Thankfully, my data is safe but locked into south. I want to remove south and use syncdb normally now, how do I do that without affecting my data?
How do I remove south from a django project
0.148885
0
0
4,611
6,107,978
2011-05-24T08:55:00.000
10
0
0
0
python,django,django-south
6,108,042
4
true
1
0
Remove 'south' from INSTALLED_APPS, remove south_migrations table from DB.
3
6
0
I installed south and tried a few changes using it, which didn't exactly work out the way I wanted it to. Thankfully, my data is safe but locked into south. I want to remove south and use syncdb normally now, how do I do that without affecting my data?
How do I remove south from a django project
1.2
0
0
4,611
6,109,602
2011-05-24T11:21:00.000
2
0
0
1
python,google-app-engine
6,112,067
2
false
1
0
Instantiating an email object certainly does not count against your "recipients emailed" quota. Like other App Engine services, you consume quota when you trigger an RPC, i.e. call send(). If you intended to email 1500 recipients and App Engine says you emailed 45,000, your code has a bug.
2
5
0
just wondering if anyone of you has come across this. I'm playing around with the Python mail API on Google App Engine and I created an app that accepts a message body and address via POST, creates an entity in the datastore, then a cron job is run every minute, grabs 200 entities and sends out the emails, then deletes...
Google App Engine Locking
0.197375
0
0
467
6,109,602
2011-05-24T11:21:00.000
3
0
0
1
python,google-app-engine
6,141,535
2
false
1
0
Use tasks to send the email. Create a task that takes a key as an argument, retrieves the stored entity for that key, then sends the email. When your handler receives the body and address, store that as you do now but then enqueue a task to do the send and pass the key of your datastore object to the task so it knows w...
2
5
0
just wondering if anyone of you has come across this. I'm playing around with the Python mail API on Google App Engine and I created an app that accepts a message body and address via POST, creates an entity in the datastore, then a cron job is run every minute, grabs 200 entities and sends out the emails, then deletes...
Google App Engine Locking
0.291313
0
0
467
6,110,384
2011-05-24T12:28:00.000
0
0
0
0
python,postgresql,db2,datamart,greenplum
7,550,497
4
false
0
0
Many of Greenplum's utilities are written in python and the current DBMS distribution comes with python 2.6.2 installed, including the pygresql module which you can use to work inside the GPDB. For data transfer into greenplum, I've written python scripts that connect to the source (Oracle) DB using cx_Oracle and then ...
2
0
0
My company has decided to implement a datamart using [Greenplum] and I have the task of figuring out how to go on about it. A ballpark figure of the amount of data to be transferred from the existing [DB2] DB to the Greenplum DB is about 2 TB. I would like to know : 1) Is the Greenplum DB the same as vanilla [PostgresS...
Transferring data from a DB2 DB to a greenplum DB
0
1
0
2,294
6,110,384
2011-05-24T12:28:00.000
0
0
0
0
python,postgresql,db2,datamart,greenplum
23,668,974
4
false
0
0
Generally, it is really slow if you use SQL insert or merge to import big bulk data. The recommended way is to use the external tables you define to use file-based, web-based or gpfdist protocol hosted files. And also greenplum has a utility named gpload, which can be used to define your transferring jobs, like source,...
2
0
0
My company has decided to implement a datamart using [Greenplum] and I have the task of figuring out how to go on about it. A ballpark figure of the amount of data to be transferred from the existing [DB2] DB to the Greenplum DB is about 2 TB. I would like to know : 1) Is the Greenplum DB the same as vanilla [PostgresS...
Transferring data from a DB2 DB to a greenplum DB
0
1
0
2,294
6,111,171
2011-05-24T13:29:00.000
2
0
0
0
python,user-interface,interface
6,112,009
1
false
0
1
I'd wager most of those cracks are written in C or even assembly language, using the Windows API at a very low level. Very few, if any, are written in Python, and positively none are written using GTK. :) Crackers have different aesthetics than ordinary programmers, and they tend to idealize low-level programs with sma...
1
0
0
Have you ever used those cracks and keygens with the really nice interfaces and 8-bit music playing in the bg with special effects when you clicked buttons and stuff? I'd like to create works like such (the GUI part), but I'm wondering which GUI toolkit has that kind of flexibility. Do all GUI toolkits have the ability...
Graphical User Interfaces for cracks, keygens, etc
0.379949
0
0
237
6,115,347
2011-05-24T18:50:00.000
3
0
0
1
python,terminal
6,115,447
2
false
0
0
Make sure that your pasted text doesn't contain any embedded control characters (such as a newline), which could end the input.
1
0
0
I'm reading text in terminal with description = raw_input() It works if I write the text and press enter. The problem is when I paste the text from somewhere with Ctrl+Shift+V or with right click + paste. My program immediately ends, description contains only part of the text (I can see it in database). Do you know how...
Problem with reading pasted text in terminal
0.291313
0
0
121
6,116,236
2011-05-24T20:09:00.000
4
0
0
1
java,python,google-app-engine
6,116,489
3
false
1
0
I would recommend using Python + Django framework. I love Java, but for the Google App Engine there is much more documentation online for Python.
1
0
0
I'm working on a practical work for college, and I have to develop a web-app that could be used by all the teachers from my province. The application should let the users (teachers) manage some information related to their daily duties. One of the requirements is that I must use Google App Engine platform for develop...
Help me decide what to use with Google App Engine for this practical work
0.26052
0
0
346
6,118,139
2011-05-24T23:49:00.000
0
0
0
0
python,wxpython,objectlistview
6,142,594
1
false
0
1
You should be able to add different images to different rows with the ObjectListView widget, if I understand the question correctly. Alternatively, you might want to take a look at the UltimateListCtrl, which was written in pure Python and can have any widget put into it. I think there's a new list control widget in 2....
1
0
0
I am trying to create a legend of sorts using ObjectListView in Python. I am able to accomplish this, using wx.PaintDC, DrawText, and DrawRectangle in wxPython, but it doesn't look very good because it is all free hand. Is it possible to create a square image, say a 10x10 pixel square, using wxPython or another packag...
Creating a Legend Using ObjectListView
0
0
0
182
6,119,038
2011-05-25T02:55:00.000
2
0
0
1
python,bash
6,119,079
4
false
0
0
Have you tried echo "Something for input" | python myPythonScript.py ?
1
2
0
I'm writing a bash script that fires up python and then enters some simple commands before exiting. I've got it firing up python ok, but how do I make the script simulate keyboard input in the python shell, as though a person were doing it?
How to write a bash script that enters text into programs
0.099668
0
0
500
6,119,508
2011-05-25T04:21:00.000
1
0
1
0
python,user-interface
6,119,548
2
false
0
1
You can use Pygame modul Pygame site has a lot of tutorials, you can use those tutorials as a starting point. Good Luck!
2
0
0
I've never created a GUI before, just simple text based stuff. I think I'm ready to move on to building a GUI and I have a project in mind. Specifically, I'm thinking about creating a simple touch typing tutor game...nothing too fancy. Which python GUI toolkit and builder would lend itself best to a project like thi...
python GUI to build a simple typing tutor game
0.099668
0
0
867
6,119,508
2011-05-25T04:21:00.000
0
0
1
0
python,user-interface
6,119,529
2
true
0
1
I wrote several application prototypes using the libglade library and the python bindings. I found the toolkit pretty easy to use, it acted just like any other GUI widget framework I've used, but the widgets seemed more ready to grow or shrink to fit the available space easier than many other GUI frameworks. Since they...
2
0
0
I've never created a GUI before, just simple text based stuff. I think I'm ready to move on to building a GUI and I have a project in mind. Specifically, I'm thinking about creating a simple touch typing tutor game...nothing too fancy. Which python GUI toolkit and builder would lend itself best to a project like thi...
python GUI to build a simple typing tutor game
1.2
0
0
867
6,120,893
2011-05-25T07:23:00.000
4
1
0
0
python,testing,robotframework
9,087,623
4
false
0
0
One method, kind of lame but workable, is to use the keyword, 'Set Test Message'. This lets you put text into the test message column of the report. Whenever the test passes, you will see the message. If it fails, you see the normal failure message. It would be great to be able to dynamically insert a documentatio...
2
2
0
I want to customize robot framework test report, in order to fit my need. Where can I find the related python source that handle this feature? Or I need to create a 3rd party library to handle this?
how to customize robot framework test reports
0.197375
0
0
23,583
6,120,893
2011-05-25T07:23:00.000
4
1
0
0
python,testing,robotframework
7,626,579
4
false
0
0
One solution is to create your own report from scratch. The XML output is very easy to parse. You can turn off the generation of reports with command line options (eg: --log NONE and --report NONE). Then, create a script that generates any type of report that you want.
2
2
0
I want to customize robot framework test report, in order to fit my need. Where can I find the related python source that handle this feature? Or I need to create a 3rd party library to handle this?
how to customize robot framework test reports
0.197375
0
0
23,583
6,121,180
2011-05-25T07:49:00.000
3
0
0
1
python,linux,python-3.x
6,121,275
3
false
0
0
This really depends on the kind of messaging you want and the roles of the two processes. If it's proper "client/server", I would probably create a SimpleHTTPServer and then use HTTP to communicate between the two. You can also use XMLRPCLib and the client to talk between them. Manually creating a TCP server with your ...
1
4
0
We have two Python programs running on two linux servers. Now we want to send messages between these Python programs. The best idea so far is to create a TCP/IP server and client architecture, but this seems like a very complicate way to do it. Is this really best practice for doing such a thing?
Interprocess messaging between two Python programs
0.197375
0
1
1,949
6,123,164
2011-05-25T10:41:00.000
0
1
0
0
python,gmail,imaplib
6,128,926
2
false
0
0
in imap you don't have labels, gmail 'emulates' them on imap, you can low at the raw source of a message picked from imap an check if it has some custom header with the label
1
9
0
I'm using imaplib for my project because I need to access gmails accounts. Fact: With gmail's labels each message may be on an arbitrary number of folders/boxes/labels. The problem is that I would like to get every single label from every single message. The first solution it cames to my mind is to use "All Mail" folde...
Python/imaplib - How to get messages' labels?
0
0
1
5,550
6,123,950
2011-05-25T11:45:00.000
0
0
0
0
python,web-applications,web-frameworks
6,124,043
4
false
1
0
My gut says you want to use SQLAlchemy as the ORM. Turbogears does this out of the box, and probably is the largest player in the "not Django" space. There was some work on pulling in SQLAlchemy for (or in addition to!) Django's ORM, but I don't know how current that work is (a quick google search found articles from 2...
3
1
0
I plan to develop a rather database heavy (~100 tables) web application in python. The focus is on providing a nice and task-optimized interface for people that edit or navigate through the data. Other focuses are: Handle lots of data and complex queries. Internationalization (translation, timezones, currencies) Maili...
Which python project to choose for a database-heavy application
0
0
0
899
6,123,950
2011-05-25T11:45:00.000
3
0
0
0
python,web-applications,web-frameworks
6,124,088
4
true
1
0
Imo the only part of django that might be "too" publishing orientated is the admin, but I have seen plenty of django applications doing stuff neatly. Django has plenty of apps available covering what you want to do, but the only road block you might find is the part of: handle lots of data and complex queries. You wil...
3
1
0
I plan to develop a rather database heavy (~100 tables) web application in python. The focus is on providing a nice and task-optimized interface for people that edit or navigate through the data. Other focuses are: Handle lots of data and complex queries. Internationalization (translation, timezones, currencies) Maili...
Which python project to choose for a database-heavy application
1.2
0
0
899
6,123,950
2011-05-25T11:45:00.000
0
0
0
0
python,web-applications,web-frameworks
6,124,031
4
false
1
0
The number of tables is not relevant for speeds etc. and not relevant for the choice of the framework. Recommendation: use SQLAlchemy as ORM between database and application. Go for Pyramid as web framework. Pyramid is easy, well-documented, test and very flexible in all aspects. Forms etc. can be easily created using ...
3
1
0
I plan to develop a rather database heavy (~100 tables) web application in python. The focus is on providing a nice and task-optimized interface for people that edit or navigate through the data. Other focuses are: Handle lots of data and complex queries. Internationalization (translation, timezones, currencies) Maili...
Which python project to choose for a database-heavy application
0
0
0
899
6,126,044
2011-05-25T14:28:00.000
0
0
0
0
python,gtk,png,pygtk
6,127,034
1
true
0
1
You can use a combination of gtk.Image, gtk.HBox (or VBox), and maybe gtk.ScrolledWindow if you plan on showing a lot of images. Just create a new gtk.Image, set the image using set_from_file, then call pack_end on the box to display it.
1
1
0
I have a PyGTK GUI that has a gtk.Table. Pressing one button will generate a PNG file. I can show the PNG file in the GUI by adding it somewhere in the table and calling the main window's show_all method again. Is there a better way? What if I want to show more than one PNG file at a time?
In PyGTK, what's a good way of displaying an image in a GUI?
1.2
0
0
173
6,127,135
2011-05-25T15:41:00.000
1
0
0
0
python,blackberry,cross-platform
6,128,379
3
false
1
0
Given the number of platforms you listed, iPhone, Symbian, Android, BlackBerry, and Windows Mobile I'd suggest you look into a web framework you can integrate your logic into. I know Django is quite popular. Putting a web-frontend on your app does mean your users do have to be connected to the Internet to use yo...
1
5
0
The said program runs only on my PC as of now. I've been searching through StackOverflow, and I've found out about RhoMobile's Rhodes which allows you to write the app in Ruby once and run it in multiple mobile platforms: iPhone, Symbian, Android, BlackBerry, and Windows Mobile. Is there anything similar for Python? I...
Get a python program I've written onto Blackberry or other mobile platform?
0.066568
0
0
2,149
6,127,314
2011-05-25T15:53:00.000
0
0
0
0
python,opencv,iplimage
6,127,643
3
false
0
0
I do not know opencv python bindings, but in C or C++ you have to get the buffer pointer stored in IplImage. This buffer is coded according to the image format (also stored in IplImage). For RGB you have a byte for R, a byte for G, a byte for B, and so on. Look at the API of python bindings,you will find how to access ...
1
4
1
I am doing some simple programs with opencv in python. I want to write a few algorithms myself, so need to get at the 'raw' image data inside an image. I can't just do image[i,j] for example, how can I get at the numbers? Thanks
Opencv... getting at the data in an IPLImage or CvMat
0
0
0
7,276
6,127,524
2011-05-25T16:11:00.000
2
0
1
0
python,random,indexing,choice
6,127,555
7
false
0
0
If the values are unique in the sequence, you can always say: list.index(value)
1
28
0
I know very well how to select a random item from a list with random.choice(seq) but how do I know the index of that element?
python: how to know the index when you randomly select an element from a sequence with random.choice(seq)
0.057081
0
0
26,292
6,128,458
2011-05-25T17:31:00.000
0
0
1
0
python,persistent-storage
6,130,718
3
false
0
0
Perhaps you could set up some layer of indirection where the objects are actually held within, say, another dictionary, and an object referencing another object will store the key of the object being referenced and then access the object through the dictionary. If the object for the stored key is not in the dictionary,...
1
2
0
I have a lot of objects which form a network by keeping references to other objects. All objects (nodes) have a dict which is their properties. Now I'm looking for a fast way to store these objects (in a file?) and reload all of them into memory later (I don't need random access). The data is about 300MB in memory whic...
Store and load a large number linked objects in Python
0
1
0
252
6,129,054
2011-05-25T18:26:00.000
3
1
0
1
python,linux,gentoo
6,129,347
2
false
0
0
Did it work before your custom kernel? Boot into a rescue CD, chroot into your gentoo env, and run your script. If it works, it's your kernel. That's about as specific as I can be.
1
2
0
I've just installed a base gentoo stage 3 and I get the following error when i try and call time.time(): sbx / # python import time Python 2.7.1 (r271:86832, May 22 2011, 14:53:09) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> time.time() Traceback (mo...
Python time.time() -> IOError
0.291313
0
0
757
6,129,086
2011-05-25T18:28:00.000
1
1
1
0
python,objective-c,ruby,ios
6,129,509
3
false
0
1
Python and Ruby themselves are not too fast, but many programs today are written to basically do none of the heavy lifting alone. For instance, if you want to save a PNG file as a JPG, you are certainly going to use the built in system calls to do it. In that case it does not really matter if it takes 0.00001 seconds i...
1
1
0
I am reading a little bit on Objective-C, and since it comes from Smalltalk, like Ruby does, so I wonder, is it true that if using Ruby, (if Apple change XCode to support it), to develop iPhone or Mac app, it is not suitable really because of the speed? For example, Angry Birds probably isn't as smooth as it is now i...
Is Ruby or Python not suitable for iPhone or Mac app development because of speed, and any compiler that can help boost the speed?
0.066568
0
0
1,121
6,129,383
2011-05-25T18:54:00.000
2
1
0
0
c++,python,django,ctypes,backend
6,129,485
1
true
0
1
Basically you have to decide what kind of operation flow you want. If you prefer synchronous processing you can call you method directly, if you favor asynchronous processing you will need an intermediate solution. However, you have to be aware, that when you call the C++ routine directly form your Django app the call ...
1
2
0
My Python backend (Django) has to request to a C++ library to get a result (with help of ctypes module). Is it normal to call a C++ method directly? Or may be I need an intermediate thread manager that starts a new thread when python script wants a result?
High Perfomance: Do call C++ methods directly from a python backend?
1.2
0
0
339
6,129,789
2011-05-25T19:30:00.000
3
1
1
0
python,vim,vi
42,373,091
5
false
0
0
Old thread, but hope this helps. By mistake I did a "/." on my vim screen, which highlighted all lines in red. If I open any other file, the red highlighting stays. Try searching for some other keyword, let's say "/word" - doesn't matter word exists or not. It restores the color.
1
5
0
I added a print line to a python script while the script was executing, and now all the text is highlighted in red when I open the file. Opening and closing the file doesn't get rid of it. Opening a second python file momentarily fixed the problem, but then closing file and reopening brought the problem back. Now it wo...
vim highlighting everything in red
0.119427
0
0
10,751
6,129,933
2011-05-25T19:39:00.000
2
0
1
0
c++,python,ctypes
6,129,979
1
true
0
1
Yes, It will all be returned to the OS once the python interpreter exits. This is true for all processes - nothing specific to python or c++.
1
1
0
Python script calls an external C++ function (using ctypes). Memory leaks are possible when execution the C++ function. Will all allocated memory (in C++ function) be automatically cleaned up after finishing of the Python script?
Call an External C++ function and Memory Leaks: is all allocated memory cleaned up after finishing Python script?
1.2
0
0
169
6,130,115
2011-05-25T19:56:00.000
2
0
1
0
visual-studio-2010,ironpython
16,109,491
1
false
0
0
Right click on the project file (not the solution) Proprieties/ Debug. Then you should select "Standrad Python Louncher" for launch mode. It will use the ipy.exe, for interpeter, just you can debug easier. You sould make visible the "Python Debug Interactiv" from Debug menu
1
2
0
I use IronPython for a lot of debugging, and I usually attach my Visual Studio debugger to ipy.exe, then import and use a .NET assembly to step through my code. However, I find that the IronPython Interactive extension for VS2010 is more fully-featured than the ipy.exe shell, and I would like to know whether it is pos...
Can you connect the Visual Studio debugger to IronPython Tools?
0.379949
0
0
425
6,130,374
2011-05-25T20:18:00.000
4
0
1
0
python,set,literals
44,576,113
7
false
0
0
Adding to the crazy ideas: with Python 3 accepting unicode identifiers, you could declare a variable ϕ = frozenset() (ϕ is U+03D5) and use it instead.
1
558
0
[] = empty list () = empty tuple {} = empty dict Is there a similar notation for an empty set? Or do I have to write set()?
Empty set literal?
0.113791
0
0
244,284
6,130,438
2011-05-25T20:25:00.000
1
0
1
0
python,string,list,memory,join
6,130,864
2
false
0
0
You should also consider what you are going to do with the resulting string. If you just want to write the contents back to a file, there is no need to join the parts first, you can use file.writelines(strings) directly.
1
2
0
In python I have read in a file into a list using file.readlines() , later on after some logic, I would like to put it back together in a string using fileString = ''.join(file), for some reason, even without a print function, it prints the fileString out to the console up to a certain point, then it just stops. It doe...
python join "large" file
0.099668
0
0
1,190
6,130,768
2011-05-25T20:49:00.000
0
0
1
0
python,dictionary,key,nonetype
72,498,581
14
false
0
0
d1={"One":1,"Two":2,"Three":3} d1.get("Four") If you will run this code there will be no 'Keyerror' which means you can use 'dict.get()' to avoid error and execute your code
2
668
0
I need a way to get a dictionary value if its key exists, or simply return None, if it does not. However, Python raises a KeyError exception if you search for a key that does not exist. I know that I can check for the key, but I am looking for something more explicit. Is there a way to just return None if the key does ...
Return a default value if a dictionary key is not available
0
0
0
515,381
6,130,768
2011-05-25T20:49:00.000
68
0
1
0
python,dictionary,key,nonetype
6,131,279
14
false
0
0
Wonder no more. It's built into the language. >>> help(dict) Help on class dict in module builtins: class dict(object) | dict() -> new empty dictionary | dict(mapping) -> new dictionary initialized from a mapping object's | (key, value) pairs ... | | get(...) |...
2
668
0
I need a way to get a dictionary value if its key exists, or simply return None, if it does not. However, Python raises a KeyError exception if you search for a key that does not exist. I know that I can check for the key, but I am looking for something more explicit. Is there a way to just return None if the key does ...
Return a default value if a dictionary key is not available
1
0
0
515,381
6,131,620
2011-05-25T22:13:00.000
4
1
0
1
php,python,comet,tornado,long-polling
6,132,278
1
true
0
0
The gist of it is that PHP was originally written with the intent of having a brand new process for every request that you could just throw away once said request ended, at a time where things like Comet and long polling weren't really on the table. As such there are quite a few areas - notably the garbage collector - ...
1
3
0
Why would a Comet Server like Tornado be especially prone to memory leaks if written in PHP? Are there genuine weaknesses particular to PHP for implementing a long polling framework/service like Tornado? Thanks
Memory Leaks Comet Server in PHP
1.2
0
0
254
6,132,080
2011-05-25T23:22:00.000
0
0
0
0
python,soap,suds
6,132,117
1
true
1
0
There is no such limit. It's just on the server side so that big queries wouldn't hinder the server's work.
1
0
0
I was wondering if there was a maximum limit to the number of items that could be received through a SOAP method, or if the server I'm communicating with just has a strange limit. When using Python's framework Suds, I used a method called getRecords from a database of about 39,000 rows. Unfortunately, when I actually ...
SOAP Method Max Item Number
1.2
0
0
86
6,132,469
2011-05-26T00:20:00.000
23
0
1
0
python,pickle,traceback
6,132,584
3
true
0
0
The traceback holds references to the stack frames of each function/method that was called on the current thread, from the topmost-frame on down to the point where the error was raised. Each stack frame also holds references to the local and global variables in effect at the time each function in the stack was called. ...
1
22
0
I've since found a work around, but still want to know the answer.
Why can't I pickle an error's Traceback in Python?
1.2
0
0
5,966
6,133,348
2011-05-26T03:23:00.000
3
0
0
0
python,wxpython
6,133,380
4
false
0
1
Don't worry about it. You aren't going to ruin your future programming by making the wrong choice now. None of the options you mention are wrong. They all do things differently because different applications have different requirements. No one way is best. Just work on what you want and do what works for you, and once...
1
3
0
I've gone from one book to another, one google search to another and I notice EVERY SINGLE ONE starts the main window in a completely different way. I don't want to pick up bad habits so can someone please give me the best of these options and why its the better method. Below are all the ways i've seen it done A) class...
Confused on how to structure the GUI (wxpython)
0.148885
0
0
1,956
6,134,642
2011-05-26T06:37:00.000
4
0
1
0
python,optparse
6,134,674
1
false
0
0
I think that this happens because Linux uses $ to identify shell variables. So, if you want to use this symbole in your arguments, your only chance is to pass '\$', that won't be replaced by the invoking shell. Windows uses %variablename% to identify that kind of variables, that's why you don't experience this kind of ...
1
0
0
if I am using a $ symbol in the arguments, python optparse is not able to parse it properly. It just ignores the symbol and the next character. If I am giving a \ before $ then it is working fine. But I don't want to give a \. Please help me out how to overcome this situation. Its happening only in Linux; on Windows it...
Python optparse is not able to parse the `$` symbol
0.664037
0
0
153
6,139,777
2011-05-26T13:59:00.000
0
0
0
0
python,mysql,database-connection,cpanel
6,139,936
3
false
0
0
You can write a simple script like import MySQLdb and catch any errors to see if the required package is installed. If this fails you can ask the hosting provider to install your package, typically via a ticket The hosting providers typically also provide URL's to connect to the MySQL tables they provision for you, and...
1
0
0
I have a written a very small web-based survey using cgi with python(This is my first web app. ).The questions are extracted from a MySQL database table and the results are supposed to be saved in the same database. I have created the database along with its table locally. My app works fine on my local computer(localho...
Uploading a mysql database to a webserver supporting python
0
1
0
513
6,141,026
2011-05-26T15:22:00.000
0
0
0
0
python,django
6,141,939
1
false
1
0
The only way is to subclass the product class, and then use your subclass instead anywhere you need access to the extra fields. Just bear in mind that spots that require the parent class will accept the subclass but spots that require the subclass will not accept the parent class. It's like putting a round peg into a s...
1
0
0
Is there anyway to add fields to the default product class provided by Cartridge? I'm attempting to setup a parent-child relationship where the parent is the Product class and the child embellishes with custom product fields. Is this at all possible? Thanks. Mark Anderson
Adding/removing product fields to Product class in Cartridge?
0
0
0
295
6,141,500
2011-05-26T15:58:00.000
1
0
0
0
python,sympy,mathematical-expressions
6,143,788
1
false
0
0
I don't believe this can be solved in the general case. A simple counter-example is sin(A), which could be both proportional and inverse proportional, depending on what value of A you are evaluating it at. However, you could use an automatic differentiation tool, such as PyDX or Theano, to compute the derivative of...
1
1
0
What is the best way to check if a parameter increase in a mathematical expression increases or decreases the expression as a whole (in Python, preferably SymPy)? Assumptions: all parameters are positive (i.e. > 0). Example A*B/(A+C): A should be found as proportional to the expression and C should be found as inverse ...
Proportionality of parameter and mathematical expression
0.197375
0
0
398
6,143,748
2011-05-26T19:06:00.000
1
0
0
0
python,mysql,django,memcached
6,146,042
1
false
1
0
Memcached is not a persistent store, so if you need your data to be durable at all then you will need to store them in a persistent store immediately. So you need to put them somewhere - possibly a MySQL table - as soon as the data arrive, and make sure they are fsync'd to disc. Storing them in memcached as well only s...
1
1
0
I'm building a real-time service so my real-time database need to storage in memcached before fetch to DB (Avoid to read/write mysql db too much). I want to fetch data to mysql DB when some events occur , etc : before data expire or have least-recently-used (LRU) data. What is solution for my problem ? My system used m...
Can auto transfer data from memcached to mysql DB?
0.197375
1
0
329
6,146,359
2011-05-26T23:50:00.000
1
1
1
0
c++,python,search
6,146,444
3
false
0
0
C++ will be faster (maybe, if you write it well), but, it will be harder, but easier to start since you know it. Python will take some time to get used to, and it will probably run a wee bit slower, but, will be easier (once you learn the language). This is a very easy problem solved numerous times, so, what language y...
1
0
0
First off , this isn't a homework assignment!!! :p What I want to do is this: Given a data file(be it text or numbers) saved on the desktop i.e., I want to be able to search that file and pull out only the data I want and print it to the screen. I may want to do other stuff with it but I have no idea what options there...
Searching a data file: coding in python vs c++
0.066568
0
0
407
6,146,892
2011-05-27T01:26:00.000
3
0
1
0
.net,python,powershell,ironpython,powershell-cmdlet
7,308,675
1
true
0
0
As far as I know it can't be done! The problem here is that an IronPython class is not a CLR class or compatible with a CLR class. A CLR class is static and an IronPython class is dynamic and the DLR, as far as I know, doesn't for example provide IronPython classes to have .net CLR attributes, which you need for CMDLET...
1
11
0
I want to be able to write PowerShell CmdLets using IronPython, and furthermore I need one CmdLet to look at the environment and add CmdLets to the PowerShell based on the contents. For example, reading a directory, and adding a CmdLet Remove- for every filename it sees there.
Writing PowerShell CmdLets in Python Dynamically
1.2
0
0
815
6,146,963
2011-05-27T01:37:00.000
3
0
1
0
python,dictionary,python-internals,del
6,147,022
24
false
0
0
When is del useful in python? You can use it to remove a single element of an array instead of the slice syntax x[i:i+1]=[]. This may be useful if for example you are in os.walk and wish to delete an element in the directory. I would not consider a keyword useful for this though, since one could just make a [].remove(...
8
448
0
I can't really think of any reason why Python needs the del keyword (and most languages seem to not have a similar keyword). For instance, rather than deleting a variable, one could just assign None to it. And when deleting from a dictionary, a del method could be added. Is there a reason to keep del in Python, or is i...
When is del useful in Python?
0.024995
0
0
369,951
6,146,963
2011-05-27T01:37:00.000
-2
0
1
0
python,dictionary,python-internals,del
13,871,797
24
false
0
0
del is the equivalent of "unset" in many languages and as a cross reference point moving from another language to python.. people tend to look for commands that do the same thing that they used to do in their first language... also setting a var to "" or none doesn't really remove the var from scope..it just empties it...
8
448
0
I can't really think of any reason why Python needs the del keyword (and most languages seem to not have a similar keyword). For instance, rather than deleting a variable, one could just assign None to it. And when deleting from a dictionary, a del method could be added. Is there a reason to keep del in Python, or is i...
When is del useful in Python?
-0.016665
0
0
369,951
6,146,963
2011-05-27T01:37:00.000
-3
0
1
0
python,dictionary,python-internals,del
17,091,850
24
false
0
0
Every object in python has an identifier, Type, reference count associated with it, when we use del the reference count is reduced, when the reference count becomes zero it is a potential candidate for getting garbage collected. This differentiates the del when compared to setting an identifier to None. In later case ...
8
448
0
I can't really think of any reason why Python needs the del keyword (and most languages seem to not have a similar keyword). For instance, rather than deleting a variable, one could just assign None to it. And when deleting from a dictionary, a del method could be added. Is there a reason to keep del in Python, or is i...
When is del useful in Python?
-0.024995
0
0
369,951
6,146,963
2011-05-27T01:37:00.000
-1
0
1
0
python,dictionary,python-internals,del
64,482,228
24
false
0
0
Here goes my 2 cents contribution: I have a optimization problem where I use a Nlopt library for it. I initializing the class and some of its methods, I was using in several other parts of the code. I was having ramdom results even if applying the same numerical problem. I just realized that by doing it, some spurius d...
8
448
0
I can't really think of any reason why Python needs the del keyword (and most languages seem to not have a similar keyword). For instance, rather than deleting a variable, one could just assign None to it. And when deleting from a dictionary, a del method could be added. Is there a reason to keep del in Python, or is i...
When is del useful in Python?
-0.008333
0
0
369,951
6,146,963
2011-05-27T01:37:00.000
2
0
1
0
python,dictionary,python-internals,del
6,147,228
24
false
0
0
I think one of the reasons that del has its own syntax is that replacing it with a function might be hard in certain cases given it operates on the binding or variable and not the value it references. Thus if a function version of del were to be created a context would need to be passed in. del foo would need to become...
8
448
0
I can't really think of any reason why Python needs the del keyword (and most languages seem to not have a similar keyword). For instance, rather than deleting a variable, one could just assign None to it. And when deleting from a dictionary, a del method could be added. Is there a reason to keep del in Python, or is i...
When is del useful in Python?
0.016665
0
0
369,951
6,146,963
2011-05-27T01:37:00.000
12
0
1
0
python,dictionary,python-internals,del
36,716,057
24
false
0
0
To add a few points to above answers: del x Definition of x indicates r -> o (a reference r pointing to an object o) but del x changes r rather than o. It is an operation on the reference (pointer) to object rather than the object associated with x. Distinguishing between r and o is key here. It removes it from locals...
8
448
0
I can't really think of any reason why Python needs the del keyword (and most languages seem to not have a similar keyword). For instance, rather than deleting a variable, one could just assign None to it. And when deleting from a dictionary, a del method could be added. Is there a reason to keep del in Python, or is i...
When is del useful in Python?
1
0
0
369,951
6,146,963
2011-05-27T01:37:00.000
12
0
1
0
python,dictionary,python-internals,del
30,622,326
24
false
0
0
Using "del" explicitly is also better practice than assigning a variable to None. If you attempt to del a variable that doesn't exist, you'll get a runtime error but if you attempt to set a variable that doesn't exist to None, Python will silently set a new variable to None, leaving the variable you wanted deleted wher...
8
448
0
I can't really think of any reason why Python needs the del keyword (and most languages seem to not have a similar keyword). For instance, rather than deleting a variable, one could just assign None to it. And when deleting from a dictionary, a del method could be added. Is there a reason to keep del in Python, or is i...
When is del useful in Python?
1
0
0
369,951
6,146,963
2011-05-27T01:37:00.000
20
0
1
0
python,dictionary,python-internals,del
13,873,748
24
false
0
0
Just another thinking. When debugging http applications in framework like Django, the call stack full of useless and messed up variables previously used, especially when it's a very long list, could be very painful for developers. so, at this point, namespace controlling could be useful.
8
448
0
I can't really think of any reason why Python needs the del keyword (and most languages seem to not have a similar keyword). For instance, rather than deleting a variable, one could just assign None to it. And when deleting from a dictionary, a del method could be added. Is there a reason to keep del in Python, or is i...
When is del useful in Python?
1
0
0
369,951
6,147,101
2011-05-27T02:03:00.000
2
0
1
1
python,installation,java,windows-7-x64
6,147,430
2
true
0
0
I'm confused. Are you switching out the paths between the JDK and Python? If that's the case, you can have both paths set in your system's PATH variable. Example: C:\jdk-install\;C:\python-install
2
1
0
I recently installed Java's JDK and Python in my Windows 7 system. I wanted to access both programs from the command line (whether it be cmd or cygwin) so I used the PATH global variable and entered the path to my JDK. What can I do so that python and JDK are accessed by PATH? What I am doing now is changing the PATH v...
Installing JDK and Python and setting the PATH variable on Windows 7
1.2
0
0
2,880
6,147,101
2011-05-27T02:03:00.000
1
0
1
1
python,installation,java,windows-7-x64
6,147,460
2
false
0
0
Right click on "My Computer" Choose "Properties" Click on "Advanced System Settings" Click on "Environment Variables" Find PATH and set it appropriately Note that only processes started after you change the path will see the change.
2
1
0
I recently installed Java's JDK and Python in my Windows 7 system. I wanted to access both programs from the command line (whether it be cmd or cygwin) so I used the PATH global variable and entered the path to my JDK. What can I do so that python and JDK are accessed by PATH? What I am doing now is changing the PATH v...
Installing JDK and Python and setting the PATH variable on Windows 7
0.099668
0
0
2,880
6,147,225
2011-05-27T02:28:00.000
0
0
0
1
python,linux,pickle,data-storage
6,147,249
5
false
0
0
I'd use a database. A real one. This is why they exist (well, one of the reasons). Don't reinvent the wheel if you don't have to.
3
2
0
I have the need to create a system to store python data structures on a linux system but have concurrent read and write access to the data from multiple programs/daemons/scripts. My first thought is I would create a unix socket that would listen for connections and serve up requested data as pickled python data struct...
Storing Python data on a Linux system
0
0
0
170
6,147,225
2011-05-27T02:28:00.000
0
0
0
1
python,linux,pickle,data-storage
6,319,111
5
true
0
0
You could serialize the data structures and store them as values using ConfigParser. If you created your own access lib/module to the access the data, you could do the serialization in the lib so the client code would just send and receive python objects. You could also handle concurrency in the lib.
3
2
0
I have the need to create a system to store python data structures on a linux system but have concurrent read and write access to the data from multiple programs/daemons/scripts. My first thought is I would create a unix socket that would listen for connections and serve up requested data as pickled python data struct...
Storing Python data on a Linux system
1.2
0
0
170
6,147,225
2011-05-27T02:28:00.000
1
0
0
1
python,linux,pickle,data-storage
6,147,346
5
false
0
0
If you want to just store name/value pairs (e.g. filename to pickled data) you can always use Berkley DB (http://code.activestate.com/recipes/189060-using-berkeley-db-database/). If your data is numbers-oriented, you might want to check out PyTables (http://www.pytables.org/moin). If you really want to use sockets (I w...
3
2
0
I have the need to create a system to store python data structures on a linux system but have concurrent read and write access to the data from multiple programs/daemons/scripts. My first thought is I would create a unix socket that would listen for connections and serve up requested data as pickled python data struct...
Storing Python data on a Linux system
0.039979
0
0
170
6,147,461
2011-05-27T03:10:00.000
1
0
0
0
python,cgi
6,159,307
3
false
1
0
Probably the best approach to something like this to seperate your concerns. Make an ajax-drive "console" type display, that for instance will poll a log file, which is written to in the worker process.
1
1
0
I made a python application that I'd like to deploy to the web. I'm on a Mac, so I enabled the web server and dropped it in my cgi-bin, and it works fine. The problem is, the application does some intensive computations, and I would really like to let the user know what's going on while it's executing. Even though i ...
Python on the web: executing code as it's processed?
0.066568
0
0
971
6,147,504
2011-05-27T03:19:00.000
1
1
1
0
python,gzip,large-files,large-data-volumes,corpus
6,148,016
1
true
0
0
It would help to have an example of a few lines and expected output. But from what I understand, here are some ideas. You certainly don't want to process all files every time you process a single file or, worse, a single 4-gram. Ideally you'd go through each file once. So my first suggestion is to maintain an intermedi...
1
4
0
Unfortunately, I'm working with an extremely large corpus which is spread into hundreds of .gz files -- 24 gigabytes (packed) worth, in fact. Python is really my native language (hah) but I was wondering if I haven't run up against a problem that will necessitate learning a "faster" language? Each .gz file contains a s...
Python - Search for items in hundreds of large, gzipped files
1.2
0
0
433
6,149,263
2011-05-27T07:41:00.000
1
0
0
1
python,google-app-engine,bulkloader
6,153,856
1
true
1
0
I would do this: Add a property to my bulkuploader.yaml for the modified time and use a import transform to get the date?
1
1
0
How can I add a last modified time property to my entity kind that gets updated during a bulk upload? I'm currently using appcfg upload_data to upload a csv up to my high replication datastore. I plan to have this as a cron job to do a one-way sync from our internal database to datastore. In order to account for stale ...
How to upload current date/time into App Engine with Bulkloader tool?
1.2
0
0
389
6,149,611
2011-05-27T08:19:00.000
2
0
1
0
python,image,web-applications,resources
6,149,856
2
false
1
0
The images will be most likely cached by the system virtual memory unless you are running out of memory. In any case, it's common practice to always run webapps behind a fast webserver and let the webserver serve static images. The webapp could simply send the img tags to the browser, than the browser would load them f...
1
0
0
I implemented a python web app, which generates images dynamically using small pieces of images. Each time when user visit the page, a script runs and all small images are loaded from disc to generate big image. I think loading small images from disc is quite a big overhead. Is it possible to load all small images onc...
How to keep static resource in memory in python web app?
0.197375
0
0
150
6,151,335
2011-05-27T11:03:00.000
1
1
0
0
java,android,python,networking,binaryfiles
6,151,433
2
true
0
1
Just doing a HTTP POST containing data to a web server should do the job. This way you have a myriad of frameworks to choose from, which saves you from doing the dirty work of pushing bits back and forth. Sure, there is some overhead, but unless you have specific reasons to avoid that (which were not mentioned in the q...
1
2
0
I need to send a binary file (or a Bitmap object) from Android to a PC, which runs a Python script to receive it. Has anybody been in the same situation or has any hints, what could be best practice here? Options are sockets or Webservice (besides from workarounds with samba etc) I guess, but what is the easiest and f...
How to best send binary file from Android to Python script on PC?
1.2
0
0
490
6,151,975
2011-05-27T12:01:00.000
1
0
0
0
python,project,task,openerp
7,260,768
1
true
1
0
I think building a wizard is the only way that will work, because there isn't a real link between attachment and project.task. If I were you, I would build a wizard that walks the parent relation to build a list of all ancestor task ids, plus the current task id. Then have the wizard open the attachment window using th...
1
1
0
I'm using the project.task model where delegation creates a parent/child link between both. When delegating I would like the person who gets the delegated task to also have access to the attachments on the original task, how could I avoid to have to really copy it? I've thought about using an <act_window> or a wizard w...
Proper way of avoiding to store the same attachment twice
1.2
0
0
99
6,154,069
2011-05-27T14:59:00.000
1
0
0
0
python,sql,python-3.x,database-connection,python-module
6,193,973
3
false
0
0
I found a module called CEODBC that I was able to use with Python 3 after doing some research. It looks like they will also be releasing a Python3 compatible version of PYODBC soon. Thanks for all your help.
1
3
0
Can someone please point me in the right direction of how I can connect to MS SQL Server with Python? What I want to do is read a text file, extract some values and then insert the values from the text file into a table in my Sql Server database. I am using Python 3.1.3, and it seems some of the modules I have come acr...
Connecting to Sql Server with Python 3 in Windows
0.066568
1
0
8,530
6,154,409
2011-05-27T15:26:00.000
2
1
0
0
python,gsm,at-command
6,154,435
1
false
0
0
A practical solution would be to connect to SMS gateway service instead of implementing your own service. Nowadays they are really cheap or even free.
1
1
0
I am trying to send sms using python and a GSM modem connected to my local machine, I have successfully sent the SMS using AT commands but now I have a technical problem for which I need help, the server of my website is located in United States while I live in Australia, so if I want to use the SMS feature on actual s...
Sending SMS using Python
0.379949
0
0
1,660
6,157,367
2011-05-27T20:27:00.000
1
0
0
1
python,google-app-engine,pickle
6,157,563
3
true
1
0
Never mind. I just ran tests with both. It appears that you cannot use TextProperty with pickle. It will cause errors. Using it with BlobProperty, on the other hand, works perfectly.
2
2
0
In Google Appengine, I'm interested in pickling an object and storing it in the datastore. I don't need to index it. Is there any difference if I store it as a BlobProperty or TextProperty? Which one is better?
Appengine - Storing a Pickled in Datastore
1.2
0
0
853
6,157,367
2011-05-27T20:27:00.000
4
0
0
1
python,google-app-engine,pickle
6,157,457
3
false
1
0
BlobProperty can store binary data while TextProperty can store only strings. You can use BlobProperty as TextProperty is basicly a BlobProperty with encoding.
2
2
0
In Google Appengine, I'm interested in pickling an object and storing it in the datastore. I don't need to index it. Is there any difference if I store it as a BlobProperty or TextProperty? Which one is better?
Appengine - Storing a Pickled in Datastore
0.26052
0
0
853
6,157,845
2011-05-27T21:23:00.000
1
0
1
0
python
6,157,910
1
false
0
0
I am not sure if you can do it like that, as strptime will expect a format string and the format string does not allow for variable fields (as you'll need if you want the format to ignore the first number of the string) You could do something like this: datetime.strptime(the_string[1:7], "%y%m%d").strftime("%d.%m.%Y") ...
1
2
0
i have a bunch of strings like this: s = 3851102123 objective would be to extract the date from it in example: 85 is year 11 is month 02 is day basically string indexes 1,2 = year, 3,4 = month, 5,6 = day rest can be discarded, this is what i came up with: >> x = datetime.strptime("3851102123", ??) How would one extrac...
Using datetime.strptime to get date from string using python
0.197375
0
0
1,767
6,158,033
2011-05-27T21:46:00.000
8
1
0
0
php,python,memory-management,garbage-collection,webserver
6,208,958
1
true
0
0
PHP was designed as a hypertext scripting language. Every process was designed to end after a very short time. So memory management and GC basically didn't matter. However the ease and popularity of PHP have invoked its usage in long lived programs such as daemons, extensive calculations, socket servers etc. PHP 5.3 in...
1
9
0
What is the difference in how they are handled? Specifically, why is it common to find Python used in production-level long lived applications like web-servers while PHP isn't given their similar efficiency levels?
How is memory management in PHP different from that in Python?
1.2
0
0
1,270
6,158,439
2011-05-27T22:58:00.000
1
0
0
0
python,user-interface,pygtk,glade,gtkbuilder
6,201,626
1
true
0
1
PyGTK bridges GTK+ to Python, so you need all three. Glade is an application to edit XML files. You'll definitely want it. To read those files you can use either libglade (separate, deprecated) or GtkBuilder (built into GTK+, and therefore PyGTK).
1
0
0
Okay, I'm just starting to get into creating GUIs with python and I'm a bit confused as how how I should go forward: Should I download PyGTK or the current version of GTK+ if I'm using Python or does it matter? Concerning GUI builders, from what people are saying, it seems like GTKbuilder is better to use than Glade...
simple questions about PyGTK, GTKbuilder, GTK+
1.2
0
0
255
6,158,907
2011-05-28T00:36:00.000
7
0
1
0
python,sequences,value-type,reference-type
6,159,699
3
false
0
0
The answer above is correct, but I object to the semantics of "reference". C-like languages treat variables as fixed buckets, in which values are placed. When you call a function, a new set of buckets are created, and the values are copied into them. Sometimes, a bucket is pass-by-reference, and actually becomes an a...
1
28
0
I assumed sequence types in Python were value types. It turns out they're reference types (Meaning that the value of a variable won't be copied when assigned to a new variable, but referenced). So now I'm wondering, what are the value types in Python? That is, what types in Python can I assign to new variables without ...
What does Python treat as reference types?
1
0
0
17,731
6,159,015
2011-05-28T01:02:00.000
0
0
1
0
python
6,159,048
4
false
0
0
I've used lgrind in the past for pretty-printed source output; I was pleased with it, but the Ubuntu Description field for lgrind suggests using the listings tool from texlive-latex-recommended package instead.
1
2
0
I need to print a python source code on a paper. What is the easiest way to do that from the shell.
How do I print a python code on paper
0
0
0
3,323
6,159,053
2011-05-28T01:13:00.000
1
1
1
0
python,macos,memory-management
6,159,207
4
false
0
0
you can use os.getpid() to get your current PID and then use that PID to find the process in the output of a subprocess calling top/free/ps etc. i'm not an OSX/BSD expert, so im unsure of the flags to which command will give you memory usage by process
1
7
0
Are there any methods in (C)Python to inspect the process' current memory usage? In particular, I'd like to determine the high-water mark of memory usage in a testing script, but if necessary I don't mind periodically checking memory usage and calculating the high water mark for myself. EDIT: I'm looking for either a p...
Is it possible to get a "high water mark" of memory usage from Python?
0.049958
0
0
7,123
6,159,173
2011-05-28T01:47:00.000
1
1
0
0
python,ping,geo,geoip
6,159,184
2
false
0
0
Call all the service API instances and use which ever responds quickest.
1
2
0
I've been thinking about how to implement mirror picking in Python. When I call on service API I get response with IP address. Now I want to take that address and check if it's close to me or not. If not, retry. I thought about pinging, as I have only ~1ms ping to the IP addresses hosted in same data center, but much h...
How to choose closest/fastest mirror in Python?
0.099668
0
1
881
6,159,619
2011-05-28T04:20:00.000
1
0
1
0
python,oop,class,variables
6,159,630
2
false
0
0
If you pass the Map to the Player at init this just passes a reference, not a copy. You will not create redundant instances of Map this way, and it's the best way to do it.
2
0
0
I've got a class named Player and there will be 200-300 instances of this class. There is a function within this class called Move and this function requires knowledge of the map. I also have a class named Map with 1-2 instances. What is the best way to feed an instance of Map into the Player instances? I just ask beca...
Python: Best way to access variable from within a class instance?
0.099668
0
0
146
6,159,619
2011-05-28T04:20:00.000
1
0
1
0
python,oop,class,variables
6,159,648
2
false
0
0
Nothing in Python is ever implicitly copied. Whenever you do x = y, whether that's a function call or a variable/element/attribute assignment, x and y afterwards refer to the same object. I see two pitfalls with your plan, though: Would the map also know about the players? If so, you'll have a lot of circular refere...
2
0
0
I've got a class named Player and there will be 200-300 instances of this class. There is a function within this class called Move and this function requires knowledge of the map. I also have a class named Map with 1-2 instances. What is the best way to feed an instance of Map into the Player instances? I just ask beca...
Python: Best way to access variable from within a class instance?
0.099668
0
0
146
6,159,666
2011-05-28T04:35:00.000
1
0
0
1
python,google-app-engine
6,164,669
4
false
1
0
Keys in App Engine are based on: The keys of the ancestor entities of the entity, if any. The kind name of the entity. Either an auto-generated integer id or a user-assigned key_name. The integer IDs are allocated in generally-increasing blocks to various instances of the application, so that they can be guaranteed to...
1
3
0
If you guys ever used Google App Engine. It generates a key for every single instance of a model created. It's pretty neat. I'm looking into building something like that. Do they do it so that the key is based on the content? Or do they just take a random choice from a-zA-Z0-9 for like 50 times and build a string out o...
Key generation in Google App Engine
0.049958
0
0
421
6,160,942
2011-05-28T10:02:00.000
1
0
1
0
python,parsing,optimization,text-parsing
6,161,102
3
false
0
0
First thing which comes in my mind is that you should use re.compile() to prepare all the regex. But I guess this is already done! Another thing to consider may be hierarchical processing: Depending on the type of regex you have they could be organized hierarchical. This way you could pre-filter the lines and only feed...
1
1
0
Set of lines need to be parsed with set of different named regexes. Every line is passed through every regex until match is found. When match is found code should return/yield (named regex,value) pairs for each line. Files are 2GB+ size so I am looking for some ideas for improving speed of my parsers. Currently code ...
looking for practical solutions for optimizing text parsing speed with python
0.066568
0
0
1,699
6,161,548
2011-05-28T12:09:00.000
0
0
0
1
python,ssh,fabric
6,161,754
6
false
0
0
I'm just going to answer the SSH part: Yes, you can set up a double tunnel -- one SSH from local to A that tunnels from a secondary local port (like 2121) to port 21 on B, and then you can SSH to localhost:2121 and login on B. I've done stuff like that with PuTTY. Implementing that in fabric is left as an exercise.
1
18
0
Situation: A and B are remote hosts. Local machine can SSH into A, but not B. B ONLY accepts SSH connections from A. Question: Is it possible to use fabric on the local machine to execute commands on Host B, preferably without having to install fabric on A?
fabric: how to double tunnel
0
0
0
6,837
6,162,827
2011-05-28T16:14:00.000
0
0
0
0
python,sql
6,162,872
1
false
0
0
You should provide more information like you SQL and database schema. It sounds like you are trying to insert items with the same primary key. If you remove the primary key you should be able to insert the data, or change the insert statement to not insert the field which is the primary key.
1
0
0
I have to write up a python program that communicates with a My SQL database to write in data... I have done the code however it does not enter all the data as it says there are duplicates... is there a way to just inclue them?
Is there a way to write into python code a command to include duplicate entries into a My SQL database
0
1
0
38
6,163,087
2011-05-28T17:04:00.000
2
0
0
1
python,shell,command-line
6,163,126
6
false
0
0
Add a shebang: as the top line of the file: #!/usr/bin/python or #!/usr/bin/python3 (you can use the python -B to prevent generation of .pyc files, which is why I don't use /usr/bin/env) Make it executable: You will need to do chmod +x app.py (optional) Add directory to path, so can call it anywhere: Add a directory wi...
2
6
0
When I want to run my python applications from commandline (under ubuntu) I have to be in the directory where is the source code app.py and run the application with command python app.py How can I make it (how is it conventionally done) to run the application from arbitrary directory with the command: app ? Similarly a...
Turn an application or script into a shell command
0.066568
0
0
3,763
6,163,087
2011-05-28T17:04:00.000
0
0
0
1
python,shell,command-line
6,163,117
6
false
0
0
I'm pretty sure you have to make the script executable via chmod +x and put it in the PATH variable of your system.
2
6
0
When I want to run my python applications from commandline (under ubuntu) I have to be in the directory where is the source code app.py and run the application with command python app.py How can I make it (how is it conventionally done) to run the application from arbitrary directory with the command: app ? Similarly a...
Turn an application or script into a shell command
0
0
0
3,763