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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10,032,077 | 2012-04-05T16:07:00.000 | 5 | 0 | 0 | 0 | python,django | 10,032,150 | 2 | true | 1 | 0 | Submit the form causing the errors with unicode characters (e.g.é) in it!
This is a very common error in Django projects and it almost always means you are calling str() somewhere. Django uses unicode strings internally but when you call str() you are asking Python to give you an ascii string back, which fails with th... | 2 | 2 | 0 | Sometimes I m getting unicode errors like below in my django site when user submit form data.
"'ascii' codec can't encode character u'\u2014' in position 109: ordinal not in range(128)"
How can i reproduce the unicode error in my system
Many Thanks. | reproduce unicode error in django | 1.2 | 0 | 0 | 309 |
10,032,093 | 2012-04-05T16:09:00.000 | 1 | 0 | 0 | 1 | java,android,python,ide,cloud | 10,033,297 | 1 | true | 1 | 0 | My guess is that using Java you will have lots of frameworks to find solutions and I really don't think Python will offer you that.
About IDE, I don't think you should worry about it with Python, you can use SublimeText 2 or Eclipse(have to install python editor). Both work great and Python is easy to deploy.
With Java... | 1 | 5 | 0 | I've done my research and narrowed this down. OK, so I am deciding on the language and and tool to use for backend (server side) of developing cloud based android applications.. I've decided on Google App Engine as my framework. As I am going to be developing on my android tablet I want a cloud based IDE. (I am go... | Android Back End Technology - Language (Java, Python) & IDE (CoderBuddy, exo Cloud, Cloud 9) | 1.2 | 0 | 0 | 2,053 |
10,033,057 | 2012-04-05T17:19:00.000 | 1 | 1 | 0 | 1 | python,crontab | 10,198,435 | 1 | true | 0 | 0 | Everything solved with the sudo crontab -u username -e
credits to 9000 | 1 | 2 | 0 | I have a call to a python script that is sudo -u user_name python python_scipt.py and I need to schedule it to run every 30 minutes with crontab. The problem is how can I authenticate it with sudo on crontab? | Authenticate with sudo on a crontab job | 1.2 | 0 | 0 | 489 |
10,033,953 | 2012-04-05T18:27:00.000 | 0 | 0 | 1 | 0 | python,language-agnostic,duck-typing,dynamic-typing | 10,034,420 | 4 | false | 0 | 0 | If you are worried that the lack of static type checking will let some bugs get through, the answer isn't to bolt on type checking, it is to write tests.
In the presence of unit tests, a type checking system becomes largely redundant as a means of catching bugs. While it is true that a type checking system can catch s... | 1 | 4 | 0 | I think understand the idea of duck typing, and would like to use it more often in my code. However, I am concerned about one potential problem: name collision.
Suppose I want an object to do something. I know the appropriate method, so I simply call it and see what happens. In general, there are three possible outcome... | Duck typing: how to avoid name collisions? | 0 | 0 | 0 | 1,060 |
10,036,461 | 2012-04-05T21:43:00.000 | 1 | 0 | 1 | 0 | python,signals,alarm | 10,036,713 | 2 | true | 0 | 0 | Use Timer instead of signals. Dealing with signals will open up lots of cans of worms, so you should avoid it whenever you can. In this case, it sounds like you can. | 2 | 2 | 0 | I know you can use signal.alarm() to schedule alarms in your main thread, but is there a way to do something like this in a thread that isn't your main thread, since these threads can't receive signals? I need to schedule something to happen 5 minutes in the future. | Python: Setting an alarm outside of the main thread | 1.2 | 0 | 0 | 550 |
10,036,461 | 2012-04-05T21:43:00.000 | 0 | 0 | 1 | 0 | python,signals,alarm | 10,036,597 | 2 | false | 0 | 0 | You can use threading.Event to notify your threads about events. Have a look at threading.Timer as well. | 2 | 2 | 0 | I know you can use signal.alarm() to schedule alarms in your main thread, but is there a way to do something like this in a thread that isn't your main thread, since these threads can't receive signals? I need to schedule something to happen 5 minutes in the future. | Python: Setting an alarm outside of the main thread | 0 | 0 | 0 | 550 |
10,036,751 | 2012-04-05T22:14:00.000 | 8 | 0 | 1 | 0 | python,file,integer,long-integer | 10,036,830 | 2 | true | 0 | 0 | Python can store arbitrarily long integers using the long type and even lets you specify long literals by appending an L to them (e.g. 0L is a long zero, as opposed to just 0 which is an int). Even better, it automatically "promotes" numbers from ints to longs when the result of a calculation is too large to be represe... | 1 | 2 | 0 | I'm planning to use very big numbers in Python, but wonder if Python can handle very big numbers. The numbers are going to have up to 3,000 zeros.
And, how much bytes does a 1 with 3,000 zeros use?
Third question, how can I save a number as integer into a file with Python without having to str() it? | Storing big numbers over 9,000 digits in Python | 1.2 | 0 | 0 | 5,303 |
10,042,429 | 2012-04-06T10:46:00.000 | 2 | 0 | 1 | 0 | python,segmentation-fault,enthought | 10,043,383 | 1 | true | 0 | 0 | Python only SEGFAULTs if
There is error in a native extension DLL code loaded
Virtual machine has bugs (it has not)
Run Python in -vvv mode to see more information about import issues.
You probably need to recompile the modules you need against the Python build you are using. Python major versions and architecture (... | 1 | 2 | 1 | I have the Enthought Python Distribution installed.
Before that I installed Python2.7 and installed other modules (e.g. opencv).
Enthought establishes itself as the default python.
Called 7.2, but it is 2.7.
Now if i want to import cv in the Enthought Python it always gives me the Segmentation fault Error.
Is there ... | Segmentation fault Python | 1.2 | 0 | 0 | 4,794 |
10,044,862 | 2012-04-06T14:25:00.000 | 1 | 0 | 1 | 0 | python,database,distributed-computing | 10,045,103 | 2 | false | 0 | 0 | If it's db connection information you're interested in, I recently wrote a service for this. Each process has token(s) set in configuration and uses those to query the service for db connection info. The data layer uses that info to create connections, no DSN's are stored. On the server side, you just maintain a dictio... | 1 | 1 | 0 | Let's say I have Python process 1 on machine 1 and Python process 2 on machine 2. Both processes are the same and process data sent by a load balancer.
Both processes need to interact with a database - in my case Postgres so each process needs to know what database it should talk to, it needs to have the right models o... | Any Python solution for having distributed processes interact with relational databases in the most decoupled way possible? | 0.099668 | 1 | 0 | 157 |
10,045,312 | 2012-04-06T15:03:00.000 | 1 | 0 | 1 | 0 | python | 10,045,462 | 1 | false | 0 | 1 | You could consider the Scintilla text editing component, with bindings for Python (and other languages.) The Scintilla text editing widget is the basis for the SciTE text editor.
SciTE supports code folding, so it is certainly doable - it may even be a built in part of Scintilla.
From the SciTE website:
Scintilla is a... | 1 | 0 | 0 | I'm learning Python and want to make a small text editor that would allow the code collapsing like when def a Function, how you can collapse that to a single line.
I'm thinking of using Tkinter but would be open to other environments.
I mainly want to know what widget I should use, I'd like to think that I'd be able to... | Python: How to program an IDE Code collapsing? | 0.197375 | 0 | 0 | 200 |
10,046,451 | 2012-04-06T16:44:00.000 | 0 | 1 | 1 | 0 | python,regex,algorithm,nlp | 10,047,362 | 4 | false | 0 | 0 | You'll need many heuristics to get an approximation of a solution, so here's one: you can safely cut off anything after a sigdash (hyphen-hyphen-space), which standards-conforming e-mail messages use to separate the message body from the signature.
Another approach you can use is to store copies of e-mails from the sam... | 2 | 2 | 0 | I need to separate natural, coherent text/sentences in emails from lists, signatures, greetings and so on before further processing.
example:
Hi tom,
last monday we did bla bla, lore Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et
dolore magna aliqua.
list item 2
li... | Algorithm to match natural text in mail | 0 | 0 | 0 | 229 |
10,046,451 | 2012-04-06T16:44:00.000 | 3 | 1 | 1 | 0 | python,regex,algorithm,nlp | 10,046,551 | 4 | false | 0 | 0 | In the example you post, line length suffices.
There is no perfect algorithm; even human beings will classify lines differently.
I suggest just use line length until you find a counter example, at which point revise your algorithm. Repeat until problem solved to your satisfaction. | 2 | 2 | 0 | I need to separate natural, coherent text/sentences in emails from lists, signatures, greetings and so on before further processing.
example:
Hi tom,
last monday we did bla bla, lore Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et
dolore magna aliqua.
list item 2
li... | Algorithm to match natural text in mail | 0.148885 | 0 | 0 | 229 |
10,046,665 | 2012-04-06T17:03:00.000 | 2 | 1 | 1 | 0 | python,text-manipulation | 10,046,888 | 3 | false | 0 | 0 | 1) What you need to know about is parsing, not regex. Additionally you will need the os module and some knowledge about pythons file handling. DiveIntoPython (http://www.diveintopython.net/) is a good start here. I'd recommend chapter 6. (And maybe 1-5 as well :) )
2) Python is a good start. Another language is not goi... | 1 | 1 | 0 | I have a need to identify comments in different kinds of source files in a given directory. ( For example java,XML, JavaScript, bash). I have decided to do this using Python (as an attempt to learn Python). The questions I have are
1) What should I know about python to get this done? ( I have an idea that Regular Expre... | What should I know about Python to identify comments in different source files? | 0.132549 | 0 | 0 | 104 |
10,047,020 | 2012-04-06T17:36:00.000 | 8 | 0 | 1 | 0 | ipython | 10,047,045 | 2 | true | 0 | 0 | Doh, one has to click on the very slim divider line. The subframe then closes... | 2 | 5 | 0 | In an IPython notebook, when you look at some docs with ? or help(), a split frame is opened at the bottom of the screen where the documentation shows up.
While I find this useful as a guide for continuing to play with some Python code, I would like to close this spit frame when I'm done reading the docs, so to get bac... | How to close the doc reading part of the IPython notebook? | 1.2 | 0 | 0 | 613 |
10,047,020 | 2012-04-06T17:36:00.000 | 5 | 0 | 1 | 0 | ipython | 21,760,178 | 2 | false | 0 | 0 | You have to press the q key.
That works for me. | 2 | 5 | 0 | In an IPython notebook, when you look at some docs with ? or help(), a split frame is opened at the bottom of the screen where the documentation shows up.
While I find this useful as a guide for continuing to play with some Python code, I would like to close this spit frame when I'm done reading the docs, so to get bac... | How to close the doc reading part of the IPython notebook? | 0.462117 | 0 | 0 | 613 |
10,048,898 | 2012-04-06T20:30:00.000 | 1 | 0 | 1 | 0 | python,string,object,representation | 10,048,954 | 3 | false | 0 | 0 | Use repr() to get the string representation, and ast.literal_eval() to recover the object.
Or just use pickle. If you are using Python 2.x you can import cPickle to get a faster pickle, but in Python 3.x there is just the one pickle and it is the C one.
Personally, I like to use JSON for simple objects; you might try ... | 1 | 0 | 0 | I want to have a string representation of a python object. I used to do it with the famous pickle, but I'm wondering if it exists something better and less expensive. I don't like to use repr and eval cause they are not secure. | Object representation in Python | 0.066568 | 0 | 0 | 674 |
10,053,409 | 2012-04-07T09:45:00.000 | 1 | 0 | 0 | 0 | python,windows,qt4,pyqt4 | 10,059,458 | 1 | true | 0 | 1 | You can use Internet Explorer via ActiveQT. There is a c++ example in "yourqtdir\4.8.0\examples\activeqt\webbrowser". | 1 | 0 | 0 | I'm want to show in the GUI a small box (400x85) that shows in an HTML file over the web.
The QtWebKit class got his QWebView widget, but the whole QtWebKit class is VERY heavy, weights 16MB, and slows the init of the application in three seconds.
It's not really necessary to load the whole QtWebKit class just to show ... | An Internet browser Qt4 widget? | 1.2 | 0 | 0 | 326 |
10,054,167 | 2012-04-07T11:45:00.000 | 2 | 0 | 0 | 0 | python,opengl,freeglut | 10,055,756 | 1 | true | 0 | 1 | You don't.
Remember: GLUT is primarily for test applications and demos. If your application is complex and platform-specific enough to need to change its icon, then you probably need to move beyond GLUT. | 1 | 1 | 0 | I am trying to learn OpenGL, and I'm using PyOpenGL and GLUT.
What really bugs me, is that I can't figure out how to change the
title bar icon. Has anyone had any success in changing this? | How do I replace the GLUT title bar icon when using pyopengl? | 1.2 | 0 | 0 | 248 |
10,054,878 | 2012-04-07T13:24:00.000 | 1 | 0 | 0 | 0 | python,active-directory,ldap | 10,056,144 | 1 | true | 0 | 0 | The search result contains:
A list of search result entries. Each search result entry in the list contains the distinguished name of the entry and a (partial) attribute list
or
A list of search result references. Each search result reference contains a sequence of URIs
After the entries or references comes a single... | 1 | 0 | 0 | I was able to get attributes about an user by doing queries on LDAP using Python ldap but I don't know how to obtain his DN.
Remark: Doing CN=sAMAccount,base_dn) is not valid because the user can be somewhere in another sub-tree.
Which is the proper way of getting the DN for an user for which I do have the sAMAccount? | How do I get the full DN, distinguishedName of an user with python ldap? | 1.2 | 0 | 1 | 1,443 |
10,055,537 | 2012-04-07T15:03:00.000 | 0 | 0 | 0 | 0 | python,django | 10,057,890 | 2 | false | 1 | 0 | If you really need to do that modify the django code itself. Monkey patching is an option also, there are a lot of techniques for that out there. | 2 | 2 | 0 | Is there a way to change the default object manager for all Models? (which would include the object managers on third party apps) | Django changing the default object manager | 0 | 0 | 0 | 627 |
10,055,537 | 2012-04-07T15:03:00.000 | 2 | 0 | 0 | 0 | python,django | 10,055,699 | 2 | false | 1 | 0 | The default manager is attached in the function ensure_default_manager in django.db.models.manager. It attaches by default a manager of class Manager. You could monkeypatch this function to attach a different (subclass of) Manager.
But you have to consider whether this is the most ideal solution to the problem you're t... | 2 | 2 | 0 | Is there a way to change the default object manager for all Models? (which would include the object managers on third party apps) | Django changing the default object manager | 0.197375 | 0 | 0 | 627 |
10,056,289 | 2012-04-07T16:37:00.000 | 0 | 1 | 0 | 0 | python,web-services,architecture,operating-system | 10,711,768 | 1 | false | 0 | 0 | I can't say I have been down this road, but I am working to go down this road. I would look into the multiprocessing libraries for Python. There are network transparent libraries. A couple of routes you could take with those:
1. Create a process that controls all of the other processes. Make this process a server y... | 1 | 3 | 0 | This is my first hack at doing any system-level programming (mostly a LAMPhp, specifically Drupal, web dev up to this point).
Because of availability of a library with a very specific feature, I am using Python for an upcoming project. I need to run, restart as needed, monitor and respond to the output of multiple Pyth... | Best practice for Python process control | 0 | 0 | 0 | 875 |
10,056,797 | 2012-04-07T17:45:00.000 | 3 | 1 | 1 | 0 | python,floating-point,factorial | 10,056,813 | 2 | false | 0 | 0 | In Python 2.7 or 3.2, you can use math.gamma(x + 1). In older versions, you'd need some external library like SciPy. | 1 | 8 | 0 | I'm wondering if there's a speedy, Pythonic way to calculate factorials of non-integral numbers (e.g., 3.4)? Of course, the bult-in factorial() function in the Math module is available, but it only works for integrals (I don't care about negative numbers here). | Python: Calculate factorial of a non-integral number | 0.291313 | 0 | 0 | 7,874 |
10,060,149 | 2012-04-08T03:26:00.000 | 1 | 0 | 1 | 0 | python | 10,060,164 | 7 | false | 0 | 0 | If you need exactly two, then:
Detect the tokens (keep some links to them, like index into the string)
Choose two at random (random.choice)
Replace them | 2 | 4 | 0 | Say that I have 10 different tokens, "(TOKEN)" in a string. How do I replace 2 of those tokens, chosen at random, with some other string, leaving the other tokens intact? | Python: How to replace N random string occurrences in text? | 0.028564 | 0 | 0 | 808 |
10,060,149 | 2012-04-08T03:26:00.000 | 1 | 0 | 1 | 0 | python | 10,060,182 | 7 | false | 0 | 0 | What are you trying to do, exactly? A good answer will depend on that...
That said, a brute-force solution that comes to mind is to:
Store the 10 tokens in an array, such that tokens[0] is the first token, tokens[1] is the second, ... and so on
Create a dictionary to associate each unique "(TOKEN)" with two numbers: ... | 2 | 4 | 0 | Say that I have 10 different tokens, "(TOKEN)" in a string. How do I replace 2 of those tokens, chosen at random, with some other string, leaving the other tokens intact? | Python: How to replace N random string occurrences in text? | 0.028564 | 0 | 0 | 808 |
10,060,759 | 2012-04-08T06:01:00.000 | 10 | 0 | 1 | 0 | python,symlink,moinmoin,openshift | 10,060,782 | 1 | true | 0 | 0 | Should work just fine - symlinks are handled on the OS level, meaning as long as python isn't trying to determine if something is a symlink or not, calling an open on it should just open the file it's pointing to.
Is there anything in particular that isn't working? What are you seeing when it stops working? | 1 | 3 | 0 | I'm have difficulty finding any docs describing Python's expected symlink behavior.
I've tried testing it myself but I'm getting weird results - sometimes it appears to work for a while then stops working.
Anyway, I have a situation where MoinMoin keeps it's data files and plugin modules in the same directory but I nee... | Does Python respect symlinks? | 1.2 | 0 | 0 | 2,784 |
10,060,840 | 2012-04-08T06:24:00.000 | 0 | 0 | 1 | 0 | python,logging,exception-handling,error-logging | 10,060,971 | 2 | false | 0 | 0 | Write your custom exception handling function, and use it every time you write catch.
In this function you should check which mode is on (INFO or DEBUG) and then extract info about exception and feed it to logger manually when needed. | 1 | 1 | 0 | I'm trying to have an exception handling mechanism with several layers of information to display to the user for my application, using python's logging module.
In the application, the logging module has 2 handlers: a file handler for keeping DEBUG information and a stream handler for keeping INFO information. By defaul... | python - Selective handling of exception traceback | 0 | 0 | 0 | 445 |
10,062,999 | 2012-04-08T13:01:00.000 | 0 | 0 | 0 | 1 | python,celery,celeryd | 10,063,062 | 3 | false | 0 | 0 | I implemented something similar to this some time ago, and the solution I came up with was very similar to yours.
The way I solved this problem was to have the worker fetch the Task object from the database when the job ran (by passing it the primary key, as the documentation recommends). In your case, before the remin... | 1 | 2 | 0 | I have a reminder type app that schedules tasks in celery using the "eta" argument. If the parameters in the reminder object changes (e.g. time of reminder), then I revoke the task previously sent and queue a new task.
I was wondering if there's any good way of keeping track of revoked tasks across celeryd restarts. I'... | how to track revoked tasks in across multiple celeryd processes | 0 | 0 | 0 | 803 |
10,063,145 | 2012-04-08T13:27:00.000 | 0 | 0 | 0 | 0 | java,python,django,servlets | 10,516,164 | 2 | true | 1 | 0 | There seems to be nothing like this in Django, there are thread locals which can be used, but they are not the exact same as Application context. | 1 | 1 | 0 | For a Servlets based web application there exists something called an Application Context. It is an Object accessible from anywhere in the application and can be used to store data which is relevant in the context of the application.
Is there something like this in Django? If not, what are the alternates that are avail... | Java's Application Context in Django | 1.2 | 0 | 0 | 650 |
10,063,193 | 2012-04-08T13:33:00.000 | 3 | 0 | 1 | 0 | python,cmd,exe,pyinstaller | 10,690,129 | 4 | false | 0 | 0 | I recommend you use the standard PyInstaller script pyinstaller.py, which combines all the other scripts into a single interface.
Just type:
python pyinstaller.py your_script.py
and PyInstaller will create a Build and Dist folder, and put your exe in the Dist folder. | 4 | 1 | 0 | I've changed it into a .spec file, after which it tells me to run build.py. I do this, but it comes up Build.py: Error: Requires exactly one .spec file, and then doesn't do anything. What am I doing wrong? | I'm using PyInstaller to turn a .py file into a .exe file, but I'm having difficulty? | 0.148885 | 0 | 0 | 10,076 |
10,063,193 | 2012-04-08T13:33:00.000 | 0 | 0 | 1 | 0 | python,cmd,exe,pyinstaller | 10,063,373 | 4 | false | 0 | 0 | put your script in a new folder.
run the 1st script (configure.py if memory serves)
run the 2nd script (make.py yourfolder\yourscript.py again from memory)
run the last script(build.py yourfolder\yourscript.spec)
you should have an exe now.
good luck. | 4 | 1 | 0 | I've changed it into a .spec file, after which it tells me to run build.py. I do this, but it comes up Build.py: Error: Requires exactly one .spec file, and then doesn't do anything. What am I doing wrong? | I'm using PyInstaller to turn a .py file into a .exe file, but I'm having difficulty? | 0 | 0 | 0 | 10,076 |
10,063,193 | 2012-04-08T13:33:00.000 | 0 | 0 | 1 | 0 | python,cmd,exe,pyinstaller | 10,063,441 | 4 | false | 0 | 0 | Following is what I use to make an exe.
using python ../pysinstaller-1.5/Configure.py
python ../pyinstaller-1.5/MakeSpec.py -F --noconsole -n name-of-the-app path-to-your main-.py-file
python ../pyinstaller-1.5/Build.py path-to-name-of-the-app.spec-file-produced
Note: You should need to run Configure only once after a ... | 4 | 1 | 0 | I've changed it into a .spec file, after which it tells me to run build.py. I do this, but it comes up Build.py: Error: Requires exactly one .spec file, and then doesn't do anything. What am I doing wrong? | I'm using PyInstaller to turn a .py file into a .exe file, but I'm having difficulty? | 0 | 0 | 0 | 10,076 |
10,063,193 | 2012-04-08T13:33:00.000 | 0 | 0 | 1 | 0 | python,cmd,exe,pyinstaller | 23,745,413 | 4 | false | 0 | 0 | If you have pyinstaller set in your path variable, as I do, all you have to do is:
pyinstaller -F
And it automatically generates everything else. | 4 | 1 | 0 | I've changed it into a .spec file, after which it tells me to run build.py. I do this, but it comes up Build.py: Error: Requires exactly one .spec file, and then doesn't do anything. What am I doing wrong? | I'm using PyInstaller to turn a .py file into a .exe file, but I'm having difficulty? | 0 | 0 | 0 | 10,076 |
10,064,560 | 2012-04-08T16:52:00.000 | 0 | 0 | 0 | 1 | python,ubuntu,osx-snow-leopard,cx-freeze | 10,861,704 | 2 | false | 0 | 0 | As far as I remember, last I used Mac OSX, it already had Python installed. This was with Mac OSX Snow Leopard. | 1 | 2 | 0 | I am still very new to Python and any freezing programs.
Recently I made a very short text adventure game I'd like to send to a few friends, most of whom have Snow Leopard. I don't want them to have to bother downloading python just to play the game though.
Is there a way to convert my game from Ubuntu so that it is p... | how to compile a python .app from ubuntu or windows | 0 | 0 | 0 | 1,261 |
10,064,769 | 2012-04-08T17:24:00.000 | 0 | 1 | 0 | 0 | python,email,imap | 10,064,803 | 4 | false | 0 | 0 | They try a lot of possibilities, let you choose one and/or create one ;) | 3 | 1 | 0 | I am trying to build a simple email client with python and IMAPClient. The problem is that the folder names aren't uniform for all servers.
If i mark an e-mail as spam, it has to be moved to the spam/junk folder from the inbox folder (?) .. but i am unable to do that because i don't know what the folder name would be (... | Identifying IMAP mail folders (spam,sent...), folder names vary with servers | 0 | 0 | 1 | 1,797 |
10,064,769 | 2012-04-08T17:24:00.000 | 0 | 1 | 0 | 0 | python,email,imap | 10,064,809 | 4 | false | 0 | 0 | Roundcube have this in both the server and user configuration. I don't know about other mail clients, but I guess they either use heuretics, either by just looking at what folders there are or by using knowledge about the particular IMAP server. | 3 | 1 | 0 | I am trying to build a simple email client with python and IMAPClient. The problem is that the folder names aren't uniform for all servers.
If i mark an e-mail as spam, it has to be moved to the spam/junk folder from the inbox folder (?) .. but i am unable to do that because i don't know what the folder name would be (... | Identifying IMAP mail folders (spam,sent...), folder names vary with servers | 0 | 0 | 1 | 1,797 |
10,064,769 | 2012-04-08T17:24:00.000 | 2 | 1 | 0 | 0 | python,email,imap | 10,064,811 | 4 | true | 0 | 0 | I believe that for common EMail providers they have a mapping as to what that provider uses by default (gmail, hotmail, exchange etc.).
Another way of doing it is to let the user decide first time, persist the setting for that account and not ask again.
Mixed approach would be to try and detect all common variations an... | 3 | 1 | 0 | I am trying to build a simple email client with python and IMAPClient. The problem is that the folder names aren't uniform for all servers.
If i mark an e-mail as spam, it has to be moved to the spam/junk folder from the inbox folder (?) .. but i am unable to do that because i don't know what the folder name would be (... | Identifying IMAP mail folders (spam,sent...), folder names vary with servers | 1.2 | 0 | 1 | 1,797 |
10,065,051 | 2012-04-08T18:01:00.000 | 4 | 0 | 0 | 0 | python,pandas | 27,531,471 | 13 | false | 0 | 0 | pandas.io.sql.frame_query is deprecated. Use pandas.read_sql instead. | 1 | 97 | 0 | The documentation for Pandas has numerous examples of best practices for working with data stored in various formats.
However, I am unable to find any good examples for working with databases like MySQL for example.
Can anyone point me to links or give some code snippets of how to convert query results using mysql-pyth... | python-pandas and databases like mysql | 0.061461 | 1 | 0 | 123,656 |
10,066,554 | 2012-04-08T21:11:00.000 | 0 | 0 | 0 | 1 | python,windows,linux,isometric | 10,067,738 | 3 | false | 0 | 0 | This source code is over 5 years old and the build script for floyd looks to assume hard-coded python2.4.
It seems pretty clear that your floyd module did not build. You will most likely have to go back to the build step and ensure that you are properly generating a _floyd.so.
If you built it correctly, then this sho... | 1 | 0 | 0 | another question for all of you-
So i am trying to get a program called Pysomap to work (its basically ISOMAP but for python[http://web.vscht.cz/spiwokv/pysomap/]), i follow the directions best as i can, building it on Ubuntu, Windows, and Fedora (prebuilt libraries), but cant seem to get it to work. On windows (which ... | How to get program to not throw "Error: Can't load Floyd's algorithm library" | 0 | 0 | 0 | 144 |
10,066,573 | 2012-04-08T21:14:00.000 | 5 | 0 | 0 | 0 | python,sql,django | 10,066,588 | 1 | true | 1 | 0 | You really don't want to implement each question/answer as a separate DB field.
Instead, make a table of questions and a table of answers, and have a field in the answers table (in general, a ForeignKey) to indicate which question a given answer is associated with. | 1 | 0 | 0 | I am developing an application designed for a secretary to use. She has a stack of hundreds of ballot forms which have a number of questions on them, and wishes to input this data into a program to show the total votes for each answer. Each question has a number of answers.
For example:
Q: "Re-elect current president o... | Adding field to SQL table from Django Application | 1.2 | 1 | 0 | 72 |
10,068,871 | 2012-04-09T04:24:00.000 | 0 | 0 | 0 | 0 | python,xpath,selenium-rc | 10,233,957 | 2 | false | 1 | 0 | It looks like a problem of timing. May be you can intentionally add wait time till the element appears on the page.
Another possibility is that element which you are trying to interact is hidden.
Would be great if you can post errors you are getting when you test fails. | 2 | 0 | 0 | Exception: ERROR: Element xpath=//*[@id='seriesNwsHldr']/div[2]/p[1]/a not found.
I checked in Fierbug. The path is correct but I don't know what's the reason for this test case to fail. | sel.click("xpath=//*[@id='seriesNwsHldr']/div[2]/p[1]/a") is not working | 0 | 0 | 1 | 146 |
10,068,871 | 2012-04-09T04:24:00.000 | 0 | 0 | 0 | 0 | python,xpath,selenium-rc | 10,234,023 | 2 | false | 1 | 0 | Can I have the site for checking?
BTW sometimes you should to wait the loading of the page, so you need to do before of this action an instructions like:
clickAndWait(30000)
in my cases it solves a lotof problems :) | 2 | 0 | 0 | Exception: ERROR: Element xpath=//*[@id='seriesNwsHldr']/div[2]/p[1]/a not found.
I checked in Fierbug. The path is correct but I don't know what's the reason for this test case to fail. | sel.click("xpath=//*[@id='seriesNwsHldr']/div[2]/p[1]/a") is not working | 0 | 0 | 1 | 146 |
10,069,167 | 2012-04-09T05:12:00.000 | 3 | 0 | 0 | 0 | python,django | 10,069,190 | 1 | true | 1 | 0 | Did you perhaps upgrade from Django 1.3 to Django 1.4 while retaining user data? Django 1.4 introduced the newer, more secure hash for password storage, but should still be backwards-compatible with the old hashes as far as I am aware. | 1 | 3 | 0 | I have a django auth_user table, and for some reason, some of the passcodes are stores as sha1$... and others pbkdf2_sha256$.... I don't see any rhyme or reason to it -- what is the difference between these two and why would some be stored as one version, but others as another? | Passwords being stored as sha1 and pbkdf2_sha256 | 1.2 | 0 | 0 | 1,609 |
10,069,594 | 2012-04-09T06:10:00.000 | 1 | 0 | 0 | 0 | python,google-app-engine,firefox,google-chrome,tipfy | 10,085,230 | 1 | true | 1 | 0 | check the Tipfy session configuration attributes, Check the path attribute '/' you need to do some modification their | 1 | 1 | 0 | I have a problem regarding with session handling in Chrome and Firefox. When in authenticate to a website and I closed it and reopen the home page in Firefox it shows my name . But when I do the same thing in chrome it didnt show my name . it shows as guest. The session for this site implemented by tipfy. do I have to ... | Session Handling in Chrome and Firefox | 1.2 | 0 | 1 | 308 |
10,069,680 | 2012-04-09T06:20:00.000 | 0 | 0 | 0 | 0 | python,matlab,matplotlib,ipython,spyder | 10,724,685 | 1 | false | 0 | 0 | I was having a similar (I think) problem. Make sure your interpreter is set to execute in the current interpreter (default, should allow for interactive plotting). If it's set to execute in a new dedicated python interpreter make sure that interact with the python interpreter after execution is selected. This solved... | 1 | 3 | 1 | Whenever I execute a plt.show() in an Ipython console in spyderlib, the console freezes until I close the figure window. This only occurs in spyderlib and the blocking does occur when I run ipython --pylab or run ipython normally and call plt.ion() before plotting. I've tried using plt.draw(), but nothing happens wit... | Spyder plotting blocks console commands | 0 | 0 | 0 | 1,329 |
10,069,959 | 2012-04-09T06:55:00.000 | 0 | 0 | 1 | 0 | python,pyinstaller,pyopenssl | 34,070,347 | 2 | false | 0 | 0 | I just upgraded from pyOpenSSL v.0.13 (which had an msi installer for Windows) to v.0.15 (which I installed via "pip" with Python v.2.7.9). Prior to this, pyInstaller worked fine. After this, pyInstaller failed to produce a working package. It turn out to be missing one dependency. It was not a dll, however, but a ... | 1 | 2 | 0 | I am trying to include the pyOpenSSL package into an executable from a virtual environment. The executable builds with out error but when I come to run it fails with error "DLL load failed: The specified module could not be found".
After investigation it would appear that the the two DLLs in pyOpenSSL (libeay32.dll & s... | Packaging pyOpenSSL into a windows executable using PyInstaller | 0 | 0 | 0 | 1,013 |
10,070,703 | 2012-04-09T08:26:00.000 | 2 | 0 | 0 | 0 | python,python-2.7,web2py,web2py-modules | 10,090,081 | 2 | true | 1 | 0 | I would consider looking into webservices.
If you could expose url from java, that will route to a method/function of java where logic is performed and it returns json object.
While in web2py urllib2 you can make a request and decode that json into native python dictionary.
The clue is that you would have to expose all... | 1 | 1 | 0 | I have to implement one web2py application which has to access java code (which has code to connect to the remote machine) but not sure whether we can do it in web2py or not.My PC has Java 1.6, Python2.7 ,web2py ,eclipse installed.
Use case is :
I have created one button in web2py application and upon clicking the butt... | can we use java code in web2py application code? | 1.2 | 0 | 0 | 632 |
10,071,609 | 2012-04-09T09:57:00.000 | 0 | 0 | 0 | 0 | python,plone | 20,901,570 | 2 | true | 0 | 0 | Best is to use collective.DocumentViewer with various options to select from | 1 | 0 | 1 | How can we search content(text) within images using plone 4.1. I work on linux Suppose an image say a sample.jpg contains text like 'Happy Birthday', on using search 'Birthday' I should get the contents i.e sample.jpg | Can we search content(text) within images using plone 4.1? | 1.2 | 0 | 0 | 232 |
10,072,287 | 2012-04-09T11:06:00.000 | 0 | 1 | 1 | 0 | php,python,python-2.7 | 10,072,364 | 3 | false | 0 | 0 | What you can do is save the Dictionary Object as json or xml in Python, then use json_decode or simple_xml in PHP to load it as array or object
You need no sorting algorithm ... PHP has a lot of them | 1 | 0 | 0 | I wrote a sorting algorithm in python.
It returns a Python Dictionary object.
How do i get the dictionary from Python into my PHP code as an associative arr ?
Will I have to write the whole sorting algorithm again in PHP? | Converting a Python Dictionary into Associative Array for PHP | 0 | 0 | 0 | 3,027 |
10,073,267 | 2012-04-09T12:36:00.000 | 1 | 0 | 1 | 0 | python,algorithm,optimization,data-structures,spell-checking | 10,073,401 | 8 | false | 0 | 0 | Use a tree structure to store the words, such that each path from root to leaf represents a single word. If your traversal cannot reach a leaf, or reaches a leaf before the end of the word, you have a word not in your lexicon.
Apart from the benefits Emil mentions in the comments, note also that this allows you to do t... | 3 | 3 | 0 | I will have to perform a spelling check-like operation in Python as follows:
I have a huge list of words (let's call it the lexicon). I am now given some text (let's call it the sample). I have to search for each sample word in the lexicon. If I cannot find it, that sample word is an error.
In short - a brute-force spe... | Fastest possible dictionary-like matching | 0.024995 | 0 | 0 | 1,646 |
10,073,267 | 2012-04-09T12:36:00.000 | 0 | 0 | 1 | 0 | python,algorithm,optimization,data-structures,spell-checking | 10,073,308 | 8 | false | 0 | 0 | The average time complexity of hashed search in a python dictionary is O(1). You can therefore use a "dictionary with no values" (a.k.a. a set) | 3 | 3 | 0 | I will have to perform a spelling check-like operation in Python as follows:
I have a huge list of words (let's call it the lexicon). I am now given some text (let's call it the sample). I have to search for each sample word in the lexicon. If I cannot find it, that sample word is an error.
In short - a brute-force spe... | Fastest possible dictionary-like matching | 0 | 0 | 0 | 1,646 |
10,073,267 | 2012-04-09T12:36:00.000 | 1 | 0 | 1 | 0 | python,algorithm,optimization,data-structures,spell-checking | 10,073,440 | 8 | false | 0 | 0 | Try it with a set, like everyone is telling you. Set lookups were optimized in python's C code by experienced programmers, so there's no way you can do better in your little application.
Unicode is not an issue: Set and dictionary keys can be unicode or English text, it doesn't matter. The only consideration for you mi... | 3 | 3 | 0 | I will have to perform a spelling check-like operation in Python as follows:
I have a huge list of words (let's call it the lexicon). I am now given some text (let's call it the sample). I have to search for each sample word in the lexicon. If I cannot find it, that sample word is an error.
In short - a brute-force spe... | Fastest possible dictionary-like matching | 0.024995 | 0 | 0 | 1,646 |
10,073,934 | 2012-04-09T13:28:00.000 | 1 | 1 | 0 | 0 | php,python,mongodb,vps | 10,074,035 | 2 | false | 0 | 0 | If the vps you are looking at restricts the packages you can install, and you need something that they prohibit, I would look for another vps. Both rackspace and amazon a range of instances, and numerous supported os. With either of them you choose your operating system and are free to install whatever you want. | 1 | 1 | 0 | I have to build a web application which uses Python, php and MongoDB.
Python - For offline database populating on my local home machine and then exporting db to VPS. Later I am planning to schedule this job using cron.
PHP - For web scripting.
The VPS I wish to buy supports Python and LAMP Stack but not mongoDB (myho... | Performance of MongoDB on VPS or cloud service not having mongoDB installed | 0.099668 | 1 | 0 | 810 |
10,076,222 | 2012-04-09T16:20:00.000 | 4 | 0 | 0 | 0 | python,statistics,scipy,correlation | 10,076,295 | 1 | true | 1 | 0 | It's up to you to choose the level of significance (alpha). To be coherent you shall choose it before running the test. The function will return you the lowest alpha you can choose for which you reject the null hypothesis (H0) [reject H0 when p-value < alpha or equivalently -p-value>-alpha].
You therefore know that the... | 1 | 2 | 1 | The output of spearmanr (Spearman correlation) of X,Y gives me the following:
Correlation: 0.54542821980327882
P-Value: 2.3569040685361066e-65
where len(X)=len(Y)=800.
My questions are as follows:
0) What is the confidence (alpha?) here ?
1) If correlation coefficient > alpha, the hypothesis of the correlation bei... | scipy: significance of the return values of spearmanr (correlation) | 1.2 | 0 | 0 | 1,006 |
10,078,683 | 2012-04-09T19:32:00.000 | 1 | 0 | 0 | 0 | python,django,django-templates | 10,078,813 | 4 | false | 1 | 0 | You can create an external tag which does that but django templating system which was build to be lightweight has no such feature in for loops. | 1 | 3 | 0 | I am rather new to django templates and have an impression that I have not understood some basics.
I have a list of elements and I need to render an element of the list based on conditions against the the previous and the next elements (in case the following or the previous elements are hidden, I need to mark the curre... | Django templates: accessing the previous and the following element of the list | 0.049958 | 0 | 0 | 4,660 |
10,082,968 | 2012-04-10T04:03:00.000 | 1 | 1 | 1 | 0 | python,email,message,multipart,smtplib | 13,021,872 | 1 | false | 0 | 0 | A multipart message is basically a nested e-mail message. The embedded messages are ordered in the order that the messages were attached to the containing e-mail. There isn't and index embedded in the e-mail (if I understand your question correctly) - get_payload() would return a list of the embedded e-mail messages.
I... | 1 | 0 | 0 | I am using the email module and creating a message object out of both ASCII and Unicode files that are essentially emails.
The emails include a secretary responding in one portion and in others the boss creating the email. These emails were extracted from pst files (i.e. from outlook or something similar). If you are ... | What exactly is a python sub message object if is_multipart is true and how does python organize them? | 0.197375 | 0 | 0 | 287 |
10,083,291 | 2012-04-10T05:00:00.000 | 3 | 0 | 0 | 0 | python,encryption,pycrypto | 10,084,619 | 2 | true | 0 | 0 | Using the simplest SSL/TLS (without PKI) as transport protection for REST is probably the most effective way to get the wheel right the first time.
Beside that, you should clarify a few topics. For instance:
Is it important that the client does not get deceived by an attacker which may be impersonating the server? If ... | 1 | 1 | 0 | I'm writing a client - server model ( client is a script on a server that gathers data and sends it via REST to the server ) and want to encrypt the data that is sent.
At the moment I have a function that generates the a random key, which adds time from a specific timezone - IP-HOSTNAME-YEAR-MONTH-DAY-HOUR-(MINUTE/2) ... | Encrypting data in Python - | 1.2 | 0 | 0 | 2,036 |
10,083,362 | 2012-04-10T05:09:00.000 | 0 | 0 | 1 | 0 | python,programming-languages,ocaml,interpreter,static-typing | 10,091,527 | 7 | false | 0 | 0 | Learn Scala.
If not satisfied and you are willing to work with MS Visual Studio, learn F#.
If not satisfied and you can reconsider your point (3), learn Haskell.
If not satisfied and you can reconsider your point (5), learn OCaml.
Note that OCaml programs can relatively easily work across separate processes, since it ... | 3 | 2 | 0 | I have done some Java programming and very little C and PHP programming as well. Recently I started to learn Python because the language seemed interesting.
But several posts on SO seemed to point that Python is not suitable for concurrent programming. And also is slower compared to those languages that have a compiler... | A language that satisfies this criteria? | 0 | 0 | 0 | 453 |
10,083,362 | 2012-04-10T05:09:00.000 | 1 | 0 | 1 | 0 | python,programming-languages,ocaml,interpreter,static-typing | 10,083,784 | 7 | false | 0 | 0 | Python satisfies most of your needs aside from static typing, however, because of its design it has something called the GIL or Global Interpreter Lock. This means that python threads don't truly execute separately. This might explain the criticisms you spoke about in reference to python and concurrent programming. How... | 3 | 2 | 0 | I have done some Java programming and very little C and PHP programming as well. Recently I started to learn Python because the language seemed interesting.
But several posts on SO seemed to point that Python is not suitable for concurrent programming. And also is slower compared to those languages that have a compiler... | A language that satisfies this criteria? | 0.028564 | 0 | 0 | 453 |
10,083,362 | 2012-04-10T05:09:00.000 | 5 | 0 | 1 | 0 | python,programming-languages,ocaml,interpreter,static-typing | 10,095,433 | 7 | true | 0 | 0 | Yes, OCaml is suitable for concurrent programming. It does have a Thread module that allows you to program network applications the way you would do it in Java.
Note that it currently does not support true parallelism (you won't have two threads running OCaml code in parallel), but it doesn't matter as OCaml is much fa... | 3 | 2 | 0 | I have done some Java programming and very little C and PHP programming as well. Recently I started to learn Python because the language seemed interesting.
But several posts on SO seemed to point that Python is not suitable for concurrent programming. And also is slower compared to those languages that have a compiler... | A language that satisfies this criteria? | 1.2 | 0 | 0 | 453 |
10,083,772 | 2012-04-10T05:54:00.000 | -3 | 0 | 0 | 0 | python,numpy | 39,361,043 | 2 | false | 0 | 0 | np.linalg.eig will often return complex values. You may want to consider using np.sort_complex(eig_vals). | 1 | 5 | 1 | I am using linalg.eig(A) to get the eigenvalues and eigenvectors of a matrix. Is there an easy way to sort these eigenvalues (and associated vectors) in order? | python numpy sort eigenvalues | -0.291313 | 0 | 0 | 13,966 |
10,084,379 | 2012-04-10T06:56:00.000 | 2 | 0 | 0 | 1 | python,build,osx-lion,web2py | 10,090,778 | 3 | true | 0 | 0 | web2py works fine with Lion's stock Python 2.7. Unless you have a compelling reason to use 2.5, stick with 2.7. | 2 | 1 | 0 | Here is what I would like to do.
Use web2py with MySQL.
To do that, I need to use source web2py rather than web2py.app
To use web2py, I need Python 2.5
I am having trouble building and installing Python 2.5
I downloaded Python-2.5.6.tgz from Python release page.
Now, I did
./configure
and then
make
Then, I get th... | Python 2.5.6 build error on Mac Lion | 1.2 | 0 | 0 | 483 |
10,084,379 | 2012-04-10T06:56:00.000 | 0 | 0 | 0 | 1 | python,build,osx-lion,web2py | 10,114,744 | 3 | false | 0 | 0 | I have web2py on my iMac OSX Lion using the web2py app and MySQL. I haven't run into any reason why you can't use the app with MySQL. | 2 | 1 | 0 | Here is what I would like to do.
Use web2py with MySQL.
To do that, I need to use source web2py rather than web2py.app
To use web2py, I need Python 2.5
I am having trouble building and installing Python 2.5
I downloaded Python-2.5.6.tgz from Python release page.
Now, I did
./configure
and then
make
Then, I get th... | Python 2.5.6 build error on Mac Lion | 0 | 0 | 0 | 483 |
10,084,487 | 2012-04-10T07:05:00.000 | 3 | 1 | 1 | 0 | python | 30,221,189 | 3 | false | 0 | 0 | Sometimes modules do important things when they are first loaded, so it might break the program to delay import of the module. For example, if a module defines command-line flags that should be parsed when the program first starts, the module must be imported before parsing the arguments. Since Python was originally de... | 2 | 12 | 0 | I am trying to understand few things with respect to design.
I see a number of the code where Lazy Import features is used.By Lazy Import, I mean a facility provided by certain recipes, packages and modules which support "LazyImport" style. Those implementation in general aim to import the module only when it is used a... | Why Lazy Import is not default in Python? | 0.197375 | 0 | 0 | 5,844 |
10,084,487 | 2012-04-10T07:05:00.000 | 5 | 1 | 1 | 0 | python | 10,084,940 | 3 | false | 0 | 0 | Python, unlike e.g. PHP, is rarely used in a way where every request/action/... causes the whole application to be started again.
So importing everything at startup has the advantage of not having to perform imports while the application is doing something where delays are annoying.
The only advantage of local/lazy imp... | 2 | 12 | 0 | I am trying to understand few things with respect to design.
I see a number of the code where Lazy Import features is used.By Lazy Import, I mean a facility provided by certain recipes, packages and modules which support "LazyImport" style. Those implementation in general aim to import the module only when it is used a... | Why Lazy Import is not default in Python? | 0.321513 | 0 | 0 | 5,844 |
10,085,738 | 2012-04-10T08:55:00.000 | 5 | 0 | 1 | 0 | python,locking,exit | 10,109,731 | 1 | true | 0 | 0 | For threads created with the threading module, the main thread joins all non-daemon threads on exit. You can see this in threading.py by searching for exitfunc (verified in Python 2.4.5, 2.7.2, and 3.2.2 source)
If you have some non-daemon thread which is waiting for a lock, and you do not arrange for the lock to be re... | 1 | 5 | 0 | I am relatively new to Python and would like to understand the behavior of sys.exit() in the following case.
Main thread calls a sys.exit() but there's another non-daemon thread which was already waiting on some lock indefinitely.
I have tested this in my program and looks like the program as a whole doesn't exit. Is t... | Python's sys.exit behavior when a non-daemon thread is waiting indefinitely on a lock | 1.2 | 0 | 0 | 1,628 |
10,087,899 | 2012-04-10T11:30:00.000 | 2 | 0 | 0 | 0 | python,openerp | 11,686,257 | 5 | false | 0 | 0 | To debug your Openerp+python code in eclipse, start eclipse in debug perspective and follow the given steps:
1: Stop your openERP running server by pressing "ctr+c".
2: In eclipse go to Menu "Run/Debug Configurations". In configuration window under "Python Run", create new debug configuration(Double click on 'Python Ru... | 1 | 1 | 0 | I am working with OpenERP 6.1 and i am not able to debug the python code
by giving print statements in the python code.
This was quite easy/possible with OpenERP 6.0 where we give the server path
followed by module name and database name to debug the code.
How can i achieve this with OpenERP 6.1??
Please help!!
Thanks ... | How to debug python code in OpenERP 6.1 | 0.07983 | 0 | 0 | 4,208 |
10,088,731 | 2012-04-10T12:22:00.000 | 1 | 1 | 1 | 0 | c#,python,lua | 10,145,095 | 1 | true | 0 | 0 | Apple relaxed the language in their license agrement to allow Lua a few years ago. It's used in a huge number of iOS games (including Angry Birds, all EA games, etc.). In fact, there are many games on the App Store written in Lua, using Lua-based frameworks like Corona or MOAI (such as Crimson: Steam Pirates, a Bungie ... | 1 | 0 | 0 | I'm building a scientific/education application, and I need to provide power-user scripting capabilities. My choices are:
Embedding an existing language such as Python or Lua
Or creating my own language with coco/R, for example
(Initially I'm building in C#, but will probably later port to C++ for iPad & Android rea... | Embedded scripting on the AppStore - use Python, or snake my way in? | 1.2 | 0 | 0 | 360 |
10,090,236 | 2012-04-10T13:59:00.000 | 16 | 0 | 1 | 0 | python,sockets | 10,090,348 | 1 | true | 0 | 0 | You have several options here:
Close the listening socket from another thread - the accept() will raise an exception if it fails.
Open a local connection to the listening socket - that makes the accept() return by design.
Use an accept mechanism that can block on more than one synchronization object so that the wait c... | 1 | 16 | 0 | I am a newbie in python sockets and am really troubled by the stubbornness of the socket.accept() method. I really need a way of ending a socket.accept() method or any other alternative to socket.accept() which runs one time only. | How to stop a python socket.accept() call? | 1.2 | 0 | 1 | 18,731 |
10,090,645 | 2012-04-10T14:27:00.000 | 1 | 0 | 1 | 0 | python,sum | 10,090,752 | 3 | false | 0 | 0 | Open the files and use readline to open the files line by line. Check whether it is string or not. By looking at your file format, I assume everything in between two strings (Name1 and Name2 or else) are numbers so store those on list. Finally use sum(list) to get the output. I am not writing the code since this is "HO... | 1 | 0 | 0 | I have to write a script that does this:
Inputfile:
Name
10
-43
54
Name2
654
43
2
-5467
Name3
65
65
Outputfile:
Name 21
Name2 -4768
Name3 130
I came to the conclusion that I am supposed to split the input into arrays at the names and then print the first element and the sum of the rest, but I do not know how to do it a... | Summing numbers with header in Python | 0.066568 | 0 | 0 | 193 |
10,091,108 | 2012-04-10T14:55:00.000 | 0 | 0 | 0 | 0 | python,mysql,notifications | 10,091,535 | 1 | false | 0 | 0 | As I understand this is not a client-server application, but rather an application that has a common remote storage.
One idea would be to change to web services (this would solve most of your problems on the long run).
Another idea (if you don't want to switch to web) is to refresh periodically the data in your interfa... | 1 | 0 | 0 | I have a desktop python application whose data backend is a MySQL database, but whose previous database was a network-accessed xml file(s). When it was xml-powered, I had a thread spawned at the launch of the application that would simply check the xml file for changes and whenever the date modified changed (due to any... | Best way to inform user of an SQL Table Update? | 0 | 1 | 0 | 450 |
10,093,519 | 2012-04-10T17:28:00.000 | 3 | 0 | 1 | 0 | python,eclipse,warnings | 40,572,933 | 3 | false | 0 | 0 | Warning:
Bad indentation (2 spaces)
Solution:
CTRL A (select all code in current file)
Source -> Convert tabs to space-tabs [In main menu bar]
Write 2 | 3 | 9 | 0 | I am using PyDev perspective. I get a "bad indentation" warning in python files. I am using two spaces for indent and eclipse seems to want me to use 4.
How to set the indentation I want so this warning goes away? | Eclipse bad indentation warning | 0.197375 | 0 | 0 | 17,111 |
10,093,519 | 2012-04-10T17:28:00.000 | 6 | 0 | 1 | 0 | python,eclipse,warnings | 10,093,560 | 3 | false | 0 | 0 | Do Control+A to select all. Then go under the "source" menu tab and select "correct indentation".
Source: currently have Eclipse open. | 3 | 9 | 0 | I am using PyDev perspective. I get a "bad indentation" warning in python files. I am using two spaces for indent and eclipse seems to want me to use 4.
How to set the indentation I want so this warning goes away? | Eclipse bad indentation warning | 1 | 0 | 0 | 17,111 |
10,093,519 | 2012-04-10T17:28:00.000 | 15 | 0 | 1 | 0 | python,eclipse,warnings | 10,098,212 | 3 | true | 0 | 0 | You have to change the tab length that PyDev uses at:
window > preferences > pydev > editor > tab length | 3 | 9 | 0 | I am using PyDev perspective. I get a "bad indentation" warning in python files. I am using two spaces for indent and eclipse seems to want me to use 4.
How to set the indentation I want so this warning goes away? | Eclipse bad indentation warning | 1.2 | 0 | 0 | 17,111 |
10,093,879 | 2012-04-10T17:54:00.000 | 0 | 0 | 0 | 0 | python,wxpython | 10,094,083 | 4 | false | 0 | 1 | I would certainly suggest using Python and its GUI libraries, but only you can really make the decision as to wether you think its better than visual studio or Java. The syntax of Python is very basic and I think many people can agree its a plesure to use when you get your head around it (no curly brackets etc). Python... | 2 | 4 | 0 | I have a two years of experience in programming of enterprise application's with Java and Visual Studio, and I'm new in Python and wxPython. So my question is: Can wxPython provide me enough rich GUI to create those same app's? My reason if using Python is in it's diversity, simplicity and fast development of app's. T... | wxPython GUI - can it be compared to Java GUI or Visual Studio GUI? | 0 | 0 | 0 | 3,812 |
10,093,879 | 2012-04-10T17:54:00.000 | 1 | 0 | 0 | 0 | python,wxpython | 10,093,925 | 4 | false | 0 | 1 | wxGlade will give you the GUI skeleton. You will still need a separate text editor (I recommend Geany) to fill in the handlers. | 2 | 4 | 0 | I have a two years of experience in programming of enterprise application's with Java and Visual Studio, and I'm new in Python and wxPython. So my question is: Can wxPython provide me enough rich GUI to create those same app's? My reason if using Python is in it's diversity, simplicity and fast development of app's. T... | wxPython GUI - can it be compared to Java GUI or Visual Studio GUI? | 0.049958 | 0 | 0 | 3,812 |
10,094,217 | 2012-04-10T18:18:00.000 | 1 | 1 | 0 | 0 | python,metaprogramming,pickle | 10,094,298 | 1 | false | 1 | 0 | Just use an ORM. This is what they are for.
What you are proposing to do is create your own half-assed ORM on your own time. Save your time for your own code that does things, and use the effort other people put for free into solving this problem for you.
Note that all class creation in python is "dynamic" - this is n... | 1 | 2 | 0 | I'm developing a framework of sorts. I'm providing a base class, that will be subclassed by other developers to add behavior to the system. The instances of those classes will have attributes that my framework doesn't necessarily expect, except by inspecting those instances' __dict__. To make things even more interest... | Getting and serializing the state of dynamically created python instances to a relational model | 0.197375 | 0 | 0 | 136 |
10,096,268 | 2012-04-10T20:50:00.000 | 3 | 0 | 0 | 1 | python,security,google-app-engine,rsa,sha | 10,097,467 | 3 | false | 1 | 0 | You can increase your hashing algorithm security by using HMAC, a secret key, and a unique salt per entry (I know people will disagree with me on this but it's my belief from my research that it helps avoid certain attacks). You can also use bcrypt or scrypt to hash which will make reversing the hash an extremely time ... | 2 | 17 | 0 | Our google app engine app stores a fair amount of personally identifying information (email, ssn, etc) to identify users. I'm looking for advice as to how to secure that data.
My current strategy
Store the sensitive data in two forms:
Hashed - using SHA-2 and a salt
Encrypted - using public/private key RSA
When we ne... | Securing data in the google app engine datastore | 0.197375 | 0 | 0 | 3,792 |
10,096,268 | 2012-04-10T20:50:00.000 | 11 | 0 | 0 | 1 | python,security,google-app-engine,rsa,sha | 10,098,781 | 3 | true | 1 | 0 | When deciding on a security architecture, the first thing in your mind should always be threat models. Who are your potential attackers, what are their capabilities, and how can you defend against them? Without a clear idea of your threat model, you've got no way to assess whether or not your proposed security measures... | 2 | 17 | 0 | Our google app engine app stores a fair amount of personally identifying information (email, ssn, etc) to identify users. I'm looking for advice as to how to secure that data.
My current strategy
Store the sensitive data in two forms:
Hashed - using SHA-2 and a salt
Encrypted - using public/private key RSA
When we ne... | Securing data in the google app engine datastore | 1.2 | 0 | 0 | 3,792 |
10,097,491 | 2012-04-10T22:40:00.000 | 4 | 0 | 0 | 0 | java,python | 10,097,783 | 10 | false | 1 | 0 | I've looked for different libraries like Jepp or Jython, but most seem to be very out of date.
Jython is not "a library"; it's an implementation of the Python language on top of the Java Virtual Machine. It is definitely not out of date; the most recent release was Feb. 24 of this year. It implements Python 2.5, which... | 1 | 64 | 0 | What's the easiest way to execute a Python script from Java, and receive the output of that script? I've looked for different libraries like Jepp or Jython, but most appear out of date. Another problem with the libraries is that I need to be able to easily include a library with the source code (though I don't need to ... | Call and receive output from Python script in Java? | 0.07983 | 0 | 0 | 184,949 |
10,098,920 | 2012-04-11T02:01:00.000 | 4 | 0 | 0 | 0 | delphi,internet-explorer,activex,python-idle | 10,099,466 | 1 | true | 0 | 0 | There is no such event exposed by IE. | 1 | 0 | 0 | I developed an activex for IE using Delphi 2007 for win32. My question is: How can I get an idle event like getting one from the message loop of TApplication?
I can use a timer of course, but if IE has one, why not use it? | Does IE raise Idle Event to ActiveX in it? If any, how to register my own code to the idle event | 1.2 | 0 | 0 | 181 |
10,098,963 | 2012-04-11T02:09:00.000 | 2 | 0 | 0 | 0 | java,javascript,python,html,navigation | 10,099,151 | 2 | false | 1 | 0 | You can use a tool like Selenium to emulate a user clicking things in a web browser (I believe it actually "drives" a real instance of whatever browser you choose.)
Selenium has a domain-specific language for specifying what actions you want to perform, and Python bindings for controlling it programmatically. I haven't... | 1 | 2 | 0 | I need to navigate though a website that is written mostly in Javascript. There are no hard links at all, as the page is simply modified through the script. I can do what I need to using Javascript injections one after another, but chrome starts searching for my input instead of injecting it after a certain string leng... | How do I navigate a website through software? | 0.197375 | 0 | 1 | 343 |
10,099,619 | 2012-04-11T04:01:00.000 | 0 | 0 | 1 | 0 | python,arrays | 10,101,163 | 4 | false | 0 | 0 | Using the construct
[[0,0]]*3
works just fine and returns the following:
[[0, 0], [0, 0], [0, 0]] | 2 | 2 | 1 | I want to initialize an array that has X two-dimensional elements. For example, if X = 3, I want it to be [[0,0], [0,0], [0,0]]. I know that [0]*3 gives [0, 0, 0], but how do I do this for two-dimensional elements? | How do I initialize a one-dimensional array of two-dimensional elements in Python? | 0 | 0 | 0 | 1,407 |
10,099,619 | 2012-04-11T04:01:00.000 | 0 | 0 | 1 | 0 | python,arrays | 10,099,628 | 4 | false | 0 | 0 | I believe that it's [[0,0],]*3 | 2 | 2 | 1 | I want to initialize an array that has X two-dimensional elements. For example, if X = 3, I want it to be [[0,0], [0,0], [0,0]]. I know that [0]*3 gives [0, 0, 0], but how do I do this for two-dimensional elements? | How do I initialize a one-dimensional array of two-dimensional elements in Python? | 0 | 0 | 0 | 1,407 |
10,100,399 | 2012-04-11T05:37:00.000 | 1 | 0 | 1 | 0 | python,performance,algorithm,memory-management | 10,102,586 | 2 | false | 0 | 0 | and is very big so its very hard to pass that data-structure from function-to-function.
No, it isn't. Python variables don't work that way. You implicitly get a pointer. | 2 | 1 | 0 | I am writing a code, wherein I will store few files into the data-structure in memory, and will then use that data-structure in all the modules in order to access that data-structure. (time-saving)
Since the code is written in python, and is very big so its very hard to pass that data-structure from function-to-functio... | How to pass data-structure residing in memory from module to module | 0.099668 | 0 | 0 | 234 |
10,100,399 | 2012-04-11T05:37:00.000 | 0 | 0 | 1 | 0 | python,performance,algorithm,memory-management | 10,100,689 | 2 | true | 0 | 0 | Python variables and function arguments are always only references to objects, so don't worry about passing a large data structure as a function argument: the data is not copied, only a new reference is created.
However, if you know your code will always deal with only a single instance of the data structure, you can s... | 2 | 1 | 0 | I am writing a code, wherein I will store few files into the data-structure in memory, and will then use that data-structure in all the modules in order to access that data-structure. (time-saving)
Since the code is written in python, and is very big so its very hard to pass that data-structure from function-to-functio... | How to pass data-structure residing in memory from module to module | 1.2 | 0 | 0 | 234 |
10,103,053 | 2012-04-11T09:14:00.000 | 0 | 0 | 0 | 0 | python,google-app-engine,captcha | 10,108,518 | 2 | false | 1 | 0 | Qaptcha seens to use cookies. To manipulate cookies on appengine, use this pseudo code:
if response.cookies['iQaptcha'] is None: | 1 | 0 | 0 | i have created a simple web app which contains recaptcha authentication. however, i feel that it is too difficult for my userbase.
i'd like a simple and decently secure solution that i can use with GAE-py without much effort, which uses something like a slider/drag-drop approach.
something like Qaptcha.
Any recommendat... | simple slider captcha implementation for google app engine-python | 0 | 0 | 0 | 826 |
10,104,261 | 2012-04-11T10:33:00.000 | 0 | 0 | 0 | 0 | python,linux,qt,gtk | 10,106,439 | 4 | false | 0 | 1 | Short: You can use both, no third party library is guaranteed to be distributed with all major distributions.
Long:
Gtk+ vs. Qt
What do you want incorporate into your application. If it is just selecting a brush, selecting color you could pretty much use any gui toolkit.
If you are going to run it as a web-based tool,... | 2 | 1 | 0 | I've decided to start working on a personal project, attempting to develop a cross platform, MSPaint like app. Oddly enough, I find mspaint is one of the applications I miss the most on Linux or OS X, so I want to try to make something similar. Tuxpaint, mtpaint, gpaint, etc. are all old and inactive and ugly. I don... | Framework for paint program | 0 | 0 | 0 | 810 |
10,104,261 | 2012-04-11T10:33:00.000 | 3 | 0 | 0 | 0 | python,linux,qt,gtk | 10,104,320 | 4 | false | 0 | 1 | Qt's canvas object (or its newer replacement QGraphicsView) can do pretty cool things. Whether you choose C++ or python is a matter of personal choice, as Qt is supported in both languages. For a simple project like this I'd choose python because killer performance is not much of an issue, and it will be much easier to... | 2 | 1 | 0 | I've decided to start working on a personal project, attempting to develop a cross platform, MSPaint like app. Oddly enough, I find mspaint is one of the applications I miss the most on Linux or OS X, so I want to try to make something similar. Tuxpaint, mtpaint, gpaint, etc. are all old and inactive and ugly. I don... | Framework for paint program | 0.148885 | 0 | 0 | 810 |
10,105,610 | 2012-04-11T12:09:00.000 | 3 | 0 | 0 | 0 | python,django,facebook,fandjango | 10,105,994 | 1 | true | 1 | 0 | There's no need to wrap the context processor. If you've wrapped the view in the first place, then the request will already be annotated with the facebook.user attribute. Since the request is passed to the context processor anyway, you have access to that attribute.
You should probably do a quick check - if hasattr(req... | 1 | 0 | 0 | I'm using Fandjango for a Django Facebook Canvas app.
To use fandjango, you need to wrap all view functions with @facebook_authorization_required, which makes sure you're authorized, then gives you the variable request.facebook.user.
What I want is to make a context processor which defines a few more variables based on... | Apply decorator to context processor | 1.2 | 0 | 0 | 280 |
10,107,136 | 2012-04-11T13:41:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,google-cloud-storage | 10,115,635 | 2 | true | 1 | 0 | Since you created the API console project with an Apps account (one @yourdomain.com), the project is automatically treated as an Apps project, and only users from your domain can be added to it.
To avoid this, create a new project using a @gmail.com account, and then add all the developers you want to have access to it... | 1 | 2 | 0 | I try to enable Cloud Storage for my GAE app. I read in the docs that:
Add the service account as a project editor to the Google APIs Console
project that the bucket belongs to. For information about permissions
in Cloud Storage, see Scopes and Permissions on the Cloud Storage
documentation.
However when I try ... | Google App Engine & Google Storage | 1.2 | 0 | 0 | 644 |
10,108,347 | 2012-04-11T14:46:00.000 | 0 | 0 | 1 | 0 | javascript,python,json | 10,108,427 | 2 | false | 0 | 0 | If the data just contained json then probably, but if it contains other javascript declarations then it won't be considered well-formed json | 1 | 0 | 0 | I have inherited a number of javascript files containing a mixture of JSON objects and other js declarations (functions, variables). I'm writing a python script to move the data contained in the JSON objects into another system.
I'd like to avoid duplicating any sort of parser functionality in what is essentially a th... | Using Python to extract JSON from a .js file also containing non-JSON declarations? | 0 | 0 | 0 | 770 |
10,108,368 | 2012-04-11T14:47:00.000 | 1 | 1 | 0 | 0 | python,r,geolocation,cran | 10,108,983 | 5 | false | 0 | 0 | A few ideas:
Ad-hoc & approximate: The "2-D histogram". Create arbitrary "rectangular" bins, of the degree width of your choice, assign each bin an ID. Placing a point in a bin means "associate the point with the ID of the bin". Upon each add to a bin, ask the bin how many points it has. Downside: doesn't correctly... | 1 | 20 | 1 | I have a R data.frame containing longitude, latitude which spans over the entire USA map. When X number of entries are all within a small geographic region of say a few degrees longitude & a few degrees latitude, I want to be able to detect this and then have my program then return the coordinates for the geographic b... | Detecting geographic clusters | 0.039979 | 0 | 0 | 5,580 |
10,109,305 | 2012-04-11T15:40:00.000 | 1 | 0 | 0 | 1 | python,windows | 10,109,380 | 3 | false | 0 | 0 | Not sure if it helps but if you enter "SET" from the command prompt you'll see a list of environment variables, including the current PROMPT (however it won't appear in the list if it's the default prompt). | 1 | 0 | 0 | In Windows XP when you open cmd.exe you get a console window with a command prompt looking like:
"C:\User and Settings\Staffer\My Documents>" where s> the underscore after the '>' is the cursor.
This is the default for Windows XP. A user might change it using the PROMPT=something or by using set PROMPT=something
In ... | Is there a way to capture the MSDOS command prompt string? | 0.066568 | 0 | 0 | 676 |
10,109,848 | 2012-04-11T16:15:00.000 | 2 | 1 | 0 | 0 | python,encryption,https,mechanize,mechanize-python | 10,109,960 | 1 | true | 0 | 0 | It's exactly the same as using a web browser -- you should use the same judgement as to whether you want to enter your username and password. | 1 | 1 | 0 | If I am using a python script with mechanize to fill out forms on websites (such as login information) should I be worried about encryption? Is there anything I need/could do to ensure that the password sent is encrypted? (Or is this even necessary? Is filling out a form with mechanize equivalent to filling out a form ... | Python Mechanize Module Encryption | 1.2 | 0 | 0 | 215 |
10,111,961 | 2012-04-11T18:39:00.000 | 1 | 0 | 1 | 0 | python,datetime,date | 10,112,006 | 4 | false | 0 | 0 | Convert all times into a 24-hour format, taking minutes and seconds as fractions of hours, then just compare them as numbers to see if a time lies in an interval. | 1 | 2 | 0 | So I'm looking to take input such as 7:00 AM as a start time, and say, 10:00 PM as an endtime, and then compare a set of times (also in the form of 8:00 AM, 3:00 PM, etc) to see if those time are or aren't in the range of time. Is there a good way to create a "day" that has a range of hours (the endtimes can be as late... | Create Range of Hours in Python | 0.049958 | 0 | 0 | 6,802 |
10,112,500 | 2012-04-11T19:20:00.000 | 4 | 0 | 0 | 0 | python,r,nlp,text-mining,lda | 10,177,394 | 2 | false | 0 | 0 | My friend's response is below, pardon the language please.
First I wrote up a Python implementation of the collapsed Gibbs sampler seen here (http://www.pnas.org/content/101/suppl.1/5228.full.pdf+html) and fleshed out here (http://cxwangyi.files.wordpress.com/2012/01/llt.pdf). This was slow as balls.
Then I used a Pyt... | 1 | 7 | 1 | I am using Latent Dirichlet Allocation with a corpus of news data from six different sources. I am interested in topic evolution, emergence, and want to compare how the sources are alike and different from each other over time. I know that there are a number of modified LDA algorithms such as the Author-Topic model, To... | Implementing alternative forms of LDA | 0.379949 | 0 | 0 | 2,734 |
10,113,218 | 2012-04-11T20:12:00.000 | 12 | 0 | 1 | 0 | python,wrapper,porting,smalltalk,pharo | 10,113,985 | 1 | true | 0 | 0 | Wrapper
Write functions in the native language whose sole purpose is to call the functions in the external library. The goal is to do as little as possible in the native language. For example, translating data types from the native language to the external library language, etc.
Wrappers make sense when the external ... | 1 | 4 | 0 | There is a project I'm about to build in Smalltalk (Pharo). And there is a python library which I intend to use for the same. Now, there are 3 options:
Smalltalk wrapper for those python libraries
Porting the python library to Smalltalk
Write the library from scratch (in Smalltalk) for use in my project
The followin... | How to decide when to wrap/port/write-from-scratch | 1.2 | 0 | 0 | 294 |
10,113,358 | 2012-04-11T20:22:00.000 | 3 | 0 | 1 | 0 | python | 10,113,663 | 3 | false | 0 | 0 | Types defined in C can never have user-assigned attributes. If you want to replace object globally then you'll need to iterate over every single class in existence, then replace __builtin__.object to catch all future class creation. And even that isn't reliable since the old object could be bound somewhere else. | 1 | 7 | 0 | Every class in python inherits from the class 'object.' I am wondering about the internal mechanism of the 'object' class implementation. Why cannot the 'object' class be assigned any user-attributes? I am convinced that it is related to memory-management but what if the user thinks of implementing the memory-managemen... | why 'object' class doesn't have user set attributes | 0.197375 | 0 | 0 | 473 |
10,113,383 | 2012-04-11T20:24:00.000 | 3 | 0 | 1 | 0 | python,import,include | 10,113,603 | 3 | false | 0 | 0 | In general, dependencies should be a tree. Circular dependencies are not resolvable.
The usual way to solve this, though, is to do a "local import" of the required module at a level other than the global namespace. | 1 | 8 | 0 | this is a case again where I'm running around in circles and I'm about to go wild.
I wish Python would analyze all files at first, so that it would know all identifiers from the beginning (I think like Java does).
I have a "main.py" and a "gui.py". Every file contains a class, that makes use of the class in the other f... | Handle circular dependencies in Python modules? | 0.197375 | 0 | 0 | 11,837 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.