Q_CreationDate
stringlengths
23
23
Title
stringlengths
11
149
Question
stringlengths
25
6.53k
Answer
stringlengths
15
5.1k
Score
float64
-1
1.2
Is_accepted
bool
2 classes
N_answers
int64
1
17
Q_Id
int64
0
6.76k
2010-01-07 17:01:27.297
Looking for a payment gateway
I'm looking for a payment gateway company so we can avoid tiresome PCI-DSS certification and its associated expenses. I'll get this out the way now, I don't want Paypal. It does what I want but it's really not a company I want to trust with any sort of money. It needs to support the following flow: User performs actio...
It sounds like you want something like Worldpay or even Google Checkout. But it all depends what your turnover is, because these sorts of providers (who host the payment page themselves), tend to take a percentage of every transaction, rather than a fixed monthly fee that you can get from elsewhere. The other thing to ...
0.16183
false
3
389
2010-01-07 17:01:27.297
Looking for a payment gateway
I'm looking for a payment gateway company so we can avoid tiresome PCI-DSS certification and its associated expenses. I'll get this out the way now, I don't want Paypal. It does what I want but it's really not a company I want to trust with any sort of money. It needs to support the following flow: User performs actio...
I just finished something exactly like this using First Data Global Gateway (don't really want to provide a link, can find with Google). There's no Python API because their interface is nothing but http POST. You have the choice of gathering credit card info yourself before posting the form to their server, as long as...
0.16183
false
3
389
2010-01-07 17:01:27.297
Looking for a payment gateway
I'm looking for a payment gateway company so we can avoid tiresome PCI-DSS certification and its associated expenses. I'll get this out the way now, I don't want Paypal. It does what I want but it's really not a company I want to trust with any sort of money. It needs to support the following flow: User performs actio...
You might want to take a look at Adyen (www.adyen.com). They are European and provide a whole lot of features and a very friendly interface. They don't charge a monthly or set up fee and seem to be reasonably priced per transaction. Their hosted payments page can be completely customised which was an amazing improvemen...
1.2
true
3
389
2010-01-07 17:18:28.730
Running Different Django Versions But Sharing Authentication
Brand new to django. We have a legacy django project using django 0.96x that does authentication, ldap, etc., and it's pretty involved so we don't want to rewrite that code. We want to add a forum solution (off the shelf) but all of the ones I've seen so far require django 1.x I'm trying to figure out how to get this ...
It's possible, but it may be pretty painful to do option #3. How about Option 4: bite the bullet and upgrade to Django 1.1.1. I did this with a couple of 0.97pre sites and it took less time than I thought it would. The biggest pain was dealing with admin stuff. Instead of going with separate admin.py files, we simply p...
1.2
true
3
390
2010-01-07 17:18:28.730
Running Different Django Versions But Sharing Authentication
Brand new to django. We have a legacy django project using django 0.96x that does authentication, ldap, etc., and it's pretty involved so we don't want to rewrite that code. We want to add a forum solution (off the shelf) but all of the ones I've seen so far require django 1.x I'm trying to figure out how to get this ...
A user's login status is stored using sessions. As far as I can tell from comparing trunk to the 0.96 source, the sessions are committed to a cookie the same way, and auth stores the user ID and backend the same way, so as long as the two apps use the same session storage and are on the same domain, it should work. (Ju...
0
false
3
390
2010-01-07 17:18:28.730
Running Different Django Versions But Sharing Authentication
Brand new to django. We have a legacy django project using django 0.96x that does authentication, ldap, etc., and it's pretty involved so we don't want to rewrite that code. We want to add a forum solution (off the shelf) but all of the ones I've seen so far require django 1.x I'm trying to figure out how to get this ...
It's possible to expose Django 0.96 tables to 1.1 - you can use unmanaged models wrapped around database VIEWs. In other words you issue: CREATE VIEW auth_user AS SELECT * from django096db.auth_user; (and similar cmd for other tables) and then you have Django 1.1 synchronized with 0.96 (assuming 0.96 tables are compati...
0
false
3
390
2010-01-12 04:28:37.153
Creating waitable objects in Python
I more or less know how to use select() to take a list of sockets, and only return the ones that are ready to read/write something. The project I'm working on now has a class called 'user'. Each 'user' object contains its own socket. What I would like to do is pass a list of users to a select(), and get back a list ...
You should have your User class implement a fileno(self) method which returns self.thesocket.fileno() -- that's the way to make select work on your own classes (sockets only on windows, arbitrary files on Unix-like systems). Not sure what switch is supposed to me -- don't recognize it as a standard library (or built-i...
1.2
true
1
391
2010-01-15 00:04:59.403
key/value (general) and tokyo cabinet (python tc-specific) question
i have been in the RDBMS world for many years now but wish to explore the whole nosql movement. so here's my first question: is it bad practice to have the possibility of duplicate keys? for example, an address book keyed off of last name (most probably search item?) could have multiple entities. is it bad practice ...
This depend on no-sql implementation. Cassandra, for example, allows range queries, so you could model data to do queries on last name, or with full name (starting with last name, then first name). Beyond this, many simpler key-value stores would indeed require you to store a list structure (or such) for multi-valued e...
1.2
true
1
392
2010-01-15 05:46:23.317
Not showing focus in wxPython?
I don't know if this is a stupid question, but is there any way to not show focus in wxPython? For example, I built a simple GUI with a few buttons and I don't want the dotted rectangle to show up on the button I have just clicked. If I remember correctly in Excel VBA you could just set TakeFocusOnClick tag to False. ...
You could also give the focus to another control in your event handler for the buttons. Just call the SetFocus() method on any other control. This might make your application more usable as a side effect if you for example return focus to a text field that is likely to be typed in next.
0
false
1
393
2010-01-15 19:08:22.297
How to speedup python unittest on muticore machines?
I'm using python unittest in order to test some other external application but it takes too much time to run the test one by one. I would like to know how can I speedup this process by using the power of multi-cores. Can I tweak unittest to execute tests in parallel? How? This question is not able python GIL limitatio...
As the @vinay-sajip suggested, a few non-core python packages like py.test and nose provided parallel execution of unit tests via multiprocessing lib right out of the box. However, one thing to consider is that if you are testing a web app with database backend and majority of your test cases are relying on connecting...
0
false
1
394
2010-01-16 09:27:22.083
Generating non-repeating random numbers in Python
Ok this is one of those trickier than it sounds questions so I'm turning to stack overflow because I can't think of a good answer. Here is what I want: I need Python to generate a simple a list of numbers from 0 to 1,000,000,000 in random order to be used for serial numbers (using a random number so that you can't tell...
You can run 1) without running into the problem of too many wrong random numbers if you just decrease the random interval by one each time. For this method to work, you will need to save the numbers already given (which you want to do anyway) and also save the quantity of numbers taken. It is pretty obvious that, after...
0.024005
false
5
395
2010-01-16 09:27:22.083
Generating non-repeating random numbers in Python
Ok this is one of those trickier than it sounds questions so I'm turning to stack overflow because I can't think of a good answer. Here is what I want: I need Python to generate a simple a list of numbers from 0 to 1,000,000,000 in random order to be used for serial numbers (using a random number so that you can't tell...
I think you are overestimating the problems with approach 1). Unless you have hard-realtime requirements just checking by random choice terminates rather fast. The probability of needing more than a number of iterations decays exponentially. With 100M numbers outputted (10% fillfactor) you'll have one in billion chance...
0.119475
false
5
395
2010-01-16 09:27:22.083
Generating non-repeating random numbers in Python
Ok this is one of those trickier than it sounds questions so I'm turning to stack overflow because I can't think of a good answer. Here is what I want: I need Python to generate a simple a list of numbers from 0 to 1,000,000,000 in random order to be used for serial numbers (using a random number so that you can't tell...
Do you need this to be cryptographically secure or just hard to guess? How bad are collisions? Because if it needs to be cryptographically strong and have zero collisions, it is, sadly, impossible.
0
false
5
395
2010-01-16 09:27:22.083
Generating non-repeating random numbers in Python
Ok this is one of those trickier than it sounds questions so I'm turning to stack overflow because I can't think of a good answer. Here is what I want: I need Python to generate a simple a list of numbers from 0 to 1,000,000,000 in random order to be used for serial numbers (using a random number so that you can't tell...
I'd rethink the problem itself... You don't seem to be doing anything sequential with the numbers... and you've got an index on the column which has them. Do they actually need to be numbers? Consider a sha hash... you don't actually need the entire thing. Do what git or other url shortening services do, and take first...
0
false
5
395
2010-01-16 09:27:22.083
Generating non-repeating random numbers in Python
Ok this is one of those trickier than it sounds questions so I'm turning to stack overflow because I can't think of a good answer. Here is what I want: I need Python to generate a simple a list of numbers from 0 to 1,000,000,000 in random order to be used for serial numbers (using a random number so that you can't tell...
The standard Linear Congruential random number generator's seed sequence CANNOT repeat until the full set of numbers from the starting seed value have been generated. Then it MUST repeat precisely. The internal seed is often large (48 or 64 bits). The generated numbers are smaller (32 bits usually) because the enti...
0.095744
false
5
395
2010-01-16 13:58:20.070
DB a table for the category and another table for the subcategory with similar fields, why?
I recently joined a new company and the development team was in the progress of a project to rebuild the database categories structure as follows: if we have category and subcategory for items, like food category and italian food category in food category. They were building a table for each category, instead of having...
First, the most obvious answer is that you should ask them, not us, since I can tell you this, that design seems bogus deluxe. The only reason I can come up with is that you have inexperienced DBA's that does not know how to performance-tune a database, and seems to think that a table with less rows will always vastly ...
0.386912
false
1
396
2010-01-18 05:30:36.243
How would I discover the memory used by an application through a python script?
Recently I've found myself testing an aplication in Froglogic's Squish, using Python to create test scripts. Just the other day, the question of how much memory the program is using has come up, and I've found myself unable to answer it. It seems reasonable to assume that there's a way to query the os (windows 7) API f...
Remember that Squish allows remote testing of the application. A system parameter queried via Python directly will only apply to the case of local testing. An approach that works in either case is to call the currentApplicationContext() function that will give you a handle to the Application Under Test. It has a usedMe...
0
false
2
397
2010-01-18 05:30:36.243
How would I discover the memory used by an application through a python script?
Recently I've found myself testing an aplication in Froglogic's Squish, using Python to create test scripts. Just the other day, the question of how much memory the program is using has come up, and I've found myself unable to answer it. It seems reasonable to assume that there's a way to query the os (windows 7) API f...
In command line: tasklist /FO LIST and parse the results? Sorry, I don't know a Pythonic way. =P
-0.135221
false
2
397
2010-01-18 10:55:11.800
populating data from xml file to a sqlite database using python
I have a question related to some guidances to solve a problem. I have with me an xml file, I have to populate it into a database system (whatever, it might be sqlite, mysql) using scripting language: Python. Does anyone have any idea on how to proceed? Which technologies I need to read further? Which environments I h...
If you are accustomed to DOM (tree) access to xml from other language, you may find useful these standard library modules (and their respective docs): xml.dom xml.dom.minidom To save tha data to DB, you can use standard module sqlite3 or look for binding to mysql. Or you may wish to use something more abstract, like...
0.101688
false
1
398
2010-01-18 15:17:06.783
How can I determine if a python script is executed from crontab?
I would like to know how can I determine if a python script is executed from crontab? I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script).
Not quite what you asked, but maybe what you want is os.isatty(sys.stdout.fileno()), which tells if stdout is connected to (roughly speaking) a terminal. It will be false if you pipe the output to a file or another process, or if the process is run from cron.
1.2
true
4
399
2010-01-18 15:17:06.783
How can I determine if a python script is executed from crontab?
I would like to know how can I determine if a python script is executed from crontab? I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script).
If you want to detect this from an imported module, I would have the main program set a global variable in the module, which would output different things depending on the value of this global variable (and have the main program decide how to set the variable through a flag that you would use in your crontab). This is...
0
false
4
399
2010-01-18 15:17:06.783
How can I determine if a python script is executed from crontab?
I would like to know how can I determine if a python script is executed from crontab? I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script).
An easier workaround would be to pass a flag to the script only from the crontab, like --crontab, and then just check for that flag.
0.067922
false
4
399
2010-01-18 15:17:06.783
How can I determine if a python script is executed from crontab?
I would like to know how can I determine if a python script is executed from crontab? I don't want a solution that will require adding a parameter because I want to be able to detect this even from an imported module (not the main script).
Set an environment variable at the cron command invocation. That works even within a module, as you can just check os.getenv().
0.327599
false
4
399
2010-01-18 23:31:34.390
Streaming Ironpython output to my editor
We embed ironpython in our app sob that scripts can be executed in the context of our application. I use Python.CreateEngine() and ScriptScope.Execute() to execute python scripts. We have out own editor(written in C#) that can load ironpython scripts and run it. There are 2 problems I need to solve. If I have a print ...
You can provide a custom Stream or TextWriter which will be used for all output. You can provide those by using one of the ScriptRuntime.IO.SetOutput overloads. Your implementation of Stream or TextWriter should receive the strings and then output them to your editor window (potentially marshalling back onto the UI t...
0.673066
false
1
400
2010-01-19 04:35:22.960
What is the maximum packet size a python socket can handle?
i am new to network programming in python. I wanted to know that what is the maximum size packet we can transmit or receive on python socket? and how to find out it?
I don't think there's any Python-specific limits. UDP packets have a theoretical limit of circa 65kb and TCP no upper limit, but you'll have flow control problems if you use packets much more than a few kilobytes.
0.135221
false
1
401
2010-01-21 03:58:43.267
Limit a single record in model for django app?
I want use a model to save the system setting for a django app, So I want to limit the model can only have one record, how to do the limit?
An easy way is to use the setting's name as the primary key in the settings table. There can't be more than one record with the same primary key, so that will allow both Django and the database to guarantee integrity.
1.2
true
1
402
2010-01-23 01:06:04.163
Can Someone Explain Threads to Me?
I have been considering adding threaded procedures to my application to speed up execution, but the problem is that I honestly have no idea how to use threads, or what is considered "thread safe". For example, how does a game engine utilize threads in its rendering processes, or in what contexts would threads only be c...
There are four things you should know about threads. Threads are like processes, but they share memory. Threads often have hardware, OS, and language support, which might make them better than processes. There are lots of fussy little things that threads need to support (like locks and semaphores) so they don't get t...
0.081452
false
5
403
2010-01-23 01:06:04.163
Can Someone Explain Threads to Me?
I have been considering adding threaded procedures to my application to speed up execution, but the problem is that I honestly have no idea how to use threads, or what is considered "thread safe". For example, how does a game engine utilize threads in its rendering processes, or in what contexts would threads only be c...
Well someone will probably answer this better, but threads are for the purpose of having background processing that won't freeze the user interface. You don't want to stop accepting keyboard input or mouse input, and tell the user, "just a moment, I want to finish this computation, it will only be a few more seconds....
0.040794
false
5
403
2010-01-23 01:06:04.163
Can Someone Explain Threads to Me?
I have been considering adding threaded procedures to my application to speed up execution, but the problem is that I honestly have no idea how to use threads, or what is considered "thread safe". For example, how does a game engine utilize threads in its rendering processes, or in what contexts would threads only be c...
This is a very broad topic. But here are the things I would want to know if I knew nothing about threads: They are units of execution within a single process that happen "in parallel" - what this means is that the current unit of execution in the processor switches rapidly. This can be achieved via different means. ...
1.2
true
5
403
2010-01-23 01:06:04.163
Can Someone Explain Threads to Me?
I have been considering adding threaded procedures to my application to speed up execution, but the problem is that I honestly have no idea how to use threads, or what is considered "thread safe". For example, how does a game engine utilize threads in its rendering processes, or in what contexts would threads only be c...
Threads don't speed up applications. Algorithms speed up applications. Threads can be used in algorithms, if appropriate.
0.040794
false
5
403
2010-01-23 01:06:04.163
Can Someone Explain Threads to Me?
I have been considering adding threaded procedures to my application to speed up execution, but the problem is that I honestly have no idea how to use threads, or what is considered "thread safe". For example, how does a game engine utilize threads in its rendering processes, or in what contexts would threads only be c...
Threads are simply a way of executing multiple things simultaneously (assuming that the platform on which they are being run is capable of parallel execution). Thread safety is simply (well, nothing with threads is truly simple) making sure that the threads don't affect each other in harmful ways. In general, you are ...
0.040794
false
5
403
2010-01-23 13:27:09.017
python threading/fork?
I'm making a python script that needs to do 3 things simultaneously. What is a good way to achieve this as do to what i've heard about the GIL i'm not so lean into using threads anymore. 2 of the things that the script needs to do will be heavily active, they will have lots of work to do and then i need to have the thi...
The GIL is really only something to care about if you want to do multiprocessing, that is spread the load over several cores/processors. If that is the case, and it kinda sounds like it from your description, use multiprocessing. If you just need to do three things "simultaneously" in that way that you need to wait in ...
0.386912
false
1
404
2010-01-23 19:12:57.393
how to generate permutations of array in python?
i have an array of 27 elements,and i don't want to generate all permutations of array (27!) i need 5000 randomly choosed permutations,any tip will be useful...
You may want the itertools.permutations() function. Gotta love that itertools module! NOTE: New in 2.6
0.067922
false
1
405
2010-01-24 17:17:40.100
TextMate and Django Integration - Supporting {% %} markup
I have installed a TextMate bundle that I believe enables the ability for automatic closing of the "{{" markup (so that it will automatically close the markup with "}}"), but this does not seem to be possible with the other markup that uses "{%" and "%}". So, I was wondering if anyone out there knows how to get TextMat...
I don't think that's possible, but the Django bundle for TextMate does allow you to insert the opening and closing tags in one go, placing the cursor in the middle, with ctrl-% (ctrl-shift-5). Click the Bundles -> Python Django Templates menu to see all the shortcuts that are available.
0.201295
false
2
406
2010-01-24 17:17:40.100
TextMate and Django Integration - Supporting {% %} markup
I have installed a TextMate bundle that I believe enables the ability for automatic closing of the "{{" markup (so that it will automatically close the markup with "}}"), but this does not seem to be possible with the other markup that uses "{%" and "%}". So, I was wondering if anyone out there knows how to get TextMat...
It's possible - the Rails bundle does this for ERB (<% automatically gets closing %> tags). So that's a place you could go look.
0.386912
false
2
406
2010-01-26 18:19:45.357
Stored Procedures in Python for PostgreSQL
we are still pretty new to Postgres and came from Microsoft Sql Server. We are wanting to write some stored procedures now. Well, after struggling to get something more complicated than a hello world to work in pl/pgsql, we decided it's better if we are going to learn a new language we might as well learn Python becaus...
Depends on what operations you're doing. Well, combine that with a general Python documentation, and that's about what you have. No. Again, depends on what you're doing. If you're only going to run a query once, no point in preparing it separately. If you are using persistent connections, it might. But they get cleared...
1.2
true
1
407
2010-01-28 05:19:13.613
how to find time at particular timezone from anywhere
I need to know the current time at CDT when my Python script is run. However this script will be run in multiple different timezones so a simple offset won't work. I only need a solution for Linux, but a cross platform solution would be ideal.
You can use time.gmtime() to get time GMT (UTC) from any machine no matter the timezone, then you can apply your offset.
1.2
true
1
408
2010-01-30 17:48:45.377
How can I create my own corpus in the Python Natural Language Toolkit?
I have recently expanded the names corpus in nltk and would like to know how I can turn the two files I have (male.txt, female.txt) in to a corpus so I can access them using the existing nltk.corpus methods. Does anyone have any suggestions? Many thanks, James.
Came to understand how corpus reading works by looking at the source code in nltk.corpus and then looking at the corpora (located in /home/[user]/nltk_data/corpora/names - this will probably be in My Documents for XP and somewhere in User for Win7 users). The structure of the corpus and its related function will give a...
0.135221
false
2
409
2010-01-30 17:48:45.377
How can I create my own corpus in the Python Natural Language Toolkit?
I have recently expanded the names corpus in nltk and would like to know how I can turn the two files I have (male.txt, female.txt) in to a corpus so I can access them using the existing nltk.corpus methods. Does anyone have any suggestions? Many thanks, James.
Alex is right, start with the docs, and figure out which corpus reader will work for your corpus. The simple instantiate it, given the path to your corpus file(s). As you'll see in the docs, the builtin corpora are simply instances of particular corpus reader classes. Look thru the code in the nltk.corpus package shoul...
0
false
2
409
2010-01-31 20:37:42.613
What is the keyboard shortcut to run all unit tests in the current project in PyDev + Eclipse?
I know Ctrl + F9 runs a single file. How to run them all? If there is no such thing, how to bind one keyboard shortcut to it?
Go to the preferences and type in keys to get to the keyboard shortcut definition page (I think it's called keys... sorry not on my dev machine right now). In this dialog you can search for commands. See if there is a run all tests command (it might help to find the run tests you are currently using first). If there...
0.135221
false
1
410
2010-02-01 19:19:42.847
Using Jython with Django?
I am planning to use Jython with Django. I want to know how stable the Jython project is, how easy to use it is, and how large its developer community is.
I have not used Django with Jython, so I can't speak to that specific issue, but I've used Jython for other things and I've found it quite stable of late, and just as easy as plain Python. I believe the "core committers" in Jython are substantially fewer than in C-Python (maybe 1/3 the number or less), if that's what ...
0.386912
false
2
411
2010-02-01 19:19:42.847
Using Jython with Django?
I am planning to use Jython with Django. I want to know how stable the Jython project is, how easy to use it is, and how large its developer community is.
I use Jython in testing and rapid-development. From my point of view it is stable.
0.265586
false
2
411
2010-02-03 04:56:52.453
How to find length of digits in an integer?
In Python, how do you find the number of digits in an integer?
If you want the length of an integer as in the number of digits in the integer, you can always convert it to string like str(133) and find its length like len(str(123)).
1.2
true
2
412
2010-02-03 04:56:52.453
How to find length of digits in an integer?
In Python, how do you find the number of digits in an integer?
Assuming you are asking for the largest number you can store in an integer, the value is implementation dependent. I suggest that you don't think in that way when using python. In any case, quite a large value can be stored in a python 'integer'. Remember, Python uses duck typing! Edit: I gave my answer before the clar...
0.029146
false
2
412
2010-02-03 08:54:56.693
Rebuilding PIL with FreeType
Previously I got a suggedtion to Install the FreeType dev files and rebuild PIL again. but I have no idea how to do it. any help will be thanked for
You do it exactly the same way as you did before, but now with the FreeType-dev files installed.
0
false
1
413
2010-02-03 21:52:53.457
Python class has method "set", how to reference builtin set type?
If you have a method called "set" in a class and want to create a standard builtin "set" object somewhere else in the class, Python seems to reference the method when I do that. How can you be more specific to let Python know you mean the builtin "set", not the method "set"? More specifically, set() is being created in...
Usually method names are disambiguated from global names because you have to prefix self.. So self.set() invokes your class method and set() invokes the global set. If this doesn't help, perhaps post the code you're having trouble with.
0.16183
false
3
414
2010-02-03 21:52:53.457
Python class has method "set", how to reference builtin set type?
If you have a method called "set" in a class and want to create a standard builtin "set" object somewhere else in the class, Python seems to reference the method when I do that. How can you be more specific to let Python know you mean the builtin "set", not the method "set"? More specifically, set() is being created in...
You can refer to built-in set as __builtins__.set.
0.16183
false
3
414
2010-02-03 21:52:53.457
Python class has method "set", how to reference builtin set type?
If you have a method called "set" in a class and want to create a standard builtin "set" object somewhere else in the class, Python seems to reference the method when I do that. How can you be more specific to let Python know you mean the builtin "set", not the method "set"? More specifically, set() is being created in...
Object attributes are always accessed via a reference, so there is no way for an object attribute to shadow a builtin.
0.240117
false
3
414
2010-02-04 17:02:37.263
Need a way to count entities in GAE datastore that meet a certain condition? (over 1000 entities)
I'm building an app on GAE that needs to report on events occurring. An event has a type and I also need to report by event type. For example, say there is an event A, B and C. They occur periodically at random. User logs in and creates a set of entities to which those events can be attributed. When the user comes back...
Results of datastore count() queries and offsets for all datastore queries are no longer capped at 1000. Since Version 1.3.6
0.201295
false
1
415
2010-02-05 13:44:51.623
How to write dynamic Django models?
what i want, is to receive advices to define a re-usefull Product model, for a shopping site app, nowadays I know that the store is going to commerce with "clothing", so the product model will have a "season or collections" relationship, but in the future I should use that app to commerce with X product, e.g: "cars" wh...
One, popular, option would be to use something like tags. So you'd have the stuff that's common to all items, like an item ID, name, description, price. Then you'd have some more generic tags or described tags in another table, associated with those items. You could have a tag that represents the season, or automobi...
0
false
1
416
2010-02-05 16:55:56.177
Detect 64bit OS (windows) in Python
Does anyone know how I would go about detected what bit version Windows is under Python. I need to know this as a way of using the right folder for Program Files. Many thanks
There should be a directory under Windows 64bit, a Folder called \Windows\WinSxS64 for 64 bit, under Windows 32bit, it's WinSxS.
-0.037089
false
4
417
2010-02-05 16:55:56.177
Detect 64bit OS (windows) in Python
Does anyone know how I would go about detected what bit version Windows is under Python. I need to know this as a way of using the right folder for Program Files. Many thanks
I guess you should look in os.environ['PROGRAMFILES'] for the program files folder.
0.607538
false
4
417
2010-02-05 16:55:56.177
Detect 64bit OS (windows) in Python
Does anyone know how I would go about detected what bit version Windows is under Python. I need to know this as a way of using the right folder for Program Files. Many thanks
Many of these proposed solutions, such as platform.architecture(), fail because their results depend on whether you are running 32-bit or 64-bit Python. The only reliable method I have found is to check for the existence of os.environ['PROGRAMFILES(X86)'], which is unfortunately hackish.
0.11086
false
4
417
2010-02-05 16:55:56.177
Detect 64bit OS (windows) in Python
Does anyone know how I would go about detected what bit version Windows is under Python. I need to know this as a way of using the right folder for Program Files. Many thanks
You should be using environment variables to access this. The program files directory is stored in the environment variable PROGRAMFILES on x86 Windows, the 32-bit program files is directory is stored in the PROGRAMFILES(X86) environment variable, these can be accessed by using os.environ('PROGRAMFILES'). Use sys.getwi...
0.055601
false
4
417
2010-02-06 03:57:19.137
Building an Inference Engine in Python
I am seeking direction and attempting to label this problem: I am attempting to build a simple inference engine (is there a better name?) in Python which will take a string and - 1 - create a list of tokens by simply creating a list of white space separated values 2 - categorise these tokens, using regular expressions ...
It looks like you search for "grammar inference" (grammar induction) library.
0.386912
false
1
418
2010-02-06 04:04:50.827
How to implement an efficient infinite generator of prime numbers in Python?
This is not a homework, I am just curious. INFINITE is the key word here. I wish to use it as for p in primes(). I believe that this is a built-in function in Haskell. So, the answer cannot be as naive as "Just do a Sieve". First of all, you do not know how many consecutive primes will be consumed. Well, suppose you co...
Do a segmented sieve, where the size of a segment is determined by available memory or the maximal size of a bitset. For each segment represent the numbers in some interval [n; n + segment_size) as a bit set and sieve with all prime numbers below the square root of the upper bound. Using a bit set uses less memory than...
0.201295
false
1
419
2010-02-06 15:27:43.583
how do people normally deal with class variables in django?
I can't see any provision for this in the django docs, so how do people go about doing this. My specific case is this. I have a shopping cart, each cart instance has an invoice number field, however the invoice number is only generated if the cart goes to a paid status, so not all shopping cart instances will have an i...
The default primary key will already be a unique monotonic integer (even in SQLite if you don't delete any records), so you can just use that for it.
1.2
true
1
420
2010-02-08 15:58:51.017
Making your own statements
Is there a way to define new statements like def, with, for of my own in Python? Of course, I don't mean to override the existing statements, only create some of my own. If so, how do I do it? Can you point me to good docs on the subject?
There are programming languages that let you do this (Tcl, for example), but Python isn't one of those languages.
0.081452
false
3
421
2010-02-08 15:58:51.017
Making your own statements
Is there a way to define new statements like def, with, for of my own in Python? Of course, I don't mean to override the existing statements, only create some of my own. If so, how do I do it? Can you point me to good docs on the subject?
You can't (re)define language keywords without rewriting a compiler/interpreter/etc. What you could do perhaps is write a something like a DSL (domain-specific language) and something that translates your keyword statements into proper python statements, which might be an easier route.
0.240117
false
3
421
2010-02-08 15:58:51.017
Making your own statements
Is there a way to define new statements like def, with, for of my own in Python? Of course, I don't mean to override the existing statements, only create some of my own. If so, how do I do it? Can you point me to good docs on the subject?
No, you cannot add new syntax within a Python program. The only way to alter the language is to edit and recompile the grammar file and supporting C code, to obtain a new altered interpreter, compiler and runtime.
1.2
true
3
421
2010-02-09 08:48:47.107
cross-platform html widget for pygtk
I'm trying to write a small gui app in pygtk which needs an html-rendering widget. I'd like to be able to use it in a windows environment. Currently I'm using pywebkitgtk on my GNU/Linux system, and it works extremely well, but it seems it's not possible to use this on Windows at this time. Can anyone give me any sugg...
In my experience, having developed cross-platform applications with both PyQt and PyGTK, you should consider moving to PyQt. It comes with a browser widget by default which runs fine on all platforms, and support for non-Linux platforms is outstanding compared to PyGTK. For PyGTK, you will have to be prepared building ...
1.2
true
1
422
2010-02-09 14:13:16.810
Django: Setting one page as the main page
I'm a newbie at Django and I want to do something that I'm not sure how to do. I have a model SimplePage, which simply stands for a webpage that is visible on the website and whose contents can be edited in the admin. (I think this is similar to FlatPage.) So I have a bunch of SimplePages for my site, and I want one of...
Create MAIN_PAGE setting inside settings.py with primary key. Then create view main_page nad retrieve the main_page object from the database using the setting. EDIT: You can also do it like this: add a model, which will reference a SimplePage and point to the main page. In main page view, you will retrieve the wanted S...
1.2
true
1
423
2010-02-10 02:38:08.953
how do I iterate over a "gslist" in Python?
Let's say I get a glib gpointer to a glib gslist and would like to iterate over the latter, how would I do it? I don't even know how to get to the gslist with the gpointer for starters! Update: I found a workaround - the python bindings in this instance wasn't complete so I had to find another solution.
How is glib exposed to Python in your application? Via SWIG, ctypes or something else? You should basically use glib's own functions to iterate over a list. Something like g_slist_foreach. Just pass it the pointer and its other parameters to do the job. Again, this heavily depends on how you access glib in your Python...
1.2
true
1
424
2010-02-10 12:54:40.400
PHP / cURL problem opening remote file
We have a script which pulls some XML from a remote server. If this script is running on any server other than production, it works. Upload it to production however, and it fails. It is using cURL for the request but it doesn't matter how we do it - fopen, file_get_contents, sockets - it just times out. This also happe...
Run Wireshark and see how far the request goes. Could be a firewall issue, a DNS resolution problem, among other things. Also, try bumping your curl timeout to something much higher, like 300s, and see how it goes.
0.386912
false
1
425
2010-02-11 19:39:15.890
Associative Matrices?
I'm working on a project where I need to store a matrix of numbers indexed by two string keys. The matrix is not jagged, i.e. if a column key exists for any row then it should exist for all rows. Similarly, if a row key exists for any column then it should exist for all columns. The obvious way to express this is wit...
Why not just use a standard matrix, but then have two dictionaries - one that converts the row keys to row indices and one that converts the columns keys to columns indices. You could make your own structure that would work this way fairly easily I think. You just make a class that contains the matrix and the two dicti...
1.2
true
1
426
2010-02-12 03:40:16.957
How to improve the throughput of request_logs on Google App Engine
Downloading logs from App Engine is nontrivial. Requests are batched; appcfg.py does not use normal file IO but rather a temporary file (in reverse chronological order) which it ultimately appends to the local log file; when appending, the need to find the "sentinel" makes log rotation difficult since one must leave en...
You can increase the per-request batch size of logs. In the latest SDK (1.3.1), check out google_appengine/google/appengine/tools/appcfg.py around like 861 (RequestLogLines method of LogsRequester class). You can modify the "limit" parameter. I am using 1000 and it works pretty well.
1.2
true
1
427
2010-02-13 00:12:37.200
How do I interact with MATLAB from Python?
A friend asked me about creating a small web interface that accepts some inputs, sends them to MATLAB for number crunching and outputs the results. I'm a Python/Django developer by trade, so I can handle the web interface, but I am clueless when it comes to MATLAB. Specifically: I'd really like to avoid hosting this o...
Regarding OS compatibility, if you use the matlab version for Linux, the scripts written in windows should work without any changes. If possible, you may also consider the possibility of doing everything with python. Scipy/numpy with Matplotlib provide a complete Matlab replacement.
0.101688
false
1
428
2010-02-13 08:47:09.740
Recommended Django Deployment
Short version: How do you deploy your Django servers? What application server, front-end (if any, and by front-end I mean reverse proxy), and OS do you run it on? Any input would be greatly appreciated, I'm quite a novice when it comes to Python and even more as a server administrator. Long version: I'm migrating betwe...
At the place I rent server, they have shaved down the Ubuntu images to bare minimum. Presumably because they had to make a special image anyway with just the right drivers and such in it, but I don't know exactly. They have even removed wget and nano. So you get all the apt-get goodness and not a whole lot of "cookie-c...
0.296905
false
3
429
2010-02-13 08:47:09.740
Recommended Django Deployment
Short version: How do you deploy your Django servers? What application server, front-end (if any, and by front-end I mean reverse proxy), and OS do you run it on? Any input would be greatly appreciated, I'm quite a novice when it comes to Python and even more as a server administrator. Long version: I'm migrating betwe...
Update your question to remove the choices that don't work. If it has Python 2.4, and an installation is a headache, just take it off the list, and update the question to list the real candidates. Only list the ones that actually fit your requirements. (You don't say what your requirements are, but minimal upgrades ...
0.386912
false
3
429
2010-02-13 08:47:09.740
Recommended Django Deployment
Short version: How do you deploy your Django servers? What application server, front-end (if any, and by front-end I mean reverse proxy), and OS do you run it on? Any input would be greatly appreciated, I'm quite a novice when it comes to Python and even more as a server administrator. Long version: I'm migrating betwe...
Personally I find one of the BSD systems far superior to Linux distros for server related tasks. Give OpenBSD or perhaps FreeBSD a chance. Once you do you´ll never go back.
0
false
3
429
2010-02-15 09:42:17.037
How to read from stdin or from a file if no data is piped in Python?
I have a CLI script and want it to read data from a file. It should be able to read it in two ways : cat data.txt | ./my_script.py ./my_script.py data.txt —a bit like grep, for example. What I know: sys.argv and optparse let me read any args and options easily. sys.stdin let me read data piped in fileinput make the ...
There is no reliable way to detect if sys.stdin is connected to anything, nor is it appropriate do so (e.g., the user wants to paste the data in). Detect the presence of a filename as an argument, and use stdin if none is found.
0.201295
false
1
430
2010-02-15 19:11:23.243
Can you auto hide frames/dialogs using wxPython?
I would like to create an application that has 3-4 frames (or windows) where each frame is attached/positioned to a side of the screen (like a task bar). When a frame is inactive I would like it to auto hide (just like the Windows task bar does; or the dock in OSX). When I move my mouse pointer to the position on the e...
I think you could easily just make a window that is the same size as the desktop then do some while looping for an inactivity variable based on mouse position, then thread off a timer for loop for the 4 inactivity variables. I'd personally design it so that when they reach 0 from 15, they change size and position to be...
0
false
2
431
2010-02-15 19:11:23.243
Can you auto hide frames/dialogs using wxPython?
I would like to create an application that has 3-4 frames (or windows) where each frame is attached/positioned to a side of the screen (like a task bar). When a frame is inactive I would like it to auto hide (just like the Windows task bar does; or the dock in OSX). When I move my mouse pointer to the position on the e...
Personally, I would combine the EVT_ENTER_WINDOW and EVT_LEAVE_WINDOW that FogleBird mentioned with a wx.Timer. Then whenever it the frame or dialog is inactive for x seconds, you would just call its Hide() method.
0
false
2
431
2010-02-16 04:06:23.740
Subscription web/desktop app [PYTHON]
Firstly pardon me if i've yet again failed to title my question correctly. I am required to build an app to manage magazine subscriptions. The client wants to enter subscriber data and then receive alerts at pre-set intervals such as when the subscription of a subscriber is about to expire and also the option to view a...
I'd like to comment on the SMS alert part. First, I have to admit that I'm not familiar with Django, but I assume it to be just like most other web frameworks: request based. This might be your first problem, as the alert service needs to run independently of requests. You could of course hack together something to e...
0
false
1
432
2010-02-16 20:15:09.090
Program web applications in python without a framework?
I am just starting Python and I was wondering how I would go about programming web applications without the need of a framework. I am an experienced PHP developer but I have an urge to try out Python and I usually like to write from scratch without the restriction of a framework like flask or django to name a few.
One of the lightest-weight frameworks is mod_wsgi. Anything less is going to be a huge amount of work parsing HTTP requests to find headers and URI's and methods and parsing the GET or POST query/data association, handling file uploads, cookies, etc. As it is, mod_wsgi will only handle the basics of request parsing an...
0.265586
false
1
433
2010-02-17 16:20:52.410
Help for novice choosing between Java and Python for app with sql db
I'm going to write my first non-Access project, and I need advice on choosing the platform. I will be installing it on multiple friends' and family's computers, so (since I'm sure many, many platforms would suffice just fine for my app), my highest priority has two parts: 1) ease of install for the non-technical user a...
If you're going to install only (or mostly) on Windows, I'd go with .Net. If you have experience with C++, then C# would be natural to you, but if you're comfortable with VBA, you can try VB.NET, but if you prefer Python, then there is IronPython or can give a try to IronRuby, but the best of all is you can mix them a...
1.2
true
2
434
2010-02-17 16:20:52.410
Help for novice choosing between Java and Python for app with sql db
I'm going to write my first non-Access project, and I need advice on choosing the platform. I will be installing it on multiple friends' and family's computers, so (since I'm sure many, many platforms would suffice just fine for my app), my highest priority has two parts: 1) ease of install for the non-technical user a...
The largest issue I can think of is the need to install an interpreter. With Java, a lot of people will already have that interpreter installed, although you won't necessarily know which version. It may be wise to include the installer for Java with the program. With Python, you're going to have to install the interpr...
0.081452
false
2
434
2010-02-19 08:41:25.437
How to open a Pyqt 3.3 ui file with QtDesigner 4?
I've a PyQt 4 installed (I can't find PyQt 3 for Windows) and I would like to open a QtDesigner ui file which has been created with QtDesigner 3.3. When I open this file I've the following message: Please use uic3 -convert to convert to Qt4 Unfortunately, I don't see the uic3 tool in the bin folder of my install. Does ...
Try finding pyuic3 or rather pyuic4. Since you are using PyQt all your qt tools have py in front (like pyrcc4 or pyuicc4). I am not sure, that there are pyqt3 binaries for windows. Are you sure that Phil Thompson did PyQt3 also for windows at the time? If so, they would be on riverbank site, I guess, but I can't find t...
0.201295
false
1
435
2010-02-19 13:28:51.633
how to have global variables among different modules in Python
I investigated that scope of global variables in python is limited to the module. But I need the scope to be global among different modules. Is there such a thing? I played around __builtin__ but no luck. thanks in advance!
Python does not support globals shared between several modules: this is a feature. Code that implicitly modifies variables used far away is confusing and unmaintainable. The real solution is to encapsulate all state within a class and pass its instance to anything that has to modify it. This can make code clearer, more...
0.386912
false
2
436
2010-02-19 13:28:51.633
how to have global variables among different modules in Python
I investigated that scope of global variables in python is limited to the module. But I need the scope to be global among different modules. Is there such a thing? I played around __builtin__ but no luck. thanks in advance!
Scopes beyond the local must be written to via a reference to the scope, or after a global or nonlocal (3.x+) directive.
0
false
2
436
2010-02-19 16:31:00.477
Scripting language for trading strategy development
I'm currently working on a component of a trading product that will allow a quant or strategy developer to write their own custom strategies. I obviously can't have them write these strategies in natively compiled languages (or even a language that compiles to a bytecode to run on a vm) since their dev/test cycles hav...
Existing languages are "a little "low level" for my target users." Yet, all you need is "a minimum of support for looping, simple arithmatic, logical expression evaluation" I don't get the problem. You only want a few features. What's wrong with the list of languages you provided? They actually offer those features?...
0
false
5
437
2010-02-19 16:31:00.477
Scripting language for trading strategy development
I'm currently working on a component of a trading product that will allow a quant or strategy developer to write their own custom strategies. I obviously can't have them write these strategies in natively compiled languages (or even a language that compiles to a bytecode to run on a vm) since their dev/test cycles hav...
Define the language first -- if possible, use the pseudo-language called EBN, it's very simple (see the Wikipedia entry). Then once you have that, pick the language. Almost certainly you will want to use a DSL. Ruby and Lua are both really good at that, IMO. Once you start working on it, you may find that you go back...
0
false
5
437
2010-02-19 16:31:00.477
Scripting language for trading strategy development
I'm currently working on a component of a trading product that will allow a quant or strategy developer to write their own custom strategies. I obviously can't have them write these strategies in natively compiled languages (or even a language that compiles to a bytecode to run on a vm) since their dev/test cycles hav...
I would use Common Lisp, which supports rapid development (you have a running image and can compile/recompile individual functions) and tailoring the language to your domain. You would provide functions and macros as building blocks to express strategies, and the whole language would be available to the user for combi...
0
false
5
437
2010-02-19 16:31:00.477
Scripting language for trading strategy development
I'm currently working on a component of a trading product that will allow a quant or strategy developer to write their own custom strategies. I obviously can't have them write these strategies in natively compiled languages (or even a language that compiles to a bytecode to run on a vm) since their dev/test cycles hav...
This might be a bit simplistic, but a lot of quant users are used to working with Excel & VBA macros. Would something like VBSCript be usable, as they may have some experience in this area.
0
false
5
437
2010-02-19 16:31:00.477
Scripting language for trading strategy development
I'm currently working on a component of a trading product that will allow a quant or strategy developer to write their own custom strategies. I obviously can't have them write these strategies in natively compiled languages (or even a language that compiles to a bytecode to run on a vm) since their dev/test cycles hav...
Custom-made modules are going to be needed, no matter what you choose, that define your firm's high level constructs. Here are some of the needs I envision -- you may have some of these covered already: a way to get current positions, current and historical quotes, previous performance data, etc... into the applicati...
0.037089
false
5
437
2010-02-19 20:51:01.430
How do quickly search through a .csv file in Python
I'm reading a 6 million entry .csv file with Python, and I want to be able to search through this file for a particular entry. Are there any tricks to search the entire file? Should you read the whole thing into a dictionary or should you perform a search every time? I tried loading it into a dictionary but that took a...
You can't go directly to a specific line in the file because lines are variable-length, so the only way to know when line #n starts is to search for the first n newlines. And it's not enough to just look for '\n' characters because CSV allows newlines in table cells, so you really do have to parse the file anyway.
0.067922
false
2
438
2010-02-19 20:51:01.430
How do quickly search through a .csv file in Python
I'm reading a 6 million entry .csv file with Python, and I want to be able to search through this file for a particular entry. Are there any tricks to search the entire file? Should you read the whole thing into a dictionary or should you perform a search every time? I tried loading it into a dictionary but that took a...
my idea is to use python zodb module to store dictionaty type data and then create new csv file using that data structure. do all your operation at that time.
0
false
2
438
2010-02-19 21:23:47.400
Building a wiki application?
I'm building this app in Python with Django. I would like to give parts of the site wiki like functionality, but I don't know how to go on about reliability and security. Make sure that good content is not ruined Check for quality Prevent spam from invading the site The items requiring wiki like functionality are jus...
Assuming that there will be a community of users you can provide good tools for them to spot problems and easily undo damage. The most important of these is to provide a Recent Changes page that summarizes recent edits. Then each page that can be edited should retain prior versions of the page that can be used to repla...
0.135221
false
2
439
2010-02-19 21:23:47.400
Building a wiki application?
I'm building this app in Python with Django. I would like to give parts of the site wiki like functionality, but I don't know how to go on about reliability and security. Make sure that good content is not ruined Check for quality Prevent spam from invading the site The items requiring wiki like functionality are jus...
Make sure that good content is not ruined = version each edit and allow roll-backs. Check for quality = get people to help with that Prevent spam from invading the site = get people to help with that, require login, add a captcha if need be, use nofollow for all links
0.135221
false
2
439
2010-02-19 21:32:25.673
Problem with asyn icmp ping
I'm writing service in python that async ping domains. So it must be able to ping many ip's at the same time. I wrote it on epoll ioloop, but have problem with packets loss. When there are many simultaneous ICMP requests much part of replies on them didn't reach my servise. What may cause this situation and how i can m...
A problem you might be having is due to the fact that ICMP is layer 3 of the OSI model and does not use a port for communication. In short, ICMP isn't really designed for this. The desired behavior is still possible but perhaps the IP Stack you are using is getting in the way and if this is on a Windows system then 10...
1.2
true
1
440
2010-02-20 22:12:01.857
Specifying python interpreter from virtualenv in emacs
Today I've been trying to bring more of the Python related modes into my Emacs configuration but I haven't had much luck. First what I've noticed is that depending on how Emacs is launched (terminal vs from the desktop), the interpreter it decides to use is different. launched from KDE menu: M-! which python gives /us...
So it seems that python-shell does the right thing by picking up the environment settings, whereas py-shell does not. python-shell is provided by python.el and py-shell is provided by python-mode.el , There's bug reports etc related to this, so I'm just not going to use py-shell for now. Figured I'd close the loop on t...
1.2
true
1
441
2010-02-21 18:50:17.927
Exchange Oauth Request Token for Access Token fails Google API
I am having trouble exchanging my Oauth request token for an Access Token. My Python application successfully asks for a Request Token and then redirects to the Google login page asking to grant access to my website. When I grant access I retrieve a 200 status code but exchanging this authorized request token for an ac...
When you're exchanging for the access token, the oauth_verifier parameter is required. If you don't provide that parameter, then google will tell you that the token is invalid.
1.2
true
1
442
2010-02-22 13:27:00.007
How to handle user mangement in Django for groups that has same access but different rules?
Background information: I have created an internal site for a company. Most of the work has gone into making calculation tools that their sale persons can use to make offers for clients. Create pdf offers and contracts that can be downloaded, compare prices etc. All of this is working fine. Now their sale persons have ...
If I'm understanding you correctly, it seems like you want to have two different groups have access to all the same views, but they will see different numbers. You can achieve this effect by making separate templates for the different groups, and then loading the appropriate template for each view depending on the grou...
0
false
1
443
2010-02-22 13:49:20.610
How do I store a dict/list in a database?
If I have a dictionary full of nested stuff, how do I store that in a database, as a string? and then, convert it back to a dictionary when I'm ready to parse? Edit: I just want to convert it to a string...and then back to a dictionary.
There are any number of serialization methods out there, JSON is readable, reasonably compact, supported natively, and portable. I prefer it over pickle, since the latter can execute arbitrary code and potentially introduce security holes, and because of its portability. Depending on your data's layout, you may also b...
0.16183
false
3
444
2010-02-22 13:49:20.610
How do I store a dict/list in a database?
If I have a dictionary full of nested stuff, how do I store that in a database, as a string? and then, convert it back to a dictionary when I'm ready to parse? Edit: I just want to convert it to a string...and then back to a dictionary.
You have two options use a standard serialization format (json, xml, yaml, ...) pros: you can access with a any language that can parse those formats (on the worst case you can write your own parser) cons: could be slower to save and load the data (this depends of the implementation mostly) use cPickle: pros: easy ...
0.081452
false
3
444
2010-02-22 13:49:20.610
How do I store a dict/list in a database?
If I have a dictionary full of nested stuff, how do I store that in a database, as a string? and then, convert it back to a dictionary when I'm ready to parse? Edit: I just want to convert it to a string...and then back to a dictionary.
Options: 1) Pickling 2) XML 3) JSON others I am sure. It has a lot to do on how much portability means to you.
0.3154
false
3
444
2010-02-22 18:17:39.080
Python: How to Access Linux Paths
Using Python, how does one parse/access files with Linux-specific features, like "~/.mozilla/firefox/*.default"? I've tried this, but it doesn't work. Thanks
It's important to remember: use of the tilde ~ expands the home directory as per Poke's answer use of the forward slash / is the separator for linux / *nix directories by default, *nix systems such as linux for example has a wild card globbing in the shell, for instance echo *.* will return back all files that match t...
0.201295
false
1
445
2010-02-22 21:22:10.427
python logging to database
I'm seeking a way to let the python logger module to log to database and falls back to file system when the db is down. So basically 2 things: How to let the logger log to database and how to make it fall to file logging when the db is down.
Old question, but dropping this for others. If you want to use python logging, you can add two handlers. One for writing to file, a rotating file handler. This is robust, and can be done regardless if the dB is up or not. The other one can write to another service/module, like a pymongo integration. Look up logging.c...
0.16183
false
1
446
2010-02-22 23:18:29.530
How do I find missing dates in a list of sorted dates?
In Python how do I find all the missing days in a sorted list of dates?
Put the dates in a set and then iterate from the first date to the last using datetime.timedelta(), checking for containment in the set each time.
0.04532
false
1
447
2010-02-23 12:08:12.327
print_r functionality in iPython
Is there a way to get PHP-like print_r(object) funcionality in iPython? I know I can use '?' to get info about an object, but how do I view the values of the object?
dir(object) will give you all its attribute names.
0.201295
false
1
448