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
3,038,661
2010-06-14T15:50:00.000
0
0
0
0
python,graph,shortest-path,dijkstra,breadth-first-search
3,042,109
7
false
0
0
Depending on what kind of additional information you have, A* may be extremely efficient. In particular, if given a node you can compute an estimate of the cost from that node to the goal, A* is optimally efficient.
1
16
0
I'm looking to find a way to in real-time find the shortest path between nodes in a huge graph. It has hundreds of thousands of vertices and millions of edges. I know this question has been asked before and I guess the answer is to use a breadth-first search, but I'm more interested in to know what software you can use...
Efficiently finding the shortest path in large graphs
0
0
1
24,381
3,039,889
2010-06-14T18:38:00.000
4
0
1
0
python,oop,scripting
3,039,925
17
false
0
0
Use the right tool for the right job. For small scripts that don't require complex data structures and algorithms, there is likely no use for object oriented concepts.
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
0.047024
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
33
0
1
0
python,oop,scripting
3,039,967
17
true
0
0
I use whatever paradigm best suits the issue at hand -- be it procedural, OOP, functional, ... program size is not a criterion, though (by a little margin) a larger program may be more likely to take advantage of OOP's strengths -- multiple instances of a class, subclassing and overriding, special method overloads, OOP...
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
1.2
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
9
0
1
0
python,oop,scripting
3,041,386
17
false
0
0
One of the unfortunate habits developed with oop is Objectophrenia - the delusion of seeing objects in every piece of code we write. The reason why that happens is due our delusion of believing in the existence of a unified objects theorem. Every piece of code you write, you begin to see it as a template for objects an...
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
1
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
8
0
1
0
python,oop,scripting
3,039,934
17
false
0
0
If you plan to use the script independently, then no. However if you plan to import it and reuse some of it, then yes. In the second case, it's best to write some classes providing the functionality that's required and then have a conditional run (if __name__=='__main__':) with code to execute the "script" version of t...
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
1
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
4
0
1
0
python,oop,scripting
3,039,923
17
false
0
0
OOP is a tool to manage complexity in code, 50-250 lines of code are rarely complicated. Most scripts I have written are primarily procedural. So yes, for small scripts just go with procedural programming. Note that for significantly complicated scripts OOP may be more relevant, but there is still not hard and fast rul...
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
0.047024
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
4
0
1
0
python,oop,scripting
3,041,936
17
false
0
0
Am I missing something by not trying harder to use objects, or does OOP just not make a lot of sense for small scripts? Objects buy you encapsulation and reuse (through inheritance). Neither is likely to be terribly useful when writing small scripts. When you have written a collection of similar scripts or you find ...
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
0.047024
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
0
0
1
0
python,oop,scripting
3,040,679
17
false
0
0
as someone who does a lot of scripts, if you get the idea that your code may at some point go beyond 250 line start to go oop. I use a lot of vba and vbscript and I would agree that anything under 100 lines is usually pretty straightforward and taking the time to plan a good oop design is just a waste. That being sa...
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
0
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
2
0
1
0
python,oop,scripting
3,039,913
17
false
0
0
In your case I'd say that OOP would be helpful only if it makes the scripts more readable and understandable. If not, you probably don't need to bother.
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
0.023525
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
2
0
1
0
python,oop,scripting
3,040,375
17
false
0
0
Using OOP for few hundred lines of code rarely makes sense. But if your script is useful, it will probably grow rather quickly because new features will be added. If this is the case, it is better to start coding OOP way it will pay in the long run.
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
0.023525
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
0
0
1
0
python,oop,scripting
3,040,355
17
false
0
0
"Script" means "sequential" and "procedural". It's a definition. All of the objects your script deals with are -- well -- objects. All programming involves objects. The objects already exist in the context in which you're writing your script. Some languages allow you to clearly identify the objects. Some language...
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
0
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
1
0
1
0
python,oop,scripting
3,040,435
17
false
0
0
OOP is about what you get if you add polymorphism on top of modular programming. The latter of both promotes low coupling, encapsulation, separation of responsibility and some other concepts, that usually produce code, that is short, expressive, maintainable, flexible, extensible, reusable and robust. This is not so mu...
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
0.011764
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
2
0
1
0
python,oop,scripting
3,040,319
17
false
0
0
Another benefit of OOP is to communicate intent (whether to other developers, managers, or yourself some point in the future). If the script is small enough where it can be fully communicated in a couple of sentences then OOP is probably not necessary, in my opinion.
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
0.023525
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
1
0
1
0
python,oop,scripting
3,039,984
17
false
0
0
First of all - what do you mean by objects? In Python functions are objects and you're most likely using them. :) If by objects you mean classes and instances thereof, then I would say something obvious: no, there is no reason to saying that using them is making your code better by itself. In small scripts there is not...
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
0.011764
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
2
0
1
0
python,oop,scripting
3,039,939
17
false
0
0
OOP is just another paradigm. A lot of problems can be solved using both procedural or OOP. I use OOP when I see clear need of inheritance in the code i am writing, its easier to manage common behaviour and common attributes. It sometimes makes it easy to understand, and manage. Even if the code is small.
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
0.023525
0
0
5,102
3,039,889
2010-06-14T18:38:00.000
6
0
1
0
python,oop,scripting
3,039,957
17
false
0
0
My experience is that any purely procedural script longer than a few dozen lines becomes difficult to maintain. For one thing, if I'm setting or modifying a variable in one place and using it in another place, and those two places can't fit on a single screen, trouble will follow. The answer, of course, is to tighten ...
15
28
0
I mostly write small scripts in python, about 50 - 250 lines of code. I usually don't use any objects, just straightforward procedural programming. I know OOP basics and I have used object in other programming languages before, but for small scripts I don't see how objects would improve them. But maybe that is just my...
Does OOP make sense for small scripts?
1
0
0
5,102
3,040,290
2010-06-14T19:32:00.000
3
0
0
0
python,file,architecture,file-upload
3,040,346
1
false
0
0
There is no reliable way to do what you're asking, because fundamentally, your server has no control over the user's browser, computer, or internet connection. If you don't care about reliability, you might try writing a bunch of javascript to trigger the upload at a scheduled time, but it just wouldn't work if the us...
1
0
0
I have a python script that accepts a file from the user and saves it. Is it possible to not upload the file immediately but to que it up and when the server has less load to upload it then. Can this be done by transferring the file to the browsers storage area or taking the file from the Harddrive and transferring to ...
Python timed file upload
0.53705
0
1
100
3,041,077
2010-06-14T21:27:00.000
2
0
0
0
python,django,deployment
3,041,911
2
true
1
0
I doubt the amount of code reuse you can get between the two projects, given your organizational situation, is worth the headaches, organizational risks, and delay risks that it would entail -- after all your team can never rely on the other, since the ACME product needs to be rock solid, and therefore needs to be ...
2
1
0
I know this sounds kind of vague, but please let me explain- I'm starting work on a brand new project, it will have two main components: "ACME PRODUCT" (think Gmail, Meebo, etc), and "THE SITE" (help, information, marketing stuff, promotional landing pages, etc lots of marketing-induced cruft). So basically the url /a...
Best practice- How to team-split a django project while still allowing code reusal
1.2
0
0
351
3,041,077
2010-06-14T21:27:00.000
3
0
0
0
python,django,deployment
3,041,105
2
false
1
0
Django's componentization of apps means that you can have independent teams working on the various apps, with template tags and filters (and of course, normal Python functions) used for cross-app coupling.
2
1
0
I know this sounds kind of vague, but please let me explain- I'm starting work on a brand new project, it will have two main components: "ACME PRODUCT" (think Gmail, Meebo, etc), and "THE SITE" (help, information, marketing stuff, promotional landing pages, etc lots of marketing-induced cruft). So basically the url /a...
Best practice- How to team-split a django project while still allowing code reusal
0.291313
0
0
351
3,042,304
2010-06-15T03:15:00.000
1
1
0
1
python,unix,permissions
3,042,340
3
false
0
0
os.getgid() and os.getuid() can be useful. For other environment variables, look into os.getenv. For example, os.getenv('USER') on my Mac OS X returns the username. os.getenv('USERNAME') would return the username on Windows machines.
1
31
0
I have a CGI script that is getting an "IOError: [Errno 13] Permission denied" error in the stack trace in the web server's error log. As part of debugging this problem, I'd like to add a little bit of code to the script to print the user and (especially) group that the script is running as, into the error log (presuma...
How to determine what user and group a Python script is running as?
0.066568
0
0
29,300
3,043,085
2010-06-15T06:54:00.000
2
0
1
0
python
3,043,222
7
false
1
0
Many websites uses Django or Zope/Plone web framework, these are written in Python. Python is used a lot for writing system administration software, usually when bash scripts (shell script) isn't up to the job, but going C/C++ is an overkill. This is also the spectrum where perl, awk, etc stands. Gentoo's emerge/portag...
2
45
0
I am a web developer and usually use PHP, JavaScript or MySQL. I have heard lot about Python. But I have no idea where it is used and why it is used. Just like PHP, ASP, ColdFusion, .NET are used to build websites, and C, C++, Java are used to build software or desktop apps. Where does Python fit in this? What can Py...
Where is Python language used?
0.057081
0
0
123,495
3,043,085
2010-06-15T06:54:00.000
1
0
1
0
python
3,043,192
7
false
1
0
Python is used for developing sites. It's more highlevel than php. Python is used for linux dekstop applications. For example, the most of Ubuntu configurations utilites are pythonic.
2
45
0
I am a web developer and usually use PHP, JavaScript or MySQL. I have heard lot about Python. But I have no idea where it is used and why it is used. Just like PHP, ASP, ColdFusion, .NET are used to build websites, and C, C++, Java are used to build software or desktop apps. Where does Python fit in this? What can Py...
Where is Python language used?
0.028564
0
0
123,495
3,043,597
2010-06-15T08:27:00.000
2
0
1
1
python,eclipse,debugging,pydev
5,732,993
2
false
0
0
There are known issues with Python 2.4 (so, if possible, get a newer version), still, if you're unable to get a newer version, at least use threadframe extension (http://pypi.python.org/pypi/threadframe). If None of that's possible, it's really expected that the debugger doesn't work as well as it could (as the debugge...
2
4
0
I've found that under some circumstances the Eclipse python debugger can be unreliable. For example, when stepping through a memory-hungry Python program I've found that after a certain point the debugger fails to respond. The entire process hangs with 100% cpu load. I've heard (unconfirmed) reports from developers th...
How can I make the Eclipse Python debugger more reliable?
0.197375
0
0
1,295
3,043,597
2010-06-15T08:27:00.000
0
0
1
1
python,eclipse,debugging,pydev
5,637,371
2
false
0
0
Not sure if its related, but I had a scenario where too many debug messages will cause my PC to become very slow. You can try go to Window -> Preferences -> Run/Debug -> Console... tick Limit console output, and reduce Console buffer size (mine is set to 40000).
2
4
0
I've found that under some circumstances the Eclipse python debugger can be unreliable. For example, when stepping through a memory-hungry Python program I've found that after a certain point the debugger fails to respond. The entire process hangs with 100% cpu load. I've heard (unconfirmed) reports from developers th...
How can I make the Eclipse Python debugger more reliable?
0
0
0
1,295
3,044,359
2010-06-15T10:36:00.000
0
0
1
1
python,windows,setuptools
3,542,501
4
false
0
0
If you want scripted automation of installs on Windows, look into AutoIt.
1
11
0
Is there no sane way to peform a scripted install of binary python packages for windows? Unfortunately it seems like several essential windows python packages like pywin32 and py2exe are only available as EXE's not MSI's (and as far as I know only the latter are scriptable). Easy_install/pip also seems no use since the...
unattended install of binary python packages (modules) for windows
0
0
0
4,548
3,044,596
2010-06-15T11:15:00.000
0
0
1
0
python,thread-safety,dbus
3,045,144
1
true
0
0
If you do not modify the list outside of the callback context, then you do not necessarily need synchronization - you will just need to be aware that the list object's state is volatile. If the list must be modified both in the callback handler as well as, say, the main execution context (or other threads, etc.), then...
1
0
0
I write a python class which makes asynchronous method calls using D-Bus. When my reply_handler is called, it stores data in list. This list can be used by another class methods at the same time. Is it safe or I can use only synchronized data structures like Queue class?
On thread safety in python using D-Bus asynchronous method calls
1.2
0
0
628
3,045,745
2010-06-15T13:49:00.000
15
0
1
0
python,qt
3,045,754
3
false
0
1
Qt (ideally) provides source compatibility, not binary compatibility. You still have to compile the application separately for each platform, and use the appropriate dynamic Qt libraries (which also need to be compiled separately, and have some platform-specific code). For your final question, the user would need Py...
1
13
0
When you write an application using Qt, can it just be run right away in different operating systems? And (correct me if I'm wrong) you don't need to have Qt already installed in all of the different platforms where you want to execute your application? How exactly does this work? Does Qt compile to the desired platfor...
How does Qt work (exactly)?
1
0
0
3,747
3,046,036
2010-06-15T14:19:00.000
0
0
0
0
python,django,sites
8,602,597
2
false
1
0
The django site framework will do that, but it can't server the site according to the domain name. You'll have to do that using you server such as Apache, Nginx, etc.
1
1
0
I need to create an application for the company where I can create sites dynamically. For example, I need an admin interface (Django's admin is enough) where I can setup a new site and add some settings to it. Each site must hold a domain (domains can be manually added to apache conf, but if Django can handle it too wo...
Django: how to create sites dynamically?
0
0
0
737
3,046,183
2010-06-15T14:37:00.000
4
0
1
1
python,macos,terminal
3,046,210
3
false
0
0
When you run python in a shell or command prompt it will execute the first executable file which is found in your PATH environment variable. To find out what file is being executed use which python or where python.
1
1
0
When I enter in python in Terminal it loads up Python 2.6.2. However there are folders by the name of Python 2.6 in different places on my drive. I'm not sure if that's because Python 2.6 has been installed in different places or because Python just likes to have lots of folers in different places. If there are multipl...
I suspect I have multiple version of Python 2.6 installed on Mac OS X 10.6.3; how do I set which one Terminal should launch?
0.26052
0
0
1,464
3,047,012
2010-06-15T16:19:00.000
5
1
1
0
python
3,047,546
11
false
0
0
In some special cases you can trade program size for blistering speed. Create a large array and store the pre-calculated result for every square root operation (using the input value as the index). It's pretty limited but you won't get anything faster. (That's how quake did it)
1
17
0
I want to find the square root of a number without using the math module,as i need to call the function some 20k times and dont want to slow down the execution by linking to the math module each time the function is called Is there any faster and easier way for finding square root?
How to perform square root without using math module?
0.090659
0
0
60,866
3,047,412
2010-06-15T17:13:00.000
1
0
1
0
python,sql,database,in-memory-database
65,153,849
6
false
0
0
In-memory databases usually do not support memory paging option (for the whole database or certain tables), i,e, total size of the database should be smaller than the available physical memory or maximum shared memory size. Depending on your application, data-access pattern, size of database and available system memory...
1
32
0
I'm doing some queries in Python on a large database to get some stats out of the database. I want these stats to be in-memory so other programs can use them without going to a database. I was thinking of how to structure them, and after trying to set up some complicated nested dictionaries, I realized that a good rep...
in-memory database in Python
0.033321
1
0
44,308
3,047,582
2010-06-15T17:41:00.000
0
0
0
0
python,pygtk
3,048,270
2
false
0
1
Text views won't expand if you pack them into a gtk.ScrolledWindow. This is not what you directly asked, but I believe should solve your problem in a better way.
1
1
0
How do I force a GTK window object to stay the same size, even when a table inside of it tries to expand? I've tried using gtk.SHRINK when attaching children to the table, but the TextViews within the table still keep expanding to way beyond an acceptable width and expanding the window along with it.
How to force GTK window to stay at a certain width, even when widgets try to expand?
0
0
0
6,353
3,047,799
2010-06-15T18:08:00.000
0
0
1
0
python
3,047,835
6
false
0
0
Working with a single file is almost certainly going to be faster: you have to read the same amount of data in both cases, but when working with multiple files, you have that much more housekeeping operations slowing you down. Additionally, you can read data from a single file at the maximum speed the disk can handle, ...
6
2
0
is opening a large file once reading it completely once to list faster (or) opening smaller files whose total sum of size is equal to large file and loading smaller file into list manupalating one by one faster? which is faster?? is the difference is time large enough to impact my program?? total time difference of le...
Which is faster?
0
0
0
359
3,047,799
2010-06-15T18:08:00.000
2
0
1
0
python
3,047,818
6
false
0
0
Obviously one open and close is going to be faster than n opens and closes if you are reading the same amount of data. Plus, when reading a single file the I/O classes you use can take advantage of things like buffering, etc, which makes it even faster.
6
2
0
is opening a large file once reading it completely once to list faster (or) opening smaller files whose total sum of size is equal to large file and loading smaller file into list manupalating one by one faster? which is faster?? is the difference is time large enough to impact my program?? total time difference of le...
Which is faster?
0.066568
0
0
359
3,047,799
2010-06-15T18:08:00.000
6
0
1
0
python
3,047,842
6
true
0
0
It depends if your data fit in your available memory. If you need to resort to paging, or virtual memory, then opening a single giant file might become slower than opening more smaller files. This will be even more true if the computation you need to make creates intermediate variables that won't fit in the physical RA...
6
2
0
is opening a large file once reading it completely once to list faster (or) opening smaller files whose total sum of size is equal to large file and loading smaller file into list manupalating one by one faster? which is faster?? is the difference is time large enough to impact my program?? total time difference of le...
Which is faster?
1.2
0
0
359
3,047,799
2010-06-15T18:08:00.000
0
0
1
0
python
3,047,859
6
false
0
0
30sec time difference? Define large. Everything that fits into an average's computer RAM would probably not take much more time than 30sec in total.
6
2
0
is opening a large file once reading it completely once to list faster (or) opening smaller files whose total sum of size is equal to large file and loading smaller file into list manupalating one by one faster? which is faster?? is the difference is time large enough to impact my program?? total time difference of le...
Which is faster?
0
0
0
359
3,047,799
2010-06-15T18:08:00.000
0
0
1
0
python
3,049,925
6
false
0
0
Why do you think you need to read the file(s) into a list? If you can open several small files and process each independently, then surely that means: (a) that you don't need to read into a list, you can process any file (including 1 large file) a line at a time (avoiding running-out-of-real-memory problems) or (b) wha...
6
2
0
is opening a large file once reading it completely once to list faster (or) opening smaller files whose total sum of size is equal to large file and loading smaller file into list manupalating one by one faster? which is faster?? is the difference is time large enough to impact my program?? total time difference of le...
Which is faster?
0
0
0
359
3,047,799
2010-06-15T18:08:00.000
1
0
1
0
python
3,047,840
6
false
0
0
If you are reading the file sequentially from start until end, one open/close is faster than multiple open/close operations. However keep in mind that if you need to do a lot of seeking in your 1 big file, then maybe storing separate files won't be slower in that case. Also keep in mind that no matter which approach...
6
2
0
is opening a large file once reading it completely once to list faster (or) opening smaller files whose total sum of size is equal to large file and loading smaller file into list manupalating one by one faster? which is faster?? is the difference is time large enough to impact my program?? total time difference of le...
Which is faster?
0.033321
0
0
359
3,048,268
2010-06-15T19:14:00.000
1
0
1
0
python,ruby,regex,perl,nlp
3,048,460
3
false
1
0
Ok, this answer is probably not going to be helpful -- I will say that up front. But, in my opinion, merely thinking about the problem in this way is enough to get you hired at most places I've worked. My suggestion? Contact the hiring manager at any of the postings in which you have interest, tell them this is what...
2
7
0
Many job sites have broken searches that don't let you narrow down jobs by experience level. Even when they do, it's usually wrong. This requires you to wade through hundreds of postings that you can't apply for before finding a relevant one, quite tedious. Since I'd rather focus on writing cover letters etc., I want t...
Online job-searching is tedious. Help me automate it
0.066568
0
0
567
3,048,268
2010-06-15T19:14:00.000
1
0
1
0
python,ruby,regex,perl,nlp
3,050,912
3
false
1
0
I developed a good parse and email routine for a couple of job websites when I was looking for work for myself and a couple of friends. I agree with the other posts, this is a great way to look at the problem. Just to drop a little info, I did it mostly in ruby, and used tor proxies and some other methods to make sure ...
2
7
0
Many job sites have broken searches that don't let you narrow down jobs by experience level. Even when they do, it's usually wrong. This requires you to wade through hundreds of postings that you can't apply for before finding a relevant one, quite tedious. Since I'd rather focus on writing cover letters etc., I want t...
Online job-searching is tedious. Help me automate it
0.066568
0
0
567
3,048,865
2010-06-15T20:43:00.000
0
0
1
0
javascript,python,floating-point
3,048,904
3
false
0
0
I would like to understand the reason for this difference in behavior. They're different languages. They use different underlying packages. They have different implementations. When you say "Python" -- which implementation are you talking about? C, Jython, IronPython? Did you compare each of those? The Javascrip...
2
5
0
I have read most of the posts on here regarding floating point, and I understand the basic underlying issue that using IEEE 754 (and just by the nature of storing numbers in binary) certain fractions cannot be represented. I am trying to figure out the following: If both Python and JavaScript use the IEEE 754 standard,...
Another floating point question
0
0
0
342
3,048,865
2010-06-15T20:43:00.000
3
0
1
0
javascript,python,floating-point
3,048,911
3
false
0
0
and printing. They might both have the same IEEE 754 underlying representation, but that doesn't mean they're forced to print the same way. It looks like Javascript is rounding the output when the difference is small enough. With floating point numbers, the important part is how the binary data is structured, not wha...
2
5
0
I have read most of the posts on here regarding floating point, and I understand the basic underlying issue that using IEEE 754 (and just by the nature of storing numbers in binary) certain fractions cannot be represented. I am trying to figure out the following: If both Python and JavaScript use the IEEE 754 standard,...
Another floating point question
0.197375
0
0
342
3,049,188
2010-06-15T21:27:00.000
2
1
0
0
python,xml,lxml
3,049,245
4
false
0
0
The only sane way to generate so large an XML file is line by line, which means printing while running a state machine, and lots of testing.
2
11
0
Does anyone know of a memory efficient way to generate very large xml files (e.g. 100-500 MiB) in Python? I've been utilizing lxml, but memory usage is through the roof.
Generating very large XML files in Python?
0.099668
0
1
4,751
3,049,188
2010-06-15T21:27:00.000
2
1
0
0
python,xml,lxml
3,050,007
4
false
0
0
Obviously, you've got to avoid having to build the entire tree ( whether DOM or etree or whatever ) in memory. But the best way depends on the source of your data and how complicated and interlinked the structure of your output is. If it's big because it's got thousands of instances of fairly independent items, then yo...
2
11
0
Does anyone know of a memory efficient way to generate very large xml files (e.g. 100-500 MiB) in Python? I've been utilizing lxml, but memory usage is through the roof.
Generating very large XML files in Python?
0.099668
0
1
4,751
3,049,431
2010-06-15T22:10:00.000
3
0
0
0
python,plone,zope
3,054,308
2
true
1
0
BFG doesn't have very much to do with Zope, except: it uses some Zope libraries internally. it uses a variant of ZPT as its built-in templating language. it uses some concepts, such as traversal, that will be familiar to Zope people. If you know Zope 3 very well, and you like it, you'll like Grok. If you want a fram...
1
1
0
I am about to take the head long plunge into Zope land and am wondering which framework would fit my needs better. I have some experience toying around with django and the primary reason I am switching to a zope-based framework is ZPT and also needing to occasionally do things with Plone. Both seem to be well run proje...
Repoze.bfg or Grok
1.2
0
0
338
3,049,569
2010-06-15T22:35:00.000
4
0
1
0
python,function,import,utilities
3,049,575
2
true
0
0
If you don't want to make it a member of the Table class you could put it into a utilities module.
1
13
0
I need to create a function to rotate a given matrix (list of lists) clockwise, and I need to use it in my Table class. Where should I put this utility function (called rotateMatrixClockwise) so I can call it easily from within a function in my Table class?
Where do I put utility functions in my Python project?
1.2
0
0
12,843
3,049,625
2010-06-15T22:45:00.000
1
0
0
0
python,database,django,postgresql,django-orm
3,049,796
1
true
1
0
This could be caused by other things. For example, configuring Apache/mod_wsgi in a way that theoretically it could accept more concurrent requests than what the database itself may be able to accept at the same time. Have you reviewed your Apache/mod_wsgi configuration and compared limit on maximum clients to that of ...
1
3
0
I'm running a Django project on Postgresql 8.1.21 (using Django 1.1.1, Python2.5, psycopg2, Apache2 with mod_wsgi 3.2). We've recently encountered this lovely error: OperationalError: FATAL: connection limit exceeded for non-superusers I'm not the first person to run up against this. There's a lot of discussion about ...
Django ORM and PostgreSQL connection limits
1.2
1
0
2,568
3,050,450
2010-06-16T02:59:00.000
0
1
0
0
java,php,python,artificial-intelligence
3,050,643
9
false
1
0
Never use PHP for AI. Java or C/C++ is the best, but Python for fast development.
7
6
0
I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods. I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP. There are some books on AI on internet but they use Java , Python. Now I have to apply AI techniques on web application...
Which language should I use for Artificial intelligence on web projects
0
0
0
10,608
3,050,450
2010-06-16T02:59:00.000
6
1
0
0
java,php,python,artificial-intelligence
3,050,476
9
false
1
0
Does it really matter which language your books use? I mean, you're not gonna copy-paste those examples. And you'll learn to recognize basic constructs (functions, loops, etc) pretty fast. It's not like learning to read Chinese. Talking about learning time, there's probably no definite answer to this question. I think ...
7
6
0
I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods. I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP. There are some books on AI on internet but they use Java , Python. Now I have to apply AI techniques on web application...
Which language should I use for Artificial intelligence on web projects
1
0
0
10,608
3,050,450
2010-06-16T02:59:00.000
3
1
0
0
java,php,python,artificial-intelligence
3,051,952
9
false
1
0
Which language should i choose java or python. Here are a few things to consider: java is more widely used (presumably more mature code "out there" to look at - but I haven't tested that out) python is more prolific (you write faster in python than in java), and from learning the language to writing the code that you...
7
6
0
I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods. I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP. There are some books on AI on internet but they use Java , Python. Now I have to apply AI techniques on web application...
Which language should I use for Artificial intelligence on web projects
0.066568
0
0
10,608
3,050,450
2010-06-16T02:59:00.000
2
1
0
0
java,php,python,artificial-intelligence
3,050,709
9
false
1
0
You can use any language you like, as long as the server it's hosted on supports it. You can use HTML/JS as the user interface, and request results from the server with AJAX requests. What answers those requests would be your AI code, and that can be anything you want. PHP makes it really simple to answer AJAX requests...
7
6
0
I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods. I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP. There are some books on AI on internet but they use Java , Python. Now I have to apply AI techniques on web application...
Which language should I use for Artificial intelligence on web projects
0.044415
0
0
10,608
3,050,450
2010-06-16T02:59:00.000
0
1
0
0
java,php,python,artificial-intelligence
3,264,444
9
false
1
0
I believe Python is nice for this sort of tasks because of it's flexibility. Using the numpy/scipy libraries together with a nice plotting lib (chaco or matplotlib for instance) makes the workflow of working with the data and algorithms easy and you can lab around with the code in the live interpreter in an almost matl...
7
6
0
I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods. I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP. There are some books on AI on internet but they use Java , Python. Now I have to apply AI techniques on web application...
Which language should I use for Artificial intelligence on web projects
0
0
0
10,608
3,050,450
2010-06-16T02:59:00.000
0
1
0
0
java,php,python,artificial-intelligence
47,068,977
9
false
1
0
AI is not a language or a specific problem like summation or finding an average of some numbers. It's the intelligence which is going to be developed artificially. And to make a system intelligent especially a computer you can use any language that computer can understand and you are comfortable with (C, Java, Python, ...
7
6
0
I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods. I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP. There are some books on AI on internet but they use Java , Python. Now I have to apply AI techniques on web application...
Which language should I use for Artificial intelligence on web projects
0
0
0
10,608
3,050,450
2010-06-16T02:59:00.000
0
1
0
0
java,php,python,artificial-intelligence
3,051,880
9
false
1
0
Pretty much any language can be used to code pretty much anything - given the effort and will. But Python has more functional programming constructs which may be more useful when you are coding AI.
7
6
0
I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods. I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP. There are some books on AI on internet but they use Java , Python. Now I have to apply AI techniques on web application...
Which language should I use for Artificial intelligence on web projects
0
0
0
10,608
3,050,477
2010-06-16T03:07:00.000
0
0
0
0
javascript,python
3,051,343
1
true
1
0
It can work like this: on air ticket booking system you have a html form pointing on certain airline booking website (by action parameter). If user submits data then data lands on airline booking website and this website proceed the request. Usuallly people want to get back to the first site. This can be done by sendin...
1
0
0
just wonder how those air ticket booking website redirect the user to the airline booking website and then fill up(i suppose doing POST) the required information so that the users will land on the booking page with origin/destination/date selected? Is the technique used is to open up new browser window and do a ajax PO...
redirection follow by post
1.2
0
1
81
3,050,512
2010-06-16T03:18:00.000
10
0
1
1
python,ubuntu,installation,gnu,configure
3,050,521
4
true
0
0
When you install from source, by default, the installation goes in /usr/local -- the executable in particular becomes /usr/local/bin/pythonX.Y with a symlink to it that's named /usr/local/python. Ubuntu's own installation is in /usr/ (e.g., /usr/bin/python), so the new installation won't overwrite it. Take care that t...
1
8
0
Background: I am using Ubuntu The newer python version is not in the apt-get repository (or synaptic) I plan on keeping the old version as the default python when you call "python" from the command line I plan on calling the new python using pythonX.X (X.X is the new version). Given the background, how do you install...
On Ubuntu, how do you install a newer version of python and keep the older python version?
1.2
0
0
11,229
3,050,528
2010-06-16T03:22:00.000
1
0
1
0
python,dtmf
3,050,536
2
false
1
0
Do an FFT on the data. You should get spikes at the frequencies of the two tones.
1
2
0
If I have a recorded audio file (MP3), is there any way to get the figure out the DTMF tones that were recorded in pure Python? (If pure python is not available, then Java is okay too. The point being that it should be able to run in Google Appengine)
Parse (extract) DTMF in Python
0.099668
0
0
6,174
3,053,442
2010-06-16T13:03:00.000
0
0
0
0
python,django
3,053,690
1
false
1
0
You'll need to be a bit more specific. There's nothing magical about an app in Django - it's just a collection of models and views. If you need access to some of the models from one app in another app, just import them and use them as normal.
1
0
0
I want to have two custom made app dealing with two different tasks. i have a page(template) where the data from the both app come together. how to deploy url for that, in the common urls.py so that the two app work together. how to integrate the views from both app to return data to same template simultaneously. is th...
multiple custom app in django
0
0
0
72
3,053,480
2010-06-16T13:09:00.000
3
1
1
0
python,watermark
3,053,551
1
false
0
0
If by watermark you mean some "signature" image content added to an image in order to mark it, then no. Such a watermark is merged with the original image and thus an integral part of it. If you mean meta-data info then yes, this can be read: but you don't specify whether you mean programmatically, or what language or ...
1
1
0
Is there any way to read metadata - watermarks from image files with Python?
How to read watermarks with Python?
0.53705
0
0
546
3,053,875
2010-06-16T13:56:00.000
0
0
1
0
python,file,append,prepend
3,053,949
3
false
0
0
You could quite easily create an new file, output the data you wish to prepend to that file and then copy the content of the existing file and append it to the new one, then rename. This would prevent having to read the whole file if that is the primary issue.
2
3
0
Question: How do you write data to an already existing file at the beginning of the file with out writing over what's already there and with out reading the entire file into memory? (e.g. prepend) Info: I'm working on a project right now where the program frequently dumps data into a file. this file will very quickly ...
adding space in an output file with out having to read the entire thing first
0
0
0
265
3,053,875
2010-06-16T13:56:00.000
1
0
1
0
python,file,append,prepend
3,053,958
3
true
0
0
It's not addressing your original question, but here are some possible workarounds: Use SQLite (it's bundled with your Python) Use a fancier database, either RDBMS or NoSQL Just track the number of dumps in a different text file The first couple of options are a little more work up front, but provide more flexibility...
2
3
0
Question: How do you write data to an already existing file at the beginning of the file with out writing over what's already there and with out reading the entire file into memory? (e.g. prepend) Info: I'm working on a project right now where the program frequently dumps data into a file. this file will very quickly ...
adding space in an output file with out having to read the entire thing first
1.2
0
0
265
3,053,923
2010-06-16T14:01:00.000
1
0
0
0
python,django,cookies,django-authentication
3,054,422
1
true
1
0
I think you should be able to access this via request.session.session_key
1
0
0
In case of views that contain login or logout, this sessionid is different from the one submitted in request's Coockie header. I need to retrieve it before returning response for some purpose. How can I do this ?
Django : In a view how do I obtain the sessionid which will be part of the Set-Cookie header of following response?
1.2
0
0
501
3,054,086
2010-06-16T14:18:00.000
0
0
0
0
python,telnet,telnetlib
3,054,195
2
false
0
0
If you log in from A to B to C, do you need the console input from A to go to C ? If not, it is fairly straightforward, as you can execute commands on the second server to connect to the third. I do something like that using SSH, where I have paramiko and scripts installed on both A and B. A logs in to B and executes a...
2
0
0
I am able to establish the initial telnet session. But from this session I need to create a second. Basically I can not telnet directly to the device I need to access. Interactively this is not an issue but I am attempting to setup an automated test using python. Does anyone know who to accomplish this?
Using Python: How can I telnet into a server and then from that connection telnet into a second server?
0
0
1
797
3,054,086
2010-06-16T14:18:00.000
1
0
0
0
python,telnet,telnetlib
3,054,153
2
false
0
0
After establishing the first connection, just write the same telnet command you use manually to that connection.
2
0
0
I am able to establish the initial telnet session. But from this session I need to create a second. Basically I can not telnet directly to the device I need to access. Interactively this is not an issue but I am attempting to setup an automated test using python. Does anyone know who to accomplish this?
Using Python: How can I telnet into a server and then from that connection telnet into a second server?
0.099668
0
1
797
3,056,324
2010-06-16T19:00:00.000
1
0
1
1
python,django,networking,mac-address
3,056,396
2
true
0
0
The easiest thing to do would be to run a tool that can achieve this and parse its output (e.g. nmap). Depending on your needs, you could run it periodically and keep a file with the mac addresses. Looking at the leases file could work, assuming that all your machines are in there. If you want to actively look for mac...
2
0
0
is there a good way to gather the mac addresses of machines on a local network using Python. If it helps I'm trying to execute this python script from the DHCP server for the network. I'm new to Python but would it be a bad idea to look at the DHCP leases file for this info? I'd like to use this inside a Django app ev...
Gathering mac addresses with Python
1.2
0
0
1,429
3,056,324
2010-06-16T19:00:00.000
1
0
1
1
python,django,networking,mac-address
3,056,384
2
false
0
0
Really a unix question (one will assume) You can either look at the arp addresses registered "/sbin/arp -a" or a DHCP lease table. If you go the arp route you will on find addresses that your system has recently received/sent packets to, the DHCP lease table will give you the ability to see everything. Though if it's...
2
0
0
is there a good way to gather the mac addresses of machines on a local network using Python. If it helps I'm trying to execute this python script from the DHCP server for the network. I'm new to Python but would it be a bad idea to look at the DHCP leases file for this info? I'd like to use this inside a Django app ev...
Gathering mac addresses with Python
0.099668
0
0
1,429
3,057,318
2010-06-16T21:26:00.000
1
0
0
0
python,django,django-urls,django-templates
16,610,048
5
false
1
0
if you are using Django 1.5 and up, django-reversetags is not required anymore for just passing view names as variables into templates, to be used within the url tag. I was confused with the availability of django-reversetags, just thought of updating the matter correctly here.
1
18
0
What I'd like to do (for a recent changes 'widget' - not a django widget in this case) is pass a urlname into my template as a variable, then use it like so: {% url sitechangeobject.urlname %} Where urlname is a string containing a valid name for a url. Is this possible? The template keeps breaking saying it can't find...
Passing variable urlname to url tag in django template
0.039979
0
0
13,093
3,057,382
2010-06-16T21:38:00.000
2
0
0
0
java,python,eclipse,jython,pydev
3,119,610
1
false
1
0
eclipse stores project data in files like .project .pydevprojct .classpath with checkin / checkout via svn it is possible to lost some of these files check your dot-files
1
2
0
I have two projects in Eclipse with Java and Python code, using Jython. Also I'm using PyDev. One project can import and use the xml module just fine, and the other gives the error ImportError: No module named xml. As far as I can tell, all the project properties are set identically. The working project was created fro...
Jython project in Eclipse can't find the xml module, but works in an identical project
0.379949
0
1
190
3,057,507
2010-06-16T22:03:00.000
4
0
0
1
python,django
3,057,550
3
false
1
0
There are a number of ways to achieve this. Assuming the correct server resources I would write a python script that calls function xyz "outside" of your django directory (although importing the necessary stuff) that only runs if /var/run/django-stuff/my-daemon.run exists. Get cron to run this every two minutes. Then, ...
2
1
0
I am working on a django web application. A function 'xyx' (it updates a variable) needs to be called every 2 minutes. I want one http request should start the daemon and keep calling xyz (every 2 minutes) until I send another http request to stop it. Appreciate your ideas. Thanks Vishal Rana
A daemon to call a function every 2 minutes with start and stop capablities
0.26052
0
0
549
3,057,507
2010-06-16T22:03:00.000
2
0
0
1
python,django
3,057,553
3
false
1
0
Probably a little hacked but you could try this: Set up a crontab entry that runs a script every two minutes. This script will check for some sort of flag (file existence, contents of a file, etc.) on the disk to decide whether to run a given python module. The problem with this is it could take up to 1:59 to run the f...
2
1
0
I am working on a django web application. A function 'xyx' (it updates a variable) needs to be called every 2 minutes. I want one http request should start the daemon and keep calling xyz (every 2 minutes) until I send another http request to stop it. Appreciate your ideas. Thanks Vishal Rana
A daemon to call a function every 2 minutes with start and stop capablities
0.132549
0
0
549
3,057,643
2010-06-16T22:30:00.000
4
0
0
0
python,django,credit-card,payment
4,027,265
4
false
1
0
You can avoid PCI audits if the credit card details never touch your server... for example by using payment forms hosted on the servers of your chosen payment gateway provider. I have used SagePay here in the UK (and built Django connectors for their service from scratch - sorry not on github yet...) and they offer pay...
1
32
0
I need to process credit card payments on an app that provides a service outside the U.S. Given that Paypal it's not an option, I was wondering if there other services I could try. What would you recommend?
What's the best option to process credit card payments in Django?
0.197375
0
0
31,908
3,057,805
2010-06-16T23:04:00.000
0
0
1
0
python,shell,command-line-interface
3,057,864
3
false
0
0
You just need to stick something like this on the first line: #/usr/local/bin/python Just make yours be wherever your python binary is located. As for args look at getopt or optparser And remember to chmod your file to make it executable.
1
3
0
If possible I would like to use the following structure for a command however I can't seem to figure out how to achieve this in Python: ./somescript.py arg <optional argument> -- "some long argument" Would it be possible to achieve this in a feasible manner without too much dirty code? Or should I just reconsider the s...
Python CLI tool - general parsing question
0
0
0
236
3,058,723
2010-06-17T03:41:00.000
6
0
0
0
python,bash,facebook
3,381,527
8
false
0
0
There IS a way to do it, I've found it, but it's a lot of work and will require you to spoof a browser 100% (and you'll likely be breaking their terms of service) Sorry I can't provide all the details, but the gist of it: assuming you have a username/password for a facebook account, go curl for the oauth/authenticate....
1
41
0
I am trying to put together a bash or python script to play with the facebook graph API. Using the API looks simple, but I'm having trouble setting up curl in my bash script to call authorize and access_token. Does anyone have a working example?
Programmatically getting an access token for using the Facebook Graph API
1
0
1
72,749
3,061,459
2010-06-17T12:05:00.000
1
0
1
0
python,code-access-security
3,063,139
2
false
0
0
In which I attempt to answer the implied question, "And if so, how?" I think this is really a Linux administration question. You'd have to figure out how to suspend a user's account on the system you're using and then log the current user out. It's likely going to involve the Python script running as a user with privil...
2
0
0
Has anyone seen Jurrassic Park where Dennis Nedry has protected the system with an animation that says 'You didn't say the magic word' where after the system goes down. Is it possible to do something similar ikn Python ? To describe it less humoristic: A response screen which waits for a condition fulfilled by the use...
Python: Dennis Nedry - Security
0.099668
0
0
467
3,061,459
2010-06-17T12:05:00.000
7
0
1
0
python,code-access-security
3,061,468
2
false
0
0
Yes, it is possible.
2
0
0
Has anyone seen Jurrassic Park where Dennis Nedry has protected the system with an animation that says 'You didn't say the magic word' where after the system goes down. Is it possible to do something similar ikn Python ? To describe it less humoristic: A response screen which waits for a condition fulfilled by the use...
Python: Dennis Nedry - Security
1
0
0
467
3,062,701
2010-06-17T14:44:00.000
1
1
1
0
c#,java,python,dynamic-languages
3,062,743
9
false
0
0
Interfaces are used in statically typed languages to describe that two otherwise independent objects "implement the same behaviour". In dynamically typed languages one implicitly assumes that when two objects have a method with the same name/params it does the same thing, so interfaces are of no use.
4
18
0
Is it just because of dynamic typing we don't require a concept of interfaces(like in Java and C#) in python?
Why don't we require interfaces in dynamic languages?
0.022219
0
0
3,173
3,062,701
2010-06-17T14:44:00.000
1
1
1
0
c#,java,python,dynamic-languages
3,062,895
9
false
0
0
Interface constructs are used in statically typed languages to teach the type system which objects are substitutable for each other in a particular method-calling context. If two objects implement the same method but aren't related through inheritance from a common base class or implementation of a common interface, th...
4
18
0
Is it just because of dynamic typing we don't require a concept of interfaces(like in Java and C#) in python?
Why don't we require interfaces in dynamic languages?
0.022219
0
0
3,173
3,062,701
2010-06-17T14:44:00.000
1
1
1
0
c#,java,python,dynamic-languages
3,063,282
9
false
0
0
One key thing about at least some dynamic languages that makes explicit interfaces more than a little awkward is that dynamic languages can often respond to messages (err, “method calls”) that they don't know about beforehand, even doing things like creating methods on the fly. The only real way to know whether an obje...
4
18
0
Is it just because of dynamic typing we don't require a concept of interfaces(like in Java and C#) in python?
Why don't we require interfaces in dynamic languages?
0.022219
0
0
3,173
3,062,701
2010-06-17T14:44:00.000
2
1
1
0
c#,java,python,dynamic-languages
3,063,169
9
false
0
0
It's worth noting that, contrary to what many people will say as a first response, interfaces can be used to do more than document "what methods a class supports". Grzenio touches on this with his wording on "implement the same behaviour". As a specific example of this, look at the Java interface Serializable. It doesn...
4
18
0
Is it just because of dynamic typing we don't require a concept of interfaces(like in Java and C#) in python?
Why don't we require interfaces in dynamic languages?
0.044415
0
0
3,173
3,062,741
2010-06-17T14:48:00.000
67
0
1
0
python,random,shuffle
3,062,966
3
true
0
0
TL;DR: It "breaks" on lists with over 2080 elements, but don't worry too much :) Complete answer: First of all, notice that "shuffling" a list can be understood (conceptually) as generating all possible permutations of the elements of the lists, and picking one of these permutations at random. Then, you must remember ...
1
34
0
I have a list which I shuffle with the Python built in shuffle function (random.shuffle) However, the Python reference states: Note that for even rather small len(x), the total number of permutations of x is larger than the period of most random number generators; this implies that most permutations of a long sequence...
Maximal Length of List to Shuffle with Python random.shuffle?
1.2
0
0
6,281
3,063,078
2010-06-17T15:25:00.000
0
0
1
0
python
3,063,106
2
false
0
0
The standard struct module can be used to do this easily. Just be careful of your platform endianess but, other than that, it should be a pretty straight-forward application of pack() and unpack().
1
6
0
How can I combine 2 ints to a single 32bit IEEE floating point ? (each of the 2 ints represent 16 bit) And in the opposite direction: How can I transform a python float into 2 16 bit ints? (I need this because of modbus protocol - where 2x16 bit registers are treated as single 32 floating point number)
Python: convert 2 ints to 32 float
0
0
0
3,715
3,064,169
2010-06-17T17:46:00.000
3
0
1
0
python,data-structures
3,064,188
4
false
0
0
Could you use a dictionary with A as the key, and the item in the dictionary as a 2-item tuple or list? If you're working with any of that data in a consistent way, you could also consider storing a class that has 2 properties in the dictionary.
1
2
0
I've got a set of data that has three attributes, say A, B, and C, where A is kind of the index (i.e., A is used to look up the other two attributes.) What would be the best data structure for such data? I used two dictionaries, with A as the index of each. However, there's key errors when the query to the data doesn...
Python what's the data structure for triple data
0.148885
0
0
2,766
3,064,392
2010-06-17T18:18:00.000
0
0
1
0
python,file-io,replace
3,066,885
5
false
0
0
sed s/oldword/newword/g originalfile.txt > fixedfile.txt :-)
1
2
0
I want to write a python code that open a text file and Replace with a word that i want send to it . May you give me an example ? Thanks .
What Is The Replace Function In Python
0
0
0
977
3,064,405
2010-06-17T18:19:00.000
3
1
0
1
python,egg
3,064,433
1
true
0
0
The best way to fix it is by creating a directory where it can write it's egg cache. You can specify the directory with the PYTHON_EGG_CACHE variable. [edit] And yes, you can convert your apps so they won't need an egg-cache. If you install the python packages with easy_install you can use easy_install -Z so it won't z...
1
1
0
Is there an easy way to disable Python egg caching? We have the situation where a system account needs to run a python program which imports a module. Since this is a non-login robot account, it does not have a home directory, and dies trying to create the directory /.python-eggs. What's the best way to fix this? Can...
Python: disabling $HOME/.python-eggs?
1.2
0
0
719
3,064,830
2010-06-17T19:13:00.000
0
0
0
0
python,sql,ms-access,crm
3,073,339
4
false
0
0
I'm not even clear on what you're trying to do. I assume your problem is that Jet/ACE can't handle a UNION with that many SELECT statements. If you have 64 identically-structured tables and you want them in a single CSV, I'd create a temp table in Access, append each table in turn, then export from the temp table to C...
2
2
0
THE TASK: I am in the process of migrating a DB from MS Access to Maximizer. In order to do this I must take 64 tables in MS ACCESS and merge them into one. The output must be in the form of a TAB or CSV file. Which will then be imported into Maximizer. THE PROBLEM: Access is unable to perform a query that is so comple...
Query crashes MS Access
0
1
0
4,410
3,064,830
2010-06-17T19:13:00.000
1
0
0
0
python,sql,ms-access,crm
3,064,852
4
false
0
0
I would recommend #2 if the merge is fairly simple and straightforward, and doesn't need the power of an RDBMS. I'd go with #1 if the merge is more complex and you will need to write some actual queries to get the data merged properly.
2
2
0
THE TASK: I am in the process of migrating a DB from MS Access to Maximizer. In order to do this I must take 64 tables in MS ACCESS and merge them into one. The output must be in the form of a TAB or CSV file. Which will then be imported into Maximizer. THE PROBLEM: Access is unable to perform a query that is so comple...
Query crashes MS Access
0.049958
1
0
4,410
3,066,255
2010-06-17T23:07:00.000
0
0
0
0
python,mysql,django
3,320,441
5
false
1
0
I concur with the 'no foreign keys' advice (with the disclaimer: I also work for Percona). The reason why it is is recommended is for concurrency / reducing locking internally. It can be a difficult "optimization" to sell, but if you consider that the database has transactions (and is more or less ACID compliant) then ...
3
2
0
I've just started learning Python Django and have a lot of experience building high traffic websites using PHP and MySQL. What worries me so far is Python's overly optimistic approach that you will never need to write custom SQL and that it automatically creates all these Foreign Key relationships in your database. The...
Does Python Django support custom SQL and denormalized databases with no Foreign Key relationships?
0
1
0
640
3,066,255
2010-06-17T23:07:00.000
0
0
0
0
python,mysql,django
3,066,274
5
false
1
0
django-admin inspectdb allows you to reverse engineer a models file from existing tables. That is only a very partial response to your question ;)
3
2
0
I've just started learning Python Django and have a lot of experience building high traffic websites using PHP and MySQL. What worries me so far is Python's overly optimistic approach that you will never need to write custom SQL and that it automatically creates all these Foreign Key relationships in your database. The...
Does Python Django support custom SQL and denormalized databases with no Foreign Key relationships?
0
1
0
640
3,066,255
2010-06-17T23:07:00.000
0
0
0
0
python,mysql,django
3,066,360
5
false
1
0
You can just create the model.py and avoid having SQL Alchemy automatically create the tables leaving it up to you to define the actual tables as you please. So although there are foreign key relationships in the model.py this does not mean that they must exist in the actual tables. This is a very good thing consider...
3
2
0
I've just started learning Python Django and have a lot of experience building high traffic websites using PHP and MySQL. What worries me so far is Python's overly optimistic approach that you will never need to write custom SQL and that it automatically creates all these Foreign Key relationships in your database. The...
Does Python Django support custom SQL and denormalized databases with no Foreign Key relationships?
0
1
0
640
3,066,438
2010-06-18T00:05:00.000
1
0
1
1
python,login,restart,boot
3,066,480
3
true
0
0
I can't think of any way to do strictly what you want off the top of my head other than the registry, at least not without even more drastic measures. But doing this registry modification isn't a big deal; just change the autologon username/password and reboot the computer. To have the computer reboot when the user log...
2
1
0
I know how to reboot machines remotely, so that's the easy part. However, the complexity of the issue is trying to setup the following. I'd like to control machines on a network for after-hours use such that when users logoff and go home, or shutdown their computers, whatever, python or some combination of python + win...
Reboot windows machines at a certain time of day and automatically login with Python
1.2
0
0
1,489
3,066,438
2010-06-18T00:05:00.000
0
0
1
1
python,login,restart,boot
3,076,111
3
false
0
0
Thanks for the responses. To be more clear on what I'm doing, I have a program that automatically starts on bootup, so getting logged in would be preferred. I'm coding a manager for a render-farm for work which will take all the machines that our guys use during the day and turn them into render servers at night (or wh...
2
1
0
I know how to reboot machines remotely, so that's the easy part. However, the complexity of the issue is trying to setup the following. I'd like to control machines on a network for after-hours use such that when users logoff and go home, or shutdown their computers, whatever, python or some combination of python + win...
Reboot windows machines at a certain time of day and automatically login with Python
0
0
0
1,489
3,067,409
2010-06-18T05:35:00.000
6
0
1
0
python
3,067,481
6
false
0
0
Quite apart from the octal caper: Zip codes, social security "numbers", credit card "numbers", phone "numbers", etc are NOT numbers in the sense that you can do meaningful arithmetic on them, so don't keep them as integers, keep them as strings.
4
6
0
zipcode = 02132 print zipcode result = 1114
Not getting exact result in python with the values leading zero. Please tell me what is going on there
1
0
0
1,103
3,067,409
2010-06-18T05:35:00.000
9
0
1
0
python
3,067,424
6
false
0
0
In Python 2.x, number with a leading zero is interpreted as octal (base-eight). Python 3.x requires a leading "0o" to indicate an octal number. You probably want to treat a zipcode as a string to keep the leading zeroes intact.
4
6
0
zipcode = 02132 print zipcode result = 1114
Not getting exact result in python with the values leading zero. Please tell me what is going on there
1
0
0
1,103
3,067,409
2010-06-18T05:35:00.000
2
0
1
0
python
3,067,418
6
false
0
0
What is your question? I guess, why is that. The answer is octal numbers. If a number starts with a zero, Python thinks you mean an octal number. (Base 8)
4
6
0
zipcode = 02132 print zipcode result = 1114
Not getting exact result in python with the values leading zero. Please tell me what is going on there
0.066568
0
0
1,103
3,067,409
2010-06-18T05:35:00.000
5
0
1
0
python
3,067,413
6
false
0
0
The leading 0 makes it assume 02132 is octal.
4
6
0
zipcode = 02132 print zipcode result = 1114
Not getting exact result in python with the values leading zero. Please tell me what is going on there
0.16514
0
0
1,103
3,067,452
2010-06-18T05:48:00.000
0
0
0
1
python,django,google-app-engine
13,855,137
3
false
1
0
Appengine comes with built in Django, if you look under your (google_appengine/lib/django_1_3) lib dir you will see a few versions. You can define what version you want to be used in your app.yaml It isn't a full release of Django and if you do want to have full admin functionality of Django you might have to use some...
1
1
0
I am impressed with django.Am am currenty a java developer.I want to make some cool websites for myself but i want to host it in some third pary environmet. Now the question is can i host the django application on appengine?If yes , how?? Are there any site built using django which are already hosted on appengine?
django on appengine
0
0
0
253
3,067,453
2010-06-18T05:48:00.000
1
0
0
0
python,django,datefield
3,067,477
3
false
1
0
A DateField is a whole date. If you only care about the month and day then use __month and __day when querying.
1
10
0
Is it possible to have a DateField without the year? Or will I have to use a CharField? I am using the admin to edit the models.
Django DateField without year
0.066568
0
0
4,685
3,068,827
2010-06-18T10:27:00.000
1
0
0
0
python,django
3,068,886
2
false
1
0
This template responsibility to display this image in your case, I believe. If you form need to be able to send image related information (path, url..), you'll need to create a dedicated widget.
2
4
0
I need to display an image in a Django form. My Django form is quite simple - a single text input field. When I initialise my Django form in a view, I would like to pass the image path as a parameter, and the form when rendered in the template displays the image. Is is possible with Django forms or would i have to disp...
Display image in Django Form
0.099668
0
0
1,365
3,068,827
2010-06-18T10:27:00.000
1
0
0
0
python,django
3,068,909
2
true
1
0
If the image is related to the form itself, not to any field in particular, then you can make a custom form class and override one of as_table(), as_ul(), as_p() methods. Or you can just use a custom template instead of leaving the form to render itself. If it is field related then a custom widget is appropriate, as Pi...
2
4
0
I need to display an image in a Django form. My Django form is quite simple - a single text input field. When I initialise my Django form in a view, I would like to pass the image path as a parameter, and the form when rendered in the template displays the image. Is is possible with Django forms or would i have to disp...
Display image in Django Form
1.2
0
0
1,365
3,068,843
2010-06-18T10:30:00.000
3
0
0
0
python,django,django-admin
3,069,023
12
false
1
0
One workaround would be to have an additional "save" permission on your model and check in the modeladmin's save_model method if the user has this permissions, if he has not, that would mean he can do everything in this modeladmin, except saving edited data!
3
27
0
is it possible to give users the permission to view, but not to change or delete. currently in the only permissions I see are "add", "change" and "delete"... but there is no "read/view" in there. I really need this as some users will only be able to consult the admin panel, in order to see what has been added in.
Permission to view, but not to change! - Django
0.049958
0
0
25,793