qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
995,077
DP1 displaying correctly: [![DP1 displaying correctly](https://i.stack.imgur.com/5ir7P.png)](https://i.stack.imgur.com/5ir7P.png) eDP1 with corrupt display: [![eDP1 with corrupt display](https://i.stack.imgur.com/VS9aR.png)](https://i.stack.imgur.com/VS9aR.png) My new machine has two monitors connected directly to ...
2018/01/12
[ "https://askubuntu.com/questions/995077", "https://askubuntu.com", "https://askubuntu.com/users/10055/" ]
Try this: ``` mysqldump -u root -p --all-databases | zip /var/www/html/db-$(date +\%F-\%T).zip ``` You will only have one file into the zip archive having **-** as file name.
The other two answers have already stated the following solution (so consider this an extension of the other two answers): ``` mysqldump -u root -p --all-databases | zip /var/www/html/db-$(date +\%F-\%T).zip - ``` This is good, but this works only on stdin/stdout. This means that the file will be stored as `-` insid...
995,077
DP1 displaying correctly: [![DP1 displaying correctly](https://i.stack.imgur.com/5ir7P.png)](https://i.stack.imgur.com/5ir7P.png) eDP1 with corrupt display: [![eDP1 with corrupt display](https://i.stack.imgur.com/VS9aR.png)](https://i.stack.imgur.com/VS9aR.png) My new machine has two monitors connected directly to ...
2018/01/12
[ "https://askubuntu.com/questions/995077", "https://askubuntu.com", "https://askubuntu.com/users/10055/" ]
Try this: ``` mysqldump -u root -p --all-databases | zip /var/www/html/db-$(date +\%F-\%T).zip ``` You will only have one file into the zip archive having **-** as file name.
For Ubuntu20 ">" sign was needed between zip and /var.. ``` mysqldump -u root -p --all-databases | zip > /var/www/html/db-$(date +\%F_%H-%M-%S).zip ```
995,077
DP1 displaying correctly: [![DP1 displaying correctly](https://i.stack.imgur.com/5ir7P.png)](https://i.stack.imgur.com/5ir7P.png) eDP1 with corrupt display: [![eDP1 with corrupt display](https://i.stack.imgur.com/VS9aR.png)](https://i.stack.imgur.com/VS9aR.png) My new machine has two monitors connected directly to ...
2018/01/12
[ "https://askubuntu.com/questions/995077", "https://askubuntu.com", "https://askubuntu.com/users/10055/" ]
The other two answers have already stated the following solution (so consider this an extension of the other two answers): ``` mysqldump -u root -p --all-databases | zip /var/www/html/db-$(date +\%F-\%T).zip - ``` This is good, but this works only on stdin/stdout. This means that the file will be stored as `-` insid...
You can try this ``` mysqldump -u root -p --all-databases | zip /var/www/html/db-$(date +\%F-\%T).zip - ```
995,077
DP1 displaying correctly: [![DP1 displaying correctly](https://i.stack.imgur.com/5ir7P.png)](https://i.stack.imgur.com/5ir7P.png) eDP1 with corrupt display: [![eDP1 with corrupt display](https://i.stack.imgur.com/VS9aR.png)](https://i.stack.imgur.com/VS9aR.png) My new machine has two monitors connected directly to ...
2018/01/12
[ "https://askubuntu.com/questions/995077", "https://askubuntu.com", "https://askubuntu.com/users/10055/" ]
You can try this ``` mysqldump -u root -p --all-databases | zip /var/www/html/db-$(date +\%F-\%T).zip - ```
For Ubuntu20 ">" sign was needed between zip and /var.. ``` mysqldump -u root -p --all-databases | zip > /var/www/html/db-$(date +\%F_%H-%M-%S).zip ```
995,077
DP1 displaying correctly: [![DP1 displaying correctly](https://i.stack.imgur.com/5ir7P.png)](https://i.stack.imgur.com/5ir7P.png) eDP1 with corrupt display: [![eDP1 with corrupt display](https://i.stack.imgur.com/VS9aR.png)](https://i.stack.imgur.com/VS9aR.png) My new machine has two monitors connected directly to ...
2018/01/12
[ "https://askubuntu.com/questions/995077", "https://askubuntu.com", "https://askubuntu.com/users/10055/" ]
The other two answers have already stated the following solution (so consider this an extension of the other two answers): ``` mysqldump -u root -p --all-databases | zip /var/www/html/db-$(date +\%F-\%T).zip - ``` This is good, but this works only on stdin/stdout. This means that the file will be stored as `-` insid...
For Ubuntu20 ">" sign was needed between zip and /var.. ``` mysqldump -u root -p --all-databases | zip > /var/www/html/db-$(date +\%F_%H-%M-%S).zip ```
70,078,534
I have 4 Google compute engine instances and I want to add port 5078 to my instances. I think I need to add some firewall rules. I tried to that but I can't see my port 5078 in my instance. can anyone tell me how to do that?
2021/11/23
[ "https://Stackoverflow.com/questions/70078534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17476888/" ]
1. Open your console and select your project in which you want to open a port. 2. Go to VPC networking and open a firewall from the list. 3. Click on create firewall rule and give a unique name and don’t change any default values. 4. In the targets section select “specific target tags” and in the next column specify th...
You need to create firewall rule allowing ingress on the port 5078. Follow below instructions : 1. Navigate to the Networking > VPC network. 2. Select Firewall. 3. Click on Create Firewall Rule. 4. Provide a unique name and description. 5. Then select Ingress and allow it. 6. In order to apply this rule to specific V...
3,376,512
I'm trying to map some structs to some other instances, like this: ``` template <typename T> class Component { public: typedef std::map<EntityID, T> instances_map; instances_map instances; Component() {}; T add(EntityID id) { T* t = new T(); instances[id] = *t; return *t; ...
2010/07/31
[ "https://Stackoverflow.com/questions/3376512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/138352/" ]
Clarify the operations you want to perform on LogicComponent. Assuming you are trying to achieve something like this: Step 1: Add a new entry to the map: ``` LogicComponent comp; EntityID id = 99; UnitInfos info = comp.add(id); ``` Step 2: Initialize the info: ``` info.x = 10.0; info.y = 11.0 // etc ``` Step 3...
might be that ``` T add(EntityID id) { T* t = new T(); instances[id] = *t; return *t; // return value and map instance are not the same anymore }; ``` should be ``` T& add(EntityID id) { instances[id] = T(); return instances[id]; }; ```
3,376,512
I'm trying to map some structs to some other instances, like this: ``` template <typename T> class Component { public: typedef std::map<EntityID, T> instances_map; instances_map instances; Component() {}; T add(EntityID id) { T* t = new T(); instances[id] = *t; return *t; ...
2010/07/31
[ "https://Stackoverflow.com/questions/3376512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/138352/" ]
Clarify the operations you want to perform on LogicComponent. Assuming you are trying to achieve something like this: Step 1: Add a new entry to the map: ``` LogicComponent comp; EntityID id = 99; UnitInfos info = comp.add(id); ``` Step 2: Initialize the info: ``` info.x = 10.0; info.y = 11.0 // etc ``` Step 3...
It sounds like you defined your indexing operator as: ``` template <typename T> T& Component::operator[]( EntityID id ) { return instances[id]; } ``` Or something like that. The likely unexpected effect of this is that it will automatically insert default-constructed instance of `T` into the map and then return...
4,076,968
I need help. I have a sql table t2 related to two other tables t1 and t3. t2 has fields: ``` idFromt3 idFromt1 Value 1 14 text1 2 14 text2 1 44 text1 2 44 text2 3 44 text3 ``` I'm searching for values, where ifFromt3 is missing. I want to fint...
2010/11/02
[ "https://Stackoverflow.com/questions/4076968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/492873/" ]
``` SELECT * FROM t2 WHERE t2.idFromt3 NOT IN ( SELECT LanguageMessageCodeID FROM t3 ) ``` or ``` SELECT * FROM t2 WHERE NOT EXISTS ( SELECT NULL FROM t3 WHERE t3.LanguageMessageCodeID = t2.id ) ``` or ``` SELECT t2.* ...
You need to use a [`LEFT OUTER JOIN`](http://en.wikipedia.org/wiki/Join_%28SQL%29#Outer_joins)s if you want to find rows that **do not** exist in the join table. An outer join will result in all rows of the left table, whether there is a match on the right one or not. In order to filter by those that do not exist, yo...
4,076,968
I need help. I have a sql table t2 related to two other tables t1 and t3. t2 has fields: ``` idFromt3 idFromt1 Value 1 14 text1 2 14 text2 1 44 text1 2 44 text2 3 44 text3 ``` I'm searching for values, where ifFromt3 is missing. I want to fint...
2010/11/02
[ "https://Stackoverflow.com/questions/4076968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/492873/" ]
You need to use a [`LEFT OUTER JOIN`](http://en.wikipedia.org/wiki/Join_%28SQL%29#Outer_joins)s if you want to find rows that **do not** exist in the join table. An outer join will result in all rows of the left table, whether there is a match on the right one or not. In order to filter by those that do not exist, yo...
Solved this issue by going this approach: ``` WITH Nums AS ( SELECT 1 AS Number UNION ALL SELECT Number + 1 FROM Nums WHERE Number < 99 --- Max number for Transactions it will count up to ), AccountLog (Account, TransNumber, NextTransNumber) AS ( SELECT ...
4,076,968
I need help. I have a sql table t2 related to two other tables t1 and t3. t2 has fields: ``` idFromt3 idFromt1 Value 1 14 text1 2 14 text2 1 44 text1 2 44 text2 3 44 text3 ``` I'm searching for values, where ifFromt3 is missing. I want to fint...
2010/11/02
[ "https://Stackoverflow.com/questions/4076968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/492873/" ]
``` SELECT * FROM t2 WHERE t2.idFromt3 NOT IN ( SELECT LanguageMessageCodeID FROM t3 ) ``` or ``` SELECT * FROM t2 WHERE NOT EXISTS ( SELECT NULL FROM t3 WHERE t3.LanguageMessageCodeID = t2.id ) ``` or ``` SELECT t2.* ...
Solved this issue by going this approach: ``` WITH Nums AS ( SELECT 1 AS Number UNION ALL SELECT Number + 1 FROM Nums WHERE Number < 99 --- Max number for Transactions it will count up to ), AccountLog (Account, TransNumber, NextTransNumber) AS ( SELECT ...
33,089
I'm using the [ASP.NET Login Controls](http://msdn.microsoft.com/en-us/library/ms178329.aspx) and [Forms Authentication](http://msdn.microsoft.com/en-us/library/aa480476.aspx) for membership/credentials for an ASP.NET web application. It keeps redirecting to a Login.aspx page at the root of my application that does not...
2008/08/28
[ "https://Stackoverflow.com/questions/33089", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
Use the LoginUrl property for the forms item? ``` <authentication mode="Forms"> <forms defaultUrl="~/Default.aspx" loginUrl="~/login.aspx" timeout="1440" ></forms> </authentication> ```
I found the answer at [CoderSource.net](http://www.codersource.net/asp_net_forms_authentication.aspx). I had to put the correct path into my web.config file. ``` <?xml version="1.0"?> <configuration> <system.web> ... <!-- The <authentication> section enables configuration o...
62,190
I have 2 samples, which I got by conducting a 5-point Likert scale survey. I have 9 results for group A and 17 results for group B for 12 variables. I would like to test now if the groups differ significantly in one or more of these variables and chose to employ the t-test. Assumptions for the t-test are 1. Interval sc...
2013/06/20
[ "https://stats.stackexchange.com/questions/62190", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/27110/" ]
Consider the Gaussian (normal) cumulative distribution function $\Phi(y)$ and the empirical cumulative distribution function $F\_{n}(y)$. For optimality (control of type I error and low type II error) the two-sample $t$-test assumes that $\Phi^{-1}(F\_{n}(y))$ when stratified by group yields two straight parallel lines...
On the shape assumption for the Mann-Whitney test: For the usual null hypothesis for the Mann-Whitney test --- that of stochastic equality --- there is no assumption about the shape of the distribution. Such an assumption comes in to play only when one is trying to test a hypothesis about the median. For reference a...
11,275,473
Say I want to write a function like this: ``` int get_some_int(string index) { ...perform magic... return result; } ``` However, I also want to be able to call it like this: ``` int var = obj.get_some_int("blah"); ``` However, I can't do this as `const char[4]` is not `const string&` I could do: ``` int...
2012/06/30
[ "https://Stackoverflow.com/questions/11275473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/867814/" ]
> > I can't do this as const char[4] is not const string& > > > No, but `std::string` has a non-`explicit` conversion constructor so a temporary `std::string` is created, so you're in the clear. - <http://ideone.com/xlg4k>
Do a: int var = obj.get\_some\_int(string("blah")); if you feel more comfortable with it.
11,275,473
Say I want to write a function like this: ``` int get_some_int(string index) { ...perform magic... return result; } ``` However, I also want to be able to call it like this: ``` int var = obj.get_some_int("blah"); ``` However, I can't do this as `const char[4]` is not `const string&` I could do: ``` int...
2012/06/30
[ "https://Stackoverflow.com/questions/11275473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/867814/" ]
> > I can't do this as const char[4] is not const string& > > > No, but `std::string` has a non-`explicit` conversion constructor so a temporary `std::string` is created, so you're in the clear. - <http://ideone.com/xlg4k>
It should work as you have done ``` int get_some_int(string index) { // This works as std::string has a constructor // That takes care of the conversion // from `char const*` which you char[4] //decays into when pa...
11,275,473
Say I want to write a function like this: ``` int get_some_int(string index) { ...perform magic... return result; } ``` However, I also want to be able to call it like this: ``` int var = obj.get_some_int("blah"); ``` However, I can't do this as `const char[4]` is not `const string&` I could do: ``` int...
2012/06/30
[ "https://Stackoverflow.com/questions/11275473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/867814/" ]
It should work as you have done ``` int get_some_int(string index) { // This works as std::string has a constructor // That takes care of the conversion // from `char const*` which you char[4] //decays into when pa...
Do a: int var = obj.get\_some\_int(string("blah")); if you feel more comfortable with it.
47,075,661
I installed ExtReact, with examples. When I run ``` npm start ``` I get an error: ``` ERROR in [@extjs/reactor-webpack-plugin]: Error: [ERR] BUILD FAILED [ERR] com.sencha.exceptions.BasicException: User limit of inotify watches reached [ERR] [ERR] Total time: 13 seconds [ERR] /home/user/project/build/ext-react/b...
2017/11/02
[ "https://Stackoverflow.com/questions/47075661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7194186/" ]
**Why?** Programs that sync files such as dropbox, git etc use inotify to notice changes to the file system. The limit can be see by - ``` cat /proc/sys/fs/inotify/max_user_watches ``` For me, it shows **100000**. When this limit is not enough to monitor all files inside a directory it throws this error. --- **In...
I solved this problem by editing `/etc/sysctl.conf`. To the file I added ``` fs.inotify.max_user_watches=100000 ```
47,075,661
I installed ExtReact, with examples. When I run ``` npm start ``` I get an error: ``` ERROR in [@extjs/reactor-webpack-plugin]: Error: [ERR] BUILD FAILED [ERR] com.sencha.exceptions.BasicException: User limit of inotify watches reached [ERR] [ERR] Total time: 13 seconds [ERR] /home/user/project/build/ext-react/b...
2017/11/02
[ "https://Stackoverflow.com/questions/47075661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7194186/" ]
I solved this problem by editing `/etc/sysctl.conf`. To the file I added ``` fs.inotify.max_user_watches=100000 ```
Increase watches * `cat /proc/sys/fs/inotify/max_user_watches` * `sudo vim /etc/sysctl.conf` * adding this line to the end of the file: ``` fs.inotify.max_user_watches=524288 ``` * `sudo sysctl -p` * `echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p` Else visit <https://githu...
47,075,661
I installed ExtReact, with examples. When I run ``` npm start ``` I get an error: ``` ERROR in [@extjs/reactor-webpack-plugin]: Error: [ERR] BUILD FAILED [ERR] com.sencha.exceptions.BasicException: User limit of inotify watches reached [ERR] [ERR] Total time: 13 seconds [ERR] /home/user/project/build/ext-react/b...
2017/11/02
[ "https://Stackoverflow.com/questions/47075661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7194186/" ]
I solved this problem by editing `/etc/sysctl.conf`. To the file I added ``` fs.inotify.max_user_watches=100000 ```
On Linux mint, Run this command and you are good to go ``` echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system ```
47,075,661
I installed ExtReact, with examples. When I run ``` npm start ``` I get an error: ``` ERROR in [@extjs/reactor-webpack-plugin]: Error: [ERR] BUILD FAILED [ERR] com.sencha.exceptions.BasicException: User limit of inotify watches reached [ERR] [ERR] Total time: 13 seconds [ERR] /home/user/project/build/ext-react/b...
2017/11/02
[ "https://Stackoverflow.com/questions/47075661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7194186/" ]
**Why?** Programs that sync files such as dropbox, git etc use inotify to notice changes to the file system. The limit can be see by - ``` cat /proc/sys/fs/inotify/max_user_watches ``` For me, it shows **100000**. When this limit is not enough to monitor all files inside a directory it throws this error. --- **In...
Increase watches * `cat /proc/sys/fs/inotify/max_user_watches` * `sudo vim /etc/sysctl.conf` * adding this line to the end of the file: ``` fs.inotify.max_user_watches=524288 ``` * `sudo sysctl -p` * `echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p` Else visit <https://githu...
47,075,661
I installed ExtReact, with examples. When I run ``` npm start ``` I get an error: ``` ERROR in [@extjs/reactor-webpack-plugin]: Error: [ERR] BUILD FAILED [ERR] com.sencha.exceptions.BasicException: User limit of inotify watches reached [ERR] [ERR] Total time: 13 seconds [ERR] /home/user/project/build/ext-react/b...
2017/11/02
[ "https://Stackoverflow.com/questions/47075661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7194186/" ]
**Why?** Programs that sync files such as dropbox, git etc use inotify to notice changes to the file system. The limit can be see by - ``` cat /proc/sys/fs/inotify/max_user_watches ``` For me, it shows **100000**. When this limit is not enough to monitor all files inside a directory it throws this error. --- **In...
On Linux mint, Run this command and you are good to go ``` echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system ```
1,557,771
This morning, my friends and I discussed following problem. **Problem**: There are two persons named Mr. A and Mr. B. Each person has his own urn containing $N$ different balls. They uniformly randomly draw a ball twice with replacement from their own urns. What is the probability that they draw the same pair of ba...
2015/12/03
[ "https://math.stackexchange.com/questions/1557771", "https://math.stackexchange.com", "https://math.stackexchange.com/users/271926/" ]
OPs second answer is correct. We denote with $[N]:=\{1,2,3,\ldots,N\}$ and consider all $N^4$ tuples in \begin{align\*} \mathcal{A}=\{((A\_1,B\_1),(A\_2,B\_2))|A\_j,B\_j\in[N],j=1,2\} \end{align\*} We denote with $E(A\_j=B\_k), 1\leq j,k\leq 2$ the event that balls $A\_j$ and $B\_k$ are drawn and are equal. > > ...
There are $\binom{N}{2}$ pairs. There is 1 way to order the match. The probability of getting a match for a particular pair is $(1/\binom{N}{2})^2$. Thus, $$P(\text{Match}) = 1\cdot\binom{N}{2}\frac{1}{\binom{N}{2}}\frac{1}{\binom{N}{2}} = \frac{1}{\binom{N}{2}}.$$
1,557,771
This morning, my friends and I discussed following problem. **Problem**: There are two persons named Mr. A and Mr. B. Each person has his own urn containing $N$ different balls. They uniformly randomly draw a ball twice with replacement from their own urns. What is the probability that they draw the same pair of ba...
2015/12/03
[ "https://math.stackexchange.com/questions/1557771", "https://math.stackexchange.com", "https://math.stackexchange.com/users/271926/" ]
OPs second answer is correct. We denote with $[N]:=\{1,2,3,\ldots,N\}$ and consider all $N^4$ tuples in \begin{align\*} \mathcal{A}=\{((A\_1,B\_1),(A\_2,B\_2))|A\_j,B\_j\in[N],j=1,2\} \end{align\*} We denote with $E(A\_j=B\_k), 1\leq j,k\leq 2$ the event that balls $A\_j$ and $B\_k$ are drawn and are equal. > > ...
I think the answer should be $\frac{2}{N^2}$ because the probability that they draw balls in the same order is $\frac{1}{N^2}$ and I do not see why it'd be different for the cross-ordered case as we can swap the order of drawing without any affect to the outcome. And as they're independent cases, we can say that the ch...
23,896,625
I am downloading several different data sets and would like each file (or set) to download to a specific folder. I have learned how to change the download directories at these page: [setting Chrome preferences w/ Selenium Webdriver in Python](https://stackoverflow.com/questions/18026391/setting-chrome-preferences-w-s...
2014/05/27
[ "https://Stackoverflow.com/questions/23896625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1920550/" ]
In the past, I have solved this by downloading to a temp folder and then renaming the file to the appropriate folder with something along the line of this: ``` def move_to_download_folder(downloadPath, newFileName, fileExtension): got_file = False ## Grab current file name. while got_file = False: ...
I used the chromeOptions Experimental method. ``` ##set download directory chromeOptions = webdriver.ChromeOptions() prefs = {"download.default_directory": "your directory path"} chromeOptions.add_experimental_option("prefs", prefs) driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver', chrome_options=chr...
23,896,625
I am downloading several different data sets and would like each file (or set) to download to a specific folder. I have learned how to change the download directories at these page: [setting Chrome preferences w/ Selenium Webdriver in Python](https://stackoverflow.com/questions/18026391/setting-chrome-preferences-w-s...
2014/05/27
[ "https://Stackoverflow.com/questions/23896625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1920550/" ]
In the past, I have solved this by downloading to a temp folder and then renaming the file to the appropriate folder with something along the line of this: ``` def move_to_download_folder(downloadPath, newFileName, fileExtension): got_file = False ## Grab current file name. while got_file = False: ...
I've looking up for something but can't find any useful for the same. I think the best option is declare a temporal download path and after that, move the file that you downloaded to your desire path using OS library.
23,896,625
I am downloading several different data sets and would like each file (or set) to download to a specific folder. I have learned how to change the download directories at these page: [setting Chrome preferences w/ Selenium Webdriver in Python](https://stackoverflow.com/questions/18026391/setting-chrome-preferences-w-s...
2014/05/27
[ "https://Stackoverflow.com/questions/23896625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1920550/" ]
I've looking up for something but can't find any useful for the same. I think the best option is declare a temporal download path and after that, move the file that you downloaded to your desire path using OS library.
I used the chromeOptions Experimental method. ``` ##set download directory chromeOptions = webdriver.ChromeOptions() prefs = {"download.default_directory": "your directory path"} chromeOptions.add_experimental_option("prefs", prefs) driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver', chrome_options=chr...
31,324,962
I need to find all the combinations that make a prime number in a string. Say I had passed in the string 32\_23, it would return 3 and 4 since 32323 and 32423 are prime numbers This is my code so far: ``` def isPrime(n): if n < 2: return False for i in range(2, n): if not n % i: return False return True ...
2015/07/09
[ "https://Stackoverflow.com/questions/31324962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4086877/" ]
If you already have access to your current database **phpMyAdmin** 1. Log in to it 2. Select the desired database from the left menu 3. You should see an **Export** tab in the right panel, click it 4. In **Export Method** you can leave it as *Quick* 5. Export it as **SQL** 6. Press **GO** (the submit button) > > If ...
The primary issue was fixed with a new download of the plugin.
173,811
Im using geoplugin.com to display content based on users location the codex is set up like this: ``` $geoplugin = unserialize( file_get_contents('http://www.geoplugin.net/php.gp? ip=' . $_SERVER['REMOTE_ADDR']) ); ``` This works on my dev site but not on my live site. I tried to use wp\_remote\_get but couldnt...
2015/01/02
[ "https://wordpress.stackexchange.com/questions/173811", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/63922/" ]
Yes you can do that using $wp\_query->current\_post inside the loop. It returns the current posts index number inside the loop (starting form 0). Have a look at the following code block ``` <?php global $wp_query; while(have_posts()){ the_post(); the_title(); //do your other stuff if($wp_query->curren...
With the help of a friend, i got the solution: ``` <?php $line = 1; $col = 1; while(have_posts()) : the_post(); if ($line % 2 == 0) { $class = 'grid_2'; // class for the 3 smaller posts } else { $class = 'grid_3'; // class for the 2 bigger posts }...
31,271,298
Hi Everyone I have the following query. On occasion, there are no results for this query, and I will need it to return a 0, rather than an error. ``` var count= dt.AsEnumerable().Where(x => x.Field<string>("names").Equals(name) && x.Field<string>("port").Equals("true")).Count(); ``` I have tried adding ?? 0 but the...
2015/07/07
[ "https://Stackoverflow.com/questions/31271298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5019819/" ]
[`Enumerable.Count`](https://msdn.microsoft.com/en-us/library/vstudio/bb338038(v=vs.100).aspx) doesn't throw an error if the sequence is empty, it returns 0. Do you instead mean that `dt` can be `null`? So either the `DataTable` is `null` or one of the strings is `null`. You don't need to use `String.Equals` you can us...
Do this: ``` var count=dt != null ? dt.AsEnumerable().Where(x => x.Field<string>("names").Equals(name) && x.Field<string>("port").Equals("true")).Count() : 0; ``` It will simply check if dt is null before any operations on dt are executed.
31,271,298
Hi Everyone I have the following query. On occasion, there are no results for this query, and I will need it to return a 0, rather than an error. ``` var count= dt.AsEnumerable().Where(x => x.Field<string>("names").Equals(name) && x.Field<string>("port").Equals("true")).Count(); ``` I have tried adding ?? 0 but the...
2015/07/07
[ "https://Stackoverflow.com/questions/31271298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5019819/" ]
[`Enumerable.Count`](https://msdn.microsoft.com/en-us/library/vstudio/bb338038(v=vs.100).aspx) doesn't throw an error if the sequence is empty, it returns 0. Do you instead mean that `dt` can be `null`? So either the `DataTable` is `null` or one of the strings is `null`. You don't need to use `String.Equals` you can us...
Yoda comparison for handle case when you have null in database: ``` var count= dt.AsEnumerable() .Where(x => name.Equals(x.Field<string>("names")) && "true".Equals(x.Field<string>("port"))) .Count(); ``` ![enter image description here](https://i.stack.imgur.com/dvR08....
46,788,299
Please i have this problem with my react class,i'm trying to update my state but i'm get this error "Cannot read property 'setState' of undefined" ..I have tried every solution online,but no luck here is the code ``` export default class PageBackground extends Component{ constructor(props) { super(pro...
2017/10/17
[ "https://Stackoverflow.com/questions/46788299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8581214/" ]
The `function () { ... }` syntax won't maintain the `this` reference from the context. Use an arrow function instead: ``` then(() => { this.setState({lat: objec.latitude, longi: objec.longitude}) }) ``` Another option is to add `.bind(this)` after `function () { }`. Or, just save `this` to a local variable and ...
Try this out: ``` getLocation () { var self = this; fetch('http://freegeoip.net/json/') .then(function (objec) { console.log(objec); self.setState({lat: objec.latitude, longi: objec.longitude}) }) .catch(function (error) { ...
46,788,299
Please i have this problem with my react class,i'm trying to update my state but i'm get this error "Cannot read property 'setState' of undefined" ..I have tried every solution online,but no luck here is the code ``` export default class PageBackground extends Component{ constructor(props) { super(pro...
2017/10/17
[ "https://Stackoverflow.com/questions/46788299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8581214/" ]
The `function () { ... }` syntax won't maintain the `this` reference from the context. Use an arrow function instead: ``` then(() => { this.setState({lat: objec.latitude, longi: objec.longitude}) }) ``` Another option is to add `.bind(this)` after `function () { }`. Or, just save `this` to a local variable and ...
The problem here is, you are trying to accesss `this` in a different scope. Whenever we pass a `function() {}` as a callback it creates it's own scope. Use arrow function's instead. ``` () => { 'your code here'; } ``` Arrow functions share the scope of its parent. ``` getLocation = () => { fetch('https://freeg...
13,541,380
I'm trying to convert a java based code to c# as followed; The original java code; ``` String str2 = "5f1fa09364a6ae7e35a090b434f182652ab8dd76:{\"expiration\": 1353759442.0991001, \"channel\": \"dreamhacksc2\", \"user_agent\": \".*" Mac localMac = Mac.getInstance("HmacSHA1"); localMac.init(new SecretKeySpec("Wd75Yj9...
2012/11/24
[ "https://Stackoverflow.com/questions/13541380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/170181/" ]
Three tips: 1. When I tested your Java code, I received this value for str3: `f52202a4a4e4e86fd42eba7fcd999f8e1d0eb163` That differs from both Java and C# result posted by you. ([This online tool](http://hash.online-convert.com/sha1-generator) also calculates my result.) 2. Wikipedia contains an [example](http://en.wi...
You are confusing bytes with strings. The result of `getBytes()` depends on the default [character-encoding](/questions/tagged/character-encoding "show questions tagged 'character-encoding'"), which may be different from system to system.
13,541,380
I'm trying to convert a java based code to c# as followed; The original java code; ``` String str2 = "5f1fa09364a6ae7e35a090b434f182652ab8dd76:{\"expiration\": 1353759442.0991001, \"channel\": \"dreamhacksc2\", \"user_agent\": \".*" Mac localMac = Mac.getInstance("HmacSHA1"); localMac.init(new SecretKeySpec("Wd75Yj9...
2012/11/24
[ "https://Stackoverflow.com/questions/13541380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/170181/" ]
Just keep it simple and the code equal. Java: ``` public static String toHexString(byte[] bytes) { StringBuilder sb = new StringBuilder(bytes.length * 2); for (int i = 0; i < bytes.length; ++i) { sb.append(String.format("%02x", bytes[i])); } return sb.toString(); } public static void main(Str...
Three tips: 1. When I tested your Java code, I received this value for str3: `f52202a4a4e4e86fd42eba7fcd999f8e1d0eb163` That differs from both Java and C# result posted by you. ([This online tool](http://hash.online-convert.com/sha1-generator) also calculates my result.) 2. Wikipedia contains an [example](http://en.wi...
13,541,380
I'm trying to convert a java based code to c# as followed; The original java code; ``` String str2 = "5f1fa09364a6ae7e35a090b434f182652ab8dd76:{\"expiration\": 1353759442.0991001, \"channel\": \"dreamhacksc2\", \"user_agent\": \".*" Mac localMac = Mac.getInstance("HmacSHA1"); localMac.init(new SecretKeySpec("Wd75Yj9...
2012/11/24
[ "https://Stackoverflow.com/questions/13541380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/170181/" ]
Just keep it simple and the code equal. Java: ``` public static String toHexString(byte[] bytes) { StringBuilder sb = new StringBuilder(bytes.length * 2); for (int i = 0; i < bytes.length; ++i) { sb.append(String.format("%02x", bytes[i])); } return sb.toString(); } public static void main(Str...
You are confusing bytes with strings. The result of `getBytes()` depends on the default [character-encoding](/questions/tagged/character-encoding "show questions tagged 'character-encoding'"), which may be different from system to system.
3,796,828
``` import java.util.scanner; import javax.swing.JOptionPane; public class FirstHomeJavaApplet{ public static void main(String[] args){ int num1=2; int num2=2; int sum; sum=num1+num2; System.out.println("My first home practice of java applet"); JOptionPane.showMessageDialog(null, num1 + "+" + num2 + " = " + ...
2010/09/26
[ "https://Stackoverflow.com/questions/3796828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/438687/" ]
Scanner should start with a capital S :)
By convention, Java classes start with capital letters. So it should be `Scanner` throughout. E.g. ``` import java.util.Scanner; ```
3,796,828
``` import java.util.scanner; import javax.swing.JOptionPane; public class FirstHomeJavaApplet{ public static void main(String[] args){ int num1=2; int num2=2; int sum; sum=num1+num2; System.out.println("My first home practice of java applet"); JOptionPane.showMessageDialog(null, num1 + "+" + num2 + " = " + ...
2010/09/26
[ "https://Stackoverflow.com/questions/3796828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/438687/" ]
Scanner should start with a capital S :)
The class is called [java.util.Scanner](http://docs.oracle.com/javase/6/docs/api/java/util/Scanner.html) (with a capital S).
3,796,828
``` import java.util.scanner; import javax.swing.JOptionPane; public class FirstHomeJavaApplet{ public static void main(String[] args){ int num1=2; int num2=2; int sum; sum=num1+num2; System.out.println("My first home practice of java applet"); JOptionPane.showMessageDialog(null, num1 + "+" + num2 + " = " + ...
2010/09/26
[ "https://Stackoverflow.com/questions/3796828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/438687/" ]
Scanner should start with a capital S :)
See that your class name starts with a Capital letter java.util.Scanner; instead of java.util.scanner;
3,796,828
``` import java.util.scanner; import javax.swing.JOptionPane; public class FirstHomeJavaApplet{ public static void main(String[] args){ int num1=2; int num2=2; int sum; sum=num1+num2; System.out.println("My first home practice of java applet"); JOptionPane.showMessageDialog(null, num1 + "+" + num2 + " = " + ...
2010/09/26
[ "https://Stackoverflow.com/questions/3796828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/438687/" ]
Scanner should start with a capital S :)
Because the class name is Scanner not scanner.
29,836,477
I have a df that looks like the following: ``` id item color 01 truck red 02 truck red 03 car black 04 truck blue 05 car black ``` I am trying to create a df that looks like this: ``` item color count truck red ...
2015/04/24
[ "https://Stackoverflow.com/questions/29836477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4793408/" ]
That's not a new column, that's a new DataFrame: ``` In [11]: df.groupby(["item", "color"]).count() Out[11]: id item color car black 2 truck blue 1 red 2 ``` To get the result you want is to use `reset_index`: ``` In [12]: df.groupby(["item", "color"])["id"].count().reset_index(name="...
Another possible way to achieve the desired output would be to use [Named Aggregation](https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html#named-aggregation). Which will allow you to specify the name and respective aggregation function for the desired output columns. > > Named aggregation > =========...
29,836,477
I have a df that looks like the following: ``` id item color 01 truck red 02 truck red 03 car black 04 truck blue 05 car black ``` I am trying to create a df that looks like this: ``` item color count truck red ...
2015/04/24
[ "https://Stackoverflow.com/questions/29836477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4793408/" ]
That's not a new column, that's a new DataFrame: ``` In [11]: df.groupby(["item", "color"]).count() Out[11]: id item color car black 2 truck blue 1 red 2 ``` To get the result you want is to use `reset_index`: ``` In [12]: df.groupby(["item", "color"])["id"].count().reset_index(name="...
Here is another option: ``` import numpy as np df['Counts'] = np.zeros(len(df)) grp_df = df.groupby(['item', 'color']).count() ``` which results in ``` Counts item color car black 2 truck blue 1 red 2 ```
29,836,477
I have a df that looks like the following: ``` id item color 01 truck red 02 truck red 03 car black 04 truck blue 05 car black ``` I am trying to create a df that looks like this: ``` item color count truck red ...
2015/04/24
[ "https://Stackoverflow.com/questions/29836477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4793408/" ]
That's not a new column, that's a new DataFrame: ``` In [11]: df.groupby(["item", "color"]).count() Out[11]: id item color car black 2 truck blue 1 red 2 ``` To get the result you want is to use `reset_index`: ``` In [12]: df.groupby(["item", "color"])["id"].count().reset_index(name="...
You can use [`value_counts`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.value_counts.html) and name the column with [`reset_index`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.reset_index.html): ``` In [3]: df[['item', 'color']].value_counts().reset_inde...
29,836,477
I have a df that looks like the following: ``` id item color 01 truck red 02 truck red 03 car black 04 truck blue 05 car black ``` I am trying to create a df that looks like this: ``` item color count truck red ...
2015/04/24
[ "https://Stackoverflow.com/questions/29836477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4793408/" ]
Another possible way to achieve the desired output would be to use [Named Aggregation](https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html#named-aggregation). Which will allow you to specify the name and respective aggregation function for the desired output columns. > > Named aggregation > =========...
Here is another option: ``` import numpy as np df['Counts'] = np.zeros(len(df)) grp_df = df.groupby(['item', 'color']).count() ``` which results in ``` Counts item color car black 2 truck blue 1 red 2 ```
29,836,477
I have a df that looks like the following: ``` id item color 01 truck red 02 truck red 03 car black 04 truck blue 05 car black ``` I am trying to create a df that looks like this: ``` item color count truck red ...
2015/04/24
[ "https://Stackoverflow.com/questions/29836477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4793408/" ]
Another possible way to achieve the desired output would be to use [Named Aggregation](https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html#named-aggregation). Which will allow you to specify the name and respective aggregation function for the desired output columns. > > Named aggregation > =========...
You can use [`value_counts`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.value_counts.html) and name the column with [`reset_index`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.reset_index.html): ``` In [3]: df[['item', 'color']].value_counts().reset_inde...
37,457,180
I'm trying to clean up a bad solution. I have a utils file, which contains some generic methods and a commands file, where I store a list of commands to use within the program. However, when trying to clean up files by using string format, I'm starting to run into problems. ``` # utils.py import os bin = '/usr/bin' t...
2016/05/26
[ "https://Stackoverflow.com/questions/37457180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4889267/" ]
You should probably use the following command from a terminal: ``` locate eclipse.ini ``` You will know the exact location of eclipse.ini and will be able to edit it.
Have you tried finding the existing file and editing it? Check [this question](https://stackoverflow.com/questions/8419099/where-does-eclipse-look-for-eclipse-ini-under-linux) for more details on where to find the file on Linux, then edit it.
37,457,180
I'm trying to clean up a bad solution. I have a utils file, which contains some generic methods and a commands file, where I store a list of commands to use within the program. However, when trying to clean up files by using string format, I'm starting to run into problems. ``` # utils.py import os bin = '/usr/bin' t...
2016/05/26
[ "https://Stackoverflow.com/questions/37457180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4889267/" ]
You should probably use the following command from a terminal: ``` locate eclipse.ini ``` You will know the exact location of eclipse.ini and will be able to edit it.
The 'eclipse.ini' file is always in the same directory as the eclipse executable in your Eclipse installation. This is normally the root directory of the installation, not 'etc'.
37,457,180
I'm trying to clean up a bad solution. I have a utils file, which contains some generic methods and a commands file, where I store a list of commands to use within the program. However, when trying to clean up files by using string format, I'm starting to run into problems. ``` # utils.py import os bin = '/usr/bin' t...
2016/05/26
[ "https://Stackoverflow.com/questions/37457180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4889267/" ]
You should probably use the following command from a terminal: ``` locate eclipse.ini ``` You will know the exact location of eclipse.ini and will be able to edit it.
``` sudo gedit /opt/eclipse/eclipse.ini ```
23,826,766
Is it possible to create a table that has a default TTL for all rows that are inserted into it, or do you have to always remember to set the TTL when you do an insert/update? Cant see anything on this in the documentation: <http://www.datastax.com/documentation/cql/3.0/cql/cql_reference/create_table_r.html>
2014/05/23
[ "https://Stackoverflow.com/questions/23826766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3646528/" ]
Yes it is possible to set TTL for the entire column family. ``` CREATE TABLE test_table ( # your table definition # ) WITH default_time_to_live = 10; Inserted rows then disappear after 10 seconds. ``` I believe the work was done for it here: <https://issues.apache.org/jira/browse/CASSANDRA-3974> Here's a docs...
From Cassandra doc : > > You can set a default TTL for an entire table by setting the table's > default\_time\_to\_live property. If you try to set a TTL for a specific > column that is longer than the time defined by the table TTL, Apache > Cassandra™ returns an error. > > > See: <https://docs.datastax.com/e...
23,826,766
Is it possible to create a table that has a default TTL for all rows that are inserted into it, or do you have to always remember to set the TTL when you do an insert/update? Cant see anything on this in the documentation: <http://www.datastax.com/documentation/cql/3.0/cql/cql_reference/create_table_r.html>
2014/05/23
[ "https://Stackoverflow.com/questions/23826766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3646528/" ]
Yes it is possible to set TTL for the entire column family. ``` CREATE TABLE test_table ( # your table definition # ) WITH default_time_to_live = 10; Inserted rows then disappear after 10 seconds. ``` I believe the work was done for it here: <https://issues.apache.org/jira/browse/CASSANDRA-3974> Here's a docs...
You can set TTL either on table or during INSERT/UPDATE. When you will create a table you can define or set default\_time\_to\_live or you can update later once table created with default TTL value. if you want to set a row level TTL you can set while inserting the row or updating any row. Below is good point you van r...
5,753,537
``` <select id="placeSelect" onchange="map_place_change();" > <option value="CN">China</option> <option value="WORD">world</option> </select> ``` when i select a value , how can i get it ? such , how can i get "CN" , how can i get "china" ? thanks ?
2011/04/22
[ "https://Stackoverflow.com/questions/5753537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/582388/" ]
you need to use following code: ``` function map_place_change(){ var value = $(this).val(); // value = "CN" var text = $(this).find("option:selected").text();// China } ```
``` $('#placeSelect').change(function(){ alert($('#placeSelect option:selected').html()); }); ``` your function would be something like: ``` function map_place_change(){ alert($('#placeSelect option:selected').html()); } ```
5,753,537
``` <select id="placeSelect" onchange="map_place_change();" > <option value="CN">China</option> <option value="WORD">world</option> </select> ``` when i select a value , how can i get it ? such , how can i get "CN" , how can i get "china" ? thanks ?
2011/04/22
[ "https://Stackoverflow.com/questions/5753537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/582388/" ]
``` $("#placeSelect").val() $("#placeSelect option:selected").text() ```
``` $('#placeSelect').change(function(){ alert($('#placeSelect option:selected').html()); }); ``` your function would be something like: ``` function map_place_change(){ alert($('#placeSelect option:selected').html()); } ```
5,753,537
``` <select id="placeSelect" onchange="map_place_change();" > <option value="CN">China</option> <option value="WORD">world</option> </select> ``` when i select a value , how can i get it ? such , how can i get "CN" , how can i get "china" ? thanks ?
2011/04/22
[ "https://Stackoverflow.com/questions/5753537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/582388/" ]
``` $('#placeSelect').change(function(){ alert($('#placeSelect option:selected').html()); }); ``` your function would be something like: ``` function map_place_change(){ alert($('#placeSelect option:selected').html()); } ```
Try this ``` $(‘#’).find(“input[CHECKED]“).val() ```
5,753,537
``` <select id="placeSelect" onchange="map_place_change();" > <option value="CN">China</option> <option value="WORD">world</option> </select> ``` when i select a value , how can i get it ? such , how can i get "CN" , how can i get "china" ? thanks ?
2011/04/22
[ "https://Stackoverflow.com/questions/5753537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/582388/" ]
``` $("#placeSelect").val() $("#placeSelect option:selected").text() ```
you need to use following code: ``` function map_place_change(){ var value = $(this).val(); // value = "CN" var text = $(this).find("option:selected").text();// China } ```
5,753,537
``` <select id="placeSelect" onchange="map_place_change();" > <option value="CN">China</option> <option value="WORD">world</option> </select> ``` when i select a value , how can i get it ? such , how can i get "CN" , how can i get "china" ? thanks ?
2011/04/22
[ "https://Stackoverflow.com/questions/5753537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/582388/" ]
you need to use following code: ``` function map_place_change(){ var value = $(this).val(); // value = "CN" var text = $(this).find("option:selected").text();// China } ```
Try this ``` $(‘#’).find(“input[CHECKED]“).val() ```
5,753,537
``` <select id="placeSelect" onchange="map_place_change();" > <option value="CN">China</option> <option value="WORD">world</option> </select> ``` when i select a value , how can i get it ? such , how can i get "CN" , how can i get "china" ? thanks ?
2011/04/22
[ "https://Stackoverflow.com/questions/5753537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/582388/" ]
``` $("#placeSelect").val() $("#placeSelect option:selected").text() ```
Try this ``` $(‘#’).find(“input[CHECKED]“).val() ```
40,989,515
I need software to check the pixel values manually of an image (**Tiff**, jpg, png,...) in an easy way (like specifying the pixel location (x,y) and then the software should give me the values of all the bands related to that pixel i.e. Red, Green, Blue, Temperature, ...). Preferable to be Windows GUI Software.
2016/12/06
[ "https://Stackoverflow.com/questions/40989515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2197108/" ]
Although the other answer pretty much does the job, here's a better one: ``` <T> List<T> getElementsOf(Class<T> clazz) { return list.stream() .filter(clazz::isInstance) .map(clazz::cast) .collect(toList()); } ``` Notice that the `clazz::isInstance` thingy. Instead of comparing...
I got the following: ``` <T> List<T> getChildrenOf(Class<T> clazz) { return children.stream() .filter(node -> node.getClass() == clazz) .map(node -> clazz.<T>cast(node)) .collect(toList()); } List<Mesh> nameNodes = b.getChildrenOf(Mesh.class); ```
40,989,515
I need software to check the pixel values manually of an image (**Tiff**, jpg, png,...) in an easy way (like specifying the pixel location (x,y) and then the software should give me the values of all the bands related to that pixel i.e. Red, Green, Blue, Temperature, ...). Preferable to be Windows GUI Software.
2016/12/06
[ "https://Stackoverflow.com/questions/40989515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2197108/" ]
I got the following: ``` <T> List<T> getChildrenOf(Class<T> clazz) { return children.stream() .filter(node -> node.getClass() == clazz) .map(node -> clazz.<T>cast(node)) .collect(toList()); } List<Mesh> nameNodes = b.getChildrenOf(Mesh.class); ```
Note that generic type information is erased at runtime, so to make that even clearer I exchanged the `T` with `Object`. Actually the `Object` wouldn't be there too, but I kept it to make it clearer, where the `T` was: ``` List<Object> getElementsOf() { return list.stream() .filter(x -> x instanceof Object...
40,989,515
I need software to check the pixel values manually of an image (**Tiff**, jpg, png,...) in an easy way (like specifying the pixel location (x,y) and then the software should give me the values of all the bands related to that pixel i.e. Red, Green, Blue, Temperature, ...). Preferable to be Windows GUI Software.
2016/12/06
[ "https://Stackoverflow.com/questions/40989515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2197108/" ]
Although the other answer pretty much does the job, here's a better one: ``` <T> List<T> getElementsOf(Class<T> clazz) { return list.stream() .filter(clazz::isInstance) .map(clazz::cast) .collect(toList()); } ``` Notice that the `clazz::isInstance` thingy. Instead of comparing...
Note that generic type information is erased at runtime, so to make that even clearer I exchanged the `T` with `Object`. Actually the `Object` wouldn't be there too, but I kept it to make it clearer, where the `T` was: ``` List<Object> getElementsOf() { return list.stream() .filter(x -> x instanceof Object...
74,349,303
We have an app developed using IONIC CORDOVA. When I am trying to upload app on the play store then it gives an error "Apps targeting Android 12 and higher are required to specify an explicit value for android:exported" I am using cordova-android: 8.0.0 If I am using cordova-android:10.1.0 then I am unable to build a...
2022/11/07
[ "https://Stackoverflow.com/questions/74349303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7051774/" ]
I was having the same issues. Im not sure what causes the issues I think it is an cordova one. But you can resolve it by going to the platforms/android/app/manifests/androidManifest.xml there is a section <activity. Add android:exported="true". It should look like this <activity android:exported="true" ....(other varia...
You should update to cordova-android 11. This release features support for Android 12 and the latest play store requirements. <https://cordova.apache.org/announcements/2022/07/12/cordova-android-release-11.0.0.html>
74,349,303
We have an app developed using IONIC CORDOVA. When I am trying to upload app on the play store then it gives an error "Apps targeting Android 12 and higher are required to specify an explicit value for android:exported" I am using cordova-android: 8.0.0 If I am using cordova-android:10.1.0 then I am unable to build a...
2022/11/07
[ "https://Stackoverflow.com/questions/74349303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7051774/" ]
I was having the same issues. Im not sure what causes the issues I think it is an cordova one. But you can resolve it by going to the platforms/android/app/manifests/androidManifest.xml there is a section <activity. Add android:exported="true". It should look like this <activity android:exported="true" ....(other varia...
I have solved this by adding android:exported: true to manifest.xml `<intent-filter android:exported="true" android:label="@string/launcher_name">` Please note that this error is related to launcher activity intent only
21,356,817
My task is to call the methods of java.lang.Math using a String with the necessary information. Since there are only methods using primitive number types I use Number as a wrapper, which then gets the value parsed from String. ``` Number value = null; switch (attributClass) { [...]//parse the attribute int...
2014/01/25
[ "https://Stackoverflow.com/questions/21356817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3038456/" ]
Whenever a user enters text into an input field it is considered a `string`. So you need to convert it to an `integer`. `parseInt` around your prompt is the easiest way. the `10` is just saying that you're using 0,1,2,3,4,5,6,7,8,9 (base10)... not something like 0100100101 (base2). ``` var inputperc = parseInt(prompt(...
Your code has a syntax error as spencer pointed out. You should consider writing a `getGrade` function though. ``` var getGrade = function (percent) { if (percent > 100 || percent < 0 || isNaN(percent)) { return "Enter a valid Percentage value between 0 and 100"; } if (percent >= 90 && percent <= ...
21,356,817
My task is to call the methods of java.lang.Math using a String with the necessary information. Since there are only methods using primitive number types I use Number as a wrapper, which then gets the value parsed from String. ``` Number value = null; switch (attributClass) { [...]//parse the attribute int...
2014/01/25
[ "https://Stackoverflow.com/questions/21356817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3038456/" ]
Small error: ``` ... if(inputperc > 100 || inputperc < 0 || isNaN(inputperc)){ document.getElementById("div2").innerHTML = "Enter a valid Percentage value between 0 and 100"; } else { // <-- forgot to close the if. if(inputperc >= 90 && inputperc <= 100){ ... ``` Also as already mentioned it's a...
Your code has a syntax error as spencer pointed out. You should consider writing a `getGrade` function though. ``` var getGrade = function (percent) { if (percent > 100 || percent < 0 || isNaN(percent)) { return "Enter a valid Percentage value between 0 and 100"; } if (percent >= 90 && percent <= ...
7,210,017
This may have been answered before. I see many "dynamic method overload resolution" questions, but none that deal specifically with passing a `dynamic` argument. In the following code, in `Test`, the last call to `M` cannot be resolved (**it doesn't compile**). The error is: *the call is ambiguous between [the first tw...
2011/08/26
[ "https://Stackoverflow.com/questions/7210017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/162396/" ]
The problem here is type inference. The compiler is trying to find out which overload to use based on the argument, but it's also trying to find out what the type of the argument is based on the chosen overload. In the case of `M(() => DynamicObject())`, the process goes something like this: 1. The argument to the met...
From the definition in MSDN: [dynamic](http://msdn.microsoft.com/en-us/library/dd264741.aspx) > > Type dynamic behaves like type object in most circumstances. However, > operations that contain expressions of type dynamic are not resolved > or type checked by the compiler. The compiler packages together > inform...
20,796,055
After adding a custom `UIButton` to `MKAnnotationView`, the `UIControlEventTouchUpInside` for the button is not working. Please have a look at my code below : ``` - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { MKAnnotationView *annotationView = (MKAnnotatio...
2013/12/27
[ "https://Stackoverflow.com/questions/20796055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1640534/" ]
Try this. ``` -(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation: (id <MKAnnotation>)annotation { MKPinAnnotationView *pinView = (MKPinAnnotationView*)[self.mapview dequeueReusableAnnotationViewWithIdentifier:@"Pin"]; if(pinView == nil) { pinView = [[MKPinAnnotationView alloc] initWith...
(i). First try using a rounded rectangle button, then use the custom button. (ii). then, check the image name is same as the name in the resource folder
11,498
As VLC is not available for android, which Android player supports most video formats (and faster and lighter if possible)? For example currently i use kascend media player, it can also play flv files (without flash player) and faster then other flv players.
2011/07/15
[ "https://android.stackexchange.com/questions/11498", "https://android.stackexchange.com", "https://android.stackexchange.com/users/5156/" ]
I use [QQPlayer](https://market.android.com/details?id=com.tencent.research.drop&feature=search_result) > > Mobile QQ player ... supports all the popular formats of videos > on the market, including AVI, FLV, MP4, 3GP, MKV, MOV and etc. In > addition, QQ Player also supports SRT, SMI plug-in subtitle and MKV > emb...
The best player is **DICE player**... you can play any format on it without your phone breaking a sweat.. My 3 years old Galaxy S is able to play 720p videos perfectly and also 1080p(though choppily). All the other players on the market failed to do that for me. The only other player that does all that was the default ...
11,498
As VLC is not available for android, which Android player supports most video formats (and faster and lighter if possible)? For example currently i use kascend media player, it can also play flv files (without flash player) and faster then other flv players.
2011/07/15
[ "https://android.stackexchange.com/questions/11498", "https://android.stackexchange.com", "https://android.stackexchange.com/users/5156/" ]
I like [MoboPlayer](https://market.android.com/details?id=com.clov4r.android.nil&hl=en) It seems the fastest on my Xoom, and plays back nearly anything I throw at it flawlessly.
VLC is available for Android already! Here are some [best android players](http://video-player-software.blogspot.com/2012/09/best-android-player-for-android-phone.html) for you!
11,498
As VLC is not available for android, which Android player supports most video formats (and faster and lighter if possible)? For example currently i use kascend media player, it can also play flv files (without flash player) and faster then other flv players.
2011/07/15
[ "https://android.stackexchange.com/questions/11498", "https://android.stackexchange.com", "https://android.stackexchange.com/users/5156/" ]
Arcmedia is also a nice player. It is based on ffmpeg, so it'll play pretty much anything you throw at it.
VLC is available for Android already! Here are some [best android players](http://video-player-software.blogspot.com/2012/09/best-android-player-for-android-phone.html) for you!
11,498
As VLC is not available for android, which Android player supports most video formats (and faster and lighter if possible)? For example currently i use kascend media player, it can also play flv files (without flash player) and faster then other flv players.
2011/07/15
[ "https://android.stackexchange.com/questions/11498", "https://android.stackexchange.com", "https://android.stackexchange.com/users/5156/" ]
Arcmedia is also a nice player. It is based on ffmpeg, so it'll play pretty much anything you throw at it.
If someone gave me the choice of picking just one media player to take to a deserted island, I would most definitely plonk for VideoLan’s VLC Media Player. VLC, the free media player popular for its capability to play most media formats(MPEG-1, MPEG-2, MPEG-4, DivX, mp3, ogg...) While, no-one seems to know much how to ...
11,498
As VLC is not available for android, which Android player supports most video formats (and faster and lighter if possible)? For example currently i use kascend media player, it can also play flv files (without flash player) and faster then other flv players.
2011/07/15
[ "https://android.stackexchange.com/questions/11498", "https://android.stackexchange.com", "https://android.stackexchange.com/users/5156/" ]
[MXPlayer](https://play.google.com/store/apps/details?id=com.mxtech.videoplayer.ad&hl=en) It supports most of the formats
If someone gave me the choice of picking just one media player to take to a deserted island, I would most definitely plonk for VideoLan’s VLC Media Player. VLC, the free media player popular for its capability to play most media formats(MPEG-1, MPEG-2, MPEG-4, DivX, mp3, ogg...) While, no-one seems to know much how to ...
11,498
As VLC is not available for android, which Android player supports most video formats (and faster and lighter if possible)? For example currently i use kascend media player, it can also play flv files (without flash player) and faster then other flv players.
2011/07/15
[ "https://android.stackexchange.com/questions/11498", "https://android.stackexchange.com", "https://android.stackexchange.com/users/5156/" ]
I use [QQPlayer](https://market.android.com/details?id=com.tencent.research.drop&feature=search_result) > > Mobile QQ player ... supports all the popular formats of videos > on the market, including AVI, FLV, MP4, 3GP, MKV, MOV and etc. In > addition, QQ Player also supports SRT, SMI plug-in subtitle and MKV > emb...
If someone gave me the choice of picking just one media player to take to a deserted island, I would most definitely plonk for VideoLan’s VLC Media Player. VLC, the free media player popular for its capability to play most media formats(MPEG-1, MPEG-2, MPEG-4, DivX, mp3, ogg...) While, no-one seems to know much how to ...
11,498
As VLC is not available for android, which Android player supports most video formats (and faster and lighter if possible)? For example currently i use kascend media player, it can also play flv files (without flash player) and faster then other flv players.
2011/07/15
[ "https://android.stackexchange.com/questions/11498", "https://android.stackexchange.com", "https://android.stackexchange.com/users/5156/" ]
[MXPlayer](https://play.google.com/store/apps/details?id=com.mxtech.videoplayer.ad&hl=en) It supports most of the formats
The best player is **DICE player**... you can play any format on it without your phone breaking a sweat.. My 3 years old Galaxy S is able to play 720p videos perfectly and also 1080p(though choppily). All the other players on the market failed to do that for me. The only other player that does all that was the default ...
11,498
As VLC is not available for android, which Android player supports most video formats (and faster and lighter if possible)? For example currently i use kascend media player, it can also play flv files (without flash player) and faster then other flv players.
2011/07/15
[ "https://android.stackexchange.com/questions/11498", "https://android.stackexchange.com", "https://android.stackexchange.com/users/5156/" ]
[MXPlayer](https://play.google.com/store/apps/details?id=com.mxtech.videoplayer.ad&hl=en) It supports most of the formats
VLC is available for Android already! Here are some [best android players](http://video-player-software.blogspot.com/2012/09/best-android-player-for-android-phone.html) for you!
11,498
As VLC is not available for android, which Android player supports most video formats (and faster and lighter if possible)? For example currently i use kascend media player, it can also play flv files (without flash player) and faster then other flv players.
2011/07/15
[ "https://android.stackexchange.com/questions/11498", "https://android.stackexchange.com", "https://android.stackexchange.com/users/5156/" ]
I use [QQPlayer](https://market.android.com/details?id=com.tencent.research.drop&feature=search_result) > > Mobile QQ player ... supports all the popular formats of videos > on the market, including AVI, FLV, MP4, 3GP, MKV, MOV and etc. In > addition, QQ Player also supports SRT, SMI plug-in subtitle and MKV > emb...
VLC is available for Android already! Here are some [best android players](http://video-player-software.blogspot.com/2012/09/best-android-player-for-android-phone.html) for you!
11,498
As VLC is not available for android, which Android player supports most video formats (and faster and lighter if possible)? For example currently i use kascend media player, it can also play flv files (without flash player) and faster then other flv players.
2011/07/15
[ "https://android.stackexchange.com/questions/11498", "https://android.stackexchange.com", "https://android.stackexchange.com/users/5156/" ]
[VLC for Android](http://www.videolan.org/vlc/download-android.html) is now [available as beta](https://play.google.com/store/apps/details?id=org.videolan.vlc.betav7neon).
If someone gave me the choice of picking just one media player to take to a deserted island, I would most definitely plonk for VideoLan’s VLC Media Player. VLC, the free media player popular for its capability to play most media formats(MPEG-1, MPEG-2, MPEG-4, DivX, mp3, ogg...) While, no-one seems to know much how to ...
43,729
When do I get them back? It simply says "You have no more close votes today." I would prefer it say "You have no more close votes today, please try again in X hours" similar to when you're out of votes.
2010/03/23
[ "https://meta.stackexchange.com/questions/43729", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/136930/" ]
I agree, this should behave the same way as the normal voting `<div>`. So when you reach the limit, it'll now tell you how many hours until 00:00 UTC when you get more. Just like upvotes/downvotes.
Same time everything else gets reset on SO - 12 AM, UTC, which is in about 50 minutes from now. If they implemented this feature then it would also have to apply to upvotes/downvotes, comment votes, rep caps, etc. Perhaps an entry in the FAQ would suffice.
54,238,300
I am trying to create a simple login sistem using react and json server (on localhost port). I have 2 inputs, one for name the other for password. My problem is that when i try to submit those inputs, on the server side both name and password appear with the values from the password. ``` class AddAcc extends Componen...
2019/01/17
[ "https://Stackoverflow.com/questions/54238300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10816078/" ]
Here's how to do it using vectors. Each item in the `badguy` list is now a pair of items, its current position and an associated speed vector. Note that the position itself is also a vector (aka a "position vector"). Updating the current position is accomplished by simply adding each badguy's speed vector to its curre...
So each asteroid in your game is represented by a `Rect`, stored in `badguys`. With a `Rect`, you're able to store a postion and a size (since a `Rect` has the attributes `x`, `y`, `width` and `height`). Now, you want to store additional information/state for each asteroid, so only using a `Rect` is not enough. You n...
44,217,368
``` <header class="top-header"> <div class="container"> <div class="logo"> <img src="./dist/img/usjr-logo.png" alt="" href="http://www.usjr.edu.ph" id="logo"> </div> <nav class ="top-nav"> <ul> <li class="current"><a href="index.html">Link A1</a></li>...
2017/05/27
[ "https://Stackoverflow.com/questions/44217368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6813433/" ]
You can use `tstrsplit` to split the column into two after removing the suffix (*.de*) with `sub`: ``` DT[, c("test1", "test2") := tstrsplit(sub("\\.de", "", ID), "_")][, ID := NULL][] # test1 test2 #1: ab cd #2: ab ci #3: fb cd #4: xy cd ```
We can use `extract` from `tidyr` ``` library(tidyr) df %>% extract(ID, into = c('test1', 'test2'), '([^_]+)_([^.]+).*') # test1 test2 #1 ab cd #2 ab ci #3 fb cd #4 xy cd ``` --- Or using `data.table` ``` library(data.table) DT[, .(test1 = sub('_.*', '', ID), test2 = sub('[^_]+_([^.]+)...
54,153,257
In my website there are dozens of calls made to a sql database and each time it passes along the ID of the user requesting data. I'm attempting to set up a singleton class that will only need to make one call to the database to grab the person's ID along with other user attributes that only need to be grabbed once. I...
2019/01/11
[ "https://Stackoverflow.com/questions/54153257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2410605/" ]
The problem is that these properties (fields, actually) are in a singleton: ``` public string userName; public string firstName; public string personID; public string secBlur; public int admin; public int fafsa; public int staff; ``` ...along with the fact that they get populated in the constructor. That means the f...
Basically, you want to do a cache. For http requests you need to check if value is already in cache, if it is not - read from the database, otherwise use cache. You can start with built-in [Cache](https://learn.microsoft.com/en-us/dotnet/api/system.web.caching.cache?view=netframework-4.7.2) As for singletons, simples...
54,153,257
In my website there are dozens of calls made to a sql database and each time it passes along the ID of the user requesting data. I'm attempting to set up a singleton class that will only need to make one call to the database to grab the person's ID along with other user attributes that only need to be grabbed once. I...
2019/01/11
[ "https://Stackoverflow.com/questions/54153257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2410605/" ]
The problem is that these properties (fields, actually) are in a singleton: ``` public string userName; public string firstName; public string personID; public string secBlur; public int admin; public int fafsa; public int staff; ``` ...along with the fact that they get populated in the constructor. That means the f...
The instance object is created just once on an application lifetime. So your private constructor formValues(), where you get the FormsIdentity, is actually executed just once after application starts up first time ever. After that , for all incoming requests, the already populated instance is given out. That's why you...
40,119,627
I'm implementing Snook's Simple jQuery Slideshow on my Bootstrap 3 website. Check it out here: <https://snook.ca/archives/javascript/more-simple-slideshow> For some reason, the row containing the slideshow has a height of 0, so all the following text is appearing on top of my slideshow images. Here's my code: ``` <...
2016/10/18
[ "https://Stackoverflow.com/questions/40119627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1982089/" ]
Add this to your Info.plist and then try calling canOpenURL. ``` <key>LSApplicationQueriesSchemes</key> <array> <string>comgooglemaps</string> </array> ```
Edit: ----- The correct key to be used in the app's **plist** file is `LSApplicationQueriesSchemes` and not `UIDefaultLaunchStoryboard` as stated by Apple's documentation. Original answer: ---------------- From Apple's documentation: > > If your app is linked on or after iOS 9.0, you must declare the URL > scheme...
74,076,500
Lets sat we have following hierarchy of constants that I would like to hard code.. ``` FRUIT->APPLE->GREEN_APPLE->"Fruit is apple of green color" FRUIT->APPLE->RED_APPLE->"Fruit is apple of red color" FRUIT->Cherry->RED_CHERRY->"Fruit is cherry of red color" FLOWER->ROSE->RED_ROSE->"Flower is rose of red color" FLOWE...
2022/10/15
[ "https://Stackoverflow.com/questions/74076500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2034519/" ]
I've made a script for you for this specific condition. Based on the info you shared, I've created the test scripts below. You can test this script and see the result really quickly at <https://onecompiler.com/mysql/> ``` -- create CREATE TABLE YOUR_TABLE ( Name TEXT NOT NULL ); -- insert INSERT INTO YOUR_TABLE VAL...
You want to work with first name and last name in your database, but your table doesn't provide that information. It only has a column for the full name. This means that your database design is not appropriate for the task. The information you seek is not stored atomic, but in a concatenated form and thus violates the ...
24,015
Answers to [Why does my A/C blow foul smelling air when it first turns on?](https://mechanics.stackexchange.com/q/116/12816) suggest several fixes that depend on knowing where in the car they are located. I can't determine in any of my cars where the following items are. E.g.: 1. Where is the A/C drain? 2. [Is the hea...
2015/12/30
[ "https://mechanics.stackexchange.com/questions/24015", "https://mechanics.stackexchange.com", "https://mechanics.stackexchange.com/users/12816/" ]
Here's an image to a cooling system for your reference. Each vehicle has it's own unique setup. The differences in some cases are slight and in some very big. You can see the placement of your heater core. [![enter image description here](https://i.stack.imgur.com/nNHPT.jpg)](https://i.stack.imgur.com/nNHPT.jpg) ...
Smelling A/C system can be caused by these things: dirty A/C filter; clogged evaporator; and if your A/C vent is not set on recycle mode.
11,651,556
Hi I am trying to get the tagName of some elements that are added dynamically but each time I try that on click I get undefined.I created a simple example that simulates my situation.Here is my code: ``` <ul> <li>sdsa</li> <li>dsa</li> </ul> <button>Press</button> $(document).ready(function(){ ...
2012/07/25
[ "https://Stackoverflow.com/questions/11651556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/985482/" ]
``` import ast with open('list.txt') as f: output = ast.literal_eval(f.read()) ``` returns `output` as a real list of dictionaries and not as its string representation `f.read()` would return. Anyway, if you are both writing and reading the file, use some serialization interface, such as `cPickle` or `json`.
You'd use the [`json`](http://docs.python.org/library/json.html) standard library module to instead do `json.dump(my_list)` and then to read it `json.load(my_file_with_my_lists)`, which converts your list to JSON and reads it back again. Cheers.
11,651,556
Hi I am trying to get the tagName of some elements that are added dynamically but each time I try that on click I get undefined.I created a simple example that simulates my situation.Here is my code: ``` <ul> <li>sdsa</li> <li>dsa</li> </ul> <button>Press</button> $(document).ready(function(){ ...
2012/07/25
[ "https://Stackoverflow.com/questions/11651556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/985482/" ]
You *can* restore the object using `ast.literal_eval()`, but you actually *should* use some sane serialisation format, like JSON or Python's pickle module. Example: ```py # JSON import json # saving with open("a.json", "w") as f: json.dump(obj, f) # loading with(open("a.json") as f: obj = json.load(f) ``` F...
You'd use the [`json`](http://docs.python.org/library/json.html) standard library module to instead do `json.dump(my_list)` and then to read it `json.load(my_file_with_my_lists)`, which converts your list to JSON and reads it back again. Cheers.
11,651,556
Hi I am trying to get the tagName of some elements that are added dynamically but each time I try that on click I get undefined.I created a simple example that simulates my situation.Here is my code: ``` <ul> <li>sdsa</li> <li>dsa</li> </ul> <button>Press</button> $(document).ready(function(){ ...
2012/07/25
[ "https://Stackoverflow.com/questions/11651556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/985482/" ]
You'd use the [`json`](http://docs.python.org/library/json.html) standard library module to instead do `json.dump(my_list)` and then to read it `json.load(my_file_with_my_lists)`, which converts your list to JSON and reads it back again. Cheers.
You can use this <http://docs.python.org/library/functions.html#execfile> function from builtin functions. But better way is use <http://docs.python.org/library/pickle.html> module for storing python datastructure in file
11,651,556
Hi I am trying to get the tagName of some elements that are added dynamically but each time I try that on click I get undefined.I created a simple example that simulates my situation.Here is my code: ``` <ul> <li>sdsa</li> <li>dsa</li> </ul> <button>Press</button> $(document).ready(function(){ ...
2012/07/25
[ "https://Stackoverflow.com/questions/11651556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/985482/" ]
``` import ast with open('list.txt') as f: output = ast.literal_eval(f.read()) ``` returns `output` as a real list of dictionaries and not as its string representation `f.read()` would return. Anyway, if you are both writing and reading the file, use some serialization interface, such as `cPickle` or `json`.
You can use this <http://docs.python.org/library/functions.html#execfile> function from builtin functions. But better way is use <http://docs.python.org/library/pickle.html> module for storing python datastructure in file
11,651,556
Hi I am trying to get the tagName of some elements that are added dynamically but each time I try that on click I get undefined.I created a simple example that simulates my situation.Here is my code: ``` <ul> <li>sdsa</li> <li>dsa</li> </ul> <button>Press</button> $(document).ready(function(){ ...
2012/07/25
[ "https://Stackoverflow.com/questions/11651556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/985482/" ]
You *can* restore the object using `ast.literal_eval()`, but you actually *should* use some sane serialisation format, like JSON or Python's pickle module. Example: ```py # JSON import json # saving with open("a.json", "w") as f: json.dump(obj, f) # loading with(open("a.json") as f: obj = json.load(f) ``` F...
You can use this <http://docs.python.org/library/functions.html#execfile> function from builtin functions. But better way is use <http://docs.python.org/library/pickle.html> module for storing python datastructure in file
31,664,159
TLDR ==== My custom structure implements the [Hashable Protocol](https://developer.apple.com/library/prerelease/mac/documentation/Swift/Reference/Swift_Hashable_Protocol/index.html). However, when hash collisions occur while inserting keys in a `Dictionary`, they are not automatically handled. How do I overcome this p...
2015/07/27
[ "https://Stackoverflow.com/questions/31664159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3681880/" ]
``` func ==(lhs: MyStructure, rhs: MyStructure) -> Bool { return lhs.hashValue == rhs.hashValue } ``` > > Note the global function to overload the equality operator (==) in order to conform to the Equatable Protocol, which is required by the Hashable Protocol. > > > Your problem is an incorrect *equality* im...
I think you have all the pieces of the puzzle you need -- you just need to put them together. You have a bunch of great sources. Hash collisions are okay. If a hash collision occurs, objects will be checked for equality instead (only against the objects with matching hashes). For this reason, objects' `Equatable` conf...
31,664,159
TLDR ==== My custom structure implements the [Hashable Protocol](https://developer.apple.com/library/prerelease/mac/documentation/Swift/Reference/Swift_Hashable_Protocol/index.html). However, when hash collisions occur while inserting keys in a `Dictionary`, they are not automatically handled. How do I overcome this p...
2015/07/27
[ "https://Stackoverflow.com/questions/31664159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3681880/" ]
I think you have all the pieces of the puzzle you need -- you just need to put them together. You have a bunch of great sources. Hash collisions are okay. If a hash collision occurs, objects will be checked for equality instead (only against the objects with matching hashes). For this reason, objects' `Equatable` conf...
You can see my comments on this page's answers and [this](https://stackoverflow.com/a/38000985/5175709) answer. I think all answers are still written in a VERY confusing way. **tl;dr** **0)** you don't need to write the implementation isEqual ie == between the hashValues. **1)** Only provide/return `hashValue`. **2)*...
31,664,159
TLDR ==== My custom structure implements the [Hashable Protocol](https://developer.apple.com/library/prerelease/mac/documentation/Swift/Reference/Swift_Hashable_Protocol/index.html). However, when hash collisions occur while inserting keys in a `Dictionary`, they are not automatically handled. How do I overcome this p...
2015/07/27
[ "https://Stackoverflow.com/questions/31664159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3681880/" ]
``` func ==(lhs: MyStructure, rhs: MyStructure) -> Bool { return lhs.hashValue == rhs.hashValue } ``` > > Note the global function to overload the equality operator (==) in order to conform to the Equatable Protocol, which is required by the Hashable Protocol. > > > Your problem is an incorrect *equality* im...
> > the equal hash values cause the collision1 key to be overwritten by > the collision2 key. There is no warning. If such a collision only > happened once in a dictionary with 100 keys, then it could easily be > missed. > > > Hash collision has nothing to do with it. (Hash collisions never affect the result, o...
31,664,159
TLDR ==== My custom structure implements the [Hashable Protocol](https://developer.apple.com/library/prerelease/mac/documentation/Swift/Reference/Swift_Hashable_Protocol/index.html). However, when hash collisions occur while inserting keys in a `Dictionary`, they are not automatically handled. How do I overcome this p...
2015/07/27
[ "https://Stackoverflow.com/questions/31664159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3681880/" ]
``` func ==(lhs: MyStructure, rhs: MyStructure) -> Bool { return lhs.hashValue == rhs.hashValue } ``` > > Note the global function to overload the equality operator (==) in order to conform to the Equatable Protocol, which is required by the Hashable Protocol. > > > Your problem is an incorrect *equality* im...
You can see my comments on this page's answers and [this](https://stackoverflow.com/a/38000985/5175709) answer. I think all answers are still written in a VERY confusing way. **tl;dr** **0)** you don't need to write the implementation isEqual ie == between the hashValues. **1)** Only provide/return `hashValue`. **2)*...
31,664,159
TLDR ==== My custom structure implements the [Hashable Protocol](https://developer.apple.com/library/prerelease/mac/documentation/Swift/Reference/Swift_Hashable_Protocol/index.html). However, when hash collisions occur while inserting keys in a `Dictionary`, they are not automatically handled. How do I overcome this p...
2015/07/27
[ "https://Stackoverflow.com/questions/31664159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3681880/" ]
> > the equal hash values cause the collision1 key to be overwritten by > the collision2 key. There is no warning. If such a collision only > happened once in a dictionary with 100 keys, then it could easily be > missed. > > > Hash collision has nothing to do with it. (Hash collisions never affect the result, o...
You can see my comments on this page's answers and [this](https://stackoverflow.com/a/38000985/5175709) answer. I think all answers are still written in a VERY confusing way. **tl;dr** **0)** you don't need to write the implementation isEqual ie == between the hashValues. **1)** Only provide/return `hashValue`. **2)*...
24,939,727
Something I have just picked up in my winforms app My app does an http call to a web Api service as follows ``` HttpClient _client = new HttpClient(); _client.Timeout = new TimeSpan(0, 3, 0); _client.BaseAddress = new Uri("http://Myserver/MyApp"); _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeade...
2014/07/24
[ "https://Stackoverflow.com/questions/24939727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/121183/" ]
Install the "microsoft asp.net web api 2.2 client libraries" from nuget and don't refer the system.net.http.dll and system.net.http.formatting.dll manually. If you install this package then will install the correct json.net as well
I received the error after updating to a newer version of the Newtonsoft.Json package. Uninstalling the Microsoft.AspNet.WebApi.Client nugget package and reinstalling it after upgrading to the newer Newtonsoft.Json package resolved the issue for me.
24,939,727
Something I have just picked up in my winforms app My app does an http call to a web Api service as follows ``` HttpClient _client = new HttpClient(); _client.Timeout = new TimeSpan(0, 3, 0); _client.BaseAddress = new Uri("http://Myserver/MyApp"); _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeade...
2014/07/24
[ "https://Stackoverflow.com/questions/24939727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/121183/" ]
If all you need is the `PostAsJsonAsync` method, you are better off writing your own extension method. I recommend removing the reference to `Microsoft.AspNet.WebApi.Client` (when I use PostAsJsonAsync from this package, it complains that it can't find an older version of Newtonsoft.Json, but the thing is that I need...
I received the error after updating to a newer version of the Newtonsoft.Json package. Uninstalling the Microsoft.AspNet.WebApi.Client nugget package and reinstalling it after upgrading to the newer Newtonsoft.Json package resolved the issue for me.
12,611
If I paste a string from some web page into an Emacs buffer sometimes it will show the Unicode representation of some characters with a backslash and some octal code. How can I convert this to the character representation? Thanks.
2015/05/22
[ "https://emacs.stackexchange.com/questions/12611", "https://emacs.stackexchange.com", "https://emacs.stackexchange.com/users/8387/" ]
The default value for the variable `org-agenda-repeating-timestamp-show-all` is `t` -- i.e., "*Non-nil means show all occurrences of a repeating stamp in the agenda.*" The variable can be set to "*a list of strings*" to "*only show occurrences of repeating stamps for these TODO keywords*." When the variable is set to `...
**TL;DR:** `(setq org-agenda-show-future-repeats nil)`. --- You have to set `org-agenda-show-future-repeats` to `nil`. The previous option `org-agenda-repeating-timestamp-show-all` [has been removed from Org mode in version 9.1](https://www.orgmode.org/Changes_old.html#org346f28d), as the new pair of options—the prev...
13,631,456
I'm facing a strange problem. I tried to **play a mp4 video on android devices** and it fails to play when video is hosted on my server but same video file plays in same android devices if hosted on other server. I'm facing this problem **only in android devices** I can play video on my desktop no matter wherever it is...
2012/11/29
[ "https://Stackoverflow.com/questions/13631456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1548937/" ]
You could use [jQuery](http://api.jquery.com/jQuery/). Assuming `row` is a DOM element, this should work: ``` var textBoxes = $("input:text", row); ```
i guess the easiest option would be to add the created rows to an array. This way you simply have to delete the rows inside the array and not iterate through the whole table.
13,631,456
I'm facing a strange problem. I tried to **play a mp4 video on android devices** and it fails to play when video is hosted on my server but same video file plays in same android devices if hosted on other server. I'm facing this problem **only in android devices** I can play video on my desktop no matter wherever it is...
2012/11/29
[ "https://Stackoverflow.com/questions/13631456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1548937/" ]
I ended up doing the following: ``` function editRow(row) { var table = document.getElementById("data"); clearExistingTextBoxes(table); ... } function clearExistingTextBoxes(table) { var tBoxRow = table.getElementsByTagName("input"); if (tBoxRow.length > 0) { tBoxRow = tBoxRow[0].parentNode.p...
i guess the easiest option would be to add the created rows to an array. This way you simply have to delete the rows inside the array and not iterate through the whole table.
28,597,300
I have an app that make a calendar event on iOS, the event is added correctly, but I want to display the calendar app with the event as the user added the event; and I have no idea to how i can call to the calendar app.
2015/02/19
[ "https://Stackoverflow.com/questions/28597300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4484583/" ]
In C, you can't do `if ( str1 != str2 )`. You have to use the `strcmp()` functions. Instead of ``` if(ptr->fileName != check){ ``` you would have ``` if ( strcmp(ptr->fileName, check) != 0 ) { ``` `strcmp` returns 0 if the strings are equal, and -1 or 1 depending on whether str1 or str2 is greater than the other...
You have to store the files that you have printed in some where. In each iteration, you need to look in your store to see if that file is already printed or not. Consider the sequence of files: 1. File1 2. File2 3. File1 4. File2 5. File1 It will be printed 5 times. If it is 1. File1 2. File1 3. File1 4. File2 5. ...
6,600
Here is some example input, so I can explain what the problem is: ``` ((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo))) ``` Think of this line of text as a topographic map of some mountains. Each set of parentheses illustrates one unit of altitude. If we "view" this from the side, so that we see the mountains vert...
2012/07/12
[ "https://codegolf.stackexchange.com/questions/6600", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/4303/" ]
Octave, 128 =========== [Very similar to my last answer...](https://codegolf.stackexchange.com/a/52516/41245) ``` p=1;x=[0];y=input(0);for j=1:numel(y);p-=(y(j)==")");x(p,j)=y(j);p+=(y(j)=="(");end;x(x==40)=x(x==41)=x(x==0)=32;char(flipud(x)) ``` ### Test **Input:** `"((1 2)(3 (4 5) moo)) (i (lik(cherries)e (wooho...
VB.net (For S&G) ---------------- Not the prettiest of code. ``` Module Q Sub Main(a As String()) Dim t = a(0) Dim h = 0 For Each m In (From G In (t.Select(Function(c) h += If(c = "(", 1, If(c = ")", -1, 0)) Return h ...
6,600
Here is some example input, so I can explain what the problem is: ``` ((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo))) ``` Think of this line of text as a topographic map of some mountains. Each set of parentheses illustrates one unit of altitude. If we "view" this from the side, so that we see the mountains vert...
2012/07/12
[ "https://codegolf.stackexchange.com/questions/6600", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/4303/" ]
J, 56 chars ----------- ``` '( ) 'charsub|.|:((,~#&' ')"0[:+/\1 _1 0{~'()'&i.)1!:1]1 ``` Another 56-character J solution... I count depth by translating `(` into ⁻1, `)` into 1 and all other characters into 0, and then taking the running sum of this: `[: +/\ 1 _1 0 {~ '()'&i.`. The rest is largely similar to @Gareth...
[AWK](https://www.gnu.org/software/gawk/manual/gawk.html), 145 bytes ==================================================================== ``` x=split($0,a,b){for(;""!=e=a[++b];d+=(e=="(")-(e==")"))for(c=0;c++<x;f=f<d?d:f)z[c]=z[c](c==d?e=="("||e==")"?" ":e:" ")}END{for(;f;)print z[f--]} ``` [Try it online!](https://...