qid int64 46k 74.7M | question stringlengths 54 37.8k | date stringlengths 10 10 | metadata listlengths 3 3 | response_j stringlengths 17 26k | response_k stringlengths 26 26k |
|---|---|---|---|---|---|
49,510,289 | I have a gigantic excel workbook with a lot of personal data. Each person has a unique numeric identifier, but has multiple rows of information.
I want to filter all the content through that identifier, and then copy the resulting rows to a template excel workbook and save the results. I'm trying to do this with Pyth... | 2018/03/27 | [
"https://Stackoverflow.com/questions/49510289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9553462/"
] | When int is defined the memory would be allocated based on compiler option ( it can be 4 to 8 bytes). The number assigned to int is stored as is.
e.g int a = 86;
The number 86 would be stored at memory allocated for a.
When char is defined , there are numbers assigned to each character. When these character needs to ... | >
> if a number is stored as a character it will contain 1 byte per character of the number(not 4 bytes)? for example if I make an int variable of the number 8 and a char variable of '8' the int variable will have consumed more memory?
>
>
>
Yes, since it is guaranteed that (assuming 8-bit bytes):
```
sizeof(cha... |
57,230,353 | I am working on a Python program for displaying photos on the Raspberry Pi (Model B Revision 2.0 with 512MB RAM). It uses Tk for displaying the images.
The program is mostly finished, but I ran into an issue where the program is terminated by the kernel because of low memory. This seems to happen randomly.
I do not un... | 2019/07/27 | [
"https://Stackoverflow.com/questions/57230353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/653770/"
] | I believe there is a memory leak when you open the image files with PIL and don't close them.
To avoid it, you must call `Image.close()`, or better yet consider using the `with` syntax.
```
def readImage(self,imagePath,w,h):
with Image.open(imagePath) as pilImage:
pilImage = self.rotateImage(pilImage... | I run the code on my machine and I noticed similiar spikes.
After some memory adjustments on a virtual machine I had a system without swap (turned of to get the crash "faster") and approximately 250Mb free memory.
While base memory usage was somewhere around 120Mb, the image change was between 190Mb and 200Mb (using i... |
20,578,798 | I'm new to python dictionaries as well as nesting.
Here's what I'm trying to find - I have objects that all have the same attributes: color and height. I need to compare all the attributes and make of list of all the ones that match.
```
matchList = []
dict = {obj1:{'color': (1,0,0), 'height': 10.6},
obj2:{'... | 2013/12/14 | [
"https://Stackoverflow.com/questions/20578798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3101267/"
] | **Update:** Found this great article from [Matt Gaunt](https://plus.google.com/+MattGaunt/posts) (a Google Employee) on adding a Translucent theme to Android apps. It is very thorough and addresses some of the issues many people seem to be having while implementing this style: [Translucent Theme in Android](http://blog... | It looks like all you need to do is add this element to the themes you want a translucent status bar on:
```
<item name="android:windowTranslucentStatus">true</item>
``` |
20,578,798 | I'm new to python dictionaries as well as nesting.
Here's what I'm trying to find - I have objects that all have the same attributes: color and height. I need to compare all the attributes and make of list of all the ones that match.
```
matchList = []
dict = {obj1:{'color': (1,0,0), 'height': 10.6},
obj2:{'... | 2013/12/14 | [
"https://Stackoverflow.com/questions/20578798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3101267/"
] | It looks like all you need to do is add this element to the themes you want a translucent status bar on:
```
<item name="android:windowTranslucentStatus">true</item>
``` | You're very close you just need to update your view background colors:
```
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffd060" >
<LinearLayout
android:layout_width="ma... |
20,578,798 | I'm new to python dictionaries as well as nesting.
Here's what I'm trying to find - I have objects that all have the same attributes: color and height. I need to compare all the attributes and make of list of all the ones that match.
```
matchList = []
dict = {obj1:{'color': (1,0,0), 'height': 10.6},
obj2:{'... | 2013/12/14 | [
"https://Stackoverflow.com/questions/20578798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3101267/"
] | It looks like all you need to do is add this element to the themes you want a translucent status bar on:
```
<item name="android:windowTranslucentStatus">true</item>
``` | To change the color of the status bar to windowBackground
```
<item name="android:windowBackground">@color/window_bg</item>
```
To add the translucent effect to status and navigation bar
```
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
``` |
20,578,798 | I'm new to python dictionaries as well as nesting.
Here's what I'm trying to find - I have objects that all have the same attributes: color and height. I need to compare all the attributes and make of list of all the ones that match.
```
matchList = []
dict = {obj1:{'color': (1,0,0), 'height': 10.6},
obj2:{'... | 2013/12/14 | [
"https://Stackoverflow.com/questions/20578798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3101267/"
] | **Update:** Found this great article from [Matt Gaunt](https://plus.google.com/+MattGaunt/posts) (a Google Employee) on adding a Translucent theme to Android apps. It is very thorough and addresses some of the issues many people seem to be having while implementing this style: [Translucent Theme in Android](http://blog... | You're very close you just need to update your view background colors:
```
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffd060" >
<LinearLayout
android:layout_width="ma... |
20,578,798 | I'm new to python dictionaries as well as nesting.
Here's what I'm trying to find - I have objects that all have the same attributes: color and height. I need to compare all the attributes and make of list of all the ones that match.
```
matchList = []
dict = {obj1:{'color': (1,0,0), 'height': 10.6},
obj2:{'... | 2013/12/14 | [
"https://Stackoverflow.com/questions/20578798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3101267/"
] | **Update:** Found this great article from [Matt Gaunt](https://plus.google.com/+MattGaunt/posts) (a Google Employee) on adding a Translucent theme to Android apps. It is very thorough and addresses some of the issues many people seem to be having while implementing this style: [Translucent Theme in Android](http://blog... | Add these lines in your main theme
```
<style name="AppTheme" parent="android:Theme.Holo.Light">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:fitsSystemWindows">true</item>
</style>
``` |
20,578,798 | I'm new to python dictionaries as well as nesting.
Here's what I'm trying to find - I have objects that all have the same attributes: color and height. I need to compare all the attributes and make of list of all the ones that match.
```
matchList = []
dict = {obj1:{'color': (1,0,0), 'height': 10.6},
obj2:{'... | 2013/12/14 | [
"https://Stackoverflow.com/questions/20578798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3101267/"
] | **Update:** Found this great article from [Matt Gaunt](https://plus.google.com/+MattGaunt/posts) (a Google Employee) on adding a Translucent theme to Android apps. It is very thorough and addresses some of the issues many people seem to be having while implementing this style: [Translucent Theme in Android](http://blog... | To change the color of the status bar to windowBackground
```
<item name="android:windowBackground">@color/window_bg</item>
```
To add the translucent effect to status and navigation bar
```
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
``` |
20,578,798 | I'm new to python dictionaries as well as nesting.
Here's what I'm trying to find - I have objects that all have the same attributes: color and height. I need to compare all the attributes and make of list of all the ones that match.
```
matchList = []
dict = {obj1:{'color': (1,0,0), 'height': 10.6},
obj2:{'... | 2013/12/14 | [
"https://Stackoverflow.com/questions/20578798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3101267/"
] | Add these lines in your main theme
```
<style name="AppTheme" parent="android:Theme.Holo.Light">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:fitsSystemWindows">true</item>
</style>
``` | You're very close you just need to update your view background colors:
```
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffd060" >
<LinearLayout
android:layout_width="ma... |
20,578,798 | I'm new to python dictionaries as well as nesting.
Here's what I'm trying to find - I have objects that all have the same attributes: color and height. I need to compare all the attributes and make of list of all the ones that match.
```
matchList = []
dict = {obj1:{'color': (1,0,0), 'height': 10.6},
obj2:{'... | 2013/12/14 | [
"https://Stackoverflow.com/questions/20578798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3101267/"
] | Add these lines in your main theme
```
<style name="AppTheme" parent="android:Theme.Holo.Light">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:fitsSystemWindows">true</item>
</style>
``` | To change the color of the status bar to windowBackground
```
<item name="android:windowBackground">@color/window_bg</item>
```
To add the translucent effect to status and navigation bar
```
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
``` |
48,921,068 | I am using `python 3` and `django 1.11` got the following data in a `.sql` file:
How do I use `DecimalField` and `DateField` components to represent the fields correctly.
I was thinking of doing something like this:
e.g `per_diem = models.DecimalField(max_digits=12, decimal_places=2,null=False)`
``
```
CREATE TABLE e... | 2018/02/22 | [
"https://Stackoverflow.com/questions/48921068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8342189/"
] | The first one is from the apache servlet API for status codes from Interface HttpServletResponse found [here](https://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/http/HttpServletResponse.html)
>
> SC\_NOT\_FOUND - Status code (404) indicating that the requested
> resource is not available.
>
>
>
Th... | There is no difference, it is same status code for HTTP from different libraries. |
30,578,381 | I am trying to compile opencv on Slackware 4.1. However I encountered the following error each time.
```
In file included from /usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:29:0,
from /tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp:65:
/usr/include/gstreamer-0.10/gst/pbutils/gstd... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30578381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4962063/"
] | It worked for me after I set WITH\_GSTREAMER\_0\_10 to ON | I am using Ubuntu 12.04 but got the same error.
This can be avoided by using the **-D WITH\_GSTREAMER=OFF** parameter.
As advised [here](http://code.opencv.org/issues/3953) and [here](https://stackoverflow.com/questions/23669638/installing-opencv-on-ubuntu-12-04).
Then [here](https://gist.github.com/melvincabatuan/c8a... |
30,578,381 | I am trying to compile opencv on Slackware 4.1. However I encountered the following error each time.
```
In file included from /usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:29:0,
from /tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp:65:
/usr/include/gstreamer-0.10/gst/pbutils/gstd... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30578381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4962063/"
] | I got this fixed by installing `libgstreamer-plugins-base1.0-dev`. Before that CMake detected GStreamer version 0.10.36, after that - 1.4.5. | I am using Ubuntu 12.04 but got the same error.
This can be avoided by using the **-D WITH\_GSTREAMER=OFF** parameter.
As advised [here](http://code.opencv.org/issues/3953) and [here](https://stackoverflow.com/questions/23669638/installing-opencv-on-ubuntu-12-04).
Then [here](https://gist.github.com/melvincabatuan/c8a... |
30,578,381 | I am trying to compile opencv on Slackware 4.1. However I encountered the following error each time.
```
In file included from /usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:29:0,
from /tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp:65:
/usr/include/gstreamer-0.10/gst/pbutils/gstd... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30578381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4962063/"
] | I am using Ubuntu 12.04 but got the same error.
This can be avoided by using the **-D WITH\_GSTREAMER=OFF** parameter.
As advised [here](http://code.opencv.org/issues/3953) and [here](https://stackoverflow.com/questions/23669638/installing-opencv-on-ubuntu-12-04).
Then [here](https://gist.github.com/melvincabatuan/c8a... | If anybody still have problem with that,
try to install gstreamer1.0 properly with all that packages
Example for Fedora OS:
```
dnf install gstreamer1-devel gstreamer1-plugins-base-tools
gstreamer1-devel-docs gstreamer1-plugins-base-devel
gstreamer1-plugins-base-devel-docs
gstreamer1-plugins-good gstreamer1-plugi... |
30,578,381 | I am trying to compile opencv on Slackware 4.1. However I encountered the following error each time.
```
In file included from /usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:29:0,
from /tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp:65:
/usr/include/gstreamer-0.10/gst/pbutils/gstd... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30578381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4962063/"
] | I got this fixed by installing `libgstreamer-plugins-base1.0-dev`. Before that CMake detected GStreamer version 0.10.36, after that - 1.4.5. | It worked for me after I set WITH\_GSTREAMER\_0\_10 to ON |
30,578,381 | I am trying to compile opencv on Slackware 4.1. However I encountered the following error each time.
```
In file included from /usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:29:0,
from /tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp:65:
/usr/include/gstreamer-0.10/gst/pbutils/gstd... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30578381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4962063/"
] | It worked for me after I set WITH\_GSTREAMER\_0\_10 to ON | If anybody still have problem with that,
try to install gstreamer1.0 properly with all that packages
Example for Fedora OS:
```
dnf install gstreamer1-devel gstreamer1-plugins-base-tools
gstreamer1-devel-docs gstreamer1-plugins-base-devel
gstreamer1-plugins-base-devel-docs
gstreamer1-plugins-good gstreamer1-plugi... |
30,578,381 | I am trying to compile opencv on Slackware 4.1. However I encountered the following error each time.
```
In file included from /usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:29:0,
from /tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp:65:
/usr/include/gstreamer-0.10/gst/pbutils/gstd... | 2015/06/01 | [
"https://Stackoverflow.com/questions/30578381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4962063/"
] | I got this fixed by installing `libgstreamer-plugins-base1.0-dev`. Before that CMake detected GStreamer version 0.10.36, after that - 1.4.5. | If anybody still have problem with that,
try to install gstreamer1.0 properly with all that packages
Example for Fedora OS:
```
dnf install gstreamer1-devel gstreamer1-plugins-base-tools
gstreamer1-devel-docs gstreamer1-plugins-base-devel
gstreamer1-plugins-base-devel-docs
gstreamer1-plugins-good gstreamer1-plugi... |
70,819,915 | This is the code:
```
name = input("Enter file: ")
handle = open(name)
counts = dict()
filetext = handle.read()
for line in handle:
words = line.split()
for word in words:
counts[word] = counts.get(word, 0) + 1
print(words)
print(counts)
bigcount = None
bigword = None
for word,count in counts.items():... | 2022/01/23 | [
"https://Stackoverflow.com/questions/70819915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18007432/"
] | After you do `handle.read()`, the file is positioned at end-of-file. There's nothing left for the `for line in handle:` to read. You either need to rewind in between (`handle.seek(0)`), or just skip the first read altogether. | You could consider building a list of lines as you iterate over the file handle rather than doing a read/seek. Also, you can work out the most frequently occurring word as you work through the file rather than doing a second pass of your dictionary. Something like this:
```
D = dict()
M = 0
B = None
C = list()
with op... |
30,421,267 | I'm currently having troubles in setting `is_active` field from `False` back to `True` in Django. I have a custom Account model which is inhereted from `AbstractBaseUser` and is managed by `class AccountManager(BaseUserManager)`.
By default, I override the `is_active` field to be False. However, when I try to reactiva... | 2015/05/24 | [
"https://Stackoverflow.com/questions/30421267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3773879/"
] | In Java, we have a class named `String` which has a method called `length()`.
In C, you need to have a `\0` at the end of your string so you could know where your string ends. But in Java, this problem handled with the method`length()`. | C doesn't have strings as an actual data type and the convention is just that character arrays ending in a null character can be used as strings. That's what you get when you use string literals in the language and that's what you have to recreate when you don't use them.
The underlying issue is that C wanted to save ... |
30,421,267 | I'm currently having troubles in setting `is_active` field from `False` back to `True` in Django. I have a custom Account model which is inhereted from `AbstractBaseUser` and is managed by `class AccountManager(BaseUserManager)`.
By default, I override the `is_active` field to be False. However, when I try to reactiva... | 2015/05/24 | [
"https://Stackoverflow.com/questions/30421267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3773879/"
] | in C there is no type `string`, there is only a pointer to a `char`. When in C you need a string, you need to know how many characters are in the string, or have an indicator to see that you have reached the end of the string.
Traditionally there are two approaches to this requirements. In the C world the convention i... | In Java, we have a class named `String` which has a method called `length()`.
In C, you need to have a `\0` at the end of your string so you could know where your string ends. But in Java, this problem handled with the method`length()`. |
30,421,267 | I'm currently having troubles in setting `is_active` field from `False` back to `True` in Django. I have a custom Account model which is inhereted from `AbstractBaseUser` and is managed by `class AccountManager(BaseUserManager)`.
By default, I override the `is_active` field to be False. However, when I try to reactiva... | 2015/05/24 | [
"https://Stackoverflow.com/questions/30421267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3773879/"
] | In Java, we have a class named `String` which has a method called `length()`.
In C, you need to have a `\0` at the end of your string so you could know where your string ends. But in Java, this problem handled with the method`length()`. | In Java, a string is mostly an abstraction, where you are not supposed to care about the internal representation. You have methods that perform operations on it and that allow you to obtain information about the string.
In C, however, this is quite the opposite. You want to know and care a string's internal structure,... |
30,421,267 | I'm currently having troubles in setting `is_active` field from `False` back to `True` in Django. I have a custom Account model which is inhereted from `AbstractBaseUser` and is managed by `class AccountManager(BaseUserManager)`.
By default, I override the `is_active` field to be False. However, when I try to reactiva... | 2015/05/24 | [
"https://Stackoverflow.com/questions/30421267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3773879/"
] | In Java, we have a class named `String` which has a method called `length()`.
In C, you need to have a `\0` at the end of your string so you could know where your string ends. But in Java, this problem handled with the method`length()`. | As it is a board question, we have to point out two important things here:
1) First thing to confirm is, C as being a basic language and having low abstraction, it doesn't have string as a datatype. In C, string is just a collection of chars. So we need some thing to specifies where the string ends, for that we use \0... |
30,421,267 | I'm currently having troubles in setting `is_active` field from `False` back to `True` in Django. I have a custom Account model which is inhereted from `AbstractBaseUser` and is managed by `class AccountManager(BaseUserManager)`.
By default, I override the `is_active` field to be False. However, when I try to reactiva... | 2015/05/24 | [
"https://Stackoverflow.com/questions/30421267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3773879/"
] | in C there is no type `string`, there is only a pointer to a `char`. When in C you need a string, you need to know how many characters are in the string, or have an indicator to see that you have reached the end of the string.
Traditionally there are two approaches to this requirements. In the C world the convention i... | C doesn't have strings as an actual data type and the convention is just that character arrays ending in a null character can be used as strings. That's what you get when you use string literals in the language and that's what you have to recreate when you don't use them.
The underlying issue is that C wanted to save ... |
30,421,267 | I'm currently having troubles in setting `is_active` field from `False` back to `True` in Django. I have a custom Account model which is inhereted from `AbstractBaseUser` and is managed by `class AccountManager(BaseUserManager)`.
By default, I override the `is_active` field to be False. However, when I try to reactiva... | 2015/05/24 | [
"https://Stackoverflow.com/questions/30421267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3773879/"
] | C doesn't have strings as an actual data type and the convention is just that character arrays ending in a null character can be used as strings. That's what you get when you use string literals in the language and that's what you have to recreate when you don't use them.
The underlying issue is that C wanted to save ... | As it is a board question, we have to point out two important things here:
1) First thing to confirm is, C as being a basic language and having low abstraction, it doesn't have string as a datatype. In C, string is just a collection of chars. So we need some thing to specifies where the string ends, for that we use \0... |
30,421,267 | I'm currently having troubles in setting `is_active` field from `False` back to `True` in Django. I have a custom Account model which is inhereted from `AbstractBaseUser` and is managed by `class AccountManager(BaseUserManager)`.
By default, I override the `is_active` field to be False. However, when I try to reactiva... | 2015/05/24 | [
"https://Stackoverflow.com/questions/30421267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3773879/"
] | in C there is no type `string`, there is only a pointer to a `char`. When in C you need a string, you need to know how many characters are in the string, or have an indicator to see that you have reached the end of the string.
Traditionally there are two approaches to this requirements. In the C world the convention i... | In Java, a string is mostly an abstraction, where you are not supposed to care about the internal representation. You have methods that perform operations on it and that allow you to obtain information about the string.
In C, however, this is quite the opposite. You want to know and care a string's internal structure,... |
30,421,267 | I'm currently having troubles in setting `is_active` field from `False` back to `True` in Django. I have a custom Account model which is inhereted from `AbstractBaseUser` and is managed by `class AccountManager(BaseUserManager)`.
By default, I override the `is_active` field to be False. However, when I try to reactiva... | 2015/05/24 | [
"https://Stackoverflow.com/questions/30421267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3773879/"
] | in C there is no type `string`, there is only a pointer to a `char`. When in C you need a string, you need to know how many characters are in the string, or have an indicator to see that you have reached the end of the string.
Traditionally there are two approaches to this requirements. In the C world the convention i... | As it is a board question, we have to point out two important things here:
1) First thing to confirm is, C as being a basic language and having low abstraction, it doesn't have string as a datatype. In C, string is just a collection of chars. So we need some thing to specifies where the string ends, for that we use \0... |
30,421,267 | I'm currently having troubles in setting `is_active` field from `False` back to `True` in Django. I have a custom Account model which is inhereted from `AbstractBaseUser` and is managed by `class AccountManager(BaseUserManager)`.
By default, I override the `is_active` field to be False. However, when I try to reactiva... | 2015/05/24 | [
"https://Stackoverflow.com/questions/30421267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3773879/"
] | In Java, a string is mostly an abstraction, where you are not supposed to care about the internal representation. You have methods that perform operations on it and that allow you to obtain information about the string.
In C, however, this is quite the opposite. You want to know and care a string's internal structure,... | As it is a board question, we have to point out two important things here:
1) First thing to confirm is, C as being a basic language and having low abstraction, it doesn't have string as a datatype. In C, string is just a collection of chars. So we need some thing to specifies where the string ends, for that we use \0... |
72,923,752 | I am learning python.
For the code below, how to convert for loop to while loop in an efficient way?
```
import pandas as pd
transactions01 = []
file=open('raw-data1.txt','w')
file.write('HotDogs,Buns\nHotDogs,Buns\nHotDogs,Coke,Chips\nChips,Coke\nChips,Ketchup\nHotDogs,Coke,Chips\n')
file.close()
file=open('raw... | 2022/07/09 | [
"https://Stackoverflow.com/questions/72923752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19517608/"
] | Code :
```
i = 0
while i<len(lines):
items = lines[i][:-1].split(',')
has_item = {}
j = 0
while j<len(items):
has_item[items[j]]=1
j+=1
transactions01.append(has_item)
i+=1
``` | It looks like you could just take your, use the csv module to parse the file as you've got an inconsistent number of rows per column, then turn it into a dataframe, use `pd.get_dummies` to get 0/1's per item present, then aggregate back to a row level to product your final output, eg:
```
import pandas as pd
import cs... |
38,000,412 | I'm just new to python and I can't seem to find a solution to my problem, since it seems to be pretty simple. I have a geometry on paraview, I'm saving it as a vtk file and I'm trying to use python to calculate it's volume.
This is the code I'm using:
```
import vtk
reader = vtk.vtkPolyDataReader()
reader.SetFileName... | 2016/06/23 | [
"https://Stackoverflow.com/questions/38000412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6505466/"
] | Depending on your version of `vtk` package you may want to test the following syntax if your version <= `5`:
```
Mass.SetInput(polydata.GetOutput());
```
Otherwise, the actual syntax is:
```
Mass.SetInputData(polydata.GetOutputPort());
```
PS: you can check the python-wrapped `vtk` version by running:
```
im... | You have assigned `reader.GetOutput()` in `polydata`. From `polydata`, I believe you need to do, `polydata.GetOutputPort()` |
38,000,412 | I'm just new to python and I can't seem to find a solution to my problem, since it seems to be pretty simple. I have a geometry on paraview, I'm saving it as a vtk file and I'm trying to use python to calculate it's volume.
This is the code I'm using:
```
import vtk
reader = vtk.vtkPolyDataReader()
reader.SetFileName... | 2016/06/23 | [
"https://Stackoverflow.com/questions/38000412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6505466/"
] | You have assigned `reader.GetOutput()` in `polydata`. From `polydata`, I believe you need to do, `polydata.GetOutputPort()` | I guess you have VTK 6 , you can provide as input to a filter either the output port of a filter or a vtkDataObject :
```
Mass.SetInputConnection(reader.GetOutputPort())
Mass.SetInputData(polydata) #that is Mass.SetInputData(reader.GetOutput())
```
For understanding why these method are not equivalent when updating... |
38,000,412 | I'm just new to python and I can't seem to find a solution to my problem, since it seems to be pretty simple. I have a geometry on paraview, I'm saving it as a vtk file and I'm trying to use python to calculate it's volume.
This is the code I'm using:
```
import vtk
reader = vtk.vtkPolyDataReader()
reader.SetFileName... | 2016/06/23 | [
"https://Stackoverflow.com/questions/38000412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6505466/"
] | Depending on your version of `vtk` package you may want to test the following syntax if your version <= `5`:
```
Mass.SetInput(polydata.GetOutput());
```
Otherwise, the actual syntax is:
```
Mass.SetInputData(polydata.GetOutputPort());
```
PS: you can check the python-wrapped `vtk` version by running:
```
im... | I guess you have VTK 6 , you can provide as input to a filter either the output port of a filter or a vtkDataObject :
```
Mass.SetInputConnection(reader.GetOutputPort())
Mass.SetInputData(polydata) #that is Mass.SetInputData(reader.GetOutput())
```
For understanding why these method are not equivalent when updating... |
32,157,861 | I use this in python:
```
test = zlib.compress(test, 1)
```
And now I want to use this in java, but I don't know how.
At the end I need to convert the result to a string...
I wait your help! thx | 2015/08/22 | [
"https://Stackoverflow.com/questions/32157861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3363949/"
] | You need to be more specific in describing what you want to achieve.
Are you just seeking to decompress a zlib-compressed piece of data?
Or are you seeking for a way to exchange data between Python and Java, possibly by transferring it across a network?
For the former, it's basically sticking the compressed datastrea... | You can try using a RPC to create a server.
<https://github.com/irmen/Pyro4>
And access that server using java.
<https://github.com/irmen/Pyrolite> |
66,129,119 | Trying to install freeradius package on Debian 10 buster and it fails.
```
$ sudo apt install freeradius
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
freeradius-krb5 freeradius-ldap freeradius-mysql freeradius-postgresql freeradius-python3
The f... | 2021/02/10 | [
"https://Stackoverflow.com/questions/66129119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11966276/"
] | when removing freeradius (either by `apt remove freeradius` or `apt purge freeradius`) mind that config files are a seperate package called `freeradius-config`
so to completely wipe freeradius and do a reinstall do:
```
apt purge freeradius freeradius-config
rm -rf /etc/freeradius/
apt install freeradius
``` | After installation of freeradius, add the following lines at the end of the client.conf file to set the access of your client:
```
#vi /etc/freeradius/3.0/clients.conf
```
For Example :
```
client SWITCH-01 {
ipaddr = 192.168.0.10
secret = kamisama123
}
client LINUX-01 {
ipaddr = 192.168.0.20
secret = ve... |
71,397,984 | I have successfully installed Pillow:
chris@MBPvonChristoph sources % python3 -m pip install --upgrade Pillow
Collecting Pillow
Using cached Pillow-9.0.1-1-cp310-cp310-macosx\_11\_0\_arm64.whl (2.7 MB)
Installing collected packages: Pillow
Successfully installed Pillow-9.0.1
but when i try to use it in pycharm got:
... | 2022/03/08 | [
"https://Stackoverflow.com/questions/71397984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8457280/"
] | looks like you may need to repoint your pycharm to your installed python interpreter.
---
1. go to command line and find out python interpreter path. On windows you can `where python` in your command line an it will give you where your python and packages are installed.. You could also activate python directly in co... | first
```
pip uninstall PIL
```
after uninstall
```
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow
```
or
```
brew install Pillow
``` |
61,941,471 | i'm still new to the field of deep learning using keras and wanted to ask if it is possible to take a model after training the network and run the network again with the variables of that model?
in other words, say i train the network and reach an accuracy of 90%, can i train the network again starting with the variab... | 2020/05/21 | [
"https://Stackoverflow.com/questions/61941471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12139083/"
] | For me I just had to add `./mongo_data` to `.dockerignore` and the Dockerfile would ignore this directory while building `api`.
I did this for all my volumes and things work fine now, no permission errors. | I had the same problem.
I assume that you didn't have this permission error at your first time of docker-compose up.
The
The file "mongo\_data/diagnostic.data" did not exist either. The mongo container will create the file when starting, and the file belongs to a user, it's 999:root in my case(postgres).
```
drwx----... |
32,925,532 | I had already looked through this post:
[Python: building new list from existing by dropping every n-th element](https://stackoverflow.com/questions/16406772/python-building-new-list-from-existing-by-dropping-every-n-th-element), but for some reason it does not work for me:
I tried this way:
```
def drop(mylist, n):
... | 2015/10/03 | [
"https://Stackoverflow.com/questions/32925532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4786305/"
] | The output is correct, you are removing the the elements with index 0, n, 2n, ... . So 1 and 3 are removed, 2 and 4 are left. So if you want to print the 0, n, 2n, ... element, just write
```
print(mylist[::n])
``` | your first approach looks good to me - you just have to adapt your start index if you want to drop the elements 1, 1+n, 1+2n, ... (as seems to be the case):
```
lst = list(range(1, 5))
del lst[1::2]
print(lst)
``` |
32,925,532 | I had already looked through this post:
[Python: building new list from existing by dropping every n-th element](https://stackoverflow.com/questions/16406772/python-building-new-list-from-existing-by-dropping-every-n-th-element), but for some reason it does not work for me:
I tried this way:
```
def drop(mylist, n):
... | 2015/10/03 | [
"https://Stackoverflow.com/questions/32925532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4786305/"
] | Let's say you have the list:
```
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
```
If you want to remove every k-th element you can do something like
```
del a[k-1::k]
```
For example with `k = 3`, the current list is now
```
[1, 2, 4, 5, 7, 8, 10]
``` | The output is correct, you are removing the the elements with index 0, n, 2n, ... . So 1 and 3 are removed, 2 and 4 are left. So if you want to print the 0, n, 2n, ... element, just write
```
print(mylist[::n])
``` |
32,925,532 | I had already looked through this post:
[Python: building new list from existing by dropping every n-th element](https://stackoverflow.com/questions/16406772/python-building-new-list-from-existing-by-dropping-every-n-th-element), but for some reason it does not work for me:
I tried this way:
```
def drop(mylist, n):
... | 2015/10/03 | [
"https://Stackoverflow.com/questions/32925532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4786305/"
] | The output is correct, you are removing the the elements with index 0, n, 2n, ... . So 1 and 3 are removed, 2 and 4 are left. So if you want to print the 0, n, 2n, ... element, just write
```
print(mylist[::n])
``` | Another way to do this, would be to generate a new list containing only the elements you need.
```
newList = [x for i, x in enumerate(myList) if i%n !=0]
```
If n were 5, this would return a list containing the elements [1,2,3,4,6,7,8,9,11...]
The advantage of doing it this way is that you keep your original list wh... |
32,925,532 | I had already looked through this post:
[Python: building new list from existing by dropping every n-th element](https://stackoverflow.com/questions/16406772/python-building-new-list-from-existing-by-dropping-every-n-th-element), but for some reason it does not work for me:
I tried this way:
```
def drop(mylist, n):
... | 2015/10/03 | [
"https://Stackoverflow.com/questions/32925532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4786305/"
] | In your first function `mylist[0::n]` is `[1, 3]` because `0::n` means first element is 0 and other elements are every n*th* element after first. As Daniel suggested you could use `mylist[::n]` which means every n*th* element.
In your second function index is starting with 0 and `0 % 0` is 0, so it doesn't copy first ... | your first approach looks good to me - you just have to adapt your start index if you want to drop the elements 1, 1+n, 1+2n, ... (as seems to be the case):
```
lst = list(range(1, 5))
del lst[1::2]
print(lst)
``` |
32,925,532 | I had already looked through this post:
[Python: building new list from existing by dropping every n-th element](https://stackoverflow.com/questions/16406772/python-building-new-list-from-existing-by-dropping-every-n-th-element), but for some reason it does not work for me:
I tried this way:
```
def drop(mylist, n):
... | 2015/10/03 | [
"https://Stackoverflow.com/questions/32925532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4786305/"
] | Let's say you have the list:
```
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
```
If you want to remove every k-th element you can do something like
```
del a[k-1::k]
```
For example with `k = 3`, the current list is now
```
[1, 2, 4, 5, 7, 8, 10]
``` | your first approach looks good to me - you just have to adapt your start index if you want to drop the elements 1, 1+n, 1+2n, ... (as seems to be the case):
```
lst = list(range(1, 5))
del lst[1::2]
print(lst)
``` |
32,925,532 | I had already looked through this post:
[Python: building new list from existing by dropping every n-th element](https://stackoverflow.com/questions/16406772/python-building-new-list-from-existing-by-dropping-every-n-th-element), but for some reason it does not work for me:
I tried this way:
```
def drop(mylist, n):
... | 2015/10/03 | [
"https://Stackoverflow.com/questions/32925532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4786305/"
] | your first approach looks good to me - you just have to adapt your start index if you want to drop the elements 1, 1+n, 1+2n, ... (as seems to be the case):
```
lst = list(range(1, 5))
del lst[1::2]
print(lst)
``` | Another way to do this, would be to generate a new list containing only the elements you need.
```
newList = [x for i, x in enumerate(myList) if i%n !=0]
```
If n were 5, this would return a list containing the elements [1,2,3,4,6,7,8,9,11...]
The advantage of doing it this way is that you keep your original list wh... |
32,925,532 | I had already looked through this post:
[Python: building new list from existing by dropping every n-th element](https://stackoverflow.com/questions/16406772/python-building-new-list-from-existing-by-dropping-every-n-th-element), but for some reason it does not work for me:
I tried this way:
```
def drop(mylist, n):
... | 2015/10/03 | [
"https://Stackoverflow.com/questions/32925532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4786305/"
] | Let's say you have the list:
```
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
```
If you want to remove every k-th element you can do something like
```
del a[k-1::k]
```
For example with `k = 3`, the current list is now
```
[1, 2, 4, 5, 7, 8, 10]
``` | In your first function `mylist[0::n]` is `[1, 3]` because `0::n` means first element is 0 and other elements are every n*th* element after first. As Daniel suggested you could use `mylist[::n]` which means every n*th* element.
In your second function index is starting with 0 and `0 % 0` is 0, so it doesn't copy first ... |
32,925,532 | I had already looked through this post:
[Python: building new list from existing by dropping every n-th element](https://stackoverflow.com/questions/16406772/python-building-new-list-from-existing-by-dropping-every-n-th-element), but for some reason it does not work for me:
I tried this way:
```
def drop(mylist, n):
... | 2015/10/03 | [
"https://Stackoverflow.com/questions/32925532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4786305/"
] | In your first function `mylist[0::n]` is `[1, 3]` because `0::n` means first element is 0 and other elements are every n*th* element after first. As Daniel suggested you could use `mylist[::n]` which means every n*th* element.
In your second function index is starting with 0 and `0 % 0` is 0, so it doesn't copy first ... | Another way to do this, would be to generate a new list containing only the elements you need.
```
newList = [x for i, x in enumerate(myList) if i%n !=0]
```
If n were 5, this would return a list containing the elements [1,2,3,4,6,7,8,9,11...]
The advantage of doing it this way is that you keep your original list wh... |
32,925,532 | I had already looked through this post:
[Python: building new list from existing by dropping every n-th element](https://stackoverflow.com/questions/16406772/python-building-new-list-from-existing-by-dropping-every-n-th-element), but for some reason it does not work for me:
I tried this way:
```
def drop(mylist, n):
... | 2015/10/03 | [
"https://Stackoverflow.com/questions/32925532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4786305/"
] | Let's say you have the list:
```
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
```
If you want to remove every k-th element you can do something like
```
del a[k-1::k]
```
For example with `k = 3`, the current list is now
```
[1, 2, 4, 5, 7, 8, 10]
``` | Another way to do this, would be to generate a new list containing only the elements you need.
```
newList = [x for i, x in enumerate(myList) if i%n !=0]
```
If n were 5, this would return a list containing the elements [1,2,3,4,6,7,8,9,11...]
The advantage of doing it this way is that you keep your original list wh... |
67,972,487 | I want to get a script to:
a) check if a number within the user defined range is prime or not
b) print the result of a check
c) print amount of numbers checked and how many of these numbers were primes
d) print the last prime number
Here is what I have so far:
```
lower = int(input("Lower boundry: "))
upper = int(inp... | 2021/06/14 | [
"https://Stackoverflow.com/questions/67972487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16223545/"
] | The indentation of your `else` clause is wrong. It should belong to the `for` loop. This means it will be executed when the loop is not terminated by the `break` statement.
I can't answer your question about the error message, because I don't know the test tool in question.
To keep track of the number of primes found... | How about this .
```
# define a flag variable
lower = int(input("Lower boundry: "))
upper = int(input("Upper boundry: "))
prime_list=[]
for num in range(lower,upper+1):
flag = False
# prime numbers are greater than 1
if num > 1:
# check for factors
for i in range(2, num):
if (num % i)... |
67,972,487 | I want to get a script to:
a) check if a number within the user defined range is prime or not
b) print the result of a check
c) print amount of numbers checked and how many of these numbers were primes
d) print the last prime number
Here is what I have so far:
```
lower = int(input("Lower boundry: "))
upper = int(inp... | 2021/06/14 | [
"https://Stackoverflow.com/questions/67972487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16223545/"
] | Fist of all: Please pose your question in the title. For Example: "How do I find all primes in a user-defined range?"
The Algorithm
-------------
To find out whether or not a number is prime you can divide it by all primes smaller than the number, since all non-primes can be divided by primes. This is significantly f... | How about this .
```
# define a flag variable
lower = int(input("Lower boundry: "))
upper = int(input("Upper boundry: "))
prime_list=[]
for num in range(lower,upper+1):
flag = False
# prime numbers are greater than 1
if num > 1:
# check for factors
for i in range(2, num):
if (num % i)... |
52,767,072 | I am trying psql and getting an error.
```
$ psql
psql: FATAL: "myilmaz" role not available
```
Then I try
```
$ createdb python_getting_started
createdb: Unable to connect to template1 database: FATAL: "myilmaz" does not have access to the system
```
I run `export DATABASE_URL=postgres://$(whoami)` as indicated ... | 2018/10/11 | [
"https://Stackoverflow.com/questions/52767072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10398711/"
] | The part you haven't understood is that every method - in fact, every call to every method - has its own collection of local variables. That means that
* the `winnings` variable declared in `main` is NOT the same variable as the `winnings` variable declared in `determineWinnings`;
* the `bet` variable declared in `ma... | To avoid skipping if in execution use
`bet = getBet(inScanner, currentPool);
highLow = getHighLow(inScanner);
winnings = determineWinnings(highLow, bet, roll);`
instead of directly calling
`getBet(inScanner, currentPool);
getHighLow(inScanner);
determineWinnings(highLow, bet, roll);`
Reson for skipping if stateme... |
74,436,487 | I am using OR-Tools to solve a problem similar to the Nurse Scheduling problem. The difference in my case is that when I schedule a "Nurse" for a shift, they must then work consecutive days (i.e., there can be no gaps between days worked).
Most of the similar questions point to this [code](https://github.com/google/or... | 2022/11/14 | [
"https://Stackoverflow.com/questions/74436487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18497033/"
] | [Select-String](https://learn.microsoft.com/en-gb/powershell/module/microsoft.powershell.utility/select-string): *By default, the output is a set of `MatchInfo` objects with one for each match found.*
Apply `.substring` method to the `$_.Line` string, e.g. as follows:
```
Select-String -Path "DatabaseBackup - USER_DA... | [`Select-String`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.powershell.commands.matchinfo?view=powershellsdk-7.2.0) is returning a `MatchInfo` object so you would need to iterate over the `Matches` property of that object.
So you could do something like this:
```
(Select-String -Path "DatabaseBackup - US... |
68,769,200 | by no means am i an expert when it comes to python but i have tried my best. I have written a short code in python that reads a text file from a blob storage and appends it with some column names and outputs it to target folder. The code executes correctly when i run from VS Code.
When i try to run it via Azure Functi... | 2021/08/13 | [
"https://Stackoverflow.com/questions/68769200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4511169/"
] | You have to revert the order of your aggregation operations since your `$project` will only leave one property `title` so there is no way to filter by `year` afterwards:
```
db.collection.aggregate([
{
"$match": {
"year": {
"$gt": 1967,
"$lt": 2020
}
... | ```
db.movies.find({year: {$gte:1967, $lte:1995} },{title:1,year:1,"director.last_name":1 }).sort({year:1})
``` |
4,834,036 | I need to have an array of python objects to be used in creating a trie datastructure. I need a structure that will be fixed-length like a tuple and mutable like a list. I don't want to use a list because I want to be able to ensure that the list is *exactly* the right size (if it starts allocating extra elements, the ... | 2011/01/28 | [
"https://Stackoverflow.com/questions/4834036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] | If you only need few fixed sizes of such a structure, I'd look at making classes with uniformly named `__slots__`, including one `size` slot to store the size. You'll need to declare a separate class for each size (number of slots). Define a `cdecl` function to access slots by index. Access performance will probably be... | How about this?
```
class TrieNode():
def __init__(self, length = 32):
self.members = list()
self.length = length
for i in range(length):
self.members.append(None)
def set(self, idx, item):
if idx < self.length and idx >= 0:
self.members[idx] = item
else:
... |
4,834,036 | I need to have an array of python objects to be used in creating a trie datastructure. I need a structure that will be fixed-length like a tuple and mutable like a list. I don't want to use a list because I want to be able to ensure that the list is *exactly* the right size (if it starts allocating extra elements, the ... | 2011/01/28 | [
"https://Stackoverflow.com/questions/4834036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] | I don't know about the *best* solution, but here's *a* solution:
```
from cpython.ref cimport PyObject, Py_XINCREF, Py_XDECREF
DEF SIZE = 32
cdef class TrieNode:
cdef PyObject *members[SIZE]
def __cinit__(self):
cdef object temp_object
for i in range(SIZE):
temp_object = int(i)
... | How about this?
```
class TrieNode():
def __init__(self, length = 32):
self.members = list()
self.length = length
for i in range(length):
self.members.append(None)
def set(self, idx, item):
if idx < self.length and idx >= 0:
self.members[idx] = item
else:
... |
4,834,036 | I need to have an array of python objects to be used in creating a trie datastructure. I need a structure that will be fixed-length like a tuple and mutable like a list. I don't want to use a list because I want to be able to ensure that the list is *exactly* the right size (if it starts allocating extra elements, the ... | 2011/01/28 | [
"https://Stackoverflow.com/questions/4834036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] | I don't know about the *best* solution, but here's *a* solution:
```
from cpython.ref cimport PyObject, Py_XINCREF, Py_XDECREF
DEF SIZE = 32
cdef class TrieNode:
cdef PyObject *members[SIZE]
def __cinit__(self):
cdef object temp_object
for i in range(SIZE):
temp_object = int(i)
... | If you only need few fixed sizes of such a structure, I'd look at making classes with uniformly named `__slots__`, including one `size` slot to store the size. You'll need to declare a separate class for each size (number of slots). Define a `cdecl` function to access slots by index. Access performance will probably be... |
49,868,348 | I'm trying to install sklearn onm an AWS DeepLearning AMI, with Conda and an assortment of backends pre-installed. I'm following ScikitLearn's website instructions:
```
$ conda install -c anaconda scikit-learn
$ source activate python3
$ jupyter notebook
```
In Jupyter notebook:
```
import numpy as np
import panda... | 2018/04/17 | [
"https://Stackoverflow.com/questions/49868348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8268013/"
] | You need to start the virtual environment **first** "source activate python3", then install scikit-learn. Without activating the virtual environment, you are installing into the base python and not into the virtual environment.
Cheers | And in case anybody didn't know how to install packages in each conda environment, it is (as in this case my environment of choice was `Tensorflow` in *Python 3.6*) here is the command I used my *mac bash*, and in my EC2 environment:
```
ubuntu@ip ***.***.**.***:~$ source activate tensorflow_p36
```
and then:
```
u... |
49,868,348 | I'm trying to install sklearn onm an AWS DeepLearning AMI, with Conda and an assortment of backends pre-installed. I'm following ScikitLearn's website instructions:
```
$ conda install -c anaconda scikit-learn
$ source activate python3
$ jupyter notebook
```
In Jupyter notebook:
```
import numpy as np
import panda... | 2018/04/17 | [
"https://Stackoverflow.com/questions/49868348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8268013/"
] | You need to start the virtual environment **first** "source activate python3", then install scikit-learn. Without activating the virtual environment, you are installing into the base python and not into the virtual environment.
Cheers | Did you install "scikit-learn",
try: `conda install -c anaconda scikit-learn`
or : first create virtual env and try: `conda install -c anaconda scikit-learn`
to create virutal env: `conda create -n *yourenvname* python=*x.x* anaconda` |
49,868,348 | I'm trying to install sklearn onm an AWS DeepLearning AMI, with Conda and an assortment of backends pre-installed. I'm following ScikitLearn's website instructions:
```
$ conda install -c anaconda scikit-learn
$ source activate python3
$ jupyter notebook
```
In Jupyter notebook:
```
import numpy as np
import panda... | 2018/04/17 | [
"https://Stackoverflow.com/questions/49868348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8268013/"
] | Did you install "scikit-learn",
try: `conda install -c anaconda scikit-learn`
or : first create virtual env and try: `conda install -c anaconda scikit-learn`
to create virutal env: `conda create -n *yourenvname* python=*x.x* anaconda` | And in case anybody didn't know how to install packages in each conda environment, it is (as in this case my environment of choice was `Tensorflow` in *Python 3.6*) here is the command I used my *mac bash*, and in my EC2 environment:
```
ubuntu@ip ***.***.**.***:~$ source activate tensorflow_p36
```
and then:
```
u... |
57,277,513 | I'm generating the pictures of my latex document with the following program `genimg.py`:
```
#!/usr/bin/env python3
def figCircle():
print('generate circle picture')
def figSquare():
print('generate square picture')
def main():
for key, value in globals().items():
if callable(value) and key.start... | 2019/07/30 | [
"https://Stackoverflow.com/questions/57277513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11811021/"
] | You could call your code recursively for imported modules. Something like
```
import types
def call_functions(module_dict):
for key, value in module_dict.items():
if callable(value) and key.startswith('fig'):
value()
elif isinstance(value, types.ModuleType):
call_functions(v... | ```
import glob
for fname in glob.glob("genimg*.py"): # get all the relevant files
mod = gname.rsplit('.',1)([0])
mod = __import__(mod) # import the module
for k,v in mod.__dict__.items():
if callable(v): v() # if a module attribute is a function, call it
``` |
62,670,115 | I have text file containing employee details and various other details. Below is the consolidated data as shown below.
```
Data file created on 4 Jun 2020
GROUPCASEINSENSITIVE ON
#KCT-User-Group
GROUP KCT ALopp190 e190 ARaga789 Lshastri921
GROUP KCT DPatel592 ANaidu026 e026 KRam161 e161
#KBN-User-Group
GROUP KBN ... | 2020/07/01 | [
"https://Stackoverflow.com/questions/62670115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13761107/"
] | As others have mentioned, you can source your `.vimrc`, but that doesn't completely reset Vim. If you want to just restart Vim, then you can do so by re-execing it.
Vim doesn't provide a built-in way to exec processes from within it, since typically one doesn't want to replace one's editor with another process, but it... | I don't know if you had tried this but you can source your vimrc file from vim itself by typing
>
> :so $MYVIMRC
>
>
> |
62,670,115 | I have text file containing employee details and various other details. Below is the consolidated data as shown below.
```
Data file created on 4 Jun 2020
GROUPCASEINSENSITIVE ON
#KCT-User-Group
GROUP KCT ALopp190 e190 ARaga789 Lshastri921
GROUP KCT DPatel592 ANaidu026 e026 KRam161 e161
#KBN-User-Group
GROUP KBN ... | 2020/07/01 | [
"https://Stackoverflow.com/questions/62670115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13761107/"
] | As others have mentioned, you can source your `.vimrc`, but that doesn't completely reset Vim. If you want to just restart Vim, then you can do so by re-execing it.
Vim doesn't provide a built-in way to exec processes from within it, since typically one doesn't want to replace one's editor with another process, but it... | In order to apply the changes, you don't have to exit vim and open it again, no need for a "hard refresh" :)
If you want to apply in on the .vimrc file itself, you can type
```
:so %
```
to apply the changes in another file, you can type:
```
:so ~/.vimrc #path to your .vimrc file
```
in normal mode, `Ctrl-O` tak... |
28,769,698 | I am learning python.
I have a file like this
```
str1 str2 str3 str4
str1 str2 str7 str8
***
str9 str10 str12 str13
str9 str10 str16 str17
****
str 18 str19 str20 str21
***
```
and so on.
I want to change it to this format->
```
str1
str2 str3 str4
str2 str7 str8
str9
str10 str12 str13
str10 str16 str17
str 1... | 2015/02/27 | [
"https://Stackoverflow.com/questions/28769698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/612258/"
] | A class diagram shows classes in their relation and their properties and methods.
A state diagram visualizes a class's states and how they can change over time.
In both cases you are talking about diagrams which are only a window into the model. The class relations define how the single classes relate to each other. ... | A state diagram shows the behavior of the class. A class model shows the relationship between two or more classes. It includes its properties/attributes...
A state is an allowable sequence of changes of objects of a class model. |
28,769,698 | I am learning python.
I have a file like this
```
str1 str2 str3 str4
str1 str2 str7 str8
***
str9 str10 str12 str13
str9 str10 str16 str17
****
str 18 str19 str20 str21
***
```
and so on.
I want to change it to this format->
```
str1
str2 str3 str4
str2 str7 str8
str9
str10 str12 str13
str10 str16 str17
str 1... | 2015/02/27 | [
"https://Stackoverflow.com/questions/28769698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/612258/"
] | This question reveals a very common misunderstanding. There are only thirteen types of diagram in UML. They're not used to describe different types of system, but to describe different aspects of the system you are documenting. Which you pick in any given situation is more a question of style, what you want to emphasiz... | A state diagram shows the behavior of the class. A class model shows the relationship between two or more classes. It includes its properties/attributes...
A state is an allowable sequence of changes of objects of a class model. |
69,325,145 | Suppose I have a string of A's and B's. I can either remove a character from either end of the string for a cost of 1, or I can remove any character from the middle for a cost of 2. What's the minimum cost to create a string of only A's?
For example, if I have the string "BBABAA", then the minimum cost to remove is 4,... | 2021/09/25 | [
"https://Stackoverflow.com/questions/69325145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11228246/"
] | All `B`s must be removed. If we remove one `B` from the middle, we split the string into two sections. For the section on the right, none of the characters could be deleted from the left since otherwise we would have deleted the `B` from the left at a lower cost for that deletion. Mirror for the section on the left. A ... | Let `C` be an array where `C[i]` Is the optimal cost for the substring `s[0:i+1]`(assuming right sise Is exclusive].
Consider another game, exactly the same, EXCEPT eating from the right costs 2 instead of 1. Let `D` be the associated cost array of this new game, this cost is helpful to keep track of situations where ... |
69,325,145 | Suppose I have a string of A's and B's. I can either remove a character from either end of the string for a cost of 1, or I can remove any character from the middle for a cost of 2. What's the minimum cost to create a string of only A's?
For example, if I have the string "BBABAA", then the minimum cost to remove is 4,... | 2021/09/25 | [
"https://Stackoverflow.com/questions/69325145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11228246/"
] | All `B`s must be removed. If we remove one `B` from the middle, we split the string into two sections. For the section on the right, none of the characters could be deleted from the left since otherwise we would have deleted the `B` from the left at a lower cost for that deletion. Mirror for the section on the left. A ... | ```
int n = s.length();
int l[] = new int[];
int r[] = new int[];
if(s.charAt(0)=='b') l[0]=1;
if(s.charAt(n-1)=='b') r[n-1]=1;
for(int i = 1; i<n; i++) {
l[i] = Math.min(l[i-1]+2, i+1);
}
for(int i = n-2; i>=0; i--) {
r[i] = Math.min(r[i+1]+2, n-i);
}
int ans = Math.min(l[n-1], r[0]);
for(int i = 0; i<n-1; i++) {... |
61,190,064 | I am trying to create a docker image with opencv in order to display a video. I have the following Dockerfile:
```
FROM python:3
ADD testDocker_1.py /
ADD video1.mp4 /
RUN pip install opencv-python
CMD [ "python", "./testDocker_1.py" ]
```
And the following python script:
```
import cv2
import os
if __name__ == '_... | 2020/04/13 | [
"https://Stackoverflow.com/questions/61190064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11266804/"
] | Try this
```
xhost +
sudo docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix test1
```
Although it would solve this particular use case, but you need to make a note of the following:
>
> **Basically, the xhost + allows everybody to use your host x server;**
>
>
>
[Refrence](https://marcos... | Kapil Khandelwal, your solution works for me. But only using the docker image on ubuntu, when I try to share it with windows it does not work.+ |
18,744,584 | Right, I am trying to setup a django dev site based on a current live site. I've setup the new virtualenv and installed all of the dependencies. I've also made a copy of the database and done a fresh DB dump. I'm now getting the error above and I have no idea why.
My django.wsgi file seems to be pointing at the virtal... | 2013/09/11 | [
"https://Stackoverflow.com/questions/18744584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1256637/"
] | In this stanza:
```
# URL that handles pages media and uses <MEDIA_ROOT>/pages by default.
_media_url = getattr(settings, "STATIC_URL", settings.MEDIA_URL)
PAGES_MEDIA_URL = getattr(settings, 'PAGES_MEDIA_URL',
join(_media_url, 'pages/'))
```
`STATIC_URL` is not in settings, and `settings.MEDIA_URL` is `None`. L... | in this line,
```
ile "/usr/lib/python2.6/posixpath.py" in join
67. elif path == '' or path.endswith('/'):
```
path is None. so a nonetype("path") has to attribute .endswith
i would suggest like the other users said to put the full traceback error and check your code and see why path is None. |
24,589,241 | I just wrote a Google Cloud Endpoints API using Python (using the latest Mac OS), and now need to create an Android Client by following this:
<https://developers.google.com/appengine/docs/python/endpoints/endpoints_tool>
In the instructions, it says that there's a file called endpointscfg.py under google\_appengine, b... | 2014/07/05 | [
"https://Stackoverflow.com/questions/24589241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3108752/"
] | After a lot of trial and error I figured out the solution.
All in all you need two different things in your project:
**1) A class that inherits from ProminentProjectAction:**
```
import hudson.model.ProminentProjectAction;
public class MyProjectAction implements ProminentProjectAction {
@Override
public St... | As it happens, there was a [plugin workshop](http://jenkins-ci.org/content/get-drunk-code-juc-boston) by Steven Christou at the recent [Jenkins User Conference](http://www.cloudbees.com/jenkins/juc-2014/boston) in Boston, which covered this case. You need to add a new RootAction, as shown in the following code from the... |
24,589,241 | I just wrote a Google Cloud Endpoints API using Python (using the latest Mac OS), and now need to create an Android Client by following this:
<https://developers.google.com/appengine/docs/python/endpoints/endpoints_tool>
In the instructions, it says that there's a file called endpointscfg.py under google\_appengine, b... | 2014/07/05 | [
"https://Stackoverflow.com/questions/24589241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3108752/"
] | Root Action and Actions are different. The first one goes only to initial page (root), the second one can be attach to a Project/Job or to a Build.
To create a Root Action, just need to create a class that it's:
1. Annotated with @Extension (so it can be found and automatically
loaded by Jenkins)
2. Implements RootAc... | As it happens, there was a [plugin workshop](http://jenkins-ci.org/content/get-drunk-code-juc-boston) by Steven Christou at the recent [Jenkins User Conference](http://www.cloudbees.com/jenkins/juc-2014/boston) in Boston, which covered this case. You need to add a new RootAction, as shown in the following code from the... |
24,589,241 | I just wrote a Google Cloud Endpoints API using Python (using the latest Mac OS), and now need to create an Android Client by following this:
<https://developers.google.com/appengine/docs/python/endpoints/endpoints_tool>
In the instructions, it says that there's a file called endpointscfg.py under google\_appengine, b... | 2014/07/05 | [
"https://Stackoverflow.com/questions/24589241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3108752/"
] | As it happens, there was a [plugin workshop](http://jenkins-ci.org/content/get-drunk-code-juc-boston) by Steven Christou at the recent [Jenkins User Conference](http://www.cloudbees.com/jenkins/juc-2014/boston) in Boston, which covered this case. You need to add a new RootAction, as shown in the following code from the... | <https://github.com/jenkinsci/s3explorer-plugin> is my Jenkins plugin that adds an `S3 Explorer` link to all Jenkins project's side-panel.
[](https://i.stack.imgur.com/WWnWn.png) |
24,589,241 | I just wrote a Google Cloud Endpoints API using Python (using the latest Mac OS), and now need to create an Android Client by following this:
<https://developers.google.com/appengine/docs/python/endpoints/endpoints_tool>
In the instructions, it says that there's a file called endpointscfg.py under google\_appengine, b... | 2014/07/05 | [
"https://Stackoverflow.com/questions/24589241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3108752/"
] | As it happens, there was a [plugin workshop](http://jenkins-ci.org/content/get-drunk-code-juc-boston) by Steven Christou at the recent [Jenkins User Conference](http://www.cloudbees.com/jenkins/juc-2014/boston) in Boston, which covered this case. You need to add a new RootAction, as shown in the following code from the... | An addition to @dchang [comment](https://stackoverflow.com/a/41149546/4233342):
I managed to make this functionality work also on pipelines by extending `TransientActionFactory<WorkflowJob>`:
```
@Extension
public static class PipelineLatestConsoleProjectActionFactory extends TransientActionFactory<WorkflowJob> {
... |
24,589,241 | I just wrote a Google Cloud Endpoints API using Python (using the latest Mac OS), and now need to create an Android Client by following this:
<https://developers.google.com/appengine/docs/python/endpoints/endpoints_tool>
In the instructions, it says that there's a file called endpointscfg.py under google\_appengine, b... | 2014/07/05 | [
"https://Stackoverflow.com/questions/24589241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3108752/"
] | After a lot of trial and error I figured out the solution.
All in all you need two different things in your project:
**1) A class that inherits from ProminentProjectAction:**
```
import hudson.model.ProminentProjectAction;
public class MyProjectAction implements ProminentProjectAction {
@Override
public St... | <https://github.com/jenkinsci/s3explorer-plugin> is my Jenkins plugin that adds an `S3 Explorer` link to all Jenkins project's side-panel.
[](https://i.stack.imgur.com/WWnWn.png) |
24,589,241 | I just wrote a Google Cloud Endpoints API using Python (using the latest Mac OS), and now need to create an Android Client by following this:
<https://developers.google.com/appengine/docs/python/endpoints/endpoints_tool>
In the instructions, it says that there's a file called endpointscfg.py under google\_appengine, b... | 2014/07/05 | [
"https://Stackoverflow.com/questions/24589241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3108752/"
] | After a lot of trial and error I figured out the solution.
All in all you need two different things in your project:
**1) A class that inherits from ProminentProjectAction:**
```
import hudson.model.ProminentProjectAction;
public class MyProjectAction implements ProminentProjectAction {
@Override
public St... | An addition to @dchang [comment](https://stackoverflow.com/a/41149546/4233342):
I managed to make this functionality work also on pipelines by extending `TransientActionFactory<WorkflowJob>`:
```
@Extension
public static class PipelineLatestConsoleProjectActionFactory extends TransientActionFactory<WorkflowJob> {
... |
24,589,241 | I just wrote a Google Cloud Endpoints API using Python (using the latest Mac OS), and now need to create an Android Client by following this:
<https://developers.google.com/appengine/docs/python/endpoints/endpoints_tool>
In the instructions, it says that there's a file called endpointscfg.py under google\_appengine, b... | 2014/07/05 | [
"https://Stackoverflow.com/questions/24589241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3108752/"
] | Root Action and Actions are different. The first one goes only to initial page (root), the second one can be attach to a Project/Job or to a Build.
To create a Root Action, just need to create a class that it's:
1. Annotated with @Extension (so it can be found and automatically
loaded by Jenkins)
2. Implements RootAc... | <https://github.com/jenkinsci/s3explorer-plugin> is my Jenkins plugin that adds an `S3 Explorer` link to all Jenkins project's side-panel.
[](https://i.stack.imgur.com/WWnWn.png) |
24,589,241 | I just wrote a Google Cloud Endpoints API using Python (using the latest Mac OS), and now need to create an Android Client by following this:
<https://developers.google.com/appengine/docs/python/endpoints/endpoints_tool>
In the instructions, it says that there's a file called endpointscfg.py under google\_appengine, b... | 2014/07/05 | [
"https://Stackoverflow.com/questions/24589241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3108752/"
] | Root Action and Actions are different. The first one goes only to initial page (root), the second one can be attach to a Project/Job or to a Build.
To create a Root Action, just need to create a class that it's:
1. Annotated with @Extension (so it can be found and automatically
loaded by Jenkins)
2. Implements RootAc... | An addition to @dchang [comment](https://stackoverflow.com/a/41149546/4233342):
I managed to make this functionality work also on pipelines by extending `TransientActionFactory<WorkflowJob>`:
```
@Extension
public static class PipelineLatestConsoleProjectActionFactory extends TransientActionFactory<WorkflowJob> {
... |
56,674,284 | I am trying to use beautiful soup to scrape data from [this](https://www.pro-football-reference.com/play-index/play_finder.cgi?request=1&match=summary_all&year_min=2018&year_max=2018&game_type=R&game_num_min=0&game_num_max=99&week_num_min=0&week_num_max=99&quarter%5B%5D=4&minutes_max=15&seconds_max=00&minutes_min=00&se... | 2019/06/19 | [
"https://Stackoverflow.com/questions/56674284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5657167/"
] | You can use `selenium` to hover over the "Share & more" link to display the menu, from which you can click the "Get table as csv":
```
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from bs4 import BeautifulSoup as soup
d = webdriver.Chrome('/path/to/chromedriver')
d.ge... | You could just use pandas
```
import pandas as pd
table = pd.read_html('https://www.pro-football-reference.com/play-index/play_finder.cgi?request=1&match=summary_all&year_min=2018&year_max=2018&game_type=R&game_num_min=0&game_num_max=99&week_num_min=0&week_num_max=99&quarter%5B%5D=4&minutes_max=15&seconds_max=00&minu... |
44,299,462 | I run below commands after unzipping that python 3.6 tar.xz file.
```
./configure
make
make install
```
Error log:
```
ranlib libpython3.6m.a
gcc -pthread -Xlinker -export-dynamic -o python Programs/python.o libpython3.6m.a -lpthread -ldl -lutil -lrt -lm
if test "no-framework" = "no-framework" ; then \
... | 2017/06/01 | [
"https://Stackoverflow.com/questions/44299462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4909084/"
] | Have you tried running the above commands using `sudo` powers?
original answer: <https://askubuntu.com/q/865554/667903>
`sudo make install`
**or**
If you are using Ubuntu 16.10 or 17.04, then Python 3.6 is in the universe repository, so you can just run
```
sudo apt-get update
sudo apt-get install python3.6
``` | Try after installing build essentials whic contains compilers,package dev tools and libs:
sudo apt-get install build-essential |
44,299,462 | I run below commands after unzipping that python 3.6 tar.xz file.
```
./configure
make
make install
```
Error log:
```
ranlib libpython3.6m.a
gcc -pthread -Xlinker -export-dynamic -o python Programs/python.o libpython3.6m.a -lpthread -ldl -lutil -lrt -lm
if test "no-framework" = "no-framework" ; then \
... | 2017/06/01 | [
"https://Stackoverflow.com/questions/44299462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4909084/"
] | Your filesystem seems to be read-only. You have to remount the partition where `/usr/local/bin/` is located with write permissions
The syntax for `mount` is
```
mount -o remount,rw /partition/identifier /mount/point
```
Let's say you have `/` on `/dev/sda2`
```
mount -o remount,rw / /dev/sda2
```
should fix your... | Try after installing build essentials whic contains compilers,package dev tools and libs:
sudo apt-get install build-essential |
52,929,872 | I am trying to read the text in a cheque using pytesseract OCR. I have installed the required python packages required for this task e.g. pip install pytesseract.
However when I try to use the package to read the file I get the following error:
```
pytesseract.image_to_string(im, lang='eng')
Traceback (most recent c... | 2018/10/22 | [
"https://Stackoverflow.com/questions/52929872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10122096/"
] | The documentation for tesseract makes this clear.
<https://pypi.org/project/pytesseract/>
```
# If you don't have tesseract executable in your PATH, include the following:
pytesseract.pytesseract.tesseract_cmd = r'<full_path_to_your_tesseract_executable>'
``` | You need to install teserract executable file and include the path into the program then it won't gives any error |
41,419,093 | I am fairly new to Python and started learning. I am trying to automate data entry. I am stuck at the "save" button. How do I find the right information and click it to save?
Thank you so much
PyGuy
---
Element
```
<input type="submit" value="Save">
```
Xpath
```
//*[@id="decorated-admin-content"]/div/div/form... | 2017/01/01 | [
"https://Stackoverflow.com/questions/41419093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7363397/"
] | If you're using python, the syntax is not right. Python uses snake\_case and By uses CONSTANT convention
```
from selenium import webdriver
from selenium.webdriver.common.by import By
driver.find_element(By.XPATH, "//input[@type='submit' and @value='save']").click()
```
It's actually suggested to use the individual... | Did you try with other parameter than xpath ?
I also had some difficulties with selenium, you can try the following line :
```
driver.findElement(By.tagName("form")).submit()
```
It's works for me and is useful to validate forms |
57,567,892 | Previously I asked a similar question: [cx\_Freeze unable fo find mkl: MKL FATAL ERROR: Cannot load mkl\_intel\_thread.dll](https://stackoverflow.com/questions/57493584/cx-freeze-unable-fo-find-mkl-mkl-fatal-error-cannot-load-mkl-intel-thread-dll)
But now I have a subtle difference. I want to run the program without i... | 2019/08/20 | [
"https://Stackoverflow.com/questions/57567892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1612432/"
] | Maybe another DLL necessary for MKL, such as `libiomp5md.dll` for example, is missing and causes the error. See [Cannot load mkl\_intel\_thread.dll on python executable](https://stackoverflow.com/q/54337644/8516269), my answer there and its comments.
If this still does not solve your problem, try to manually copy othe... | Recently I faced the same error in python3.7 . I did not have the option of moving Dll, I Solved the problem by just doing.
```
conda install cython
```
After the cython install all dll's were in proper place. |
57,567,892 | Previously I asked a similar question: [cx\_Freeze unable fo find mkl: MKL FATAL ERROR: Cannot load mkl\_intel\_thread.dll](https://stackoverflow.com/questions/57493584/cx-freeze-unable-fo-find-mkl-mkl-fatal-error-cannot-load-mkl-intel-thread-dll)
But now I have a subtle difference. I want to run the program without i... | 2019/08/20 | [
"https://Stackoverflow.com/questions/57567892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1612432/"
] | Maybe another DLL necessary for MKL, such as `libiomp5md.dll` for example, is missing and causes the error. See [Cannot load mkl\_intel\_thread.dll on python executable](https://stackoverflow.com/q/54337644/8516269), my answer there and its comments.
If this still does not solve your problem, try to manually copy othe... | >
> set CONDA\_DLL\_SEARCH\_MODIFICATION\_ENABLE=1;
>
>
>
will solve all your problems |
57,567,892 | Previously I asked a similar question: [cx\_Freeze unable fo find mkl: MKL FATAL ERROR: Cannot load mkl\_intel\_thread.dll](https://stackoverflow.com/questions/57493584/cx-freeze-unable-fo-find-mkl-mkl-fatal-error-cannot-load-mkl-intel-thread-dll)
But now I have a subtle difference. I want to run the program without i... | 2019/08/20 | [
"https://Stackoverflow.com/questions/57567892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1612432/"
] | Maybe another DLL necessary for MKL, such as `libiomp5md.dll` for example, is missing and causes the error. See [Cannot load mkl\_intel\_thread.dll on python executable](https://stackoverflow.com/q/54337644/8516269), my answer there and its comments.
If this still does not solve your problem, try to manually copy othe... | As per <https://stackoverflow.com/a/56186333/977566> I renamed c:\windows\system32\libiomp5md.dll to .bak and that fixed it for me. |
57,567,892 | Previously I asked a similar question: [cx\_Freeze unable fo find mkl: MKL FATAL ERROR: Cannot load mkl\_intel\_thread.dll](https://stackoverflow.com/questions/57493584/cx-freeze-unable-fo-find-mkl-mkl-fatal-error-cannot-load-mkl-intel-thread-dll)
But now I have a subtle difference. I want to run the program without i... | 2019/08/20 | [
"https://Stackoverflow.com/questions/57567892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1612432/"
] | Maybe another DLL necessary for MKL, such as `libiomp5md.dll` for example, is missing and causes the error. See [Cannot load mkl\_intel\_thread.dll on python executable](https://stackoverflow.com/q/54337644/8516269), my answer there and its comments.
If this still does not solve your problem, try to manually copy othe... | For this, it is enough to get the full version of visual c++ program and delete anaconda and folders related to anaconda such as `.anaconda` or `.conda` or `.matplotlib` or `AppData/anaconda` and ... and then install it again
Of course, don't forget that all Intel services must be active
<https://learn.microsoft.... |
57,567,892 | Previously I asked a similar question: [cx\_Freeze unable fo find mkl: MKL FATAL ERROR: Cannot load mkl\_intel\_thread.dll](https://stackoverflow.com/questions/57493584/cx-freeze-unable-fo-find-mkl-mkl-fatal-error-cannot-load-mkl-intel-thread-dll)
But now I have a subtle difference. I want to run the program without i... | 2019/08/20 | [
"https://Stackoverflow.com/questions/57567892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1612432/"
] | Recently I faced the same error in python3.7 . I did not have the option of moving Dll, I Solved the problem by just doing.
```
conda install cython
```
After the cython install all dll's were in proper place. | >
> set CONDA\_DLL\_SEARCH\_MODIFICATION\_ENABLE=1;
>
>
>
will solve all your problems |
57,567,892 | Previously I asked a similar question: [cx\_Freeze unable fo find mkl: MKL FATAL ERROR: Cannot load mkl\_intel\_thread.dll](https://stackoverflow.com/questions/57493584/cx-freeze-unable-fo-find-mkl-mkl-fatal-error-cannot-load-mkl-intel-thread-dll)
But now I have a subtle difference. I want to run the program without i... | 2019/08/20 | [
"https://Stackoverflow.com/questions/57567892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1612432/"
] | Recently I faced the same error in python3.7 . I did not have the option of moving Dll, I Solved the problem by just doing.
```
conda install cython
```
After the cython install all dll's were in proper place. | For this, it is enough to get the full version of visual c++ program and delete anaconda and folders related to anaconda such as `.anaconda` or `.conda` or `.matplotlib` or `AppData/anaconda` and ... and then install it again
Of course, don't forget that all Intel services must be active
<https://learn.microsoft.... |
57,567,892 | Previously I asked a similar question: [cx\_Freeze unable fo find mkl: MKL FATAL ERROR: Cannot load mkl\_intel\_thread.dll](https://stackoverflow.com/questions/57493584/cx-freeze-unable-fo-find-mkl-mkl-fatal-error-cannot-load-mkl-intel-thread-dll)
But now I have a subtle difference. I want to run the program without i... | 2019/08/20 | [
"https://Stackoverflow.com/questions/57567892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1612432/"
] | As per <https://stackoverflow.com/a/56186333/977566> I renamed c:\windows\system32\libiomp5md.dll to .bak and that fixed it for me. | >
> set CONDA\_DLL\_SEARCH\_MODIFICATION\_ENABLE=1;
>
>
>
will solve all your problems |
57,567,892 | Previously I asked a similar question: [cx\_Freeze unable fo find mkl: MKL FATAL ERROR: Cannot load mkl\_intel\_thread.dll](https://stackoverflow.com/questions/57493584/cx-freeze-unable-fo-find-mkl-mkl-fatal-error-cannot-load-mkl-intel-thread-dll)
But now I have a subtle difference. I want to run the program without i... | 2019/08/20 | [
"https://Stackoverflow.com/questions/57567892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1612432/"
] | As per <https://stackoverflow.com/a/56186333/977566> I renamed c:\windows\system32\libiomp5md.dll to .bak and that fixed it for me. | For this, it is enough to get the full version of visual c++ program and delete anaconda and folders related to anaconda such as `.anaconda` or `.conda` or `.matplotlib` or `AppData/anaconda` and ... and then install it again
Of course, don't forget that all Intel services must be active
<https://learn.microsoft.... |
62,501,832 | I was using following code to download the NSE stock data(indian stocks) :
```
from alpha_vantage.timeseries import TimeSeries
ts = TimeSeries(key='my api key',output_format='pandas')
data, meta_data = ts.get_daily_adjusted(symbol='VEDL.NS', outputsize='full')
data.to_csv('/content/gdrive/My Drive/ColabNotebooks/NSE... | 2020/06/21 | [
"https://Stackoverflow.com/questions/62501832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13787047/"
] | there are several ways to do this, and the one I will offer are not the best or the nicest ones, but hope that they will help
**1) Simply write all your data to table**
You can just insert all your data to the table setting the [ConflictAlgorithm](https://pub.dev/documentation/sqflite_common/latest/sql/ConflictAlgori... | WHAT ABOUT Read Data from Sqflite and Show in datatable? |
39,067,203 | This seems to work fine -
```
%time a = "abc"
print(a)
CPU times: user 0 ns, sys: 0 ns, total: 0 ns
Wall time: 19.1 µs
abc
```
This doesn't -
```
def func():
%time b = "abc"
print(b)
func()
CPU times: user 0 ns, sys: 0 ns, total: 0 ns
Wall time: 31 µs
---------------------------------------------------... | 2016/08/21 | [
"https://Stackoverflow.com/questions/39067203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1500929/"
] | POST data is given in a protected Map getParams () and not the URL:
```
@Override
protected Map<String,String> getParams(){
Map<String,String> params = new HashMap<String, String>();
params.put("parametr1","value1");
params.put("parametr2","value2");
params.put("parametr3","value3");
return params;... | You want to parse a array into a boolean, you have to loop through the array like this:
```
JSONObject jsonObject = new JSONObject(response);
JSONArray jsonArray= jsonObject.getJSONArray("example");
if (jsonArray.length() != 0) {
... |
70,582,851 | I'm trying to create a webscraping Flask app that creates a new Webdriver instance for each user session, so that different users can scrape content from different pages. This would be simpler if the `driver.get()` and data collection happened in the same API call, but they can't due to the nature of the scraping I'll ... | 2022/01/04 | [
"https://Stackoverflow.com/questions/70582851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13592179/"
] | I advise you to follow many good techniques when developing a responsive webpage, here I explain to you:
* **Replacing in your CSS absolute units such as px for percentages or em**. It is always much better to work with relative measurements rather than absolute ones. From my experience, I always try to work with em, ... | This is a common problem I would advise that you read up on what `viewports` are on [w3schools.com](https://www.w3schools.com/css/css_rwd_viewport.asp).
A viewport is basically the visible area on a user’s device.
As we both know, the visible area of a desktop is different from that of a notebook, tablet, and mobile ... |
70,582,851 | I'm trying to create a webscraping Flask app that creates a new Webdriver instance for each user session, so that different users can scrape content from different pages. This would be simpler if the `driver.get()` and data collection happened in the same API call, but they can't due to the nature of the scraping I'll ... | 2022/01/04 | [
"https://Stackoverflow.com/questions/70582851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13592179/"
] | I advise you to follow many good techniques when developing a responsive webpage, here I explain to you:
* **Replacing in your CSS absolute units such as px for percentages or em**. It is always much better to work with relative measurements rather than absolute ones. From my experience, I always try to work with em, ... | I refactored all your code to be Responsive! with **CSS grid** and **flexbox**
not only CSS but also HTML to be `semantic`, easy to read...
---
the GitHub repo: <https://github.com/Laaouatni/stackoverflow-my-answers/tree/main/79>
---
try to see the @diego answer then copy this :)
I hope it will help you
**here t... |
70,582,851 | I'm trying to create a webscraping Flask app that creates a new Webdriver instance for each user session, so that different users can scrape content from different pages. This would be simpler if the `driver.get()` and data collection happened in the same API call, but they can't due to the nature of the scraping I'll ... | 2022/01/04 | [
"https://Stackoverflow.com/questions/70582851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13592179/"
] | I refactored all your code to be Responsive! with **CSS grid** and **flexbox**
not only CSS but also HTML to be `semantic`, easy to read...
---
the GitHub repo: <https://github.com/Laaouatni/stackoverflow-my-answers/tree/main/79>
---
try to see the @diego answer then copy this :)
I hope it will help you
**here t... | This is a common problem I would advise that you read up on what `viewports` are on [w3schools.com](https://www.w3schools.com/css/css_rwd_viewport.asp).
A viewport is basically the visible area on a user’s device.
As we both know, the visible area of a desktop is different from that of a notebook, tablet, and mobile ... |
15,572,171 | The python syntax of `for x in y:` to iterate over a list must somehow remember what element the pointer is at currently right? How would we access that value as I am trying to solve this without resorting to `for index, x in enumerate(y):`
The technical reason why I want to do this is that I assume that `enumerate()`... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15572171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1093485/"
] | You cannot. `for` uses the [Python iteration protocol](http://docs.python.org/2/glossary.html#term-iterator), which for lists means it'll create a *private* iterator object. That object keeps track of the position in the list.
Even if you were to create the iterator explicitly with [`iter()`](http://docs.python.org/2/... | No, it uses the underlying **iterator**, which is not forced to keep track of a current index.
Unless you manually incerement a counter, this is not possible:
```
idx = 0
for x in y:
idx+=1
# ...
```
so, just keep with `enumerate()` |
15,572,171 | The python syntax of `for x in y:` to iterate over a list must somehow remember what element the pointer is at currently right? How would we access that value as I am trying to solve this without resorting to `for index, x in enumerate(y):`
The technical reason why I want to do this is that I assume that `enumerate()`... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15572171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1093485/"
] | You cannot. `for` uses the [Python iteration protocol](http://docs.python.org/2/glossary.html#term-iterator), which for lists means it'll create a *private* iterator object. That object keeps track of the position in the list.
Even if you were to create the iterator explicitly with [`iter()`](http://docs.python.org/2/... | That 'pointer' value is internal to whatever it is that created the iterator. Remember that is doesn't need to be a list (something that can be indexed), so if you really want the 'index', you will need to resort to using enumerate. |
15,572,171 | The python syntax of `for x in y:` to iterate over a list must somehow remember what element the pointer is at currently right? How would we access that value as I am trying to solve this without resorting to `for index, x in enumerate(y):`
The technical reason why I want to do this is that I assume that `enumerate()`... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15572171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1093485/"
] | You cannot. `for` uses the [Python iteration protocol](http://docs.python.org/2/glossary.html#term-iterator), which for lists means it'll create a *private* iterator object. That object keeps track of the position in the list.
Even if you were to create the iterator explicitly with [`iter()`](http://docs.python.org/2/... | This information is internal to the iterator and cannot be accessed. See here for a description of the [iterator protocol](http://docs.python.org/2/library/stdtypes.html). Essentially, the only publicly available member of the iterator is `next()` which raises a `StopIteration` exception once the range is exhausted.
B... |
52,729,841 | I have only very rudimentary experience in Python. I am trying to install the package `pyslim` (see [here on the pypi website](https://pypi.org/project/pyslim/)). I did
```
$ pip install pyslim
Requirement already satisfied: pyslim in ./Library/Python/2.7/lib/python/site-packages/pyslim-0.1-py2.7.egg (0.1)
Requiremen... | 2018/10/09 | [
"https://Stackoverflow.com/questions/52729841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2051137/"
] | Take a look to [this other question](https://stackoverflow.com/questions/49228744/attributeerror-module-attr-has-no-attribute-s) that is related to the `attrs` package.
In your case, you have `attr` and `attrs` installed at the same time, and they are incompatible between them, so python is unable to resolve the packa... | First uninstall pyslim. Use "pip uninstall pyslim". Then try installing again using
"conda install -c conda-forge pyslim"
Refer <https://anaconda.org/conda-forge/pyslim> |
1,075,905 | My first attempt at jython is a java/jython project I'm writing in eclipse with pydev.
I created a java project and then made it a pydev project by the RightClick project >> pydev >> set as... you get the idea. I then added two source folders, one for java and one for jython, and each source folder has a package. And ... | 2009/07/02 | [
"https://Stackoverflow.com/questions/1075905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/125946/"
] | Jythonc doesn't exist anymore, it has been forked off to another project called [Clamp](http://github.com/groves/clamp/), but with that said...
>
> ...you can pre-compile
> your python scripts to .class files
> using:
>
>
> jython [jython home]/Lib/compileall.py
> [the directory where you keep your
> python cod... | Following the "Accessing Jython from Java Without Using jythonc" tutorial it became possible to use the jython modules inside java code. The only tricky point is that the \*.py modules do not get compiled to \*.class files. So it turns out to be exotic scripting inside java. The performance may of course degrade vs jyt... |
68,654,385 | This is my code to read the LDS sensor. LDS sensor is used to estimate the distance from robot to walls. I can print the data(estimate distance) in the terminal but I cant write it in the csv file automatically. I would like to write about 1000 data into csv file by using python code [enter image description here](http... | 2021/08/04 | [
"https://Stackoverflow.com/questions/68654385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16594158/"
] | Outputting a topic formatted as csv is built into `rostopic echo`, the -p flag [rostopic\_echo](http://wiki.ros.org/rostopic#rostopic_echo). You can redirect the terminal output to a file instead of the terminal with `>`
So to save `/scan` to csv you could just run the following in a terminal:
```
rostopic echo -p /s... | In a more classic ROS style, do all your setup in the "main" function, have global variables for either the returned values of callbacks or for initialized parameters, and do the processing for all your received msgs in your callbacks or timers.
```py
#! /usr/bin/env python
# lds_to_csv_node.py
import rospy
import cs... |
17,891,704 | What does the [None] do in this code?
```
public class Example { //Java
public Example (int _input, int _outputs){ //Java
scratch = [None] * (_input + _outputs); //Python Code
```
I'm porting a python implementation into Java and need to better understand what this means.... | 2013/07/26 | [
"https://Stackoverflow.com/questions/17891704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2624276/"
] | ```
scratch = [None] * (_input + _outputs)
```
This makes a list of length `_input + _outputs`. Each element in this list is a `None` object.
This list is assigned to a variable, named `scratch` | ```
[value] * number
```
means list of `number` elements, each of them is `value`.
So your code means list of `(_input + _outputs)` `None`'s
`null` is closest thing to Python's `None` I know. |
17,891,704 | What does the [None] do in this code?
```
public class Example { //Java
public Example (int _input, int _outputs){ //Java
scratch = [None] * (_input + _outputs); //Python Code
```
I'm porting a python implementation into Java and need to better understand what this means.... | 2013/07/26 | [
"https://Stackoverflow.com/questions/17891704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2624276/"
] | `[None]` is a list containing one element, the singleton `None`, which is commonly used to represent "no value" in Python. This list is being multiplied by the sum of the number of inputs and outputs. The resulting list will have as many references to `None` as there are inputs and outputs. | ```
[value] * number
```
means list of `number` elements, each of them is `value`.
So your code means list of `(_input + _outputs)` `None`'s
`null` is closest thing to Python's `None` I know. |
3,330,280 | I'm weaving my c code in python to speed up the loop:
```
from scipy import weave
from numpy import *
#1) create the array
a=zeros((200,300,400),int)
for i in range(200):
for j in range(300):
for k in range(400):
a[i,j,k]=i*300*400+j*400+k
#2) test on c code to access the array
code="""
fo... | 2010/07/25 | [
"https://Stackoverflow.com/questions/3330280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/389799/"
] | You could replace the 3 for-loops with
```
grid=np.ogrid[0:200,0:300,0:400]
a=grid[0]*300*400+grid[1]*400+grid[2]
```
The following suggests this may result in a ~68x (or better? see below) speedup:
```
% python -mtimeit -s"import test" "test.m1()"
100 loops, best of 3: 17.5 msec per loop
% python -mtimeit -s"impor... | The problem is that you are printing out 2.4 million numbers to the screen in your C code. This is of course going to take a while because the numbers have to be converted into strings and then printed to the screen. Do you really need to print them all to the screen? What is your end goal here?
For a comparison, I tr... |
3,330,280 | I'm weaving my c code in python to speed up the loop:
```
from scipy import weave
from numpy import *
#1) create the array
a=zeros((200,300,400),int)
for i in range(200):
for j in range(300):
for k in range(400):
a[i,j,k]=i*300*400+j*400+k
#2) test on c code to access the array
code="""
fo... | 2010/07/25 | [
"https://Stackoverflow.com/questions/3330280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/389799/"
] | You could replace the 3 for-loops with
```
grid=np.ogrid[0:200,0:300,0:400]
a=grid[0]*300*400+grid[1]*400+grid[2]
```
The following suggests this may result in a ~68x (or better? see below) speedup:
```
% python -mtimeit -s"import test" "test.m1()"
100 loops, best of 3: 17.5 msec per loop
% python -mtimeit -s"impor... | There is no way to speed up accessing a multidimensional array in C. You have to calculate the array index and you have to dereference it, this is as simple as it gets. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.