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
1,236,285
2009-08-05T23:34:00.000
46
0
0
0
python,django,debugging,testing,stdout
1,239,545
5
true
1
0
Checked TEST_RUNNER in settings.py, it's using a project-specific runner that calls out to Nose. Nose has the -s option to stop it from capturing stdout, but if I run: ./manage.py test -s manage.py captures it first and throws a "no such option" error. The help for manage.py doesn't mention this, but I found that if I run: ./manage.py test -- -s it ignores the -s and lets me capture it on the custom runner's side, passing it to Nose without a problem.
2
54
0
When I run tests with ./manage.py test, whatever I send to the standard output through print doesn't show. When tests fail, I see an "stdout" block per failed test, so I guess Django traps it (but doesn't show it when tests pass).
How do I see stdout when running Django tests?
1.2
0
0
33,876
1,236,285
2009-08-05T23:34:00.000
4
0
0
0
python,django,debugging,testing,stdout
1,236,326
5
false
1
0
You probably have some intermediate test runner, such as Nose, intercepting and storing stdout. Try either running the Django tests directly, or write to stderr instead.
2
54
0
When I run tests with ./manage.py test, whatever I send to the standard output through print doesn't show. When tests fail, I see an "stdout" block per failed test, so I guess Django traps it (but doesn't show it when tests pass).
How do I see stdout when running Django tests?
0.158649
0
0
33,876
1,237,126
2009-08-06T05:32:00.000
0
0
0
1
python,google-app-engine,cron,scheduled-tasks
1,237,224
1
false
1
0
"fetch" your OWN url (on appspot.com probably, but, who cares -- use a relative url anywau1-), not google.com, the homepage of the search engine -- what's that got to do w/your app anyway?!-)...
1
0
0
I want to add a scheduled task to fetch a URL via cron job using google app engine. I am continuously getting a failure. I am just fetching www.google.com. Why is the url fetch failing? Am I missing something?
Cron job python Google App Engine
0
0
0
1,453
1,237,200
2009-08-06T06:08:00.000
1
0
1
0
.net,vba,com,vb6,ironpython
1,237,238
2
true
0
0
You need to generate a Runtime COM Wrapper assembly using the tlbimp tool, and add a reference to that; languages which support .net attributes can do the interoperation explicitly, but even there, autogenerating the wrapper is far simpler. Inspecting the wrapper assembly in ildasm will show exactly how the conversion has been performed.
2
2
0
I'm currently developing what is more or less a script that needs to get some data from a VB 6 COM dll. This dll is currently used in a MS Word VBA project, and it exports classes, etc to the VBA code. It is added in the Tools -> References menu in the VBA editor, and I can see it's classes in the object browser of VBA. From my readings, it is possible to use a VB6 COM library in VB.NET (or at least, it is supposed to be able to.) As it should be possible in VB.NET, and since .NET runs on the CLR, and since IronPython does to, logically, can't i access this ancient DLL from IronPython? I have tried import clr; clr.AddReferenceToFileAndPath(dllpath) in IronPython, but keep getting 'IOError: file does not exist', which is clearly false. If anyone can point me to using a VB6 COM object in /any/ .NET language, that would be greatly appreciated. Thanks! PS: No, I can't edit / view source of the COM DLL, it's 3rd party proprietary stuff. PPS: Any way I can get the GUID / COM 'name; of the dll?
How can I use a VB6 COM 'reference' in IronPython?
1.2
0
0
559
1,237,200
2009-08-06T06:08:00.000
0
0
1
0
.net,vba,com,vb6,ironpython
1,237,242
2
false
0
0
In any .NET language (in Visual Studio, not sure if IronPython has full language support there, or if it only runs on the CLR with .NET Framework?) you simply go to the Add Reference dialog, select the COM tab, select the library (much like in the VB6/VBA references dialog) and you're basically done. VisualStudio then generates a .NET interop assembly for you that is the middle man to the COM library and you can just use it as if it were a .NET assembly. If IronPython is supported in VisualStudio, that's probably what you should do. If not, then you need to find out which commandline tool VisualStudio uses to generate the interop assembly (a bit like WSDL.EXE which it uses when you add a web reference), use that tool to manually generate the interop assembly and use that from IronPython as you would do with any other .NET assembly. I don't have any specifics for you right now without checking Google/MSDN, as I only do C# work inside VisualStudio, so I've never actually needed this myself yet.
2
2
0
I'm currently developing what is more or less a script that needs to get some data from a VB 6 COM dll. This dll is currently used in a MS Word VBA project, and it exports classes, etc to the VBA code. It is added in the Tools -> References menu in the VBA editor, and I can see it's classes in the object browser of VBA. From my readings, it is possible to use a VB6 COM library in VB.NET (or at least, it is supposed to be able to.) As it should be possible in VB.NET, and since .NET runs on the CLR, and since IronPython does to, logically, can't i access this ancient DLL from IronPython? I have tried import clr; clr.AddReferenceToFileAndPath(dllpath) in IronPython, but keep getting 'IOError: file does not exist', which is clearly false. If anyone can point me to using a VB6 COM object in /any/ .NET language, that would be greatly appreciated. Thanks! PS: No, I can't edit / view source of the COM DLL, it's 3rd party proprietary stuff. PPS: Any way I can get the GUID / COM 'name; of the dll?
How can I use a VB6 COM 'reference' in IronPython?
0
0
0
559
1,237,602
2009-08-06T08:26:00.000
-1
0
0
0
python,django,django-models
1,237,762
2
false
1
0
My initial instinct when reading this was that you need to overload the save method on the model, and use the os.rename() method, but that causes a lot of overhead, and is just generally a hassle from start to finish. If you simply want to rename the file, but don't want to make any physical changes to it (resizing, duplicating, etc.), then I'd definitely recommend the approach arcanum suggests above.
1
8
0
I'm uploading images (represented by a FileField) and I need to rename those files when they are uploaded. I want them to be formated like that: "%d-%d-%s.%s" % (width, height, md5hash, original_extension) I've read the documentation but I don't know if I need to write my own FileSystemStorage class or my own FileField class or ... ? Everything is so linked I don't know where to start.
Choose the filename of an uploaded file with Django
-0.099668
0
0
7,557
1,238,606
2009-08-06T12:39:00.000
113
0
1
0
python,python-3.x
1,238,632
2
true
0
0
You don't need to inherit from object to have new style in python 3. All classes are new-style.
1
105
0
In older Python versions when you create a class, it can inherit from object which is as far I understand a special built-in Python element that allows your class to be a new-style class. What about newer versions (> 3.0 and 2.6)? I googled about the object class but I get so many results (for obvious reasons).
Is it necessary or useful to inherit from Python's object in Python 3.x?
1.2
0
0
24,895
1,241,148
2009-08-06T20:16:00.000
13
0
1
0
python,constructor,copy
1,241,241
8
false
0
0
For your situation, I would suggest writing a class method (or it could be a static method or a separate function) that takes as an argument an instance of the library's class and returns an instance of your class with all applicable attributes copied over.
1
111
0
Is there a copy constructor in python ? If not what would I do to achieve something similar ? The situation is that I am using a library and I have extended one of the classes there with extra functionality and I want to be able to convert the objects I get from the library to instances of my own class.
Copy constructor in python?
1
0
0
81,359
1,241,758
2009-08-06T21:58:00.000
0
0
0
0
python,database,database-design,file-io
1,241,784
4
false
0
0
Are you likely to need all rows in order or will you want only specific known rows? If you need to read all the data there isn't much advantage to having it in a database. edit: If the code fits in memory then a simple CSV is fine. Plain text data formats are always easier to deal with than opaque ones if you can use them.
3
0
1
I'm developing an app that handle sets of financial series data (input as csv or open document), one set could be say 10's x 1000's up to double precision numbers (Simplifying, but thats what matters). I plan to do operations on that data (eg. sum, difference, averages etc.) as well including generation of say another column based on computations on the input. This will be between columns (row level operations) on one set and also between columns on many (potentially all) sets at the row level also. I plan to write it in Python and it will eventually need a intranet facing interface to display the results/graphs etc. for now, csv output based on some input parameters will suffice. What is the best way to store the data and manipulate? So far I see my choices as being either (1) to write csv files to disk and trawl through them to do the math or (2) I could put them into a database and rely on the database to handle the math. My main concern is speed/performance as the number of datasets grows as there will be inter-dataset row level math that needs to be done. -Has anyone had experience going down either path and what are the pitfalls/gotchas that I should be aware of? -What are the reasons why one should be chosen over another? -Are there any potential speed/performance pitfalls/boosts that I need to be aware of before I start that could influence the design? -Is there any project or framework out there to help with this type of task? -Edit- More info: The rows will all read all in order, BUT I may need to do some resampling/interpolation to match the differing input lengths as well as differing timestamps for each row. Since each dataset will always have a differing length that is not fixed, I'll have some scratch table/memory somewhere to hold the interpolated/resampled versions. I'm not sure if it makes more sense to try to store this (and try to upsample/interploate to a common higher length) or just regenerate it each time its needed.
Store data series in file or database if I want to do row level math operations?
0
1
0
581
1,241,758
2009-08-06T21:58:00.000
0
0
0
0
python,database,database-design,file-io
1,241,787
4
false
0
0
What matters most if all data will fit simultaneously into memory. From the size that you give, it seems that this is easily the case (a few megabytes at worst). If so, I would discourage using a relational database, and do all operations directly in Python. Depending on what other processing you need, I would probably rather use binary pickles, than CSV.
3
0
1
I'm developing an app that handle sets of financial series data (input as csv or open document), one set could be say 10's x 1000's up to double precision numbers (Simplifying, but thats what matters). I plan to do operations on that data (eg. sum, difference, averages etc.) as well including generation of say another column based on computations on the input. This will be between columns (row level operations) on one set and also between columns on many (potentially all) sets at the row level also. I plan to write it in Python and it will eventually need a intranet facing interface to display the results/graphs etc. for now, csv output based on some input parameters will suffice. What is the best way to store the data and manipulate? So far I see my choices as being either (1) to write csv files to disk and trawl through them to do the math or (2) I could put them into a database and rely on the database to handle the math. My main concern is speed/performance as the number of datasets grows as there will be inter-dataset row level math that needs to be done. -Has anyone had experience going down either path and what are the pitfalls/gotchas that I should be aware of? -What are the reasons why one should be chosen over another? -Are there any potential speed/performance pitfalls/boosts that I need to be aware of before I start that could influence the design? -Is there any project or framework out there to help with this type of task? -Edit- More info: The rows will all read all in order, BUT I may need to do some resampling/interpolation to match the differing input lengths as well as differing timestamps for each row. Since each dataset will always have a differing length that is not fixed, I'll have some scratch table/memory somewhere to hold the interpolated/resampled versions. I'm not sure if it makes more sense to try to store this (and try to upsample/interploate to a common higher length) or just regenerate it each time its needed.
Store data series in file or database if I want to do row level math operations?
0
1
0
581
1,241,758
2009-08-06T21:58:00.000
2
0
0
0
python,database,database-design,file-io
1,245,169
4
true
0
0
"I plan to do operations on that data (eg. sum, difference, averages etc.) as well including generation of say another column based on computations on the input." This is the standard use case for a data warehouse star-schema design. Buy Kimball's The Data Warehouse Toolkit. Read (and understand) the star schema before doing anything else. "What is the best way to store the data and manipulate?" A Star Schema. You can implement this as flat files (CSV is fine) or RDBMS. If you use flat files, you write simple loops to do the math. If you use an RDBMS you write simple SQL and simple loops. "My main concern is speed/performance as the number of datasets grows" Nothing is as fast as a flat file. Period. RDBMS is slower. The RDBMS value proposition stems from SQL being a relatively simple way to specify SELECT SUM(), COUNT() FROM fact JOIN dimension WHERE filter GROUP BY dimension attribute. Python isn't as terse as SQL, but it's just as fast and just as flexible. Python competes against SQL. "pitfalls/gotchas that I should be aware of?" DB design. If you don't get the star schema and how to separate facts from dimensions, all approaches are doomed. Once you separate facts from dimensions, all approaches are approximately equal. "What are the reasons why one should be chosen over another?" RDBMS slow and flexible. Flat files fast and (sometimes) less flexible. Python levels the playing field. "Are there any potential speed/performance pitfalls/boosts that I need to be aware of before I start that could influence the design?" Star Schema: central fact table surrounded by dimension tables. Nothing beats it. "Is there any project or framework out there to help with this type of task?" Not really.
3
0
1
I'm developing an app that handle sets of financial series data (input as csv or open document), one set could be say 10's x 1000's up to double precision numbers (Simplifying, but thats what matters). I plan to do operations on that data (eg. sum, difference, averages etc.) as well including generation of say another column based on computations on the input. This will be between columns (row level operations) on one set and also between columns on many (potentially all) sets at the row level also. I plan to write it in Python and it will eventually need a intranet facing interface to display the results/graphs etc. for now, csv output based on some input parameters will suffice. What is the best way to store the data and manipulate? So far I see my choices as being either (1) to write csv files to disk and trawl through them to do the math or (2) I could put them into a database and rely on the database to handle the math. My main concern is speed/performance as the number of datasets grows as there will be inter-dataset row level math that needs to be done. -Has anyone had experience going down either path and what are the pitfalls/gotchas that I should be aware of? -What are the reasons why one should be chosen over another? -Are there any potential speed/performance pitfalls/boosts that I need to be aware of before I start that could influence the design? -Is there any project or framework out there to help with this type of task? -Edit- More info: The rows will all read all in order, BUT I may need to do some resampling/interpolation to match the differing input lengths as well as differing timestamps for each row. Since each dataset will always have a differing length that is not fixed, I'll have some scratch table/memory somewhere to hold the interpolated/resampled versions. I'm not sure if it makes more sense to try to store this (and try to upsample/interploate to a common higher length) or just regenerate it each time its needed.
Store data series in file or database if I want to do row level math operations?
1.2
1
0
581
1,241,797
2009-08-06T22:07:00.000
8
1
1
0
python,benchmarking,fft
1,241,961
3
false
0
0
I would recommend numpy library, I not sure if it's the fastest implementation that exist but but surely it's one of best scientific module on the "market".
1
5
0
Taking speed as an issue it may be better to choose another language, but what is your library/module/implementation of choice for doing a 1D fast Fourier transform (FFT) in Python?
What is the recommended Python module for fast Fourier transforms (FFT)?
1
0
0
2,655
1,241,813
2009-08-06T22:11:00.000
14
0
0
0
python,django,binary
1,248,531
3
false
1
0
Oh, again that old one... Simply stated, you can't deploy an application in a non-compiled language (Python, Perl, PHP, Ruby...) in a source-safe way - all existing tricks are extremely easy to circumvent. Anyway, that doesn't matter at all: the contract you have with your customer does. Even for Java there are neat decompilers. If your customer wants to redeploy by hand your application on another machine, he could anyway even if the application was in C. Unless you wrote a dongle-protected anti-piracy scheme? Come on. You have to build a relation with your client. This is a social, commercial and legal problem that can't be solved with a technical stunt.
2
14
0
is there possible only to deploy binary version of web application based on django , no source code publish? Thanks
django binary (no source code) deployment
1
0
0
7,256
1,241,813
2009-08-06T22:11:00.000
3
0
0
0
python,django,binary
1,248,511
3
false
1
0
No, there isn't a reliable to do this at the moment. Even compiled code like referenced in the answer above this one isn't 100% secure. My advice: clean open code for your clients and a good relation with them is the only way to go. Keeping your code hidden can be good from a business point of view but from a client relation point of view it's a real show stopper. Advertise: "Our code is open!", which doesn't mean your clients can do anything they want with it.
2
14
0
is there possible only to deploy binary version of web application based on django , no source code publish? Thanks
django binary (no source code) deployment
0.197375
0
0
7,256
1,242,541
2009-08-07T02:03:00.000
2
0
0
0
python,gtk,colors,pygtk
1,242,550
1
true
0
1
If you're running on a system that uses a palette display (as opposed to a true-colour display), then you must allocate new colours in the palette before you can use them. This is because palette-based displays can only display a limited number of colours at once (usually 256 or sometimes 65536). Most displays these days are capable of true colour display, which can display all available colours simultaneously, so this won't appear to be a problem and you can get away with directly asking for specific colours.
1
1
0
Various examples always use alloc_color() and stuff like gtk.color.parse('red'), etc. I just do gtk.gdk.Color(65535,0,0), and that seems to work. What's the need for alloc_color?
What's the point of alloc_color() in gtk?
1.2
0
0
236
1,244,784
2009-08-07T13:46:00.000
0
0
1
0
python,setuptools
1,245,527
4
false
0
0
If you are packaging something to be installed on Debian (as implied), the best way to manage dependencies is to package your program as a .deb and express the dependencies the Debian way. (Note, PIL is available in Debian as python-imaging.)
3
0
0
For instance, what if PIL, python-rsvg and libev3 are dependencies of the program? These dependencies are not in pypi index, the latter two are Debian package names.
How to write a setup.py for a program that depends on packages outside pypi
0
0
0
1,505
1,244,784
2009-08-07T13:46:00.000
2
0
1
0
python,setuptools
1,244,867
4
true
0
0
Simply don't put them in your dependencies and document that in your INSTALL or README.
3
0
0
For instance, what if PIL, python-rsvg and libev3 are dependencies of the program? These dependencies are not in pypi index, the latter two are Debian package names.
How to write a setup.py for a program that depends on packages outside pypi
1.2
0
0
1,505
1,244,784
2009-08-07T13:46:00.000
0
0
1
0
python,setuptools
1,246,840
4
false
0
0
Since the setup.py is Python code too, you just can download and run the setup.py on those packages.
3
0
0
For instance, what if PIL, python-rsvg and libev3 are dependencies of the program? These dependencies are not in pypi index, the latter two are Debian package names.
How to write a setup.py for a program that depends on packages outside pypi
0
0
0
1,505
1,244,897
2009-08-07T14:06:00.000
-7
0
1
1
python,windows,linux,console,ncurses
1,244,980
5
false
0
0
develop two interfaces for your program, a text console ui and a graphical ui. Make the console one work only on linux. Nobody on windows uses text console apps.
1
24
0
I'm looking into developing a console application in python which should be able to run under Windows as well as Linux. For this, I'd really like to use a high-level console library like curses. However, as far as I know, curses is not available on Windows. What other options do I have? Unfortunately, using cygwin under Windows is not an option... Thanks for your help!
curses-like library for cross-platform console app in python
-1
0
0
13,292
1,245,818
2009-08-07T16:48:00.000
3
1
0
1
python
1,245,828
4
false
0
0
Rename it to *.pyw to hide the console on execution in Windows.
1
2
0
I have a python script which I can run from pythonwin on which I give the arguments. Is it possible to automate this so that when I just click on the *.py file, I don't see the script and it asks for the path in a dos window?
Run Python script without opening Pythonwin
0.148885
0
0
6,240
1,245,907
2009-08-07T17:08:00.000
2
0
1
0
python,readline
1,245,925
3
true
0
0
I don't know of any existing code for the task, but if I were to do this I'd catch the exception, try adding a fake trailing quote, and see how shlex.split does with the string thus modified.
1
1
0
I've written a simple shell-like program that uses readline in order to provide smart completion of arguments. I would like the mechanism to support arguments that have spaces and are quoted to signify as one argument (as with providing the shell with such). I've seen that shlex.split() knows how to parse quoted arguments, but in case a user wants to complete mid-typing it fails (for example: 'complete "Hello ' would cause an exception to be thrown when passed to shlex, because of unbalanced quotes). Is there code for doing this? Thanks!
Handling lines with quotes using python's readline
1.2
0
0
954
1,246,131
2009-08-07T17:51:00.000
2
0
0
0
python,audio,compression
1,334,217
6
false
1
0
You may use ctypes module to call functions directly from dynamic libraries. It doesn't require you to install external Python libs and it has better performance than command line tools, but it's usually harder to implement (plus of course you need to provide external library).
2
21
0
I'm trying to find a Python library that would take an audio file (e.g. .ogg, .wav) and convert it into mp3 for playback on a webpage. Also, any thoughts on setting its quality for playback would be great. Thank you.
Python library for converting files to MP3 and setting their quality
0.066568
0
1
51,200
1,246,131
2009-08-07T17:51:00.000
1
0
0
0
python,audio,compression
1,246,816
6
false
1
0
Another option to avoid installing Python modules for this simple task would be to just exec "lame" or other command line encoder from the Python script (with the popen module.)
2
21
0
I'm trying to find a Python library that would take an audio file (e.g. .ogg, .wav) and convert it into mp3 for playback on a webpage. Also, any thoughts on setting its quality for playback would be great. Thank you.
Python library for converting files to MP3 and setting their quality
0.033321
0
1
51,200
1,246,235
2009-08-07T18:12:00.000
-1
0
0
1
python,arm,embedded
4,729,963
2
false
0
0
I suggest using SQLite. I have an application running Python+SQLite for telemetry purposes and it works like a charm. It's much easier than MySQL.
1
0
0
I have an application where a small embedded ARM9 device (running Linux) must gather information from sensors and then connect to a remote mySQL database and INSERT the data. I have Python 2.5 running on the ARM9 device fine. I have developed a prototype application in Python 2.5 running on x86 Windows and it connects with mySQL and INSERTS just fine. My confusion in this issue come from working with "mySQL Connect/C" which would have to be cross compiled for the ARM processor before being used. What is the best way to port or move this DB app onto the ARM device? Are there underlying x86 binaries in supporting libraries that must be cross compiled? Or, is MySQLdb simply portable across platforms?
Python/mySQL on an Embedded ARM9 Device?
-0.099668
0
0
1,766
1,246,552
2009-08-07T19:27:00.000
1
0
0
0
python,windows,gtk,pygtk
1,247,303
3
false
0
1
Gtk provides function gtk_status_icon_position_menu that can be passed into gtk_menu_popup as a GtkPositionFunc. This seems to provide the requested functionality.
2
4
0
I am assisting with Windows support for a PyGTK app that appears as a system tray applet, but am not so strong on the GTK+ gooey stuff... We have it so when you left-click the systray icon, the window appears right by your tray icon no matter where your system tray is--and on Linux this works great, using the results of gtk.StatusIcon.get_geometry() to calculate the size and position. Of course, the docs for gtk.StatusIcon.get_geometry() point out that "some platforms do not provide this information"--and this includes MS Windows, as I get NoneType as the result. I can make a guess and position the window in the bottom-right corner of the screen, 30 pixels up from the bottom--as this will catch the majority of Windows users who haven't moved the taskbar. But for those that have, it looks all wrong. So is there a Windows-friendly way to get the position of the systray icon so I can place my window there? Please note: I am already using gtk_menu_popup() with gtk_status_icon_position_menu for a pop-up menu which works correctly. But what I am trying to position is a separate gtk.Window, which will not accept gtk_status_icon_position_menu (because it's not a menu). Any other ideas would be appreciated...
Getting the position of the gtk.StatusIcon on Windows
0.066568
0
0
1,237
1,246,552
2009-08-07T19:27:00.000
0
0
0
0
python,windows,gtk,pygtk
1,874,016
3
false
0
1
The behavior i experienced in windows with gtk_status_icon_position_menu was that it spawns the window at the location the user clicked in the statusicon
2
4
0
I am assisting with Windows support for a PyGTK app that appears as a system tray applet, but am not so strong on the GTK+ gooey stuff... We have it so when you left-click the systray icon, the window appears right by your tray icon no matter where your system tray is--and on Linux this works great, using the results of gtk.StatusIcon.get_geometry() to calculate the size and position. Of course, the docs for gtk.StatusIcon.get_geometry() point out that "some platforms do not provide this information"--and this includes MS Windows, as I get NoneType as the result. I can make a guess and position the window in the bottom-right corner of the screen, 30 pixels up from the bottom--as this will catch the majority of Windows users who haven't moved the taskbar. But for those that have, it looks all wrong. So is there a Windows-friendly way to get the position of the systray icon so I can place my window there? Please note: I am already using gtk_menu_popup() with gtk_status_icon_position_menu for a pop-up menu which works correctly. But what I am trying to position is a separate gtk.Window, which will not accept gtk_status_icon_position_menu (because it's not a menu). Any other ideas would be appreciated...
Getting the position of the gtk.StatusIcon on Windows
0
0
0
1,237
1,247,486
2009-08-07T23:43:00.000
16
0
1
0
python,list-comprehension,map-function
1,247,531
14
false
0
0
I find list comprehensions are generally more expressive of what I'm trying to do than map - they both get it done, but the former saves the mental load of trying to understand what could be a complex lambda expression. There's also an interview out there somewhere (I can't find it offhand) where Guido lists lambdas and the functional functions as the thing he most regrets about accepting into Python, so you could make the argument that they're un-Pythonic by virtue of that.
2
878
0
Is there a reason to prefer using map() over list comprehension or vice versa? Is either of them generally more efficient or considered generally more pythonic than the other?
List comprehension vs map
1
0
0
283,077
1,247,486
2009-08-07T23:43:00.000
19
0
1
0
python,list-comprehension,map-function
24,108,573
14
false
0
0
If you plan on writing any asynchronous, parallel, or distributed code, you will probably prefer map over a list comprehension -- as most asynchronous, parallel, or distributed packages provide a map function to overload python's map. Then by passing the appropriate map function to the rest of your code, you may not have to modify your original serial code to have it run in parallel (etc).
2
878
0
Is there a reason to prefer using map() over list comprehension or vice versa? Is either of them generally more efficient or considered generally more pythonic than the other?
List comprehension vs map
1
0
0
283,077
1,247,501
2009-08-07T23:47:00.000
0
0
0
0
python,django
1,247,506
4
false
1
0
Then I thought it might be a DNS issue, but the site loads instantly when served with Apache2. How are you serving your Django site? I presume you're running mod_python on Apache2? You may want to start by running an Apache2 locally on you computer (use MAMP or WAMP and install mod_python there) and seeing if it's still slow. Then you can tell whether it's a django/python issue or an Apache/mod_python issue
3
2
0
I have a slowness problem with Django and I can't find the source .. I'm not sure what I'm doing wrong, but at least twice while working on projects Django became really slow. Requests takes age to complete (~15 seconds) and Validating model when starting the development server is also very slow (12+ seconds on a quad core..) I've tried many solution found on the net for similar problem, but they don't seem related to me. The problem doesn't seem to come from Django's development server since the request are also very slow on the production server with apache and mod_python. Then I thought it might be a DNS issue, but the site loads instantly when served with Apache2. I tried to strace the development server, but I didn't find anything interesting. Even commenting all the apps (except django apps) didn't change anything.. models still take age to validate. I really don't know where I should be looking now .. Anybody has an idea ?
django extreme slowness
0
0
0
3,386
1,247,501
2009-08-07T23:47:00.000
0
0
0
0
python,django
1,247,774
4
false
1
0
I've once used remote edit to develop my Django site. The validating process seem to be very slow too. But, everything else is fine not like yours. It's come from the webserver can't add/change .pyc in that directory.
3
2
0
I have a slowness problem with Django and I can't find the source .. I'm not sure what I'm doing wrong, but at least twice while working on projects Django became really slow. Requests takes age to complete (~15 seconds) and Validating model when starting the development server is also very slow (12+ seconds on a quad core..) I've tried many solution found on the net for similar problem, but they don't seem related to me. The problem doesn't seem to come from Django's development server since the request are also very slow on the production server with apache and mod_python. Then I thought it might be a DNS issue, but the site loads instantly when served with Apache2. I tried to strace the development server, but I didn't find anything interesting. Even commenting all the apps (except django apps) didn't change anything.. models still take age to validate. I really don't know where I should be looking now .. Anybody has an idea ?
django extreme slowness
0
0
0
3,386
1,247,501
2009-08-07T23:47:00.000
0
0
0
0
python,django
1,248,504
4
false
1
0
If the validating models takes forever don't search for anything else. On a dual core some of my largest enterprise applications (+30 models) take less then a second to validate. The problem must lie somewhere with your models but without source code it's hard to tell what the problem is. Kind regards, Michael Open Source Consultant
3
2
0
I have a slowness problem with Django and I can't find the source .. I'm not sure what I'm doing wrong, but at least twice while working on projects Django became really slow. Requests takes age to complete (~15 seconds) and Validating model when starting the development server is also very slow (12+ seconds on a quad core..) I've tried many solution found on the net for similar problem, but they don't seem related to me. The problem doesn't seem to come from Django's development server since the request are also very slow on the production server with apache and mod_python. Then I thought it might be a DNS issue, but the site loads instantly when served with Apache2. I tried to strace the development server, but I didn't find anything interesting. Even commenting all the apps (except django apps) didn't change anything.. models still take age to validate. I really don't know where I should be looking now .. Anybody has an idea ?
django extreme slowness
0
0
0
3,386
1,247,921
2009-08-08T03:51:00.000
1
0
0
0
python,graphics,sprite,pygame
1,247,984
4
false
0
1
you might consider switching to using png images where you can do any kind of transparency you want directly in the image.
1
4
0
I've just started working with pygame and I'm trying to make a semi-transparent sprite, and the sprite's source file is a non-transparent bitmap file loaded from the disk. I don't want to edit the source image if I can help it. I'm sure there's a way to do this with pygame code, but Google is of no help to me.
How to make translucent sprites in pygame
0.049958
0
0
7,546
1,250,086
2009-08-08T22:57:00.000
1
0
0
1
java,python,audio,mp3
5,060,666
4
false
1
0
One (somehow pretentious) idea: record a mute (silent) mp3 in bitrate that your mp3 is. Then, copy all the frames from original mp3 up to the point when you want your silence to start. Then, copy as much muted frames you need from your 'silence file'. Then, copy the rest from the original file. You'll have muted file without re-encoding the file!
1
5
0
I'm trying to write a batch process that can take an MP3 file and mute certain parts of it, ideally in Python or Java. Take this example: Given a 2 minute MP3, I want to mute the time between 1:20 and 1:30. When saved back to a file, the rest of the MP3 will play normally -- only that portion will be silent. Any advice for setting this up in a way that's easy to automate/run on the command line would be fantastic!
Manipulate MP3 programmatically: Muting certain parts?
0.049958
0
0
1,648
1,250,295
2009-08-09T01:02:00.000
1
0
1
0
python,ide
1,273,578
6
false
0
0
In contrast to the other answers i think that IDE's are very important especially for script languages. Almost all code is bad documentated and an IDE with a good debugger gives you much insides about what is really going on what datatypes are assigned to this values. Is this a hash of lists of hashes or a list of hashs of hashs. And the easy documentation lookup will save you time. But this is only important for people who need to count there time, this normally excludes beginners or hobbyists.
4
5
0
I'm a beginning Python programmer, just getting my feet wet in the language and its tools and native practices. In the past, I've used languages that were tightly integrated into IDEs, and indeed I had never before considered that it was even possible to program outside of such a tool. However, much of the documentation and tutorials for Python eschew any sort of IDE, relying instead on powerful editors and interactive interpreters for writing and teaching the language. How important is an IDE to normal Python development? Are there good IDEs available for the language? If you do use an IDE for Python, how do you use it effectively?
What is the importance of an IDE when programming in Python?
0.033321
0
0
1,921
1,250,295
2009-08-09T01:02:00.000
0
0
1
0
python,ide
1,252,287
6
false
0
0
(1) IDEs are less important than for other languages, but if you find one that is useful, it still makes things easier. Without IDEs -- what are doing? Always running Python from command line? (2-3) On my Mac there's included IDLE which I keep always open for its Python shell (it's colored unlike the one in Terminal) and I use free Komodo Edit which I consider to be well-suited for Python as it doesn't go into the language deeply but rather focuses on coloring, tab management, parsing Python output, running frequent commands etc.
4
5
0
I'm a beginning Python programmer, just getting my feet wet in the language and its tools and native practices. In the past, I've used languages that were tightly integrated into IDEs, and indeed I had never before considered that it was even possible to program outside of such a tool. However, much of the documentation and tutorials for Python eschew any sort of IDE, relying instead on powerful editors and interactive interpreters for writing and teaching the language. How important is an IDE to normal Python development? Are there good IDEs available for the language? If you do use an IDE for Python, how do you use it effectively?
What is the importance of an IDE when programming in Python?
0
0
0
1,921
1,250,295
2009-08-09T01:02:00.000
4
0
1
0
python,ide
1,250,429
6
false
0
0
A matter of habit and personal preferences. Me, I use vim (I have to admit emacs is at least as powerful, but my fingers are deeply trained by over 30 years of vi, and any other editor gives me the jitters, especially when it tries to imitate vi and never really manages to get it 100% right;-), occasionally an interactive environment (python itself, sometimes ipython), and on even rarer occasions a debugger (pdb). A good editor gives me all I need in term of word completion, lookup, &c. I've tried Eclipse, its plugins, eric, and Kommodo, but I just don't like them -- Wing, I think I could get used to, and I have to admit its debugger is absolutely out of this world... but, I very rarely use (or need!) advanced debugging functionality, so after every rare occasion I'd forget, and have to learn it all over again a few months later when the need arose again... nah!-)
4
5
0
I'm a beginning Python programmer, just getting my feet wet in the language and its tools and native practices. In the past, I've used languages that were tightly integrated into IDEs, and indeed I had never before considered that it was even possible to program outside of such a tool. However, much of the documentation and tutorials for Python eschew any sort of IDE, relying instead on powerful editors and interactive interpreters for writing and teaching the language. How important is an IDE to normal Python development? Are there good IDEs available for the language? If you do use an IDE for Python, how do you use it effectively?
What is the importance of an IDE when programming in Python?
0.132549
0
0
1,921
1,250,295
2009-08-09T01:02:00.000
3
0
1
0
python,ide
1,250,364
6
false
0
0
How important is an IDE to normal Python development? Not very, IMHO. It's a lightweight language with much less boilerplate and simpler idioms than in some other languages, so there's less need for an IDE for that part. The standard interactive interpreter provides help and introspection functionality and a reasonable debugger (pdb). When I want a graphical look at my class hierarchies, I use epydoc to generate it. The only IDE-like functionality I sometimes wish I had is something that would help automate refactoring. Are there good IDEs available for the language? So I hear. Some of my coworkers use Wing. If you do use an IDE for Python, how do you use it effectively? N/A. I tried using Wing a few times but found that it interfered with my normal development process rather than supporting it.
4
5
0
I'm a beginning Python programmer, just getting my feet wet in the language and its tools and native practices. In the past, I've used languages that were tightly integrated into IDEs, and indeed I had never before considered that it was even possible to program outside of such a tool. However, much of the documentation and tutorials for Python eschew any sort of IDE, relying instead on powerful editors and interactive interpreters for writing and teaching the language. How important is an IDE to normal Python development? Are there good IDEs available for the language? If you do use an IDE for Python, how do you use it effectively?
What is the importance of an IDE when programming in Python?
0.099668
0
0
1,921
1,250,437
2009-08-09T02:46:00.000
1
0
0
1
python,google-app-engine,model-view-controller,google-cloud-datastore
1,251,369
2
false
1
0
If you roll your own user model, you're going to need to do your own session handling as well; the App Engine Users API creates login sessions for you behind the scenes. Also, while this should be obvious, you shouldn't store the user's password in plaintext; store an SHA-1 hash and compare it to a hash of the user's submitted password when they login.
1
4
0
How does one handle logging in and out/creating users, without using Google Users? I'd like a few more options then just email and password. Is it just a case of making a user model with the fields I need? Is that secure enough? Alternatively, is there a way to get the user to log in using the Google ID, but without being redirected to the actual Google page?
Creating alternative login to Google Users for Google app engine
0.099668
0
0
928
1,250,739
2009-08-09T05:31:00.000
1
0
0
0
python,twisted,pygame,pyro
1,255,178
3
false
0
0
I've nothing against Twisted and PyRo, but the sort of simple messages you're going to be sending don't require anything like that and might be overcomplicated by using some sort of framework. Pickling an object and sending it over a socket is actually a very easy operation and well worth trying, even if you do eventually go with a more heavyweight framework. Don't fear the network!
1
3
0
I am making a simple multiplayer economic game in pygame. It consists of turns of a certain length, at the end of which, data is sent to the central server. A few quick calculations are done on the data and the results are sent back to the players. My question is how I should implement the network support. I was looking at Twisted and at Pyro and any suggestions or advice would be appreciated.
Network Support for Pygame
0.066568
0
0
3,753
1,251,260
2009-08-09T12:04:00.000
3
0
1
1
python,windows,user-interface
1,251,275
3
false
0
0
I would recommend that you use IronPython, which is Microsoft's implementation of Python for the .NET framework.
1
1
0
What would be the optimal way to develop a basic graphical application for Windows based on a Python console script? It would be great if the solution could be distributed as a standalone directory, containing the .exe file.
Writing Windows GUI applications with embedded Python scripts
0.197375
0
0
1,987
1,252,357
2009-08-09T21:40:00.000
36
0
1
0
python
1,252,369
4
false
0
0
That's what "is" is for. Instead of testing "if a == b", which tests for the same value, test "if a is b", which will test for the same identifier.
2
94
0
This would be similar to the java.lang.Object.hashcode() method. I need to store objects I have no control over in a set, and make sure that only if two objects are actually the same object (not contain the same values) will the values be overwritten.
Is there an object unique identifier in Python
1
0
0
90,732
1,252,357
2009-08-09T21:40:00.000
2
0
1
0
python
1,252,386
4
false
0
0
As ilya n mentions, id(x) produces a unique identifier for an object. But your question is confusing, since Java's hashCode method doesn't give a unique identifier. Java's hashCode works like most hash functions: it always returns the same value for the same object, two objects that are equal always get equal codes, and unequal hash values imply unequal hash codes. In particular, two different and unequal objects can get the same value. This is confusing because cryptographic hash functions are quite different from this, and more like (though not exactly) the "unique id" that you asked for. The Python equivalent of Java's hashCode method is hash(x).
2
94
0
This would be similar to the java.lang.Object.hashcode() method. I need to store objects I have no control over in a set, and make sure that only if two objects are actually the same object (not contain the same values) will the values be overwritten.
Is there an object unique identifier in Python
0.099668
0
0
90,732
1,253,232
2009-08-10T05:29:00.000
-1
1
0
0
java,python,.net,ruby,perl
2,274,406
16
false
0
0
GTK, originally in C. Ported to Java, Python, Ruby, C++, and most every other common language you can think of.
3
10
0
Since I am working with different Platforms and programming languages, I found there are many good libraries that are ported with different programming language than its original. For example JUnit and Log4j which has been ported into several different languages. Sometimes if I am already used to working with these libraries, I would find the ported version for it if I'm working with another programming language. What are other libraries that you have found been ported to different languages and as good as the original? Please make it one library per answer so others can vote. Format: Original-Library-Name, Original-Programming-Language Ported-Library-Name, Ported-Programming-Language If possible with the links to the website of the libraries.
Which libraries have been ported to different programming languages?
-0.012499
0
0
1,282
1,253,232
2009-08-10T05:29:00.000
3
1
0
0
java,python,.net,ruby,perl
1,269,650
16
false
0
0
Java,Java C#, .NET Ohh com'on, just kidding, ok, down vote me now!
3
10
0
Since I am working with different Platforms and programming languages, I found there are many good libraries that are ported with different programming language than its original. For example JUnit and Log4j which has been ported into several different languages. Sometimes if I am already used to working with these libraries, I would find the ported version for it if I'm working with another programming language. What are other libraries that you have found been ported to different languages and as good as the original? Please make it one library per answer so others can vote. Format: Original-Library-Name, Original-Programming-Language Ported-Library-Name, Ported-Programming-Language If possible with the links to the website of the libraries.
Which libraries have been ported to different programming languages?
0.037482
0
0
1,282
1,253,232
2009-08-10T05:29:00.000
2
1
0
0
java,python,.net,ruby,perl
1,253,957
16
false
0
0
Hibernate, Java NHibernate, .NET
3
10
0
Since I am working with different Platforms and programming languages, I found there are many good libraries that are ported with different programming language than its original. For example JUnit and Log4j which has been ported into several different languages. Sometimes if I am already used to working with these libraries, I would find the ported version for it if I'm working with another programming language. What are other libraries that you have found been ported to different languages and as good as the original? Please make it one library per answer so others can vote. Format: Original-Library-Name, Original-Programming-Language Ported-Library-Name, Ported-Programming-Language If possible with the links to the website of the libraries.
Which libraries have been ported to different programming languages?
0.024995
0
0
1,282
1,253,905
2009-08-10T09:26:00.000
3
0
0
0
python,network-programming
1,254,288
4
false
0
0
Python is a mature language that can do almost anything that you can do in C/C++ (even direct memory access if you really want to hurt yourself). You'll find that you can write beautiful code in it in a very short time, that this code is readable from the start and that it will stay readable (you will still know what it does even after returning one year later). The drawback of Python is that your code will be somewhat slow. "Somewhat" as in "might be too slow for certain cases". So the usual approach is to write as much as possible in Python because it will make your app maintainable. Eventually, you might run into speed issues. That would be the time to consider to rewrite a part of your app in C. The main advantages of this approach are: You already have a running application. Translating the code from Python to C is much more simple than write it from scratch. You already have a running application. After the translation of a small part of Python to C, you just have to test that small part and you can use the rest of the app (that didn't change) to do it. You don't pay a price upfront. If Python is fast enough for you, you'll never have to do the optional optimization. Python is much, much more powerful than C. Every line of Python can do the same as 100 or even 1000 lines of C.
2
4
0
I am considering programming the network related features of my application in Python instead of the C/C++ API. The intended use of networking is to pass text messages between two instances of my application, similar to a game passing player positions as often as possible over the network. Although the python socket modules seems sufficient and mature, I want to check if there are limitations of the python module which can be a problem at a later stage of the development. What do you think of the python socket module : Is it reliable and fast enough for production quality software ? Are there any known limitations which can be a problem if my app. needs more complex networking other than regular client-server messaging ? Thanks in advance, Paul
Suggestion Needed - Networking in Python - A good idea?
0.148885
0
1
1,015
1,253,905
2009-08-10T09:26:00.000
1
0
0
0
python,network-programming
1,253,945
4
false
0
0
To answer #1, I know that among other things, EVE Online (the MMO) uses a variant of Python for their server code.
2
4
0
I am considering programming the network related features of my application in Python instead of the C/C++ API. The intended use of networking is to pass text messages between two instances of my application, similar to a game passing player positions as often as possible over the network. Although the python socket modules seems sufficient and mature, I want to check if there are limitations of the python module which can be a problem at a later stage of the development. What do you think of the python socket module : Is it reliable and fast enough for production quality software ? Are there any known limitations which can be a problem if my app. needs more complex networking other than regular client-server messaging ? Thanks in advance, Paul
Suggestion Needed - Networking in Python - A good idea?
0.049958
0
1
1,015
1,254,028
2009-08-10T09:58:00.000
6
0
0
1
python,google-app-engine
1,255,893
2
false
1
0
There are a few issues with using Python 2.6 with the SDK, mostly related to the SDK's sandboxing, which is designed to imitate the sandbox limitations in production. Note, of course, that even if you get Python 2.6 running with the SDK, your code will still have to run under 2.5 in production.
1
9
0
Since Python 2.6 is backward compatible to 2.52 , did anyone succeeded in using it with Google app Engine ( which supports 2.52 officially ). I know i should try it myself. But i am a python and web-apps new bee and for me installation and configuration is the hardest part while getting started with something new in this domain. ( .... I am trying it myself in the meanwhile ....) Thanks
Has anyone succeeded in using Google App Engine with Python version 2.6?
1
0
0
3,409
1,254,469
2009-08-10T11:55:00.000
7
0
1
0
python,optparse
1,254,500
5
false
0
0
And if you need programmatic access to the default values, you can get to them via the defaults attribute of the parser (it's a dict)
1
43
0
Is there a way to make Python's optparse print the default value of an option or flag when showing the help with --help?
Can Python's optparse display the default value of an option?
1
0
0
4,633
1,254,802
2009-08-10T13:13:00.000
0
1
0
0
php,python
1,256,684
3
false
1
0
I've done this in the past by serving the PHP portions directly via Apache. You could either put them in with your media files, (/site_media/php/) or if you prefer to use something more lightweight for your media server (like lighttpd), you can set up another portion of the site that goes through apache with PHP enabled. From there, you can either take the ajax route in your templates, or you can load the PHP from your views using urllib(2) or httplib(2). Better yet, wrap the urllib2 call in a templatetag, and call that in your templates.
1
2
0
I'm trying to integrate an old PHP ad management system into a (Django) Python-based web application. The PHP and the Python code are both installed on the same hosts, PHP is executed by mod_php5 and Python through mod_wsgi, usually. Now I wonder what's the best way to call this PHP ad management code from within my Python code in a most efficient manner (the ad management code has to be called multiple times for each page)? The solutions I came up with so far, are the following: Write SOAP interface in PHP for the ad management code and write a SOAP client in Python which then calls the appropriate functions. The problem I see is, that will slow down the execution of the Python code considerably, since for each page served, multiple SOAP client requests are necessary in the background. Call the PHP code through os.execvp() or subprocess.Popen() using PHP command line interface. The problem here is that the PHP code makes use of the Apache environment ($_SERVER vars and other superglobals). I'm not sure if this can be simulated correctly. Rewrite the ad management code in Python. This will probably be the last resort. This ad management code just runs and runs, and there is no one remaining who wrote a piece of code for this :) I'd be quite afraid to do this ;) Any other ideas or hints how this can be done? Thanks.
Call PHP code from Python
0
0
0
3,234
1,254,819
2009-08-10T13:16:00.000
7
0
0
0
python,textbox,wxpython,wxwidgets
1,254,881
1
true
0
1
wx.StaticText You could also use a regular TextCtrl with the style TE_READONLY but that shows a cursor and the text looks editable, but it isn't.
1
5
0
How to create a non-editable text box with no cursor in wxPython to dump text in?
Non-editable text box in wxPython
1.2
0
0
4,502
1,257,264
2009-08-10T21:16:00.000
3
0
0
0
java,python,sockets
1,257,332
2
false
1
0
You've got to tell us what type of object you're working with. I'm assuming you're talking about a socket read. Either you read the socket with blocking or you read without blocking. You can measure how you have just read in a non-blocking read, if you are interested in that. However, it sounds like you are trying to bend python into a java.io style stream-buffer paradigm that it just doesn't support in detail.
1
2
0
Java's InputStream provides a method named available which returns the number of bytes that can be read without blocking. How can I achieve this in Python?
What's Python's equivalent to Java InputStream's available method?
0.291313
0
0
2,424
1,261,875
2009-08-11T17:36:00.000
22
0
1
0
python,closures,global,python-nonlocal
4,359,041
9
false
0
0
It takes the one "closest" to the point of reference in the source code. This is called "Lexical Scoping" and is standard for >40 years now. Python's class members are really in a dictionary called __dict__ and will never be reached by lexical scoping. If you don't specify nonlocal but do x = 7, it will create a new local variable "x". If you do specify nonlocal, it will find the "closest" "x" and assign to that. If you specify nonlocal and there is no "x", it will give you an error message. The keyword global has always seemed strange to me since it will happily ignore all the other "x" except for the outermost one.
2
428
0
What does the Python nonlocal statement do (in Python 3.0 and later)? There's no documentation on the official Python website and help("nonlocal") does not work, either.
Python nonlocal statement
1
0
0
147,059
1,261,875
2009-08-11T17:36:00.000
2
0
1
0
python,closures,global,python-nonlocal
6,939,750
9
false
0
0
My personal understanding of the "nonlocal" statement (and do excuse me as I am new to Python and Programming in general) is that the "nonlocal" is a way to use the Global functionality within iterated functions rather than the body of the code itself. A Global statement between functions if you will.
2
428
0
What does the Python nonlocal statement do (in Python 3.0 and later)? There's no documentation on the official Python website and help("nonlocal") does not work, either.
Python nonlocal statement
0.044415
0
0
147,059
1,263,756
2009-08-12T01:01:00.000
0
0
0
0
python,ruby-on-rails,django,dashboard,filemaker
1,264,058
4
false
1
0
Both of these technologies are certainly mature enough to run Mission Critical applications, you just need to look at the number of big sites already on the internet that are running these technologies, so from that point of view you shouldn't be concerned. You only need to worry about your learning curve, if you feel confident in learning them well enough to write quality code for your client then go for it. Have a look at each of them, decide which technology you would prefer and get coding. Hope your application goes well :)
4
1
0
I'm about to start a fairly large project for a mid-sized business with a lot of integration with other systems (POS, accounting, website, inventory, purchasing, etc.) The purpose of the system is to try to reduce current data siloing and give employees role-based access to the specific data entry and reports they need, as well as to replace some manual and redundant business processes. The system needs to be cross-platform (Windows/Linux), open source and is primarily for LAN use. My experience is mostly PHP/web/app development, but I have developed a few LAN apps using Java/Servoy (like Filemaker). I found Servoy to be very rapid and to easily make use of different data providers (DB products), but it's not open source, and any non-standard development is in Java/Swing (which is verbose and takes a lot of time). I'm interested in learning Python/Django or Ruby/Rails - but I'm not sure if these are the best solutions for building a mission critical data entry/reporting LAN app. Is a web client/server really a good choice for this type of application? Thanks in advance for any tips/ advice.
technology recommendation for LAN Dashboard
0
0
0
706
1,263,756
2009-08-12T01:01:00.000
0
0
0
0
python,ruby-on-rails,django,dashboard,filemaker
1,265,425
4
false
1
0
You could also take a look at ExtJS for the frontend. I've made an ExtJS frontend for a company Dashboard, and using a Django backend managing the URL dispatching, the ORM and the data retrieval (communicating with the frontend with JSON webservices) and users love it, because it's almost as interactive as a local application (use something modern like Firefox 3.5, Chrome, Safari 4 or Explorer 8 for better javascript performance) but easy to manage for programmers and administrators (no installations, no local backups, no upgrade problems, etc.)
4
1
0
I'm about to start a fairly large project for a mid-sized business with a lot of integration with other systems (POS, accounting, website, inventory, purchasing, etc.) The purpose of the system is to try to reduce current data siloing and give employees role-based access to the specific data entry and reports they need, as well as to replace some manual and redundant business processes. The system needs to be cross-platform (Windows/Linux), open source and is primarily for LAN use. My experience is mostly PHP/web/app development, but I have developed a few LAN apps using Java/Servoy (like Filemaker). I found Servoy to be very rapid and to easily make use of different data providers (DB products), but it's not open source, and any non-standard development is in Java/Swing (which is verbose and takes a lot of time). I'm interested in learning Python/Django or Ruby/Rails - but I'm not sure if these are the best solutions for building a mission critical data entry/reporting LAN app. Is a web client/server really a good choice for this type of application? Thanks in advance for any tips/ advice.
technology recommendation for LAN Dashboard
0
0
0
706
1,263,756
2009-08-12T01:01:00.000
1
0
0
0
python,ruby-on-rails,django,dashboard,filemaker
1,263,768
4
false
1
0
If you're comfortable with a LAMP-style stack with PHP, then there's no reason you can't use either Django or Rails. Both are mature, well documented platforms with active, helpful communities. Based on what you've described, there's no reason that you can't use either technology.
4
1
0
I'm about to start a fairly large project for a mid-sized business with a lot of integration with other systems (POS, accounting, website, inventory, purchasing, etc.) The purpose of the system is to try to reduce current data siloing and give employees role-based access to the specific data entry and reports they need, as well as to replace some manual and redundant business processes. The system needs to be cross-platform (Windows/Linux), open source and is primarily for LAN use. My experience is mostly PHP/web/app development, but I have developed a few LAN apps using Java/Servoy (like Filemaker). I found Servoy to be very rapid and to easily make use of different data providers (DB products), but it's not open source, and any non-standard development is in Java/Swing (which is verbose and takes a lot of time). I'm interested in learning Python/Django or Ruby/Rails - but I'm not sure if these are the best solutions for building a mission critical data entry/reporting LAN app. Is a web client/server really a good choice for this type of application? Thanks in advance for any tips/ advice.
technology recommendation for LAN Dashboard
0.049958
0
0
706
1,263,756
2009-08-12T01:01:00.000
0
0
0
0
python,ruby-on-rails,django,dashboard,filemaker
1,275,182
4
true
1
0
Thank you everyone for your helpful answers! I think they address most of the issues raised by the question. But I think the key to the "final answer" (IMO) rests on the "multiple database" aspect. Railsninja suggested a piece of software he used for a project to extend rails functionality in this manner - thank you for the link! That could have been a possible solution - but it sounds like it was used for one project, and I worry about the testing since it is not a part of the mainstream Rails build. Then I found out that multi-db support is just around the corner for a Django core update (eta late August 2009). So I think I am going to dive in to the project with Django.
4
1
0
I'm about to start a fairly large project for a mid-sized business with a lot of integration with other systems (POS, accounting, website, inventory, purchasing, etc.) The purpose of the system is to try to reduce current data siloing and give employees role-based access to the specific data entry and reports they need, as well as to replace some manual and redundant business processes. The system needs to be cross-platform (Windows/Linux), open source and is primarily for LAN use. My experience is mostly PHP/web/app development, but I have developed a few LAN apps using Java/Servoy (like Filemaker). I found Servoy to be very rapid and to easily make use of different data providers (DB products), but it's not open source, and any non-standard development is in Java/Swing (which is verbose and takes a lot of time). I'm interested in learning Python/Django or Ruby/Rails - but I'm not sure if these are the best solutions for building a mission critical data entry/reporting LAN app. Is a web client/server really a good choice for this type of application? Thanks in advance for any tips/ advice.
technology recommendation for LAN Dashboard
1.2
0
0
706
1,264,421
2009-08-12T05:56:00.000
4
0
1
0
python,localization,multilingual,plone,linguaplone
1,264,656
1
true
0
0
Each language folder should implement INavigationRoot. You can set that up by going to the ZMI, finding the folder, and going to the Interfaces tab. There you will find plone.app.layout.navigation.interfaces.INavigationRoot. Click it, and navigation will treat it as the root of the tree. (Note that in Plone 3.3 the support for INavigationRoot has gotten better, so you may want to upgrade. -- edit by Maurits)
1
1
0
I am developing a multi-lingual site with Plone. I want to have one language per folder but the Plone navigation UI is causing problems. I have several different folders in my root, such as en, de, nl, etcetera. Inside those folders is the actual content, such as en/news, nl/nieuw, de/nachrichten, etcetera. I have set up Plone Language Tool to pick the language setting from the URL, but the navigation is not showing the correct items. The tabbed navigation is making tabs for the language folders. The path bar is showing "You are here: Home -> en -> news". How can I change the tabbed navigation and the path bar to show the items inside the language specific folder? I want to have a tab for "news", not for "en" on the English site. The path bar should show "You are here: Home -> news". I am using Plone 3.2.3 with Plone Language Tool 3.0.2 and LinguaPlone 2.4.
Plone navigation with one-language-per-folder site
1.2
0
0
797
1,265,599
2009-08-12T11:31:00.000
1
0
0
0
python,audio,wxpython,system-sounds
1,265,745
3
false
0
0
From the documentation: wxTopLevelWindow::RequestUserAttention void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO) Use a system-dependent way to attract users attention to the window when it is in background. flags may have the value of either wxUSER_ATTENTION_INFO (default) or wxUSER_ATTENTION_ERROR which results in a more drastic action. When in doubt, use the default value. Note that this function should normally be only used when the application is not already in foreground. This function is currently implemented for Win32 where it flashes the window icon in the taskbar, and for wxGTK with task bars supporting it.
1
0
0
How play standard system sounds from a Python script? I'm writing a GUI program in wxPython that needs to beep on events to attract user's attention, maybe there are functions in wxPython I can utilize?
System standard sound in Python
0.066568
0
0
995
1,265,821
2009-08-12T12:22:00.000
6
0
0
0
python,wxpython,size
1,265,988
1
true
0
1
For the width or height to be automatically determined based on context you use for it the value of -1, for example (-1, 100) for a height of 100 and automatic width. The default size for controls is usually (-1, -1). If a width or height is specified and the sizer item for the control doesn't have wx.EXPAND flag set (note that even if this flag is set some sizers won't expand in both directions by default) you might call it "locked" as it won't chage that dimension. Make sure to study the workings of sizers in depth as it is one of the most important things in GUI design.
1
2
0
How to change only hight of an object in wxPython, leaving its width automatic? In my case it's a TextCtrl. How to make the height of the window available for change and lock the width?
Changing height of an object in wxPython
1.2
0
0
258
1,268,252
2009-08-12T19:33:00.000
-1
0
1
0
python
1,270,886
10
false
0
0
Why not just use a database for the shared data? You have a multitude of lightweight options where you don't need to worry about the concurrency issues: sqlite, any of the nosql/key-value breed of databases, etc.
4
72
0
I have an xmlrpc server using Twisted. The server has a huge amount of data stored in-memory. Is it possible to have a secondary, separate xmlrpc server running which can access the object in-memory in the first server? So, serverA starts up and creates an object. serverB starts up and can read from the object in serverA. * EDIT * The data to be shared is a list of 1 million tuples.
Possible to share in-memory data between 2 separate processes?
-0.019997
0
0
67,200
1,268,252
2009-08-12T19:33:00.000
133
0
1
0
python
1,269,055
10
true
0
0
Without some deep and dark rewriting of the Python core runtime (to allow forcing of an allocator that uses a given segment of shared memory and ensures compatible addresses between disparate processes) there is no way to "share objects in memory" in any general sense. That list will hold a million addresses of tuples, each tuple made up of addresses of all of its items, and each of these addresses will have be assigned by pymalloc in a way that inevitably varies among processes and spreads all over the heap. On just about every system except Windows, it's possible to spawn a subprocess that has essentially read-only access to objects in the parent process's space... as long as the parent process doesn't alter those objects, either. That's obtained with a call to os.fork(), that in practice "snapshots" all of the memory space of the current process and starts another simultaneous process on the copy/snapshot. On all modern operating systems, this is actually very fast thanks to a "copy on write" approach: the pages of virtual memory that are not altered by either process after the fork are not really copied (access to the same pages is instead shared); as soon as either process modifies any bit in a previously shared page, poof, that page is copied, and the page table modified, so the modifying process now has its own copy while the other process still sees the original one. This extremely limited form of sharing can still be a lifesaver in some cases (although it's extremely limited: remember for example that adding a reference to a shared object counts as "altering" that object, due to reference counts, and so will force a page copy!)... except on Windows, of course, where it's not available. With this single exception (which I don't think will cover your use case), sharing of object graphs that include references/pointers to other objects is basically unfeasible -- and just about any objects set of interest in modern languages (including Python) falls under this classification. In extreme (but sufficiently simple) cases one can obtain sharing by renouncing the native memory representation of such object graphs. For example, a list of a million tuples each with sixteen floats could actually be represented as a single block of 128 MB of shared memory -- all the 16M floats in double-precision IEEE representation laid end to end -- with a little shim on top to "make it look like" you're addressing things in the normal way (and, of course, the not-so-little-after-all shim would also have to take care of the extremely hairy inter-process synchronization problems that are certain to arise;-). It only gets hairier and more complicated from there. Modern approaches to concurrency are more and more disdaining shared-anything approaches in favor of shared-nothing ones, where tasks communicate by message passing (even in multi-core systems using threading and shared address spaces, the synchronization issues and the performance hits the HW incurs in terms of caching, pipeline stalls, etc, when large areas of memory are actively modified by multiple cores at once, are pushing people away). For example, the multiprocessing module in Python's standard library relies mostly on pickling and sending objects back and forth, not on sharing memory (surely not in a R/W way!-). I realize this is not welcome news to the OP, but if he does need to put multiple processors to work, he'd better think in terms of having anything they must share reside in places where they can be accessed and modified by message passing -- a database, a memcache cluster, a dedicated process that does nothing but keep those data in memory and send and receive them on request, and other such message-passing-centric architectures.
4
72
0
I have an xmlrpc server using Twisted. The server has a huge amount of data stored in-memory. Is it possible to have a secondary, separate xmlrpc server running which can access the object in-memory in the first server? So, serverA starts up and creates an object. serverB starts up and can read from the object in serverA. * EDIT * The data to be shared is a list of 1 million tuples.
Possible to share in-memory data between 2 separate processes?
1.2
0
0
67,200
1,268,252
2009-08-12T19:33:00.000
2
0
1
0
python
1,270,922
10
false
0
0
Why not stick the shared data into memcache server? then both servers can access it quite easily.
4
72
0
I have an xmlrpc server using Twisted. The server has a huge amount of data stored in-memory. Is it possible to have a secondary, separate xmlrpc server running which can access the object in-memory in the first server? So, serverA starts up and creates an object. serverB starts up and can read from the object in serverA. * EDIT * The data to be shared is a list of 1 million tuples.
Possible to share in-memory data between 2 separate processes?
0.039979
0
0
67,200
1,268,252
2009-08-12T19:33:00.000
4
0
1
0
python
1,271,568
10
false
0
0
You could write a C library to create and manipulate shared-memory arrays for your specific purpose, and then use ctypes to access them from Python. Or, put them on the filesystem in /dev/shm (which is tmpfs). You'd save a lot of development effort for very little performance overhead: reads/writes from a tmpfs filesystem are little more than a memcpy.
4
72
0
I have an xmlrpc server using Twisted. The server has a huge amount of data stored in-memory. Is it possible to have a secondary, separate xmlrpc server running which can access the object in-memory in the first server? So, serverA starts up and creates an object. serverB starts up and can read from the object in serverA. * EDIT * The data to be shared is a list of 1 million tuples.
Possible to share in-memory data between 2 separate processes?
0.07983
0
0
67,200
1,269,242
2009-08-12T23:17:00.000
10
1
1
0
python,smalltalk
1,271,000
5
false
0
0
As someone new to smalltalk, the two things that really strike me are the image-based system, and that reflection is everywhere. These two simple facts appear to give rise to everything else cool in the system: The image means that you do everything by manipulating objects, including writing and compiling code Reflection allows you to inspect the state of any object. Since classes are objects and their sources are objects, you can inspect and manipulate code You have access to the current execution context, so you can have a look at the stack, and from there, compiled code and the source of that code and so on The stack is an object, so you can save it away and then resume later. Bingo, continuations! All of the above starts to come together in cool ways: The browser lets you explore the source of literally everything, including the VM in Squeak You can make changes that affect your live program, so there's no need to restart and navigate your way through to whatever you're working on Even better, when your program throws an exception you can debug the live code. You fix the bug, update the state if it's become inconsistent and then have your program continue. The browser will tell you if it thinks you've made a typo It's absurdly easy to browse up and down the class hierarchy, or find out what messages a object responds to, or which code sends a given message, or which objects can receive a given message You can inspect and manipulate the state of any object in the system You can make any two objects literally switch places with become:, which lets you do crazy stuff like stub out any object and then lazily pull it in from elsewhere if it's sent a message. The image system and reflection has made all of these perfectly natural and normal things for a smalltalker for about thirty years.
3
10
0
I'm studying Smalltalk right now. It looks very similar to python (actually, the opposite, python is very similar to Smalltalk), so I was wondering, as a python enthusiast, if it's really worth for me to study it. Apart from message passing, what are other notable conceptual differences between Smalltalk and python which could allow me to see new programming horizons ?
Differences between Smalltalk and python?
1
0
0
5,971
1,269,242
2009-08-12T23:17:00.000
7
1
1
0
python,smalltalk
1,269,259
5
false
0
0
Smalltalk historically has had an amazing IDE built in. I have missed this IDE on many languages. Smalltalk also has the lovely property that it is typically in a living system. You start up clean and start modifying things. This is basically an object persistent storage system. That being said, this is both good and bad. What you run is part of your system and part of what you ship. The system can be setup quite nicely before being distributed. The down side, is that the system has everything you run as part of what you ship. You need to be very careful packaging for redistribution. Now, that being said, it has been a while since I have worked with Smalltalk (about 20 years). Yes, I know, fun times for those who do the math. Smalltalk is a nice language, fun to program in, fun to learn, but I have found it a little hard to ship things in. Enjoy playing with it if you do. I have been playing with Python and loving it. Jacob
3
10
0
I'm studying Smalltalk right now. It looks very similar to python (actually, the opposite, python is very similar to Smalltalk), so I was wondering, as a python enthusiast, if it's really worth for me to study it. Apart from message passing, what are other notable conceptual differences between Smalltalk and python which could allow me to see new programming horizons ?
Differences between Smalltalk and python?
1
0
0
5,971
1,269,242
2009-08-12T23:17:00.000
2
1
1
0
python,smalltalk
1,269,266
5
false
0
0
The language aspect often isn't that important, and many languages are quite samey, From what I see, Python and Smalltalk share OOP ideals ... but are very different in their implementation and the power in the presented language interface. the real value comes in what the subtle differences in the syntax allows in terms of implementation. Take a look at Self and other meta-heavy languages. Look past the syntax and immediate semantics to what the subtle differences allow the implementation to do. For example: Everything in Smalltalk-80 is available for modification from within a running program What differences between Python and Smalltalk allow deeper maniplation if any? How does the language enable the implementation of the compiler/runtime?
3
10
0
I'm studying Smalltalk right now. It looks very similar to python (actually, the opposite, python is very similar to Smalltalk), so I was wondering, as a python enthusiast, if it's really worth for me to study it. Apart from message passing, what are other notable conceptual differences between Smalltalk and python which could allow me to see new programming horizons ?
Differences between Smalltalk and python?
0.07983
0
0
5,971
1,269,320
2009-08-12T23:44:00.000
-1
0
0
0
python,user-interface,image,gtk,pygtk
64,004,356
6
false
0
1
actually when we use gdk_pixbuf_scale_simple(pb,700,700,GDK_INTERP_BILINEAR); this function causes memory leakage (If we monitor task manager the memory requirement goes on increasing till it kills the process) when used with a timer event. How to solve that
1
22
0
In GTK, how can I scale an image? Right now I load images with PIL and scale them beforehand, but is there a way to do it with GTK?
Scale an image in GTK
-0.033321
0
0
18,745
1,270,403
2009-08-13T06:48:00.000
0
0
1
0
python,numeric
1,270,701
3
false
0
0
Don't think i really understood question: Do you mean that operation result should be explictly specified? you can do it with explict cast float(1+0.5) int(1+0.5) complex(1+0.5) Do you mean that operators should accept only same type operands? 1+2 1+0.5 -> raises exception 1+int(0.5) float(1)+0.5 while having sense, it would introduce too much verbosity and int->float casts are always successful and don't lead to precision loss (except really large numbers) Separate operands for different return types: 1 + 0.5 -> int 1 `float_plus` 2 -> float Duplicates explict cast functionality and is plain sick
2
0
0
A little background: I'm in the process of learning Python through O'Reilly's, "Learning Python" book, I've had some experience in Java. Anyway, upon reading Chapter 5 (I'm still in the middle of it, actually) I have come across a question with the way Python treats results of Mixed Numeric expressions. In the book, they use an example of mixing an integer and a floating-point number (40 + 3.14) and proceed to explain that the result of this expression would be a floating-point number because Python converts operands up to the type of the most complicated operand. My question is this: Instead of programmers having to remember which Numeric operand is the highest and remember that the that the result will be "upped" to that format, wouldn't it be simpler to create a special Numeric Literal for result types? My logic is this: If you have a decimal place in your expression, you know it's going to be a floating point number, if you have something like 3+4j, you know it's going to be a complex number. Why should you have to remember the hierarchy of Numeric Literals just to know what your result is going to be treated as? In my opinion, it seems like it would be a much simpler process to assign results to a single, uninformed Literal to know that regardless of whether or not the expression has Mixed Numerics, it will be treated as a specific Data Type. Follow up question: Is there a language where this kind of thing is currently being preformed? Again, my knowledge of Python is limited, so this may be a silly question, but I would like to know why programmers have to put themselves through this process. The only reason why I could imagine that there isn't a system of some kind in place already is that perhaps the specific Numeric Type of a result isn't as important as it is in some other languages (Java).
About Python's Mixed Numeric Data Types converting results up to the most complicated operand
0
0
0
585
1,270,403
2009-08-13T06:48:00.000
5
0
1
0
python,numeric
1,270,465
3
true
0
0
"If you have a decimal place in your expression, you know it's going to be a floating point number, if you have something like 3+4j, you know it's going to be a complex number." That is the "hierarchy of Numeric Literals". I'm not really sure what more you want. Furthermore, the result will always be a subclass of numbers.Number, so you actually do have some guarantee about what type the resulting object will be.
2
0
0
A little background: I'm in the process of learning Python through O'Reilly's, "Learning Python" book, I've had some experience in Java. Anyway, upon reading Chapter 5 (I'm still in the middle of it, actually) I have come across a question with the way Python treats results of Mixed Numeric expressions. In the book, they use an example of mixing an integer and a floating-point number (40 + 3.14) and proceed to explain that the result of this expression would be a floating-point number because Python converts operands up to the type of the most complicated operand. My question is this: Instead of programmers having to remember which Numeric operand is the highest and remember that the that the result will be "upped" to that format, wouldn't it be simpler to create a special Numeric Literal for result types? My logic is this: If you have a decimal place in your expression, you know it's going to be a floating point number, if you have something like 3+4j, you know it's going to be a complex number. Why should you have to remember the hierarchy of Numeric Literals just to know what your result is going to be treated as? In my opinion, it seems like it would be a much simpler process to assign results to a single, uninformed Literal to know that regardless of whether or not the expression has Mixed Numerics, it will be treated as a specific Data Type. Follow up question: Is there a language where this kind of thing is currently being preformed? Again, my knowledge of Python is limited, so this may be a silly question, but I would like to know why programmers have to put themselves through this process. The only reason why I could imagine that there isn't a system of some kind in place already is that perhaps the specific Numeric Type of a result isn't as important as it is in some other languages (Java).
About Python's Mixed Numeric Data Types converting results up to the most complicated operand
1.2
0
0
585
1,271,317
2009-08-13T11:09:00.000
0
0
0
0
python,windows,mapping,drive
20,201,066
7
false
0
0
I had trouble getting this line to work: win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK, drive, networkPath, None, user, password) But was successful with this: win32wnet.WNetAddConnection2(1, 'Z:', r'\UNCpath\share', None, 'login', 'password')
1
33
0
What is the best way to map a network share to a windows drive using Python? This share also requires a username and password.
What is the best way to map windows drives using Python?
0
0
1
68,179
1,271,631
2009-08-13T12:25:00.000
0
0
0
0
python,django,templates
1,271,873
6
false
1
0
You will need to add the DEBUG flag to your context_processors. There may not even be an alternative way. At least, none that I know of.
1
69
0
Do you know if it is possible to know in a django template if the TEMPLATE_DEBUG flag is set? I would like to disable my google analytics script when I am running my django app on my development machine. Something like a {% if debug %} template tag would be perfect. Unfortunately, I didn't find something like that in the documentation. For sure, I can add this flag to the context but I would like to know if there is a better way to do that.
How to check the TEMPLATE_DEBUG flag in a django template?
0
0
0
31,654
1,272,242
2009-08-13T14:17:00.000
4
0
0
1
python,windows,sysinternals
1,272,313
2
false
0
0
Yes you can put a UNC path in your %PATH% env variable, and it will work if you have access to that path with your current session.
1
1
0
I have a python script calling an exe file. The exe file can be in the same folder as that of the python script or in a network drive. Is it possible to call the exe if it is in a remote drive/computer? Can this be done by setting the %PATH% variable
Is it possible to add a network drive to %PATH% environment variable
0.379949
0
0
5,469
1,272,325
2009-08-13T14:29:00.000
2
1
0
0
python,cgi,mod-python
1,272,579
1
true
1
0
You could always write your own handler, which is the way mod_python is normally intended to be used. You would have to set some HTTP headers (and you could have a look at the publisher handler's source code for inspiration on that), but otherwise I don't think it's much more complicated than what you've been trying to do. Though as long as you're at it, I would suggest trying mod_wsgi instead of mod_python, which is probably eventually going to supersede mod_python. WSGI is a Python standard for writing web applications.
1
2
0
I'm looking for the simplest way of using python and SQLAlchemy to produce some XML for a jQuery based HTTP client. Right now I'm using mod_python's CGI handler but I'm unhappy with the fact that I can't persist stuff like the SQLAlchemy session. The mod_python publisher handler that is apparently capable of persisting stuff does not allow requests with XML content type (as used by jQuery's ajax stuff) so I can't use it. What other options are there?
Alternatives to mod_python's CGI handler
1.2
1
0
1,222
1,273,297
2009-08-13T17:03:00.000
0
1
0
0
python,twisted
1,273,455
3
false
0
0
I'd use a firewall on windows, or iptables on linux.
1
2
0
What would be the best method to restrict access to my XMLRPC server by IP address? I see the class CGIScript in web/twcgi.py has a render method that is accessing the request... but I am not sure how to gain access to this request in my server. I saw an example where someone patched twcgi.py to set environment variables and then in the server access the environment variables... but I figure there has to be a better solution. Thanks.
Python Twisted: restricting access by IP address
0
0
1
3,265
1,274,493
2009-08-13T20:50:00.000
2
1
1
0
php,python,operators,bitwise-operators
1,274,508
3
false
0
0
$n <<= 1; is valid php
2
1
0
I have the Python expression n <<= 1 How do you express this in PHP?
How can I write 'n <<= 1' (Python) in PHP?
0.132549
0
0
527
1,274,493
2009-08-13T20:50:00.000
5
1
1
0
php,python,operators,bitwise-operators
1,274,505
3
true
0
0
It's the same operator in php. $n <<= 1;
2
1
0
I have the Python expression n <<= 1 How do you express this in PHP?
How can I write 'n <<= 1' (Python) in PHP?
1.2
0
0
527
1,275,482
2009-08-14T00:47:00.000
1
0
0
0
python,pygame,sprite
1,296,881
3
true
0
1
Typically you will sacrifice either processor time or memory, and you need to balance between the two. Unless you've got some great limit to your processor or you're computing a lot of expensive stuff, there's no real reason to put all that into the memory. Rotating a few sprites with a transform is cheap enough that it is definitely not worth it to store 32x as much information in memory - especially because that information is a bunch of images, and images use up a lot of memory, relatively speaking.
2
2
0
I am working on a top-down view 2d game at the moment and I am learning a ton about sprites and sprite handling. My question is how to handle a set of sprites that can be rotated in as many as 32 directions. At the moment a given object has its sprite sheet with all of the animations oriented with the object pointing at 0 degrees at all times. Now, since the object can rotate in as many as 32 directions, what is the best way to work with that original sprite sheet. My current best guess is to have the program basically dynamically create 32 more sprite sheets when the object is first loaded into the game, and then all subsequent instances of that type of object will share those sprite sheets. Anyways, any advice in this regard would be helpful. Let me know if I need to rephrase the question, I know its kindof an odd one. Thanks Edit: I guess for more clarification. If I have, for instance an object that has 2 animations of 5 frames a peice, that is a pretty easy sprite sheet to create and organize, its a simple 2x5 grid (or 5x2 depending on how you lay it out). But the problem is that now those 2 animations have to be rotated in 32 directions. This means that in the end there will be 320 individual sprites. I am going to say that (and correct me if im wrong) since I'm concerned about performance and frame-rate, rotating the sprites on the fly every single frame is not an option. So, how should these 320 sprites that make up these 2 animations be organized? Would it be better to Think of it as 32 2x5 sprite sheets split the sprite sheet up into individual frames, and then have an array the 32 different directions per frame (so 10 arrays of 32 directional sprites) Other....? Doesn't matter? Thanks
What is the best way to handle rotating sprites for a top-down view game
1.2
0
0
1,381
1,275,482
2009-08-14T00:47:00.000
4
0
0
0
python,pygame,sprite
1,277,181
3
false
0
1
The 32 directions for the sprite translate into 32 rotations by 11.25 degrees. You can reduce the number of precalculated images to 8 you only calculate the first 90 degrees (11.25, 22.5, 33.75, 45.0, 56.25, 67.5, 78.75, 90.0) and use the flip operations dynamically. Flips are much faster because they essentially only change the order an image is copied from the buffer. For example, when you display an image that is rotated by 101.25 degrees, load the precalculated image of 67.5 degrees and flip it vertically. I just realized that this only works if your graphic is symmetrical ;-) When talking about a modern computer, you might not need to optimize anything. The memory used by precalculating the sprites is certainly negligible, and the cpu usage when rotating the image probably too. When you are programming for a embedded device however, it does matter.
2
2
0
I am working on a top-down view 2d game at the moment and I am learning a ton about sprites and sprite handling. My question is how to handle a set of sprites that can be rotated in as many as 32 directions. At the moment a given object has its sprite sheet with all of the animations oriented with the object pointing at 0 degrees at all times. Now, since the object can rotate in as many as 32 directions, what is the best way to work with that original sprite sheet. My current best guess is to have the program basically dynamically create 32 more sprite sheets when the object is first loaded into the game, and then all subsequent instances of that type of object will share those sprite sheets. Anyways, any advice in this regard would be helpful. Let me know if I need to rephrase the question, I know its kindof an odd one. Thanks Edit: I guess for more clarification. If I have, for instance an object that has 2 animations of 5 frames a peice, that is a pretty easy sprite sheet to create and organize, its a simple 2x5 grid (or 5x2 depending on how you lay it out). But the problem is that now those 2 animations have to be rotated in 32 directions. This means that in the end there will be 320 individual sprites. I am going to say that (and correct me if im wrong) since I'm concerned about performance and frame-rate, rotating the sprites on the fly every single frame is not an option. So, how should these 320 sprites that make up these 2 animations be organized? Would it be better to Think of it as 32 2x5 sprite sheets split the sprite sheet up into individual frames, and then have an array the 32 different directions per frame (so 10 arrays of 32 directional sprites) Other....? Doesn't matter? Thanks
What is the best way to handle rotating sprites for a top-down view game
0.26052
0
0
1,381
1,277,124
2009-08-14T10:22:00.000
-5
0
0
1
python,macos,shell,lxml,osx-leopard
1,277,175
15
false
0
0
I compile it in /usr/local without any issues whatsoever. Install Python, libxml2, libxslt and then lxml. You might need setuptools installed too.
2
36
0
I've tried this and run in to problems a bunch of times in the past. Does anyone have a recipe for installing lxml on OS X without MacPorts or Fink that definitely works? Preferably with complete 1-2-3 steps for downloading and building each of the dependencies.
How do you install lxml on OS X Leopard without using MacPorts or Fink?
-1
0
0
27,228
1,277,124
2009-08-14T10:22:00.000
1
0
0
1
python,macos,shell,lxml,osx-leopard
7,850,559
15
false
0
0
I had this working fine with Snow Lepoard but after I upgraded to Lion I had to symlink gcc-4.2 to gcc. Running sudo env ARCHFLAGS="-arch i386 -arch x86_64" easy_install lxml was looking for gcc-4.2 instead of gcc.
2
36
0
I've tried this and run in to problems a bunch of times in the past. Does anyone have a recipe for installing lxml on OS X without MacPorts or Fink that definitely works? Preferably with complete 1-2-3 steps for downloading and building each of the dependencies.
How do you install lxml on OS X Leopard without using MacPorts or Fink?
0.013333
0
0
27,228
1,278,664
2009-08-14T15:52:00.000
2
1
1
0
python,file
1,278,690
6
false
0
0
map "".join(line.split('.')[:-1]) to each line of the file.
1
1
0
Sequence 1.1.1 ATGCGCGCGATAAGGCGCTA ATATTATAGCGCGCGCGCGGATATATATATATATATATATT Sequence 1.2.2 ATATGCGCGCGCGCGCGGCG ACCCCGCGCGCGCGCGGCGCGATATATATATATATATATATT Sequence 2.1.1 ATTCGCGCGAGTATAGCGGCG NOW,I would like to remove the last digit from each of the line that starts with '>'. For example, in this first line, i would like to remove '.1' (rightmost) and in second instance i would like to remove '.2' and then write the rest of the file to a new file. Thanks,
How to eliminate last digit from each of the top lines
0.066568
0
0
336
1,279,244
2009-08-14T17:54:00.000
4
1
0
0
python,stringio,bytesio
1,279,251
2
true
0
0
In Python 2.x, "string" means "bytes", and "unicode" means "string". You should use the StringIO or cStringIO modules. The mode will depend on which kind of data you pass in as the buffer parameter.
1
1
0
Question: How do I get a byte stream that works like StringIO for Python 2.5? Application: I'm converting a PDF to text, but don't want to save a file to the hard disk. Other Thoughts: I figured I could use StringIO, but there's no mode parameter (I guess "String" implies text mode). Apparently the io.BytesIO class is new in v2.6, so that doesn't work for me either. I've got a solution with the tempfile module, but I'd like to avoid any reads/writes to/from the hard disk.
BytesIO with python v2.5
1.2
0
0
4,303
1,279,768
2009-08-14T19:35:00.000
1
0
0
0
python,artificial-intelligence,ocr,computer-vision
1,280,833
4
false
0
0
It's not as robust, but you can look at the colours of 3 or 4 locations on the card so that if they are white or if they are a color, you can determine which card and suit it is. Obviously this won't work if you don't always have the same cards.
3
11
0
I decided to do a project for fun where I want to take as input the image of a playing card and return its rank and suit. I figure that I only need look at the upper-left corner, since that has all the information. It should be robust - if I have a large image of an Ace of Diamonds, I should be able to scale it anywhere from 20 to 200% and still get the right answer. First question - is there anything already written that does this? If so I'll find something else to OCR so I don't duplicate the efforts. Second - what's the best way to go about doing this? Neural network? Something hand-coded? Can anyone give any pointers? (0xCAAF9452 is not an acceptable answer).
OCR Playing Cards
0.049958
0
0
8,932
1,279,768
2009-08-14T19:35:00.000
1
0
0
0
python,artificial-intelligence,ocr,computer-vision
1,288,332
4
false
0
0
Given the limited sample size (4 suits, 13 different values) I'd just try to match a reference image of the suit and value with a new input image. First find the bounding box of the incoming suit / value (the smallest box enclosing all non-white pixels), scale your reference pictures to match the size of that bounding box, and find the best "match" through pixel-wise absolute difference. The colour of the picture (i.e. red or black) will make this even easier.
3
11
0
I decided to do a project for fun where I want to take as input the image of a playing card and return its rank and suit. I figure that I only need look at the upper-left corner, since that has all the information. It should be robust - if I have a large image of an Ace of Diamonds, I should be able to scale it anywhere from 20 to 200% and still get the right answer. First question - is there anything already written that does this? If so I'll find something else to OCR so I don't duplicate the efforts. Second - what's the best way to go about doing this? Neural network? Something hand-coded? Can anyone give any pointers? (0xCAAF9452 is not an acceptable answer).
OCR Playing Cards
0.049958
0
0
8,932
1,279,768
2009-08-14T19:35:00.000
1
0
0
0
python,artificial-intelligence,ocr,computer-vision
1,280,850
4
false
0
0
Personally I would go the machine learning route with this one.
3
11
0
I decided to do a project for fun where I want to take as input the image of a playing card and return its rank and suit. I figure that I only need look at the upper-left corner, since that has all the information. It should be robust - if I have a large image of an Ace of Diamonds, I should be able to scale it anywhere from 20 to 200% and still get the right answer. First question - is there anything already written that does this? If so I'll find something else to OCR so I don't duplicate the efforts. Second - what's the best way to go about doing this? Neural network? Something hand-coded? Can anyone give any pointers? (0xCAAF9452 is not an acceptable answer).
OCR Playing Cards
0.049958
0
0
8,932
1,281,075
2009-08-15T03:34:00.000
2
0
0
0
python,ajax,screen-scraping
3,134,226
5
false
1
0
Here is how I would do it: Install Firebug on Firefox, then turn the NET on in firebug and click on the desired link on YouTube. Now see what happens and what pages are requested. Find the one that are responsible for the AJAX part of page. Now you can use urllib or Mechanize to fetch the link. If you CAN pull the same content this way, then you have what you are looking for, then just parse the content. If you CAN'T pull the content this way, then that would suggest that the requested page might be looking at user login credentials, sessions info or other header fields such as HTTP_REFERER ... etc. Then you might want to look at something more extensive like the scrapy ... etc. I would suggest that you always follow the simple path first. Good luck and happy "responsibly" scraping! :)
1
2
0
I'm trying to scrap a page in youtube with python which has lot of ajax in it I've to call the java script each time to get the info. But i'm not really sure how to go about it. I'm using the urllib2 module to open URLs. Any help would be appreciated.
Scraping Ajax - Using python
0.07983
0
1
4,364
1,283,061
2009-08-15T22:48:00.000
1
0
0
1
python,pipe,popen
1,283,191
5
false
0
0
Alternatively, you can pipe your process into tee and capture only one of the streams. Something along the lines of sh -c 'process interesting stuff' | tee /dev/stderr. Of course, this only works on Unix-like systems.
2
5
0
I want to capture stdout from a long-ish running process started via subprocess.Popen(...) so I'm using stdout=PIPE as an arg. However, because it's a long running process I also want to send the output to the console (as if I hadn't piped it) to give the user of the script an idea that it's still working. Is this at all possible? Cheers.
Python - capture Popen stdout AND display on console?
0.039979
0
0
11,350
1,283,061
2009-08-15T22:48:00.000
1
0
0
1
python,pipe,popen
1,283,062
5
true
0
0
Can you simply print it as you read it from the pipe?
2
5
0
I want to capture stdout from a long-ish running process started via subprocess.Popen(...) so I'm using stdout=PIPE as an arg. However, because it's a long running process I also want to send the output to the console (as if I hadn't piped it) to give the user of the script an idea that it's still working. Is this at all possible? Cheers.
Python - capture Popen stdout AND display on console?
1.2
0
0
11,350
1,283,065
2009-08-15T22:52:00.000
0
1
0
0
python,pdf,fonts
1,285,029
2
false
0
0
Highlight is possible in pdf file using PDF annotations but doing it natively is not that easy job. If any of the mentioned library provide such facility is something that you may look for.
1
12
0
I'm not familiar with the PDF specification at all. I was wondering if it's possible to directly manipulate a PDF file so that certain blocks of text that I've identified as important are highlighted in colors of my choice. Language of choice would be python.
Programmatically change font color of text in PDF
0
0
0
6,726
1,283,266
2009-08-16T01:23:00.000
0
0
1
0
python,functional-programming,recursion
1,283,297
3
false
0
0
I'd implement an iterative binary adder or hamming code and run that way.
1
1
0
I have the following need (in python): generate all possible tuples of length 12 (could be more) containing either 0, 1 or 2 (basically, a ternary number with 12 digits) filter these tuples according to specific criteria, culling those not good, and keeping the ones I need. As I had to deal with small lengths until now, the functional approach was neat and simple: a recursive function generates all possible tuples, then I cull them with a filter function. Now that I have a larger set, the generation step is taking too much time, much longer than needed as most of the paths in the solution tree will be culled later on, so I could skip their creation. I have two solutions to solve this: derecurse the generation into a loop, and apply the filter criteria on each new 12-digits entity integrate the filtering in the recursive algorithm, so to prevent it stepping into paths that are already doomed. My preference goes to 1 (seems easier) but I would like to hear your opinion, in particular with an eye towards how a functional programming style deals with such cases.
Recursive generation + filtering. Better non-recursive?
0
0
0
870
1,283,646
2009-08-16T07:03:00.000
0
0
0
1
php,python,entity-framework,open-source
1,325,558
3
false
1
0
I have heard iBattis is good. A few companies fall back to iBattis when their programmer teams are not capable of understanding Hibernate (time issue). Personally, I still like Linq2Sql. Yes, the first time someone needs to delete and redrag over a table seems like too much work, but it really is not. And the time that it doesn't update your class code when you save is really a pain, but you simply control-a your tables and drag them over again. Total remakes are very quick and painless. The classes it creates are extremely simple. You can even create multiple table entities if you like with SPs for CRUD. Linking SPs to CRUD is similar to EF: You simply setup your SP with the same parameters as your table, then drag it over your table, and poof, it matches the data types. A lot of people go out of their way to take IQueryable away from the repository, but you can limit what you link in linq2Sql, so IQueryable is not too bad. Come to think of it, I wonder if there is a way to restrict the relations (and foreign keys).
1
2
0
What I really like about Entity framework is its drag and drop way of making up the whole model layer of your application. You select the tables, it joins them and you're done. If you update the database scheda, right click -> update and you're done again. This seems to me miles ahead the competiting ORMs, like the mess of XML (n)Hibernate requires or the hard-to-update Django Models. Without concentrating on the fact that maybe sometimes more control over the mapping process may be good, are there similar one-click (or one-command) solutions for other (mainly open source like python or php) programming languages or frameworks? Thanks
Entity Framwework-like ORM NOT for .NET
0
1
0
433
1,283,856
2009-08-16T09:14:00.000
2
0
0
0
python,mod-wsgi,mod-python,stackless,python-stackless
1,284,586
1
true
1
0
When you install a new version of Python (whether stackless or not) you also need to reinstall all of the third party modules you need -- either from sources, which you say you don't want to do, or from packages built for the new version of Python you've just installed. So, check the repository from which you installed Python 2.6.2 with aptitude: does it also have versions for that specific Python of mod_python, mysqldb, django, and any other third party stuff you may need? There really is no "silver bullet" for package management and I know of no "sumo distribution" of Python bundling all the packages you could ever possibly need (if there were, it would have to be many 10s of GB;-).
1
0
0
I installed stackless pyton 2.6.2 after reading several sites that said its fully compatible with vanilla python. After installing i found that my django applications do not work any more. I did reinstall django (1.1) again and now im kind of lost. The error that i get is 500: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Apache/2.2.11 (Ubuntu) DAV/2 PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch mod_python/3.3.1 Python/2.6.2 mod_ruby/1.2.6 Ruby/1.8.7(2008-08-11) mod_ssl/2.2.11 OpenSSL/0.9.8g Server at 127.0.0.1 Port 80 What else, could or should i do? Edit: From 1st comment i understand that the problem is not in django but mod_python & apache? so i edited my question title. Edit2: I think something is wrong with some paths setup. I tried going from mod_python to mod_wsgi, managed to finally set it up correctly only to get next error: [Sun Aug 16 12:38:22 2009] [error] [client 127.0.0.1] raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) [Sun Aug 16 12:38:22 2009] [error] [client 127.0.0.1] ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb Alan
Stackless python stopped mod_python/apache from working
1.2
1
0
672
1,283,922
2009-08-16T09:55:00.000
2
0
1
0
python,libraries
1,283,942
7
true
0
0
For the basics, yes, the standard Python library is probably all you'll need. But as you continue programming in Python, eventually you will need some other library for some task -- for instance, I recently needed to generate a tone at a specific, but differing, frequency for an application, and pyAudiere did the job just right. A lot of the other libraries out there generate their documentation differently from the core Python style -- it's just visually different, the content is the same. Some only have docstrings, and you'll be best off reading them in a console, perhaps. Regardless of how the other documentation is generated, get used to looking through the Python APIs to find the functions/classes/methods you need. When the time comes for you to use non-core libraries, you'll know what you want to do, but you'll have to find how to do it. For the future, it wouldn't hurt to be familiar with C, either. There's a number of Python libraries that are actually just wrappers around C libraries, and the documentation for the Python libraries is just the same as the documentation for the C libraries. PyOpenGL comes to mind, but it's been a while since I've personally used it.
4
1
0
I am trying to learn Python and referencing the documentation for the standard Python library from the Python website, and I was wondering if this was really the only library and documentation I will need or is there more? I do not plan to program advanced 3d graphics or anything advanced at the moment. Edit: Thanks very much for the responses, they were very useful. My problem is where to start on a script I have been thinking of. I want to write a script that converts images into a web format but I am not completely sure where to begin. Thanks for any more help you can provide.
Does one often use libraries outside the standard ones?
1.2
0
0
257
1,283,922
2009-08-16T09:55:00.000
0
0
1
0
python,libraries
1,283,963
7
false
0
0
Assuming that the standard library doesn't provide what we need and we don't have the time, or the knowledge, to implement the code we reuse 3rd party libraries. This is a common attitude regardless of the programming language.
4
1
0
I am trying to learn Python and referencing the documentation for the standard Python library from the Python website, and I was wondering if this was really the only library and documentation I will need or is there more? I do not plan to program advanced 3d graphics or anything advanced at the moment. Edit: Thanks very much for the responses, they were very useful. My problem is where to start on a script I have been thinking of. I want to write a script that converts images into a web format but I am not completely sure where to begin. Thanks for any more help you can provide.
Does one often use libraries outside the standard ones?
0
0
0
257
1,283,922
2009-08-16T09:55:00.000
0
0
1
0
python,libraries
1,283,926
7
false
0
0
If you're just beginning, all you'll need to know is the stuff you can get from the Python website. Failing that a quick Google is the fastest way to get (most) Python answers these days. As you develop your skills and become more advanced, you'll start looking for more exciting things to do, at which point you'll naturally start coming across other libraries (for example, pygame) that you can use for your more advanced projects.
4
1
0
I am trying to learn Python and referencing the documentation for the standard Python library from the Python website, and I was wondering if this was really the only library and documentation I will need or is there more? I do not plan to program advanced 3d graphics or anything advanced at the moment. Edit: Thanks very much for the responses, they were very useful. My problem is where to start on a script I have been thinking of. I want to write a script that converts images into a web format but I am not completely sure where to begin. Thanks for any more help you can provide.
Does one often use libraries outside the standard ones?
0
0
0
257
1,283,922
2009-08-16T09:55:00.000
0
0
1
0
python,libraries
1,284,615
7
false
0
0
If there's a chance that someone else ever wanted to do what you want to do, there's a chance that someone created a library for it. A few minutes Googling something like "python image library" will find you what you need, or let you know that someone hasn't created a library for your purposes.
4
1
0
I am trying to learn Python and referencing the documentation for the standard Python library from the Python website, and I was wondering if this was really the only library and documentation I will need or is there more? I do not plan to program advanced 3d graphics or anything advanced at the moment. Edit: Thanks very much for the responses, they were very useful. My problem is where to start on a script I have been thinking of. I want to write a script that converts images into a web format but I am not completely sure where to begin. Thanks for any more help you can provide.
Does one often use libraries outside the standard ones?
0
0
0
257
1,284,008
2009-08-16T10:51:00.000
0
0
0
0
python,gstreamer
2,610,696
3
false
0
0
The code shown above seems basically correct, but it will flounder on the rocks of v4l2. The strings you get will depend on what card you have: On four different cards so far I've encountered: "Composite" "Composite1" "composite" "Composite Video Input" Also be aware that some cards will have the driver lie, since the chip set has four inputs, the driver will often report four, even if the manufacturer only connects to two of them.
2
1
0
I own a avermedia volar HX usb stick, I want to capture fromthe composite input , but I can't because I'm unable to select the input. I'm using gstreamer with + python, I think I need to use gsttuner select input but I have no experience using gstreamer's interfaces. Could someone post a simple example? Thanks!
how can I grab video from usb video capture + dvb device with gstreamer?
0
0
0
1,572
1,284,008
2009-08-16T10:51:00.000
1
0
0
0
python,gstreamer
4,445,534
3
false
0
0
To anyone stumbling on this, some internal gstreamer changes since this was originally posted may require gst.STATE_READY now instead of STATE_PAUSED. Tripped me up as it seems half the capture devices I encounter default to PAL and I need to use the GST_TUNER interface to change it.
2
1
0
I own a avermedia volar HX usb stick, I want to capture fromthe composite input , but I can't because I'm unable to select the input. I'm using gstreamer with + python, I think I need to use gsttuner select input but I have no experience using gstreamer's interfaces. Could someone post a simple example? Thanks!
how can I grab video from usb video capture + dvb device with gstreamer?
0.066568
0
0
1,572