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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,502,345 | 2010-03-23T17:56:00.000 | 2 | 1 | 0 | 0 | python,hudson | 2,502,582 | 3 | false | 0 | 0 | Well, after some more debugging, I realized that the pylint output file referenced the source code files relative to where pylint was being run, which wasn't the same path that Hudson needed. Basically, Violations needed the paths relative to the Hudson workspace. | 1 | 3 | 0 | I'm using Hudson CI with a Python project. I've installed the Violations plugin and configured it to run the code against pylint. This works, but I only see a list of violations without linking to the source code. Is it possible to setup Violations and pylint to load and highlight the violating source files (something ... | Is it possible to see the source code of the violating files in Hudson with Violations and Pylint? | 0.132549 | 0 | 0 | 600 |
2,502,385 | 2010-03-23T18:02:00.000 | 0 | 0 | 0 | 1 | python,image,vbscript,batch-file,console-application | 2,502,963 | 4 | false | 0 | 1 | Try TK, it is included with python. Also, PyGtk is lighter than wxPython, but I ended up bitting the bullet and using wxPython for the same purpose recently, it is heavy, but it didn't have any affect on the script performance. | 1 | 2 | 0 | Any ideas how I can display an image file (bmp or png) centered on the screen as an application splash screen when running a Windows console script based on a batch file, vbscript/wscript or Python console script?
I'm not interested in a wxPython solution - that's too much overhead just to implement a cosmetic feature ... | Display an image as a splash screen when running Windows batch file, vbscript/wscript or Python console script | 0 | 0 | 0 | 5,541 |
2,503,444 | 2010-03-23T20:40:00.000 | 4 | 1 | 1 | 0 | python | 2,503,474 | 10 | false | 0 | 0 | If you write good unit tests for all of your code, you should find the errors very quickly when testing code. | 3 | 11 | 0 | I'm not sure if I like Python's dynamic-ness. It often results in me forgetting to check a type, trying to call an attribute and getting the NoneType (or any other) has no attribute x error. A lot of them are pretty harmless but if not handled correctly they can bring down your entire app/process/etc.
Over time I got... | What is your strategy to avoid dynamic typing errors in Python (NoneType has no attribute x)? | 0.07983 | 0 | 0 | 2,459 |
2,503,444 | 2010-03-23T20:40:00.000 | 8 | 1 | 1 | 0 | python | 2,503,704 | 10 | true | 0 | 0 | forgetting to check a type
This doesn't make much sense. You so rarely need to "check" a type. You simply run unit tests and if you've provided the wrong type object, things fail. You never need to "check" much, in my experience.
trying to call an attribute and
getting the NoneType (or any other)
has no attrib... | 3 | 11 | 0 | I'm not sure if I like Python's dynamic-ness. It often results in me forgetting to check a type, trying to call an attribute and getting the NoneType (or any other) has no attribute x error. A lot of them are pretty harmless but if not handled correctly they can bring down your entire app/process/etc.
Over time I got... | What is your strategy to avoid dynamic typing errors in Python (NoneType has no attribute x)? | 1.2 | 0 | 0 | 2,459 |
2,503,444 | 2010-03-23T20:40:00.000 | 0 | 1 | 1 | 0 | python | 2,503,535 | 10 | false | 0 | 0 | I haven’t done a lot of Python programming, but I’ve done no programming at all in staticly typed languages, so I don’t tend to think about things in terms of variable types. That might explain why I haven’t come across this problem much. (Although the small amount of Python programming I’ve done might explain that too... | 3 | 11 | 0 | I'm not sure if I like Python's dynamic-ness. It often results in me forgetting to check a type, trying to call an attribute and getting the NoneType (or any other) has no attribute x error. A lot of them are pretty harmless but if not handled correctly they can bring down your entire app/process/etc.
Over time I got... | What is your strategy to avoid dynamic typing errors in Python (NoneType has no attribute x)? | 0 | 0 | 0 | 2,459 |
2,503,562 | 2010-03-23T20:56:00.000 | 1 | 0 | 0 | 0 | python,pygtk | 14,070,047 | 3 | false | 0 | 1 | You can use PyGobject instead of pygtk, and then setting a placeholder is a piece of cake:
entry.set_placeholder_text("some string") | 1 | 3 | 0 | How to create pygtk entry with placeholder like in HTML 5 input element? | Pygtk entry placeholder | 0.066568 | 0 | 0 | 981 |
2,504,386 | 2010-03-23T23:27:00.000 | 1 | 0 | 0 | 0 | python,django,django-models | 2,504,441 | 3 | false | 1 | 0 | Quoth my elementary chemistry teacher: "If you don't write it down, it didn't happen", therefore save logs in a file.
Since the log information is disjoint from your application data (it's meta-data, actually), keep them separate. You could log to a database table but it should be distinct from your model.
Text pickle ... | 1 | 6 | 0 | I have various models of which I would like to keep track and collect statistical data.
The problem is how to store the changes throughout time.
I thought of various alternative:
Storing a log in a TextField, open it and update it every time the model is saved.
Alternatively pickle a list and store it in a TextField.
... | Keeping track of changes - Django | 0.066568 | 0 | 0 | 1,579 |
2,504,800 | 2010-03-24T01:31:00.000 | 19 | 0 | 1 | 1 | python,programming-languages,development-environment | 2,504,835 | 11 | true | 0 | 0 | Your system already has Python on it. Use the text editor or IDE of your choice; I like vim.
I can't tell you what third-party modules you need without knowing what kind of development you will be doing. Use apt as much as you can to get the libraries.
To speak to your edit:
This isn't minimalistic, like handing a .N... | 5 | 13 | 0 | I'm a .NET developer who knows very little about Python, but want to give it a test drive for a small project I'm working on.
What tools and packages should I install on my machine? I'm looking for a common, somewhat comprehensive, development environment.
I'll likely run Ubuntu 9.10, but I'm flexible. If Windows is a... | How do I set up a Python development environment on Linux? | 1.2 | 0 | 0 | 15,576 |
2,504,800 | 2010-03-24T01:31:00.000 | 4 | 0 | 1 | 1 | python,programming-languages,development-environment | 2,504,896 | 11 | false | 0 | 0 | Since I'm accustomed to Eclipse, I find Eclipse + PyDev convenient for Python. For quick computations, Idle is great.
I've used Python on Windows and on Ubuntu, and Linux is much cleaner. | 5 | 13 | 0 | I'm a .NET developer who knows very little about Python, but want to give it a test drive for a small project I'm working on.
What tools and packages should I install on my machine? I'm looking for a common, somewhat comprehensive, development environment.
I'll likely run Ubuntu 9.10, but I'm flexible. If Windows is a... | How do I set up a Python development environment on Linux? | 0.072599 | 0 | 0 | 15,576 |
2,504,800 | 2010-03-24T01:31:00.000 | 1 | 0 | 1 | 1 | python,programming-languages,development-environment | 2,506,982 | 11 | false | 0 | 0 | You don't need much. Python comes with "Batteries Included."
Visual Studio == IDLE. You already have it. If you want more IDE-like environment, install Komodo Edit.
NUnit == unittest. You already have it in the standard library.
SQL Server == sqlite. You already have it in the standard library.
Stop wasting time g... | 5 | 13 | 0 | I'm a .NET developer who knows very little about Python, but want to give it a test drive for a small project I'm working on.
What tools and packages should I install on my machine? I'm looking for a common, somewhat comprehensive, development environment.
I'll likely run Ubuntu 9.10, but I'm flexible. If Windows is a... | How do I set up a Python development environment on Linux? | 0.01818 | 0 | 0 | 15,576 |
2,504,800 | 2010-03-24T01:31:00.000 | 2 | 0 | 1 | 1 | python,programming-languages,development-environment | 2,504,806 | 11 | false | 0 | 0 | Python (duh), setuptools or pip, virtualenv, and an editor. I suggest geany, but that's just me. And of course, any other Python modules you'll need. | 5 | 13 | 0 | I'm a .NET developer who knows very little about Python, but want to give it a test drive for a small project I'm working on.
What tools and packages should I install on my machine? I'm looking for a common, somewhat comprehensive, development environment.
I'll likely run Ubuntu 9.10, but I'm flexible. If Windows is a... | How do I set up a Python development environment on Linux? | 0.036348 | 0 | 0 | 15,576 |
2,504,800 | 2010-03-24T01:31:00.000 | 0 | 0 | 1 | 1 | python,programming-languages,development-environment | 2,505,840 | 11 | false | 0 | 0 | Database: sqlite (inbuilt). You might want SQLAlchemy though.
GUI: tcl is inbuilt, but wxPython or pyQt are recommended.
IDE: I use idle (inbuilt) on windows, TextMate on Mac, but you might like PyDev. I've also heard good things about ulipad.
Numerics: numpy.
Fast inline code: lots of options. I like boost weave (part... | 5 | 13 | 0 | I'm a .NET developer who knows very little about Python, but want to give it a test drive for a small project I'm working on.
What tools and packages should I install on my machine? I'm looking for a common, somewhat comprehensive, development environment.
I'll likely run Ubuntu 9.10, but I'm flexible. If Windows is a... | How do I set up a Python development environment on Linux? | 0 | 0 | 0 | 15,576 |
2,505,072 | 2010-03-24T03:05:00.000 | 1 | 0 | 0 | 0 | python,django,payment-gateway,payment-processing | 17,987,815 | 5 | false | 1 | 0 | Consider enabling more than one payment gateways. If you add only one, and this gateway fails for some reason you'll start losing money (actually happened to one of the persons I know). | 2 | 18 | 0 | I'm developing a web application that will require users to either make one time deposits of money into their account, or allow users to sign up for recurring billing each month for a certain amount of money.
I've been looking at various payment gateways, but most (if not all) of them seem complex and difficult to get ... | What is the Simplest Possible Payment Gateway to Implement? (using Django) | 0.039979 | 0 | 0 | 23,610 |
2,505,072 | 2010-03-24T03:05:00.000 | 2 | 0 | 0 | 0 | python,django,payment-gateway,payment-processing | 2,505,692 | 5 | false | 1 | 0 | I've done successful integrations for both Google Checkout and PayPal ExpressCheckout in Django. Both services have stable, well-developed APIs, and neither one was too difficult to implement. There are good Python libraries already written to do the heavy lifting for you, too. | 2 | 18 | 0 | I'm developing a web application that will require users to either make one time deposits of money into their account, or allow users to sign up for recurring billing each month for a certain amount of money.
I've been looking at various payment gateways, but most (if not all) of them seem complex and difficult to get ... | What is the Simplest Possible Payment Gateway to Implement? (using Django) | 0.07983 | 0 | 0 | 23,610 |
2,507,463 | 2010-03-24T12:11:00.000 | 0 | 0 | 0 | 0 | java,php,python,ruby | 2,512,975 | 8 | false | 1 | 0 | There are no clear cut winners when picking a web framework. Each platform you mentioned has its benefits and drawbacks (cost of hardware, professional support, community support, etc.). Depending on your time table, project requirements, and available hardware resources you are probably going to need some different an... | 2 | 1 | 0 | A legacy web application written using PHP and utilizing MySql database needs to be rewritten completely. However, the existing database structure must not be changed at all.
I'm looking for suggestions on which framework would be most suitable for this task? Language candidates are Python, PHP, Ruby and Java.
Accordin... | Web framework for an application utilizing existing database? | 0 | 1 | 0 | 1,525 |
2,507,463 | 2010-03-24T12:11:00.000 | 2 | 0 | 0 | 0 | java,php,python,ruby | 2,507,492 | 8 | false | 1 | 0 | I have very good experience with Django. Every time I needed it was up to the task for interfacing with existing database.
Autogenerated models are the start, as MySQL is not the strictest with its schema. Not that it will not work only that usually some of the db restrictions are held in app itself. | 2 | 1 | 0 | A legacy web application written using PHP and utilizing MySql database needs to be rewritten completely. However, the existing database structure must not be changed at all.
I'm looking for suggestions on which framework would be most suitable for this task? Language candidates are Python, PHP, Ruby and Java.
Accordin... | Web framework for an application utilizing existing database? | 0.049958 | 1 | 0 | 1,525 |
2,508,861 | 2010-03-24T15:17:00.000 | 8 | 0 | 1 | 0 | python | 2,508,868 | 8 | false | 0 | 0 | int('243\r\n'.strip())
But that won't help you, if something else than a number is passed. Always put try, except and catch ValueError.
Anyway, this also works: int('243\n\r '), so maybe you don't even need strip.
EDIT:
Why don't you just write your own function, that will catch the exception and return a sane default... | 2 | 10 | 0 | Does anybody have a quickie for converting an unsafe string to an int?
The string typically comes back as: '234\r\n' or something like that.
In this case I want 234. If '-1\r\n', I want -1. I never want the method to fail but I don't want to go so far as try, except, pass just to hide errors either (in case something ... | Python: Convert a string to an integer | 1 | 0 | 0 | 49,606 |
2,508,861 | 2010-03-24T15:17:00.000 | 0 | 0 | 1 | 0 | python | 2,509,234 | 8 | false | 0 | 0 | Under Python 3.0 (IDLE) this worked nicely
strObj = "234\r\n"
try:
#a=int(strObj)
except ValueError:
#a=-1
print(a)
>>234
If you're dealing with input you cannot trust, you never should anyway, then it's a good idea to use try, except, pass blocks to control exceptions when users provide incompa... | 2 | 10 | 0 | Does anybody have a quickie for converting an unsafe string to an int?
The string typically comes back as: '234\r\n' or something like that.
In this case I want 234. If '-1\r\n', I want -1. I never want the method to fail but I don't want to go so far as try, except, pass just to hide errors either (in case something ... | Python: Convert a string to an integer | 0 | 0 | 0 | 49,606 |
2,510,158 | 2010-03-24T17:51:00.000 | 1 | 0 | 1 | 0 | python,ip-address,syslog,blacklist | 2,510,205 | 2 | false | 0 | 0 | For each line:
read the IP and attempt status
keep a dictionary by IP of amount of failed attempts
Then go over the dictionary:
print to file all IPs with 5 or more attempts
Python hints:
To read a file line by line: for line in open(filename)
Parsing the log line depends entirely on its format. Some useful Pytho... | 1 | 0 | 0 | Basically I have an authlog/syslog file with a list of log in attempts and IP addresses - I need to make a Python program that will create a txt file with all the IP addresses that have more than 5 failed login attempts - a sort of "blacklist".
So basically something like:
if "uniqueipaddress" and "authentication failu... | Python - create blacklist file of IP addresses that have more than 5 failed login attempts in the authlog | 0.099668 | 0 | 0 | 1,998 |
2,510,755 | 2010-03-24T19:19:00.000 | 6 | 1 | 1 | 0 | python,algorithm | 2,510,928 | 8 | false | 0 | 0 | It sounds like what you want, is to treat alphabetical characters as a base-26 value between 0 and 1. When you have strings of different length (an example in base 10), say 305 and 4202, your coming out with a midpoint of 3, since you're looking at the characters one at a time. Instead, treat them as a floating point... | 1 | 8 | 0 | Suppose you take the strings 'a' and 'z' and list all the strings that come between them in alphabetical order: ['a','b','c' ... 'x','y','z']. Take the midpoint of this list and you find 'm'. So this is kind of like taking an average of those two strings.
You could extend it to strings with more than one character, for... | Average of two strings in alphabetical/lexicographical order | 1 | 0 | 0 | 2,674 |
2,510,903 | 2010-03-24T19:45:00.000 | 1 | 0 | 0 | 1 | python,django,google-app-engine,web-applications,tipfy | 2,512,079 | 6 | false | 1 | 0 | I'm still investigating, but I think webapp and tipfy will be a lighter framework than django. Right now, I am using just webapp and the cold start times are already too long. I want to use tipfy for sessions and keep everything else in webapp.
What are you trying to optimize for? Speed of development? Easy of progra... | 3 | 10 | 0 | which one are you using on google app engine?
what were the reasons behind your decision? | webapp, tipfy or django on google app engine | 0.033321 | 0 | 0 | 2,218 |
2,510,903 | 2010-03-24T19:45:00.000 | 1 | 0 | 0 | 1 | python,django,google-app-engine,web-applications,tipfy | 3,184,831 | 6 | false | 1 | 0 | I would still prefer Django for its structure and a high support available over internet for it and for the following reasons:
Webapp offcourse is light weight, but
Django comes with a nice structure
which saves a lots of time while
working on a large application.
Google app engine does provide a good
document for wo... | 3 | 10 | 0 | which one are you using on google app engine?
what were the reasons behind your decision? | webapp, tipfy or django on google app engine | 0.033321 | 0 | 0 | 2,218 |
2,510,903 | 2010-03-24T19:45:00.000 | 4 | 0 | 0 | 1 | python,django,google-app-engine,web-applications,tipfy | 3,304,317 | 6 | false | 1 | 0 | Imho..
Django - the only part that's relevant is the templating and maybe the no rel..
Webapp - never tried it after
Tipfy - is what I'm using, seems to be more "pylons" like, has a basic apps/modules structure and lots of "helpers" which quite frankly should be in the google.appengine.api
Easy to implement templates a... | 3 | 10 | 0 | which one are you using on google app engine?
what were the reasons behind your decision? | webapp, tipfy or django on google app engine | 0.132549 | 0 | 0 | 2,218 |
2,512,386 | 2010-03-25T00:24:00.000 | 78 | 0 | 0 | 0 | python,csv,merge,concatenation | 5,876,058 | 22 | false | 0 | 0 | Why can't you just sed 1d sh*.csv > merged.csv?
Sometimes you don't even have to use python! | 1 | 96 | 1 | Guys, I here have 200 separate csv files named from SH (1) to SH (200). I want to merge them into a single csv file. How can I do it? | how to merge 200 csv files in Python | 1 | 0 | 0 | 189,456 |
2,512,571 | 2010-03-25T01:20:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,memcached | 2,514,663 | 3 | false | 1 | 0 | If you cache a query, is there an
accepted method for ensuring that the
cache is cleared/updated when an
object stored in that query is
updated.
Typically you wrap your reads with a conditional to retrieve the value from the main DB if it's not in the cache. Just wrap your updates as well to fill the cache whe... | 2 | 2 | 0 | I am struggling to find a good tutorial or best practices document for the use of memcache in app engine.
I'm pretty happy with it on the level presented in the docs. Get an object by ID, checking memcache first, but I'm unclear on things like:
If you cache a query, is there an accepted method for ensuring that the ... | Idiots guide to app engine and memcache | 0.197375 | 0 | 0 | 2,620 |
2,512,571 | 2010-03-25T01:20:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,memcached | 5,571,331 | 3 | false | 1 | 0 | About reference properties, let's say you have MainModel and RefModel with a reference property 'ref' that points to a MainModel instance. Whenever you cal ref_model.ref it does a datastore get operation and retrieves the object from datastore. It does not interact with memcache in any way. | 2 | 2 | 0 | I am struggling to find a good tutorial or best practices document for the use of memcache in app engine.
I'm pretty happy with it on the level presented in the docs. Get an object by ID, checking memcache first, but I'm unclear on things like:
If you cache a query, is there an accepted method for ensuring that the ... | Idiots guide to app engine and memcache | 0 | 0 | 0 | 2,620 |
2,513,260 | 2010-03-25T05:27:00.000 | 2 | 0 | 1 | 0 | python,wxpython | 2,513,304 | 5 | false | 0 | 0 | You have given yourself an answer:
and feel pretty confident about
writing simple applications for it
go ahead and write more complex applications!
The issue here is that you do not feel challenged, and you assume that you are done with your basic learning. Just find what to do! Simplify a process (say, file manag... | 2 | 2 | 0 | Well, I have read several user guides and watched dozens and dozens of video tutorials on how to program with Python, and feel pretty confident about writing simple applications for it. My main point in my question is, where would I be able to learn more advanced programming knowledge about Python? | Once I know the basic elements and syntax of Python, what should I do? | 0.07983 | 0 | 0 | 243 |
2,513,260 | 2010-03-25T05:27:00.000 | 1 | 0 | 1 | 0 | python,wxpython | 2,561,525 | 5 | false | 0 | 0 | my favorite way in learning python is ( learning through projects ).
put yourself a goal , like a software for example ( 6 years ago when i started to learn python i picked a messenger . so i had to read more about sockets, network programming , and interfaces libraries ) . start with it , look for examples and resou... | 2 | 2 | 0 | Well, I have read several user guides and watched dozens and dozens of video tutorials on how to program with Python, and feel pretty confident about writing simple applications for it. My main point in my question is, where would I be able to learn more advanced programming knowledge about Python? | Once I know the basic elements and syntax of Python, what should I do? | 0.039979 | 0 | 0 | 243 |
2,513,786 | 2010-03-25T07:45:00.000 | 1 | 0 | 0 | 0 | python,wxpython,copy,matplotlib | 3,120,753 | 1 | false | 0 | 1 | I'm not familiar with the inner workings, but could easily imagine how disposing of a frame damages the figure data. Is it expensive to draw? Otherwise I'd take the somewhat chickenish approach of simply redrawing it ;) | 1 | 8 | 1 | I have FigureCanvasWxAgg instance with a figure displayed on a frame. If user clicks on the canvas another frame with a new FigureCanvasWxAgg containing the same figure will be shown. By now closing the new frame can result in destroying the C++ part of the figure so that it won't be available for the first frame.
How... | How to copy matplotlib figure? | 0.197375 | 0 | 0 | 1,759 |
2,517,367 | 2010-03-25T16:29:00.000 | 1 | 0 | 1 | 0 | .net,ironpython,dynamic-language-runtime | 2,519,403 | 1 | true | 0 | 0 | There's no way to turn this off without modifying IronPython. | 1 | 1 | 0 | When I create an instance of my C# class in IronPython with named parameters to the constructor, it is setting properties corresponding to the names of the parameters. I wish to disable this behavior so I can have better control on the order the properties are evaluated.
Is this possible? | Ironpython - Named parameters to constructor | 1.2 | 0 | 0 | 413 |
2,518,730 | 2010-03-25T19:29:00.000 | 2 | 0 | 0 | 0 | python,numpy | 2,521,903 | 5 | false | 0 | 0 | I would say go with meshgrid or mgrid, in particular if you need non-integer coordinates. I'm surprised that Numpy's broadcasting rules would be more efficient, as meshgrid was designed especially for the problem that you want to solve. | 1 | 4 | 1 | I want to create a list containing the 3-D coords of a grid of regularly spaced points, each as a 3-element tuple. I'm looking for advice on the most efficient way to do this.
In C++ for instance, I simply loop over three nested loops, one for each coordinate. In Matlab, I would probably use the meshgrid function (whi... | A 3-D grid of regularly spaced points | 0.07983 | 0 | 0 | 1,877 |
2,518,753 | 2010-03-25T19:32:00.000 | 1 | 0 | 1 | 0 | python | 2,518,794 | 5 | false | 0 | 0 | You could simply use a number, and decide on a mapping between number and "card". For example:
number MOD 13 = face value (after a +1)
number DIV 13 = suit | 1 | 17 | 0 | What is the best way to store the cards and suits in python so that I can hold a reference to these values in another variable?
For example, if I have a list called hand (cards in players hand), how could I hold values that could refer to the names of suits and values of specific cards, and how would these names and va... | best way to implement a deck for a card game in python | 0.039979 | 0 | 0 | 27,823 |
2,518,814 | 2010-03-25T19:41:00.000 | 4 | 0 | 1 | 0 | ironpython,distribution | 2,522,814 | 1 | true | 0 | 0 | I would not try to find IronPython - I would append all necessary IronPython runtime files directly to your application. Then it is 100% foolproof :-) | 1 | 3 | 0 | I'm thinking of developing a small application using IronPython, however I want to distribute my app to non-techies and so ideally I want to be able to give them a standard shortcut to my application along with the instructions that they need to install IronPython first.
If possible I even want my shortcut to detect if... | Distributing IronPython applications | 1.2 | 0 | 0 | 986 |
2,519,598 | 2010-03-25T21:37:00.000 | 3 | 0 | 0 | 0 | python,c,telnet | 2,525,924 | 9 | false | 0 | 0 | While telnet is almost just a socket tied to a terminal it's not quite. I believe that there can be some control characters that get passed shortly after the connection is made. If your device is sending some unexpected control data then it may be confusing your program.
If you haven't already, go download wireshark ... | 3 | 9 | 0 | HI,
I have a device that exposes a telnet interface which you can log into using a username and password and then manipulate the working of the device.
I have to write a C program that hides the telnet aspect from the client and instead provides an interface for the user to control the device.
What would be a good way ... | Writing a telnet client | 0.066568 | 0 | 1 | 18,409 |
2,519,598 | 2010-03-25T21:37:00.000 | 4 | 0 | 0 | 0 | python,c,telnet | 2,519,786 | 9 | false | 0 | 0 | telnet's protocol is pretty straightforward... you just create a TCP connection, and send and receive ASCII data. That's pretty much it.
So all you really need to do is create a program that connects via TCP, then reads characters from the TCP socket and parses it to update the GUI, and/or writes characters to the soc... | 3 | 9 | 0 | HI,
I have a device that exposes a telnet interface which you can log into using a username and password and then manipulate the working of the device.
I have to write a C program that hides the telnet aspect from the client and instead provides an interface for the user to control the device.
What would be a good way ... | Writing a telnet client | 0.088656 | 0 | 1 | 18,409 |
2,519,598 | 2010-03-25T21:37:00.000 | 1 | 0 | 0 | 0 | python,c,telnet | 2,521,858 | 9 | false | 0 | 0 | Unless the application is trivial, a better starting point would be to figure out how you're going to create the GUI. This is a bigger question and will have more impact on your project than how exactly you telnet into the device. You mention C at first, but then start talking about Python, which makes me believe you a... | 3 | 9 | 0 | HI,
I have a device that exposes a telnet interface which you can log into using a username and password and then manipulate the working of the device.
I have to write a C program that hides the telnet aspect from the client and instead provides an interface for the user to control the device.
What would be a good way ... | Writing a telnet client | 0.022219 | 0 | 1 | 18,409 |
2,519,670 | 2010-03-25T21:51:00.000 | 2 | 0 | 1 | 0 | python,regex,alphanumeric | 44,874,007 | 6 | false | 0 | 0 | I would consider this for a valid username:
1) Username must be 6-30 characters long
2) Username may only contain:
Uppercase and lowercase letters
Numbers from 0-9 and
Special characters _ - .
3) Username may not:
Begin or finish with characters _ - .
Have more than one sequential character _ - . inside
This would... | 1 | 7 | 0 | I looked and searched and couldn't find what I needed although I think it should be simple (if you have any Python experience, which I don't).
Given a string, I want to verify, in Python, that it contains ONLY alphanumeric characters: a-zA-Z0-9 and . _ -
examples:
Accepted:
bill-gates
Steve_Jobs
Micro.soft
Rejected:... | Python code to use a regular expression to make sure a string is alphanumeric plus . - _ | 0.066568 | 0 | 0 | 15,328 |
2,519,706 | 2010-03-25T21:56:00.000 | 1 | 0 | 0 | 1 | python,linux,logging,permissions | 2,519,800 | 2 | false | 0 | 0 | I see you are on linux,
Depending on which filesystem you are using, you may be able to use the chattr command. You can make files that are append only by setting the a attribute | 1 | 0 | 0 | I am writing a python script that needs to make a log entry whenever it's invoked. The log created by the script must not be changeable by the user (except root) who invoked the script. I tried the syslog module and while this does exactly what I want in terms of file permissions, I need to be able to put the resulting... | Creating Read-only logs with python | 0.099668 | 0 | 0 | 414 |
2,520,144 | 2010-03-25T23:22:00.000 | 1 | 0 | 0 | 0 | python,django,openid | 2,520,867 | 1 | true | 1 | 0 | Are you supplying an email address or URL? OpenID needs a URL and *******@gmail.com is an email address. | 1 | 0 | 0 | I get the following error when attempting to use django-openid-auth OpenID discovery error: No usable OpenID services found for *******@gmail.com
I have followed the instructions that come with it, though it seems there is something I am missing. the installation is on my localhost. | Django OpenID django-openid-auth Login Error | 1.2 | 0 | 0 | 577 |
2,521,558 | 2010-03-26T06:54:00.000 | 1 | 0 | 1 | 0 | python,performance,if-statement | 2,521,596 | 3 | false | 0 | 0 | I'm with Thilo: I think it should be pretty cheap.
If you really care, you should time the code and find out whether the slight overhead is unacceptable. I suspect not. | 2 | 5 | 0 | I have a division operation inside a cycle that repeats many times. It so happens that in the first few passes through the loop (more or less first 10 loops) the divisor is zero. Once it gains value, a div by zero error is not longer possible.
I have an if condition to test the divisor value in order to avoid the div b... | Avoid IF statement after condition has been met | 0.066568 | 0 | 0 | 1,717 |
2,521,558 | 2010-03-26T06:54:00.000 | 9 | 0 | 1 | 0 | python,performance,if-statement | 2,521,564 | 3 | false | 0 | 0 | Don't worry. An if (a != 0) is cheap.
The alternative (if you really want one) could be to split the loop into two, and exit the first one once the divisor gets its value. But that sounds like it would make the code unnecessarily complex (difficult to read). | 2 | 5 | 0 | I have a division operation inside a cycle that repeats many times. It so happens that in the first few passes through the loop (more or less first 10 loops) the divisor is zero. Once it gains value, a div by zero error is not longer possible.
I have an if condition to test the divisor value in order to avoid the div b... | Avoid IF statement after condition has been met | 1 | 0 | 0 | 1,717 |
2,522,774 | 2010-03-26T11:16:00.000 | 2 | 0 | 0 | 0 | python,django | 2,522,807 | 3 | false | 1 | 0 | request.env['HTTP_USER_AGENT'] will give the user agent string the browser sent. | 2 | 1 | 0 | in server side, not browser. | Is it possible to detect the browser version from Django server side? | 0.132549 | 0 | 0 | 948 |
2,522,774 | 2010-03-26T11:16:00.000 | 1 | 0 | 0 | 0 | python,django | 2,588,289 | 3 | true | 1 | 0 | Unfortunately request.env won't work.
However, you can get it through request.META.get("HTTP_USER_AGENT") | 2 | 1 | 0 | in server side, not browser. | Is it possible to detect the browser version from Django server side? | 1.2 | 0 | 0 | 948 |
2,525,002 | 2010-03-26T16:40:00.000 | 1 | 0 | 1 | 0 | python,ascii,coda | 2,525,363 | 1 | true | 0 | 0 | Python uses the 7-bit ASCII character set for program text. So all you need to do is convert your program to ASCII by going to text > convert to ASCII. Any bad characters will automatically be removed. If you want to specifically know which characters were the bad ones, you can use diff to compare changed and unchanged... | 1 | 1 | 0 | Sometimes I get errors while coding, because of typing some combination of keys (eg. ALT + SHIFT + SQUARE BRACKET) in a wrong way. So I get Syntax Error in Python, but I can't see where the illegal character is, 'cause Coda do not show it to me. Any solution? | How can I catch non valid ASCII characters in Panic Coda? | 1.2 | 0 | 0 | 443 |
2,525,518 | 2010-03-26T17:50:00.000 | 7 | 1 | 0 | 0 | python,c,code-translation | 2,525,638 | 4 | false | 0 | 0 | There's a fundamental question here: is the intent to basically create a Python compiler that uses C as a back-end, or to convert the program to C and maintain the C afterward?
Writing a compiler that produces (really ugly) C as its output probably isn't trivial -- a compiler rarely is, and generating code for Python w... | 1 | 11 | 0 | I was asked to write a code translator that would take a Python program and produce a C program. Do you have any ideas how could I approach this problem or is it even possible? | Writing code translator from Python to C? | 1 | 0 | 0 | 11,985 |
2,526,110 | 2010-03-26T19:25:00.000 | 1 | 1 | 0 | 0 | python,security,authentication,login | 2,526,606 | 4 | false | 0 | 0 | As for how to protect the client... The most realistic thing is to say that you don't. When you're writing the server code, never trust any data that the client sends you. Never give the client any information you don't want the player to have.
In some games, like chess (or really anything turn-based), that actually... | 3 | 4 | 0 | First off I will say I am completely new to security in coding. I am currently helping a friend develop a small game (in Python) which will have a login server. I don't have much knowledge regarding security, but I know many games do have issues with this. Everything from 3rd party applications (bots) to WPE packet man... | Game login authentication and security | 0.049958 | 0 | 0 | 1,320 |
2,526,110 | 2010-03-26T19:25:00.000 | 1 | 1 | 0 | 0 | python,security,authentication,login | 2,526,532 | 4 | false | 0 | 0 | The simple answer to how to protect the password going over the wire, replay attacks, and message tampering is: use SSL. Yes, there are other things you can do with challenge-response authentication schemes for the login part of it, but it sounds like you really want the whole channel protected anyway. Use SSL at the... | 3 | 4 | 0 | First off I will say I am completely new to security in coding. I am currently helping a friend develop a small game (in Python) which will have a login server. I don't have much knowledge regarding security, but I know many games do have issues with this. Everything from 3rd party applications (bots) to WPE packet man... | Game login authentication and security | 0.049958 | 0 | 0 | 1,320 |
2,526,110 | 2010-03-26T19:25:00.000 | 1 | 1 | 0 | 0 | python,security,authentication,login | 2,526,148 | 4 | false | 0 | 0 | This is a tough problem, because the code runs on the client. The replay problem can be solved by using a challenge by letting the server sending a random token which the client adds to the string to be encrypted. This way, the password string will be different each time, and replaying the encrypted string doesn't work... | 3 | 4 | 0 | First off I will say I am completely new to security in coding. I am currently helping a friend develop a small game (in Python) which will have a login server. I don't have much knowledge regarding security, but I know many games do have issues with this. Everything from 3rd party applications (bots) to WPE packet man... | Game login authentication and security | 0.049958 | 0 | 0 | 1,320 |
2,526,273 | 2010-03-26T19:48:00.000 | 0 | 1 | 0 | 0 | python,pyinotify | 2,526,820 | 1 | false | 0 | 0 | If you're going to watch only a few files in a huge tree, it makes sense to watch individual files. On the other hand, if you're going to watch almost all files in the tree, watching the entire tree instead makes sense. To know the point of turn exactly, you must benchmark both to see which one performs better. | 1 | 0 | 0 | I have a very large directory tree I am wanting pyInotify to watch.
Is it better to have pyInotify watch the entire tree or is it better to have a number of watches reporting changes to specific files ?
Thanks | pyInotify performance | 0 | 0 | 0 | 522 |
2,526,458 | 2010-03-26T20:17:00.000 | 1 | 0 | 0 | 0 | python,error-handling,pylons | 2,526,649 | 3 | false | 1 | 0 | I use formencode @validate decorator. It is possible to write custom validator for it but the problem with handling exceptions that occur in the model after validation still exists.
You could write custom action decorator similar to formencode one which will handle your model exceptions and populate c.form_errors. | 1 | 3 | 0 | What is the proper way to handle errors with Python + Pylons?
Say a user sets a password via a form that, when passed to a model class via the controller, throws an error because it's too short. How should that error be handled so that an error message gets displayed on the web page rather than the entire script termi... | Error handling with Python + Pylons | 0.066568 | 0 | 0 | 698 |
2,526,632 | 2010-03-26T20:46:00.000 | 1 | 0 | 0 | 1 | python,debian,binding | 2,526,648 | 5 | false | 0 | 0 | The python-dev package needs to be installed. | 1 | 3 | 0 | I'm trying to compile a Python binding, but I'm unable to find the python.h header on debian. Which package should I install? | Compiling a Python binding on Linux | 0.039979 | 0 | 0 | 772 |
2,526,681 | 2010-03-26T20:55:00.000 | 0 | 0 | 0 | 1 | java,python,xml,macos,xslt | 2,541,765 | 8 | false | 1 | 0 | I have used Saxon 6.5 for years for command line transformations. (Java, XSLT 1)
An excellent fallback if a native solution is not available. | 1 | 15 | 0 | I am on OSX Snow Leopard (10.6.2) I can install anything I need to. I would preferably like a Python or Java solution. I have searched on Google and found lots of information on writing my own program to do this, but this is a just a quick and dirty experiment so I don't want to invest a lot of time on writing a bunch ... | I need a simple command line program to transform XML using an XSL Stylesheet | 0 | 0 | 0 | 23,093 |
2,526,815 | 2010-03-26T21:16:00.000 | 2 | 0 | 0 | 0 | python,c,algorithm,calendar,astronomy | 2,597,088 | 8 | false | 0 | 0 | If you don't need high accuracy, you can always (ab)use a lunar (or lunisolar) calendar class (e.g., HijriCalendar or ChineseLunisolarCalendar in Microsoft .NET) to calculate the (approximate) moon phase of any date, as the calendar's "day-of-month" property, being a lunar (or lunisolar) calendar day, always correspond... | 1 | 41 | 0 | Does anyone know an algorithm to either calculate the moon phase or age on a given date or find the dates for new/full moons in a given year?
Googling tells me the answer is in some Astronomy book, but I don't really want to buy a whole book when I only need a single page.
Update:
I should have qualified my statement a... | Moon / Lunar Phase Algorithm | 0.049958 | 0 | 0 | 43,689 |
2,527,173 | 2010-03-26T22:28:00.000 | 6 | 0 | 0 | 1 | python,mongodb,cassandra,couchdb,nosql | 2,528,683 | 2 | true | 0 | 0 | Cassandra supports map reduce since version 0.6. (Current stable release is 0.5.1, but go ahead and try the new map reduce functionality in 0.6.0-beta3) To get started I recommend to take a look at the word count map reduce example in 'contrib/word_count'. | 1 | 4 | 1 | Since Cassandra doesn't have MapReduce built in yet (I think it's coming in 0.7), is it dumb to try and MapReduce with my Python client or should I just use CouchDB or Mongo or something?
The application is stats collection, so I need to be able to sum values with grouping to increment counters. I'm not, but pretend I'... | Is Using Python to MapReduce for Cassandra Dumb? | 1.2 | 0 | 0 | 1,625 |
2,527,867 | 2010-03-27T02:10:00.000 | -1 | 1 | 0 | 0 | python,perl,groovy | 2,529,182 | 4 | false | 1 | 0 | First, it's important to note that it is very hard to convince someone they're wrong.
He's advocating bash scripts and Perl,
due to their universality and
simplicity
Bash scripts are not simple. The bash programming model is really complex and unfriendly. if statements and expressions, in particular are horrify... | 2 | 4 | 0 | I'm part of a six-member build and release team for an embedded software company. We also support a lot of developer tools, such as Atlassian's Fisheye, Jira, etc., Perforce, Bugzilla, AnthillPro, and a couple of homebrew tools (like my Django release notes generator).
Most of the time, our team just writes little plug... | Standardizing a Release/Tools group on a specific language | -0.049958 | 0 | 0 | 196 |
2,527,867 | 2010-03-27T02:10:00.000 | 4 | 1 | 0 | 0 | python,perl,groovy | 2,527,917 | 4 | false | 1 | 0 | Google standardized on Python for such tasks (and many more) a bit before I joined the company; as far as I know, huge advantages such as Python's great implementations on the JVM and .NET didn't even play a role in the decision -- it was all about readability. At the time (and to some extent, even now) the theory at ... | 2 | 4 | 0 | I'm part of a six-member build and release team for an embedded software company. We also support a lot of developer tools, such as Atlassian's Fisheye, Jira, etc., Perforce, Bugzilla, AnthillPro, and a couple of homebrew tools (like my Django release notes generator).
Most of the time, our team just writes little plug... | Standardizing a Release/Tools group on a specific language | 0.197375 | 0 | 0 | 196 |
2,528,283 | 2010-03-27T05:46:00.000 | 16 | 0 | 1 | 0 | python,mercurial | 2,528,509 | 7 | false | 0 | 0 | Do not store .pyc files in the repository.
Automatize .pyc delete with: find . -name '*.pyc' -delete
While develop use -B argument in Python. | 2 | 15 | 0 | (I foresaw this problem might happen 3 months ago, and was told to be diligent to avoid it. Yesterday, I was bitten by it, hard, and now that it has cost me real money, I am keen to fix it.)
If I move one of my Python source files into another directory, I need to remember to tell Mercurial that it moved (hg move).
Whe... | Automatically deleting pyc files when corresponding py is moved (Mercurial) | 1 | 0 | 0 | 7,805 |
2,528,283 | 2010-03-27T05:46:00.000 | 6 | 0 | 1 | 0 | python,mercurial | 2,528,297 | 7 | false | 0 | 0 | You need:
1) A real deployment infrastructure, even if it's just a shell script, which does everything. Cloning/checking out an updated copy from source control is not a deployment strategy.
2) Any deployment system should completely clean the directory structure. My usual preference is that each deployment happens to ... | 2 | 15 | 0 | (I foresaw this problem might happen 3 months ago, and was told to be diligent to avoid it. Yesterday, I was bitten by it, hard, and now that it has cost me real money, I am keen to fix it.)
If I move one of my Python source files into another directory, I need to remember to tell Mercurial that it moved (hg move).
Whe... | Automatically deleting pyc files when corresponding py is moved (Mercurial) | 1 | 0 | 0 | 7,805 |
2,531,479 | 2010-03-28T00:35:00.000 | 0 | 0 | 1 | 0 | python,ipython | 2,531,535 | 4 | false | 0 | 0 | The DeprecationWarning isn't emitted until the method is called, so you'd have to have a separate attribute on the class that stores the names of deprecated methods, then check that before suggesting a completion.
Alternatively, you could walk the AST for the method looking for DeprecationWarning, but that will fail if... | 1 | 3 | 0 | I would like to control which methods appear when a user uses tab-completion on a custom object in ipython - in particular, I want to hide functions that I have deprecated. I still want these methods to be callable, but I don't want users to see them and start using them if they are inspecting the object. Is this somet... | Hide deprecated methods from tab completion | 0 | 0 | 0 | 991 |
2,531,717 | 2010-03-28T02:44:00.000 | 1 | 0 | 1 | 0 | python,django,keyword | 2,531,927 | 2 | false | 0 | 0 | Abbreviations like NO for navigation officer or OR for operations room need a little care lest you cause a SNAFU ;-) One suspects that better results could be obtained from "Find the NO and send her to the OR" by tagging the words with parts of speech using the context ... hint 1: "the OR" should result in "the [noun]"... | 2 | 1 | 0 | I'm building a website in django that needs to extract key words from short (twitter-like) messages.
I've looked at packages like topia.textextract and nltk - but both seem to be overkill for what I need to do. All I need to do is filter words like "and", "or", "not" while keeping nouns and verbs that aren't conjunctiv... | Key word extraction in Python | 0.099668 | 0 | 0 | 1,322 |
2,531,717 | 2010-03-28T02:44:00.000 | 3 | 0 | 1 | 0 | python,django,keyword | 2,531,724 | 2 | true | 0 | 0 | You can make a set sw of the "stop words" you want to eliminate (maybe copy it once and for all from the stop words corpus of NLTK, depending how familiar you are with the various natural languages you need to support), then apply it very simply.
E.g., if you have a list of words sent that make up the sentence (shorn o... | 2 | 1 | 0 | I'm building a website in django that needs to extract key words from short (twitter-like) messages.
I've looked at packages like topia.textextract and nltk - but both seem to be overkill for what I need to do. All I need to do is filter words like "and", "or", "not" while keeping nouns and verbs that aren't conjunctiv... | Key word extraction in Python | 1.2 | 0 | 0 | 1,322 |
2,532,268 | 2010-03-28T08:05:00.000 | 0 | 0 | 0 | 0 | python,django,django-middleware,django-orm | 5,369,262 | 2 | false | 1 | 0 | You can set up one site for each "site", with it's own settings file, listening to it's own socket, using the same codebase. I'm doing that and I can easily support more than 30 concurrent sites on a middle-size server. Maintainability of configurations and startup scripts is the only issue. | 2 | 2 | 0 | I am creating multisites platform. Anybody can make simple site, with my platform. I plan to use django multidb support. One db for one site. And i need to change db settings depending on request.get_host().
I think that i's not good idea. Prompt other decisions? How it is realised on various designers of sites? | How to change db in django depending on request.get_host()? | 0 | 0 | 0 | 466 |
2,532,268 | 2010-03-28T08:05:00.000 | 1 | 0 | 0 | 0 | python,django,django-middleware,django-orm | 2,534,950 | 2 | false | 1 | 0 | You might want to reconsider using a separate db for reach site. In reviewing the multi-db source, it looks like you'll run into a few scalability issues, depending on how many sites you want to support:
Currently all the databases are set up in settings.py. This could cause a few issues:
Each new site would require r... | 2 | 2 | 0 | I am creating multisites platform. Anybody can make simple site, with my platform. I plan to use django multidb support. One db for one site. And i need to change db settings depending on request.get_host().
I think that i's not good idea. Prompt other decisions? How it is realised on various designers of sites? | How to change db in django depending on request.get_host()? | 0.099668 | 0 | 0 | 466 |
2,532,840 | 2010-03-28T12:19:00.000 | 2 | 0 | 0 | 0 | python,django,content-management-system | 30,400,944 | 2 | false | 1 | 0 | I would say no. Django CMS is well designed, if you change content frequently. It has nice features to build up a page. But that means it only shows its benefits, when you create a lot pages/subpages and so on.
For a simple website that only presents data, without adding new pages/views, Django will suffice.
And from ... | 1 | 0 | 0 | I know python and have just read a basic intro of django. I have to built something like a travel website with real time updates. Will django be sufficent for this? Somebody advised me to look at django-CMS, I couldn't find a very beginner's tutorial there. Should I opt for django-CMS? Also how much of django should i ... | Using Django CMS | 0.197375 | 0 | 0 | 1,502 |
2,533,563 | 2010-03-28T16:18:00.000 | 8 | 0 | 1 | 0 | java,python,programming-languages | 26,374,367 | 7 | false | 0 | 0 | why its always 1st jan 1970 , Because - '1st January 1970' usually called as "epoch date" is the date when the time started for Unix computers, and that timestamp is marked as '0'. Any time since that date is calculated based on the number of seconds elapsed. In simpler words... the timestamp of any date will be differ... | 3 | 114 | 0 | Is there any reason behind using date(January 1st, 1970) as default standard for time manipulation? I have seen this standard in Java as well as in Python. These two languages I am aware of. Are there other popular languages which follows the same standard?
Please describe. | Why are dates calculated from January 1st, 1970? | 1 | 0 | 0 | 104,058 |
2,533,563 | 2010-03-28T16:18:00.000 | 1 | 0 | 1 | 0 | java,python,programming-languages | 2,533,568 | 7 | false | 0 | 0 | Yes, C (and its family). This is where Java took it too. | 3 | 114 | 0 | Is there any reason behind using date(January 1st, 1970) as default standard for time manipulation? I have seen this standard in Java as well as in Python. These two languages I am aware of. Are there other popular languages which follows the same standard?
Please describe. | Why are dates calculated from January 1st, 1970? | 0.028564 | 0 | 0 | 104,058 |
2,533,563 | 2010-03-28T16:18:00.000 | 3 | 0 | 1 | 0 | java,python,programming-languages | 16,132,913 | 7 | false | 0 | 0 | Q) "Why are dates calculated from January 1st, 1970?"
A) It had to be as recent as possible, yet include some past.
There was most likely no significant other reason as a lot of people feel that same way.
They knew it posed a problem if they placed it too far into the past and they knew it gave negative results if it w... | 3 | 114 | 0 | Is there any reason behind using date(January 1st, 1970) as default standard for time manipulation? I have seen this standard in Java as well as in Python. These two languages I am aware of. Are there other popular languages which follows the same standard?
Please describe. | Why are dates calculated from January 1st, 1970? | 0.085505 | 0 | 0 | 104,058 |
2,534,525 | 2010-03-28T20:55:00.000 | 1 | 1 | 0 | 0 | php,python,session,wsgi | 2,534,567 | 3 | false | 1 | 0 | Depends on the PHP app, if it's keeping session data in a database (MySQL maybe) you can just connect to the database and get the data, if it's using native PHP sessions you should look to the session.save_path config setting in php.ini, that's the place where the runtime saves files with the session data.
Once you hav... | 2 | 8 | 0 | I've got a python/WSGI app which needs to check to see if a user has logged on to a PHP web app. The problem is that the PHP app checks if a user has logged on by comparing a value in the $_SESSION variable to a value in the cookie from the user's browser. I would prefer to avoid changing the behavior of the php app if... | Accessing php $_SESSION from python (wsgi) - is it possible? | 0.066568 | 0 | 0 | 5,062 |
2,534,525 | 2010-03-28T20:55:00.000 | 4 | 1 | 0 | 0 | php,python,session,wsgi | 2,534,558 | 3 | false | 1 | 0 | yep. session (in default) is a regular file. so all what you need is look over session directory and find file with name of session cookie value. then - you have to implement php-like serialize/unserialize and do whatever you want.
nope | 2 | 8 | 0 | I've got a python/WSGI app which needs to check to see if a user has logged on to a PHP web app. The problem is that the PHP app checks if a user has logged on by comparing a value in the $_SESSION variable to a value in the cookie from the user's browser. I would prefer to avoid changing the behavior of the php app if... | Accessing php $_SESSION from python (wsgi) - is it possible? | 0.26052 | 0 | 0 | 5,062 |
2,534,527 | 2010-03-28T20:55:00.000 | -2 | 0 | 0 | 0 | python | 2,534,778 | 3 | false | 0 | 0 | File share and polling filesystem every minute. No joke. Of course, it depends on what are requirements for your applications and what lag is acceptable but in practice using file shares is quite common. | 2 | 3 | 0 | This whole topic is way out of my depth, so forgive my imprecise question, but I have two computers both connected to one LAN.
What I want is to be able to communicate one string between the two, by running a python script on the first (the host) where the string will originate, and a second on the client computer to r... | Python inter-computer communication | -0.132549 | 0 | 1 | 996 |
2,534,527 | 2010-03-28T20:55:00.000 | 4 | 0 | 0 | 0 | python | 2,534,582 | 3 | false | 0 | 0 | First, lets get the nomenclature straight. Usually the part that initiate the communication is the client, the parts that is waiting for a connection is a server, which then will receive the data from the client and generate a response. From your question, the "host" is the client and the "client" seems to be the serve... | 2 | 3 | 0 | This whole topic is way out of my depth, so forgive my imprecise question, but I have two computers both connected to one LAN.
What I want is to be able to communicate one string between the two, by running a python script on the first (the host) where the string will originate, and a second on the client computer to r... | Python inter-computer communication | 0.26052 | 0 | 1 | 996 |
2,534,943 | 2010-03-28T23:05:00.000 | 0 | 0 | 0 | 0 | python,django,synchronized | 24,900,469 | 4 | false | 1 | 0 | Great article Justin, just one thing using python 2.5 makes this way easier
In Python 2.5 and later, you can also use the with statement. When used with a lock, this statement automatically acquires the lock before entering the block, and releases it when leaving the block:
from future import with_statement # 2.5 only
... | 1 | 5 | 0 | Is there any way to block a critical area like with Java synchronized in Django? | Thread Synchronization in Django | 0 | 0 | 0 | 5,313 |
2,535,037 | 2010-03-28T23:35:00.000 | 4 | 0 | 1 | 0 | python,syntax | 2,535,050 | 5 | false | 0 | 0 | As far as I know, this isn't possible in 2.5. However, in 3.0, this was changed so that you can simply call super().__init__(). | 1 | 4 | 0 | I find this syntax astoundingly annoying. Every time I rename my class, I have to change this call for no apparent reason. Isn't there some __class__ magic variable or something I can use at least? Interested in answers for Python 2.5, but it doesn't hurt to know if later versions fixed this. | Way to call super(MyClass, self).__init__() without MyClass? | 0.158649 | 0 | 0 | 1,197 |
2,535,055 | 2010-03-28T23:40:00.000 | 1 | 1 | 0 | 0 | python,network-programming,network-protocols | 2,535,076 | 7 | false | 0 | 0 | Many firewalls are configured to drop ping packets without responding. In addition, some network adapters will respond to ICMP ping requests without input from the operating system network stack, which means the operating system might be down, but the host still responds to pings (usually you'll notice if you reboot th... | 3 | 10 | 0 | How would I check if the remote host is up without having a port number? Is there any other way I could check other then using regular ping.
There is a possibility that the remote host might drop ping packets | Check if remote host is up in Python | 0.028564 | 0 | 1 | 46,690 |
2,535,055 | 2010-03-28T23:40:00.000 | 2 | 1 | 0 | 0 | python,network-programming,network-protocols | 2,535,139 | 7 | false | 0 | 0 | A protocol-level PING is best, i.e., connecting to the server and interacting with it in a way that doesn't do real work. That's because it is the only real way to be sure that the service is up. An ICMP ECHO (a.k.a. ping) would only tell you that the other end's network interface is up, and even then might be blocked;... | 3 | 10 | 0 | How would I check if the remote host is up without having a port number? Is there any other way I could check other then using regular ping.
There is a possibility that the remote host might drop ping packets | Check if remote host is up in Python | 0.057081 | 0 | 1 | 46,690 |
2,535,055 | 2010-03-28T23:40:00.000 | 1 | 1 | 0 | 0 | python,network-programming,network-protocols | 17,115,260 | 7 | false | 0 | 0 | What about trying something that requires a RPC like a 'tasklist' command in conjunction with a ping? | 3 | 10 | 0 | How would I check if the remote host is up without having a port number? Is there any other way I could check other then using regular ping.
There is a possibility that the remote host might drop ping packets | Check if remote host is up in Python | 0.028564 | 0 | 1 | 46,690 |
2,535,403 | 2010-03-29T01:54:00.000 | 3 | 0 | 1 | 0 | python,crash | 2,535,408 | 3 | false | 0 | 0 | You might try running your application directly from a console (cmd on windows, sh/bash/etc on unix), so you can see any stack trace, etc printed to the console when the process dies. | 1 | 8 | 0 | I have a python app which is supposed to be very long-lived, but sometimes the process just disappears and I don't know why. Nothing gets logged when this happens, so I'm at a bit of a loss.
Is there some way in code I can hook in to an exit event, or some other way to get some of my code to run just before the proc... | Catching a python app before it exits | 0.197375 | 0 | 0 | 2,043 |
2,535,683 | 2010-03-29T03:38:00.000 | 3 | 0 | 1 | 0 | python,debugging,list,list-comprehension | 2,535,689 | 7 | true | 0 | 0 | If it's complicated enough that it's not obvious at first glance, unpack it into multiple steps and/or for loops. It's clearly too complicated, and making it more explicit is the easiest way to go about debugging it. Added bonus: you can now step through with the debugger or add print statements! | 3 | 19 | 0 | Python list comprehensions are nice, but near impossible to debug. You guys have any good tips / tools for debugging them? | Tips for debugging list comprehensions? | 1.2 | 0 | 0 | 4,854 |
2,535,683 | 2010-03-29T03:38:00.000 | 1 | 0 | 1 | 0 | python,debugging,list,list-comprehension | 2,535,701 | 7 | false | 0 | 0 | tip: Use list comprehension for simple tasks (1 or 2 levels). Otherwise, making it explicit is better for readability. | 3 | 19 | 0 | Python list comprehensions are nice, but near impossible to debug. You guys have any good tips / tools for debugging them? | Tips for debugging list comprehensions? | 0.028564 | 0 | 0 | 4,854 |
2,535,683 | 2010-03-29T03:38:00.000 | 0 | 0 | 1 | 0 | python,debugging,list,list-comprehension | 2,535,774 | 7 | false | 0 | 0 | Use a debugger like pdb to walk through or break the list comprehension into a full for loop. | 3 | 19 | 0 | Python list comprehensions are nice, but near impossible to debug. You guys have any good tips / tools for debugging them? | Tips for debugging list comprehensions? | 0 | 0 | 0 | 4,854 |
2,536,307 | 2010-03-29T07:14:00.000 | 18 | 0 | 1 | 0 | python,decorator,deprecated | 2,536,397 | 7 | false | 0 | 0 | I guess the reason is that Python code can't be processed statically (as it done for C++ compilers), you can't get warning about using some things before actually using it. I don't think that it's a good idea to spam user of your script with a bunch of messages "Warning: this developer of this script is using deprecate... | 1 | 186 | 0 | I need to mark routines as deprecated, but apparently there's no standard library decorator for deprecation. I am aware of recipes for it and the warnings module, but my question is: why is there no standard library decorator for this (common) task ?
Additional question: are there standard decorators in the standard l... | decorators in the python standard lib (@deprecated specifically) | 1 | 0 | 0 | 110,084 |
2,536,468 | 2010-03-29T07:56:00.000 | 0 | 0 | 0 | 0 | python,debugging,pylons | 2,536,493 | 1 | true | 1 | 0 | (On the off-chance that this helps...)
Ubuntu's default Terminal program auto-detects URLs. When my pylons programs burp, I just ctrl-click on the link in the console. | 1 | 0 | 0 | Is there a way to view the latest debug message instead of having to copy and paste something like "_debug/view/1269848287" to the browser everytime? | Pylons: View latest debug message | 1.2 | 0 | 0 | 90 |
2,537,065 | 2010-03-29T10:02:00.000 | 5 | 0 | 0 | 1 | python,django,cgi,webserver,tornado | 3,244,176 | 2 | false | 1 | 0 | Main feature of Tornado is that it is high performance web-server written in Python, for creating web applications using Python programming language.
Running Tornado as CGI application negates the very reason it exists, because running CGI scripts is expensive in terms of performance, and most probably there is no way ... | 1 | 2 | 0 | Tornado is a webserver + framework like Django but for real-time features.
On my server I don't have a python module or wsgi module so I thought
CGI.
Is there a way to get Tornado ( or Django ) works by using CGI folder ?
If yes, Could you explain me how do I do that ? | Tornado or Django works with CGI? | 0.462117 | 0 | 0 | 1,611 |
2,539,109 | 2010-03-29T15:24:00.000 | 4 | 0 | 0 | 0 | python,django,authentication | 2,539,518 | 3 | false | 1 | 0 | Setting the session cookie age in the django session middleware just sets the expiry time in the set-cookie header passed back to the browser. It's only browser compliance with the expiry time that enforces the "log out".
Depending on your reasons for needing the idle log-out, you might not consider browser compliance ... | 1 | 28 | 0 | I'm working on a website that requires us to log a user out after N minutes of inactivity. Are there any best practices for this using Django? | Logging users out of a Django site after N minutes of inactivity | 0.26052 | 0 | 0 | 17,914 |
2,539,147 | 2010-03-29T15:30:00.000 | 3 | 0 | 1 | 0 | python,sql,orm | 2,539,235 | 4 | false | 0 | 0 | SQLAlchemy offers an ORM much like django, but does not require that you work within a web framework. | 1 | 1 | 0 | I am in need of a lightweight way to store dictionaries of data into a database. What I need is something that:
Creates a database table from a simple type description (int, float, datetime etc)
Takes a dictionary object and inserts it into the database (including handling datetime objects!)
If possible: Can handle b... | Lightweight Object->Database in Python | 0.148885 | 1 | 0 | 1,069 |
2,540,460 | 2010-03-29T18:54:00.000 | 0 | 0 | 0 | 1 | python,unix | 2,540,756 | 5 | false | 0 | 0 | I would parse /etc/passwd for the username in question. Users may not necessarily have homedir's. | 1 | 21 | 0 | What is the easiest way to check the existence of a user on a GNU/Linux OS, using Python?
Anything better than issuing ls ~login-name and checking the exit code?
And if running under Windows? | How to check if a user exists in a GNU/Linux OS using Python? | 0 | 0 | 0 | 15,746 |
2,541,254 | 2010-03-29T21:01:00.000 | 1 | 0 | 0 | 0 | python,netbeans,import,module,pygame | 2,908,642 | 1 | false | 0 | 1 | Well I've just finished installing it on my Mac - you have to watch out for the Python Platform under Tools and File. The default is Jython, but you want to change it to point to your python version in the Frameworks file of your Library.
Does that make sense? | 1 | 0 | 0 | I am running python 2.6.5 and pygame 1.9.1 It seems to me I've tried everything but it keeps showing 'module not found' errors... Please help! | Can't import pygame to Netbeans on Mac | 0.197375 | 0 | 0 | 997 |
2,541,702 | 2010-03-29T22:34:00.000 | 3 | 0 | 0 | 0 | python,lotus-notes,lotus | 2,542,163 | 3 | false | 1 | 0 | The short answer is, unfortunately you will need the Notes client installed. There are a few ways to access data from an NSF such as NotesSQL, COM, C/C++, but all rely on the Lotus C API at the core, and you'll need a notes client and a notes ID file to gain access via that API. | 3 | 0 | 0 | I am looking for a programatic way to access content in a Lotus Notes database (.nsf file) without having Lotus Notes software installed.
Python would be preferred but I'm also willing to look at other languages e.g. C/C++ or other means e.g. SQL
From what I have read, all of the methods e.g. Python COM access, pyodbc ... | Access to content of Lotus Notes database without Lotus Notes software installed | 0.197375 | 0 | 0 | 3,704 |
2,541,702 | 2010-03-29T22:34:00.000 | 0 | 0 | 0 | 0 | python,lotus-notes,lotus | 2,551,002 | 3 | false | 1 | 0 | Like Ken says, inevitably there has to be a server in the mix. If you're searching for specific text in a Notes / Domino application, and looking to replace it, there's a tool out there which does this: Teamstudio Configurator.
Configurator also has an API (written in Lotusscript, which is very like old-skool VB) so yo... | 3 | 0 | 0 | I am looking for a programatic way to access content in a Lotus Notes database (.nsf file) without having Lotus Notes software installed.
Python would be preferred but I'm also willing to look at other languages e.g. C/C++ or other means e.g. SQL
From what I have read, all of the methods e.g. Python COM access, pyodbc ... | Access to content of Lotus Notes database without Lotus Notes software installed | 0 | 0 | 0 | 3,704 |
2,541,702 | 2010-03-29T22:34:00.000 | 1 | 0 | 0 | 0 | python,lotus-notes,lotus | 2,607,921 | 3 | false | 1 | 0 | If this is a one-time need, you may be able to find sites that will do some simple Domino/Notes hosting for free. If you could put the NSF up to a service like that, you could then use Domino URL's (REST) to extract the data and search for links, etc. | 3 | 0 | 0 | I am looking for a programatic way to access content in a Lotus Notes database (.nsf file) without having Lotus Notes software installed.
Python would be preferred but I'm also willing to look at other languages e.g. C/C++ or other means e.g. SQL
From what I have read, all of the methods e.g. Python COM access, pyodbc ... | Access to content of Lotus Notes database without Lotus Notes software installed | 0.066568 | 0 | 0 | 3,704 |
2,541,742 | 2010-03-29T22:42:00.000 | 4 | 0 | 0 | 0 | python,cookies,session,security | 2,542,128 | 8 | true | 1 | 0 | If the only information in the cookie is an identifier, essentially a label, the only attack you're trying to protect from is an attacker guessing what it is. So use some random bytes. Enough random bytes that it's "unguessable."
Then squish the random bytes into something that fits within the confines of which chara... | 2 | 6 | 0 | I'm writing my own sessions controller that issues a unique id to a user once logged in, and then verifies and authenticates that unique id at every page load. What is the most secure way to generate such an id? Should the unique id be completely random? Is there any downside to including the user id as part of the ... | Most secure way to generate a random session ID for a cookie? | 1.2 | 0 | 0 | 13,882 |
2,541,742 | 2010-03-29T22:42:00.000 | 0 | 0 | 0 | 0 | python,cookies,session,security | 29,989,100 | 8 | false | 1 | 0 | I would avoid the random factor completely. What I've generally done is:
Generate a sequential session_id (which I store locally).
When the user logs in, sign session_id with a private key (I use itsdangerous for this).
When I get a request, if the session_id's signature is intact, I proceed, otherwise, 403 (400 would... | 2 | 6 | 0 | I'm writing my own sessions controller that issues a unique id to a user once logged in, and then verifies and authenticates that unique id at every page load. What is the most secure way to generate such an id? Should the unique id be completely random? Is there any downside to including the user id as part of the ... | Most secure way to generate a random session ID for a cookie? | 0 | 0 | 0 | 13,882 |
2,542,025 | 2010-03-29T19:33:00.000 | 1 | 0 | 0 | 1 | python,network-shares | 2,542,026 | 1 | true | 0 | 0 | Mount the shares using Samba, check the free space on the share using df or os.statvfs and read/write to it like any other folder. | 1 | 1 | 0 | How to Write/Read a file to/from a network folder/share using python? The application will run under Linux and network folder/share can be a Linux/Windows System.
Also, how to check that network folder/share has enough space before writing a file?
What things should i consider? | Read/Write a file from/to network folder/share using Python? | 1.2 | 0 | 1 | 1,813 |
2,542,206 | 2010-03-30T00:47:00.000 | 2 | 0 | 0 | 0 | python,timezone,pylons | 2,542,216 | 1 | true | 0 | 0 | You can't get the client's timezone using server-side code, you can, however:
use Javascript: Date.getTimezoneOffset();
use geolocation to determine where the user is located and deduce the timezone from the location | 1 | 2 | 0 | Is there a way to get the timezone of the connecting user using Pylons, and to adjust the content before rendering accordingly? Or can this only be done by JS?
Thanks. | Get a user's timezone in Python + Pylons | 1.2 | 0 | 0 | 590 |
2,542,674 | 2010-03-30T03:20:00.000 | 5 | 0 | 0 | 0 | python,django | 2,542,702 | 5 | false | 1 | 0 | The python interpreter does not look everywhere on your path to find the script. It does look everywhere for imports, but not for scripts.
Try typing django-admin.py, just django-admin.py and not python django-admin.py, and it should work. Windows should find it on the path, then execute it as a python script.
OK,
If W... | 4 | 3 | 0 | I have added C:\Python26\Lib\site-packages\django\bin to my path, I have started a new cmd session in Windows 7, but when I try to do 'python django-admin.py ...' it says there is no file django-admin.py. When I type path, there is the full path to ...\django\bin. This is driving me nuts. Clearly it's there, but it's ... | No matter what I do, django-admin.py is not found, even though it's in my path | 0.197375 | 0 | 0 | 6,085 |
2,542,674 | 2010-03-30T03:20:00.000 | 4 | 0 | 0 | 0 | python,django | 2,543,312 | 5 | false | 1 | 0 | python -mdjango-admin looks like what you're looking for. -m tells Python to find a module on sys.path and run that module as "the main script" -- which seems exactly your goal! | 4 | 3 | 0 | I have added C:\Python26\Lib\site-packages\django\bin to my path, I have started a new cmd session in Windows 7, but when I try to do 'python django-admin.py ...' it says there is no file django-admin.py. When I type path, there is the full path to ...\django\bin. This is driving me nuts. Clearly it's there, but it's ... | No matter what I do, django-admin.py is not found, even though it's in my path | 0.158649 | 0 | 0 | 6,085 |
2,542,674 | 2010-03-30T03:20:00.000 | 5 | 0 | 0 | 0 | python,django | 14,559,937 | 5 | false | 1 | 0 | I realize this is old, but came across the same issue.
On Windows, your path should include the following:
C:\Python27\;C:\Python27\Scripts
This is assuming python 2.7.3 is installed and django 1.4.3 | 4 | 3 | 0 | I have added C:\Python26\Lib\site-packages\django\bin to my path, I have started a new cmd session in Windows 7, but when I try to do 'python django-admin.py ...' it says there is no file django-admin.py. When I type path, there is the full path to ...\django\bin. This is driving me nuts. Clearly it's there, but it's ... | No matter what I do, django-admin.py is not found, even though it's in my path | 0.197375 | 0 | 0 | 6,085 |
2,542,674 | 2010-03-30T03:20:00.000 | 0 | 0 | 0 | 0 | python,django | 2,718,527 | 5 | false | 1 | 0 | I had the same problem, and python -mdjango-admin works. but i had to define PYTHONHOME & PYTHONPATH first | 4 | 3 | 0 | I have added C:\Python26\Lib\site-packages\django\bin to my path, I have started a new cmd session in Windows 7, but when I try to do 'python django-admin.py ...' it says there is no file django-admin.py. When I type path, there is the full path to ...\django\bin. This is driving me nuts. Clearly it's there, but it's ... | No matter what I do, django-admin.py is not found, even though it's in my path | 0 | 0 | 0 | 6,085 |
2,542,809 | 2010-03-30T04:02:00.000 | 3 | 0 | 1 | 0 | python,import | 2,542,833 | 4 | false | 0 | 0 | I figured it out. Imported modules have a __file__ field that is the file that was loaded. Combine that with __import__, I defined a function:
which = lambda str : __import__(str).__file__. | 2 | 7 | 0 | How do you determine which file is imported in Python with an "import" statement?
I want to determine that I am loading the correct version of a locally modified .py file. Basically the equivalent of "which" in a POSIX environment. | How do you determine which file is imported in Python with an "import" statement? | 0.148885 | 0 | 0 | 2,953 |
2,542,809 | 2010-03-30T04:02:00.000 | 10 | 0 | 1 | 0 | python,import | 2,542,840 | 4 | false | 0 | 0 | Look at its __file__ attribute. | 2 | 7 | 0 | How do you determine which file is imported in Python with an "import" statement?
I want to determine that I am loading the correct version of a locally modified .py file. Basically the equivalent of "which" in a POSIX environment. | How do you determine which file is imported in Python with an "import" statement? | 1 | 0 | 0 | 2,953 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.