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,743,222 | 2010-09-18T19:44:00.000 | 0 | 0 | 1 | 0 | python,datetime | 66,881,576 | 9 | false | 0 | 0 | I use data.strftime('%y-%m-%d') with lambda to transfer column to date | 2 | 899 | 0 | How do I convert a datetime.datetime object (e.g., the return value of datetime.datetime.now()) to a datetime.date object in Python? | How do I convert a datetime to date? | 0 | 0 | 0 | 961,155 |
3,743,329 | 2010-09-18T20:13:00.000 | 5 | 0 | 0 | 0 | python,database,django,class | 3,743,351 | 2 | true | 1 | 0 | Do not store code in the database!!!
Imagine a class with a malicious __init__ method finding it's way in your "class repository" in the database. This means whoever has write access to those database tables has the ability to read any file from your web server and even nuke it's file system, since they have the abilit... | 1 | 2 | 0 | I'm using Django and want to be able to store classes in a database for things like forms and models so that I can easily make them creatable through a user interface since they are just stored in the database as opposed to a regular file. I don't really know a whole lot about this and am not sure if this is a situatio... | Python, how to instantiate classes from a class stored in a database? | 1.2 | 0 | 0 | 262 |
3,743,532 | 2010-09-18T21:14:00.000 | 7 | 0 | 1 | 0 | python,ruby,dictionary,symbols,language-comparisons | 3,743,553 | 5 | false | 0 | 0 | No, there is no equivalent.
No you can use every hashable object as dictionary key. | 1 | 81 | 0 | Is there a Python equivalent to Ruby symbols?
If so then what is it?
If not then are we stuck with using strings as our keys in dictionaries only? | Is there a Python equivalent to Ruby symbols? | 1 | 0 | 0 | 17,962 |
3,743,653 | 2010-09-18T21:53:00.000 | 1 | 0 | 1 | 0 | python,regex,parsing,delimiter | 3,743,911 | 4 | false | 0 | 0 | I don't know your problem domain, so I don't know what forms of regex you're expecting, but it seems to me you should keep your section formatting as it is. A regex that starts with [ and ends with ] and has no square brackets in between is quite unusual. It can only match a single character. So leave the section he... | 1 | 2 | 0 | I have a config file that the user can specify sections, and then within those section they can specify regular expressions. I have to parse this config file and separate the regex's into the various sections.
Is there an easy way to delimitate a regex from a section header? I was thinking just the standard
[section]
... | easy way to determine if a string CAN'T be a valid regex | 0.049958 | 0 | 0 | 115 |
3,743,812 | 2010-09-18T22:43:00.000 | 0 | 0 | 0 | 1 | python,linux,windows,shell,osx-leopard | 3,743,825 | 2 | false | 0 | 0 | All of those operating systems should support a PATH environment variable which specifies directories that have executables that should be available everywhere. Make your script executable by chmod +x and place it into one of those directories (or add a new one to your PATH - I have ~/bin for instance).
I don't know ho... | 1 | 3 | 0 | Can someone tell me how to make my script callable in any directory?
My script simply returns the number of files in a directory. I would like it to work in any directory by invoking it, instead of first being copied there and then typing python myscript.py
I am using Mac OS X, but is there a common way to get it insta... | Making Python script accessible system wide | 0 | 0 | 0 | 3,533 |
3,744,180 | 2010-09-19T01:30:00.000 | 1 | 0 | 1 | 0 | java,javascript,python,methods,properties | 3,744,184 | 9 | false | 0 | 0 | Typically properties are accessors, and methods perform some sort of action. Going on this assumption, it's cheap to use a property, expensive to use a method.
Foo.Bar, for example, would indicate to me that it would return a value, like a string, without lots of overhead.
Foo.Bar() (or more likely, Foo.GetBar()), on t... | 3 | 5 | 0 | One of my most common bugs is that I can never remember whether something is a method or a property, so I'm constantly adding or removing parentheses.
So I was wondering if there was good logic behind making the difference between calling on an object's properties and methods explicit.
Obviously, it allows you to have ... | Why does java/javascript/python force the use of () after a method name, even if it takes no arguments? | 0.022219 | 0 | 0 | 454 |
3,744,180 | 2010-09-19T01:30:00.000 | 3 | 0 | 1 | 0 | java,javascript,python,methods,properties | 3,744,187 | 9 | false | 0 | 0 | I think you answered it yourself:
One of my most common bugs is that I can never remember whether something is a method or a property, so I'm constantly adding or removing parentheses.
Consider the following:
if (colorOfTheSky == 'blue')
vs:
if (colorOfTheSky() == 'blue')
We can tell just by looking that the first ch... | 3 | 5 | 0 | One of my most common bugs is that I can never remember whether something is a method or a property, so I'm constantly adding or removing parentheses.
So I was wondering if there was good logic behind making the difference between calling on an object's properties and methods explicit.
Obviously, it allows you to have ... | Why does java/javascript/python force the use of () after a method name, even if it takes no arguments? | 0.066568 | 0 | 0 | 454 |
3,744,180 | 2010-09-19T01:30:00.000 | 3 | 0 | 1 | 0 | java,javascript,python,methods,properties | 3,744,267 | 9 | false | 0 | 0 | If you're having troubles, distinguishing between your properties and methods, you're probably not naming them very well.
In general, your methods should have a verb in them: i.e. write, print, echo, open, close, get, set, and property names should be nouns or adjectives: name, color, filled, loaded.
It's very importan... | 3 | 5 | 0 | One of my most common bugs is that I can never remember whether something is a method or a property, so I'm constantly adding or removing parentheses.
So I was wondering if there was good logic behind making the difference between calling on an object's properties and methods explicit.
Obviously, it allows you to have ... | Why does java/javascript/python force the use of () after a method name, even if it takes no arguments? | 0.066568 | 0 | 0 | 454 |
3,744,792 | 2010-09-19T06:49:00.000 | 0 | 0 | 1 | 0 | python,python-internals | 3,809,298 | 4 | false | 0 | 0 | I don't do any error checking here because (1) this is just for debugging/profiling/hacking (2) this exact process was 'just' completed or the code wouldn't be running. Is there a problem with this?
Yes:
Start a program
Wait unit it imports a particular module foo.py
Edit foo.py
Now code that's loaded in a Python pr... | 1 | 6 | 0 | I'm writing some code to determine the name that an object is assigned to. This is for general debugging work and to further familiarize myself with python internals.
I have it structured as a class decorator so that all instances of that class will have their names recorded if it is possible to do. The code is fairly ... | Accessing the name that an object being created is assigned to | 0 | 0 | 0 | 327 |
3,745,724 | 2010-09-19T12:47:00.000 | 0 | 0 | 0 | 0 | python,django,web-services | 3,746,062 | 2 | false | 1 | 0 | There are so many things like SOAPpy, XML-RPC, JSON-RPC RESTful, web service.
This should give you a clue - there are different services out there that use one or more of these mechanisms.
Basically all i want to know is what is the standard way of implementing web service in Python/Django and has anyone implemented... | 1 | 0 | 0 | I am trying to explore more about web service in Python/Django and to be honest i am quite confused. There are so many things like SOAPpy, XML-RPC, JSON-RPC RESTful, web service.
Basically all i want to know is what is the standard way of implementing web service in Python/Django and has anyone implemented in live pro... | Python / Django Web service Confusion | 0 | 0 | 0 | 1,172 |
3,745,917 | 2010-09-19T13:48:00.000 | 2 | 0 | 1 | 1 | python,windows,pyqt4,startup | 3,745,929 | 2 | true | 0 | 0 | You can just place a shortcut in the "Startup" folder, in the windows start menu. | 1 | 2 | 0 | I'm writing a program using python 2.6 and pyqt4. I want this program to automatically start whenever windows stars (something like uTorrent client). How do I make this work? I am using windows 7. | How to write a python program that automatically starts when windows start? | 1.2 | 0 | 0 | 2,821 |
3,746,090 | 2010-09-19T14:29:00.000 | 1 | 1 | 1 | 0 | python,deployment,packages | 3,746,128 | 1 | false | 0 | 0 | I would run the program and do proper try..except at place of first use of feature in informative message to user for what is missing (not installed db, installed but not running etc) | 1 | 4 | 0 | I am building a system that has dependencies such as Apache, Postgresql, and mod_wsgi. As part of my deployment process, I would like to write a sanity-checking script that tries to determine whether the server environment conforms to various assumptions, the most basic of which is whether the dependencies are installe... | Best practices for programmatically sanity checking environment using Python? | 0.197375 | 0 | 0 | 533 |
3,746,221 | 2010-09-19T15:11:00.000 | 4 | 1 | 1 | 1 | python,perl,awk,tcl,expect | 3,747,275 | 4 | false | 0 | 0 | ajsie asks, "Which other automation tools are you talking about?"
I'll answer a different question: "which other contexts do I have in mind"? The answer: any interactive environment OTHER than a stdio one. Expect is NOT for automation of GUI points-and-clicks, for example. Expect is also not available for Win* n... | 2 | 8 | 0 | I am amazed by how Expect (TCL) can automate a lot of things I normally could not do.
I thought I could dig deeper into Expect by reading a book, but before I do that I want to ask if there are other solutions/languages that could do what Expect does?
Eg. I have read that people compare Expect with Awk and also Perl.
C... | Other solutions/languages that are superior to the TCL-based Expect? | 0.197375 | 0 | 0 | 1,532 |
3,746,221 | 2010-09-19T15:11:00.000 | 9 | 1 | 1 | 1 | python,perl,awk,tcl,expect | 3,747,203 | 4 | true | 0 | 0 | There's more to it.
Bluntly, the original Expect--the Tcl Expect--is the best one. It better supports "interact" and various pty eccentricities than any of its successors. It has no superior, for what it does.
HOWEVER, at the same time, most Expect users exploit such a small fraction of Expect's capabilities that thi... | 2 | 8 | 0 | I am amazed by how Expect (TCL) can automate a lot of things I normally could not do.
I thought I could dig deeper into Expect by reading a book, but before I do that I want to ask if there are other solutions/languages that could do what Expect does?
Eg. I have read that people compare Expect with Awk and also Perl.
C... | Other solutions/languages that are superior to the TCL-based Expect? | 1.2 | 0 | 0 | 1,532 |
3,746,520 | 2010-09-19T16:34:00.000 | 7 | 0 | 1 | 0 | python,vb.net | 3,746,627 | 1 | false | 0 | 0 | VB is flamed less for being easy than for the population of programmers who use it. VB is perceived as being for people one step up from writing Excel macros, often in in-house corporate environments, churning out crapware. Being a Microsoft product doesn't help.
VB is also seen as being the low-end language in the Mi... | 1 | 4 | 0 | I have always wondered about this and seen this among lots of programmers. Why is a VB programmer or VB code easily dismissed as too noobish and easy while the same does not apply to Python or Python code? After all, isn't Python as easy as VB is? And it does provide drag-n-drop GUI application building also. So why is... | Why is VB flamed for being easy and yet Python is not? | 1 | 0 | 0 | 309 |
3,746,790 | 2010-09-19T17:50:00.000 | 0 | 0 | 0 | 0 | python,django,django-models | 3,746,881 | 2 | false | 1 | 0 | If you are okay with changing these setting programmatically via settings.py you should do that. However, if you want to change these settings via the Admin Console, you should use models. | 1 | 1 | 0 | I want to keep some global settings for my project in Django. I need to have access to these settings from the code. For example, I need to set a current theme for my site that I can set using admin console or from the code. Or I need to set a tagline that will show in the header of all pages. I suppose I should use mo... | How to work with settings in Django | 0 | 0 | 0 | 108 |
3,747,402 | 2010-09-19T20:44:00.000 | 0 | 0 | 1 | 0 | python,user-interface | 3,747,540 | 1 | false | 0 | 0 | uninstalling Python AND manually deleting the Python installation folder (which isn't removed by default when uninstalling) allowed me to re-install Python successfully | 1 | 1 | 0 | For some reason my Python IDLE interface stopped working :( I ran a some code which seems to have been buggy since i couldn't even exit it with ctrl+F6. I had to close the IDLE window down and since then it won't launch anymore. Reinstalling Python didn't make any difference....any ideas to help me get it runnig again ... | Python27 IDLE GUI stopped working | 0 | 0 | 0 | 345 |
3,747,772 | 2010-09-19T22:36:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine | 3,747,783 | 2 | true | 1 | 0 | Try updating your model so that the Districts field is not required (i.e., pass required=False as a keyword parameter to the Districts field). Then the validator shouldn't complain about the existing entities and you should be able to delete the entities.
Alternatively, if you know the keys for the entities you want t... | 2 | 3 | 0 | I am trying to delete records in the datastore. Unfortunately, whenever I try to delete the items, it gives me a BadValueError, saying Districts (one of the columns) is required. Because of an issue with the bulk loader, Districts is null for all of the rows...but I still need to clean out the datastore to try to fix... | Getting BadValueError on Google App Engine Datastore Delete | 1.2 | 0 | 0 | 481 |
3,747,772 | 2010-09-19T22:36:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine | 3,747,781 | 2 | false | 1 | 0 | Change your entities/models so that Districts is no longer a required property? | 2 | 3 | 0 | I am trying to delete records in the datastore. Unfortunately, whenever I try to delete the items, it gives me a BadValueError, saying Districts (one of the columns) is required. Because of an issue with the bulk loader, Districts is null for all of the rows...but I still need to clean out the datastore to try to fix... | Getting BadValueError on Google App Engine Datastore Delete | 0 | 0 | 0 | 481 |
3,748,720 | 2010-09-20T04:31:00.000 | 7 | 1 | 1 | 0 | python | 3,748,735 | 2 | false | 0 | 0 | Assuming you're already familiar with another programming language:
Time to learn python basics: 1 week.
Total time to figure out email module: 2 days.
Total time to figure out httplib module: 1 days.
Total time to figure out creating database: 3 days.
Total time to learn about SQL: 2 weeks.
Total time to figure o... | 2 | 1 | 0 | I have been wanting to get into Python for a while now and have accumulated quite a few links to tutorials, books, getting started guides and the like. I have done a little programming in PERL and PHP, but mostly just basic stuff.
I'd like to be able to set expectations for myself, so based on the following requirement... | Complete newbie excited about Python. How hard would this app be to build? | 1 | 0 | 0 | 221 |
3,748,720 | 2010-09-20T04:31:00.000 | 0 | 1 | 1 | 0 | python | 3,748,731 | 2 | false | 0 | 0 | Assuming that you don't write everything from the ground up and reuse basic components, this shouldn't be too hard. Probably the most difficult aspect will be authentication, because that requires domain specific knowledge and is hard to get right in any language. I would suggest starting with the basic functionality, ... | 2 | 1 | 0 | I have been wanting to get into Python for a while now and have accumulated quite a few links to tutorials, books, getting started guides and the like. I have done a little programming in PERL and PHP, but mostly just basic stuff.
I'd like to be able to set expectations for myself, so based on the following requirement... | Complete newbie excited about Python. How hard would this app be to build? | 0 | 0 | 0 | 221 |
3,749,270 | 2010-09-20T07:04:00.000 | 0 | 0 | 0 | 1 | python,header,exe | 3,749,339 | 3 | false | 0 | 0 | Of course it is possible to write a Python script to retrieve header information from an XYZ file. Three simple steps:
(1) Find docs for the header part of an XYZ file; read them.
(2) Read the docs for the Python struct module or ctypes module or both.
(3) Write and test the script.
Which step are you having trouble wi... | 1 | 2 | 0 | I was wondering whether it would be possible to write a python script that retrieves header information from an .exe file. I tried googling but didn't really find any results that were usable.
Thanks.
Sept | Retrieve header information from exe | 0 | 0 | 0 | 3,428 |
3,749,729 | 2010-09-20T08:26:00.000 | 0 | 1 | 0 | 0 | python,code-coverage | 3,749,902 | 2 | false | 0 | 0 | I don't know how you can check for inter-language unit test coverage. You will have to tweak the framework yourself to achieve something like this.
That said, IMHO this is a wrong approach to take for various reasons.
Inter-language disqualifies the tests from being described as "unit". These are functional tests. an... | 1 | 0 | 0 | I have a python script which generates some reports based on a DB.
I am testing the script using java Db Units which call the python script.
My question is how can I verify the code coverage for the python script while I am running the DB Units? | While running some java DB Unit tests which call a python script how can I test the code coverage for the python script? | 0 | 0 | 0 | 172 |
3,752,154 | 2010-09-20T13:58:00.000 | 0 | 0 | 1 | 0 | python | 3,777,996 | 1 | true | 1 | 0 | should be 'className' in IE... | 1 | 0 | 0 | I wrote the sentence as follows:
allLinkValues = ie.getLinksValue('class')
but the return values are all None, don't know why... | how to get the value of the 'class' attribute in a link? | 1.2 | 0 | 0 | 34 |
3,753,612 | 2010-09-20T16:50:00.000 | 2 | 0 | 0 | 0 | python,winapi,pywin32,windows | 3,762,323 | 2 | false | 0 | 1 | So far the only possible solution I see is to use SetWindowsHookEx. Pywin32 doesn't interface this, so I think I'll have to do something like this:
Write a C extension module. It has a function like setCallback which takes a python function to be called when the drag event happens.
Write a C DLL that contains the act... | 1 | 2 | 0 | Is there a way to detect when a window that doesn't belong to my application is being dragged in windows using python/pywin32? I want to set it up so that when I drag a window whose title matches a pattern near the desktop edge, it snaps to the edge when the mouse is let go. I could write code to snap all windows with ... | python+win32: detect window drag | 0.197375 | 0 | 0 | 1,517 |
3,753,982 | 2010-09-20T17:47:00.000 | 1 | 1 | 0 | 0 | java,python,email,scheduling | 3,754,181 | 6 | false | 0 | 0 | I don't think standard SMTP protocol has such a feature, so if you want to be platform-independent, you will have to search for another solution.
How about writing your message to a queue (local database, for example) with a timestamp and then have some program watching it periodically and send pending emails out?
Is t... | 2 | 1 | 0 | I'm writing an application and I'd like it to somehow schedule an email to be sent at a later date (likely an hour after it is run). The programming language will be Python or Java.
Any open-source tools available for that purpose?
EDIT: I forgot to mention it's to be run after a test run, so the application will alrea... | Scheduling a time in the future to send an email in Java or Python | 0.033321 | 0 | 0 | 4,238 |
3,753,982 | 2010-09-20T17:47:00.000 | 2 | 1 | 0 | 0 | java,python,email,scheduling | 3,754,446 | 6 | false | 0 | 0 | You can build the actual email to send, using JavaMail (with attachments and all), save it to disk, and then delegate a "mail foo@bar.com < textfilefromjavamail" to the Linux batch system.
There is an "at" command which will most likely do exactly what you want. | 2 | 1 | 0 | I'm writing an application and I'd like it to somehow schedule an email to be sent at a later date (likely an hour after it is run). The programming language will be Python or Java.
Any open-source tools available for that purpose?
EDIT: I forgot to mention it's to be run after a test run, so the application will alrea... | Scheduling a time in the future to send an email in Java or Python | 0.066568 | 0 | 0 | 4,238 |
3,754,848 | 2010-09-20T19:33:00.000 | 1 | 1 | 0 | 1 | python,permissions | 3,754,917 | 3 | false | 0 | 0 | Try cp -a from_dir to_dir. It will maintain the permissions from the first directory. | 1 | 1 | 0 | I'm curious how to copy the permission from directory to another.
Any idea?
Thanks | How to copy directory permissions | 0.066568 | 0 | 0 | 1,862 |
3,755,493 | 2010-09-20T21:03:00.000 | 3 | 0 | 1 | 0 | .net,python,ironpython | 3,755,511 | 1 | true | 0 | 0 | you need to deploy the python libraries you're referencing along with your dll. it wont be included statically in there for you. | 1 | 1 | 0 | If I reference the Python Standard Library using IronPython do I have to deploy any Python related libraries or runtimes along with my .net dll? Or, can I just deploy the dll? | Does IronPython .net based DLL need to be deployed with Python Standard Library if it uses the Standard Library? | 1.2 | 0 | 0 | 177 |
3,758,440 | 2010-09-21T08:16:00.000 | 3 | 1 | 0 | 0 | python,ruby,twitter | 3,758,455 | 4 | false | 1 | 0 | I know of twissandra which is an open source clone. Of course I doubt it meets your need of feature rich implementations. | 1 | 6 | 0 | Is there any production ready open source twitter clones written in Ruby or Python ?
I am more interested in feature rich implementations, not just bare bones twitter like messages (e.g.: APIs, FBconnect, Notifications, etc)
Thanks ! | Open source Twitter clone (in Ruby/Python) | 0.148885 | 0 | 0 | 2,578 |
3,758,468 | 2010-09-21T08:20:00.000 | 1 | 0 | 0 | 0 | python,wxpython | 3,758,497 | 1 | true | 0 | 1 | I think you could do 2 progress bars, one for files, and second for line in just read file. This will be similar to copy progress in TotalCommander.
If you want one progress bar you could just count file sizes using os.path.getsize(path) and then show how many bytes have you processed/bytes total. | 1 | 0 | 0 | I have wxpython application that run over a list of files on some directory and proccess the files line by line
I need to build a progress bar that show the status how records already done with wx.gauge control
I need to count the number of the records before i use the wx.guage in order to build the progress bar ,
is ... | counting records of files on directory with python | 1.2 | 0 | 0 | 222 |
3,758,509 | 2010-09-21T08:28:00.000 | 9 | 0 | 0 | 0 | python,django,customization,admin | 3,759,347 | 2 | true | 1 | 0 | Slow down. Relax. Follow the Django philosophy.
You have an "app". It presents data. Focus on presentation.
You have a default, built-in admin for your "app". It updates data and it's already there.
If the admin app doesn't meet your needs update Forms and update Models to get close. But don't strain yourself me... | 1 | 1 | 0 | I am new to django and have gotten a bit stuck on trying to make the admin site work as I'd like it to. I am wondering if for making the admin functionality I want it is better to make a custom admin app with a template inheriting from admin/base_site.html, using the frontend login with a redirect when is_staff is tru... | Customizing Django Admin Interface functionality | 1.2 | 0 | 0 | 4,748 |
3,758,648 | 2010-09-21T08:48:00.000 | 13 | 0 | 0 | 0 | python,pyqt,pyside | 3,761,216 | 1 | true | 0 | 1 | u need to import QtCore
so the code will look like this :
self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
whenever you see Qt.something put in mind that they are talking about the Qt class inside QtCore module .
hope this helps | 1 | 7 | 0 | I've been looking for how to do this and I've found places where the subject comes up, but none of the suggestions actually work for me, even though they seem to work out okay for the questioner (they don't even list what to import). I ran across self.setWindowFlags(Qt.FramelessWindowHint) but it doesn't seem to work r... | Setting window style in PyQT/PySide? | 1.2 | 0 | 0 | 6,028 |
3,758,658 | 2010-09-21T08:49:00.000 | 1 | 0 | 0 | 0 | javascript,jquery,python,matplotlib,hyperlink | 3,759,346 | 2 | false | 0 | 0 | You can do this with an imagemap or HTML element overlay controlled by JavaScript/jQuery.
Essentially, send your chart data to the page along with the chart image, and use JS to create the elements with the links according to the specification of the data.
It's a bit harder than the bar graphs I've done this to before,... | 1 | 3 | 0 | I want to do a pie chart in matplotlib.
This pie chart will be a representation of two variables: male and female.
That's easy to do :)
What I would like to do next, I'm not even sure if it's possible to do with matplotlib, I would like to make these two variables clickable so if I click on male, I would see another pa... | how to create hyperlink in piechart | 0.099668 | 0 | 0 | 1,491 |
3,759,003 | 2010-09-21T09:37:00.000 | 0 | 0 | 0 | 0 | python,django,google-app-engine,django-models,google-cloud-datastore | 3,808,459 | 3 | true | 1 | 0 | Two possible solutions:
Check if the reference still exists, before you access it:
if not obj.reference:
# Referenced entity was deleted
When you delete a model object that may be referenced, query all models that might reference it, and set their reference property to None. | 3 | 1 | 0 | I am working on an application on Django and google application engine. In my application I have several models with several ReferenceProperty fields. The issue is that if any of the ReferenceProperty field gets deleted it produces a ReferenceProperty related errors in all the other models where it has been used. What... | Django Google app engine reference issues | 1.2 | 0 | 0 | 249 |
3,759,003 | 2010-09-21T09:37:00.000 | 0 | 0 | 0 | 0 | python,django,google-app-engine,django-models,google-cloud-datastore | 3,759,035 | 3 | false | 1 | 0 | When I have the same problem ago, I could not find a general solution. The only way I found is to do try/except for every reference property. If you find another answer post it here. | 3 | 1 | 0 | I am working on an application on Django and google application engine. In my application I have several models with several ReferenceProperty fields. The issue is that if any of the ReferenceProperty field gets deleted it produces a ReferenceProperty related errors in all the other models where it has been used. What... | Django Google app engine reference issues | 0 | 0 | 0 | 249 |
3,759,003 | 2010-09-21T09:37:00.000 | 1 | 0 | 0 | 0 | python,django,google-app-engine,django-models,google-cloud-datastore | 3,808,505 | 3 | false | 1 | 0 | You could also just set a flag, say deleted, on the entity you're deleting, and then leave it in the datastore. This has the advantage of avoiding all referential integrity problems in the first place, but it comes at the cost of two main disadvantages:
All your existing queries need to be changed to deal with entitie... | 3 | 1 | 0 | I am working on an application on Django and google application engine. In my application I have several models with several ReferenceProperty fields. The issue is that if any of the ReferenceProperty field gets deleted it produces a ReferenceProperty related errors in all the other models where it has been used. What... | Django Google app engine reference issues | 0.066568 | 0 | 0 | 249 |
3,759,021 | 2010-09-21T09:39:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine | 3,759,934 | 1 | true | 1 | 0 | No. An entity's Key is composed of the application ID, the Kind, the path of the parent entity (if any) and either a key name or an auto-generated ID. It's not possible to have both. The entire Key is the "primary key". | 1 | 0 | 0 | I'm building a facebook app, and my users table's keyName is set to the Uid of the facebook user. I found this to be efficient because I can use db.Key.from_path() to efficiently query the datastore for a particular user instead of doing a query (where uid = x, limit = 1). This is actually my first time using key names... | is it possible to have keyname and an id for an entity in Appengine? | 1.2 | 0 | 0 | 68 |
3,760,714 | 2010-09-21T13:25:00.000 | 1 | 0 | 1 | 0 | python,user-interface | 3,762,679 | 4 | false | 0 | 0 | I Think the latest Tkinter version offers native look for Macos. WxPython and QT offers native look for macos,windows and linux. GTK is abit ugly and prone to crashes on mac cause of the X11 implentation there.
Of course you could build your own GUI , that something I am trying to do with pygame.Let me clarify , I am ... | 1 | 7 | 0 | Last time I saw, GUIs in Python were extremely ugly, how's it today?
(saw some beautiful images on google images, but I don't know if are really Python's) | How's Python GUI development today (Sep/2010)? | 0.049958 | 0 | 0 | 1,095 |
3,761,655 | 2010-09-21T15:07:00.000 | 0 | 0 | 1 | 0 | java,python,timezone,data-processing | 3,764,242 | 3 | false | 0 | 0 | In my experience with this, we've rolled the data up into hourly (or fifteen minute) buckets during the nightly run. Then you can have the user requests grab the relevant buckets based on the time zone they are using for their report. | 1 | 2 | 0 | curious how people have solved this problem...
I have a series of jobs that run overnight that roll up reports based on that day's data for customers. They're now asking for timezone support.
One of the reports is.. you had x number of orders last night, however last night could be different depending on timezone. Wha... | How do you handle timezones for data processing? | 0 | 0 | 0 | 881 |
3,761,994 | 2010-09-21T15:45:00.000 | 2 | 1 | 0 | 0 | c++,python,linear-algebra | 3,762,217 | 5 | false | 0 | 0 | I don't have directly applicable experience, but the scipy/numpy operations are almost all implemented in C. As long as most of what you need to do is expressed in terms of scipy/numpy functions, then your code shouldn't be much slower than equivalent C/C++. | 2 | 4 | 1 | I'm writing an application where quite a bit of the computational time will be devoted to performing basic linear algebra operations (add, multiply, multiply by vector, multiply by scalar, etc.) on sparse matrices and vectors. Up to this point, we've built a prototype using C++ and the Boost matrix library.
I'm consid... | Python vs. C++ for an application that does sparse linear algebra | 0.07983 | 0 | 0 | 3,064 |
3,761,994 | 2010-09-21T15:45:00.000 | 1 | 1 | 0 | 0 | c++,python,linear-algebra | 3,762,759 | 5 | false | 0 | 0 | Speed nowdays its no longer an issue for python since ctypes and cython emerged. Whats brilliant about cython is that your write python code and it generates c code without requiring from you to know a single line of c and then compiles to a library or you could even create a stanalone. Ctypes also is similar though a... | 2 | 4 | 1 | I'm writing an application where quite a bit of the computational time will be devoted to performing basic linear algebra operations (add, multiply, multiply by vector, multiply by scalar, etc.) on sparse matrices and vectors. Up to this point, we've built a prototype using C++ and the Boost matrix library.
I'm consid... | Python vs. C++ for an application that does sparse linear algebra | 0.039979 | 0 | 0 | 3,064 |
3,762,199 | 2010-09-21T16:04:00.000 | 24 | 0 | 0 | 0 | python,data-warehouse,etl | 3,762,400 | 2 | true | 0 | 0 | Yes. Just write Python using a DB-API interface to your database.
Most ETL programs provide fancy "high-level languages" or drag-and-drop GUI's that don't help much.
Python is just as expressive and just as easy to work with.
Eschew obfuscation. Just use plain-old Python.
We do it every day and we're very, very ple... | 2 | 14 | 0 | I am working on a data warehouse and looking for an ETL solution that uses Python.
I have played with SnapLogic as an ETL, but I was wondering if there were any other solutions out there.
This data warehouse is just getting started. Ihave not brought any data over yet. It will easily be over 100 gigs with the initial s... | ETL using Python | 1.2 | 0 | 0 | 6,797 |
3,762,199 | 2010-09-21T16:04:00.000 | 1 | 0 | 0 | 0 | python,data-warehouse,etl | 61,763,849 | 2 | false | 0 | 0 | You can use pyodbc a library python provides to extract data from various Database Sources. And than use pandas dataframes to manipulate and clean the data as per the organizational needs. And than pyodbc to load it to your data warehouse. | 2 | 14 | 0 | I am working on a data warehouse and looking for an ETL solution that uses Python.
I have played with SnapLogic as an ETL, but I was wondering if there were any other solutions out there.
This data warehouse is just getting started. Ihave not brought any data over yet. It will easily be over 100 gigs with the initial s... | ETL using Python | 0.099668 | 0 | 0 | 6,797 |
3,763,766 | 2010-09-21T19:31:00.000 | 1 | 1 | 0 | 0 | c++,python,symbian | 3,763,786 | 5 | false | 0 | 1 | Python is more easy to use, but you have to know that a mobile is normally a very strict environment, so is possible that C++ be a better alternative. | 2 | 0 | 0 | I am interested in programming for Mobile Devices.
Now I have a phone which runs Symbian S60 3rd, which is one of my motivations for programming for mobile devices.
Now, my question is, which one is better to go for?
Python or C++?
I have a good background in C++ (ANSI), Java and C#.
Thanks. | Python or C++? Programming for mobile devices | 0.039979 | 0 | 0 | 1,838 |
3,763,766 | 2010-09-21T19:31:00.000 | 2 | 1 | 0 | 0 | c++,python,symbian | 3,763,991 | 5 | true | 0 | 1 | There's a large learning curve associated with Symbian C++, if you want to do a quick prototype probably do it in Python.
It depends on what you want your application to do. I believe the Symbian Python implementation was done in some Symbian developers spare time so it may not give you access to everything on the phon... | 2 | 0 | 0 | I am interested in programming for Mobile Devices.
Now I have a phone which runs Symbian S60 3rd, which is one of my motivations for programming for mobile devices.
Now, my question is, which one is better to go for?
Python or C++?
I have a good background in C++ (ANSI), Java and C#.
Thanks. | Python or C++? Programming for mobile devices | 1.2 | 0 | 0 | 1,838 |
3,764,291 | 2010-09-21T20:39:00.000 | 10 | 0 | 0 | 0 | python,networking | 3,764,315 | 21 | false | 0 | 0 | You can just try to download data, and if connection fail you will know that somethings with connection isn't fine.
Basically you can't check if computer is connected to internet. There can be many reasons for failure, like wrong DNS configuration, firewalls, NAT. So even if you make some tests, you can't have guarante... | 2 | 162 | 0 | I want to see if I can access an online API, but for that, I need to have Internet access.
How can I see if there's a connection available and active using Python? | How can I see if there's an available and active network connection in Python? | 1 | 0 | 1 | 229,860 |
3,764,291 | 2010-09-21T20:39:00.000 | 5 | 0 | 0 | 0 | python,networking | 3,764,759 | 21 | false | 0 | 0 | Try the operation you were attempting to do anyway. If it fails python should throw you an exception to let you know.
To try some trivial operation first to detect a connection will be introducing a race condition. What if the internet connection is valid when you test but goes down before you need to do actual work? | 2 | 162 | 0 | I want to see if I can access an online API, but for that, I need to have Internet access.
How can I see if there's a connection available and active using Python? | How can I see if there's an available and active network connection in Python? | 0.047583 | 0 | 1 | 229,860 |
3,764,360 | 2010-09-21T20:48:00.000 | 10 | 0 | 1 | 0 | python | 3,764,790 | 4 | false | 0 | 0 | Not only does __repr__() get called when you use repr(), but also in the following cases:
You type obj in the shell and press enter
You ever print an object in a dictionary/tuple/list. E.g.: print [u'test'] does not print ['test'] | 2 | 18 | 0 | print OBJECT calls OBJECT.__str__(), then when OBJECT.__repr__() is called? I see that print OBJECT calls OBJECT.__repr__() when OBJECT.__str__() doesn't exist, but I expect that's not the only way to call __repr__(). | When __repr__() is called? | 1 | 0 | 0 | 13,116 |
3,764,360 | 2010-09-21T20:48:00.000 | 1 | 0 | 1 | 0 | python | 3,764,522 | 4 | false | 0 | 0 | In python 2.x, `obj` will end up calling obj.__repr__(). It's shorthand for repr(). | 2 | 18 | 0 | print OBJECT calls OBJECT.__str__(), then when OBJECT.__repr__() is called? I see that print OBJECT calls OBJECT.__repr__() when OBJECT.__str__() doesn't exist, but I expect that's not the only way to call __repr__(). | When __repr__() is called? | 0.049958 | 0 | 0 | 13,116 |
3,764,851 | 2010-09-21T22:02:00.000 | 1 | 0 | 0 | 0 | python,oop | 3,764,942 | 2 | false | 1 | 0 | I would not couple my project tightly to the library, but instead try to abstract functionality and couple both using one or more objects in between. The mediator and/or facade pattern come to my mind here. | 1 | 1 | 0 | I'm working on a poker analysis tool with the following use case:
User create Strategy class with one method: input GameState, output PokerAction
User runs Analysis script, which launches a PokerGame between various Strategy subclasses (i.e. various strategies)
PokerGame generates random deck
PokerGame sends GameState... | Designing my domain model around one 3rd-party library | 0.099668 | 0 | 0 | 191 |
3,764,879 | 2010-09-21T22:10:00.000 | 7 | 0 | 1 | 0 | python,recursion,functional-programming,tree,traversal | 3,764,896 | 5 | false | 0 | 0 | Pretty much the same as in every other language - in your case, you pass a reference to the parent and check if it is None. If so, you create a proper parent node. | 1 | 1 | 0 | I'm writing a function to traverse the user's file system and create a tree representing that directory (the tree is really a TreeView widget in Tkinter, but that's functionally a tree).
The best way I can think of doing this is recursion. However, one of my cases in the function requires me to know if it is the "origi... | Is there a way to tell if I'm using recursion in Python? | 1 | 0 | 0 | 281 |
3,765,178 | 2010-09-21T23:17:00.000 | 15 | 0 | 1 | 1 | python,windows | 3,765,219 | 6 | true | 0 | 0 | Don't tell anybody this, but I've run python/django on windows. It works all right and the performance hit isn't any worse than you would expect from windows. I used MySQL and it installed without a problem. I had to grope around to find out how to manage it (no good ol' sudo /etc/init.d/mysql restart but i eventually ... | 6 | 17 | 0 | I am interested in learning python but my Linux skills suck. I would like to develop a medium to large scale web application using python and django but afraid the software may not work well on a windows box. Is there a performance difference in running python on Linux vs Windows? Is there anything that I should watch ... | Running python on a Windows machine vs Linux | 1.2 | 0 | 0 | 63,443 |
3,765,178 | 2010-09-21T23:17:00.000 | 1 | 0 | 1 | 1 | python,windows | 3,765,246 | 6 | false | 0 | 0 | Which software are you affraid will not work on windows, the actual web app or your development enviroment. If you mean the IDE, then I wouldn't worry about that there are very good python IDEs for windows, as for the webapp that's another discussion all together
The statement that "it is very easy integrating C++ libs... | 6 | 17 | 0 | I am interested in learning python but my Linux skills suck. I would like to develop a medium to large scale web application using python and django but afraid the software may not work well on a windows box. Is there a performance difference in running python on Linux vs Windows? Is there anything that I should watch ... | Running python on a Windows machine vs Linux | 0.033321 | 0 | 0 | 63,443 |
3,765,178 | 2010-09-21T23:17:00.000 | 1 | 0 | 1 | 1 | python,windows | 3,765,233 | 6 | false | 0 | 0 | Shouldn't be a problem. Some people even host Python+Django on Windows. | 6 | 17 | 0 | I am interested in learning python but my Linux skills suck. I would like to develop a medium to large scale web application using python and django but afraid the software may not work well on a windows box. Is there a performance difference in running python on Linux vs Windows? Is there anything that I should watch ... | Running python on a Windows machine vs Linux | 0.033321 | 0 | 0 | 63,443 |
3,765,178 | 2010-09-21T23:17:00.000 | 1 | 0 | 1 | 1 | python,windows | 3,765,227 | 6 | false | 0 | 0 | Python program is very easily portable. Most of the time your code will work on any platform that have the appropriate version of python.
One point to be aware of though, is file path handling. Linux, Windows, Macs, etc uses different path schemes, so you shouldn't be handling them as strings; instead use os.path funct... | 6 | 17 | 0 | I am interested in learning python but my Linux skills suck. I would like to develop a medium to large scale web application using python and django but afraid the software may not work well on a windows box. Is there a performance difference in running python on Linux vs Windows? Is there anything that I should watch ... | Running python on a Windows machine vs Linux | 0.033321 | 0 | 0 | 63,443 |
3,765,178 | 2010-09-21T23:17:00.000 | 9 | 0 | 1 | 1 | python,windows | 3,765,244 | 6 | false | 0 | 0 | I've been working Py on both Windows and Linux. I favor Linux because of several things:
virtualenvs - once you start working with virtualenvs, there is no turning back.
SHELL - CMD is very frustrating when executing python/management commands in django. Also, you should add python.exe every time :).
ipython works bet... | 6 | 17 | 0 | I am interested in learning python but my Linux skills suck. I would like to develop a medium to large scale web application using python and django but afraid the software may not work well on a windows box. Is there a performance difference in running python on Linux vs Windows? Is there anything that I should watch ... | Running python on a Windows machine vs Linux | 1 | 0 | 0 | 63,443 |
3,765,178 | 2010-09-21T23:17:00.000 | 14 | 0 | 1 | 1 | python,windows | 3,765,742 | 6 | false | 0 | 0 | but afraid the software may not work well on a windows box.
Your software will work. The Windows OS may not work as you hope. But that's Windows, not Python.
We develop 100% on Windows. We completely test: Unit test, integration test and user acceptance test on Windows. 100%.
We deploy for production 0% on Windo... | 6 | 17 | 0 | I am interested in learning python but my Linux skills suck. I would like to develop a medium to large scale web application using python and django but afraid the software may not work well on a windows box. Is there a performance difference in running python on Linux vs Windows? Is there anything that I should watch ... | Running python on a Windows machine vs Linux | 1 | 0 | 0 | 63,443 |
3,765,496 | 2010-09-22T00:37:00.000 | 0 | 0 | 0 | 0 | python,macos,user-interface,wxpython | 3,765,854 | 1 | true | 0 | 1 | I was thinking maybe a class
decorator, but this is functionality
that will be added at runtime, due to
the dynamic nature of python.
I don't understand why this makes you "a little stumped". The class decorator executes just after the end of the class statement -- yes, that's "at runtime", but, so is the clqss ... | 1 | 0 | 0 | It's my understanding that in wxPython in OSX, ⌘+w support for closing wx.Window objects. In order to add it, I've had to bind to wx.EVT_KEY_DOWN, checking for event.MetaDown() and event.KeyCode == 'W' explicitly.
In my app, I need to have all windows and dialogs support this. I'm still in the process of layout out my ... | Command+W Support in wxPython | 1.2 | 0 | 0 | 93 |
3,765,897 | 2010-09-22T02:23:00.000 | 2 | 0 | 1 | 0 | python,multithreading,sigint | 3,765,907 | 1 | false | 0 | 0 | Only the main tread can handle signals. Just make all your threads "daemonic" ones (set the thread object's .daemon property to True before you start the thread) to ensure the threads terminate when the main thread does. | 1 | 4 | 0 | I have a multithreaded program and use the signal.signal(SIGINT,func) to kill all threads when ctrl c is pressed. The question I have is this:
I have to call signal.signal(...) from main in python. Do I have to call that on a loop or can I just set it once and whenever the user presses ctrl c, the signal will be caught... | Signal handler, python | 0.379949 | 0 | 0 | 409 |
3,768,019 | 2010-09-22T09:44:00.000 | 4 | 0 | 0 | 1 | python,wsgi | 3,768,227 | 3 | true | 0 | 0 | The software uses UDP to send sequential updates to a given set of variables in (near) real-time (updates every 5-10 ms). thus, I do not need to capture all UDP data -- it is sufficient that the latest update is retrieved
What you must do is this.
Step 1.
Build a Python app that collects the UDP data and caches it int... | 1 | 6 | 0 | I am currently working on exposing data from legacy system over the web. I have a (legacy) server application that sends and receives data over UDP. The software uses UDP to send sequential updates to a given set of variables in (near) real-time (updates every 5-10 ms). thus, I do not need to capture all UDP data -- it... | How to serve data from UDP stream over HTTP in Python? | 1.2 | 0 | 1 | 4,771 |
3,769,701 | 2010-09-22T13:28:00.000 | -6 | 1 | 0 | 0 | python,imaplib | 3,787,209 | 4 | false | 0 | 0 | No idea how they do it but doesn't Microsoft Outlook let you move an email from a local folder to a remote IMAP folder? | 1 | 5 | 0 | I am trying to use python's imaplib to create an email and send it to a mailbox with specific name, e.g. INBOX. Anyone has some great suggestion :). | How to create an email and send it to specific mailbox with imaplib | -1 | 0 | 1 | 18,674 |
3,770,394 | 2010-09-22T14:43:00.000 | 5 | 0 | 0 | 0 | python,mysql,optimization | 3,770,439 | 2 | false | 0 | 0 | 25Mb is tiny. Microscopic. SQL is slow. Glacial.
Do not waste time on SQL unless you have transactions (with locking and multiple users).
If you're doing "analysis", especially computationally-intensive analysis, load all the data into memory.
In the unlikely event that data doesn't fit into memory, then do this.
Q... | 1 | 2 | 0 | I am building an application with objects which have their data stored in mysql tables (across multiple tables). When I need to work with the object (retrieve object attributes / change the attributes) I am querying the sql database using mysqldb (select / update). However, since the application is quite computation in... | Optimizing Python Code for Database Access | 0.462117 | 1 | 0 | 1,287 |
3,772,260 | 2010-09-22T18:02:00.000 | 48 | 0 | 0 | 0 | python,django,ipython | 26,771,173 | 12 | false | 1 | 0 | My solution to it is I write the code and save to a file and then use:
python manage.py shell < test.py
So I can make the change, save and run that command again till I fix whatever I'm trying to fix. | 2 | 108 | 0 | I am working with Django and use Django shell all the time. The annoying part is that while the Django server reloads on code changes, the shell does not, so every time I make a change to a method I am testing, I need to quit the shell and restart it, re-import all the modules I need, reinitialize all the variables I n... | How to reload modules in django shell? | 1 | 0 | 0 | 52,169 |
3,772,260 | 2010-09-22T18:02:00.000 | 25 | 0 | 0 | 0 | python,django,ipython | 3,816,813 | 12 | false | 1 | 0 | It seems that the general consensus on this topic, is that python reload() sucks and there is no good way to do this. | 2 | 108 | 0 | I am working with Django and use Django shell all the time. The annoying part is that while the Django server reloads on code changes, the shell does not, so every time I make a change to a method I am testing, I need to quit the shell and restart it, re-import all the modules I need, reinitialize all the variables I n... | How to reload modules in django shell? | 1 | 0 | 0 | 52,169 |
3,772,981 | 2010-09-22T19:40:00.000 | 0 | 0 | 1 | 0 | python,class | 3,773,003 | 1 | true | 0 | 0 | What do you mean by use?
storage[0] will give you a reference to the record.
From there you can just use whatever methods main.Record exposes to access its data. | 1 | 0 | 0 | storage = []
...
after running program
storage = [ <main.Record instance at 0x032E8530> ]
inside the instance of Record are:
"Model No."
"Standard: Part Number"
"Standard: Issue Date"
"Date of Declaration"
"Declaration Document Number"
Question: How do I use specific data from within the Record? | Using data from a specific class in python | 1.2 | 0 | 0 | 46 |
3,773,208 | 2010-09-22T20:10:00.000 | 3 | 0 | 0 | 0 | python,django | 3,773,276 | 1 | false | 1 | 0 | There is no requirement in Django that you import modules at function scope. You can, but that is true of python generally. I'd like to see your code and error message. I don't think that your problem is due to the cause you attribute it to. | 1 | 0 | 0 | I always thought it was OK to just import all of your modules at the top of a view file. Then if you ever change a model name you can just edit the import at the top and not go digging through every view function that you need it imported in.
Well, I just ran into an instance where I had imported a model at the top ... | Django, where to import your modules | 0.53705 | 0 | 0 | 81 |
3,773,566 | 2010-09-22T20:56:00.000 | 1 | 1 | 0 | 0 | php,python,sockets,web-applications,tcp | 3,773,702 | 3 | false | 1 | 0 | I believe you need to close the low-level socket fairly abruptly. You won't be able to do it from Javascript. For the other languages you'll generally need to get a handle on the underlying socket object and close() it manually.
I also doubt you can do this through Apache since it is Apache and not your application hol... | 1 | 8 | 0 | I'm sure you've seen the "the connection was reset" message displayed when trying to browse web pages. (The text is from Firefox, other browsers differ.)
I need to generate that message/error/condition on demand, to test workarounds.
So, how do I generate that condition programmatically? (How to generate a TCP RST fr... | How do I generate a connection reset programatically? | 0.066568 | 0 | 0 | 3,959 |
3,774,108 | 2010-09-22T22:30:00.000 | 5 | 1 | 1 | 0 | c++,python,scripting,lua,embedded-language | 3,774,415 | 4 | false | 0 | 0 | Having incorporated Lua in one of my C projects myself, I'll suggest Lua, as this is easier.
But that depends on what your scripting language needs to be capable of. Lua rose to the de-facto scripting language of games. If you need advanced scripting capabilities, you might use Python, but if it's just for easy scripti... | 2 | 16 | 0 | For a project I'm currently working on, I'm looking to embed a scripting engine into my C++ code to allow for some extensibility down the line. The application will require a fair amount of text processing and the use of regular expressions within these scripts.
I know Lua is generally the industry darling when it com... | Python vs Lua for embedded scripting/text processing engine | 0.244919 | 0 | 0 | 9,483 |
3,774,108 | 2010-09-22T22:30:00.000 | 4 | 1 | 1 | 0 | c++,python,scripting,lua,embedded-language | 3,774,148 | 4 | false | 0 | 0 | dont forget the grand-daddy of them all - tcl
there is a c++ wrapper for tcl which makes it incredibly easy to embed
i am using it in a current project
in previous (c#) project I used lua over python. In older c# projects I had used python;
I chose lua because the syntax is more normal for average scripter (used to vbs... | 2 | 16 | 0 | For a project I'm currently working on, I'm looking to embed a scripting engine into my C++ code to allow for some extensibility down the line. The application will require a fair amount of text processing and the use of regular expressions within these scripts.
I know Lua is generally the industry darling when it com... | Python vs Lua for embedded scripting/text processing engine | 0.197375 | 0 | 0 | 9,483 |
3,774,772 | 2010-09-23T01:21:00.000 | 2 | 1 | 0 | 1 | python,cron,package,execute,at-job | 3,774,794 | 4 | false | 0 | 0 | type man at, it will explain how to use it. Usage will slighty differ from system to system, so there's no use to tell you here exactly. | 1 | 2 | 0 | When I try to use cron to execute my python script in a future time, I found there is a command at, AFAIK, the cron is for periodically execute, but what my scenario is only execute for once in specified time.
and my question is how to add python script to at command,
also it there some python package for control the a... | How to use at command to set python script execute at specified time | 0.099668 | 0 | 0 | 2,030 |
3,776,665 | 2010-09-23T08:47:00.000 | 11 | 0 | 1 | 0 | python,python-3.x,python-2.x | 3,776,824 | 1 | true | 0 | 0 | Write your code entirely against 2.x, targeting the most recent version in the 2.x series. In this case, it's probably going to remain 2.7. Run it through 2to3, and if it doesn't pass all of its unit tests, fix the 2.x version until the generated 3.x version works.
Eventually, when you want to drop 2.x support, you can... | 1 | 9 | 0 | I've written a pure-Python module for Python 3.0/3.1 which I'd also like to make it compatible with 2.x (probably just 2.6/2.7) in order to make it available to the widest possible audience.
The module is concerned with reading and writing a set of related file formats, so the differences between 2.x and 3.x versions w... | Writing a module for both Python 2.x and 3.x | 1.2 | 0 | 0 | 444 |
3,778,043 | 2010-09-23T11:52:00.000 | 5 | 0 | 0 | 0 | python,image-processing | 3,778,086 | 1 | false | 0 | 1 | Your target image size has a different aspect ratio to that of the original. The original is 2:1 but the target is 4:3.
You can resize preserving the aspect ratio, but depending on which dimension you choose you'll either get an image that's 400 x 200 or 600 x 300.
If you need the image to be 400 x 300 then you'll need... | 1 | 0 | 0 | I have an image having dimension 1000*500
I want to make it of 400*300
But My image should not looked distorted.
http://www.daniweb.com/forums/thread295652.html - i used this as a reference. But My image get distorted. | i want a to resize an image but without distortion | 0.761594 | 0 | 0 | 1,120 |
3,780,094 | 2010-09-23T15:47:00.000 | 0 | 0 | 1 | 1 | python,file,relative-path | 3,780,153 | 4 | false | 0 | 0 | Put it in a well known directory (/usr/lib/yourproject/ or ~/lib or something similar), or have it in a well known relative path based on the location of your source files that are using it. | 2 | 0 | 0 | I have a python module that is shared among several of my projects (the projects each have a different working directory). One of the functions in this shared module, executes a script using os.spawn. The problem is, I'm not sure what pathname to give to os.spawn since I don't know what the current working directory ... | Determining a file's path name from different working directories in python | 0 | 0 | 0 | 165 |
3,780,094 | 2010-09-23T15:47:00.000 | 1 | 0 | 1 | 1 | python,file,relative-path | 3,780,160 | 4 | true | 0 | 0 | So I just learned about the __file__ variable, which will provide a solution to my problem. I can use file to get a pathname which will be constant among all projects, and use that to reference the script I need to call, since the script will always be in the same location relative to __file__. However, I'm open to oth... | 2 | 0 | 0 | I have a python module that is shared among several of my projects (the projects each have a different working directory). One of the functions in this shared module, executes a script using os.spawn. The problem is, I'm not sure what pathname to give to os.spawn since I don't know what the current working directory ... | Determining a file's path name from different working directories in python | 1.2 | 0 | 0 | 165 |
3,780,379 | 2010-09-23T16:14:00.000 | 0 | 1 | 0 | 0 | ironpython | 3,780,791 | 1 | false | 0 | 0 | Resolved. Turns out that you need to rebuild IronPython from source, with the command line options –X:Frames or –X:FullFrames. | 1 | 0 | 0 | I'm trying to use a module that requires sys._getframe(), which, as I understand it, is not enabled by default. I've seen a lot of material that suggests that there is a way to enable _getframe(), but I've yet to find anything that tells me how to do so. What is the proper method for enabling this function in IronPyt... | How can I enable sys._getframe in IronPython 2.6.1? | 0 | 0 | 0 | 905 |
3,781,087 | 2010-09-23T17:41:00.000 | 0 | 0 | 0 | 1 | python,unix,shell | 3,786,764 | 7 | false | 0 | 0 | If you don't want to use paramiko, then try telnetlib. You can use it to execute remote commands. | 2 | 6 | 0 | Is there a way that I can use Python on Windows to execute shell scripts which are located on a remote Unix machine?
P.S: Sorry about the late edit. I do know of Paramiko, but I wanted to know if there is way of doing it without it. For starters, could it be done with subprocess()? | shell script remote execution using python | 0 | 0 | 0 | 11,566 |
3,781,087 | 2010-09-23T17:41:00.000 | 0 | 0 | 0 | 1 | python,unix,shell | 3,781,130 | 7 | false | 0 | 0 | You will either need to run some sort of server on the remote machine, or ssh in and do it yourself. It would not be difficult to use one of the many pre-written Python servers to listen for a client and kick off a shell script.
Authentication may or may not be a problem for you; be aware that anyone else can follow th... | 2 | 6 | 0 | Is there a way that I can use Python on Windows to execute shell scripts which are located on a remote Unix machine?
P.S: Sorry about the late edit. I do know of Paramiko, but I wanted to know if there is way of doing it without it. For starters, could it be done with subprocess()? | shell script remote execution using python | 0 | 0 | 0 | 11,566 |
3,781,454 | 2010-09-23T18:35:00.000 | 10 | 0 | 1 | 0 | python,programming-languages | 3,781,496 | 4 | true | 0 | 0 | I'm sure you know the + function. So, what is it's type? Numbers? Well, it works for lists and strings too. It even works for every object that defines __add__. Or in some cases when one object defines __radd__.
So it's hard to tell the type of this function already. But Python makes it even possible to define these m... | 2 | 6 | 0 | If we know the type of variable or parameter very well, why not to declare them?
I'd like to know why it's bad or not necessary.
Sorry, I'm new on Python (from about 1 year) and before I was on C, VB, VB.NET and C# programming languages.
With Python, I hope to have bad parameter types to be catched at compilation tim... | why python doesn't need type declaration for python, other way what are the adv. of not declaring type? | 1.2 | 0 | 0 | 10,558 |
3,781,454 | 2010-09-23T18:35:00.000 | 3 | 0 | 1 | 0 | python,programming-languages | 3,781,478 | 4 | false | 0 | 0 | That's the nature of dynamic languages.
Static typing is the Java/C# style. (And even C# can infer type using var now.)
It's a tradeoff: you're exchanging type safety for flexibility at runtime. | 2 | 6 | 0 | If we know the type of variable or parameter very well, why not to declare them?
I'd like to know why it's bad or not necessary.
Sorry, I'm new on Python (from about 1 year) and before I was on C, VB, VB.NET and C# programming languages.
With Python, I hope to have bad parameter types to be catched at compilation tim... | why python doesn't need type declaration for python, other way what are the adv. of not declaring type? | 0.148885 | 0 | 0 | 10,558 |
3,781,802 | 2010-09-23T19:23:00.000 | 1 | 0 | 0 | 0 | python,mysql,django,pylons,cherrypy | 3,783,714 | 5 | false | 1 | 0 | CherryPy is the only framework I'm aware of that does real HTTP caching out of the box (but look at "beaker" for a WSGI component solution). Many of the others give you tools to store arbitrary objects in Memcached or other storage. | 1 | 6 | 0 | This may seem like a subjective question. But it is not (that's not the idea, at least).
I'm developing an Advertising software (like AdWords, AdBrite, etc) and i've decide to use Python. And would like to use one of those well known web frameworks (Django, Cherrypy, pylons, etc).
The question is:
Given that it will ha... | Selecting a Python Web Framework | 0.039979 | 0 | 0 | 2,699 |
3,781,873 | 2010-09-23T19:33:00.000 | 0 | 0 | 1 | 1 | python,pywin32,python-embedding | 3,782,055 | 1 | false | 0 | 0 | I previously used py2exe to freeze the application and all the DLLs. Then use Innosetup to create an installer. Work like a charm. | 1 | 2 | 0 | I have python as an embedded scripting environment in my application. I supply the python bits (python26.dll, DLLs & Lib folders) with my application. All this to avoid asking users to install python (you know how it goes in big corporations).
All works nice except pywin32. It installs pythoncom26.dll and pywintypes26.... | pywin32 captive installation (avoid py*.dll getting installed in system32 directory) | 0 | 0 | 0 | 573 |
3,782,386 | 2010-09-23T20:40:00.000 | 3 | 0 | 0 | 0 | python,django-models,sqlalchemy,data-warehouse,olap | 3,782,627 | 3 | false | 0 | 0 | I'm using SQLAlchemy with a pretty big datawarehouse and I'm using it for the full ETL process with success. Specially in certain sources where I have some complex transformation rules or with some heterogeneous sources (such as web services). I'm not using the Sqlalchemy ORM but rather using its SQL Expression Languag... | 3 | 10 | 0 | We've worked hard to work up a full dimensional database model of our problem, and now it's time to start coding. Our previous projects have used hand-crafted queries constructed by string manipulation.
Is there any best/standard practice for interfacing between python and a complex database layout?
I've briefly evalua... | Python: interact with complex data warehouse | 0.197375 | 1 | 0 | 3,376 |
3,782,386 | 2010-09-23T20:40:00.000 | 2 | 0 | 0 | 0 | python,django-models,sqlalchemy,data-warehouse,olap | 3,782,432 | 3 | false | 0 | 0 | SQLAlchemy definitely. Compared to SQLAlchemy, all other ORMs look like child's toy. Especially the Django-ORM. What's Hibernate to Java, SQLAlchemy is to Python. | 3 | 10 | 0 | We've worked hard to work up a full dimensional database model of our problem, and now it's time to start coding. Our previous projects have used hand-crafted queries constructed by string manipulation.
Is there any best/standard practice for interfacing between python and a complex database layout?
I've briefly evalua... | Python: interact with complex data warehouse | 0.132549 | 1 | 0 | 3,376 |
3,782,386 | 2010-09-23T20:40:00.000 | 6 | 0 | 0 | 0 | python,django-models,sqlalchemy,data-warehouse,olap | 3,782,509 | 3 | false | 0 | 0 | Don't get confused by your requirements. One size does not fit all.
load large amounts of data relatively quickly
Why not use the databases's native loaders for this? Use Python to prepare files, but use database tools to load. You'll find that this is amazingly fast.
update/insert small amounts of data quickly... | 3 | 10 | 0 | We've worked hard to work up a full dimensional database model of our problem, and now it's time to start coding. Our previous projects have used hand-crafted queries constructed by string manipulation.
Is there any best/standard practice for interfacing between python and a complex database layout?
I've briefly evalua... | Python: interact with complex data warehouse | 1 | 1 | 0 | 3,376 |
3,782,613 | 2010-09-23T21:19:00.000 | 0 | 0 | 0 | 1 | python,vim,autocomplete | 44,201,882 | 3 | false | 0 | 0 | That's the way my same problem i solve:
before i get this problem - i was set the path only to directory and that's was wrong
After i set the path Including the filename it starts work! | 3 | 1 | 0 | So I installed pydiction into vim for autocompleting my python code in windows. No problemo. Worked like a charm.
Tried the same thing with my Ubuntu setup, creating the .vim/after/ftplugin directory in my home folder and updating the vimrc with the correct path of the pydiction dictionary but I fail every time. Why i... | Problems with Vim's Pydiction and Python in Ubuntu 10.4 | 0 | 0 | 0 | 2,092 |
3,782,613 | 2010-09-23T21:19:00.000 | 0 | 0 | 0 | 1 | python,vim,autocomplete | 3,788,533 | 3 | false | 0 | 0 | Sounds like it's having a problem with your complete-dict file. I'm using Ubuntu 10.04 and it works fine for me. Make sure your complete-dict file actually has content in it, in this case make sure it has the word 'raw' in it. | 3 | 1 | 0 | So I installed pydiction into vim for autocompleting my python code in windows. No problemo. Worked like a charm.
Tried the same thing with my Ubuntu setup, creating the .vim/after/ftplugin directory in my home folder and updating the vimrc with the correct path of the pydiction dictionary but I fail every time. Why i... | Problems with Vim's Pydiction and Python in Ubuntu 10.4 | 0 | 0 | 0 | 2,092 |
3,782,613 | 2010-09-23T21:19:00.000 | 1 | 0 | 0 | 1 | python,vim,autocomplete | 3,793,008 | 3 | false | 0 | 0 | Problem has been solved, apparently gvim did not like the fact that i put the files in a ".vim" directory even though that was exactly what the instructions told me to do. I put them in my home folder pydiction.vim and complete-dictionary and now it works ok, with no issues.
Now autocomplete works with any word I tried... | 3 | 1 | 0 | So I installed pydiction into vim for autocompleting my python code in windows. No problemo. Worked like a charm.
Tried the same thing with my Ubuntu setup, creating the .vim/after/ftplugin directory in my home folder and updating the vimrc with the correct path of the pydiction dictionary but I fail every time. Why i... | Problems with Vim's Pydiction and Python in Ubuntu 10.4 | 0.066568 | 0 | 0 | 2,092 |
3,783,887 | 2010-09-24T02:42:00.000 | 7 | 1 | 0 | 0 | python,cgi,bioinformatics,biopython | 3,784,056 | 3 | true | 0 | 0 | Here are a couple of possibilities:
Apache (on Unix) generally runs as a different user, and with a different environment, to python from the command line. Try making a small script that just prints out sys.version and sys.prefix, and compare the result through apache and via the command line, to make sure that you're... | 1 | 9 | 0 | I have no idea what could be the problem here:
I have some modules from Biopython which I can import easily when using the interactive prompt or executing python scripts via the command-line.
The problem is, when I try and import the same biopython modules in a web-executable cgi script, I get a "Import Error"
: No
... | Why can't python find some modules when I'm running CGI scripts from the web? | 1.2 | 0 | 0 | 9,473 |
3,785,502 | 2010-09-24T08:48:00.000 | 2 | 0 | 0 | 0 | python,django | 3,787,861 | 1 | true | 1 | 0 | Well I found the answer. It was quite easy actually. you just need to set the FileField value to some string and it will point to that file.
The point is that the path specified should be correct otherwise you get a 404 error when trying to access it. | 1 | 1 | 0 | I wanted to know how is it possible in django to bind an already uploaded file (stored in the file system of server) to a Model FileField. This way I want to have my edit page of that model to prepopulate the FileField with this file.
Thanks | Prepopulating a Django FileField | 1.2 | 0 | 0 | 669 |
3,786,881 | 2010-09-24T12:07:00.000 | 0 | 0 | 1 | 0 | python,methods | 54,966,515 | 8 | false | 0 | 0 | If you think of an object as being similar to a noun, then a method is similar to a verb. Use a method right after an object (i.e. a string or a list) to apply a method's action to it. | 1 | 79 | 0 | Can anyone, please, explain to me in very simple terms what a "method" is in Python?
The thing is in many Python tutorials for beginners this word is used in such way as if the beginner already knew what a method is in the context of Python. While I am of course familiar with the general meaning of this word, I have no... | What is a "method" in Python? | 0 | 0 | 0 | 215,845 |
3,787,405 | 2010-09-24T13:13:00.000 | -1 | 1 | 1 | 0 | python,caching,hash | 3,787,439 | 3 | false | 0 | 0 | The usual reason is that most objects in Python are mutable, so if the hash depends on the properties, it changes as soon as you change a property. If your class really is an immutable and (all the properties which go into the hash are immutable, too!), then you can cache the hash. | 1 | 14 | 0 | I've written a class whose .__hash__() implementation takes a long time to execute. I've been thinking to cache its hash, and store it in a variable like ._hash so the .__hash__() method would simply return ._hash. (Which will be computed either at the end of the .__init__() or the first time .__hash__() is called.)
My... | Is there any reason *not* to cache an object's hash? | -0.066568 | 0 | 0 | 2,299 |
3,788,198 | 2010-09-24T14:46:00.000 | 2 | 0 | 1 | 0 | c++,python,data-structures,boost | 3,793,491 | 2 | false | 0 | 0 | Since python collections only store references to objects, not objects themselves, theres isn't much difference between having one collection with multiple indexing schemes, and just having multiple collections.
You can for example have several dicts with your data, each of them using different keys to refer to them. | 2 | 5 | 0 | I have come to appreciate a lot boost::multi_index in C++. It happens that I would happily use something like that in Python; for scripts that process data coming out from numerical intensive applications. Is there such a thing for Python? I just want to be sure that it doesn't exist, then I would try to implement it m... | Something like boost::multi_index for Python | 0.197375 | 0 | 0 | 1,017 |
3,788,198 | 2010-09-24T14:46:00.000 | 1 | 0 | 1 | 0 | c++,python,data-structures,boost | 9,054,439 | 2 | true | 0 | 0 | To answer your question of whether a similar thing exists in Python, I would say no.
One useful feature of Boost.MultiIndex is that elements can be modified in-place (via replace() or modify()). Python's native dict doesn't provide such a functionality and requires the key to be immutable. I haven't seen other implem... | 2 | 5 | 0 | I have come to appreciate a lot boost::multi_index in C++. It happens that I would happily use something like that in Python; for scripts that process data coming out from numerical intensive applications. Is there such a thing for Python? I just want to be sure that it doesn't exist, then I would try to implement it m... | Something like boost::multi_index for Python | 1.2 | 0 | 0 | 1,017 |
3,789,220 | 2010-09-24T16:48:00.000 | 1 | 0 | 1 | 0 | python,sockets,asyncore | 3,854,614 | 1 | true | 0 | 0 | To answer my own question:
For this type of polling application it is necessary to have a small timeout value. The timeout specifies how long the internal select function blocks waiting for a socket to become active. If you are sending data frequently you need to set the timeout to a small value, so that select polls ... | 1 | 1 | 0 | I have written a program that communicates with many servers at once using the asyncore module. For the most part I am just responding to data received from the servers, but occasionally I need to send some data "out-of-sync". With the default timeout of 30 seconds there is an obvious delay before the packet gets sent,... | Python asyncore with very low timeout | 1.2 | 0 | 0 | 800 |
3,789,716 | 2010-09-24T17:58:00.000 | 1 | 1 | 1 | 0 | ironpython | 3,803,617 | 2 | false | 0 | 0 | It is not possible.
The only way is to change the clr.AddReference method. As IronPython is open source it should be easy. | 1 | 0 | 0 | I was wondering if there was a way that you could get init code to run upon importing a .NET assembly using clr.AddReference(), in the same way that importing a python file executes the init.py code that resides in the same directory. Thanks in advance! | IronPython: how can I run init code when I import a module using clr.AddReference()? | 0.099668 | 0 | 0 | 416 |
3,790,142 | 2010-09-24T19:04:00.000 | 1 | 0 | 0 | 0 | java,python | 3,790,193 | 14 | false | 1 | 0 | If you mean to use it like you would in a Python loop, Java loops nicely with the for statement, which renders this structure unnecessary for that purpose. | 1 | 115 | 0 | Does Java have an equivalent to Python's range(int, int) method? | Java: Equivalent of Python's range(int, int)? | 0.014285 | 0 | 0 | 96,489 |
3,791,527 | 2010-09-24T22:39:00.000 | 1 | 0 | 0 | 0 | python,ajax,user-interface,browser | 3,791,545 | 2 | true | 1 | 0 | The closest you can get is using (ick) frames, with one frame for your bar and one for the page. That's what Google Image Search does. It can easily get broken by frame-busting scripts though. | 2 | 1 | 0 | Goal
I want to create a web app with a horizontal GUI bar that floats with the user as they move from site to site. e.g. A user will sign into the web at the home page and then proceed to say Google to start searching for their topic. Once they are signed in and leave the web app homepage a horizontal GUI bar will appe... | Is there any other way besides browser extensions that one could have a GUI bar hover over any website a user visits? | 1.2 | 0 | 0 | 115 |
3,791,527 | 2010-09-24T22:39:00.000 | 0 | 0 | 0 | 0 | python,ajax,user-interface,browser | 3,791,539 | 2 | false | 1 | 0 | Is my idea possible with technologies
like AJAX and Python?
If the pages you want floating under the bar belong to a different domain than yours (it seems like that's what you want), then the answer is No. This is not possible with client-sided scripting alone (eg: Javascript) because of the same origin policy. What... | 2 | 1 | 0 | Goal
I want to create a web app with a horizontal GUI bar that floats with the user as they move from site to site. e.g. A user will sign into the web at the home page and then proceed to say Google to start searching for their topic. Once they are signed in and leave the web app homepage a horizontal GUI bar will appe... | Is there any other way besides browser extensions that one could have a GUI bar hover over any website a user visits? | 0 | 0 | 0 | 115 |
3,791,903 | 2010-09-25T00:26:00.000 | 17 | 0 | 1 | 0 | python,python-import | 3,791,936 | 3 | false | 0 | 0 | You only need it in Python 2.5. Older versions (<= 2.4) don't support it and newer versions (>= 2.6) have it enabled by default.
So if you want to support Python >= 2.5, you can simply put the from __future__ import with_statement at the beginning. For newer versions, it will simply be ignored. | 1 | 27 | 0 | Using python 2.6.5, I can use the with statement without calling from __future__ import with_statement. How can I tell which version of Python supports with without specifically importing it from __future__? | Which python version needs from __future__ import with_statement? | 1 | 0 | 0 | 12,726 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.