Q_Id int64 337 49.3M | CreationDate stringlengths 23 23 | Users Score int64 -42 1.15k | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | Tags stringlengths 6 105 | A_Id int64 518 72.5M | AnswerCount int64 1 64 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 6 11.6k | Available Count int64 1 31 | Q_Score int64 0 6.79k | Data Science and Machine Learning int64 0 1 | Question stringlengths 15 29k | Title stringlengths 11 150 | Score float64 -1 1.2 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 8 6.81M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1,679,844 | 2009-11-05T11:07:00.000 | 0 | 0 | 1 | 0 | python,security,qt,pyqt | 1,682,414 | 2 | false | 0 | 0 | Depending on how your QPrinter deals with a file that already exists, you could use QTemporaryFile to create a file, then close the file and keep the reference to the QTemporaryFile object around until you are done with it. (This will also clean up the file for you when you destroy the object.) | 1 | 1 | 0 | I considered using tmpnam to set the output file name of a QPrinter. But the Python documentation recommends against using it.
os.tmpnam()
Return a unique path name that is reasonable for creating a temporary
file. ... Applications are responsible
for properly creating and managing
files created using paths retu... | How insecure is / replacement for tmpnam? | 0 | 0 | 0 | 1,726 |
1,680,194 | 2009-11-05T12:17:00.000 | 1 | 0 | 1 | 0 | python,regex,vim | 55,582,911 | 11 | false | 0 | 0 | There is a tricky way to do this if you have Vim compiled with +rightleft. You set 'allowrevins' which let you hit Ctrl+_ in insert mode to start Reverse Insert mode. It was originally made for inserting bidirectional scripts.
Type your desired word in Insert mode, or move your cursor to the end of an already typed wor... | 3 | 19 | 0 | How can I reverse a word in Vim? Preferably with a regex or normal-mode commands, but other methods are welcome too:
word => drow
Thanks for your help!
PS: I'm in windows XP
Python is built in supported in my vim, but not Perl. | Reverse a word in Vim | 0.01818 | 0 | 0 | 7,495 |
1,680,194 | 2009-11-05T12:17:00.000 | 0 | 0 | 1 | 0 | python,regex,vim | 1,680,392 | 11 | false | 0 | 0 | If you have some time on your hands, you can bubble your way there by iteratively transposing characters (xp)... | 3 | 19 | 0 | How can I reverse a word in Vim? Preferably with a regex or normal-mode commands, but other methods are welcome too:
word => drow
Thanks for your help!
PS: I'm in windows XP
Python is built in supported in my vim, but not Perl. | Reverse a word in Vim | 0 | 0 | 0 | 7,495 |
1,680,194 | 2009-11-05T12:17:00.000 | 0 | 0 | 1 | 0 | python,regex,vim | 71,982,856 | 11 | false | 0 | 0 | you can use revins mode in order to do it:
at the beginning type :set revins. from now on every letter you type will be inserted in a reverse order, until you type :set norevins to turn off. i.e, while revins is set, typing word will output drow.
in order to change an existing word after revins mode is set, and the cur... | 3 | 19 | 0 | How can I reverse a word in Vim? Preferably with a regex or normal-mode commands, but other methods are welcome too:
word => drow
Thanks for your help!
PS: I'm in windows XP
Python is built in supported in my vim, but not Perl. | Reverse a word in Vim | 0 | 0 | 0 | 7,495 |
1,680,311 | 2009-11-05T12:39:00.000 | 0 | 0 | 0 | 1 | python,linux,ubuntu,gnome | 1,680,360 | 4 | false | 0 | 1 | This normally happens automatically when calling the gtk.main() function | 1 | 7 | 0 | In Gnome, whenever an application is started, the mouse cursor changes from normal to an activity indicator (a spinning wheel type thing on Ubuntu). Is there any way to inform Gnome (through some system call) when the application has finished launching so that the mouse cursor returns to normal without waiting for the ... | GTK+ Startup Notification Icon | 0 | 0 | 0 | 840 |
1,681,143 | 2009-11-05T15:08:00.000 | 0 | 0 | 1 | 0 | python,datetime,time,timezone,pytz | 18,385,592 | 8 | false | 0 | 0 | Maybe try:
import time
print time.tzname #or time.tzname[time.daylight] | 1 | 34 | 0 | Is there a cross-platform function in python (or pytz) that returns a tzinfo object corresponding to the timezone currently set on the computer?
environment variables cannot be counted on as they are not cross-platform | how to get tz_info object corresponding to current timezone? | 0 | 0 | 0 | 32,220 |
1,681,208 | 2009-11-05T15:17:00.000 | 6 | 0 | 1 | 1 | python,path,cross-platform,environment-variables | 1,681,256 | 4 | false | 0 | 0 | The caveat to be aware of with modifying environment variables in Python, is that there is no equivalent of the "export" shell command. There is no way of injecting changes into the current process, only child processes. | 1 | 102 | 0 | Is there a way to modify the PATH environment variable in a platform independent way using python?
Something similar to os.path.join()? | Python: Platform independent way to modify PATH environment variable | 1 | 0 | 0 | 88,027 |
1,682,831 | 2009-11-05T19:03:00.000 | 1 | 1 | 1 | 0 | python,embedding | 1,682,872 | 1 | true | 0 | 0 | The only idea I could think of would be to simply give the user a method (menu option, etc) of executing scripts in the program.
Correct.
So certain classes, functions, objects, etc. would be exported to python, some script would do something, then said script could be run from the program.
Correct.
Would such a design... | 1 | 2 | 0 | There are lots of tutorials/instructions on how to embed python in an application, but nothing (that I've seen) on overall design for how the embedded interpreter should be used and interact with the application.
The only idea I could think of would be to simply give the user a method (menu option, etc) of executing sc... | Embedding Python Design | 1.2 | 0 | 0 | 282 |
1,683,831 | 2009-11-05T21:39:00.000 | 1 | 0 | 0 | 1 | python,windows,temporary-files | 1,683,853 | 4 | false | 0 | 0 | There shouldn't be such space limitation in Temp. If you wrote the app, I would recommend creating your files in ProgramData... | 3 | 5 | 0 | I have an application written in Python that's writing large amounts of data to the %TEMP% folder. Oddly, every once and awhile, it dies, returning IOError: [Errno 28] No space left on device. The drive has plenty of free space, %TEMP% is not its own partition, I'm an administrator, and the system has no quotas.
Does... | Limitations of TEMP directory in Windows? | 0.049958 | 0 | 0 | 13,119 |
1,683,831 | 2009-11-05T21:39:00.000 | 2 | 0 | 0 | 1 | python,windows,temporary-files | 1,683,908 | 4 | false | 0 | 0 | Using a FAT32 filesystem I can imagine this happening when:
Writing a lot of data to one file, and you reach the 4GB file size cap.
Or when you are creating a lot of small files and reaching the 2^16-2 files per directory cap.
Apart from this, I don't know of any limitations the system can impose on the temp folder, ... | 3 | 5 | 0 | I have an application written in Python that's writing large amounts of data to the %TEMP% folder. Oddly, every once and awhile, it dies, returning IOError: [Errno 28] No space left on device. The drive has plenty of free space, %TEMP% is not its own partition, I'm an administrator, and the system has no quotas.
Does... | Limitations of TEMP directory in Windows? | 0.099668 | 0 | 0 | 13,119 |
1,683,831 | 2009-11-05T21:39:00.000 | 0 | 0 | 0 | 1 | python,windows,temporary-files | 1,683,911 | 4 | false | 0 | 0 | There should be no trouble whatsoever with regard to your %TEMP% directory.
What is your disk quota set to for %TEMP%'s hosting volume? Depending in part on what the apps themselves are doing, one of them may be throwing an error due to the disk quota being reached, which is a pain if this quota is set unreasonably ... | 3 | 5 | 0 | I have an application written in Python that's writing large amounts of data to the %TEMP% folder. Oddly, every once and awhile, it dies, returning IOError: [Errno 28] No space left on device. The drive has plenty of free space, %TEMP% is not its own partition, I'm an administrator, and the system has no quotas.
Does... | Limitations of TEMP directory in Windows? | 0 | 0 | 0 | 13,119 |
1,684,145 | 2009-11-05T22:37:00.000 | -1 | 1 | 0 | 0 | c#,.net,python,ruby | 1,684,168 | 4 | false | 0 | 1 | I have seen ways to call into Ruby / Python from c#. But it's easier the other way around. | 1 | 8 | 0 | I have a lot of APIs/Classes that I have developed in Ruby and Python that I would like to use in my .NET apps. Is it possible to instantiate a Ruby or Python Object in C# and call its methods?
It seems that libraries like IronPython do the opposite of this. Meaning, they allow Python to utilize .NET objects, but not t... | Call Ruby or Python API in C# .NET | -0.049958 | 0 | 0 | 5,027 |
1,685,558 | 2009-11-06T05:15:00.000 | 1 | 0 | 1 | 0 | python | 1,685,597 | 1 | true | 0 | 0 | You could use r'(Start \d+.*?group=.*?name=.*?number=.*?end=\d+)*'. | 1 | 0 | 0 | I want to validate below data using regex and python.
Below is the dump of the data which Can be stored in string variable
Start 0 .......... group=..... name=...... number=.... end=(digits)
Start 1 .......... group=..... name=...... number=.... end=(digits)
Start 2 .......... group=..... name=...... number=.... en... | how to write regex for below format using python | 1.2 | 0 | 0 | 92 |
1,686,192 | 2009-11-06T08:27:00.000 | 24 | 1 | 0 | 0 | python,performance | 1,686,232 | 8 | false | 0 | 0 | This totally depends on the usecase. For long running applications (like servers), Java has proven to be extremely fast - even faster than C. This is possible as the JVM might compile hot bytecode to machine code. While doing this, it may take fully advantage of each and every feature of the CPU. This typically isn't p... | 4 | 12 | 0 | I'm a Java programmer and if there's one thing that I dislike about it, it would be speed. Java seems really slow, but a lot of the Python scriptsprograms I have written so far seem really fast.
So I was just wondering if Python is faster than Java, or C# and how that compares to C/C++ (which I figure it'll be slower ... | How fast is Python? | 1 | 0 | 0 | 29,026 |
1,686,192 | 2009-11-06T08:27:00.000 | 0 | 1 | 0 | 0 | python,performance | 7,529,473 | 8 | false | 0 | 0 | For the Python, velocity depends also for the interpreter implementations... I saw that pypy is generally faster than cpython. | 4 | 12 | 0 | I'm a Java programmer and if there's one thing that I dislike about it, it would be speed. Java seems really slow, but a lot of the Python scriptsprograms I have written so far seem really fast.
So I was just wondering if Python is faster than Java, or C# and how that compares to C/C++ (which I figure it'll be slower ... | How fast is Python? | 0 | 0 | 0 | 29,026 |
1,686,192 | 2009-11-06T08:27:00.000 | 2 | 1 | 0 | 0 | python,performance | 1,686,811 | 8 | false | 0 | 0 | It is very hard to make a truly objective and general comparison of the runtime speed of two languages. In comparing any two languages X and Y, one often finds X is faster than Y in some respects while being slower in others. For me, this makes any benchmarks/comparisons available online largely useless. The best way i... | 4 | 12 | 0 | I'm a Java programmer and if there's one thing that I dislike about it, it would be speed. Java seems really slow, but a lot of the Python scriptsprograms I have written so far seem really fast.
So I was just wondering if Python is faster than Java, or C# and how that compares to C/C++ (which I figure it'll be slower ... | How fast is Python? | 0.049958 | 0 | 0 | 29,026 |
1,686,192 | 2009-11-06T08:27:00.000 | 0 | 1 | 0 | 0 | python,performance | 1,686,388 | 8 | false | 0 | 0 | It's a question you can't answer properly, because it all depends when it has to be fast.
Java is good for huge servers, it's bad when you have to re-compile and test a lot of times your code (compilation is sooooooo slow). Python doesn't even have to be compiled to test !
In production environment, it's totally silly ... | 4 | 12 | 0 | I'm a Java programmer and if there's one thing that I dislike about it, it would be speed. Java seems really slow, but a lot of the Python scriptsprograms I have written so far seem really fast.
So I was just wondering if Python is faster than Java, or C# and how that compares to C/C++ (which I figure it'll be slower ... | How fast is Python? | 0 | 0 | 0 | 29,026 |
1,686,235 | 2009-11-06T08:37:00.000 | 2 | 0 | 0 | 0 | python,model-view-controller,user-interface | 1,738,316 | 3 | true | 1 | 1 | The anomaly (from the MVC viewpoint) that makes this design difficult to make MVC-conformant is that you want to display information that, by your conceptualization, "does not live in a model". There is no such thing as "information that does not live in a model" in MVC: its conceptual root is "the models hold all the... | 1 | 4 | 0 | I have a widget that displays a filesystem hierarchy for convenient browsing (basically a tree control and some associated toolbar buttons, such as "refresh"). Each of these widgets has a set of base directories for it to display (recursively). Assume that the user may instantiate as many of these widgets as they find ... | wxPython: How should I organize per-widget data in the controller? | 1.2 | 0 | 0 | 519 |
1,686,768 | 2009-11-06T10:36:00.000 | 1 | 0 | 1 | 0 | python,pylons | 1,686,843 | 2 | false | 0 | 0 | Because threading.local is new in Python 2.4. The StackedObjectProxy uses threading.local if it can. | 1 | 2 | 0 | It seems like threading.local is more straightforward and more robust. | Why does Pylons use StackedObjectProxies instead of threading.local? | 0.099668 | 0 | 0 | 731 |
1,687,357 | 2009-11-06T12:45:00.000 | -4 | 0 | 1 | 1 | python,macos,python-3.x | 67,923,827 | 23 | false | 0 | 0 | You can do it from Terminal too. It's quite easy. You just need to type python3 --version and | 7 | 140 | 0 | I wanted to update my python 2.6.1 to 3.x on mac but i was wondering if its possible to do it using terminal or i have to download the installer from python website?
The reason why i am asking this question is because installer is not updating my terminal python version. | Updating Python on Mac | -1 | 0 | 0 | 519,726 |
1,687,357 | 2009-11-06T12:45:00.000 | 5 | 0 | 1 | 1 | python,macos,python-3.x | 1,687,431 | 23 | false | 0 | 0 | I believe Python 3 can coexist with Python 2. Try invoking it using "python3" or "python3.1". If it fails, you might need to uninstall 2.6 before installing 3.1. | 7 | 140 | 0 | I wanted to update my python 2.6.1 to 3.x on mac but i was wondering if its possible to do it using terminal or i have to download the installer from python website?
The reason why i am asking this question is because installer is not updating my terminal python version. | Updating Python on Mac | 0.043451 | 0 | 0 | 519,726 |
1,687,357 | 2009-11-06T12:45:00.000 | 3 | 0 | 1 | 1 | python,macos,python-3.x | 1,688,349 | 23 | false | 0 | 0 | I personally wouldn't mess around with OSX's python like they said. My personally preference for stuff like this is just using MacPorts and installing the versions I want via command line. MacPorts puts everything into a separate direction (under /opt I believe), so it doesn't override or directly interfere with the re... | 7 | 140 | 0 | I wanted to update my python 2.6.1 to 3.x on mac but i was wondering if its possible to do it using terminal or i have to download the installer from python website?
The reason why i am asking this question is because installer is not updating my terminal python version. | Updating Python on Mac | 0.026081 | 0 | 0 | 519,726 |
1,687,357 | 2009-11-06T12:45:00.000 | 0 | 0 | 1 | 1 | python,macos,python-3.x | 47,333,658 | 23 | false | 0 | 0 | First, install Homebrew (The missing package manager for macOS) if you haven': Type this in your terminal
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Now you can update your Python to python 3 by this command
brew install python3 && cp /usr/local/bin/python3 /usr/... | 7 | 140 | 0 | I wanted to update my python 2.6.1 to 3.x on mac but i was wondering if its possible to do it using terminal or i have to download the installer from python website?
The reason why i am asking this question is because installer is not updating my terminal python version. | Updating Python on Mac | 0 | 0 | 0 | 519,726 |
1,687,357 | 2009-11-06T12:45:00.000 | 2 | 0 | 1 | 1 | python,macos,python-3.x | 66,423,786 | 23 | false | 0 | 0 | Sometimes when you install Python from the install wizard on MAC it will not link to your bash profile. Since you are using homebrew, just to brew install python This would install the latest version of Python and then to link them brew link python@3.9 | 7 | 140 | 0 | I wanted to update my python 2.6.1 to 3.x on mac but i was wondering if its possible to do it using terminal or i have to download the installer from python website?
The reason why i am asking this question is because installer is not updating my terminal python version. | Updating Python on Mac | 0.01739 | 0 | 0 | 519,726 |
1,687,357 | 2009-11-06T12:45:00.000 | 1 | 0 | 1 | 1 | python,macos,python-3.x | 71,035,575 | 23 | false | 0 | 0 | Install Home brew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install python 3 brew install python3 && cp /usr/local/bin/python3 /usr/local/bin/python
Update python to latest version ln -s -f /usr/local/bin/python[your-latest-version-just-installed] /usr/local/bin/pyt... | 7 | 140 | 0 | I wanted to update my python 2.6.1 to 3.x on mac but i was wondering if its possible to do it using terminal or i have to download the installer from python website?
The reason why i am asking this question is because installer is not updating my terminal python version. | Updating Python on Mac | 0.008695 | 0 | 0 | 519,726 |
1,687,357 | 2009-11-06T12:45:00.000 | 1 | 0 | 1 | 1 | python,macos,python-3.x | 61,615,371 | 23 | false | 0 | 0 | If it were me, I would just leave it as it is.
Use python3 and pip3 to run your files since python and python3 can coexist.
brew install python3 && cp /usr/local/bin/python3 /usr/local/bin/python
You can use the above line but it might have unintended consequences. | 7 | 140 | 0 | I wanted to update my python 2.6.1 to 3.x on mac but i was wondering if its possible to do it using terminal or i have to download the installer from python website?
The reason why i am asking this question is because installer is not updating my terminal python version. | Updating Python on Mac | 0.008695 | 0 | 0 | 519,726 |
1,687,510 | 2009-11-06T13:10:00.000 | 9 | 0 | 0 | 0 | python,nlp,nltk,chunking | 1,687,712 | 2 | true | 0 | 0 | You can get out of the box named entity chunking with the nltk.ne_chunk() method. It takes a list of POS tagged tuples:
nltk.ne_chunk([('Barack', 'NNP'), ('Obama', 'NNP'), ('lives', 'NNS'), ('in', 'IN'), ('Washington', 'NNP')])
results in:
Tree('S', [Tree('PERSON', [('Barack', 'NNP')]), Tree('ORGANIZATION', [('Obama',... | 1 | 9 | 1 | I am using their default POS tagging and default tokenization..and it seems sufficient. I'd like their default chunker too.
I am reading the NLTK toolkit book, but it does not seem like they have a default chunker? | What is the default chunker for NLTK toolkit in Python? | 1.2 | 0 | 0 | 4,560 |
1,688,845 | 2009-11-06T16:46:00.000 | 4 | 0 | 0 | 0 | python,import | 1,688,883 | 1 | true | 0 | 0 | You have to build the extension from source yourself.
It was valiant of you to try and "reverse the bytes", but only certain sections of the ELF file have word-oriented (as opposed to byte-oriented) data.
Furthermore, it's unlikely that the dll in question was compiled for your system's CPU architecture. | 1 | 1 | 0 | Im attempting to use a C++ extension for Python called PySndObj. and getting an error I have never seen and cannot find anything about on the web :(
ImportError: /home/nhnifong/SndObj-2.6.6/python/_sndobj.so: ELF file data encoding not little-endian
I know that probably means the byte order is backwards, So I tried wri... | Why am I getting a little-endian error when importing .so file in python | 1.2 | 0 | 0 | 2,256 |
1,689,015 | 2009-11-06T17:16:00.000 | 36 | 0 | 0 | 1 | python,windows,shell | 1,689,269 | 9 | false | 0 | 0 | If you name your files with the ".pyw" extension, then windows will execute them with the pythonw.exe interpreter. This will not open the dos console for running your script. | 3 | 71 | 0 | Is there any way to run a Python script in Windows XP without a command shell momentarily appearing? I often need to automate WordPerfect (for work) with Python, and even if my script has no output, if I execute it from without WP an empty shell still pops up for a second before disappearing. Is there any way to preven... | Run Python script without Windows console appearing | 1 | 0 | 0 | 105,900 |
1,689,015 | 2009-11-06T17:16:00.000 | -2 | 0 | 0 | 1 | python,windows,shell | 62,431,147 | 9 | false | 0 | 0 | I had the same problem. I tried many options, and all of them failed
But I tried this method, and it magically worked!!!!!
So, I had this python file (mod.py) in a folder, I used to run using command prompt
When I used to close the cmd the gui is automatically closed.....(SAD),
So I run it as follows
C:\....>pythonw m... | 3 | 71 | 0 | Is there any way to run a Python script in Windows XP without a command shell momentarily appearing? I often need to automate WordPerfect (for work) with Python, and even if my script has no output, if I execute it from without WP an empty shell still pops up for a second before disappearing. Is there any way to preven... | Run Python script without Windows console appearing | -0.044415 | 0 | 0 | 105,900 |
1,689,015 | 2009-11-06T17:16:00.000 | 0 | 0 | 0 | 1 | python,windows,shell | 69,071,490 | 9 | false | 0 | 0 | Turn of your window defender. And install pyinstaller package using pip install pyinstaller .
After installing open cmd and type pyinstaller --onefile --noconsole filename.py | 3 | 71 | 0 | Is there any way to run a Python script in Windows XP without a command shell momentarily appearing? I often need to automate WordPerfect (for work) with Python, and even if my script has no output, if I execute it from without WP an empty shell still pops up for a second before disappearing. Is there any way to preven... | Run Python script without Windows console appearing | 0 | 0 | 0 | 105,900 |
1,689,031 | 2009-11-06T17:18:00.000 | 1 | 0 | 0 | 0 | python,mysql,django,overhead | 1,689,143 | 4 | false | 1 | 0 | There is always overhead in database calls, in your case the overhead is not that bad because the application and database are on the same machine so there is no network latency but there is still a significant cost.
When you make a request to the database it has to prepare to service that request by doing a number of ... | 4 | 3 | 0 | So I've been building django applications for a while now, and drinking the cool-aid and all: only using the ORM and never writing custom SQL.
The main page of the site (the primary interface where users will spend 80% - 90% of their time) was getting slow once you have a large amount of user specific content (ie photo... | Overhead of a Round-trip to MySql? | 0.049958 | 1 | 0 | 1,620 |
1,689,031 | 2009-11-06T17:18:00.000 | 3 | 0 | 0 | 0 | python,mysql,django,overhead | 1,689,146 | 4 | false | 1 | 0 | The overhead of each queries is only part of the picture. The actual round trip time between your Django and Mysql servers is probably very small since most of your queries are coming back in less than a one millisecond. The bigger problem is that the number of queries issued to your database can quickly overwhelm it.... | 4 | 3 | 0 | So I've been building django applications for a while now, and drinking the cool-aid and all: only using the ORM and never writing custom SQL.
The main page of the site (the primary interface where users will spend 80% - 90% of their time) was getting slow once you have a large amount of user specific content (ie photo... | Overhead of a Round-trip to MySql? | 0.148885 | 1 | 0 | 1,620 |
1,689,031 | 2009-11-06T17:18:00.000 | 4 | 0 | 0 | 0 | python,mysql,django,overhead | 1,689,452 | 4 | false | 1 | 0 | Just because you are using an ORM doesn't mean that you shouldn't do performance tuning.
I had - like you - a home page of one of my applications that had low performance. I saw that I was doing hundreds of queries to display that page. I went looking at my code and realized that with some careful use of select_relate... | 4 | 3 | 0 | So I've been building django applications for a while now, and drinking the cool-aid and all: only using the ORM and never writing custom SQL.
The main page of the site (the primary interface where users will spend 80% - 90% of their time) was getting slow once you have a large amount of user specific content (ie photo... | Overhead of a Round-trip to MySql? | 0.197375 | 1 | 0 | 1,620 |
1,689,031 | 2009-11-06T17:18:00.000 | 2 | 0 | 0 | 0 | python,mysql,django,overhead | 1,689,330 | 4 | true | 1 | 0 | There are some ways to reduce the query volume.
Use .filter() and .all() to get a bunch of things; pick and choose in the view function (or template via {%if%}). Python can process a batch of rows faster than MySQL.
"But I could send too much to the template". True, but you'll execute fewer SQL requests. Measure... | 4 | 3 | 0 | So I've been building django applications for a while now, and drinking the cool-aid and all: only using the ORM and never writing custom SQL.
The main page of the site (the primary interface where users will spend 80% - 90% of their time) was getting slow once you have a large amount of user specific content (ie photo... | Overhead of a Round-trip to MySql? | 1.2 | 1 | 0 | 1,620 |
1,689,570 | 2009-11-06T18:56:00.000 | 0 | 0 | 0 | 1 | python,security,google-app-engine,automation | 1,690,155 | 5 | false | 1 | 0 | Can you break up the scraping process into independent chunks that can each finish in the timeframe of an appengine request? (which can run longer than one second btw). Then you can just spawn a bunch of tasks using the task API that when combined, accomplish the full scrape. Then use the cron API to spawn off those ... | 4 | 0 | 0 | I'm writing an aggregation application which scrapes data from a couple of web sources and displays that data with a novel interface. The sites from which I'm scraping update every couple of minutes, and I want to make sure the data on my aggregator is up-to-date.
What's the best way to periodically submit fresh data t... | How do I upload data to Google App Engine periodically? | 0 | 0 | 0 | 400 |
1,689,570 | 2009-11-06T18:56:00.000 | 3 | 0 | 0 | 1 | python,security,google-app-engine,automation | 1,690,150 | 5 | true | 1 | 0 | Write a Task Queue task or an App Engine cron job to handle this. I'm not sure where you heard that there's a limit of 1 second on any sort of App Engine operations - requests are limited to 30 seconds, and URL fetches have a maximum deadline of 10 seconds. | 4 | 0 | 0 | I'm writing an aggregation application which scrapes data from a couple of web sources and displays that data with a novel interface. The sites from which I'm scraping update every couple of minutes, and I want to make sure the data on my aggregator is up-to-date.
What's the best way to periodically submit fresh data t... | How do I upload data to Google App Engine periodically? | 1.2 | 0 | 0 | 400 |
1,689,570 | 2009-11-06T18:56:00.000 | 0 | 0 | 0 | 1 | python,security,google-app-engine,automation | 1,689,805 | 5 | false | 1 | 0 | The only way to get data into AppEngine is to call up a Web app of yours (as a Web app) and feed it data through the usual HTTP-ish means, i.e. as parameters to a GET request (for short data) or to a POST (if long or binary).
In other words, you'll have to craft your own little dataloader, which you will access as a We... | 4 | 0 | 0 | I'm writing an aggregation application which scrapes data from a couple of web sources and displays that data with a novel interface. The sites from which I'm scraping update every couple of minutes, and I want to make sure the data on my aggregator is up-to-date.
What's the best way to periodically submit fresh data t... | How do I upload data to Google App Engine periodically? | 0 | 0 | 0 | 400 |
1,689,570 | 2009-11-06T18:56:00.000 | 0 | 0 | 0 | 1 | python,security,google-app-engine,automation | 1,693,701 | 5 | false | 1 | 0 | I asked around and some friends came up with two solutions:
Upload a file with a shared secret token along with the application, but when committing to the codebase, change the token.
Create a small datastore model with one row, a secret token.
In both cases the token can be used to authenticate POST requests used to... | 4 | 0 | 0 | I'm writing an aggregation application which scrapes data from a couple of web sources and displays that data with a novel interface. The sites from which I'm scraping update every couple of minutes, and I want to make sure the data on my aggregator is up-to-date.
What's the best way to periodically submit fresh data t... | How do I upload data to Google App Engine periodically? | 0 | 0 | 0 | 400 |
1,691,179 | 2009-11-06T23:16:00.000 | 53 | 0 | 0 | 1 | python,tcp,twisted,protocols | 1,691,189 | 4 | true | 0 | 0 | As long as the two messages were sent on the same TCP connection, order will be maintained. If multiple connections are opened between the same pair of processes, you may be in trouble.
Regarding Twisted, or any other asynchronous event system: I expect you'll get the dataReceived messages in the order that bytes are ... | 3 | 43 | 0 | If I send two TCP messages, do I need to handle the case where the latter arrives before the former? Or is it guaranteed to arrive in the order I send it? I assume that this is not a Twisted-specific example, because it should conform to the TCP standard, but if anyone familiar with Twisted could provide a Twisted-spec... | Is TCP Guaranteed to arrive in order? | 1.2 | 0 | 0 | 30,177 |
1,691,179 | 2009-11-06T23:16:00.000 | 25 | 0 | 0 | 1 | python,tcp,twisted,protocols | 1,691,197 | 4 | false | 0 | 0 | TCP is connection-oriented and offers its Clients in-order delivery. Of course this applies to the connection level: individual connections are independent.
You should note that normally we refer to "TCP streams" and "UDP messages".
Whatever Client library you use (e.g. Twisted), the underlying TCP connection is indepe... | 3 | 43 | 0 | If I send two TCP messages, do I need to handle the case where the latter arrives before the former? Or is it guaranteed to arrive in the order I send it? I assume that this is not a Twisted-specific example, because it should conform to the TCP standard, but if anyone familiar with Twisted could provide a Twisted-spec... | Is TCP Guaranteed to arrive in order? | 1 | 0 | 0 | 30,177 |
1,691,179 | 2009-11-06T23:16:00.000 | 8 | 0 | 0 | 1 | python,tcp,twisted,protocols | 1,691,194 | 4 | false | 0 | 0 | TCP is a stream, UDP is a message. You're mixing up terms. For TCP it is true that the stream will arrive in the same order as it was send. There are no distict messages in TCP, bytes appear as they arrive, interpreting them as messages is up to you. | 3 | 43 | 0 | If I send two TCP messages, do I need to handle the case where the latter arrives before the former? Or is it guaranteed to arrive in the order I send it? I assume that this is not a Twisted-specific example, because it should conform to the TCP standard, but if anyone familiar with Twisted could provide a Twisted-spec... | Is TCP Guaranteed to arrive in order? | 1 | 0 | 0 | 30,177 |
1,691,400 | 2009-11-07T00:21:00.000 | 1 | 0 | 0 | 0 | python,django,symfony1 | 1,691,549 | 2 | false | 1 | 0 | Assuming you are going to be using the components in different places on different pages I would suggest trying {% include "foo.html" %}. One of the (several) downsides of the Django templating language is that there is no concept of macros, so you need to be very consistent in the names of values in the context you pa... | 1 | 1 | 0 | I've been developing in the Symfony framework for quite a time, but now I have to work with Django and I'm having problems with doing something like a "component" or "partial" in Symfony.
That said, here is my goal:
I have a webpage with lots of small widgets, all these need their logic - located in a "views.py" I gue... | How to implement Symfony Partials or Components in Django? | 0.099668 | 0 | 0 | 715 |
1,692,082 | 2009-11-07T05:18:00.000 | 6 | 0 | 0 | 1 | python,progress-bar,subprocess,popen,apt-get | 1,692,347 | 2 | false | 0 | 0 | Instead of parsing the output of the apt-get, you can use python-apt to install packages. AFAIK it also has modules for reporting the progress. | 1 | 6 | 0 | I'm working on a simple GUI Python script to do some simple tasks on a system. Some of that work involves apt-get install to install some packages.
While this is going on, I want to display a progress bar that should update with the progress of the download, using the little percentage shown in apt-get's interface in t... | Parsing output of apt-get install for progress bar | 1 | 0 | 0 | 3,478 |
1,692,107 | 2009-11-07T05:29:00.000 | 6 | 0 | 1 | 0 | python,performance,switch-statement | 1,692,119 | 6 | false | 0 | 0 | Your concern should be about the readability and maintainability of the code, rather than its efficiency. This applies in most scenarios, and particularly in the one you describe now. The efficiency difference is likely to be negligible (you can easily check it with a small amount of benchmarking code), but 30-40 elif'... | 4 | 3 | 0 | I have read a few articles around alternatives to the switch statement in Python. Mainly using dicts instead of lots of if's and elif's. However none really answer the question: is there one with better performance or efficiency? I have read a few arguments that if's and elifs would have to check each statement and bec... | Performance difference in alternative switches in Python | 1 | 0 | 0 | 1,377 |
1,692,107 | 2009-11-07T05:29:00.000 | 1 | 0 | 1 | 0 | python,performance,switch-statement | 1,692,248 | 6 | false | 0 | 0 | Times when you'd use a switch in many languages you would use a dict in Python. A switch statement, if added to Python (it's been considered), would not be able to give any real performance gain anyways.
dicts are used ubiquitously in Python. CPython dicts are an insanely-efficient, robust hashtable implementation. Loo... | 4 | 3 | 0 | I have read a few articles around alternatives to the switch statement in Python. Mainly using dicts instead of lots of if's and elif's. However none really answer the question: is there one with better performance or efficiency? I have read a few arguments that if's and elifs would have to check each statement and bec... | Performance difference in alternative switches in Python | 0.033321 | 0 | 0 | 1,377 |
1,692,107 | 2009-11-07T05:29:00.000 | 0 | 0 | 1 | 0 | python,performance,switch-statement | 1,692,132 | 6 | false | 0 | 0 | I think a dict will gain advantage over the alternative sequence of if statements as the number of cases goes up, since the key lookup only requires one hash operation. Otherwise if you only have a few cases, a few if statements are better. A dict is probably a more elegant solution for what you are doing. Either way, ... | 4 | 3 | 0 | I have read a few articles around alternatives to the switch statement in Python. Mainly using dicts instead of lots of if's and elif's. However none really answer the question: is there one with better performance or efficiency? I have read a few arguments that if's and elifs would have to check each statement and bec... | Performance difference in alternative switches in Python | 0 | 0 | 0 | 1,377 |
1,692,107 | 2009-11-07T05:29:00.000 | 8 | 0 | 1 | 0 | python,performance,switch-statement | 1,692,135 | 6 | false | 0 | 0 | dict's perfomance is typically going to be unbeatable, because a lookup into a dict is going to be O(1) except in rare and practically never-observed cases (where they key involves user-coded types with lousy hashing;-). You don't have to "create new modules" as you say, just arbitrary callables, and that creation, wh... | 4 | 3 | 0 | I have read a few articles around alternatives to the switch statement in Python. Mainly using dicts instead of lots of if's and elif's. However none really answer the question: is there one with better performance or efficiency? I have read a few arguments that if's and elifs would have to check each statement and bec... | Performance difference in alternative switches in Python | 1 | 0 | 0 | 1,377 |
1,693,088 | 2009-11-07T13:51:00.000 | 7 | 1 | 1 | 0 | python,optimization,assert,bytecode | 1,693,940 | 7 | false | 0 | 0 | I have never encountered a good reason to use -O. I have always assumed its main purpose is in case at some point in the future some meaningful optimization is added. | 2 | 50 | 0 | Python has a flag -O that you can execute the interpreter with. The option will generate "optimized" bytecode (written to .pyo files), and given twice, it will discard docstrings. From Python's man page:
-O Turn on basic optimizations. This changes the filename extension
for compiled (bytecode) files from .py... | What is the use of Python's basic optimizations mode? (python -O) | 1 | 0 | 0 | 12,397 |
1,693,088 | 2009-11-07T13:51:00.000 | 4 | 1 | 1 | 0 | python,optimization,assert,bytecode | 1,693,128 | 7 | false | 0 | 0 | You've pretty much figured it out: It does practically nothing at all. You're almost never going to see speed or memory gains, unless you're severely hurting for RAM. | 2 | 50 | 0 | Python has a flag -O that you can execute the interpreter with. The option will generate "optimized" bytecode (written to .pyo files), and given twice, it will discard docstrings. From Python's man page:
-O Turn on basic optimizations. This changes the filename extension
for compiled (bytecode) files from .py... | What is the use of Python's basic optimizations mode? (python -O) | 0.113791 | 0 | 0 | 12,397 |
1,693,205 | 2009-11-07T14:27:00.000 | 1 | 1 | 1 | 0 | .net,python,performance,ironpython | 1,694,288 | 3 | false | 0 | 0 | You could enable .net tracing, which outputs timing information at the bottom of the page. Make an app in C#/.Net and an app using Python and look at the differences in timing. That will give you a definitive answer.
In all honesty I think you're better off just using C#, it's "faster" to develop since the VS environme... | 2 | 10 | 0 | I would like to give sources for what I'm saying but I just dont have them, it's something I heard.
Once a programming professor told me that some software benchmarking done to .net vs Python in some particular items it gave a relation of 5:8 in favor of .NET . That was his argument in favor of Python not being so much... | How does ironpython speed compare to other .net languages? | 0.066568 | 0 | 0 | 6,879 |
1,693,205 | 2009-11-07T14:27:00.000 | 0 | 1 | 1 | 0 | .net,python,performance,ironpython | 2,617,858 | 3 | false | 0 | 0 | IronPython will be considerably slower than C#. You could think of the comparison as very roughly between CPython and C, but with the gap somewhat smaller. | 2 | 10 | 0 | I would like to give sources for what I'm saying but I just dont have them, it's something I heard.
Once a programming professor told me that some software benchmarking done to .net vs Python in some particular items it gave a relation of 5:8 in favor of .NET . That was his argument in favor of Python not being so much... | How does ironpython speed compare to other .net languages? | 0 | 0 | 0 | 6,879 |
1,693,564 | 2009-11-07T16:24:00.000 | 1 | 0 | 0 | 0 | python,apache2,wsgi,x-sendfile | 1,693,668 | 2 | false | 1 | 0 | I have discovered the answer. Use the BETA version provided. It seems to fix this issue. | 1 | 3 | 0 | Any filesize over about 4GB is not going to work with the mod_xsendfile for Apache2 (as it sets the content length to a long).
I am willing to rewrite it to support this; however, I can find no documentation on how to set content length from the apache api to something larger than a long and thus serve large files thro... | X-Sendfile and VERY big files on Apache2 | 0.099668 | 0 | 0 | 1,086 |
1,693,815 | 2009-11-07T17:39:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,indexing,archive,bigtable | 1,693,856 | 2 | false | 1 | 0 | Unless someone's written utilities for this kind of thing, the way to go is to read from one and write to the other kind! | 2 | 0 | 0 | Is there a way to move an entity to another kind in appengine.
Say you have a kind defines, and you want to keep a record of deleted entities of that kind.
But you want to separate the storage of live object and archived objects.
Kinds are basically just serialized dicts in the bigtable anyway. And maybe you don't need... | Move or copy an entity to another kind | 0.099668 | 0 | 0 | 162 |
1,693,815 | 2009-11-07T17:39:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,indexing,archive,bigtable | 1,693,979 | 2 | true | 1 | 0 | No - once created, the kind is a part of the entity's immutable key. You need to create a new entity and copy everything across. One way to do this would be to use the low-level google.appengine.api.datastore interface, which treats entities as dicts. | 2 | 0 | 0 | Is there a way to move an entity to another kind in appengine.
Say you have a kind defines, and you want to keep a record of deleted entities of that kind.
But you want to separate the storage of live object and archived objects.
Kinds are basically just serialized dicts in the bigtable anyway. And maybe you don't need... | Move or copy an entity to another kind | 1.2 | 0 | 0 | 162 |
1,694,205 | 2009-11-07T19:53:00.000 | 3 | 1 | 0 | 0 | python,joomla,xml-rpc | 1,696,183 | 1 | true | 0 | 0 | the book "Mastering Joomla 1.5 Extension and Framework Development" has a nice explanation of that.
Joomla has a fex XML-RPC plugins that let you do a few things, like the blogger API interface. (plugins/xmlrpc/blogger.php)
You should create your own XML-RPC plugin to do the custom things you want. | 1 | 3 | 0 | How do I get started with getting going with XML-RPC with joomla? I've been looking around for documentation and finding nothing...
I'd like to connect to a joomla server, (after enabling the Core Joomla XML-RPC plugin), and be able to do things like login and add an article, and tweak all the parameters of the article... | Joomla and XMLRPC | 1.2 | 0 | 1 | 2,670 |
1,695,014 | 2009-11-08T01:20:00.000 | 1 | 0 | 1 | 0 | python,security,virtual-machine,interpreter | 1,695,275 | 8 | false | 0 | 0 | I am an undergrad and in my first year, we were taught python. We had these things called "CodeLabs" that had to be submitted periodically. It works by asking a question and asking the student to input their answer into a text box and running that code on some test cases and checking their return values
One day, the co... | 5 | 6 | 0 | Is there a secure Python intepreter?
Imagine a Python VM you can run on your machine, that restricts the operations.
No files can be opened, no system calls, etc.
It just transforms stdin to stdout, maybe with text processing + math etc.
Does such a secure Python VM exist? | Secure Python intepreter? | 0.024995 | 0 | 0 | 1,260 |
1,695,014 | 2009-11-08T01:20:00.000 | -1 | 0 | 1 | 0 | python,security,virtual-machine,interpreter | 2,215,015 | 8 | false | 0 | 0 | Isn't security more a job for the operating system ?
I mean, create a user with restricted access to files and such. Then let the vm be ran only with these rights.
Or maybe I'm speaking nonsense. I'm no sysadmin or security expert, but I tend to do things with the tools that are made for it. | 5 | 6 | 0 | Is there a secure Python intepreter?
Imagine a Python VM you can run on your machine, that restricts the operations.
No files can be opened, no system calls, etc.
It just transforms stdin to stdout, maybe with text processing + math etc.
Does such a secure Python VM exist? | Secure Python intepreter? | -0.024995 | 0 | 0 | 1,260 |
1,695,014 | 2009-11-08T01:20:00.000 | 2 | 0 | 1 | 0 | python,security,virtual-machine,interpreter | 1,695,169 | 8 | true | 0 | 0 | You could run Jython on the JVM with a SecurityManager that allows you to specify permitted / disallowed operations. | 5 | 6 | 0 | Is there a secure Python intepreter?
Imagine a Python VM you can run on your machine, that restricts the operations.
No files can be opened, no system calls, etc.
It just transforms stdin to stdout, maybe with text processing + math etc.
Does such a secure Python VM exist? | Secure Python intepreter? | 1.2 | 0 | 0 | 1,260 |
1,695,014 | 2009-11-08T01:20:00.000 | -1 | 0 | 1 | 0 | python,security,virtual-machine,interpreter | 1,695,267 | 8 | false | 0 | 0 | I've been toying with this lately. My requirements include Python 3.x which immediately takes solutions like Jython and IronPython off the table. I'd be hesitant to take that route anyway, as I've never trusted user-mode language VMs.
That being the case, for my purposes the best solution so far is to take it out of th... | 5 | 6 | 0 | Is there a secure Python intepreter?
Imagine a Python VM you can run on your machine, that restricts the operations.
No files can be opened, no system calls, etc.
It just transforms stdin to stdout, maybe with text processing + math etc.
Does such a secure Python VM exist? | Secure Python intepreter? | -0.024995 | 0 | 0 | 1,260 |
1,695,014 | 2009-11-08T01:20:00.000 | 0 | 0 | 1 | 0 | python,security,virtual-machine,interpreter | 1,697,077 | 8 | false | 0 | 0 | You could always go to the source code and make your own flavor of Python. If enough people need it, it will be no time before it's up and running. | 5 | 6 | 0 | Is there a secure Python intepreter?
Imagine a Python VM you can run on your machine, that restricts the operations.
No files can be opened, no system calls, etc.
It just transforms stdin to stdout, maybe with text processing + math etc.
Does such a secure Python VM exist? | Secure Python intepreter? | 0 | 0 | 0 | 1,260 |
1,695,971 | 2009-11-08T10:29:00.000 | 0 | 0 | 0 | 0 | python,text,nlp,words,wordnet | 58,050,062 | 5 | false | 0 | 0 | sorry, may I ask which tool could judge "difficulty level" of sentences?
I wish to find out "similar difficulty level" of sentences for user to read. | 4 | 6 | 1 | For example...
Chicken is an animal.
Burrito is a food.
WordNet allows you to do "is-a"...the hiearchy feature.
However, how do I know when to stop travelling up the tree? I want a LEVEL.
That is consistent.
For example, if presented with a bunch of words, I want wordNet to categorize all of them, but at a certain leve... | Does WordNet have "levels"? (NLP) | 0 | 0 | 0 | 2,585 |
1,695,971 | 2009-11-08T10:29:00.000 | 2 | 0 | 0 | 0 | python,text,nlp,words,wordnet | 1,696,133 | 5 | false | 0 | 0 | In order to get levels, you need to predefine the content of each level. An ontology often defines these as the immediate IS_A children of a specific concept, but if that is absent, you need to develop a method of that yourself.
The next step is to put a priority on each concept, in case you want to present only one ca... | 4 | 6 | 1 | For example...
Chicken is an animal.
Burrito is a food.
WordNet allows you to do "is-a"...the hiearchy feature.
However, how do I know when to stop travelling up the tree? I want a LEVEL.
That is consistent.
For example, if presented with a bunch of words, I want wordNet to categorize all of them, but at a certain leve... | Does WordNet have "levels"? (NLP) | 0.07983 | 0 | 0 | 2,585 |
1,695,971 | 2009-11-08T10:29:00.000 | 0 | 0 | 0 | 0 | python,text,nlp,words,wordnet | 1,717,952 | 5 | false | 0 | 0 | WordNet's hypernym tree ends with a single root synset for the word "entity". If you are using WordNet's C library, then you can get a while recursive structure for a synset's ancestors using traceptrs_ds, and you can get the whole synset tree by recursively following nextss and ptrlst pointers until you hit null point... | 4 | 6 | 1 | For example...
Chicken is an animal.
Burrito is a food.
WordNet allows you to do "is-a"...the hiearchy feature.
However, how do I know when to stop travelling up the tree? I want a LEVEL.
That is consistent.
For example, if presented with a bunch of words, I want wordNet to categorize all of them, but at a certain leve... | Does WordNet have "levels"? (NLP) | 0 | 0 | 0 | 2,585 |
1,695,971 | 2009-11-08T10:29:00.000 | 6 | 0 | 0 | 0 | python,text,nlp,words,wordnet | 1,698,380 | 5 | false | 0 | 0 | [Please credit Pete Kirkham, he first came with the reference to SUMO which may well answer the question asked by Alex, the OP]
(I'm just providing a complement of information here; I started in a comment field but soon ran out of space and layout capabilites...)
Alex: Most of SUMO is science or engineering? It does no... | 4 | 6 | 1 | For example...
Chicken is an animal.
Burrito is a food.
WordNet allows you to do "is-a"...the hiearchy feature.
However, how do I know when to stop travelling up the tree? I want a LEVEL.
That is consistent.
For example, if presented with a bunch of words, I want wordNet to categorize all of them, but at a certain leve... | Does WordNet have "levels"? (NLP) | 1 | 0 | 0 | 2,585 |
1,697,045 | 2009-11-08T16:24:00.000 | 1 | 0 | 0 | 0 | python,sql,django,database-design,database | 1,697,224 | 2 | true | 1 | 0 | You might also simply store the last time a user was reading a particular forum. Any posts that have been updated since that date are new. You'll only be storing one additional piece of information per user as opposed to a piece of information per post per user. | 2 | 2 | 0 | I'm working on a not-so-big project in django that will among other things incorporate a forum system.
I have most of the system at a more or less functioning state, but I'm still missing a feature to mark unread threads for the users when there are new posts.
The thing is I can't really think of a way to properly stor... | Django/SQL: keeping track of who who read what in a forum | 1.2 | 0 | 0 | 354 |
1,697,045 | 2009-11-08T16:24:00.000 | 2 | 0 | 0 | 0 | python,sql,django,database-design,database | 1,697,061 | 2 | false | 1 | 0 | You're much better off storing the "read" bit, not the "unread" bit. And you can store them not as relational data, but in a giant bit-blob. Then you don't have to modify the read data at all when new posts are added, only when a user reads posts. | 2 | 2 | 0 | I'm working on a not-so-big project in django that will among other things incorporate a forum system.
I have most of the system at a more or less functioning state, but I'm still missing a feature to mark unread threads for the users when there are new posts.
The thing is I can't really think of a way to properly stor... | Django/SQL: keeping track of who who read what in a forum | 0.197375 | 0 | 0 | 354 |
1,697,153 | 2009-11-08T17:01:00.000 | 2 | 0 | 0 | 0 | c++,python,database,persistence | 1,697,185 | 6 | false | 0 | 0 | BerkeleyDB is good, also look at the *DBM incarnations (e.g. GDBM). The big question though is: for what do you need to search? Do you need to search by that URL, by a range of URLs or the dates you list?
It is also quite possible to keep groups of records as simple files in the local filesystem, grouped by dates ... | 3 | 5 | 0 | I'm developing an application that will store a sizeable number of records. These records will be something like (URL, date, title, source, {optional data...})
As this is a client-side app, I don't want to use a database server, I just want the info stored into files.
I want the files to be readable from various langua... | Which database should I use to store records, and how should I use it? | 0.066568 | 1 | 0 | 666 |
1,697,153 | 2009-11-08T17:01:00.000 | 0 | 0 | 0 | 0 | c++,python,database,persistence | 1,698,109 | 6 | false | 0 | 0 | Ok, so you say just storing the data..? You really only need a DB for retrieval, lookup, summarising, etc. So, for storing, just use simple text files and append lines. Compress the data if you need to, use delims between fields - just about any language will be able to read such files. If you do want to retrieve, then... | 3 | 5 | 0 | I'm developing an application that will store a sizeable number of records. These records will be something like (URL, date, title, source, {optional data...})
As this is a client-side app, I don't want to use a database server, I just want the info stored into files.
I want the files to be readable from various langua... | Which database should I use to store records, and how should I use it? | 0 | 1 | 0 | 666 |
1,697,153 | 2009-11-08T17:01:00.000 | 2 | 0 | 0 | 0 | c++,python,database,persistence | 1,697,239 | 6 | false | 0 | 0 | Personally I would use sqlite anyway. It has always just worked for me (and for others I work with). When your app grows and you suddenly do want to do something a little more sophisticated, you won't have to rewrite.
On the other hand, I've seen various comments on the Python dev list about Berkely DB that suggest i... | 3 | 5 | 0 | I'm developing an application that will store a sizeable number of records. These records will be something like (URL, date, title, source, {optional data...})
As this is a client-side app, I don't want to use a database server, I just want the info stored into files.
I want the files to be readable from various langua... | Which database should I use to store records, and how should I use it? | 0.066568 | 1 | 0 | 666 |
1,697,334 | 2009-11-08T17:54:00.000 | 1 | 0 | 0 | 0 | python,algorithm,sudoku | 35,500,598 | 11 | false | 0 | 0 | Not gonna write full code, but I did a sudoku solver a long time ago. I found that it didn't always solve it (the thing people do when they have a newspaper is incomplete!), but now think I know how to do it.
Setup: for each square, have a set of flags for each number showing the allowed numbers.
Crossing out: just li... | 2 | 22 | 1 | I want to write a code in python to solve a sudoku puzzle. Do you guys have any idea about a good algorithm for this purpose. I read somewhere in net about a algorithm which solves it by filling the whole box with all possible numbers, then inserts known values into the corresponding boxes.From the row and coloumn of k... | Algorithm for solving Sudoku | 0.01818 | 0 | 0 | 147,751 |
1,697,334 | 2009-11-08T17:54:00.000 | 5 | 0 | 0 | 0 | python,algorithm,sudoku | 1,697,407 | 11 | false | 0 | 0 | I wrote a simple program that solved the easy ones. It took its input from a file which was just a matrix with spaces and numbers. The datastructure to solve it was just a 9 by 9 matrix of a bit mask. The bit mask would specify which numbers were still possible on a certain position. Filling in the numbers from the fil... | 2 | 22 | 1 | I want to write a code in python to solve a sudoku puzzle. Do you guys have any idea about a good algorithm for this purpose. I read somewhere in net about a algorithm which solves it by filling the whole box with all possible numbers, then inserts known values into the corresponding boxes.From the row and coloumn of k... | Algorithm for solving Sudoku | 0.090659 | 0 | 0 | 147,751 |
1,698,017 | 2009-11-08T21:44:00.000 | 4 | 0 | 0 | 0 | python,scipy,neural-network | 1,698,110 | 3 | false | 0 | 0 | If you're familiar with Matlab, check out the excellent Python libraries numpy, scipy, and matplotlib. Together, they provide the most commonly used subset of Matlab functions. | 1 | 3 | 1 | I am trying to learn programming in python and am also working against a deadline for setting up a neural network which looks like it's going to feature multidirectional associative memory and recurrent connections among other things. While the mathematics for all these things can be accessed from various texts and sou... | Neural Networks in Python without using any readymade libraries...i.e., from first principles..help! | 0.26052 | 0 | 0 | 4,234 |
1,698,362 | 2009-11-08T23:40:00.000 | 0 | 1 | 0 | 0 | python,time,multithreading,pamie | 1,698,371 | 2 | false | 1 | 0 | I think what you are looking for is somewhere to set the timeout on your request. I would suggest looking into the documentation on PAMIE. | 2 | 0 | 0 | currently im making some crawler script,one of problem is
sometimes if i open webpage with PAMIE,webpage can't open and hang forever.
are there any method to close PAMIE's IE or win32com's IE ?
such like if webpage didn't response or loading complete less than 10sec or so .
thanks in advance | win32com and PAMIE web page open timeout | 0 | 0 | 1 | 294 |
1,698,362 | 2009-11-08T23:40:00.000 | 2 | 1 | 0 | 0 | python,time,multithreading,pamie | 1,698,422 | 2 | true | 1 | 0 | Just use, to initialize your PAMIE instance, PAMIE(timeOut=100) or whatever. The units of measure for timeOut are "tenths of a second" (!); the default is 3000 (300 seconds, i.e., 5 minutes); with 300 as I suggested, you'd time out after 10 seconds as you request.
(You can pass the timeOut= parameter even when you're ... | 2 | 0 | 0 | currently im making some crawler script,one of problem is
sometimes if i open webpage with PAMIE,webpage can't open and hang forever.
are there any method to close PAMIE's IE or win32com's IE ?
such like if webpage didn't response or loading complete less than 10sec or so .
thanks in advance | win32com and PAMIE web page open timeout | 1.2 | 0 | 1 | 294 |
1,700,228 | 2009-11-09T10:33:00.000 | 2 | 1 | 0 | 0 | c#,python,ipc,rpc,bidirectional | 1,700,287 | 2 | false | 0 | 0 | Use JSON-RPC because the experience that you gain will have more practical use. JSON is widely used in web applications written in all of the dozen or so most popular languages. | 2 | 6 | 0 | I want to pass data between a Python and a C# application in Windows (I want the channel to be bi-directional)
In fact I wanna pass a struct containing data about a network packet that I've captured with C# (SharpPcap) to the Python app and then send back a modified packet to the C# program.
What do you propose ? (I ra... | IPC between Python and C# | 0.197375 | 0 | 0 | 2,195 |
1,700,228 | 2009-11-09T10:33:00.000 | 2 | 1 | 0 | 0 | c#,python,ipc,rpc,bidirectional | 1,700,631 | 2 | true | 0 | 0 | Why not use a simple socket communication, or if you wish you can start a simple http server, and/or do json-rpc over it. | 2 | 6 | 0 | I want to pass data between a Python and a C# application in Windows (I want the channel to be bi-directional)
In fact I wanna pass a struct containing data about a network packet that I've captured with C# (SharpPcap) to the Python app and then send back a modified packet to the C# program.
What do you propose ? (I ra... | IPC between Python and C# | 1.2 | 0 | 0 | 2,195 |
1,700,441 | 2009-11-09T11:24:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine | 1,701,239 | 3 | false | 1 | 0 | To answer the actual question from the title of your post, assuming you're still wondering: to get environment variables, simple import os and the environment is available in os.environ. | 1 | 0 | 0 | does someone have an idea how to get the environment variables on Google-AppEngine ?
I'm trying to write a simple Script that shall use the Client-IP (for Authentication) and a parameter (geturl or so) from the URL (for e.g. http://thingy.appspot.dom/index?geturl=www.google.at)
I red that i should be able to get the C... | Environment on google Appengine | 0.197375 | 0 | 0 | 461 |
1,701,199 | 2009-11-09T14:12:00.000 | 43 | 0 | 1 | 0 | java,python,exception | 1,701,327 | 3 | true | 1 | 0 | In Python, that would be ValueError, or a subclass of it.
For example, trying to .read() a closed file raises "ValueError: I/O operation on closed file". | 1 | 67 | 0 | IllegalStateException is often used in Java when a method is invoked on an object in inappropriate state. What would you use instead in Python? | Is there an analogue to Java IllegalStateException in Python? | 1.2 | 0 | 0 | 12,359 |
1,702,024 | 2009-11-09T16:11:00.000 | 1 | 0 | 0 | 0 | python,performance,profiling,paster | 1,710,186 | 3 | true | 0 | 0 | I almost always use paster serve --reload ... during development. That command executes itself as a subprocess (it executes its own script using the subprocess module, not fork()).
The subprocess polls for source code changes, quits when it detects a change, and gets restarted by the parent paster serve --reload.
That'... | 1 | 2 | 0 | Python's paster serve app.ini is taking longer than I would like to be ready for the first request.
I know how to profile requests with middleware, but how do I profile the initialization time? I would like it to not fork a thread pool and quit as soon as it is ready to serve so the time after it's ready doesn't show ... | How do I profile `paster serve`'s startup time? | 1.2 | 0 | 0 | 545 |
1,702,586 | 2009-11-09T17:41:00.000 | 5 | 0 | 1 | 1 | python,notepad++ | 24,143,304 | 21 | false | 0 | 0 | I wish people here would post steps instead of just overall concepts. I eventually got the cmd /k version to work.
The step-by-step instructions are:
In NPP, click on the menu item: Run
In the submenu, click on: Run
In the Run... dialog box, in the field The Program to Run, delete any existing text and type in: cmd /K... | 1 | 140 | 0 | I prefer using Notepad++ for developing,
How do I execute the files in Python through Notepad++? | How to Execute a Python Script in Notepad++? | 0.047583 | 0 | 0 | 455,952 |
1,703,012 | 2009-11-09T18:56:00.000 | 1 | 0 | 1 | 0 | python,random | 1,703,327 | 5 | false | 0 | 0 | Perhaps it is not a problem in your case, but ont problem with using the system time as the seed is that someone who knows roughly when your system was started may be able to guess your seed (by trial) after seeing a few numbers from the sequence.
eg, don't use system time as the seed for your online poker game | 4 | 6 | 0 | Simple enough question:
I'm using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this default to the current time, but this is not ideal. It seems like a string literal constant (similar to a password) would ... | What is suggested seed value to use with random.seed()? | 0.039979 | 0 | 0 | 13,998 |
1,703,012 | 2009-11-09T18:56:00.000 | 5 | 0 | 1 | 0 | python,random | 1,703,027 | 5 | false | 0 | 0 | For most cases using current time is good enough. Occasionally you need to use a fixed number to generate pseudo random numbers for comparison purposes. | 4 | 6 | 0 | Simple enough question:
I'm using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this default to the current time, but this is not ideal. It seems like a string literal constant (similar to a password) would ... | What is suggested seed value to use with random.seed()? | 0.197375 | 0 | 0 | 13,998 |
1,703,012 | 2009-11-09T18:56:00.000 | 3 | 0 | 1 | 0 | python,random | 1,703,241 | 5 | false | 0 | 0 | Setting the seed is for repeatability, not security. If anything, you make the system less secure by having a fixed seed than one that is constantly changing. | 4 | 6 | 0 | Simple enough question:
I'm using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this default to the current time, but this is not ideal. It seems like a string literal constant (similar to a password) would ... | What is suggested seed value to use with random.seed()? | 0.119427 | 0 | 0 | 13,998 |
1,703,012 | 2009-11-09T18:56:00.000 | 0 | 0 | 1 | 0 | python,random | 1,703,231 | 5 | false | 0 | 0 | If you are using random for generating test data I would like to suggest that reproducibility can be important.
Just think to an use case: for data set X you get some weird behaviour (eg crash). Turns out that data set X shows some feature that was not so apparent from the other data sets Y and Z and uncovers a bug whi... | 4 | 6 | 0 | Simple enough question:
I'm using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this default to the current time, but this is not ideal. It seems like a string literal constant (similar to a password) would ... | What is suggested seed value to use with random.seed()? | 0 | 0 | 0 | 13,998 |
1,703,440 | 2009-11-09T20:11:00.000 | 2 | 0 | 0 | 0 | python,wsgi | 1,718,144 | 3 | false | 1 | 0 | I prefer working directly on wsgi, along with mako and psycopg.
It's good to know about Beaker, though I usually don't hold state in the server because I believe it reduces scalability. I either put it in the user's cookie, in the database tied to a token in the user's cookie, or in a redirect url. | 3 | 1 | 0 | I'm quite new in Python world. I come from java and ABAP world, where their application server are able to handle stateful request.
Is it also possible in python using WSGI?
Or stateful and stateless are handled in other layer? | How can I make WSGI(Python) stateful? | 0.132549 | 0 | 0 | 1,364 |
1,703,440 | 2009-11-09T20:11:00.000 | 1 | 0 | 0 | 0 | python,wsgi | 1,703,477 | 3 | false | 1 | 0 | Your question is a little vague and open-ended. First of all, WSGI itself isn't a framework, it's just the glue to connect a framework to the web server. Secondly, I'm not clear on what you mean when you say "state" -- do you mean storing information about a client on the server? If so, web frameworks (Pylons, Django, ... | 3 | 1 | 0 | I'm quite new in Python world. I come from java and ABAP world, where their application server are able to handle stateful request.
Is it also possible in python using WSGI?
Or stateful and stateless are handled in other layer? | How can I make WSGI(Python) stateful? | 0.066568 | 0 | 0 | 1,364 |
1,703,440 | 2009-11-09T20:11:00.000 | 5 | 0 | 0 | 0 | python,wsgi | 1,703,470 | 3 | false | 1 | 0 | Usually, you don't work with "bare" WSGI. You work with web-frameworks, such as Pylons or TurboGears2.
And these contain a session-middleware, based on WSGI - called "Beaker". But if you work with the framework, you don't have to worry about that - you just use it.
But if you insist, you can of course use Beaker standa... | 3 | 1 | 0 | I'm quite new in Python world. I come from java and ABAP world, where their application server are able to handle stateful request.
Is it also possible in python using WSGI?
Or stateful and stateless are handled in other layer? | How can I make WSGI(Python) stateful? | 0.321513 | 0 | 0 | 1,364 |
1,704,458 | 2009-11-09T22:43:00.000 | 9 | 0 | 1 | 0 | python,gzip | 54,360,738 | 11 | false | 0 | 0 | Despite what the other answers say, the last four bytes are not a reliable way to get the uncompressed length of a gzip file. First, there may be multiple members in the gzip file, so that would only be the length of the last member. Second, the length may be more than 4 GB, in which case the last four bytes represent ... | 4 | 17 | 0 | Using gzip, tell() returns the offset in the uncompressed file.
In order to show a progress bar, I want to know the original (uncompressed) size of the file.
Is there an easy way to find out? | Get uncompressed size of a .gz file in python | 1 | 0 | 0 | 15,630 |
1,704,458 | 2009-11-09T22:43:00.000 | 5 | 0 | 1 | 0 | python,gzip | 1,704,485 | 11 | false | 0 | 0 | Unix way: use "gunzip -l file.gz" via subprocess.call / os.popen, capture and parse its output. | 4 | 17 | 0 | Using gzip, tell() returns the offset in the uncompressed file.
In order to show a progress bar, I want to know the original (uncompressed) size of the file.
Is there an easy way to find out? | Get uncompressed size of a .gz file in python | 0.090659 | 0 | 0 | 15,630 |
1,704,458 | 2009-11-09T22:43:00.000 | 4 | 0 | 1 | 0 | python,gzip | 1,704,537 | 11 | false | 0 | 0 | The last 4 bytes of the .gz hold the original size of the file | 4 | 17 | 0 | Using gzip, tell() returns the offset in the uncompressed file.
In order to show a progress bar, I want to know the original (uncompressed) size of the file.
Is there an easy way to find out? | Get uncompressed size of a .gz file in python | 0.072599 | 0 | 0 | 15,630 |
1,704,458 | 2009-11-09T22:43:00.000 | 0 | 0 | 1 | 0 | python,gzip | 1,750,299 | 11 | false | 0 | 0 | GzipFile.size stores the uncompressed size, but it's only incremented when you read the file, so you should prefer len(fd.read()) instead of the non-public GzipFile.size. | 4 | 17 | 0 | Using gzip, tell() returns the offset in the uncompressed file.
In order to show a progress bar, I want to know the original (uncompressed) size of the file.
Is there an easy way to find out? | Get uncompressed size of a .gz file in python | 0 | 0 | 0 | 15,630 |
1,704,589 | 2009-11-09T23:09:00.000 | 0 | 0 | 1 | 0 | python,zope.interface | 1,707,215 | 2 | false | 0 | 0 | Use python 2.x. It is more supported by most libraries. It has many 3.x features plus all 3rd party libraries. Later when dependencies are available you can migrate to py3 using 2to3. | 1 | 1 | 0 | Zope Interfaces are a great way to get some Java-style "design by contract" into a python program. It provides some great features such as implement-able interfaces and a really neat pattern for writing adaptors for objects.
Unfortunately, since it's part of a very mature platform which runs just fine on Python 2.x th... | I want to use ZopeInterfaces, however my project is based on Python 3.x - any suggestions? | 0 | 0 | 0 | 100 |
1,704,607 | 2009-11-09T23:13:00.000 | 33 | 0 | 1 | 0 | c#,python | 1,704,637 | 3 | true | 0 | 0 | C#'s yield return is equivalent to Python's yield , and yield break is just return in Python.
Other than those minor differences, they have basically the same purpose. | 1 | 32 | 0 | What is the difference between yield keyword in Python and yield keyword in C#? | Difference between yield in Python and yield in C# | 1.2 | 0 | 0 | 4,780 |
1,705,077 | 2009-11-10T01:14:00.000 | 6 | 0 | 0 | 1 | python,linux,process | 1,705,099 | 8 | false | 0 | 0 | Checking the list of running processes is accomplished (even by core utilities like "ps") by looking at the contents of the /proc directory.
As such, the library you're interested for querying running processes is the same as used for working with any other files and directories (i.e. sys or os, depending on the flavor... | 1 | 14 | 0 | Through my web interface I would like to start/stop certain processes and determine whether a started process is still running.
My existing website is Python based and running on a Linux server, so do you know of a suitable library that supports this functionality?
Thanks | Python library for Linux process management | 1 | 0 | 0 | 10,686 |
1,705,217 | 2009-11-10T02:02:00.000 | 1 | 0 | 0 | 0 | python,google-app-engine,forms | 1,705,231 | 4 | false | 1 | 0 | Is there a more specific reason you don't want to use django.forms? I've quite successfully used bits and pieces of django all by themselves without trouble in several projects.
As an aside, there are several patches that make django sortof work in app-engine, though I assume you've considered and discarded them. | 1 | 3 | 0 | django.forms is very nice, and does almost exactly what I want to do on my current project, but unfortunately, Google App Engine makes most of the rest of Django unusable, and so packing it along with the app seems kind of silly.
I've also discovered FormAlchemy, which is an SQLAlchemy analog to Django forms, and I i... | Python Form Processing alternatives | 0.049958 | 0 | 0 | 1,382 |
1,705,824 | 2009-11-10T05:33:00.000 | 0 | 0 | 0 | 0 | python,graph,geometry,cycle | 1,705,913 | 11 | false | 0 | 0 | Do you need to find 'all' of the 'triangles', or just 'some'/'any'?
Or perhaps you just need to test whether a particular node is part of a triangle?
The test is simple - given a node A, are there any two connected nodes B & C that are also directly connected.
If you need to find all of the triangles - specifically, al... | 2 | 10 | 1 | I am working with complex networks. I want to find group of nodes which forms a cycle of 3 nodes (or triangles) in a given graph. As my graph contains about million edges, using a simple iterative solution (multiple "for" loop) is not very efficient.
I am using python for my programming, if these is some inbuilt module... | Finding cycle of 3 nodes ( or triangles) in a graph | 0 | 0 | 0 | 18,355 |
1,705,824 | 2009-11-10T05:33:00.000 | 1 | 0 | 0 | 0 | python,graph,geometry,cycle | 1,705,866 | 11 | false | 0 | 0 | Even though it isn't efficient, you may want to implement a solution, so use the loops. Write a test so you can get an idea as to how long it takes.
Then, as you try new approaches you can do two things:
1) Make certain that the answer remains the same.
2) See what the improvement is.
Having a faster algorithm that mi... | 2 | 10 | 1 | I am working with complex networks. I want to find group of nodes which forms a cycle of 3 nodes (or triangles) in a given graph. As my graph contains about million edges, using a simple iterative solution (multiple "for" loop) is not very efficient.
I am using python for my programming, if these is some inbuilt module... | Finding cycle of 3 nodes ( or triangles) in a graph | 0.01818 | 0 | 0 | 18,355 |
1,705,955 | 2009-11-10T06:16:00.000 | 3 | 0 | 0 | 0 | python,django,packaging,pinax,external-dependencies | 1,706,000 | 4 | false | 0 | 0 | Could you handle this using the "==dev" version specifier? If the distribution's page on PyPI includes a link to a .tgz of the current dev version (such as both github and bitbucket provide automatically) and you append "#egg=project_name-dev" to the link, both easy_install and pip will use that .tgz if ==dev is reques... | 3 | 6 | 0 | One issue that comes up during Pinax development is dealing with development versions of external apps. I am trying to come up with a solution that doesn't involve bringing in the version control systems. Reason being I'd rather not have to install all the possible version control systems on my system (or force that up... | How might I handle development versions of Python packages without relying on SCM? | 0.148885 | 0 | 0 | 347 |
1,705,955 | 2009-11-10T06:16:00.000 | 0 | 0 | 0 | 0 | python,django,packaging,pinax,external-dependencies | 1,706,060 | 4 | false | 0 | 0 | EDIT: I am not sure I am reading your question correctly so the following may not answer your question directly.
Something I've considered, but haven't tested, is using pip's freeze bundle feature. Perhaps using that and distributing the bundle with Pinax would work? My only concern would be how different OS's are ha... | 3 | 6 | 0 | One issue that comes up during Pinax development is dealing with development versions of external apps. I am trying to come up with a solution that doesn't involve bringing in the version control systems. Reason being I'd rather not have to install all the possible version control systems on my system (or force that up... | How might I handle development versions of Python packages without relying on SCM? | 0 | 0 | 0 | 347 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.