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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8,763,101 | 2012-01-06T19:10:00.000 | 0 | 0 | 1 | 0 | python,date,time,gmt | 8,763,245 | 3 | true | 0 | 0 | If you create a datetime instance and don't provide a time zone (a tzinfo object), the resulting datetime instance is "timezone-agnostic". It does not care about time zones.
So, if all your dates are in the same time zone, just non't specify the time zone, and you'll be fine.
Use datetime.utcnow() to get current time i... | 3 | 1 | 0 | I want to convert a datestring to date in UTC . In addition need to compare this date with current time in UTC and get the difference in milliseconds in python.
I looked at python
timedelta
tzinfo
time
date
datetime
But all of them seem to be confusing , what the best way to solve my problem w... | datetime , time python | 1.2 | 0 | 0 | 520 |
8,764,244 | 2012-01-06T20:44:00.000 | 1 | 0 | 0 | 1 | python,linux,shell,default-programs | 8,764,283 | 6 | false | 0 | 0 | Per-user environment variables tells you that.
$EDITOR gives you the command to be launched as text editor;
$BROWSER gives you the browser
$PAGER gives you the pager (ex. more or less).
This however is valid for command line softwares, while usually desktop environments use their own (internal) variables.
Also in pyt... | 3 | 8 | 0 | In linux, how can I determine the default text editor, terminal, etc?
does it vary by distro? | How to programmatically determine default applications in linux | 0.033321 | 0 | 0 | 2,033 |
8,764,244 | 2012-01-06T20:44:00.000 | 3 | 0 | 0 | 1 | python,linux,shell,default-programs | 8,764,364 | 6 | false | 0 | 0 | I accessed the list while ago programatically in a rather ugly manner and I'm sure its not the best way. The options are stored in a file called defaults.list (I think this is generally the case). The location is less general I think it in /usr/share/applications/ on my ubuntu system although it does appear elsewhere ... | 3 | 8 | 0 | In linux, how can I determine the default text editor, terminal, etc?
does it vary by distro? | How to programmatically determine default applications in linux | 0.099668 | 0 | 0 | 2,033 |
8,764,244 | 2012-01-06T20:44:00.000 | 2 | 0 | 0 | 1 | python,linux,shell,default-programs | 8,764,453 | 6 | false | 0 | 0 | The resolution order is $EDITOR -> editor -> some predefined list of console editors. On Debian/Ubuntu, sensible-editor (and sensible-browser and sensible-pager) will do the lookup for you, including looking at the right environment variables. Similar variables are $PAGER, $SHELL, $BROWSER. To look up a file associatio... | 3 | 8 | 0 | In linux, how can I determine the default text editor, terminal, etc?
does it vary by distro? | How to programmatically determine default applications in linux | 0.066568 | 0 | 0 | 2,033 |
8,764,562 | 2012-01-06T21:08:00.000 | 4 | 1 | 0 | 1 | python,linux,centos | 8,764,672 | 1 | true | 0 | 0 | This is because /usr/local/bin comes before /bin in your $PATH.
What does which python say? I suspect it gives a symlink /usr/local/bin/python to /usr/local/bin/python2.7. Changing that symlink to /bin/python or removing it altogether should fix your problem. | 1 | 2 | 0 | I installed python2.7 as an alternate version of python. I was attempting to utilize a newer version of mod_python and I needed 2.7. The default python (/bin/python) is 2.6. Unfortunately now, calling python from the command line calls /usr/local/bin/python2.7. I realize that I can set up a number of links pointing bac... | Installed a python2.7 as an alternate, but path to default 2.6 is destroyed. System path file for default interpreter? | 1.2 | 0 | 0 | 5,778 |
8,766,312 | 2012-01-07T00:39:00.000 | 1 | 1 | 0 | 1 | python | 8,766,362 | 2 | true | 0 | 0 | As far as I know, it's not possible. | 2 | 1 | 0 | If I run a python script via python foo.py then I can get the contents of the script by reading the file sys.argv[0]. Is it possible to get the contents of the script (e.g., as a string) if the script is passed to the python interpreter via python -c "$(cat foo.py)"? | Get the text of a python script that is passed via the `-c` option | 1.2 | 0 | 0 | 48 |
8,766,312 | 2012-01-07T00:39:00.000 | 0 | 1 | 0 | 1 | python | 8,766,445 | 2 | false | 0 | 0 | No. As far as I know, It wont be possible. When you call "$(cat foo.py)", shell will get only the contents and the reference is lost. | 2 | 1 | 0 | If I run a python script via python foo.py then I can get the contents of the script by reading the file sys.argv[0]. Is it possible to get the contents of the script (e.g., as a string) if the script is passed to the python interpreter via python -c "$(cat foo.py)"? | Get the text of a python script that is passed via the `-c` option | 0 | 0 | 0 | 48 |
8,766,613 | 2012-01-07T01:37:00.000 | 0 | 0 | 1 | 0 | python | 8,766,799 | 4 | false | 0 | 0 | The built-in sum(iterable) is the immediate answer- if you need a generalization, try reduce(func, iterable) (Python 2.x) or functools.reduce(func, iterable) (Python 3). Eg, to get the product of a list of numbers, reduce(operator.mul, [1,2,3,4]) which returns 24. | 2 | 1 | 0 | I’m sure all experienced Python programmers know a simple, elegant way to do this. Unfortunately, at my beginner’s level, I do not.
Anyway, I’m currently attempting to modify some AI scripts for a game program written by others. I’m looking for a way to extract the numeric elements from an existing object and then add ... | Python Object Element Extraction and Addition | 0 | 0 | 0 | 105 |
8,766,613 | 2012-01-07T01:37:00.000 | 5 | 0 | 1 | 0 | python | 8,766,623 | 4 | true | 0 | 0 | You can use sum(iterable) to add up all the items in a tuple or list.
sum([1,2,3]) returns 6, for example. | 2 | 1 | 0 | I’m sure all experienced Python programmers know a simple, elegant way to do this. Unfortunately, at my beginner’s level, I do not.
Anyway, I’m currently attempting to modify some AI scripts for a game program written by others. I’m looking for a way to extract the numeric elements from an existing object and then add ... | Python Object Element Extraction and Addition | 1.2 | 0 | 0 | 105 |
8,768,439 | 2012-01-07T08:44:00.000 | 7 | 0 | 0 | 0 | python,web-scraping,scrapy | 33,116,540 | 6 | false | 1 | 0 | Delays Can we set in 2 says:-
We can specify the delay while running the crawler.
Eg. scrapy crawl sample --set DOWNLOAD_DELAY=3 ( which means 3 seconds delay between two requests)
Or else we can specify Globaly in the settings.py
DOWNLOAD_DELAY = 3
by default scrapy takes 0.25 seconds delay between 2 requests. | 1 | 51 | 0 | I don't want to crawl simultaneously and get blocked. I would like to send one request per second. | How to give delay between each requests in scrapy? | 1 | 0 | 1 | 47,919 |
8,769,455 | 2012-01-07T11:50:00.000 | 2 | 0 | 0 | 0 | python,django | 8,769,513 | 1 | true | 1 | 0 | Not sure if you can do it directly in the template though you can try iterating over user.groups.all() | 1 | 1 | 0 | How to display user group of logged in user in django admin change_form.html ? I want to display the group name of the logged in user in the change_form of a model. Eg I am able to display the user name by using {{ user }} tag. How to display {{ user.groups__name }} | Display user group of logged in user in django admin change_form.html? | 1.2 | 0 | 0 | 1,211 |
8,770,914 | 2012-01-07T15:53:00.000 | 0 | 1 | 0 | 1 | python,open-source,monitoring | 8,777,056 | 1 | true | 0 | 0 | All tools that allow you to run scripts to gather metrics can basically run commands over a ssh connection on the target box.
The question is though if this makes a lot of sense as you rely on the network connection always being available and for each (set of) property(s) you need to run a new remote connection with a... | 1 | 0 | 0 | I am looking for an open source monitoring solution (preferably in Python) that works with ssh or snmp and does not require the installation of an agent (like Nagios, ZenOSS, munin).
Are you aware of such a solution? | open source monitoring solution without the need of an agent | 1.2 | 0 | 0 | 482 |
8,772,087 | 2012-01-07T18:46:00.000 | 0 | 0 | 1 | 0 | python,pickle | 8,772,278 | 3 | true | 0 | 0 | You can store it for as long as you want. It's just a file. However, if your data structures start becoming complicated, it can become tedious and time consuming to unpickle, update and pickle the data again. Also, it's just file access so you have to handle concurrency issues by yourself. | 3 | 0 | 0 | I'm storing a list of dictionaries in cPickle, but need to be able to add and remove to/from it occasionally. If I store the dictionary data in cPickle, is there some sort of limit on when I will be able to load it again? | how long can i store data in cPickle? | 1.2 | 0 | 0 | 164 |
8,772,087 | 2012-01-07T18:46:00.000 | 0 | 0 | 1 | 0 | python,pickle | 8,772,238 | 3 | false | 0 | 0 | cPickle is just a faster implementation of pickle. You can use it to convert a python object to its string equivalent and retrieve it back by unpickling.
You can do one of the two things with a pickled object:
Do not write to a file
In this case, the scope of your pickled data is similar to that of
any other variable... | 3 | 0 | 0 | I'm storing a list of dictionaries in cPickle, but need to be able to add and remove to/from it occasionally. If I store the dictionary data in cPickle, is there some sort of limit on when I will be able to load it again? | how long can i store data in cPickle? | 0 | 0 | 0 | 164 |
8,772,087 | 2012-01-07T18:46:00.000 | 0 | 0 | 1 | 0 | python,pickle | 8,772,177 | 3 | false | 0 | 0 | No. cPickle just writes data to files and reads it back; why would you think there would be a limit? | 3 | 0 | 0 | I'm storing a list of dictionaries in cPickle, but need to be able to add and remove to/from it occasionally. If I store the dictionary data in cPickle, is there some sort of limit on when I will be able to load it again? | how long can i store data in cPickle? | 0 | 0 | 0 | 164 |
8,772,368 | 2012-01-07T19:24:00.000 | 2 | 0 | 0 | 0 | python,django,project | 8,772,447 | 2 | true | 1 | 0 | If you want to use payment processing you should probably make a store of some sort .
I for one have a kikstarter/rockethub clone project queued in my want-to-do projects list .
But you should try thinking at something that you would use and isn't out there at the moment , something that would solve some needs of yours... | 2 | 8 | 0 | I am presently embarking to learn Python and Django together and I have gained a fair bit of theoretical knowledge to help me out.
However, I'm after a good project that I can dig into which will offer me experience in Python, Django, MySQL, HTML5, CSS3, and various initiatives such as OpenID and maybe even payment pro... | Learning Django - Good starter project | 1.2 | 0 | 0 | 1,466 |
8,772,368 | 2012-01-07T19:24:00.000 | 1 | 0 | 0 | 0 | python,django,project | 9,969,956 | 2 | false | 1 | 0 | Some suggestions:
A personal blog.
A social network, think about something... a Social network for Cat Lovers ? for Hunters ?
Do free stuff for you'r friends/family or even advertise yourself.
Improve an already existing website. You don't like Google ? Build a better Search Engine ! | 2 | 8 | 0 | I am presently embarking to learn Python and Django together and I have gained a fair bit of theoretical knowledge to help me out.
However, I'm after a good project that I can dig into which will offer me experience in Python, Django, MySQL, HTML5, CSS3, and various initiatives such as OpenID and maybe even payment pro... | Learning Django - Good starter project | 0.099668 | 0 | 0 | 1,466 |
8,772,935 | 2012-01-07T20:37:00.000 | 1 | 0 | 0 | 0 | python,curl,screen-scraping | 8,773,176 | 4 | false | 1 | 0 | You could observe what requests are made when you click the button (using Firebug in Firefox or Developer Tools in Chrome). You may then be able to request the PDF directly.
It's difficult to help without seeing the page in question. | 2 | 0 | 0 | I need to create a script that will log into an authenticated page and download a pdf.
However, the pdf that I need to download is not at a URL, but it is generated upon clicking on a specific input button on the page. When I check the HTML source, it only gives me the url of the button graphic and some obscure name o... | Advanced screen-scraping using curl | 0.049958 | 0 | 1 | 686 |
8,772,935 | 2012-01-07T20:37:00.000 | 2 | 0 | 0 | 0 | python,curl,screen-scraping | 8,773,567 | 4 | true | 1 | 0 | Try mechanize or twill. HttpFox or firebug can help you to build your queries. Remember you can also pickle cookies from browser and use it later with py libs. If the code is generated by javascript it could be possible to 'reverse engineer' it. If nof you can run some javascript interpret or use selenium or windmill t... | 2 | 0 | 0 | I need to create a script that will log into an authenticated page and download a pdf.
However, the pdf that I need to download is not at a URL, but it is generated upon clicking on a specific input button on the page. When I check the HTML source, it only gives me the url of the button graphic and some obscure name o... | Advanced screen-scraping using curl | 1.2 | 0 | 1 | 686 |
8,773,029 | 2012-01-07T20:52:00.000 | 0 | 0 | 0 | 0 | python,ajax,web,web-frameworks | 20,160,269 | 5 | false | 1 | 0 | I found interesting web2py framework, easy to install, and it has o lot of features as "from the box" | 1 | 2 | 0 | I'm looking for a python web framework that is easy to use and allows me to generate some nice looking user interfaces on the fly. I have not much experience with web development and don't want to spent much time to learn internals.
So far I use cherrypy and mako templating to serve the app. My problem is, it just look... | How to make a pretty Python web app? | 0 | 0 | 0 | 7,102 |
8,774,388 | 2012-01-08T00:36:00.000 | 2 | 0 | 0 | 0 | python,pygtk,x11 | 8,778,003 | 1 | true | 0 | 1 | You MUST rely on a desktop environment, otherwise it is not possible, since X11 isn't supposed to handle such things as wallpapers. When you set a background image, an external program loads the image and sets it as the background pixmap of the root window. Therefore, unless the specific loading mechanism stores the im... | 1 | 0 | 0 | I would like to determine a user's wallpaper path with PyGTK.
If possible, I would like to not rely on a Desktop Environment's function to do this - this is because some users(like myself) do not use a DE. Because of this, I am wondering if you can use X11 or something else to determine the current wallpaper being used... | Determining path to current wallpaper with pygtk (maybe X11?) | 1.2 | 0 | 0 | 382 |
8,775,786 | 2012-01-08T06:12:00.000 | 2 | 0 | 0 | 0 | python,numpy,scientific-computing | 8,775,931 | 3 | false | 0 | 0 | I would recommend looking at the pickle module. The pickle module allows you to serialize python objects as streams of bytes (e.g., strings). This allows you to write them to a file or send them over a network, and then reinstantiate the objects later. | 1 | 6 | 1 | I've currently got a project running on PiCloud that involves multiple iterations of an ODE Solver. Each iteration produces a NumPy array of about 30 rows and 1500 columns, with each iterations being appended to the bottom of the array of the previous results.
Normally, I'd just let these fairly big arrays be returned ... | Efficient ways to write a large NumPy array to a file | 0.132549 | 0 | 0 | 8,395 |
8,779,159 | 2012-01-08T16:29:00.000 | 1 | 0 | 0 | 0 | php,python,facebook,api,facebook-graph-api | 8,781,271 | 1 | true | 1 | 0 | 1) Nope.
2) Yes, you can use the Graph API and HTTP Get me/feed?until={date} | 1 | 4 | 0 | So I was flicking through my Facebook Timeline, and started to look at some old posts I made in 2009~2010. And they're a bit stupid and I'd like to remove them or change the privacy settings on them.
There are too many to do it individually, so I've been looking at the Graph API. However, I have been unable to find an... | Changing privacy of old Facebook posts using the Graph API | 1.2 | 0 | 1 | 740 |
8,782,924 | 2012-01-09T01:08:00.000 | 6 | 0 | 1 | 0 | python,string | 8,782,937 | 1 | true | 0 | 0 | Canonicalise the strings before matching. replace all v's with u's and all j's with i's. In the dictionary, store a mapping from each canonical form to all the matching non-canonical forms. | 1 | 0 | 0 | As you may know, in Latin alphabet there was no difference between u/v and i/j. That's a very late tradition to separate this letters, and many Latin texts don't have such a separation.
Following this tradition, I decided to make available for users of my little dictionary to find words disregarding u/v and i/j letters... | Interchangeable letters | 1.2 | 0 | 0 | 156 |
8,783,155 | 2012-01-09T01:54:00.000 | 1 | 0 | 1 | 0 | python,service | 8,783,207 | 1 | true | 0 | 0 | Use an int like you mentioned. ints have arbitrary precision, you don't need to worry about wrap around or any of those effects. | 1 | 1 | 0 | I currently have a game loop that fires off about 20 times per second that updates the game state based on inputs and then package up the result to send off to clients.
My "tick" is currently a counter that I += 1 to every game loop and slap on the packets before I send them off. I am worried that this will not be a f... | What method should I use in a python game server, to keep tick times? | 1.2 | 0 | 0 | 205 |
8,783,236 | 2012-01-09T02:12:00.000 | 1 | 0 | 0 | 0 | python,wxpython,wxwidgets | 8,783,458 | 2 | true | 0 | 1 | wx.EVT_LIST_ITEM_DESELECTED will only fire when the user changes the selected object in the list box. This serves the same purpose as losing focus on the text box. Call the update routines from that event as well. To skip the subsequent wx.EVT_KILL_FOCUS from the text box set a "isDirty" attribute in the parent obje... | 1 | 0 | 0 | My GUI consists of a wx.ListCtrl on the left, with a list of objects to edit, and a set of wx.TextCtrls on the right, for editing the selected object.
My strategy for implementing this was:
On a textbox's wx.EVT_KILL_FOCUS , update the relevant attribute of the currently selected object
On the list's wx.EVT_LIST_ITEM_... | The order of wxPython events is causing me problems | 1.2 | 0 | 0 | 256 |
8,783,578 | 2012-01-09T03:20:00.000 | 4 | 0 | 0 | 0 | python,c,sockets,network-programming | 8,783,612 | 3 | false | 0 | 0 | In most cases, you don't know how much data is "all of the data". For example, if you're receiving data in a line-oriented protocol, a line might be 10 bytes long or 65 bytes long. | 2 | 8 | 0 | Why doesn't the recv system call just block until all the data is received? Every time I have seen a recv call, it's in a while loop which just keeps on calling recv until all the data is there. Why not just have recv block in the first place? | Why doesn't recv block until it receives all of the data? | 0.26052 | 0 | 0 | 3,003 |
8,783,578 | 2012-01-09T03:20:00.000 | 9 | 0 | 0 | 0 | python,c,sockets,network-programming | 8,783,608 | 3 | false | 0 | 0 | You can request that recv block until all data is received, with the MSG_WAITALL flag. However, if a signal arrives, a system call that has performed some work (ie, receiving part of the data) cannot be automatically restarted to receive the rest. As such, even with MSG_WAITALL, there are cases where the recv call may ... | 2 | 8 | 0 | Why doesn't the recv system call just block until all the data is received? Every time I have seen a recv call, it's in a while loop which just keeps on calling recv until all the data is there. Why not just have recv block in the first place? | Why doesn't recv block until it receives all of the data? | 1 | 0 | 0 | 3,003 |
8,784,336 | 2012-01-09T05:36:00.000 | 1 | 1 | 0 | 0 | python,networking,zeromq | 8,784,472 | 2 | false | 0 | 0 | ZeroMQ, as it's name suggests most probably is a messaging provider. A messaging API is needed to send and recieve messages using these message providers. And you need to integrate these providers with your application server (view documentation). Some MQ supports multiple platforms like Ruby, Java, Php and Others. It ... | 1 | 2 | 0 | I've heard a lot about ZeroMQ and its advantages, but I'm not really sure what it is. What are some example uses, what is it trying to replace (if anything), what problem does it solve, what are the alternatives out there, etc.? And, what is a "messaging library"? | What is ZeroMQ? | 0.099668 | 0 | 0 | 2,626 |
8,785,217 | 2012-01-09T07:38:00.000 | 1 | 0 | 0 | 1 | python,linux,macos,unix | 8,785,305 | 4 | false | 0 | 0 | What about reading /etc/mtab and /etc/fstab?
I don't know OSX, but that's the standard Unix way to know what is mounted where. mtab should list all mounted filesystems, fstab should list all predefined mountpoints (which may or may not actually be mounted). | 1 | 3 | 0 | I want to be able to take a device name (eg: /dev/disk2) and determine where (if anywhere) it's mounted (eg: /mnt/cdrom or /Volumes/RANDLABEL) in Python.
One way I can do this is to run df or mount and then parse the output, but this seems pretty cheesy and unreliable. For example, mount uses " on " as the delimiter be... | Reliable and "as portable as possible" way to map from device name to mountpoint in Python | 0.049958 | 0 | 0 | 1,462 |
8,786,084 | 2012-01-09T09:16:00.000 | 1 | 0 | 1 | 0 | python,random,portability | 19,476,177 | 5 | false | 0 | 0 | Just as a heads up: in addition to the 2.3 change, python 3 gives numbers from python 2.x from randrange and probably other functions, even if the numbers from random.random are similar. | 1 | 19 | 0 | I need to generate a controlled sequence of pseudo-random numbers, given an initial parameter. For that I'm using the standard python random generator, seeded by this parameter. I'd like to make sure that I will generate the same sequence across systems (Operating system, but also Python version).
In summary: Does pyth... | Reproducibility of python pseudo-random numbers across systems and versions? | 0.039979 | 0 | 0 | 3,819 |
8,786,842 | 2012-01-09T10:16:00.000 | 6 | 0 | 0 | 0 | java,python,physics,simulation | 8,787,013 | 6 | false | 1 | 0 | In this day and age, you might look to the HTML 5 canvas & JS. | 1 | 9 | 0 | Is there an alternative to making educational Java applets for physics simulations like projectile motion, gravity, etc? | Python alternative to Java applet? | 1 | 0 | 0 | 11,614 |
8,788,041 | 2012-01-09T11:55:00.000 | 0 | 0 | 0 | 0 | excel,python-3.x,xls | 8,797,959 | 1 | false | 0 | 0 | I believe the maintainer of xlrd is working on porting it, but it's not yet ready. | 1 | 1 | 0 | Are there any python3 modules for importing(reading) excel .xls files or is there any work in progress on porting one of the python2 modules? All I'm coming up with is xlrd for python2. | python3 module for importing xls files | 0 | 1 | 0 | 530 |
8,788,299 | 2012-01-09T12:16:00.000 | 2 | 0 | 0 | 0 | python,webdriver | 8,788,422 | 1 | true | 1 | 0 | There is a find_elements_by_class_name, notice the elements (plural) method which returns an iterator. To find the n'th element simply replace num: find_elements_by_class_name('className')[num]
This should return all DOM elements with the same class name. | 1 | 2 | 0 | I'm using .find_element_by_class_name() to get an element with a given class name. It seems that the returned element is the first with the class name. How can I get the n'th element with that class name?
Also, is it possible to get all the DOM elements with a given class name? | Get n'th element with given class name with WebDriver | 1.2 | 0 | 1 | 2,275 |
8,789,172 | 2012-01-09T13:30:00.000 | 0 | 0 | 1 | 0 | python,tempdata,tempdir | 8,789,283 | 6 | false | 0 | 0 | Usually programs use a ~/.progname directory to store data that should be persistent but should stay "out of the way" of the user. | 1 | 8 | 0 | I need a temporary directory, but I want full control over its creation and deletion.
I will use this directory to place git repositories which I want to monitor for new commits, so I need to store them somewhere permanently.
Therefore I want to avoid /tmp dir, since it can be cleared by user(?). What is the best pract... | Temporary directory persist across program runs | 0 | 0 | 0 | 2,726 |
8,790,555 | 2012-01-09T15:12:00.000 | 1 | 0 | 0 | 1 | python,colors,hex,x11,rgb | 8,791,192 | 4 | false | 0 | 0 | You can't convert to x11 colors automatically.
x11 colors are basically just names mapped to arbitrary RGB values, so the only way to get from RGB to x11 is to reverse the map.
If you want to convert an RGB color that isn't in x11 to the closest match in x11 that would be pretty difficult. | 2 | 2 | 0 | I'm searching for a single function to convert RGB tuple (255, 255, 255) or HTML hex (#FFFFFF) to X11 color (0...255 int) to manage colors in Unix terminal. I've looked over the internet but I didn't find anything like that, so I'm asking for code or link to a website that contains code or information about how I can d... | Convert HTML HEX Color or RGB tuple to X11 color | 0.049958 | 0 | 0 | 2,309 |
8,790,555 | 2012-01-09T15:12:00.000 | 1 | 0 | 0 | 1 | python,colors,hex,x11,rgb | 8,791,219 | 4 | false | 0 | 0 | If I understand your question properly, I don't think you can do this. The RGB tuple (and its representation as a 6-digit hex number for HTML) represents a specific color in the RGB colorspace. The single integer in the range 0 to 255 you mention for the Unix terminal isn't a specific color, but rather an index into a ... | 2 | 2 | 0 | I'm searching for a single function to convert RGB tuple (255, 255, 255) or HTML hex (#FFFFFF) to X11 color (0...255 int) to manage colors in Unix terminal. I've looked over the internet but I didn't find anything like that, so I'm asking for code or link to a website that contains code or information about how I can d... | Convert HTML HEX Color or RGB tuple to X11 color | 0.049958 | 0 | 0 | 2,309 |
8,792,044 | 2012-01-09T16:50:00.000 | 13 | 0 | 1 | 1 | python,python-idle | 34,907,888 | 10 | false | 0 | 0 | One way to run IDLE from spotlight or an icon in the Applications folder is to build a quick Automation for it. As mentioned by other commentators, this probably isn't necessary for Python 3, as it creates a shortcut automatically, and some hand-installed versions have tools to do this automatically. But if you want t... | 6 | 46 | 0 | I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight. | how do I launch IDLE, the development environment for Python, on Mac OS 10.7? | 1 | 0 | 0 | 100,963 |
8,792,044 | 2012-01-09T16:50:00.000 | 2 | 0 | 1 | 1 | python,python-idle | 45,255,372 | 10 | false | 0 | 0 | first to launch the terminal CMD+space
second to input idle3
the idle will be activated automatically. | 6 | 46 | 0 | I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight. | how do I launch IDLE, the development environment for Python, on Mac OS 10.7? | 0.039979 | 0 | 0 | 100,963 |
8,792,044 | 2012-01-09T16:50:00.000 | 63 | 0 | 1 | 1 | python,python-idle | 8,792,311 | 10 | true | 0 | 0 | In the stock Mac OS X python installation, idle is found in /usr/bin, which is not (easily) accessible from Finder and not indexed by Spotlight. The quickest option is to open the Terminal utility and type 'idle' at the prompt. For a more Mac-like way of opening it, you'll have to create a small app or shortcut to laun... | 6 | 46 | 0 | I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight. | how do I launch IDLE, the development environment for Python, on Mac OS 10.7? | 1.2 | 0 | 0 | 100,963 |
8,792,044 | 2012-01-09T16:50:00.000 | 0 | 0 | 1 | 1 | python,python-idle | 32,878,774 | 10 | false | 0 | 0 | As to the earlier questions about starting IDLE: you can certainly start it from the command line. Also, if you installed Python using Homebrew, you can run 'brew linkapps' (from the command line); that will place an app for IDLE (among other things) in Launchpad (Applications folder). | 6 | 46 | 0 | I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight. | how do I launch IDLE, the development environment for Python, on Mac OS 10.7? | 0 | 0 | 0 | 100,963 |
8,792,044 | 2012-01-09T16:50:00.000 | 1 | 0 | 1 | 1 | python,python-idle | 32,877,359 | 10 | false | 0 | 0 | After you launch idle from the command line (make sure idle shell window has focus), click File, click "New File". A new window opens; this is your editor.
Type your program in the editor. Click "File", click "Save As...". Save your file somewhere with any name you choose, and a ".py" extension to the file name.
Click... | 6 | 46 | 0 | I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight. | how do I launch IDLE, the development environment for Python, on Mac OS 10.7? | 0.019997 | 0 | 0 | 100,963 |
8,792,044 | 2012-01-09T16:50:00.000 | 1 | 0 | 1 | 1 | python,python-idle | 35,586,250 | 10 | false | 0 | 0 | The answer of Matthewm1970 works like a charm!
And if you add an & to your shell command, the automation script will end immediately. There is no spinning gear. Like so:
/usr/local/bin/idle3.5&
Note the ampersand.
Cheers.
-melle | 6 | 46 | 0 | I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight. | how do I launch IDLE, the development environment for Python, on Mac OS 10.7? | 0.019997 | 0 | 0 | 100,963 |
8,793,702 | 2012-01-09T19:02:00.000 | 2 | 0 | 1 | 0 | python,icr | 8,793,854 | 3 | false | 0 | 0 | I don't really see what this has to do with python, unless of course you've already digitized the results and are now looking to tally up the results. It sounds like you still need to scan the results in and as far as I know, python doesn't have any direct capabilities of doing something like that. You're going to have... | 1 | 3 | 0 | I am interested in doing some snail mail based surveys but I am looking for quick ways to digitize the surveys they send back.
So if I had a question and 5 boxes beneath it where you would indicate your opinion by checking the appropriate box, does anything exist where I could scan it and run it through a piece of soft... | any Python tools for reading Scantron-style data | 0.132549 | 0 | 0 | 2,785 |
8,793,877 | 2012-01-09T19:17:00.000 | 1 | 0 | 1 | 0 | python,django,virtualenv,pip | 43,931,969 | 5 | false | 0 | 0 | seems like we can't just copy one virtualenv as another one.
even you chnage the $VIRTUAL_ENV in the activate file, it still act as in origin virtualenv and pip will install all the packages to origin site-packages/ | 3 | 34 | 0 | Is it possibe to copy python modules from one virtualenv to another.If so how is this done? | how to copy modules from one virtualenv to another | 0.039979 | 0 | 0 | 31,912 |
8,793,877 | 2012-01-09T19:17:00.000 | 0 | 0 | 1 | 0 | python,django,virtualenv,pip | 69,423,767 | 5 | false | 0 | 0 | I was facing a problem installing 'wordcloud' on another Python venv on Windows 10. Package was installed on another project, same machine.
copy "wordcloud" and "wordcloud-1.8.1.dist-info" folders from Users/<user>/PycharmProjects/<projectname>/venv/Lib/site-packages and paste to your new project /<projectname>/venv/Li... | 3 | 34 | 0 | Is it possibe to copy python modules from one virtualenv to another.If so how is this done? | how to copy modules from one virtualenv to another | 0 | 0 | 0 | 31,912 |
8,793,877 | 2012-01-09T19:17:00.000 | 1 | 0 | 1 | 0 | python,django,virtualenv,pip | 8,794,087 | 5 | false | 0 | 0 | Usually you are able to copy the .egg-info from the lib/site-packages folder of the virtualenv to the lib/site-packages of the other environment. | 3 | 34 | 0 | Is it possibe to copy python modules from one virtualenv to another.If so how is this done? | how to copy modules from one virtualenv to another | 0.039979 | 0 | 0 | 31,912 |
8,795,361 | 2012-01-09T21:20:00.000 | 3 | 0 | 0 | 0 | python,html,google-app-engine,browser,search-engine | 8,795,433 | 2 | false | 1 | 0 | Some search engines cannot index dynamic pages.
Not true. Clients cannot know and do not care if the server got the content by executing a script or just reading a static file.
Most search engines won't execute client side JavaScript. Most search engines will not submit forms.
If your content is accessible by followin... | 1 | 0 | 0 | A website may be accessed not only by a user on a browser, but also programs, bots and crawlers. I have a website running on Google App Engine with python which has non-static HTML pages that are generated by a python program by combining, merging and looping strings. However, they are also not dynamic pages in the sen... | Test how my website appears to a program | 0.291313 | 0 | 0 | 101 |
8,795,448 | 2012-01-09T21:29:00.000 | -1 | 0 | 0 | 0 | python,tags,semantics,named-entity-recognition | 8,796,685 | 1 | false | 0 | 0 | Take a look at NLTK python library. It contains a vast number of tools, dictionaries and algorithms. | 1 | 4 | 0 | I am interested in generating a list of suggested semantic tags (via links to Freebase, Wikipedia or another system) to a user who is posting a short text snippet. I'm not looking to "understand" what the text is really saying, or even to automatically tag it, I just want to suggest to the user the most likely semanti... | Suggest semantic tags for short snippets of text | -0.197375 | 0 | 0 | 383 |
8,795,762 | 2012-01-09T21:59:00.000 | 5 | 0 | 1 | 0 | python,hash | 8,795,790 | 4 | true | 0 | 0 | Hashing isn't exactly my area of expertise but what comes to mind is sorting the bytes based on their numerical values and then hashing that. | 1 | 2 | 0 | I am reading in files through Python and have the problem of creating an identifier for the last 500 bytes or so in the file. I would like the identifier to be the same for any file that shares the same exact bytes in that chunk, however the actual bytes can be in any order. If a byte is missing or added I would like... | How should I go about creating the same hash ID for the same data which is in random order in Python? | 1.2 | 0 | 0 | 131 |
8,795,879 | 2012-01-09T22:12:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,requesthandler | 8,797,080 | 1 | false | 1 | 0 | The 413 is generated by the App Engine infrastructure; the request neve reaches your app, so it's impossible to handle this condition yourself. | 1 | 1 | 0 | I have been banging my head around on this issue for a bit and have not come up with a solution. I am attempting to trap the exception UploadEntityTooLargeEntity. This exception is raised by GAE when 2 things happen.
Set the max_bytes_total param in the create_upload_url:
self.template_values['AVATAR_SAVE_URL'] = bl... | Handling GAE BlobStore Exception via webapp2 handler | 0.53705 | 0 | 0 | 194 |
8,796,565 | 2012-01-09T23:18:00.000 | 2 | 0 | 1 | 0 | python,types | 8,796,638 | 2 | false | 0 | 0 | Python is dynamic and strongly typed programming language. What that means is that you can define a variable without explicitly stating its type, but when you first use that variable it becomes bound to a certain type.
For example,
x = 5 is an integer, and so now you cannot concatenate it with string, e.g. x+"hello" | 1 | 1 | 0 | Using Haskell's type system I know that at some point in the program, a variable must contain say an Int of a list of strings. For code that compiles, the type checker offers certain guarantees that for instance I'm not trying to add an Int and a String.
Are there any tools to provide similar guarantees for Python code... | When coding in Python, how do I achieve guarantees of correctness similar to those I get with Haskell's type system? | 0.197375 | 0 | 0 | 497 |
8,796,800 | 2012-01-09T23:46:00.000 | 14 | 1 | 1 | 0 | python,serial-port,pyserial | 8,808,218 | 3 | true | 0 | 0 | I have done this with pyserial. Reading from one thread and writing from another should not cause problems in general, since there isn't really any kind of resource arbitration problem. Serial ports are full duplex, so reading and writing can happen completely independently and at the same time. | 3 | 10 | 0 | I tried googling this, couldn't find an answer, searched here, couldn't find an answer. Has anyone looked into whether it's thread safe to write to a Serial() object (pyserial) from thread a and do blocking reads from thread b?
I know how to use thread synchronization primitives and thread-safe data structures, and in... | pyserial - possible to write to serial port from thread a, do blocking reads from thread b? | 1.2 | 0 | 0 | 10,755 |
8,796,800 | 2012-01-09T23:46:00.000 | 0 | 1 | 1 | 0 | python,serial-port,pyserial | 14,660,364 | 3 | false | 0 | 0 | I would recommend to modify Thread B from "blocking read" to "non blocking read/write". Thread B would become your serial port "Daemon".
Thread A could run at full speed for a friendly user interface or perform any real time operation.
Thread A would write a message to Thread B instead of trying to write directly to th... | 3 | 10 | 0 | I tried googling this, couldn't find an answer, searched here, couldn't find an answer. Has anyone looked into whether it's thread safe to write to a Serial() object (pyserial) from thread a and do blocking reads from thread b?
I know how to use thread synchronization primitives and thread-safe data structures, and in... | pyserial - possible to write to serial port from thread a, do blocking reads from thread b? | 0 | 0 | 0 | 10,755 |
8,796,800 | 2012-01-09T23:46:00.000 | 4 | 1 | 1 | 0 | python,serial-port,pyserial | 8,814,172 | 3 | false | 0 | 0 | I've used pyserial in this way on Linux (and Windows), no problems ! | 3 | 10 | 0 | I tried googling this, couldn't find an answer, searched here, couldn't find an answer. Has anyone looked into whether it's thread safe to write to a Serial() object (pyserial) from thread a and do blocking reads from thread b?
I know how to use thread synchronization primitives and thread-safe data structures, and in... | pyserial - possible to write to serial port from thread a, do blocking reads from thread b? | 0.26052 | 0 | 0 | 10,755 |
8,796,882 | 2012-01-09T23:59:00.000 | 0 | 1 | 0 | 0 | c++,python,ipc,redis,distributed | 8,810,895 | 2 | true | 0 | 0 | if time is not of the essence (T minutes sounds like it is long compared to whatever events are happening in the C++ programs that are kicked off) then dont make things any more complicated than they need to be. forget IPC (sockets, shared mem, etc), just have each C++ program log what you need to know about time/per... | 1 | 0 | 0 | I have a simple python server script which forks off multiple instances (say N) of C++ program. The C++ program generates some events that need to be captured.
The events are currently being captured in a log file (1 logfile per forked process). In addition, i need to periodically (T minutes) get the rate at which the ... | Request for suggestions on doing IPC/event capture | 1.2 | 0 | 0 | 160 |
8,798,043 | 2012-01-10T02:57:00.000 | 0 | 0 | 0 | 0 | user-interface,wxpython,pygame | 9,446,899 | 2 | false | 0 | 1 | I dont think its possible since wxPython (using wxWidgets c++) is a wrapper around the window management system, it rely on the OS functions to draw on screen (it convert to the right system calls depending on OS).
Pygame uses SDL and a simple code to window management system, it calls few OS functions just to create ... | 1 | 6 | 0 | I am looking for a way in which wxPython GUI elements can be added into pygame. If there is an alternative to solve the purpose of adding GUI elements to a pygame please suggest so. I am having problem in installing PGU.Thanks for help. | Adding wxpython in pygame | 0 | 0 | 0 | 1,738 |
8,798,707 | 2012-01-10T04:51:00.000 | -1 | 0 | 0 | 0 | android,iphone,python,django,security | 8,799,339 | 3 | false | 1 | 0 | Use client authentication with SSL or just layer your own client authentication (username/password, token, etc) on top of server-authentication SSL.
(Edit: Moving the comment here, since it won't fit as a comment)
To elaborate a bit, any authentication info needs to be stored or entered in the app. If you have people ... | 1 | 34 | 0 | An Android/Iphone app will be accessing application data from the server.
[Django-Python]
How can I secure the communication with the mobile app ?
Expectation : Secure enough for sensitive information like passwords, there shall be no direct way of decryption except brute-forcing.
My requirements :
Authentication [On... | Securing communication [Authenticity, Privacy & Integrity] with mobile app? | -0.066568 | 0 | 0 | 6,963 |
8,799,886 | 2012-01-10T07:27:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,proxy,urlfetch | 8,807,655 | 2 | true | 1 | 0 | You can always roll your own:
In case of fixed destination: just setup a fixed port forwarding on a proxy server. Then send requests from GAE to proxy. If you have multiple destinations, then set forwarding on separate ports, one for each destination.
In case of dynamic destination (too much to handle via fixed port ... | 1 | 6 | 0 | Is there a way to specify a proxy server when using urlfetch on Google App Engine?
Specifically, every time I make a call using urlfetch, I want GAE to go through a proxy server. I want to do this on production, not just dev.
I want to use a proxy because there are problems with using google's outbound IP addresses (r... | URLFetch behind a Proxy Server on App Engine Production | 1.2 | 0 | 0 | 2,065 |
8,802,343 | 2012-01-10T11:12:00.000 | 1 | 0 | 1 | 0 | python,logout,logoff | 8,802,566 | 3 | false | 0 | 0 | Try os.system("shutdown -l").
shutdown -l is the windows shell command for logoff | 1 | 4 | 0 | Which Python function should I use, to log off current user.
I found an example that is locking my pc, like Win+L combination
ctypes.windll.user32.LockWorkStation ()
but I need a similar function, which will log off. | Windows logoff using Python | 0.066568 | 0 | 0 | 8,279 |
8,806,705 | 2012-01-10T16:28:00.000 | 1 | 0 | 0 | 0 | python,django,workflow,django-cms | 8,821,441 | 2 | true | 1 | 0 | When you turn on CMS_MODERATION in Django-CMS, you will get three icons next to each page in the page list view. From left to right, these control
whether changes to this page will require moderator approval
whether changes to this page's children will require moderator approval
whether changes to this page's descende... | 1 | 4 | 0 | I need to implement workflows in my Django-CMS application at work. But form the Django-CMS feature list, we can read:
Editorial workflow
Workflows for publishing and approval.
I tried to search for it and didn't find anything. I've search the Django-CMS documentation (http://docs.django-cms.org/en/latest/index.html) a... | Django-cms and Editorial workflows | 1.2 | 0 | 0 | 1,990 |
8,807,793 | 2012-01-10T17:39:00.000 | 4 | 0 | 1 | 0 | python,scala,read-eval-print-loop | 8,807,828 | 2 | true | 0 | 0 | The default python interpreter manipulates a variable by the name _ to have the last returned value (including None for expressions that return it). iPython extends this to __ and ___ as well as Out, which is a dict containing all of the returned results.
This feature is present only in interactive interpreters, thoug... | 1 | 1 | 0 | I've started to like Scala REPL's ability to reference previous computations with resX and wanted to know if there's a way to access that in Python/bpython/iPython REPL. | Is there similar functionality in Python REPL to Scala's REPL to reference a previous computation? | 1.2 | 0 | 0 | 273 |
8,808,104 | 2012-01-10T18:01:00.000 | 1 | 0 | 0 | 1 | java,python,networking,tcp,tunnel | 8,808,582 | 4 | false | 0 | 0 | If you want to route only tcp traffic is actually kind of simple using threads and sockets.
You should listen in a different port for every server you want to reach. Either in Java or Python you have to create a "socket" for every port you want to listen in.
For every new connection you create a new connection to the s... | 1 | 5 | 0 | I want to build an application that routes all network traffic (not just HTTP) through my application. Basically, what I want is all the traffic to be given to my application (they should never reach the actual target, my application should handle this), which will in turn be forwarded to a server; same goes for input,... | Routing all packets through my program? | 0.049958 | 0 | 1 | 2,625 |
8,808,476 | 2012-01-10T18:27:00.000 | 1 | 1 | 0 | 0 | python,thrift | 8,826,673 | 2 | false | 0 | 0 | I've read that you can deploy it behind nginx using the upstream module to point to the thrift server. You should have at least one CPU core per thrift server and one left for the system (i.e. if you're on a quad-core, you should only run 3 thrift servers, leaving one left over for the system). | 2 | 5 | 0 | There is probably a nice document that will help me. Please point to it.
If I write a Thrift server using Python what is the best way to deploy it in a production environment? All I can find is examples of using the Python based servers that come with the distribution. How can I use Apache as the server platform for... | how to deploy a hardened Thrift server for python? | 0.099668 | 0 | 0 | 1,005 |
8,808,476 | 2012-01-10T18:27:00.000 | 1 | 1 | 0 | 0 | python,thrift | 17,220,313 | 2 | false | 0 | 0 | I assume that you are using the Python THttpServer? A couple of notes:
1) There is a comment in that code that reads
"""
This class is not very performant, but it is useful (for example) for
acting as a mock version of an Apache-based PHP Thrift endpoint.
"""
I wouldn't recommend that you use it in production if you ... | 2 | 5 | 0 | There is probably a nice document that will help me. Please point to it.
If I write a Thrift server using Python what is the best way to deploy it in a production environment? All I can find is examples of using the Python based servers that come with the distribution. How can I use Apache as the server platform for... | how to deploy a hardened Thrift server for python? | 0.099668 | 0 | 0 | 1,005 |
8,811,403 | 2012-01-10T22:23:00.000 | 0 | 0 | 0 | 0 | python,firefox,firefox-addon,right-click | 8,811,426 | 2 | false | 0 | 0 | I think it is not possible. Normal FF extensions are afaik written in XUL and Javascript and therefore can not call other (non JS-) code. | 1 | 2 | 0 | Hi I'm studying Python and I've started my first little project.
The first thing that I want to do is to add an item to the right click menu of Firefox. So, when I right-click a link that item will be available and when I click it some Python code will be called in order to "do something" with that URL.
Do I have to c... | Add option to right-click menu in Firefox | 0 | 0 | 1 | 534 |
8,812,975 | 2012-01-11T01:22:00.000 | 1 | 0 | 1 | 0 | python,concurrency | 8,813,016 | 1 | true | 0 | 0 | Between having no shared array elements between threads and the GIL, you're good. | 1 | 2 | 0 | I have a large python array (and by array I mean a list that is initialized to a certain size by doing [None] * 1000) that will be accessed by multiple threads. No 2 threads will ever access the same index. Do I need any sort of concurrency control? I'm guessing not since there's no threat of overwriting values? Thanks... | Do I need concurrency control on python array if no 2 threads access the same element? | 1.2 | 0 | 0 | 118 |
8,813,669 | 2012-01-11T03:05:00.000 | 0 | 1 | 1 | 0 | python,unit-testing,nose | 8,814,746 | 1 | false | 0 | 0 | Better to create a functions which accept text as an argument and return text as well. These functions should be placed in the myscript.py and tested in the tests.py. | 1 | 1 | 0 | I am fairly new to programming and I am trying to learn the python Nose module for testing a code (myscript.py) that takes 2 input files and writes 2 output files. I want to write a test.py script (to run using Nose) that will take a bunch of test files, run them as input files, and then evaluate the output files by co... | Basics of Using Python Nose | 0 | 0 | 0 | 348 |
8,814,383 | 2012-01-11T05:01:00.000 | 0 | 1 | 0 | 1 | python,eclipse,twisted,sigint | 61,871,564 | 5 | false | 0 | 0 | in some versions, you can do the following.
In the Debug perspective, you can open a view called "Signals"
(Window/Show View/Signals" or Left-Bottom Icon).
You will get a list of all supported signals. Right-click and "Resume
with Signal" will give you the result you need. | 1 | 29 | 0 | I have setup a run configuration in Eclipse and need to send SIGINT (Ctrl+C) to the program. There is cleanup code in the program that runs after SIGINT, so pressing Eclipse's "Terminate" buttons won't work (they send SIGKILL I think). Typing CTRL+C into the Console also doesn't work.
How do I send SIGINT to a process ... | Sending SIGINT (Ctrl-C) to program running in Eclipse Console | 0 | 0 | 0 | 15,315 |
8,815,201 | 2012-01-11T06:43:00.000 | 0 | 1 | 0 | 0 | python,unit-testing,testing | 10,704,251 | 2 | false | 0 | 0 | We have some functional tests that truly do hit a real FTP server that we keep running as part of our staging environment. The config of our Django project is slightly different when running tests, so it hits this 'test' FTP server rather than any of our real servers or any of our client's. Having said that, these are ... | 1 | 2 | 0 | I have very little knowledge in testing and I wish to seek guidance in the following scenario - I have a piece of code where it takes in some arguments (filename, path etc) and uploads the file specified to a remote ftp server. So, the goal of the testing would be to check if the file is uploaded to the correct directo... | python test sending files over ftp | 0 | 0 | 0 | 2,285 |
8,817,296 | 2012-01-11T09:56:00.000 | 1 | 0 | 0 | 0 | python,regex,html-parsing,data-mining | 8,854,322 | 2 | false | 1 | 0 | If you need to do classification given the content of pages, I would suggest you to take a look at NLTK (http://www.nltk.org/), a natural language toolkit of open source python modules.
Don't just try to look at occurrences of e.g. "report" in the the pages. A report may or may not have "report" as a title or in the co... | 1 | 0 | 0 | I have the some 50 raw HTML page contents which are relevant to my project. I am not sure these contents are having unique pattern.
I need to parse the contents from all pages and has to be classified based on the keywords.
Keywords all like that
'REVIEWS',"REPORTS","FEEDBACK","DESCRIPTION","COMMENTS","SUCCESS RATES","... | Parsing and splitting multiple HTML pages without having a clue | 0.099668 | 0 | 1 | 218 |
8,823,088 | 2012-01-11T16:42:00.000 | 1 | 0 | 1 | 1 | python,locking,ipc | 8,823,470 | 3 | true | 0 | 0 | You could apply locks to a file using fcntl.lockf or fcntl.flock. That seems to meet all your criteria. Or do you need something that doesn't require a system call every time you want to lock or unlock? | 1 | 1 | 0 | Is there any locking interface for Python that automatically breaks the lock when the process dies? I was under the impression that sysv ipc allows for that, but I'm still trying to figure out the details.
What I expect from the interface:
lock / release functions
working between different processes on Linux
automatic... | Python locks that go away when process dies | 1.2 | 0 | 0 | 744 |
8,823,830 | 2012-01-11T17:29:00.000 | 0 | 0 | 1 | 0 | ipython | 8,825,937 | 1 | true | 0 | 0 | Unfortunately, it may not be possible to free memory effectively in the Controller in IPython 0.10, but the MultiEngineClient.clear_pending_results() method may help.
The controller in 0.11-0.12 can use a database (sqlite or mongodb) to store results, and has been seen to run for a long time, with gigabytes of throughp... | 1 | 0 | 0 | I am using IPython 0.10.2 and Python 2.7 right now. I start one ipcontroller and 20 ipengines on my cluster. The code structure is very simple. I just use MultiEngineClient.execute() methods and MultiEngineClient dictionary interface (e.g., mec['a'] = b) . My current application needs to run nearly two days. However, a... | Huge memory usage by ipcontroller | 1.2 | 0 | 0 | 345 |
8,823,924 | 2012-01-11T17:36:00.000 | 4 | 0 | 0 | 0 | python,emacs,docstring,pep8,autoformatting | 8,827,727 | 4 | false | 0 | 0 | I don't know how to do that, but I've never felt the need. It is so easy to use C-x f to change the fill column. And you can just hit M-p to reuse the last value you entered. Just C-x f M-p --- 3 keystrokes. | 1 | 14 | 0 | I would like to have auto-fill set to 79 columns for code sections and 72 for docstrings to get automatic PEP8 compliance. There seems to be an option to do this for Lisp mode (emacs-lisp-docstring-fill-column) but not for Python.
Is there an enhanced python-mode.el around somewhere that includes this? | In emacs Python mode, how do I set a different auto-fill width for docstrings and code? | 0.197375 | 0 | 0 | 2,249 |
8,824,143 | 2012-01-11T17:52:00.000 | 3 | 0 | 1 | 0 | python,import,package | 8,824,181 | 1 | true | 0 | 0 | The easiest way is giving the local package a different name and then using import foo_dev as foo instead of just import foo | 1 | 4 | 0 | I have two packages installed with the same name, one globally and one locally (a development version). My PYTHONPATH has to local directory in it. Now, when importing in Python, I want to choose which package I take. Is there any way to do this? | Importing Python packages with same name | 1.2 | 0 | 0 | 190 |
8,825,681 | 2012-01-11T19:48:00.000 | 5 | 0 | 0 | 0 | python,xlrd | 8,826,320 | 6 | false | 0 | 0 | I'm reminded of this gem from the xlrd docs:
Dates in Excel spreadsheets
In reality, there are no such things. What you have are floating point
numbers and pious hope.
The same is true of integers. Perhaps minus the pious hope. | 1 | 20 | 0 | I use xlrd to read data from excel files.
For integers stored in the files, let's say 63, the xlrd interprets it as 63.0 of type number.
Why can't xlrd recognize 63 as an integer?
Assume sheet.row(1)[0].value gives us 63.0. How can I convert it back to 63. | Integers from excel files become floats? | 0.16514 | 1 | 0 | 30,994 |
8,826,688 | 2012-01-11T21:11:00.000 | 2 | 0 | 0 | 0 | python,pyqt,pyqt4,editing,qtablewidget | 8,948,046 | 2 | false | 0 | 1 | You can also use setCurrentCell.
table.setCurrentCell(0,1)
QTableWidget.setCurrentCell (self, int row, int column) | 1 | 2 | 0 | Two part question:
I have a 10x10 QTableWidget with QTableWidgetItem in each cell.
For some reason, clicking on a cell is not sufficient to edit it, I need to double-click the cell to enter it.
Is there a way to change this behavior to single click
Is there a way to have 2nd cell in 1st row selected and ready for ed... | QTableWidget how to have a cell selected for editing from code and/or with single click | 0.197375 | 0 | 0 | 3,799 |
8,827,703 | 2012-01-11T22:33:00.000 | 7 | 0 | 1 | 0 | python,algorithm,theory | 8,827,797 | 4 | true | 0 | 0 | It is proven for rock-paper-scissors that a random bot will be at the median of each rank.
Therefore, I'd create a set of bots, each calculating one heuristic and running on the background on parallel. For each turn, each bot will virtually "draw" and check if he had won or lost - if it would have played this turn. Eac... | 2 | 10 | 0 | In my school our teacher is holding a Rock, paper, scissors bot competition. I know how to program in Python, but I have no idea how to program a bot that would have a bigger chance of success than one that randomly selects its weapons. I think it is possible to store all previous moves and then look for patterns in or... | Rock paper Scissors bot algorithm | 1.2 | 0 | 0 | 6,603 |
8,827,703 | 2012-01-11T22:33:00.000 | 0 | 0 | 1 | 0 | python,algorithm,theory | 8,827,880 | 4 | false | 0 | 0 | Where might be some potential profit in trying to figure out the strategies of the other bots, for instance, if it's a forced participation, there will be some lazy student who makes up a bot that would always throw up scissors.
I propose another strategy (I've heard about it on some similar competition, but can't trac... | 2 | 10 | 0 | In my school our teacher is holding a Rock, paper, scissors bot competition. I know how to program in Python, but I have no idea how to program a bot that would have a bigger chance of success than one that randomly selects its weapons. I think it is possible to store all previous moves and then look for patterns in or... | Rock paper Scissors bot algorithm | 0 | 0 | 0 | 6,603 |
8,828,909 | 2012-01-12T01:08:00.000 | 3 | 1 | 1 | 0 | python,performance,cpython | 8,829,028 | 2 | false | 0 | 0 | If you're going to be doing a lot of heavy number crunching, have a look at "numpy". | 2 | 5 | 0 | I need to manipulate large numbers in Python that fit into 64 bits. Currently, my code is running on a 64-bit platform but there is small but distinct possibility that it will have to run on a 32-bit platform. Consequently, I would prefer to use long type to represent my numbers. I understand there is a performance im... | Performance impact of using long vs. int in Python | 0.291313 | 0 | 0 | 904 |
8,828,909 | 2012-01-12T01:08:00.000 | 3 | 1 | 1 | 0 | python,performance,cpython | 8,829,078 | 2 | false | 0 | 0 | If your program does a lot of numerical computations - to a point that performance matters, you should profile it, and have the numerical part running in native code. You should not have to worry if internally the numbers are Python "integers" or "long" - so much that Python 3 removes the type difference.
There are sev... | 2 | 5 | 0 | I need to manipulate large numbers in Python that fit into 64 bits. Currently, my code is running on a 64-bit platform but there is small but distinct possibility that it will have to run on a 32-bit platform. Consequently, I would prefer to use long type to represent my numbers. I understand there is a performance im... | Performance impact of using long vs. int in Python | 0.291313 | 0 | 0 | 904 |
8,830,216 | 2012-01-12T04:40:00.000 | 2 | 0 | 1 | 0 | python,list-comprehension | 8,830,410 | 4 | false | 0 | 0 | Here's how I think through list comprehensions.
1) I need to output a list
2) I'm starting with a list/iterable.
3) I either need to perform an action on all the elements and/or choose specific elements from the original list.
That leads me to the following construction:
output = [ mangle(x) for x in selector(input)]
... | 2 | 1 | 0 | When i think about any problem , thinking via list comprehension doesn't come naturally.
Whats the best way to think through this?
Regards
Ashish | How to write Generators , list comprehension in python | 0.099668 | 0 | 0 | 188 |
8,830,216 | 2012-01-12T04:40:00.000 | 0 | 0 | 1 | 0 | python,list-comprehension | 8,830,944 | 4 | true | 0 | 0 | For me, examples made the difference. List comprehensions may not come naturally until you've used them to solve a problem or two that a for loop would not solve as elegantly.
Some thoughts (others may have better examples):
Given a list of words, find the words of length 5.
Given a list of numbers, return the subset... | 2 | 1 | 0 | When i think about any problem , thinking via list comprehension doesn't come naturally.
Whats the best way to think through this?
Regards
Ashish | How to write Generators , list comprehension in python | 1.2 | 0 | 0 | 188 |
8,830,355 | 2012-01-12T05:01:00.000 | 3 | 0 | 1 | 0 | python,visual-studio-2010,pyqt,ptvs | 11,158,550 | 1 | false | 0 | 1 | I had the same problem with PTVS version 1.1.1 . I did the following . Now auto completion works for PyQT libraries.
1. upgraded the PTVS to 1.5
2. In visual studio , select tools-options- python tools-interpreter options. Click on "Generate completion" , then restart the visual studio. | 1 | 1 | 0 | I'm using PyQT v4.9 for Windows 7, and Visual Studio 2010 (extension PTVS 1.1 )
Autocomplete is good function in IDE. Example:
object.method_of_class() #when I press the dot, see a list of possible methods.
But with pyqt class, this not works, exapmle:
QtGui.QDesktopWidget()
How can I solve this problem?
P.S. Fo... | PyQT and Visual Studio 2010 | 0.53705 | 0 | 0 | 1,633 |
8,830,977 | 2012-01-12T06:23:00.000 | 0 | 0 | 0 | 0 | java,python,frameworks,web | 8,831,216 | 5 | false | 1 | 0 | Spring MVC 3 is in my experience the
most flexible
extensible and
speedy web framework around
Spring's main purpose was to introduce Dependency Injection for objects.
Another Java lightweight MVC frameworks is Wicket.
Stripes framework
Lightweight
Action based
Convention over configuration approach
No XML
Smart and... | 2 | 2 | 0 | I need to develop a lightweight web application, it will:
have a simple webgui for administrator to operate;
have interface to invoke background existing modules for functionality implement, let's assume it has shell invoke interface firstly, it is not clear yet.
so my question is do we have any popular and recom... | what's the popular and recommendatory lightweight java(or python?) web application framework? | 0 | 0 | 0 | 3,214 |
8,830,977 | 2012-01-12T06:23:00.000 | 0 | 0 | 0 | 0 | java,python,frameworks,web | 8,831,308 | 5 | false | 1 | 0 | Wonder why Struts has not found place in above list ? Is it too heavy ? | 2 | 2 | 0 | I need to develop a lightweight web application, it will:
have a simple webgui for administrator to operate;
have interface to invoke background existing modules for functionality implement, let's assume it has shell invoke interface firstly, it is not clear yet.
so my question is do we have any popular and recom... | what's the popular and recommendatory lightweight java(or python?) web application framework? | 0 | 0 | 0 | 3,214 |
8,835,679 | 2012-01-12T13:17:00.000 | 2 | 0 | 0 | 0 | python,wxpython,wxwidgets | 8,837,486 | 3 | false | 0 | 1 | The wx.App does a bunch of behind the scenes stuff to make your application work. It does the main loop, which is what waits for the user to do something and then responds. You have to have it. As FogleBird mentioned. By the way, you should NOT have more than one. Doing so will cause weird issues, if it works at all. | 1 | 1 | 0 | What is the use of the wx.App class (apart from what the documentation says), when you can just create a frame and .Show(True) it?
When should a wx.App class be used, or why shouldn't you create a frame and just show it? | purpose of wx.App when just showing a frame is enough | 0.132549 | 0 | 0 | 661 |
8,836,536 | 2012-01-12T14:18:00.000 | 0 | 0 | 1 | 0 | python,memory-management,virtual-memory | 8,836,643 | 2 | true | 0 | 1 | At the C level (CPython's implementation), anything that is allocated on the heap with malloc() will consume memory and this memory will not be released to the OS when that memory is freed with free(). It will only be returned when the process dies. But when new blocks are allocated with malloc() they will use the free... | 1 | 1 | 0 | I have a question about the virtual memory in Python.
When the process is consuming a relatively large amount of memory, it doesn't "release" the unused memory. For example, after creating a massive list of strings, let's say the list uses 30MB of memory, so the entire process takes roughly 40MB, when the list is delet... | Virtual memory management in Python (2.6-2.7) - Will it reuse the allocated memory for any type of data? | 1.2 | 0 | 0 | 3,099 |
8,837,899 | 2012-01-12T15:46:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine | 8,838,811 | 2 | true | 1 | 0 | You've said that you're storing the target time in the Alarm table. So, your cron just has to run every minute (or every 5 or 10, depending on the resolution of your alarms) and check if there's an alarm matching the current time, and if so then do the action. | 1 | 0 | 0 | I have a form with a text field for entering a number without decimal
places representing an amount of minutes that will have to be added to the current time
and will be inserted into a table named Alarm.
When the resulting time comes, my web app must make an insert operation over another table.
For example, if the use... | How could I do this kind of scheduled task in AppEngine Python? | 1.2 | 0 | 0 | 170 |
8,838,243 | 2012-01-12T16:08:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,logging | 8,848,350 | 2 | true | 1 | 0 | I had a similar logging in my app, and what I did is to set up a simple servlet in a self-hosted server that receives the log string and level and store them in our local database. Each time I need this kind of log, I use asynchronous URLFetch to send the data from our app to our logging server.
I could store the log d... | 2 | 2 | 0 | I have an application for which I would like to record some statistics for later analysis but which are not at all needed within the application itself. i.e. The data will never need to be read by the application. Whatever system is used for storing these statistics, I just need to be able to take periodic dumps of t... | Custom logs in AppEngine | 1.2 | 0 | 0 | 228 |
8,838,243 | 2012-01-12T16:08:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,logging | 8,844,141 | 2 | false | 1 | 0 | Your best option is to store this data in the datastore. If you're concerned about latency, you can either use asynchronous operations, and start the write as soon as possible, or you can use the task queue to do the writes offline. | 2 | 2 | 0 | I have an application for which I would like to record some statistics for later analysis but which are not at all needed within the application itself. i.e. The data will never need to be read by the application. Whatever system is used for storing these statistics, I just need to be able to take periodic dumps of t... | Custom logs in AppEngine | 0.197375 | 0 | 0 | 228 |
8,838,782 | 2012-01-12T16:44:00.000 | 0 | 1 | 1 | 0 | python,pip,pypi | 8,839,036 | 3 | false | 0 | 0 | You should keep a "reference copy" of the projects on which you depend.
If someone removes the project from GitHub (and PyPi and all the mirrors, and every other site on the net) then you have the source and can now distribute it. | 2 | 1 | 0 | I'm building various python-based projects that use pip/buildout to install dependencies. But I don't like the idea of someone deleting a github project and crippling my apps, or a network outage meaning I can't perform a deployment.
How do other people solve this?
I've got various ideas, but I think perhaps the one th... | Caching Python requirements for production deployments | 0 | 0 | 0 | 495 |
8,838,782 | 2012-01-12T16:44:00.000 | 0 | 1 | 1 | 0 | python,pip,pypi | 8,839,967 | 3 | false | 0 | 0 | I have exactly the same requirements, and also use buildout to manage my deployments. I try not to install ANY of my package dependencies system-wide; I let buildout install eggs for all of them into my buildout. That way if I depend on a newer version of some package in rev N+1 of my project, and at "go-live" time N... | 2 | 1 | 0 | I'm building various python-based projects that use pip/buildout to install dependencies. But I don't like the idea of someone deleting a github project and crippling my apps, or a network outage meaning I can't perform a deployment.
How do other people solve this?
I've got various ideas, but I think perhaps the one th... | Caching Python requirements for production deployments | 0 | 0 | 0 | 495 |
8,839,930 | 2012-01-12T18:00:00.000 | 0 | 0 | 1 | 1 | python,eclipse,pydev | 8,842,240 | 2 | true | 0 | 0 | I don't think you can make pydev default to .pyo, but you can always pass "-O" as a VM argument in Run Configurations. | 2 | 1 | 0 | I am using Eclipse with Pydev 1.5.7 installed. I am also using Python 2.5. By default, Pydev compiles to .pyc. How do I make it compile to .pyo by default | How to make pydev compile to .pyo and not .pyc | 1.2 | 0 | 0 | 633 |
8,839,930 | 2012-01-12T18:00:00.000 | 0 | 0 | 1 | 1 | python,eclipse,pydev | 67,301,483 | 2 | false | 0 | 0 | Or add PYTHONOPTIMIZE = 2 as environment variable in the run configuration dialog. | 2 | 1 | 0 | I am using Eclipse with Pydev 1.5.7 installed. I am also using Python 2.5. By default, Pydev compiles to .pyc. How do I make it compile to .pyo by default | How to make pydev compile to .pyo and not .pyc | 0 | 0 | 0 | 633 |
8,840,127 | 2012-01-12T18:15:00.000 | 0 | 0 | 0 | 0 | python,opencv,face-detection,simplecv | 33,917,789 | 2 | false | 0 | 0 | The color segementation involves "gradient of the difference between the pseudo-hue and luminance (obtaining hybrid contours)". Try googling for qouted string and you will find multiple research papers on this topic. | 1 | 5 | 1 | How do people usually extract the shape of the lips once the mouth region is found (in my case using haar cascade)? I tried color segmentation and edge/corner detection but they're very inaccurate for me. I need to find the two corners and the very upper and lower lip at the center. I've heard things about active appea... | OpenCV Lip Segmentation | 0 | 0 | 0 | 4,301 |
8,840,999 | 2012-01-12T19:20:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,google-cloud-datastore | 8,844,099 | 1 | true | 1 | 0 | Practically speaking, no. Any difference in the efficiency of comparing different datatypes is insignificant compared to disk access times. | 1 | 1 | 0 | Will a query with a filter over IntegerProperty perform any better than a query with a filter over String Property?
(same indexes) | appengine datastore - filter by string or integer | 1.2 | 0 | 0 | 276 |
8,841,110 | 2012-01-12T19:29:00.000 | 0 | 0 | 1 | 1 | python,cygwin,command-prompt | 60,981,831 | 3 | false | 0 | 0 | A Windows install of ActiveState python won't enter interactive mode, AND it will be run instead of cygwin Python even if you have cygwin Python installed, because ActiveState python inserts its bin path at the front of your Windows System PATH environment variables.
I solved it by going (in Windows) to Control Panel->... | 1 | 23 | 0 | I like python in interactive mode when on linux. However on cygwin, the interactive mode doesn't start. I don't see the ">>>" prompt and whatever I enter doesn't result in anything.
Solved: I figured out the problem from the answers below. I was using a windows installation of python and it needs -i option to start in ... | How to enable python interactive mode in cygwin? | 0 | 0 | 0 | 9,333 |
8,841,227 | 2012-01-12T19:38:00.000 | 2 | 0 | 0 | 0 | python,html,character-encoding | 8,841,681 | 2 | true | 1 | 0 | The request header Accept-Charset (which may get mapped to HTTP_ACCEPT_CHARSET server-side) expresses the client’s preferences, to be used when the server is capable to serving the resource in different encodings. The server may ignore it, and often will.
If your page is UTF-8 encoded and declared as such, then any for... | 1 | 1 | 0 | Client browsers are sending the header HTTP_ACCEPT_CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.3. I only serve webpages as utf8 with the correct header but browsers are posting data from forms encoded with the ISO-8859-1 charset. My question is, will a browser always prefer charsets in the order of its ACCEPT_CHARSET head... | Browser charsets order of precedence | 1.2 | 0 | 1 | 114 |
8,841,569 | 2012-01-12T20:08:00.000 | 2 | 0 | 1 | 0 | python,nlp,nltk | 8,860,314 | 4 | true | 0 | 0 | NLP techniques are relatively ill equipped to deal with this kind of text.
Phrased differently: it is quite possible to build a solution which includes NLP processes to implement the desired classifier but the added complexity doesn't necessarily pays off in term of speed of development nor classifier precision improve... | 1 | 5 | 1 | I have a list of products that I am trying to classify into categories. They will be described with incomplete sentences like:
"Solid State Drive Housing"
"Hard Drive Cable"
"1TB Hard Drive"
"500GB Hard Drive, Refurbished from Manufacturer"
How can I use python and NLP to get an output like "Housing, Cable, Drive, Dri... | Find subject in incomplete sentence with NLTK | 1.2 | 0 | 0 | 2,952 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.