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
17,158,233
2013-06-17T23:01:00.000
-3
0
1
0
java,python,exception-handling
17,158,373
3
false
1
0
Best practice is to handle appropriate exceptions in the appropriate place. Only you, as developer, can decide which part of your code should catch exceptions. This should become apparent with decent unit testing. If you have unhandled exceptions, they will show up. You already described the differences. At a more fun...
2
9
0
I am original Java developer, for me, checked Exception in Java is obviously/easy enough for me to decide to catch or throw it to the caller to handle later. Then it comes Python, there is no checked exception, so conceptually, nothing forces you to handle anything(In my experience, you don't even know what exceptions ...
Exception Handling guideline- Python vs Java
-0.197375
0
0
2,973
17,159,576
2013-06-18T02:12:00.000
0
0
0
0
python,django,ip
17,159,679
4
false
1
0
Not in any reliable way, or at least not in Django. The problem is that user IPs are usually dynamic, hence the address is changing every couple of days. Also some ISPs soon will start to use a single IP for big blocks of users (forgot what this is called) since they are running out of IPv4 IP addresses... In other wor...
1
0
0
I have the user registration form made in django. I want to know the city from which the user is registering. Is there any way that i get the IP address of the user and then somehow get the city for that IP. using some API or something
Is there any simple way to store the user location while registering in database
0
1
0
163
17,160,797
2013-06-18T04:54:00.000
1
0
0
1
python,autobahn
17,166,189
1
true
1
0
There is no WAMP specific session close (since WAMP does not have a closing handshake separate from WebSocket). You can use the onClose hook. Another point you might have a look at: the recommended way of accessing databases from Twisted applications is via twisted.enterprise.adbapi which automatically manages a databa...
1
1
0
I'm using Autobahn Python to make a WAMP server. I open up a database connection in onSessionOpen of my subclass of WampServerProtocol, and of course need to close it when the connection closed. However, I can't find a session close handler in either the tutorials or the docs.
Is there a onSessionClose in WampServerProtocol?
1.2
0
0
156
17,162,992
2013-06-18T07:28:00.000
3
0
0
0
python,button,tkinter
17,163,119
1
true
0
1
Try calling .invoke() on the button
1
1
0
I'm trying do a very simple task: Make a Button click in Tkinter. I have an array of Buttons and, when I finish an event, I want to make a Button click event in one of my buttons. I thought it should be as simple as buttons[2].click(), but that doesn't do anything.
Make a click event in Tkinter
1.2
0
0
972
17,164,837
2013-06-18T09:07:00.000
1
0
0
0
python,hardware,pyglet
17,254,328
1
false
0
1
Problem solved. I give the answer in the unlikely case someone would encounter it : it was a driver settings issue : in AMD Vision Engine Control Center, I had to move performance vs. quality setting to max. performance. I have now similar performances on the 2 machines.
1
3
0
I changed my computer recently, and the very same program using Python and Pyglet runs a lot slower on the newer computer than on the old one (25 seconds vs. 10 seconds). The older was an Asus EEE 1015p, with the following specs : processor : Intel Atom N570 memory : 2 Gb gfx : Intel GMA 3150 OS : Windows 7 Starter Ed...
Pyglet slower on a faster computer
0.197375
0
0
270
17,168,883
2013-06-18T12:29:00.000
3
0
1
0
python,python-multithreading,locks
17,169,240
1
true
0
0
The best idea is to just not use threads at all. Most Python implementations have a global interpreter lock which eliminates the advantages of using threads in first place. If you're using threading to wait for IO, you can get the same or better performance if you just use asynchronous IO instead. If you're using threa...
1
1
0
i have a question regards python locks and threading, i realise locks are used to prevent variables from being overwritten by another thread, is it normal to use locks to get around this issue as it then means you can only run a single thread concurrently, it also means creating acquire/release locks for every variable...
python locking and threading concurrency
1.2
0
0
1,966
17,169,774
2013-06-18T13:11:00.000
3
0
1
0
python,windows
17,169,942
1
false
0
0
For Unix kernel two threads one reading and other writing to a file (socket) is same as two processes doing the same. As the kernel is capable of Multiplexing the IO you don't need to worry.
1
4
0
I want to have a reader thread & a writer thread to same TCP socket. Is it ok? Do I need to lock before accessing it ? Platform is Windows 7, CPython 2.7.4
Python : is it ok to threads read/write simultaneously to same TCP socket?
0.53705
0
0
1,224
17,171,843
2013-06-18T14:42:00.000
1
1
0
0
python,image,unit-testing,language-agnostic,integration-testing
21,843,350
1
true
0
0
Do you write your own library to convert images of you just use existing library? In the latter case you simply do not test it. Author has already tested it somehow. You just need to create an abstraction layer between your code and the image library you use. Then you can simply check if your code calls the library wit...
1
1
0
I'm writing an app that converts different images to JPG. It operates over a complex directory structure. There, a directory may include other directories, image files (JPG, GIF, PNG, TIFF), PDF files, RAR/ZIP archives, which in turn may include anything of the above. The app finds everything that can be converted to a...
Integration testing and images
1.2
0
0
271
17,173,464
2013-06-18T15:53:00.000
1
0
0
1
python,real-time,tornado
17,173,870
1
false
0
0
It really depends on what you want to do with the Tweets. Simply reading a stream of Tweets has not been an issue that I've seen. In fact that can be done on an AWS Micro Instance. I even run more advanced regression algorithms on the real-time feed. The scalability problem arises if you try to process a set of histori...
1
2
0
I am working on a project which is going to consume data from Twitter Stream API and count certain hashtags. But I have difficulties in understanding what kind architecture I need in my case. Should I use Tornado or is there more suitable frameworks for this?
Realtime data processing with Python
0.197375
0
0
1,294
17,180,409
2013-06-18T23:01:00.000
2
0
0
0
python,opencv,image-processing,frame,python-imaging-library
17,181,542
1
false
0
0
For effects like zooming in and out, optical flow seems the best choice. Search for research papers on "Shot Detection" for other possible approaches. As for the techniques you mention, did you apply some form of noise reduction before using them?
1
2
1
I have a sequence of actions taking place on a video like, say "zooming in and zooming out" a webpage. I want to catch the frames that had a visual change from a some previous frame and so on. Basically, want to catch the visual difference happening in the video. I have tried using feature detection using SURF. It just...
change detection on video frames
0.379949
0
0
371
17,181,923
2013-06-19T02:20:00.000
1
1
0
1
python,unit-testing,integration-testing,celery
18,316,377
1
false
1
0
I'm not sure if it's worthwhile to explicitly test the transportation mechanism (i.e. the sending of the task parameters through celery) using a unit test. Personally, I would write my test as follows (can be split up in several unit tests): Use the code from project B to generate a task with sample parameters. Encode...
1
6
0
I have the following setup: Django-Celery project A registers task foo Project B: Uses Celery's send_task to call foo Project A and project B have the same configuration: SQS, msgpack for serialization, gzip, etc. Each project lives on a different github repository I've unit-tested calls to "foo" in project A, wi...
Running a Celery worker in unittest
0.197375
0
0
774
17,183,068
2013-06-19T04:49:00.000
0
0
0
0
python,selenium-webdriver
17,183,255
2
false
1
0
Most of the times im using By.xpath and it works specially if you use contains in your xpath. For example : //*[contains(text(),'ABC')] This will look for all the elements that contains string 'ABC' In your case you can replace ABC with Delete Log File
1
0
0
I am very much new to selenium WebDriver and I am trying to automate a page which has a button named "Delete Log File". Using FireBug I got to know that, the HTML is described as and also the css selector is defined as "#DeleteLogButton" using firepath hence I used browser.find_element_by_css_selector("#DeleteLogBut...
Unable to locate the element while using selenium-webdriver
0
0
1
157
17,183,100
2013-06-19T04:51:00.000
0
0
1
0
python,automation
17,183,172
1
false
0
0
If the Info ur looking for is showed by IE you can obtain it by using xpath. If you want to make it automatic you could use selenium which works with webs as well. If the program doesnt provide an api then its not possible to interact with the program unless you get the output from a browser or you may use programs li...
1
0
0
For example, if the program did not provide an API, and I need it to do something from Python script, is this possible to do so? Let's give an example: I would like to copy the Product ID from the Internet Explorer's product ID everyday and new a text file named in this format: ddmmyyyy, and store on desktop. It is stu...
Is this possible to write a program to inter-act with existing software?
0
0
0
46
17,184,244
2013-06-19T06:25:00.000
0
0
0
1
python,celery,celery-task,celeryd
61,655,803
5
false
0
0
try to remove the .state file and if you are using a beat worker (celery worker -B) then remove the schedule file as well
2
15
0
I Have add some wrong task to a celery with redis broker but now I want to remove the incorrect task and I can't find any way to do this Is there some commands or some api to do this ?
how to remove task from celery with redis broker?
0
0
0
22,805
17,184,244
2013-06-19T06:25:00.000
3
0
0
1
python,celery,celery-task,celeryd
61,655,939
5
false
0
0
The simplest way is to use the celery control revoke [id1 [id2 [... [idN]]]] (do not forget to pass the -A project.application flag too). Where id1 to idN are task IDs. However, it is not guaranteed to succeed every time you run it, for valid reasons... Sure Celery has API for it. Here is an example how to do it from a...
2
15
0
I Have add some wrong task to a celery with redis broker but now I want to remove the incorrect task and I can't find any way to do this Is there some commands or some api to do this ?
how to remove task from celery with redis broker?
0.119427
0
0
22,805
17,185,238
2013-06-19T07:26:00.000
1
0
1
0
python,naming-conventions,naming,fabric
17,185,924
2
false
0
0
I don't know if there is any accepted practice for naming such things, but here is what the different names mean to me in case this is any help: install_nginx: This suggests the function is actually taking the nginx package from an external repository and installing it onto the server. setup_nginx: This suggests that ...
1
2
0
I often notice fabfiles in different projects having functions like below install_ngnix setup_ngnix deploy_ngnix My interpretation/naming preference is install_* for package install tasks but setup_* and deploy_* sounds very similar perhaps overlapping. I wonder what is generally accepted and better practice? And wha...
Naming fabric operations
0.099668
0
0
63
17,192,726
2013-06-19T13:37:00.000
0
0
1
0
matplotlib,ipython-notebook
17,193,682
1
false
0
0
They should not appear unless you explicitly create them. Are you by any chance renaming the notebook manually on the filesystem ?
1
0
0
I am just starting with iPython notebook --pylab inline. It works great for what I am doing. I am happily creating multiple notebooks for different areas that I am working on. However, on the first launch page in my browser (the one that lists all of the notebooks), I keep seeing new Unknown* notebooks appearing ove...
iPython notebook automatically creates new empty notebooks
0
0
0
141
17,193,457
2013-06-19T14:08:00.000
3
1
1
0
python,oop,static-methods
17,193,588
5
false
0
0
Python just doesn't do private. If you like you can follow convention and precede the name with a single underscore, but it's up to other coders to respect that in a gentlemanly† fashion † or gentlewomanly
1
25
0
I would like to have a function in my class, which I am going to use only inside methods of this class. I will not call it outside the implementations of these methods. In C++, I would use a method declared in the private section of the class. What is the best way to implement such a function in Python? I am thinking o...
Private methods in Python
0.119427
0
0
48,236
17,195,096
2013-06-19T15:20:00.000
0
0
1
0
javascript,python,ruby,node.js,opalrb
17,195,327
1
true
1
0
You shouldn't even need to understand the syntax of Javascript. Just an understanding of the DOM should suffice. Having said that, all the DOM examples will be in JS syntax, so reading them will be tricky. Being able to debug the transpiled javascript is also usefulo Correct. You can write a server an client with javas...
1
0
0
Newbie self-learner diving into web development here. My goal is to learn how to build web-apps. Three quick questions: Ruby and Python seem to have offshoots that compile their respective code to Javascript (i.e. Opal/Pyjamas). If I can get an understanding of the DOM, i.e. the DOM, do I have to even learn the f...
Languages compiling/interpreting to Javascript (such as Ruby/Python/Coffescript)
1.2
0
0
192
17,197,743
2013-06-19T17:40:00.000
13
0
1
1
python,linux,installation
17,201,432
1
true
0
0
As far as I know, there’s no automatic way to do this. But you can go into /usr/local and delete bin/pythonX and lib/pythonX (and maybe lib64/pythonX). But more generally, why bother? The whole point of altinstall is that many versions can live together. So you don't need to delete them. For your tests, what you shoul...
1
13
0
How do you cleanly remove Python when it was installed with make altinstall? I'm not finding an altuninstall or such in the makefile, nor does this seem to be a common question. In this case I'm working with Python 2.7.x in Ubuntu, but I expect the answer would apply to earlier and later versions/sub-versions. Why? I'm...
How do you cleanly remove Python when it was installed with 'make altinstall'?
1.2
0
0
18,817
17,199,544
2013-06-19T19:18:00.000
0
0
1
1
python,pip,mingw32
19,987,999
2
false
0
0
I've struggled with this issue for a while, and found that sometimes pip seems to ignore MSYS_HOME and can't find pydistutils.cfg, in which case the only recourse seems to be manually copying the pydistutils.cfg into your virtualenv right before running pip install. It sure would be great if someone could definitively ...
1
8
0
This has been asked and answered a few times, but as you'll see none of the previous answers work for me -- I feel like something had changed to make all the old answers outdated. Or at the very least, I'm in some kind of edge case: On a Windows 7 box, I've installed MinGW32 and Python 2.7 (32 bit version) (I've also t...
python - Getting Pip to use MinGW32 on Windows?
0
0
0
5,583
17,201,129
2013-06-19T20:54:00.000
5
0
0
1
python,windows
17,201,159
2
true
0
0
Mostly, yes, as long as you keep to using the tools Python provides you and don't write code that is platform specific. Use os.path.join() to build paths, for example. Open files in binary mode when you deal with binary data, text mode when it's text data. Etc. Python code itself is platform agnostic; the interpreter o...
1
4
0
I would like to write some Python code in Windows using QtPy. But before I do that I'd like to know that I can use the code I wrote in Python. I understand that the complied program won't work due to different platforms but will there be any issues with regards to the *.py files I write in windows vs linux? I've been t...
will python code written in windows work in linux?
1.2
0
0
7,110
17,207,280
2013-06-20T07:05:00.000
1
1
0
1
python,file-io,permissions
17,207,385
2
true
0
0
One option would be to do this somewhat sensitive "su" work in a background process that is disconnected from the web. Likely running via cron, this script would take the root owned log files, possibly change them to a format that the web-side code could deal with easily like loading them into a database, or merely unz...
1
0
0
The business case... The app server (Ubuntu/nginx/postgresql/python) that I use writes gzipped system log files as root to /var/log I need to present data from these log files to users' browsers My approach I need to do a fair bit of searching and string manipulation server side so I have a python script that deals wit...
Open root owned system files for reading with python
1.2
0
0
746
17,208,910
2013-06-20T08:34:00.000
1
0
0
1
python,linux
17,213,744
1
true
0
0
It depends on the distro you are using and the version of libguestfs, but let's assume Fedora/RHEL/Debian and you're using libguestfs ≥ 1.18. In that case for local mount functionality you will only need the basic library package, called libguestfs on Fedora-like or libguestfs0 on Debian-like distros. You may also wan...
1
0
0
I have created installer for Linux tool, this tool depends on libguestfs. The question is, what are the minimum required libguestfs packages I need to install in order for my tool to work?
What are the libguestfs basic packages
1.2
0
0
304
17,209,762
2013-06-20T09:13:00.000
0
0
0
0
opencv,python-2.7
17,212,232
1
false
0
0
Simplify edge A and B into a line equation (using only the few last pixels) Get the line equations of the two lines (form y = mx + b) Get the angle orientations of the two lines θ=atan|1/m| Subtract the two angles from each other Make sure to do the special case of infinite slope, and also do some simple math to get F...
1
1
1
i need to find out contact angle between 2 edges in an image using open cv and python so can anybody suggest me how to find it? if not code please let me know algorithm for the same.
to measure Contact Angle between 2 edges in an image
0
0
0
531
17,211,006
2013-06-20T10:12:00.000
1
0
0
0
python,qt,pyqt,pyside
17,515,469
2
false
0
1
I basically found out the solution: be sure you have QT >= 5 installed, since it has been introduced in that version, secondly I am now running python3.3. Enjoy your retina
1
3
0
Qt interfaces currently look horrible on a retina display as they scale up.Its possible to use an Info.Plist for a complied application but does anyone have a solution for dynamic python such as interfaces created in PySide?
Optimising Python QT apps on retina displays
0.099668
0
0
2,959
17,211,448
2013-06-20T10:36:00.000
1
0
1
0
python,hash
17,211,615
3
false
0
0
are you worried about collisions across OS's? is that your issue? But since you are only dealing with a few hundred of 5tuples cant you apply some kind of hash collusion resolution techniques like chaining or open addressing etc. If I am not missing anything else I believe the above method is better than devising a ne...
1
1
0
I identify Internet traffic flows by their 5-tuple (src IP, dst port, sport, dport, transport protocol number) and I would like turn this 5-tuple into a much more compact alphanumeric ID for internal use in my script. What choices do I have in Python? I read that the built-in function hash is only consistent OS-wise, s...
identify 5-tuple flows by hash value in Python
0.066568
0
0
1,599
17,213,515
2013-06-20T12:20:00.000
0
0
0
0
python,scrapy
17,213,740
3
true
1
0
Items in a database are have not a special order if you don't impose it. So you should add a timestamp to your table in the database, keep it up-to-date (mysql has a special flag to mark a field as auto-now) and use ORDER BY in your queries.
2
2
0
I am trying to put the items, scraped by my spider, in a mysql db via a mysql pipeline. Everything is working but i see some odd behaviour. I see that the filling of the database is not in the same order as the website itself. There is like a random order. Probably of the dictionary like list of the items scraped i gue...
Scrapy reversed item ordening for preparing in db
1.2
1
0
201
17,213,515
2013-06-20T12:20:00.000
1
0
0
0
python,scrapy
17,221,923
3
false
1
0
It's hard to say without the actual code, but in theory.. Scrapy is completely async, you cannot know the order of items that will be parsed and processed through the pipeline. But, you can control the behavior by "marking" each item with priority key. Add a field priority to your Item class, in the parse_item method o...
2
2
0
I am trying to put the items, scraped by my spider, in a mysql db via a mysql pipeline. Everything is working but i see some odd behaviour. I see that the filling of the database is not in the same order as the website itself. There is like a random order. Probably of the dictionary like list of the items scraped i gue...
Scrapy reversed item ordening for preparing in db
0.066568
1
0
201
17,213,899
2013-06-20T12:41:00.000
2
0
0
0
python
17,213,951
3
true
0
0
I'm guessing that it never writes a newline? If that's true, you need to sys.stdout.flush() occasionally.
2
0
0
I have a python script which has a while(1) condition , takes input from a table in database processes it and writes something to stdout but I am unable to redirect its output to a file.I tried all standard methods and found maybe because the script never stops and I have to stop it with Ctrl-Z it is unbale to append t...
Redirection of output in infinetely running python script
1.2
0
0
41
17,213,899
2013-06-20T12:41:00.000
1
0
0
0
python
17,214,078
3
false
0
0
You could also disable I/O buffering with the -u option: python -u yourscript.py. (This can diminish performance in some cases.)
2
0
0
I have a python script which has a while(1) condition , takes input from a table in database processes it and writes something to stdout but I am unable to redirect its output to a file.I tried all standard methods and found maybe because the script never stops and I have to stop it with Ctrl-Z it is unbale to append t...
Redirection of output in infinetely running python script
0.066568
0
0
41
17,215,202
2013-06-20T13:42:00.000
1
0
1
0
python,printing
17,225,483
1
false
0
1
If you are using IDLE, the default IDE that comes with Python for Windows you should be able to print your Python script with syntax highlighting from there. If you are looking for a script that takes a python file and then prints it with syntax highlighting, you'd need to provide more information as to what you are tr...
1
2
0
using 2.5.4 on windows 7 is there a simple way to print py files in color (as they appear on the screen) AND select a desired font? thanks Glen
Is there a way to print a py file in color?
0.197375
0
0
104
17,216,646
2013-06-20T14:42:00.000
0
0
0
0
android,python,django
17,216,777
1
true
1
0
That is not possible, as the history of google play only belongs to that particular app. App to app communication is not possible to take data, unless using a content provider. As every app is treated as a seperate user by the linux kernel.
1
1
0
for a website I am making in Django, I need to see what apps a user has downloaded in the past. I know I can federated login through Django and the OpenID to have users login through their google accounts. However, is there any API out there that can allow me to see what android applications this user has downloaded i...
API to access a user's download history in Google Play?
1.2
0
0
199
17,218,051
2013-06-20T15:44:00.000
0
0
0
0
python,indexing,scipy,rotatetransform,correspondence
18,653,827
1
true
0
0
After some time of debugging, I realized that depending on the angle - typically under and over n*45 degrees - scipy adds a row and a column to the output image. a simple test of the angle adding one to the indices solved my problem. I hope this can help the future reader of this topic.
1
1
1
I hope this hasn't already been answered but I haven't found this anywhere. My problem is quite simple : I'm trying to compute an oblic profile of an image using scipy. One great way to do it is to : locate the segment along which I want my profile by giving the beginning and the end of my segment, extract the minim...
finding corresponding pixels before and after scipy.ndimage.interpolate.rotate
1.2
0
0
131
17,218,183
2013-06-20T15:49:00.000
0
1
0
0
html,windows,python-2.7,command,command-prompt
17,218,531
1
false
1
0
I believe the correct answer is you cannot. Feel free to let me know otherwise if you find out a way to do it.
1
1
0
I would like to run the command python abc.py in the windows command prompt when the button on html page is clicked.The python file is located at C:/abc.py> I would like to know how to code the html page to do this process.Thank you for the help.
Running the Command on Windows Command prompt using HTML button
0
0
0
6,859
17,218,398
2013-06-20T16:00:00.000
1
0
0
1
python,types,raspberry-pi
17,218,735
3
true
0
0
There are multiple cache layers between a Python program and a database. In particular, the Linux disk block cache may keep your database in core depending on patterns of usage. Therefore, you should not assume that writing to a database and reading back is necessarily slower than some home-brew cache that you'd put in...
2
1
0
I am creating a weather station using a Raspberry Pi. I have a mySQL database setup for the different sensors (temp, humidity, pressure, rain, etc) and am now getting to processing the wind sensors. I have a python program that watches the GPIO pins for the anemometer and counts the pulses to calculate the wind speed....
Python "in memory DB style" data types
1.2
0
0
221
17,218,398
2013-06-20T16:00:00.000
0
0
0
1
python,types,raspberry-pi
17,218,570
3
false
0
0
In my general experience, it is easier to work with a dictionary keyed by datetime. A list of lists can get very confusing, very quickly. I'm not certain, however, how to best update a dictionary. It could be that my Python is rusty, but it would seem to me that dumping to a DB and reading back is a bit redundant, thou...
2
1
0
I am creating a weather station using a Raspberry Pi. I have a mySQL database setup for the different sensors (temp, humidity, pressure, rain, etc) and am now getting to processing the wind sensors. I have a python program that watches the GPIO pins for the anemometer and counts the pulses to calculate the wind speed....
Python "in memory DB style" data types
0
0
0
221
17,218,451
2013-06-20T16:03:00.000
0
0
1
0
python,regex,variables
17,218,529
2
false
0
0
How about a pattern "%s(.*?)%s" % (oneTwoThree, dF5)? Then you can do a re.search on that pattern and use the groups function on the result. Something on the lines of pattern = "%s(.*?)%s" % (oneTwoThree, dF5) matches = re.search(pattern, text) if matches: print matches.groups() re.findall, if used instead of r...
1
0
0
I've looked at several posts and other forums to find an answer related to my question, but nothing has come up specific to what I need. As a heads up, I'm new to programming and don't possess the basic foundation that most would. I know bash, little python, and decent with RE. I'm trying to create a python script, usi...
Using variable in regular expression in Python
0
0
0
1,615
17,219,344
2013-06-20T16:51:00.000
0
0
0
0
python,django,matlab,web-applications,octave
17,220,530
2
false
1
0
You could always just host the MATLAB code and sample .mat on a website for people to download and play with on their own machines if they have a MATLAB license. If you are looking at having some sort of embedded app on your website you are going to need to rewrite your code in another language. The project sounds d...
2
0
1
Hi I have a MATLAB function that graphs the trajectory of different divers (the Olympic sport diving) depending on the position of a slider at the bottom of the window. The file takes multiple .mat files (with trajectory information in 3 dimensions) as input. I am trying to put this MATLAB app on to the internet. What ...
MATLAB to web app
0
0
0
934
17,219,344
2013-06-20T16:51:00.000
1
0
0
0
python,django,matlab,web-applications,octave
17,224,492
2
false
1
0
A cheap and somewhat easy way (with limited functionality) would be: Install MATLAB on your server, or use the MATLAB Compiler to create a stand alone executable (not sure if that comes with your version of MATLAB or not). If you don't have the compiler and can't install MATLAB on your server, you could always go to a ...
2
0
1
Hi I have a MATLAB function that graphs the trajectory of different divers (the Olympic sport diving) depending on the position of a slider at the bottom of the window. The file takes multiple .mat files (with trajectory information in 3 dimensions) as input. I am trying to put this MATLAB app on to the internet. What ...
MATLAB to web app
0.099668
0
0
934
17,219,512
2013-06-20T16:59:00.000
0
0
0
0
python,authentication,client,restful-authentication
21,565,425
1
false
1
0
So, you've officially bumped into one of the most difficult questions in modern web development (in my humble opinion): web authentication. Here's the theory behind it (I'll answer your question in a moment). When you're building complicated apps with more than a few users, particularly if you're building apps that hav...
1
0
0
Here is the situation: We use Flask for a website application development.Also on the website sever, we host a RESTful service. And we use Flask-login for as the authentication tool, for BOTH the web application access and the RESTful service (access the Restful service from browsers). Later, we find that we need to, a...
Flask login together with client authentication methods for RESTful service
0
0
1
527
17,220,296
2013-06-20T17:43:00.000
0
0
1
0
python,iteration,complexity-theory
17,220,514
4
false
0
0
ninjagecko already answered the specific case of lists (and tuples FWIW), the general answer is : "it depends on the 'container' implementation" (I quote 'container' cause it can as well be a generator). For builtin types, you want sets or dicts for a fast lookup. Else you'd better check the doc or implementation for y...
2
3
0
I have a list of over 100000 values and I am iterating over these values and checking if each one is contained in another list of random values (of the same size). I am doing this by using if item[x] in randomList. How efficient is this? Does python do some sort of hashing for each container or is it internally doing a...
How efficient is Python's 'in' or 'not in' operators, for large lists?
0
0
0
2,792
17,220,296
2013-06-20T17:43:00.000
8
0
1
0
python,iteration,complexity-theory
17,220,436
4
true
0
0
in is implemented by the __contains__ magic method of the object it applies to, so the efficiency is dependent upon that. For instance, set, dict and frozenset will be hash based lookups, while list will require a linear search. However, xrange (or range in Python 3.x) has a __contains__ method that doesn't require a l...
2
3
0
I have a list of over 100000 values and I am iterating over these values and checking if each one is contained in another list of random values (of the same size). I am doing this by using if item[x] in randomList. How efficient is this? Does python do some sort of hashing for each container or is it internally doing a...
How efficient is Python's 'in' or 'not in' operators, for large lists?
1.2
0
0
2,792
17,220,385
2013-06-20T17:47:00.000
3
0
1
0
python,virtualenv,pyramid,setup.py
17,221,439
2
true
0
0
pip and setup.py develop should not to be mixed. The latter uses easy_install which is not compatible with pip in the case of namespace packages (these are packages that are installed as subpackages of another parent, such as zope.sqlalchemy installing only the .sqlalchemy part of the full zope.* package). Namespace pa...
2
6
0
I have installed pyramid and successfully created a project, but when I try to add new packages to the setup.py requirements they always give me a pkg_resources.DistributionNotFound error. The packages are installed, and this only happens if I try to install new packages after I run ../bin/python3.3 setup.py develop I...
How to install new packages for pyramid without getting a pkg_resources.DistributionNotFound: once a project has been created
1.2
0
0
2,273
17,220,385
2013-06-20T17:47:00.000
5
0
1
0
python,virtualenv,pyramid,setup.py
17,241,201
2
false
0
0
Using Michael's suggestions above, I was able to solve his issue. I didn't even need to install any packages manually. Once everything was working, if I added a requirement to my setup.py file (which is created when you make a pyramid project) and ran pip install -e . again everything was installed perfectly. The pro...
2
6
0
I have installed pyramid and successfully created a project, but when I try to add new packages to the setup.py requirements they always give me a pkg_resources.DistributionNotFound error. The packages are installed, and this only happens if I try to install new packages after I run ../bin/python3.3 setup.py develop I...
How to install new packages for pyramid without getting a pkg_resources.DistributionNotFound: once a project has been created
0.462117
0
0
2,273
17,221,936
2013-06-20T19:14:00.000
0
0
1
0
python,events
17,221,983
2
false
1
0
Instead of calling that function, make a function that calls both -function a (your function) -function b (the exit function code) call this meta function instead
1
1
0
I'm in the process of adding a bit of code to a django system that needs to make a specific function call upon exiting a function. Most of the code that I'm updating has several exit points throughout, which requires that I add a one-liner immediately before each one of them. A wee bit ugly. What I'd like to do is to...
Is there a way in python to trigger an action upon exiting a function
0
0
0
347
17,222,824
2013-06-20T20:06:00.000
4
0
0
0
python,sqlalchemy,flask,flask-sqlalchemy
17,223,377
1
true
1
0
The extensions exist to extend the functionality of Flask, and reduce the amount of code you need to write for common usage patterns, like integrating your application with SQLAlchemy in the case of flask-sqlalchemy, or login handling with flask-login. Basically just clean, reusable ways to do common things with a web ...
1
1
0
Lets take SQLAlchemy as an example. Why should I use the Flask SQLAlchemy extension instead of the normal SQLAlchemy module? What is the difference between those two? Isn't is perfectly possible to just use the normal module in your Flask app?
Why do Flask Extensions exist?
1.2
1
0
99
17,236,675
2013-06-21T13:37:00.000
0
0
0
1
python,linux,module,installation
63,105,985
6
false
0
0
You could also have a folder that contains all your global modules e.g. my_modules/ then localize the site-packages/ folder of the Python version your are using (you will find it easily by using this command: python -m site). Now, cd to this folder and create a custom file with a .pth extension. In this file, add the a...
1
14
0
I made myself a little module which I happen to use quite a lot. Whenever I need it I simply copy it to the folder in which I want to use it. Since I am lazy I wanted to install it so that I can call it from anywhere, even the interactive prompt. So I read a bit about installing here, and concluded I needed to copy the...
How to make my Python module available system wide on Linux?
0
0
0
38,144
17,241,004
2013-06-21T17:25:00.000
75
0
0
0
python,pandas
17,241,104
8
false
0
0
You can use df.index to access the index object and then get the values in a list using df.index.tolist(). Similarly, you can use df['col'].tolist() for Series.
1
289
1
Do you know how to get the index or column of a DataFrame as a NumPy array or python list?
How do I convert a pandas Series or index to a Numpy array?
1
0
0
558,431
17,242,048
2013-06-21T18:30:00.000
1
0
1
0
python,python-multithreading
17,278,340
2
true
0
0
Problem resolved. Pythoncom was included in my support libraries, but being a C extension my PyDev environment was not able to get the CoInitialize as a global variable. So I explicitly added CoInitialize through: Window->Preferences->PyDev->Editor->Code Analysis Here, in the 'Undefined' tab (since CoInitialize was com...
1
1
0
I am learning multithreading in Python. I was going through examples online and trying out multithreading for my WMI module which remotely connects to the remote machine. But, when I use pythoncom.CoInitialize(), it gives me an error saying that 'CoInitialize is an undefined variable'. I am unable to figure out what is...
CoInitialize() is undefined - Python error
1.2
0
0
2,434
17,242,335
2013-06-21T18:48:00.000
0
0
0
0
python,django,date,python-datetime
17,242,425
1
false
1
0
There's no predefined query field lookup that can do this for weeks. I'd either reuse code from the WeekArchiveView date-based generic view, or ideally directly subclass it - it already handles the filtering.
1
2
0
Is there a way to easily filter Date objects by week? Basically I want to do something like items= RelevantObject.objects.filter(date__week=32) I've found that it's possible to do this for year and month, but it doesn't seem like the capability for week is built in. Is there a "right" way to do this? It seems like it ...
Django filter by week
0
0
0
1,992
17,242,929
2013-06-21T19:29:00.000
1
0
0
0
selenium,python-3.x,local,phantomjs,webpage-screenshot
17,243,970
1
false
1
0
I feel silly now. I needed another forward slash driver.get("file:///
1
0
0
I am using Selenium with PhantomJS as the webdriver in order to render webpages using Python. The pages are on my local drive. I need to save a screenshot of the webpages. Right now, the pages all render completely black. The code works perfect on non-local webpages. Is there a way to specify that the page is local? I ...
Screenshot local page with Selenium and PhantomJS
0.197375
0
1
630
17,243,620
2013-06-21T20:16:00.000
20
1
1
0
python,python-2.7,python-3.x
17,243,722
3
false
0
0
Leaving aside the speed issue, which is often based on where you make the itemgetter or lambda function, I personally find that itemgetter is really nice for getting multiple items at once: for example, itemgetter(0, 4, 3, 9, 19, 20) will create a function that returns a tuple of the items at the specified indices of t...
1
40
0
I was curious if there was any indication of which of operator.itemgetter(0) or lambda x:x[0] is better to use, specifically in sorted() as the key keyword argument as that's the use that springs to mind first. Are there any known performance differences? Are there any PEP related preferences or guidance on the matter?
operator.itemgetter or lambda
1
0
0
10,179
17,243,749
2013-06-21T20:24:00.000
0
0
1
1
python,wxpython,coderunner
17,243,806
4
false
0
0
CodeRunner should work fine with Python 2.7, but you'll have to make sure that a compatible version of wxPython is installed in your site-packages. To verify that wxPython works correctly, you should start up a python instance in your terminal and run some test code (i.e., import the library and run some of the functio...
1
1
0
im using a program called CodeRunner to program Python code. I want to install wxpython but how do I figure out what version python im using? when i do python -v in Terminal it says im on 2.7, but is that the same version that CodeRunner is using? Is there a way for me to find out?
Python programming with CodeRunner
0
0
0
1,192
17,247,981
2013-06-22T06:27:00.000
3
0
1
0
python,proxy
20,379,881
2
false
0
0
Or use the HTTP_PROXY / HTTPS_PROXY setting instead.
1
9
0
I am not super technical person. But I know that in Windows if I install R using the internet2 option then I can download whatever package I want in it. I install Python and everytime I try to download a package or install a package (e.g. using easy_install) it fails. What can I do to make Python automatically detect ...
How to tell Python to automatically use the proxy setting in Windows XP like R's internet2 option?
0.291313
0
0
57,214
17,250,477
2013-06-22T12:00:00.000
4
0
1
0
python,customization
17,250,500
3
false
0
0
No, Python (and most mainstream languages) does not allow this kind of customization. In Python the restriction is quite intentional — an expression such as a equals b would look ungrammatical to any reader familiar with Python.
1
2
0
In order to make Python look more familiar, I've tried to assign an operator symbol to a variable's name,just for educational purposes: import operator equals = operator.eq This seems to work fine for equals(a,b) but not for a equals b Is there a way to express that a equals b instead of a == b
How to change the look of Python operators?
0.26052
0
0
170
17,252,951
2013-06-22T16:38:00.000
-1
0
1
0
python
17,253,029
5
false
0
0
not x is true for a wide variety of values, e.g. 0, None, "", False, [], {}, etc. x == None is only true for the one specific value None. If x is a class instance, then both not x and x == None will be false, but that doesn't mean that those are equivalent expressions. Fine; that previous paragraph should read: If x i...
1
9
0
Can not x and x==None give different answers if x is a class instance ? I mean how is not x evaluated if x is a class instance ?
Difference between 'not x' and 'x==None' in python
-0.039979
0
0
2,782
17,253,251
2013-06-22T17:10:00.000
0
0
1
0
python,arrays,file
17,253,278
2
false
0
0
In general, searching a file will be slower because hard drives are slow. Loading names and dates in your array will generally run faster, so first option will be better than the second.
1
0
0
I want to create a name-day calendar but I struggle with a question, what method is preferable Load all the names and dates in an array Create a file and search it every time I want to find what day corresponds to a specific name Other method?
Array vs file, in simple python app
0
0
0
36
17,253,919
2013-06-22T18:19:00.000
0
0
1
1
python,ascii,less-unix
17,254,020
2
false
0
0
is the remote machine maybe set to unicode (modern linux distros are), then make sure you are running putty with the unicode setting too.
1
1
0
I'm connected to a Linux machine using PuTTY. On the Linux machine, I'm running a python script that takes a list of characters and prints each character, together with its index, in order. Some of the characters in my list fall outside the range of printable ascii characters. These irregular characters are corrupting ...
How can I display out-of-range ascii characters?
0
0
0
527
17,254,295
2013-06-22T19:01:00.000
2
0
1
0
python,virtualenv,virtualenvwrapper
17,254,371
1
true
1
0
Only python packages installed inside virtualenvironment are isolated. System packages are not.
1
1
0
When I create a new virtualEnv, if I install Django inside a new environment, it's isolated. But what if I'm inside a virtualEnv and I install emacs, and mysql or such. These packages have nothing to do with python. Would the emacs and mysql packages that I installed be global or isolated to one virtualEnv only? Thank...
What exactly is virtualEnv isolating? Just python related packages or more?
1.2
0
0
457
17,254,603
2013-06-22T19:39:00.000
1
1
1
0
python,python-2.7,import,module
17,254,692
5
false
0
0
Interesting question. As you know, in PHP, you can separate your code by using include, which literally takes all the code in the included file and puts it wherever you called include. This is convenient for writing web applications because you can easily divide a page into parts (such as header, navigation, footer, et...
3
5
0
I come from a PHP (as well as a bunch of other stuff) background and I am playing around with Python. In PHP when I want to include another file I just do include or require and everything in that file is included. But it seems the recommended way to do stuff in python is from file import but that seems to be more for ...
Little confused with import python
0.039979
0
0
7,295
17,254,603
2013-06-22T19:39:00.000
0
1
1
0
python,python-2.7,import,module
17,257,186
5
false
0
0
There's an execfile() function which does something vaguely comparable with PHP's include, here, but it's almost certainly something you don't want to do. As others have said, it's just a different model and a different programming need in Python. Your code is going to go from function to function, and it doesn't reall...
3
5
0
I come from a PHP (as well as a bunch of other stuff) background and I am playing around with Python. In PHP when I want to include another file I just do include or require and everything in that file is included. But it seems the recommended way to do stuff in python is from file import but that seems to be more for ...
Little confused with import python
0
0
0
7,295
17,254,603
2013-06-22T19:39:00.000
1
1
1
0
python,python-2.7,import,module
17,255,642
5
false
0
0
On a technical level, a Python import is very similar to a PHP require, as it will execute the imported file. But since Python isn't designed to ultimately generate an HTML file, the way you use it is very different. Typically a Python file will on the module level not include much executable code at all, but definitio...
3
5
0
I come from a PHP (as well as a bunch of other stuff) background and I am playing around with Python. In PHP when I want to include another file I just do include or require and everything in that file is included. But it seems the recommended way to do stuff in python is from file import but that seems to be more for ...
Little confused with import python
0.039979
0
0
7,295
17,257,056
2013-06-23T01:56:00.000
2
0
0
0
python,numpy,matrix-inverse
17,257,084
1
true
0
0
It may very well have to do with the smallness of the values in the matrix. Some matrices that are not, in fact, mathematically singular (with a zero determinant) are totally singular from a practical point of view, in that the math library one is using cannot process them properly. Numerical analysis is tricky, as you...
1
1
1
While trying to compute inverse of a matrix in python using numpy.linalg.inv(matrix), I get singular matrix error. Why does it happen? Has it anything to do with the smallness of the values in the matrix. The numbers in my matrix are probabilities and add up to 1.
Inverse of a Matrix in Python
1.2
0
0
7,873
17,260,920
2013-06-23T12:53:00.000
2
0
0
0
python,django,class
17,261,090
1
true
1
0
I see a lot of reasons not to do it. I'm sure caching solutions offer robust solutions to memory management. This includes running as a daemon. Having cache invalidation, setting lifetimes on the data. By setting a classvariable, you are forgoing the above things. Additionally, caching solutions provide a clean do...
1
1
0
I have a class which parses multiple urls/feeds and stores hashes of entries. Formerly I had put the hashes into a session variable, but instead of hitting the db I now switched to a class variable in the form of {request.user.id : [hashes]}. Is this bad practice? Any reasons against it?
Django: Reasonable to store session data in Class Variable?
1.2
0
0
192
17,261,062
2013-06-23T13:11:00.000
0
0
1
0
python,math,calculator
17,261,126
4
false
0
0
most languages treat numbers starting with 0 as octal numbers, so 30 octal = 3 * 8 = 24
1
0
0
I want Python recognize numbers like 030 as 30. for some reason, when I write "print 030" it returns 24, when I write "print 020" it returns 16. What's the reason and How can I make it treat it as 30? Thanks
How Python treats numbers with 0 at the beginning?
0
0
0
133
17,262,542
2013-06-23T15:56:00.000
0
0
1
0
git,python-2.7,github,py2exe,gitignore
17,262,566
1
true
0
0
you can have .gitignore in each folder. And can use !*.pyc entry or sepcific files listed to unignore them.
1
0
0
I'm using py2exe to build windows executable from a python script. This creates a collect-2.7 directory which contains compiled version of all the core python files in .pyc. I need to commit these compiled files with the .exe to work with. But .pyc is added in .gitignore which omits the collect-2.7 directory. How coul...
How to add a directory which contains .pyc to git with .pyc in .gitignore?
1.2
0
0
100
17,263,509
2013-06-23T17:45:00.000
0
0
1
0
python,scrapy,twisted
29,180,806
3
false
1
0
Ensure you have the python development headers: apt-get install build-essential python-dev Install scrapy with pip: pip install Scrapy
1
5
0
In Ubuntu 13.04, I have installed Scrapy for python-2.7, from the tarball. Executing a crawl command results in the below error: ImportError: Error loading object 'scrapy.telnet.TelnetConsole': No module named conch I've also tried installing twisted conch using easy_install and using the tarball. I have also removed...
Error while using Scrapy : ['scrapy.telnet.TelnetConsole': No module named conch twisted]
0
0
0
3,304
17,263,517
2013-06-23T17:45:00.000
-2
0
0
0
python,python-2.7,pexpect
17,265,035
1
false
0
0
pexpect allows you to specify a list of prompts to match against, so it caters explicitly to your use case. Consult the docstring of pexpect.expect().
1
0
0
Script-1 can be run from a shell and will ask the user for 3 prompts, A, B, and C in that order. A or B will appear to the user, and C will always will appear. In other words, when Script-1 is run, the user will be prompted by question A or B. Once answered, the question C will always be prompted last. I want to write ...
Pexpect Multiple, Different Prompts
-0.379949
0
0
704
17,265,027
2013-06-19T20:39:00.000
0
0
0
0
python,http,dns
17,265,028
2
true
1
0
You can't. Pages not only can pages be dynamically generated based on backend database data and search queries or other input that your program supplies to the website, but there is a nearly infinite list of possible pages, and the only way to know which ones exist is to test and see. The closest you can get is to scra...
1
4
0
How would I scrape a domain to find all web pages and content? For example: www.example.com, www.example.com/index.html, www.example.com/about/index.html and so on.. I would like to do this in Python and preferable with Beautiful Soup if possible..
How can I find (and scrape) all web pages on a given domain using Python?
1.2
0
1
1,831
17,267,246
2013-06-24T02:27:00.000
0
0
1
0
python,algorithm
17,267,437
3
true
0
0
@Aswin's comment is interesting. If you are sorting each time you insert an item, the call to sort() is O(n) rather than the usual O(n*log(n)). This is due to the way the sort(timsort) is implemented. However on top of this, you'd need to shift a bunch of elements along the list to make space. This is also O(n), so ove...
1
3
0
What is the efficient way to read elements into a list and keep the list sorted apart from searching the place for a new element in the existing sorted list and inserting in there?
how to keep a list sorted as you read elements
1.2
0
0
566
17,268,766
2013-06-24T05:52:00.000
2
0
0
1
python,django,celery,django-celery,celery-task
17,270,294
1
true
1
0
For this type of situation I have in the past made a egg of all of my celery task code that I can simply rsync or copy in some fashion to my worker nodes. This way you can edit your celery code in a single project that can be used in your django and on your work nodes. So in summary create a web-app-celery-tasks projec...
1
1
0
I have a Django application which uses django-celery, celery and rabbitmq for offline, distributed processing. Now the setup is such that I need to run the celery tasks (and in turn celery workers) in other nodes in the network (different from where the Django web app is hosted). To do that, as I understand I will need...
How to seamlessly maintain code of django celery in a multi node environment
1.2
0
0
582
17,268,785
2013-06-24T05:53:00.000
3
0
1
0
python,python-2.7
17,268,865
1
true
0
0
Take this common module and repackage it as its own independent package, not in either of your web services. Then have the 2 web services (and any future ones) import this as an external module. And congratulations on thinking in terms of code reuse, and not just doing a quick-and-dirty copy/paste of the common module ...
1
1
0
Consider I have 2 web services in Python 2.7. Both have to use the same module I have developped (and may evolve). Now, the module's sources are in subfolder of the first application but I would want the second to use is too. What would be the best practice to share the module between both applications?
Best practice to share a module between 2 applications
1.2
0
0
88
17,270,259
2013-06-24T07:37:00.000
4
0
0
0
python,quickfix
17,277,267
2
true
1
0
This message has a repeating group of two MDEntries. Field 290 appears in the first one, but not the second one. Your code is probably trying to extract 290 from the second one, and is thus getting the error. Group 1 (has 290): 279=2☺55=ZN☺48=00A0IN00ZNZ☺10455=ZNU3☺167=FUT☺207=CBOT☺15=USD☺200=201309☺290=1☺269=0☺270=...
1
1
0
I send a standard Market Data Incremental Refresh Request message (35 = V) and begin receiving incremental refreshes. Most of the time everything is absolutely fine and dandy. However, every once in a while, I get a strange Field not found message. For example: (8=FIX.4.2☺9=00221☺35=X☺49=XXX☺56=XXX☺34=4☺52=20130624-07...
"Field not found" when field is present
1.2
0
0
2,904
17,270,293
2013-06-24T07:39:00.000
1
0
1
0
python,numpy,naming-conventions
17,270,654
2
false
0
0
numpy arrays and lists should occupy similar syntactic roles in your code and as such I wouldn't try to distinguish between them by naming conventions. Since everything in python is an object the usual naming conventions are there not to help distinguish type so much as usage. Data, whether represented in a list or a n...
2
2
1
PEP8 has naming conventions for e.g. functions (lowercase), classes (CamelCase) and constants (uppercase). It seems to me that distinguishing between numpy arrays and built-ins such as lists is probably more important as the same operators such as "+" actually mean something totally different. Does anyone have any nami...
how do you distinguish numpy arrays from Python's built-in objects
0.099668
0
0
415
17,270,293
2013-06-24T07:39:00.000
2
0
1
0
python,numpy,naming-conventions
17,270,547
2
false
0
0
You may use a prefix np_ for numpy arrays, thus distinguishing them from other variables.
2
2
1
PEP8 has naming conventions for e.g. functions (lowercase), classes (CamelCase) and constants (uppercase). It seems to me that distinguishing between numpy arrays and built-ins such as lists is probably more important as the same operators such as "+" actually mean something totally different. Does anyone have any nami...
how do you distinguish numpy arrays from Python's built-in objects
0.197375
0
0
415
17,270,474
2013-06-24T07:52:00.000
4
0
0
0
python,django,django-models,phone-number
17,270,535
3
true
1
0
I always use a simple CharField, since phone numbers differ so greatly from region to region and country to country. Some people might even use characters instead of numbers - according to the numeric keyboard on phones. Maybe adding a Choicefield for country prefix is a good idea, but that is as far as I would go. I w...
1
1
0
Trying to get the best way to store a phone # in Django. At the monent i'm using Charfield and checking if it's a number ...
What's the recommended way for storing a phone number?
1.2
0
0
191
17,270,936
2013-06-24T08:22:00.000
1
0
0
1
python,dbus
17,271,574
2
false
1
0
So does this mean that my website needs to run a DBUS service to allow me to call methods from it into my program? A dbus background process (a daemon) would run on your web server, yes. In fact dbus provides two daemons. One is a system daemon which permits objects to receive system information (e.g. printer availabi...
1
1
0
Ok, so, I might be missing the plot a bit here, but would really like some help. I am quite new to development etc. and have now come to a point where I need to implement DBus (or some other inter-program communication). I am finding the concept a bit hard to understand though. My implementation will be to use an HTML ...
Confused about DBus
0.099668
0
0
460
17,271,272
2013-06-24T08:41:00.000
0
0
1
0
python-2.7
17,271,340
2
false
0
0
If you know what attributes you're looking for, you can match them against dir(parent class)
1
1
0
I have to add all the variables exist in parent class in one list in child class. However all the variables in the parent class is not mandatory. Is there any way i can figure out if variable exist in parent class or not ??
how to verify if variable exist in parent class in python
0
0
0
431
17,271,319
2013-06-24T08:44:00.000
-3
0
1
0
python,macos,pip,installation
40,502,894
21
false
0
0
I recommend Anaconda to you. It's the leading open data science platform powered by Python. There are many basic packages installed. Anaconda (conda) comes with its own installation of pip.
1
1,672
0
I spent most of the day yesterday searching for a clear answer for installing pip (package manager for Python). I can't find a good solution. How do I install it?
How do I install pip on macOS or OS X?
-0.028564
0
0
2,711,123
17,271,955
2013-06-24T09:17:00.000
1
0
0
0
java,python,django,converter
17,273,153
1
true
1
0
Sorry, I can't comment as I have low rep. But would it be an option to parse the python into JSON objects, and Java use Jackson or GSON to parse them back into class objects?
1
0
0
I'm looking for a good way to "copy" / convert a model from Python source code to Java source code. My idea is to use the Python django framework on a server to generate entity model classes. On the other side I would like to convert the entity classes to Java to use them in a native Android project. Do you have any re...
Good way to convert Python (django) entity classes to Java
1.2
0
0
999
17,272,210
2013-06-24T09:31:00.000
0
0
1
0
python,python-3.x
17,272,608
2
false
0
0
Any methods not overridden in the child are looked for in the parents. This includes the initializer, __init__(). If you do not define this in the child then the parent's method is called, initializing the object as it would an instance of the parent.
1
0
0
When you inherit from a parent class in python 3.x does the parent class 'empty' its default values, and do you have to re-define them?
Inheriting from a parent class in python 3.x
0
0
0
71
17,274,626
2013-06-24T11:41:00.000
0
0
0
0
python,python-3.x,sqlite
17,275,138
1
false
0
0
This will work just fine. When two threads are trying to create the same file, one will fail to do so, but it will continue to try to lock the file.
1
1
0
I would like to save data to sqlite3 databases which will be fetched from the remote system by FTP. Each database would be given a name that is an encoding of the time and date with a resolution of 1 hour (i.e. a new database every hour). From the Python 3 sqlite3 library, would any problems be encountered if two threa...
Can sqlite3 databases be created in a thread-safe way?
0
1
0
426
17,276,970
2013-06-24T13:41:00.000
0
0
0
0
python,database,flask,flask-sqlalchemy
17,289,054
2
false
1
0
It's not an efficient model, but this would work: You can write three different APIs (RESTful pattern is a good idea). Each will be an independent Flask application, listening on a different port (likely over localhost, not the public IP interface). A forth Flask application is your main application that external clien...
1
3
0
I have a flask application which use three types of databases - MySQL, Mongo and Redis. Now, if it had been simple MySQL I could have use SQLAlchemy or something on that line for database modelling. Now, in the current scenario where I am using many different types of database in a single application, I think I will ha...
How to create models if I am using various types of database simultaneously?
0
1
0
79
17,279,906
2013-06-24T16:02:00.000
0
0
0
1
python,linux,http,proxy,urllib2
17,279,971
1
false
0
0
Permanent network settings are stored in various files in /etc/networking and /etc/network-scripts. You could use diff to compare what's in those files between the system. However, that's just the network stuff (static v.s. dynamic, routes, gateways, iptables firewalls, blah blah blah). If there's no differences there,...
1
0
0
I'm having a pretty unique problem. I'm using the python module urllib2 in order to get http responses from a local terminal. At first, urllib2 would only work with non-local addresses (i.e. google.com, etc.) and not local webservers. I eventually deduced that urllib2 was not respecting the no_proxy environment variabl...
Is there an easy way to tell the difference in network settings between two systems running Fedora 12?
0
0
1
73
17,280,297
2013-06-24T16:24:00.000
1
0
0
0
python,bots,mediawiki-api
17,282,177
1
true
1
0
You can create a new article simply by editing a page that doesn't exist yet.
1
1
0
I've been charged with migrating a large amount of simple web pages into wikiMedia articles. I've been researching the API and PyWikiBot but it seems that all it allows you to do is edit and retrieve what is already there. Can these tools be used to create a brand new article with content, a title and links to itself e...
MediaWiki API: can it be used to create new articles programatically?
1.2
0
1
94
17,285,540
2013-06-24T21:35:00.000
0
0
0
0
python,3d,maya
17,289,834
1
false
0
0
The tech part is pretty easy. If you're already storing everything locally, it's all root-relative to start with, which is the best way to do it. If you need to do things in world space you can do them using xform(t = (x,y,z) ws = True) to move them around in world space rather than relative. It sounds like the problem...
1
0
0
So I've been developing a pose library tool for the studio I intern at. I have it pretty much done but when testing I realized a pretty big flaw with the tool. When I set the pose it's positions are based on the local space to it's parent, but the parent is a move scale rotate curve. When an animator sets the pose and...
Maya Pose Library - attribute set offset
0
0
0
432
17,286,096
2013-06-24T22:18:00.000
4
0
1
0
python,file,dictionary
17,286,234
2
true
0
0
I would suggest the following 3 pass solution: Iterate over your original dictionary file once, adding a val, key line to your output file for each val as you go. Sort the output file from step 1 using the unix sort command or some other fast sorting program. If there is a possibility that step 1 produced duplicates t...
1
0
0
Been having trouble efficiently inverting (swapping the values for keys and the keys for values) a large (2.8GB) dictionary stored in a file. Efficiency is the problem, my current solution is to: Read the dictionary file line by line (format: ,,,...) For each line: Run through the in-progress output file from the pre...
Efficient dictionary inversion on dictionary like file
1.2
0
0
139
17,287,996
2013-06-25T02:02:00.000
1
0
0
0
python,django,django-south,database-migration
17,293,912
3
false
1
0
If you have installed South in your virtualenv then, once you are in the virtualenv, try to execute python manage.py help instead of ./manage.py help.
3
3
0
When I do a "./manage.py help", it gives me NO south commands, although South has been installed. I have the latest version of south installed for my django project, which is South==0.8.1. I have added "south" to my INSTALLED_APPS in settings.py I have done a manage.py syncdb, and there is a "south_migrationhistory" da...
Django Manage.py Gives No South Commands
0.066568
0
0
379
17,287,996
2013-06-25T02:02:00.000
0
0
0
0
python,django,django-south,database-migration
23,678,798
3
false
1
0
You might want to check if the INSTALLED_APPS is not overwritten somewhere outside the settings.py file. E.g. if you are using a separate settings file for a local settings.
3
3
0
When I do a "./manage.py help", it gives me NO south commands, although South has been installed. I have the latest version of south installed for my django project, which is South==0.8.1. I have added "south" to my INSTALLED_APPS in settings.py I have done a manage.py syncdb, and there is a "south_migrationhistory" da...
Django Manage.py Gives No South Commands
0
0
0
379
17,287,996
2013-06-25T02:02:00.000
0
0
0
0
python,django,django-south,database-migration
17,291,512
3
false
1
0
If you're using virtualenv, ensure that it is activated when running ./manage.py help command. Django will just pass all import errors when showing available commands.
3
3
0
When I do a "./manage.py help", it gives me NO south commands, although South has been installed. I have the latest version of south installed for my django project, which is South==0.8.1. I have added "south" to my INSTALLED_APPS in settings.py I have done a manage.py syncdb, and there is a "south_migrationhistory" da...
Django Manage.py Gives No South Commands
0
0
0
379
17,290,130
2013-06-25T05:58:00.000
1
0
1
0
python,web-scraping
17,290,354
1
false
0
0
No; it is not uncommon for web pages to be identical in the first 1024 bytes. For example, many complex sites have JavaScript, CSS, and boilerplate HTML at the top of the HTML file which far exceed the 1024 bytes you have budgeted. Some experimentation with real-life data may reveal a reasonable buffer, but there is s...
1
0
0
I'm creating a Python program that determines if a file from a website is already available on my computer (already downloaded), and my way of determining that is I get the MD5 of that file from the website, then compare it with the MD5 records of files stored in my database. My concern is this procedure will be very s...
Is it okay to rely on the MD5 check sum based on the first 1024 bytes of a file for file duplicate comparison?
0.197375
0
0
156
17,290,936
2013-06-25T06:52:00.000
0
0
1
1
python,linux,scientific-computing
17,291,000
2
false
0
0
There will not be any problem if you change the way of packaging. Ubuntu needs a different type of packaging while centos needs another type. Build your package and pack it in such a way as normal centos packages and then use it in centos
2
1
0
Is it problematic to build python packages (numpy, scipy, matplotlib, h5py,...) on one linux distro (ubuntu) and run them from another distro (centos)? I am asking this because our computing cluster has centos machines while my pc is ubuntu.
building python packages on one linux distro and running them from another
0
0
0
36
17,290,936
2013-06-25T06:52:00.000
0
0
1
1
python,linux,scientific-computing
17,291,237
2
false
0
0
Use distutils to package as eggs and specify the dependencies you should not have too many problems - the pyo files that are zipped into the eggs work fine across platforms. You might like to take a look at pypiserver to set up a local pypi that you can pip from.
2
1
0
Is it problematic to build python packages (numpy, scipy, matplotlib, h5py,...) on one linux distro (ubuntu) and run them from another distro (centos)? I am asking this because our computing cluster has centos machines while my pc is ubuntu.
building python packages on one linux distro and running them from another
0
0
0
36
17,291,455
2013-06-25T07:23:00.000
3
0
1
0
python,image,python-imaging-library
17,291,771
6
false
0
0
I would consider creating an array of x by y integers all starting at (0, 0, 0) and then for each pixel in each file add the RGB value in, divide all the values by the number of images and then create the image from that - you will probably find that numpy can help.
1
25
0
For example, I have 100 pictures whose resolution is the same, and I want to merge them into one picture. For the final picture, the RGB value of each pixel is the average of the 100 pictures' at that position. I know the getdata function can work in this situation, but is there a simpler and faster way to do this in P...
How to get an average picture from 100 pictures using PIL?
0.099668
0
0
40,383
17,293,311
2013-06-25T09:09:00.000
4
0
0
0
python,flask
17,308,839
6
false
1
0
I had a similar problem with my blog. I wanted to send notification emails to those subscribed to comments when a new comment was posted, but I did not want to have the person posting the comment waiting for all the emails to be sent before he gets his response. I used a multiprocessing.Pool for this. I started a pool ...
1
30
0
Is there a way in Flask to send the response to the client and then continue doing some processing? I have a few book-keeping tasks which are to be done, but I don't want to keep the client waiting. Note that these are actually really fast things I wish to do, thus creating a new thread, or using a queue, isn't really ...
Flask end response and continue processing
0.132549
0
0
24,216
17,299,364
2013-06-25T14:00:00.000
-1
0
0
0
python,excel,xlrd,xlwt,openpyxl
17,305,443
12
false
0
0
Unfortunately there isn't really a better way to do in that read in the file, and use a library like xlwt to write out a new excel file (with your new row inserted at the top). Excel doesn't work like a database that you can read and and append to. You unfortunately just have to read in the information and manipulate...
1
19
0
I'm looking for the best approach for inserting a row into a spreadsheet using openpyxl. Effectively, I have a spreadsheet (Excel 2007) which has a header row, followed by (at most) a few thousand rows of data. I'm looking to insert the row as the first row of actual data, so after the header. My understanding is that ...
Insert row into Excel spreadsheet using openpyxl in Python
-0.016665
1
0
90,928
17,300,419
2013-06-25T14:43:00.000
1
0
1
0
python,algorithm,sorting
17,300,620
4
false
0
0
Have a list of size 20 tupples initialised with less than the minimum result of the calculation and two indices of -1. On calculating a result append it to the results list, with the indices of the pair that resulted, sort on the value only and trim the list to length 20. Should be reasonably efficient as you only e...
1
7
1
I am thinking about a problem I haven't encountered before and I'm trying to determine the most efficient algorithm to use. I am iterating over two lists, using each pair of elements to calculate a value that I wish to sort on. My end goal is to obtain the top twenty results. I could store the results in a third list, ...
Python Sort On The Fly
0.049958
0
0
911
17,301,571
2013-06-25T15:36:00.000
1
0
0
1
python,pipe
17,301,654
2
false
0
0
Take a look at subprocess communicate and pipe examples.
1
1
0
I am trying to run a command exe from Python while passing in parameters. I have looked at a few other question, and the reason why my question is different is because I first want to call a cmd exe program while passing in some parameters, then I have to wait for 10 sec for the exe to prompt me for some username, and ...
Calling command exe with python
0.099668
0
0
218
17,302,404
2013-06-25T16:15:00.000
1
0
1
1
python,windows,relative-path
17,302,657
1
false
0
0
Just try '.\file_name' as your path 2 issues . = current directory, (.. is up one), and you need to escape the \ as \ if using windows file separators.
1
0
0
I'm a very new python user using python 2.6.2 and my question is simple. I want to only have the relative path "\file_name" in an input file instead of the full path like "c:\folder_a\folder_b\file_name" but when I use the relevant path in my input files I get the error "Windows Error [Error 2]: The system cannot find...
Using only relative path instead of full path
0.197375
0
0
98