Q_CreationDate
stringlengths
23
23
Title
stringlengths
11
149
Question
stringlengths
25
6.53k
Answer
stringlengths
15
5.1k
Score
float64
-1
1.2
Is_accepted
bool
2 classes
N_answers
int64
1
17
Q_Id
int64
0
6.76k
2015-08-28 10:28:55.307
How to print barcode in Centos 6 using python
I want to print Barcode on my Zebra Desktop label printer on CentOS 6.5 but I did not find any python drivers for that and did not found script so that i can use in my project. Does anyone know how to print Barcode in Zebra printer?
If you are printing to a network printer open a TCP connection to port 9100. If you are printing to a USB printer look up a USB library for python. Once you have a connection send a print string formatted in ZPL. Look on the Zebra site for the ZPL manual. There are examples in there on how to print a barcode. Normal Li...
0.673066
false
1
3,905
2015-08-28 19:24:28.197
how to know what page or call is being when in a JSP page when submited
I have a JSP page called X.JSP (contains few radio button and submit button), when i hit the submit button in X.JSP, the next page is displayed Y.JSP?xxxx=1111&yyyy=2222&zzzz=3333 how to know what page or service or ajax call is being made when i hit the submit button in X.JSP page. xxxx=1111&yyyy=2222&zzzz=3333 these...
The developers console ( F12 in Chrome and Firefox) is a wonderful thing. Check the Network or Net tab. There you can see all the requests between your browser and your server.
0
false
1
3,906
2015-08-29 10:15:26.453
How to properly install wxPython?
So I was looking around at different things to do on Python, like code for flashing text or a timer, but when I copied them into my window, there were constant syntax errors. Now, maybe you're not meant to copy them straight in, but one error I got was 'no module named wx'. I learned that I could get that module by ins...
Check the version of wxpython and the version of python you have in your machine. For python 2.7 use wxPython3.0-win32-3.0.2.0-py27 package
0
false
2
3,907
2015-08-29 10:15:26.453
How to properly install wxPython?
So I was looking around at different things to do on Python, like code for flashing text or a timer, but when I copied them into my window, there were constant syntax errors. Now, maybe you're not meant to copy them straight in, but one error I got was 'no module named wx'. I learned that I could get that module by ins...
3 steps to install wx-widgets and pygame in python IDLE Install python 3xxx in your system opting (Add 3xxx to your path). open python CLI to see whether python is working or not. then open command prompt (CMD). type PIP to see whether pip is installed or not. enter command : pip install wheel enter command : pip i...
0.278185
false
2
3,907
2015-08-29 10:32:24.120
Install a custom Python 2.7.10 module on Mac
I don't know how many duplicates of this are out there but none of those I looked at solved my problem. To practice writing and installing custom modules I've written a simple factorial module. I have made a factorial folder in my site-packages folder containing factorial.py and an empty __init__.py file. But typing im...
I think there are several different things to take into consideration here. When you're importing a module, (doing import factorial), Python will look in the defined PATH and try to find the module you're trying to import. In the simplest case, if your module is in the same folder where your script is trying to import ...
1.2
true
1
3,908
2015-08-30 13:51:58.043
Python mssql passing procedure user defined data type as parameter
My original purpose was to bulk insert into my db I tried pyodbc, sqlalchemy and ceodbc to do this with executemany function but my dba checked and they execute each row individually. his solution was to run procedure that recieve table (user defined data type) as parameter and load it into the real table. The problem ...
Sqlalchemy bulk operations doesn't really inserts a bulk. It's written in the docs. And we've checked it with our dba. Thank you we'll try the xml.
0
false
1
3,909
2015-08-31 06:29:47.267
Export from Oracle to MongoDB using python
I know there are various ETL tools available to export data from oracle to MongoDB but i wish to use python as intermediate to perform this. Please can anyone guide me how to proceed with this? Requirement: Initially i want to add all the records from oracle to mongoDB and after that I want to insert only newly inserte...
To answer your question directly: 1. Connect to Oracle 2. Fetch all the delta data by timestamp or id (first time is all records) 3. Transform the data to json 4. Write the json to mongo with pymongo 5. Save the maximum timestamp / id for next iteration Keep in mind that you should think about the data model consi...
0
false
1
3,910
2015-08-31 16:47:39.227
Is it possible to Bulk Insert using Google Cloud Datastore
We are migrating some data from our production database and would like to archive most of this data in the Cloud Datastore. Eventually we would move all our data there, however initially focusing on the archived data as a test. Our language of choice is Python, and have been able to transfer data from mysql to the data...
There is no "bulk-loading" feature for Cloud Datastore that I know of today, so if you're expecting something like "upload a file with all your data and it'll appear in Datastore", I don't think you'll find anything. You could always write a quick script using a local queue that parallelizes the work. The basic gist wo...
1.2
true
1
3,911
2015-09-01 06:58:21.483
How to store a dynamic python dictionary in MySQL database?
I am doing a mini-project on Web-Crawler+Search-Engine. I already know how to scrape data using Scrapy framework. Now I want to do indexing. For that I figured out Python dictionary is the best option for me. I want mapping to be like name/title of an object (a string) -> the object itself (a Python object). Now the pr...
If you want to store dynamic data in a database, here are a few options. It really depends on what you need out of this. First, you could go with a NoSQL solution, like MongoDB. NoSQL allows you to store unstructured data in a database without an explicit data schema. It's a pretty big topic, with far better guides/...
0.201295
false
1
3,912
2015-09-02 00:53:41.593
getting "SyntaxError" when installing twilio in the Windows command line interface
I'm new here and also a new Python learner. I was trying to install twilio package through the Windows command line interface, but I got a syntax error(please see below). I know there're related posts, however, I was still unable to make it work after trying those solutions. Perhaps I need to set the path in the comman...
go to the command prompt it will say the account and all that jazz. type cd .. then hit enter it will say C:\Users> type cd .. again then it will say C:> type cd python27 (or the name of your python folder) it will say C:\Python27> type cd scripts it will say C:\python27/scripts> type easy_install twilio then wait fo...
0.135221
false
2
3,913
2015-09-02 00:53:41.593
getting "SyntaxError" when installing twilio in the Windows command line interface
I'm new here and also a new Python learner. I was trying to install twilio package through the Windows command line interface, but I got a syntax error(please see below). I know there're related posts, however, I was still unable to make it work after trying those solutions. Perhaps I need to set the path in the comman...
You should not type python first, then it becomes python command line. Open a new command prompt and directly type: easy_install twilio
0.386912
false
2
3,913
2015-09-02 01:10:08.887
Multiple authentication app support
When developing a Django project, many third party authentication packages are available, for example: Django OAuth Toolkit, OAuth 2.0 support. Djoser, provides a set of views to handle basic actions such as registration, login, logout, password reset and account activation. Currently, I just want to support basic ac...
djoser supports only Basic Auth and the token auth by Django Rest Framework. What you can do is to make use of login and logout from Django OAuth Toolkit and then djoser views such as like register, password reset.
0
false
1
3,914
2015-09-02 12:59:17.957
Python import statement inside and outside a function. What is better for the memory?
When memory issues are critical, do I save some memory when I do my python imports inside a function, so as to when the call finishes everything will be discarder from memory? Or this cumbers more my memory and CPU especially when I do a lot of calls of the specific function? (The user does the calls and I do not know ...
When you import a module, any/all module objects/functions/etc are cached so that importing the same module again is a no-op. Subsequently these objects/functions/etc will not be freed when the local names referring to them go out of scope. This only affects functions and objects defined globally within the module and ...
0.673066
false
1
3,915
2015-09-03 00:15:16.597
Markdown in iPython Notebook: how to highlight code?
In Markdown, how do you highlight code <--- just like that. I don't know how to search for it because I'm not sure what it's called. I also don't know what the little dashes are called either. I tried doing what I would do in SO, but it just reads it as normal text Update: This is what I have: foo in SO it actually s...
Late answer but backtick ` is the way to go, just like here at SO.
0.135221
false
1
3,916
2015-09-03 16:42:34.737
Updating only TTL in cassandra
When running model.update(args, kwargs) in python, if the data is not different it doesn't actually make any changes, correct? If so, does it update the TTL? If not, how can we make it so it will reset the TTL? Use case: We have a model that stores out loop information for twisted and we have a TTL of 10 seconds on it...
When you do an insert or update in Cassandra, the new value overrides the old value even if it is the same value. This is because Cassandra does not do a read of the existing data before storing the new data. Every write is just an append operation and Cassandra has no idea if the new value is the same as the old val...
1.2
true
1
3,917
2015-09-04 04:40:30.517
Can we make many views.py in Django as a Controller?
Iam new to Django Framework and just started learning django 1.8. In other framework Like Laravel,Rails there we can make different controller file. for example UserController.php,ContactController.php etc. I think in Django, views.py is similar to Controller and In django ,in views.py i have a long line of code of ...
Instead of multiple views.py, You can divide your application into individual applications within your project. Like separate applications for userRegistration, Contact, ArticleControl. this way your code will look much cleaner. And in case of any bug you will be able to debug that specific application easily.
0.999329
false
1
3,918
2015-09-04 04:49:32.933
Pip freeze for only project requirements
When I run pip freeze > requirements.txt it seems to include all installed packages. This appears to be the documented behavior. I have, however, done something wrong as this now includes things like Django in projects that have no business with Django. How do I get requirements for just this project? or in the future ...
I just had the same issue, here's what I've found to solve the problem. First create the venv in the directory of your project, then activate it. For Linux/MacOS : python3 -m venv ./venv source myvenv/bin/activate For Windows : python3 -m venv .\venv env\Scripts\activate.bat Now pip freeze > requirements.txt should on...
0
false
3
3,919
2015-09-04 04:49:32.933
Pip freeze for only project requirements
When I run pip freeze > requirements.txt it seems to include all installed packages. This appears to be the documented behavior. I have, however, done something wrong as this now includes things like Django in projects that have no business with Django. How do I get requirements for just this project? or in the future ...
if you are using linux then do it with sed pip freeze | sed 's/==.*$/''/' > requirements.txt
0.040794
false
3
3,919
2015-09-04 04:49:32.933
Pip freeze for only project requirements
When I run pip freeze > requirements.txt it seems to include all installed packages. This appears to be the documented behavior. I have, however, done something wrong as this now includes things like Django in projects that have no business with Django. How do I get requirements for just this project? or in the future ...
I have tried both pipreqs and pigar and found pigar is better because it also generates information about where it is used, it also has more options.
0.715303
false
3
3,919
2015-09-04 11:33:51.320
Keeping python sockets alive in event of connection loss
I'm trying to make a socket connection that will stay alive so that in event of connection loss. So basically I want to keep the server always open (also the client preferably) and restart the client after the connection is lost. But if one end shuts down both ends shut down. I simulated this by having both ends on the...
The issue is not related to the programming language, in this case python. The oeprating system (Windows or linux), has the final word regarding the resilience degree of the socket.
0
false
2
3,920
2015-09-04 11:33:51.320
Keeping python sockets alive in event of connection loss
I'm trying to make a socket connection that will stay alive so that in event of connection loss. So basically I want to keep the server always open (also the client preferably) and restart the client after the connection is lost. But if one end shuts down both ends shut down. I simulated this by having both ends on the...
I'm assuming we're dealing with TCP here since you use the word "connection". It all depend by what you mean by "connection loss". If by connection loss you mean that the data exchanges between the server and the client may be suspended/irresponsive (important: I did not say "closed" here) for a long among of time, sec...
1.2
true
2
3,920
2015-09-04 21:21:21.633
Using SCM to synchronize PyDev eclipse projects between different computer
I use eclipse to write python codes using pydev. So far I have been using dropbox to synchronize my workspace. However, this is far from ideal. I would like to use github (or another SCM platform) to upload my code so I can work with it from different places. However, I have found many tutorials kind of daunting... M...
I use bitbucket coupled with mercurial. That is my repository is on bitbucket and i pull and psuh to it from mercurial within eclipse For my backup i have an independent carbonite process going to net back all hard disk files. But I imagine there is a clever free programatic way to do so. If one knew how to write the a...
0
false
2
3,921
2015-09-04 21:21:21.633
Using SCM to synchronize PyDev eclipse projects between different computer
I use eclipse to write python codes using pydev. So far I have been using dropbox to synchronize my workspace. However, this is far from ideal. I would like to use github (or another SCM platform) to upload my code so I can work with it from different places. However, I have found many tutorials kind of daunting... M...
I use mercurial. I picked it because it seemed easier. But is is only easiER. There is mercurial eclipse plugin. Save a copy of your workspace and maybe your eclipse folder too before daring it :)
1.2
true
2
3,921
2015-09-06 06:50:58.783
Homebrew installation of OpenCV 3.0 not linking to Python
When I install OpenCV 3.0 with Homebrew, it gives me the following directions to link it to Python 2.7: If you need Python to find bindings for this keg-only formula, run: echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth While I can find the python2.7 s...
You need to install opencv like brew install opencv3 --with-python3. You can see a list of options for a package by running brew info opencv3.
0.673066
false
2
3,922
2015-09-06 06:50:58.783
Homebrew installation of OpenCV 3.0 not linking to Python
When I install OpenCV 3.0 with Homebrew, it gives me the following directions to link it to Python 2.7: If you need Python to find bindings for this keg-only formula, run: echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth While I can find the python2.7 s...
It's weird that there is no concise instruction for installing OpenCV 3 with Python3. So, here I make it clear step-by-step: Install Homebrew Python 3.5: brew install python3 Tap homebrew/science: brew tap homebrew/science Install any Python3 packages using pip3. This will create the site-packages folder for Python3 ...
0.998178
false
2
3,922
2015-09-06 12:23:38.097
Configuring an aiohttp app hosted by gunicorn
I implemented my first aiohttp based RESTlike service, which works quite fine as a toy example. Now I want to run it using gunicorn. All examples I found, specify some prepared application in some module, which is then hosted by gunicorn. This requires me to setup the application at import time, which I don't like. I w...
At least for now aiohttp is a library without reading configuration from .ini or .yaml file. But you can write code for reading config and setting up aiohttp server by hands easy.
0.386912
false
1
3,923
2015-09-06 20:35:39.510
How to setup rethinkdb proxy server
we have two client machines, how do we connect both of them using proxy server? As you said earlier: "To start a RethinkDB proxy on the client: rethinkdb proxy -j -j ..." only of the clients can connect in this way, since the ports will already be in use.
As mentioned elsewhere, you can avoid the port conflict by passing in the -o 1 argument. This shifts the ports that the proxy uses by an offset of 1.
0.386912
false
1
3,924
2015-09-07 12:20:21.633
Parse mailer daemons, failure notices
I have something like 1500 mail messages in eml format and I want to parse them na get e-mail addresses that caused error and error message (or code). I would like to try to do it in python. Someone have any idea how to do that except parsing line by line and searching for line and error code (or know software to do th...
So you have 1500 .eml files and want to identify mails from mailer-daemons and which adress caused the mailer-daemon message? Just iterate over the files, then check the from: line and see if it is a mailer-daemon message, and then get the adress that caused the error out of the text. There is no other way than iterati...
0
false
1
3,925
2015-09-07 19:16:24.353
jupyter - how to comment out cells?
Is it possible to comment out whole cells in jupyter? I need it for this case: I have a lot of cells, and I want to run all of them, except for a few of them. I like it that my code is organized in different cells, but I don't want to go to each cell and comment out its lines. I prefer to somehow choose the cells I wan...
If you switch the cell to 'raw NBConvert' the code retains its formatting, while all text remains in a single font (important if you have any commented sections), so it remains readable. 'Markdown' will interpret the commented sections as headers and change the size and colour accordingly, making the cell rather messy....
0.999329
false
4
3,926
2015-09-07 19:16:24.353
jupyter - how to comment out cells?
Is it possible to comment out whole cells in jupyter? I need it for this case: I have a lot of cells, and I want to run all of them, except for a few of them. I like it that my code is organized in different cells, but I don't want to go to each cell and comment out its lines. I prefer to somehow choose the cells I wan...
I think the easiest thing will be to change the cell type to 'Markdown' with M when you don't want to run it and change back to 'Code' with Y when you do. In a short test I did, I did not lose my formatting when switching back and forth. I don't think you can select multiple cells at once.
0.99998
false
4
3,926
2015-09-07 19:16:24.353
jupyter - how to comment out cells?
Is it possible to comment out whole cells in jupyter? I need it for this case: I have a lot of cells, and I want to run all of them, except for a few of them. I like it that my code is organized in different cells, but I don't want to go to each cell and comment out its lines. I prefer to somehow choose the cells I wan...
Mark the content of the cell and press Ctrl+ /. It will comment out all lines in that cell. Repeat the same steps to uncomment the lines of your cell.
1
false
4
3,926
2015-09-07 19:16:24.353
jupyter - how to comment out cells?
Is it possible to comment out whole cells in jupyter? I need it for this case: I have a lot of cells, and I want to run all of them, except for a few of them. I like it that my code is organized in different cells, but I don't want to go to each cell and comment out its lines. I prefer to somehow choose the cells I wan...
You can switch the cell from 'Code to 'Raw NBConvert'
0.201295
false
4
3,926
2015-09-08 12:42:05.337
pycharm python console autocompletion
if I start ipython in a terminal, when I type 'im' and press TAB, the terminal will auto-complete it with 'import', but when I click python console button in the bottom of pycharm IDE, when the ipython environment shows, type 'im', press TAB, it will not give autocompletion. In PyCharm, it use pydevconsole.py to create...
ctrl+space confuse with input language switching of Windows. need change setting of Keymap File -> Setting -> Keymap -> Main menu -> Code -> Complete -> Basic
0.201295
false
1
3,927
2015-09-09 20:41:57.273
Use Histogram data to generate random samples in scipy
Suppose I have a process where I push a button, and after a certain amount of time (from 1 to 30 minutes), an event occurs. I then run a very large number of trials, and record how long it takes the event to occur for each trial. This raw data is then reduced to a set of 30 data points where the x value is the number...
You can also use the histogram, piecewise uniform distribution directly, then you get exactly the corresponding random numbers instead of an approximation. The inverse cdf, ppf, is piecewise linear and linear interpolation can be used to transform uniform random numbers appropriately.
0.135221
false
1
3,928
2015-09-09 23:12:37.373
Change date format when importing from CSV
I have a CSV file where the date is formatted as yy/mm/dd, but Excel is reading it wrongly as dd/mm/yyyy (e.g. 8th September 2015 is read as 15th of September 2008). I know how to change the format that Excel outputs, but how can I change the format it uses to interpret the CSV data? I'd like to keep it to Excel if...
Option 3. Import it properly Use DATA, Get External Data, From Text and when the wizard prompts you choose the appropriate DMY combination (Step 3 of 3, Under Column data format, and Date).
1.2
true
1
3,929
2015-09-10 21:05:59.430
Hosting API docs generated with mkdocs at a URL within a Django project
I tend to write my API documentation in Markdown and generate a static site with MkDocs. However, the site I'd like to host the documentation on is a Django site. So my question is, and I can't seem to find an answer Googling around, is how would I go about hosting the MkDocs static generated site files at a location...
Django is just a framework you need to host your static files and serve them with something like Nginx or Apache etc.
0.496174
false
1
3,930
2015-09-11 19:06:02.927
Is there a difference between "brew install" and "pip install"?
I want to install pillow on my Mac. I have python 2.7 and python 3.4, both installed with Homebrew. I tried brew install pillow and it worked fine, but only for python 2.7. I haven't been able to find a way to install it for python 3. I tried brew install pillow3 but no luck. I've found a post on SO that says to f...
Homebrew is a package manager, similar to apt on ubuntu or yum on some other linux distros. Pip is also a package manager, but is specific to python packages. Homebrew can be used to install a variety of things such as databases like MySQL and mongodb or webservers like apache or nginx.
0.496174
false
1
3,931
2015-09-11 20:15:58.357
Python: Regular expression for quadratic equations
I am currently trying to do a quadratic equation solver. I searched on the web how people did their version, but all of them implied that the user entered the coefficients, which, although the easiest way, I really hate it. I want the user to introduce the whole equation, and let the program know which are the coeffici...
I'd recommend cleaning the input up a but first. Get rid of all the white space, or at least the spaces. Check for an equal sign and see if there's a 0 on one side or the other. If there is you can remove it. If not you have to decide how clever you want to be. Get it close to a format you want to deal with, in other ...
0
false
1
3,932
2015-09-13 19:39:43.760
If my entire training set of documents is class A, how can I use TF-IDF to find other documents of class A?
I have a collection X of documents, all of which are of class A (the only class in which I'm interested or know anything about). I also have a much larger collection Y of documents that I know nothing about. The documents in X and Y come from the same source and have similar formats and somewhat similar subject matters...
The easiest thing to do is what was already proposed - clustering. More specifically, you extract a single feature vector from set X and then apply K-means clustering to the whole X & Y set. ps: Be careful not to confuse k-means with kNN (k-nearest neighbors). You are able to apply only unsupervised learning methods.
0.201295
false
2
3,933
2015-09-13 19:39:43.760
If my entire training set of documents is class A, how can I use TF-IDF to find other documents of class A?
I have a collection X of documents, all of which are of class A (the only class in which I'm interested or know anything about). I also have a much larger collection Y of documents that I know nothing about. The documents in X and Y come from the same source and have similar formats and somewhat similar subject matters...
What I think you have is an unsupervised learning application. Clustering. Using the combined X & Y dataset, generate clusters. Then overlay the X boundary; the boundary that contains all X samples. All items from Y in the X boundary can be considered X. And the X-ness of a given sample from Y is the distance from...
1.2
true
2
3,933
2015-09-14 19:07:36.940
SWIG: wchar_t support for Java
I use %include wchar.i in C# and it seems to work correctly for all wchar_t values and arrays mapping to C#'s string. Swig's library for Python also contains the typemaps for wchar_t in wchar.i file. Java's library doesn't have wchar.i. What's the reason for that? And also how I can achieve type mapping from wchar_t ty...
As you are using c++, than you can try with std::wstring as it has typemaps for all: C#, Python and Java. It is in std_wstring.i
0
false
1
3,934
2015-09-14 21:09:58.320
How can I reference libraries for ApacheSpark using IPython Notebook only?
I'm currently playing around with the Apache Spark Service in IBM Bluemix. There is a quick start composite application (Boilerplate) consisting of the Spark Service itself, an OpenStack Swift service for the data and an IPython/Jupyter Notebook. I want to add some 3rd party libraries to the system and I'm wondering h...
You cannot add 3rd party libraries at this point in the beta. This will most certainly be coming later in the beta as it's a popular requirement ;-)
1.2
true
1
3,935
2015-09-15 05:06:14.750
how to install python-devel in Mac OS?
brew and port does not provide python-devel. How can I install it in Mac OS. Is there an equivalent in Mac OS?
If you install Python using brew, the relevant headers are already installed for you. In other words, you don't need python-devel.
1
false
1
3,936
2015-09-15 15:44:56.987
Get files attached to URL using python
So I have a question; How does one get the files from a webpage and the urls attached to them. For example, Google.com so we go to google.com and open firebug (Mozilla/chrome) and go to the "network" We then see the location of every file attached, and extension of the file. How do I do this in python? For url stuff, I...
It is not difficult to parse the webpage and find the links of all "attached" files such as (css, icon, js, images, etc.) which will be fetched by the browser that you can see them in the 'Network' panel. The harder part is that some files are fetched by javascript using ajax. The only way to do that (completely and co...
0
false
1
3,937
2015-09-16 07:11:29.430
What is the right way in Django to generate random URLs for user uploaded items?
For example, uploading a gif to gfycat generates URLs in the form of Adjective-Adjective-Noun such as ForkedTestyRabbit. Obviously going to this URL allows you to view the model instance that was uploaded. So I'm thinking the post upload generates a unique random URL, e.g. /uploads/PurpleSmellyGiraffe. The model will h...
What I usually do is create a dir with uploaded date as name, e.g. 04042018/ and then I rename the uploaded file with an uuid4, e.g. 550e8400-e29b-41d4-a716-446655440000.jpg So the fullpath for the uploaded file will be something like this: site_media/media/04042018/550e8400-e29b-41d4-a716-446655440000.jpg Personally I...
1.2
true
1
3,938
2015-09-16 14:47:13.760
How can I switch using pip between system and anaconda
I am now using anaconda pip after I installed pip by "conda install pip", if I want to use system pip again, how can I make it? Or how can I switch system pip to anaconda pip?
You don't need to change your path. Just use the full path to the system pip (generally /usr/bin/pip or /usr/local/bin/pip) to use the system pip.
0.201295
false
2
3,939
2015-09-16 14:47:13.760
How can I switch using pip between system and anaconda
I am now using anaconda pip after I installed pip by "conda install pip", if I want to use system pip again, how can I make it? Or how can I switch system pip to anaconda pip?
Odds are that anaconda automatically edited your .bashrc so that anaconda/bin is in front of your /usr/bin folder in your $PATH variable. To check this, type echo $PATH, and the command line will return a list of directory paths. Your computer checks each of these places for pip when you type pip in the command line....
0.986614
false
2
3,939
2015-09-18 12:55:55.673
Save multiple figures in one pdf page, matplotlib
I'm trying to get my figures in just one pdf page, but I don't know how to do this. I found out that it's possible to save multiple figures in a pdf file with 'matplotlib.backends.backend_pdf', but it doesn't work for just one page. Has anyone any ideas ? Convert the figures to just one figure ?
The PDF backend makes one page per figure. Use subplots to get multiple plots into one figure and they'll all show up together on one page of the PDF.
0
false
1
3,940
2015-09-18 18:45:29.490
Copy database from one server to another server + trigger python script on a database event
I've a read-only access to a database server dbserver1. I need to store the result set generated from my query running on dbserver1 into another server of mine dbserver2. How should I go about doing that? Also can I setup a trigger which will automatically copy new entries that will come in to the dbserver1 to dbserve...
lad2015 answered the first part. The second part can be infinitely more dangerous as it involves calling outside the Sql Server process. In the bad old days one would use the xp_cmdshell. These days it may be more worthwhile to create an Unsafe CLR stored procedure that'll call the python script. But it is very dangero...
1.2
true
1
3,941
2015-09-18 19:58:34.797
Python can't open file
I have a PHP script that is supposed to execute a python script as user "apache" but is returning the error: /transform/anaconda/bin/python: can't open file '/transform/python_code/edit_doc_with_new_demo_info.py': [Errno 13] Permission denied Permissions for edit_doc_with_new_demo_info.py are ---xrwx--x. 1 apache Posix...
You need read permission to run the python script.
0.201295
false
1
3,942
2015-09-18 20:27:10.843
Add models to specific user (Django)
Good evening, I am working on some little website for fun and want users to be able to add items to their accounts. What I am struggling with is coming up with a proper solution how to implement this properly. I thought about adding the User Object itself to the item's model via ForeignKey but wouldn't it be necessary...
You could create a model UserItems for each user with a ForeignKey pointing to the user and an item ID pointing to items. The UserItems model should store the unique item IDs of the items that belong to a user. This should scale better if items can be attached to multiple users or if items can exist that aren't attache...
0
false
1
3,943
2015-09-20 02:07:57.813
Getting PyCharm to import sklearn
Beginner here. I’m trying to use sklearn in pycharm. When importing sklearn I get an error that reads “Import error: No module named sklearn” The project interpreter in pycharm is set to 2.7.10 (/anaconda/bin/python.app), which should be the right one. Under default preferenes, project interpreter, I see all of anacon...
Same error occurs to me i have fixed by selecting File Menu-> Default Settings-> Project Interpreter -> Press + button and type 'sklearn' Press install button. Installation will be done in 10 to 20 seconds. If issue not resolved please check you PyCharm Interpreter path. Sometimes your machine have Python 2.7 and Pytho...
0.050976
false
4
3,944
2015-09-20 02:07:57.813
Getting PyCharm to import sklearn
Beginner here. I’m trying to use sklearn in pycharm. When importing sklearn I get an error that reads “Import error: No module named sklearn” The project interpreter in pycharm is set to 2.7.10 (/anaconda/bin/python.app), which should be the right one. Under default preferenes, project interpreter, I see all of anacon...
SOLVED: reinstalled Python 3.7.9 (not the latet) installed numpy 1.17.5 (not the latest) installed scikit-learn (latest) sklearn works now!
0.050976
false
4
3,944
2015-09-20 02:07:57.813
Getting PyCharm to import sklearn
Beginner here. I’m trying to use sklearn in pycharm. When importing sklearn I get an error that reads “Import error: No module named sklearn” The project interpreter in pycharm is set to 2.7.10 (/anaconda/bin/python.app), which should be the right one. Under default preferenes, project interpreter, I see all of anacon...
For Mac OS: PyCharm --> Preferences --> Project Interpreter --> Double Click on pip (a new window will open with search option) --> mention 'Scikit-learn' on the search bar --> Install Packages --> Once installed, close that new window --> OK on the existing window and you are done.
0
false
4
3,944
2015-09-20 02:07:57.813
Getting PyCharm to import sklearn
Beginner here. I’m trying to use sklearn in pycharm. When importing sklearn I get an error that reads “Import error: No module named sklearn” The project interpreter in pycharm is set to 2.7.10 (/anaconda/bin/python.app), which should be the right one. Under default preferenes, project interpreter, I see all of anacon...
please notice that, in the packages search 'Scikit-learn', instead 'sklearn'
0.386912
false
4
3,944
2015-09-20 13:45:10.417
ImportError after successful pip installation
I have successfully installed a library with pip install <library-name>. But when I try to import it, python raises ImportError: No module named <library-name>. Why do I get this error and how can I use the installed library?
A couple more points: Check to see if you're installing the library into the virtualenv that you want to use. There are some libraries whose package names are different from the library's name. You could take a look at their documentation online (google with keyword python <library> would usually bring up the informat...
0.386912
false
1
3,945
2015-09-20 14:35:55.523
Python - Rebuild Javascript generated code using Requests Module
I'm facing a new problem. I'm writing a scraper for a website, usually for this kind of tasks I use selenium, but in this case I cannot use anything that simulate a web-browser. Researching on StackOverflow, I read the best solution is to undestand what javascript did and rebuild the request over HTTP. Yeah, I understa...
In most cases, it is enougth to analyze the "network" tab of the developer tools and see the requests that are fired when you hit that button you metioned. As you understand those requests, you will be able to implement your scraper to run similar requests and grab the relevant data.
0.673066
false
1
3,946
2015-09-20 17:10:42.590
Best server configuration for site with heavy calculations
I have a site, that performs some heavy calculations, using library for symbolic math. Currently average calculation time is 5 seconds. I know, that ask too broad question, but nevertheless, what is the optimized configuration for this type of sites? What server is best for this? Currently, I'm using Apache with mod_ws...
Andrew, I believe that you can move some pieces of your deployment topology. My suggestion is use nginx for delivering HTTP content, and expose your application using some web framework, i.e. tornadoweb (my preference, considering async core, and best documented if compared to twisted, even twisted being a really great...
1.2
true
1
3,947
2015-09-22 04:53:03.643
Python - global Serial obj instance accessible from multiple modules
I have 5 different games written in python that run on a raspberry pi. Each game needs to pass data in and out to a controller using a serial connection. The games get called by some other code (written in nodeJS) that lets the user select any of the games. I'm thinking I don't want to open and close a serial port ever...
Delegate the opening and management of the serial port to a separate daemon, and use a UNIX domain socket to transfer the file descriptor for the serial port to the client programs.
0
false
1
3,948
2015-09-22 08:53:15.797
Pyenchant - Italian and Spanish Languages
I am using pyenchant package for spell check in Python. I am able to do it successfully for languages English, French, German. Also, I want to do it for languages Italian and Spanish. I looked into available dictionaries in enchant using enchant.list_languages() and I got only ['de_DE', 'en_AU', 'en_GB', 'en_US', 'fr_F...
You can use hunspell for italian it will replace it, and myspell for spanish sudo apt install hunspell-it Italian sudo apt install myspell-es Spanish
0
false
1
3,949
2015-09-22 11:02:39.350
No Module Named MySqlDb in Python Virtual Enviroment
I had posted about this error some time back but need some more clarification on this. I'm currently building out a Django Web Application using Visual Studio 2013 on a Windows 10 machine (Running Python3.4). While starting out I was constantly dealing with the MySQL connectivity issue, for which I did a mysqlclient pi...
This approach worked ! I was able to install the mysqlclient inside the virtual environment through the following command:- python -m pip install mysqlclient Thanks Much..!!!!!
0.135221
false
1
3,950
2015-09-23 14:18:09.593
how to access python from command line using py instead of python
I have a very weird request. An executable I have has a system call to a python script which goes like py file1.py Now, in my system though py is shown as an unrecognized internal or external command. python file1.py works however. is there some way I can get my windows command prompt to recognize that py and python re...
py command comes with Python3.x and allow to choose among multiple Python interpreters. For example if you have both Python 3.4 and 2.7 installed, py -2 will start python2.7 and py -3 will start python3.4 . If you just use py it will start the one that was defined as default. So the official way would be to install Pyt...
1.2
true
1
3,951
2015-09-24 08:25:33.397
Is it necessary to use virtualenv to use Flask framework?
I just started exploring Flask. Earlier I tried to explore Django but found it a bit complicated. However, Installing Flask requires us to install virtualenv first which, As I can recall, is not required in the case of Django. In case it is not required, how to go ahead without virtualenv?
No, there is no requirement to use a virtualenv. No project ever would require you to use one; it is just a method of insulating a collection of Python libraries from other projects. I personally do strongly recommend you use a virtualenv, because it makes it much, much easier to swap out versions of libraries and not ...
1.2
true
1
3,952
2015-09-24 13:29:30.280
How to sync a salt execution module with non-python dependencies
I am currently transforming a perl / bash tool into a salt module and I am wondering how I should sync the non-python parts of this module to my minions. I want to run salt agent-less and ideally the dependencies would by synced automatically alongside the module itself once its called via salt-ssh. But it seems that o...
Only python extensions are supported, so your best bet is to do the following: 1) Deploy your non-Python components via a file.managed / file.recurse state. 2) Ensure your custom execution module has a __virtual__() function checking for the existence of the non-Python dependencies, and returning False if they are not ...
1.2
true
1
3,953
2015-09-24 21:48:25.230
How to make the text shell not appear when running a program
I'm just wondering (as im starting to make a game with pygame) is there a way to 1) Run a program that only opens a GUI and not the shell and 2) Run the program without having to edit with idle (I'd like to do this so the game will look more professional. I would like to just have a desktop shortcut or something that ...
If you're on windows, a quick thing could be to make a one-line batch script. start pythonw.exe <filename> The start keyword causes the shell to not wait for the program to finish. pythonw vs python prevents the python terminal from appearing. If you're on linux/mac, you could do the same with shell scripts.
0.386912
false
1
3,954
2015-09-25 00:21:24.223
How to save in openpyxl without losing formulae?
Because I need to parse and then use the actual data in cells, I open an xlsm in openpyxl with data_only = True. This has proved very useful. Now though, having the same need for an xlsm that contains formuale in cells, when I then save my changes, the formulae are missing from the saved version. Are data_only = True a...
If you want to preserve the integrity of the workbook, ie. retain the formulae, the you cannot use data_only=True. The documentation makes this very clear.
0.386912
false
1
3,955
2015-09-28 06:36:29.443
how to keep django models in database for users customized view?
suppose i have three models, at my view I am showing all the item of these models, i want to give my user privilege to set which model's objects are to be shown at view at first, second and third. what is the best way to implement this?
it is not clear what you mean by "my user" . is this just the admin user who set this configuration globaly for the site . or do you mean evey user of the site has his/her own preferences ? if the latter case then make a new model called Preferences which has one to one relation to the user model . then in your query y...
0
false
1
3,956
2015-09-28 06:59:35.317
Is it possible to output to and monitor streams other than stdin, stdout & stderr? (python)
This is a python question, but also a linux/BSD question. I have a python script with two threads, one downloading data from the web and the other sending data to a device over a serial port. Both of these threads print a lot of status information to stdout using python's logging module. What I would like is to have tw...
File write operations are buffered by default so the file isn't effectiveley written until either the buffer is full, the file is closed or you explicitely call flush() on the file. But anyway: dont use direct file access if you want to log to a file, use either a logging.StreamHandler with an opened file as stream or...
0
false
1
3,957
2015-09-28 10:21:17.520
Can't uninstall Python on Windows (3.4.2)
I accidentally downloaded Python 3.4.2 a while back but I actually needed Python 2.7, so I deleted the 3.4.2 files and downloaded 2.7 instead. Now I need Python 3, so I tried to download it but I noticed that in the control panel in the Uninstall Programs section it tells me that the 3.4.2 from back then is still on my...
Did you try to reinstall the version you want to delete and then uninstall it afterwards ?
1.2
true
1
3,958
2015-09-29 02:28:48.730
spyder python how to re-open Variable Explorer
I accidentally closed the variable explorer on my Pythone(Spyder)... Does anyone know how I can reopen it? If I must reinstall the program, then I will but I just want to see if there is a way. Thank you!
Just use combination of shift+ctrl+v
0.545705
false
4
3,959
2015-09-29 02:28:48.730
spyder python how to re-open Variable Explorer
I accidentally closed the variable explorer on my Pythone(Spyder)... Does anyone know how I can reopen it? If I must reinstall the program, then I will but I just want to see if there is a way. Thank you!
Go to View/Panes and select Variable Explorer.
1.2
true
4
3,959
2015-09-29 02:28:48.730
spyder python how to re-open Variable Explorer
I accidentally closed the variable explorer on my Pythone(Spyder)... Does anyone know how I can reopen it? If I must reinstall the program, then I will but I just want to see if there is a way. Thank you!
Just go to tools(look at the dashboard at top middle) and select reset spyder to factory dafaults and click ok You will get your default spyder console.
0.101688
false
4
3,959
2015-09-29 02:28:48.730
spyder python how to re-open Variable Explorer
I accidentally closed the variable explorer on my Pythone(Spyder)... Does anyone know how I can reopen it? If I must reinstall the program, then I will but I just want to see if there is a way. Thank you!
You can go to view then in view click on window layout then in that click on reset to spyder default which will give you the default layout of spyder.
0.201295
false
4
3,959
2015-09-29 05:47:11.127
Python connection to Oracle database
I am writing a Python script to fetch and update some data on a remote oracle database from a Linux server. I would like to know how can I connect to remote oracle database from the server. Do I necessarily need to have an oracle client installed on my server or any connector can be used for the same? And also if I use...
Yes, you definitely need to install an Oracle Client, it even says so in cx_oracle readme.txt. Another recommendation you can find there is installing an oracle instant client, which is the minimal installation needed to communicate with Oracle, and is the simplest to use. Other dependencies can usually be found in the...
0
false
1
3,960
2015-09-29 16:35:29.577
Maya right click context sensitive menu
I am trying to edit the right click context sensitive menu from Maya. I have found how to add a menuItem but I would like to have this Item in the top of the list not at the bottom... I think in this case I need to deleteAllItems from the menu, add mine and then re-add the default Maya ones but I don't know how to re-a...
Okay i think I have found a solution, that's the best I have found but this is not very handy... create a copy of the buildobjectMenuItemsNow.mel and dagMenuProc.mel in your script folder so Maya will read those ones instead of the native ones. Once you have done that you can modify the dagMenuProc.mel without destruct...
1.2
true
1
3,961
2015-10-02 07:45:09.137
Make certain operators have no effect over a duration of time? (Python)
I am working with multi-threading. There is a thread that periodically adds to a certain variable, say every 5 seconds. I want to make it so that, given a call to function f(), additions to that variable will have no effect. I can't find how to do this anywhere and I'm not sure where to start. Is there any syntax that ...
I would suggest creating an addToVariable or setVariable method to take care of the actual adding to the variable in question. This way you can just set a flag, and if the flag is set addToVariable returns immediately instead of actually adding to the variable in question. If not, you should look into operator overloa...
1.2
true
1
3,962
2015-10-02 18:46:40.977
Creating a webpage crawler that finds and maches user input
I made a website with many pages, on each page is a sample essay. The homepage is a page with a search field. I'm attempting to design a system where a user can type in a word and when they click 'search', multiple paragaphs containing the searched word from the pages with a sample essays are loaded on to the page. I'm...
The programing language does not realy matter for the way to solve the problem. You can implement it in the language which you are comfortable with. There are two basic ways to solve the problem: Use a crawler which creates a index of words found on the different pages The use that index to lookup the searched word o...
1.2
true
1
3,963
2015-10-04 18:48:46.713
panda3d python import error
I have been searching the web for hours now, found several instances where someone had the same problem, but I seem to be too much of a newb with linux/ubuntu to follow the instructions properly, as none of the given solutions worked. Whenever I try to run a panda3d sample file from the python shell, I would give me an...
try to change your PYTHONPATH? i met a problem like this, and then i modify my PYTHONPATH, and it worked.
0.386912
false
1
3,964
2015-10-05 16:44:29.497
How to run imdbpy2sql.py and import data from IMDb to postgres
I'm startint a project on my own and I'm having some troubles with importing datas from IMDb. Already downloaded everything that's necessary but I'm kinda newbie in this python and command lines stuff, and it's pissing me off because I'm doing my homework (trying to learn how to do these things) but I can't reach it :(...
Problem solved! For those who are having the same problem, here it goes: Download the java movie database. It works witch postrgres or mysql. You'll have to download java runtime. After that open the readme in the directory you installed the java movie database, there are all the instructions, but I'll help you. Follow...
1.2
true
1
3,965
2015-10-06 09:07:14.150
wxtextCtrl To Allow Input/Display Of More Text Than Default Display
Last week I was given a requirement for an already crowded display/input screen written in wxPython (data stored in MySQL database) to show the first 24 characters of two free format comment fields but to allow up to 255 characters to be displayed/input. For instance on entry the screen might show “Right hip and knee X...
The simplest way to do it I see would be to store only the abbreviated contents in wxTextCtrl itself normally and only replace it with the full contents when the user is about to start editing it (i.e. when you get wxEVT_SET_FOCUS) and then replace it with the abbreviated version again later (i.e. when you get wxEVT_KI...
0.201295
false
2
3,966
2015-10-06 09:07:14.150
wxtextCtrl To Allow Input/Display Of More Text Than Default Display
Last week I was given a requirement for an already crowded display/input screen written in wxPython (data stored in MySQL database) to show the first 24 characters of two free format comment fields but to allow up to 255 characters to be displayed/input. For instance on entry the screen might show “Right hip and knee X...
Have you considered using my.TextCtrl.SetToolTipString() and setting it to the same value as the textctrl contents. In this manner only the first 24 characters show in the textctrl but if you hover over it the entire string will be displayed as a tooltip.
0
false
2
3,966
2015-10-06 19:36:00.643
Invoke gdb from python script
where should my python files be stored so that I can run that using gdb. I have custom gdb located at /usr/local/myproject/bin. I start my gdb session by calling ./arm-none-eabi-gdb from the above location. I don't know how this gdb and python are integrated into each other. Can anyone help.?
I was able to figure out. What I understood is GDB embeds the Python interpreter so it can use Python as an extension language. You can't just import gdb from /usr/bin/python like it's an ordinary Python library because GDB isn't structured as a library. What you can do is source MY-SCRIPT.py from within gdb (equivalen...
0
false
1
3,967
2015-10-06 23:18:06.500
Change data type in text file from string to float Python
I am trying to read in a 4 column txt file and create a 5th column. Column 1 is a string and columns 2-4 are numbers, however they are being read as strings. I have two questions - my python script is currently unable to perform multiplication on two of the columns because it is reading columns 2-4 as strings. I want t...
Just cast them to float using float(x) method where x is the string that contains the float
0
false
1
3,968
2015-10-08 07:40:17.233
ImportError: cannot import name webdriver
I am implementing selenium and i have already included "from selenium import webdriver" but still getting this error "ImportError: cannot import name webdriver" Any idea how to resolve this error?
Cross check your language binding, check with older versions
0
false
1
3,969
2015-10-08 18:33:49.517
Avoiding global variables but also too many function arguments (Python)
Let's say I have a python module that has a lot of functions that rely on each other, processing each others results. There's lots of cohesion. That means I'll be passing back and forth a lot of arguments. Either that, or I'd be using global variables. What are best practices to deal with such a situation if? Things t...
This is a very generic question so it is hard to be specific. What you seem to be describing is a bunch of inter-related functions that share data. That pattern is usually implemented as an Object. Instead of a bunch of functions, create a class with a lot of methods. For the common data, use attributes. Set the attr...
0.995055
false
1
3,970
2015-10-09 03:13:14.993
Passing binary data from java to python
I have a working program written in Java (a 3d game) and some scripts in Python written with theano to process images. I am trying to capture the frames of the game as it is running and run these scripts on the frames. My current implementation grabs the binary data from each pixel in the frame, saves the frame as a p...
If there is no limit to the length of the string argument for launching the python script, you could simply encode the binary data from the image into a string, and pass that. The only problem you might encounter with this approach would be null characters and and negative numbers.
0
false
1
3,971
2015-10-09 09:29:07.617
How to stop console from exiting
I want the program to wait like 5 seconds before exiting the console after finishing whatever it does, so the user can read the "Good Bye" message, how can one do this?
If it's not a multithreaded program, then just let the program do whatever it needs and then: raw_input("Press Enter to stop the sharade.\n") Maybe it's not exactly what you're looking for but on the other hand you should not rely on a predefined sleep time.
0
false
1
3,972
2015-10-09 17:06:01.240
How to load big datasets like million song dataset into BigData HDFS or Hbase or Hive?
I have downloaded a subset of million song data set which is about 2GB. However, the data is broken down into folders and sub folders. In the sub-folder they are all in several 'H5 file' format. I understand it can be read using Python. But I do not know how to extract and load then into HDFS so I can run some data ana...
Don't load such amount of small files into HDFS. Hadoop doesn't handle well lots of small files. Each small file will incur in overhead because the block size (usually 64MB) is much bigger. I want to do it myself, so I'm thinking of solutions. The million song dataset files don't have more than 1MB. My approach will be...
0
false
2
3,973
2015-10-09 17:06:01.240
How to load big datasets like million song dataset into BigData HDFS or Hbase or Hive?
I have downloaded a subset of million song data set which is about 2GB. However, the data is broken down into folders and sub folders. In the sub-folder they are all in several 'H5 file' format. I understand it can be read using Python. But I do not know how to extract and load then into HDFS so I can run some data ana...
If it's already in the CSV or any format on the linux file system, that PIG can understand, just do a hadoop fs -copyFromLocal to If you want to read/process the raw H5 File format using Python on HDFS, look at hadoop-streaming (map/reduce) Python can handle 2GB on a decent linux system- not sure if you need hadoop f...
0.201295
false
2
3,973
2015-10-10 17:42:52.037
PYGTK Resizing permissions
I want to set a window's size, and then be able to resize it while the program is running. I've been able to make the window large, but I can't resize it smaller than the original set size. For a different project, I would also like to know how to make it so the window is not resizable at all.
For the first question: Gtk.Window.resize(width, height) should work. If you use set_size_request(width, height), you cannot resize your window smaller than these values. For the second question: Gtk.Window.set_resizable(False)
1.2
true
1
3,974
2015-10-11 18:15:23.837
Run Code In Atom Code Editor
I have read numerous articles about running code in the Atom code editor, however, I cannot seem to understand how this can be done. Could anyone explain it in simpler terms? I want to run my Python code in it and I have downloaded the 'python-tools-0.6.5' and 'atom-script-2.29.0' files from the Atom website and I jus...
From Atom > Preferences > Install: Search for atom-runner package and install it. Close the atom editor and reopen. This helps the atom editor set the right path and will solve the issue. If this doesnt help, manually copy the folder of the python installation directory and add the path to system PATH. This will solve ...
0
false
1
3,975
2015-10-12 11:32:21.637
encrypting data on server and decrypting it on client
I have a very simple iOS and Android applications that download a txt file from a web server and preset it to the user. I'm looking for a way that only the application will be able to read the file so no one else can download and use it. I would like to take the file that is on my computer, encrypt it somehow, upload t...
It's very wide question and the variety of ways to do that. First of all, you need to choose a method of the encryption and purpose why you encrypt the data. There are 3 main encryption methods: 1. Symmetric Encryption Encrypter and Decrypter have access to the same key. It's quite easy, but it has one big drawback ...
-0.386912
false
1
3,976
2015-10-12 20:02:58.837
Missing 'Notebooks' tab
I have installed iPython Notebook as a component of my Anaconda installation. To become familiar with using iPython Notebook I started through an introductory tutorial and immediately ran into a discrepancy. When I open the notebook the tutorial shows I should have three tabs across the top labelled 'Notebooks', 'Run...
To start the notebook in notebook server 4.2.1, go to file tab and on the top right side, you will see new drop down menu. Click on the python[root] and it should start the new notebook.
0
false
2
3,977
2015-10-12 20:02:58.837
Missing 'Notebooks' tab
I have installed iPython Notebook as a component of my Anaconda installation. To become familiar with using iPython Notebook I started through an introductory tutorial and immediately ran into a discrepancy. When I open the notebook the tutorial shows I should have three tabs across the top labelled 'Notebooks', 'Run...
The three tabs "Files", "Running" and "Clusters" should be correct. The "Running" tab has the active notebooks listed. Yes, perhaps it was an older tutorial. Do you have a link?
0
false
2
3,977
2015-10-14 13:37:37.730
SocketRocket (iOS) : How to identify whom user are chatting with another?
I would like to create multiple sockets between all users. So how can i pass key and ID such as the server is divided in seprated windows. Thank You.
You do exactly that: you [can] pass around keys and make them show up in separate windows. From the way you've phrased your question, you appear new to streams/sockets. I'd recommend you first start with one socket and make a chat application so you can get a feel for how to develop protocols which let you do that.
1.2
true
1
3,978
2015-10-14 23:48:53.990
Python code to open with another program?
I have a program I want to open when I open Chrome. Instead of opening them separately, I want it to automatically start when Chrome starts. How would I write code to have the program attach itself to Chrome? I don't want the program to start on startup, just when Chrome starts. I know I can right click on the Chrome i...
Lots of options. Which you should choose depends on lots of things. Sorry for being so vague, but your question does not give any details besides the name Chrome. How ever you start Chrome, e. g. by a button or menu of your window manager, maybe you can tweak that button or menu to start both programs. This is prob...
0
false
1
3,979
2015-10-16 02:45:51.477
unable save file in a shared folder on a remote ubuntu machine using notepad++
I use a shared folder to share files in linux with a windows machine. However, after i have edited a python file using notepad++ in windows, changed the owner of the file to the user of ubuntu, and run the file, i wanted to edit the file again, when i save the file, I get the following error. 'Please check whether if ...
Try to kill the process which is opening the python file or you can reboot your windows It may resolve the problem
0
false
1
3,980
2015-10-16 12:01:00.230
How to use Django 1.8.5 ORM without creating a django project?
I've used Django ORM for one of my web-app and I'm very much comfortable with it. Now I've a new requirement which needs database but nothing else that Django offers. I don't want to invest more time in learning one more ORM like sqlalchemy. I think I can still do from django.db import models and create models, but th...
I had to add import django, and then this worked.
0
false
1
3,981
2015-10-16 13:45:50.273
Speed up Python MST calculation using Delaunay Triangulation
I have a code that makes Minimum Spanning Trees of many sets of points (about 25000 data sets containing 40-10000 points in each set) and this is obviously taking a while. I am using the MST algorithm from scipy.sparse.csgraph. I have been told that the MST is a subset of the Delaunay Triangulation, so it was suggested...
NB: this assumes we're working in 2-d I suspect that what you are doing now is feeding all point to point distances to the MST library. There are on the order of N^2 of these distances and the asymptotic runtime of Kruskal's algorithm on such an input is N^2 * log N. Most algorithms for Delaunay triangulation take N lo...
1.2
true
1
3,982
2015-10-17 07:18:49.473
Multi-threading on Google app engine
Does Google App engine support multithreading? I am seeing conflicting reports on the web. Basically, I am working on a module that communicates with Apple Push Notification server (APNS). It uses a worker thread that constantly looks for new messages that need to be pushed to client devices in a pull queue. After it ...
Found the issue. I was calling start_background_thread with argument set to function(). When I fixed it to calling it as function it worked as expected.
0
false
1
3,983