Q_CreationDate stringlengths 23 23 | Title stringlengths 11 149 | Question stringlengths 25 6.53k | Answer stringlengths 15 5.1k | Score float64 -1 1.2 | Is_accepted bool 2
classes | N_answers int64 1 17 | Q_Id int64 0 6.76k |
|---|---|---|---|---|---|---|---|
2012-04-26 07:24:36.250 | Grabbing pixel attributes in Python | I am using Python3 on Windows 7. I want to grab all the attributes like color intensity, color etc. Of all the pixels of the screen area that I select with mouse. The selection can be of any shape but right now rectangular and square will do.
I want to do it in any area of the screen.
Can you guys please guide me how ... | You need to use some sort of cross-platform GUI toolkit, such as GTK or KDE, maybe Tk or wx will work as well, I don't know.
How you then do it depends on what toolkit you choose. | 0 | false | 1 | 1,832 |
2012-04-26 11:18:26.053 | Eclipse with Webfaction and Django | This is my first time purchasing a hosting and I opted for Webfaction.com to host my Django application. So far, i've been using Eclipse to write all my code and manage my Django application and I'm not ready to use VIM as a text editor yet. Now my question is, how can I use Eclipse to write my code and manage all my f... | Don't do that. Your host is for hosting. Your personal machine is for developing.
Edit and run your code locally. When it's ready, upload it to Webfaction. Don't edit code on your server. | 1.2 | true | 1 | 1,833 |
2012-04-26 15:28:53.830 | Django Application Assign Stylesheet -- don't want to add it to app's index file? Can it be dynamic? | I am new to Django framework and kindly consider if my question is novice.
I have created a polls application using the django framwork. I am unable to figure out how to make my stylesheet dynamic for front end. As i dont want to call it in my base_site.html or index.html files as I am also multiple views render differ... | If i'm reading your question correctly the first part wants to make a stylesheet that is dynamic???
I am unable to figure out how to make my stylesheet dynamic for front
end
For that you could use something like
Django admin follows convention of adding {% block extra_head %} (or something similar, sorry don't reme... | 1.2 | true | 1 | 1,834 |
2012-04-26 21:30:05.163 | How to migrate a python site to another machine? | I would like to know how to setup a complex python website, that is currently running in production environment, into a local machine for development?
Currently the site uses python combined with Django apps (registration + cms modules) in a virtual environment. | In case you are using pip for package management, you can easily recreate the virtualenv on another system:
On system1, run pip freeze --local > requirements.txt and copy that file to system2. Over there, create and activate the virtualenv and use pip install -r requirements.txt to install all packages that were instal... | 1.2 | true | 1 | 1,835 |
2012-04-27 10:35:43.423 | how to do Ldap Server Authentication? | I have set up a Ldap Server somewhere. I can bind to it, can add, modify, delete entry in the database. Now when it come to authentication isnt it as simple as giving the username and password to the server, asking it to search for an entry matching the two? And furthermore, isnt it the 'userPassword' field that contai... | Typically you would search using the username value provided on uid or cn values within the LDAP Tree.
-jim | 0.135221 | false | 2 | 1,836 |
2012-04-27 10:35:43.423 | how to do Ldap Server Authentication? | I have set up a Ldap Server somewhere. I can bind to it, can add, modify, delete entry in the database. Now when it come to authentication isnt it as simple as giving the username and password to the server, asking it to search for an entry matching the two? And furthermore, isnt it the 'userPassword' field that contai... | LDAP servers are generally not going to allow you to search on the userPassword attribute, for obvious security reasons. (and the password attribute is likely stored in hashed form anyway, so a straight search would not work.)
Instead, the usual way to do LDAP authentication is:
prompt for username & password
Bind to... | 1.2 | true | 2 | 1,836 |
2012-04-28 12:20:57.647 | How to kill the cherrypy process? | I am using cherrypy in python script.I think I have to register a callback method from the main application so that i can stop cherrypy main process from a worker thread,but how do i kill the main process within the that process.
So i want to know how to stop cherrypy from within the main process. | If your process is using CherryPy to block (via quickstart or engine.block), then you could simply call: cherrypy.engine.exit() from your page handler. That would be the cleanest option since it would properly terminate CherryPy and plugins you may have subscribed to. | 0 | false | 1 | 1,837 |
2012-04-29 21:27:51.837 | Creating a customized language using Python | I have started playing with Sage recently, and I've come to suspect that the standard Python int is wrapped in a customized class called Integer in Sage. If I type in type(1) in Python, I get <type 'int'>, however, if I type in the same thing in the sage prompt I get <type 'sage.rings.integer.Integer'>.
If I wanted to ... | In the case of Sage, it's easy. Sage has complete control of its own REPL (read-evaluate-print loop), so it can parse the commands you give it and make the parts of your expression into whatever classes it wants. It is not so easy to have standard Python automatically use your integer type for integer literals, however... | 0.135221 | false | 1 | 1,838 |
2012-04-30 00:07:17.420 | button visibility in openerp | I am using openerp 5.16 web.
Is there any way we can hide button depending upon the logged in user.
or how can i control the group visibility depending upon the user group. | Depending the logged in user :
You can use the variable 'uid' but I don't think you can do 'uid.name' or 'uid.groups_id'. So the easier method will be the second.
Depending on the groups
Example : We have some users who are managers and others not, create a group 'Manager' (in a xml file !!!) and add this group to man... | 0.101688 | false | 1 | 1,839 |
2012-05-01 12:34:16.483 | What type of project will help me learn thread programming | I want to learn threading and multiprocessing in Python. I don't know what kind of project to take up for this.
I want to be able to deal with all the related objects like Locks, Mutexes, Conditions, Semaphores, etc.
Please suggest a project type that's best for me.
P.S. Along with the project, please suggest any tools... | I propose you attempt to program a very simple database server. Each client can connect to the server and do create, read, update, delete on a set of entities. Implementation-wise, the server should have one thread for each client all operating a global set of entities, which are protected using locks.
For learning how... | 0 | false | 2 | 1,840 |
2012-05-01 12:34:16.483 | What type of project will help me learn thread programming | I want to learn threading and multiprocessing in Python. I don't know what kind of project to take up for this.
I want to be able to deal with all the related objects like Locks, Mutexes, Conditions, Semaphores, etc.
Please suggest a project type that's best for me.
P.S. Along with the project, please suggest any tools... | a few ideas:
web crawler - have a pool of threads getting work from a dispatcher via a queue, download web pages and return the results somewhere.
chat server - accepting permanent connections from users and dispatching messages from one to another.
mp3 file organizer - rebuild a music library's structure from mp3 ta... | 0.995055 | false | 2 | 1,840 |
2012-05-02 10:39:00.433 | How to run nginx + python (without django) | I want to have simple program in python that can process different requests (POST, GET, MULTIPART-FORMDATA). I don't want to use a complete framework.
I basically need to be able to get GET and POST params - probably (but not necessarily) in a way similar to PHP. To get some other SERVER variables like REQUEST_URI, QUE... | You should look into using Flask -- it's an extremely lightweight interface to a WSGI server (werkzeug) which also includes a templating library, should you ever want to use one. But you can totally ignore it if you'd like. | 1.2 | true | 2 | 1,841 |
2012-05-02 10:39:00.433 | How to run nginx + python (without django) | I want to have simple program in python that can process different requests (POST, GET, MULTIPART-FORMDATA). I don't want to use a complete framework.
I basically need to be able to get GET and POST params - probably (but not necessarily) in a way similar to PHP. To get some other SERVER variables like REQUEST_URI, QUE... | All the same you must use wsgi server, as nginx does not support fully this protocol. | 0 | false | 2 | 1,841 |
2012-05-02 20:29:11.373 | How can I change the order of the BoxLayout in kivy? | I am testing kivy and I want to create a BoxLayout so to stack some buttons. My problem is that the children that are added to the layout follow a bottom-top logic while I want the opposite. Do you know how can I reverse the order? Thanks! | There is a tricky way to do that.
Use a gridlayout and set cols to 1 | 0.201295 | false | 1 | 1,842 |
2012-05-03 02:48:34.140 | Pointers on using celery with sorl-thumbnails with remote storages? | I'm surprised I don't see anything but "use celery" when searching for how to use celery tasks with sorl-thumbnails and S3.
The problem: using remote storages causes massive delays when generating thumbnails (think 100s+ for a page with many thumbnails) while the thumbnail engine downloads originals from remote storage... | As I understand Sorl works correctly with the S3 storage but it's very slow.
I believe that you know what image sizes do you need.
You should launch the celery task after the image was uploaded. In task you call to
sorl.thumbnail.default.backend.get_thumbnail(file, geometry_string, **options)
Sorl will generate a thum... | 0.496174 | false | 1 | 1,843 |
2012-05-03 06:52:29.270 | Apply regex on Solr query? | I have got indexes created on tables having data of the form:
indexname='text'---->Today is a great day for running in the park.
Now i want to perform a search on the indexes where only 'day' or 'run' is appearing in the text.
I have implemented query like :
q = 'text:(day or run*)'
But this query is not returning me a... | Regex and wildcards are slow in search engines. You'll get better performance by pre-processing the terms in a language-sensitive way.
You can match "run" to "running" with a stemmer, an analysis step that reduces different forms of a word to a common stem. When the query and the index term are both stemmed, then they ... | 0 | false | 2 | 1,844 |
2012-05-03 06:52:29.270 | Apply regex on Solr query? | I have got indexes created on tables having data of the form:
indexname='text'---->Today is a great day for running in the park.
Now i want to perform a search on the indexes where only 'day' or 'run' is appearing in the text.
I have implemented query like :
q = 'text:(day or run*)'
But this query is not returning me a... | Your use case is very basic and doesn't require regex at all with Solr. It looks like you just may have a syntax issue. q=text:day OR text:run should do exactly what you're looking for. | 0.201295 | false | 2 | 1,844 |
2012-05-03 16:40:55.700 | Python installation mess on Mac OS X, cannot run python | I stupidly downloaded python 3.2.2 and since then writing 'python' in the terminal yields 'command not found'. Also, when starting the terminal I get this:
Last login: Wed May 2 23:17:28 on ttys001
-bash: export: `folder]:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/bin:/opt/local/sbin:/usr/local/gi... | Something got messed up in your $PATH. Have a look in ~/.profile, ~/.bashrc, ~/.bash_profile, etc., and look for a line starting with export that doesn't end cleanly. | 0.135221 | false | 1 | 1,845 |
2012-05-03 21:36:08.063 | Fabric + django asynchronous prompt for sudo password | I'm working on the deployment tool in Django and fabric. The case is putting some parameters (like hostname and username) in the initial form, then let Django app to call fabric methods to do the rest and collect the output in the web browser.
IF there is a password prompt from OS to fabric (ie. running sudo commands e... | I can't think of a way to do a password prompt only if required... you could prompt before and cache it as required, though, and the backend would have access.
To pass the sudo password to the fabric command, you can use sudo -S... i.e.
echo password | sudo -S command | 0.201295 | false | 2 | 1,846 |
2012-05-03 21:36:08.063 | Fabric + django asynchronous prompt for sudo password | I'm working on the deployment tool in Django and fabric. The case is putting some parameters (like hostname and username) in the initial form, then let Django app to call fabric methods to do the rest and collect the output in the web browser.
IF there is a password prompt from OS to fabric (ie. running sudo commands e... | Yes, capture the password exception, than popup the form, and run the fabric script again with env.password = userpassword
If you want to continue where you caught the exception, keep a variable that knows what has been done yet (i.e. nlinesexecuted) and save it when you catch the exception. Use logic when you rerun th... | 1.2 | true | 2 | 1,846 |
2012-05-04 11:23:53.840 | plone how to add content rule for event which after end date should be moved to another folder | I wish to create a content rule for an event such that after expiry date of the event i.e end date, it should be moved to another folder. How do I specify the content rule. Please guide. Using Plone 4.1 | Not sure you can do this with a content rule; there is no code running at that exact time. You'd need to run an external cron job to trigger a scan for expired events.
Why not just use a collection to list expired events in the other location? | 1.2 | true | 1 | 1,847 |
2012-05-04 14:59:11.117 | Django: How can I find methods/functions filling in the specific template | Say, I find some bug in a web interface. I open firebug and discover element and class, id of this element. By them I can then identify a template which contains variables, tags and so on.
How can I move forward and reveal in which .py files these variables are filled in?
I know how it works in Lift framework: when you... | Determining template variable resolution is all about Context.
Use the URL to identify the view being invoked.
Look at the view's return and note a) the template being used, and b) any values being passed in the Context used when the template is being rendered.
Look at settings.py for the list of TEMPLATE_CONTEXT_PROC... | 1.2 | true | 2 | 1,848 |
2012-05-04 14:59:11.117 | Django: How can I find methods/functions filling in the specific template | Say, I find some bug in a web interface. I open firebug and discover element and class, id of this element. By them I can then identify a template which contains variables, tags and so on.
How can I move forward and reveal in which .py files these variables are filled in?
I know how it works in Lift framework: when you... | In well designed django, you should only have to edit the template. Good design provides clean separation. It's possible the developer may have been forced todo something unusual...but you could try to edit the template and see what happens (make backup 1st) | 0.201295 | false | 2 | 1,848 |
2012-05-05 16:19:40.270 | Multiple key press detection wxPython | I am creating a Project Manager using wxPython it has a splitter window. On one side is a tree that shows the names of and opens the files and on the other size is a textctrl that is used to edit the file.
One problem I am having is that I would like it to go back 4 spaces when SHIFT and TAB are pressed, I have code wo... | I don't know use WxPython and so don't have much idea about it. But in general what you can do is whenever a key is pressed, call a callback function and you could get the time when the key was pressed. save it somewhere. And when the next key is pressed, get the time. compare both times, if there's not much significan... | 0.201295 | false | 1 | 1,849 |
2012-05-06 06:31:07.223 | Python PyInstaller Ubuntu Troubles | I have been searching for tutorials on how to use pyinstaller and cant find that one that i can follow. I have been researching this for hours on end and cant find anything that helps me. I am using Linux and was wondering if anyone can help me out form the very begging, because there is not one part i understand about... | The following is reposted from my comment on the question, so that this question may be marked as answered (assuming OP is satisfied with this answer). It was originally posted as a comment because it does not answer the question directly.
The reason there aren't many tutorials on how to do this on Linux is
because ... | 1.2 | true | 1 | 1,850 |
2012-05-07 08:37:45.400 | Python - Reading directly from hard drive | I want to read bytes directly off a hard drive, preferably using python. How can I do this, provided it is even possible. Also, can I write directly to a hard drive, and how?
I want to do this to make a complete clone of a hard drive, and then restoring from that backup. I'm quite certain there are easier ways to get w... | On linux, you can open('/dev/sdX', 'r').
However, the easier way is using the dd commandline utility (but it will only work properly if both disks are exactly the same). | 1.2 | true | 1 | 1,851 |
2012-05-09 05:43:52.293 | Python: Failed to import extension - Errno 2 | I am having weird behaviors in my Python environment on Mac OS X Lion.
Apps like Sublime Text (based on Python) don't work (I initially thought it was an app bug),
and now, after I installed hg-git, I get the following error every time I lauch HG in term:
*** failed to import extension hggit from /Library/Frameworks/P... | "site-package"? Did you mean "site-packages"? | 0 | false | 1 | 1,852 |
2012-05-09 09:54:00.013 | Django users post to twitter | I use Django-social-auth to authenticate the users of a Django project. So I guess I have all the necessary information about a Twitter user to make a post on their behalf on their Twitter account. So do I really need to install a new app? or with the info at hand how would I do that? Isn't it just a matter of posting ... | You could just extract the code into your own project and that will work. But the benefits of using an open source library is that there's a good chance when Twitter or Social Network X changes it's API, the library, if popular, would get updated as opposed to you needing to make the change. | 0.265586 | false | 1 | 1,853 |
2012-05-09 15:42:50.357 | Execute java methodes via a Python or Perl client | I have a java application as server (installed on Tomcat/Apache) and another java application as client. The client's task is to get some arguments and pass them to the server and call an adequate method on the server to be execute.
I want to have the client in other languages like Perl, Python or TCL. So, I need to k... | What you are talking about is Web Services. A corollary to this is XML and SOAP. In Java, Python, C#, C++... any language, you can create a Web Service that conforms to a standard pattern. Using NetBeans (Oracle's Java IDE) it is easy to create Java web services. Otherwise, use google to search for "web services tutori... | 0 | false | 1 | 1,854 |
2012-05-09 18:49:49.863 | Best approach to doing analysis of sets of tags? | I have thousands of survey responses that have been tagged according to the content of the response. Each response can have one tag or many (up to 20), and the tags are independent of one another rather than being structured into category-subcategory or something.
I want to be able to do analysis like the following:
H... | Go with SQL! It is very powerful for data analysis. It will allow you to ask questions in the future about the data. Questions that you have not yet thought of.
Although SQL as a language may seem a bit cumbersome, it is much easier to use than a "real" programming language. In your case, SQL interfaces to Excel, s... | 0 | false | 3 | 1,855 |
2012-05-09 18:49:49.863 | Best approach to doing analysis of sets of tags? | I have thousands of survey responses that have been tagged according to the content of the response. Each response can have one tag or many (up to 20), and the tags are independent of one another rather than being structured into category-subcategory or something.
I want to be able to do analysis like the following:
H... | You have a quite small dataset, so you do not need any kind of ORM really, just load all data in Python and chew a report of it.
SQL as a language is horrible for a more complex data analysis (e.g. where you really want to crosstabulate things etc). | 0.101688 | false | 3 | 1,855 |
2012-05-09 18:49:49.863 | Best approach to doing analysis of sets of tags? | I have thousands of survey responses that have been tagged according to the content of the response. Each response can have one tag or many (up to 20), and the tags are independent of one another rather than being structured into category-subcategory or something.
I want to be able to do analysis like the following:
H... | While data concerning the frequency of individual tags should be very simple to construct, data concerning the relationships between tags is very difficult and falls under the realm of data mining. Here is what I would do, at a very high level, assuming you have a response table, a tag table, and a response_tag table.... | 0.101688 | false | 3 | 1,855 |
2012-05-10 11:02:20.507 | Find available bandwidth from Python or C++ | I am trying to get the available bandwidth from my PC.
Suppose I'm streaming a video at 2 Mbps and my network card is of 100 Mbps, my program should tell me that 98 Mbps is available.
Is it easy to do in C++ or Python? And how can I find the available bandwidth using any of the suggested programming language. Any hel... | There are many, many factors that will influence the available bandwidth: your hardware (network card, router, WiFi stability, cabling), what you are doing (other downloads, machine load) and what is happening elsewhere (bandwidth to target server, ISP issues, etc.). And all of those can change at any moment in time to... | 0.386912 | false | 1 | 1,856 |
2012-05-12 00:18:57.783 | Getting Tkinter listbox item when hit Button-1 | After creating a simple window/widget layout with Page (page.sourceforge.net)
I found that the listbox curselection() call returns the proper index when releasing Button-1.
When hit, it returns the previous index (the item which we just leave).
Becasue of some timer activities I'd like to get the clicked index at click... | Bind to the event <<ListboxSelect>> instead of <1>, this event will fire after the current selection has been updated.
If you genuinely need for the binding to work literally on a press of the mouse button you will have to rearrange the order of the bind tags for the widget. | 0.386912 | false | 1 | 1,857 |
2012-05-12 05:52:22.900 | Any addons for contacts for Plone 4.1 | Hi I have tried UpfrontContacts, collective.contacts couldn't get to build the zope.conf. Any for the version of Plone i.e 4.1 ? Please let me know the exact steps to implement the same also. Also tried Membrane. But don't know how to use it. | Products.PressRoom is the answer yahooo! :) | 1.2 | true | 1 | 1,858 |
2012-05-13 06:47:24.830 | Sorting a list with elements containing dictionary values | I'm trying to make a sorting system with card ranks and their values are obtained from a separate dictionary. In a simple deck of 52 cards, we have 2 to Ace ranks, in this case I want a ranking system where 0 is 10, J is 11, Q is 12, K is 13, A is 14 and 2 is 15 where 2 is the largest valued rank. The thing is, if ther... | have you already tried
sorted(list_for_sorting, key=dictionary_you_wrote.__getitem__)
? | 0 | false | 1 | 1,859 |
2012-05-13 16:13:45.633 | Where are the logs from BackgroundThreads on App Engine? | I'm writing an app that writes log entries from a BackgroundThread object on a backend instance. My problem is that I don't know how to access the logs.
The docs say, "A background thread's os.environ and logging entries are independent of those of the spawning thread," and indeed, the log entries don't show up with t... | There is a combobox in the top left corner of the versions/backends of your application switch to the backend there and you will see the backend logs. | 0.995055 | false | 1 | 1,860 |
2012-05-14 07:01:23.383 | Access webcam over internet using Python | I have written a program using Python and OpenCV where I perform operations on a video stream in run time. It works fine. Now if I want to publish it on a website where someone can see this using their browser and webcam, how do I proceed? | not really sure what you want to happen but if your going to implement this kind of feature in a website I think you should use a flash application instead of python (or if possible html 5). though your using python on the development of you web app it would only run on the server side instead and the feature you want ... | 1.2 | true | 1 | 1,861 |
2012-05-14 12:19:04.227 | How can I dynamically generate class instances with single attributes read from flat file in Python? | I apologise if this question has already been asked.
I'm really new to Python programming, and what I need to do is this:
I have a .csv file in which each line represent a person and each column represents a variable.
This .csv file comes from an agent-based C++ simulation I have done.
Now, I need to read each line of ... | I have a .csv file
You're in luck; CSV support is built right in, via the csv module.
Do you suggest creating a class dictionary for accessing every instance?
I don't know what you think you mean by "class dictionary". There are classes, and there are dictionaries.
But I still need to provide a name to every single... | 0.135221 | false | 1 | 1,862 |
2012-05-15 06:13:26.763 | Maintain a large dictionary in memory for Django-Python? | I have a big key-value pair dump, that I need to lookup for my django-Python webapp.
So, I have following options:
Store it as json dump and load it as a python dict.
Store it in a dump.py and import the dict from it.
Use some targeted systems for this problem: [ Are these really meant for this usecase ? ]
Mem-cache
... | 5Mb isn't that large. You could keep it in memory in process, and I recommend that you do, until it becomes clear from profiling and testing that that approach isn't meeting your needs. Always do the simplest thing possible.
Socket communication doesn't of itself introduce much of an overhead. You could probably pare i... | 0.101688 | false | 3 | 1,863 |
2012-05-15 06:13:26.763 | Maintain a large dictionary in memory for Django-Python? | I have a big key-value pair dump, that I need to lookup for my django-Python webapp.
So, I have following options:
Store it as json dump and load it as a python dict.
Store it in a dump.py and import the dict from it.
Use some targeted systems for this problem: [ Are these really meant for this usecase ? ]
Mem-cache
... | In past for a similar problem I have used the idea of a dump.py . I would think that all of the other data structures would require a layer to convert objects of one kind into python objects . However I would still think that this would depend on data size and the amount of data you are handling . Memcache and redis ... | 0.101688 | false | 3 | 1,863 |
2012-05-15 06:13:26.763 | Maintain a large dictionary in memory for Django-Python? | I have a big key-value pair dump, that I need to lookup for my django-Python webapp.
So, I have following options:
Store it as json dump and load it as a python dict.
Store it in a dump.py and import the dict from it.
Use some targeted systems for this problem: [ Are these really meant for this usecase ? ]
Mem-cache
... | Memcached, though a great product, is trumped by Redis in my book. It offers lots of things that memcached doesn't, like persistence.
It also offers more complex data structures like hashses. What is your particular data dump? How big is it, and how large / what type of values? | 0.201295 | false | 3 | 1,863 |
2012-05-15 08:55:21.377 | install python and make in cygwin | I have installed Cygwin Terminal in OS Windows. But I need to install also python and make in cygwin.All of these programs are needed to run petsc library.
Does Someone know how to install these components in cygwin? | @spacediver is right on. Run cygwin's setup.exe again and when you get to the packages screen make sure you select make and python (and any other libs/apps you may need - perhaps gcc or g++). | 0.386912 | false | 5 | 1,864 |
2012-05-15 08:55:21.377 | install python and make in cygwin | I have installed Cygwin Terminal in OS Windows. But I need to install also python and make in cygwin.All of these programs are needed to run petsc library.
Does Someone know how to install these components in cygwin? | Look into cygwin native package manager, devel category. You should find make and python there. | 0.673066 | false | 5 | 1,864 |
2012-05-15 08:55:21.377 | install python and make in cygwin | I have installed Cygwin Terminal in OS Windows. But I need to install also python and make in cygwin.All of these programs are needed to run petsc library.
Does Someone know how to install these components in cygwin? | In my case, it was happened due to python is not well installed. So python.exe is referenced in the shell so it can't find the file because the system is different.
Please check cygwin python is well installed. | 0 | false | 5 | 1,864 |
2012-05-15 08:55:21.377 | install python and make in cygwin | I have installed Cygwin Terminal in OS Windows. But I need to install also python and make in cygwin.All of these programs are needed to run petsc library.
Does Someone know how to install these components in cygwin? | After running into this problem myself, I was overlooking all of the relevant answers saying to check the setup.exe again. This was the solution to me, there are a few specific things to check.
Check /bin for "make.exe". If it's not there, you have not installed it correctly
Run the setup.exe. Don't be afraid, as new ... | 0.443188 | false | 5 | 1,864 |
2012-05-15 08:55:21.377 | install python and make in cygwin | I have installed Cygwin Terminal in OS Windows. But I need to install also python and make in cygwin.All of these programs are needed to run petsc library.
Does Someone know how to install these components in cygwin? | Here is a command line version to install python in cygwin
wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /bin
apt-cyg install python | 0.327599 | false | 5 | 1,864 |
2012-05-15 19:16:42.843 | Modular serialization with pickle (Python) | I want to perform serialisation of some object graph in a modular way. That is I don't want to serialize the whole graph. The reason is that this graph is big. I can keep timestamped version of some part of the graph, and i can do some lazy access to postpone loading of the parts i don't need right now.
I thought i cou... | Here's how I think I would go about this.
Have a module level dictionary mapping persistent_id to SpecialClass objects. Every time you initialise or unpickle a SpecialClass instance, make sure that it is added to the dictionary.
Override SpecialClass's __getattr__ and __setattr__ method, so that specialobj.foo = anoth... | 0 | false | 2 | 1,865 |
2012-05-15 19:16:42.843 | Modular serialization with pickle (Python) | I want to perform serialisation of some object graph in a modular way. That is I don't want to serialize the whole graph. The reason is that this graph is big. I can keep timestamped version of some part of the graph, and i can do some lazy access to postpone loading of the parts i don't need right now.
I thought i cou... | Metaprogramming is strong in Python; Python classes are extremely malleable. You can alter them after declaration all the way you want, though it's best done in a metaclass (decorator). More than that, instances are malleable, independently of their classes.
A 'reference to a place' is often simply a string. E.g. a ref... | 0 | false | 2 | 1,865 |
2012-05-16 09:00:54.343 | Check how many elements from a list fall within a specified range (Python) | I have a list of elements (integers) and what I need to do is to quickly check how many elements from this list fall within a specified range. The example is below.
range is from 34 to 566
l = [9,20,413,425]
The result is 2.
I can of course use a simple for loop for the purpose and compare each element with the min and... | len([x for x in l if x > 34 and x < 566]) | 0.995055 | false | 1 | 1,866 |
2012-05-16 21:10:07.577 | Minimax explanation "for dummies" | I'm quite new to algorithms and i was trying to understand the minimax, i read a lot of articles,but i still can't get how to implement it into a tic-tac-toe game in python.
Can you try to explain it to me as easy as possible maybe with some pseudo-code or some python code?.
I just need to understand how it works. i r... | Minimax is a way of exploring the space of potential moves in a two player game with alternating turns. You are trying to win, and your opponent is trying to prevent you from winning.
A key intuition is that if it's currently your turn, a two-move sequence that guarantees you a win isn't useful, because your opponen... | 0.545705 | false | 1 | 1,867 |
2012-05-16 21:36:28.860 | convert python time.time() to java.nanoTime() | java's System.nanoTime() seems to give a long: 1337203874231141000L
while python time.time() will give something like 1337203880.462787
how can i convert time.time()'s value to something match up to System.nanoTime()? | Divide the output of System.nanoTime() by 10^9. This is because it is in nanoseconds, while the output of time.time() is in seconds. | 0 | false | 1 | 1,868 |
2012-05-16 23:52:03.663 | Inserting image into IPython notebook markdown | I am starting to depend heavily on the IPython notebook app to develop and document algorithms. It is awesome; but there is something that seems like it should be possible, but I can't figure out how to do it:
I would like to insert a local image into my (local) IPython notebook markdown to aid in documenting an algor... | You can find your current working directory by 'pwd' command in jupyter notebook without quotes. | -0.116092 | false | 5 | 1,869 |
2012-05-16 23:52:03.663 | Inserting image into IPython notebook markdown | I am starting to depend heavily on the IPython notebook app to develop and document algorithms. It is awesome; but there is something that seems like it should be possible, but I can't figure out how to do it:
I would like to insert a local image into my (local) IPython notebook markdown to aid in documenting an algor... | Getting an image into Jupyter NB is a much simpler operation than most people have alluded to here.
Simply create an empty Markdown cell.
Then drag-and-drop the image file into the empty Markdown cell.
The Markdown code that will insert the image then appears.
For example, a string shown highlighted in gray below wil... | 0.999715 | false | 5 | 1,869 |
2012-05-16 23:52:03.663 | Inserting image into IPython notebook markdown | I am starting to depend heavily on the IPython notebook app to develop and document algorithms. It is awesome; but there is something that seems like it should be possible, but I can't figure out how to do it:
I would like to insert a local image into my (local) IPython notebook markdown to aid in documenting an algor... | Last version of jupyter notebook accepts copy/paste of image natively | 0.283556 | false | 5 | 1,869 |
2012-05-16 23:52:03.663 | Inserting image into IPython notebook markdown | I am starting to depend heavily on the IPython notebook app to develop and document algorithms. It is awesome; but there is something that seems like it should be possible, but I can't figure out how to do it:
I would like to insert a local image into my (local) IPython notebook markdown to aid in documenting an algor... | minrk's answer is right.
However, I found that the images appeared broken in Print View (on my Windows machine running the Anaconda distribution of IPython version 0.13.2 in a Chrome browser)
The workaround for this was to use <img src="../files/image.png"> instead.
This made the image appear correctly in both Print Vi... | 0.087241 | false | 5 | 1,869 |
2012-05-16 23:52:03.663 | Inserting image into IPython notebook markdown | I am starting to depend heavily on the IPython notebook app to develop and document algorithms. It is awesome; but there is something that seems like it should be possible, but I can't figure out how to do it:
I would like to insert a local image into my (local) IPython notebook markdown to aid in documenting an algor... | I never could get "insert image" into a markdown cell to work. However, the drag and drop entered the png file saved in the same directory as my notebook. It brought this text into the cell
""
The shift + enter > image is now displayed in notebook.
FWIW | 0 | false | 5 | 1,869 |
2012-05-17 08:47:11.543 | How do I operate on a huge matrix (100000x100000) stored as nested list? | Circumstances
I have a procedure which will construct a matrix using the given list of values!
and the list starts growing bigger like 100 thousand or million values in a list, which in turn, will result in million x million size matrix.
in the procedure, i am doing some add/sub/div/multiply operations on the matrix, e... | First and foremost, such matrix would have 10G elements. Considering that for any useful operation you would then need 30G elements, each taking 4-8 bytes, you cannot assume to do this at all on a 32-bit computer using any sort of in-memory technique. To solve this, I would use a) genuine 64-bit machine, b) memory-mapp... | 1.2 | true | 2 | 1,870 |
2012-05-17 08:47:11.543 | How do I operate on a huge matrix (100000x100000) stored as nested list? | Circumstances
I have a procedure which will construct a matrix using the given list of values!
and the list starts growing bigger like 100 thousand or million values in a list, which in turn, will result in million x million size matrix.
in the procedure, i am doing some add/sub/div/multiply operations on the matrix, e... | Your data structure is not possible with arrays, it is too large. If the matrix is for instance a binary matrix you could look at representations for its storage like hashing larger blocks of zeros together to the same bucket. | 0 | false | 2 | 1,870 |
2012-05-17 21:46:45.867 | python e**(-x) OverflowError: (34, 'Result too large') | Is there a way in python to truncate the decimal part at 5 or 7 digits?
If not, how can i avoid a float like e**(-x) number to get too big in size?
Thanks | The "Result too large" doesn't refer to the number of characters in the decimal representation of the number, it means that the number that resulted from your exponential function is large enough to overflow whatever type python uses internally to store floating point values.
You need to either use a different type to ... | 0.265586 | false | 1 | 1,871 |
2012-05-18 11:48:38.400 | Simulating the passing of time in unittesting | I've built a paywalled CMS + invoicing system for a client and I need to get more stringent with my testing.
I keep all my data in a Django ORM and have a bunch of Celery tasks that run at different intervals that makes sure that new invoices and invoice reminders get sent and cuts of access when users don't pay their ... | Without the use of a special mock library, I propose to prepare the code for being in mock-up-mode (probably by a global variable). In mock-up-mode instead of calling the normal time-function (like time.time() or whatever) you could call a mock-up time-function which returns whatever you need in your special case.
I w... | 0.496174 | false | 1 | 1,872 |
2012-05-18 21:59:38.867 | Why would I write doctests in restructured text? | Another way to ask this:
If I wrote doctests in reST, can I use it for Sphinx or other automatic documentation efforts?
Background: I don't know how to use Sphinx and have not much experience with reST either, so I am wondering if I can use reST-written doctests somewhere else useful than with Sphinx? | Adding doctests to your documentation makes sense to ensure that code in your documentation is actually working as expected. So, you're testing your documentation. For general code-testing, using doctests can't be recommended at all. | 0 | false | 1 | 1,873 |
2012-05-19 13:55:50.880 | Eclipse plugin that just runs a python script | I want to generate an Eclipse plugin that just runs an existing Python script with parameters.
While this sounds very simple, I don't think it's easy to implement. I can generate a Eclipse plugin. My issue is not how to use PDE. But:
can I call the existing Python script from Java, from an Eclipse plugin?
it needs to ... | You can already create an External Launch config from Run>External Tools>External Tools Configurations. You are basically calling the program from eclipse. Any output should then show up in the eclipse Console view. External launch configs can also be turned into External Builders and attached to projects.
If you ar... | 1.2 | true | 1 | 1,874 |
2012-05-21 08:23:48.007 | Gtk.Treeview deselect row via signals and code | I'm using PyGObject but I think this is a question that could be adapted to all GTK, so if someone know how to do it using C or anything should work in python also.
I have two treeview, Active and Inactive, I load data from a Sqlite database and I can swap and drag & drop items from one to other.
This is just an aeste... | At the risk of being too basic (perhaps I misunderstand the problem), to manipulate treeview selections, you use the GtkTreeSelection object returned from GtkTreeView.get_selection. You can attach to signals on this object, change the current selection,etc. | 1.2 | true | 1 | 1,875 |
2012-05-21 16:49:42.467 | I have modulus and private exponent. How to construct RSA private key and sign a message? | I am newbie in cryptography and pycrypto.
I have modulus n and private exponent d. From what I understand after reading some docs private key consists of n and d.
I need to sign a message and I can't figure out how to do that using pycrypto. RSA.construct() method accepts a tuple. But I have to additionally provide p... | If you don't have the public exponent you may be able to guess it. Most of the time it's not a random prime but a static value. Try the values 65537 (hex 0x010001, the fourth number of Fermat), 3, 5, 7, 13 and 17 (in that order).
[EDIT] Simply sign with the private key and verify with the public key to see if the publi... | 0.265586 | false | 2 | 1,876 |
2012-05-21 16:49:42.467 | I have modulus and private exponent. How to construct RSA private key and sign a message? | I am newbie in cryptography and pycrypto.
I have modulus n and private exponent d. From what I understand after reading some docs private key consists of n and d.
I need to sign a message and I can't figure out how to do that using pycrypto. RSA.construct() method accepts a tuple. But I have to additionally provide p... | No, you can't compute e from d.
RSA is symmetric in d and e: you can equally-well interchange the roles of the public and the private keys. Of course, we choose one specially to be private and reveal the other -- but theoretically they do the same thing. Naturally, since you can't deduce the private key from the public... | 0.386912 | false | 2 | 1,876 |
2012-05-22 07:32:18.040 | queues remain unknown or just don't know how to call them | I've added a new queue to a python GAE app, and would like to add tasks to it, but always get an UnknownQueueError when I run my tests. On the other hand, I see the queue present in the GAE admin console (both local and remote). So the question is (1) do I miss something when I add a task to my queue? (2) if not, then ... | If your are running a unitest and using init_taskqueue_stub() you need to pass the path of the queue.yaml when calling it using the root_path parameter. | 0.386912 | false | 1 | 1,877 |
2012-05-22 14:00:55.520 | Get started with pystache | This is really a newbie question, but I don't know how to search answers for this. I want to use pystache, and I am able to execute the .py file to print out some rendered output from .mustache file. but how exactly do I convert this into .html file? Specifically, how to put it on the server so that the browser would d... | Pystache is a template library not http server! If you want make webapp try to use ready-made webframeworks like Django or Pyramid. | 1.2 | true | 1 | 1,878 |
2012-05-24 10:50:00.980 | Using a Ruby gem from a Django application | Lets say I have a few Ruby gems that I'd like to use from my Python (Django) application. I know this isn't the most straightforward question but let's assume that rewriting the Ruby gem in Python is a lot of work, how can I use it?
Should I create an XML-RPC wrapper around it using Rails and call it? Is there somethin... | It depends a little on what you need to do. The XML-RPC suggestion has already been made.
You might actually be able to use them together in a JVM, assuming you can accept running Django with jython and use jruby. But that is a bit of work, which may or may not be worth the effort.
It would perhaps be easier if you de... | 0.545705 | false | 2 | 1,879 |
2012-05-24 10:50:00.980 | Using a Ruby gem from a Django application | Lets say I have a few Ruby gems that I'd like to use from my Python (Django) application. I know this isn't the most straightforward question but let's assume that rewriting the Ruby gem in Python is a lot of work, how can I use it?
Should I create an XML-RPC wrapper around it using Rails and call it? Is there somethin... | I suggest you either:
Expose a ruby service using REST or XML-RPC.
or
Shell out to a ruby script from Django.
To transfer data between Python and Ruby I suggest you use JSON, XML or plain text (depending on what kind of data you need to transfer).
I would recommend to use option 2 (start a ruby script from the Pyt... | 1.2 | true | 2 | 1,879 |
2012-05-24 21:13:17.310 | Ubuntu Linux: terminal limits the output when I get the full Twitter Streaming API | I have this python script that outputs the Twitter Stream to my terminal console. Now here is the interesting thing:
* On snowleopard I get all the data I want.
* On Ubuntu (my pc) this data is limited and older data is deleted.
Both terminal consoles operate in Bash, so it has to be an OS thing presumably.
My question... | I'd also avoid doing this with a terminal, but to answer the question directly:
right click on the terminal window
profiles
profile preferences
scolling
scollback: unlimited
It's better though to redirect to a file, then access that file. "tail -f" is very helpful. | 0.265586 | false | 1 | 1,880 |
2012-05-25 12:32:08.597 | python eclipse dependency plugin - m2eclipse like | Is there any eclipse plugin for python dependency management? just like what M2Eclipse does for maven project? so I can resolve all the dependencies and get ride off all the errors when I develop python using pydev.
If there is no such plugin, how do I resolve the dependencies, do I have to install the dependency modul... | The only one so far I found available is PyFlakes, it does some level of dependency check and import validations. | 0 | false | 1 | 1,881 |
2012-05-25 20:27:42.020 | Changing python from 2.7 to 2.6 for omniidl | I have downloaded the omniORB4.1.6 pre-compiled with msvc10. I have python 2.7 and everything seems to work fine. I want to know how i can tell my omniidl to use my python 2.6 installation instead of 2.7. Can anyone help me? Thanks. | you can't and shouldn't. it is compiled specifically for 2.7. that's why "2.7" appears in the download file name.
if you want to use a different python, download the source package and build it yourself. | 0 | false | 1 | 1,882 |
2012-05-25 22:53:39.733 | Substring Counting in Python and Adding 2 Numbers From One Line of Input | I'm following a python website for my schoolwork. It's really neat, it gives you tasks to complete and compiles the code in the browser. Anyway, I came to a challenge that I'm not really sure how to go about.
One of the questions was:
The same substring may occur several times inside the same string: for example "asse... | the STRING.count method should work just fine for the first problem. If you look carefully, there actually aren't two non-overlapping 'sses' strings in assesses.
You either have a- sses -ses, or asse- sses. Do you see the issue? Calling "trans-Panamanian banana".count("an") produces the correct number.
I think using e... | 0 | false | 1 | 1,883 |
2012-05-26 06:03:09.267 | how do i change the value of os.path.expanduser("~") in python? | hi i am having trouble in running python IDLE.
once i have installed EMACS and uninstalled it, whenever i try to run python IDLE it gives me:
Warning: os.path.expanduser("~") points to
C:\Program Files\Emacs\,
but the path does not exist
the IDLE does work, but i can't launch IDLE by simply clicking on "open with IDLE"... | According to the doc,
On Windows, HOME and USERPROFILE will be used if set, otherwise a
combination of HOMEPATH and HOMEDRIVE will be used. An initial ~user
is handled by stripping the last directory component from the created
user path derived above.
You can try run 'set' in command prompt to see if these two... | 0.673066 | false | 1 | 1,884 |
2012-05-27 16:03:52.190 | Combining node.js and Python | Node.js is a perfect match for our web project, but there are few computational tasks for which we would prefer Python. We also already have a Python code for them.
We are highly concerned about speed, what is the most elegant way how to call a Python "worker" from node.js in an asynchronous non-blocking way? | If you arrange to have your Python worker in a separate process (either long-running server-type process or a spawned child on demand), your communication with it will be asynchronous on the node.js side. UNIX/TCP sockets and stdin/out/err communication are inherently async in node. | 0.386912 | false | 1 | 1,885 |
2012-05-28 06:22:04.623 | how to install library modules on python version which is not default | I have python 2.7 by default and 2.6 but I need some modules installed on python 2.6 .But by default it is installing on 2.7.Any idea how to do it. | If you explicitly call your Python 2.6 Binary when installing the package it will install to that instance instead. So instead of python setup.py install you would do /path/to/python26 setup.py install. | 1.2 | true | 1 | 1,886 |
2012-05-28 06:53:48.253 | Error importing persist module | I am using fedora and wxpython version 2.8.12 .While trying to import wx.lib.agw.persist
I am getting an error saying
Import Error: No module persist.
Will the module not be there by default with wxPython, if not how do I get this module installed? please help me. | wx.lib.agw.persist is new in 2.8.12.1. | 0.673066 | false | 1 | 1,887 |
2012-05-29 19:22:44.423 | Change color weight of raw image file | I am working on a telescope project and we are testing the CCD. Whenever we take pictures things are slightly pink-tinted and we need true color to correctly image galactic objects. I am planning on writing a small program in python or java to change the color weights but how can I access the weight of the color in a... | Typical white-balance issues are caused by differing proportions of red, green, and blue in the makeup of the light illuminating a scene, or differences in the sensitivities of the sensors to those colors. These errors are generally linear, so you correct for them by multiplying by the inverse of the error.
Suppose you... | 1.2 | true | 1 | 1,888 |
2012-05-30 13:09:04.707 | Setting up a Python environment in a Rails project | I have a Ruby on Rails project, using Python + Scrapy to scrape the web, and I would like to distribute and deploy the Rails project with all Python executables and libraries installed automatically.
The deployment environment ships by default a Python version lower than 2.6, and I would like users not to depend on OS... | Are all your (DTAP) environments using the same operating system and processor architecture?
If not, I wouldn't recommend shipping the Python interpreter with your project. Why don't you compile a more recent version of Python on your environments and install it in some non-standard path, like /opt/python27/ (or simili... | 1.2 | true | 1 | 1,889 |
2012-05-30 18:00:47.833 | Encrypt a file in python-gnupg using multiple keys | I am encrypting a file using python-gnupg and it looks like encrypt_file onlys accepts a single key for the sign parameter. If I have a key file with multiple keys that I want to encrypt the document with, how can I do this? If I understand correctly I should be able to encrypt a file using multiple keys. | Having re-read your question again after reading the python-gnupg documentation, I think you're asking about signing a document with several private keys at the same time you are encrypting it.
Unfortunately, that process is not supported by python-gnupg, because GnuPG does not support it either. You'll have to decide ... | 0 | false | 1 | 1,890 |
2012-05-30 19:52:53.463 | Pygame alpha values | I am new to using pygame and I was wondering if someone could explain the use of alpha values? I don't quite understand the difference between that and colorkey.
For my current situation I think I want to use alpha values but am not quite clear how.
In my game I have two sprites with .png files loaded to each surfac... | Although if you want the sprites to fade until they've vanished, gradually reduce the alpha value after they've collided. When alpha reaches 0, use del sprite if you don't need the sprites anymore. | 0 | false | 2 | 1,891 |
2012-05-30 19:52:53.463 | Pygame alpha values | I am new to using pygame and I was wondering if someone could explain the use of alpha values? I don't quite understand the difference between that and colorkey.
For my current situation I think I want to use alpha values but am not quite clear how.
In my game I have two sprites with .png files loaded to each surfac... | Colorkey lets you pick one color in a sprite (surface); any pixel of that color will be completely transparent. (If you remember .gif transparency, it's the same idea.)
'alpha' is a measure of opacity - 0 for completely transparent, 255 for completely opaque - and can be applied to an entire sprite (as an alpha plane) ... | 0.545705 | false | 2 | 1,891 |
2012-05-30 22:08:01.730 | Where does Python Imaging LIbrary Save Objects | I am using the Image.save method from PIL and I cannot find where the file is being placed. I have done a system search yet still no luck.
My code looks like this:
print imageObj.save(fileName, "JPEG")
and gives the proper None response to say that it is working. Any idea where they go and how I can find them?
Th... | You should pick a location to save the image when setting the filename variable.
filename = "/Users/clifgray/Desktop/filename.jpeg"
imgObj.save(filename) | 1.2 | true | 1 | 1,892 |
2012-05-31 01:12:34.593 | Database migrations on django production | From someone who has a django application in a non-trivial production environment, how do you handle database migrations? I know there is south, but it seems like that would miss quite a lot if anything substantial is involved.
The other two options (that I can think of or have used) is doing the changes on a test dat... | South isnt used everywhere. Like in my orgainzation we have 3 levels of code testing. One is local dev environment, one is staging dev enviroment, and third is that of a production .
Local Dev is on the developers hands where he can play according to his needs. Then comes staging dev which is kept identical to product... | 0.067922 | false | 2 | 1,893 |
2012-05-31 01:12:34.593 | Database migrations on django production | From someone who has a django application in a non-trivial production environment, how do you handle database migrations? I know there is south, but it seems like that would miss quite a lot if anything substantial is involved.
The other two options (that I can think of or have used) is doing the changes on a test dat... | If its not trivial, you should have pre-prod database/ app that mimic the production one. To avoid downtime on production. | 0 | false | 2 | 1,893 |
2012-05-31 09:25:48.213 | migrating data from tomcat .dbx files | I want to migrate data from an old Tomcat/Jetty website to a new one which runs on Python & Django. Ideally I would like to populate the new website by directly reading the data from the old database and storing them in the new one.
Problem is that the database I was given comes in the form of a bunch of WEB-INF/data/*... | The ".dbx" suffix has been used by various softwares over the years so it could be almost anything. The only way to know what you really have here is to browse the source code of the legacy java app (or the relevant doc or ask the author etc).
wrt/ scraping, it's probably going to be a lot of a pain for not much result... | 0 | false | 1 | 1,894 |
2012-05-31 14:56:09.437 | how to make wxpython password textctrl show chars? | With wxPython a password field could be created as:
wx.TextCtrl(frm, -1, '', style=wx.TE_PASSWORD )
I'm wondering if there is a way to dynamically change this password field into a normal textctrl, such that user could see what the password is. | then it would not be a password entry, but you can use style=wx.TE_MULTILINE or TE_RICH. if that is what you are asking.
Hope this helps | -0.135221 | false | 2 | 1,895 |
2012-05-31 14:56:09.437 | how to make wxpython password textctrl show chars? | With wxPython a password field could be created as:
wx.TextCtrl(frm, -1, '', style=wx.TE_PASSWORD )
I'm wondering if there is a way to dynamically change this password field into a normal textctrl, such that user could see what the password is. | I'm not aware of a way to dynamically change the style flags on the text control widget after creation. Some widgets allow this sort of thing on some OSes and some do not. You could just create two text controls with the second one in normal mode and hide it. Then when you want to toggle, you grab the password-protecte... | 0.386912 | false | 2 | 1,895 |
2012-05-31 18:12:23.147 | How to use pygame.MOUSEBUTTONDOWN? | My simple question is how can I use pygame.MOUSEBUTTONDOWN on a sprite or item to trigger an event?
e.g. I have item_A and want music to start when I press the object with my mouse. | You will need to poll for events in your main loop, and when you detect a MOUSEBUTTONDOWN event you will need to check if it's on the sprite you want, and if it is then start the music. | 0 | false | 1 | 1,896 |
2012-06-02 04:10:37.897 | Django Handle big files ( imageblob ) | I am writing a small gallery app and after extensive testing i submitted a 3mb image.
Basically the gallery app relies on another app that creates an UploadedFile instance for every image, however i see that for this specific image it has created 4 instances ( rows in db ) that belong to the same 3mb image, each image ... | It seems like the issue was the Jquery plugin that i was using to upload multiple files. The plugin was the one who split the file into chunks which were then sent individually as POST requests, and django didn't know that blob1, blob2, blob3, blob4 where the same file in chunks. | 1.2 | true | 1 | 1,897 |
2012-06-03 15:53:45.190 | Python: how to calculate data received and send between two ipaddresses and ports | I guess it's socket programming. But I have never done socket programming expect for running the tutorial examples while learning Python. I need some more ideas to implement this.
What I specifically need is to run a monitoring program of a server which will poll or listen to traffic being exchange from different IPs a... | IPTraf is an ncurses based IP LAN monitoring tool. Has a capability to generate network statistics including TCP,UDP,ICMP and some more.
Since you're thinking to execute it from python, you may consider to use screen (screen manager with VT100/ANSI terminal emulation) to overcome ncurses issues and you may want to pass... | 0 | false | 1 | 1,898 |
2012-06-03 23:59:08.540 | import error in eclipse, running an app as root | Im developing an installer for a GNU/Linux distribution in Python using Eclipse+PyDev. For some tasks on it there is needed that the program runs with root priviledges, but I run Eclipse as a common user.
I had searched a lot of stuff on the Internet about how to run an app as root without having to run Eclipse with pr... | It seems like your PYTHONPATH is different outside/inside Eclipse. Try just removing the Python interpreter and adding it again to gather new paths -- if that's not enough, do: import sys;print('\n'.join(sorted(sys.path))) outside/inside Eclipse to know what's different and fix your paths inside Eclipse. | 0 | false | 1 | 1,899 |
2012-06-04 06:16:17.643 | How do you find the CPU consumption for a piece of Python? | Background
I have a Django application, it works and responds pretty well on low load, but on high load like 100 users/sec, it consumes 100% CPU and then due to lack of CPU slows down.
Problem:
Profiling the application gives me time taken by functions.
This time increases on high load.
Time consumed may be due to com... | You could try configuring your test to ramp up slowly, slow enough so that you can see the CPU gradually increase and then run the profiler before you hit high CPU. There's no point trying to profile code when the CPU is maxed out because at this point everything will be slow. In fact, you really only need a relatively... | 1.2 | true | 1 | 1,900 |
2012-06-05 12:23:17.943 | Virtual brackets in Python | (Warning: Potential flame-war starter. This is however not my goal, the point here is not to discuss the design choices of Python, but to know how to make the best out of it).
Is there a program, script, method (Unix-based, ideally), to display "virtual" brackets around blocs of code in Python, and to keep them where t... | I used an editor that does code rollups and understood Python syntax, then I looked for rollups that are in unexpected locations. I don't remember if Kate does that. It's not obvious that there is an issue, but it makes it easier when you are looking for an issue. | 0.386912 | false | 1 | 1,901 |
2012-06-05 14:26:30.297 | Automating HTTP navigation and HTML printing using Python | Every Monday at Work, I have the task of printing out Account analysis (portfolio analysis) and Account Positions for over 50 accounts. So i go to the page, click "account analysis", enter the account name, click "format this page for printing", Print the output (excluding company disclosures), then I go back to the ac... | I think it will be easier for you get program like autoit. | 0 | false | 1 | 1,902 |
2012-06-05 23:01:32.297 | Compiling and running code as dmg or exe | Newbie question I am finding it hard to get my head around.
If I wanted to use one of the many tool out their like rsync lsync or s3cmd how can you build these into a program for none computer savvy people to use.
Ie I am comfortable opening terminal and running s3cmd which Is developed in python how would I go about d... | If you mean specifically with Python, as I gather from tagging that in your question, it won't simply run the same way as Java will, because there's no equivalent Virtual Machine.
If the user has a Python interpreter on their system, they they can simply run the .py file.
If they do not, you can bundle the interpreter ... | 0 | false | 1 | 1,903 |
2012-06-06 18:43:18.950 | Recommendation system - using different metrics | I'm looking to implement an item-based news recommendation system. There are several ways I want to track a user's interest in a news item; they include: rating (1-5), favorite, click-through, and time spent on news item.
My question: what are some good methods to use these different metrics for the recommendation syst... | For recommendation system, there are two problems:
how to quantify the user's interest in a certain item based on the numbers you collected
how to use the quantified interest data to recommend new items to the user
I guess you are more interested in the first problem.
To solve the first problem, you need either linea... | 0 | false | 2 | 1,904 |
2012-06-06 18:43:18.950 | Recommendation system - using different metrics | I'm looking to implement an item-based news recommendation system. There are several ways I want to track a user's interest in a news item; they include: rating (1-5), favorite, click-through, and time spent on news item.
My question: what are some good methods to use these different metrics for the recommendation syst... | Recommender systems in the land of research generally work on a scale of 1 - 5. It's quite nice to get such an explicit signal from a user. However I'd imagine the reality is that most users of your system would never actually give a rating, in which case you have nothing to work with.
Therefore I'd track page views b... | 0 | false | 2 | 1,904 |
2012-06-07 09:39:09.730 | How to simply create a list of CheckBox which has a dropdown list like a ComboBox with PyQt? | I'm new to PyQt and I have to work on an application which use it. For the moment, I don't have any problem, but I'm stuck on something. I have to create a "ComboBox with its items checkable, like a CheckBox". This ComboBox should contain many image format, like "jpg", "exr" or "tga", and I will have to pick up the tex... | You can do this using the model->view framework, but it means implementing a custom model to support checkable data.
You create a custom model by subclassing QAbstractItemModel. This presents an API to the QComboBox for accessing the underlying data. Off the top of my head I think you'll need to implement the flags met... | 1.2 | true | 1 | 1,905 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.