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 |
|---|---|---|---|---|---|---|---|
2018-01-04 03:10:09.217 | Refresh Excel Pivot Tables | I have a workbook that has several tabs with pivot tables. I can put data on the tab that holds the data for each pivot. My problem is that I don't know how to refresh the pivot tables. I would assume that I would need to cycle through each sheet, check to see if there is a pivot table, and refresh it. I just can't... | Worksheets("SheetName").PivotTables("PivotTableName").PivotCache().Refresh() | 0 | false | 1 | 5,286 |
2018-01-04 09:20:55.237 | Converting Python 3.6.1 Tetris game with music, to exe | I am kind a stuck. I have tried to make Tetris game with music to .exe, but I really don't know how to do it. Can someone give some tips, how to make .py to .exe?
I have tried Pyinstaller, cx_Freeze and none of them work. | They should all work. Py2exe and Py2app are the ones that don't. If they don't work they you haven't used them properly. Particularly cx_Freeze that requires you to "tune things manually".
Here are some debug steps that will help you resolve your error:
When freezing for the first time don't hide the console. This... | 0.386912 | false | 1 | 5,287 |
2018-01-04 09:45:13.120 | Give python variables to GTK+ with an html file | for a project i have to make a GUI for python. It should show some variables (temp etc). But I don't know how I can pass variables trough GTK to the window. Any answers appreciated :)
some info: I am using a RPi3, but that's nothing which is important, or is it? I have a 7" display attached, on which the program should... | Done. I've used Flask, Socket.io and gtk to make an app, showing a html file in full screen, with python variables in it. | 1.2 | true | 1 | 5,288 |
2018-01-04 10:55:30.403 | permission denied when installing python packages through cygwin | I'm working on a windows 7 and using Cygwin for unix-like functionality. I can write and run Python scripts fine from the Cygwin console, and the installation of Python packages using pip installis successful and the installed package appears under pip list. However, if I try to run a script that imports these packages... | just make sure you are in admin mode.
i.e. right click on Cygwin, select running as administrator.
then install your package specifically using pip3, for python3.
i.e. pip3 install your_package
with updated version, do pip3 install --upgrade your_package | 1.2 | true | 1 | 5,289 |
2018-01-05 22:38:52.613 | how do I get Flask blueprints to work with multiple domains? | I have a Flask app and want it to work for www.domain-a.net and www.domain-b.net behind Apache + WSGI. I can get it to work for one or the other, but can't find a way to get it to work for both. It seems that the domain which registers first is the only one that works.
Preferably this would work by having two Apache Vi... | It seems that having SERVER_NAME set in the os environment was causing this problem in conjunction with subdomains in blueprint registration. I removed SERVER_NAME from /etc/apache2/envvars and the subdomain logic and it worked. | 0.201295 | false | 1 | 5,290 |
2018-01-06 11:25:04.887 | Plane-plane intersection in python | I need to calculate intersection of two planes in form of AX+BY+CZ+D=0 and get a line in form of two (x,y,z) points. I know how to do the math, but I want to avoid inventing a bicycle and use something effective and tested. Is there any library which already implements this? Tried to search opencv and google, but with ... | This is solved by elementary vector computation and is not substantial/useful enough to deserve a library implementation. Work out the math with Numpy.
The line direction is given by the cross product of the two normal vectors (A, B, C), and it suffices to find a single point, say the intersection of the two given plan... | -0.265586 | false | 1 | 5,291 |
2018-01-07 19:23:52.697 | How to remove old version of gurobi in Windows | I am using gurobi with anaconda and python, and recently downloaded an updated version (7.5.2) to update the already installed 7.0.2 version that is on my computer.
I can find the conda command line prompts to remove the conda installed package, but cannot find any code anywhere to remove the 7.0.2 version from my comp... | I suggest the following:
conda list to see what's in the environment, and how it was installed.
If gurobi was installed as a conda package then use conda uninstall gurobi, if using pip then use pip uninstall gurobi. | 0 | false | 1 | 5,292 |
2018-01-09 05:44:13.990 | How best to interact with AWS RDS Postgres via NiFi | I have a FlowFile and I want to insert the attributes into RDS. If this was a local machine, I'd create a DBCPConnectionPool, reference a JDBC driver, etc.
With RDS, what am I supposed to do? Something similar (how would I do this on AWS)? Or am I stuck using ExecuteScript? If it's the later, is there a Python exam... | Question might not have been clear based on the feedback, but here is the answer to get a NiFi (running on an AWS EC2 instance) communicating with an Amazon RDS instance:
On the EC2 instance, download the latest JDBC driver (wget "https://driver.jar")
(If needed) Move the JDBC driver into a safe folder.
Create the DBC... | 1.2 | true | 1 | 5,293 |
2018-01-10 14:22:50.440 | How to disable initializing of graphics window of Python Turtle | everyone!
I want to implement the Turtle into my application just for the purpose of coordinate generation. The problem is that I need to get the coordinates of turtle move (etc.) without any "pop-up window" containing the graphics or even worse animation. Is it possible somehow to disable initialization of turtle grap... | OK, I have solved the situation by using: speed(0); turtle.tracer(False); turtle.bye(). The graphics window is intialized but suddenly closed. | 0 | false | 1 | 5,294 |
2018-01-11 11:29:02.077 | Logging uWSGI application stop in Python | I have a Flask app that I run with uWSGI. I have configured logging to file in the Python/Flask application, so on service start it logs that the application has been started.
I want to be able to do this when the service stops as well, but I don't know how to implement it.
For example, if I run the uwsgi app in consol... | There is no "stop" event in WSGI, so there is no way to detect when the application stops, only when the server / worker stops. | 0.386912 | false | 1 | 5,295 |
2018-01-11 14:43:54.723 | Regular expression help to find space after a long string | My code is as follow:
list = re.findall(("PROGRAM S\d\d"), contents
If I print the list I just print S51 but I want to take everything.
I want to findall everything like that "PROGRAM S51_Mix_Station". I know how to put the digits to find them but I don´t know how to find everything until the next space because usually... | Ok, thanks. I find another solution.
lista = re.findall(("PROGRAM S\d\d\S+") To find any character after the digit as repetition. | 0 | false | 1 | 5,296 |
2018-01-11 16:21:45.573 | How to convert a .py file into a .exe file for Python 3.6.4 | I need to convert my .py files into .exe files for Python 3.6.4. I have tried almost everything on Google and YouTube and none of it seems to work for me. It seems as though a lot of the explanations either gloss over the most technical aspects of installing any modules that convert .py files into .exe files or they ... | Most of the external packages are still not supporting 3.6.
Try with cx_Freeze in 3.6 else go with pyinstaller but python version should be 3.5(this works fine for me) | 0 | false | 1 | 5,297 |
2018-01-12 03:24:42.117 | Difference between tf.layers.conv1d vs tf.layers.conv2d | What is the difference in the functionalities of tf.layers.conv1d and tf.layers.conv2d in tensorflow and how to decide which one to choose? | tf.layers.conv1d is used when you slide your convolution kernels along 1 dimensions (i.e. you reuse the same weights, sliding them along 1 dimensions), whereas tf.layers.conv2d is used when you slide your convolution kernels along 2 dimensions (i.e. you reuse the same weights, sliding them along 2 dimensions).
So the t... | 1.2 | true | 1 | 5,298 |
2018-01-13 06:37:05.960 | How to link python code to android application developed in java? | I have to develop an Android application which makes use of machine learning algorithms at the back end. Now, for developing the Android app, I use Java and for implementing the machine learning algorithms I use Python.
My question is how to link the Python code to an Android app written in Java. That is supposed my Py... | If you have access to python from java android app. You can write python output in file, then in java code read that file.
Or if python output is in web, you will need some web service that provides json/xml output, and then in java code you should call that web service. | 0 | false | 1 | 5,299 |
2018-01-15 15:18:51.190 | How to read a sensor in c but then use that input in python | I have a flow sensor that I have to read with c because python isn't fast enough but the rest of my code is python. What I want to do is have the c code running in the background and just have the python request a value from it every now and then. I know that popen is probably the easiest way to do this but I don't ful... | Probably not a full answer, but I expect it gives some hints and it is far too long for a comment. You should think twice about your requirements, because it will probably not be that easy depending on your proficiency in C and what OS you are using.
If I have correctly understood, you have a sensor that sends data (w... | 0 | false | 1 | 5,300 |
2018-01-15 23:26:09.010 | ETL for a frequently changing Table structure | Scenario:
I have a Source which maintains the transactions data. They have around 900 columns and based on the requirements of the new business, they add additional columns.
We are a BI team and we only extract around 200 columns which are required for our reporting. But when new business is launched / new analysis is ... | I suppose your additional columns are measures, not dimensions. So you can keep the dimensions in the individual columns and include them into sort key, and store measures in JSON, accessing them whenever you need. Also if you can distinguish between frequently used measures vs. occasional you can store the frequently ... | 0.386912 | false | 1 | 5,301 |
2018-01-16 01:45:03.300 | Running 2 tasks at the same time using Fabric | For my automation purposes, I'm using Fabric. But I could not run 2 tasks at the same time?
For example, I want to run task 1 to collect data in the tmp folder. I want to run task 2 which will generate data and put in tmp. Tas1 2 will be running a bit before task 2.
Here is my sudo code:
output1 = run("./task1_data_log... | The task1 did not run at all because running a command with & in Fabric does not work.
It is because, in linux when you log out of a session all the processes associated with it are terminated.
So if you want to make sure a command keeps running even after you log out of the session you need to run it like this:
run('n... | 1.2 | true | 1 | 5,302 |
2018-01-16 03:33:55.103 | difflib and removing lines even without + in front of them python | I'm relatively new to python and I am using difflib to compare two files and I want to find all the lines that don't match. The first file is just one line so it is essentially comparing against all the lines of the second file. When using difflib, the results show the '-' sign in front of the lines that don't match an... | You may use below
set(str1).intersection(set(str2))
which will give you the difference of the two list. | 0 | false | 1 | 5,303 |
2018-01-17 13:57:14.993 | dtype changes after set_value/at | I'm facing a weird issue on Pandas now, not sure if a pandas pitfall or just something I'm missing...
My pd.Series is just
foo
False
False
False
> a.foo.dtype
dtype('bool')
When I use a dataframe.set_value(index, col, None), my whole Series is converted to dtype('float64') (same thing applies to a.at[index, col] = No... | I think the problem is related to the fact that I was trying to assign a None to a bool Series, then it just tries to convert to a different type (why not object?)
Fixed changing the dtype to object first: dataframe.foo = dataframe.foo.astype(object).
Works like a charm now. | 0.386912 | false | 1 | 5,304 |
2018-01-17 20:50:53.353 | Is it possible to make sequential tests in Python-Selenium tests? | Edited Question:
I guess I worded my previous question improperly, I actually want to get away from "unit tests" and create automated, modular system tests that build off of each other to test the application as whole. Many parts are dependent upon the previous pages and subsequent pages cannot be reached without firs... | You don't really want your tests to be sequential. That breaks one of the core rules of unit tests where they should be able to be run in any order.
You haven't posted any code so it's hard to know what to suggest but if you aren't using the page object model, I would suggest that you start. There are a lot of resource... | 0 | false | 1 | 5,305 |
2018-01-18 14:20:31.067 | Regex find char '.' except for words starting with @ | assuming the following sentence:
this is @sys.any and. here @names hello. and good.bye
how would I find all the '.' besides the ones appearing in words that start with @?
disclaimer, been playing at regex101 for over 2 hours now after reading a few answers on SO and other forums. | (^|\s)(\w*(\.))+ - this may satisfy the sample text you've posted. You can find all '.' in third group
UPDATE: if in your text you have words, started with any other symbol, for instance, #asd.qwe.zxc, you can improve your reg exp:
(^|\s)[^@]?(\w*(\.))+ | 0.386912 | false | 1 | 5,306 |
2018-01-18 21:21:55.047 | Launching a flask app/website so other networks can connect | So I've currently got a flask app that I'm using to run a testing app, (this works on local host) but I cant work out how to launch it so I can test the connectivity from other devices (public).
can someone explain how I can go about launching it, or at least point me in the right direction to some documentation about ... | to make an application works with public host you have to make sure enabling port forwarding in your modem device, you can etablish a cnx with the nginx server | 0.135221 | false | 2 | 5,307 |
2018-01-18 21:21:55.047 | Launching a flask app/website so other networks can connect | So I've currently got a flask app that I'm using to run a testing app, (this works on local host) but I cant work out how to launch it so I can test the connectivity from other devices (public).
can someone explain how I can go about launching it, or at least point me in the right direction to some documentation about ... | If you change the ip address of the flask server from the default 0.0.0.0 to your the ip address of your computer (eg 192.168.1.2) the other clients on your local network can connect.
If you want to expose your app the whole of the internet you should get a host that (eg try heroku.com) that has a fixed ip assigned and... | 0 | false | 2 | 5,307 |
2018-01-19 15:09:46.653 | PAGMO/PYGMO: Anyone understand the options for Corana’s Simulated Annealing? | I'm using the PYGMO package to solve some nasty non-linear minimization problems, and am very interested in using their simulated_annealing algorithm, however it has a lot of hyper-parameters for which I don't really have any good intuition. These include:
Ts (float) – starting temperature
Tf (float) – final temperatu... | Gonna answer my own question here. I climbed into the actual .cpp code and found the answers.
In Corana's method, you select how many total iterations N of annealing you want. Then the minimization is a nested series of loops where you vary the step sizes, number of step-size adjustments, and temperature values at user... | 0 | false | 1 | 5,308 |
2018-01-19 20:32:16.700 | Calling gcc to compile multiple files with Python | I'm trying to build a simple IDE that is web based in Python. For now, this IDE will support C only. I know it is possible to call the gcc with Python to compile and run a single C file. But what if I would like to compile and run multiple C files from a single project (i.e. linking .h files and .c files), is this poss... | Well assuming you want to handle all type of projects and their dependencies (which is not easy) the best way is to have a module that generates a Makefile for the project and use it to compile and solve all dependencies | 0 | false | 1 | 5,309 |
2018-01-20 07:00:54.130 | Aws Glue - S3 - Native Python | Within AWS Glue how do I deal with files from S3 that will change every week.
Example:
Week 1: “filename01072018.csv”
Week 2: “filename01142018.csv”
These files are setup in the same format but I need Glue to be able to change per week to load this data into Redshift from S3. The code for Glue uses native Python as the... | AWS Glue should be able to process all the files in a folder irrespective of the name in a single job. If you don’t want the old file to be processed again move it using boto3 api for s3 to another location after each run. | 0 | false | 1 | 5,310 |
2018-01-21 18:54:31.037 | Is it possible to limit the number of messages a user can send a day with Django postman? | I have been using Django Postman for a few weeks now, and in order to limit the number of messages sent by each user, I have been wondering what would be the best way to limit the number of messages a user can send a day, a week... using Django-postman?
I have been browsing dedicated documentation for weeks too in ord... | as a simple idea the inserting of new msg in database should be with a condition to limit their numbers (the count of the previous msg isn't > max )
another method : you will show the input of the msg jsut when (selet * form table where userid=sesion and count(usermsg)< max ) | 0 | false | 1 | 5,311 |
2018-01-22 16:37:19.870 | How to find the median between two sorted arrays? | I'm working on a competitive programming problem where we're trying to find the median of two sorted arrays. The optimal algorithm is to perform a binary search and identify splitting points, i and j, between the two arrays.
I'm having trouble deriving the solution myself. I don't understand the initial logic. I will ... | Here is my approach that I managed to come up with.
First of all we know that the resulting array will contain N+M elements, meaning that the left part will contain (N+M)/2 elements, and the right part will contain (N+M)/2 elements as well. Let's denote the resulting array as Ans, and denote the size of one of its part... | 0.995055 | false | 1 | 5,312 |
2018-01-23 18:13:13.963 | Possible to write a loop in Python that stores user input for future manipulation without using append? | I'm a beginner and my textbook just covered iterations and loops in Python. Lists have only been given cursory coverage at this point.
The exercise I'm struggling with is this: Write a program which repeatedly reads numbers until the user enters "done". Once "done" is entered print out the total, count and average of... | You only need to remember the sum and the number of inputs in two variables that are updated when the user writes a number.
When the user enters 'done', compute the mean (sum / number_of_inputs). | 0.673066 | false | 1 | 5,313 |
2018-01-25 03:29:38.357 | where does the yield store value in python | I understand generator generates value once at a time, which could save a lot memory and not like list which stores all value in memory.
I want to know in python, how yield knows which value should be returned during the iteration without storing all data at once in memory?
In my understanding, if i want to print 1 to... | Simply put, yield delays the execution but remembers where it left off. However, more specifically, when yield is called, the variables in the state of the generator function are saved in a "frozen" state. When yield is called again, the built in next function sends back the data in line to be transmitted. If there is ... | 1.2 | true | 1 | 5,314 |
2018-01-25 23:32:43.687 | How can I send a data array back and forth between java and python? | I have a java program and I need it to get some data calculated by a python script.
I've already got java to send an integer to python via jython's PythonInterpreter and displayed it, but I can't recover it to make other operations. Also, it would be great to send a full integer array rather than a single integer but ... | If you want a simple solution then I suggest that you write and read the integers to a file. Perhaps not the most elegant way but it would only take a couple of minutes to implement. | 0.135221 | false | 3 | 5,315 |
2018-01-25 23:32:43.687 | How can I send a data array back and forth between java and python? | I have a java program and I need it to get some data calculated by a python script.
I've already got java to send an integer to python via jython's PythonInterpreter and displayed it, but I can't recover it to make other operations. Also, it would be great to send a full integer array rather than a single integer but ... | If the solution of writing/reading the numbers to a file somehow is not sufficient, you can try the following:
Instead of using Jython, you can use Pyro4 (and the Pyrolite client library for your java code) to call a running Python program from your java code.
This allows you to run your python code in a 'normal' pytho... | 0 | false | 3 | 5,315 |
2018-01-25 23:32:43.687 | How can I send a data array back and forth between java and python? | I have a java program and I need it to get some data calculated by a python script.
I've already got java to send an integer to python via jython's PythonInterpreter and displayed it, but I can't recover it to make other operations. Also, it would be great to send a full integer array rather than a single integer but ... | I've worked on similar project. Here's brief outline of what Java and Python was doing respectively.
Java
We used Java as a main server for receiving requests from clients and sending back responses after some data manipulation.
Python
Python was in charge of data manipulation or calculation. Data was sent from Java v... | 0.135221 | false | 3 | 5,315 |
2018-01-26 17:34:57.373 | Access a progress that work background with nohup (LINUX) -get foreground | I am working on a chat program with Python. I would like to use nohup because users always can access server when I am logout.
I could run nohup very well. It was great.But I am a admin and I can write messages,and can see online users as using python. after I worked nohup, and logout, when I login I can't access the ... | If you nohup a process, when you log out the parent of the process switches to being init (1) and you can't get control of it again.
The best approach is to have the program open a socket and then use that for ipc. You probably want to split your code in to 2 pieces - a daemon that runs in the background and keeps a so... | 0 | false | 1 | 5,316 |
2018-01-27 17:57:40.467 | Python 3, PyQt 5 - MP4 as resource file issue | I've made a desktop app using Python 3 and PyQt 5 and it works except for the playback of the MP4 video files (compiled by pyrcc5). They are visible and play on the video widget but there is a green line down the right side. I tried to put a green frame (using a Style Sheet) around the QVideoWidget but with no success.... | Okay, so I couldn't find anything on "MP4 and green line" so I looked at how to modify the PyQt5 interface as a way of hiding the issue.
The option I chose was QGroupBox and changing the padding in the stylesheet to -9 (in my particular case - you may find another value works better but it depends on the UI).
I did att... | 0.386912 | false | 1 | 5,317 |
2018-01-27 20:24:25.973 | Connect to remote PostgreSQL server over Tor? [python] [Tor] | I'm creating a Python 3 spider that scrapes Tor hidden services for useful data. I'm storing this data in a PostgreSQL database using the psycopg2 library. Currently, the spider script and the database are hosted on the same network, so they have no trouble communicating. However, I plan to migrate the database to a re... | This would be easy enough if I simply opened the database VPS to accept connections from anywhere
Here lies your issue. Just simply lock down your VPS using fail2ban and ufw. Create a ufw role to only allow connection to your Postgres port from the IP address you want to give access from to that VPS ip address.
This ... | 0 | false | 1 | 5,318 |
2018-01-27 22:28:40.437 | Atom script configure script run python 2.7 | I have downloaded Anaconda on my computer however Anaconda is installed for all users on my mac therefore when I try and access python2.7 by typing in the path: /anaconda3/envs/py27/bin:/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Even if I open from terminal the path above is not in the current director... | Only way I can change Atom python is to run it from a directory that has a different default python version. if I type python from a terminal window, whichever version of python that opens is the version Atom uses. I use virtual environments so I can run python 2.7.13 or python 3.6. If I want Atom to run python 3, I ac... | 1.2 | true | 1 | 5,319 |
2018-01-27 23:59:01.100 | how to access part of a encoded (gb18020) string in python | I am encoding Chinese characters using gb18030 in python. I want to access part of the encoded string. For example, the string for 李 is: '\xc0\xee'. I want to extract 'c0' and 'ee' out of this. However, python is not treating '\xc0\xee' as a 8 character string, but as a 2 character string. How I do turn it into a 8 cha... | Found the solution. repr() will do. | 0.201295 | false | 1 | 5,320 |
2018-01-29 04:13:40.180 | Python Binary String Loop | The question on my assignment is as follows:
Write a function that takes, as an argument, a string, identified by the variable aString. If the string only contains digits 0 and 1, return the string formed by concatenating the argument with the string "is a binary string." Otherwise, return a string indicating the leng... | A binary string has been defined as a string that only contains "0" or "1". So, how about checking each 'character' in the string, and if it's not a "0" or "1" you will know that the string is not a binary string. | -0.101688 | false | 1 | 5,321 |
2018-01-29 12:47:00.817 | how do you close a Pywinrm session? | hello I'm using PyWinRM to poll a remote windows server.
s = winrm.Session('10.10.10.10', auth=('administrator', 'password'))
As there is no s.close() function available, I am worried about leaking file descriptors.
I've checked by using lsof -p <myprocess> | wc -l and my fd count is stable
but my google searches sh... | Actually, I had a quick look at the code of wirm (as of 20201117)
and the "Session" is not an actual session in the traditional sense, but only an object holding the creds to authenticate.
Each time run_cmd or run_ps is invoked, a session in opened on the target and closed on completion of the task. So there's nothing ... | 0 | false | 1 | 5,322 |
2018-01-29 14:27:53.377 | Partially undirect graphs in Networkx | I'm looking for a way to implement a partially undirect graph. This is, graphs where edges can be directed (or not) and with different type of arrow (>, *, #, etc.).
My problem is that when I try to use undirect grpah from Networkx and stored arrow type as an attribute, I don't find an efficient way to tell networkx ... | I guess you can use a directed graph and store the direction as an attribute if you don't need to represent that directed graph. | 0 | false | 2 | 5,323 |
2018-01-29 14:27:53.377 | Partially undirect graphs in Networkx | I'm looking for a way to implement a partially undirect graph. This is, graphs where edges can be directed (or not) and with different type of arrow (>, *, #, etc.).
My problem is that when I try to use undirect grpah from Networkx and stored arrow type as an attribute, I don't find an efficient way to tell networkx ... | After search it in a lot of different sources, the only way to do a partial undirect graph I've found it is this is through adjacent matrices.
Networkx has a good tools to move between graph and adjacent matrix (in pandas and numpy array format).
The disadvantage is if you need networkx functions you have to program ... | 1.2 | true | 2 | 5,323 |
2018-01-30 16:03:57.857 | TensorFlow Checkpoints to S3 | I am executing a Python-Tensorflow script on Amazon Sagemaker. I need to checkpoint my model to the S3 instance I am using, but I can't find out how to do this without using the Sagemake Tensorflow version.
How does one checkpoint to an S3 instance without using the Sagemaker TF version? | Create an object in S3 and enable versioning to the bucket. Everytime you change the model and save it to S3, it will be automatically versioned and stored in the bucket.
Hope it helps. | 0 | false | 1 | 5,324 |
2018-01-30 18:46:56.933 | how can i get IDLE (Python) to use packages installed by anaconda (windows 7 32bit)? | The title says it all i want to be able to use the packages that are installed with anaconda with idle so are there any ways of making this work?
When i try to import packages with idle that i installed using anaconda it says package not found.
I need some help please and thank you in advance. | The IDLE that comes with python 3.5.2 can only be run by python 3.5.2. Code you submit to python 3.5.2 through that IDLE can normally only access packages installed for 3.5.2, plus your own code. I believe Anaconda 3.6.3 comes with Python 3.6.3 and the 3.6.3 standard library, including the 3.6.3 version of idlelib.
I... | 0 | false | 1 | 5,325 |
2018-01-30 23:20:14.607 | How to oversample image dataset using Python? | I am working on a multiclass classification problem with an unbalanced dataset of images(different class). I tried imblearn library, but it is not working on the image dataset.
I have a dataset of images belonging to 3 class namely A,B,C. A has 1000 data, B has 300 and C has 100. I want to oversample class B and C, so ... | Thanks for the clarification. In general, you don't oversample with Python. Rather, you pre-process your data base, duplicating the short-handed classes. In the case you cite, you might duplicate everything in class B, and make 5 copies of everything in class C. This gives you a new balance of 1000:600:500, likely ... | 0.201295 | false | 1 | 5,326 |
2018-01-31 15:03:04.047 | I cannot build python.dll as a static library (/MTd) using Visual Studio | I am working with the 3.6.4 source release of Python. I have no trouble building it with Visual Studio as a dynamic library (/MDd) I can link the Python .dll to my own code and verify its operation.
But when I build it (and my code) with (/MTd) it soon runs off the rails when I try to open a file with a Python program.... | This is what I needed to do to build and use python statically embedded in another application.
To build the static python library (e.g., python36_d.lib, python36.lib)
Convert ALL projects in the python solution (pcbuild.sln) to static. This is about 40 projects, so it may take awhile. This includes setting library... | 1.2 | true | 1 | 5,327 |
2018-02-01 08:18:43.420 | Way to use something like PyAutoGUI on Mobile? | I'm currently using Qpython and Sl4A to run python scripts on my Droid device.
Does anybody know of a way to use something like PyAutoGUI on mobile to automate tapping sequences (which would be mouse clicks on a desktop or laptop)?
I feel like it wouldn't be too hard, but I'm not quite sure how to get the coordinates f... | Unfortunately no. PyAutoGUI only runs on Windows, macOS, and Linux | 0.386912 | false | 2 | 5,328 |
2018-02-01 08:18:43.420 | Way to use something like PyAutoGUI on Mobile? | I'm currently using Qpython and Sl4A to run python scripts on my Droid device.
Does anybody know of a way to use something like PyAutoGUI on mobile to automate tapping sequences (which would be mouse clicks on a desktop or laptop)?
I feel like it wouldn't be too hard, but I'm not quite sure how to get the coordinates f... | Something like PyAutoGui for Android is AutoInput. It's a part of the main app Tasker. If you've heard about Tasker, then you know what I'm taking about.
If not, them Tasker is an app built to automate your Android Device. If you need specific taps and scrolls, then you can install the plug-in Auto Input for Tasker. I... | 0.998178 | false | 2 | 5,328 |
2018-02-01 16:05:35.597 | How to implement Sklearn Metric in Keras as Metric? | Tried googling up, but could not find how to implement Sklearn metrics like cohen kappa, roc, f1score in keras as a metric for imbalanced data.
How to implement Sklearn Metric in Keras as Metric? | Metrics in Keras and in Sklearn mean different things.
In Keras metrics are almost same as loss. They get called during training at the end of each batch and each epoch for reporting and logging purposes. Example use is having the loss 'mse' but you still would like to see 'mae'. In this case you can add 'mae' as a m... | 1.2 | true | 1 | 5,329 |
2018-02-01 21:46:46.357 | Connect to MongoDB with self-signed certificate from EVE | MongoDB uses self-signed certificate. I want to setup service on EVE to work with it. I searched documentation and SO but found only information how to use self-signed cert to access EVE itself. What should I do to connect to MongoDB from EVE with self-signed certificate? | Resolved by passing required parameters (ssl, ssl_ca_certs, etc) to MongoClient via MONGO_OPTIONS setting. | 1.2 | true | 1 | 5,330 |
2018-02-01 23:30:21.023 | Unable to get pycharm to run my .sh file | So I'm not sure how to word this correctly but I have a .sh file that I use to turn on my python app and it runs fine when I run this command ./start_dev.sh in my terminal. But I am having trouble trying to have it run in pycharm because my app is run in Ubuntu and I don't know how to direct the interpreter path to my ... | You should be able to go to Run->Edit Configurations and then add configurations, including an Interpreter path where you can set the path to your virtualenv bash executable | -0.386912 | false | 1 | 5,331 |
2018-02-02 00:32:53.407 | ipynb python file to executable exe file | I am using jupyter notebook for coding, hence my file format is ipynb. I would like to turn this piece of code into an executable file .exe for later uses.
So far I have managed to get the exe file by going to anaconda prompt, executed the following command
---> pyinstaller --name ‘name of the exe’ python_code.ipynb
Th... | Try exporting your .ipynb file to a normal .py file and running pyinstaller on the .py file instead.
You can export as .py by going to File > Download As > Python (.py) in the Jupyter Notebook interface | 0.386912 | false | 1 | 5,332 |
2018-02-02 14:23:29.370 | Flask: spawning a single async sub-task within a request | I have seen a few variants of my question but not quite exactly what I am looking for, hence opening a new question.
I have a Flask/Gunicorn app that for each request inserts some data in a store and, consequently, kicks off an indexing job. The indexing is 2-4 times longer than the main data write and I would like to... | Celery will be your best bet - it's exactly what it's for.
If you have a need to introduce dependencies, it's not a bad thing to have dependencies. Just as long as you don't have unneeded dependencies.
Depending on your architecture, though, more advanced and locked-in solutions might be available. You could, if you'... | 0 | false | 1 | 5,333 |
2018-02-03 09:01:05.233 | how to use python inside SQL server 2014 | I have some experience with SQL and python.
In one of my SQL stored procedures I want to use some python code block and some functions of python numpy.
What is the best way to do it.SQL server version is 2014. | First install the MySQL connector for python from the MySQL website and then import the mysql.connector module and initialize a variable to a mysql.connector.connect object and use cursors to modify and query data. Look at the documentation for more help.
If you don't have problem with no networking capabilities and le... | 0 | false | 1 | 5,334 |
2018-02-03 18:27:02.737 | Python web service with React/Node Application | I have the bulk of my web application in React (front-end) and Node (server), and am trying to use Python for certain computations. My intent is to send data from my Node application to a Python web service in JSON format, do the calculations in my Python web service, and send the data back to my Node application.
Fla... | In terms of thoughts:
1) You can build a REST interface to your python code using Flask. Make REST calls from your nodejs.
2) You have to decide if your client will wait synchronously for the result. If it takes a relatively long time you can use a web hook as a callback for the result. | 0 | false | 1 | 5,335 |
2018-02-04 18:10:51.457 | Handle concurrent requests or threading Flask SocketIO with eventlet | I’ve started working a lot with Flask SocketIO in Python with Eventlet and are looking for a solution to handle concurrent requests/threading. I’ve seen that it is possible with gevent, but how can I do it if I use eventlet? | The eventlet web server supports concurrency through greenlets, same as gevent. No need for you to do anything, concurrency is always enabled. | 1.2 | true | 1 | 5,336 |
2018-02-06 18:49:19.253 | installing pandas in pydev eclipse neon 2 | I have installed python 3.6.4 on my MAC OS and have Eclipse neon 2.0 running. I have added pydev plugin to work on python projects. I need to import pandas library, but there is no such option as windows -> preferences -> libraries
Can someone help me with any other way to install python libraries in neon 2.
And also ... | I faced same problem when working with eclipse pydev project.
here are steps that helped me resolve the issue
In eclipse open the workspace, click on Windows->Preferences->pydev-> interpreters-> python interpreter -> Click on Manage with PIP
In Command to execute , enter install pandas.
Problem solved | 0 | false | 1 | 5,337 |
2018-02-07 06:00:26.393 | Assigning giveaways based on cryptocurrency block header | I'm building a project that does a giveaway every Monday. There are three prizes, the basic prize, the "lucky" prize, and the jackpot prize. The basic prize is given out 70% of the time, the lucky prize gets given out 25% of the time and the jackpot prize gets rewarded the final 5% of the time.
There are multiple peopl... | I figured this out, the solution is below:
int(hashlib.sha256(block_header + userID).hexdigest(), 16) / float(2**256)
You conver the hash into an integer, then divide that integer by 2**256. This gives you a decimal from 0 to 1 that can be compared to a random.random() to get the prize. | 0 | false | 1 | 5,338 |
2018-02-07 23:51:56.367 | Finding a file in an FTP server using ftplib | I was wondering if there was an effective way to recursively search for a given filename using ftplib. I know that I could use FTP.cwd() and FTP.retrlines('LIST), but I think that it would be rather repetitive and inefficient. Is there something that lets me find files on an FTP server in Python, such as how os can do ... | No. Using FTP.retrlines('LIST') is the only solution with FTP protocol.
If you need a faster approach, you would have to use another interface. Like shell, some web API, etc. | 0 | false | 1 | 5,339 |
2018-02-08 04:38:21.387 | load balancing in django | I have a Django server which responds to a call like this 127.0.0.1:8000/ao/. Before adding further applications to the server, I would like to experiment the load balancing which are supported by Django.
Can anyone please explain how to implement load balancing. I spent sometime in understanding the architecture but w... | Load balancing is not anything to do with Django. It is something you implement at a much higher layer, via servers that sit in front of the machines that Django is running on.
However, if you've just started creating your site, it is much too early to start thinking about this. | 0 | false | 1 | 5,340 |
2018-02-09 03:04:14.830 | How to create a Python API and use it with React Native? | I'm learning about basic back-end and server mechanics and how to connect it with the front end of an app. More specifically, I want to create a React Native app and connect it to a database using Python(simply because Python is easy to write and fast). From my research I've determined I'll need to make an API that com... | You have to create a flask proxy, generate JSON endpoints then use fetch or axios to display this data in your react native app. You also have to be more specific next time. | 0.386912 | false | 1 | 5,341 |
2018-02-09 05:38:07.923 | Extending a trendline in a lmfit plot | I have fitted a curve using lmfit but the trendline/curve is short. Please how do I extend the trendline/curve in both directions because the trendline/curve is hanging. Sample codes are warmly welcome my senior programmers. Thanks. | More detail about what you are actually doing would be helpful. That is, vague questions can really only get vague answers.
Assuming you are doing curve fitting with lmfit's Model class, then once you have your Model and a set of Parameters (say, after a fit has refined them to best match some data), then you can use ... | 1.2 | true | 1 | 5,342 |
2018-02-09 07:15:23.420 | How to use RASA NLU with RASA CORE | I am new to chatbot application and RASA as well, can anyone please help me to understand how should i use RASA NLU with RASA CORE. | RASA NLU is the natural language understanding piece, which is used for taking examples of natural language and translating them into "intents." For example: "yes", "yeah", "yep" and "for sure" would all be translated into the "yes" intent.
RASA CORE on the other hand is the engine that processes the flow of conversat... | 1.2 | true | 1 | 5,343 |
2018-02-09 09:28:56.073 | Priority Queue: If two objects have same priority, how do I determine which to extract? | Basically, no counter is allowed. No iterables (arrays, dictionaries, etc.) allowed either to store insertion. There are two linked lists: one storing odd insertions and even insertions. Each node has the priority, and the object. Is there any pattern you can find? Or is this impossible?
Edit: sorry for not mentioning... | Since all items are arranged in a prioritised manner, just extract them in the way they come out...as it is a queue. Or you could apply more conditions on how you would like to arrange the items with same priorities among themselves. | 0 | false | 1 | 5,344 |
2018-02-10 00:08:39.447 | support vector regression time series forecasting - python | I have a dataset of peak load for a year. Its a simple two column dataset with the date and load(kWh).
I want to train it on the first 9 months and then let it predict the next three months . I can't get my head around how to implement SVR. I understand my 'y' would be predicted value in kWh but what about my X value... | given multi-variable regression, y =
Regression is a multi-dimensional separation which can be hard to visualize in ones head since it is not 3D.
The better question might be, which are consequential to the output value `y'.
Since you have the code to the loadavg in the kernel source, you can use the input parameters... | 0 | false | 1 | 5,345 |
2018-02-11 10:49:20.877 | Design Decision Django Rest Framework - Django as Frontend | I am currently developing my first more complex Web Application and want to ask for directions from more experienced Developers.
First I want to explain the most important requirements.
I want to develop a Web App (no mobile apps or desktop apps) and want to use as much django as possible. Because I am comfortable with... | as per my experience and knowledge, you are almost going towards correct direction.
my recommendation is for making backend rest api Django and django rest framework is the best option however for consuming those api you can look for the angular or react both works very well in terms of consuming API. | 0 | false | 1 | 5,346 |
2018-02-12 01:22:08.467 | Making my Artificial Intelligence visuals that react with sound change | So basically I have created an A.I assistant and was wondering if anyone had suggestions on how to make visuals that react with the sound? | You can just measure the loudness of the voice command spoken in mDb. You can then process these numbers to change the UI.
Like , higher the loudness makes the bar longer. Let me know which speech to text engine are you using so that I can provide further help. | 0 | false | 1 | 5,347 |
2018-02-12 02:10:02.367 | How to implement modular exponentiation? | I am trying to calculate something like this: a^b mod c, where all three numbers are large.
Things I've tried:
Python's pow() function is taking hours and has yet to produce a result. (if someone could tell me how it's implemented that would be very helpful!)
A right-to-left binary method that I implemented, with O(lo... | It sounds like you are trying to evaluate pow(a, b) % c. You should be using the 3-argument form, pow(a, b, c), which takes advantage of the fact that a * b mod c == a mod c * b mod c, which means you can reduce subproducts as they are computed while computing a ^ b, rather than having to do all the multiplications fir... | 0.386912 | false | 1 | 5,348 |
2018-02-12 18:28:11.870 | Import my python module to rstudio | I have developed few modules in python and I want to import them to rstudio RMarkdown file. However, I am not sure how I can do it.
For example, I can't do from code.extract_feat.cluster_blast import fill_df_by_blast as fill_df as I am used to do it in pycharm.
Any hint?
Thanks. | First I had to make a setup.py file for my project.
activate the virtual environment corresponding to my project source activate, then run python setup.py develop
Now, I can import my own python library from R as I installed it in my environment. | 0 | false | 1 | 5,349 |
2018-02-13 00:58:43.877 | Running tensorflow in ipython | tensorflow works using python in a virtualenv I created, but tensorflow doesn't work in the same virtualenv with ipython. This is the error I get:
Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the pac... | I think I figured out the problem. pip was pointing to /Library/Frameworks/Python.framework/Versions/3.4/bin/pip
My ipython was pointing to /opt/local/bin/ipython
I re-installed tensorflow within my virtual environment by calling /opt/local/bin/pip-2.7 install --upgrade tensorflow
Now I can use tensorflow within ipytho... | 0 | false | 1 | 5,350 |
2018-02-13 04:35:57.390 | What does tensorflow nonmaximum suppression function's argument "score" do to this function? | I read the document about the function and I understood how NMS works. What I'm not clear is scores argument to this function. I think NMS first look at bottom right coordinate and sort according to it and calculate IoU then discard some boxes which have IoU greater than the threshold that you set. In this theory score... | The scores argument decides the sorting order. The method tf.image.non_max_suppression goes through (greedily, so all input entries are covered) input bounding boxes in order decided by this scores argument, selects only those bounding boxes from them which are not overlapping (more than iou_threshold) with boxes alrea... | 1.2 | true | 1 | 5,351 |
2018-02-13 17:39:26.140 | Python in Google Cloud Functions | Can Google Cloud Functions handle python with packages like sklearn, pandas, etc? If so, can someone point me in the direction of resources on how to do so.
I've been searching a while and it seems like this is impossible, all I've found are resources to deploy the base python language to google cloud. | You can use AWS lambda as well if you want to work around and still use Python as your main language. Some modules/packages will need to be imported via zip file with AWS Lambda but it has a broader range of usable languages than GCF | 0.101688 | false | 1 | 5,352 |
2018-02-14 04:04:49.403 | Python - can you add a tooltip on a wx.CheckBox object? | And if so, how would one add a tooltip to a checkbox object? It appears that the control inherits from wxWindow which has tooltips, so can it be added to a wxCheckBox?
Thanks! | Try this:
self.YourCheckboxObject.SetToolTip(wx.ToolTip("Paste your tooltip text here")) | 0 | false | 1 | 5,353 |
2018-02-14 06:04:25.223 | ModuleNotFoundError: No module named 'oauth2client.client' | I got this error in in Python3.6 ModuleNotFoundError: No module named 'oauth2client.client',i tried pip3.6 install --upgrade google-api-python-client,But I don't know how to fix
Please tell me how to fix,
Thanks | Use below code, this worked for me:
pip3 install --upgrade oauth2client | 0.999909 | false | 1 | 5,354 |
2018-02-15 12:06:17.237 | Webots programming with Python - blocking code | I am using webots for my project at university. I want my robot to do a specific action for a certain amount of time, but I cannot find a way to do it without blocking the code and the sensors and consequently the whole simulation. I tried both the commands robot.step() and time.sleep() but they both blocck the code an... | I tried robot.step() and it works thank you. I use small increments of time so that the code is not continuously blocing and there is time for my sensors to do the reading. | 0 | false | 1 | 5,355 |
2018-02-16 17:51:46.277 | How to remove the remains of python 3.7? | I have accidentally removed several parts of python and now am trying to start again... The installer says that 57 files are still on my PC and I cannot find them. Does anyone know how to get a copy of the uninstaller? As it should find the remaining files. | This depends on the OS and how Python was installed.
For windows, look under %USERPROFILE%\AppData\Local\Programs\Python - or just run the installer again, it should have an option to fix or remove the current install. | 1.2 | true | 1 | 5,356 |
2018-02-20 01:44:10.303 | How to deploy flask virtualenv into production | I developed a flask app running on virtualenv, how do I deploy it into production? I have a Red Hat Enterprise Linux Server release 5.6, cannot use docker.
The server has cgi and wsgi setup. Python 2.7.
I know using the pip install -r requirements.txt, but how do I get the virtualenv to persist on production once my se... | You may want to look at using a requirements.txt file in Python. Using $ pip freeze > requirements.txt can build that file with what pip has installed in your virtualenv. | 0 | false | 1 | 5,357 |
2018-02-20 06:56:29.623 | How to apply GoogleColab stronger CPU and more RAM? | I use GoogleColab to test data stuctures like chain-hashmap,probe-hashmap,AVL-tree,red-black-tree,splay-tree(written in Python),and I store very large dataset(key-value pairs) with these data stuctures to test some operation running time,its scale just like a small wikipedia,so run these python script will use very muc... | There is no way to request more CPU/RAM from Google Colaboratory at this point, sorry. | 0.201295 | false | 1 | 5,358 |
2018-02-20 07:57:39.113 | Classification: skewed data within a class | I'm trying to build a multilabel-classifier to predict the probabilities of some input data being either 0 or 1. I'm using a neural network and Tensorflow + Keras (maybe a CNN later).
The problem is the following:
The data is highly skewed. There are a lot more negative examples than positive maybe 90:10. So my neural... | You're on the right track.
Usually, you would either balance your data set before training, i.e. reducing the over-represented class or generate artificial (augmented) data for the under-represented class to boost its occurrence.
Reduce over-represented class
This one is simpler, you would just randomly pick as many s... | 0.386912 | false | 1 | 5,359 |
2018-02-21 06:13:10.217 | How to build a decoder using dynamic rnn in Tensorflow? | I know how to build an encoder using dynamic rnn in Tensorflow, but my question is how can we use it for decoder?
Because in decoder at each time step we should feed the prediction of previous time step.
Thanks in advance! | If for example, you are using Tensorflow's attention_decoder method, pass a parameter "loop_function" to your decoder. Google search for "extract_argmax_and_embed", that is your loop function. | 1.2 | true | 1 | 5,360 |
2018-02-21 11:26:24.503 | Can't install pcap in pycharm? | I try install pcap package in pycharam tools but did not install and show blow error :
Collecting pcap Could not find a version that satisfies the
requirement pcap (from versions: ) No matching distribution found for
pcap
how can i fix installing package? | On the command line, go to the location where you had installed your setup and use this command to install the missing package:
pip install pcap | 1.2 | true | 1 | 5,361 |
2018-02-21 16:58:20.487 | PyOpenGL how to rotate a scene with the mouse | I am trying to create a simple scene in 3d (in python) where you have a cube in front of you, and you are able to rotate it around with the mouse.
I understand that you should rotate the complete scene to mimic camera movement but i can't figure out how you should do this.
Just to clarify I want the camera (or scene) ... | Ok I think i have found what you should do
just for the people that have trouble with this like I did this is the way you should do it:
to rotate around a cube with the camera in opengl:
your x mouse value has to be added to the z rotator of your scene
and the cosinus of your y mouse value has to be added to the x rota... | 1.2 | true | 1 | 5,362 |
2018-02-21 19:35:29.660 | Python3.6 + Postgresql how to put VARIABLES to SQL query? | I got something like this:
cur.execute("INSERT INTO name VALUES(HERE_IS_VARIABLE,'string',int,'string')")
Stuff with %s (like in python 2.*) not working.
I got errors, which tells me that im trying to use "column name" in place where i put my variable. | You can try using f-Strings and separating out the statement from the execution:
statement = f"INSERT INTO name VALUES({VARIABLE_NAME},'string',int,'string')"
cur.execute(statement)
You might also want to try with '' around {VARIABLE_NAME}: '{VARIABLE_NAME}'
In f-strings, the expressions in {} get evaluated and their ... | 0 | false | 1 | 5,363 |
2018-02-22 07:16:16.060 | Django: detect the mouse click if session out | I have created a login page for my application and set the session out for 3 minutes and it is working fine, but the problem is when session out happened the user is still able to do many activities on the current page i.e the logout page do not show until unless user do a page refresh or redirect to the other page.
So... | You can run a javascript setTimeout in the background which will check if user is logged in and after three minutes the browser window will refresh.
OR (better)
You can run this timer server-side and when the client would try to change something, firstly look at the timer or the value where is the time until when is t... | 0 | false | 1 | 5,364 |
2018-02-22 10:14:57.343 | PyCharm terminal doesn't activate conda environment | I have a conda environment at the default location for windows, which is C:\ProgramData\Anaconda2\envs\myenv. Also, as recommended, the conda scripts and executables are not in the %PATH% environment variable.
I opened a project in pycharm and pointed the python interpreter to
C:\ProgramData\Anaconda2\envs\myenv\pytho... | Solution for Windows
Go to Settings -> Tools -> Terminal
set Shell path to:
For powershell (I recommend this):
powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& 'C:\tools\miniconda3\shell\condabin\conda-hook.ps1'
For cmd.exe:
cmd.exe "C:\tools\miniconda3\Scripts\activate.bat"
PyCharm will change environment ... | 0.124933 | false | 3 | 5,365 |
2018-02-22 10:14:57.343 | PyCharm terminal doesn't activate conda environment | I have a conda environment at the default location for windows, which is C:\ProgramData\Anaconda2\envs\myenv. Also, as recommended, the conda scripts and executables are not in the %PATH% environment variable.
I opened a project in pycharm and pointed the python interpreter to
C:\ProgramData\Anaconda2\envs\myenv\pytho... | Found a solution. Problem is we have been creating conda environments from within Pycharm while starting a new project.
This is created at the location /Users/<username>/.conda/envs/<env-name>.
e.g. /Users/taponidhi/.conda/envs/py38.
Instead create environments from terminal using conda create --name py38.
This will cr... | 0.031387 | false | 3 | 5,365 |
2018-02-22 10:14:57.343 | PyCharm terminal doesn't activate conda environment | I have a conda environment at the default location for windows, which is C:\ProgramData\Anaconda2\envs\myenv. Also, as recommended, the conda scripts and executables are not in the %PATH% environment variable.
I opened a project in pycharm and pointed the python interpreter to
C:\ProgramData\Anaconda2\envs\myenv\pytho... | I am using OSX and zshell has become the default shell in 2020.
I faced the same problem: my conda environment was not working inside pycharm's terminal.
File -> Settings -> Tools -> Terminal. the default shell path was configured as /bin/zsh --login
I tested on a separate OSX terminal that /bin/zsh --login somehow mes... | 0 | false | 3 | 5,365 |
2018-02-22 10:29:28.120 | Choosing subset of farthest points in given set of points | Imagine you are given set S of n points in 3 dimensions. Distance between any 2 points is simple Euclidean distance. You want to chose subset Q of k points from this set such that they are farthest from each other. In other words there is no other subset Q’ of k points exists such that min of all pair wise distances in... | Find the maximum extent of all points. Split into 7x7x7 voxels. For all points in a voxel find the point closest to its centre. Return these 7x7x7 points. Some voxels may contain no points, hopefully not too many. | 0 | false | 2 | 5,366 |
2018-02-22 10:29:28.120 | Choosing subset of farthest points in given set of points | Imagine you are given set S of n points in 3 dimensions. Distance between any 2 points is simple Euclidean distance. You want to chose subset Q of k points from this set such that they are farthest from each other. In other words there is no other subset Q’ of k points exists such that min of all pair wise distances in... | If you can afford to do ~ k*n distance calculations then you could
Find the center of the distribution of points.
Select the point furthest from the center. (and remove it from the set of un-selected points).
Find the point furthest from all the currently selected points and select it.
Repeat 3. until you end with k p... | 0.101688 | false | 2 | 5,366 |
2018-02-22 20:22:37.977 | gradient boosting- features contribution | Is there a way in python by which I can get contribution of each feature in probability predicted by my gradient boosting classification model for each test observation. Can anyone give actual mathematics behind probability prediction in gradient boosting classification model and how can it be implemented in Python. | Use the feature_importances_ property. Very easy. | 0.135221 | false | 1 | 5,367 |
2018-02-23 03:48:21.723 | How to get cookies before making request in Python | I am basically running my personal project,but i'm stuck in some point.I am trying to make a login request to hulu.com using Python's request module but the problem is hulu needs a cookie and a CSRF token.When I inspected the request with HTTP Debugger it shows me the action URL and some request headers.But the cookie ... | First create a session then use GET and use session.cookies.get_dict() it will return a dict and it should have appropriate values you need | 1.2 | true | 1 | 5,368 |
2018-02-25 00:38:38.480 | How to let server send the message first in GRPC using python | Hi i am new to GRPC and i want to send one message from server to client first. I understood how to implement client sending a message and getting response from server. But i wanna try how server could initiate a message to connected clients. How could i do that? | Short answer: you can't
gRPC is a request-response framework based on HTTP2. Just as you cannot make a website that initiates a connection to a browser, you cannot make a gRPC service initiating a connection to the client. How would the service even know who to talk to?
A solution could be to open a gRPC server on the ... | 0 | false | 1 | 5,369 |
2018-02-25 06:10:08.487 | If a dictionary key contains a certain word, how would I remove it? | A simple program about storing rivers and their respective locations in a dictionary. I was wondering how I would go about looping through a dictionary key and looking if the dictionary key (or value) contains a certain word, if the word is present in the key, remove it.
EX: rivers_dict = {'mississippi river': 'mississ... | Use the enumerate function that will count all the words like looping it as
for index, value in enumerate(dic): | 0 | false | 1 | 5,370 |
2018-02-25 19:43:40.450 | How to run a python script on a remote server that it doesn't quit after I log off? | I've created a script for my school project that works with data. I'm quite new to working remotely on a server, so this might seem like a dumb question, but how do I execute my script named
stats.py
so that it continues executing even after I log off PuTTy? The script file is located on the server. It has to work w... | There are many ways you can run a python program after you disconnect from an SSH session.
1) Tmux or Screen
Tmux is a "terminal multiplexer" which enables a number of terminals to be accessed by a single one.
You start by sshing as you do, run it by typing tmux and executing it. Once you are done you can disconnect fr... | 1.2 | true | 1 | 5,371 |
2018-02-26 09:27:53.910 | Clean email field when new user is registering in Django? | As I know, standard new user process registration (Django 2.x) is validate email field only for exists and equals for E-mail Schemas. But users may be write e-mail address like this: JOHN_DOE@MAIL.COM (via Caps Lock) and save it to DB.
It's would be dangerous, because other user can register account for these e-mail, ... | I would change it to lowercase and then save it because it looks like the least number of operations to be done. Also it should make the shortest code.
If you'll decide to check if it's unique in lowercase in DB and then save it you may end up checking DB two times (one when first check, 2nd when saving) if you'll impl... | 0 | false | 1 | 5,372 |
2018-02-27 14:36:05.507 | How do I use Lyft driver API like Mystro android app? | I want to use Lyft Driver api like in the Mystro android app however iv searched everywhere and all I could find is lyft api.
To elaborate more on what I'm trying to achieve, I want api that will allow me to intergrate with the lyft driver app and not the lyft rider app, I want to be able to for example view nearby rid... | The Mystro app does not have any affiliation with either Uber or Lyft nor do they use their APIs to interact with a driver (as neither Uber or Lyft have a publicly accessible driver API like this). They use an Android Accessibility "feature" that let's the phone look into and interact with other apps you have running.... | 0.386912 | false | 1 | 5,373 |
2018-02-28 10:35:23.333 | Concurrent file upload/download and running background processes | I want to create a minimal webpage where concurrent users can upload a file and I can process the file (which is expected to take some hours) and email back to the user later on.
Since I am hosting this on AWS, I was thinking of invoking some background process once I receive the file so that even if the user closes th... | Here's how it might look like (hosting-agnostic):
A user uploads a file on the web server
The file is saved in a storage that can be accessed later by the background jobs
Some metadata (location in the storage, user's email etc) about the file is saved in a DB/message broker
Background jobs tracking the DB/message bro... | 0.386912 | false | 1 | 5,374 |
2018-02-28 14:31:41.907 | Django OAuth Toolkit - Register a user | I've gone through the docs of Provider and Resource of Django OAuth Toolkit, but all I'm able to find is how to 'authenticate' a user, not how to register a user.
I'm able to set up everything on my machine, but not sure how to register a user using username & password. I know I'm missing something very subtle. How do ... | I'm registering user with regular django mechanism combined with django-oauth-toolkit's application client details (client id and client secret key).
I have separate UserRegisterApiView which is not restricted with token authentication but it checks for client id and client secret key while making post request to regis... | 0.101688 | false | 2 | 5,375 |
2018-02-28 14:31:41.907 | Django OAuth Toolkit - Register a user | I've gone through the docs of Provider and Resource of Django OAuth Toolkit, but all I'm able to find is how to 'authenticate' a user, not how to register a user.
I'm able to set up everything on my machine, but not sure how to register a user using username & password. I know I'm missing something very subtle. How do ... | You have to create the user using normal Django mechanism (For example, you can add new users from admin or from django shell). However, to get access token, OAuth consumer should send a request to OAuth server where user will authorize it, once the server validates the authorization, it will return the access token. | 0.545705 | false | 2 | 5,375 |
2018-03-01 09:10:26.110 | Is there a way to put a kanban element to the bottom in odoo | At the moment i am working on an odoo project and i have a kanban view. My question is how do i put a kanban element to the bottom via xml or python. Is there an index for the elements or something like that? | I solved it myself. I just added _order = 'finished asc' to the class. finished is a record of type Boolean and tells me if the Task is finished or not. | 0 | false | 1 | 5,376 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.