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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
19,791,353 | 2013-11-05T14:30:00.000 | 8 | 0 | 1 | 0 | python,ruby,linker,interpreted-language,compiled-language | 19,791,553 | 2 | true | 0 | 0 | An interpreted language is more or less a large configuration for an executable that is called interpreter. That executable (e. g. /usr/bin/python) is the program which actually runs. It then reads the script it shall execute (e. g. /home/alfe/bin/factorial.py) and executes it, in the simplest form line-by-line.
During that process it can encounter references to other files (other modules, e. g. /usr/python/lib/math.py) and then it will read and interpret those.
Many such languages have mechanisms built in to reduce the overhead of this process by creating byte-code versions of the scripts they interpreted. So there might well be a file /usr/python/lib/math.pyc for instance, which the interpreter put there after first processing and which it can faster read and interpret than the original /usr/python/lib/math.py. But this is not really part of the concept of interpreted languages¹.
Sometimes, a binary library is part of an interpreted language; depending on the sophistication of the interpreter it can link that library at runtime and then use it. This is most typical for the system modules and stuff which needs to be highly optimized.
But in general one can say that no binary machine code gets generated at all. And nothing is linked at the compile time. Actually, there is no real compile time, even though one could call that first processing of the input scripts a compile step.
Footnotes:
¹) The concept of interpreting scripts does encompass neither that "compiling" (pre-translating of the source into a faster-to-interpret form) nor that "caching" of this form by storing files like the .pyc files. WRT to your question concerning linking and splitting programs into several files or modules, these aspects of precompiling and caching are just technical details to speed up things. The concept itself is: read one line of the input script & execute it. Then read the next line and so on. | 2 | 10 | 0 | In compiled languages, the source code is turned into object code by the compiler and the different object files (if there are multiple files) are linked by the linker and loaded into the memory by the loader for execution.
If I have an application written using an interpreted language (for eg., ruby or python) and if the source code is split across files, when exactly are the files brought together. To put it other words when is the linking done? Do interpreted languages have Linkers and Loaders in the first place or the interpreter does everything?
I am really confused about this and not able to get my head around it!! Can anyone shine some light on this?! | Linking and Loading in interpreted languages | 1.2 | 0 | 0 | 2,957 |
19,791,570 | 2013-11-05T14:41:00.000 | 3 | 0 | 0 | 1 | python,django,perl,rabbitmq,celery | 19,791,772 | 2 | false | 1 | 0 | The easiest way to execute a Perl script from Celery would probably be a thin wrapper written in Python that runs the script as a subprocess. | 1 | 0 | 0 | I have a need to execute PERL scripts through a Django web interface.
The user will select the parameters of the script and execute it.
I am wondering if it is possible to use Celery/RabbitMQ to execute these script as Celery tasks?
If so, would I need to modify the PERL script?
Would I have to write RabbitMQ code into the PERL scripts? Or would I just execute the Celery task and wait for the script to finish processing? I would like to have the script update the Django user/celery. | How to execute PERL scripts in Django using async tasker like Celery? | 0.291313 | 0 | 0 | 555 |
19,793,448 | 2013-11-05T16:08:00.000 | 2 | 1 | 0 | 0 | python,http,get,httprequest | 19,793,524 | 2 | true | 0 | 0 | Write a C module that does everything. Or fire up a profiler to find out in which part of the code the time is spent exactly and then fix that.
Just as guideline: Python should be faster than the network, so the HTTP request code probably isn't your problem. My guess is that you do something wrong but since you don't provide us with any information (like the code you wrote), we can't help you. | 1 | 0 | 0 | I'm developing a python script and I need to find the fastest way for getting a JSON from remote server. Currently I'm using requests module, but still requesting JSON is the slowest part of the script. So, what is the fastest way for python HTTP GET request?
Thanks for any answer. | Fastest way for python HTTP GET request | 1.2 | 0 | 1 | 2,147 |
19,794,979 | 2013-11-05T17:21:00.000 | 0 | 0 | 0 | 0 | python,django,sqlalchemy,pyramid,wsgi | 19,795,569 | 1 | false | 1 | 0 | I place my SQLAlchemy/SQLSoup connections at models.py, because it is related to persistence (and to the "model" layer of Model-View-Whatever).
You can even replace the Django ORM with SQLAlchemy if you are not using applications relying on the first like django.contrib.admin or django.contrib.auth. | 1 | 1 | 0 | I'm plugging some framework agnostic code of mine into Django instead of Pyramid. It uses SQLAlchemy and has a customized session factory object for getting db sessions. In pyramid, I instantiate this at server start up in the main app method and attach it to the registry so that all other parts of my app can get at it. I'd like to know what the "correct" way of instantiating and making available a shared factory is in Django. Is there somewhere canonical for putting something like that so that Django users will find it easily and the code will be readable to people used to Django patterns?
thanks | Where to instantiate shared thread objects in Django, equiv of pyramid registry? | 0 | 0 | 0 | 152 |
19,795,589 | 2013-11-05T17:57:00.000 | 1 | 0 | 0 | 0 | python,zabbix | 19,806,257 | 2 | false | 0 | 0 | I use zabbix_api to do navigate through zabbix catalogs, get hosts, get host, get host's items, etc. Though I didn't try to get the data with python, I don't see why it shouldn't work. I do get data from PHP using PhpZabbixApi. Any specific problems you've run into? | 1 | 4 | 0 | Intro
I have a cluster to monitor using Zabbix 2.0, everything works fine and I have all the data I need on Zabbix, but the way zabbix displays the data is not optimal for our use case. At the same time I have a python app running with a web front end I can use to create a more refined way of displaying Zabbix's data. What I want to do is to turn Zabbix's latest data tab into a grid view with a host in every row and the items as columns (like a spreadsheet).
The problem
Apparently Zabbix's API is still a work in progress and the interface sometimes changes, which should not be a problem if some basic functionality is working. What I need to do is to be able to fetch the list of hosts not only IDs but the host's info as well. And for each host I need to be able to fetch some items, again not only the items ID but the entire data too. So far I've tried using two Python libraries to do it: zabbix_api and PyZabbix, no luck so far since both libraries fetch only IDs and not the data I need for hosts and items.
The question
Is there a library/way of doing this that actually works or is this API in a too early stage yet?
Thanks in advance! | using zabbix API to create a grid view from python | 0.099668 | 0 | 1 | 1,002 |
19,798,153 | 2013-11-05T20:20:00.000 | 12 | 0 | 0 | 0 | python,pandas,dataframe,vectorization | 37,336,872 | 11 | false | 0 | 0 | Probably simplest explanation the difference between apply and applymap:
apply takes the whole column as a parameter and then assign the result to this column
applymap takes the separate cell value as a parameter and assign the result back to this cell.
NB If apply returns the single value you will have this value instead of the column after assigning and eventually will have just a row instead of matrix. | 1 | 624 | 1 | Can you tell me when to use these vectorization methods with basic examples?
I see that map is a Series method whereas the rest are DataFrame methods. I got confused about apply and applymap methods though. Why do we have two methods for applying a function to a DataFrame? Again, simple examples which illustrate the usage would be great! | Difference between map, applymap and apply methods in Pandas | 1 | 0 | 0 | 436,006 |
19,799,605 | 2013-11-05T21:42:00.000 | 0 | 0 | 0 | 0 | python,python-2.7,beautifulsoup,mysql-python | 19,801,757 | 1 | false | 1 | 0 | If you have 2 versions of python installed on your system, then you've somehow installed one library in each of them.
You either need to install both libraries in both versions of python (which 2 seperate versions of pip can do), or need to setup your PYTHONPATH environment variable to allow loading of modules from additional paths (like the site-packages folder of the python 2.7.4 (64bit) installation from the python 2.7.3 executable). | 1 | 0 | 0 | I have two different python programs. One of the program uses the python BeautifulSoup module, the other uses the MySQLdb module. When I run the python files individually, I have no problem and the program run fine and give me the desired output. However I need to combine the two programs so to achieve my ultimate goal. However the Beautiful soup module only runs if I open it in python 2.7.3 and the MySQLdb runs only on the python 2.7.4 (64bit) version. I installed both the modules exactly the way it was mentioned in the docs. Any help will be much appreciated. | Modules not Working across different python versions | 0 | 1 | 0 | 50 |
19,799,893 | 2013-11-05T21:59:00.000 | 0 | 0 | 0 | 0 | python,pandas | 19,800,482 | 1 | false | 0 | 0 | I suppose you could create another column that is the Hour and subtract the time in question and get the absolute (unsigned) value that you could then do the min function on.. It is not code but I think the logic is right (or at least close.. after you find the mins,, then you can select them and then do your resample.. | 1 | 1 | 1 | I'm using pandas to get hourly data from a dataset with fifteen minute sampling intervals. My problem using the resample('H', how='ohlc') method is that it provides values within that hour and I want the value closest to the hour. For instance, I would like to take a value sampled at 2:55 instead of one from 3:10, but can't figure out how to find the value that is closest if it occurs prior to the timestamp being evaluated against.
Any help would be greatly appreciated. | Using Pandas to get the closest value to a timestamp | 0 | 0 | 0 | 630 |
19,801,783 | 2013-11-06T00:25:00.000 | 3 | 0 | 1 | 0 | python | 19,801,875 | 3 | true | 0 | 0 | I bet your data source actually has hours from 0 through 24 inclusive. Check that. It's a "dumb idea" to distinguish between midnight "at the start of a day" and midnight "at the end of a day". If so, then as @Amadan said, 24 really means 00:00 the next day.
How to deal with it depends on the exact (exhaustive) details of how datetimes are represented in your data source. One example isn't enough to nail that. If that's all there is to it, then checking thestring.endswith(" 24") is sufficient to catch this case. When you do have such a case, throw the 24 away, convert to a datetime, then add timedelta(days=1) to it.
Or if you're absolutely sure the hours range from 1 through 24 inclusive, you'll have to subtract one from the hour. But I've certainly never seen a system that works that way. | 1 | 5 | 0 | I have a data source that contains datetime's I'm reading in Python. The program always dies on the 24th hour, since python holds dates 0-23 not 1-24.
Considering I get a string like '2012/15/01 24', what is the best way to handle this?
I could use regular expressions to pull out the date convert that to a date time, then use regular expressions again to get the hour, convert to an int, subtract an hour then add the hours to the datetime, but that seems like a pain.
Is there a better way, or more common approach to this? | Parse datetime with hours 1-24 instead of 0-23 | 1.2 | 0 | 0 | 6,629 |
19,801,968 | 2013-11-06T00:44:00.000 | -1 | 0 | 1 | 0 | python,python-3.x,pycharm | 19,802,042 | 4 | false | 0 | 0 | Try install python 3.3 ( maybe it's help you). Do you have win64 or win32? | 1 | 0 | 0 | I am a beginner to Python and have begun by using the PyCharm IDE. Whenever I run a program, I get a long list of errors in the console that goes like:
Exception in thread pydevd.CheckAliveThread: Traceback (most recent
call last): File
"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py",
line 921, in _bootstrap_inner
self.run() File "/Applications/PyCharm CE.app/helpers/pydev/pydevd_comm.py", line 252, in run
self.OnRun() File "/Applications/PyCharm CE.app/helpers/pydev/pydevd.py", line 188, in OnRun
self.stop() File "/Applications/PyCharm CE.app/helpers/pydev/pydevd_comm.py", line 262, in stop
_Thread_stop(self) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py",
line 990, in _stop
assert not lock.locked() AssertionError
...
AssertionError Traceback (most recent call last): File
"/Applications/PyCharm CE.app/helpers/pydev/pydevd.py", line 997, in
trace_dispatch
if not t.isAlive(): File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py",
line 1117, in is_alive
self._wait_for_tstate_lock(False) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py",
line 1073, in _wait_for_tstate_lock
assert self._is_stopped AssertionError
Process finished with exit code 0
The program runs, but having that every time is really annoying. How can I fix this? Thanks | PyCharm, Python3.4 | -0.049958 | 0 | 0 | 2,889 |
19,803,591 | 2013-11-06T03:33:00.000 | 0 | 0 | 0 | 0 | python,django,django-south | 19,804,412 | 2 | false | 1 | 0 | First thing you must run initial migration.
python manage.py schemamigration --initial
You are getting this error because of your project structure or there is some issue with your south package .try to remove and reinstalling south.
You need to see that there should not be any extra .py file in your migration folder. | 1 | 1 | 0 | I am trying to learn Django by setting up one of the projects I found on github. Afetr I ran the syncdb command it showed
Not synced (use migrations):
- django_extensions
- djangoratings
- profiles
- guardian
(use ./manage.py migrate to migrate these).
When I am running "python manage.py migrate app" , it gives
AttributeError: 'module' object has no attribute 'Migration'.
I also ran schemamigration app --auto and --initial as well. But nothing seems to be working. Can somebody point out where I am going wrong. | South Migration Error | 0 | 0 | 0 | 666 |
19,806,519 | 2013-11-06T07:41:00.000 | 0 | 0 | 1 | 0 | python,multiprocessing | 19,808,614 | 1 | false | 0 | 0 | You're overestimating multiprocessing. It uses os.fork() to make new processes (which is fast) but then it uses pickle to pass all data back and forth. On Windows, not having fork(), it is a worst hack: new processes are started and initialized by running the same code as the parent program, hoping that nothing too bad occurs. | 1 | 0 | 0 | When I use Pooling in python does each process create its own copy of the given data exactly or it extracts the interest region? Is there any way to limit those processes to copy only the interest region for each ? | Do python multiprocessing pools share memory or they convey their own exact copies into another memory space? | 0 | 0 | 0 | 51 |
19,811,702 | 2013-11-06T12:06:00.000 | 2 | 1 | 1 | 0 | python,unit-testing | 19,811,744 | 1 | true | 0 | 0 | The best way is probably to use a coverage tool. It will tell you how much of your code is called at least one time by a test. | 1 | 1 | 0 | Is there a standard method to check if all functions of all files that are included in a test have a testcase? So if I have script_1.py, script_2.py and script_3.py with corresponding test_script_1.py, test_script_2.py and test_script_3.py, how can I check that every function in script_x.py gets called at least ones by the test scripts?
I wrote the test functions in the format def test<Name_of_function>_<test_condition> so for example the function def sum(a, b) has test functions def testSum_valid_input and def testSum_invalid_input, so I could write a script that gets all the function names from the test scripts and compare that to the functions in the tested scripts, but I am hoping that there is already an easy way to do this. | How to check that all functions have a test case? | 1.2 | 0 | 0 | 52 |
19,815,949 | 2013-11-06T15:23:00.000 | 0 | 0 | 0 | 0 | python,django | 65,434,713 | 4 | false | 1 | 0 | if you just want to set an initial value in the form,
form = MyForm(initial={'field': field_var}) | 1 | 4 | 0 | I'm using a forms.ModelForm to set a model's attributes. For one of the attributes, I'd like to set a default value, and I want to handle it in the form, thus no default=value on the model attribute in the model class.
On the form, though, I don't want to show the user the value, not even a hidden value, therefore, I can't put the field in fields=(...) and because of that, I can't use the field.initial=value way of setting the default.
I could override validation or saving methods and squeeze a attribute setting in there, but this is not what I would prefer to do.
Are there any "proper" or more elegant ways of solving this problem? | How to set form field default value without showing the field in django forms? | 0 | 0 | 0 | 6,103 |
19,820,306 | 2013-11-06T18:50:00.000 | 0 | 0 | 0 | 0 | python,selenium,selenium-webdriver,phantomjs | 45,224,165 | 1 | false | 1 | 0 | set load images equals to false , which will definitely help you to increase the speed of phantomJS. | 1 | 1 | 0 | I've been using selenium in python to drive phantomjs. The problem is that it is quite slow.
I'm beginning to think that it is selenium that is slow, not the core phantomjs functionality of emulating a browser, Javascript and all.
Is there a more direct way to drive phantom that is faster? | phantomjs vs selenium performance | 0 | 0 | 1 | 1,072 |
19,821,425 | 2013-11-06T19:50:00.000 | 0 | 0 | 0 | 0 | python,numpy,scipy,nearest-neighbor | 70,856,990 | 5 | false | 0 | 0 | The fastest way to do this is X[tuple(index.T)], where X is the ndarray with the elements and index is the ndarray of indices wished to be retrieved. | 1 | 48 | 1 | I have a numpy array, filtered__rows, comprised of LAS data [x, y, z, intensity, classification]. I have created a cKDTree of points and have found nearest neighbors, query_ball_point, which is a list of indices for the point and its neighbors.
Is there a way to filter filtered__rows to create an array of only points whose index is in the list returned by query_ball_point? | How to filter numpy array by list of indices? | 0 | 0 | 0 | 89,890 |
19,827,404 | 2013-11-07T03:19:00.000 | 0 | 0 | 1 | 1 | python,eclipse,ide,pydev | 20,275,034 | 9 | false | 0 | 0 | ![Kepler Pydev config]
I had to spend lot of time to figure out why it is not working. But ultimately did. Download 2.8.2 zip instead and unzip in dropins folder as shown. Start eclipse with -clean option | 2 | 21 | 0 | I've been using PyDev within Eclipse on my Mac for about two years now. Updated Eclipse today, and suddenly PyDev is completely missing. Tried everything, included a complete uninstall and fresh install, but although PyDev shows up as installed in the menu, it appears nowhere else.
PyDev version: 3.0.0.201311051910
Eclipse: Version: Kepler Service Release 1
Build id: 20130919-0819
I can't open a PyDev perspective, I can't create a new Python file, and I can't open an existing Python file without it just being seen as plain text.
I've got a huge assignment due tonight, help appreciated. | Pydev Not Recognized in Eclipse | 0 | 0 | 0 | 27,038 |
19,827,404 | 2013-11-07T03:19:00.000 | 0 | 0 | 1 | 1 | python,eclipse,ide,pydev | 20,405,349 | 9 | false | 0 | 0 | I debugged a python project (imported before). The Pydev menu has reappeared by only changing the current perspective to "Debug".
I think opening the Pydev perspective through Window > Open Perspective > Other ... > Pydev would also create the Pydev menu. | 2 | 21 | 0 | I've been using PyDev within Eclipse on my Mac for about two years now. Updated Eclipse today, and suddenly PyDev is completely missing. Tried everything, included a complete uninstall and fresh install, but although PyDev shows up as installed in the menu, it appears nowhere else.
PyDev version: 3.0.0.201311051910
Eclipse: Version: Kepler Service Release 1
Build id: 20130919-0819
I can't open a PyDev perspective, I can't create a new Python file, and I can't open an existing Python file without it just being seen as plain text.
I've got a huge assignment due tonight, help appreciated. | Pydev Not Recognized in Eclipse | 0 | 0 | 0 | 27,038 |
19,829,516 | 2013-11-07T06:39:00.000 | 2 | 0 | 1 | 1 | python,windows,python-2.7,cmd | 19,829,607 | 3 | false | 0 | 0 | You can check registry by:
HKLM SOFTWARE\Python\PythonCore\${PYTHON_VERSION}\InstallPath
or HKCU | 1 | 30 | 0 | I am trying to get the installed path of python?
Any idea how to get the python installed path from command line in windows. I don't want to set the environment variable?
Thanks, | how to get python installed path from command line | 0.132549 | 0 | 0 | 85,755 |
19,829,799 | 2013-11-07T06:59:00.000 | 0 | 0 | 0 | 0 | python,django,tastypie | 19,831,689 | 1 | false | 1 | 0 | Turns out the clients in question override urls.py to include their apps. I replaced the API url pattern with a custom one and it seems to work. | 1 | 1 | 0 | I have a django based CMS system I am working on and it uses tastypie. While all resources native to the CMS are registered in a separate file imported later into urls.py some of the clients using the system require loading their own custom apps. Is there some way to register an additional resource without changing the main codebase? | How do I register tastypie resources from external app? | 0 | 0 | 0 | 38 |
19,831,205 | 2013-11-07T08:37:00.000 | 0 | 0 | 1 | 0 | python | 19,831,313 | 5 | false | 0 | 0 | Read the base folder path and stored into variable and move to sub folder and process the text file using chdir and base path change the directory and read the sub folder once again. | 1 | 0 | 0 | so I'm a rookie at programming and I'm trying to make a program in python that basically opens a text file with a bunch of columns and writes the data to 3 different text files based on a string in the row. As my program stands right now, I have it change the directory to a specific output folder using os.chdir so it can open my text file but what I want is it to do something like this:
Imagine a folder set up like this :
Source Folder contains N number of folders. Each of those folders contains N number of output folders. Each output folder contains 1 Results.txt.
The idea is to have the program start at the source folder, look into Folder 1, look for output 1, open the .txt file then do it's thing. Once it's done, it should go back to folder 1 and open output 2 and do it's thing again. Then it should go back to Folder 1 and if it can't find any more output folders, it needs to go to Folder A and then enter Folder 2 and repeat the process until there are no more folders. Honestly not sure where to really start with this, the best I could do is make a small program that prints all my .txt files but I'm not sure how to open them at all. Hope my question makes sense and thanks for the help. | How to move in and out of folders in python | 0 | 0 | 0 | 403 |
19,842,701 | 2013-11-07T17:32:00.000 | 0 | 0 | 1 | 1 | python,windows | 19,843,644 | 3 | true | 0 | 0 | Assumptions: You mention python(w).exe and cmd, so you're most likely on windows.
You probably selected "use python 2.n" somewhere in your IDE (whichever one you may use). That works fine as long as you ONLY execute your scripts from there. From any arbitrary other place on your system, windows (or any other OS) makes use of environment variables PATH, in this case. (right-click My Computer > advanced > environment variables or something). It probably contains the path to python27.exe C:/Python27, change that to C:/Python25. If multiple directories are used, first order takes precedence.
pythonw.exe is a custom executable related to early pywin32 development by Mark Hammond I believe, and yes it should supress the console window during startup. | 1 | 1 | 0 | a) I have a code that works fine if I choose Python 2.5 but it gives me errors when using python 2.7. I have easily fixed the problem in windows by choosing python 2.5 as the default program. But, it seems that cmd does not follow this change. How could I fix this?
b) what is the difference between running a script using python.exe vs. pythonw.exe? I read somewhere that upon using pythonw.exe, I will not see the cmd window that pops out and disappears. But for my case, this is not true and I actually see the cmd window. Also, if I use python.exe I get an error from running my script but not when I use pythonw.exe. | Choosing a different python version to run code | 1.2 | 0 | 0 | 473 |
19,844,558 | 2013-11-07T19:09:00.000 | 2 | 0 | 1 | 0 | python,string,python-3.x | 19,844,624 | 4 | false | 0 | 0 | Use the index method to get the first occurrence of #. If the index method allows a starting position, use the position of the first # + 1 for the start. If it doesn't, make a copy of the string starting at position of first # + 1 (possibly a copy and then a substring). | 1 | 2 | 0 | But I need the index of the second time appearance.
It is like I have a string "asd#1-2#qwe"
I can simply use index method to find the index value of first #, which is 3.
But now I wanna get the index of second #, which should be 7. | How to find a index of an item in a string? | 0.099668 | 0 | 0 | 99 |
19,848,191 | 2013-11-07T22:40:00.000 | 0 | 0 | 0 | 0 | python,oracle,connection-pooling | 19,848,278 | 1 | false | 0 | 0 | Let the database handle the pool. . . it's smarter than you'll be, and you'll leverage every bug fix/performance improvement Oracle's installed base comes up with. | 1 | 4 | 0 | Situation:
I have a requirement to use connection pooling while connecting to Oracle database in python. Multiple python applications would use the helper connection libraries I develop.
My Thought Process:
Here I can think of two ways of connection pooling:
1) Let connection pool be maintained and managed by database itself (as provided by Oracle's DRCP) and calling modules just ask connections from the connection broker described by Oracle DRCP.
2) Have a server process that manages the connection pool and all caller modules ask for connections from this pool (like dbcp?)
What suggestions do I need:
option 1) looks very straight forward since pool does not need to be stored by application.
But I wanted to know what advantages do I get other than simplicity using option 1)?
I am trying to avoid option 2) since it would require a dedicated server process always running (considering shelving is not possible for connection objects).
Is there any other way? | Application vs Database Resident Connection Pool | 0 | 1 | 0 | 622 |
19,849,506 | 2013-11-08T00:28:00.000 | 1 | 0 | 1 | 0 | python,ruby,lua,2d-games | 19,849,546 | 2 | false | 0 | 0 | No. It might be possible to use the JVM versions of the languages to create JVM classes, then JAR them up. I have never used any of them besides jRuby.
Why use three similar scripting languages at the same time? It's like eating pasta with mashed potatoes and bread. | 2 | 1 | 0 | I'm started programming not too long ago. I use a little of Python, Lua, and Ruby. Is it possible to compile all three scripts into one executable using py2exe, py2app, or py2deb?
If not, which one should I use for game development, and if anyone has any type of resources to study off of, I really would mind learning more. | How to use together!? Python, Lua, and Ruby? | 0.099668 | 0 | 0 | 1,013 |
19,849,506 | 2013-11-08T00:28:00.000 | 1 | 0 | 1 | 0 | python,ruby,lua,2d-games | 19,849,593 | 2 | true | 0 | 0 | Combining them all into one executable is hard. Combining them into one application, not so hard.
Let's take py2app as an example. It builds an OS X application bundle—a directory full of files. There's a complete Python interpreter with a custom standard library in the Frameworks subdirectory. And your application's Python source code (and/or .pyc bytecode) and all of your data files are in the Resources subdirectory. Finally, in the MacOS subdirectory, there are two things: a standard python stub executable, which runs Python with your custom standard library, and another stub executable with the name of your app, which runs Python with your custom standard library and executes your main script.
Imagine you had an identical tool for Ruby and Lua.
You could very easily build an application bundle that puts each framework in the Frameworks directory, puts all your source code in all three languages, and all of your data files, into the Resources directory, and puts all three stub executables in the MacOS directory. Whichever one of your scripts is the main program, you'd keep just the stub executable for that one.
As long as your scripts know how to find the python, lua, and ruby stub executables to launch other scripts (which you can do by, e.g., modifying the PATH in the environment at the start of your main script), everything works.
And there's an even simpler solution: py2app (and ruby2app and lua2app) up each application separately, and then just package the complete applications inside the bundle (e.g., in an Applications directory under the Library directory) and just run them that way. The down side is that if you have 20 different Python scripts, you're going to end up with 20 complete Python installations, which gets to be a pretty big download.
But you can go half-way in between: merge all the Python apps into one bundle, all the Ruby apps into another, and all the Lua apps into another.
The problem with doing this in practice are that you don't actually have an identical tool for Ruby and Lua; you have different tools, which build different structures. And you don't have an identical tool for Windows (py2exe builds a very differently-shaped structure, and uses very different configuration settings). So you need to understand (up to) the cartesian product of N*M different structures if you have N languages and M platforms.
And you really do need all the separate tools. py2app can't be used on Ruby or Lua code, or Windows code, because it needs to understand Python modules—including Python C extension modules, which it has to understand at the Mach-O level as well as at the Python API level—in order to figure out the dependencies and get the right files, and figure out the right places to put them in the bundle so the interpreter can find them, and so on.
Still, it's definitely doable—I've worked on two projects that bundled up multiple scripts written in two or three different scripting languages in exactly the way I described above. | 2 | 1 | 0 | I'm started programming not too long ago. I use a little of Python, Lua, and Ruby. Is it possible to compile all three scripts into one executable using py2exe, py2app, or py2deb?
If not, which one should I use for game development, and if anyone has any type of resources to study off of, I really would mind learning more. | How to use together!? Python, Lua, and Ruby? | 1.2 | 0 | 0 | 1,013 |
19,851,323 | 2013-11-08T03:55:00.000 | 1 | 0 | 0 | 0 | python,web-applications,flask | 19,851,945 | 1 | false | 1 | 0 | Yes.
What would be the problem exactly?
Personally I would recommend setting up an Nginx server at both ends to serve the file from the filesystem. Using Flask for hosting files is a waste of resources. | 1 | 0 | 0 | I have two Flask servers A and B. My user is on machine C. A is the public interface machine. The user wants to retrieve a 500GB octet-stream from B, but only the public interface on A is exposed.
So I'd like something where:
User on machine C sends GET request to server A, request gets routed to server B, server B replies to C with the 500GB octet-stream without going through A.
Is this possible? | forwarding large files on servers | 0.197375 | 0 | 0 | 39 |
19,851,498 | 2013-11-08T04:17:00.000 | 0 | 0 | 1 | 0 | python,floating-point-precision | 19,851,584 | 2 | false | 0 | 0 | i am not sure if it is right, if you find the number of digits in the input and then multiplying the input with required powers of 10 gives you mantissa. | 1 | 0 | 0 | I need to convert a user inputted float into a 5 digit number that has no decimals to calculate the mantissa and exponent of the float
Example :- a input of: 12 Mantissa: 12000 Exponent: -3
but I can only find information on math.frexp(x) which I cant use for my assignment. Basically I need a way to convert the users input into a 5 digit mantissa but i am completely out of ideas and cant figure out how to properly convert the float so that it will work in calculations for the exponent. any help would be appreciated. | Float should have 5 leading numbers and no decimals | 0 | 0 | 0 | 73 |
19,851,780 | 2013-11-08T04:47:00.000 | 4 | 0 | 1 | 0 | python,eclipse,adt,pydev | 19,976,691 | 2 | true | 1 | 0 | The non-obvious answer here is that JDK 7 needs to be installed. Otherwise, the PyDev installation succeeds but then silently is hidden in Eclipse. I just went through this, and getting JDK 7 fixes it right up. | 2 | 3 | 0 | I tried to setup PyDev on my ADT/eclipse. I am wondering the installation did not prompt any errors but I could not see pydev plugin after restarting ADT. Moreover I tried to extract plugin files in to eclipse>plugin folder for pydev it did not work either. Any solutions or ideas for it to work on ADT. | PyDev is installed but does not show up in ADT | 1.2 | 0 | 0 | 960 |
19,851,780 | 2013-11-08T04:47:00.000 | 0 | 0 | 1 | 0 | python,eclipse,adt,pydev | 19,902,911 | 2 | false | 1 | 0 | You need to run Eclipse as an administartor when you do the Pydev (or any other) install. | 2 | 3 | 0 | I tried to setup PyDev on my ADT/eclipse. I am wondering the installation did not prompt any errors but I could not see pydev plugin after restarting ADT. Moreover I tried to extract plugin files in to eclipse>plugin folder for pydev it did not work either. Any solutions or ideas for it to work on ADT. | PyDev is installed but does not show up in ADT | 0 | 0 | 0 | 960 |
19,854,866 | 2013-11-08T08:47:00.000 | 0 | 0 | 0 | 1 | python,desktop,os.system,mstsc | 29,933,838 | 1 | false | 0 | 0 | To close one of the mstsc, you should know the pid of it. If you are opening mstsc.exe from a python script itself, then you could capture the pid of that instance.
p = Popen('C:\Windows\System32\mstsc.exe "connection.rdp"')
print p.pid
Then kill the exe using pid. | 1 | 1 | 0 | I want to automate closing the remote desktop application using python. I open the remote desktop using mstsc. When I do
os.system("TASKKILL /F /IM mstsc.exe")
It is killing all the remote desktop applications that are open. Is there a way I can specify through python which remote desktop it has to close.
I have 2 or more instances of remote desktop open and I require my program to close only specific connection. Is there a way I can pass the IP address or process ID or something. | how to close remote desktop window using python | 0 | 0 | 0 | 1,415 |
19,859,282 | 2013-11-08T12:37:00.000 | 2 | 0 | 1 | 0 | python,string | 61,931,265 | 19 | false | 0 | 0 | This probably isn't the best approach in Python, but as a Haskeller this lambda/map approach made perfect sense to me and is very short:
anydigit = lambda x: any(map(str.isdigit, x))
Doesn't need to be named of course. Named it could be used like anydigit("abc123"), which feels like what I was looking for! | 1 | 277 | 0 | Most of the questions I've found are biased on the fact they're looking for letters in their numbers, whereas I'm looking for numbers in what I'd like to be a numberless string.
I need to enter a string and check to see if it contains any numbers and if it does reject it.
The function isdigit() only returns True if ALL of the characters are numbers. I just want to see if the user has entered a number so a sentence like "I own 1 dog" or something.
Any ideas? | Check if a string contains a number | 0.02105 | 0 | 0 | 536,944 |
19,864,484 | 2013-11-08T16:55:00.000 | 3 | 0 | 0 | 0 | python,pygame | 19,864,546 | 1 | false | 0 | 1 | You probably shouldn't be trying to launch a new instance of your game. You should create a reset method which can be called to restart everything. It would clear all variables, set the game state back to the start, etc. | 1 | 0 | 0 | I am trying to develop GUI for a who wants to be a millionaire game using pygame. If the user is presented with the welcome screen and clicks new game, it should clear the welcome screen and bring up the main game screen.
I tried using os.system('xxx.py') but it doesnt stay on, it just flashes and goes off.
Any ideas on how to make this work?
Thanks in anticipation. | Clear previous screen to show next screen pygame | 0.53705 | 0 | 0 | 208 |
19,865,347 | 2013-11-08T17:44:00.000 | 3 | 0 | 0 | 0 | python,opencv | 19,867,945 | 1 | true | 0 | 0 | No I think there is something else that is the problem. Docs say: cv2.getAffineTransform Calculates an affine transform from three pairs of the corresponding points.
The problem is you are giving it 125 pairs of points. It only wants 3 pairs of point correspondences. This is of course the number of correspondences needed to solve the linear system of equations. If you are looking to estimate an affine transformation from noisy correspondences then you will need to use something like weighted least squares or RANSAC. To estimate affine transform from noisy data with a prepackaged algorithm it looks like cv2.estimateRigidTransform might work setting fullAffine = True | 1 | 1 | 1 | I'm trying to use the cv2.getAffineTransform(src,dst) function in openCV, but it crashes because my inputs are arrays containing 125 pairs of x,y coordinates and getAffineTransform wants its input to have three columns. Can I just concat a row full of zeros onto my array or is there a special transformation I should do? | Converting x,y coordinates into a format for getAffineTransform? | 1.2 | 0 | 0 | 935 |
19,867,190 | 2013-11-08T19:37:00.000 | 2 | 0 | 1 | 1 | c++,python,c,delphi,.obj | 19,867,378 | 1 | false | 0 | 1 | Delphi generated .obj files cannot be consumed by Python because Python doesn't consume .obj files. You'd need to compile them to a library at the very least. At which point, emitting .obj files is pointless – you may as well just output a full module. I conclude that you'll need to compile your Delphi code to a library (DLL) or a COM object.
To support multiple platforms, you'll need to compile separately for each platform. Which means that you'll only be able to support platforms on which Delphi compilers exist. FreePascal has wider platform support and may be a better choice.
Obviously COM would restrict you to Windows. So the other option is a library. This can be consumed using ctypes or by making your module a Python extension module. | 1 | 3 | 0 | I have a lot of code in Delphi I would like to use in python.
In Delphi XE is an option to generate C / C + + files. obj
Can I generate these files. Obj in Delphi and use it in python code
python code to use it. obj will still be cross-platform?
thank you | delphi code compiled to obj files to be used in python | 0.379949 | 0 | 0 | 245 |
19,870,149 | 2013-11-08T23:09:00.000 | 0 | 0 | 1 | 0 | python,json | 19,870,206 | 6 | false | 1 | 0 | any seralizer/deserializer/parser is a potential security threat to the application
It is true on the serverside as long as you write seralizer/deserializer/parser by yourself.
As long as you use standard library you can trust its programmers. | 6 | 0 | 0 | I'm writing a Python application with Django and serializing objects to and from JSON using Python's standard json library.
I've heard something along the lines that
any seralizer/deserializer/parser is a potential security threat to the application
Is this really true on the serverside? Do I need to fear someone sending tampered JSON up to my instance and them having remote code execution privileges? I would think that there wouldn't be any security threats other than (potentially) XSS or SQL injection, which in my case (converting values to ints, storing all data in MongoDB) shouldn't be the case.
Should I be paranoid along these lines of parsing JSON data from clients? | Is parsing JSON on the serverside dangerous? | 0 | 0 | 0 | 768 |
19,870,149 | 2013-11-08T23:09:00.000 | 0 | 0 | 1 | 0 | python,json | 19,870,208 | 6 | false | 1 | 0 | You never know what the parser does inside. A parsing itself is a possible security threat, although the developers try to do their best to avoid it.
For a stable library that's been developed for a long time, there's nearly no danger. | 6 | 0 | 0 | I'm writing a Python application with Django and serializing objects to and from JSON using Python's standard json library.
I've heard something along the lines that
any seralizer/deserializer/parser is a potential security threat to the application
Is this really true on the serverside? Do I need to fear someone sending tampered JSON up to my instance and them having remote code execution privileges? I would think that there wouldn't be any security threats other than (potentially) XSS or SQL injection, which in my case (converting values to ints, storing all data in MongoDB) shouldn't be the case.
Should I be paranoid along these lines of parsing JSON data from clients? | Is parsing JSON on the serverside dangerous? | 0 | 0 | 0 | 768 |
19,870,149 | 2013-11-08T23:09:00.000 | 3 | 0 | 1 | 0 | python,json | 19,870,248 | 6 | true | 1 | 0 | JSON data can only contain basic types: strings, numbers, Booleans, null, objects, and lists. This means that properly formatted JSON data poses no risk at all to your application, unless you are doing something silly like executing that code with eval().
So if valid JSON is not an issue, the question becomes "can a client send any invalid data that poses a security risk when processed by Python's json module". The answer here is also no, Python's json module will reliably raise a ValueError for invalid json data, with no scary side effects. | 6 | 0 | 0 | I'm writing a Python application with Django and serializing objects to and from JSON using Python's standard json library.
I've heard something along the lines that
any seralizer/deserializer/parser is a potential security threat to the application
Is this really true on the serverside? Do I need to fear someone sending tampered JSON up to my instance and them having remote code execution privileges? I would think that there wouldn't be any security threats other than (potentially) XSS or SQL injection, which in my case (converting values to ints, storing all data in MongoDB) shouldn't be the case.
Should I be paranoid along these lines of parsing JSON data from clients? | Is parsing JSON on the serverside dangerous? | 1.2 | 0 | 0 | 768 |
19,870,149 | 2013-11-08T23:09:00.000 | 0 | 0 | 1 | 0 | python,json | 19,870,358 | 6 | false | 1 | 0 | Yes. You should be paranoid. Just because the parsers are trusted does't mean you can't screw up. | 6 | 0 | 0 | I'm writing a Python application with Django and serializing objects to and from JSON using Python's standard json library.
I've heard something along the lines that
any seralizer/deserializer/parser is a potential security threat to the application
Is this really true on the serverside? Do I need to fear someone sending tampered JSON up to my instance and them having remote code execution privileges? I would think that there wouldn't be any security threats other than (potentially) XSS or SQL injection, which in my case (converting values to ints, storing all data in MongoDB) shouldn't be the case.
Should I be paranoid along these lines of parsing JSON data from clients? | Is parsing JSON on the serverside dangerous? | 0 | 0 | 0 | 768 |
19,870,149 | 2013-11-08T23:09:00.000 | 0 | 0 | 1 | 0 | python,json | 19,870,379 | 6 | false | 1 | 0 | Well... to take any user input is potentially dangerous, especially when using external libraries you don't know well. For instance, it's simple to demonstrate how a quicksort algorithm poorly implemented can be used to a Denial of Service attack by feeding it tailored data that leads all iterations to an O(n²). Does that means sort algorithms are dangerous? No. It means poor implementations of anything can be dangerous.
Obviously, you should estimate the danger and benefits and choose what to adopt based on that. Frankly, if you were working on the kind of project where the potential risk of using a 3rd party json implementation is a security issue, you wouldn't be asking about it on Stack Overflow. | 6 | 0 | 0 | I'm writing a Python application with Django and serializing objects to and from JSON using Python's standard json library.
I've heard something along the lines that
any seralizer/deserializer/parser is a potential security threat to the application
Is this really true on the serverside? Do I need to fear someone sending tampered JSON up to my instance and them having remote code execution privileges? I would think that there wouldn't be any security threats other than (potentially) XSS or SQL injection, which in my case (converting values to ints, storing all data in MongoDB) shouldn't be the case.
Should I be paranoid along these lines of parsing JSON data from clients? | Is parsing JSON on the serverside dangerous? | 0 | 0 | 0 | 768 |
19,870,149 | 2013-11-08T23:09:00.000 | 1 | 0 | 1 | 0 | python,json | 19,870,187 | 6 | false | 1 | 0 | In general that blurb is true, but is dependent on how security-enabled/conscious the parser and its developers are. The json module itself has been vetted for a long time, and does not do anything that would compromise the security of the server. | 6 | 0 | 0 | I'm writing a Python application with Django and serializing objects to and from JSON using Python's standard json library.
I've heard something along the lines that
any seralizer/deserializer/parser is a potential security threat to the application
Is this really true on the serverside? Do I need to fear someone sending tampered JSON up to my instance and them having remote code execution privileges? I would think that there wouldn't be any security threats other than (potentially) XSS or SQL injection, which in my case (converting values to ints, storing all data in MongoDB) shouldn't be the case.
Should I be paranoid along these lines of parsing JSON data from clients? | Is parsing JSON on the serverside dangerous? | 0.033321 | 0 | 0 | 768 |
19,883,186 | 2013-11-09T21:15:00.000 | 1 | 0 | 0 | 0 | python,django | 19,883,259 | 2 | false | 1 | 0 | Simply the module won't be found when you try to run your project.
You can run 'python' in your command line and try to 'import django' if it returns an error then django isn't found it means that django isn't installed on the current machine. | 1 | 4 | 0 | I've built a small project on my system.
After building the project, I put it on a USB drive, and copied to another system.
When I run the project, how can it detect if django is installed in the system or if the system has all of the the requirements for the project?
For example, I made a blog example project on a laptop, then copied that project(blog) onto a USB drive and then I copied that project(blog) to my own system. After copying, I tried to run the project. If django is installed then the project runs successfully. But when django is not installed it gives an error in the terminal.
How can the program detect if the required (Django/Python) is installed or not? | How can a django project detect if the system has django installed? | 0.099668 | 0 | 0 | 262 |
19,886,791 | 2013-11-10T06:01:00.000 | 2 | 0 | 1 | 0 | python | 19,887,048 | 3 | false | 1 | 0 | python is the language, I guess you mean some web platform like django. however, there is no javascript / css management tool at part of the platform. | 1 | 1 | 0 | Coming from C#, management of -all- dependencies was done using NuGet. In Python, PIP is used to manage python packages. Is there any de facto standard for managing Javascript and CSS library dependencies? | How do Python developers manage Javascript/CSS library dependencies? | 0.132549 | 0 | 0 | 220 |
19,892,934 | 2013-11-10T17:46:00.000 | 0 | 0 | 0 | 0 | python,openerp | 19,897,059 | 1 | false | 1 | 0 | All the sales done through post is registered in post.order. If you are creating orders from an external source other than pos, you can create the order in this table and call the confirm bottom action. Rest changes in all other table will be done automatically.. | 1 | 0 | 0 | I got one table in which modifications are made :-account_bank_statement, what other tables are needed for the point of sale and if i make a sale in which tables modifications are made.I want to make a sale but not through the pos provided. | In which tables changes are made in openERP when an items is sold at Point of sale | 0 | 1 | 0 | 49 |
19,894,995 | 2013-11-10T20:48:00.000 | 1 | 0 | 1 | 0 | python,eclipse,pydev | 43,474,460 | 18 | false | 0 | 0 | If anybody has Eclipse Neon, this is how I fixed it:
From the Window menu > Perspective > Customize
Check Pydev Debug and the sub-items you're interested in.
Now you can see the Pydev on the Menu bar. | 9 | 29 | 0 | After installing the latest version of Pydev on eclipse it is not showing under the list of available perspectives.
Eclipse does however list pydev as being installed which seems weird to me. I would also like to add that I installed pydev through the standard method (Through the "install new software" option under help).
Any help on how to resolve this would be greatly appreciated. | Pydev Perspective Not Showing After Install For Eclipse | 0.011111 | 0 | 0 | 43,566 |
19,894,995 | 2013-11-10T20:48:00.000 | 0 | 0 | 1 | 0 | python,eclipse,pydev | 43,308,288 | 18 | false | 0 | 0 | In my case, while installing the plugin, I had forgotten to click on a checkbox to trust a certificate, then I installed it again, checked the checkbox and it worked. | 9 | 29 | 0 | After installing the latest version of Pydev on eclipse it is not showing under the list of available perspectives.
Eclipse does however list pydev as being installed which seems weird to me. I would also like to add that I installed pydev through the standard method (Through the "install new software" option under help).
Any help on how to resolve this would be greatly appreciated. | Pydev Perspective Not Showing After Install For Eclipse | 0 | 0 | 0 | 43,566 |
19,894,995 | 2013-11-10T20:48:00.000 | 0 | 0 | 1 | 0 | python,eclipse,pydev | 45,366,759 | 18 | false | 0 | 0 | I had the problem too, and I solved it just by waiting for eclipse to download all files, it takes some time.
When the downloads are completed eclipse will remind you to restart, if you see that remind you have succeeded. | 9 | 29 | 0 | After installing the latest version of Pydev on eclipse it is not showing under the list of available perspectives.
Eclipse does however list pydev as being installed which seems weird to me. I would also like to add that I installed pydev through the standard method (Through the "install new software" option under help).
Any help on how to resolve this would be greatly appreciated. | Pydev Perspective Not Showing After Install For Eclipse | 0 | 0 | 0 | 43,566 |
19,894,995 | 2013-11-10T20:48:00.000 | 0 | 0 | 1 | 0 | python,eclipse,pydev | 43,186,346 | 18 | false | 0 | 0 | I faced this issue. My environment looked like this
Windows 7 Enterprise (64 bit)
Eclipse SDK 4.2
Python 3.6.1
Pydev 5.2
JRE 1.8.0_111
In the above configuration the PyDev plugin didn't show up.
I did the following:
Installed the jdk 1.8 (64 bit)
Installed Eclipse Neon
Installed the Pydev plugin using the Plugin manager.
All works fine now !
It is clearly stated in the installation instructions that PyDev requires Java 8 and Eclipse 4.6 (Neon) in order to run and only supports Python 2.6 onwards. | 9 | 29 | 0 | After installing the latest version of Pydev on eclipse it is not showing under the list of available perspectives.
Eclipse does however list pydev as being installed which seems weird to me. I would also like to add that I installed pydev through the standard method (Through the "install new software" option under help).
Any help on how to resolve this would be greatly appreciated. | Pydev Perspective Not Showing After Install For Eclipse | 0 | 0 | 0 | 43,566 |
19,894,995 | 2013-11-10T20:48:00.000 | 0 | 0 | 1 | 0 | python,eclipse,pydev | 71,694,673 | 18 | false | 0 | 0 | I installed Eclipse IDE for Java Developers (setup by Oomph) into the folder 'C:\Program Files' with administrator privileges on Windows. After manually renaming/moving the Eclipse installation folder and installing PyDev, it did not show up as Perspective.
A possible solution is to run Eclipse as administrator and to reinstall PyDev.
Note: When the initial installation directory of Eclipse is not changed, PyDev also works correctly. | 9 | 29 | 0 | After installing the latest version of Pydev on eclipse it is not showing under the list of available perspectives.
Eclipse does however list pydev as being installed which seems weird to me. I would also like to add that I installed pydev through the standard method (Through the "install new software" option under help).
Any help on how to resolve this would be greatly appreciated. | Pydev Perspective Not Showing After Install For Eclipse | 0 | 0 | 0 | 43,566 |
19,894,995 | 2013-11-10T20:48:00.000 | 1 | 0 | 1 | 0 | python,eclipse,pydev | 37,609,949 | 18 | false | 0 | 0 | in my case, you need to use jdk 1.8, if the pydev is 5.0.0. | 9 | 29 | 0 | After installing the latest version of Pydev on eclipse it is not showing under the list of available perspectives.
Eclipse does however list pydev as being installed which seems weird to me. I would also like to add that I installed pydev through the standard method (Through the "install new software" option under help).
Any help on how to resolve this would be greatly appreciated. | Pydev Perspective Not Showing After Install For Eclipse | 0.011111 | 0 | 0 | 43,566 |
19,894,995 | 2013-11-10T20:48:00.000 | 2 | 0 | 1 | 0 | python,eclipse,pydev | 25,865,042 | 18 | false | 0 | 0 | For Ubuntu users:
Check for Java version ($ java -version). If it is 1.6.0, please upgrade it to 1.7.0 ($ sudo apt-get install openjdk-7-jdk)
Also, run the command $ sudo update-alternatives --config java
Restart Eclipse and Pydev will show up in the preferences. | 9 | 29 | 0 | After installing the latest version of Pydev on eclipse it is not showing under the list of available perspectives.
Eclipse does however list pydev as being installed which seems weird to me. I would also like to add that I installed pydev through the standard method (Through the "install new software" option under help).
Any help on how to resolve this would be greatly appreciated. | Pydev Perspective Not Showing After Install For Eclipse | 0.022219 | 0 | 0 | 43,566 |
19,894,995 | 2013-11-10T20:48:00.000 | 2 | 0 | 1 | 0 | python,eclipse,pydev | 20,583,817 | 18 | false | 0 | 0 | I had the same problem; it seems I was using Eclipse with Java 1.6 instead of with Java 1.7 as required by PyDev.
The fix, for PyDev 3.1.0 on Linux at least, is to start Eclipse with the Java 1.7 binary. Two ways to do this: updating the default Java installation for the system to 1.7 or edit the eclipse.ini to point to a Java 1.7 java binary. | 9 | 29 | 0 | After installing the latest version of Pydev on eclipse it is not showing under the list of available perspectives.
Eclipse does however list pydev as being installed which seems weird to me. I would also like to add that I installed pydev through the standard method (Through the "install new software" option under help).
Any help on how to resolve this would be greatly appreciated. | Pydev Perspective Not Showing After Install For Eclipse | 0.022219 | 0 | 0 | 43,566 |
19,894,995 | 2013-11-10T20:48:00.000 | 3 | 0 | 1 | 0 | python,eclipse,pydev | 40,831,132 | 18 | false | 0 | 0 | update Java version.
Install the new java.
Go to Eclipse-> Preference-> Java -> Intalled JRE -> Check latest java (1.8) -> Apply. Restart Eclipse | 9 | 29 | 0 | After installing the latest version of Pydev on eclipse it is not showing under the list of available perspectives.
Eclipse does however list pydev as being installed which seems weird to me. I would also like to add that I installed pydev through the standard method (Through the "install new software" option under help).
Any help on how to resolve this would be greatly appreciated. | Pydev Perspective Not Showing After Install For Eclipse | 0.033321 | 0 | 0 | 43,566 |
19,896,763 | 2013-11-10T23:52:00.000 | 0 | 0 | 1 | 0 | java,c++,python,eclipse | 19,897,203 | 2 | false | 0 | 0 | Could it be in a hidden working set? In the Project Explorer, expand the menu (downward arrow on top right) and in Select Working Set, make sure all working sets are selected. | 1 | 0 | 0 | all. I've read the existing threads on this topic.
My understanding is that if I use different workspaces in Eclipse, I should be able to save the same project name. But I'm not able to and not sure why.
In Windows 7, I have Eclipse Kepler (Java) installed with the C++ and Python plugins. I created three workspaces:
C:\eclipse\workspace-c++
C:\eclipse\workspace-java
C:\eclipse\workspace-python
... and I want to create HelloWorld projects in each. I can create the first project, but when I switch perspective and try to save the second in a different workspace, it says that the "project already exists."
Any ideas? Thanks for your help. | Eclipse. Different Workspaces. Can't save same project name | 0 | 0 | 0 | 427 |
19,896,904 | 2013-11-11T00:08:00.000 | 2 | 0 | 0 | 0 | python,algorithm,latitude-longitude | 19,896,958 | 2 | false | 0 | 0 | You might want to look into spatial data structures like the k-d tree or quadtree, which are optimized to answer queries of the form "what points are close to some test point p?" There are lots of good references for and implementations of these data structures online, and you might be able to use some of them to solve your problem simply and efficiently.
Hope this helps! | 1 | 1 | 0 | I am given a file with interesting locations in some cities in the united states.
in another file, I am given a lot of data for train/taxi pickups. I would like to know of an easy to implement algorithm to find if one of these pickup locations is within some x kilometers / miles from one of the interesting locations.
I am writing a python script to do that.
EDIT
I would like to know if I can import a library which has a function that I can use. | Algorithm to find if location (latitude , longitude) is within radius range of a given location (latitude, longitude) | 0.197375 | 0 | 0 | 2,476 |
19,896,965 | 2013-11-11T00:16:00.000 | 2 | 0 | 0 | 0 | python,performance,wxpython,scintilla | 19,897,133 | 1 | true | 0 | 1 | Use GetFirstVisibleLine() to determine the first visible line. Lines are numbered starting at zero.
Use LinesOnScreen() to determine how many lines are visible on the screen.
You can use GetLine(line) to get a string of an individual line. | 1 | 2 | 0 | I am still working on my text editor, and now I want to make it run faster. So I thought I may somehow get currently visible text, and parse it as I want. So is there a way to get currently visible lines?
P.S. Or maybe there is another way to increase StyledTextCtrl's performance? Thanks. | wxPython - StyledTextCtrl get currently visible lines | 1.2 | 0 | 0 | 273 |
19,898,967 | 2013-11-11T04:42:00.000 | 3 | 0 | 0 | 0 | python,flask,wtforms,flask-wtforms | 25,145,753 | 2 | false | 1 | 0 | A great question. This is what we do (flask backend, jquery frontend):
use jquery.forms plugin to ajax forms. Pretty solid mature code. Shortcoming, cannot send json encoded data, only form-urlencoded. Receives plain or json data.
use wtfroms for form validation. Very mature codebase.
tried to use wtforms-json for accepting json, very screwy problems. | 1 | 16 | 0 | I accustomed of using WTForms by means of Flask-WTF in my flask application. Doing server side validation is trivial. But how do I leverage this server validation to become a field level, ajax, client side validation? So, when user tab to another input fields, my application can directly goes on validating it and give validation warning/info/error.
I haven't found a resource in the internet yet | How to use WTForms in Ajax validation? | 0.291313 | 0 | 0 | 8,644 |
19,900,202 | 2013-11-11T06:32:00.000 | 2 | 0 | 1 | 0 | python,pandas,numpy | 50,679,155 | 10 | false | 0 | 0 | Just to add to all other answers, one can also use df.info() to get whats the data type of each column. | 1 | 129 | 1 | Is there a better way to determine whether a variable in Pandas and/or NumPy is numeric or not ?
I have a self defined dictionary with dtypes as keys and numeric / not as values. | How to determine whether a column/variable is numeric or not in Pandas/NumPy? | 0.039979 | 0 | 0 | 132,614 |
19,901,351 | 2013-11-11T07:53:00.000 | 1 | 0 | 1 | 1 | python | 19,901,418 | 3 | false | 0 | 0 | If you are using Linux, you can try this:
(cmdpid=$BASHPID; (sleep 60; kill $cmdpid) & exec YOUR_COMMAND)
for example, if you want to execute a program named script.py:
(cmdpid=$BASHPID; (sleep 60; kill $cmdpid) & exec python script.py) | 1 | 0 | 0 | I have python script and want to stop work or kill proccess after 60 second of execution .
not just stop work , kill or die proccess.
Don't find a good reference for this .
P.S: Kill python script itself (like a timer with first line of script to kill script after a time)
P.S2: I'm on windows and want compile it to .exe
P.S3: Python is on version 2.7 | Kill Python script after 60 second in simplest way | 0.066568 | 0 | 0 | 1,157 |
19,901,647 | 2013-11-11T08:14:00.000 | 1 | 0 | 0 | 1 | python,ubuntu,debian,deb,lintian | 20,292,610 | 2 | false | 1 | 0 | For future reference, here's what I did.
I generated and packaged the .pyo files into their own tar.gz file
In the postinst script, the tar.gz file is extracted, and the tar.gz file is deleted
In the postrm script, the pyo files are deleted.
This isn't the nicest solution in the world, but it works with Debian/Ubuntu's overly draconian policies (which don't even make sense; if I can install a binary, why not a pyo?).
Hopefully this helps someone out. | 1 | 4 | 0 | I have written a proprietary application that needs to install some .pyo files. When I create a .deb from the app, lintian complains that package-installs-python-bytecode. I tried adding an override, but apparently this tag is marked as non-overridable by ftp-master-auto-reject.profile in /usr/share/lintian/profiles/debian. Since this tag is considered an Error, Ubuntu Software Center complains about the package.
Is there a clean way to override this tag so that Ubuntu Software Center no longer complains? | Over-riding Debian/Ubuntu's lintian profile | 0.099668 | 0 | 0 | 683 |
19,904,687 | 2013-11-11T11:01:00.000 | 2 | 0 | 0 | 0 | python,qt,pdf-generation,pyqt4 | 19,905,659 | 1 | true | 0 | 1 | You can use QPixmap.grabWidget to capture you main window widget and QPrinter to produce a pdf file. A QPainter is needed to draw the pixmap to the printer. | 1 | 1 | 0 | I'm working on an app that will display an image and some text. But I want to export the whole QT interface as a PDF (By pressing on a button on the UI itself). All the text and all the images just as it appears on the UI.
Now if that isn't possible, maybe I can some how automatically create a jpg, save it and then somehow, using reportlab, to convert the jpg to a PDF.
I have no idea where to start. Can any one please give me an example or even just a hint. | Creating a PDF from a QT application | 1.2 | 0 | 0 | 1,204 |
19,906,736 | 2013-11-11T12:46:00.000 | 0 | 0 | 0 | 0 | python,qt,user-interface,pyqt | 63,035,982 | 3 | false | 0 | 1 | Nicolescu's answer is perfect and working.
When you open popup/modal(QWidgets.QWidget) window, and want to disable parent window activiy, until the child is open, just use hist example.
def init(self):
self.setWindowModality(QtCore.Qt.ApplicationModal)) | 1 | 5 | 0 | I have created a QMainWindow in python with Qt library. When user clicks on the close button, I'm prompting a warning QMessageBox (Yes/No). I want to fully disable main window's functionality until user chooses yes or no -to the second window-. (I want something like "freezing" the main window.)
I have tried "self.setEnabled(False)" for the main window, but user could still click on minimize and maximize buttons.
Thank you in advance. | disable window functionality in pyqt | 0 | 0 | 0 | 6,641 |
19,907,723 | 2013-11-11T13:35:00.000 | 0 | 0 | 0 | 1 | python,eclipse,pydev | 31,271,138 | 4 | false | 0 | 0 | I had the same problem, I opened Eclipse as admin and it worked... don't know if it helps | 1 | 0 | 0 | I'd like install pydev in eclipse by following method, all of them fails:
using update site, errors happens in the installation, looks like a firewall issue.
download the pydev zip file, and extract to the eclipse folder, not working ( could not find it in preference after restart eclipse)
download hte pydev zip file, and extract to the dropins folder, still not working (could not find it in preference after restart eclipse)
I am very frustrated on this, could anyone help on this ? Thanks
My enviroment:
OS: Mac 10.8
Eclipse: 3.7
Pydev: 3.0
Country: China | Can't install pydev in eclipse | 0 | 0 | 0 | 9,571 |
19,913,092 | 2013-11-11T18:17:00.000 | 1 | 1 | 0 | 0 | python,mocking,simulation,raspberry-pi,gpio | 25,086,750 | 2 | false | 0 | 0 | IF you just don't want to trust a software layer, you could try manually setting the pin high:
The GPIO pins on the Raspberry Pi work with a voltage of 3.3VDC.
Pins 1 & 17 on the P1-GPIO header outputs 3.3VDC.
You could CAREFULLY try to connect a jumper from Pin 1 or 17 to the GPIO input pin you want to test. Connect it to test high, disconnect to test for low.
MAKE SURE YOU DON"T USE THE 5VDC GPIO PINS, YOU COULD/WILL DAMAGE/KILL YOUR PI! | 1 | 5 | 0 | I'm new on Raspberry Pi and I would to know how can we simulate/mock the sensors (or GPIO) so I can test just my python code, mocking the Highs and Lows of the pins?
Thanks in advance! | Simulate Raspberry Pi GPIO signal | 0.099668 | 0 | 0 | 6,042 |
19,913,421 | 2013-11-11T18:38:00.000 | 0 | 1 | 0 | 0 | python,pymc | 19,960,199 | 1 | false | 0 | 0 | You can create custom StepMethods to perform any kind of sampling you like. See the docs for how to create your own. | 1 | 3 | 1 | Is there an easy way to use PyMC's MCMC algorithms to efficiently sample a parameter space for a frequentists analysis? I'm not interested in the point density (for Bayesian analysis), but rather want a fast and efficient way to sample a multidimensional parameter space, so I would like to trace all tested points (i.e. in particular also the rejected points), while recurring points need to be saved only once in the trace.
I would be grateful for any helpful comments.
Btw, thanks for developing PyMC, it is a great package! | Using MCMC from PyMC as an efficient sampler for frequentist analysis? | 0 | 0 | 0 | 155 |
19,916,729 | 2013-11-11T21:53:00.000 | 0 | 1 | 1 | 1 | python,cpython,python-internals | 70,165,436 | 4 | false | 0 | 0 | When we run the python programs: 1_python source code compile with Cpython to the bytecode (bytecode is the binary file with .pyc format which seralize with marshal and it is set of stack structures that solve with pvm) 2_then the pvm (python virtual machine/python interpreter) is stackbase machine (the machine which solve task with stack data structure) which loop inside bytecode line by line and execute it.
What executes the bytecode?
The bytecode tells the Python interpreter which C code to execute. | 1 | 65 | 0 | I am trying to understand how Python works (because I use it all the time!). To my understanding, when you run something like python script.py, the script is converted to bytecode and then the interpreter/VM/CPython–really just a C Program–reads in the python bytecode and executes the program accordingly.
How is this bytecode read in? Is it similar to how a text file is read in C? I am unsure how the Python code is converted to machine code. Is it the case that the Python interpreter (the python command in the CLI) is really just a precompiled C program that is already converted to machine code and then the python bytecode files are just put through that program? In other words, is my Python program never actually converted into machine code? Is the python interpreter already in machine code, so my script never has to be? | How exactly is Python Bytecode Run in CPython? | 0 | 0 | 0 | 14,342 |
19,919,547 | 2013-11-12T01:59:00.000 | 17 | 0 | 0 | 0 | python,django,django-admin,admin | 21,247,209 | 1 | false | 1 | 0 | In python, modules can be loaded from within a package's __init__.py; it doesn't need to be a file in the same directory.
If you look in django/contrib/admin/__init__.py you will see:
from django.contrib.admin.sites import AdminSite, site
So then if you look in django/contrib/admin/sites.py you will see:
site = AdminSite() (at the bottom)
def get_urls(self):
from django.conf.urls import patterns, url, include
if settings.DEBUG:
self.check_dependencies()
def wrap(view, cacheable=False):
def wrapper(*args, **kwargs):
return self.admin_view(view, cacheable)(*args, **kwargs)
return update_wrapper(wrapper, view)
# Admin-site-wide views.
urlpatterns = patterns('',
url(r'^$',
wrap(self.index),
name='index'),
url(r'^logout/$',
wrap(self.logout),
name='logout'),
url(r'^password_change/$',
wrap(self.password_change, cacheable=True),
name='password_change'),
url(r'^password_change/done/$',
wrap(self.password_change_done, cacheable=True),
name='password_change_done'),
url(r'^jsi18n/$',
wrap(self.i18n_javascript, cacheable=True),
name='jsi18n'),
url(r'^r/(?P\d+)/(?P.+)/$',
wrap(contenttype_views.shortcut),
name='view_on_site'),
url(r'^(?P\w+)/$',
wrap(self.app_index),
name='app_list')
)
# Add in each model's views.
for model, model_admin in six.iteritems(self._registry):
urlpatterns += patterns('',
url(r'^%s/%s/' % (model._meta.app_label, model._meta.module_name),
include(model_admin.urls))
)
return urlpatterns
@property
def urls(self):
return self.get_urls(), self.app_name, self.name
note: urls maps to get_urls() | 1 | 11 | 0 | In my urls.py, I have a line of codes of ('include(admin.site.urls). But I cannot find the source file in the setup dir of python like ..\site-packages\django\contrib\admin Where are they? | where can i find the source file of 'admin.site.urls'? | 1 | 0 | 0 | 11,132 |
19,920,246 | 2013-11-12T03:18:00.000 | 0 | 0 | 1 | 0 | python-2.7 | 19,920,270 | 2 | false | 0 | 0 | Do you mean to tell you the last time you entered anything or a specific word?
If it's a specific one, make a dictionary where you use words as keys, and then store the time there. | 1 | 0 | 0 | I have been recently working with Python, and I wish to make a program that tells me how long was the last time I inputted something without it closing (e.g. The first thing I input is the word "foo". After 15 minutes, I input foo again, so the program prints that I last inputted the word foo 15 minutes ago).
Any ideas on how to make such a script? (Thanks in advance) | Permanent timer on Python | 0 | 0 | 0 | 63 |
19,921,322 | 2013-11-12T05:10:00.000 | 0 | 0 | 1 | 0 | python,macos,virtualenv | 19,921,357 | 2 | false | 0 | 0 | The best way to find out is to set up a test, duplicate account with all the same setup (.login, .bashrc, .bash_profile, .tcshrc, etc.) and see what happens when you try.
You may be perfectly fine, or you might have your home directory name hard coded into one of those files, in which case testing this out first might show the problem really quickly (before you mess up your real home directory). | 2 | 0 | 0 | I was going to change the home directory name on my MacBook, but I was wondering if that will mess up any virtual environments or any other files I'm not thinking of right now in my already created Python/Django projects? | Will Changing Home Directory Name Mess Up Virtual Environments? | 0 | 0 | 0 | 39 |
19,921,322 | 2013-11-12T05:10:00.000 | 0 | 0 | 1 | 0 | python,macos,virtualenv | 19,921,505 | 2 | false | 0 | 0 | Rename the home directory, then create a link pointing the old directory name to the new directory name.
This way, anything that points to the old name will still work. | 2 | 0 | 0 | I was going to change the home directory name on my MacBook, but I was wondering if that will mess up any virtual environments or any other files I'm not thinking of right now in my already created Python/Django projects? | Will Changing Home Directory Name Mess Up Virtual Environments? | 0 | 0 | 0 | 39 |
19,921,705 | 2013-11-12T05:37:00.000 | 0 | 0 | 0 | 1 | python,django,amazon-web-services,amazon-ec2 | 51,827,225 | 2 | false | 1 | 0 | Make sure to include your IPv4 Public IP address in the ALLOWED_HOSTS section in Django project/app/settings.py script... | 1 | 4 | 0 | So, I have looked around stack overflow + other sites, but havent been able to solve this problem: hence posting this question!
I have recently started learning django... and am now trying to run it on ec2.
I have an ec2 instance of this format: ec2-xx-xxx-xx-xxx.us-west-2.compute.amazonaws.com on which I have a django app running. I changed the security group of this instance to allow http port 80 connections.
I did try to run it the django app the following ways: python manage.py runserver 0.0.0.0:8000 and python manage.py runserver ec2-xx-xxx-xx-xxx.us-west-2.compute.amazonaws.com:8000 and that doesnt seem to be helping either!
To make sure that there is nothing faulty from django's side, I opened another terminal window and ssh'ed into the instance and did a curl GET request to localhost:8000/admin which went through successfully.
Where am I going wrong? Will appreciate any help! | How do I access my django app running on Amazon ec2? | 0 | 0 | 0 | 6,277 |
19,926,738 | 2013-11-12T10:32:00.000 | 2 | 1 | 0 | 1 | python,jenkins,continuous-integration,continuous-deployment | 19,932,927 | 1 | true | 0 | 0 | Since we already use Jenkins, I think we do it in a script called by
Jenkins. Any reason to do it with a different (better) tool?
To answer your question: No, there aren't any big reasons to not go with Jenkins for deployment.
Pros:
You already know Jenkins (and you probably know some of the quirks)
You don't need to introduce yet another technology
You said that you want to write scripts called by Jenkins, so you can switch easily to a different system later.
Cons:
there might be better tools out there for deployment
Does not tie the best with Change Control tools.
Additional Considerations:
Do not use the same server for prod deployment and continuous build/integration. These are two different tasks performed by two different roles. Therefore two different permission schemes might be employed.
Use permissions wisely. I use two different permissions for my deploy and CI servers. We have 3 Jenkins servers right now.
CI and deploy to uncontrolled environments (Developers can play with these environments)
Deploy to controlled environments. (QA environemnts and upwards)
Deploy to prod (yes, that's the only purpose in live of this server.) with the most restrictive permission scheme.
sandbox, actually there is this forth server for Jenkins admins to play with.
Store your deployable artifacts outside of Jenkins (and you do if I read your question correctly).
So depending on your existing infrastructure and procedure you decide for the tooling. Jenkins won't log you in as long as you keep as much of the logic as possible in scripts that are only executed by Jenkins. | 1 | 2 | 0 | We want to use continuous deployment.
We have:
all sources (python) in a local RhodeCode (git) server.
Jenkins for automated testing
SSH connections to the production systems (linux).
a tool which can update servers in one command.
Now something like this should be implemented:
run tests with Jenkins
if there is a failure. Stop, mail developers
If all tests are OK:
deploy
We are long enough in the business to write some scripts to do this.
My questions:
How to you update the version numbers? You could increment them, you could use a timestamp ...
Since we already use Jenkins, I think we do it in a script called by Jenkins. Any reason to do it with a different (better) tool?
My fear: Jenkins becomes a central server for things which are not related to testing (deploy). I think other tools like SaltStack or Ansible should be used for this. Up to now we use Fabric (simple layer above ssh). Maybe we should switch to a central management system before starting with continuous deployment. | Continuous Deployment: Version Numbering and Jenkins for Deployment? | 1.2 | 0 | 0 | 1,215 |
19,932,110 | 2013-11-12T14:40:00.000 | 2 | 0 | 0 | 0 | java,python,hadoop | 19,932,204 | 3 | false | 1 | 0 | No, you don't necessarily need java knowledge, as you can write map-reduce jobs perfectly well in pig or hive (similar to SQL). However, as with all layers of abstraction, at some point you may well need to know what is going on "behind the scenes" and being able to look, understand and debug the underlying java is a big advantage.
There is a lot of effort currently going into providing a more complete SQL interface to hadoop, with tools such as Impala (Cloudera), Presto (Facebook), Phoenix and Hive (already mentioned). | 1 | 2 | 0 | I wanted to start learning the big data technology from the scratch. I wanted to know is it necessary to learn java for operating with hadoop as i am already well versed in python? | is is necessary to learn java for hadoop? | 0.132549 | 0 | 0 | 689 |
19,937,402 | 2013-11-12T18:45:00.000 | 1 | 0 | 0 | 0 | python,django,oauth-2.0,multi-tenant,django-allauth | 21,147,716 | 1 | false | 1 | 0 | You should use Django sites framework together with django-allauth.
Consumer keys, tokens make use of the Django sites framework. This is
especially helpful for larger multi-domain projects, but also allows
for for easy switching between a development (localhost) and
production setup without messing with your settings and database.
Just configure each social app in the admin backend. | 1 | 3 | 0 | I am creating a web application that will support several domains. For example, if my app were named www.webapp.com, I'd also have numerous customers mapping their domains to my site via DNS CNAME mappings, i.e. webapp.yourdomain.com CNAME www.webapp.com and foo.anotherdomain.com CNAME www.webapp.com, etc...
I want users to authenticate against my app via Google or Facebook (OAuth 2.0) - without me (or the domain owners) having to create a separate Google/Facebook app per mapped domain. Ideally, I would have the base domain act as a broker and redirect to the appropriate mapped domain when responding to the callback url. For example, a user visiting webapp.yourdomain.com/accounts/facebook/login would authenticate against Facebook with a callback url going to www.webapp.com/accounts/facebook/login/callback. When processing the request, I could find the appropriate context, and redirect to webapp.yourdomain.com/accounts/facebook/login/callback where the real authentication would take place (and domain-specific auth cookies would be set).
So, is this doable in django-allauth? How much hacking would it require? Or, is there another social authentication solution for Django that would be easier to implement this in? | django-allauth with multiple domains | 0.197375 | 0 | 0 | 848 |
19,939,598 | 2013-11-12T20:50:00.000 | 0 | 0 | 0 | 0 | python,qt,pyqt,pyqt4 | 19,943,638 | 1 | false | 0 | 1 | The pyuic tool uses the objectName to generate the names of the top-level class and its members. So to make a member "private", just prepend some underscores to the objectName property in the designer component. | 1 | 0 | 0 | I've created a form in Qt Creator 4 and 'compile' it to python module with pyuic4. Everything is ok but when I call the class represented my for it contains over 20 form elements as a public members (including Spacers etc.). But I need only 5 of them. It's not fatal but annoying... Is there a way to declare an element in Qt Creator as private/hidden? I mean it has to be done in Qt Creator because if I'll make any changes and recompile .ui file all changes in .py file would be overwritten. | Qt Creator: how to hide members? | 0 | 0 | 0 | 96 |
19,943,476 | 2013-11-13T01:22:00.000 | 0 | 1 | 0 | 0 | php,python | 19,951,713 | 1 | false | 0 | 0 | There is absolutely no requirement than Python and PHP (or any other language) should generate the same random number for the same seed. | 1 | 2 | 0 | I currently need to use a script that requires python and PHP to output the same random numbers given a seed. Is there any RNG that can let them do this?
When I use mt_rand and mt_srand and python's default rng (which is supposed to be mersenne twist) with the same seed I get different results. | Python and PHP not returning the same results for a similiarly seeded RNG | 0 | 0 | 0 | 130 |
19,944,745 | 2013-11-13T03:31:00.000 | 0 | 0 | 0 | 0 | python,selenium,webdriver,selenium-webdriver | 58,951,194 | 3 | false | 0 | 0 | "driver.session_id" will get you the session-id of current session. | 2 | 11 | 0 | Im using SauceLabs and I need the sessionId to get the Job Id there and use it to set pass/fail status during execution of the test. How can I get the session Id using python? | How to get session id on Selenium webdriver using Python? | 0 | 0 | 1 | 14,421 |
19,944,745 | 2013-11-13T03:31:00.000 | 0 | 0 | 0 | 0 | python,selenium,webdriver,selenium-webdriver | 60,012,259 | 3 | false | 0 | 0 | This worked for me:
BuiltIn().get_library_instance('SeleniumLibrary').driver.session_id | 2 | 11 | 0 | Im using SauceLabs and I need the sessionId to get the Job Id there and use it to set pass/fail status during execution of the test. How can I get the session Id using python? | How to get session id on Selenium webdriver using Python? | 0 | 0 | 1 | 14,421 |
19,945,334 | 2013-11-13T04:30:00.000 | 2 | 0 | 0 | 0 | python,numpy,scipy,scikit-learn,scikits | 24,098,425 | 1 | false | 0 | 0 | No, this is not possible at present. It's also not "doable", and here's why.
CountVectorizer and TfidfVectorizer are designed to turn text documents into vectors. These vectors need to all have an equal number of elements, which in turn is equal to the size of the vocabulary, because that conventions is ingrained in all scikit-learn code. If the vocabulary is allowed to grow, then the vectors produced at various times have different lengths. This affects e.g. the number of parameters in a linear (or other parametric) classifiers trained on such vectors, which then also needs to be able to grow. It affects k-means and dimensionality reduction classes. It even affects something as simple as matrix multiplications, which can no longer be handled with a simple call to NumPy's dot routine, requiring custom code instead. In other words, allowing this flexibility in the vectorizers makes little sense unless you adapt all of scikit-learn to handle the result.
While this would be possible, I (as a core scikit-learn developer) would strongly oppose the change because it makes the code very complicated, probably slower, and even if it would work, it would make it impossible to distinguish between a "growing vocabulary" and the much more common situation of a user passing data in the wrong way, so that the number of dimensions comes out wrong.
If you want to feed data in in batches, then either using a HashingVectorizer (no vocabulary) or do two passes over the data to collect the vocabulary up front. | 1 | 5 | 1 | Scikit-learn CountVectorizer for bag-of-words approach currently gives two sub-options: (a) use a custom vocabulary (b) if custom vocabulary is unavailable, then it makes a vocabulary based on all the words present in the corpus.
My question: Can we specify a custom vocabulary to begin with, but ensure that it gets updated when new words are seen while processing the corpus. I am assuming this is doable since the matrix is stored via a sparse representation.
Usefulness: It will help in cases when one has to add additional documents to the training data, and one should not have to start from the beginning. | Adding new words to text vectorizer in scikit-learn | 0.379949 | 0 | 0 | 2,027 |
19,946,192 | 2013-11-13T05:41:00.000 | 0 | 1 | 0 | 0 | php,python,ajax,twitter,streaming | 22,292,555 | 2 | true | 1 | 0 | I am using twython and using long polling technique for displaying the streams. | 1 | 0 | 0 | I am using twiiter streaming api and twython module with python 2.7 windows 7 os. I want to click a button and streaming of tweets should start. and on clicking the streaming should stop.I am using python for backend and HTML on front end.I am communicating to python via php using passthru function.when i am giving an ajax call to php on clicking of button then all the tweets is displayed at a time. I want streaming.Can anyone help?Thanks | Streaming Tweets Via Python | 1.2 | 0 | 1 | 225 |
19,949,809 | 2013-11-13T09:17:00.000 | 1 | 0 | 0 | 1 | python,docker | 19,951,847 | 3 | false | 1 | 0 | In order to use a Docker container, you will always need the basics - Docker installed on a Linux OS (that supports LXC and any other required filesystem type). In a production environment, you'd be running a recent, native install of Linux, and the initial install of Docker would be easy, and a one-time event (in a cloud environment, you'd probably not upgrade a working machine, but instead spin up a new one, with the latest pre-tested Docker version, and the equally upgraded & tested new containers).
On a MacOS, or Windows development machine, you need a virtual machine to host the Linux OS. There's no way around that. | 3 | 5 | 0 | I'll like to create a python flask application that can run on any platform. I've put it in a Docker container. But unless I've misunderstood something the host machine still need docker installed to launch the container. Which in turn required Vagrant and and Ubuntu VM (at least on Mac). Am I missing something? What is the correct way to use a container as a standalone application? | How do I make a standalone application out of a Docker container? | 0.066568 | 0 | 0 | 3,690 |
19,949,809 | 2013-11-13T09:17:00.000 | 0 | 0 | 0 | 1 | python,docker | 20,142,281 | 3 | false | 1 | 0 | The simple answer is: you can't.
The long answer is: Docker is not intended to be used to make cross platform standalone applications (but JAVA is, for example). Docker instead focuses on having a light weight container that acts like a virtual machine but basically isn't. It's just a box inside a linux(!) system that behaves like a virtual machine to install services into that can be separated clearly from each other that way. A proper use case example for docker would be to install a web application with a specific version of say apache and php in it to have a definitive environment guaranteed. | 3 | 5 | 0 | I'll like to create a python flask application that can run on any platform. I've put it in a Docker container. But unless I've misunderstood something the host machine still need docker installed to launch the container. Which in turn required Vagrant and and Ubuntu VM (at least on Mac). Am I missing something? What is the correct way to use a container as a standalone application? | How do I make a standalone application out of a Docker container? | 0 | 0 | 0 | 3,690 |
19,949,809 | 2013-11-13T09:17:00.000 | 0 | 0 | 0 | 1 | python,docker | 20,142,478 | 3 | false | 1 | 0 | A Linux VM is a dependency if you are on Windows or Mac. Vagrant is not though. It is mentioned only because it's probably the easiest way to get a VM up and running. | 3 | 5 | 0 | I'll like to create a python flask application that can run on any platform. I've put it in a Docker container. But unless I've misunderstood something the host machine still need docker installed to launch the container. Which in turn required Vagrant and and Ubuntu VM (at least on Mac). Am I missing something? What is the correct way to use a container as a standalone application? | How do I make a standalone application out of a Docker container? | 0 | 0 | 0 | 3,690 |
19,951,684 | 2013-11-13T10:46:00.000 | 3 | 0 | 1 | 0 | python | 19,951,968 | 1 | true | 0 | 0 | Module time is built-in in the Python interpreter. No other version than the interpreter's itself can be a valid answer (you can access that one using sys.version).
Other built-in modules like os, sys etc. also do not have their own version information. | 1 | 3 | 0 | How do I determine which version of the python module 'time' is installed. For other modules .version.version or .__version__ work, however for time, both these methods return the error 'module' object has no attribute 'version' or 'version' | Which version of python time module am I using | 1.2 | 0 | 0 | 1,804 |
19,952,513 | 2013-11-13T11:25:00.000 | 0 | 0 | 1 | 0 | asp.net,visual-studio-2010,ironpython | 20,004,327 | 1 | true | 0 | 0 | I found the solution just in case someone needs the same, for websites which is what I needed (for web applications is easier because there's an installable tool)
Add a registry entry key ".py" in
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles.aspx | 1 | 0 | 0 | Is it possible to have .aspx and .aspx.py (IronPython codefile) nested underneath aspx files in VS 2010 ? I've seen some people added Windows registry entries for Visual Studio so other files would show up as nested underneath aspx, but I've no idea how to do it for IronPython if possible | Visual Studio file nesting aspx - aspx.py | 1.2 | 0 | 0 | 64 |
19,957,613 | 2013-11-13T15:23:00.000 | 1 | 1 | 0 | 0 | python,sql,configuration,nginx,fuse | 20,018,813 | 1 | true | 0 | 0 | I haven't seen any working solution to solve your task, a quick google search doesn't give any useful information either (it doesn't look like HttpPerlModule could help with DB stored configuration).
It sounds like it's a good task to develop and contribute to Nginx project ! | 1 | 0 | 0 | I know there exists a plugin for nginx to load the config through perl. I was wondering, does anyone have any experience doing this without using a plugin? Possibly a fuse-backed Python script that queries a DB?
I would really like to not use the perl plugin, as it doesn't seem that stable. | Running Nginx with a database-backed config file | 1.2 | 1 | 0 | 722 |
19,960,086 | 2013-11-13T17:11:00.000 | 3 | 1 | 0 | 0 | python,twitter,tweepy | 19,960,645 | 1 | false | 0 | 0 | As straming API creates a permanent connection, Falling behind technically means that tweets are put in this connection faster than consumed by your client.
Solution is straightforward, you have to process tweets faster, that is optimize your landscape. There must be a bottleneck/bottlenecks, identify them and handle properly. For example, it might be database latency, when your db can not process sufficient inserts per second, IO latency, when data cant be stored to disk as fast as needed; code inefficiency; high CPU load; network bandwidth bound etc.
No silver bullet for all cases, but some obvious steps include:
storing received from Twitter data as is, and do post-processing in windows of lower load;
deploy of a cluster with several tweets consumers (processors) and data sharding;
usage of faster disks/some raid configuration can speed-up IO;
tweet query optimisation, making sure to request and process least amount of tweets possible;
code optimisation;
migration to a datacenter with higher bandwith; | 1 | 1 | 0 | I have a python script which reads all tweets about a specific sporting event and enters them into a database. While I was running it this weekend every time a big event occurred in the game the script would stop and I would get an error. It said it was with the code but I don't believe that is the case. I found this on Twitter's api site:
"Falling behind
Clients which are unable to process messages fast enough will be disconnected. A way to track whether your client is falling behind is to compare the timestamp of the Tweets you receive with the current time. If the difference between the timestamps increases over time, then the client is not processing Tweets as fast as they are being delivered. Another way to receive notifications that a client is falling behind is to pass the stall_warnings parameter when establishing the streaming connection."
and I was wondering if this is whats happening to me and what would be the best way to implement a solution. | Tweepy streaming API falling behind | 0.53705 | 0 | 1 | 599 |
19,962,129 | 2013-11-13T18:58:00.000 | 0 | 1 | 0 | 0 | python,django,jenkins | 25,029,569 | 2 | false | 1 | 0 | Check the latest version of original django-jenkins library. It has same unit test discovery method and coverage disabled by default. Coverage could be enabled with --enable-coverage command line option. | 1 | 0 | 0 | I am using django_discover_jenkins module for generating jenkins reports as a part of unit test runs.
Has anyone used this before and found it to be slower? The coverage tasks slow this down considerably.
How do I remove coverage task from the django_discover_jenkins task set without editing the settings file. | Django Jenkins Test runner - Slow | 0 | 0 | 0 | 560 |
19,962,699 | 2013-11-13T19:31:00.000 | 5 | 0 | 0 | 0 | python,angularjs,flask,cors,flask-restful | 47,288,580 | 9 | false | 1 | 0 | Just an update to this comment. Flask CORS is the way to go, but the flask.ext.cors is deprecated.
use:
from flask_cors import CORS | 2 | 47 | 0 | I've developed a small write-only REST api with Flask Restful that accepts PUT request from a handful of clients that can potentially have changing IP addresses. My clients are embedded Chromium clients running an AngularJS front-end; they authenticate with my API with a simple magic key -- it's sufficient for my very limited scale.
I'm testing deploying my API now and I notice that the Angular clients are attempting to send an OPTIONS http methods to my Flask service. My API meanwhile is replying with a 404 (since I didn't write an OPTIONS handler yet, only a PUT handler). It seems that when sending cross-domain requests that are not POST or GET, Angular will send a pre-flight OPTIONS method at the server to make sure the cross-domain request is accepted before it sends the actual request. Is that right?
Anyway, how do I allow all cross-domain PUT requests to Flask Restful API? I've used cross-domaion decorators with a (non-restful) Flask instance before, but do I need to write an OPTIONS handler as well into my API? | Flask RESTful cross-domain issue with Angular: PUT, OPTIONS methods | 0.110656 | 0 | 1 | 58,328 |
19,962,699 | 2013-11-13T19:31:00.000 | 36 | 0 | 0 | 0 | python,angularjs,flask,cors,flask-restful | 28,923,164 | 9 | false | 1 | 0 | You can use the after_request hook:
@app.after_request
def after_request(response):
response.headers.add('Access-Control-Allow-Origin', '*')
response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
response.headers.add('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE')
return response | 2 | 47 | 0 | I've developed a small write-only REST api with Flask Restful that accepts PUT request from a handful of clients that can potentially have changing IP addresses. My clients are embedded Chromium clients running an AngularJS front-end; they authenticate with my API with a simple magic key -- it's sufficient for my very limited scale.
I'm testing deploying my API now and I notice that the Angular clients are attempting to send an OPTIONS http methods to my Flask service. My API meanwhile is replying with a 404 (since I didn't write an OPTIONS handler yet, only a PUT handler). It seems that when sending cross-domain requests that are not POST or GET, Angular will send a pre-flight OPTIONS method at the server to make sure the cross-domain request is accepted before it sends the actual request. Is that right?
Anyway, how do I allow all cross-domain PUT requests to Flask Restful API? I've used cross-domaion decorators with a (non-restful) Flask instance before, but do I need to write an OPTIONS handler as well into my API? | Flask RESTful cross-domain issue with Angular: PUT, OPTIONS methods | 1 | 0 | 1 | 58,328 |
19,962,995 | 2013-11-13T19:48:00.000 | 0 | 0 | 1 | 0 | python,selenium,beautifulsoup | 19,963,148 | 1 | true | 0 | 0 | There is no nice solution to do this. It would be the best to use existing mechanisms -- as dependencies defined in setup.py.
If you really need to do this, you could execute the corresponding scripts using subprocess.call():
Check whether pip is available. If not, terminate the program.
Check whether virtualenv is available. If yes, create and activate a new environment.
Call pip to install the required packages.
If virtualenv is not installed, this will require root privileges. | 1 | 1 | 0 | I have a python.py file that I would like to by able to run on any computer that has python installed.
However, the program uses several packages that I installed through pip (BeautifulSoup and Selenium).
Is there a way to make a single python file that will automatically incorporate everything it needs from these packages into the .py file?
Thanks! | Make python file that isn't reliant on installed packages | 1.2 | 0 | 1 | 45 |
19,965,018 | 2013-11-13T21:45:00.000 | 9 | 0 | 1 | 0 | python,format,decimal | 19,965,123 | 8 | false | 0 | 0 | Try math.floor(val) == val or val == int(val). | 1 | 32 | 0 | I am using the Decimal library in Python, and printing out the values using
format(value, 'f'), where value is a Decimal. I get numbers in the form 10.00000, which reflects the precision on the decimal. I know that float supports is_integer, but there seems to be a lack of a similar API for decimals. I was wondering if there was a way around this. | python Decimal - checking if integer | 1 | 0 | 0 | 26,761 |
19,965,232 | 2013-11-13T21:57:00.000 | 1 | 0 | 1 | 0 | python,list,python-2.7 | 19,965,350 | 4 | false | 0 | 0 | Your second solution is much less efficient than your first. count and remove both traverse the list, so to remove N copies of an item, you have to traverse the list N+1 times. Whereas the list comprehension only traverses the list once no matter how many copies there are. | 1 | 0 | 0 | Suppose you have a list that is n entries long. This list does not contain uniform data (some entries maybe strings, others integers, or even other lists). Assuming that list contains at least one instance of a given value, what is the fastest to remove all instances in that list?
I can think of two, a list comprehension, or .remove()
[item for item in lst if item != itemToExclude]
for i in range(lst.count(itemToExclude)): lst.remove(itemToExclude)
But I have no sense for which of these will be fastest for an arbitrarily large list, or if there are any other ways. As a side note, if someone could provide some guidelines for determining the speed of methods at a glance, I would greatly appreciate it! | What is the fastest way to remove all instances of a particular entry from a list in Python? | 0.049958 | 0 | 0 | 125 |
19,965,270 | 2013-11-13T22:00:00.000 | 1 | 0 | 1 | 0 | python,django | 19,967,173 | 1 | false | 0 | 0 | They don't differ in performance at all. | 1 | 1 | 0 | I'm curious about this, from a performance point of view only, how do their differ considering the proper use? | Performance: Class Based Views VS Function Based Views | 0.197375 | 0 | 0 | 346 |
19,965,595 | 2013-11-13T22:18:00.000 | 0 | 0 | 1 | 0 | python,string,comparison | 27,936,479 | 4 | false | 0 | 0 | What is the need for using other than '==' as python strings are immutable and memoized by default?
As pointed in other answers you can use 'is' for reference(id) comparison. | 1 | 1 | 0 | Can you compare strings in Python in any other way apart from ==?
Is there anything like .equals in Java? | Can you compare strings in python like in Java with .equals? | 0 | 0 | 0 | 7,329 |
19,966,996 | 2013-11-14T00:04:00.000 | 4 | 0 | 1 | 0 | python,python-2.7,matplotlib,ipython | 19,967,663 | 2 | true | 0 | 0 | I discovered that I needed to use plt.show() rather than plt.draw(). | 1 | 3 | 0 | When I run my code from the shell command line, it opens the figure window and displays the plot but as soon as the code is completed it closes it. I do not have any close() statements.
How can I prevent figures from closing when running a python script from the command line with ipython?
I could add a statement at the end to quit only after pressing any key, but that feels too much like a hack. | Prevent figures from closing when running a script from the command line | 1.2 | 0 | 0 | 1,138 |
19,968,985 | 2013-11-14T03:29:00.000 | 0 | 0 | 0 | 0 | jquery,python,django,autocomplete,django-forms | 20,029,341 | 1 | false | 1 | 0 | It would be helpful to see the model and form.
If you are using a simple charfield in your model and set the choices in the automcomplete class, you should be able to input arbitrary values. | 1 | 0 | 0 | I have a django form element (Musical Instrument) where I'd like to autocomplete from a list of choices (e.g. ['Piano', 'Guitar', 'Drums', 'Bass']), but allow the user to enter something else if it isn't in the list.
I'm currently using autocomplete-light, but can swap this for something else if need be.
Any ideas? | Autocompleting list of choices with 'other' option in django | 0 | 0 | 0 | 59 |
19,969,687 | 2013-11-14T04:41:00.000 | 3 | 0 | 0 | 1 | python,linux,centos,mesos | 20,348,972 | 1 | false | 0 | 0 | you need to have python dev version (headers etc.)
try
yum install python-devel | 1 | 1 | 0 | I am trying to install mesos on CentOs. I downloaded it and run ./configure command. But couldn't be completed due to installed version of python as mesos requires development version 2.6. I tried to upgrade python but it upgrades to 2.4 only. Then I manually download python 2.6 and install, which is located under /usr/local/bin/ and the old one is located under /usr/bin. When I run the python command in terminal it displays python 2.6, but again when I configure mesos it again gives same error.
configure: error: in `/root/mesos-0.14.1':
configure: error:
Could not link test program to Python. Maybe the main Python library has been
installed in some non-standard library path. If so, pass it to configure,
via the LDFLAGS environment variable.
Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
============================================================================
ERROR!
You probably have to install the development version of the Python package
for your distribution. The exact name of this package varies among them.
============================================================================
I then create symbolic link of /usr/local/bin/python to /usr/bin/python but now 'yum' command doesn't work also configuring mesos again gives same error. I also tried ./configure LDFLAGS="-L/usr/local/lib/python/lib" .What should I do to install mesos cluster in Cent Os ? What is the solution ? | Python error while configuring mesos on centos | 0.53705 | 0 | 0 | 2,608 |
19,972,936 | 2013-11-14T08:35:00.000 | 0 | 0 | 0 | 0 | emacs,ipython,tab-completion,linux-mint | 19,977,775 | 3 | false | 0 | 0 | Start IPython not from pure shell, but from a python-mode.
I.e. M-x run-python RET with shipped python.el, having customized python-shell-interpreter accordingly.
Resp. M-x IPython RET with python-mode.el | 1 | 5 | 0 | When I run IPython inside emacs in textmode (i.e. inside a terminal), I don't get any tab completion. Rather than given tab completion it jumps four spaces.
When I run emacs in normal GUI mode there is fine tab completion.
Is there a way to fix that for text mode?
I'm using Linux Mint 15, Emacs 24.3 and IPython 1.1.0 | No tab completion for IPython in Emacs textmode | 0 | 0 | 0 | 2,227 |
19,975,234 | 2013-11-14T10:28:00.000 | 1 | 1 | 1 | 0 | python,raspberry-pi,mqtt,mosquitto | 19,975,285 | 2 | false | 0 | 0 | If you are using pip, use pip freeze | grep 'python-mosquitto' to get the package version, and pip remove python-mosquitto to remove it. | 1 | 0 | 0 | How do I see what is the version of the python-mosquitto package used by my program? How do I find an old version of python-mosquitto (version 0.15) and remove it?
I'm running on Raspberry Pi, raspian | how to find python-mosquitto version | 0.099668 | 0 | 0 | 3,471 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.