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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
18,538,170 | 2013-08-30T17:09:00.000 | 0 | 0 | 0 | 0 | java,c++,python,interface,integration | 18,609,443 | 3 | true | 1 | 1 | gcj (gcc compiler for java) supports java 1.5 syntax (1.4 is working better on it) and therefore some Java programs may be compiled to native code. gcjh (or javah) can produce headers for java libraries, so you can write C extensions for python. Of course some libraries could not be compiled with gcj (like Apache Commo... | 2 | 1 | 0 | I implemented most of my projects in C++ and python. However, we recently got a new database interface that I could only use Java to retrieve data.
I want to stay with my Python/C++ tools but I am wondering if there is a good solution to integrate Java to my Python application. I heard about Jython, but it is a differ... | Python Integration with Java / C | 1.2 | 0 | 0 | 251 |
18,538,170 | 2013-08-30T17:09:00.000 | 0 | 0 | 0 | 0 | java,c++,python,interface,integration | 18,538,315 | 3 | false | 1 | 1 | One way to do this is to write web services. A web service can accept an HTTP request, marshal it into a data request, pass that to a Java class that get the data out, map the quert results into a response of some kind, and send it back.
Any client that can send an HTTP request, accept the response and unmarshal it ca... | 2 | 1 | 0 | I implemented most of my projects in C++ and python. However, we recently got a new database interface that I could only use Java to retrieve data.
I want to stay with my Python/C++ tools but I am wondering if there is a good solution to integrate Java to my Python application. I heard about Jython, but it is a differ... | Python Integration with Java / C | 0 | 0 | 0 | 251 |
18,540,987 | 2013-08-30T20:28:00.000 | 0 | 1 | 0 | 0 | python,sqlite,search,flask,typeahead | 18,541,075 | 2 | false | 1 | 0 | You are looking for "partial matches". I would load all possible names into an array, and sort them. Then I would separately create a (26x26) lookup array that shows the index of the first element in the list of names that corresponds to a combination of the first two letters; you might also have a dict (rather than an... | 1 | 0 | 0 | I am developing my first Flask application (with sqlite as a database). It takes a single name from user as a query, and displays information about this name as a response.
All working well, but I want to implement typeahead.js to make better user experience. Typeahead.js sends requests to server as user types, and sug... | Fastest text search in Python | 0 | 0 | 0 | 1,008 |
18,541,427 | 2013-08-30T21:02:00.000 | 0 | 0 | 1 | 1 | python,linux,file-extension,file-type | 18,541,480 | 2 | false | 0 | 0 | Ultimately, there is no absolute way of knowing. For several reasons:
Some file format use simple identifiers, but others don't.
For those that don't, the only way is analyzing the behavior of a program able to able the format. If the program can successfully open the file, then it belongs to it.
But if not, the fil... | 1 | 0 | 0 | I want to check if a given file's extension is correct or not. For example, someone give me a file with an extension .zip but actually it may be an executable.
Using mimetypes I could not determine a file's real type. As far as I see, mimetypes needs an extension.
I can map the output of unix file command with some ext... | File extension validation with python | 0 | 0 | 0 | 1,133 |
18,543,447 | 2013-08-31T01:03:00.000 | 1 | 0 | 1 | 1 | python,python-2.7,python-3.x,subprocess,fork | 18,543,541 | 1 | false | 0 | 0 | Take a look at multiprocess.Process | 1 | 0 | 0 | I have a function dosomething() inside which am doing a os.chroot(). A process running chroot() cannot get out of chroot jail. So i want this dosomething() to run as a child process in the main program and i need to wait till the child process gets over . What is the simplest way to do this ? | How to run a function as a child process in python? | 0.197375 | 0 | 0 | 160 |
18,546,053 | 2013-08-31T08:14:00.000 | 0 | 0 | 1 | 0 | python,regex | 61,012,316 | 4 | false | 0 | 0 | The solution I'm currently using to accept http / https only, username:password optionally and host as an IP or domain name is the following:
^(?:https?:\/\/)(?:(\w+)(?::(\w*))@)?([a-zA-Z0-9][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9]{0,1}\.([a-zA-Z]{1,6}|[a-zA-Z0-9-]{1,30}\.[a-zA-Z]{2,3})|((?:\d{1,3})(?:\.\d{1,3}){3}))(?::(\d{1,5... | 1 | 0 | 0 | I need to match both formats like: user:pass@112.213.123.12:3847 and 111.23.123.78:2938, how do you do that(match valid proxy only)?
And by the way, is there such module(validate proxy formats) in python already? | How to perfectly match a proxy with regex? | 0 | 0 | 1 | 3,078 |
18,546,103 | 2013-08-31T08:21:00.000 | -1 | 0 | 1 | 0 | python,python-3.x | 18,546,144 | 2 | false | 0 | 0 | Entering multiple lines: use three quotation marks thusly:
"""hello
this is multiple
lines"""
count lines... len(text.split()) or len(text.split('\n')) etc | 1 | 1 | 0 | I have to write a code which recognizes a text line by line and reverses each line in the output, I dont know how to enter a text with multiple lines (as "input()" function will take the input after the first "Enter" but I still want to enter more lines?
second I don't know how to count the input line by line? whould ... | How to show EOF in Python? / how to identify lines? | -0.099668 | 0 | 0 | 105 |
18,546,876 | 2013-08-31T10:02:00.000 | 0 | 0 | 0 | 0 | python,tkinter | 18,548,116 | 1 | true | 0 | 1 | You can't, if you're talking about the native menubar you get when you set the menu attribute of the root window.
You can create your own menubar that behaves a little bit like a menubar by using a frame and one or more menubuttons, and place that at the bottom. | 1 | 0 | 0 | I have a program thats like a desktop enviroment with educational games and I was wondering how to put the menubar on the bottom of the window.
Thanks In Advance! | tkinter - Change menubar location | 1.2 | 0 | 0 | 269 |
18,547,065 | 2013-08-31T10:22:00.000 | 0 | 0 | 1 | 0 | python,eclipse,console,pydev | 22,821,015 | 2 | false | 0 | 0 | Do a ctrl+alt+enter in the coding window (with a console open or not) and you will automatically load the current code for use. | 1 | 1 | 0 | I use Eclipse with pydev for python development. I would like to test my code using pydev's interactive python console. When I make a change in the code, interactive pydev console doesn't notice it, and i have to close the current pydev console and open a new one to reflect the changes. Is there an easier way to get th... | How to restart pydev interactive console after a code change? | 0 | 0 | 0 | 1,638 |
18,553,849 | 2013-08-31T23:44:00.000 | 14 | 0 | 0 | 0 | java,android,python,kivy | 18,563,503 | 2 | false | 0 | 1 | To complete inclement's answer, pyjnius indeed allows to access a lot of the android api. But it's not perfect, calling existing classes is not always enough, and an android programmer often need to create code that will be called by android to manage events, there are two ways to do that, both used by the android api.... | 1 | 21 | 0 | I'm a python developer with little experience creating android apps in java and want to create an app that will access my university web portal, retrieve some data and show on a view.
So, after researching Kivy, I have a few questions:
1) Which one is easier and faster to develop android apps?
2) Does Kivy have any and... | Difference between Kivy and Java for android apps | 1 | 0 | 0 | 11,995 |
18,554,799 | 2013-09-01T03:01:00.000 | 1 | 0 | 1 | 0 | python,json,csv,python-2.7,python-3.x | 18,806,638 | 1 | true | 0 | 0 | I found the solution. While parsing the string, I converted the string to unicode using the unicode() function:
unicode(stringname, errors='replace')
and it replaced all the erroneous symbols. | 1 | 0 | 0 | I am trying to convert a csv file to a json file. The whole code runs fine but when I encounter the statement:
json.dump(DictName, out_file)
I get the following error:
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 15: invalid start byte
Would someone please be able to help?
TIA. | Want the code to read ' instead of ’ | 1.2 | 0 | 0 | 61 |
18,555,139 | 2013-09-01T04:10:00.000 | 0 | 0 | 0 | 0 | python,node.js,socket.io | 18,555,399 | 1 | true | 0 | 0 | Assuming your Python objects are simple enough (not instances of classes, say), just send a JSON representation (json.dumps()) of them to the socket.io side. I am assuming you can parse JSON on the client side if needed. | 1 | 0 | 0 | Ok so what I'd like to do is have a game written in python and for all the multiplayer to be handled socket.io just because these are two things I'm fairly familiar with and I wanna keep possibilities for a web version or web app for the game open
So what I'm wondering is, how exactly do I do this and would it be bette... | Sending python objects to node.js via socket.io | 1.2 | 0 | 1 | 347 |
18,557,438 | 2013-09-01T10:20:00.000 | 4 | 0 | 1 | 0 | python | 18,557,493 | 3 | false | 0 | 0 | I think the biggest issue (and the reason that those implementations require type annotations) is that the Python specification relies heavily on deferring semantic evaluation like function binding to execution time.
Even if typing can be fully inferred from the script in some cases, it would be extremely complex to do... | 2 | 7 | 0 | Why can't pure Python be fully compiled? Compiled or interpreted is a trait of the implementation, not the language. So shouldn't there be some Python implementation that is fully before-hand compiled to native code? What makes (pure) Python so difficult to compile?
I know there are things like PyPy and Cython but as I... | Why can't pure Python be fully compiled? | 0.26052 | 0 | 0 | 3,504 |
18,557,438 | 2013-09-01T10:20:00.000 | 6 | 0 | 1 | 0 | python | 18,557,527 | 3 | false | 0 | 0 | False premise. Python can be fully compiled, no type annotations or anything of the sort are necessary.
Furthermore, PyPy does fully compile Python code into machine code. That this isn’t done ahead of time is irrelevant for the aspect of compilability – it’s just an implementation detail of the JIT architecture. | 2 | 7 | 0 | Why can't pure Python be fully compiled? Compiled or interpreted is a trait of the implementation, not the language. So shouldn't there be some Python implementation that is fully before-hand compiled to native code? What makes (pure) Python so difficult to compile?
I know there are things like PyPy and Cython but as I... | Why can't pure Python be fully compiled? | 1 | 0 | 0 | 3,504 |
18,560,367 | 2013-09-01T16:17:00.000 | 1 | 0 | 0 | 0 | android,python-3.x,kivy,sl4a | 18,723,415 | 2 | false | 0 | 1 | I'm loving kivy. The irony is, that I found this topic here looking for help with python 3. Python 2 works perfectly, but 3 is still being made compatible. Other than that Kivy is great for beginner coders. Especially, because you don't have to code the complex stuff. | 2 | 0 | 0 | I am learning to program (python 3.x) and was wondering what would be best to learn for making android apps/games. I dont know anything about UI really but have heard that kivy? Is on android. Is that worth learning or should i use something else.
Thanks
Edit:
I am using sl4a and py34a on my android device. | kivy or something else for android UI | 0.099668 | 0 | 0 | 2,257 |
18,560,367 | 2013-09-01T16:17:00.000 | 2 | 0 | 0 | 0 | android,python-3.x,kivy,sl4a | 19,018,485 | 2 | false | 0 | 1 | Kivy is good, and will run on Android, but you can't make Android apps with it. It has no way of interacting with the Android API. You can run a kivy app on the device, but can not read sensors or anything like that. They have a project called pyjnius, which allows you to access Java classes from Python, but not with P... | 2 | 0 | 0 | I am learning to program (python 3.x) and was wondering what would be best to learn for making android apps/games. I dont know anything about UI really but have heard that kivy? Is on android. Is that worth learning or should i use something else.
Thanks
Edit:
I am using sl4a and py34a on my android device. | kivy or something else for android UI | 0.197375 | 0 | 0 | 2,257 |
18,562,006 | 2013-09-01T19:18:00.000 | 1 | 0 | 0 | 0 | python,flask,web,session,caching | 21,949,675 | 2 | false | 1 | 0 | Your instinct is correct, it's probably not the way to do it.
Session data should only be ephemeral information that is not too troublesome to lose and recreate. For example, the user will just have to login again to restore it.
Configuration data or anything else that's necessary on the server and that must survive a ... | 1 | 7 | 0 | Scenario:
Major web app w. Python+Flask
Flask login and Flask.session for basic session variables (user-id and session-id)
Flask.session and limitations? (Cookies)
Cookie based and basically persist only at the client side.
For some session variables that will be regularly read (ie, user permissions, custom applica... | Efficient session variable server-side caching with Python+Flask | 0.099668 | 0 | 0 | 2,346 |
18,563,018 | 2013-09-01T21:14:00.000 | 4 | 0 | 0 | 0 | python,python-3.x | 18,563,064 | 3 | false | 0 | 0 | I think I found the proper way, just looking from another perspective:
self.data = self.data[Index:]
just copying what I need to itself again | 1 | 7 | 0 | I am pretty new to python and sometimes things that seems pretty easy become lot complicated than expected
I am currently using a bytes buffer to read from a socket:
data = self.socket.recv(size)
and then process part of that buffer and need remove it
The thing is that I've been looking for a way to do that and didn't ... | How to remove a range of bytes from a bytes object in python? | 0.26052 | 0 | 1 | 23,868 |
18,563,715 | 2013-09-01T22:52:00.000 | 2 | 0 | 0 | 0 | python,qt,qt4,pyqt,pyqt4 | 18,565,528 | 1 | true | 0 | 1 | You can hide a column in a QTableWidget by calling setColumnHidden(int column, bool hide) with the column number, and True for the hide option.
A better solution to this would to be to prevent the user interface from ever receiving this information. A Model-View-Controller setup, or the use of a data access layer could... | 1 | 2 | 0 | I need to send a set of information to model widget, QTableView/QTableWidget, Then When user click on a row, can open a new widget with ID of sent by information to QTableView/QTableWidget.
I use PyQt
I need to send hidden, it means user can't see my hidden id of database on QTableView/QTableWidget
Primative Quest... | How to send data to QTableView/QTableWidget (PyQt) | 1.2 | 0 | 0 | 1,156 |
18,565,750 | 2013-09-02T04:39:00.000 | 1 | 0 | 1 | 0 | python,python-module | 18,565,804 | 1 | true | 0 | 0 | For Linkedin authentication backend, you should import this way,
from social.backends.linkedin import LinkedinOAuth
for OAuth2,
from social.backends.linkedin import LinkedinOAuth2 | 1 | 0 | 0 | I'm running Windows 7 x64. I've installed Python 2.7 32-bit into the default directory (C:/Python27).
I used Pip to install a few modules (e.g. social-auth), but when I try to import them, Python says there is no module with that name. For example, "import linkedin" results in an ImportError.
Google search suggests tha... | Python 2.7 not searching folders inside of site-packages | 1.2 | 0 | 0 | 99 |
18,569,056 | 2013-09-02T08:49:00.000 | 2 | 0 | 0 | 0 | python,flask,uwsgi | 18,570,411 | 1 | true | 1 | 0 | you can use the python atexit module or the uwsgi.atexit hook | 1 | 0 | 0 | i am using flask and uwsgi.. At some point i need to know when uwsgi is stopped or when my app (Flask) object is destroyed and when it happens, execute a function.
Any ideas ??
Please | How to execute a function when uwsgi is stopped | 1.2 | 0 | 0 | 890 |
18,569,784 | 2013-09-02T09:27:00.000 | 0 | 1 | 1 | 0 | python,passwords,password-protection,password-encryption | 19,035,745 | 8 | false | 0 | 0 | To protect data stored on the client machine, you have to encrypt it. Period.
If you trust an authorized user, you can use a password-based encryption key (many other answers on Stack Exchange address this), and hope that he is smart enough to protect his computer from malware.
If you don't trust the authorized user ... | 4 | 10 | 0 | I am a beginner so if this question sounds stupid, please bear with me.
I am wondering that when we write code for username/password check in python, if it is not compiled to exe ie script state, won't people will easily open the file and remove the code potion that is doing the password check?
I am assuming that the ... | Python Password Protection | 0 | 0 | 0 | 40,722 |
18,569,784 | 2013-09-02T09:27:00.000 | 2 | 1 | 1 | 0 | python,passwords,password-protection,password-encryption | 18,571,072 | 8 | false | 0 | 0 | On a server only server administrators should have the right to change the code. Hence, to change the code you have to have administrator access, and if you do, then you can access everything anyway. :-)
The same goes for a client program. If the only security is the password check, you don't need to get around the pas... | 4 | 10 | 0 | I am a beginner so if this question sounds stupid, please bear with me.
I am wondering that when we write code for username/password check in python, if it is not compiled to exe ie script state, won't people will easily open the file and remove the code potion that is doing the password check?
I am assuming that the ... | Python Password Protection | 0.049958 | 0 | 0 | 40,722 |
18,569,784 | 2013-09-02T09:27:00.000 | 4 | 1 | 1 | 0 | python,passwords,password-protection,password-encryption | 18,570,957 | 8 | false | 0 | 0 | If you are doing the checking on a user's machine, they can edit the code how they like, pretty much no matter what you do. If you need security like this then the code should be run somewhere inaccessible, for instance a server. "Don't trust the client" is an important computer security principle.
I think what you wan... | 4 | 10 | 0 | I am a beginner so if this question sounds stupid, please bear with me.
I am wondering that when we write code for username/password check in python, if it is not compiled to exe ie script state, won't people will easily open the file and remove the code potion that is doing the password check?
I am assuming that the ... | Python Password Protection | 0.099668 | 0 | 0 | 40,722 |
18,569,784 | 2013-09-02T09:27:00.000 | 0 | 1 | 1 | 0 | python,passwords,password-protection,password-encryption | 62,569,006 | 8 | false | 0 | 0 | One way would be to store the password in a hash form of any algorithm and check if the hash of the password given is equal to the stored password hash.
The second way might be to take a password like "cat" and convert them to ascii and and add them up and store the sum. Then you can compare the given password's ascii ... | 4 | 10 | 0 | I am a beginner so if this question sounds stupid, please bear with me.
I am wondering that when we write code for username/password check in python, if it is not compiled to exe ie script state, won't people will easily open the file and remove the code potion that is doing the password check?
I am assuming that the ... | Python Password Protection | 0 | 0 | 0 | 40,722 |
18,570,143 | 2013-09-02T09:46:00.000 | 1 | 0 | 0 | 0 | python,linux,excel,shell,xlrd | 18,574,653 | 2 | false | 0 | 0 | mv file.{xls,csv}
It's a csv file, stop treating it as an excel file and things will work a lot better. :) There are nice csv manipulation tools available in most languages. Do you really need the excel library? | 1 | 0 | 0 | I have an excel file whose extension is .xls but his type is Tab Space separated Text.
When I try to open the file by MS Excel it tells me that the extension is fake. And So I have to confirm that I trust the file and so I can read it then.
But my real problem is that when I try to read my file by the xlrd library it g... | How to change automatically the type of the excel file from Tab space separated Text to xls file? | 0.099668 | 1 | 0 | 399 |
18,575,012 | 2013-09-02T13:59:00.000 | 11 | 0 | 1 | 0 | ipython-notebook | 54,837,259 | 7 | false | 0 | 0 | Knowing that in jupyter (ipython) notebook markdown cells the title level is identified by the number of # (# for top level headings or h1, ## for h2, ....), I use the following combination of HTML and markdown:
# <center>Your centered level h1 title</center>
## <center>Your centered level h2 title</center>
etc..
It's... | 4 | 50 | 0 | I want to customize my notebook, make it more readable and stylish. So for that, I want to start with centering my headers. Is it possible? | Centering Text in IPython notebook markdown/heading cells? | 1 | 0 | 0 | 94,911 |
18,575,012 | 2013-09-02T13:59:00.000 | 4 | 0 | 1 | 0 | ipython-notebook | 67,552,210 | 7 | false | 0 | 0 | the easy way for me is just :
# <center> some fancy title here
it works without closing the tag, so i usually copy "<center>" and past it away in a single step when i finish. | 4 | 50 | 0 | I want to customize my notebook, make it more readable and stylish. So for that, I want to start with centering my headers. Is it possible? | Centering Text in IPython notebook markdown/heading cells? | 0.113791 | 0 | 0 | 94,911 |
18,575,012 | 2013-09-02T13:59:00.000 | -3 | 0 | 1 | 0 | ipython-notebook | 51,788,944 | 7 | false | 0 | 0 | It's quite simple to make your text stylish in Jupyter-notebook as it's syntax are similar to HTML.
For example, you can use the following commands to play with your texts:
1.**bold_text** will make your test bold like bold_text.
2.*italic_text* will result in italic text like italic_text
3.***bold_italic_text*** will... | 4 | 50 | 0 | I want to customize my notebook, make it more readable and stylish. So for that, I want to start with centering my headers. Is it possible? | Centering Text in IPython notebook markdown/heading cells? | -0.085505 | 0 | 0 | 94,911 |
18,575,012 | 2013-09-02T13:59:00.000 | -3 | 0 | 1 | 0 | ipython-notebook | 66,083,631 | 7 | false | 0 | 0 | if you want to make a header you can easily use # at the beginning of text to make it big size and also bold, ## will also do the same but text size will be smaller, you can reduce the size of the bold text by increasing the #s up to 6. | 4 | 50 | 0 | I want to customize my notebook, make it more readable and stylish. So for that, I want to start with centering my headers. Is it possible? | Centering Text in IPython notebook markdown/heading cells? | -0.085505 | 0 | 0 | 94,911 |
18,576,492 | 2013-09-02T15:21:00.000 | 3 | 0 | 1 | 1 | python,python-2.7 | 18,576,513 | 2 | false | 0 | 0 | Specify Python 2.7's executable in the shebang of your scripts. Don't screw with the system Python. | 1 | 0 | 0 | I have access to old linux server(debian) and default Python is 2.6. To start my scripts I need Python 2.7. When I type python to console always 2.6 starts
(I have installed 2.7 and when I want to run I use command pythonbrew use 2.7.2)
How to avoid to type this and set that Python 2.7 is default? | How to avoid to type this and set that python 2.7 is default instead of python 2.6? | 0.291313 | 0 | 0 | 63 |
18,576,573 | 2013-09-02T15:26:00.000 | 4 | 0 | 1 | 0 | python,function | 18,576,700 | 3 | true | 0 | 0 | __init__ is invoked on instantiation. When you call some_instance = SomeClass(a, b), it is called with self, a and b as arguments.
Python has the "we are all consenting adults" motto, so yes, you can - but every time you call double-underscored methods you should really know what you are doing and you have to face the ... | 1 | 0 | 0 | Is it possible to invoke __init__() function explicitly? Or the function is always invoked when an object of the class is instantiated? | Can __init__() function in python be invoked at a different moment than at object creation? | 1.2 | 0 | 0 | 89 |
18,576,838 | 2013-09-02T15:44:00.000 | 2 | 1 | 0 | 0 | php,python,mysql,mongodb,startup | 18,577,154 | 1 | false | 1 | 0 | The idea that PHP/MySQL is easier or simpler than say Python/MongoDB is just inconsistent.
If you compare for example, Django (the most popular python web framework) with symfony(PHP) you will find that they are almost identical in terms of features and architecture (symfony is actually slightly more complex but also ... | 1 | 0 | 0 | since about two years ago, I did find my interest in code (Hardware/Sytems/Web) and now, I've found a project which motivates me a lot (It takes all my free time indeed).
Starting this point and because my project could soon switch from a free time project to a daily job, I'm currently developing a mockup of this proje... | Startup building and mokup | 0.379949 | 0 | 0 | 70 |
18,577,413 | 2013-09-02T16:27:00.000 | 1 | 1 | 0 | 0 | c++,python,c | 18,577,516 | 5 | false | 0 | 0 | Profile your application. If it really is spending time in a couple of places that you can recode in C consider doing so. Don't do this unless profiling tells you you really need to. | 3 | 0 | 0 | Recently I've read that we can code C/C++ and from python call those modules, I know that C/C++ is fast and strongly typed and those things but what advantages I got if I code some module and then call it from python? in what case/scenario/context it would be nice to implement this?
Thanks in advance. | What are the advantages of extending Python with C or C++? | 0.039979 | 0 | 0 | 437 |
18,577,413 | 2013-09-02T16:27:00.000 | 1 | 1 | 0 | 0 | c++,python,c | 18,577,711 | 5 | false | 0 | 0 | Another reason is there might be a C/C++ library with functionality not available in python. You might write a python extension in C/C++ so that you can access/use that C/C++ library. | 3 | 0 | 0 | Recently I've read that we can code C/C++ and from python call those modules, I know that C/C++ is fast and strongly typed and those things but what advantages I got if I code some module and then call it from python? in what case/scenario/context it would be nice to implement this?
Thanks in advance. | What are the advantages of extending Python with C or C++? | 0.039979 | 0 | 0 | 437 |
18,577,413 | 2013-09-02T16:27:00.000 | 0 | 1 | 0 | 0 | c++,python,c | 18,577,861 | 5 | false | 0 | 0 | The primary advantage I see is speed. That's the price paid for the generality and flexibility of a dynamic language like Python. The execution model of the language doesn't match the execution model of the processor, by a wide margin, so there must be a translation layer someplace at runtime.
There are significant s... | 3 | 0 | 0 | Recently I've read that we can code C/C++ and from python call those modules, I know that C/C++ is fast and strongly typed and those things but what advantages I got if I code some module and then call it from python? in what case/scenario/context it would be nice to implement this?
Thanks in advance. | What are the advantages of extending Python with C or C++? | 0 | 0 | 0 | 437 |
18,579,076 | 2013-09-02T18:36:00.000 | 0 | 0 | 0 | 0 | java,python,swing,user-interface,toolkit | 18,579,176 | 2 | false | 0 | 1 | I know QT is for Java (and Python of course). It is well documented and is used by a lot of people around the world. | 1 | 3 | 0 | I've been write window programs with C# + WPF for a while now. It is very good, has alot of rich elements as of .NET 4.5 but I dont really buy the idea of porting window based programs to other operating system like OS X using mono and others.
I started working on Java and Python, I haven't written any desktop based p... | Best GUI Toolkit/Framework for Java and Python | 0 | 0 | 0 | 3,817 |
18,579,714 | 2013-09-02T19:30:00.000 | 2 | 0 | 1 | 0 | python-3.x,pydev | 18,657,531 | 1 | false | 0 | 0 | You must enable the debug perspective.
Then, in the PyDev menu use: Manage Python Exception Breakpoints | 1 | 2 | 0 | In Visual Studio, when I run an application, it will pause and enter debug mode when an exception is caught.
How do I replicate this behaviour in Pydev? | Pydev, how to pause on exception | 0.379949 | 0 | 0 | 333 |
18,581,117 | 2013-09-02T21:41:00.000 | 2 | 0 | 0 | 0 | python,django,transactions | 18,581,616 | 1 | true | 0 | 0 | There is no way to transactionally delete multiple files on normal filesystems (you might be able to find esoteric filesystems where it is, but even if so I doubt that helps you. Apparently your current filesystem doesn't even let you delete a file that's being read, so presumably you're stuck with what you have!).
Per... | 1 | 0 | 0 | I need to do the following
Delete many entities from a database, also those entities have a file associated with them saved into the file system, which are accessed also by the web server (images!).
The problem: File deletion might fail, I have all the files in a folder for the main entity (its actually a 1-N relatio... | Delete files atomically/transactionally in python | 1.2 | 1 | 0 | 708 |
18,581,440 | 2013-09-02T22:14:00.000 | 0 | 0 | 1 | 0 | python,python-2.7 | 18,582,055 | 1 | false | 0 | 0 | I use Python where I can and C where I must. I can load libraries dynamically on both and I don't see much of a difference. So IMHO no, these are orthogonal concepts.
Lines may blurry because you can load binary modules in Python, and you can embed a dynamic interpreter in C (Python being a little big for this, I pref... | 1 | 1 | 0 | Python is an interpreted language, and it has built-in support for dynamic module loading.
Does the former make it easier for the latter? Or the two are unrelated?
Some conceptual explanation would be appreciated! | Being interpreted and dynamic module loading | 0 | 0 | 0 | 48 |
18,581,973 | 2013-09-02T23:19:00.000 | 1 | 0 | 1 | 1 | python,coderunner | 21,959,976 | 1 | false | 0 | 0 | Coderunner is more useful in testing single python files instead of larger projects, however it can run such projects. A larger project should have a setup.py or a main.py which should be run. Also, what errors are you getting? | 1 | 1 | 0 | I'm brand new to coding. I managed to figure out how to use github and I have been forking projects over to my machine in an attempt to play around with them and learn python. My problem is every single project I fork over, when I run any of the .py files in Coderunner it pops up with errors and doesn't run correctly... | Unable to run any Python program using code runner | 0.197375 | 0 | 0 | 605 |
18,582,698 | 2013-09-03T01:14:00.000 | 3 | 0 | 1 | 0 | python,multithreading,python-2.7,signals,mutex | 18,582,723 | 1 | false | 0 | 0 | Python's signal module runs signal handlers on the main interpreter thread exclusively. If your main thread is hung and unable to execute Python code, your signal handlers will not run. Signals will be fired and caught, but if the thread can't execute Python code then nothing will happen.
The best way to avoid this sit... | 1 | 0 | 0 | I have a python script with multiple threading-launched threads in which several threads occasionally freeze (apparently simultaneously). In this script, I've registered a signal handler to dump stack traces from all the running threads. When it's frozen, no dumped stacks appear. What could be causing this?
A couple of... | What can cause python registered signals to be ignored? | 0.53705 | 0 | 0 | 137 |
18,594,248 | 2013-09-03T13:58:00.000 | 0 | 0 | 0 | 0 | python,django,request | 18,594,433 | 2 | false | 1 | 0 | Middleware is very certainly not thread-safe. You should not store anything per-request either on the middleware object, or in the global namespace.
The usual way to do this is sort of thing to annotate it onto the request object. Middleware and views have access to this, but to get it anywhere else (eg in the model) y... | 1 | 0 | 0 | I have following problem. I want to add to django some kind of setup/teardown for each request. For example at the beginning of per user request I want to collect start data collection and at the end of request dump all data to database (1).
What comes to my mind right now, at the start of middleware instantiate an obj... | Django bootstrap/middleware/enter-exit | 0 | 0 | 0 | 216 |
18,595,099 | 2013-09-03T14:39:00.000 | 0 | 0 | 0 | 0 | python,opencv | 20,780,282 | 5 | false | 0 | 0 | these parameters should be integer, or it will raise TypeError | 2 | 14 | 1 | OpenCV2 for python have 2 function
[Function 1]
Python: cv2.ellipse(img, center, axes, angle, startAngle, endAngle, color[, thickness[, lineType[, shift]]]) → None
[Function 2]
Python: cv2.ellipse(img, box, color[, thickness[, lineType]]) → None
I want to use [Function 1]
But when I use this Code
cv2.ellipse(Res... | How I can use cv2.ellipse? | 0 | 0 | 0 | 13,427 |
18,595,099 | 2013-09-03T14:39:00.000 | 7 | 0 | 0 | 0 | python,opencv | 28,592,694 | 5 | false | 0 | 0 | Make sure all the ellipse parameters are int otherwise it raises "TypeError: ellipse() takes at most 5 arguments (10 given)". Had the same problem and casting the parameters to int, fixed it.
Please note that in Python, you should round the number first and then use int(), since int function will cut the number:
x = 2.... | 2 | 14 | 1 | OpenCV2 for python have 2 function
[Function 1]
Python: cv2.ellipse(img, center, axes, angle, startAngle, endAngle, color[, thickness[, lineType[, shift]]]) → None
[Function 2]
Python: cv2.ellipse(img, box, color[, thickness[, lineType]]) → None
I want to use [Function 1]
But when I use this Code
cv2.ellipse(Res... | How I can use cv2.ellipse? | 1 | 0 | 0 | 13,427 |
18,596,971 | 2013-09-03T16:16:00.000 | 0 | 0 | 0 | 0 | python,django,namespaces,setuptools | 18,644,769 | 3 | true | 1 | 0 | The only way I found for now is the following:
Do not use the namespace_packages parameter in setuptools.setup()
Instead, explicitly define "namespace" packages with this in the __init__.py file:
__import__('pkg_resources').declare_namespace(__name__)
I have not done a lot of testings as to if this will work if I don... | 1 | 2 | 0 | I was asked to split a big project into some reusable libraries (packages). So the idea was to do this:
company-django-shared
company-django-shared-dev
company-python-shared
company-python-shared-dev
These are installable with setuptools and namespaces:
company
company.packagename
company.packagename.tests
company.u... | ImportError: Could not import settings 'company.foo.settings' (Is it on sys.path?): No module named foo.settings | 1.2 | 0 | 0 | 1,119 |
18,600,081 | 2013-09-03T19:32:00.000 | 1 | 0 | 0 | 0 | python,resize,window,pyqt,pyqt4 | 29,042,473 | 5 | false | 0 | 1 | you could set the maximumSize and minimumSize with the same values, it'll get to dissapear maximise button | 1 | 12 | 0 | I would like to know how to disable the window Maximise button in pyqt4. I am at present using QWidget.setFixedSize (self, QSize) to prevent user window resizing, however the maximise button is still enabled and when pressed causes the application to move to the top left corner of the screen. I am basically wanting to ... | how to disable the window maximize icon using PyQt4? | 0.039979 | 0 | 0 | 20,169 |
18,600,435 | 2013-09-03T19:55:00.000 | 3 | 0 | 1 | 0 | python | 18,600,585 | 1 | false | 0 | 0 | Your best bet (besides Googling for help before posting a question on SO) might be to do something like this:
Note the time when the program starts. start = datetime.datetime.now()
Do your calculations
sleep until 100 seconds after start. (start + datetime.timedelta(seconds=100))
Note that this won't be perfect, sinc... | 1 | 0 | 0 | I am new to Python so be gentle.
I have been trying to write a program that counts or measures events in real time. At the moment I am using the sleep command but this pause event doesn't take into account the time the program takes to run. I have read up on the datetime module and can sort of see how this could be use... | Real time timer | 0.53705 | 0 | 0 | 299 |
18,603,205 | 2013-09-03T23:48:00.000 | 1 | 0 | 1 | 0 | python,macos,gcc,cython,kivy | 18,794,769 | 1 | true | 0 | 1 | Which python are you using, the system python or macports or something else?
Make sure you have XCode and gcc installed on your system first. Running which gcc on the command line will help identify where your current version of gcc resides. I assume you already checked this?
As an alternative, you can try instal... | 1 | 0 | 0 | I have scowered stack overflow all day today trying to figure out why when I try to install cython
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
I am using OSX mountain lion and I am using default python with pygame and easygui and command line tools installed ... | When I try to install cython I get an error message unable to execute gcc-4.0 | 1.2 | 0 | 0 | 531 |
18,603,302 | 2013-09-03T23:57:00.000 | 3 | 0 | 1 | 1 | python,django,git,virtualenv,virtualenvwrapper | 25,869,799 | 3 | false | 1 | 0 | Struggled with some variation of this issue not long ago; it ended up being my cluttered .bash_profile file.
Make sure you don't have anything that might mess up your virtualenv inside your .bash_profile/.bashrc, such as $VIRTUAL_ENV or $PYTHONHOME or $PYTHONPATH environment variables. | 2 | 11 | 0 | I am attempting to setup a development environment on my new dev machine at home. I have just installed Ubuntu and now I am attempting to clone a remote repo from our web-server and install its dependencies so I can begin work.
So far I have manually installed virtualenv and virtualenvwrapper from pypi and edited my b... | Pip doesn't install packages to activated virtualenv, ignores requirements.txt | 0.197375 | 0 | 0 | 6,391 |
18,603,302 | 2013-09-03T23:57:00.000 | 2 | 0 | 1 | 1 | python,django,git,virtualenv,virtualenvwrapper | 32,925,897 | 3 | false | 1 | 0 | I know this is an old post, but I just encountered a similar problem. In my case the cause was that I was running the pip install command using sudo. This made the command run globally and the packages install in the global python path.
Hope that helps somebody. | 2 | 11 | 0 | I am attempting to setup a development environment on my new dev machine at home. I have just installed Ubuntu and now I am attempting to clone a remote repo from our web-server and install its dependencies so I can begin work.
So far I have manually installed virtualenv and virtualenvwrapper from pypi and edited my b... | Pip doesn't install packages to activated virtualenv, ignores requirements.txt | 0.132549 | 0 | 0 | 6,391 |
18,606,097 | 2013-09-04T05:35:00.000 | 4 | 0 | 1 | 0 | python,save | 18,606,314 | 8 | false | 0 | 1 | First, don't overthink this. You don't need to use anything complicated. As a preliminary step, research basic file input/output in python.
Second, I'm assuming you have a player class in your game? Or possibly an overall class which keeps track of game state. Well have that class store default values for your variabl... | 1 | 5 | 0 | I am in the process of making a text based game with Python, and I have the general idea down. But I am going to make the game in depth to the point where, it will take longer than one sitting to finish it. So I want to be able to make the game to where, on exit, it will save a list of variables (player health, gold, r... | Python text game: how to make a save feature? | 0.099668 | 0 | 0 | 36,232 |
18,607,233 | 2013-09-04T06:53:00.000 | 0 | 0 | 1 | 0 | python | 18,607,287 | 3 | false | 0 | 0 | Even though your file may be only 2GB, the overhead of reading it in may result in far more than 2GB of memory used. | 1 | 0 | 0 | a single file with size greater then 2G.
I call open(f, "rb").read()
MemoryError.
I call open(f, "rb").read(1<<30)
OK
How can I eliminate the 2G limit? I have enough memory -- 16G | MemoryError when read a file larger than 2G | 0 | 0 | 0 | 624 |
18,611,649 | 2013-09-04T10:42:00.000 | 4 | 0 | 1 | 0 | python,sublimetext2 | 19,054,775 | 2 | true | 0 | 0 | Have you installed pylint? Ya gotta install pylint separately.
HT to hernamesbarbara for actually making my answer useful. | 1 | 3 | 0 | I am trying to configure sublimer for python, when installing pylinter I always get this error:
"please define the full path to "lint.py" in the settings.
Even tried a full uninstall...
By the way, also sublimerope - extract method doesnt work... | Please define the full path to lint.py in the settings | 1.2 | 0 | 0 | 3,014 |
18,613,447 | 2013-09-04T12:09:00.000 | 1 | 0 | 1 | 0 | python | 18,614,455 | 2 | false | 0 | 0 | Python can use all of the memory allocated to it. The OS allocates the memory, and usually has limits per process, but there are commands to control those limits. ( 'ulimit' on unix, for example ). But then most OSes use virtual memory, so the OS and it's processes can use more virtual memory than the physical memory ... | 2 | 4 | 0 | If I use python (32 bit version) on a machine with for example 64Gb ram , will it be able to use these 64Gb of ram. Or does this depend on the Operating System ? | How much ram can python use? | 0.099668 | 0 | 0 | 6,517 |
18,613,447 | 2013-09-04T12:09:00.000 | 8 | 0 | 1 | 0 | python | 18,613,543 | 2 | true | 0 | 0 | Python does not itself use any mechanisms for extending past the per-process userspace memory limit of the operating system. There are however modules for and means of doing so. So the answer is "depends on how much work you're willing to do". | 2 | 4 | 0 | If I use python (32 bit version) on a machine with for example 64Gb ram , will it be able to use these 64Gb of ram. Or does this depend on the Operating System ? | How much ram can python use? | 1.2 | 0 | 0 | 6,517 |
18,620,311 | 2013-09-04T17:33:00.000 | 0 | 0 | 0 | 1 | python,xml,google-app-engine | 20,461,649 | 1 | false | 1 | 0 | Just to clarify, I'm going to assume that you're asking about the Model.to_xml() method, and that by efficient you mean a single method which you can call which will provide you with a model object.
As you noted, there is no such method on the Model class for the datastore API. I think the intention is that the purpose... | 1 | 4 | 0 | In Google App Engine, I can serialize an object by calling its to_xml() method.
There doesnt appear to be an equivalent from_xml() method to deserialize the xml.
Is there an efficient way to deserialize back to an object? | How to deserialize xml created by to_xml() in google appengine | 0 | 0 | 0 | 190 |
18,624,934 | 2013-09-04T22:35:00.000 | 1 | 0 | 1 | 0 | vim,python-3.x | 18,626,135 | 2 | false | 0 | 0 | You should put customized settings in to ~/.vim/ftplugin/python.vim This will be sourced when vim sees a file with a filetype python.
To make sure the settings only affect the current buffer use setlocal.
To make sure that mappings only affect the current buffer use noremap <buffer>
Just make sure to have filetype plug... | 1 | 0 | 0 | I am new to vim and I want to use it for scripting Python3. anyone knows how to customize vim for editing Python 3 scripts? (mainly for indentations, coloring and tab suggestions... )
Thanks | How to Customize vim for scripting in Python 3 ? | 0.099668 | 0 | 0 | 1,096 |
18,625,446 | 2013-09-04T23:31:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,angularjs,routes,webapp2 | 18,626,669 | 2 | false | 1 | 0 | I'm working on the same stack and the way we do it is that we have the main pages (index, login, signup) configured as regular individual pages where we use angular without routing. Any page that anonymous users will access will be such pages which work over server side routing. But once the user login is successful we... | 2 | 0 | 0 | I'm currently building a web application using AngularJS, Webapp2, and the Python Google App Engine environment. This app is supposed to have all the features of modern social networks (users, posts, likes, comments). I want the page hierarchy to look like this, the main pages are from the server and the sub pages are ... | GAE Python Server initiating Angular Routes from Responses | 0 | 0 | 0 | 298 |
18,625,446 | 2013-09-04T23:31:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,angularjs,routes,webapp2 | 21,590,989 | 2 | false | 1 | 0 | Make both GAE and Angular understand your routes. You will need to define them for one, why not both?
You just have to organise your markup and structure so it can support complete page loading and ajax loading. For example, initial load is done on any route by GAE, then Angular can take over, loading each page "conten... | 2 | 0 | 0 | I'm currently building a web application using AngularJS, Webapp2, and the Python Google App Engine environment. This app is supposed to have all the features of modern social networks (users, posts, likes, comments). I want the page hierarchy to look like this, the main pages are from the server and the sub pages are ... | GAE Python Server initiating Angular Routes from Responses | 0 | 0 | 0 | 298 |
18,625,601 | 2013-09-04T23:47:00.000 | 1 | 0 | 0 | 0 | python,django,django-authentication,django-registration,django-1.5 | 18,625,653 | 1 | true | 1 | 0 | When you have it all in one table, then database access is faster. With the old way you had to join on the auxiliary table to get all the information of the user.
Usually when you see a One-to-One relation, it would be better just to merge them in one table.
But the new custom User model solves also another problem, wh... | 1 | 0 | 0 | I'm currently using Django 1.5.1 and using a custom user as described in the official documentation. I realized everything is stored under one table, the auth_user one.
My question is, why is it better to have everything in one big table, instead of having 2 tables like it used to be prior to 1.5 by using a user_profil... | Django custom user VS user profile | 1.2 | 0 | 0 | 907 |
18,626,114 | 2013-09-05T00:54:00.000 | 0 | 0 | 0 | 1 | python,linux,macos,sqlite | 18,629,528 | 2 | false | 0 | 0 | To figure out exactly which sqlite3 binaries your system can find type which -a sqlite3. This will list the apps in the order that they are found according to your PATH variable, this also shows what order the thes ystem would use when figuring out which to run if you have multiple versions.
Homebrew should normally li... | 1 | 1 | 0 | I have a Mac running OS X 10.6.8, which comes pre-installed with SQLite3 v3.6. I installed v3.8 using homebrew. But when I type "sqlite3" in my terminal it continues to run the old pre-installed version. Any help? Trying to learn SQL as I'm building my first web app.
Not sure if PATH variable has anything to do with it... | Running upgraded version of SQLite (3.8) on Mac when Terminal still defaults to old version 3.6 | 0 | 1 | 0 | 1,449 |
18,636,019 | 2013-09-05T12:13:00.000 | 0 | 0 | 0 | 0 | python,maya,pymel | 18,669,628 | 2 | true | 1 | 0 | We can find the shape from the edge, by simply listing it's immediate connection with the use of node()
PYMEL:
pm.PyNode(selection[0].node().getParent())
No need to split the string, or re map the array. | 1 | 0 | 0 | Im using Maya to perform a certain task on selected edges.
Let's say I save these edges like this:
edges = pm.filterExpand(sm=32)
From here, I can just select the first edge, and get the object by splitting the unicode string:
'pSphere1.e[274]'
Here's how I split it, and it gave me pSphere1, however calling getShape() ... | Get Shape from selected Edges | 1.2 | 0 | 0 | 1,151 |
18,636,159 | 2013-09-05T12:20:00.000 | 0 | 0 | 0 | 0 | django,python-2.7,django-1.3 | 19,995,173 | 1 | false | 1 | 0 | I will try to answer why this was happening for us, i worked on it long time ago so will try to recollect as much as i can.
We were allowing admins to modify the login id of the user, This would go and change the email id int he partial digest table. A lot of times they would use this to disable an account by changing... | 1 | 0 | 0 | We have digest authentication in our application. For some reason we are seeing for a few users having different id, username as in "auth_user" table but for some reason in the django_digest_partialdigest the user_id is different but the "login" column has the same username.
I Am not able find out what scenario would ... | Django 1.3 authentication | 0 | 0 | 0 | 31 |
18,638,461 | 2013-09-05T14:02:00.000 | 3 | 0 | 0 | 0 | python,hdf5,pytables | 18,641,432 | 1 | true | 0 | 0 | HDF5 attribute access is notoriously slow. HDF5 is really built for and around the array data structure. Things like groups and attributes are great helpers but they are not optimized.
That said while attribute reading is slow, attribute writing is even slower. Therefore, it is always worth the extra effort to do w... | 1 | 0 | 1 | I am working a lot with pytables and HDF5 data and I have a question regarding the attributes of nodes (the attributes you access via pytables 'node._v_attrs' property).
Assume that I set such an attribute of an hdf5 node. I do that over and over again, setting a particular attribute
(1) always to the same value (so ov... | Pytables, HDF5 Attribute setting and deletion, | 1.2 | 0 | 0 | 986 |
18,645,394 | 2013-09-05T20:30:00.000 | 1 | 0 | 1 | 0 | python,string | 18,645,414 | 4 | false | 0 | 0 | Enclose the entire string with """ or ''' (you would use ''' if the outermost quotation marks were ") in cases like these to make things simpler.
"""'"['BOS']"'""" | 1 | 0 | 0 | In Python how would I write the string '"['BOS']"'.
I tried entering "\"['BOS']\"" but this gives the output '"[\'BOS\']"' with added backslashes in front of the '. | Multiple Quotes in String | 0.049958 | 0 | 0 | 3,846 |
18,646,039 | 2013-09-05T21:12:00.000 | 1 | 0 | 1 | 0 | python,enthought | 18,647,689 | 2 | false | 0 | 0 | Umair, ctrl + n or File > Python File will do what you want.
Best,
Jonathan | 2 | 0 | 1 | I am using Enthought canopy for data analysis. I didn't find any option to create a .py file to write my code and save it for later use. I tried File> New >IPython Notebook, wrote my code and saved it. But the next time I opened it within Canopy editor, it wasn't editable. I need something like a Python shell where you... | How to create a .py file within canopy? | 0.099668 | 0 | 0 | 1,009 |
18,646,039 | 2013-09-05T21:12:00.000 | 1 | 0 | 1 | 0 | python,enthought | 19,578,868 | 2 | false | 0 | 0 | Let me add that if you need to open the file, even if it's a text file but you want to be able to run it as a Python file (or whatever language format) just look at the bottom of the Canopy window and select the language you want to use. In some cases it may default to just text. Click it and select the language you wa... | 2 | 0 | 1 | I am using Enthought canopy for data analysis. I didn't find any option to create a .py file to write my code and save it for later use. I tried File> New >IPython Notebook, wrote my code and saved it. But the next time I opened it within Canopy editor, it wasn't editable. I need something like a Python shell where you... | How to create a .py file within canopy? | 0.099668 | 0 | 0 | 1,009 |
18,646,885 | 2013-09-05T22:23:00.000 | 1 | 0 | 0 | 0 | python,apple-push-notifications,celery,boto,amazon-sns | 22,409,890 | 2 | false | 0 | 0 | You should be reusing the SNS connection for best performance. That said, please ensure that you detect and re-establish the connection if it is closed. | 1 | 1 | 0 | I'm using boto and SNS to send push notifications to iOS. I've made a wrapper class, APNS, that keeps a long running boto.SNSConnection as a member variable.
I'd like to have an instance of the APNS class as a global variable, so I can use celery to send push notifications in the background.
Are there any problems wit... | Is having a long running boto SNSConnection a bad idea? | 0.099668 | 0 | 0 | 252 |
18,647,154 | 2013-09-05T22:46:00.000 | 1 | 0 | 0 | 1 | python,amazon-web-services,amazon-ec2,websocket | 20,952,263 | 1 | false | 1 | 0 | This could be caused by to a Chrome Extension. | 1 | 0 | 0 | I have a web socket server running on an Ubuntu 12.04 EC2 Instance. My web socket server is written in Python, I am using Autobahn WebSockets.
I have a JavaScript client that uses WebRTC to capture webcam frames and send them to the web socket server.
My webserver (where the JavaScript is hosted) is not deployed on EC2... | JavaScript client failed to send WebSocket frame to WebSocket server on Amazon EC2 | 0.197375 | 0 | 1 | 1,419 |
18,647,897 | 2013-09-06T00:11:00.000 | 4 | 0 | 1 | 0 | python,disassembly | 18,663,296 | 3 | true | 0 | 0 | The Python bytecode disassembler has no common use aside from curiosity or investigating details of the Python implementations. It's similar to how most C programmers never need to look at assembler, even though they are compiling C code to assembler and using debuggers like gdb. In Python's case, pdb (but also trace... | 2 | 3 | 0 | I've noticed there is a significant degree of interest in Python disassemblers such as the dis module.
However it is surprisingly difficult to find what these disassemblers are generally used for in industry/academia. Outside of satisfying curiosity (a perfectly legitimate endeavour!) or writing Python implementations... | What are Python disassemblers used for? | 1.2 | 0 | 0 | 269 |
18,647,897 | 2013-09-06T00:11:00.000 | 0 | 0 | 1 | 0 | python,disassembly | 26,515,207 | 3 | false | 0 | 0 | If you want to look for a line of code in a machine language program, such as one causing an annoying popup or a piece of malware, a disassembler might help you find the piece of toxic code.
Also,as Flornquake says, programs assembled by higher order languages like Python are sometimes not efficient. If you need a h... | 2 | 3 | 0 | I've noticed there is a significant degree of interest in Python disassemblers such as the dis module.
However it is surprisingly difficult to find what these disassemblers are generally used for in industry/academia. Outside of satisfying curiosity (a perfectly legitimate endeavour!) or writing Python implementations... | What are Python disassemblers used for? | 0 | 0 | 0 | 269 |
18,647,942 | 2013-09-06T00:17:00.000 | 4 | 0 | 1 | 0 | python,api,maya,mel,pymel | 18,669,643 | 2 | true | 0 | 0 | While your answer will work theodox, I did find a much simpler resolution, after some serious digging!
Turns out, hiding and not very well documented, was a function ironically called indices(), I did search for this but nothing came up in the docs.
Pymel
selection[0].indices()[0]
The above will give us the integer o... | 1 | 1 | 0 | Is there's a way to get the indices properly from a Pymel/Maya API function?
I know Pymel has a function called getEdges() however according to their docs this get's them from the selected face, however I just need them from the selected edges.
Is this possible? | How to get edge indices from selection? | 1.2 | 0 | 0 | 2,796 |
18,650,551 | 2013-09-06T05:30:00.000 | 1 | 0 | 0 | 0 | javascript,python,django,client-server,tastypie | 18,650,699 | 1 | true | 1 | 0 | A mobile client doesn't care if the Javascript comes from Django or any other web server. So go ahead and put all your JavaScript and static HTML on another server.
If you want your mobile app to see if the user is logged in, it should make an AJAX call to your Django backend (where the request is authenticated). The... | 1 | 1 | 0 | I'm using TastyPie and Django to build out my backend for an application that will have browser and mobile (native iOS) clients.
I have been through the TastyPie and Django docs, can authenticate successfully either using the TastyPie resources I set up, or using Djangos built in views. I see a lot of examples on inclu... | How to properly decouple Django from an AJAX application? | 1.2 | 0 | 0 | 275 |
18,651,617 | 2013-09-06T06:49:00.000 | 0 | 0 | 0 | 0 | python,django | 18,655,003 | 1 | false | 1 | 0 | Can't you specify the details of your development database in settings.py? This would connect you to the existing database and remove the need to create a new test instance. | 1 | 0 | 0 | How can I test my app in django, so that it connects to my local database and does NOT require me to create a test database? | Test an app in django and connect to local database | 0 | 0 | 0 | 129 |
18,655,290 | 2013-09-06T10:12:00.000 | 0 | 0 | 1 | 0 | python,sockets,asyncore | 18,655,376 | 1 | false | 0 | 0 | You can make one connection per socket at the same time only. But this doesn't mean that you can't do what you want to, however you'll need 2 sockets for 2 connections. | 1 | 0 | 0 | I have a class that implements the asyncore module, it serves as a client that connects to HOST_A. The problem is I need to pass the data received from HOST_A to a HOST_B. So i'm wondering if asyncore can create two socket connections to HOST_A and HOST_B.Is this possible? | Can python asyncore module handle/connect more than one socket? | 0 | 0 | 1 | 283 |
18,657,777 | 2013-09-06T12:21:00.000 | 0 | 0 | 0 | 0 | python,html | 18,658,647 | 1 | true | 1 | 0 | Flask. Just use Flask.
Honestly you'll finish your project in 20 minutes. | 1 | 0 | 0 | I have a database that can be fetched using mysql query and send the data as response for an ajax jquery request. Which python framework would be best suitable to satisfy this primary need?
Thanks in advance. | Light Weight Python Web FrameWork | 1.2 | 0 | 0 | 379 |
18,659,656 | 2013-09-06T14:00:00.000 | 2 | 0 | 0 | 1 | python,windows,pythonw | 18,662,659 | 2 | false | 0 | 0 | pythonw supresses the console window that is created when a python script is executed. Its intended for programs that open their own GUI. Without pythonw, a python gui app would have its regular windows plus an extra console floating around. I'm not sure what pythonw does to your stdout, but os.isatty() returns False a... | 1 | 0 | 0 | I've written a script that works great at a command prompt, but it only displays the last line if I double click on the script.py icon on my desktop.
The function in the script runs perfectly but once it finds a match it's supposed to display the output on the screen. At the end, I have an os.pause statement and THAT ... | Python script displays output in command window but nothing shows in Windows | 0.197375 | 0 | 0 | 2,336 |
18,664,940 | 2013-09-06T19:11:00.000 | -1 | 0 | 0 | 0 | python,berkeley-db,bsddb | 18,793,657 | 2 | true | 0 | 0 | Well, there's no workaround. But you can use two approaches
Store the integers as string using str or repr. If the ints are big, you can even use string formatting
use cPickle/pickle module to store and retrieve data. This is a good way if you have data types other than basic types. For basics ints and floats this act... | 1 | 0 | 0 | I want to use BDB as a time-series data store, and planning to use the microseconds since epoch as the key values. I am using BTREE as the data store type.
However, when I try to store integer keys, bsddb3 gives an error saying TypeError: Integer keys only allowed for Recno and Queue DB's.
What is the best workaround?... | Use integer keys in Berkeley DB with python (using bsddb3) | 1.2 | 1 | 0 | 689 |
18,666,243 | 2013-09-06T20:40:00.000 | 1 | 0 | 0 | 0 | python,django,user-interface,packages | 29,824,864 | 2 | false | 1 | 0 | Use the bootstrap. I developed the django app too using the bootstrap and it works fine in all smartphone, tablet and desktop devices. | 1 | 4 | 0 | I've made a desktop-friendly django app and would prefer not to have to rewrite all of the html/css to allow proper view on mobile browsers.
I'm on django 1.5 and python 2.7
Is there a package or library or quicker way to efficiently create a mobile version of my django (web) app instead of having to re-write a whole n... | Convert Web Friendly Django app to a Mobile friendly django app | 0.099668 | 0 | 0 | 4,667 |
18,668,736 | 2013-09-07T01:23:00.000 | 1 | 0 | 0 | 0 | python,esky | 18,676,400 | 1 | true | 0 | 0 | Perhaps not possible.
However, one can use the Appdata folder on Windows systems, and /etc folder on Linux systems. | 1 | 1 | 0 | I have an ini file that contains the configuration of my app.
Esky creates new folders for the updated versions. How can I make sure that configuration file gets copied? | How can I move config file between esky updates? | 1.2 | 0 | 0 | 113 |
18,669,374 | 2013-09-07T03:25:00.000 | 1 | 0 | 1 | 0 | python,regex | 18,669,461 | 2 | false | 1 | 0 | I don't see why a collection of regexs wouldn't work. There are a variety of different formats, but there are really only a handful that are most common. With, say, a dozen easy regex, you could probably scrub 90% of the dates out there.
Another (partial) approach would be to scan for month names and abbreviations, and... | 1 | 1 | 0 | For html pages, and news-related pages especially, it would be very helpful and incredibly useful if there were a mechanism for parsing out the publication dates.
Unfortunately, there is not one set regex/pattern for dates on the internet. CNN may publish it like MONTH DD, YYYY and HuffingtonPost may publish as MM/DD/Y... | Python: Parsing out publication dates from html pages | 0.099668 | 0 | 0 | 506 |
18,670,974 | 2013-09-07T07:35:00.000 | 1 | 0 | 0 | 0 | python | 18,687,144 | 2 | false | 0 | 0 | Generically you can populate your points in two ways:
1) use random to create the coordinates for your points within the outer bounds of the solution. If a given random point falls outside the max or inside the inner limit.
2) You can do it using polar coordinates: generate a random distance between the inner and oute... | 1 | 3 | 1 | I have to generate a various points and its xyz coordinates and then calculate the distance.
Lets say I want create random point coordinates from point a away from 2.5 cm in all directions. so that i can calculate the mutual distance and angles form a to all generated point (red)
I want to remove the redundant poi... | How to get a series of random points in a specific range of distances from a reference point and generate xyz coordinates | 0.099668 | 0 | 0 | 5,337 |
18,671,253 | 2013-09-07T08:11:00.000 | 5 | 0 | 1 | 1 | python,homebrew | 18,674,756 | 9 | false | 0 | 0 | Alternatively, you probably can just enter "python3" to run your most current version of python3.x and "python" or "python2" to run the latest installed 2.x version. | 2 | 149 | 0 | I need to be able to switch back and forth between Python 2 and 3. How do I do that using Homebrew as I don't want to mess with path and get into trouble.
Right now I have 2.7 installed through Homebrew. | How can I use Homebrew to install both Python 2 and 3 on Mac? | 0.110656 | 0 | 0 | 81,770 |
18,671,253 | 2013-09-07T08:11:00.000 | 1 | 0 | 1 | 1 | python,homebrew | 49,878,692 | 9 | false | 0 | 0 | I thought I had the same requirement - to move between Python versions - but I achieved all I needed with only Python3.6 by building from source instead of using homebrew.
git clone https://git.<theThingYouWantToInstall>
Depending on the repo, check if there is MAKE file already setup for this option. | 2 | 149 | 0 | I need to be able to switch back and forth between Python 2 and 3. How do I do that using Homebrew as I don't want to mess with path and get into trouble.
Right now I have 2.7 installed through Homebrew. | How can I use Homebrew to install both Python 2 and 3 on Mac? | 0.022219 | 0 | 0 | 81,770 |
18,673,258 | 2013-09-07T12:21:00.000 | 2 | 1 | 1 | 0 | python,ruby,compiler-construction,compilation,dynamic-languages | 18,674,023 | 2 | true | 0 | 0 | Yes, it is definitely possible to create compilers for dynamic languages. There are a myriad of examples of compilers for dynamic languages in the wild:
CPython is an implementation of the Python programming language which has a Python compiler.
PyPy is an implementation of the Python programming language which has a ... | 1 | 3 | 0 | Are there some set of reasons that make it impossible for dynamic languages such as Python or Ruby to be compiled instead of interpreted without losing any of his dynamics characteristics?
Of course one the requirements to that hypothetical compiler is that those languages doesn't lose any of his characteristics like... | It is possible to create compilers for dynamic languages without losing his dynamic characteristics? | 1.2 | 0 | 0 | 509 |
18,673,426 | 2013-09-07T12:41:00.000 | 0 | 1 | 0 | 0 | python,nfc,raspberry-pi,mifare | 20,600,986 | 2 | false | 0 | 0 | I built an application on the Raspberry Pi to read and write RFid cards. The easiest way to do it is to use the pcscd library and java. There are good examples on the Oracle website and the pcscd library is broadly supported.
Be aware though. The usb cardreader I used did not seem to work initially. The cardreader uses... | 1 | 1 | 0 | So i bought a cheap mifare NFC chip reader from ebay for 5$. I wanted to play around with chips, and ultimately copy some NFC chips i have here. I have a NFC chip that I use to open my locker with on school, but the card we have is really big and inconvient, so I want to copy it on a smaller NFC chip and put it on my k... | NFC tag reading in python on raspberry pi | 0 | 0 | 0 | 10,270 |
18,674,630 | 2013-09-07T15:02:00.000 | 0 | 0 | 0 | 0 | python,persistence | 18,674,706 | 1 | false | 1 | 0 | Martijn's suggestion could be one of the alternatives.
You may consider to store the pickle objects directly in a sqlite database which still can manage from the python standard library.
Use a StringIO object to convert between the database column and python object.
You didn't mention the size of each object you are pi... | 1 | 0 | 0 | I have some code that I am working on that scrapes some data from a website, and then extracts certain key information from that website and stores it in an object. I create a couple hundred of these objects each day, each from unique url's. This is working quite well, however, I'm inexperienced in what options are a... | Persistence of a large number of objects | 0 | 1 | 0 | 95 |
18,686,796 | 2013-09-08T17:51:00.000 | 1 | 0 | 1 | 1 | python,c,pthreads,multiprocessing,named-pipes | 22,251,245 | 1 | true | 0 | 0 | Answering my own question:
I've implemented this (a while back) using option 4. Works good, very stable.
Releasing the GIL wasn't happening in my first attempt, because I didn't initialize threading.
After that, smooth sailing. | 1 | 0 | 0 | I'd like people's opinion on which direction to choose between different solutions to implement inter-thread named-pipe communication.
I'm working on a solution for the following:
A 3rd party binary on AIX calls a shared object.
I build this shared object using the python 2.7.5 api, so I have a python thread (64 bit).
... | Embedded CPython, thread interaction using named pipe | 1.2 | 0 | 0 | 157 |
18,693,208 | 2013-09-09T07:17:00.000 | 1 | 0 | 1 | 0 | python,watchdog | 18,693,572 | 1 | true | 0 | 0 | You can add a tag such as an observer name when you create the event. Python events can have almost any type of data added as named members and then access by the handler. | 1 | 0 | 0 | I'm using same event handler for multiple watchdog observers. I need to know, event is generated for which observer when file/dir is created. | Python watchdog. Need to know the observer | 1.2 | 0 | 0 | 168 |
18,700,969 | 2013-09-09T14:48:00.000 | 0 | 0 | 0 | 0 | python,openerp,restrict | 18,828,239 | 1 | false | 1 | 0 | For your cases:
You can try using Many2Many relation so as to choose the record of users.
Use Groups to obtain your desired result.
For example:
<field name="user_id" groups="your_group" />
By doing this you can provide what fields to be visible to which user based on access rights provided in your GROUPS. | 1 | 0 | 0 | I'm facing a complex problem, at least for me.
I have a form called "Task", which contains all the normal info, and I would like to add users to that Task.
If I want to add multiple users to that task, I should use the widget one2many, am I right? If so, is it possible to display a dropdown or something and add the us... | openERP restrict users | 0 | 0 | 0 | 404 |
18,701,464 | 2013-09-09T15:11:00.000 | 1 | 0 | 1 | 0 | python,beautifulsoup,windows-7-x64 | 18,701,653 | 3 | false | 1 | 0 | You just need to add to download it and add it to your python search path directly. (Which is in sys.path, if you need to check it.)
From the documentation:
Beautiful Soup is licensed under the MIT license, so you can also download the tarball, drop the bs4/ directory into almost any Python application (or into your l... | 1 | 0 | 0 | I wanted to write a program to scrape a website from python. Since there is no built-in possibility to do so, I decided to give the BeautifulSoup module a try.
Unfortunately I encountered some problems using pip and ez_install, since I use Windows 7 64 bit and Python 3.3.
Is there a way to get the BeautifulSoup module ... | BeautifulSoup installation or alternative without easy_install | 0.066568 | 0 | 0 | 4,503 |
18,703,136 | 2013-09-09T16:49:00.000 | 19 | 0 | 0 | 0 | python,scikit-learn,random-forest | 18,719,287 | 3 | true | 0 | 0 | We don't implement proximity matrix in Scikit-Learn (yet).
However, this could be done by relying on the apply function provided in our implementation of decision trees. That is, for all pairs of samples in your dataset, iterate over the decision trees in the forest (through forest.estimators_) and count the number of... | 1 | 14 | 1 | I'm trying to perform clustering in Python using Random Forests. In the R implementation of Random Forests, there is a flag you can set to get the proximity matrix. I can't seem to find anything similar in the python scikit version of Random Forest. Does anyone know if there is an equivalent calculation for the python ... | Proximity Matrix in sklearn.ensemble.RandomForestClassifier | 1.2 | 0 | 0 | 6,625 |
18,704,175 | 2013-09-09T17:59:00.000 | 4 | 0 | 1 | 0 | ipython,offline | 18,708,798 | 1 | false | 0 | 0 | Yes, it should work without needing an internet connection. If a browser tab doesn't open automatically, open a browser and go to the URL it gives you in the terminal where you started the notebook (by default, this is http://127.0.0.1:8888/ ). It uses the 'loopback' network interface, which stays within your own compu... | 1 | 3 | 0 | Can ipython notebook be used when not connected to the internet?
My installation doesn't open a web browser tab if not online.
Thanks! | Using ipython notebook offline | 0.664037 | 0 | 1 | 24,898 |
18,705,107 | 2013-09-09T19:02:00.000 | 0 | 0 | 0 | 0 | python,django,pycharm | 18,716,562 | 1 | true | 1 | 0 | OK, I've found solution.
If you want to launch many test suits with one test launcher in PyCharm, you should add names of your applications separated by a space to Target field of your Django tests Run/Debug configuration. | 1 | 1 | 0 | I've Django project with two applications with added unit tests (django.test.TestCase). In PyCharm I have created two Django test launchers (one for every app). In this configuration everything works correctly. Now I want to create one test launcher, which will be able to start unit test for both applications at once.
... | Run unit tests for two Django applications in PyCharm | 1.2 | 0 | 0 | 701 |
18,705,223 | 2013-09-09T19:09:00.000 | 0 | 0 | 0 | 0 | python,ruby,data-mining,data-analysis | 18,712,558 | 2 | true | 0 | 0 | Sounds like a classic matrix factorization task to me.
With a weighted matrix, instead of a binary one. So some fast algorithms may not be applicable, because they support binary matrixes only.
Don't ask for source on Stackoverflow: asking for off-site resources (tools, libraries, ...) is off-topic. | 1 | 0 | 0 | For a music project I want to find what which groups of artists users listens to. I have extracted three columns from the database: the ID of the artist, the ID of the user, and the percentage of all the users stream that is connected to that artist.
E.g. Half of the plays from user 15, is of the artist 12.
12 | 15 |... | Data Mining: grouping based on two text values (IDs) and one numeric (ratio) | 1.2 | 1 | 0 | 261 |
18,706,059 | 2013-09-09T20:01:00.000 | 1 | 0 | 1 | 0 | ipython-notebook | 18,712,352 | 1 | false | 0 | 0 | We want to support this in metadata at notebook top level, but nobody has taken time to write a proposal for metadata structure, how to edit it, and how to show it.
This would be usefull for view on nbviewer, but also for conversion to LaTeX, and other format. It might just be slightly more complicated that at first th... | 1 | 3 | 0 | I'd like to pre-pend a simple author and copyright clause the beginning of newly created ipython notebooks. Is this possible? If so how can it be done? | How can I automatically add author and copyright info to newly created ipython notebooks? | 0.197375 | 0 | 0 | 1,779 |
18,711,451 | 2013-09-10T05:43:00.000 | 2 | 0 | 0 | 0 | python,user-interface,wxpython,pyqt | 18,732,393 | 1 | true | 0 | 1 | The simple answer is, no. Or, if it is possible, it's certainly not easy.
Although there are many similarities in look and function between wxPython and PyQt, under the hood they are essentially different. | 1 | 0 | 0 | I want to use Grid from wxpython and use it in my GUI which is based on PyQt. Is it possible? | Can wxpython and PyQt be used together in same GUI? | 1.2 | 0 | 0 | 264 |
18,711,815 | 2013-09-10T06:12:00.000 | 5 | 0 | 0 | 0 | python,html,plone | 18,714,130 | 1 | true | 1 | 1 | You can create a static text portlet in that context you need it: folder, page. | 1 | 0 | 0 | Hi want to add text box and label in plone site
but, that plone site does not display text box
how can i create text box in plone site
thanks! | How to create text box in plone site | 1.2 | 0 | 0 | 111 |
18,715,563 | 2013-09-10T09:44:00.000 | 2 | 0 | 1 | 0 | python,text-to-speech | 21,506,735 | 1 | true | 0 | 0 | Yes, neospeech is a language library. By installing it, you can just set the voice of pyttsx and tts Chinese as well. | 1 | 2 | 0 | I want to know how to text-to-speech Chinese using the python package 'pyttsx'. It seems to need some other modules like neospeech. | How to TTS Chinese using pyttsx | 1.2 | 0 | 0 | 2,532 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.