Q_Id int64 2.93k 49.7M | CreationDate stringlengths 23 23 | Users Score int64 -10 437 | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | DISCREPANCY int64 0 1 | Tags stringlengths 6 90 | ERRORS int64 0 1 | A_Id int64 2.98k 72.5M | API_CHANGE int64 0 1 | AnswerCount int64 1 42 | REVIEW int64 0 1 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 15 5.1k | Available Count int64 1 17 | Q_Score int64 0 3.67k | Data Science and Machine Learning int64 0 1 | DOCUMENTATION int64 0 1 | Question stringlengths 25 6.53k | Title stringlengths 11 148 | CONCEPTUAL int64 0 1 | Score float64 -1 1.2 | API_USAGE int64 1 1 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 15 3.72M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1,490,559 | 2009-09-29T04:23:00.000 | 6 | 0 | 0 | 0 | 0 | python,django,url,slug,collision | 0 | 1,492,882 | 0 | 4 | 1 | true | 1 | 0 | One thing I never liked about the unique slug fields/methods is that if you have a lot of clashes for a single title, you'll end up running several queries to try and determine an available slug. I know you mentioned you don't want to show the id for non-clashing slugs, but, as far as performance, I think it's the bett... | 2 | 7 | 0 | 0 | I'm currently working on a toy project in Django.
Part of my app allows users to leave reviews. I'd like to take the title of the review and slugify it to create a url.
So, if a user writes a review called "The best thing ever!", the url would be something like: www.example.com/reviews/the-best-thing-ever.
That's a... | Django slugified urls - how to handle collisions? | 0 | 1.2 | 1 | 0 | 0 | 3,203 |
1,490,559 | 2009-09-29T04:23:00.000 | 0 | 0 | 0 | 0 | 0 | python,django,url,slug,collision | 0 | 2,340,063 | 0 | 4 | 1 | false | 1 | 0 | I would (in the form validation) just check to see if the slug is used, and then add something to it, either a number "my-cool-idea_2" or the actual id | 2 | 7 | 0 | 0 | I'm currently working on a toy project in Django.
Part of my app allows users to leave reviews. I'd like to take the title of the review and slugify it to create a url.
So, if a user writes a review called "The best thing ever!", the url would be something like: www.example.com/reviews/the-best-thing-ever.
That's a... | Django slugified urls - how to handle collisions? | 0 | 0 | 1 | 0 | 0 | 3,203 |
1,494,231 | 2009-09-29T18:41:00.000 | 1 | 0 | 1 | 0 | 0 | javascript,c++,python,timestamp | 0 | 1,494,464 | 0 | 5 | 0 | false | 0 | 0 | Under WIN32, you can use SystemTimeToFileTime.
FILETIME is a 64-bit unsigned integer that counts the number of 100-nanosecond intervals since January 1, 1601 (UTC).
You can convert two timestamps to FILETIME. You can convert it to ULARGE_INTEGER (t.dwLowDateTime + t.dwHighDateTime << 32), and do regular arithmetics to ... | 2 | 3 | 0 | 0 | I'm trying to find to accurately count the number of seconds since Jan 1, 1850 to the present in a couple of languages (JavaScript, C++, and Python [don't even ask, I stopped asking these questions long ago]).
Problem is the platforms store timestamps as 32-bit signed integers, so I can't get a timestamp for dates olde... | How to get a timestamp older than 1901 | 0 | 0.039979 | 1 | 0 | 0 | 913 |
1,494,231 | 2009-09-29T18:41:00.000 | 3 | 0 | 1 | 0 | 0 | javascript,c++,python,timestamp | 0 | 1,494,286 | 0 | 5 | 0 | false | 0 | 0 | The portable, language-agnostic approach:
Step 1. Count the number of seconds between 01/01/1850 00:00 and 01/01/1901 00:00. Save this number somewhere (call it M)
Step 2. Use available language functionality to count the number of seconds between 01/01/1901 00:00 and whatever other date and time you want.
Step 3. Retu... | 2 | 3 | 0 | 0 | I'm trying to find to accurately count the number of seconds since Jan 1, 1850 to the present in a couple of languages (JavaScript, C++, and Python [don't even ask, I stopped asking these questions long ago]).
Problem is the platforms store timestamps as 32-bit signed integers, so I can't get a timestamp for dates olde... | How to get a timestamp older than 1901 | 0 | 0.119427 | 1 | 0 | 0 | 913 |
1,494,524 | 2009-09-29T19:41:00.000 | 0 | 0 | 0 | 0 | 0 | python,django,authentication | 0 | 1,494,572 | 0 | 3 | 0 | false | 1 | 0 | Modify things slightly so that users have a category prefix on their username? You haven't given us much info on what you want to do, it's possible that your needs might be met by using the sites framework, or simply two separate django installs.
If what you're trying to do is make the user login page and the admin log... | 1 | 8 | 0 | 0 | I've recently started learning/using django; I'm trying to figure out a way to have two separate authentications systems for administrators and users. Rather than create a whole new auth system, I'd like to leverage django's built-in functionality (i.e. session management, @login_required decorator, etc.).
Specificall... | Separate Admin/User authentication system in Django | 0 | 0 | 1 | 0 | 0 | 3,543 |
1,499,572 | 2009-09-30T17:32:00.000 | 1 | 0 | 0 | 1 | 0 | python,mysql,macos | 0 | 2,302,542 | 0 | 2 | 0 | false | 0 | 0 | You also need python_select (or is it select_python?) to change the default python used. | 1 | 0 | 0 | 0 | I just upgraded the default Python 2.5 on Leopard to 2.6 via the installer on www.python.org. Upon doing so, the MySQLdb I had installed was no longer found. So I tried reinstalling it via port install py-mysql, and it succeeded, but MySQLdb was still not importable. So then I tried to python install python26 with pyth... | With multiple Python installs, how does MacPorts know which one to install MySQLdb for? | 0 | 0.099668 | 1 | 1 | 0 | 1,051 |
1,500,564 | 2009-09-30T20:46:00.000 | 2 | 1 | 0 | 0 | 0 | python,scripting,numbers,profiler,line | 0 | 1,500,818 | 0 | 3 | 0 | false | 0 | 0 | cProfile does not track line numbers within a function; it only tracks the line number of where the function was defined.
cProfile attempts to duplicate the behavior of profile (which is pure Python). profile uses pstats to store the data from running, and pstats only stores line numbers for function definitions, no... | 1 | 5 | 0 | 0 | I'm using cProfile, pstats and Gprof2dot to profile a rather long python script.
The results tell me that the most time is spent calling a method in an object I've defined. However, what I would really like is to know exactly what line number within that function is eating up the time.
Any idea's how to get this addit... | cProfile and Python: Finding the specific line number that code spends most time on | 0 | 0.132549 | 1 | 0 | 0 | 2,434 |
1,501,907 | 2009-10-01T04:36:00.000 | -1 | 0 | 0 | 1 | 0 | python,google-app-engine,cron | 0 | 1,501,925 | 0 | 4 | 0 | false | 1 | 0 | Looking over the docs, I agree that your 24 cron entry idea is the only documented way that would work. Not ideal, but should work. | 2 | 4 | 0 | 0 | I need to run a task every hour on the hour (00:00, 01:00, 02:00, ..., 23:00) every day of the week, but can't seem to find an example in App Engine's docs of how to do this.
There is an example of running at ask every hour, but this doesn't fit because the "start" of that hour depends on when you deploy the applicatio... | Run a task every hour on the hour with App Engine's cron API | 0 | -0.049958 | 1 | 0 | 0 | 3,297 |
1,501,907 | 2009-10-01T04:36:00.000 | 1 | 0 | 0 | 1 | 0 | python,google-app-engine,cron | 0 | 1,501,960 | 0 | 4 | 0 | false | 1 | 0 | The docs say you can have 20 cron entries, so you can't have one for every hour of the day.
You could run your task every minute and check if it is the first minute of the hour - exit otherwise. | 2 | 4 | 0 | 0 | I need to run a task every hour on the hour (00:00, 01:00, 02:00, ..., 23:00) every day of the week, but can't seem to find an example in App Engine's docs of how to do this.
There is an example of running at ask every hour, but this doesn't fit because the "start" of that hour depends on when you deploy the applicatio... | Run a task every hour on the hour with App Engine's cron API | 0 | 0.049958 | 1 | 0 | 0 | 3,297 |
1,507,041 | 2009-10-01T23:32:00.000 | 10 | 0 | 1 | 0 | 1 | python | 0 | 1,507,054 | 0 | 8 | 0 | false | 0 | 0 | Read other people's code. Write some of your own code. Repeat for a year or two.
Study the Python documentation and learn the built-in modules.
Read Python in a Nutshell.
Subscribe your RSS reader to the Python tag on Stack Overflow. | 3 | 10 | 0 | 0 | Once you have learned the basic commands in Python, you are often able to solve most programming problem you face. But the way in which this is done is not really Python-ic.
What is common is to use the classical c++ or Java mentality to solve problems. But Python is more than that. It has functional programming incor... | How do I get fluent in Python? | 0 | 1 | 1 | 0 | 0 | 14,330 |
1,507,041 | 2009-10-01T23:32:00.000 | 2 | 0 | 1 | 0 | 1 | python | 0 | 1,507,058 | 0 | 8 | 0 | false | 0 | 0 | I guess becoming fluent in any programming language is the same as becoming fluent in a spoken/written language. You do that by speaking and listening to the language, a lot.
So my advice is to do some projects using python, and you will soon become fluent in it. You can complement this by reading other people's code w... | 3 | 10 | 0 | 0 | Once you have learned the basic commands in Python, you are often able to solve most programming problem you face. But the way in which this is done is not really Python-ic.
What is common is to use the classical c++ or Java mentality to solve problems. But Python is more than that. It has functional programming incor... | How do I get fluent in Python? | 0 | 0.049958 | 1 | 0 | 0 | 14,330 |
1,507,041 | 2009-10-01T23:32:00.000 | 3 | 0 | 1 | 0 | 1 | python | 0 | 1,507,068 | 0 | 8 | 0 | false | 0 | 0 | The same way you get fluent in any language - program a lot.
I'd recommend working on a project (hopefully something you'll actually use later). While working on the project, every time you need some basic piece of functionality, try writing it yourself, and then checking online how other people did it.
This both lets ... | 3 | 10 | 0 | 0 | Once you have learned the basic commands in Python, you are often able to solve most programming problem you face. But the way in which this is done is not really Python-ic.
What is common is to use the classical c++ or Java mentality to solve problems. But Python is more than that. It has functional programming incor... | How do I get fluent in Python? | 0 | 0.07486 | 1 | 0 | 0 | 14,330 |
1,512,644 | 2009-10-03T02:45:00.000 | 1 | 1 | 1 | 0 | 0 | python,release-management,pypi | 0 | 1,513,884 | 1 | 2 | 0 | true | 0 | 0 | You don't need to release eggs for anything else than Windows, and then only if your package uses C extensions so that they have compiled parts. Otherwise you simply release one source distribution. That will be enough for all Python versions on all platforms.
Running the tests for different versions automated is trick... | 1 | 5 | 0 | 0 | I've got several eggs I maintain on Pypi but up until now I've always focused on Python 2.5x.
I'd like to release my eggs under both Python 2.5 & Python 2.6 in an automated fashion i.e.
running tests
generating doc
preparing eggs
uploading to Pypi
How do you guys achieve this?
A related question: how do I tag an egg... | Python Pypi: what is your process for releasing packages for different Python versions? (Linux) | 0 | 1.2 | 1 | 0 | 0 | 817 |
1,513,543 | 2009-10-03T11:40:00.000 | 0 | 1 | 0 | 0 | 0 | python,openid,rpxnow | 0 | 1,513,794 | 0 | 1 | 0 | true | 0 | 0 | I believe that OpenID lets the user decide how much information to "share" during the login process. I can't say that I am an expert on the subject, but I know that my identity at myopenid.com lets me specify precisely what information to make available.
Is it possible that the AOL default is to share nothing? If thi... | 1 | 0 | 0 | 0 | I can't seem to fetch the verifiedEmail field when trying to login to AOLs OpenID on my site. Every other provider that I know of provides this property, but not AOL.
I realize that AOL somehow uses an old OpenID version, although is it feasible to just assume that their e-mail ends in @aol.com? I'm using the RPXNow li... | verifiedEmail AOL OpenID | 0 | 1.2 | 1 | 0 | 0 | 166 |
1,515,686 | 2009-10-04T05:35:00.000 | 2 | 0 | 0 | 0 | 0 | python,sockets,nonblocking | 0 | 1,515,698 | 0 | 4 | 0 | false | 0 | 0 | Why socket alone? It's so much simpler to use another standard library module, asyncore -- and if you can't, at the very least select!
If you're constrained by your homework's condition to only use socket, then I hope you can at least add threading (or multiprocessing), otherwise you're seriously out of luck -- you can... | 1 | 0 | 0 | 0 | Can someone please tell how to write a Non-Blocking server code using the socket library alone.Thanks | Non Blocking Server in Python | 0 | 0.099668 | 1 | 0 | 1 | 2,625 |
1,517,428 | 2009-10-04T21:29:00.000 | 1 | 0 | 1 | 0 | 0 | c#,python,vim,ide | 0 | 1,517,444 | 0 | 11 | 1 | false | 0 | 0 | Good IDE for python are Komodo or Eclipse with PyDev.
But even Notepad++ or any other text editor will enough to get you started, since you don't need to compile your code, just have a good editor.
The benefit of the above IDEs, is that you can use them to manage a large scale project and debug your code.
As for the cr... | 2 | 2 | 0 | 0 | I'm locked in using C# and I don't like it one bit. I have to start branching out to better myself as a professional and as a person, so I've decided to start making things in my own time using Python.
The problem is, I've basically programmed only in C#. What IDE should I use to make programs using Python?
My goal is ... | Coming from a Visual Studio background, what do you recommend I use to start my VERY FIRST Python project? | 1 | 0.01818 | 1 | 0 | 0 | 619 |
1,517,428 | 2009-10-04T21:29:00.000 | 0 | 0 | 1 | 0 | 0 | c#,python,vim,ide | 0 | 1,517,475 | 0 | 11 | 1 | false | 0 | 0 | Eclipse + Pydev is currently the gold standard IDE for Python. It's cross platform and since it's a general purpose IDE it has support for just about every other programming activity you might want to consider.
Eclipse is not bad for C++, and very mature for Java developers. It's quite amazing when you realize that al... | 2 | 2 | 0 | 0 | I'm locked in using C# and I don't like it one bit. I have to start branching out to better myself as a professional and as a person, so I've decided to start making things in my own time using Python.
The problem is, I've basically programmed only in C#. What IDE should I use to make programs using Python?
My goal is ... | Coming from a Visual Studio background, what do you recommend I use to start my VERY FIRST Python project? | 1 | 0 | 1 | 0 | 0 | 619 |
1,520,576 | 2009-10-05T14:52:00.000 | 0 | 0 | 1 | 0 | 0 | python,vim | 0 | 1,520,822 | 0 | 4 | 0 | false | 0 | 0 | Try hitting Ctrl-p while typing mid-word. Ctrl-p inserts the most recent word that starts with the prefix you're typing and Ctrl-n inserts the next match. If you have several possibilities, you can hit ctrl-p more than once to substitute each candidate in order. | 2 | 4 | 0 | 1 | I've gotten omnicompletion with Pysmell to work before, but I can't seem to do it again.
I tried following some steps online, but most, if not all, of them are to vague and assume too much that you know what you are doing to some extent.
Can someone post a full, step-by-step tutorial on how to get code completion work... | Getting proper code completion for Python on Vim? | 0 | 0 | 1 | 0 | 0 | 7,163 |
1,520,576 | 2009-10-05T14:52:00.000 | 4 | 0 | 1 | 0 | 0 | python,vim | 0 | 1,523,392 | 0 | 4 | 0 | false | 0 | 0 | There's also Ctrl+n in insert mode which will autocomplete based on the words it has seen in any of the open buffers (even in other tabs). | 2 | 4 | 0 | 1 | I've gotten omnicompletion with Pysmell to work before, but I can't seem to do it again.
I tried following some steps online, but most, if not all, of them are to vague and assume too much that you know what you are doing to some extent.
Can someone post a full, step-by-step tutorial on how to get code completion work... | Getting proper code completion for Python on Vim? | 0 | 0.197375 | 1 | 0 | 0 | 7,163 |
1,521,670 | 2009-10-05T18:28:00.000 | 1 | 0 | 0 | 0 | 0 | python,com,wxpython,parent | 0 | 1,522,240 | 0 | 2 | 0 | false | 0 | 0 | How's PP's control flow? If it's event-driven it could get appropriate events upon closure of that parent window or termination of that AP process; otherwise it could "poll" to check if the window or process are still around. | 1 | 0 | 0 | 0 | I have a Python program (PP) that loads another Program(AP) via COM, gets its window handle and sets it to be the PP parent.
This works pretty well except that I can't control that AP still has their [X] button available in the top left corner. Since this is a pretty obvious place for the user to close when they are d... | Close Python when Parent is closed | 0 | 0.099668 | 1 | 0 | 0 | 181 |
1,523,706 | 2009-10-06T05:13:00.000 | 1 | 0 | 0 | 1 | 0 | python,python-3.x,werkzeug | 0 | 1,622,505 | 0 | 3 | 0 | false | 1 | 0 | I can only answer question one:
I started using it for some small webstuff but now moved on to rework larger apps with it. Why Werkzeug? The modular concept is really helpful. You can hook in modules as you like, make stuff easily context aware and you get good request file handling for free which is able to cope with ... | 3 | 2 | 0 | 0 | I've been looking really hard at all of the way**(s)** one can develop web applications using Python. For reference, we are using RHEL 64bit, apache, mod_wsgi.
History:
PHP + MySQL years ago
PHP + Python 2.x + MySQL recently and current
Python + PostgreSQL working on it
We use a great library for communicating betwe... | Werkzeug in General, and in Python 3.1 | 0 | 0.066568 | 1 | 1 | 0 | 2,259 |
1,523,706 | 2009-10-06T05:13:00.000 | 1 | 0 | 0 | 1 | 0 | python,python-3.x,werkzeug | 0 | 1,523,934 | 0 | 3 | 0 | false | 1 | 0 | I haven't used Werkzeug, so I can only answer question 2:
No, Werkzeug does not work on Python 3. In fact, very little works on Python 3 as of today. Porting is not difficult, but you can't port until all your third-party libraries have been ported, so progress is slow.
One big stopper has been setuptools, which is a v... | 3 | 2 | 0 | 0 | I've been looking really hard at all of the way**(s)** one can develop web applications using Python. For reference, we are using RHEL 64bit, apache, mod_wsgi.
History:
PHP + MySQL years ago
PHP + Python 2.x + MySQL recently and current
Python + PostgreSQL working on it
We use a great library for communicating betwe... | Werkzeug in General, and in Python 3.1 | 0 | 0.066568 | 1 | 1 | 0 | 2,259 |
1,523,706 | 2009-10-06T05:13:00.000 | 3 | 0 | 0 | 1 | 0 | python,python-3.x,werkzeug | 0 | 1,525,943 | 0 | 3 | 0 | false | 1 | 0 | mod_wsgi for Python 3.x is also not ready. There is no satisfactory definition of WSGI for Python 3.x yet; the WEB-SIG are still bashing out the issues. mod_wsgi targets a guess at what might be in it, but there are very likely to be changes to both the spec and to standard libraries. Any web application you write toda... | 3 | 2 | 0 | 0 | I've been looking really hard at all of the way**(s)** one can develop web applications using Python. For reference, we are using RHEL 64bit, apache, mod_wsgi.
History:
PHP + MySQL years ago
PHP + Python 2.x + MySQL recently and current
Python + PostgreSQL working on it
We use a great library for communicating betwe... | Werkzeug in General, and in Python 3.1 | 0 | 0.197375 | 1 | 1 | 0 | 2,259 |
1,524,713 | 2009-10-06T10:15:00.000 | 0 | 0 | 0 | 0 | 0 | python,django | 0 | 1,524,724 | 0 | 4 | 0 | false | 1 | 0 | You could make a Date object in javascript. Check the current time and depending on the time, you set the img src to whatever image you want for that time of day :) or hide the image through myimg.style.visibility = "hidden" if you dont want to display an image at that moment. | 2 | 1 | 0 | 0 | I'm supposed to display images at certain times of the day on the webpage, Please can anyone tell me how to go about it | How do I display images at different times on webpage | 0 | 0 | 1 | 0 | 1 | 328 |
1,524,713 | 2009-10-06T10:15:00.000 | 0 | 0 | 0 | 0 | 0 | python,django | 0 | 1,524,812 | 0 | 4 | 0 | false | 1 | 0 | If you need to change the image before a page refresh, you could use jquery ajax call to get the correct image. jquery has some interval functionality which would allow this. | 2 | 1 | 0 | 0 | I'm supposed to display images at certain times of the day on the webpage, Please can anyone tell me how to go about it | How do I display images at different times on webpage | 0 | 0 | 1 | 0 | 1 | 328 |
1,529,584 | 2009-10-07T05:07:00.000 | 1 | 0 | 1 | 1 | 0 | python,macos,osx-leopard | 0 | 1,529,596 | 0 | 3 | 0 | false | 0 | 0 | It probably failed because /var/log has user set to root and group set to wheel. Try running your python code as root and it will probably work. | 1 | 1 | 0 | 0 | how can i create new file in /var/log directory using python language in OSX leopard? i tried to do it using os.open function but i get "permission denied"
thanks in advance | how to create new file using python | 0 | 0.066568 | 1 | 0 | 0 | 1,509 |
1,529,896 | 2009-10-07T06:41:00.000 | 2 | 1 | 0 | 0 | 0 | python,ruby,scripting-language | 0 | 1,529,931 | 0 | 11 | 1 | false | 0 | 0 | Script languages have no differences compared with other languages in the sense that you still have to break your problems into manageable pieces -- that is, functions. So, instead of testing the whole script after finishing the whole script, I prefer to test those small functions before integrating them. TDD always h... | 4 | 6 | 0 | 0 | I am basically from the world of C language programming, now delving into the world of scripting languages like Ruby and Python.
I am wondering how to do debugging.
At present the steps I follow is,
I complete a large script,
Comment everything but the portion I
want to check
Execute the script
Though it works, I am... | Debugging a scripting language like ruby | 1 | 0.036348 | 1 | 0 | 0 | 1,224 |
1,529,896 | 2009-10-07T06:41:00.000 | 10 | 1 | 0 | 0 | 0 | python,ruby,scripting-language | 0 | 1,529,996 | 0 | 11 | 1 | true | 0 | 0 | Your sequence seems entirely backwards to me. Here's how I do it:
I write a test for the functionality I want.
I start writing the script, executing bits and verifying test results.
I review what I'd done to document and publish.
Specifically, I execute before I complete. It's way too late by then.
There are debugg... | 4 | 6 | 0 | 0 | I am basically from the world of C language programming, now delving into the world of scripting languages like Ruby and Python.
I am wondering how to do debugging.
At present the steps I follow is,
I complete a large script,
Comment everything but the portion I
want to check
Execute the script
Though it works, I am... | Debugging a scripting language like ruby | 1 | 1.2 | 1 | 0 | 0 | 1,224 |
1,529,896 | 2009-10-07T06:41:00.000 | 0 | 1 | 0 | 0 | 0 | python,ruby,scripting-language | 0 | 1,531,112 | 0 | 11 | 1 | false | 0 | 0 | The debugging method you described is perfect for a static language like C++, but given that the language is so different, the coding methods are similarly different. One of the big very important things in a dynamic language such as Python or Ruby is the interactive toplevel (what you get by typing, say python on the ... | 4 | 6 | 0 | 0 | I am basically from the world of C language programming, now delving into the world of scripting languages like Ruby and Python.
I am wondering how to do debugging.
At present the steps I follow is,
I complete a large script,
Comment everything but the portion I
want to check
Execute the script
Though it works, I am... | Debugging a scripting language like ruby | 1 | 0 | 1 | 0 | 0 | 1,224 |
1,529,896 | 2009-10-07T06:41:00.000 | 2 | 1 | 0 | 0 | 0 | python,ruby,scripting-language | 0 | 1,530,723 | 0 | 11 | 1 | false | 0 | 0 | My question is, is there any better way of debugging?"
Yes.
Your approach, "1. I complete a large script, 2. Comment everything but the portion I want to check, 3. Execute the script" is not really the best way to write any software in any language (sorry, but that's the truth.)
Do not write a large anything. Ever.
Do... | 4 | 6 | 0 | 0 | I am basically from the world of C language programming, now delving into the world of scripting languages like Ruby and Python.
I am wondering how to do debugging.
At present the steps I follow is,
I complete a large script,
Comment everything but the portion I
want to check
Execute the script
Though it works, I am... | Debugging a scripting language like ruby | 1 | 0.036348 | 1 | 0 | 0 | 1,224 |
1,530,960 | 2009-10-07T11:08:00.000 | 1 | 0 | 0 | 0 | 0 | python,numpy,memory-management | 0 | 1,534,340 | 0 | 4 | 1 | false | 0 | 0 | On possible option is to do a single pass through the file first to count the number of rows, without loading them.
The other option is to double your table size each time, which has two benefits:
You will only re-alloc memory log(n) times where n is the number of rows.
You only need 50% more ram than your largest tab... | 1 | 11 | 1 | 0 | I have a series of large text files (up to 1 gig) that are output from an experiment that need to be analysed in Python. They would be best loaded into a 2D numpy array, which presents the first question:
As the number of rows is unknown at the beginning of the loading, how can
a very large numpy array be most efficie... | Incrementally building a numpy array and measuring memory usage | 0 | 0.049958 | 1 | 0 | 0 | 6,464 |
1,532,306 | 2009-10-07T15:20:00.000 | 2 | 0 | 1 | 1 | 0 | python,windows,registry | 0 | 1,532,868 | 0 | 3 | 0 | false | 0 | 0 | HKEY_CURRENT_USER maps to a HKEY_USERS\{id} key.
Try finding the id by matching the HKEY_USERS{id}\Volatile Environment\USERNAME key to the username of the user (by enumerating/iterating over the {id}s that are present on the system). When you find the match just use HKEY_USERS{id} as if it was HKEY_CURRENT_USER | 1 | 1 | 0 | 0 | In my application I run subprocesses under several different user accounts. I need to be able to read some of the information written to the registry by these subprocesses. Each one is writing to HKEY_CURRENT_USER, and I know the user account name that they are running under.
In Python, how can I read values from HKEY_... | Reading HKEY CURRENT USER from the registry in Python, specifying the user | 0 | 0.132549 | 1 | 0 | 0 | 8,899 |
1,532,720 | 2009-10-07T16:28:00.000 | 5 | 1 | 1 | 0 | 1 | python,multithreading,md5,crc32,hashlib | 1 | 1,533,036 | 0 | 6 | 0 | false | 0 | 0 | It's an algorithm selection problem, rather than a library/language selection problem!
There appears to be two points to consider primarily:
how much would the disk I/O affect the overall performance?
what is the expected reliability of the error detection feature?
Apparently, the answer to the second question is som... | 5 | 6 | 0 | 0 | i need to transfer large files across network and need to create checksum for them on hourly basis. so the speed for generating checksum is critical for me.
somehow i can't make zlib.crc32 and zlib.adler32 working with files larger than 4GB on Windows XP Pro 64bit machine. i suspect i've hit the 32bit limitation here? ... | the fastest way to create checksum for large files in python | 1 | 0.16514 | 1 | 0 | 0 | 17,263 |
1,532,720 | 2009-10-07T16:28:00.000 | 1 | 1 | 1 | 0 | 1 | python,multithreading,md5,crc32,hashlib | 1 | 1,532,764 | 0 | 6 | 0 | false | 0 | 0 | You cannot possibly use more than one core to calculate MD5 hash of a large file because of the very nature of MD5: it expects a message to be broken up in chunks and fed into hashing function in strict sequence. However, you can use one thread to read a file into internal queue, and then calculate hash in a separate t... | 5 | 6 | 0 | 0 | i need to transfer large files across network and need to create checksum for them on hourly basis. so the speed for generating checksum is critical for me.
somehow i can't make zlib.crc32 and zlib.adler32 working with files larger than 4GB on Windows XP Pro 64bit machine. i suspect i've hit the 32bit limitation here? ... | the fastest way to create checksum for large files in python | 1 | 0.033321 | 1 | 0 | 0 | 17,263 |
1,532,720 | 2009-10-07T16:28:00.000 | 3 | 1 | 1 | 0 | 1 | python,multithreading,md5,crc32,hashlib | 1 | 1,533,255 | 0 | 6 | 0 | false | 0 | 0 | First, there is nothing inherent in any of the CRC algorithms that would prevent them working on an arbitrary length of data (however, a particular implementation might well impose a limit).
However, in a file syncing application, that probably doesn't matter, as you may not want to hash the entire file when it gets la... | 5 | 6 | 0 | 0 | i need to transfer large files across network and need to create checksum for them on hourly basis. so the speed for generating checksum is critical for me.
somehow i can't make zlib.crc32 and zlib.adler32 working with files larger than 4GB on Windows XP Pro 64bit machine. i suspect i've hit the 32bit limitation here? ... | the fastest way to create checksum for large files in python | 1 | 0.099668 | 1 | 0 | 0 | 17,263 |
1,532,720 | 2009-10-07T16:28:00.000 | 2 | 1 | 1 | 0 | 1 | python,multithreading,md5,crc32,hashlib | 1 | 1,540,992 | 0 | 6 | 0 | false | 0 | 0 | You might be hitting a size limit for files in XP. The 64-bit gives you more addressing space (removing the 2GB (or so) addressing space per application), but probably does nothing for the file size problem. | 5 | 6 | 0 | 0 | i need to transfer large files across network and need to create checksum for them on hourly basis. so the speed for generating checksum is critical for me.
somehow i can't make zlib.crc32 and zlib.adler32 working with files larger than 4GB on Windows XP Pro 64bit machine. i suspect i've hit the 32bit limitation here? ... | the fastest way to create checksum for large files in python | 1 | 0.066568 | 1 | 0 | 0 | 17,263 |
1,532,720 | 2009-10-07T16:28:00.000 | 1 | 1 | 1 | 0 | 1 | python,multithreading,md5,crc32,hashlib | 1 | 1,532,779 | 0 | 6 | 0 | false | 0 | 0 | md5 itself can't be run in parallel. However you can md5 the file in sections (in parallel) and the take an md5 of the list of hashes.
However that assumes that the hashing is not IO-limited, which I would suspect it is. As Anton Gogolev suggests - make sure that you're reading the file efficiently (in large power-of-2... | 5 | 6 | 0 | 0 | i need to transfer large files across network and need to create checksum for them on hourly basis. so the speed for generating checksum is critical for me.
somehow i can't make zlib.crc32 and zlib.adler32 working with files larger than 4GB on Windows XP Pro 64bit machine. i suspect i've hit the 32bit limitation here? ... | the fastest way to create checksum for large files in python | 1 | 0.033321 | 1 | 0 | 0 | 17,263 |
1,534,070 | 2009-10-07T20:40:00.000 | 2 | 0 | 0 | 0 | 0 | python | 0 | 1,537,103 | 0 | 8 | 0 | false | 1 | 0 | Whose web server? If it is a web server provided by a web hosting company or someone else and you don't have control over it, you need to ascertain in what way they support the use of Python for writing web applications. It isn't enough to know just that they have Python available.
As pointed out by others, is likely t... | 1 | 11 | 0 | 0 | Most likely it's a dumb question for those who knows the answer, but I'm a beginner, and here it goes:
I have a Python script which I run in a command-line with some parameter, and it prints me some results. Let's say results are some HTML code.
I never done any Python programming for web, and couldn't figure it out...... | Python: how to show results on a web page? | 0 | 0.049958 | 1 | 0 | 0 | 29,818 |
1,538,589 | 2009-10-08T15:36:00.000 | 0 | 0 | 1 | 0 | 0 | python | 0 | 1,538,805 | 0 | 11 | 0 | false | 0 | 0 | What if you break it up into syllables and then use those to construct words to compare to your dictionary. It's still a brute force method, but it would surely speed things up a bit. | 3 | 1 | 0 | 0 | I'm wondering how to proceed with this task, take this string for example "thingsandstuff".
How could I generate all possible strings out of this string as to look them up individually against an english dictionary?
The goal is to find valid english words in a string that does not contain space.
Thanks | How to sort all possible words out of a string? | 0 | 0 | 1 | 0 | 0 | 3,534 |
1,538,589 | 2009-10-08T15:36:00.000 | 0 | 0 | 1 | 0 | 0 | python | 0 | 1,538,687 | 0 | 11 | 0 | false | 0 | 0 | Well here is my idea
Find all possible strings containing 1 character from the original
Find all possible strings containing 2 characters from the original
... Same thing up to the length of the original string
Then add all up and go match with your dictionary | 3 | 1 | 0 | 0 | I'm wondering how to proceed with this task, take this string for example "thingsandstuff".
How could I generate all possible strings out of this string as to look them up individually against an english dictionary?
The goal is to find valid english words in a string that does not contain space.
Thanks | How to sort all possible words out of a string? | 0 | 0 | 1 | 0 | 0 | 3,534 |
1,538,589 | 2009-10-08T15:36:00.000 | 3 | 0 | 1 | 0 | 0 | python | 0 | 1,538,637 | 0 | 11 | 0 | false | 0 | 0 | The brute force approach, i.e. checking every substring, is computationally unfeasible even for strings of middling lengths (a string of length N has O(N**2) substrings). Unless there is a pretty tight bound on the length of strings you care about, that doesn't scale well.
To make things more feasible, more knowledge i... | 3 | 1 | 0 | 0 | I'm wondering how to proceed with this task, take this string for example "thingsandstuff".
How could I generate all possible strings out of this string as to look them up individually against an english dictionary?
The goal is to find valid english words in a string that does not contain space.
Thanks | How to sort all possible words out of a string? | 0 | 0.054491 | 1 | 0 | 0 | 3,534 |
1,541,776 | 2009-10-09T04:24:00.000 | 6 | 0 | 1 | 1 | 0 | python,macos,installation,upgrade | 0 | 1,541,785 | 0 | 7 | 0 | false | 0 | 0 | May I suggest you leave the "Default" be, and install Python in /usr/local/bin.
Download python
Unzip it
./configure
make
sudo make install
done.
Since /usr/local/bin comes before /usr/bin in the $PATH, you will invoke 2.6 when you type python, but the OS will remain stable... | 2 | 14 | 0 | 0 | I'd like to upgrade the default python installation (2.5.1) supplied with OS X Leopard to the latest version. Please let me know how I can achieve this.
Thanks | Upgrade Python to 2.6 on Mac | 0 | 1 | 1 | 0 | 0 | 13,472 |
1,541,776 | 2009-10-09T04:24:00.000 | 20 | 0 | 1 | 1 | 0 | python,macos,installation,upgrade | 0 | 1,541,850 | 0 | 7 | 0 | false | 0 | 0 | When an OS is distributed with some specific Python release and uses it for some OS functionality (as is the case with Mac OS X, as well as many Linux distros &c), you should not tamper in any way with the system-supplied Python (as in, "upgrading" it and the like): while Python strives for backwards compatibility with... | 2 | 14 | 0 | 0 | I'd like to upgrade the default python installation (2.5.1) supplied with OS X Leopard to the latest version. Please let me know how I can achieve this.
Thanks | Upgrade Python to 2.6 on Mac | 0 | 1 | 1 | 0 | 0 | 13,472 |
1,548,620 | 2009-10-10T17:56:00.000 | 0 | 0 | 0 | 0 | 0 | python | 0 | 1,548,641 | 0 | 7 | 0 | false | 0 | 1 | I started Python over a year ago too, also C++ background.
I've learned that everything is simpler in Python, you don't need to worry so much if you're doing it right, you probably are. Most of the things came natural.
I can't say I've read a book or anything, I usually pested the guys in #python on freenode a lot an... | 2 | 4 | 0 | 1 | I have a background in C++ and Java and Objective C programming, but i am finding it hard to learn python, basically where its "Main Function" or from where the program start executing. So is there any tutorial/book which can teach python to people who have background in C++ or Java. Basically something which can show ... | Python for C++ or Java Programmer | 1 | 0 | 1 | 0 | 0 | 463 |
1,548,620 | 2009-10-10T17:56:00.000 | 0 | 0 | 0 | 0 | 0 | python | 0 | 1,548,801 | 0 | 7 | 0 | false | 0 | 1 | The pithiest comment I guess is that the entry point is the 1st line of your script that is not a function or a class. You don't necessarily need to use the if hack unless you want to and your script is meant to be imported. | 2 | 4 | 0 | 1 | I have a background in C++ and Java and Objective C programming, but i am finding it hard to learn python, basically where its "Main Function" or from where the program start executing. So is there any tutorial/book which can teach python to people who have background in C++ or Java. Basically something which can show ... | Python for C++ or Java Programmer | 1 | 0 | 1 | 0 | 0 | 463 |
1,553,114 | 2009-10-12T07:06:00.000 | 5 | 0 | 0 | 0 | 0 | python,algorithm | 0 | 1,553,126 | 0 | 4 | 0 | true | 0 | 0 | Why not download some real open source repos and use those?
Have you thought about what goes into the files? is that random data too? | 1 | 2 | 1 | 0 | I'd like to profile some VCS software, and to do so I want to generate a set of random files, in randomly arranged directories. I'm writing the script in Python, but my question is briefly: how do I generate a random directory tree with an average number of sub-directories per directory and some broad distribution of f... | Generate random directories/files given number of files and depth | 0 | 1.2 | 1 | 0 | 0 | 3,603 |
1,554,546 | 2009-10-12T13:22:00.000 | 5 | 0 | 1 | 0 | 1 | python,properties | 0 | 1,554,639 | 0 | 8 | 0 | false | 0 | 0 | A basic reason is really simply that it looks better. It is more pythonic. Especially for libraries. something.getValue() looks less nice than something.value
In plone (a pretty big CMS), you used to have document.setTitle() which does a lot of things like storing the value, indexing it again and so. Just doing doc... | 4 | 81 | 0 | 0 | It appears to me that except for a little syntactic sugar, property() does nothing good.
Sure, it's nice to be able to write a.b=2 instead of a.setB(2), but hiding the fact that a.b=2 isn't a simple assignment looks like a recipe for trouble, either because some unexpected result can happen, such as a.b=2 actually caus... | When and how to use the builtin function property() in python | 0 | 0.124353 | 1 | 0 | 0 | 35,751 |
1,554,546 | 2009-10-12T13:22:00.000 | 1 | 0 | 1 | 0 | 1 | python,properties | 0 | 34,562,077 | 0 | 8 | 0 | false | 0 | 0 | getters and setters are needed for many purposes, and are very useful because they are transparent to the code. Having object Something the property height, you assign a value as Something.height = 10, but if height has a getter and setter then at the time you do assign that value you can do many things in the procedur... | 4 | 81 | 0 | 0 | It appears to me that except for a little syntactic sugar, property() does nothing good.
Sure, it's nice to be able to write a.b=2 instead of a.setB(2), but hiding the fact that a.b=2 isn't a simple assignment looks like a recipe for trouble, either because some unexpected result can happen, such as a.b=2 actually caus... | When and how to use the builtin function property() in python | 0 | 0.024995 | 1 | 0 | 0 | 35,751 |
1,554,546 | 2009-10-12T13:22:00.000 | 15 | 0 | 1 | 0 | 1 | python,properties | 0 | 1,554,753 | 0 | 8 | 0 | false | 0 | 0 | but hiding the fact that a.b=2 isn't a
simple assignment looks like a recipe
for trouble
You're not hiding that fact though; that fact was never there to begin with. This is python -- a high-level language; not assembly. Few of the "simple" statements in it boil down to single CPU instructions. To read simplici... | 4 | 81 | 0 | 0 | It appears to me that except for a little syntactic sugar, property() does nothing good.
Sure, it's nice to be able to write a.b=2 instead of a.setB(2), but hiding the fact that a.b=2 isn't a simple assignment looks like a recipe for trouble, either because some unexpected result can happen, such as a.b=2 actually caus... | When and how to use the builtin function property() in python | 0 | 1 | 1 | 0 | 0 | 35,751 |
1,554,546 | 2009-10-12T13:22:00.000 | 3 | 0 | 1 | 0 | 1 | python,properties | 0 | 1,556,870 | 0 | 8 | 0 | false | 0 | 0 | You are correct, it is just syntactic sugar. It may be that there are no good uses of it depending on your definition of problematic code.
Consider that you have a class Foo that is widely used in your application. Now this application has got quite large and further lets say it's a webapp that has become very popular.... | 4 | 81 | 0 | 0 | It appears to me that except for a little syntactic sugar, property() does nothing good.
Sure, it's nice to be able to write a.b=2 instead of a.setB(2), but hiding the fact that a.b=2 isn't a simple assignment looks like a recipe for trouble, either because some unexpected result can happen, such as a.b=2 actually caus... | When and how to use the builtin function property() in python | 0 | 0.07486 | 1 | 0 | 0 | 35,751 |
1,556,668 | 2009-10-12T20:22:00.000 | 2 | 1 | 0 | 1 | 0 | python,perl | 0 | 1,557,216 | 0 | 8 | 0 | false | 0 | 0 | Well, if you really want to write the GUI in another language (which, seriously, is just a bad idea, since it will cost you more than it could ever benefit you), the thing you should do is the following:
Document your Perl app in terms of the services it provides. You should do it with XML Schema Definition - XSD - fo... | 3 | 1 | 0 | 0 | We have a sizable code base in Perl. For the forseeable future, our codebase will remain in Perl. However, we're looking into adding a GUI-based dashboard utility. We are considering writing the dashboard in Python (using tkinter or wx). The problem, however, is that we would like to leverage our existing Perl codebase... | Recommendations for perl-to-python interoperation? | 0 | 0.049958 | 1 | 0 | 0 | 406 |
1,556,668 | 2009-10-12T20:22:00.000 | 1 | 1 | 0 | 1 | 0 | python,perl | 0 | 1,560,979 | 0 | 8 | 0 | false | 0 | 0 | Interesting project: I would opt for loose-coupling and consider an XML-RPC or JSON based approach. | 3 | 1 | 0 | 0 | We have a sizable code base in Perl. For the forseeable future, our codebase will remain in Perl. However, we're looking into adding a GUI-based dashboard utility. We are considering writing the dashboard in Python (using tkinter or wx). The problem, however, is that we would like to leverage our existing Perl codebase... | Recommendations for perl-to-python interoperation? | 0 | 0.024995 | 1 | 0 | 0 | 406 |
1,556,668 | 2009-10-12T20:22:00.000 | 7 | 1 | 0 | 1 | 0 | python,perl | 0 | 1,557,825 | 0 | 8 | 0 | false | 0 | 0 | I hate to be another one in the chorus, but...
Avoid the use of an alternate language
Use Wx so it's native look and feel makes the application look "real" to non-technical audiences.
Download the Padre source code and see how it does Wx Perl code, then steal rampantly from it's best tricks or maybe just gut it and us... | 3 | 1 | 0 | 0 | We have a sizable code base in Perl. For the forseeable future, our codebase will remain in Perl. However, we're looking into adding a GUI-based dashboard utility. We are considering writing the dashboard in Python (using tkinter or wx). The problem, however, is that we would like to leverage our existing Perl codebase... | Recommendations for perl-to-python interoperation? | 0 | 1 | 1 | 0 | 0 | 406 |
1,570,401 | 2009-10-15T05:13:00.000 | 1 | 0 | 0 | 1 | 0 | python,linux,usergroups | 0 | 1,571,882 | 0 | 4 | 0 | false | 0 | 0 | There are no library calls for creating a group. This is because there's really no such thing as creating a group. A GID is simply a number assigned to a process or a file. All these numbers exist already - there is nothing you need to do to start using a GID. With the appropriate privileges, you can call chown(2) to s... | 3 | 6 | 0 | 0 | I want to create a user group using python on CentOS system. When I say 'using python' I mean I don't want to do something like os.system and give the unix command to create a new group. I would like to know if there is any python module that deals with this.
Searching on the net did not reveal much about what I want, ... | Create a user-group in linux using python | 0 | 0.049958 | 1 | 0 | 0 | 6,393 |
1,570,401 | 2009-10-15T05:13:00.000 | 5 | 0 | 0 | 1 | 0 | python,linux,usergroups | 0 | 1,570,429 | 0 | 4 | 0 | false | 0 | 0 | I think you should use the commandline programs from your program, a lot of care has gone into making sure that they don't break the groups file if something goes wrong.
However the file format is quite straight forward to write something yourself if you choose to go that way | 3 | 6 | 0 | 0 | I want to create a user group using python on CentOS system. When I say 'using python' I mean I don't want to do something like os.system and give the unix command to create a new group. I would like to know if there is any python module that deals with this.
Searching on the net did not reveal much about what I want, ... | Create a user-group in linux using python | 0 | 0.244919 | 1 | 0 | 0 | 6,393 |
1,570,401 | 2009-10-15T05:13:00.000 | 11 | 0 | 0 | 1 | 0 | python,linux,usergroups | 0 | 1,570,448 | 0 | 4 | 0 | true | 0 | 0 | I don't know of a python module to do it, but the /etc/group and /etc/gshadow format is pretty standard, so if you wanted you could just open the files, parse their current contents and then add the new group if necessary.
Before you go doing this, consider:
What happens if you try to add a group that already exists o... | 3 | 6 | 0 | 0 | I want to create a user group using python on CentOS system. When I say 'using python' I mean I don't want to do something like os.system and give the unix command to create a new group. I would like to know if there is any python module that deals with this.
Searching on the net did not reveal much about what I want, ... | Create a user-group in linux using python | 0 | 1.2 | 1 | 0 | 0 | 6,393 |
1,581,895 | 2009-10-17T10:21:00.000 | 1 | 0 | 1 | 0 | 0 | python,multithreading,queue | 0 | 1,581,902 | 0 | 13 | 0 | false | 0 | 0 | The way I solved this (actually I did this in Scala, not Python) was to use both a Set and a Queue, only adding links to the queue (and set) if they did not already exist in the set.
Both the set and queue were encapsulated in a single thread, exposing only a queue-like interface to the consumer threads.
Edit: someone ... | 5 | 17 | 0 | 0 | I'm writing a simple crawler in Python using the threading and Queue modules. I fetch a page, check links and put them into a queue, when a certain thread has finished processing page, it grabs the next one from the queue. I'm using an array for the pages I've already visited to filter the links I add to the queue, but... | How check if a task is already in python Queue? | 0 | 0.015383 | 1 | 0 | 1 | 12,544 |
1,581,895 | 2009-10-17T10:21:00.000 | 1 | 0 | 1 | 0 | 0 | python,multithreading,queue | 0 | 1,581,903 | 0 | 13 | 0 | false | 0 | 0 | SQLite is so simple to use and would fit perfectly... just a suggestion. | 5 | 17 | 0 | 0 | I'm writing a simple crawler in Python using the threading and Queue modules. I fetch a page, check links and put them into a queue, when a certain thread has finished processing page, it grabs the next one from the queue. I'm using an array for the pages I've already visited to filter the links I add to the queue, but... | How check if a task is already in python Queue? | 0 | 0.015383 | 1 | 0 | 1 | 12,544 |
1,581,895 | 2009-10-17T10:21:00.000 | -3 | 0 | 1 | 0 | 0 | python,multithreading,queue | 0 | 1,581,908 | 0 | 13 | 0 | false | 0 | 0 | Also, instead of a set you might try using a dictionary. Operations on sets tend to get rather slow when they're big, whereas a dictionary lookup is nice and quick.
My 2c. | 5 | 17 | 0 | 0 | I'm writing a simple crawler in Python using the threading and Queue modules. I fetch a page, check links and put them into a queue, when a certain thread has finished processing page, it grabs the next one from the queue. I'm using an array for the pages I've already visited to filter the links I add to the queue, but... | How check if a task is already in python Queue? | 0 | -0.046121 | 1 | 0 | 1 | 12,544 |
1,581,895 | 2009-10-17T10:21:00.000 | 1 | 0 | 1 | 0 | 0 | python,multithreading,queue | 0 | 1,581,920 | 0 | 13 | 0 | false | 0 | 0 | Why only use the array (ideally, a dictionary would be even better) to filter things you've already visited? Add things to your array/dictionary as soon as you queue them up, and only add them to the queue if they're not already in the array/dict. Then you have 3 simple separate things:
Links not yet seen (neither in ... | 5 | 17 | 0 | 0 | I'm writing a simple crawler in Python using the threading and Queue modules. I fetch a page, check links and put them into a queue, when a certain thread has finished processing page, it grabs the next one from the queue. I'm using an array for the pages I've already visited to filter the links I add to the queue, but... | How check if a task is already in python Queue? | 0 | 0.015383 | 1 | 0 | 1 | 12,544 |
1,581,895 | 2009-10-17T10:21:00.000 | 0 | 0 | 1 | 0 | 0 | python,multithreading,queue | 0 | 1,582,421 | 0 | 13 | 0 | false | 0 | 0 | instead of "array of pages already visited" make an "array of pages already added to the queue" | 5 | 17 | 0 | 0 | I'm writing a simple crawler in Python using the threading and Queue modules. I fetch a page, check links and put them into a queue, when a certain thread has finished processing page, it grabs the next one from the queue. I'm using an array for the pages I've already visited to filter the links I add to the queue, but... | How check if a task is already in python Queue? | 0 | 0 | 1 | 0 | 1 | 12,544 |
1,586,008 | 2009-10-18T20:56:00.000 | 0 | 0 | 0 | 0 | 0 | php,python,ruby-on-rails,database | 0 | 1,586,035 | 0 | 4 | 1 | false | 1 | 0 | It would be great if code written for one platform would work on every other without any modification whatsoever, but this is usually not the case and probably never will be. What the current frameworks do is about all anyone can. | 3 | 2 | 0 | 0 | I start feeling old fashioned when I see all these SQL generating database abstraction layers and all those ORMs out there, although I am far from being old. I understand the need for them, but their use spreads to places they normally don't belong to.
I firmly believe that using database abstraction layers for SQL gen... | PHP, Python, Ruby application with multiple RDBMS | 0 | 0 | 1 | 1 | 0 | 369 |
1,586,008 | 2009-10-18T20:56:00.000 | 2 | 0 | 0 | 0 | 0 | php,python,ruby-on-rails,database | 0 | 1,586,105 | 0 | 4 | 1 | false | 1 | 0 | If you want to leverage the bells and whistles of various RDBMSes, you can certainly do it. Just apply standard OO Principles. Figure out what kind of API your persistence layer will need to provide.
You'll end up writing a set of isomorphic persistence adapter classes. From the perspective of your model code (whi... | 3 | 2 | 0 | 0 | I start feeling old fashioned when I see all these SQL generating database abstraction layers and all those ORMs out there, although I am far from being old. I understand the need for them, but their use spreads to places they normally don't belong to.
I firmly believe that using database abstraction layers for SQL gen... | PHP, Python, Ruby application with multiple RDBMS | 0 | 0.099668 | 1 | 1 | 0 | 369 |
1,586,008 | 2009-10-18T20:56:00.000 | 2 | 0 | 0 | 0 | 0 | php,python,ruby-on-rails,database | 0 | 1,587,887 | 0 | 4 | 1 | true | 1 | 0 | You cannot eat a cake and have it, choose on of the following options.
Use your database abstraction layer whenever you can and in the rare cases when you have a need for a hand-made query (eg. performance reasons) stick to the lowest common denominator and don't use stored procedures or any proprietary extensions tha... | 3 | 2 | 0 | 0 | I start feeling old fashioned when I see all these SQL generating database abstraction layers and all those ORMs out there, although I am far from being old. I understand the need for them, but their use spreads to places they normally don't belong to.
I firmly believe that using database abstraction layers for SQL gen... | PHP, Python, Ruby application with multiple RDBMS | 0 | 1.2 | 1 | 1 | 0 | 369 |
1,587,991 | 2009-10-19T10:42:00.000 | 2 | 1 | 1 | 0 | 0 | python | 0 | 1,588,007 | 0 | 2 | 1 | true | 0 | 0 | This is what Apache is for.
Create a directory that will have the reports.
Configure Apache to serve files from that directory.
If the report exists, redirect to a URL that Apache will serve.
Otherwise, the report doesn't exist, so create it. Then redirect to a URL that Apache will serve.
There's no "hashing". You h... | 1 | 1 | 0 | 0 | I have a web server that is dynamically creating various reports in several formats (pdf and doc files). The files require a fair amount of CPU to generate, and it is fairly common to have situations where two people are creating the same report with the same input.
Inputs:
raw data input as a string (equations, numbe... | Caching system for dynamically created files? | 0 | 1.2 | 1 | 0 | 0 | 141 |
1,604,391 | 2009-10-22T00:25:00.000 | 1 | 0 | 1 | 0 | 0 | python,oop | 0 | 1,604,426 | 0 | 5 | 0 | false | 0 | 0 | There are many 'mindsets' that you could adopt to help in the design process (some of which point towards OO and some that don't). I think it is often better to start with questions rather than answers (i.e. rather than say, 'how can I apply inheritance to this' you should ask how this system might expect to change ove... | 3 | 6 | 0 | 0 | I'm trying to learn object oriented programming, but am having a hard time overcoming my structured programming background (mainly C, but many others over time). I thought I'd write a simple check register program as an exercise. I put something together pretty quickly (python is a great language), with my data in so... | Object oriented design? | 1 | 0.039979 | 1 | 0 | 0 | 1,625 |
1,604,391 | 2009-10-22T00:25:00.000 | 7 | 0 | 1 | 0 | 0 | python,oop | 0 | 1,604,427 | 0 | 5 | 0 | false | 0 | 0 | You don't have to throw out structured programming to do object-oriented programming. The code is still structured, it just belongs to the objects rather than being separate from them.
In classical programming, code is the driving force that operates on data, leading to a dichotomy (and the possibility that code can op... | 3 | 6 | 0 | 0 | I'm trying to learn object oriented programming, but am having a hard time overcoming my structured programming background (mainly C, but many others over time). I thought I'd write a simple check register program as an exercise. I put something together pretty quickly (python is a great language), with my data in so... | Object oriented design? | 1 | 1 | 1 | 0 | 0 | 1,625 |
1,604,391 | 2009-10-22T00:25:00.000 | 3 | 0 | 1 | 0 | 0 | python,oop | 0 | 1,604,403 | 0 | 5 | 0 | false | 0 | 0 | "My data is basically a list of accounts"
Account is a class.
"dicts that represent transactions"
Transaction appears to be a class. You happen to have elected to represent this as a dict.
That's your first pass at OO design. Focus on the Responsibilities and Collaborators.
You have at least two classes of objects. | 3 | 6 | 0 | 0 | I'm trying to learn object oriented programming, but am having a hard time overcoming my structured programming background (mainly C, but many others over time). I thought I'd write a simple check register program as an exercise. I put something together pretty quickly (python is a great language), with my data in so... | Object oriented design? | 1 | 0.119427 | 1 | 0 | 0 | 1,625 |
1,604,811 | 2009-10-22T03:06:00.000 | 1 | 0 | 0 | 0 | 0 | python,user-interface | 1 | 1,604,842 | 0 | 2 | 0 | false | 0 | 1 | If by printf you mean exactly thqt call from C code, you need to redirect (and un-buffer) your standard output (file descriptor 0) to somewhere you can pick up the data from -- far from trivial, esp. in Windows, although maybe doable. But why not just change that call in your C code to something more sensible? (Worst... | 1 | 0 | 0 | 0 | I am using the Python/C API with my app and am wondering how you can get console output with a gui app. When there is a script error, it is displayed via printf but this obviously has no effect with a gui app. I want to be able to obtain the output without creating a console. Can this be done?
Edit - Im using Windows, ... | How to get output? | 0 | 0.099668 | 1 | 0 | 0 | 173 |
1,613,927 | 2009-10-23T14:41:00.000 | 2 | 0 | 1 | 0 | 0 | python,debugging,pydev | 0 | 6,309,211 | 1 | 3 | 0 | false | 0 | 0 | You can run arbitrary commands in the console during the breakpoint. For my needs, this typically achieves the same purpose as coding live, although I do wish it were as elegant as simply using the editor. | 2 | 6 | 0 | 0 | I am new to python and haven't been able to find out whether this is possible or not.
I am using the PyDev plugin under Eclipse, and basically all I want to find out is, is it possible to edit code whilst you're sitting at a breakpoint? I.e. Edit code whilst you're debugging.
It allows me to do this at present, but it ... | Python Debugging: code editing on the fly | 1 | 0.132549 | 1 | 0 | 0 | 1,488 |
1,613,927 | 2009-10-23T14:41:00.000 | 2 | 0 | 1 | 0 | 0 | python,debugging,pydev | 0 | 1,614,052 | 1 | 3 | 0 | false | 0 | 0 | When you start a Python program, it will be compiled into bytecode (and possibly saved as .pyc file). That means you can change the source but since you don't "open" the source again, the change won't be picked up.
There are systems like TurboGears (a web framework) which detect these changes and restart themselves but... | 2 | 6 | 0 | 0 | I am new to python and haven't been able to find out whether this is possible or not.
I am using the PyDev plugin under Eclipse, and basically all I want to find out is, is it possible to edit code whilst you're sitting at a breakpoint? I.e. Edit code whilst you're debugging.
It allows me to do this at present, but it ... | Python Debugging: code editing on the fly | 1 | 0.132549 | 1 | 0 | 0 | 1,488 |
1,614,190 | 2009-10-23T15:24:00.000 | 2 | 0 | 1 | 0 | 0 | python | 0 | 1,614,204 | 0 | 3 | 0 | false | 0 | 0 | Write a comment? Python comments start with #. | 1 | 1 | 0 | 0 | When writing code in Python, how can you write something next to it that explains what the code is doing, but which doesn't affect the code? | How do I add text describing the code into a Python source file? | 0 | 0.132549 | 1 | 0 | 0 | 419 |
1,622,884 | 2009-10-26T02:52:00.000 | 2 | 0 | 0 | 0 | 0 | wxpython,drag,playing-cards | 0 | 1,623,027 | 0 | 2 | 0 | false | 0 | 1 | Going through the wxPython demo and looking at all the examples would be a good start. You'll likely find page Using Images | DragImage to be useful, since you'll probably want cards that you can drag.
Generally, the demo can help you do most things in wxPython, and also show you what wxPython can do, and it's worth t... | 1 | 0 | 0 | 0 | I know python and I'm a newibe with wx python but I would like to make a card game.
However I have no idea how to make a image follow the mouse and put it in the middle of the screen when the program running. It will be nice if you guys can help me out. | wx python card game | 0 | 0.197375 | 1 | 0 | 0 | 877 |
1,635,565 | 2009-10-28T00:47:00.000 | 1 | 0 | 0 | 0 | 0 | python,powerpoint | 0 | 1,737,489 | 0 | 4 | 0 | false | 0 | 0 | Save the file with the extension ".pps". That will make powerpoint open the file in presentation mode.
The presentaion needs to designed to advance slides, else you will have to script that part. | 1 | 2 | 0 | 0 | I was wondering how I can make a script load powerpoint file, advance slides automatically and put it on full screen. Is there a way to make windows do that? Can I just load powerpoint.exe and maybe use some sort of API/Pipe to give commands from another script.
To make a case: I'm making a script that automatically sc... | How do I make powerpoint play presentations/load up ppts automatically? | 0 | 0.049958 | 1 | 0 | 0 | 4,926 |
1,643,362 | 2009-10-29T12:26:00.000 | 1 | 1 | 0 | 1 | 0 | python | 0 | 1,643,387 | 0 | 4 | 0 | false | 0 | 0 | Raise exeption and handle it in main or use sys.exit | 1 | 1 | 0 | 0 | I am looking for a simple Python webserver that is easy to kill from within code. Right now, I'm playing with Bottle, but I can't find any way at all to kill it in code. If you know how to kill Bottle (in code, no Ctrl+C) that would be super, but I'll take anything that's Python, simple, and killable. | Killing Python webservers | 0 | 0.049958 | 1 | 0 | 0 | 410 |
1,645,550 | 2009-10-29T18:07:00.000 | 3 | 0 | 1 | 0 | 0 | c#,.net,python,clr | 0 | 1,645,603 | 0 | 2 | 0 | false | 0 | 0 | This is supported at the CLR level. The argument variable at slot 0 represents the "this" pointer. C# essentially generates calls to this as ldarg.0 | 1 | 2 | 0 | 0 | When you have an object instance in C#, you can use the this keyword inside the instance scope. How does the compiler handles it? Is there any assistance for this at runtime?
I am mainly wondering how C# does it vs in python you have to provide self for every function manually. | How this keyword is provided for object instances in C#? | 0 | 0.291313 | 1 | 0 | 0 | 334 |
1,650,856 | 2009-10-30T16:21:00.000 | 1 | 0 | 0 | 0 | 0 | python,ms-access | 0 | 1,652,783 | 0 | 6 | 0 | false | 0 | 0 | Is your script executing a single INSERT statement per row of data? If so, pre-processing the data into a text file of many rows that could then be inserted with a single INSERT statement might improve the efficiency and cut down on the accumulating temporary crud that's causing it to bloat.
You might also make sure t... | 4 | 1 | 0 | 0 | I have a database which I regularly need to import large amounts of data into via some python scripts. Compacted, the data for a single months imports takes about 280mb, but during the import file size swells to over a gb.
Given the 2gb size limit on mdb files, this is a bit of a concern. Apart from breaking the insert... | MS-Access Database getting very large during inserts | 1 | 0.033321 | 1 | 1 | 0 | 3,989 |
1,650,856 | 2009-10-30T16:21:00.000 | -1 | 0 | 0 | 0 | 0 | python,ms-access | 0 | 31,059,064 | 0 | 6 | 0 | false | 0 | 0 | File --> Options --> Current Database -> Check below options
* Use the Cache format that is compatible with Microsoft Access 2010 and later
* Clear Cache on Close
Then, you file will be saved by compacting to the original size. | 4 | 1 | 0 | 0 | I have a database which I regularly need to import large amounts of data into via some python scripts. Compacted, the data for a single months imports takes about 280mb, but during the import file size swells to over a gb.
Given the 2gb size limit on mdb files, this is a bit of a concern. Apart from breaking the insert... | MS-Access Database getting very large during inserts | 1 | -0.033321 | 1 | 1 | 0 | 3,989 |
1,650,856 | 2009-10-30T16:21:00.000 | 3 | 0 | 0 | 0 | 0 | python,ms-access | 0 | 1,650,897 | 0 | 6 | 0 | false | 0 | 0 | A common trick, if feasible with regard to the schema and semantics of the application, is to have several MDB files with Linked tables.
Also, the way the insertions take place matters with regards to the way the file size balloons... For example: batched, vs. one/few records at a time, sorted (relative to particular ... | 4 | 1 | 0 | 0 | I have a database which I regularly need to import large amounts of data into via some python scripts. Compacted, the data for a single months imports takes about 280mb, but during the import file size swells to over a gb.
Given the 2gb size limit on mdb files, this is a bit of a concern. Apart from breaking the insert... | MS-Access Database getting very large during inserts | 1 | 0.099668 | 1 | 1 | 0 | 3,989 |
1,650,856 | 2009-10-30T16:21:00.000 | 3 | 0 | 0 | 0 | 0 | python,ms-access | 0 | 1,651,412 | 0 | 6 | 0 | false | 0 | 0 | One thing to watch out for is records which are present in the append queries but aren't inserted into the data due to duplicate key values, null required fields, etc. Access will allocate the space taken by the records which aren't inserted.
About the only significant thing I'm aware of is to ensure you have exclusi... | 4 | 1 | 0 | 0 | I have a database which I regularly need to import large amounts of data into via some python scripts. Compacted, the data for a single months imports takes about 280mb, but during the import file size swells to over a gb.
Given the 2gb size limit on mdb files, this is a bit of a concern. Apart from breaking the insert... | MS-Access Database getting very large during inserts | 1 | 0.099668 | 1 | 1 | 0 | 3,989 |
1,656,859 | 2009-11-01T10:48:00.000 | 4 | 0 | 1 | 0 | 0 | python,regex,recursion | 0 | 1,656,944 | 0 | 5 | 0 | false | 0 | 0 | You can't do it with a regexp. Python doesn't support recursive regexp | 1 | 15 | 0 | 0 | I'm interested how can be implemented recursive regexp matching in Python (I've not found any examples :( ). For example how would one write expression which matches "bracket balanced" string like "foo(bar(bar(foo)))(foo1)bar1" | How can a recursive regexp be implemented in python? | 0 | 0.158649 | 1 | 0 | 0 | 8,412 |
1,666,482 | 2009-11-03T10:27:00.000 | 1 | 0 | 1 | 0 | 0 | python,deployment,setuptools,distutils | 0 | 1,666,911 | 0 | 6 | 0 | true | 0 | 0 | You can't assume it's installed. There are ways around that, you can fall back to distutils (but then why have setuptools in the first place) or you can install setuptools in setup.py (but I think that's evil).
Use setuptools only if you need it.
When it comes to setuptools vs distrubute, they are compatible, and choos... | 5 | 3 | 0 | 1 | I'm just learning the art of writing a setup.py file for my project. I see there's lots of talk about setuptools, which is supposed to be superior to distutils. There's one thing though that I fail to understand, and I didn't see it addressed in any tutorial I've read about this: What if setuptools isn't installed? I u... | What if setuptools isn't installed? | 0 | 1.2 | 1 | 0 | 0 | 1,621 |
1,666,482 | 2009-11-03T10:27:00.000 | 4 | 0 | 1 | 0 | 0 | python,deployment,setuptools,distutils | 0 | 1,666,595 | 0 | 6 | 0 | false | 0 | 0 | The standard way to distribute packages with setuptools includes an ez_setup.py script which will automatically download and install setuptools itself - on Windows I believe it will actually install an executable for easy_install. You can get this from the standard setuptools/easy_install distribution. | 5 | 3 | 0 | 1 | I'm just learning the art of writing a setup.py file for my project. I see there's lots of talk about setuptools, which is supposed to be superior to distutils. There's one thing though that I fail to understand, and I didn't see it addressed in any tutorial I've read about this: What if setuptools isn't installed? I u... | What if setuptools isn't installed? | 0 | 0.132549 | 1 | 0 | 0 | 1,621 |
1,666,482 | 2009-11-03T10:27:00.000 | 0 | 0 | 1 | 0 | 0 | python,deployment,setuptools,distutils | 0 | 1,666,606 | 0 | 6 | 0 | false | 0 | 0 | I would say it depends on what kind of user you are addressing.
If they are simply users and not Python programmers, or if they are basic programmers, using setuptools might be a little bit too much at first. For those the distutils is perfect.
For clients, I would definitely stick to distutils.
For more enthusiast pro... | 5 | 3 | 0 | 1 | I'm just learning the art of writing a setup.py file for my project. I see there's lots of talk about setuptools, which is supposed to be superior to distutils. There's one thing though that I fail to understand, and I didn't see it addressed in any tutorial I've read about this: What if setuptools isn't installed? I u... | What if setuptools isn't installed? | 0 | 0 | 1 | 0 | 0 | 1,621 |
1,666,482 | 2009-11-03T10:27:00.000 | 2 | 0 | 1 | 0 | 0 | python,deployment,setuptools,distutils | 0 | 1,698,562 | 0 | 6 | 0 | false | 0 | 0 | I have used setuptools to compile many python scripts that I have written into windows EXEs. However, it has always been my understanding (from experience) that the computer running the compiled EXE does not need to have setup tools installed.
Hope that helps | 5 | 3 | 0 | 1 | I'm just learning the art of writing a setup.py file for my project. I see there's lots of talk about setuptools, which is supposed to be superior to distutils. There's one thing though that I fail to understand, and I didn't see it addressed in any tutorial I've read about this: What if setuptools isn't installed? I u... | What if setuptools isn't installed? | 0 | 0.066568 | 1 | 0 | 0 | 1,621 |
1,666,482 | 2009-11-03T10:27:00.000 | 2 | 0 | 1 | 0 | 0 | python,deployment,setuptools,distutils | 0 | 1,666,592 | 0 | 6 | 0 | false | 0 | 0 | In most librarys I ever installed for python, a warning apears "You have to install setuptools". You could do it as well I think, you could add a link so the user don't have to search the internet for it. | 5 | 3 | 0 | 1 | I'm just learning the art of writing a setup.py file for my project. I see there's lots of talk about setuptools, which is supposed to be superior to distutils. There's one thing though that I fail to understand, and I didn't see it addressed in any tutorial I've read about this: What if setuptools isn't installed? I u... | What if setuptools isn't installed? | 0 | 0.066568 | 1 | 0 | 0 | 1,621 |
1,670,569 | 2009-11-03T22:31:00.000 | 1 | 0 | 0 | 0 | 0 | python,soap,suds | 0 | 1,670,775 | 0 | 3 | 0 | false | 0 | 0 | I think you have to create a new Client object for each different URL. | 1 | 2 | 0 | 0 | Using SUDS SOAP client how do I specify web service URL. I can see clearly that WSDL path is specified in Client constructor but what if I wan't to change web service url? | Changing web service url in SUDS library | 0 | 0.066568 | 1 | 0 | 1 | 5,956 |
1,673,749 | 2009-11-04T13:30:00.000 | 36 | 0 | 1 | 0 | 0 | python,regex | 0 | 1,673,804 | 0 | 2 | 0 | true | 0 | 0 | You want [^\W\d]: the group of characters that is not (either a digit or not an alphanumeric). Add an underscore in that negated set if you don't want them either.
A bit twisted, if you ask me, but it works. Should be faster than the lookahead alternative. | 1 | 9 | 0 | 0 | Using Python module re, how to get the equivalent of the "\w" (which matches alphanumeric chars) WITHOUT matching the numeric characters (those which can be matched by "[0-9]")?
Notice that the basic need is to match any character (including all unicode variation) without numerical chars (which are matched by "[0-9]").... | How to match alphabetical chars without numeric chars with Python regexp? | 1 | 1.2 | 1 | 0 | 0 | 6,224 |
1,674,696 | 2009-11-04T15:51:00.000 | 0 | 1 | 0 | 1 | 0 | python,nginx,load-balancing,wsgi,reverse-proxy | 0 | 1,718,183 | 0 | 7 | 0 | false | 0 | 0 | Another option is a queue table in the database.
The worker processes run in a loop or off cron and poll the queue table for new jobs. | 4 | 4 | 0 | 0 | I have a python (well, it's php now but we're rewriting) function that takes some parameters (A and B) and compute some results (finds best path from A to B in a graph, graph is read-only), in typical scenario one call takes 0.1s to 0.9s to complete. This function is accessed by users as a simple REST web-service (GET ... | how to process long-running requests in python workers? | 0 | 0 | 1 | 0 | 1 | 2,509 |
1,674,696 | 2009-11-04T15:51:00.000 | 0 | 1 | 0 | 1 | 0 | python,nginx,load-balancing,wsgi,reverse-proxy | 0 | 1,675,726 | 0 | 7 | 0 | false | 0 | 0 | I think you can configure modwsgi/Apache so it will have several "hot" Python interpreters
in separate processes ready to go at all times and also reuse them for new accesses
(and spawn a new one if they are all busy).
In this case you could load all the preprocessed data as module globals and they would
only get loade... | 4 | 4 | 0 | 0 | I have a python (well, it's php now but we're rewriting) function that takes some parameters (A and B) and compute some results (finds best path from A to B in a graph, graph is read-only), in typical scenario one call takes 0.1s to 0.9s to complete. This function is accessed by users as a simple REST web-service (GET ... | how to process long-running requests in python workers? | 0 | 0 | 1 | 0 | 1 | 2,509 |
1,674,696 | 2009-11-04T15:51:00.000 | 1 | 1 | 0 | 1 | 0 | python,nginx,load-balancing,wsgi,reverse-proxy | 0 | 1,682,864 | 0 | 7 | 0 | false | 0 | 0 | The most simple solution in this case is to use the webserver to do all the heavy lifting. Why should you handle threads and/or processes when the webserver will do all that for you?
The standard arrangement in deployments of Python is:
The webserver start a number of processes each running a complete python interpret... | 4 | 4 | 0 | 0 | I have a python (well, it's php now but we're rewriting) function that takes some parameters (A and B) and compute some results (finds best path from A to B in a graph, graph is read-only), in typical scenario one call takes 0.1s to 0.9s to complete. This function is accessed by users as a simple REST web-service (GET ... | how to process long-running requests in python workers? | 0 | 0.028564 | 1 | 0 | 1 | 2,509 |
1,674,696 | 2009-11-04T15:51:00.000 | 0 | 1 | 0 | 1 | 0 | python,nginx,load-balancing,wsgi,reverse-proxy | 0 | 1,676,102 | 0 | 7 | 0 | false | 0 | 0 | You could use nginx load balancer to proxy to PythonPaste paster (which serves WSGI, for example Pylons), that launches each request as separate thread anyway. | 4 | 4 | 0 | 0 | I have a python (well, it's php now but we're rewriting) function that takes some parameters (A and B) and compute some results (finds best path from A to B in a graph, graph is read-only), in typical scenario one call takes 0.1s to 0.9s to complete. This function is accessed by users as a simple REST web-service (GET ... | how to process long-running requests in python workers? | 0 | 0 | 1 | 0 | 1 | 2,509 |
1,676,835 | 2009-11-04T21:42:00.000 | 16 | 1 | 1 | 0 | 0 | python,self-reference | 0 | 1,676,861 | 0 | 7 | 0 | false | 0 | 0 | If you have a class in that module, then the __module__ property of the class is the module name of the class. Thus you can access the module via sys.modules[klass.__module__]. This is also works for functions. | 2 | 187 | 0 | 0 | How can I get a reference to a module from within that module? Also, how can I get a reference to the package containing that module? | How to get a reference to a module inside the module itself? | 0 | 1 | 1 | 0 | 0 | 72,566 |
1,676,835 | 2009-11-04T21:42:00.000 | 0 | 1 | 1 | 0 | 0 | python,self-reference | 0 | 70,034,466 | 0 | 7 | 0 | false | 0 | 0 | If all you need is to get access to module variable then use globals()['bzz'] (or vars()['bzz'] if it's module level). | 2 | 187 | 0 | 0 | How can I get a reference to a module from within that module? Also, how can I get a reference to the package containing that module? | How to get a reference to a module inside the module itself? | 0 | 0 | 1 | 0 | 0 | 72,566 |
1,681,143 | 2009-11-05T15:08:00.000 | 0 | 0 | 1 | 0 | 0 | python,datetime,time,timezone,pytz | 0 | 18,385,592 | 0 | 8 | 0 | false | 0 | 0 | Maybe try:
import time
print time.tzname #or time.tzname[time.daylight] | 1 | 34 | 0 | 0 | Is there a cross-platform function in python (or pytz) that returns a tzinfo object corresponding to the timezone currently set on the computer?
environment variables cannot be counted on as they are not cross-platform | how to get tz_info object corresponding to current timezone? | 0 | 0 | 1 | 0 | 0 | 32,220 |
1,685,558 | 2009-11-06T05:15:00.000 | 1 | 0 | 1 | 0 | 0 | python | 0 | 1,685,597 | 0 | 1 | 0 | true | 0 | 0 | You could use r'(Start \d+.*?group=.*?name=.*?number=.*?end=\d+)*'. | 1 | 0 | 0 | 0 | I want to validate below data using regex and python.
Below is the dump of the data which Can be stored in string variable
Start 0 .......... group=..... name=...... number=.... end=(digits)
Start 1 .......... group=..... name=...... number=.... end=(digits)
Start 2 .......... group=..... name=...... number=.... en... | how to write regex for below format using python | 0 | 1.2 | 1 | 0 | 0 | 92 |
1,691,400 | 2009-11-07T00:21:00.000 | 1 | 0 | 0 | 0 | 0 | python,django,symfony1 | 0 | 1,691,549 | 0 | 2 | 0 | false | 1 | 0 | Assuming you are going to be using the components in different places on different pages I would suggest trying {% include "foo.html" %}. One of the (several) downsides of the Django templating language is that there is no concept of macros, so you need to be very consistent in the names of values in the context you pa... | 1 | 1 | 0 | 0 | I've been developing in the Symfony framework for quite a time, but now I have to work with Django and I'm having problems with doing something like a "component" or "partial" in Symfony.
That said, here is my goal:
I have a webpage with lots of small widgets, all these need their logic - located in a "views.py" I gue... | How to implement Symfony Partials or Components in Django? | 0 | 0.099668 | 1 | 0 | 0 | 715 |
1,693,815 | 2009-11-07T17:39:00.000 | 1 | 0 | 0 | 1 | 0 | python,google-app-engine,indexing,archive,bigtable | 0 | 1,693,856 | 0 | 2 | 0 | false | 1 | 0 | Unless someone's written utilities for this kind of thing, the way to go is to read from one and write to the other kind! | 2 | 0 | 0 | 0 | Is there a way to move an entity to another kind in appengine.
Say you have a kind defines, and you want to keep a record of deleted entities of that kind.
But you want to separate the storage of live object and archived objects.
Kinds are basically just serialized dicts in the bigtable anyway. And maybe you don't need... | Move or copy an entity to another kind | 0 | 0.099668 | 1 | 0 | 0 | 162 |
1,693,815 | 2009-11-07T17:39:00.000 | 1 | 0 | 0 | 1 | 0 | python,google-app-engine,indexing,archive,bigtable | 0 | 1,693,979 | 0 | 2 | 0 | true | 1 | 0 | No - once created, the kind is a part of the entity's immutable key. You need to create a new entity and copy everything across. One way to do this would be to use the low-level google.appengine.api.datastore interface, which treats entities as dicts. | 2 | 0 | 0 | 0 | Is there a way to move an entity to another kind in appengine.
Say you have a kind defines, and you want to keep a record of deleted entities of that kind.
But you want to separate the storage of live object and archived objects.
Kinds are basically just serialized dicts in the bigtable anyway. And maybe you don't need... | Move or copy an entity to another kind | 0 | 1.2 | 1 | 0 | 0 | 162 |
1,695,971 | 2009-11-08T10:29:00.000 | 0 | 0 | 0 | 0 | 0 | python,text,nlp,words,wordnet | 0 | 58,050,062 | 0 | 5 | 0 | false | 0 | 0 | sorry, may I ask which tool could judge "difficulty level" of sentences?
I wish to find out "similar difficulty level" of sentences for user to read. | 4 | 6 | 1 | 0 | For example...
Chicken is an animal.
Burrito is a food.
WordNet allows you to do "is-a"...the hiearchy feature.
However, how do I know when to stop travelling up the tree? I want a LEVEL.
That is consistent.
For example, if presented with a bunch of words, I want wordNet to categorize all of them, but at a certain leve... | Does WordNet have "levels"? (NLP) | 0 | 0 | 1 | 0 | 0 | 2,585 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.