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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4,641,765 | 2011-01-09T21:02:00.000 | 2 | 0 | 1 | 0 | python,list,integer,add | 39,752,058 | 5 | false | 0 | 0 | If you try appending the number like, say
listName.append(4) , this will append 4 at last.
But if you are trying to take <int> and then append it as, num = 4 followed by listName.append(num), this will give you an error as 'num' is of <int> type and listName is of type <list>. So do type cast int(num) before appending... | 1 | 14 | 0 | I have a list of integers and I was wondering if it would be possible to add to individual integers in this list. | Add to integers in a list | 0.07983 | 0 | 0 | 198,237 |
4,641,877 | 2011-01-09T21:18:00.000 | 0 | 1 | 0 | 0 | python,pdf,pdf-generation | 4,641,984 | 3 | false | 0 | 0 | Be careful if you want to be able to extract the tabular data later from the PDFs. They need to be created as Structured Content or there will be no tabular metadata in the PDF file. | 1 | 3 | 0 | What is the easiest way to generate PDF documents with embedded fonts in Python without a commercial/restricted library?
I want to generate documents with tabular data and headers/footers. I've tried reportlab, but while powerful, it seems rather difficult to use. | FLOSS/Free solution to generate PDF documents in Python? | 0 | 0 | 0 | 383 |
4,642,716 | 2011-01-10T00:10:00.000 | -3 | 0 | 0 | 0 | python,pyqt | 4,644,119 | 4 | false | 0 | 0 | Note that this doesn't tell you eg. which cell in a grid control wasedited - just the grid control handle itself.
There is a new Advanced Qt book out which goes into a lot of detail about advanced signal/slot routing | 1 | 9 | 0 | I develop an application on PyQt, I like the signal-slot model, but is there any way to
determine the emitter of signal? I hope that there is a way, because it will let to write more generic code without defining lots of slots for each similar signal. | How to determine who emitted the signal? | -0.148885 | 0 | 0 | 17,908 |
4,643,247 | 2011-01-10T02:33:00.000 | 1 | 0 | 0 | 1 | python,wxpython | 4,643,279 | 3 | false | 0 | 1 | I suggest both, script for all platforms and frozen binary for lazy windows users.
To answer your latest question, you don't compile python. Python is an interpreted language, it gets compiled on the fly when run. A python frozen binary is actually the python interpreter with your script hardcoded in it. And frozen bin... | 1 | 3 | 0 | I have a wxPython application that is almost done & I would like to place it in my portfolio. I have to consider when someone attempts to run my app that they may not have Python, or wxPython, so if they just click the main script/python file its not going to run, right?
How should I distribute my app (how do you distr... | Releasing a wxPython App: Give out scripts or compile in Exe, etc? | 0.066568 | 0 | 0 | 1,685 |
4,643,579 | 2011-01-10T03:59:00.000 | 1 | 0 | 0 | 0 | objective-c,time,python-idle | 9,402,960 | 4 | false | 0 | 1 | I used a different approach.
Subclassing UIApplication I override the sendEvent method filtering touches (actually you can filter any kind of event, acceleration, touches, etc.).
Using a shared variable and a background timer I managed the "idle".
Every time the user touch the screen the variable is set with current t... | 1 | 7 | 0 | My cocoa app runs background tasks, which I would like to stop when the user becomes idle (no keyboard/mouse input) and then resume when the user becomes active again. Is there a way to register for idle-state notifications? | Objective C: Get notifications about a user's idle state | 0.049958 | 0 | 0 | 3,011 |
4,644,049 | 2011-01-10T05:51:00.000 | 0 | 0 | 0 | 0 | python,django,authentication,configuration,login | 59,461,520 | 3 | false | 1 | 0 | LOGIN_REDIRECT_URL = '/login' will solve your problem.
LOGIN_URL = '/login' is just for telling django that '/login' is your login URL and LOGIN_REDIRECT_URL will tell django where to redirect user after login. | 1 | 9 | 0 | I want it to redirect to "/login" instead of "/accounts/login"
Is there a setting I can change? | The @login_required decorator of Django redirects people to /accounts/login when they aren't registered. How to change this URL? | 0 | 0 | 0 | 4,416 |
4,644,317 | 2011-01-10T06:42:00.000 | 1 | 0 | 0 | 0 | python,django,apache,mod-wsgi | 4,644,443 | 1 | true | 1 | 0 | The broken pipe mostly mean that one socket in the canal of transmission has been closed without notifying the other one , in your case i think it mean that the database connection that you have establish was closed from the database part, so when you code try to use it, it raise the exception.
Usually the database con... | 1 | 1 | 0 | i have a django project with a long running (~3hour) management command
in my production environment ( apache mod_wsgi ) this process fails with a broken pipe(32) at the end, when trying to update the database.
thank you | django long running process database connection | 1.2 | 1 | 0 | 571 |
4,645,581 | 2011-01-10T10:06:00.000 | 1 | 0 | 0 | 0 | python,continuous-integration,python-sphinx,hudson | 4,653,469 | 3 | false | 1 | 0 | Get the sidelink plugin. That let's you add a link to the ones that are on the left-hand side of the project page. | 2 | 5 | 0 | I'm using Hudson to generate the documentation for a Python project using Sphinx. This generates HTML documentation in the folder project/_build/html, which I set up to be used as an build artifact. Now after running the job, I can navigate to the documentation by clicking on the "Artifacts" link, then on the folder, a... | Add a custom link to hudson project page | 0.066568 | 0 | 0 | 1,120 |
4,645,581 | 2011-01-10T10:06:00.000 | 2 | 0 | 0 | 0 | python,continuous-integration,python-sphinx,hudson | 4,647,033 | 3 | true | 1 | 0 | The Project Description allows HTML, just edit it and place the link to your docs from the last successful build. | 2 | 5 | 0 | I'm using Hudson to generate the documentation for a Python project using Sphinx. This generates HTML documentation in the folder project/_build/html, which I set up to be used as an build artifact. Now after running the job, I can navigate to the documentation by clicking on the "Artifacts" link, then on the folder, a... | Add a custom link to hudson project page | 1.2 | 0 | 0 | 1,120 |
4,646,659 | 2011-01-10T12:11:00.000 | 1 | 0 | 0 | 0 | python,django | 4,647,246 | 8 | false | 1 | 0 | There are two places you can go to try to decouple the view and put it into a new desktop app. First you can use the existing controller and model and adapt a new view to that. Second, you can use only the existing model and build a new view and controller.
If you haven't adhered closely enough to the MVC principles t... | 3 | 3 | 0 | How to convert the web site develpoed in django, python into desktop application.
I am new to python and django can you please help me out
Thanks in Advance | How to convert the django web application into the desktop application | 0.024995 | 0 | 0 | 6,009 |
4,646,659 | 2011-01-10T12:11:00.000 | 2 | 0 | 0 | 0 | python,django | 4,646,707 | 8 | false | 1 | 0 | For starters, you'll have to replace the web UI with a desktop technology like Tk/Tcl.
If you do that, you may not want to use HTTP as the protocol between the client and the services.
Django is a web framework. If you're switching to a desktop, you'll have to forego Django. | 3 | 3 | 0 | How to convert the web site develpoed in django, python into desktop application.
I am new to python and django can you please help me out
Thanks in Advance | How to convert the django web application into the desktop application | 0.049958 | 0 | 0 | 6,009 |
4,646,659 | 2011-01-10T12:11:00.000 | 0 | 0 | 0 | 0 | python,django | 41,890,316 | 8 | false | 1 | 0 | I am thinking about a similar Problem.
Would it be enough to habe a minimal PyQt Gui that enables you to present the djando-website from localhost (get rid of TCP/HTTPS on loop interface somehow) via QtWebkit?
All you seem to need is to have a minimal Python-Broser, that surfs the build in Webserver (and i guess you co... | 3 | 3 | 0 | How to convert the web site develpoed in django, python into desktop application.
I am new to python and django can you please help me out
Thanks in Advance | How to convert the django web application into the desktop application | 0 | 0 | 0 | 6,009 |
4,648,115 | 2011-01-10T14:59:00.000 | 0 | 0 | 1 | 0 | python,glob | 4,648,223 | 2 | false | 0 | 0 | glob doesn't use regular expressions, it has a much simpler set of rules.
An alternative would be to use os.walk() and perform the title matching yourself with a regular expression. | 1 | 0 | 0 | Hey there.
I'm using glob.glob function in order to get a list of all .txt files on a path that i provide.
The regex I'm feeding the function as C:\build\*.txt, but it works only for the root directory, and I'd like to find all text files in c:\build\, also c:\build\files\ha.txt for example.
How is it possible?
Thankss... | How to find all text files with Regex? | 0 | 0 | 0 | 4,381 |
4,648,792 | 2011-01-10T16:09:00.000 | 1 | 0 | 0 | 1 | python,linux,internals | 4,649,590 | 3 | false | 0 | 0 | Not really sure why you need something specific, they are all text files for the most part, you can just mess with them directly.
There aren't any python modules that does that as far as I know. | 1 | 9 | 0 | Hey all, Linux has a lot of great features in procfs and sysfs, and tools like vmstat extend that quite a bit, but I have a need to collect data from a variety of these systems and was hoping to leverage a unified Python utility instead of hacking together a bunch of disparate scripts.
In order to do that I first need ... | Is there a python module to parse Linux's sysfs? | 0.066568 | 0 | 0 | 6,009 |
4,649,343 | 2011-01-10T17:03:00.000 | 2 | 0 | 0 | 0 | python,html,url | 4,650,080 | 1 | true | 1 | 0 | You need a script that you can execute on the server. This can be written in any language you want. Python works fine. Unless loads of people call the URL at once you can use CGI (it's a bit slow when using Python). | 1 | 1 | 0 | What I'm asking may sound strange, but I really need it..
What I need is a url that I can setup (like a free server with php support, but something reliable) and call that url from python with the arguments I need and it would write the values to a file.
I don't know if what I really need is a server with php (I hope n... | Call a url that writes to a file on a server (free) | 1.2 | 0 | 1 | 250 |
4,650,243 | 2011-01-10T18:46:00.000 | 163 | 1 | 0 | 0 | c++,python,c,code-generation | 4,650,953 | 8 | false | 0 | 1 | If the C variant needs x hours less, then I'd invest that time in letting the algorithms run longer/again
"invest" isn't the right word here.
Build a working implementation in Python. You'll finish this long before you'd finish a C version.
Measure performance with the Python profiler. Fix any problems you find. C... | 2 | 202 | 0 | is it possible to convert a Python program to C/C++?
I need to implement a couple of algorithms, and I'm not sure if the performance gap is big enough to justify all the pain I'd go through when doing it in C/C++ (which I'm not good at). I thought about writing one simple algorithm and benchmark it against such a conve... | Convert Python program to C/C++ code? | 1 | 0 | 0 | 475,467 |
4,650,243 | 2011-01-10T18:46:00.000 | 12 | 1 | 0 | 0 | c++,python,c,code-generation | 37,192,125 | 8 | false | 0 | 1 | I know this is an older thread but I wanted to give what I think to be helpful information.
I personally use PyPy which is really easy to install using pip. I interchangeably use Python/PyPy interpreter, you don't need to change your code at all and I've found it to be roughly 40x faster than the standard python interp... | 2 | 202 | 0 | is it possible to convert a Python program to C/C++?
I need to implement a couple of algorithms, and I'm not sure if the performance gap is big enough to justify all the pain I'd go through when doing it in C/C++ (which I'm not good at). I thought about writing one simple algorithm and benchmark it against such a conve... | Convert Python program to C/C++ code? | 1 | 0 | 0 | 475,467 |
4,651,172 | 2011-01-10T20:27:00.000 | 24 | 0 | 0 | 0 | python,django,django-templates | 4,651,237 | 4 | false | 1 | 0 | {{ data.0 }} should work.
Let's say you wrote data.obj django tries data.obj and data.obj(). If they don't work it tries data["obj"]. In your case data[0] can be written as {{ data.0 }}. But I recommend you to pull data[0] in the view and send it as separate variable. | 1 | 137 | 0 | This may be simple, but I looked around and couldn't find an answer. What's the best way to reference a single item in a list from a Django template?
In other words, how do I do the equivalent of {{ data[0] }} within the template language? | Reference list item by index within Django template? | 1 | 0 | 0 | 132,262 |
4,651,239 | 2011-01-10T20:33:00.000 | 2 | 0 | 1 | 0 | python,scheduler | 4,651,287 | 2 | false | 0 | 0 | That's not the best solution. It's no guarantee you are locked out for more than one second.
You should stick to 0.5 second resolution (or worse if no lives depend on it) and fire the event whenever it is at or past the due time, and keep a flag per event if it has been fired. Then it will always be fired at exactly o... | 1 | 1 | 0 | I'm creating an alarm clock in python and have a simple question:
My alarm clock's resolution needs to be down to the second. Currently I have a thread that wakes every 0.5 seconds, and checks whether its time to start making noise.
My only concern is that somehow the system gets completely overloaded at some point and... | Simple alarm clock and checking time every second | 0.197375 | 0 | 0 | 1,365 |
4,652,048 | 2011-01-10T22:05:00.000 | 4 | 0 | 0 | 0 | python,django,post,button,django-forms | 4,652,188 | 1 | true | 1 | 0 | That's what a Form is for. You can create a small HTML form with just the button.
The form's action is the URI to which a request is sent.
Django parse the URI and calls a view function.
The function does the work and returns the resulting page. | 1 | 1 | 0 | Basic question, but I can't find a simple answer anywhere.
What is the best way to do the following in Django:
User pushes button
Some Python code gets crunched server-side
User sees confirmation page
All the user needs to know is that the server did what he told it to. No input other than the button click.
Thanks i... | How to: Click button, then do stuff, then show confirmation in Django | 1.2 | 0 | 0 | 864 |
4,652,472 | 2011-01-10T22:56:00.000 | 28 | 0 | 1 | 0 | python,vim | 4,661,417 | 3 | true | 0 | 0 | To best answer your initial question: "How to install python syntax support in Vim":
There is no need to install anything! If you have not made any modifications (e.g. no configuration changes for vim in ~/.vimrc) try the following:
Open a Python file with vim
type the following command :syntax on
You should now hav... | 2 | 14 | 0 | I recently started programming in python and have fallen in love with Vim over the past few weeks. I know want to use Vim as my primary editor for python files. I know there are python plugins for Vim, but I am very confused as to where/how I can install these. I don't really understand where Vim is installed. I'm runn... | How to install python syntax support for Vim on Mac OSX? | 1.2 | 0 | 0 | 21,812 |
4,652,472 | 2011-01-10T22:56:00.000 | 0 | 0 | 1 | 0 | python,vim | 36,414,972 | 3 | false | 0 | 0 | for mac os x, the vimrc file is located in /usr/share/vim directory
edit the vimdc file with any text editor. Add the syntax on to the last line of the file. Then next time you start a file you can see color. This is a system wide setting. In other linux flavor it may be located in /etc/ you can find this file by find... | 2 | 14 | 0 | I recently started programming in python and have fallen in love with Vim over the past few weeks. I know want to use Vim as my primary editor for python files. I know there are python plugins for Vim, but I am very confused as to where/how I can install these. I don't really understand where Vim is installed. I'm runn... | How to install python syntax support for Vim on Mac OSX? | 0 | 0 | 0 | 21,812 |
4,652,893 | 2011-01-10T23:59:00.000 | 1 | 0 | 1 | 1 | python,textwrangler | 4,910,172 | 1 | true | 0 | 0 | The terminal that TextWranger opens up when you click on #! | Run in Debugger is the debug environment provided by TextWrangler. It's a command-line utility similar to gdb (from the GNU toolchain) if you've ever used that before. When the terminal opens, if you see this prompt: (pdb) then that means you're in the debug... | 1 | 2 | 0 | When I am debugging python code in TextWrangler using the #! | Run in Debugger option the code is run in a terminal not in the python debugger. How do I configure TextWrangler to use the python debugger?
BTW - Using TextWrangler v3.5 (2880) running on a Mac, python file has .py extension and is seen by TextWrangler as ... | Debugging Python in TextWrangler shows Terminal not Debugger | 1.2 | 0 | 0 | 2,348 |
4,653,361 | 2011-01-11T01:34:00.000 | 1 | 1 | 0 | 1 | python,erlang | 4,654,839 | 1 | false | 0 | 0 | I haven't worked Erlang<->Python before but erlport.org seems promising. I would try that first before getting into greasiness with REST and what not. I.e. I didn't provide and answer but a recommendation :) | 1 | 2 | 0 | I have a project where I use erlang to aggregate RSS, and I use python to process the RSS feeds.
Method 1:
Use an erlang port, using erlport.org, to call python.
I'm not sure how to design the python code to be asyncrhonous using erlport.
Method 2:
Use erlang to call on a RESTful interface with Tornado that does the... | Which of two methods of using python within erlang should I use? | 0.197375 | 0 | 0 | 196 |
4,656,923 | 2011-01-11T11:06:00.000 | 0 | 0 | 0 | 1 | python,events,google-app-engine,login,hook | 4,663,607 | 2 | false | 1 | 0 | I'm using Python on GAE (so it may be different for Java) but have seen no documentation about such a hook for a user logging in. If you used one of the session management frameworks you'd probably get some indication for that, but otherwise I do this kind of house keeping on my opening page itself which requires login... | 1 | 7 | 0 | Every time a user logs in to the application, I want to perform a certain task, say, record the time of login. So I wanted to know if a hook is fired on login by default? If yes, how can I make my module respond to it.
Edit - Assume there are multiple entry points in the application to login. | Login hook on Google Appengine | 0 | 0 | 0 | 345 |
4,657,001 | 2011-01-11T11:14:00.000 | 0 | 0 | 0 | 0 | python,gdata-api,google-data-api,gdata-python-client | 4,792,423 | 1 | true | 0 | 0 | Answer from Google support forum:
This might happen due to some issues in the Calendar servers and is not an error on your part. The best way to "resolve" this issue is to retry again. | 1 | 1 | 0 | I'm using python GData to work with Google Calendar. I'm making really simple requests (e.g. create event), using OAuth authorization.
Usually this works OK, but sometimes I'm receiving lots of 302 redirects, that leads to "Maximum redirects count reached" exception.
If I re-try same request, it's usually works corre... | Python GData lib causes too much redirects | 1.2 | 0 | 1 | 76 |
4,657,347 | 2011-01-11T11:57:00.000 | 17 | 0 | 1 | 0 | python,windows,django,networking,windows-server-2008 | 4,657,548 | 1 | true | 0 | 0 | That's an error Windows gives when you're trying to bind to an address on the local machine that's not assigned to any of the adapters on the machine. If ipconfig doesn't show it, you can't bind to it.
If the external address is on a router that is NAT'ing requests from it to the server's internal address, you can't b... | 1 | 7 | 0 | I'm using Python 2.6 and Windows Server 2008.
The server has two IP addresses 1 internal, 1 external.
I need Python to use the external IP address, but while doing so I get this:
socket.error: [Error 10049] The requested address is not valid in its context
To be more precise I'm using Django's runserver command for... | Socket error "IP address not valid in its context" - Python | 1.2 | 0 | 1 | 25,060 |
4,657,611 | 2011-01-11T12:29:00.000 | 1 | 1 | 0 | 0 | java,php,python,xmpp | 8,296,818 | 4 | true | 0 | 0 | The OpenFire understand XMPP, what you need is XMPP library/API (like XMPP4R if you are Rubyist). Using it your app will login to OpenFire (by sending gmail/yahoo credentials) and others will see you as online. But when they will reply to you, you will be notified in your application. Where you can receive the message,... | 1 | 0 | 0 | I am interested to make a chatbot. My script is currently working fine with imified.com bot. however imified is down almost everday. so i am looking for my own solution.
during my findings, I have found (through this site) openfire and I have configured it and it is working fine even with gmails users.
but i am still... | XMPP, openfire and bot issue | 1.2 | 0 | 1 | 2,089 |
4,658,259 | 2011-01-11T13:47:00.000 | 2 | 0 | 1 | 0 | python,python-3.x,python-2.7 | 4,658,632 | 1 | true | 0 | 0 | Why don't you try it? If it hasn't been ported it's unlikely to even install.
The lack of mention of Python 3 is however a pretty big indication that it hasn't been ported, and since it hasn't had one single release since Python 3 was released I'd say you probably have to use Python 2.
(Edit: I downloaded it and tried.... | 1 | 1 | 0 | I will be using pygccxml to parse C++ header files.
Does this module work with Python 3.0+ (i.e. have you used it without issues on this version of python)?
The reason I ask is that python 3.0+ is backwards-incompatible and i want to know if I need to run python 2.7+ or if I can go with the newer 3.0+.
Thank You | pygccxml on python 3.0+ or Python 2.7+? | 1.2 | 0 | 0 | 365 |
4,658,355 | 2011-01-11T13:56:00.000 | -4 | 0 | 1 | 0 | python,windows,cmd,font-size,command-prompt | 4,661,519 | 3 | false | 0 | 0 | No, you can't change that, as far as I know. Luckly, nobody on windows uses the console anyway, so I advise you to move to a GUI library instead.
With your own GUI window, you can configure the font and layout as much as you want, include buttons, images, animations, menus, etc... | 2 | 2 | 0 | I'm using Win XP and Python 2.5. Is there a way in Python to modify font size when print to CMD window? | Modify font size when print out to screen | -1 | 0 | 0 | 31,677 |
4,658,355 | 2011-01-11T13:56:00.000 | 0 | 0 | 1 | 0 | python,windows,cmd,font-size,command-prompt | 33,972,605 | 3 | false | 0 | 0 | You should create a desktop link to cmd.exe and set/change the layout properties (e.g. to window size 120*40 or appropriate). Start your program in this console windows (python.exe yourprogram.py). | 2 | 2 | 0 | I'm using Win XP and Python 2.5. Is there a way in Python to modify font size when print to CMD window? | Modify font size when print out to screen | 0 | 0 | 0 | 31,677 |
4,658,688 | 2011-01-11T14:33:00.000 | 2 | 0 | 1 | 0 | python | 4,658,916 | 3 | false | 0 | 0 | Yes, you can store it. In a file, or in the windows registry if you are on windows, or in a database, or in a datastore if you are on some server, or you can store it on a server.
Maybe you can give some more information about your actual problem, and also tell us what you have tried, and why that failed? | 1 | 0 | 0 | Is it possible to store name of the user that started my script last?
I want to have something like this:
user1 launched script
user2 launched script
python myscr.py
Last started by: user1
... | python: Python script knows user that started this script last time? | 0.132549 | 0 | 0 | 158 |
4,661,377 | 2011-01-11T18:45:00.000 | 0 | 1 | 0 | 0 | php,python,cron,web-hosting | 4,661,872 | 3 | true | 1 | 0 | A different solution might be to use a database, and not bite off so much work at once. Make a table listing the sites you pull, and store when they were last pulled. Then have the cron pull out 1 or 2 that haven't been pulled in a while. Have it run often, then you'll always have fresh data, but the script will hav... | 2 | 1 | 0 | We have a website that lists links to blogs in realtime. The problem is that the pages are slow to load because they are reading data from the various source sites.
I wrote a PHP script that creates an HTML version of each page. This runs once each hour. The problem is that the PHP script is timing out before it finish... | Alternatives to PHP Cron Job for Long Running Jobs | 1.2 | 0 | 0 | 1,341 |
4,661,377 | 2011-01-11T18:45:00.000 | 1 | 1 | 0 | 0 | php,python,cron,web-hosting | 4,661,510 | 3 | false | 1 | 0 | Given the fact that your original problem is one of network latency ("pages are slow to load") I see no reason to believe that PHP is the bottleneck here. I doubt changing languages will affect your script run time. | 2 | 1 | 0 | We have a website that lists links to blogs in realtime. The problem is that the pages are slow to load because they are reading data from the various source sites.
I wrote a PHP script that creates an HTML version of each page. This runs once each hour. The problem is that the PHP script is timing out before it finish... | Alternatives to PHP Cron Job for Long Running Jobs | 0.066568 | 0 | 0 | 1,341 |
4,661,557 | 2011-01-11T19:06:00.000 | 14 | 0 | 1 | 0 | python,colors,python-imaging-library | 56,346,551 | 13 | false | 0 | 0 | Adding a solution using the ellipsis
image = image[...,::-1]
In this case, the ellipsis ... is equivalent to :,: while ::-1 inverts the order of the last dimension (channels). | 1 | 68 | 0 | I have an image where the colors are BGR. How can I transform my PIL image to swap the B and R elements of each pixel in an efficient manner? | PIL rotate image colors (BGR -> RGB) | 1 | 0 | 0 | 117,384 |
4,662,738 | 2011-01-11T21:13:00.000 | 0 | 0 | 0 | 0 | python,django,mobile-phones,mobile-website,sms-gateway | 4,666,780 | 3 | false | 1 | 0 | First of all you either need to setup your own gateway with a mobile phone and a software that reads incoming text and processes it or find a service provider. If you buy a short code it may be costly but there should be some services around that allows you to use common number with a keyword to receive and process inc... | 1 | 0 | 0 | Ive tried to look up how to accept texts from mobile phones with Django (e.g. like Twitter) to post data to user accounts. All i have ran across is how to make a mobile web app with django as in different layouts etc.. Has anyone any idea where a tutorial on this might be or how in the world to start doing this with dj... | Accepting mobile short code texts (e.g. Twitter) with Django | 0 | 0 | 0 | 342 |
4,663,071 | 2011-01-11T21:55:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,sqlite,relational-database,non-relational-database | 4,663,353 | 3 | true | 1 | 0 | I don't think you're likely to find anything like that...surely not over blobstore. Because if all your data is stored in a single blob, you'd have to read the entire database into memory for any operation, and you said you can't do that.
Using the datastore as your backend is more plausible, but not much. The big issu... | 2 | 2 | 0 | I have a medium size (~100mb) read-only database that I want to put on google app engine. I could put it into the datastore, but the datastore is kind of slow, has no relational features, and has many other frustrating limitations (not going into them here). Another option is loading all the data into memory, but I q... | A Read-Only Relational Database on Google App Engine? | 1.2 | 1 | 0 | 803 |
4,663,071 | 2011-01-11T21:55:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,sqlite,relational-database,non-relational-database | 4,663,631 | 3 | false | 1 | 0 | django-nonrel does not magically provide an SQL database - so it's not really a solution to your problem.
Accessing a blobstore blob like a file is possible, but the SQLite module requires a native C extension, which is not enabled on App Engine. | 2 | 2 | 0 | I have a medium size (~100mb) read-only database that I want to put on google app engine. I could put it into the datastore, but the datastore is kind of slow, has no relational features, and has many other frustrating limitations (not going into them here). Another option is loading all the data into memory, but I q... | A Read-Only Relational Database on Google App Engine? | 0.132549 | 1 | 0 | 803 |
4,664,075 | 2011-01-12T00:03:00.000 | 9 | 0 | 1 | 0 | python,module,installation | 4,664,182 | 2 | true | 0 | 0 | You could simply place it in the same directory as your script and you will be able to import it.
If you want to "install" it, you can place it as C:\Python31\Lib\site-packages\ystockquote.py. You should then be able to import it with import ystockquote. | 1 | 3 | 0 | certainly you all know the answer and it's easy going, but I'm new to python :)
I found a piece of code in the internet reading the stock price from yahoo finance
#!/usr/bin/env python
#
# Copyright (c) 2007-2008, Corey Goldberg (corey@goldb.org)
#
# license: GNU LGPL
#
# This library is free software; you can redi... | Python: Install a module out of source code | 1.2 | 0 | 0 | 7,341 |
4,664,306 | 2011-01-12T00:39:00.000 | 8 | 0 | 1 | 0 | python,performance,string,path | 4,664,326 | 7 | false | 0 | 0 | I don't know who told you not to use it, but they're wrong.
Even if it were slow, it would never be slow to a program-breaking extent. I've never noticed it being remotely slow.
It's key to cross-platform programming. Line separators etc. differ by platform, and os.path.join will always join paths correctly regardless... | 2 | 3 | 0 | I've been told os.path.join is horribly slow in python and I should use string concatenation ('%s/%s' % (x, y)) instead. Is there really that big a difference and if so how can I track it? | Is Python's os.path.join slow? | 1 | 0 | 0 | 2,548 |
4,664,306 | 2011-01-12T00:39:00.000 | 1 | 0 | 1 | 0 | python,performance,string,path | 4,664,349 | 7 | false | 0 | 0 | It may be nearly 50 times faster, but unless you're doing it in a CPU bound tight inner loop, the speed difference isn't going to matter at all. The portability difference on the other hand will make the difference between whether or not your program can be easily ported to a non-Unix platform or not.
So, please use o... | 2 | 3 | 0 | I've been told os.path.join is horribly slow in python and I should use string concatenation ('%s/%s' % (x, y)) instead. Is there really that big a difference and if so how can I track it? | Is Python's os.path.join slow? | 0.028564 | 0 | 0 | 2,548 |
4,664,325 | 2011-01-12T00:42:00.000 | 1 | 1 | 0 | 0 | python,ruby-on-rails,ruby | 4,664,359 | 3 | false | 0 | 0 | You will incur the cost of starting python each time you run it from ruby. The cost would be the same in a python framework, unless you could use the python script as a library instead. | 2 | 1 | 0 | I have a Rails server which will need to run a python script at the background. I know that I can run it like I run terminal commands in ruby, but how is the performance like? is it better to use a python framework and not Rails? Is there better ways (optimization wise) to run python scripts on a Rails server? | How to run a python script on a Rails server? | 0.066568 | 0 | 0 | 3,452 |
4,664,325 | 2011-01-12T00:42:00.000 | 5 | 1 | 0 | 0 | python,ruby-on-rails,ruby | 4,664,387 | 3 | true | 0 | 0 | If you mean that it needs to run periodically, just set it up as a cron job, no special performance characteristics to worry about there.
If you mean that it needs to run when pages are requested from your Ruby website, then simply running the script each time won't perform well as it needs to fire up the Python interp... | 2 | 1 | 0 | I have a Rails server which will need to run a python script at the background. I know that I can run it like I run terminal commands in ruby, but how is the performance like? is it better to use a python framework and not Rails? Is there better ways (optimization wise) to run python scripts on a Rails server? | How to run a python script on a Rails server? | 1.2 | 0 | 0 | 3,452 |
4,664,438 | 2011-01-12T01:04:00.000 | 0 | 1 | 1 | 0 | python,cpython | 42,154,981 | 4 | false | 0 | 0 | Ran into a similar situation.
Later on found that the white space indentation technique used matters.
Especially on windows platforms, ensure that a uniform technique is adapted
throughout the module i.e., either use tab or spaces exclusively. | 1 | 4 | 0 | each unit test I'm running is writing python code out to a file, then importing it as a module. The problem is that the code changes but further import statements don't modify the module.
I think what I need is a way to ether force a reload on a module or clear the internal bytecode cache. Any ideas?
Thanks! | Is there anyway to clear python bytecode cache? | 0 | 0 | 0 | 12,520 |
4,664,646 | 2011-01-12T01:44:00.000 | 9 | 0 | 1 | 0 | python,django,version | 4,664,796 | 7 | true | 1 | 0 | Change your PATH system environment variable to point to the version of Python you want to use. | 1 | 13 | 0 | I have two python versions: Python 2.5 and Python 2.7. When I'm setting up django, I want to use Python 2.7, but django is using Python 2.5 somehow.
How can I make sure that django use Python 2.7? I'm using Windows XP | Change default Python interpreter on Windows XP | 1.2 | 0 | 0 | 39,814 |
4,666,046 | 2011-01-12T06:46:00.000 | 0 | 0 | 1 | 0 | python | 4,666,122 | 2 | false | 0 | 0 | You want to look at the os module and the os.path module. os allows you to create directories and files. os.path allows you to examine filenames and paths. | 1 | 0 | 0 | I'm trying to code a program in python which will create a folder for each file in a directory (local) with the same name, then move that file into the folder. I've been looking everywhere for the correct code, or bits, but I havn't been able to find (or recognise) it. Any help (or hints) would be very much appreciated... | How do I set the _path_ as a variable? | 0 | 0 | 0 | 79 |
4,666,274 | 2011-01-12T07:26:00.000 | 0 | 1 | 0 | 0 | c++,python,boost,build | 4,671,114 | 1 | false | 0 | 0 | If on Windows, do a 'Find' (or download and use Agent Ransack). If on linux, grep for it. If it is on your local computer, one of these will find it. | 1 | 0 | 0 | I used a python script to install boost (without bjam) but I cannot find it anymore. Does anybody know where it is located?
Thanks | python script for installing boost | 0 | 0 | 0 | 100 |
4,666,339 | 2011-01-12T07:39:00.000 | 1 | 1 | 1 | 0 | python,arrays,file,list,palindrome | 4,666,394 | 5 | false | 0 | 0 | You're including the newline at the end of each word in /usr/share/dict/words. That means you never find any palindromes. You'll speed things up if you just log the palindromes as you find them, instead of deleting non-palindromes from the list, too. | 1 | 2 | 0 | i recently wrote a method to cycle through /usr/share/dict/words and return a list of palindromes using my ispalindrome(x) method
here's some of the code...what's wrong with it? it just stalls for 10 minutes and then returns a list of all the words in the file
def reverse(a):
return a[::-1]
def ispalindrome(a):
... | python and palindromes | 0.039979 | 0 | 0 | 3,147 |
4,666,392 | 2011-01-12T07:49:00.000 | 11 | 1 | 0 | 0 | php,python,fabric | 4,670,514 | 6 | true | 0 | 0 | Hmm? Why does it matter? Fabric is just python scripting. So it's project language agnostic. You can use it put anything on a server you'd use scp for, as well as script anything via ssh you'd use bash or [insert other tool here] for. Fabric really isn't Python's capistrano. It's more akin to a combining of both cap an... | 2 | 8 | 0 | I am happily using fabric for my Python projects for deployment. Now I am engaged in a larger PHP project and wondering if there is something like fabric for PHP? | PHP alternative for Python's fabric | 1.2 | 0 | 0 | 7,479 |
4,666,392 | 2011-01-12T07:49:00.000 | 1 | 1 | 0 | 0 | php,python,fabric | 4,697,683 | 6 | false | 0 | 0 | If you're looking for a build tool (as opposed to deployment), you can use Phing (http://phing.info/), a PHP equivalent of Java's Ant.
Doesn't handle the tunnelling (running remote commands etc.) but does do a nice job of breaking up your deployment into tasks with chained dependancies, and being PHP can interact with ... | 2 | 8 | 0 | I am happily using fabric for my Python projects for deployment. Now I am engaged in a larger PHP project and wondering if there is something like fabric for PHP? | PHP alternative for Python's fabric | 0.033321 | 0 | 0 | 7,479 |
4,668,985 | 2011-01-12T12:50:00.000 | -1 | 0 | 1 | 0 | python,linux,fonts,tkinter,right-to-left | 4,669,402 | 2 | false | 1 | 1 | Use a toolkit that isn't terrible, such as PyQt, PyGTK, or wxPython. | 1 | 2 | 0 | I am working on a project that is based on Urdu language in Ubuntu platform. I'm using Python language and have almost achieved my task.
The problem is that, the Urdu text is rendered in reverse order.
For example, consider the word کام (which means work)
consisting of the three letters:
ک ,
ا , and
م
The output is re... | Reverse rendering of Urdu fonts | -0.099668 | 0 | 0 | 824 |
4,669,630 | 2011-01-12T14:02:00.000 | 2 | 0 | 1 | 0 | python,ironpython | 4,669,678 | 2 | false | 0 | 0 | Isn't it obvious that it's 2.6? | 1 | 1 | 0 | Which version of python does IronPython 2.6.2 support? | Which version of python does IronPython 2.6.2 support? | 0.197375 | 0 | 0 | 308 |
4,670,350 | 2011-01-12T15:13:00.000 | 0 | 0 | 1 | 0 | python,struct,biginteger | 4,670,445 | 9 | false | 0 | 0 | You could pickle the object to binary, use protocol buffers (I don't know if they allow you to serialize unlimited precision integers though) or BSON if you do not want to write code.
But writing a function that dumps 16 byte integers by shifting it should not be so hard to do if it's not time critical. | 1 | 8 | 0 | In Python, long integers have unlimited precision. I would like to write a 16 byte (128 bit) integer to a file. struct from the standard library supports only up to 8 byte integers. array has the same limitation. Is there a way to do this without masking and shifting each integer?
Some clarification here: I'm writing t... | How do I write a long integer as binary in Python? | 0 | 0 | 0 | 18,312 |
4,672,060 | 2011-01-12T17:46:00.000 | 13 | 0 | 0 | 0 | python,web-scraping,html-parsing,webpage | 4,672,098 | 10 | true | 1 | 0 | There's no way to do this that's guaranteed to work, but one strategy you might use is to try to find the element with the most visible text inside of it. | 2 | 59 | 0 | Given a news article webpage (from any major news source such as times or bloomberg), I want to identify the main article content on that page and throw out the other misc elements such as ads, menus, sidebars, user comments.
What's a generic way of doing this that will work on most major news sites?
What are some ... | Web scraping - how to identify main content on a webpage | 1.2 | 0 | 1 | 24,718 |
4,672,060 | 2011-01-12T17:46:00.000 | 6 | 0 | 0 | 0 | python,web-scraping,html-parsing,webpage | 4,672,151 | 10 | false | 1 | 0 | It might be more useful to extract the RSS feeds (<link type="application/rss+xml" href="..."/>) on that page and parse the data in the feed to get the main content. | 2 | 59 | 0 | Given a news article webpage (from any major news source such as times or bloomberg), I want to identify the main article content on that page and throw out the other misc elements such as ads, menus, sidebars, user comments.
What's a generic way of doing this that will work on most major news sites?
What are some ... | Web scraping - how to identify main content on a webpage | 1 | 0 | 1 | 24,718 |
4,672,697 | 2011-01-12T18:48:00.000 | 0 | 1 | 1 | 0 | python | 12,867,404 | 2 | false | 0 | 0 | There's a bunch of services on the web that will make it easier for you to send and receive e-mails using their API. This would relieve you from the pain of setting up, running and administrering your own e-mail service. | 1 | 1 | 0 | How do I setup a server so I can get emails and parse them in python? | How to setup parsing emails? | 0 | 0 | 1 | 194 |
4,672,945 | 2011-01-12T19:11:00.000 | 0 | 1 | 0 | 0 | python,unit-testing,pdf-generation,imagemagick,cairo | 4,676,387 | 5 | false | 0 | 0 | I would try this using xpresser - (https://wiki.ubuntu.com/Xpresser ) You can try to match images to similar images not exact copies - which is the problem in these cases.
I don't know if xpresser is being ctively developed, or if it can be used with stand alone image files (I think so) -- anyway it takes its ideas f... | 2 | 19 | 0 | I'm writing a CAD application that outputs PDF files using the Cairo graphics library. A lot of the unit testing does not require actually generating the PDF files, such as computing the expected bounding boxes of the objects. However, I want to make sure that the generated PDF files "look" correct after I change the c... | How to unit test a Python function that draws PDF graphics? | 0 | 0 | 0 | 5,316 |
4,672,945 | 2011-01-12T19:11:00.000 | 8 | 1 | 0 | 0 | python,unit-testing,pdf-generation,imagemagick,cairo | 4,673,001 | 5 | true | 0 | 0 | You could capture the PDF as a bitmap (or at least a losslessly-compressed) image, and then compare the image generated by each test with a reference image of what it's supposed to look like. Any differences would be flagged as an error for the test. | 2 | 19 | 0 | I'm writing a CAD application that outputs PDF files using the Cairo graphics library. A lot of the unit testing does not require actually generating the PDF files, such as computing the expected bounding boxes of the objects. However, I want to make sure that the generated PDF files "look" correct after I change the c... | How to unit test a Python function that draws PDF graphics? | 1.2 | 0 | 0 | 5,316 |
4,674,208 | 2011-01-12T21:22:00.000 | 1 | 0 | 1 | 0 | python,set | 4,674,607 | 4 | false | 0 | 0 | All depends of what you have as input and want as output.
If you have a list li at the beginning and want to get a modified list in the end, then the faster method is if not elt in li: li.append(elt) the problem is converting initial list to set, then converting back to list which is way too slow.
But if you can work w... | 1 | 10 | 0 | Sorry for the poorly worded title but I asked a question earlier about getting a unique list of items from two lists. People told me to make the list -> sets and then union.
So now I'm wondering if it's faster to:
While adding one item to a list, scan the whole list for duplicates.
Make that one item a set and then un... | Is it faster to union sets or check the whole list for a duplicate? | 0.049958 | 0 | 0 | 8,621 |
4,675,504 | 2011-01-13T00:14:00.000 | 0 | 1 | 0 | 0 | php,python | 4,677,419 | 4 | false | 0 | 0 | I cant comment on the difference in scalability of a website but i have had very positive experiences using frameworks such as django for small time websites. I really love the separation of code and templating (i know you can do this somehow with php too). | 4 | 1 | 0 | I appreciate there are perhaps better ways of making a PHP application scale than the above, however I'm wondering more on principle. From what I've heard, Python is faster than PHP and I'm trying to decide which language to learn next, as a PHP developer. | Would porting parts of a PHP application to Python help it scale? | 0 | 0 | 0 | 107 |
4,675,504 | 2011-01-13T00:14:00.000 | 3 | 1 | 0 | 0 | php,python | 4,675,567 | 4 | true | 0 | 0 | Python's a very good language to learn for a number of reasons, including its clear syntax, its excellent standard library, its multi-paradigm support, and the helpful community that surrounds it.
However, scalability has more to do with your system's overall architecture than with the programming language you choose.... | 4 | 1 | 0 | I appreciate there are perhaps better ways of making a PHP application scale than the above, however I'm wondering more on principle. From what I've heard, Python is faster than PHP and I'm trying to decide which language to learn next, as a PHP developer. | Would porting parts of a PHP application to Python help it scale? | 1.2 | 0 | 0 | 107 |
4,675,504 | 2011-01-13T00:14:00.000 | 2 | 1 | 0 | 0 | php,python | 4,675,551 | 4 | false | 0 | 0 | I don't think rewriting in Python will help you that much, it is very hard to say anyway without knowing your exact scalability problem. When it comes to real scaling issues, every problem is unique and there is no one true solution.
That being said, Python is an interesting language, and if you've time on your hands a... | 4 | 1 | 0 | I appreciate there are perhaps better ways of making a PHP application scale than the above, however I'm wondering more on principle. From what I've heard, Python is faster than PHP and I'm trying to decide which language to learn next, as a PHP developer. | Would porting parts of a PHP application to Python help it scale? | 0.099668 | 0 | 0 | 107 |
4,675,504 | 2011-01-13T00:14:00.000 | 0 | 1 | 0 | 0 | php,python | 4,675,549 | 4 | false | 0 | 0 | For web applications I would personally learn Python after PHP, but if your a Windows fan consider ASP.NET. | 4 | 1 | 0 | I appreciate there are perhaps better ways of making a PHP application scale than the above, however I'm wondering more on principle. From what I've heard, Python is faster than PHP and I'm trying to decide which language to learn next, as a PHP developer. | Would porting parts of a PHP application to Python help it scale? | 0 | 0 | 0 | 107 |
4,675,728 | 2011-01-13T00:51:00.000 | 0 | 1 | 0 | 1 | python,stdout | 68,410,134 | 13 | false | 0 | 0 | I know this question is answered (using python abc.py > output.log 2>&1 ), but I still have to say:
When writing your program, don't write to stdout. Always use logging to output whatever you want. That would give you a lot of freedom in the future when you want to redirect, filter, rotate the output files. | 1 | 395 | 0 | How do I redirect stdout to an arbitrary file in Python?
When a long-running Python script (e.g, web application) is started from within the ssh session and backgounded, and the ssh session is closed, the application will raise IOError and fail the moment it tries to write to stdout. I needed to find a way to make the ... | Redirect stdout to a file in Python? | 0 | 0 | 0 | 655,144 |
4,676,130 | 2011-01-13T02:08:00.000 | 1 | 0 | 1 | 0 | python,keyboard-shortcuts,python-idle | 24,644,532 | 3 | false | 0 | 0 | Also, you can scroll back up to any previous line and hit 'return', which will place that statement in the current working line. | 3 | 7 | 0 | Is there a keyboard short cut for accessing previous statements in python IDLE? I am using a Mac
Thanks | keyboard short cut for accessing previous statements in python IDLE using a Mac | 0.066568 | 0 | 0 | 20,946 |
4,676,130 | 2011-01-13T02:08:00.000 | 3 | 0 | 1 | 0 | python,keyboard-shortcuts,python-idle | 12,829,561 | 3 | false | 0 | 0 | Using IDLE on the MAC you would need Ctrl+P (not command) for Previous statement (instruction) and Ctrl+N for Next statement.
I was struggling with this same question as I am always using the Up arrow on most of the "shell" style programs. | 3 | 7 | 0 | Is there a keyboard short cut for accessing previous statements in python IDLE? I am using a Mac
Thanks | keyboard short cut for accessing previous statements in python IDLE using a Mac | 0.197375 | 0 | 0 | 20,946 |
4,676,130 | 2011-01-13T02:08:00.000 | 15 | 0 | 1 | 0 | python,keyboard-shortcuts,python-idle | 4,676,215 | 3 | false | 0 | 0 | On Windows this hotkey is alt-p.
However, assuming IDLE has options in Mac ;) you should be able to find out by going to Options->Configure IDLE. Then look in the Keys tab and under Custom Key Bindings, look for "history-previous".
That should tell you what you need to know. | 3 | 7 | 0 | Is there a keyboard short cut for accessing previous statements in python IDLE? I am using a Mac
Thanks | keyboard short cut for accessing previous statements in python IDLE using a Mac | 1 | 0 | 0 | 20,946 |
4,676,957 | 2011-01-13T05:03:00.000 | 2 | 0 | 1 | 0 | python,exception,error-handling,conditional | 4,677,074 | 4 | false | 0 | 0 | Try catch statements are designed to handle serious errors and particularly for connecting to outside service such as a web service, Database, web Request and etc. where errors will and are expected to happen from time-to-time. It’s heavier on runtime environment to handle an exception, than for you to write good code ... | 3 | 5 | 0 | When do you use each? I find that I'm using if's a lot more than exceptions. It seems like I'm catching the exceptions using my "ifs", before I even get them. There are ifs all over my code. | When should you check for errors using "if" , and when should you use exceptions? | 0.099668 | 0 | 0 | 204 |
4,676,957 | 2011-01-13T05:03:00.000 | 2 | 0 | 1 | 0 | python,exception,error-handling,conditional | 4,677,142 | 4 | false | 0 | 0 | I'm not repeating what many people have already said, but there's a big advantage of using exceptions which I'd like to mention:
If some routine fails, you can easily decide on which level of indirection you should handle that exception - and you won't need to bloat the deeper levels with error checking after, say, eac... | 3 | 5 | 0 | When do you use each? I find that I'm using if's a lot more than exceptions. It seems like I'm catching the exceptions using my "ifs", before I even get them. There are ifs all over my code. | When should you check for errors using "if" , and when should you use exceptions? | 0.099668 | 0 | 0 | 204 |
4,676,957 | 2011-01-13T05:03:00.000 | 1 | 0 | 1 | 0 | python,exception,error-handling,conditional | 4,677,081 | 4 | false | 0 | 0 | Especially as you work with large applications, exception handling really is a better practice. As you mentioned, you are getting a lot of if statements. With python, using try/except statements allows you to create a more standardized way of dealing with exceptions. With exceptions, you'll get the benefit of seeing ... | 3 | 5 | 0 | When do you use each? I find that I'm using if's a lot more than exceptions. It seems like I'm catching the exceptions using my "ifs", before I even get them. There are ifs all over my code. | When should you check for errors using "if" , and when should you use exceptions? | 0.049958 | 0 | 0 | 204 |
4,677,185 | 2011-01-13T05:47:00.000 | 6 | 0 | 1 | 0 | python,global-variables | 4,677,216 | 2 | true | 0 | 0 | Assuming SYNC_TOTAL_SIZE is not declared as local variable. It depends on what operations you are performing on global variables, for just reading the global variable there is no need to declare it as global, but if you are modifying the value of global variable you have to declare it with global. | 1 | 1 | 0 | I am having troubles using global variables in python...
In my program, i have declared 2 global variables,
global SYNC_DATA and
global SYNC_TOTAL_SIZE
Now in one of my functions, I am able to use the global variable SYNC_DATA without declaring it as global again in the function; however , I am not able to use the othe... | python global variable trouble | 1.2 | 0 | 0 | 776 |
4,680,693 | 2011-01-13T13:44:00.000 | 0 | 0 | 0 | 1 | python,security,apache,root,privileges | 4,710,807 | 2 | true | 1 | 0 | Hello
You can easily create web applications in Python using WSGI-compliant web frameworks such as CherryPy2 and templating engines such as Genshi. You can use the 'subprocess' module to manadge external commands... | 2 | 3 | 0 | I received a project recently and I am wondering how to do something in a correct and secure manner.
The situation is the following:
There are classes to manage linux users, mysql users and databases and apache virtual hosts. They're used to automate the addition of users in a small shared-hosting environnement. These ... | Modify system configuration files and use system commands through web interface | 1.2 | 0 | 0 | 474 |
4,680,693 | 2011-01-13T13:44:00.000 | 0 | 0 | 0 | 1 | python,security,apache,root,privileges | 4,684,335 | 2 | false | 1 | 0 | You can use sudo to give the apache user root permission for only the commands/scripts you need for your web app. | 2 | 3 | 0 | I received a project recently and I am wondering how to do something in a correct and secure manner.
The situation is the following:
There are classes to manage linux users, mysql users and databases and apache virtual hosts. They're used to automate the addition of users in a small shared-hosting environnement. These ... | Modify system configuration files and use system commands through web interface | 0 | 0 | 0 | 474 |
4,682,960 | 2011-01-13T17:11:00.000 | 1 | 0 | 0 | 0 | ado.net,ironpython,system.data.sqlite | 4,696,478 | 1 | false | 0 | 1 | My first guess is that you're trying to load the x86 (32-bit) System.Data.SQLite.dll in a x64 (64-bit) process, or vice versa. System.Data.SQLite.dll contains the native sqlite3 library, which must be compiled for x86 or x64, so there is a version of System.Data.SQLite.dll for each CPU.
If you're using the console, ipy... | 1 | 1 | 0 | I'm trying to use clr.AddReference to add sqlite3 functionality to a simple IronPython program I'm writing; but everytime I try to reference System.Data.SQLite I get this error:
Traceback (most recent call last):
File "", line 1, in
IOError: System.IO.IOException: Could not add reference to assembly System.Data... | Adding System.Data.SQLite reference in IronPython | 0.197375 | 1 | 0 | 1,695 |
4,683,639 | 2011-01-13T18:17:00.000 | 2 | 0 | 1 | 1 | python,ocaml | 4,684,135 | 6 | false | 0 | 0 | You can execute commands using Sys.command, so you can just do Sys.command "python foo.py", assuming python is in your path and foo.py is in the current directory. | 2 | 3 | 0 | I wanted to ask if you could call in a program written in Ocaml a program written in python , and if the answer is yes how do I do? | Call a program written in python in a program written in Ocaml | 0.066568 | 0 | 0 | 849 |
4,683,639 | 2011-01-13T18:17:00.000 | -1 | 0 | 1 | 1 | python,ocaml | 4,683,673 | 6 | false | 0 | 0 | It depends on your exact requirements, but you can use pythons os.system() to execute an program in the same way you would call it from the command line. That should be a good starting point. | 2 | 3 | 0 | I wanted to ask if you could call in a program written in Ocaml a program written in python , and if the answer is yes how do I do? | Call a program written in python in a program written in Ocaml | -0.033321 | 0 | 0 | 849 |
4,683,937 | 2011-01-13T18:47:00.000 | 0 | 1 | 1 | 0 | c++,python,matlab,setter,getter | 4,683,972 | 10 | false | 0 | 0 | In Matlab, each additional function call incurs some overhead. So if you don't need a setter/getter, because some language feature allows you to do exactly the same, then I really cannot see why you wouldn't want to use the language feature. | 7 | 6 | 0 | So I know there are a lot of questions on getters and setters in general, but I couldn't find something exactly like my question. I was wondering if people change the use of get/set depending on different languages. I started learning with C++ and was taught to use getters and setters. This is what I understand:
In ... | The use of getters and setters for different programming languages | 0 | 0 | 0 | 2,133 |
4,683,937 | 2011-01-13T18:47:00.000 | 2 | 1 | 1 | 0 | c++,python,matlab,setter,getter | 4,684,067 | 10 | false | 0 | 0 | Depends on how abstracted you need. For example, I recently needed a getter and setter in C++ when abstracting a Text object. The Direct3D text object just held a string Text member variable. The Direct2D Text object however had to be recreated and recached and that kind of thing. If I had opted for public variables wh... | 7 | 6 | 0 | So I know there are a lot of questions on getters and setters in general, but I couldn't find something exactly like my question. I was wondering if people change the use of get/set depending on different languages. I started learning with C++ and was taught to use getters and setters. This is what I understand:
In ... | The use of getters and setters for different programming languages | 0.039979 | 0 | 0 | 2,133 |
4,683,937 | 2011-01-13T18:47:00.000 | 2 | 1 | 1 | 0 | c++,python,matlab,setter,getter | 4,683,991 | 10 | false | 0 | 0 | I don't generally use getters/setters because the presence of them indicates that my class isn't doing enough to be alive.
When I do consider needing them I always create them, no matter whether or not the language supports mixing access wrt variables. Only time I'd consider not doing so is in languages like VB that s... | 7 | 6 | 0 | So I know there are a lot of questions on getters and setters in general, but I couldn't find something exactly like my question. I was wondering if people change the use of get/set depending on different languages. I started learning with C++ and was taught to use getters and setters. This is what I understand:
In ... | The use of getters and setters for different programming languages | 0.039979 | 0 | 0 | 2,133 |
4,683,937 | 2011-01-13T18:47:00.000 | 3 | 1 | 1 | 0 | c++,python,matlab,setter,getter | 4,684,469 | 10 | false | 0 | 0 | It's OK to have all public variables in any language. Yes, I know it's the opposite of what you learned.
OO theory says that there should be a public API that is stable, and private variables, where you can do whatever you want, and an implementation you can change to your hearts delight without changing the API.
And t... | 7 | 6 | 0 | So I know there are a lot of questions on getters and setters in general, but I couldn't find something exactly like my question. I was wondering if people change the use of get/set depending on different languages. I started learning with C++ and was taught to use getters and setters. This is what I understand:
In ... | The use of getters and setters for different programming languages | 0.059928 | 0 | 0 | 2,133 |
4,683,937 | 2011-01-13T18:47:00.000 | 0 | 1 | 1 | 0 | c++,python,matlab,setter,getter | 4,684,420 | 10 | false | 0 | 0 | Python and C++ have different principles. C++ and Java are quite “static” and have lots of compile time checks, so you should exploit them when using C++ and Java: public vs. private, const-correctness, etc. Plus they don't have properties, so if you find that you should do some parameter validation, you cannot easily ... | 7 | 6 | 0 | So I know there are a lot of questions on getters and setters in general, but I couldn't find something exactly like my question. I was wondering if people change the use of get/set depending on different languages. I started learning with C++ and was taught to use getters and setters. This is what I understand:
In ... | The use of getters and setters for different programming languages | 0 | 0 | 0 | 2,133 |
4,683,937 | 2011-01-13T18:47:00.000 | 0 | 1 | 1 | 0 | c++,python,matlab,setter,getter | 4,684,036 | 10 | false | 0 | 0 | Python, being a dynamic scripting language, is less about compile-time constraints, and more about flexibility.
Getters and setters ("property" is just getter + setter) allow for better encapsulation (checking validity, only getter, not setter; implementation details does not matter - e.g. time has hours, minutes, seco... | 7 | 6 | 0 | So I know there are a lot of questions on getters and setters in general, but I couldn't find something exactly like my question. I was wondering if people change the use of get/set depending on different languages. I started learning with C++ and was taught to use getters and setters. This is what I understand:
In ... | The use of getters and setters for different programming languages | 0 | 0 | 0 | 2,133 |
4,683,937 | 2011-01-13T18:47:00.000 | 0 | 1 | 1 | 0 | c++,python,matlab,setter,getter | 4,684,480 | 10 | false | 0 | 0 | You're right - no need for "simple" getters and setters in modern Matlab OOP; the access modifiers that you mentioned are the "Right Way".
In the new MCOS Matlab classes, the syntax for accessing a class property is the same whether you define custom getter/setters or not. Clients can always access property foo as "obj... | 7 | 6 | 0 | So I know there are a lot of questions on getters and setters in general, but I couldn't find something exactly like my question. I was wondering if people change the use of get/set depending on different languages. I started learning with C++ and was taught to use getters and setters. This is what I understand:
In ... | The use of getters and setters for different programming languages | 0 | 0 | 0 | 2,133 |
4,684,520 | 2011-01-13T19:48:00.000 | 9 | 0 | 1 | 0 | python | 4,684,545 | 4 | false | 0 | 0 | You can use abspath in the os.path module.
os.path.abspath(path)
Return a normalized absolutized
version of the pathname path. On most
platforms, this is equivalent to
normpath(join(os.getcwd(), path)). | 2 | 20 | 0 | Is there an easy way in Python to resolve path operators like ..? For instance is there a function call that will convert: /../../test/../path to /path? | Fixing '../../' paths in python | 1 | 0 | 0 | 14,202 |
4,684,520 | 2011-01-13T19:48:00.000 | 4 | 0 | 1 | 0 | python | 4,684,540 | 4 | false | 0 | 0 | you can use the function os.path.abspath from os.path | 2 | 20 | 0 | Is there an easy way in Python to resolve path operators like ..? For instance is there a function call that will convert: /../../test/../path to /path? | Fixing '../../' paths in python | 0.197375 | 0 | 0 | 14,202 |
4,685,634 | 2011-01-13T21:44:00.000 | 0 | 1 | 0 | 0 | python,sockets,smtp,smtplib | 4,685,735 | 1 | false | 0 | 0 | Depends entirely on where the bottleneck is. If it's on the SMTP server or the network, the answer is no. If it's in your python code, probably yes. | 1 | 0 | 0 | I'm writing a program which is sending files through SMTP, thanks to my (local) Postfix server, on port 25.
Is it possible to use several threads (thus several sockets) to inject emails faster ? | Several threads connecting to a Postfix server? | 0 | 0 | 0 | 305 |
4,686,104 | 2011-01-13T22:33:00.000 | 1 | 0 | 0 | 1 | python,networking,ssh,portforwarding | 4,686,141 | 2 | false | 0 | 0 | I'd use ssh to create a remote tunnel (-R) from the server to the local system. If you're insistent on doing this with Python then there's the subprocess module. | 1 | 1 | 0 | I'd like to do the following with Python:
Computer 1 starts SSH server (probably using twisted or paramiko)
Computer 1 connects to Server 1 (idle connection)
Computer 2 connects to Server 1
Server 1 forwards Computer 2's connection to Computer 1 (connection no longer idle)
Computer 1 forwards Server 1's connection to ... | Establish SSH Connection Between Two Isolated Machines Using a 3rd System | 0.099668 | 0 | 1 | 660 |
4,687,678 | 2011-01-14T03:21:00.000 | 3 | 0 | 1 | 0 | python,refactoring,diff | 4,688,559 | 5 | false | 0 | 0 | I've done this occasionally before using Emacs:
Clone an indirect buffer (M-x clone-indirect-buffer).
Mark the one section and narrow (C-x n n) to it.
Switch to the original buffer and narrow to the other section.
Run Ediff (M-x ediff-two-buffers) on the buffer and its clone.
A nice perk is that you can merge chunks ... | 1 | 3 | 0 | I'm trying to refactor a python module in which the main problem is duplicate code.
Is there any tool that I can use to view diff of two selected sections, so that I can see the difference between those almost-the-same codes? | What tools can I use to view diff of two sections of the same file? | 0.119427 | 0 | 0 | 200 |
4,688,715 | 2011-01-14T07:06:00.000 | 3 | 0 | 1 | 0 | python,numpy,signal-processing,correlation | 4,688,995 | 6 | false | 0 | 0 | It depends on the kind of signal you have (periodic?…), on whether both signals have the same amplitude, and on what precision you are looking for.
The correlation function mentioned by highBandWidth might indeed work for you. It is simple enough that you should give it a try.
Another, more precise option is the one I... | 1 | 26 | 0 | I have to compare two time-vs-voltage waveforms. Because of the peculiarity of the sources of these waveforms, one of them can be a time shifted version of the other.
How can i find whether there is a time shift? and if yes, how much is it.
I am doing this in Python and wish to use numpy/scipy libraries. | find time shift between two similar waveforms | 0.099668 | 0 | 0 | 32,033 |
4,689,252 | 2011-01-14T08:37:00.000 | 20 | 0 | 1 | 0 | python | 4,689,273 | 2 | false | 0 | 0 | Importing only ever loads a module once. Any imports after that simply add it to the current namespace.
Just import things in the files you need them to be available and let Python do the heavy-lifting of figuring out loading the modules. | 2 | 11 | 0 | I am working on a project wherein I need to use a third party module in different project files(.py files). The situation is like this.
I have a file "abc.py" which imports third party module "common.py". There are couple of other files which also import "common.py". All these files are also imported in main project fi... | python multiple imports for a common module | 1 | 0 | 0 | 6,958 |
4,689,252 | 2011-01-14T08:37:00.000 | 3 | 0 | 1 | 0 | python | 8,536,720 | 2 | false | 0 | 0 | Yes, you are right, this behavior really exists in Python. Namely, if user code tries to import the same module in different ways, for example - import a and import A.a (where a.py file is located into A package and the first import is done from within the A package while the other import comes as from outside).
This c... | 2 | 11 | 0 | I am working on a project wherein I need to use a third party module in different project files(.py files). The situation is like this.
I have a file "abc.py" which imports third party module "common.py". There are couple of other files which also import "common.py". All these files are also imported in main project fi... | python multiple imports for a common module | 0.291313 | 0 | 0 | 6,958 |
4,689,456 | 2011-01-14T09:04:00.000 | 7 | 1 | 1 | 0 | python,cryptography | 4,689,577 | 4 | false | 0 | 0 | This is impossible. That's the entire point of secure hash algorithms that are used, among other things, to hash passwords. | 1 | 0 | 0 | Suppose I hashed a password and obtained a hashcode for it. I need to find the degree of similarity between the password and its hashcode. Please suggest me some different mechanism for this | Anybody know a valid mechanism to detect the degree of similarity between a string and its hashcode? | 1 | 0 | 0 | 131 |
4,689,837 | 2011-01-14T09:56:00.000 | 0 | 0 | 1 | 0 | python,collections | 4,689,940 | 2 | false | 0 | 0 | I would do it with a class Car and a dict(model:Car) store different cars. | 1 | 2 | 0 | I'm learning python, and I'm a bit confused about which the purpose of the different data structures like list, tuples, dictionaries, sets.
For example, let's say cars are defined by Brand,Model,Horsepower
I wish to have a collection of cars on which I could
sort by Horsepower, or brand
compare by model (to erase dupl... | Python collections of non-base type? | 0 | 0 | 0 | 155 |
4,690,585 | 2011-01-14T11:32:00.000 | 4 | 0 | 0 | 0 | python,matplotlib,reportlab | 4,880,177 | 4 | false | 0 | 0 | There is not one, but what I do in my own use of MatPlotLib with ReportLab is to generate PNGs and then embed the PNGs so that I don't need to also use PIL. However, if you do use PIL, I believe you should be able to generate and embed EPS using MatPlotLib and ReportLab. | 1 | 16 | 1 | I want to embed matplotlib charts into PDFs generated by ReportLab directly - i.e. not saving as a PNG first and then embedding the PNG into the PDF (i think I'll get better quality output).
Does anyone know if there's a matplotlib flowable for ReportLab?
Thanks | Is there a matplotlib flowable for ReportLab? | 0.197375 | 0 | 0 | 10,096 |
4,690,851 | 2011-01-14T12:05:00.000 | 1 | 0 | 0 | 1 | python,linux,memory-leaks,coredump | 46,514,677 | 2 | false | 0 | 0 | Try running linux perf tool on the python process with callgraph enabled.
if its multi threaded process give all associated LWPs as arguments. | 1 | 16 | 0 | I have a core dump under Linux. The process went on memory allocation rampage and I need to find at least which library this happens in.
What tool do you suggest to get broad overview of where the memory is going? I know the problem is hard/unsolvable fully. Any tool that could at least give some clues would help.
[it... | How to analyze memory usage from a core dump? | 0.099668 | 0 | 0 | 11,789 |
4,690,890 | 2011-01-14T12:10:00.000 | 0 | 0 | 0 | 0 | python,multithreading,network-programming,urllib2,mechanize | 4,691,668 | 2 | false | 0 | 0 | You could possibly be creating more threads than you expect - monitor the result of threading.active_count() to test this.
If possible try to rule out the VPN at your end (or post the relevant guts of the code so we can test it).
(Nettiquete) If you're not doing so already, only use network.http.max-connections-per-ser... | 1 | 2 | 0 | I'm writing a python script checking/monitoring several server/websites status(response time and similar stuff), it's a GUI program and I use separate thread to check different server/website, and the basic structure of each thread is using an infinite while loop to request that site every random time period(15 to 30 s... | My python program always brings down my internet connection after several hours running, how do I debug and fix this problem? | 0 | 0 | 1 | 643 |
4,693,352 | 2011-01-14T16:30:00.000 | 8 | 0 | 1 | 0 | python,python-3.x | 4,704,594 | 2 | false | 0 | 0 | The answer to all your questions are "Yes". :)
Do many of the major modules and libraries support Python 3 yet?
Yes.
Is it gaining acceptance
Yes.
or are people mostly sticking with 2.x?
Yes.
Your question is a bit fuzzy, namely. If you are wondering if you should use Python 2 or Python 3, then the answer is "Use... | 1 | 11 | 0 | I know that when it launched, a lot of people didn't think it would be picked up very easily. I was wondering if thats changed at all. Do many of the major modules and libraries support Python 3 yet? Is it gaining acceptance or are people mostly sticking with 2.x? | has Python 3 been widely adopted yet? | 1 | 0 | 0 | 1,601 |
4,693,740 | 2011-01-14T17:03:00.000 | 1 | 0 | 0 | 0 | python,sockets | 4,693,820 | 1 | false | 0 | 0 | If you just want to redirect the user to your file server, then it sort of depends on what operating system they're using. If everybody's going to be on Windows, then you should be able to include a link to "//Your-Fileserver-Name/Path1/Path2". Obviously you have to share the appropriate files on your server using Wi... | 1 | 0 | 0 | I am designing a website for a local server on our lan, so that anyone who tires to access that IP from a browser sees a web page and when he clicks on some link on that web page then a directory or some folder from that server should open.
I am using python for this purpose and the server is just like another PC with ... | How to open a directory/folder on a machine on LAN using python? | 0.197375 | 0 | 1 | 261 |
4,694,706 | 2011-01-14T18:45:00.000 | 3 | 0 | 0 | 1 | python,pygtk,twisted,amqp,deferred | 4,695,170 | 1 | true | 0 | 0 | On the server side, how do I defer the response inside one of the servers pb methods?
Easy. Return the Deferred from the remote_ method. Done. | 1 | 2 | 0 | Background:
I have a gtk client that uses twisted and perspective broker to perform remote object execution and server/client communication. This works great for me and was a breeze to start working with.
I have amqp (Message Queue/MQ) services that I also need to communicate from the client.
I have a security model i... | Python Twisted - Prospective Broker and Server-Side Deffereds | 1.2 | 0 | 0 | 323 |
4,695,337 | 2011-01-14T19:58:00.000 | 7 | 0 | 0 | 0 | python,scipy,sparse-matrix | 4,695,834 | 3 | true | 0 | 0 | I don't think that there is any way to really escape from doing the copying. Both of those types of sparse matrices store their data as Numpy arrays (in the data and indices attributes for csr and in the data and rows attributes for lil) internally and Numpy arrays can't be extended.
Update with more information:
LIL d... | 1 | 31 | 1 | Suppose I have a NxN matrix M (lil_matrix or csr_matrix) from scipy.sparse, and I want to make it (N+1)xN where M_modified[i,j] = M[i,j] for 0 <= i < N (and all j) and M[N,j] = 0 for all j. Basically, I want to add a row of zeros to the bottom of M and preserve the remainder of the matrix. Is there a way to do this wit... | expanding (adding a row or column) a scipy.sparse matrix | 1.2 | 0 | 0 | 27,075 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.