Available Count
int64
1
31
AnswerCount
int64
1
35
GUI and Desktop Applications
int64
0
1
Users Score
int64
-17
588
Q_Score
int64
0
6.79k
Python Basics and Environment
int64
0
1
Score
float64
-1
1.2
Networking and APIs
int64
0
1
Question
stringlengths
15
7.24k
Database and SQL
int64
0
1
Tags
stringlengths
6
76
CreationDate
stringlengths
23
23
System Administration and DevOps
int64
0
1
Q_Id
int64
469
38.2M
Answer
stringlengths
15
7k
Data Science and Machine Learning
int64
0
1
ViewCount
int64
13
1.88M
is_accepted
bool
2 classes
Web Development
int64
0
1
Other
int64
1
1
Title
stringlengths
15
142
A_Id
int64
518
72.2M
3
4
0
3
1
0
1.2
0
I am purely a windows programmer and spend all my time hacking VC++. Recently I have been heading several web based applications and myself built applications with python (/pylons framework) and doing projects on rails. All the web projects are hosted on ubuntu linux. The RELEASE procedures and check list we followed for building and releasing VC++ windows application are merely no more useful when it comes to script based language. So we don't built any binaries now. I copied asp/php files into IIS folder through ftp server when using open source cms applications. So FTP is the one of the way to host the files to the web server. Now we feel lazy or not so passionate to copy files via ftp instead we use the SVN checkout and we simply do svn update to get the latest copy. Is SVN checkout and svn update are the right methods to update the latest build files into the server? Are there any downside in using svn update? Any better method to release the script/web based scripts into the production server? PS: I have used ssh server at some extension on linux platform.
0
python,ruby,linux,scripting,release
2010-01-13T18:52:00.000
1
2,059,337
I would create a branch in SVN for every release of web application and when the release is ready there, I would check it out on the server and set to be run or move it into the place of the old version.
0
242
true
1
1
Practices while releasing the python/ruby/script based web applications on production
2,059,364
3
4
0
0
1
0
0
0
I am purely a windows programmer and spend all my time hacking VC++. Recently I have been heading several web based applications and myself built applications with python (/pylons framework) and doing projects on rails. All the web projects are hosted on ubuntu linux. The RELEASE procedures and check list we followed for building and releasing VC++ windows application are merely no more useful when it comes to script based language. So we don't built any binaries now. I copied asp/php files into IIS folder through ftp server when using open source cms applications. So FTP is the one of the way to host the files to the web server. Now we feel lazy or not so passionate to copy files via ftp instead we use the SVN checkout and we simply do svn update to get the latest copy. Is SVN checkout and svn update are the right methods to update the latest build files into the server? Are there any downside in using svn update? Any better method to release the script/web based scripts into the production server? PS: I have used ssh server at some extension on linux platform.
0
python,ruby,linux,scripting,release
2010-01-13T18:52:00.000
1
2,059,337
One downside of doing an svn update: though you can go back in time, to what revision do you go back to? You have to look it up. svn update pseudo-deployments work much cleaner if you use tags - in that case you'd be doing an svn switch to a different tag, not an svn update on the same branch or the trunk. You want to tag your software with the version number something like 1.1.4 , and then have a simple script to zip it up application-1.1.4,zip, and deploy it - then you have automated repeatable releases and rollbacks as well as greater visibility into what is changing between releases.
0
242
false
1
1
Practices while releasing the python/ruby/script based web applications on production
4,454,448
3
4
0
2
1
0
0.099668
0
I am purely a windows programmer and spend all my time hacking VC++. Recently I have been heading several web based applications and myself built applications with python (/pylons framework) and doing projects on rails. All the web projects are hosted on ubuntu linux. The RELEASE procedures and check list we followed for building and releasing VC++ windows application are merely no more useful when it comes to script based language. So we don't built any binaries now. I copied asp/php files into IIS folder through ftp server when using open source cms applications. So FTP is the one of the way to host the files to the web server. Now we feel lazy or not so passionate to copy files via ftp instead we use the SVN checkout and we simply do svn update to get the latest copy. Is SVN checkout and svn update are the right methods to update the latest build files into the server? Are there any downside in using svn update? Any better method to release the script/web based scripts into the production server? PS: I have used ssh server at some extension on linux platform.
0
python,ruby,linux,scripting,release
2010-01-13T18:52:00.000
1
2,059,337
Is SVN checkout and svn update are the right methods to update the latest build files into the server? Very, very good methods. You know what you got. You can go backwards at any time. Are there any downside in using svn update? None. Any better method to release the script/web based scripts into the production server? What we do. We do not run out of the SVN checkout directories. The SVN checkout directory is "raw" source sitting on the server. We use Python's setup.py install to create the application in /opt/app/app-x.y directory tree. Each tagged SVN branch is also a branch in the final installation. Ruby has gems and other installation tools that are probably similar to Python's. Our web site's Apache and mod_wsgi configurations refer to a specific /opt/app/app-x.y version. We can then stage a version, do testing, do things like migrate data from production to the next release, and generally get ready. Then we adjust our Apache and mod_wsgi configuration to use the next version. Previous versions are all in place. And left in place. We'll delete them some day when they confuse us.
0
242
false
1
1
Practices while releasing the python/ruby/script based web applications on production
2,059,406
2
7
0
15
159
1
1
0
How can individual unit tests be temporarily disabled when using the unittest module in Python?
0
python,python-unittest
2010-01-14T18:26:00.000
0
2,066,508
Simply placing @unittest.SkipTest decorator above the test is enough.
0
78,791
false
0
1
Disable individual Python unit tests temporarily
42,430,138
2
7
0
5
159
1
0.141893
0
How can individual unit tests be temporarily disabled when using the unittest module in Python?
0
python,python-unittest
2010-01-14T18:26:00.000
0
2,066,508
I just rename a test case method with an underscore: test_myfunc becomes _test_myfunc.
0
78,791
false
0
1
Disable individual Python unit tests temporarily
2,066,777
1
2
0
2
5
1
0.197375
0
What is the most efficient method to store a Python dictionary on the disk? The only methods I know of right now are plain-text and the pickle module. Edit: Sorry for not being very clear. By efficient I meant fastest execution speed. The dictionary will contain mutable objects that will hold information to be parsed and modified.
0
python,dictionary,disk,pickle
2010-01-14T21:35:00.000
0
2,067,749
JSON and YAML work well, also. Depends on what you mean by "efficient"? Size of file? Time required? Amount of code you need to write? You have the timeit module available to determine what meets your specific criteria for "efficient".
0
5,666
false
0
1
Efficient method to store Python dictionary on disk?
2,068,000
4
7
0
3
3
0
1.2
0
So I'm aware of the big ammount of general-purpose scripting languages like Ruby, Python, Perl, maybe even PHP, etc. that actually claim being usable for creating desktop applications too. I think my question can be answered clearly Are there actually companies using a special scripting language only to create their applications? Are there any real advantages on creating a product in a language like Python only? I'm not talking about the viability of those languages for web-development! Should I stick with C(++) for desktop apps? best regards, lamas
0
python,ruby,perl,scripting
2010-01-14T22:03:00.000
1
2,067,907
Python (combined with PyQt) is a very solid combination for GUI desktop applications (note that while QT is LGPL, PyQt (the Python bindings) is dual licensed: GPL or commercial). It offers the same (GUI library-wise) as Qt on C++ but with Python's specific strenghts. I'll list some of the more obvious ones: rapid prototyping extremely readable (hence maintainable) code Should I stick with C(++) for desktop apps? In general: no, unless you want to / need to (for a specific reason).
0
464
true
0
1
"Real" and non-embedded use of Ruby, Python and their friends
2,067,929
4
7
0
6
3
0
1
0
So I'm aware of the big ammount of general-purpose scripting languages like Ruby, Python, Perl, maybe even PHP, etc. that actually claim being usable for creating desktop applications too. I think my question can be answered clearly Are there actually companies using a special scripting language only to create their applications? Are there any real advantages on creating a product in a language like Python only? I'm not talking about the viability of those languages for web-development! Should I stick with C(++) for desktop apps? best regards, lamas
0
python,ruby,perl,scripting
2010-01-14T22:03:00.000
1
2,067,907
The company I work for uses Perl and Tk with PerlApp to build executable packages to produce or major software application. Perl beats C and C++ for simplicity of code. You can do things in one line of Perl that take 20 lines of C. We've used WxPerl for a few smaller projects. We'd like to move fully to WxPerl, but existing code works, so the move has a low priority until Wx can give us something we need that Tk can't. Python is popular for building GUI apps, too. You may have heard about Chandler. That's a big Python app. There are many others as well. Ruby is also a suitable choice. PHP is breaking into the world of command line apps. I am not sure about the power or flexibility of its GUI toolkits.
0
464
false
0
1
"Real" and non-embedded use of Ruby, Python and their friends
2,068,161
4
7
0
2
3
0
0.057081
0
So I'm aware of the big ammount of general-purpose scripting languages like Ruby, Python, Perl, maybe even PHP, etc. that actually claim being usable for creating desktop applications too. I think my question can be answered clearly Are there actually companies using a special scripting language only to create their applications? Are there any real advantages on creating a product in a language like Python only? I'm not talking about the viability of those languages for web-development! Should I stick with C(++) for desktop apps? best regards, lamas
0
python,ruby,perl,scripting
2010-01-14T22:03:00.000
1
2,067,907
I would recommend you not try to look for a language that is best for GUI apps but instead look for the language that you like the most and then use that to write your app. Ruby, Python, Perl all have GUI tool kits available to them. Most of them have access to the same often used tool kits like TK, GTK, and Wx. The look and feel of a an app will be dependent more on the GUI tool kit than on the language, and performance wise your likely to see more impact for how you write your app than language choice. If your comfortable with C++ then you should also look at C# or Java as options. While not scripting languages they have many of the same benefits like memory management and more sane string implementations.
0
464
false
0
1
"Real" and non-embedded use of Ruby, Python and their friends
2,072,473
4
7
0
1
3
0
0.028564
0
So I'm aware of the big ammount of general-purpose scripting languages like Ruby, Python, Perl, maybe even PHP, etc. that actually claim being usable for creating desktop applications too. I think my question can be answered clearly Are there actually companies using a special scripting language only to create their applications? Are there any real advantages on creating a product in a language like Python only? I'm not talking about the viability of those languages for web-development! Should I stick with C(++) for desktop apps? best regards, lamas
0
python,ruby,perl,scripting
2010-01-14T22:03:00.000
1
2,067,907
I have used a number of programs that were developed using scripted languages. Several embedded device vendors ship my group Windows-based configuration and debugging utilities written in TCL. Google's drawing program SketchUp has a lot of Ruby inside it (and users can create add-ons using Ruby). I have seen many Linux applications written in Python. There are many more examples out there, but often times finished applications are bundled up to the point where you can't really tell what's powering it on the inside. Yes, there can be advantages to working with scripted languages. Some scripted languages make it easier to do specific tasks; for example, text processing is much easier (IMO) in a language like Ruby that has regular expression support and a robust String class than it is in plain old C. Generating a UI using a scripted language may make it easier to support multiple platforms, as all the platform-specific code is taken care of inside the language interpreter or pre-compiled libraries. For example, our suppliers who build TCL-based apps claim they can build the UI for an app using TCL in a fraction of the time it would take them to build it in C++ or VB, and then they can port it to Linux almost effortlessly. On the other hand there are a few things that scripted languages typically aren't suited for, such as writing drivers or doing anything that requires low-level hardware access. Most importantly, however, is this: modern languages have become quite powerful to the point where choice of language doesn't make as big of a difference as it used to be. Use the language you are most comfortable with. The learning curve associated with learning a new language will usually have a much larger impact on your project.
0
464
false
0
1
"Real" and non-embedded use of Ruby, Python and their friends
2,068,564
2
4
0
1
3
1
1.2
0
There're tons of apps/widgets for PHP function reference and even for Ruby but I'm shocked to find there is nothing available for a popular language like Python (besides the official online documentation ofcourse). Is there really not a single handy reference widget/app available for Python? I have 'Pocket Reference' book, but a dashboard widget would be so handy!
0
python,macos,documentation,reference,widget
2010-01-15T00:06:00.000
0
2,068,486
Python libraries have (or should have) built in documentation through docstrings. Also, python code is (mostly) very readable, and reading the source (.py or even .c) is actually the preferred way for many developers to get the information they're looking for, especially since some corner cases may not even be documented. I've caught myself looking through the source now and then, as if it's a natural step in looking up functionality, either because I'm curious how they solve the problem, or because I reckon it's faster than googling obscure problems and reading SO questions.
0
657
true
0
1
Python Function Reference
2,068,830
2
4
0
0
3
1
0
0
There're tons of apps/widgets for PHP function reference and even for Ruby but I'm shocked to find there is nothing available for a popular language like Python (besides the official online documentation ofcourse). Is there really not a single handy reference widget/app available for Python? I have 'Pocket Reference' book, but a dashboard widget would be so handy!
0
python,macos,documentation,reference,widget
2010-01-15T00:06:00.000
0
2,068,486
The interactive interpreter is a fantastic reference tool. dir(<identifier) lists all the attributes of a module, class, or function help(<identifier>) gives you help about same. pydoc at the command line is another great tool. It does for Python what man gives you for commands, plus it even includes a web server you can start up to see the documentation in your browser.
0
657
false
0
1
Python Function Reference
2,069,084
1
2
0
2
0
1
1.2
0
I have a third-party Python script (foo.py) in a folder that is in my system path (but not the Python sys.path). foo.py is not part of any Python module. I am writing another script (bar.py) in which I'd like to call a function located in foo.py. Is this possible? Can it be done without explicitly naming the folder of foo.py? Thanks.
0
python,import
2010-01-15T19:07:00.000
0
2,074,071
You can include the path of foo.py in the PYTHONPATH environment variable. The interpreter will look also the directories contained there, so you can make the import just like it was on the same directory.
0
197
true
0
1
Use function from Python script in OS path
2,074,086
1
4
0
0
13
1
0
0
I'm using python unittest in order to test some other external application but it takes too much time to run the test one by one. I would like to know how can I speedup this process by using the power of multi-cores. Can I tweak unittest to execute tests in parallel? How? This question is not able python GIL limitation because in fact not the python code takes time but the external application that I execute, currently via os.system().
0
python,multithreading,unit-testing,performance,multicore
2010-01-15T19:08:00.000
0
2,074,074
As the @vinay-sajip suggested, a few non-core python packages like py.test and nose provided parallel execution of unit tests via multiprocessing lib right out of the box. However, one thing to consider is that if you are testing a web app with database backend and majority of your test cases are relying on connecting to the same test database, then your unit test execution speed is bottlenecked on the DB not I/O per se. And using multiprocess won't speed it up. Given that each unit test case requires an independent setup of the database schema + data, you cannot scale out the execution speed only on CPU but restricted with a single test database connection to a single test database server (otherwise the state of the data may interfere with other other while parallel executing each test case so on and so forth).
0
9,389
false
0
1
How to speedup python unittest on muticore machines?
35,182,727
1
4
0
1
15
1
0.049958
0
How can we export C# methods? I have a dll and I want to use its methods in the Python language with the ctypes module. Because I need to use the ctypes module, I need to export the C# methods for them to be visible in Python. So, how can I export the C# methods (like they do in C++)?
0
c#,python,methods,export,python.net
2010-01-17T18:49:00.000
0
2,082,159
(This may no longer be relevant since SLaks has found that ingenious link, but I'll leave an edited version for reference...) The "normal" way of exposing .NET/C# objects to unmanaged code (like Python) is to create a COM-callable wrapper for the C# DLL (.NET assembly), and call that using Python's COM/OLE support. To create the COM-callable wrapper, use the tlbexp and/or regasm command-line utilities. Obviously, however, this does not provide the C/DLL-style API that SLaks' link does.
0
8,012
false
0
1
How to export C# methods?
2,082,198
4
27
0
2
241
0
0.014814
0
Does any standard "comes with batteries" method exist to clear the terminal screen from a Python script, or do I have to go curses (the libraries, not the words)?
0
python,terminal
2010-01-18T07:34:00.000
1
2,084,508
You could tear through the terminfo database, but the functions for doing so are in curses anyway.
0
516,293
false
0
1
Clear terminal in Python
2,084,517
4
27
0
0
241
0
0
0
Does any standard "comes with batteries" method exist to clear the terminal screen from a Python script, or do I have to go curses (the libraries, not the words)?
0
python,terminal
2010-01-18T07:34:00.000
1
2,084,508
If all you need is to clear the screen, this is probably good enough. The problem is there's not even a 100% cross platform way of doing this across linux versions. The problem is the implementations of the terminal all support slightly different things. I'm fairly sure that "clear" will work everywhere. But the more "complete" answer is to use the xterm control characters to move the cursor, but that requires xterm in and of itself. Without knowing more of your problem, your solution seems good enough.
0
516,293
false
0
1
Clear terminal in Python
4,808,001
4
27
0
2
241
0
0.014814
0
Does any standard "comes with batteries" method exist to clear the terminal screen from a Python script, or do I have to go curses (the libraries, not the words)?
0
python,terminal
2010-01-18T07:34:00.000
1
2,084,508
python -c "from os import system; system('clear')"
0
516,293
false
0
1
Clear terminal in Python
2,084,525
4
27
0
108
241
0
1
0
Does any standard "comes with batteries" method exist to clear the terminal screen from a Python script, or do I have to go curses (the libraries, not the words)?
0
python,terminal
2010-01-18T07:34:00.000
1
2,084,508
Why hasn't anyone talked about just simply doing Ctrl+L in Windows or Cmd+L in Mac. Surely the simplest way of clearing screen.
0
516,293
false
0
1
Clear terminal in Python
26,639,250
1
2
0
1
0
0
0.099668
0
I have a set of binary assets (swf files) each about 150Kb in size. I am developing them locally on my home computer and I want to periodically deploy them for review. My current strategy is: Copy the .swf's into a transfer directory that is also a hg (mercurial) repo. hg push the changes to my slicehost VPN ssh onto my slicehost VPN cd to my transfer directory and hg up su www and cp the changed files into my public folder for viewing. I would like to automate the process. Best case scenario is something close to: Copy the .swf's into a "quick deploy" directory Run a single local script to do all of the above. I am interested in: advice on where to put passwords since I need to su www to transfer files into the public web directories. how the division of responsibility between local machine and server is handled. I think using rsync is a better tool than hg since I don't really need a revision history of these types of changes. I can write this as a python script, a shell script or however is considered a best practice. Eventually I would like to build this into a system that can handle my modest deployment needs. Perhaps there is an open-source deployment system that handles this and other types of situations? I'll probably roll-my-own for this current need but long term I'd like something relatively flexible. Note: My home development computer is OS X and the target server is some recent flavour of Ubuntu. I'd prefer a python based solution but if this is best handled from the shell I have no problems putting it together that way.
0
python,macos,deployment,ubuntu,rsync
2010-01-18T09:25:00.000
1
2,084,969
to avoid su www I see two easy choices. make a folder writable to you and readable by www's group in some path that the web-server will be able to serve, then you can rsync to that folder from somewhere on your local machine. put your public ssh key in www's authorized_keys and rsync to the www user (a bit less security in some setups perhaps, but not much, and usually more convenient). working around su www by putting your or its password in some file would seem far less secure. A script to invoke "rsync -avz --partial /some/path www@server:some/other/path" should be quick to write in python (although I do not python well).
0
349
false
0
1
How to deploy highly iterative updates
2,085,042
4
6
0
1
5
0
0.033321
0
I would like to know how can I determine if a python script is executed from crontab? I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script).
0
python,unix,terminal,cron
2010-01-18T15:17:00.000
1
2,086,961
An easier workaround would be to pass a flag to the script only from the crontab, like --crontab, and then just check for that flag.
0
4,167
false
0
1
How can I determine if a python script is executed from crontab?
2,087,056
4
6
0
0
5
0
0
0
I would like to know how can I determine if a python script is executed from crontab? I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script).
0
python,unix,terminal,cron
2010-01-18T15:17:00.000
1
2,086,961
If you want to detect this from an imported module, I would have the main program set a global variable in the module, which would output different things depending on the value of this global variable (and have the main program decide how to set the variable through a flag that you would use in your crontab). This is quite robust (comparing to studying PPIDs).
0
4,167
false
0
1
How can I determine if a python script is executed from crontab?
2,087,816
4
6
0
21
5
0
1.2
0
I would like to know how can I determine if a python script is executed from crontab? I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script).
0
python,unix,terminal,cron
2010-01-18T15:17:00.000
1
2,086,961
Not quite what you asked, but maybe what you want is os.isatty(sys.stdout.fileno()), which tells if stdout is connected to (roughly speaking) a terminal. It will be false if you pipe the output to a file or another process, or if the process is run from cron.
0
4,167
true
0
1
How can I determine if a python script is executed from crontab?
2,087,031
4
6
0
5
5
0
0.16514
0
I would like to know how can I determine if a python script is executed from crontab? I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script).
0
python,unix,terminal,cron
2010-01-18T15:17:00.000
1
2,086,961
Set an environment variable at the cron command invocation. That works even within a module, as you can just check os.getenv().
0
4,167
false
0
1
How can I determine if a python script is executed from crontab?
2,087,053
1
3
1
6
4
0
1
0
We embed ironpython in our app sob that scripts can be executed in the context of our application. I use Python.CreateEngine() and ScriptScope.Execute() to execute python scripts. We have out own editor(written in C#) that can load ironpython scripts and run it. There are 2 problems I need to solve. If I have a print statement in ironpython script, how can i show it my editor(how will I tell python engine to redirect output to some handler in my C# code) I plan to use unittest.py for running unittest. When I run the following runner = unittest.TextTestRunner() runner.run(testsuite) the output is redirected to standard output but need a way for it to be redirected to my C# editor output window so that user can see the results. This question might be related to 1 Any help is appreciated G
0
ironpython
2010-01-18T23:31:00.000
0
2,089,998
You can provide a custom Stream or TextWriter which will be used for all output. You can provide those by using one of the ScriptRuntime.IO.SetOutput overloads. Your implementation of Stream or TextWriter should receive the strings and then output them to your editor window (potentially marshalling back onto the UI thread if you're running the script on a 2ndary execution thread).
0
4,586
false
1
1
Streaming Ironpython output to my editor
2,090,745
1
2
0
0
1
0
0
0
I've encountered the following error while scripting in Python. ERROR Tue 19. Jan 14:51:21 2010 C:\Python24\Lib\site-packages\win32com\client\util.py:0: Script Error com_error: (-2147217385, 'OLE error 0x80041017', None, None) Unfortunately, I don't know what it means, or even what other information I might need to find out. Does anyone have any insight into this?
0
python,com
2010-01-19T03:56:00.000
0
2,090,950
When doing python COM programming, I sometimes use VBA (in Excel) to test code that gives errors. That way, I can see if the problem is in the Python-COM layer, or if I get the same error when using VBA. I have sometimes seen that the error messages in VBA have descriptions that the Python exception lacks. VBA is quite nice for doing COM programming. You have tab completion/intellisense in the editor.
0
1,265
false
0
1
unidentified com_error in python
2,091,963
1
2
0
0
2
1
0
0
I have installed Py-Appscript on my machine and it can be used with the Python installation at /Library/Frameworks/Python.framework/Versions/Current/bin/python. I am trying to use this installation of Py-Appscript with an Automator service. To do this, I use the Run Shell Script action and then set the Shell to usr/bin/python (which is my only choice for Python, unfortunately). The usr/bin/python does not appear to have access to my third-party modules and crashes on the line: from appscript import * Is there a way for me to give usr/bin/python access to my third-party modules? OR Is there a way to tell Automator to use /Library/Frameworks/Python.framework/Versions/Current/bin/python instead? I need Automator to run the Python directly from the Run Shell Script action. Any action that calls Python scripts that are external to Automator (via bin/bash, for example) does not perform quickly enough to be useful.
0
python,automator
2010-01-19T13:40:00.000
1
2,093,837
When you install modules, you typically install them per Python instance. So in this case you have installed them for the Python in /Library/Frameworks/Python.framework/Versions/Current/bin/python, and it will then be available only for that Python. /usr/bin/python is then apparently another Python installation (I'm not an OS X expert). To make it available for the /usr/bin/python installation, install it for /usr/bin/python.
0
2,403
false
0
1
Using Third-Party Modules with Python in an Automator Service
2,094,638
1
5
1
9
4
1
1
0
In a game that I am writing, I use a 2D vector class which I have written to handle the speeds of the objects. This is called a large number of times every frame as there are a lot of objects on the screen, so any increase I can make in its speed will be useful. It is pretty simple, consisting mostly of wrappers to the related math functions. It would be quite trivial to rewrite in C, but I am not sure whether doing so will make any significant difference as all it really does is call the underlying math functions, add, multiply or divide. So, my question is under what circumstances does it make sense to rewrite in C? Where will you see a significant speed boost, and where can you see a reasonable speed boost without rewriting an extensive amount of the program?
0
python,c,optimization
2010-01-19T19:19:00.000
0
2,096,334
First measure then optimize
0
429
false
0
1
When Does It Make Sense To Rewrite A Python Module in C?
2,096,358
3
7
1
0
7
0
0
0
I'm making an application that analyses one or more series of data using several different algorithms (agents). I came to the idea that each of these agents could be implemented as separate Python scripts which I run using either the Python C API or Boost.Python in my app. I'm a little worried about runtime overhead TBH, as I'm doing some pretty heavy duty data processing and I don't want to have to wait several minutes for each simulation. I will typically be making hundreds of thousands, if not millions, of iterations in which I invoke the external "agents"; am I better of just hardcoding everything in the app, or will the performance drop be tolerable? Also, are there any other interpreted languages I can use other than Python?
0
c++,python,perl,performance,lua
2010-01-20T18:04:00.000
0
2,103,728
you could probably create an embedded language using C++ templates and operator overloading, see for example ublas or ftensor matrix languages. i do not think python or other interpreted languages of is suitable for having numbercrunching/data processing.
0
2,474
false
0
1
Selecting An Embedded Language
2,103,784
3
7
1
1
7
0
0.028564
0
I'm making an application that analyses one or more series of data using several different algorithms (agents). I came to the idea that each of these agents could be implemented as separate Python scripts which I run using either the Python C API or Boost.Python in my app. I'm a little worried about runtime overhead TBH, as I'm doing some pretty heavy duty data processing and I don't want to have to wait several minutes for each simulation. I will typically be making hundreds of thousands, if not millions, of iterations in which I invoke the external "agents"; am I better of just hardcoding everything in the app, or will the performance drop be tolerable? Also, are there any other interpreted languages I can use other than Python?
0
c++,python,perl,performance,lua
2010-01-20T18:04:00.000
0
2,103,728
For millions of calls (from I'm assuming c++, because you mentioned boost) into python, yes: you will notice a performance hit. This may or may not be significant - perhaps the speed gain of trying out new 'agents' would be greater than the hit. Python does have fast numerical libraries (such as numpy) that might help, but you'll still incur overhead of marshalling data, calling into python, the gil, etc. Yes, you can embed many other languages: check out lua. Also, check out swig.org, which can connect to many other languages besides python.
0
2,474
false
0
1
Selecting An Embedded Language
2,103,831
3
7
1
5
7
0
0.141893
0
I'm making an application that analyses one or more series of data using several different algorithms (agents). I came to the idea that each of these agents could be implemented as separate Python scripts which I run using either the Python C API or Boost.Python in my app. I'm a little worried about runtime overhead TBH, as I'm doing some pretty heavy duty data processing and I don't want to have to wait several minutes for each simulation. I will typically be making hundreds of thousands, if not millions, of iterations in which I invoke the external "agents"; am I better of just hardcoding everything in the app, or will the performance drop be tolerable? Also, are there any other interpreted languages I can use other than Python?
0
c++,python,perl,performance,lua
2010-01-20T18:04:00.000
0
2,103,728
Tcl was designed from the ground up to be an embedded language.
0
2,474
false
0
1
Selecting An Embedded Language
2,104,152
1
1
1
1
0
0
1.2
0
I'm writing an application working with plugins. There are two types of plugins: Engine and Model. Engine objects have an update() method that call the Model.velocity() method. For performance reasons these methods are allowed to be written in C. This means that sometimes they will be written in Python and sometimes written in C. The problem is that this forces to do an expensive Python function call of Model.velocity() in Engine.update() (and also reacquiring the GIL). I thought about adding something like Model.get_velocity_c_func() to the API, that would allow Model implementations to return a pointer to the C version of their velocity() method if available, making possible for Engine to do a faster C function call. What data type should I use to pass the function pointer ? And is this a good design at all, maybe there is an easier way ?
0
python,c,function-pointers
2010-01-21T01:29:00.000
0
2,106,324
The CObject (PyCOBject) data type exists for this purpose. It holds a void*, but you can store any data you wish. You do have to be careful not to pass the wrong CObject to the wrong functions, as some other library's CObjects will look just like your own. If you want more type security, you could easily roll your own PyType for this; all it has to do, after all, is contain a pointer of the right type.
0
366
true
0
1
Passing C function pointers between two python modules
2,106,391
2
5
0
0
4
1
0
0
I have a string that I would like to encrypt in Python, store it as a cookie, then in a PHP file I'd like to retrieve that cookie, and decrypt it in PHP. How would I go about doing this? I appreciate the fast responses. All cookie talk aside, lets just say I want to encrypt a string in Python and then decrypt a string in PHP. Are there any examples you can point me to?
0
php,python
2010-01-21T19:38:00.000
0
2,112,274
Well, my first thought would be to use a web server that uses SSL and set the cookie's secure property to true, meaning that it will only be served over SSL connections. However, I'm aware that this probably isn't what you're looking for.
0
7,880
false
0
1
How to encrypt a string in Python and decrypt that same string in PHP?
2,112,306
2
5
0
1
4
1
0.039979
0
I have a string that I would like to encrypt in Python, store it as a cookie, then in a PHP file I'd like to retrieve that cookie, and decrypt it in PHP. How would I go about doing this? I appreciate the fast responses. All cookie talk aside, lets just say I want to encrypt a string in Python and then decrypt a string in PHP. Are there any examples you can point me to?
0
php,python
2010-01-21T19:38:00.000
0
2,112,274
If you're not talking about encryption but encoding to make sure the contents make it through safely regardless of quoting issues, special characters, and line breaks, I think base64 encoding is your best bet. PHP has base64_encode / decode() out of the box, and I'm sure Python has, too. Note that base64 encoding obviously does nothing to encrypt your data (i.e. to make it unreadable to outsiders), and base64 encoded data grows by 33%.
0
7,880
false
0
1
How to encrypt a string in Python and decrypt that same string in PHP?
2,112,331
3
5
0
3
35
1
0.119427
0
I'm a PhD student and use Python to write the code I use for my research. My workflow often consists of making a small change to the code, running the program, seeing whether the results improved, and repeating the process. Because of this, I find myself spending more time waiting for my program to run than I do actually working on it (a common experience, I know). I'm currently using the most recent version of Python 2 on my system, so my question is whether switching to Python 3 is going to give me any speed boost or not. At this point, I don't really have a compelling reason to move to Python 3, so if the execution speeds are similar, I'll probably just stick with 2.x. I know I'm going to have to modify my code a bit to get it working in Python 3, so it's not trivial to just test it on both versions to see which runs faster. I'd need to be reasonably confident I will get a speed improvement before I spend the time updating my code to Python 3.
0
python,performance
2010-01-21T19:43:00.000
0
2,112,298
Try refining the algorithms or changing the data structures used. That's usually the best way to get an increase in performance.
0
14,827
false
0
1
Python 2.x vs 3.x Speed
2,115,650
3
5
0
2
35
1
0.07983
0
I'm a PhD student and use Python to write the code I use for my research. My workflow often consists of making a small change to the code, running the program, seeing whether the results improved, and repeating the process. Because of this, I find myself spending more time waiting for my program to run than I do actually working on it (a common experience, I know). I'm currently using the most recent version of Python 2 on my system, so my question is whether switching to Python 3 is going to give me any speed boost or not. At this point, I don't really have a compelling reason to move to Python 3, so if the execution speeds are similar, I'll probably just stick with 2.x. I know I'm going to have to modify my code a bit to get it working in Python 3, so it's not trivial to just test it on both versions to see which runs faster. I'd need to be reasonably confident I will get a speed improvement before I spend the time updating my code to Python 3.
0
python,performance
2010-01-21T19:43:00.000
0
2,112,298
I have phylogenetics analysis that takes a long time to run, and uses about a half-dozen python scripts as well as other bioinformatics software (muscle, clustal, blast, even R!). I use temp files to save intermediate results and a master script with the subprocess module to glue all the pieces together. It's easy to change the master to run only the modified parts that I want to test. But, if the changes are being made to early steps, and you only know how good it is at the end of the whole process, then this strategy wouldn't help much.
0
14,827
false
0
1
Python 2.x vs 3.x Speed
2,112,852
3
5
0
2
35
1
0.07983
0
I'm a PhD student and use Python to write the code I use for my research. My workflow often consists of making a small change to the code, running the program, seeing whether the results improved, and repeating the process. Because of this, I find myself spending more time waiting for my program to run than I do actually working on it (a common experience, I know). I'm currently using the most recent version of Python 2 on my system, so my question is whether switching to Python 3 is going to give me any speed boost or not. At this point, I don't really have a compelling reason to move to Python 3, so if the execution speeds are similar, I'll probably just stick with 2.x. I know I'm going to have to modify my code a bit to get it working in Python 3, so it's not trivial to just test it on both versions to see which runs faster. I'd need to be reasonably confident I will get a speed improvement before I spend the time updating my code to Python 3.
0
python,performance
2010-01-21T19:43:00.000
0
2,112,298
I can't answer the root of your question, but if you read anything regarding the sluggish performance of the io module please disregard it. The were definitely performance issues in Python 3.0, but they were largely resolved in Python 3.1.
0
14,827
false
0
1
Python 2.x vs 3.x Speed
2,112,332
1
10
0
78
120
0
1
0
What would be the best way in Python to determine whether a directory is writeable for the user executing the script? Since this will likely involve using the os module I should mention I'm running it under a *nix environment.
0
python,file,permissions,directory,operating-system
2010-01-21T22:24:00.000
1
2,113,427
It may seem strange to suggest this, but a common Python idiom is It's easier to ask for forgiveness than for permission Following that idiom, one might say: Try writing to the directory in question, and catch the error if you don't have the permission to do so.
0
85,042
false
0
1
Determining Whether a Directory is Writeable
2,113,457
2
2
1
1
4
0
0.099668
0
In the 'old days' when there was just cpython, most extensions were written in c (as platform independent as possible) and compiled into pyd's (think PyCrypto for example). Now there is Jython, IronPython and PyPy and the pyd’s do not work with any of them (Ironclad aside). It seems they all support ctypes and that the best approach MIGHT be to create a platform independent dll or shared library and then use ctypes to interface to it. But I think this approach will be a bit slower than the old fashion pyd approach. You could also program a pyd for cpython, a similar c# dll for IronPython and a java class or jar for Jython (I'm not sure about PyPy. But while this approach will appeal to platform purists it is very labor intensive. So what is the best route to take today?
0
python,ironpython,jython
2010-01-22T02:44:00.000
0
2,114,627
If you're wrapping an existing native library, the ctypes is absolutely the way to go. If you're trying to speed up the hot spots in a Python extension, then making a custom extension for each interpreter (and a pure-Python fallback) is tractable because the bulk of the code is pure Python that can be shared, but undesirable and labour-intensive, as you said. You could use ctypes in this case as well.
0
501
false
0
1
Python extensions that can be used in all varieties of python (jython / IronPython / etc.)
2,119,710
2
2
1
2
4
0
1.2
0
In the 'old days' when there was just cpython, most extensions were written in c (as platform independent as possible) and compiled into pyd's (think PyCrypto for example). Now there is Jython, IronPython and PyPy and the pyd’s do not work with any of them (Ironclad aside). It seems they all support ctypes and that the best approach MIGHT be to create a platform independent dll or shared library and then use ctypes to interface to it. But I think this approach will be a bit slower than the old fashion pyd approach. You could also program a pyd for cpython, a similar c# dll for IronPython and a java class or jar for Jython (I'm not sure about PyPy. But while this approach will appeal to platform purists it is very labor intensive. So what is the best route to take today?
0
python,ironpython,jython
2010-01-22T02:44:00.000
0
2,114,627
Currently, it seems the ctypes is indeed the best approach. It works today, and it's so convenient that it's gonna conquer (most of) the world. For performance-critical APIs (such as numpy), ctypes is indeed problematic. The cleanest approach would probably be to port Cython to produce native IronPython / Jython / PyPy extensions. I recall that PyPy had plans to compile ctypes code to efficient wrappers, but as far as I google, there is nothing like that yet...
0
501
true
0
1
Python extensions that can be used in all varieties of python (jython / IronPython / etc.)
2,116,557
1
1
0
1
0
1
1.2
0
Well aware that DLR is here!! I have recently reading up on all of these and was wondering if there were any specific benefits of using one language over another? For example performance benefits! and available functionality through standard libaries!!
0
f#,ironpython,ironruby
2010-01-22T09:41:00.000
0
2,116,310
The answer is "depends". F# is great if you need to functional programming is used extensively by Academics that need its pure computing power to get something done. IronPython and IronRuby is great for being able to create applications that run on the CLR because they give you the .NET goodness with the speed of writing Python or Ruby. I don't think that any of these is more preferable to another without it being in a proper context
0
638
true
0
1
What are the benefits of using IronPython over IronRuby or F#?
2,116,333
2
4
0
1
2
0
0.049958
1
I have extensive experience with PHP cURL but for the last few months I've been coding primarily in Java, utilizing the HttpClient library. My new project requires me to use Python, once again putting me at the crossroads of seemingly comparable libraries: pycurl and urllib2. Putting aside my previous experience with PHP cURL, what is the recommended library in Python? Is there a reason to use one but not the other? Which is the more popular option?
0
python,urllib2,pycurl
2010-01-23T03:20:00.000
0
2,121,945
Use urllib2. It's got very good documentation in python, while pycurl is mostly C documentation. If you hit a wall, switch to mechanize or pycurl.
0
4,948
false
0
1
Python: urllib2 or Pycurl?
2,122,198
2
4
0
3
2
0
0.148885
1
I have extensive experience with PHP cURL but for the last few months I've been coding primarily in Java, utilizing the HttpClient library. My new project requires me to use Python, once again putting me at the crossroads of seemingly comparable libraries: pycurl and urllib2. Putting aside my previous experience with PHP cURL, what is the recommended library in Python? Is there a reason to use one but not the other? Which is the more popular option?
0
python,urllib2,pycurl
2010-01-23T03:20:00.000
0
2,121,945
urllib2 is part of the standard library, pycurl isn't (so it requires a separate step of download/install/package etc). That alone, quite apart from any difference in intrinsic quality, is guaranteed to make urllib2 more popular (and can be a pretty good pragmatical reason to pick it -- convenience!-).
0
4,948
false
0
1
Python: urllib2 or Pycurl?
2,121,967
1
2
0
2
6
0
0.197375
1
I have a big list of Twitter users stored in a database, almost 1000. I would like to use the Streaming API in order to stream tweets from these users, but I cannot find an appropriate way to do this. Help would be very much appreciated.
0
php,python,twitter
2010-01-23T15:34:00.000
0
2,123,651
You can track 400 filter words and 5000 userids via streaming api. Filter words can be something apple, orange, ipad etc... And in order to track any user's timeline you need to get the user's twitter user id.
0
2,823
false
0
1
Streaming multiple tweets - from multiple users? - Twitter API
8,286,513
1
3
0
3
3
0
0.197375
0
I have some daemons that use PID files to prevent parallel execution of my program. I have set up a signal handler to trap SIGTERM and do the necessary clean-up including the PID file. This works great when I test using "kill -s SIGTERM #PID". However, when I reboot the server the PID files are still hanging around preventing start-up of the daemons. It is my understanding that SIGTERM is sent to all processes when a server is shutting down. Should I be trapping another signal (SIGINT, SIGQUIT?) in my daemon?
0
python,linux,sigterm
2010-01-25T18:53:00.000
1
2,134,732
Not a direct solution but it might be a good idea to check for an actual process running with the pid in the pid file at startup and if none exists, to cleanup the stale file. It's possible that your process is getting a SIGKILL before it has a chance to cleanup the pid file.
0
727
false
0
1
PID files hanging around for daemons after server restart
2,134,763
2
3
0
0
2
0
0
0
I am trying to set a cron task to read updates for a Facebook application. I have prompted the user to grant Offline Access permissions and i have store the session_key in the db. I am crearing a new Facebook object and besides api and secret key I also use the session_key (previously stored in db) and the fb uid. When i am trying to create the auth token or do a API call i get a Error 104: Incorrect signature Any ideas, experience, hints ?
0
python,facebook,pyfacebook
2010-01-26T14:53:00.000
0
2,140,142
I've never used PyFacebook. Or tried to resume sessions in this manner. But I'd imagine just storing session_key and uid is not enough. There are other params too, and a signature param that's calculated based on all the fb_* params. So you might need to store all of them. But even so, they might only work for 20-30 minutes if you're unlucky.
0
819
false
1
1
PyFacebook Infinite Session
2,140,233
2
3
0
1
2
0
0.066568
0
I am trying to set a cron task to read updates for a Facebook application. I have prompted the user to grant Offline Access permissions and i have store the session_key in the db. I am crearing a new Facebook object and besides api and secret key I also use the session_key (previously stored in db) and the fb uid. When i am trying to create the auth token or do a API call i get a Error 104: Incorrect signature Any ideas, experience, hints ?
0
python,facebook,pyfacebook
2010-01-26T14:53:00.000
0
2,140,142
I faced the same problem where the error displayed was: "facebook.FacebookError: Error 104: Incorrect signature" Just reset your APP Secret_key and make corresponding change in the code and that sgould fix the problem. Cheers!
0
819
false
1
1
PyFacebook Infinite Session
11,015,676
4
4
0
1
1
0
0.049958
0
I would like to have my PHP website destroy a users session if they have been idle for 5 minutes. If this does happen, I'd like to present the user with a message stating why they were logged out and redirect them to the login page. What is the best way to handle this? I am running on php and myadmin. Thanks Avinash
0
php,session,python-idle
2010-01-27T08:23:00.000
0
2,145,365
I assume you mean 'idle' time. There is no need to calculate that, but you have to store the last (authenticated) access made by that user and reset the counter. Typically, one would should issue an authentication cookie with a certain timestamp. Upon authentication of the cookie, you compare the current time with the timestamp. If this difference is larger than some threshold, say 5 minutes, you present an error page. To improve the user experience, you might also want to display a timer to the user so there is no bad surprise.
0
2,505
false
1
1
How do I detect when a user has been idle for a certain time and destroy their session in PHP?
2,145,413
4
4
0
1
1
0
0.049958
0
I would like to have my PHP website destroy a users session if they have been idle for 5 minutes. If this does happen, I'd like to present the user with a message stating why they were logged out and redirect them to the login page. What is the best way to handle this? I am running on php and myadmin. Thanks Avinash
0
php,session,python-idle
2010-01-27T08:23:00.000
0
2,145,365
Can you not just use PHP's built-in session functions to set session expiry time to 5 mins. and re-direct if a session no longer exists?
0
2,505
false
1
1
How do I detect when a user has been idle for a certain time and destroy their session in PHP?
2,145,866
4
4
0
7
1
0
1.2
0
I would like to have my PHP website destroy a users session if they have been idle for 5 minutes. If this does happen, I'd like to present the user with a message stating why they were logged out and redirect them to the login page. What is the best way to handle this? I am running on php and myadmin. Thanks Avinash
0
php,session,python-idle
2010-01-27T08:23:00.000
0
2,145,365
Every time you load a page, store a timestamp in a session variable. When the user goes to a page, check to see if $SESSION['lastActivity'] < time() - <your idle time>. If true, then redirect to a 'your session has expired' page or similar. If not, continue loading the page.
0
2,505
true
1
1
How do I detect when a user has been idle for a certain time and destroy their session in PHP?
2,145,390
4
4
0
0
1
0
0
0
I would like to have my PHP website destroy a users session if they have been idle for 5 minutes. If this does happen, I'd like to present the user with a message stating why they were logged out and redirect them to the login page. What is the best way to handle this? I am running on php and myadmin. Thanks Avinash
0
php,session,python-idle
2010-01-27T08:23:00.000
0
2,145,365
Create a javascript function that has a x minute timeout that pops up and redirects. Also on the server make sure their session expires so that in the case of Javascript not being available, they cannot continue actions after their idle time has passed.
0
2,505
false
1
1
How do I detect when a user has been idle for a certain time and destroy their session in PHP?
2,145,652
1
1
0
3
3
0
1.2
0
My own answer to this question is YES, but I'd like to hear from others. Put another way the question could be: Would the success of 1-click-install WordPress (not WordPress.com, which is SaaS) be possible if it weren't written in PHP, all other things being equal? The critical associated requirements I believe support PHP are: hosting/deployment flexibility developer reach flexibility and depth of knowledge around server performance tuning Items #1 and #2 are equally critical, and both are far more important than #3. FWIW, I'm not a particular fan of PHP - can anyone truly be? - but the goals of re-deployment and extensibility point wherever they point. Please, please do not pollute this space if you do not grok the question. This is not about PHP and it's relative merits, or lack of merit, compared to other programming languages out of context. I am looking for insight specifically around language choice as it relates to deployment/uptake/extensibility strategy as outlined. Thanks.
0
php,python,wordpress,deployment,hosting
2010-01-27T22:55:00.000
0
2,150,947
As far as points #1 and #2 go, you are probably right. No other platform is so widely, easily and cheaply available in terms of hosting companies and packages like the LAMP stack. Plus, most incompatibilities that can occur when deploying an application to a completely unknown web space are well documented, their number is limited, and can mostly be checked beforehand (register_globals, safe mode, allocated script memory, etc.) If I were thinking about developing a web application that I want to see spreading as quickly and as far as possible also among non-professionals and end users, PHP would be my platform of choice for these reasons. I must add that I am deeply familiar only with the hosting market in Germany, but I'm quite sure the basic characteristics are the same. As for developer availability: People who claim to be able to speak PHP are easy to find. Those who will actually do a good job for you, less so. Still, I think it is safe to say that PHP developers are easier to find than, say, Pythonists or Ruby developers. I don't expect this to stay this way forever, though. Other languages are gaining popularity, and in the end, developers and which languages they like influences the hosting market massively in the long term.
0
181
true
1
1
Is PHP the only choice re: massive and rapid uptake of a re-deployable, extensible web application?
2,150,982
1
3
0
4
5
0
1.2
0
I need to know the current time at CDT when my Python script is run. However this script will be run in multiple different timezones so a simple offset won't work. I only need a solution for Linux, but a cross platform solution would be ideal.
0
python,linux,datetime,timezone
2010-01-28T05:19:00.000
0
2,152,471
You can use time.gmtime() to get time GMT (UTC) from any machine no matter the timezone, then you can apply your offset.
0
1,946
true
0
1
how to find time at particular timezone from anywhere
2,152,511
2
4
0
2
13
0
0.099668
0
Can anyone help me to send and receive SMS using AT commands in Python? In case it matters, I'm using Fedora 8. Which phone will be better with Linux (Nokia, Sony Ericson, Samsung,.....)? Will all phones support sending and receiving SMS using AT commands?
0
python,sms,at-command
2010-01-29T10:13:00.000
0
2,161,197
Talking to the phone is easy. You just need to open the appropriate /dev/ttyACM* device and talk to it. Which phone is trickier. Any phone that supports "tethering" and the full AT command set for SMS messages should be fine.
0
53,296
false
0
1
How to Send/Receive SMS using AT commands?
2,161,275
2
4
0
1
13
0
0.049958
0
Can anyone help me to send and receive SMS using AT commands in Python? In case it matters, I'm using Fedora 8. Which phone will be better with Linux (Nokia, Sony Ericson, Samsung,.....)? Will all phones support sending and receiving SMS using AT commands?
0
python,sms,at-command
2010-01-29T10:13:00.000
0
2,161,197
I would suggest replace the time.sleep with condition loop waiting for the response from the modem "OK" before continue next state.
0
53,296
false
0
1
How to Send/Receive SMS using AT commands?
48,543,135
1
3
0
0
2
0
0
1
How can I retrieve contacts from hotmail with python? Is there any example?
0
python,hotmail
2010-01-29T22:08:00.000
0
2,165,517
use octazen, but you have to pay for it
0
1,864
false
0
1
How do I retrieve Hotmail contacts with python
2,458,380
1
5
0
0
4
0
0
0
Here is the situation: I have a Mediawiki installation, and a few additional server-side scripts that require more resources and were already written in a different language (python). The python code will be very loosely coupled with the Mediawiki code (only called by clicking on a link here or there) What I would like is that when a GET or POST command is sent to the server to execute a python script, I would like to check to see if a user is already logged in to Mediawiki. If not, I would like to just redirect them to the Mediawiki login page. Any ideas? There are several articles on integrating Mediawiki with other PHP frameworks like Drupal and forum software, but that is more than I need. What is the best way to do this? -check for cookies somehow (is this secure?) -does the Mediawiki database keep track of who is logged in? Thanks
0
python,authentication,mediawiki
2010-01-31T08:01:00.000
0
2,170,990
All you need to do is essentially forward the session, cookies and all, to the API as if it's the user querying. How would one go about doing that? I can access the API directly and see my login info, but if I access it via PHP, it shows me as not being logged in (anonymous user id "0"). How do I forward the session, cookies, etc. to the API via PHP to show the user's info?
0
4,553
false
1
1
How to check if a user is logged on in mediawiki in a different app?
2,456,365
1
3
0
1
7
0
0.066568
0
I know Ctrl + F9 runs a single file. How to run them all? If there is no such thing, how to bind one keyboard shortcut to it?
0
eclipse,unit-testing,pydev,python-unittest
2010-01-31T20:37:00.000
0
2,173,212
Go to the preferences and type in keys to get to the keyboard shortcut definition page (I think it's called keys... sorry not on my dev machine right now). In this dialog you can search for commands. See if there is a run all tests command (it might help to find the run tests you are currently using first). If there is check out the shortcut or define your own.
0
5,179
false
0
1
What is the keyboard shortcut to run all unit tests in the current project in PyDev + Eclipse?
2,220,154
3
8
0
0
13
1
0
0
I know some Python and I'm really impressed by the language's ease of use. From what I've seen of Objective-C it looks a lot less pretty, but it seems to be the lingua franca for Mac OS X development (which means it has better documentation). I'm thinking about starting Mac development - will using PyObjC+Python make me a second class citizen?
0
python,cocoa,macos,pyobjc
2010-02-01T09:01:00.000
0
2,175,573
You're going to need Objective-C: that's what all the tutorials, documentation, sample code, and everything is written in. In addition to a wilder variety of people being able to help you. So learn ObjC first. If, on your second or third project, or a year down the road, you start a project that needs a Python module (like, say, Twisted, or SQLAlchemy. But a SERIOUS need like foundation of your app need, where the extra boost your app gets makes everything worth it), then you can write a PyObjC app and get a lot of the speed benefits of that language, with your background in Cocoa.
0
3,245
false
0
1
What are the downsides of using Python instead of Objective-C?
2,176,578
3
8
0
2
13
1
0.049958
0
I know some Python and I'm really impressed by the language's ease of use. From what I've seen of Objective-C it looks a lot less pretty, but it seems to be the lingua franca for Mac OS X development (which means it has better documentation). I'm thinking about starting Mac development - will using PyObjC+Python make me a second class citizen?
0
python,cocoa,macos,pyobjc
2010-02-01T09:01:00.000
0
2,175,573
Second class citizen seems a bit strong. The Objective-C API's are available from Python as well, should you need them, and that's mostly if you want to make Cocoa apps. But then they are restricted to OS X anyway. Personally, I have no interest in building apps that isn't cross-platform, but that's me. That also means I haven't actually done this, so I don't know how tricky it is, but there was an article in the Python Magazine not long ago, and it didn't look that horrible. The major drawback of Python is execution time, and that mainly comes from it being a dynamic language. This can be solved with Cython and C-extensions, etc, but then you get a mix of Python + ObjectiveC API's + Cython which can be daunting. So it depends a lot of what kinds of applications you are going to make. Something uniquely OSX-ish that makes no sense anywhere else? ObjectiveC is probably the ticket. Cross-platform servers, well then Python rocks! Something else? Then it depends.
0
3,245
false
0
1
What are the downsides of using Python instead of Objective-C?
2,175,875
3
8
0
3
13
1
0.07486
0
I know some Python and I'm really impressed by the language's ease of use. From what I've seen of Objective-C it looks a lot less pretty, but it seems to be the lingua franca for Mac OS X development (which means it has better documentation). I'm thinking about starting Mac development - will using PyObjC+Python make me a second class citizen?
0
python,cocoa,macos,pyobjc
2010-02-01T09:01:00.000
0
2,175,573
DO NOT ATTEMPT to avoid learning objective-C if you're going to write apps for the Mac. The purpose of PyObjC and the other language bindings is to let you re-use existing libraries in your apps, not to let you avoid learning the native tools.
0
3,245
false
0
1
What are the downsides of using Python instead of Objective-C?
2,176,187
1
2
0
0
1
0
0
0
Calling resource.getrusage() from Python returns a 0 value for resident set size on Solaris and Linux systems. On Linux you can pull the RSS From /proc//status instead. Does anybody have a good way to pull RSS on Solaris, either similar or not to the Linux workaround?
0
python,solaris,getrusage
2010-02-01T21:17:00.000
1
2,180,156
Well...you can pull it from the pmap application by calling pmap -x. But I was looking more for a way to access the info directly in /proc from my app. The only way to do it is to access the /proc/<pid>/xmap file. Unfortunately, the data is stored as an array of prxmap structs...so either a Python C-module is in order or using the ctypes module. I'll post an update when I get one of those written.
0
479
false
0
1
How can I grap resident set size from Python on Solaris?
2,193,909
1
3
0
2
5
0
0.132549
0
I'm building a genetic algorithm to tackle the traveling salesman problem. Unfortunately, I hit peaks that can sustain for over a thousand generations before mutating out of them and getting better results. What crossover and mutation operators generally do well in this case?
0
python,algorithm,genetic-algorithm,evolutionary-algorithm,traveling-salesman
2010-02-02T15:27:00.000
0
2,185,177
If your problem is that peaks remain for over one thousand generations, then the problem might not be with the crossover and mutation operators. You might not be introducing or keeping enough variation to your population: I would examine the proportions of crossovers, of mutations, and of survivors from one generation to the next, and possibly raise the proportion of mutations.
0
2,732
false
0
1
Suggested GA operators for a TSP problem?
2,185,816
1
9
0
5
87
0
0.110656
0
Or is there a better way to quickly output the contents of an array (multidimensional or what not). Thanks.
0
php,python
2010-02-02T21:24:00.000
0
2,187,821
print and pprint are great for built-in data types or classes which define a sane object representation. If you want a full dump of arbitrary objects, you'll have to roll your own. That is not that hard: simply create a recursive function with the base case being any non-container built-in data type, and the recursive case applying the function to each item of a container or each attribute of the object, which can be gotten using dir() or the inspect module.
0
77,118
false
0
1
What is the equivalent of php's print_r() in python?
2,187,885
2
3
0
8
2
1
1
0
I'm going to help my friend in a improve of his phpBB board, but I want to make somethings there in Python or Perl. But it's possible to integrate these languages with PHP?
0
php,python,perl,integration,phpbb
2010-02-02T21:53:00.000
0
2,187,998
You can always call the python or perl interpreter from within PHP! Minimalistic interchange is possible by means of passing command line arguments and capturing stdout (exec or passthru are related php functions). However, I don't think its's a good idea - using two interpreters instead of one doubles the overall runtime overhead and startup time.
0
848
false
0
1
Integrating Python or Perl with PHP
2,188,027
2
3
0
8
2
1
1
0
I'm going to help my friend in a improve of his phpBB board, but I want to make somethings there in Python or Perl. But it's possible to integrate these languages with PHP?
0
php,python,perl,integration,phpbb
2010-02-02T21:53:00.000
0
2,187,998
I'd say that the only reasonable way of doing that is if you are making a separate service, that you talk to via Ajax or XML or something like that. Everything else is more trouble than it's worth.
0
848
false
0
1
Integrating Python or Perl with PHP
2,188,168
1
1
0
2
1
0
1.2
0
I use python based as well as rails applications on ubuntu linux. We have functionalities like register, forgot password, reset password, email alerts etc features based on emails. Since now a days, we go on offline development, we want to run a local smtp & pop3 server to send and receive emails. Emails shall be send via the our web application and we will use the email clients like thunderbird to receive emails(just to verify). I have used jmailsrv (I have used 6 years ago, but could not locate exact package now), a java based simple email server. Are there any other light alternative for development work?
0
python,ruby-on-rails,linux,email
2010-02-03T20:31:00.000
0
2,195,203
Why does it need to be a simple mail server? Can't you just use something like postfix which is very easy for simple configurations
0
839
true
1
1
Linux development/minimal smtp and pop3 server
2,195,237
2
5
0
0
17
1
0
0
What is the Python code to create a password encrypted zip file? I'm fine with using some apt-get'able utilities using system on the command line.
0
python
2010-02-03T21:51:00.000
0
2,195,747
You can use Pygpgme to create a password-protected gpg file, which is compressed. You'll need to use the equivalent of gpg -c myFile or gpg --symmetric myFile and gpg myFile.gpg I don't know what the equivalents are in that Python module, but I know they've existed since version 0.2. There was a bug report before then mentioning the lack of it, but someone released a patch and they fixed it in version 0.2. This uses symmetric encryption so you don't have to worry about keys. You might find my post asking how to use it on UbuntuForums. Feel free to answer it if you know.
0
51,029
false
0
1
Code to create a password encrypted zip file?
22,124,386
2
5
0
5
17
1
0.197375
0
What is the Python code to create a password encrypted zip file? I'm fine with using some apt-get'able utilities using system on the command line.
0
python
2010-02-03T21:51:00.000
0
2,195,747
Extraction is pretty easy, you just use zipfile.ZipFile.setpassword() which was introduced in python 2.6, however the standard python library lacks support for creating encrypted zip files. There are commercially available libraries for Python which supports creation of encrypted and password protected zip files. If you want to use something freely available, you need to use the standard zip command line utility. zip -e -Ppassword filename.zip fileA fileB ...
0
51,029
false
0
1
Code to create a password encrypted zip file?
2,196,159
1
2
0
6
3
1
1
0
I am building a routine that processes disk buffers for forensic purposes. Am I better off using python strings or the array() type? My first thought was to use strings, but I'm trying to void unicode problems, so perhaps array('c') is better?
0
python,arrays,performance
2010-02-04T13:41:00.000
0
2,200,027
If you need to alter the buffer in-place (it's not clear if you do, since you use the ambiguous term "to process"), arrays will likely be better, since strings are immutable. In Python 2.6 or better, however, bytearrays can be the best of both worlds -- mutable and rich of methods and usable with regular expressions too. For read-only operations, strings have the edge over array (thanks to many more methods, plus extras such as regular expressions, available on them), if you're stuck with old Python versions and so cannot use bytearray. Unicode is not an issue in either case (in Python 2; in Python 3, definitely go for bytearray!-).
0
681
false
0
1
which is more efficient for buffer manipulations: python strings or array()
2,200,806
2
5
0
0
4
0
0
0
I'd like to make a website, it's not a huge project, but I'm a bit out of the web design loop. The last time I made a website was probably around 2002. I figure the web frameworks and tools have come a ways since then. It's mostly the design aspect that I'd like it to make easier. I can do the backend language in any language. My question is: What are some tools or web frameworks that make the design aspect of making a website easier. It could be a framework in php/python/ruby. As far as tools go, free/open source is preferred, but I wouldn't mind looking at good commercial alternatives.
0
php,python,ruby
2010-02-05T00:19:00.000
0
2,204,223
django on Google App Engine gets you free(up to a point) and scalable hosting
0
335
false
1
1
What's a good web framework and/or tool for a software developer?
2,204,294
2
5
0
0
4
0
0
0
I'd like to make a website, it's not a huge project, but I'm a bit out of the web design loop. The last time I made a website was probably around 2002. I figure the web frameworks and tools have come a ways since then. It's mostly the design aspect that I'd like it to make easier. I can do the backend language in any language. My question is: What are some tools or web frameworks that make the design aspect of making a website easier. It could be a framework in php/python/ruby. As far as tools go, free/open source is preferred, but I wouldn't mind looking at good commercial alternatives.
0
php,python,ruby
2010-02-05T00:19:00.000
0
2,204,223
It really depends on a couple things: What are you familiar with? You indicated that you've done some web development in the past. What did you use? If you were using classic ASP, then learning ASP.NET should be less of a jump for you. What are you trying to create? If all you need are static HTML files with a tiny bit of functionality, you could try learning PHP as it's pretty quick and easy to get going. If you need light database access, then maybe Ruby on Rails will be your cup of tea. With that being said, I'd recommend the following in no particular order (just because I've tried them and they're all pretty decent): Ruby on Rails ASP.NET / ASP.NET MVC PHP
0
335
false
1
1
What's a good web framework and/or tool for a software developer?
2,204,292
2
2
0
2
3
1
1.2
0
i'm doing simulation which generates thousands of result objects. Each object size is around 1mb, and all the result objects should be on memory to be queried for various ad hoc reports. And it takes 1~2 secs to make one result object. So it takes more than 5 minutes to get one simulation done even though i fully use my quad-core cpu with parallel execution. And the task process takes more than 4~5 gb memory for one simulation set. The problem is, I want to run more simulation sets simultaneously and get it done more quickly. Currently, I'm doing this job using c# and ironpython on windows vista64, quad-core cpu with 8g memory. I gonna order a new computer, 24 gb memory with better cpu and ultimately, i may buy workstation with multi cpus and more memories. So my question is, what is the best way to utilize new hardware? I consider one of the combinations below. ironpython + c# on windows 64 ironpython + c# (mono) on linux 64 jython + java on windows 64 jython + java on linux 64 Simulation engine is written in c# / java, and i use python to make reports. Which combination do you guys think is the best? Is there no big difference between .net and java platform to handle memory consuming task? Is there no difference between windows and linux? I sometimes run my current c# + ironpython code on my ubuntu laptop (32bit, 2g ram) and feel that it seems pretty stable compared to windows .net env on the same spec hardware. But i dont know when the underlying hardware is pretty better. And i welcome any kind of suggestion regardless of the choices above.
0
c#,java,.net,python,memory
2010-02-05T08:19:00.000
0
2,205,832
Since you can install all of those for free and it sounds like you already have the code implemented in both .Net and Java then I suggest you benchmark the program on all four platforms (windows/linux * java/.net). It sounds like all the heavy lifting is done in Java/C#, so I suspect the relative performance of Jython vs. IronPython is largely irrelevant.
0
839
true
1
1
best (python) setup for cpu / memory intensive task
2,205,899
2
2
0
2
3
1
0.197375
0
i'm doing simulation which generates thousands of result objects. Each object size is around 1mb, and all the result objects should be on memory to be queried for various ad hoc reports. And it takes 1~2 secs to make one result object. So it takes more than 5 minutes to get one simulation done even though i fully use my quad-core cpu with parallel execution. And the task process takes more than 4~5 gb memory for one simulation set. The problem is, I want to run more simulation sets simultaneously and get it done more quickly. Currently, I'm doing this job using c# and ironpython on windows vista64, quad-core cpu with 8g memory. I gonna order a new computer, 24 gb memory with better cpu and ultimately, i may buy workstation with multi cpus and more memories. So my question is, what is the best way to utilize new hardware? I consider one of the combinations below. ironpython + c# on windows 64 ironpython + c# (mono) on linux 64 jython + java on windows 64 jython + java on linux 64 Simulation engine is written in c# / java, and i use python to make reports. Which combination do you guys think is the best? Is there no big difference between .net and java platform to handle memory consuming task? Is there no difference between windows and linux? I sometimes run my current c# + ironpython code on my ubuntu laptop (32bit, 2g ram) and feel that it seems pretty stable compared to windows .net env on the same spec hardware. But i dont know when the underlying hardware is pretty better. And i welcome any kind of suggestion regardless of the choices above.
0
c#,java,.net,python,memory
2010-02-05T08:19:00.000
0
2,205,832
@Dave is spot on, if you really care benchmark each combination and see. Personally I'd suggest you stick with the tool set that you are most comfortable with, be that Windows, Java, Linux, .Net or any random combination there of. Your level of productivity in maintaining and developing your software usually trumps any minor performance gain you might get from switching OS or VM.
0
839
false
1
1
best (python) setup for cpu / memory intensive task
2,205,986
1
6
0
5
1
1
1.2
0
So, I know I can use dir() to get information about class members etc. What I'm looking for is a way to get a nicely formatted report on everything related to a class (the members, docstrings, inheritance hierarchy, etc.). I want to be able to run this on the command-line so I can explore code and debug better.
0
python
2010-02-08T22:43:00.000
0
2,225,456
Try calling help on your class.
0
122
true
0
1
Is there a way for me to get detailed formatted information on a Python class?
2,225,477
2
4
0
2
6
1
0.099668
0
I do basic python programming and now I want to get deep into language features. I have collected/considered the following to be advanced python capabilities and learning them now. Decorator Iterator Generator Meta Class Anything else to be added/considered to the above list?
0
python
2010-02-09T07:53:00.000
0
2,227,537
First, this thread should be community wiki. Second, iterators and generators are pretty basic Python IMHO. I agree with you on decorators and metaclasses. But I'm not a very good programmer, so I probably find this more difficult to wrap my brain around than others. Third, I would add threading/multiprocessing to the list. That's really tricky :)
0
3,365
false
0
1
What are features considerd as advanced python?
2,227,567
2
4
0
1
6
1
0.049958
0
I do basic python programming and now I want to get deep into language features. I have collected/considered the following to be advanced python capabilities and learning them now. Decorator Iterator Generator Meta Class Anything else to be added/considered to the above list?
0
python
2010-02-09T07:53:00.000
0
2,227,537
I think you'll find that there isn't a good answer to your question. What's great about Python is that all of its features are fairly easy to understand. But there's enough stuff in the language and the library that you never get around to learning it all. So it really boils down to which you've had occasion to use, and which you've only heard about. If you haven't used decorators or generators, they sound advanced. But once you actually have to use them in a real-world situation, you'll realize that they're really quite simple, and wonder how you managed to live without them before.
0
3,365
false
0
1
What are features considerd as advanced python?
2,229,792
2
3
0
0
0
0
0
0
I have been using Macromedia / Adobe Director & Lingo since 1998. I am extremely familiar with using this software to create CDROMs and DVDs and also have a good knowledge of design elements and their integration such as flash videos, images & audio etc. I am always keen to explore other technologies and understand that Python can be used to create CDROMs. I have tried Googling some information on this subject but to no avail. Does anyone know the pros and cons of Python CDROM production? Is it capable of delivering such media rich experiences as Adobe Director? What are the limitations? Any help / resources would be greatly appreciated.
0
python,adobe,media,dvd,cd-rom
2010-02-09T12:36:00.000
0
2,228,988
It sounds like you're not asking so much for mass-copying of CDs/DVDs (which is what I assumed from reading the title), but for a Python-based replacement for Adobe Director? I don't think anything like that presently exists. However, Python could certainly help you out with the scripting and control of various elements in the production process -- for example, taking the tedium out of assembling lots of files together into one final package. You'd have to be more specific about what you're looking for, though.
0
214
false
1
1
Python CDROM Production
2,228,998
2
3
0
1
0
0
0.066568
0
I have been using Macromedia / Adobe Director & Lingo since 1998. I am extremely familiar with using this software to create CDROMs and DVDs and also have a good knowledge of design elements and their integration such as flash videos, images & audio etc. I am always keen to explore other technologies and understand that Python can be used to create CDROMs. I have tried Googling some information on this subject but to no avail. Does anyone know the pros and cons of Python CDROM production? Is it capable of delivering such media rich experiences as Adobe Director? What are the limitations? Any help / resources would be greatly appreciated.
0
python,adobe,media,dvd,cd-rom
2010-02-09T12:36:00.000
0
2,228,988
Python isn't the tool you are looking for... [waves hand across in front of Mindblip's face] Stick with Director or try Flash with either MPlayer or Zinc.
0
214
false
1
1
Python CDROM Production
2,229,023
1
2
0
0
1
0
0
1
I'm considering to use XML-RPC.NET to communicate with a Linux XML-RPC server written in Python. I have tried a sample application (MathApp) from Cook Computing's XML-RPC.NET but it took 30 seconds for the app to add two numbers within the same LAN with server. I have also tried to run a simple client written in Python on Windows 7 to call the same server and it responded in 5 seconds. The machine has 4 GB of RAM with comparable processing power so this is not an issue. Then I tried to call the server from a Windows XP system with Java and PHP. Both responses were pretty fast, almost instantly. The server was responding quickly on localhost too, so I don't think the latency arise from server. My googling returned me some problems regarding Windows' use of IPv6 but our call to server does include IPv4 address (not hostname) in the same subnet. Anyways I turned off IPv6 but nothing changed. Are there any more ways to check for possible causes of latency?
0
c#,.net,python,windows-7,xml-rpc
2010-02-10T09:23:00.000
0
2,235,643
Run a packet capture on the client machine, check the network traffic timings versus the time the function is called. This may help you determine where the latency is in your slow process, e.g. application start-up time, name resolution, etc. How are you addressing the server from the client? By IP? By FQDN? Is the addressing method the same in each of the applications your using? If you call the same remote procedure multiple times from the same slow application, does the time taken increase linearly?
0
1,326
false
0
1
Slow XML-RPC in Windows 7 with XML-RPC.NET
2,235,703
1
1
0
1
0
0
0.197375
1
We have a script which pulls some XML from a remote server. If this script is running on any server other than production, it works. Upload it to production however, and it fails. It is using cURL for the request but it doesn't matter how we do it - fopen, file_get_contents, sockets - it just times out. This also happens if I use a Python script to request the URL. The same script, supplied with another URL to query, works - every time. Obviously it doesn't return the XML we're looking for but it DOES return SOMETHINg - it CAN connect to the remote server. If this URL is requested via the command line using, for example, curl or wget, again, data is returned. It's not the data we're looking for (in fact, it returns an empty root element) but something DOES come back. Interestingly, if we strip out query string elements from the URL (the full URL has 7 query string elements and runs to about 450 characters in total) the script will return the same empty XML response. Certain combinations of the query string will once again cause the script to time out. This, as you can imagine, has me utterly baffled - it seems to work in every circumstance EXCEPT the one it needs to work in. We can get a response on our dev servers, we can get a response on the command line, we can get a response if we drop certain QS elements - we just can't get the response we want with the correct URL on the LIVE server. Does anyone have any suggestions at all? I'm at my wits end!
0
php,python,xml,apache,curl
2010-02-10T12:54:00.000
0
2,236,864
Run Wireshark and see how far the request goes. Could be a firewall issue, a DNS resolution problem, among other things. Also, try bumping your curl timeout to something much higher, like 300s, and see how it goes.
0
606
false
0
1
PHP / cURL problem opening remote file
2,236,930
1
1
0
0
2
0
1.2
0
I have device connected through serial port to PC. Using c-kermit I can send commands to device and read output. I can also send files using kermit protocol. In python we have pretty nice library - pySerial. I can use it to send/receive data from device. But is there some nice solution to send files using kermit protocol?
0
python,serial-port,pyserial,kermit
2010-02-10T14:31:00.000
1
2,237,483
You should be able to do it via the subprocess module. The following assumes that you can send commands to your remote machine and parse out the results already. :-) I don't have anything to test this on at the moment, so I'm going to be pretty general. Roughly: 1.) use pyserial to connect to the remote system through the serial port. 2.) run the kermit client on the remote system using switches that will send the file or files you wish to transfer over the remote systems serial port (the serial line you are using.) 3.) disconnect your pyserial instance 4.) start your kermit client with subprocess and accept the files. 5.) reconnect your pyserial instance and clean everything up. I'm willing to bet this isn't much help, but when I actually did this a few years ago (using os.system, rather than subprocess on a hideous, hideous SuperDOS system) it took me a while to get my fat head around the fact that I had to start a kermit client remotely to send the file to my client! If I have some time this week I'll break out one of my old geode boards and see if I can post some actual working code.
0
3,905
true
0
1
How to send file to serial port using kermit protocol in python
3,143,184
2
2
0
4
10
0
0.379949
0
I've noticed two methods to "message passing". One I've seen Erlang use and the other is from Stackless Python. From what I understand here's the difference Erlang Style - Messages are sent and queued into the mailbox of the receiving process. From there they are removed in a FIFO basis. Once the first process sends the message it is free to continue. Python Style - Process A queues up to send to process B. B is currently performing some other action, so A is frozen until B is ready to receive. Once B opens a read channel, A sends the data, then they both continue. Now I see the pros of the Erlang method being that you don't have any blocked processes. If B never is able to receive, A can still continue. However I have noticed in some programs I have written, that it is possible for Erlang message boxes to get full of hundreds (or thousands) of messages since the inflow of messages is greater than the outflow. Now I haven't written a large program in either framework/language so I'm wondering your experiences are with this, and if it's something I should even worry about. Yes, I know this is abstract, but I'm also looking for rather abstract answers.
0
python,erlang,actor,stackless,python-stackless
2010-02-10T19:32:00.000
0
2,239,731
Broadly speaking, this is unbounded queues vs bounded queues. A stackless channel can be considered a special case of a queue with 0 size. Bounded queues have a tendency to deadlock. Two threads/processes trying to send a message to each other, both with a full queue. Unbounded queues have more subtle failure. A large mailbox won't meet latency requirements, as you mentioned. Go far enough and it will eventually overflow; no such thing as infinite memory, so it's really just a bounded queue with a huge limit that aborts the process when full. Which is best? That's hard to say. There's no easy answers here.
0
1,147
false
0
1
blocking channels vs async message passing
2,240,157
2
2
0
8
10
0
1.2
0
I've noticed two methods to "message passing". One I've seen Erlang use and the other is from Stackless Python. From what I understand here's the difference Erlang Style - Messages are sent and queued into the mailbox of the receiving process. From there they are removed in a FIFO basis. Once the first process sends the message it is free to continue. Python Style - Process A queues up to send to process B. B is currently performing some other action, so A is frozen until B is ready to receive. Once B opens a read channel, A sends the data, then they both continue. Now I see the pros of the Erlang method being that you don't have any blocked processes. If B never is able to receive, A can still continue. However I have noticed in some programs I have written, that it is possible for Erlang message boxes to get full of hundreds (or thousands) of messages since the inflow of messages is greater than the outflow. Now I haven't written a large program in either framework/language so I'm wondering your experiences are with this, and if it's something I should even worry about. Yes, I know this is abstract, but I'm also looking for rather abstract answers.
0
python,erlang,actor,stackless,python-stackless
2010-02-10T19:32:00.000
0
2,239,731
My experience in Erlang programming is that when you expect a high messaging rate (that is, a faster producer than consumer) then you add your own flow control. A simple scenario The consumer will: send message, wait for ack, then repeat. The producer will: wait for message, send ack when message received and processed, then repeat. One can also invert it, the producer waits for the consumer to come and grab the N next available messages. These approaches and other flow control can be hidden behind functions, the first one is mostly already available in gen_server:call/2,3 against a gen_server OTP behavior process. I see asynchronous messaging as in Erlang as the better approach, since when latencies are high you might very much want to avoid a synchronization when messaging between computers. One can then compose clever ways to implement flow control. Say, requiring an ack from the consumer for every N messages the producer have sent it, or send a special "ping me when you have received this one" message now and then, to count ping time.
0
1,147
true
0
1
blocking channels vs async message passing
2,240,486
1
3
0
4
2
0
0.26052
0
I have a GSM modem that disconnect after a while, maybe because of low signal. I am just wondering is there an AT command that can detect the disconnection and re-establish a reconnection. Is there a way in code (preferably python) I can detect the disconnection and re-establish a reconnection? Gath
0
python,gsm,at-command
2010-02-12T12:39:00.000
0
2,251,796
Depending on what type of connection, circuit switched (CS) or packet switched (PS), the monitoring will be a little bit different. To detect a disconnect you can enable UR (unsolicited result) code AT+CPSB=1 to monitor PDP context activity (aka packet switched connections). For circuit switched calls you can monitor with the +CIEV: UR code enabled with AT+CMER=3,0,0,2. To re-establish the connection you have to set up the connection again. For CS you will either have to know the phone number dialed, or you can use the special form of ATD, ATDL [1] which will dial the last dialed number. You can use ATDL for PS as well if the call was started with ATD (i.e. "ATD*99*....") which is quite common, but I do not think there is any way if started with AT+CGDATA for instance. However, none of the above related to ATD matters, because it is not what you want. For CS you might set up a call from your python script, but then so what? After receiving CONNECT all the data traffic would be coming on the serial connection that your python script are using. And for PS the connection will not even finish successfully unless the phone receives PPP traffic from the PC as part of connection establishment. Do you intend your python script to supply that? What you really want is to trigger your PC to try to connect again, whether this is standard operating system dial up networking or some special application launching it. So monitor the modem with a python script and then take appropriate action on the PC side to re-establish the connection. [1] Side note to ATDL: notice that if you want to repeat the last voice call you should still terminate with a semicolon, i.e. ATDL;, otherwise you would start a data call.
0
4,663
false
0
1
What are the functions / AT commands to reconnect a disconnected GSM modem?
2,251,902
1
1
0
0
0
0
0
0
Via django iam launching a thread (via middle ware the moment the first request comes) which continously fetches the twitter public steam and puts it down into the database.Assume the thread name is twitterthread. I also have have several cron jobs which periodically interacts with other third party api services. Observed the following Problem: if i don't launch twitterthread cron jobs are running fine. Where as if i launch twitterthread cron jobs are not running Any idea on what can go wrong? and any guidelines on the way to fix it.
0
python,django,cron
2010-02-12T17:23:00.000
0
2,253,714
I'd advice to avoid launching threads inside the django application. Most of the times you can run the thread as a separate application. If you deploy the app in a Apache server and you don't control it properly each Apache process will assume that a request is the first one and you could end up with more than one instance of twitterthread.
0
253
false
1
1
cron job and Long process problem
3,487,091
1
3
0
1
1
1
0.066568
0
I am on working on a Python script which is supposed to process a tarball and output new one, trying to keep the format of the original. Thus, I am looking for a way to lookup the compression method used in an open tarball to open the new one with same compression. AFAICS TarFile class doesn't provide any public interface to get the needed information directly. And I would like to avoid reading the file independently of the tarfile module. I am currently considering looking up the class of the underlying file object (t.fileobj.__class__) or trying to open the input file in all possible modes and choosing the correct format basing on which one succeeds.
0
python,tarfile
2010-02-12T18:09:00.000
0
2,254,017
Tar doesn't compress, it concatenates (which is why TarFile won't tell you what compression method is used, because there isn't one). Are you trying to find out if it's a tar.gz, tar.bz2, or tar.Z ?
0
267
false
0
1
tarfile: determine compression of an open tarball
2,254,074
1
4
0
1
24
0
0.049958
0
A friend asked me about creating a small web interface that accepts some inputs, sends them to MATLAB for number crunching and outputs the results. I'm a Python/Django developer by trade, so I can handle the web interface, but I am clueless when it comes to MATLAB. Specifically: I'd really like to avoid hosting this on a Windows server. Any issues getting MATLAB running in Linux with scripts created on Windows? Should I be looking into shelling out commands or compiling it to C and using ctypes to interact with it? If compiling is the way to go, is there anything I should know about getting it compiled and working in Python? (It's been a long time since I've compiled or worked with C) Any suggestions, tips, or tricks on how to pull this off?
0
python,matlab,ctypes
2010-02-13T00:12:00.000
1
2,255,942
Regarding OS compatibility, if you use the matlab version for Linux, the scripts written in windows should work without any changes. If possible, you may also consider the possibility of doing everything with python. Scipy/numpy with Matplotlib provide a complete Matlab replacement.
0
23,758
false
0
1
How do I interact with MATLAB from Python?
2,257,221
4
4
0
0
0
0
0
0
newb here. I am trying to make a c++ program that will read from a named pipe created by python. My problem is, the named pipe created by python uses os.getpid() as part of the pipe name. when i try calling the pipe from c++, i use getpid(). i am not getting the same value from c++. is there a method equivalent in c++ for os.getpid? thanks! edit: sorry, i am actually using os.getpid() to get the session id via ProcessIDtoSessionID(). i then use the session id as part of the pipe name
0
c++,python
2010-02-13T12:09:00.000
1
2,257,415
You cannot easily retrieve the Python interpreter's PID from your C++ program. Either assign the named pipe a constant name, or if you really need multiple pipes of the same Python program, create a temporary file to which the Python programs write their PIDs (use file locking!) - then you can read the PIDs from the C++ program.
0
862
false
0
1
How do I do os.getpid() in C++?
2,257,431
4
4
0
2
0
0
0.099668
0
newb here. I am trying to make a c++ program that will read from a named pipe created by python. My problem is, the named pipe created by python uses os.getpid() as part of the pipe name. when i try calling the pipe from c++, i use getpid(). i am not getting the same value from c++. is there a method equivalent in c++ for os.getpid? thanks! edit: sorry, i am actually using os.getpid() to get the session id via ProcessIDtoSessionID(). i then use the session id as part of the pipe name
0
c++,python
2010-02-13T12:09:00.000
1
2,257,415
You won't get the same value if you're running as a separate process as each process has their own process ID. Find some other way to identify the pipe.
0
862
false
0
1
How do I do os.getpid() in C++?
2,257,426
4
4
0
4
0
0
0.197375
0
newb here. I am trying to make a c++ program that will read from a named pipe created by python. My problem is, the named pipe created by python uses os.getpid() as part of the pipe name. when i try calling the pipe from c++, i use getpid(). i am not getting the same value from c++. is there a method equivalent in c++ for os.getpid? thanks! edit: sorry, i am actually using os.getpid() to get the session id via ProcessIDtoSessionID(). i then use the session id as part of the pipe name
0
c++,python
2010-02-13T12:09:00.000
1
2,257,415
You don't get same proccess IDs because your python program and c++ programs are run in different proccesses thus having different process IDs. So generally use a different logic to name your fifo files.
0
862
false
0
1
How do I do os.getpid() in C++?
2,257,422
4
4
0
0
0
0
0
0
newb here. I am trying to make a c++ program that will read from a named pipe created by python. My problem is, the named pipe created by python uses os.getpid() as part of the pipe name. when i try calling the pipe from c++, i use getpid(). i am not getting the same value from c++. is there a method equivalent in c++ for os.getpid? thanks! edit: sorry, i am actually using os.getpid() to get the session id via ProcessIDtoSessionID(). i then use the session id as part of the pipe name
0
c++,python
2010-02-13T12:09:00.000
1
2,257,415
The standard library does not give you anything other than files. You will need to use some other OS specific API.
0
862
false
0
1
How do I do os.getpid() in C++?
2,257,420
2
3
0
8
13
0
1
0
I know Eclipse + PyDev has an option Run As => 3 Python Coverage. But all it reports is: Ran 6 tests in 0.001s OK And it says nothing about code coverage. How to get a code coverage report in Pydev?
0
python,eclipse,code-coverage,pydev
2010-02-14T21:07:00.000
0
2,262,777
Note that in pydev 2.0, the coverage support changed, now, you should first open the coverage view and select the 'enable code coverage for new launches'... after that, any launch you do (regular or unit-test) will have coverage information being gathered (and the results inspection also became a bit more intuitive).
0
12,234
false
0
1
How to get unit test coverage results in Eclipse + Pydev?
5,648,086
2
3
0
14
13
0
1.2
0
I know Eclipse + PyDev has an option Run As => 3 Python Coverage. But all it reports is: Ran 6 tests in 0.001s OK And it says nothing about code coverage. How to get a code coverage report in Pydev?
0
python,eclipse,code-coverage,pydev
2010-02-14T21:07:00.000
0
2,262,777
Run a file with "Python Coverage" Window > Show View > Code Coverage Results View Select the directory in which the executed file is Double-click on the executed file in the file list Statistics are now at the right, not executed lines are marked red in the code view Actually this is a really nice feature, didn't know about it before :)
0
12,234
true
0
1
How to get unit test coverage results in Eclipse + Pydev?
2,262,839
2
4
0
0
0
0
0
1
I have edited about 100 html files locally, and now I want to push them to my live server, which I can only access via ftp. The HTML files are in many different directories, but hte directory structure on the remote machine is the same as on the local machine. How can I recursively descend from my top-level directory ftp-ing all of the .html files to the corresponding directory/filename on the remote machine? Thanks!
0
python,networking,scripting,ftp
2010-02-15T02:37:00.000
0
2,263,782
umm, maybe by pressing F5 in mc for linux or total commander for windows?
0
409
false
1
1
How to upload all .html files to a remote server using FTP and preserving file structure?
2,263,804
2
4
0
0
0
0
0
1
I have edited about 100 html files locally, and now I want to push them to my live server, which I can only access via ftp. The HTML files are in many different directories, but hte directory structure on the remote machine is the same as on the local machine. How can I recursively descend from my top-level directory ftp-ing all of the .html files to the corresponding directory/filename on the remote machine? Thanks!
0
python,networking,scripting,ftp
2010-02-15T02:37:00.000
0
2,263,782
if you have a mac, you can try cyberduck. It's good for syncing remote directory structures via ftp.
0
409
false
1
1
How to upload all .html files to a remote server using FTP and preserving file structure?
2,299,546
3
12
0
5
49
1
0.083141
0
Python is the nicest language I currently know of, but static typing is a big advantage due to auto-completion (although there is limited support for dynamic languages, it is nothing compared to that supported in static). I'm curious if there are any languages which try to add the benefits of Python to a statically typed language. In particular I'm interesting in languages with features like: Syntax support: such as that for dictionaries, array comprehensions Functions: Keyword arguments, closures, tuple/multiple return values Runtime modification/creation of classes Avoidance of specifying classes everywhere (in Python this is due to duck typing, although type inference would work better in a statically typed language) Metaprogramming support: This is achieved in Python through reflection, annotations and metaclasses Are there any statically typed languages with a significant number of these features?
0
python,programming-languages
2010-02-15T09:17:00.000
0
2,264,889
The Go programming language. I've seen some similar paradigm.
0
12,408
false
0
1
What statically typed languages are similar to Python?
2,269,524
3
12
0
1
49
1
0.016665
0
Python is the nicest language I currently know of, but static typing is a big advantage due to auto-completion (although there is limited support for dynamic languages, it is nothing compared to that supported in static). I'm curious if there are any languages which try to add the benefits of Python to a statically typed language. In particular I'm interesting in languages with features like: Syntax support: such as that for dictionaries, array comprehensions Functions: Keyword arguments, closures, tuple/multiple return values Runtime modification/creation of classes Avoidance of specifying classes everywhere (in Python this is due to duck typing, although type inference would work better in a statically typed language) Metaprogramming support: This is achieved in Python through reflection, annotations and metaclasses Are there any statically typed languages with a significant number of these features?
0
python,programming-languages
2010-02-15T09:17:00.000
0
2,264,889
Autocompletion is still possible in a dynamically typed language; nothing prevents the IDE from doing type inference or inspection, even if the language implementation doesn't.
0
12,408
false
0
1
What statically typed languages are similar to Python?
2,265,030
3
12
0
4
49
1
0.066568
0
Python is the nicest language I currently know of, but static typing is a big advantage due to auto-completion (although there is limited support for dynamic languages, it is nothing compared to that supported in static). I'm curious if there are any languages which try to add the benefits of Python to a statically typed language. In particular I'm interesting in languages with features like: Syntax support: such as that for dictionaries, array comprehensions Functions: Keyword arguments, closures, tuple/multiple return values Runtime modification/creation of classes Avoidance of specifying classes everywhere (in Python this is due to duck typing, although type inference would work better in a statically typed language) Metaprogramming support: This is achieved in Python through reflection, annotations and metaclasses Are there any statically typed languages with a significant number of these features?
0
python,programming-languages
2010-02-15T09:17:00.000
0
2,264,889
Rpython is a subset of Python that is statically typed.
0
12,408
false
0
1
What statically typed languages are similar to Python?
13,959,384
1
6
0
4
43
0
0.132549
0
I am just starting Python and I was wondering how I would go about programming web applications without the need of a framework. I am an experienced PHP developer but I have an urge to try out Python and I usually like to write from scratch without the restriction of a framework like flask or django to name a few.
0
python
2010-02-16T20:15:00.000
0
2,276,000
One of the lightest-weight frameworks is mod_wsgi. Anything less is going to be a huge amount of work parsing HTTP requests to find headers and URI's and methods and parsing the GET or POST query/data association, handling file uploads, cookies, etc. As it is, mod_wsgi will only handle the basics of request parsing and framing up results. Sessions, cookies, using a template generator for your response pages will be a surprising amount of work. Once you've started down that road, you may find that a little framework support goes a long way.
0
35,567
false
1
1
Program web applications in python without a framework?
2,276,041