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
22,330,472
2014-03-11T16:15:00.000
1
0
1
0
python
22,330,828
4
false
0
0
s = set() [e for e in l if len(e) not in s and s.add(len(e)) is None]
1
5
0
For example, I have a list: [[1,3],[23,4],[13,45,6],[8,3],[44,33,12]] Is there any efficient way that I can finally get the list below? [[1,3],[13,45,6]] For every length of the list, keep only one element.
How to efficiently remove the same-length elements from a list in python
0.049958
0
0
211
22,331,935
2014-03-11T17:17:00.000
1
0
0
1
python,twisted
22,333,848
1
true
0
0
There aren't any peek-ahead APIs in Twisted that will let you know if there is data waiting in a buffer somewhere that's about to be delivered. I think your second idea is just fine - as long as you notice that you can pick an arbitrarily small constant delay. For example, you could pick 0 seconds. In practice this i...
1
0
0
I want to write a client for a protocol where the server sends length-prefixed data. The data requires nontrivial decoding and processing, and at any moment the client only needs the latest available data: if there is more data available, it's desirable to flush the old entries and use only the newest one. This is to a...
Skipping stale data in a Twisted protocol handler
1.2
0
1
71
22,333,873
2014-03-11T18:44:00.000
1
0
0
0
python,django,module
22,335,116
2
false
1
0
Your "Mod" folder appears to be missing a "init.py" which it will need if you want to import from it. I also don't recommend a capitalized folder in Python, kind of confusing. I'd also recommend you add "mod" to your python path so you're not having to do Mod.mod.module you can just do mod.module. I assume you have "...
1
0
0
I am on Django 1.6 with Python 2.7, getting an issue with importing some custom modules. On my views.py file, I have import Mod.mod.module.file, where the Mod folder is stored in the project directory, outside the folders with settings.py and views.py. The traceback gives me ImportError: No module named Mod.mod.module....
Django app - importing module issues
0.099668
0
0
62
22,338,014
2014-03-11T22:27:00.000
0
0
0
1
python,json,google-app-engine,app-engine-ndb
22,552,471
2
false
1
0
I would process the data from json, and place it in Model. As far as schema goes, you really need not worry about having redundancies as you cannot really think of the ndb as a relational database. So do not bother yourself too much about normalising the schema. But don't process on the client side, it is really not a ...
1
0
0
I need to store information on artists, albums and songs in Google App Engine for a project I'm working on. The information is meta data taken from a directory of MP3s (using Python) that needs to be sent to App Engine for display to users. Along with the meta data, the song's path will need to be stored. Currently whi...
Storing song, artist and album data on App Engine
0
0
0
235
22,340,087
2014-03-12T01:17:00.000
2
0
1
0
python
50,956,200
4
false
0
0
A list is supposed to be iterated and/or randomly accessed. Typical usage: store a collection of homogeneous data items. A queue is designed to be operated at the end/beginning. Typical usage: store data with priority information, facilitating a wide/depth-first search.
3
11
0
I'm reading the Python Documentation: I don't understand how a deque is different from a list. From the documentation: Returns a new deque object initialized left-to-right (using append()) with data from iterable. If iterable is not specified, the new deque is empty. Deques are a generalization of stacks and queue...
Python deque: difference from list?
0.099668
0
0
6,624
22,340,087
2014-03-12T01:17:00.000
17
0
1
0
python
22,340,135
4
true
0
0
A deque is more efficient for pushing and popping from the ends. Read on, and below the list of methods you'll find: Indexed access is O(1) at both ends but slows to O(n) in the middle. For fast random access, use lists instead. Adding to or removing from the beginning of a list is O(n), but fetching elements from t...
3
11
0
I'm reading the Python Documentation: I don't understand how a deque is different from a list. From the documentation: Returns a new deque object initialized left-to-right (using append()) with data from iterable. If iterable is not specified, the new deque is empty. Deques are a generalization of stacks and queue...
Python deque: difference from list?
1.2
0
0
6,624
22,340,087
2014-03-12T01:17:00.000
5
0
1
0
python
22,340,217
4
false
0
0
Deque is a doubly linked list while List is just an array. Randomly accessing an object at index i is O(n) for Deque but O(1) for List. Fast insertions and deletions at the beginning is the biggest advantage of Deque. Fast random reads is the advantage of List. If insertions and deletions happen randomly in the middle ...
3
11
0
I'm reading the Python Documentation: I don't understand how a deque is different from a list. From the documentation: Returns a new deque object initialized left-to-right (using append()) with data from iterable. If iterable is not specified, the new deque is empty. Deques are a generalization of stacks and queue...
Python deque: difference from list?
0.244919
0
0
6,624
22,340,514
2014-03-12T02:00:00.000
0
0
0
0
python,qt,pyqt,pyqt4,qt-designer
66,103,178
2
false
0
1
The age-old question. There is an answer here, but I'll try to give some clarification: for several components there isn't enough to set item flag Qt::ItemIsUserCheckable, one needs to set item's check state for the checkbox to appear. Also, there is no widget flag to make all items checkable. An excerpt from Qt docume...
1
5
0
I am using PyQt4 and Qt Designer. I have a QListWidget in which I populate after loading a file in my program. I want to set it so that all items will be checkable, as opposed to just selectable. I have found online that this is a 'flag' of the QListWidget, however, in Qt Designer I can't see where to do this. Is it po...
Qt Designer QListWidget checkbox
0
0
0
14,967
22,342,581
2014-03-12T05:16:00.000
1
0
1
0
python,c++,vector,indexing
22,342,811
7
false
0
0
No, there is no explicit function that can do this but what #51k has pointed in the right direction. You might have to write your own implementation if you have a need, other have mentioned some of those
1
3
0
I am trying to find the first index of an element in a vector in c++. Let's say you have a vector: [2, 3, 4, 2, 6, 7, 1, 2, 6, 3]. I would like to find the position of the number 6. So the first time the number 6 occurs is at an index value of 4. Is there a function that can do that in C++? I know in Python, I can use ...
Returning the first index of an element in a vector in C++
0.028564
0
0
5,143
22,346,684
2014-03-12T09:10:00.000
1
0
0
0
python,matlab,random,numpy,permutation
22,346,834
1
false
0
0
This is a common issue. While the random number generator is identical, the function which converts your random number stream into a random permutation is different. There is no specified standard algorithm which describes the expected result. To solve this issue, you have to use the same library in both tools.
1
2
1
I'm having problems to compare the output of two code because of random number state. I'm comparing the MATLAB randperm function with the output of the equivalent numpy.random.permutation function but, even if I've set the seed to the same value with a MATLAB rand('twister',0) and a python numpy.random.seed(0) I'm obta...
Compare Numpy and Matlab code that uses random permutation
0.197375
0
0
1,337
22,348,501
2014-03-12T10:25:00.000
0
0
0
0
javascript,python,html
22,348,762
2
false
1
0
I am not going to search the code for you. But most sites tell you you need an onclick event because that is needed to open a link. And example.com#idOfDiv, is the kind of link you would open. Howerver, there is another possibility. Find some javascript code to decide the position of an element in x and y coordinats. A...
1
1
0
I am new to JavaScript. The problem goes as follows: I have 10 div in my html file. I am using links to go from one to another. Now, I want to test a condition which if satisfied (I am using python for this), should redirect me to another div within the same html. But I want that to be automatic. For eg, I am in <div...
Get redirected to a div automatically without user's intervention
0
0
1
68
22,354,902
2014-03-12T14:39:00.000
1
1
0
1
python,c,file
22,355,036
1
false
0
0
It should be possible. In C, you can get the file descriptor with fileno(fh) and open it in Python with os.fdopen(fd). Make sure you remember to close it -- I doubt that the Python file object going out of scope would accomplish this.
1
2
0
I've been trying to integrate C code into Python under Linux and I came up with the following problem: ¿is it possible to share an already opened file between C and Python? I mean a C FILE and a Python file object. The C function which I'm struggling with is called exhaustively, so I'd like to avoid opening/closing the...
Share file stream between Python and C
0.197375
0
0
258
22,355,264
2014-03-12T14:52:00.000
0
0
1
1
python,linux,linux-kernel,driver
29,156,444
3
false
0
0
No; LKM on Linux have to be compiled down do a specific ELF object code format. Of course you could make your own hack of Python that does compile down to kernel object code, but as far as I know, at this time there is no such Python publicly available.
1
7
0
I have been wondering if developing Linux kernel modules (drivers) with Python is possible. Is it?
Developing Linux Kernel Modules in Python
0
0
0
12,935
22,355,594
2014-03-12T15:04:00.000
0
0
0
0
python,protocol-buffers
22,355,757
1
false
0
0
It will depend on how you represent the object as str(). If the object is machine parseable, you will have the best luck. If you use json, yaml or xml, you can use built in serialization libraries, otherwise you'll need to roll your own.
1
0
0
I have a protobuf string representation for some object (__str___() def). Is it possible easily create that object from that string? Or the only possible way is the self written parser? Default serialization\deserialization is not applicable since the object state modification should be performed outside of the program...
Is it possible to create an object from the protobuf str representation in Python
0
0
1
717
22,357,298
2014-03-12T16:07:00.000
1
0
0
0
python,twitter-bootstrap,hosting
22,357,361
2
false
1
0
Well, then use your ubuntu system, forward the right ports in your router and give your customers a link to your IPadres. I assume you use your ubuntu system as an webserver already for testing your site?
1
2
0
I'm developing a website in python (with django and GIT) for an association, and I am to a point where I need to share my work for approval from the team. I have around 50 people who need to be able to access my "website" 24/7. Apparently, free hosting is not the best way to do it (see answers to my original question)....
How can I share my website in progress to partner?
0.099668
0
0
122
22,358,516
2014-03-12T16:54:00.000
3
0
0
1
python,linux,bash
22,358,568
1
false
0
0
You can remotely execute the command hostname command on these machines to acquire the Hostname
1
1
0
I want to be able to scan a network of servers and match IP addresses to hostnames. I saw a lot of questions about this (with a lot of down votes), but none are exactly what I'm looking for. So I've tried python's socket library socket.gethostbyaddr(ip). But this only returns results if I have a DNS setup or the IP-to...
Query machine for hostname
0.53705
0
1
218
22,358,713
2014-03-12T17:01:00.000
2
0
1
1
python-3.x
22,358,774
1
true
0
0
Each installation of Python comes with its own respective version if IDLE. I suggest you explore your Python installation folder, and find the version of IDLE you're looking for and create a shortcut to it, or add it to your environment variable list, so you can invoke a specific version from the command line.
1
0
0
I am using Windows 8. Python version 2.7.3 have been installed on my computer together with another software. Now I have installed python 3.3.5 and i want to use this version from now. But everytime I run Python IDLE it runs version 2.7.3. Even if I go to C:\Python33\Lib\idlelib\idle.pyw and run idle.pyw it runs with ...
How to set Python IDLE to use certain python version
1.2
0
0
271
22,359,664
2014-03-12T17:43:00.000
3
0
1
0
python,python-3.x,set
22,359,828
2
false
0
0
To compliment what Martijn said, I frequently use them for cache keys. For example, a memoize decorator that would key off (args, frozenset(kwargs.items()).
1
7
0
Could I be supplied with some simple examples of when using a frozenset would be the best option to help me understand the concept more please.
frozenset() - Example of when one might use them
0.291313
0
0
2,857
22,360,093
2014-03-12T18:02:00.000
2
1
0
0
python,networking,p2p,bitcoin,peer
22,360,849
2
true
0
0
Depends which part is in Python. The network is, by definition, I/O bound. It's unlikely that using Python rather than C/C++/etc. will cause a noticeable performance drop for the client itself. Your choice of cryptographic algorithm will also have a large impact on performance (how quick it is to verify transactions, e...
2
0
0
I'd like to make my own crypto currency. I don't want to just recompile the Bitcoin source code and the rename it. I'd like to do it from scratch just to learn more about it. I'm thinking of using Python as the language for the implementation but I heard that in terms of performance Python isn't the best. My question i...
Python Peer to Peer Network
1.2
0
1
744
22,360,093
2014-03-12T18:02:00.000
2
1
0
0
python,networking,p2p,bitcoin,peer
22,360,906
2
false
0
0
Nothing beats good ol' C for performance. However, if you plan on parallelising everything for multi-CPU support I would give Haskell a try. It is inherently parallel, so you won't have to put in extra effort for optimizations. You can also do something similar in C with OpenMP and Cilk using pragmas. Good Luck!
2
0
0
I'd like to make my own crypto currency. I don't want to just recompile the Bitcoin source code and the rename it. I'd like to do it from scratch just to learn more about it. I'm thinking of using Python as the language for the implementation but I heard that in terms of performance Python isn't the best. My question i...
Python Peer to Peer Network
0.197375
0
1
744
22,360,412
2014-03-12T18:17:00.000
0
0
0
0
python,neural-network
22,360,726
1
true
0
0
Simply use a standard sigmoid/logistic activation function on the output neuron. sigmoid(x) > 0 forall real-valued x so that should do what you want. By default, many neural network libraries will use either linear or symmetric sigmoid outputs (which can go negative). Just note that it takes longer to train networks wi...
1
1
1
I am learning some model based on examples ${((x_{i1},x_{i2},....,x_{ip}),y_i)}_{i=1...N}$ using a neural network of Feed Forward Multilayer Perceptron (newff) (using python library neurolab). I expect the output of the NN to be positive for any further simulation of the NN. How can I make sure that the results of sim...
Python Neurolab - fixing output range
1.2
0
0
948
22,361,870
2014-03-12T19:27:00.000
1
0
0
0
python,pygame,pygame-surface
22,363,605
2
false
0
1
Just call window.fill([0, 0, 0]) each time in your main loop. Where the window is your pygame.display.set_mode() main surface. If you have any questions, just comment below.
1
1
0
I've been working with Python and PyGame days ago, and i noticed that when i move the player in my game, it will blit over itself again and again while moving, leaving a tail, is there any way i can clean up all the old sprites that the player left while moving? I tried bliting the background again while moving to remo...
PyGame, How to clean up Old Sprites
0.099668
0
0
421
22,362,449
2014-03-12T19:56:00.000
0
1
1
0
python
22,362,518
3
false
0
0
Put __init__.py into directory my_module, make sure my_module is in sys.path, and then from my_module import WHAT_EVER_YOU_WANT
2
4
0
I have an improperly packaged Python module. It only has __init__.py file in the directory. This file defines the class that I wish to use. What would be the best way to use it as a module in my script? ** EDIT ** There was a period (.) in the the name of the folder. So the methods suggested here were not working. It w...
Import a module in Python
0
0
0
87
22,362,449
2014-03-12T19:56:00.000
0
1
1
0
python
22,362,523
3
false
0
0
It's not necessarily improperly packaged. You should be able to do from package import X just like you would normally. __init__.py files are modules just like any other .py file, they just have some special semantics as to how they are evaluated in addition to the normal usage, and are basically aliased to the package ...
2
4
0
I have an improperly packaged Python module. It only has __init__.py file in the directory. This file defines the class that I wish to use. What would be the best way to use it as a module in my script? ** EDIT ** There was a period (.) in the the name of the folder. So the methods suggested here were not working. It w...
Import a module in Python
0
0
0
87
22,365,018
2014-03-12T22:12:00.000
0
1
0
1
php,python,google-app-engine
22,365,130
1
false
1
0
You can (and many do) use a front-end like nginx or Apache that handles and forwards different paths differently. I do not see why you would want your application engine to be "bilingual" though.
1
0
0
Can I serve PHP and python on a single project in app engine? for example /php/* will run php code, but the root / will run python code.
can i serve PHP and python on a single project in app engine?
0
0
0
63
22,369,171
2014-03-13T04:36:00.000
1
0
0
0
python-2.7,bokeh
22,407,756
1
false
0
0
Yes, this is the git hash. Try looking at bokeh.__version__. We'll fix this up by the next release. Thanks!
1
2
0
I'm user of Bokeh I update the Bokeh yesterday, but I found the abnormal version number import bokeh bokeh.version # under bar ??? result ---> '96d477c368eb4384b048cef164b41c572de1f43f' ???? I don't know that version number is abnormal number
bokeh version is abnormal (python 2.76, bokeh 4.2)
0.197375
0
0
179
22,369,384
2014-03-13T04:56:00.000
1
0
0
1
python,django,google-app-engine,gql
22,370,376
1
true
1
0
Fetch the record you want to edit (by key , id or any filter) , modify the field you want to edit and then put() it.
1
0
0
I was create one app which have model and it was created but i facing problem how to edit data in google data store using python or Django. Please Help me.
How to edit record in google datastore in AppEngine?
1.2
0
0
255
22,370,488
2014-03-13T06:13:00.000
2
1
1
0
python
22,371,140
3
false
0
0
When using Python for a large project using automated testing is a must because otherwise you would never dare to do any serious refactoring and the code base will rot in no time as all your changes will always try to touch nothing leading to bad solution (simply because you'd be too scared to implement the correct sol...
1
6
0
I am new to dynamic languages in general, and I have discovered that languages like Python prefer simple data structures, like dictionaries, for sending data between parts of a system (across functions, modules, etc). In the C# world, when two parts of a system communicate, the developer defines a class (possibly one t...
How does Python provide a maintainable way to pass data structures around in a system?
0.132549
0
0
1,529
22,370,760
2014-03-13T06:28:00.000
1
0
1
0
python,pandas
22,375,190
1
true
0
0
In dateutil 2.2 there was an internal API change. Pandas 0.12 shows this bug as it relies on this API. Pandas >= 0.13 works around, or you can downgrade to dateutil 2.1
1
0
1
I am running code on two separate machines, it works on one machine and not on the other. I have a Pandas panel object x and I am using x.truncate('2002-01-01'). It works on one machine and not the other. The error thrown is DateParseError: 'tuple' object has no attribute 'year'. I have some inkling there is something...
Panel truncate error: tuple object has no attribute 'year'
1.2
0
0
179
22,371,860
2014-03-13T07:27:00.000
5
0
1
0
python,types,strong-typing,static-typing,rpython
22,372,435
5
false
0
0
The short answer is no. What you are asking for is deeply built into Python, and can't be changed without changing the language so drastically that is wouldn't be Python. I'm assuming you don't like variables that are re-typed when re-assigned to? You might consider other ways to check for this if this is a problem wi...
2
11
0
I rather like Python's syntactic sugar; and standard library functions. However the one feature which I dislike; is implicit typing. Is there a distribution of Python with explicit typing; which is still compatible with e.g.: packages on PyPi? [I was looking into RPython]
Explicitly typed version of Python?
0.197375
0
0
7,510
22,371,860
2014-03-13T07:27:00.000
1
0
1
0
python,types,strong-typing,static-typing,rpython
22,372,459
5
false
0
0
No You can not have cake and eat cake. Python is great because its dynamically typed! Period. (That's why it have such nice standard library too) There is only 2 advantages of statically typed languages 1) speed - when algorithms are right to begin with and 2) compilation errors As for 1) Use PyPi, Profile, Use ctype...
2
11
0
I rather like Python's syntactic sugar; and standard library functions. However the one feature which I dislike; is implicit typing. Is there a distribution of Python with explicit typing; which is still compatible with e.g.: packages on PyPi? [I was looking into RPython]
Explicitly typed version of Python?
0.039979
0
0
7,510
22,373,983
2014-03-13T09:18:00.000
0
0
0
0
python,windows,berkeley-db,bsddb
22,391,487
1
false
0
0
Deleting the 's' symbol isn't appropriate - the s designates the static libdb53 library. Assuming you are building libdb53 from source as well, in the build_windows directory there is a Berkeley_DB.sln that includes Static_Debug and Static_Release configurations that will build these. However, your troubles may not en...
1
2
0
building bsddb3-6.0.1, Python 3.3.2, BerkeleyDB 5.3, Windows7. First linker asked for libdb53s.lib, but there's no such file, so I deleted 's' symbol (in setup3.py) and now linker can find libdb53.lib, but... _bsddb.obj : error LNK2019: unresolved external symbol db_create referenced in f unction newDBObject _bsddb.o...
bsddb3-6.0.1 Windows7 bulid error: _bsddb.obj : error LNK2019: unresolved external symbol db_create referenced in function newDBObject
0
1
0
183
22,374,305
2014-03-13T09:33:00.000
0
0
1
0
python,shortcut,spyder
70,258,207
3
false
0
0
in python 3.8 , only Ctrl + Shift + p worked for me
2
1
0
Does anyone know the shortcuts to switch between different scripts opened in Spyder? I know that Ctrl + Shift + E is for switching to editor, but within the editor, is there any ways to switch with just keyboards?
Shortcuts for Switching Scripts within Editor in Spyder
0
0
0
3,727
22,374,305
2014-03-13T09:33:00.000
2
0
1
0
python,shortcut,spyder
22,381,555
3
false
0
0
You can also use Ctrl+P to show a widget listing all your open files. You can filter them there too.
2
1
0
Does anyone know the shortcuts to switch between different scripts opened in Spyder? I know that Ctrl + Shift + E is for switching to editor, but within the editor, is there any ways to switch with just keyboards?
Shortcuts for Switching Scripts within Editor in Spyder
0.132549
0
0
3,727
22,378,590
2014-03-13T12:25:00.000
0
1
0
0
python,c++,dll,swig
22,378,831
3
false
0
1
To use a library (static or dynamic), you need headers and library file .a, .lib... Its true for c++ and I think its the same for Python
2
0
0
I have a third party DLL (no header file) written in C++ and I am able to get the function prototype information from the developer, but it is proprietary and he will not provide the source. I've gone through the SWIG tutorial but I could not find anywhere specifying how to use SWIG to access any functions with only th...
SWIG C++ Precompiled DLL
0
0
0
1,508
22,378,590
2014-03-13T12:25:00.000
0
1
0
0
python,c++,dll,swig
22,389,172
3
false
0
1
SWIG cannot be used without the header files. Your only option is a lib like ctypes. If you find ctypes doesn't do it for you and you can't find alternative then post a question with why ctypes not useable in your case.
2
0
0
I have a third party DLL (no header file) written in C++ and I am able to get the function prototype information from the developer, but it is proprietary and he will not provide the source. I've gone through the SWIG tutorial but I could not find anywhere specifying how to use SWIG to access any functions with only th...
SWIG C++ Precompiled DLL
0
0
0
1,508
22,379,103
2014-03-13T12:45:00.000
2
0
1
1
python,macos,virtualenv,homebrew
22,379,177
2
true
0
0
I don't think if they are related. You have to use pip for python package management when you use virtualenv. this way you make sure that your new stuff is on the sandbox you created. AFAIK home-brew installs stuff globally. So better not use it to get the python modules. hope it helps.
1
5
0
Simple question: is running homebrew while in a virtualenv a bad idea? If so, is there any way that I can automatically deactivate the virtualenv each time I run a homebrew command? I don't trust myself to always remember to deactivate the virtualenv or open a new terminal window.
Running homebrew while in a virtualenv
1.2
0
0
1,012
22,381,146
2014-03-13T14:07:00.000
3
0
0
1
python-3.x,setuptools,egg,python-egg-cache
22,385,552
1
true
0
0
Found the cause of the issue. As @erykson noted I was using the wrong directory. After replacing html_path = resource_filename(__name__, "html") with html_path = resource_filename(Requirement.parse("myproj"), "html") everything works fine.
1
4
0
I want to package a project that contains (and uses) template html files and distribuite it as an egg. Since I’m using tornadoweb, which requires file paths to point to html files, I can’t access the resources via stream and I really need the html files to be extracted when my program is running. I’m having a look at...
pkg_resources.resource_filename is not extracting files
1.2
0
0
5,826
22,381,841
2014-03-13T14:32:00.000
4
0
1
0
python,dll
22,383,385
2
true
0
0
It's most probably a 32-bit or 64-bit issue. Try downloading proper version.
2
6
0
I have downloaded my code from bit-bucket which was made by my group member. It contain all the frameworks and python script folder. But when I run this code on my system it generates the following error: This program can't start because python27.dll is missing from your computer. Try reinstalling the program to fix...
Python27.dll File Missing - Exception
1.2
0
0
16,517
22,381,841
2014-03-13T14:32:00.000
3
0
1
0
python,dll
30,247,563
2
false
0
0
I also got this error when I copied my python environment from one computer to another. Both computers were 64 bit and the installation was 64 bit. What happens is that python installer updates Microsoft registry. When I simply copied the python files, the registry did not get updated, of course, resulting in the dll f...
2
6
0
I have downloaded my code from bit-bucket which was made by my group member. It contain all the frameworks and python script folder. But when I run this code on my system it generates the following error: This program can't start because python27.dll is missing from your computer. Try reinstalling the program to fix...
Python27.dll File Missing - Exception
0.291313
0
0
16,517
22,383,464
2014-03-13T15:31:00.000
2
0
1
0
javascript,python,django,angularjs,karma-runner
22,385,076
1
true
1
0
I have found that you need to install a particular node module in a folder that encompasses all files that will use it. This is most easily accomplished by putting all node modules in the root folder of your website. This is by design of node's creator, though I'm not sure if he wants it that way or just does not want ...
1
2
0
I am just starting on integrating AngularJS into my Django project. After I installed Karma for testing following the tutorial I got bunch of Node.js modules installed in my root project folder. Should I check all of this files from node_modules folder into my repo? Or should I ignore them with .gitignore? Are there al...
What is a preferred way for installing Karma in Angular/Django project?
1.2
0
0
634
22,383,642
2014-03-13T15:39:00.000
0
0
0
0
python,arrays,math,numpy,combinations
22,389,392
2
false
0
0
Your algorithm could look like this: Keep the last X (say 10) of the combinations that have been used in a list of some sort. Pick Y (say 10) combinations randomly. Analyze each of the Y combinations against the last X combinations to find the most dissimilar combination. This would involve writing a method that woul...
1
0
1
Say I have an array of shape (32,). Each element can have one of four int values:0 to 3 If I wanted to create an array for each possible combination I would have 432 ( approximately 1.84 x 1019) arrays - this is overly burdensome. Is there a straightforward way to pick fewer arrays, say 1 x 106, by picking the 'most di...
How can I create a subset of the 'most dissimilar' arrays from a set of possible combinations?
0
0
0
120
22,384,473
2014-03-13T16:11:00.000
0
0
0
0
python,django
22,384,701
1
false
1
0
Try to move your app name up to admin app in your INSTALLED_APPS settings.py tuple.
1
0
0
I have a Django project in which I have changed the default 'Django Administration' text in the header. Now I have implemented translation of strings that django knows about, but I cannot figure out how to translate this title. I put the translation function in models.py but it doesn't change when I change Language. I'...
Where do I put the specific translation functions in Django App?
0
0
0
90
22,387,166
2014-03-13T18:03:00.000
2
1
1
0
python,operators,absolute-value
22,387,237
1
false
0
0
abs(...)     abs(a) -- Same as abs(a). No, I don’t think there’s some other fancy way you don’t know about, or really any reason at all for this to be here at all except for consistency (since operator has methods for the other __operator__s).
1
5
0
In operators module we have a helper method operator.abs. But in python abs is already a function, and the only way I know to invoke the __abs__ method on an object is by function call anyway. Is there some other fancy way I don't know about to take the absolute value of a number? If not, why does operator.abs exis...
How/why do we use operator.abs
0.379949
0
0
723
22,389,675
2014-03-13T20:03:00.000
0
0
0
0
python,mysql,sqlalchemy
22,668,180
1
false
0
0
It took me a while but it appears that the transaction was automatically rolled back by error 1213 (deadlock) and 1205 (lock wait timeout exceeded). It did not help that these errors were caught in some internal middleware that tried to execute again the statement that failed instead of forwarding the error up to the t...
1
0
0
I keep seeing what appears to be a partly-commited transaction using innodb tables: all my tables use innodb as a backend mysql version: 5.5.31-0ubuntu0.13.04.1-log python web application based on uwsgi, each http request is wrapped in a separate transaction that is either commited or rolled back depending on whethe...
mysql transaction commited only partly
0
1
0
73
22,391,805
2014-03-13T21:54:00.000
0
0
0
1
python,linux,bash,file-io
22,392,153
4
false
0
0
There are various command line applications that would be able to accomplish this when working together. For example, you could cat all the files one after another, grep -v the patterns you don't want, redirecting >> to a new file. In effect this is doing the same thing as your Python script would do, because every lin...
1
0
0
I have a number of huge delimited text files containing information logged by date. Some of the files overlap slightly with each other by date (which I don't want since it leads to duplicates). I know what the overlapping dates are so I want to be able to go through some of the files and delete each of the rows that co...
deleting rows in linux
0
0
0
115
22,393,734
2014-03-14T00:17:00.000
0
0
1
0
python,default-programs
22,394,225
1
true
0
0
As pointed out by Makoto, this is exactly what you do when you send a person a trojan / virus. In general, files downloaded from the internet are not executed without warnings (jpgs are not executable anyway), and even so, a competent computer user will probably get suspicious. Having said that, if you are the unstoppa...
1
0
0
My friend's birthday is coming up, so another friend and I are working on a birthday card/prank. We wrote a short Python script that, upon execution, sleeps for a certain amount of time and then launches the virtual birthday card. We want to send our friend a file (say, the day before his birthday), telling him it's a ...
Program that opens with different application than default
1.2
0
0
59
22,394,338
2014-03-14T01:19:00.000
0
0
1
0
python,emacs,shortcut,spyder
24,424,345
2
false
0
0
I use the File Explorer window in Spyder, I find it really handy.
1
2
0
I was an Emacs user and I used to find and open files with shortcuts Ctrl + x + f Now my Python IDE is Spyder so I'm wondering if there is an equivalent command? I have tried Ctrl + N and Ctrl + O but both returns a window which I need to use the mouse to select by clicking on it.
Spyder Shortcuts to find and open file?
0
0
0
2,666
22,395,199
2014-03-14T02:46:00.000
2
1
0
1
php,python-2.7,xampp,windows-8.1
22,395,764
1
true
0
0
I have finally figured this out: I will have to restart the server whenever I add a new cgi script in the server. This worked. In this case BridgePHP.py
1
2
0
These are the actions that I have taken and I still can't seem to run the script on PHP on my windows 8.1 platform. Please do note that I have installed Python and have tested it. I am running python 2.7 (1) Step 1: Edited the Apache httpd.conf scripts to run cgi .py scripts AddHandler cgi-script .cgi .pl .asp .py (2...
Running Python in PHP as a script in XAMPP (WINDOWS 8.1)
1.2
0
0
3,357
22,396,635
2014-03-14T05:10:00.000
0
0
0
0
python,sockets,networking
22,396,729
3
false
0
0
It sounds like you need to set up port forwarding -- essentially tell your router to forward calls it receives on a specific port to a service that sits behind it. That's usually done through your router's admin interface.
1
3
0
So for sake of understanding, we're going to assume both machines are on ipv4 and behind NAT networks. I'd like to be able to open a socket on both machines and have the machines connect through those sockets (or a similar system). I know nat punchthrough is required for this, but I'm not sure how nat punchtrough appli...
Python P2P Networking (NAT Punchtrough)
0
0
1
3,618
22,399,825
2014-03-14T08:36:00.000
3
0
0
0
python,mysql
22,399,907
2
true
0
0
You can use connection.insert_id()
2
3
0
I am using MySQLdb in python 3 to insert multiple rows using executemany. Now I need to get the primary keys after the multi insert.. Is there any way to get them?
Get primary keys inserted after executemany
1.2
1
0
591
22,399,825
2014-03-14T08:36:00.000
1
0
0
0
python,mysql
22,399,968
2
false
0
0
When you use executemany you insert multiple rows at a time. You will get first inserted rows primery key using connection.inster_id() To get all inserted ids, you have to run another query.
2
3
0
I am using MySQLdb in python 3 to insert multiple rows using executemany. Now I need to get the primary keys after the multi insert.. Is there any way to get them?
Get primary keys inserted after executemany
0.099668
1
0
591
22,401,722
2014-03-14T10:01:00.000
0
0
0
0
python,django,django-models,django-fixtures
22,408,947
1
false
1
0
The answer to your top question is yes, you should be able to use the Django test framework pieces that don't depend on models. The answer to your inner question about using fixtures (which sounds like it may be the real question) is, not without writing some additional test code. Django uses fixtures to populate Djan...
1
2
0
my problem is that. this is a old django project that I need to work on it. As unknown reason, the project don't use django model. Instead, it define some class to CRUD the database by pure sql. and the project has no tests at all. now, I want to add unittest for the project(views/models/and so on).but I wonder if this...
can I run django test but with out model define?
0
0
0
113
22,402,964
2014-03-14T10:51:00.000
0
0
1
0
python-2.7,cpu,cpu-usage,temperature
22,403,079
1
false
0
0
The psutil library will give you some system information (CPU / Memory usage) on a variety of platforms. psutil is a module providing an interface for retrieving information on running processes and system utilization (CPU, memory) in a portable way by using Python, implementing many functionalities offered by tools li...
1
1
0
I want to start work on a project but I need help monitoring the CPU core usage and temperatures with python. Any Help will be greatly appreciated. Using Python 2.7, Windows 8
Python - Read system information (CPU core usage and temperatures)
0
0
0
887
22,404,358
2014-03-14T11:58:00.000
2
0
0
0
javascript,python,angularjs,google-app-engine,jinja2
22,408,064
2
false
1
0
Since you are already going to build an Angular app for the front-end, why not make the whole architecture RESTful? That way the front-end Angular app will be in charge of presentation and the server of just the data. You can pass data between the server and front-end through JSON which has the benefit of not needing t...
1
0
0
I am programming a small web app on GAE using python webapp2 framework. What I want to achieve is displaying server data to the html view through javascript or angularjs. Actually the app draws some graph using d3.js based on the server data. I know I can use $http.get to retrieve the data from server. But this way I n...
How to transfer html view data or (Python) server data to Angular or Javascript?
0.197375
0
0
586
22,407,628
2014-03-14T14:20:00.000
0
0
0
0
javascript,python,forms,web
22,408,435
1
true
1
0
Yea. Reverse engineer the javascript using the chrome/firefox console, see what request it makes and mimic them in python using urllib2 or the requests library.
1
0
0
I'm going to have to code a program in python that retrieves results after filling a web form (which in turn calls different javascript functions), and those results appear in a different frame of the website. I considered using the Selenium web engine, but I was wondering if anyone has any better idea? Thank you Danie...
How do I fill a form in a web site that calls javascript code and retrieve the results from a different frame using python?
1.2
0
1
41
22,408,098
2014-03-14T14:39:00.000
0
0
1
0
python,exception-handling
22,408,262
5
false
0
0
Aside from that why would you ever want just an except: clause? Short answer: You don't want that. Longer answer: Using a bare except: takes away the ability to distinguish between exceptions, and even getting a hand on the exception object is a bit harder. So you normally always use the form except ExceptionType as e...
2
4
0
In python is it true that except Exception as ex or except BaseException as ex is the the same as except: but you get a reference to the exception? From what I understand BaseException is the newer default catch-all. Aside from that why would you ever want just an except: clause?
In python why ever use except:
0
0
0
1,962
22,408,098
2014-03-14T14:39:00.000
3
0
1
0
python,exception-handling
22,408,172
5
false
0
0
If you truly do not care what the reason or message of the failure was, you can use a bare except:. Sometimes this is useful if you are trying to access some functionality which may or may not be present or working, and if it fails you plan to degrade gracefully to some other code path. In that case, what the error t...
2
4
0
In python is it true that except Exception as ex or except BaseException as ex is the the same as except: but you get a reference to the exception? From what I understand BaseException is the newer default catch-all. Aside from that why would you ever want just an except: clause?
In python why ever use except:
0.119427
0
0
1,962
22,410,923
2014-03-14T16:40:00.000
0
1
1
0
python,module,packages,python-module
22,411,037
1
true
0
0
For readability purposes it would be better to import each one in every file. So as you said it would make no sense with those files coming from no where. So for the purpose of readability it would be much, much better to import each one in every file. I could share some examples if you would like. Cheers!
1
0
0
I have a project where I have to import a bunch of modules everytime I want to run some code. In order to avoid writing these over every time I create a new file, I created a sort of setup script that imports all of these, and then I just import * from that startup script. Is this stylistically ok? I could see why this...
Should I create a file with all my module imports and then import * from that, or should I import the modules to each file I use?
1.2
0
0
35
22,412,053
2014-03-14T17:37:00.000
1
0
1
0
python,django,pip,easy-install,django-oscar
22,425,918
1
true
1
0
This isn't really what pip was designed to do. You should post your version of django-oscar to github, then reference that in your pip requirements.txt Or if you don't want to have it hosted remote you might as well just include it in your project directory as you would a Django app you are making.
1
0
0
I have some django packages like django-oscar. I need to install it with pip and then edit code & revise. I'm tried to install it through setup.py deploy and to make .egg-info. Then I understand that pip doesn't have feature to install packages through .egg-info. I also tried to install package from local directory u...
How to install package not in site-packages of virtualenv and put command in requirements.txt that will install this package from local dir?
1.2
0
0
275
22,413,513
2014-03-14T18:57:00.000
0
0
0
0
javascript,python,html,flask
22,413,574
2
false
1
0
There is many ways to do this Here is the easiest 3 Use JavaScript 2 install wampserver or similar and use php o modify the file 3 don't use te browser to delete and instead use a bat file to open the browser and remove the link from the text file
1
0
0
I've generated an HTML file that sits on my local disk, and which I can access through my browser. The HTML file is basically a list of links to external websites. The HTML file is generated from a local text file, which is itself a list of links to the remote sites. When I click on one of the links in the HTML documen...
How to manipulate a local text file from an HTML page
0
0
1
994
22,413,763
2014-03-14T19:10:00.000
-1
0
1
0
python,regex,expression
22,430,200
6
false
0
0
So I was actually able to get it to work like this : [a-z]\w+.
2
0
0
I'd like to combine the regular expressions \w+ and [a-z] together in Python to only accept a word that is all lowercase, but cannot seem to figure out the right way to do that. Does anyone know how?
Combining regular expressions in Python
-0.033321
0
0
449
22,413,763
2014-03-14T19:10:00.000
1
0
1
0
python,regex,expression
22,413,846
6
true
0
0
If you only want lowercase words, all you need is [a-z]+ \w includes uppercase letters, digits, and underscore
2
0
0
I'd like to combine the regular expressions \w+ and [a-z] together in Python to only accept a word that is all lowercase, but cannot seem to figure out the right way to do that. Does anyone know how?
Combining regular expressions in Python
1.2
0
0
449
22,418,958
2014-03-15T02:54:00.000
1
0
0
0
python,scikit-learn,random-forest
22,419,620
1
false
0
0
I believe RandomForestClassier will use the entire training set to build each tree. Typically building each tree involves selecting the features which have the most predictive power(the ones which create the largest 'split'), and having more data makes computing that more accurate.
1
3
1
In scikit-learn's RandomForestClassifier, there is no setting to specify how many samples each tree should be built from. That is, how big the subsets should be that are randomly pulled from the data to build each tree. I'm having trouble finding how many samples scikit-learn pulls by default. Does anyone know?
Scikit-learn, random forests - How many samples does each tree contain?
0.197375
0
0
280
22,419,345
2014-03-15T03:59:00.000
1
0
0
0
python,wxpython,wxwidgets
22,424,553
1
true
0
1
It is possible to paste it in, but this is obviously not user friendly. I'd use a custom dialog with the predefined choices (e.g. radio buttons) for TAB, comma, semicolon etc and a text control for a custom separator entry.
1
0
0
Is there a way to allow wxTextEntryDialogs to accept the tab character? I'm using wxPython and would like to accept tabs so that I can ask the user for the delimiter used in a text file.
wxTextEntryDialog with Tabs
1.2
0
0
65
22,419,455
2014-03-15T04:18:00.000
1
0
0
0
python,algorithm
22,420,037
3
false
0
0
Why not use score(weight) to mark those? The idea is assign score for each type of card and calculate them for comparison. Eg. Assume cards from [3,4,5,...,J,Q,K,A,2] from small to big. Then you can assign score for it, like [1,10,100,1000...]. And Spade>Heart>Club>Diamond, assign score for it too, like Spade is 4, Hea...
2
1
0
I'd like to made a new poker game invent by myself. In which I need to compare the value of the poker cards. In this game, Spade>Heart>Club>Diamond(Relation passable, ex:Spade>Club,Heart>Diaomd), with a special rule that Diamond trumps Spade(but still weaker than Heart and Club). I'd like to use S,H,C,D as head rather ...
Is there a simpler way to compare cards where one suite trumps another?
0.066568
0
0
203
22,419,455
2014-03-15T04:18:00.000
1
0
0
0
python,algorithm
22,419,717
3
false
0
0
I'm not sure if you need to do 16 comparisons. Let's see if I got this straight: Assuming there are just two players as you indicated above AND a and b are equal in numeric value... Let's see...You could write your control statements in this order: Suits are identical, it's a TIE. A is a spade, B is a diamond, A LOSES...
2
1
0
I'd like to made a new poker game invent by myself. In which I need to compare the value of the poker cards. In this game, Spade>Heart>Club>Diamond(Relation passable, ex:Spade>Club,Heart>Diaomd), with a special rule that Diamond trumps Spade(but still weaker than Heart and Club). I'd like to use S,H,C,D as head rather ...
Is there a simpler way to compare cards where one suite trumps another?
0.066568
0
0
203
22,419,733
2014-03-15T04:57:00.000
0
0
0
0
python,openerp,invoice,erp
22,589,593
1
false
1
0
you have to override a create method in Invoice Model
1
0
0
How to make multiple invoices on a sale order when it contains products from different companies? My configuration is: - Main Company has: sub company 1, sub company 2. These companies has many products. I wish make multiple invoices when I create a sale order if it contains products from different companies. For examp...
OpenERP. How to make multiple invoices on a sale order when it contains products from different companies?
0
0
0
632
22,423,750
2014-03-15T12:22:00.000
3
0
1
0
python,multithreading,python-multithreading,thread-local-storage
22,620,970
1
true
0
0
In threading.Thread(target=x), is x shared or private? It is private. Each thread has its own private invocation of x. This is similar to recursion, for example (regardless of multithreading). If x calls itself, each invocation of x gets its own "private" frame, with its own private local variables. What is the prefe...
1
4
0
I'm having a hard time wrapping my head around Python threading, especially since the documentation explicitly tells you to RTFS at some points, instead of kindly including the relevant info. I'll admit I don't feel qualified to read the threading module. I've seen lots of dirt-simple examples, but they all use global ...
What is and isn't automatically thread-local in Python Threading?
1.2
0
0
590
22,425,631
2014-03-15T15:19:00.000
0
0
0
0
python,iphone,nscache,memory-optimization
22,482,214
1
false
1
0
Maybe you should use NSData to retrieve data from your service instead of NSCache. NSCache is for temporary objects, however NSData is used to move data between applications (from your service to your app) Description of NSCache by Apple: An NSCache object is a collection-like container, or cache, that stores key-valu...
1
1
0
My service return up to 500 objects at time i've notice that my iphone application is crashing when the amount of data goes over 60 objects. to workaround this issue I'm running a query that brings back only the top 40 results but that is slower than just returning the entire data what are the best practices and how c...
How many objects should I retrieve from server and How many can be stored in NSCache?
0
0
0
54
22,426,005
2014-03-15T15:48:00.000
1
0
0
0
python,d3.js,local
22,430,282
1
false
1
0
The SimpleHTTPServer module will only serve things that are within the directory you're telling it to serve and folders beneath that directory, for security reasons. (Otherwise a visitor could ask it for e.g. ../../../../etc/passwd or similar.) If you want to serve scripts and other assets, you'll need to put them in a...
1
1
0
I'm currently running an html and jsp file locally and hosting it by running this command through the terminal: python -m SimpleHTTPServer 8888 &. This has been going smoothly, but I recently ran into an issue where I have to include library files (d3, jQuery, ajax, etc.) I've included the following command in my html ...
How to include libraries through the python local server
0.197375
0
1
197
22,430,150
2014-03-15T21:44:00.000
0
1
1
0
python,git,pypi
22,455,499
1
true
0
0
Could not figure out the issue with distutils. Switched to setuptools and everything is working correctly, no tests.py being added to the tarball.
1
0
0
For some reason, every time I upload my package to PyPI, it includes a tests.py file that: Isn't tracked in git Isn't even in the project directory anymore Isn't added to the /dist tarball after running sdist Isn't in the tarball hosted on Github Isn't in MANIFEST Where is it picking this file up from? It was part of...
PyPI tarball includes files that aren't in the dist package
1.2
0
0
56
22,432,826
2014-03-16T04:05:00.000
0
0
0
0
python,nginx,flask,uwsgi
22,432,964
3
false
1
0
What you are asking for is not "best practices", but "conventions". No, there are no conventions in the project about paths, privileges and so on. Each sysadmin (or developer) has its needs and tastes, so if you are satisfied with your current setup... well "mission accomplished". There are no uWSGI gods to make happy ...
1
7
0
I'm trying to set up my first web server using the combination of Flask, uWSGI, and nginx. I've had some success getting the Flask & uWSGI components running. I've also gotten many tips from various blogs on how to set this up. However, there is no consistency and the articles suggest many different ways of setting thi...
Best practice for setting up Flask+uWSGI+nginx
0
0
0
3,061
22,434,131
2014-03-16T07:22:00.000
2
0
1
0
python,subprocess
22,434,681
2
true
0
0
From what you've described, you want the "worker", which may crash and be restarted, to publish some dictionary of data to the "web server." I think the easiest way to do this is to simply have the web server accept incoming messages from the worker via HTTP PUT. You can encode the worker's dict as JSON and put that ...
1
0
0
Is it possible to use 'multiprocessing' communication to a process that I didn't spawn? The 'multiprocessing' module looks ideal for my needs, but in all the examples one process spawns the other. How can I get a 'handle' on the process I want to communicate with if I didn't spawn it? Background Information There are ...
Communicating between Pre-Existing Python Processes using Multiprocessing
1.2
0
0
283
22,435,352
2014-03-16T09:50:00.000
0
0
1
0
python,c,multithreading,gil
22,435,597
2
false
0
1
If your main requirement is to have several interpreters independent from each other, you'd probably better suited doing fork() and exec() than doing multithreading. This way each of the interpreters would live in it's own address space not disturbing one of the others.
1
2
0
I have a really specific need : I want to create a python console with a Qt Widget, and to be able to have several independent interpreters. Now let me try to explain where are my problems and all tries I did, in order of the ones I'd most like to make working to those I can use by default The first point is that all...
Python & C/C++ multithreading : run several threads executing python in the background of C
0
0
0
1,118
22,435,753
2014-03-16T10:34:00.000
1
1
0
0
python,midi,synthesizer,fluidsynth
22,449,199
1
true
1
0
In MIDI if you send a note on message it stays on until you send a note off. Maybe you are sending a note on every time you check the state of the button? If so, you shouldn't, send the note on/note off only when the button state changes.
1
0
0
I'm working on a Raspberry Pi project at the moment and I'm searching for a possibility to play a note as long as ey press a button (connected with gpio). I use pyFluidsynth and got it working but it's note holding a note as long as i press a button, it repeats it really fast but to slow not to hear it. Is there any c...
How to play a note as long as I hit the key (Fluidsynth)?
1.2
0
0
317
22,436,119
2014-03-16T11:17:00.000
0
0
0
0
python,scapy,icmp,tunneling
22,436,235
2
false
0
0
I think you've discovered why the inventors of the Internet developed TCP. There's a limit on the payload size in an ICMP packet. Most networks have a 1500-byte total limit on the size of Ethernet packets, so with a 20-byte IP header and an 8-byte ICMP header, your maximum payload size in a single packet will be 1472 o...
1
0
0
I am using scapy to send data over ICMP. I need to send image and other files over ICMP using scapy. I am able to send simple strings in ICMP. How could I send image and other files ?
How to send an image in ICMP data field using ICMP
0
0
1
2,190
22,436,515
2014-03-16T11:55:00.000
1
0
0
0
python,r,hdf5,statistics,h5py
22,436,696
1
false
0
0
Is there a way to convert the data without losing any information? If the HDF5 data is regular enough, you can just load it in Python or R and save it out again as CSV (or even SPSS .sav format if you're a bit more adventurous and/or care about performance). Why doesn't SPSS support h5 anyway? Who knows. It probabl...
1
0
1
I have two sets of data in separated .h5 files (Hierarchical Data Format 5, HDF5), obtained with python scripts, and I would like to perform statistical analysis to find correlations between them. My experience here is limited; I don't know any R. I would like to load the data into SPSS, but SPSS doesn't seem to suppor...
Statistical analysis of .h5 files (SPSS?)
0.197375
0
0
398
22,437,058
2014-03-16T12:51:00.000
2
0
0
0
java,python,json,cassandra,cassandra-cli
22,519,952
1
false
0
0
If you don't need to be able to query individual items from the json structure, just store the whole serialized string into one column. If you do need to be able to query individual items, I suggest using one of the collection types: list, set, or map. As far as typing goes, I would leave the value as text or blob and...
1
1
1
I have list of nested Json objects which I want to save into cassandra (1.2.15). However the constraint I have is that I do not know the column family's column data types before hand i.e each Json object has got a different structure with fields of different datatypes. So I am planning to use dynamic composite type for...
Import nested Json into cassandra
0.379949
1
0
1,459
22,438,569
2014-03-16T15:06:00.000
1
0
0
0
algorithm,python-3.x,message-passing
22,452,071
1
false
0
1
The issue is trying to give an absolute value to the priority. Rather you need to build a relative priority data structure for each call. This way you can say that hit() is highest priority for super-shields then shields then hull. The mod would then simply need to change the hit sound effects for the hull or add an ad...
1
0
0
I'm writing a prototype for the tactical spaceship combat in a game I'm working on. The basic idea of the part I'm working on right now is that a 'ship' object (which represents a single individual ship) contains a list of 'system' objects. When a ship is first initialized, it calls an initialize() function on each of ...
Algorithm design for systems on a spaceship taking messages
0.197375
0
0
112
22,438,807
2014-03-16T15:27:00.000
1
1
1
0
python,exception,cgi
22,439,025
1
false
0
0
Any unhandled exception causes program to terminate. That means if your program is doing some thing and exception occurs it will shutdown in an unclean fashion without releasing resources. Any ways CGI is obsolete use Django, Flask, Web2py or something.
1
1
0
I have a python CGI script that takes several query strings as arguments. The query strings are generated by another script, so there is little possibility to get illegal arguments, unless some "naughty" user changes them intentionally. A illegal argument may throw a exception (e.g. int() function get non-numerical i...
What is the risk of not catching exceptions in a CGI script
0.197375
0
0
54
22,439,542
2014-03-16T16:29:00.000
5
0
1
0
python,palindrome
22,439,567
2
false
0
0
Let's assume n is even. Generate every string of length n/2 that consists of x and y, and append its mirror image to get a palindrome. Exercise 1: prove that this generates all palindromes of length n. Exercise 2: figure out what to do when n is odd.
1
3
0
is there any patterns i can use to sort out how to create a string that is palindrome which made up with 'X' 'Y'
How to generate a list of palindromes with only 'x','y' and a given length n in Python?
0.462117
0
0
1,191
22,440,743
2014-03-16T18:09:00.000
2
0
0
0
python,opengl,pygame,pixels
22,441,324
1
false
0
1
What you are asking for seems to be two things in one... you want an off-screen buffer (FBO) and you want to get the contents of the framebuffer in client memory. Can you indicate which version of GL you are targeting? If you are targeting OpenGL 3.0+, then you can use FBOs (Framebuffer Objects) and PBOs (Pixel Buffer ...
1
0
0
Is there a way to use OpenGL to draw offscreen? What I want to do is this: I want to be able to use functions like glVertex, and get the result in a 2D pixel array. I am using Python. I tried using PyGame, but it's not working very well. The problem with PyGame is that uses a window event though i don't need it. In add...
Draw with OpenGL offscreen
0.379949
0
0
587
22,440,923
2014-03-16T18:23:00.000
1
0
0
0
python,arrays,numpy
22,440,992
2
false
0
0
If you're willing to accept probabilistic times and you have fewer than 50% ignored values, you can just retry until you have an acceptable value. If you can't, you're going to have to go over the entire array at least once to know which values to ignore, but that takes n memory.
1
2
1
I'm using python. I have what might be an easy question, though I can't see it. If I have an array x = array([1.0,0.0,1.5,0.0,6.0]) and y = array([1,2,3,4,5]) I'm looking for an efficient way to pick randomly between 1.0,1.5,6.0 ignoring all zeros while retaining the index for comparison with another array such as y. S...
How to pick a random element in an np array only if it isn't a certain value
0.099668
0
0
1,746
22,442,378
2014-03-16T20:16:00.000
405
0
1
0
python,list,sorting,copy,in-place
22,442,440
6
true
0
0
sorted() returns a new sorted list, leaving the original list unaffected. list.sort() sorts the list in-place, mutating the list indices, and returns None (like all in-place operations). sorted() works on any iterable, not just lists. Strings, tuples, dictionaries (you'll get the keys), generators, etc., returning a li...
2
264
0
list.sort() sorts the list and replaces the original list, whereas sorted(list) returns a sorted copy of the list, without changing the original list. When is one preferred over the other? Which is more efficient? By how much? Can a list be reverted to the unsorted state after list.sort() has been performed?
What is the difference between `sorted(list)` vs `list.sort()`?
1.2
0
0
136,029
22,442,378
2014-03-16T20:16:00.000
1
0
1
0
python,list,sorting,copy,in-place
49,599,301
6
false
0
0
The .sort() function stores the value of new list directly in the list variable; so answer for your third question would be NO. Also if you do this using sorted(list), then you can get it use because it is not stored in the list variable. Also sometimes .sort() method acts as function, or say that it takes arguments in...
2
264
0
list.sort() sorts the list and replaces the original list, whereas sorted(list) returns a sorted copy of the list, without changing the original list. When is one preferred over the other? Which is more efficient? By how much? Can a list be reverted to the unsorted state after list.sort() has been performed?
What is the difference between `sorted(list)` vs `list.sort()`?
0.033321
0
0
136,029
22,443,297
2014-03-16T21:31:00.000
0
0
0
0
python,linux,database,sqlite
22,443,606
2
true
0
0
I don't think this can be done in full generality without out-of-band information or just treating everything as strings/text. That is, the information contained in the CSV file won't, in general, be sufficient to create a semantically “satisfying” solution. It might be good enough to infer what the types probably are ...
1
0
0
I want to convert a csv file to a db (database) file using python. How should I do it ?
How do I convert a .csv file to .db file using python?
1.2
1
0
933
22,446,362
2014-03-17T03:20:00.000
2
0
1
0
python
22,446,407
2
false
0
0
Just do for (i, c) in enumerate(s): if c.isdigit(): break else: raise ValueError('input with no number part') fields = s[:i].split('-')
1
0
0
I have some strings that look like this: text-text-text-12345 but the number of "text"'s are not the same so I don't want to string split on "-" Is there any way I can split on the first appearance of a number, so I have the string text-text-text-? I am thinking about using regular expressions but I would love to figur...
Python- can I split a string with str.split after the first integer?
0.197375
0
0
1,287
22,449,304
2014-03-17T08:02:00.000
2
0
0
1
python,macos,python-imaging-library
22,470,752
2
false
0
0
following line helped me. sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pillow
1
2
0
When I try to install PIL library on Macosx 10.9.2, it's giving following error, how to install it. $: sudo pip install pillow cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prot...
how to install PIL on Macosx 10.9?
0.197375
0
0
751
22,451,973
2014-03-17T10:31:00.000
1
0
0
0
python,excel,xlwt,openpyxl,pyxll
22,486,256
6
false
0
0
No, and in openpyxl there will never be. I think there is a Python library that purports to implements an engine for such formualae which you can use.
1
13
0
I made a script that opens a .xls file, writes a few new values in it, then saves the file. Later, the script opens it again, and wants to find the answers in some cells which contain formulas. If I call that cell with openpyxl, I get the formula (ie: "=A1*B1"). And if I activate data_only, I get nothing. Is there a wa...
Calculating Excel sheets without opening them (openpyxl or xlwt)
0.033321
1
0
24,869
22,452,284
2014-03-17T10:45:00.000
2
0
0
0
python,django
22,452,380
1
true
1
0
Since the operator module is part of the standard library, it looks like you have a corrupt Python installation in your virtualenv. The best thing to do would be to simply delete and recreate your virtualenv.
1
0
0
So these are my website informations: framework : Django hosting : alwaysdata python : 2.7 virtualenv is used The problem : I have the non explicit 500 error :Internal Server Error I have not any error log But : I found a trail to solve this issue. Indeed when i run manually the django.fcgi, i got this traceback: T...
django.fcgi or virtualenv : no module named operator
1.2
0
0
2,136
22,453,554
2014-03-17T11:51:00.000
3
0
0
0
python,widget,tkinter,label,styling
22,455,831
2
false
0
1
There is nothing you can do with the label widget -- it only supports a single font and single color for the entire label. However, you can easily substitute a canvas or text widget anywhere you need this feature. There's no reason why you can't use a text widget that is one line tall and a dozen or so characters wide.
1
2
0
I'm wondering how I can change the font of a Python Tkinter label widget so that half the displayed text is bold and half is not without having to use two labels. The text for the widget is assigned prior to the label actually being created and stored in a variable so I need some kind of flag presumably to tell it how ...
How to change font style for part of a tkinter label
0.291313
0
0
9,774
22,455,309
2014-03-17T13:16:00.000
2
0
0
1
python,file,python-3.x,exe,cx-freeze
22,455,449
2
false
0
0
The only way Windows associates files with a particular program is by their extension, so this only works if your files have a unique extension (which it looks like maybe they do). So your user would need to setup the association on their machine, which varies depending on the version of Windows. For instance, in Windo...
1
6
0
I am programming on a windows machine and I have an app that reads file selected by the user. Is it possible to allow them to open the file directly when they double click. This needs to work when the program is "compiled" as an .exe with cxfreeze. What I am really asking is this: Is there a way to allow the user to do...
How can I directly open a custom file with python on a double click?
0.197375
0
0
541
22,456,509
2014-03-17T14:07:00.000
1
0
0
0
python,sdk,render,maya,autodesk
22,980,455
1
true
0
1
I was able to do some of the things by parsing the file using basic Python and then extracting the things I needed. The V-Ray API has a proprietary license, and there is no open source way to access the .vrscene I decided to try with a trial version of the SDK, and by using the SDK you will be able to find a nice Pyth...
1
0
0
I'm developing some Python scripts to read/parse/process some .vrscene files. From others' examples, I can see that there is a Python SDK for VRay called vrayutils. I want to get this information from the SettingsOutput object. From a .vrscene file I want to get the total frame numbers. Does anyone know where I can get...
Getting access to VRay Python SDK
1.2
0
0
1,560
22,456,531
2014-03-17T14:08:00.000
1
0
0
0
python,wxpython,publish-subscribe,subscription
22,482,340
3
false
0
0
It is a bad idea in the first place. You should let pubsub do the work for you. One listener per topic. There is no cost to doing that, it segregates your code, makes it easier to maintain, separation of responsibilities. That said, a listener can listen to base topic: pub.subscribe('a.b', listener) will get messages...
1
2
0
This may seem a bit general, but the problem is quite simple actually. Is it possible to subscribe to a subset of topics using the pubsub module. Let me briefly explain what I would like to accomplish. In a wxpython project I want to change the text in the status bar according to different events. So I would like to ha...
python pubsub subscribe to more than one topic
0.066568
0
0
2,130
22,458,670
2014-03-17T15:38:00.000
0
0
0
0
python,expect
22,616,702
1
true
0
0
So, I found out that the string I was passing to winpexpect was Unicode in one case and str in another case. It seems that winpexpect will block at winspawn if the string you pass in is unicode.
1
0
0
I am trying to use winpexpect to have an interactive subprocesses in Python. I am completely baffled. When I run a unit test, winspawn executes normally along with all the expects. When I run my program as a whole, winspawn inexplicably blocks forever. How can this be? As far as I know, winspawn is non-blocking.
winpexpect: winspawn is blocking
1.2
0
0
479
22,460,124
2014-03-17T16:39:00.000
-1
0
1
0
python,eclipse,pydev,pylint
22,460,335
2
false
0
0
try %@? this might be your answer. Not a whole lot out there about special characters in python.
1
1
0
I'm trying to create a simple string like: test = "abc@email.com" in Pydev but it automatically interpret "@" as a special symbol and the statement cannot pe done. When I focus on the variable in Pydev, I can see: test = "abc*@email.com"* instead of test = "abc@email.com" Anyone has any idea why I have this issue? If...
Cannot create a string with "@" symbol inside the text in Pydev
-0.099668
0
0
72
22,460,645
2014-03-17T17:03:00.000
0
0
0
0
eclipse,macos,opencv,python-2.7,pydev
22,673,856
1
true
0
0
Ok, it's working now. Here is what I did: Install Python and every package I need for it with Macports Set the Macports version as standard Adjust PATH and PYTHONPATH Reboot (not sure if needed) Remove old interpreter and libs in Eclipse Choose the new Python installation as Interpreter in Eclipse Confirm the new libs...
1
0
1
My final goal is to use Python scripts with SciPy, NumPy, Theano and openCV libraries to write code for a machine learning application. Everything worked so far apart from the openCV. I am trying to install openCV 2.4.8 to use in Python projects in my Eclipse Kepler installation on my MBA running Mac OSX 10.9.2. I have...
Python with openCV on MAC crashes
1.2
0
0
611
22,460,948
2014-03-17T17:15:00.000
4
0
0
0
python,machine-learning,scikit-learn
22,463,625
2
true
0
0
For which algorithms in scikit-learn is this transformation into dummy variables necessary? And for those algorithms that aren't, it can't hurt, right? All algorithms in sklearn with the notable exception of tree-based methods require one-hot encoding (also known as dummy variables) for nominal categorical variables. ...
1
2
1
In scikit-learn, which models do I need to break categorical variables into dummy binary fields? For example, if the column is political-party, and the values are democrat, republican and green, for many algorithms, you have to break this into three columns where each row can only hold one 1, and all the rest must be 0...
scikit learn creation of dummy variables
1.2
0
0
3,572
22,464,447
2014-03-17T20:17:00.000
0
0
0
0
python,django,monitor
22,575,690
1
true
1
0
Well, there are many ways to do this. One would be a simple daemon (card observer) script that reads the card data every second or so and puts it in a memcached/db/file. Then you simply read it in the view. Once you get this working, you may want to take another course, like running a observer thread from Django etc.
1
0
0
I have a django-based website. And I have an RFID-reader used by the django site. The reader's have a monitor, and a function, wich gives back the uid of the inserted card. When card isn't inserted, it gives back None. I'd like to "run" the monitor's code while the django site is running, and I'd like to call the funct...
Django background monitor service
1.2
0
0
128