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
4,733,886
2011-01-19T10:00:00.000
3
0
1
1
python,windows,debugging,race-condition,boot
4,733,924
2
false
0
0
Run it inside a virtual machine.
2
3
0
I dealt with a bug today that only appeared when I ran my program right after booting my computer. The cold start exposed a race condition which triggered the bug. I managed to fix it, but it took a long time because I had to reboot my machine several times to figure out what was going on. Can anybody suggest better...
Dealing with bugs that only appear right after boot
0.291313
0
0
58
4,733,886
2011-01-19T10:00:00.000
2
0
1
1
python,windows,debugging,race-condition,boot
4,734,016
2
true
0
0
Use virtual machine (f.e. VirtualBox) and save state (make snapshot) just before booting is finished. Test freely and restore just booted state according to your needs.
2
3
0
I dealt with a bug today that only appeared when I ran my program right after booting my computer. The cold start exposed a race condition which triggered the bug. I managed to fix it, but it took a long time because I had to reboot my machine several times to figure out what was going on. Can anybody suggest better...
Dealing with bugs that only appear right after boot
1.2
0
0
58
4,736,698
2011-01-19T14:56:00.000
1
0
0
1
java,c++,python,c,ruby
4,737,502
3
false
1
0
You should probably use a standard interprocess mechanism like a pipe or socket. All of these languages have libraries available for both, and this strategy allows communication between any 2 of your processes (Java/Ruby, Ruby/Python, Java/C, etc)
2
2
0
I have succeeded in getting ProcessBuilder to run external scripts, but I still have to get Java to communicate with the external scripts. I figure that I should get the input/output streams from the process, and use those to send and receive data. I'm having a the most trouble with giving input to the scripts. It seem...
Getting Java to talk to Python, C, C++, and Ruby
0.066568
0
0
1,579
4,736,698
2011-01-19T14:56:00.000
2
0
0
1
java,c++,python,c,ruby
4,737,732
3
true
1
0
The method getOutputStream() on the Process class returns a stream you can write to in Java that connects to the stdin stream of the process. You should be able to read this as you would normally read stdin for each language (e.g., cin for C++, scanf for C, STDIN.read for Ruby, don't know Python!) If this is what you'r...
2
2
0
I have succeeded in getting ProcessBuilder to run external scripts, but I still have to get Java to communicate with the external scripts. I figure that I should get the input/output streams from the process, and use those to send and receive data. I'm having a the most trouble with giving input to the scripts. It seem...
Getting Java to talk to Python, C, C++, and Ruby
1.2
0
0
1,579
4,737,324
2011-01-19T15:47:00.000
0
0
0
0
python,qt,pyqt4,qt-designer
4,741,509
1
true
0
1
To have the widgets resized with the window, you must apply a layout to your top-level object (usually QMainWindow), and then place your new widgets where you want in the layout (and maybe other layouts for a more complicated window). NOTE: the menu items allowing to apply a layout on the main window will be available ...
1
0
0
I am working on Qtdesigner for generating a GUI for my python app. The problem is that I had manually made the widgets and then compiled it to py. But then I found out that the components did not resize when maximised. So I opened the .ui file in designer and selected the group box for my widgets and chose layout in gr...
Help in designing layout with qtdesigner for python
1.2
0
0
316
4,737,721
2011-01-19T16:17:00.000
0
1
0
0
javascript,python,encryption,pgp
4,738,545
1
false
1
0
Use SSL for your connections to the server. Probably the easiest way to do that is to use HTTP for communication and also to run a proxy (say, Apache) on the server that can do HTTPS and forwards requests to the actual server application.
1
1
0
I'm looking for a public private key solution that I can use with a javascript client and python backend. The aim is to send data encrypted from the client to the server... Are the any solutions? Thanks for hints.
public private key solution for javascript and python
0
0
1
401
4,737,814
2011-01-19T16:24:00.000
0
0
1
0
python,string
4,738,130
3
false
0
0
No 3: If your string is s: max((j-i,s[i:j]) for i in range(len(s)-1) for j in range(i+2,len(s)+1) if s[i:j]==s[j-1:i-1:-1])[1] will return the answer.
1
2
0
I'm new to Python and am currently reading a chapter on String manipulation in "Dive into Python." I was wondering what are some of the best (or most clever/creative) ways to do the following: 1) Extract from this string: "stackoverflow.com/questions/ask" the word 'questions.' I did string.split(/)[0]-- but that isn...
Python: Clever ways at string manipulation
0
0
0
975
4,737,852
2011-01-19T16:27:00.000
0
0
1
0
python,synchronization,calendar
4,738,228
1
true
0
0
Most calendars, including the Google calendar, has ways to import and synchronize data. You can use these ways. Just import the gdata information (perhaps you need to make it into ics first, I don't know) into the Google calendar.
1
0
0
Question is rather conceptual, then direct. What's the best solution to keep two different calendars synchronised? I can run a cron job for example every minute, I can keep additional information in database. How to avoid events conflicts? As far I was thinking about these two solutions. First one is keeping a database...
Two calendars synchronization
1.2
1
0
516
4,738,285
2011-01-19T17:05:00.000
2
1
1
0
python
4,738,310
5
false
0
0
It is the same as != ("not equal")
1
6
0
What is the meaning of <> in Python? I have tried searching for it on Google but I cannot seem to get inside the search term... I have not seen this in any other language also otherwise I would have tried to find it.
what does <> mean in Python
0.07983
0
0
866
4,738,980
2011-01-19T18:10:00.000
2
1
1
0
php,python,frameworks,dependency-injection
4,739,047
2
false
0
0
I usually choose frameworks, whether DI or otherwise, using the following criteria: Pick a framework that has the required functionality for the job at hand Prefer frameworks that are simple - The less "extra" stuff not required for 1., the better. Prefer frameworks "built-in" to the language/framework you're already ...
1
2
0
Rather than triggering a flamewar on what DI framework is "best" (I don't think there's a definitive general solution), this question is meant to discuss good alternatives for projects of different kinds, no matter the programming language, based on professional experience. Some issues I'd like to lean about: What wer...
Inversion of Control: Have you ever had to decide what Dependency Injection framework is best for a project? Which one did you pick and why?
0.197375
0
0
367
4,739,268
2011-01-19T18:41:00.000
0
0
1
0
python
4,742,790
2
false
0
0
Which distribution are you using? I would recommend you to upgrade your system to a newer version of your linux distro, whatever it is. Modern Linux distros are using at least python2.6 now. If you do not want to upgrade your system with various reasons, ActiveState's python version as stated in Jasie's answer is good ...
1
2
0
Hi I just want to install mercurial but for all versions it needs python 2.6, I tried to use .rpm file but the only thing I got is lots of lines full of error which tells: need old versions before 2.6 and after 2.5 which is installed on my linux. any help would be appreciated. Bests
upgrading python
0
0
0
345
4,740,528
2011-01-19T20:46:00.000
0
0
1
0
python,django,satchmo
4,741,617
2
false
0
0
The idea is that settings.py contains all the settings you actually need to run your project. local_settings.py is for if you need to override any of them locally, for instance in development. For example, you might have different database passwords, or template paths, etc. The answer to your question is to put new set...
1
3
0
Can someone explain the difference between local_settings.py and settings.py in Satchmo? I understand that the settings.py module imports the local_settings.py module as it's final step. So any settings in local_settings.py takes precedence. But what is the point of doing this? Isn't settings.py supposed to be the conf...
Difference Between Satchmo's local_settings.py and settings.py
0
0
0
438
4,740,961
2011-01-19T21:26:00.000
0
0
1
0
python
4,741,664
2
false
0
0
If you are not in the same timezone as NYC, it's in practice impossible without knowing the timezone and when DST changes. You can't hardcode it for NYC, of course, but it is way easier to just install pytz or dateutil, and then you aren't limited to NYC.
1
2
0
In Python, I want a Python program to be able to determine the current date and time in NYC . Is that practical? While datetime.datetime.now() can tell me the local time, and datetime.utcnow() can tell me the UTC (GMT). However just looking at the difference will not help me as DST changes. I try things like "dt=date...
Python: What date/time is it in NYC? (without pytz)
0
0
0
490
4,741,223
2011-01-19T21:53:00.000
5
0
1
0
python,compression,translation
4,741,255
3
true
0
0
You can try to compress the string and the encode the result to for example base64. This of course assumes that your original strings are compressible. For strings of 19 characters this seems unlikely. If you are allowed to persist some data you can compress the first string to 1, the second to 2, etc... and you will n...
2
2
0
I'm sorry for the generic question (I don't have any past knowledge about compression and I don't know if it has a possible solution). I have some codes of always 19 characters. These characters can be only: A-Z, a-z, 0-9, ., :, - An example can be something like 1995AbC...123..456Z What I want to do is to find a way t...
Python: Code string to shorter meaningless string in reversible way
1.2
0
0
2,339
4,741,223
2011-01-19T21:53:00.000
4
0
1
0
python,compression,translation
4,741,338
3
false
0
0
You allow 65 different characters. Assuming all inputs have the same probability, every encoding would produce not less than 19*65/128 ≈ 10 characters. However, since you probably want to ignore unprintable characters, this is diminished to 19*65/95=13 characters with a perfect mapping. Therefore, any such mapping will...
2
2
0
I'm sorry for the generic question (I don't have any past knowledge about compression and I don't know if it has a possible solution). I have some codes of always 19 characters. These characters can be only: A-Z, a-z, 0-9, ., :, - An example can be something like 1995AbC...123..456Z What I want to do is to find a way t...
Python: Code string to shorter meaningless string in reversible way
0.26052
0
0
2,339
4,742,287
2011-01-20T00:25:00.000
0
0
1
0
python,regex
4,742,333
6
false
0
0
If you are looking for only one result, use the re.search function instead. That returns a MatchObject (http://docs.python.org/library/re.html#re.MatchObject). The object has start() and end() functions.
1
0
0
Say, I have 'ABBACDA', and I want to find the index of where each A is. Using Regex in Python, match = re.findall('A', 'ABBACDA') only returns a list. Any way I can tweak this? Or should I go an entirely different route? I wanted to avoid using a for x in enumerate(str) because I also would like to check for where, sa...
Finding character position from a RegEx'd string
0
0
0
2,829
4,742,338
2011-01-20T00:35:00.000
4
0
0
0
python,django
4,742,356
2
true
1
0
It will slow down startup (actually, whatever loads the file containing those imports the first time will be slowed down). Assuming django does not do that for every request but only once, it is not an issue at all.
2
3
0
What if I'm importing 100 things ? (In the top of my views.py) And then inside each of them, I'm importing 30 things. Will that slow things down?
How much do imports slow down Django?
1.2
0
0
282
4,742,338
2011-01-20T00:35:00.000
3
0
0
0
python,django
4,742,347
2
false
1
0
Only the first time they're imported in the process. After that, all that happens is that a reference is copied to the local scope.
2
3
0
What if I'm importing 100 things ? (In the top of my views.py) And then inside each of them, I'm importing 30 things. Will that slow things down?
How much do imports slow down Django?
0.291313
0
0
282
4,743,497
2011-01-20T04:40:00.000
0
0
1
0
python,coding-style,conventions
4,743,712
4
false
0
0
Python actually gives you the choice to package your code in the way you see fit. The analogy between Python and Java is that a file i.e., the .py file in Python is equivalent to a package in Java as in it can contain many related classes and functions. For good examples, have a look in the Python built-in modules. Ju...
3
30
0
In Java, this question is easy (if a little tedious) - every class requires its own file. So the number of .java files in a project is the number of classes (not counting anonymous/nested classes). In Python, though, I can define multiple classes in the same file, and I'm not quite sure how to find the point at which I...
When should a Python script be split into multiple files/modules?
0
0
0
8,928
4,743,497
2011-01-20T04:40:00.000
3
0
1
0
python,coding-style,conventions
4,744,148
4
false
0
0
As I see it, this is really a question about reuse and abstraction. If you have a problem that you can solve in a very general way, so that the resulting code would be useful in many other programs, put it in its own module. For example: a while ago I wrote a (bad) mpd client. I wanted to make configuration file and o...
3
30
0
In Java, this question is easy (if a little tedious) - every class requires its own file. So the number of .java files in a project is the number of classes (not counting anonymous/nested classes). In Python, though, I can define multiple classes in the same file, and I'm not quite sure how to find the point at which I...
When should a Python script be split into multiple files/modules?
0.148885
0
0
8,928
4,743,497
2011-01-20T04:40:00.000
2
0
1
0
python,coding-style,conventions
4,743,655
4
false
0
0
In Java ... every class requires its own file. On the flipside, sometimes a Java file, also, will include enums or subclasses or interfaces, within the main class because they are "closely related." not counting anonymous/nested classes Anonymous classes shouldn't be counted, but I think tasteful use of nested clas...
3
30
0
In Java, this question is easy (if a little tedious) - every class requires its own file. So the number of .java files in a project is the number of classes (not counting anonymous/nested classes). In Python, though, I can define multiple classes in the same file, and I'm not quite sure how to find the point at which I...
When should a Python script be split into multiple files/modules?
0.099668
0
0
8,928
4,745,071
2011-01-20T08:53:00.000
2
1
1
0
c#,java,python,reflection
4,745,791
5
false
0
0
Yes, in that aspect, Python developement is fundametally different. Reflection in C#/Java refers to the ability of the runtime to know things about the code it's running, and to take decisions based on that information. Since Python uses dynamic typing, any type discovery is delegated to the runtime and not the compile...
4
9
0
I've written C# and the mantra coming from on high seems to be "never use reflection in production code". I have used it for test code, but never anything that runs in the wild. All the arguments seem reasonable, and there's always a way to do it by adding another layer of abstraction or design pattern or whatever. Now...
Never use reflection in production code! What about Python?
0.07983
0
0
3,093
4,745,071
2011-01-20T08:53:00.000
0
1
1
0
c#,java,python,reflection
4,745,191
5
false
0
0
IMO the reason for me about avoiding using reflection in production code is the fact than reflection could make code really harder to maintain and debug.
4
9
0
I've written C# and the mantra coming from on high seems to be "never use reflection in production code". I have used it for test code, but never anything that runs in the wild. All the arguments seem reasonable, and there's always a way to do it by adding another layer of abstraction or design pattern or whatever. Now...
Never use reflection in production code! What about Python?
0
0
0
3,093
4,745,071
2011-01-20T08:53:00.000
6
1
1
0
c#,java,python,reflection
4,745,134
5
false
0
0
I think that the "no reflection in production code" is not correct in c#. Reflection often allows the programmer to do things otherwise impossible. I would say "no reflection for non-public members in production code" and "use reflection with care!" if not used correctly, you could lose performance. Used correctly coul...
4
9
0
I've written C# and the mantra coming from on high seems to be "never use reflection in production code". I have used it for test code, but never anything that runs in the wild. All the arguments seem reasonable, and there's always a way to do it by adding another layer of abstraction or design pattern or whatever. Now...
Never use reflection in production code! What about Python?
1
0
0
3,093
4,745,071
2011-01-20T08:53:00.000
18
1
1
0
c#,java,python,reflection
4,745,093
5
true
0
0
As a dynamic language Python is fundamentally different than statically typed languages, so everything is reflection in it :-) Also never use reflection in production code (for static languages) seems a bit extreme to me.
4
9
0
I've written C# and the mantra coming from on high seems to be "never use reflection in production code". I have used it for test code, but never anything that runs in the wild. All the arguments seem reasonable, and there's always a way to do it by adding another layer of abstraction or design pattern or whatever. Now...
Never use reflection in production code! What about Python?
1.2
0
0
3,093
4,745,359
2011-01-20T09:27:00.000
0
0
1
0
python,ironpython,python-idle
4,746,203
1
true
0
0
Most Python code should work cross-platform, cross-IDE as at heart they all use the same interpreter (although versions may differ). Your IDE should only edit and run programs and will not affect the code you write.
1
0
0
I am trying to choose an IDE for Python. I like IronPython and want to inquire if the code written in IronPython can run in a normal Python shell like IDLE
Does code written in IronPython work in IDLE
1.2
0
0
430
4,746,115
2011-01-20T10:44:00.000
3
1
0
0
python,performance,excel,com,automation
4,746,776
1
false
0
0
I cannot answer for Python, but for VBA/VB6 a significant number of changes were made in XL 2010 to improve performance rather than make it slower, see:http://blogs.office.com/b/microsoft-excel/archive/2009/09/03/performance-improvements-in-excel-2010.aspx Could you give a VB example of something that is 5 times slower...
1
2
0
We have several programs generating excel documents via com automation, some written in VB6, some in python. Regardless of the programming language those programs run 5 times slower than with older excel versions. Profiling the python version shows that the additional run time is spent mostly in low level com functiona...
Automation of excel 2010 5 times slower than before
0.53705
0
0
692
4,746,579
2011-01-20T11:33:00.000
12
0
1
0
python,vim,syntax,vi,vim-syntax-highlighting
4,746,595
4
false
0
0
Put the line syntax on in your .vimrc.
2
94
0
How do I do I set the syntax highlighting in Vim 7 for python? I would like to set my own colorschemes, and syntax highlighting for a type of code file.
Syntax highlighting in vim for python
1
0
0
115,665
4,746,579
2011-01-20T11:33:00.000
148
0
1
0
python,vim,syntax,vi,vim-syntax-highlighting
4,746,609
4
true
0
0
The command to enable syntax highlighting in vim is :syntax on, if you want it to be active everytime you launch vim, just add a line containing syntax on in your .vimrc file.
2
94
0
How do I do I set the syntax highlighting in Vim 7 for python? I would like to set my own colorschemes, and syntax highlighting for a type of code file.
Syntax highlighting in vim for python
1.2
0
0
115,665
4,747,944
2011-01-20T13:53:00.000
1
0
0
0
shell,formatting,input,wxpython,wxwidgets
4,748,126
3
false
0
1
In our product we have a console made up of two edit windows, separated by a thin line. The upper window is the output window, it is read-only. The lower window is editable. Once you have written a command in it and submitted it, the command is removed from the lower window and goes to the upper window, along with comm...
2
1
0
HI, guys, I am using wxpython to develop a GUI for software configuration, launching and interaction. I want something like a CLI shell window (like pycrust) embedded inside the GUI to interact with a long-term running background process. I could give the input via this shell window and print the output on this window....
output readonly, input editable with wx.textctrl?
0.066568
0
0
1,237
4,747,944
2011-01-20T13:53:00.000
1
0
0
0
shell,formatting,input,wxpython,wxwidgets
4,764,075
3
false
0
1
Just keep track of the location of the prompt each time you display it. Intercept all keypresses and releases, and if anything causes text before the prompt to change, veto that event. It's not that hard, it just takes a little attention to detail and some diligence to capture all text-modification events.
2
1
0
HI, guys, I am using wxpython to develop a GUI for software configuration, launching and interaction. I want something like a CLI shell window (like pycrust) embedded inside the GUI to interact with a long-term running background process. I could give the input via this shell window and print the output on this window....
output readonly, input editable with wx.textctrl?
0.066568
0
0
1,237
4,748,787
2011-01-20T15:11:00.000
10
0
1
0
python,multithreading,locking,gil
4,748,838
4
false
0
0
They are running at the same time, they just don't execute at the same time. The iterations might be interleaved. Quote Python: The mechanism used by the CPython interpreter to assure that only one thread executes Python bytecode at a time. So two for loops might run at the same time, there will just be no (for examp...
3
6
0
I was reading about the GIL and it never really specified if this includes the main thread or not (i assume so). Reason I ask is because I have a program with threads setup that modify a dictionary. The main thread adds/deletes based on player input while a thread loops the data updating and changing data. However in ...
Python threading and GIL
1
0
0
3,773
4,748,787
2011-01-20T15:11:00.000
6
0
1
0
python,multithreading,locking,gil
4,748,829
4
false
0
0
The GIL locks at a Python byte-code level, and applies to all threads, even the main thread. If you have one thread modifying a dictionary, and another iterating keys, they will interfere with each other. "Only one runs at a time" is true, but you have to understand the unit of granularity. In the case of CPython's G...
3
6
0
I was reading about the GIL and it never really specified if this includes the main thread or not (i assume so). Reason I ask is because I have a program with threads setup that modify a dictionary. The main thread adds/deletes based on player input while a thread loops the data updating and changing data. However in ...
Python threading and GIL
1
0
0
3,773
4,748,787
2011-01-20T15:11:00.000
3
0
1
0
python,multithreading,locking,gil
4,748,843
4
false
0
0
The gil prevents two threads from modifying the interpreter state simultaneously. It doesn't provide any thread consistency constraints, or any kind of mutex at all on a granularity smaller than the whole process. If you need to read and modify a dict in two threads, you should be using a mutex
3
6
0
I was reading about the GIL and it never really specified if this includes the main thread or not (i assume so). Reason I ask is because I have a program with threads setup that modify a dictionary. The main thread adds/deletes based on player input while a thread loops the data updating and changing data. However in ...
Python threading and GIL
0.148885
0
0
3,773
4,748,962
2011-01-20T15:26:00.000
1
0
0
0
python,oracle,pyodbc,cx-oracle,instantclient
4,753,975
2
false
0
0
Use the instant client with SQL*Plus and see if you can run the update. If there's a problem, SQL*Plus is production quality, so won't crash and it should give you a reasonable error message.
2
2
0
I can connect to a Oracle 10g release 2 server using instant client. Using pyodbc and cx_Oracle. Using either module, I can execute a select query without any problems, but when I try to update a table, my program crashes. For example, SELECT * FROM table WHERE col1 = 'value'; works fine. UPDATE table SET col2 = 'value...
Oracle instant client can't execute sql update
0.099668
1
0
587
4,748,962
2011-01-20T15:26:00.000
0
0
0
0
python,oracle,pyodbc,cx-oracle,instantclient
4,749,022
2
false
0
0
Sounds more like your user you are connecting with doesn't have those privileges on that table. Do you get an ORA error indicating insufficient permissions when performing the update?
2
2
0
I can connect to a Oracle 10g release 2 server using instant client. Using pyodbc and cx_Oracle. Using either module, I can execute a select query without any problems, but when I try to update a table, my program crashes. For example, SELECT * FROM table WHERE col1 = 'value'; works fine. UPDATE table SET col2 = 'value...
Oracle instant client can't execute sql update
0
1
0
587
4,749,083
2011-01-20T15:33:00.000
0
1
0
0
python,linux,authentication
4,749,108
4
false
0
0
Use subprocess to invoke passwd.
1
5
0
I'm trying to write some scripts in Python and stumbled upon the need of making something to update the password of a given user in a Linux system... UPDATE: the objective is to achieve the script to update the password automatically from a given data/algorithm. The important thing is to have no human intervention... i...
is there a way to script in Python to change user passwords in Linux? if so, how?
0
0
0
9,738
4,750,432
2011-01-20T17:27:00.000
2
1
0
1
python,bittorrent
4,750,449
2
false
0
0
The original BitTorrent client is written in Python. Have you checked that out?
1
7
0
I have bigs files to move to a lot of servers. For now we use rsync, but I would like to experiment with bittorent. I'm studing the code of Deluge, a Python bittorent client but it uses twisted and is utterly complex. Do you know anything hight level? EDIT: I just read that Facebook does code deployment using Bittorent...
Do you know Python libs to send / receive files using Bittorent?
0.197375
0
0
891
4,751,508
2011-01-20T19:21:00.000
1
0
0
0
python,web.py
9,408,237
4
false
1
0
I don't recommend serving static files with web.py. You'd better have apache or nginx configured for that.
1
8
0
I am using webpy framefork. I want to serve static file on one of requests. Is there special method in webpy framework or I just have to read and return that file?
How to serve file in webpy?
0.049958
0
0
12,091
4,752,294
2011-01-20T20:37:00.000
42
0
1
0
python,list
4,752,327
4
true
0
0
Many ways come to mind. You could turn it in a set (which filters out duplicates) and check for length of oneEdit: As another poster noted, this only works with hashable types; I revoke the suggestion as it has worse performance and is less general. You could use a generator expression: all(items[0] == item for item in...
1
23
0
In Python, is the a simple way to test that all values in a list are equal to one another?
all list values same
1.2
0
0
28,178
4,752,451
2011-01-20T20:52:00.000
1
1
1
0
python,string,content-type
4,752,526
4
false
0
0
If the file is downloaded from a webserver, you should have a content-type to look at, however you are at the mercy of the webserver whether or not it truly describes the type of the file. Another alternative would be to use a heuristic to guess the file type. This can often be done by looking at the first few bytes of...
2
2
0
I receive some data as a string. I need to write the data to a file, but the problem is that sometimes the data is compressed/zipped and sometimes it's just plain text. I need to determine the content-type so I know whether to write it to a .txt file or a .tgz file. Any ideas on how to accomplish this? Can I use mi...
How to determine content type of a string
0.049958
0
0
2,383
4,752,451
2011-01-20T20:52:00.000
1
1
1
0
python,string,content-type
4,752,565
4
true
0
0
Both gzip and zip use distinct headers before compressed data, rather unlikely for human-readable strings. If the choice is only between these, you can make a faster check than mimetypes would provide.
2
2
0
I receive some data as a string. I need to write the data to a file, but the problem is that sometimes the data is compressed/zipped and sometimes it's just plain text. I need to determine the content-type so I know whether to write it to a .txt file or a .tgz file. Any ideas on how to accomplish this? Can I use mi...
How to determine content type of a string
1.2
0
0
2,383
4,752,695
2011-01-20T21:18:00.000
1
0
0
0
python,apache,mercurial,dvcs
4,752,795
3
false
1
0
I don't think you can; that's not a common thing to do in a VCS. If I'm wrong, I'm happy to be corrected. Perhaps you can make the "master" httpd.conf file a template, and have a build script that generates the five files you want, passing in the appropriate port number for each file. That way you isolate the change ...
1
2
0
I have five httpd.conf files which differ only in the port number that they are listening on. All of the other data between the sites is the same. Is there any way to track this as a single file in Mercurial? So that if I make a different change to the httpd.conf file, I could push this to all five, and keep the port n...
Track small differences in 5 files with Mercurial?
0.066568
0
1
67
4,752,784
2011-01-20T21:26:00.000
1
1
1
0
python,google-app-engine,file-io,localization
4,753,511
3
false
0
0
You say you changed the encoding you use with the file to ISO-8859-1. Did you try changing it to UTF-8?
1
4
0
I'm working on a Python script that reads an XML file encoded with UTF-8, does some manipulation with it and saves it to Google's Datastore (it's an App Engine program). The way I'm reading and parsing the files is just with file.readline() and a few regular expressions. The only problem is that the file I'm working w...
Doing File I/O in Python with non-ASCII Characters
0.066568
0
0
629
4,754,682
2011-01-21T01:51:00.000
1
0
0
0
python,django,date,django-models
4,754,791
2
false
1
0
When you convert the date string into a datetime object, you'll likely use datetime.strptime with the format argument. I would ask the user what format they use and/or store it in the database (and by that I mean allow them to choose the format they want).
1
0
0
Im importing records from a CSV file into a django model. The CSV file is uploaded by the user. The problem I'm facing is with the date field. The date field expects the date to be in YYYY-MM-DDbut different spreadsheet programs default to different types of formats and I dont want the user to have to change their defa...
Django and Python handle changing date format
0.099668
0
0
650
4,755,963
2011-01-21T06:16:00.000
0
0
0
0
python,user-interface,wxpython
4,763,861
3
false
0
1
I second the ToasterBox suggestion. You can also create your own Dialog though and position it by grabbing the screen resolution and the size of the dialog and setting its position. I've done the latter for a custom popup. On Macs, you can access Growl through a Python API that's mentioned on their website.
1
4
0
We are building an app where in there will be a need to display the updates/notification (ex : like status updates/wall posts on FB). These needs to be displyed at the lower right corner of the window(like any other notifications). So was trying on some alternatives to best display the updates. Some option explored are...
wxPython PopUp notifications
0
0
0
2,743
4,756,205
2011-01-21T06:55:00.000
0
0
1
0
python,compatibility,versions
37,867,615
2
false
0
0
If you want to use any of the python 3 function in python 2.7 then you can import future module at the beginning and then you can use it in your code.
1
13
0
Some python 3 features and modules having been backported to python 2.7 what are the notable differences between python 3.1 and python 2.7?
python 2.7 vs python 3.1
0
0
0
6,762
4,756,544
2011-01-21T07:51:00.000
1
0
1
0
javascript,python,ruby,windows,lua
4,774,036
12
false
0
1
Im pretty sure Stackless Python is going to be the only one supporting multithreading out the box. Stackless Python was chosen by CCP for their MMO: Eve-Online specifically because the stackless nature of the code allowed them to schedule the continuations on any OS thread they needed once they'd built the necessary pr...
5
17
0
Considering the following requirementes: Must be supported on Windows. Preferably works also on other platforms. Must support multi threading. By that I mean that the engine can work in parallel in multiple threads. Readability is important. License must be compatible with closed-source projects. I like Python for ...
Which scripting language is better for embedding in multi-threaded C/C++ application
0.016665
0
0
4,208
4,756,544
2011-01-21T07:51:00.000
0
0
1
0
javascript,python,ruby,windows,lua
4,855,161
12
false
0
1
Entirely preference-based. Most languages have a way to embed in C with options for exports into the scripting environment. If it were me, I'd go with V8 Javascript.
5
17
0
Considering the following requirementes: Must be supported on Windows. Preferably works also on other platforms. Must support multi threading. By that I mean that the engine can work in parallel in multiple threads. Readability is important. License must be compatible with closed-source projects. I like Python for ...
Which scripting language is better for embedding in multi-threaded C/C++ application
0
0
0
4,208
4,756,544
2011-01-21T07:51:00.000
0
0
1
0
javascript,python,ruby,windows,lua
4,859,076
12
false
0
1
By "multithreaded" I'm assuming you mean "can effectively exploit multiple cores"? If your system only has a single CPU, then you're only going to be done one thing at a time regardless of the scripting language you choose. If you do decide to go the CPython route, then there the main thing to remember is that it is on...
5
17
0
Considering the following requirementes: Must be supported on Windows. Preferably works also on other platforms. Must support multi threading. By that I mean that the engine can work in parallel in multiple threads. Readability is important. License must be compatible with closed-source projects. I like Python for ...
Which scripting language is better for embedding in multi-threaded C/C++ application
0
0
0
4,208
4,756,544
2011-01-21T07:51:00.000
11
0
1
0
javascript,python,ruby,windows,lua
4,769,506
12
false
0
1
I've been in the same dilemma an choose Lua over Python and JScript. The thing which Lua does best is the great interop with C/C++ code using libraries like luabridge and luabind. That is, you can call lua from C++ and have the script call back into C++ without a problem, access c++ data from the script and vice versa...
5
17
0
Considering the following requirementes: Must be supported on Windows. Preferably works also on other platforms. Must support multi threading. By that I mean that the engine can work in parallel in multiple threads. Readability is important. License must be compatible with closed-source projects. I like Python for ...
Which scripting language is better for embedding in multi-threaded C/C++ application
1
0
0
4,208
4,756,544
2011-01-21T07:51:00.000
12
0
1
0
javascript,python,ruby,windows,lua
4,808,596
12
false
0
1
Lua is the best choice. Python, Ruby and JavaScript are big languages and they are not designed for to embed. But Lua is different, designed to embed. You should consider the "restriction" more than any other things for your script language. Embed scripts can use for hack (bad meaning) easily. For example, by default L...
5
17
0
Considering the following requirementes: Must be supported on Windows. Preferably works also on other platforms. Must support multi threading. By that I mean that the engine can work in parallel in multiple threads. Readability is important. License must be compatible with closed-source projects. I like Python for ...
Which scripting language is better for embedding in multi-threaded C/C++ application
1
0
0
4,208
4,758,693
2011-01-21T12:17:00.000
2
0
0
0
python,numpy,python-3.x
4,758,849
6
false
0
0
I am quite conservative in this respect, and so I use Python 2.6. That's what comes pre-installed on my Linux box, and it is also the target version for the latest binary releases of SciPy. Python 3 is without a doubt a huge step forward, but if you do mainly numerical stuff with NumPy and SciPy, I'd still go for Pytho...
3
8
1
I am about to embark on some signal processing work using NumPy/SciPy. However, I have never used Python before and don't know where to start. I see there are currently two branches of Python in this world: Version 2.x and 3.x. Being a neophile, I instinctively tend to go for the newer one, but there seems to be a lot...
I want to use NumPy/SciPy. Should I use Python 2 or 3?
0.066568
0
0
5,690
4,758,693
2011-01-21T12:17:00.000
2
0
0
0
python,numpy,python-3.x
4,758,906
6
false
0
0
I can recommend Using py3k over py2.6 if possible. Especially if you're a new user, since some of the syntax changes in py3k and it'll be harder to get used the new syntax if you're starting out learning the old. The modules you mention all have support for py3k but as SilentGhost noted you might want to check for comp...
3
8
1
I am about to embark on some signal processing work using NumPy/SciPy. However, I have never used Python before and don't know where to start. I see there are currently two branches of Python in this world: Version 2.x and 3.x. Being a neophile, I instinctively tend to go for the newer one, but there seems to be a lot...
I want to use NumPy/SciPy. Should I use Python 2 or 3?
0.066568
0
0
5,690
4,758,693
2011-01-21T12:17:00.000
3
0
0
0
python,numpy,python-3.x
4,758,785
6
true
0
0
Both scipy and numpy are compatible with py3k. However, if you'll need to plot stuff: matplotlib is not yet officially compatible with py3k. So, it'll depend on whether your signalling processing involves plotting. Syntactic differences are not that great between the two version.
3
8
1
I am about to embark on some signal processing work using NumPy/SciPy. However, I have never used Python before and don't know where to start. I see there are currently two branches of Python in this world: Version 2.x and 3.x. Being a neophile, I instinctively tend to go for the newer one, but there seems to be a lot...
I want to use NumPy/SciPy. Should I use Python 2 or 3?
1.2
0
0
5,690
4,758,855
2011-01-21T12:36:00.000
3
0
1
1
python,path,working-directory
4,758,914
3
false
0
0
You'd typically use os.listdir('.') for this purpose. If you need a standard module, the variable os.curdir is available.
1
0
0
I want to use the function os.listdir(path) to get a list of files from the directory I'm running the script in, but how do I say the current directory in the "path" argument?
How do I refer to the current directory in functions from the Python 'os' module?
0.197375
0
0
6,837
4,759,485
2011-01-21T13:47:00.000
0
1
0
0
java,python,math,stocks
4,759,549
8
false
0
0
What is more important for you? If it's rapid application development, I found Python significantly easier to code for than Java - and I was just learning Python, while I had been coding on Java for years. If it's application speed and the ability to reuse existing code, then you should probably stick with Java. It's r...
3
21
1
I'm trying to write a pretty heavy duty math-based project, which will parse through about 100MB+ data several times a day, so, I need a fast language that's pretty easy to use. I would have gone with C, but, getting a large project done in C is very difficult, especially with the low level programming getting in your ...
Java or Python for math?
0
0
0
12,225
4,759,485
2011-01-21T13:47:00.000
1
1
0
0
java,python,math,stocks
4,759,596
8
false
0
0
If those are the choices, then Java should be the faster for math intensive work. It is compiled (although yes it is still running byte code). Exelian mentions NumPy. There's also the SciPy package. Both are worth looking at but only really seem to give speed improvements for work with lots of arrays and vector process...
3
21
1
I'm trying to write a pretty heavy duty math-based project, which will parse through about 100MB+ data several times a day, so, I need a fast language that's pretty easy to use. I would have gone with C, but, getting a large project done in C is very difficult, especially with the low level programming getting in your ...
Java or Python for math?
0.024995
0
0
12,225
4,759,485
2011-01-21T13:47:00.000
0
1
0
0
java,python,math,stocks
4,765,700
8
false
0
0
The Apache Commons Math picked up where JAMA left off. They are quite capable for scientific computing. So is Python - NumPy and SciPy are excellent. I also like the fact that Python is a hybrid of object-orientation and functional programming. Functional programming is awfully handy for numerical methods. I'd rec...
3
21
1
I'm trying to write a pretty heavy duty math-based project, which will parse through about 100MB+ data several times a day, so, I need a fast language that's pretty easy to use. I would have gone with C, but, getting a large project done in C is very difficult, especially with the low level programming getting in your ...
Java or Python for math?
0
0
0
12,225
4,760,815
2011-01-21T15:55:00.000
9
0
1
0
python
4,761,025
3
true
0
0
mylist.extend( [x] if type(x) == str else x ) or maybe the opposite would be safer if you want to catch things other than strings too: mylist.extend( x if type(x) == list else [x] )
2
6
0
Is there a simple way to append a list if X is a string, but extend it if X is a list? I know I can simply test if an object is a string or list, but I was wondering if there is a quicker way than this?
python extend or append a list when appropriate
1.2
0
0
4,014
4,760,815
2011-01-21T15:55:00.000
0
0
1
0
python
4,760,929
3
false
0
0
I do not think so. extend takes any iterable as input, and strings as well as lists are iterables in python.
2
6
0
Is there a simple way to append a list if X is a string, but extend it if X is a list? I know I can simply test if an object is a string or list, but I was wondering if there is a quicker way than this?
python extend or append a list when appropriate
0
0
0
4,014
4,763,072
2011-01-21T19:44:00.000
3
0
0
1
python,django,celery
8,588,149
4
false
0
0
you can work around this with the environment... or, use --config: it requires a path relative to CELERY_CHDIR from /etc/defaults/celeryd a python module name, not a filename. The error message could probably use these two facts.
2
23
0
/home/myuser/mysite-env/lib/python2.6/site-packages/celery/loaders/default.py:53: NotConfigured: No celeryconfig.py module found! Please make sure it exists and is available to Python. NotConfigured) I even defined it in my /etc/profile and also in my virtual environment's "activate". But it's not reading it.
Why can't it find my celery config file?
0.148885
0
0
30,388
4,763,072
2011-01-21T19:44:00.000
3
0
0
1
python,django,celery
5,534,637
4
false
0
0
Make sure you have celeryconfig.py in the same location you are running 'celeryd' or otherwise make sure its is available on the Python path.
2
23
0
/home/myuser/mysite-env/lib/python2.6/site-packages/celery/loaders/default.py:53: NotConfigured: No celeryconfig.py module found! Please make sure it exists and is available to Python. NotConfigured) I even defined it in my /etc/profile and also in my virtual environment's "activate". But it's not reading it.
Why can't it find my celery config file?
0.148885
0
0
30,388
4,763,965
2011-01-21T21:27:00.000
3
0
1
0
python,scope
4,764,004
6
true
0
0
This is not how nonlocal works. It doesn't provide dynamic scoping (which is just a huge PITA waiting to happen and even more rarely useful than your average "evil" feature). It just fixes up lexical scoping. Anyway, you can't do what you have in mind (and I would say that this is a good thing). There's not even a dirt...
1
8
0
Say, I have some scope with variables, and a function called in this scope wants to change some immutable variables: def outer(): s = 'qwerty' n = 123 modify() def modify(): s = 'abcd' n = 456 Is it possible somehow to access the outer scope? Something like nonlocal variables from Py3k. Sure I ca...
Accessing the outer scope in Python 2.6
1.2
0
0
11,146
4,764,129
2011-01-21T21:46:00.000
0
0
0
1
python,google-app-engine,forms,file-upload,blobstore
4,775,721
1
false
1
0
The solution I've come up with for this is not the prettiest but it gets the job done. On the upload view (view that is specified in the create_upload_url function) I'm passing the post variables to the same form class from the first page. If the form is valid I'm saving the variables along with the BlobInfo.key to the...
1
3
0
What is the best workflow for uploading file to the blobstore while saving information about the blob and other fields to a model record? For example, should I submit the form to the blobstore upload url (blobstore.create_upload_url), clean the form, redirect if errors and save and redirect if not? What is the best w...
What is the best Google App Engine blobstore workflow?
0
0
0
681
4,764,474
2011-01-21T22:26:00.000
0
0
0
1
python,google-app-engine,guid
4,764,511
5
false
1
0
Any chance they are guid's for things you're storing in the datastore? If so, I believe object.key is a GUID
1
8
0
I was wondering if anyone knows of a good way to generate GUIDs on python google app engine. I feel like there is a simple way that people are using, what would you suggest.
Good way to generate GUIDs on app engine?
0
0
0
3,107
4,764,476
2011-01-21T22:26:00.000
0
0
0
0
python,orm
4,764,551
4
true
0
0
I thought that ORM solutions had to do with DQL (Data Query Language), not DDL (Data Definition Language). You don't use ORM to add, alter, or remove columns at runtime. You'd have to be able to add, alter, or remove object attributes and their types at the same time. ORM is about dynamically generating SQL and devel...
1
1
0
I have a massive data set of customer information (100s of millions of records, 50+ tables). I am writing a python (twisted) app that I would like to interact with the dataset, performing table manipulation. What I really need is an abstraction of 'table', so I can add/remove/alter columns/tables without having to res...
Python ORM for massive data set
1.2
1
0
858
4,765,785
2011-01-22T02:27:00.000
6
0
1
0
python,multithreading
4,765,832
2
true
0
0
I'm not sure I'd consider semaphores and locks "more powerful methods", as you suggest. Queues are generally a higher-order abstraction. In other words, you could use semaphores and locks to build thread-safe queues. Which you'd use where depends on your application. Queues are good for passing "work" between threads...
1
7
0
The principal challenge of multi-threaded applications is coordinating threads that share data or other resources. To that end, the threading module provides a number of synchronization primitives including locks, events, condition variables, and semaphores. While those tools are powerful, minor design ...
Queue.Queue vs semaphores, locks, etc. in multithreaded Python code
1.2
0
0
5,093
4,766,804
2011-01-22T08:00:00.000
1
0
0
0
python,django,satchmo
4,825,020
2
false
0
0
There have been many changes in Satchmo between those releases so they are definitely different. Vanilla Satchmo 0.8.1 would refer to an unmodified satchmo version 0.8.1. Satchmo v0.9.2 refers to Satchmo version 0.9.2, most likely also unmodified. If you are going to use Satchmo get 0.9.2 unless you have a really goo...
1
0
0
What is the difference between vanilla Satchmo 0.8.1 and just Satchmo v0.9.2?
What is the difference between `vanilla Satchmo 0.8.1` and `just Satchmo v0.9.2`?
0.099668
0
0
128
4,770,083
2011-01-22T19:34:00.000
0
0
0
0
python,sql-server,cygwin,sqlalchemy
5,013,126
1
false
0
0
FreeTDS + unixodbc + pyodbc stack will work on Unix-like systems and should therefore work just as well in Cygwin. You should use version 8.0 of TDS protocol. This can be configured in connection string.
1
2
0
I'm trying to use sqlalchemy on Cygwin with a MSSQL backend but I cannot seem to get any of the MSSQL Python DB APIs installed on Cygwin. Is there one that is known to work?
Which Python (sqlalchemy) mssql DB API works in Cygwin?
0
1
0
682
4,770,929
2011-01-22T22:05:00.000
2
0
1
0
visual-studio-2010,ironpython
4,772,335
3
true
0
0
IronPython 2.7 includes VS 2010 support - it's still only a beta but if you download and install it there's an option to install VS support. That includes a project system, intellisense, a REPL window, object browsing, etc...
2
2
0
I've looked through the existing threads on IronPython and IDEs without finding an answer. If I don't need to support Python 3, is there a practical way to do IronPython development fully inside the VS 2k10 IDE like I used to with FORTRAN.net?
Is there a practical way to use IronPython entirely within the VS 2k10 IDE?
1.2
0
0
300
4,770,929
2011-01-22T22:05:00.000
1
0
1
0
visual-studio-2010,ironpython
4,824,702
3
false
0
0
VS 2008 No. VS2010 The extension module is fine, but it does not allow you to compile to an exe from within VS2010. I prefer Sharpdevelop 3.5 or later. I don't know if #develop supports FORTRAN.NET though.
2
2
0
I've looked through the existing threads on IronPython and IDEs without finding an answer. If I don't need to support Python 3, is there a practical way to do IronPython development fully inside the VS 2k10 IDE like I used to with FORTRAN.net?
Is there a practical way to use IronPython entirely within the VS 2k10 IDE?
0.066568
0
0
300
4,771,169
2011-01-22T22:55:00.000
3
0
0
0
python,django,uniform
4,883,410
4
true
1
0
Have you checked the source? It should already be there. The uni_form template tag should include it automatically.
2
3
0
I'm using django-uni-forms to display my fields, with a rather rudimentary example straight out of their book. When I render the form fields using <form>{%csrf_tag%} {%form|as_uni_form%}</form>, everything works as expected. However, django-uni-form Helpers allow you to generate the form tag (and other helper-related c...
django-uni-form helpers and CSRF tags over POST
1.2
0
0
753
4,771,169
2011-01-22T22:55:00.000
1
0
0
0
python,django,uniform
8,118,393
4
false
1
0
Use the most recent version of django-uni-form. It fixes this and so much more.
2
3
0
I'm using django-uni-forms to display my fields, with a rather rudimentary example straight out of their book. When I render the form fields using <form>{%csrf_tag%} {%form|as_uni_form%}</form>, everything works as expected. However, django-uni-form Helpers allow you to generate the form tag (and other helper-related c...
django-uni-form helpers and CSRF tags over POST
0.049958
0
0
753
4,773,381
2011-01-23T10:39:00.000
4
0
0
0
java,python,passwords,md5,sha1
4,773,413
1
true
1
0
In general, you will need to know the exact algorithm used by the Java program. Then you would be able to recreate the same results in Python. (You cannot get the plain-text password from the hash, without using brute-force, but you should be able to recreate the same hashing algorithm, so you can verify a user's passw...
1
0
0
I have a legacy system with passwords that look like this 115c28e0578f262bde08e3de39ee9066. Im not quite sure if they were created with md5 or crypt or... It was a java application that created them. My new system is in Python (Django) and I tried to run a comparison check on a known password using md5(), sha1() and cr...
Detecting password encryption type --can I import them into Django?
1.2
0
0
657
4,774,505
2011-01-23T15:09:00.000
2
0
1
1
python,centos
4,775,706
5
true
0
0
python-devel won't help you, since it will only be available for 2.4. You will need to install the package from source with the appropriate version of Python, e.g. python2.6 setup.py install.
2
1
0
I've just installed Python2.6 on CentOS 5. I have to type python26 to run it. If I type python I get the default Python 2.4. Now I need to build a package using python2.6, but it fails because it can't find python-devel. I know python-devel is installed for Python 2.4. How do I install python-devel (or other packages...
Install packages to Python2.6
1.2
0
0
3,008
4,774,505
2011-01-23T15:09:00.000
0
0
1
1
python,centos
4,774,534
5
false
0
0
You can install a specific version of the package, such as: yum install python-devel-2.6.2-5.el6.i686 I don't know the exact package version, depends on your CentOS version.
2
1
0
I've just installed Python2.6 on CentOS 5. I have to type python26 to run it. If I type python I get the default Python 2.4. Now I need to build a package using python2.6, but it fails because it can't find python-devel. I know python-devel is installed for Python 2.4. How do I install python-devel (or other packages...
Install packages to Python2.6
0
0
0
3,008
4,774,641
2011-01-23T15:40:00.000
6
0
0
0
python,ajax,crud,web-frameworks,turbogears
4,774,688
2
false
1
0
Most of the modern frameworks, like TG, Django or Flask support CRUD-style applications. But none of those are that much abstract, that you can give them a model, and there you have your ajaxy db manipulation templates and validations. Django has django-admin and a great form builder and helper module; Flask can work ...
1
6
0
I am looking for a Python web framework which will allow me to rapidly build a CRUD application with automatic AJAX support. The framework should be able to generate a nice table which is sortable and filterable, which works via AJAX and without JS support at all as well. I have looked at TurboGears2 and it seems promi...
Python web framework with CRUD powered by AJAX
1
0
0
7,870
4,775,375
2011-01-23T17:55:00.000
1
0
0
0
python,database,django,distributed
4,775,514
1
false
1
0
It seems to me that your application has a pretty ugly architecture. Try to refactor it or you will have troubles. Anyway, you can try to cache your suppliers' data to your own database (single) and save some resources.
1
0
0
I'm building site in django, which lists items of many suppliers. Each supplier has own big database and make changes quite often. I have to be aware of all changes in no more than 60 minutes. There are about 10m items to display. How to implement all that in a efficient way?
View with data from many databases
0.197375
0
0
90
4,776,359
2011-01-23T20:39:00.000
25
0
1
0
python,editor,version,python-idle
4,776,403
6
true
0
0
There are different versions of IDLE installed for each Python version. Depending on how you installed Python on Mac OS X, you may find different folders in /Applications. Look for a Python 3.n (n = 1 or 2) folder with an IDLE in it. Or, from a terminal command line, you may find an idle2.6 and an idle3 or idle3.1 o...
2
23
0
I have Python 2.x and 3.x on my machine (Mac OS X 10.6). For some things I want to use ver 2, but for others I want ver 3. I like the IDLE software for editing/running, but it always uses version 3. Is there any way to change the version of the interpreter that IDLE uses? Thanks!
Python IDLE: Change Python Version
1.2
0
0
53,315
4,776,359
2011-01-23T20:39:00.000
0
0
1
0
python,editor,version,python-idle
62,900,880
6
false
0
0
In RHEL 7 after installing yum install python-tools typing "idle3.6" worked for me.
2
23
0
I have Python 2.x and 3.x on my machine (Mac OS X 10.6). For some things I want to use ver 2, but for others I want ver 3. I like the IDLE software for editing/running, but it always uses version 3. Is there any way to change the version of the interpreter that IDLE uses? Thanks!
Python IDLE: Change Python Version
0
0
0
53,315
4,777,262
2011-01-23T23:25:00.000
1
0
0
1
python,django,installation
4,777,646
3
false
1
0
Get him to set up a virtual machine on his Mac, using VMWare Fusion or Parallels, running the same operating system that you currently use for your back end. If he prefers developing using Mac tools he can do still that by sharing his local changes to the virtual machine via a shared directory.
2
1
0
Hey everyone, I am expanding my team and I have recently added an additional front end engineer on my site. I am currently using django to run my site but my site is using a lot of plugins, namely: django-celery, django-mailer, django-notification, and django-socialregistration. Let me describe my situation: He is us...
Easiest way to share work between backend and front end
0.066568
0
0
181
4,777,262
2011-01-23T23:25:00.000
0
0
0
1
python,django,installation
4,777,381
3
false
1
0
An alternative, if that's possible, would be to set up a testing/development environment on a machine with an OS you're familiar with, then install something like Dropbox on his local machine where he can develop the frontend code, and install Dropbox on that other environment with the backend components. Dropbox would...
2
1
0
Hey everyone, I am expanding my team and I have recently added an additional front end engineer on my site. I am currently using django to run my site but my site is using a lot of plugins, namely: django-celery, django-mailer, django-notification, and django-socialregistration. Let me describe my situation: He is us...
Easiest way to share work between backend and front end
0
0
0
181
4,777,592
2011-01-24T00:37:00.000
0
0
0
0
jquery,python,django
4,777,733
3
false
1
0
You are right,its a basic Ajax, but you might have a complex algorithm to figure out the number of stars as
1
1
0
How do I make django-ratings work with Jquery? What I'm trying to do is allow the user to select how ever many stars they want to give the product, and to have the corresponding rating processed asynchronously. I realize this is probably basic AJAX, and I apologize if this is a stupid question. Thank you in advanced.
Django-ratings and Jquery integration?
0
0
0
759
4,778,058
2011-01-24T02:23:00.000
2
0
0
0
python,sql,multithreading
4,778,081
2
true
0
0
Put the queries in a table, with one row per distinct query, and a column to count. Insert if the query doesn't exist already, or otherwise increment the query row counter. Put a cron job together than empties the table at 12 midnight. Use transactions to prevent two different requests from colliding.
1
0
0
A website I am making revolves around a search utility, and a want to have something on the homepage that lists the top 10 (or something) most searched queries of the day. What would be the easiest / most efficient way of doing this? Should I use a sql database, or just a text file containing the top 10 queries and a c...
How to make a "top queries" page
1.2
1
0
98
4,778,089
2011-01-24T02:31:00.000
9
0
1
0
python,list,nlp,pickle,shelve
4,778,137
3
true
0
0
Depending upon how you intend to get at the data, SQLite3 might be the best approach. SQLite3 is excellent at random access to relational data, but if your data is not very relational, it might not make as much sense. (Even if all your have is an 'id' number and then your string, I think SQLite3 for underlying storage ...
2
10
0
I have a large set of strings that I'm using for natural language processing research, and I'd like a nice way to store it in Python. I could use pickle, but loading the entire list into memory would then be an impossibility (I believe), as it's about 10 GB large, and I don't have that much main memory. Currently I hav...
Ways to store and access large (~10 GB) lists in Python?
1.2
0
0
1,371
4,778,089
2011-01-24T02:31:00.000
1
0
1
0
python,list,nlp,pickle,shelve
4,778,191
3
false
0
0
I would say use shelve (which uses a bdb backend) or Sqlite3. I would go with SQLite3, for a simple list a table like CREATE TABLE list(idx int primary key, value text); should be enough.
2
10
0
I have a large set of strings that I'm using for natural language processing research, and I'd like a nice way to store it in Python. I could use pickle, but loading the entire list into memory would then be an impossibility (I believe), as it's about 10 GB large, and I don't have that much main memory. Currently I hav...
Ways to store and access large (~10 GB) lists in Python?
0.066568
0
0
1,371
4,778,679
2011-01-24T04:35:00.000
4
0
1
1
python
4,778,706
4
false
0
0
2.6 will be around for a long time. There are many machines that still run even 2.4, so you're fine.
2
5
0
i have no way of upgrade to python 2.7 or 3.1 so i am stuck with python 2.6 on my ubuntu 10.04 machine. will i still be able to find host that supports python 2.6? is using python 2.6 still consider outdated or bad practice?
using python 2.6?
0.197375
0
0
657
4,778,679
2011-01-24T04:35:00.000
3
0
1
1
python
4,778,746
4
false
0
0
Python 2.6 will probably still be around for a while, as Python 2.7 was released only a few months ago. You can always use from __future__ import ... to make use of some of the newer features from Python 3.x
2
5
0
i have no way of upgrade to python 2.7 or 3.1 so i am stuck with python 2.6 on my ubuntu 10.04 machine. will i still be able to find host that supports python 2.6? is using python 2.6 still consider outdated or bad practice?
using python 2.6?
0.148885
0
0
657
4,778,978
2011-01-24T05:38:00.000
1
1
1
0
c++,python,choice
4,781,086
7
false
0
0
Dumb programmers are good programmers. I've maintained code of people that is much smarter than me, their code is an unreadable mess. Funnily, the same things happen with people who can't program except that the really smart programmers code actually works. In both cases it's hard for other people to take over, and at ...
7
4
0
I've got good experience in Java and web development with some experience in C++ also. Lately, I've been thinking of leaving Java (bored with it) for C++. Then came Python(didn't like Ruby). I find it too good to resist and started using it. But the C++ still stays in my mind. Now I want to "stick" with one language t...
Which language should I stick with
0.028564
0
0
932
4,778,978
2011-01-24T05:38:00.000
2
1
1
0
c++,python,choice
4,779,041
7
false
0
0
It really depends on what kind of work you are planning to do. But, really, most high level programming languages operate on very similar principles. If you understand all the underlying concepts, switching from one language to another is just a matter of changing your syntax. Still, if you're insistent on sticking en...
7
4
0
I've got good experience in Java and web development with some experience in C++ also. Lately, I've been thinking of leaving Java (bored with it) for C++. Then came Python(didn't like Ruby). I find it too good to resist and started using it. But the C++ still stays in my mind. Now I want to "stick" with one language t...
Which language should I stick with
0.057081
0
0
932
4,778,978
2011-01-24T05:38:00.000
4
1
1
0
c++,python,choice
4,779,017
7
false
0
0
I am of the opinion that you don't "leave" a language. It's still in your toolbox, just possibly not used as often. I would recommend looking at it more like: "i'm thinking of broadening my options by learning a new language." Just this past week I have worked in C#, Java, Bash, Python and Javascript. When you're l...
7
4
0
I've got good experience in Java and web development with some experience in C++ also. Lately, I've been thinking of leaving Java (bored with it) for C++. Then came Python(didn't like Ruby). I find it too good to resist and started using it. But the C++ still stays in my mind. Now I want to "stick" with one language t...
Which language should I stick with
0.113791
0
0
932
4,778,978
2011-01-24T05:38:00.000
2
1
1
0
c++,python,choice
4,779,018
7
false
0
0
I personally keep my main activity on C/C++/Assembly, and explore other languages on the side. This is because my goals are to stay as sharp as possible, whether that be on problem solving part or hardware friendly side. Personally I find it much more exciting to be next to the hardware amongst other things. Also, when...
7
4
0
I've got good experience in Java and web development with some experience in C++ also. Lately, I've been thinking of leaving Java (bored with it) for C++. Then came Python(didn't like Ruby). I find it too good to resist and started using it. But the C++ still stays in my mind. Now I want to "stick" with one language t...
Which language should I stick with
0.057081
0
0
932
4,778,978
2011-01-24T05:38:00.000
3
1
1
0
c++,python,choice
4,779,127
7
false
0
0
I'd suggest looking into a more esoteric language, at least for a little while. Write up a small GUI in Smalltalk, or a utility in Common Lisp or Scheme. Don't just try to adapt your Java knowledge to those languages, really try to use the languages the way the Ron Jeffries and Paul Grahams of the world use them. If ...
7
4
0
I've got good experience in Java and web development with some experience in C++ also. Lately, I've been thinking of leaving Java (bored with it) for C++. Then came Python(didn't like Ruby). I find it too good to resist and started using it. But the C++ still stays in my mind. Now I want to "stick" with one language t...
Which language should I stick with
0.085505
0
0
932
4,778,978
2011-01-24T05:38:00.000
3
1
1
0
c++,python,choice
4,779,510
7
true
0
0
I have mostly experience in a few of domain-specific languages and a few general purpose languages (C, C++, Java, Delphi, etc.), and I have no experience with Python (only a general idea of it). You must not judge languages on a basis of how hard they are. You say you have to consider the fact that you have to spend ti...
7
4
0
I've got good experience in Java and web development with some experience in C++ also. Lately, I've been thinking of leaving Java (bored with it) for C++. Then came Python(didn't like Ruby). I find it too good to resist and started using it. But the C++ still stays in my mind. Now I want to "stick" with one language t...
Which language should I stick with
1.2
0
0
932
4,778,978
2011-01-24T05:38:00.000
13
1
1
0
c++,python,choice
4,778,995
7
false
0
0
I suggest you don't worry about "sticking" with a language and learn to move in and out of whatever is the best solution for your problem. The best programmers are simply great problem solvers - the particular language doesn't really matter.
7
4
0
I've got good experience in Java and web development with some experience in C++ also. Lately, I've been thinking of leaving Java (bored with it) for C++. Then came Python(didn't like Ruby). I find it too good to resist and started using it. But the C++ still stays in my mind. Now I want to "stick" with one language t...
Which language should I stick with
1
0
0
932
4,782,344
2011-01-24T13:10:00.000
1
0
0
0
python,database,sqlalchemy,relation
5,594,860
1
false
1
0
I found the answer myself by now: If you use an orm.relation from each side and no backrefs, you have to use back_populates or if you mess around at one side, it won't be properly updated in the mapping on the other side. Therefore, an orm.relation from each side instead of an automated backref IS possible but you have...
1
0
0
In some project I implement user-requested mapping (at runtime) of two tables which are connected by a 1-to-n relation (one table has a ForeignKey field). From what I get from the documentation, the usual way is to add a orm.relation to the mapped properties with a mapped_collection as collection_class on the non-forei...
SQLAlchemy - difference between mapped orm.relation with backref or two orm.relation from both sides
0.197375
1
0
664
4,782,590
2011-01-24T13:34:00.000
1
0
1
0
python
4,782,634
4
false
0
0
string is an expression. An expression is anything that has "a value". Like 3, 'Hello world', 1+1, math.sqrt(9), etc. Function names are expressions too. eval() gives you the value of the expression that you give to it as a string. If you say eval('1+1') it returns 2. So it returns the same that would be returned if yo...
2
20
0
I have some confusion about its meaning or definition. Isn't that some code that produce or calculate new data values? (Says Zelle in his book) Then I wonder if a string data type is an expression. If it is, then what does eval() do when its argument is a string? The book by Zelle sayseval(<string>) evaluates string a...
What is an expression in Python?
0.049958
0
0
63,062
4,782,590
2011-01-24T13:34:00.000
31
0
1
0
python
4,782,649
4
true
0
0
Expressions represent something, like a number, a string, or an instance of a class. Any value is an expression! Anything that does something is a statement. Any assignment to a variable or function call is a statement. Any value contained in that statement in an expression. foo = "hello" is a statement that assigns f...
2
20
0
I have some confusion about its meaning or definition. Isn't that some code that produce or calculate new data values? (Says Zelle in his book) Then I wonder if a string data type is an expression. If it is, then what does eval() do when its argument is a string? The book by Zelle sayseval(<string>) evaluates string a...
What is an expression in Python?
1.2
0
0
63,062
4,783,257
2011-01-24T14:37:00.000
1
1
1
0
python,unit-testing,dynamic-languages
4,783,323
3
false
0
0
Unit testing with complete coverage is really the only way to handle any development work which relies on dynamic languages. Clearly it's very beneficial to have strong coverage tests for statically typed languages but in my experience it's even more important when you have dynamic typing. If you aren't covering all t...
1
2
0
I can't find the answer on SO but it's very likely that the argument has been already discussed. I'm trying to write a quite small size program using the Python language. It's my first "real" experience with a dynamic language and I would prefer to do everything in the right way. One of the practice that I would try t...
How to deal with wrong parameters types in dynamic-languages?
0.066568
0
0
313