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
49,678
Most of the time people ask duplicate questions, or the same question.I have seen many questions of Stack OverFlow users comments " this is a duplicate" ,"exact duplicate", and the question is closed.It could be better if the question is filtered before asking rather than giving the users related questions.Something li...
2010/05/12
[ "https://meta.stackexchange.com/questions/49678", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/146924/" ]
Presumably the poster is ignoring the suggestions given when the user types in the question title. Why would they pay attention to a differently worded message? If you propose to put up a message box or extra page people will just click through it, seeing it as a unnecessary barrier to the important bit - which is pos...
Hmm... interesting proposition. Well, one thing The Builders wanted to avoid when they built SOFU was having to do too much moderation. So if there's any sort of question filter, it'd have to be community policed. It might be possible to implement something similar to slashdot's firehose. This would be a temporary s...
18,754,689
Here is the code of GetHashCode32 method in C#: ``` public static class StringHelper { public static unsafe int GetHashCode32(this string s) { fixed (char* str = s.ToCharArray()) { char* chPtr = str; int num = 0x15051505; int num2 = num; int* numP...
2013/09/12
[ "https://Stackoverflow.com/questions/18754689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2197931/" ]
I can give you a few reasons why it might be different: Firstly, `0x15051505` == `0b10101000001010001010100000101` which, if you count it, is 29 bits long. Left-shifting that by 5 will produce undefined behaviour according to the C standard, assuming `sizeof(int) <= 4`. Secondly, this line: ``` int *numPtr = (int*)c...
The issue is that the original algorithm reads UTF-16 (Unicode) strings from memory, two at a time. The expected data is padded with zeroes: ``` 0x00350033 (numPtr[0]) lp0: "35" 0x00370034 (numPtr[1]) "47" 0x00370030 (numPtr[0]) lp1: "07" 0x00340030 (numPtr[1]) "04" 0x00350033 (numPtr[0]) lp2: "35" 0x003600...
18,754,689
Here is the code of GetHashCode32 method in C#: ``` public static class StringHelper { public static unsafe int GetHashCode32(this string s) { fixed (char* str = s.ToCharArray()) { char* chPtr = str; int num = 0x15051505; int num2 = num; int* numP...
2013/09/12
[ "https://Stackoverflow.com/questions/18754689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2197931/" ]
I can give you a few reasons why it might be different: Firstly, `0x15051505` == `0b10101000001010001010100000101` which, if you count it, is 29 bits long. Left-shifting that by 5 will produce undefined behaviour according to the C standard, assuming `sizeof(int) <= 4`. Secondly, this line: ``` int *numPtr = (int*)c...
C char is 1 byte and it is signed, C# char is 2 byte and in C# the first byte is unsigned. This means that if you have a string in memory and use a 4-byte int poitner to access that memory, you get 4 chars in C into one int, but only 2 chars in C# into one int. So this can never produce the same result. **How to fix...
18,754,689
Here is the code of GetHashCode32 method in C#: ``` public static class StringHelper { public static unsafe int GetHashCode32(this string s) { fixed (char* str = s.ToCharArray()) { char* chPtr = str; int num = 0x15051505; int num2 = num; int* numP...
2013/09/12
[ "https://Stackoverflow.com/questions/18754689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2197931/" ]
C char is 1 byte and it is signed, C# char is 2 byte and in C# the first byte is unsigned. This means that if you have a string in memory and use a 4-byte int poitner to access that memory, you get 4 chars in C into one int, but only 2 chars in C# into one int. So this can never produce the same result. **How to fix...
The issue is that the original algorithm reads UTF-16 (Unicode) strings from memory, two at a time. The expected data is padded with zeroes: ``` 0x00350033 (numPtr[0]) lp0: "35" 0x00370034 (numPtr[1]) "47" 0x00370030 (numPtr[0]) lp1: "07" 0x00340030 (numPtr[1]) "04" 0x00350033 (numPtr[0]) lp2: "35" 0x003600...
20,107,931
I am following [this tutorial](http://learn.knockoutjs.com/#/?tutorial=loadingsaving) and would like to move the "Add" button into the `foreach` loop. So, every row will have a button that can add a new record on the end. My problem is that moving the form seems to break everything. I have [this (fiddle)](http://jsfid...
2013/11/20
[ "https://Stackoverflow.com/questions/20107931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1618257/" ]
``` 'workflow' in children ``` returns `True/False` if it is/isn't in children Then, your code would be: ``` if 'workflow' in children: print 'workflow' ```
You can use an in line `if` statement. ``` print('workflow' if 'workflow' in children else children) ```
38,061
On shabbat we don't wear tefillin because shabbat is an אות. However yom tov is not referred to as an אות. So why don't we wear tefillin on yom tov?
2014/05/11
[ "https://judaism.stackexchange.com/questions/38061", "https://judaism.stackexchange.com", "https://judaism.stackexchange.com/users/5016/" ]
The Rambam ([Hil. Tefilin 4:10](http://www.mechon-mamre.org/i/2304.htm)) disagrees with you. He says: > > וכן שבתות וימים טובים, אינן זמן תפילין, שנאמר "והיו לך לאות" (ראה שמות יג,ט), ושבתות וימים טובים הן עצמן אות. > > > The Rambam says clearly that Yom Tov is an אות and therefor does not warrant putting on Tefi...
Additionally, Pesach Mitzrayim is refered to in the Torah as an ot, and as all the yamim tovim are connected to the Exodus, there's a sort of transitive operation by which the others can be considered otot as well.
41,308
The PC's are in hiding behind a cliff, they can see the unaware monsters but cannot attack them from their position. If they move out of hiding in the open (in order to have a line-of-effect on the monsters), does this expend their surprise round, or does the combat only start at this point, granting the PC's a surpri...
2014/06/22
[ "https://rpg.stackexchange.com/questions/41308", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/9855/" ]
It all depends on when the monsters becomes aware of the adventurers, either through the monsters seeing (or in some way perceiving) the adventurers, or when the adventurers attack. Lets say the heroes move out of hiding. If the monsters see the heroes appear from behind the cliff, this is the surprise round. Each he...
The move action that takes the PCs out of their hiding spot initiates the surprise round. The reason for this is because at that point it is possible for the creatures to spot them and participate in the surprise round.
54,242,427
I have a Woocommerce search box on my page and I want the button and the search box itself to display in the same line. I tried using the attribute `inline-block` but it didn't seem to work. Source code: ``` <div data-id="b273043" class="elementor-element elementor-element-b273043 searchbar elementor-widget elementor...
2019/01/17
[ "https://Stackoverflow.com/questions/54242427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9941871/" ]
Try adding the `!important` rule to this style or styling the `input` and `button`. Note that the `!important` rule should only be used as a last resort as it can't be overridden. Instead you should override styles using ordering of your styles (in this case make sure your custom CSS is included after the WooCommerce C...
The search input box inside form has width: 100%. Change the width to 50%.
54,242,427
I have a Woocommerce search box on my page and I want the button and the search box itself to display in the same line. I tried using the attribute `inline-block` but it didn't seem to work. Source code: ``` <div data-id="b273043" class="elementor-element elementor-element-b273043 searchbar elementor-widget elementor...
2019/01/17
[ "https://Stackoverflow.com/questions/54242427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9941871/" ]
Just try to add ``` [id^="woocommerce-product-search-field"] { width: auto !important; } ``` somewhere in the end of last added css file
Try adding the `!important` rule to this style or styling the `input` and `button`. Note that the `!important` rule should only be used as a last resort as it can't be overridden. Instead you should override styles using ordering of your styles (in this case make sure your custom CSS is included after the WooCommerce C...
54,242,427
I have a Woocommerce search box on my page and I want the button and the search box itself to display in the same line. I tried using the attribute `inline-block` but it didn't seem to work. Source code: ``` <div data-id="b273043" class="elementor-element elementor-element-b273043 searchbar elementor-widget elementor...
2019/01/17
[ "https://Stackoverflow.com/questions/54242427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9941871/" ]
Just try to add ``` [id^="woocommerce-product-search-field"] { width: auto !important; } ``` somewhere in the end of last added css file
The search input box inside form has width: 100%. Change the width to 50%.
54,242,427
I have a Woocommerce search box on my page and I want the button and the search box itself to display in the same line. I tried using the attribute `inline-block` but it didn't seem to work. Source code: ``` <div data-id="b273043" class="elementor-element elementor-element-b273043 searchbar elementor-widget elementor...
2019/01/17
[ "https://Stackoverflow.com/questions/54242427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9941871/" ]
Please use below code to implement inline form for all browsers. ``` <style> .form-inline{ display: -ms-flexbox; display: flex; -ms-flex-flow: row wrap; flex-flow: row wrap; -ms-flex-align: center; align-items: center; } </style> <form class="form-inline"> <input type="text" name="name" plac...
The search input box inside form has width: 100%. Change the width to 50%.
54,242,427
I have a Woocommerce search box on my page and I want the button and the search box itself to display in the same line. I tried using the attribute `inline-block` but it didn't seem to work. Source code: ``` <div data-id="b273043" class="elementor-element elementor-element-b273043 searchbar elementor-widget elementor...
2019/01/17
[ "https://Stackoverflow.com/questions/54242427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9941871/" ]
Just try to add ``` [id^="woocommerce-product-search-field"] { width: auto !important; } ``` somewhere in the end of last added css file
Please use below code to implement inline form for all browsers. ``` <style> .form-inline{ display: -ms-flexbox; display: flex; -ms-flex-flow: row wrap; flex-flow: row wrap; -ms-flex-align: center; align-items: center; } </style> <form class="form-inline"> <input type="text" name="name" plac...
15,045,770
I have created the below php script for the contact page of my website. The problem with the script is that when a user fills and clicks the submit button, it show a success message but the email is not sent. Can someone please check and tell me where I went wrong. ``` <?php error_reporting(E_ALL ^ E_NOTICE); // h...
2013/02/23
[ "https://Stackoverflow.com/questions/15045770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2103187/" ]
You need to remove the line: ``` $emailSent = true; ``` And change the mail send line to `$emailSent = mail($emailTo, $subject, $body, $headers);` This sets $emailSent to true if the email is accepted for delivery. [PHP Mail](http://php.net/manual/en/function.mail.php)
Instead of ``` mail($emailTo, $subject, $body, $headers); // set our boolean completion value to TRUE $emailSent = true; ``` do `$emailSent = mail($emailTo, $subject, $body, $headers);` otherwise you'll be hardcoding the result, why would you say that the email has been sent if you don't know? what are yo...
15,045,770
I have created the below php script for the contact page of my website. The problem with the script is that when a user fills and clicks the submit button, it show a success message but the email is not sent. Can someone please check and tell me where I went wrong. ``` <?php error_reporting(E_ALL ^ E_NOTICE); // h...
2013/02/23
[ "https://Stackoverflow.com/questions/15045770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2103187/" ]
You need to remove the line: ``` $emailSent = true; ``` And change the mail send line to `$emailSent = mail($emailTo, $subject, $body, $headers);` This sets $emailSent to true if the email is accepted for delivery. [PHP Mail](http://php.net/manual/en/function.mail.php)
I guess, you should try to change the following: ``` if(!isset($hasError)) { ... } ``` condition. You should type: ``` if(!$hasError) { ... } ```
15,045,770
I have created the below php script for the contact page of my website. The problem with the script is that when a user fills and clicks the submit button, it show a success message but the email is not sent. Can someone please check and tell me where I went wrong. ``` <?php error_reporting(E_ALL ^ E_NOTICE); // h...
2013/02/23
[ "https://Stackoverflow.com/questions/15045770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2103187/" ]
You need to remove the line: ``` $emailSent = true; ``` And change the mail send line to `$emailSent = mail($emailTo, $subject, $body, $headers);` This sets $emailSent to true if the email is accepted for delivery. [PHP Mail](http://php.net/manual/en/function.mail.php)
Ensure that your php mail smtp headers is properly configured. below are sample code which works for me. Copy and try it. If the code below does not work for you then try to install Dropifi Contact Widget (www.dropifi.com). They have a very intuitive contact form which you can customize to meet your need. ``` requi...
15,045,770
I have created the below php script for the contact page of my website. The problem with the script is that when a user fills and clicks the submit button, it show a success message but the email is not sent. Can someone please check and tell me where I went wrong. ``` <?php error_reporting(E_ALL ^ E_NOTICE); // h...
2013/02/23
[ "https://Stackoverflow.com/questions/15045770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2103187/" ]
Instead of ``` mail($emailTo, $subject, $body, $headers); // set our boolean completion value to TRUE $emailSent = true; ``` do `$emailSent = mail($emailTo, $subject, $body, $headers);` otherwise you'll be hardcoding the result, why would you say that the email has been sent if you don't know? what are yo...
I guess, you should try to change the following: ``` if(!isset($hasError)) { ... } ``` condition. You should type: ``` if(!$hasError) { ... } ```
15,045,770
I have created the below php script for the contact page of my website. The problem with the script is that when a user fills and clicks the submit button, it show a success message but the email is not sent. Can someone please check and tell me where I went wrong. ``` <?php error_reporting(E_ALL ^ E_NOTICE); // h...
2013/02/23
[ "https://Stackoverflow.com/questions/15045770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2103187/" ]
Instead of ``` mail($emailTo, $subject, $body, $headers); // set our boolean completion value to TRUE $emailSent = true; ``` do `$emailSent = mail($emailTo, $subject, $body, $headers);` otherwise you'll be hardcoding the result, why would you say that the email has been sent if you don't know? what are yo...
Ensure that your php mail smtp headers is properly configured. below are sample code which works for me. Copy and try it. If the code below does not work for you then try to install Dropifi Contact Widget (www.dropifi.com). They have a very intuitive contact form which you can customize to meet your need. ``` requi...
188,856
I read that to get diamonds you should mine a whole chunk. what's this "mining a whole chunk" mean? I would also like to ask that would I get diamond for sure?
2014/10/21
[ "https://gaming.stackexchange.com/questions/188856", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/90465/" ]
What Kenjara said about chunk size is correct. However I would add the following points. * Diamond Ore only appears below level 16 * The highest concentration of diamonds occurs between levels 5-12 but because of lava lakes there is slightly less in the middle of that (~9) * There is ~1 diamond ore vein generated per ...
A single chunk is A 16 X 16 area 256 blocks deep. It is probably saying to mine a 16 x 16 area at the level diamonds appear. As far as I am aware this will not certainly get you diamonds. You are probably better off looking for dirt at the levels diamond exist and mining all of the dirt as diamonds can appear among it...
188,856
I read that to get diamonds you should mine a whole chunk. what's this "mining a whole chunk" mean? I would also like to ask that would I get diamond for sure?
2014/10/21
[ "https://gaming.stackexchange.com/questions/188856", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/90465/" ]
A single chunk is A 16 X 16 area 256 blocks deep. It is probably saying to mine a 16 x 16 area at the level diamonds appear. As far as I am aware this will not certainly get you diamonds. You are probably better off looking for dirt at the levels diamond exist and mining all of the dirt as diamonds can appear among it...
This tip is using the crawl feature. Mine one side of the outline of a chunk (just the levels that diamonds spawn)(or you can do 9-12 y to be more efficient, then do multiple chunks), as it has a guaranteed number of diamonds that I forget, then on that side, use the crawl feature with a trapdoor or piston and mine lik...
188,856
I read that to get diamonds you should mine a whole chunk. what's this "mining a whole chunk" mean? I would also like to ask that would I get diamond for sure?
2014/10/21
[ "https://gaming.stackexchange.com/questions/188856", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/90465/" ]
A single chunk is A 16 X 16 area 256 blocks deep. It is probably saying to mine a 16 x 16 area at the level diamonds appear. As far as I am aware this will not certainly get you diamonds. You are probably better off looking for dirt at the levels diamond exist and mining all of the dirt as diamonds can appear among it...
1.18+ Answer ------------ Diamond ore generation has changed since this question was asked. It's also different between Java and Bedrock. Diamonds will only generate from y14 to y-63, and is more likely to generate the lower down you are. This is the same for both versions. I only want to calculate this once, so I wil...
188,856
I read that to get diamonds you should mine a whole chunk. what's this "mining a whole chunk" mean? I would also like to ask that would I get diamond for sure?
2014/10/21
[ "https://gaming.stackexchange.com/questions/188856", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/90465/" ]
What Kenjara said about chunk size is correct. However I would add the following points. * Diamond Ore only appears below level 16 * The highest concentration of diamonds occurs between levels 5-12 but because of lava lakes there is slightly less in the middle of that (~9) * There is ~1 diamond ore vein generated per ...
This tip is using the crawl feature. Mine one side of the outline of a chunk (just the levels that diamonds spawn)(or you can do 9-12 y to be more efficient, then do multiple chunks), as it has a guaranteed number of diamonds that I forget, then on that side, use the crawl feature with a trapdoor or piston and mine lik...
188,856
I read that to get diamonds you should mine a whole chunk. what's this "mining a whole chunk" mean? I would also like to ask that would I get diamond for sure?
2014/10/21
[ "https://gaming.stackexchange.com/questions/188856", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/90465/" ]
What Kenjara said about chunk size is correct. However I would add the following points. * Diamond Ore only appears below level 16 * The highest concentration of diamonds occurs between levels 5-12 but because of lava lakes there is slightly less in the middle of that (~9) * There is ~1 diamond ore vein generated per ...
1.18+ Answer ------------ Diamond ore generation has changed since this question was asked. It's also different between Java and Bedrock. Diamonds will only generate from y14 to y-63, and is more likely to generate the lower down you are. This is the same for both versions. I only want to calculate this once, so I wil...
188,856
I read that to get diamonds you should mine a whole chunk. what's this "mining a whole chunk" mean? I would also like to ask that would I get diamond for sure?
2014/10/21
[ "https://gaming.stackexchange.com/questions/188856", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/90465/" ]
1.18+ Answer ------------ Diamond ore generation has changed since this question was asked. It's also different between Java and Bedrock. Diamonds will only generate from y14 to y-63, and is more likely to generate the lower down you are. This is the same for both versions. I only want to calculate this once, so I wil...
This tip is using the crawl feature. Mine one side of the outline of a chunk (just the levels that diamonds spawn)(or you can do 9-12 y to be more efficient, then do multiple chunks), as it has a guaranteed number of diamonds that I forget, then on that side, use the crawl feature with a trapdoor or piston and mine lik...
94,948
Your task is to regulate traffic on a crossroads. There are 4 roads coming from north, east, south and west. The input is a string representing the upcoming traffic on each road. For example, `NNNWS` indicates there is a total of 5 cars: three at the north, one at the west and one at the south. The order of characters...
2016/09/30
[ "https://codegolf.stackexchange.com/questions/94948", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/13798/" ]
Perl, 65 bytes ============== Includes +2 for `-lp` Give input on STDIN. Assumes the empty string is not a valid input ``` #!/usr/bin/perl -lp s%.%'+(y/NESW/ESWN/*s/N(.*)W/W$1N/,/N/^/S/)'x4%gere+0or$_=stuck ``` If you don't mind the absence of a newline after `stuck` you can drop the `l` option
JavaScript (ES6), ~~108~~ ~~107~~ ~~106~~ 104 bytes --------------------------------------------------- ``` s=>(r=t=`NESWNE`,s.replace(/./g,c=>r|=2<<t.search(c)),t.substr(449778192>>r&3,1053417876>>r&3)||`stuck`) ``` Accumulates a bitmask of which directions have approaching cars and extracts the appropriate portion...
94,948
Your task is to regulate traffic on a crossroads. There are 4 roads coming from north, east, south and west. The input is a string representing the upcoming traffic on each road. For example, `NNNWS` indicates there is a total of 5 cars: three at the north, one at the west and one at the south. The order of characters...
2016/09/30
[ "https://codegolf.stackexchange.com/questions/94948", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/13798/" ]
PHP, 267 Bytes ============== use the new [spaceship operator](http://php.net/manual/en/language.operators.comparison.php) and [usort](http://php.net/manual/en/function.usort.php) -5 Bytes by @IsmaelMiguel ``` <?foreach($f=[E,S,W,N]as$l)$s.=+!($r=strstr)($i=$argv[1],$l);if(in_array($s,[0101,1010,0000]))die(stuck);$x=...
JavaScript (ES6), ~~108~~ ~~107~~ ~~106~~ 104 bytes --------------------------------------------------- ``` s=>(r=t=`NESWNE`,s.replace(/./g,c=>r|=2<<t.search(c)),t.substr(449778192>>r&3,1053417876>>r&3)||`stuck`) ``` Accumulates a bitmask of which directions have approaching cars and extracts the appropriate portion...
94,948
Your task is to regulate traffic on a crossroads. There are 4 roads coming from north, east, south and west. The input is a string representing the upcoming traffic on each road. For example, `NNNWS` indicates there is a total of 5 cars: three at the north, one at the west and one at the south. The order of characters...
2016/09/30
[ "https://codegolf.stackexchange.com/questions/94948", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/13798/" ]
Perl, 65 bytes ============== Includes +2 for `-lp` Give input on STDIN. Assumes the empty string is not a valid input ``` #!/usr/bin/perl -lp s%.%'+(y/NESW/ESWN/*s/N(.*)W/W$1N/,/N/^/S/)'x4%gere+0or$_=stuck ``` If you don't mind the absence of a newline after `stuck` you can drop the `l` option
Batch, 216 bytes ---------------- ``` @echo off set/pt= set/an=2,e=4,s=8,w=16,r=0 :l set/ar^|=%t:~0,1% set t=%t:~1% if not "%t%"=="" goto l set/a"o=449778192>>r&3,l=1053417876>>r&3" if %l%==0 (echo stuck)else set t=NESWNE&call echo %%t:~%o%,%l%%% ``` Simple port of my JavaScript answer. Takes input on STDIN in upper...
94,948
Your task is to regulate traffic on a crossroads. There are 4 roads coming from north, east, south and west. The input is a string representing the upcoming traffic on each road. For example, `NNNWS` indicates there is a total of 5 cars: three at the north, one at the west and one at the south. The order of characters...
2016/09/30
[ "https://codegolf.stackexchange.com/questions/94948", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/13798/" ]
PHP, 267 Bytes ============== use the new [spaceship operator](http://php.net/manual/en/language.operators.comparison.php) and [usort](http://php.net/manual/en/function.usort.php) -5 Bytes by @IsmaelMiguel ``` <?foreach($f=[E,S,W,N]as$l)$s.=+!($r=strstr)($i=$argv[1],$l);if(in_array($s,[0101,1010,0000]))die(stuck);$x=...
Batch, 216 bytes ---------------- ``` @echo off set/pt= set/an=2,e=4,s=8,w=16,r=0 :l set/ar^|=%t:~0,1% set t=%t:~1% if not "%t%"=="" goto l set/a"o=449778192>>r&3,l=1053417876>>r&3" if %l%==0 (echo stuck)else set t=NESWNE&call echo %%t:~%o%,%l%%% ``` Simple port of my JavaScript answer. Takes input on STDIN in upper...
28,533,785
``` var names = "John Keynes Carl Gauss Paul Feyerabend Antoine Lavoisier" ``` Result in output should be : ``` "John Keynes","Carl Gauss","Paul Feyerabend","Antoine Lavoisier" ```
2015/02/16
[ "https://Stackoverflow.com/questions/28533785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1960859/" ]
This does it using `dplyr` ``` library(dplyr) df %>% group_by(ID, var) %>% mutate(tf = ifelse(value==lag(value), 1, 0)) %>% filter(is.na(tf) | tf==0) %>% select(-tf) # ID var TIME value method #1 1 3 0 2 1 #2 1 3 3 0 1 #3 1 4 0 10 1 #4 1 4 4 5 1...
Base solution: ``` df[with(df, abs(ave(value,ID,FUN=function(x) c(1,diff(x)) ))) > 0,] # ID var TIME value method #1 1 3 0 2 1 #3 1 3 3 0 1 #4 1 4 0 10 1 #6 1 4 4 5 1 #8 2 3 0 2 1 #10 2 3 3 0 1 #11 2 4 0 10 1...
28,533,785
``` var names = "John Keynes Carl Gauss Paul Feyerabend Antoine Lavoisier" ``` Result in output should be : ``` "John Keynes","Carl Gauss","Paul Feyerabend","Antoine Lavoisier" ```
2015/02/16
[ "https://Stackoverflow.com/questions/28533785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1960859/" ]
This does it using `dplyr` ``` library(dplyr) df %>% group_by(ID, var) %>% mutate(tf = ifelse(value==lag(value), 1, 0)) %>% filter(is.na(tf) | tf==0) %>% select(-tf) # ID var TIME value method #1 1 3 0 2 1 #2 1 3 3 0 1 #3 1 4 0 10 1 #4 1 4 4 5 1...
From the expected results, you may also try `rleid` from `data.table` ``` library(data.table)#data.table_1.9.5 setDT(df)[df[, .I[1L] , list(ID, var, rleid(value))]$V1] # ID var TIME value method #1: 1 3 0 2 1 #2: 1 3 3 0 1 #3: 1 4 0 10 1 #4: 1 4 4 5 1 #5:...
28,533,785
``` var names = "John Keynes Carl Gauss Paul Feyerabend Antoine Lavoisier" ``` Result in output should be : ``` "John Keynes","Carl Gauss","Paul Feyerabend","Antoine Lavoisier" ```
2015/02/16
[ "https://Stackoverflow.com/questions/28533785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1960859/" ]
Base solution: ``` df[with(df, abs(ave(value,ID,FUN=function(x) c(1,diff(x)) ))) > 0,] # ID var TIME value method #1 1 3 0 2 1 #3 1 3 3 0 1 #4 1 4 0 10 1 #6 1 4 4 5 1 #8 2 3 0 2 1 #10 2 3 3 0 1 #11 2 4 0 10 1...
From the expected results, you may also try `rleid` from `data.table` ``` library(data.table)#data.table_1.9.5 setDT(df)[df[, .I[1L] , list(ID, var, rleid(value))]$V1] # ID var TIME value method #1: 1 3 0 2 1 #2: 1 3 3 0 1 #3: 1 4 0 10 1 #4: 1 4 4 5 1 #5:...
1,149,798
**Q**: I have two monitors with different scaling on the same window. Any ideas on how to fix this issue? I also have a minor issue with new windows or browser windows opening half off screen and I think it could be related by not sure. **Info**: I have a Optiplex 990 with an NVidia GTX 750 Ti for CAD and modeling on ...
2016/11/25
[ "https://superuser.com/questions/1149798", "https://superuser.com", "https://superuser.com/users/668071/" ]
Everything works as expected. Your screens have different physical pixel sizes. * Dell UP3214Q's pixels are 0.182 mm in size with density of 140 PPI (pixels per inch) * Dell P2213's pixels are 0.282 mm in size with density of 90 PPI Task Manager window on your screenshot is 806px high. Divide that by screen's densit...
Scaling is working. You have the resolution on one monitor set a lot higher then the other so you are getting the scaling difference when Task Manager overlaps both monitors. Make the resolution the same on both monitors. I would also use the correct Nvidia drivers and the Nvidia Control Panel. It is much better than ...
57,106,059
I want to know the regexp for the following case: The string contains an uppercase word in a single line with two newlines before. After that, there are several lines of alphanumeric letters (maybe non-ASCII utf-8) or maybe an empty line. I want to capture the whole portion starting with the uppercase word in a line a...
2019/07/19
[ "https://Stackoverflow.com/questions/57106059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7829174/" ]
Here is one approach using `re.findall`: ``` matches = re.findall(r'(?:^|\n\n)([A-Z]{3,}.*?)(?=\n\n[A-Z]{3,}\n|$)', input, flags=re.DOTALL) print(matches) ``` This prints: ``` ['ASDF\nwqer rtre 34 $^&% fsfa\nDDwrgd 43 er 1. ewrtfg\n324rfegf 4gfgre', 'QWE\npritoy Fbhfg 45345 )*9\ntret 345 gret54\nretre 56 gre ger\n...
Try this: ``` regex = re.compile(r"^[A-Z]+\r?\n(?:(?!^\r?\n[A-Z]+\r?\n).)*", re.MULTILINE|re.DOTALL) ``` **Explanation:** ``` ^ # Start of line [A-Z]+ # Match uppercase ASCII keyword \r?\n # Match newline (?: # Start of non-capturing group (?...
57,106,059
I want to know the regexp for the following case: The string contains an uppercase word in a single line with two newlines before. After that, there are several lines of alphanumeric letters (maybe non-ASCII utf-8) or maybe an empty line. I want to capture the whole portion starting with the uppercase word in a line a...
2019/07/19
[ "https://Stackoverflow.com/questions/57106059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7829174/" ]
Here is one approach using `re.findall`: ``` matches = re.findall(r'(?:^|\n\n)([A-Z]{3,}.*?)(?=\n\n[A-Z]{3,}\n|$)', input, flags=re.DOTALL) print(matches) ``` This prints: ``` ['ASDF\nwqer rtre 34 $^&% fsfa\nDDwrgd 43 er 1. ewrtfg\n324rfegf 4gfgre', 'QWE\npritoy Fbhfg 45345 )*9\ntret 345 gret54\nretre 56 gre ger\n...
This expression is likely to extract our desired outputs: ``` (?=^[A-Z]+$)([\s\S]*?)(?=^[A-Z]+$)|([\s\S]*) ``` The expression is explained on the top right panel of [this demo](https://regex101.com/r/8MeWml/1/) if you wish to explore/simplify/modify it. ### Test ``` import re regex = r"(?=^[A-Z]+$)([\s\S]*?)(?=^[...
45,059
Is there any way to have the region highlighted *without* `transient-mark-mode` on? I'm trying to implement [kakoune](https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc) style editing in emacs and having a persistent region actually makes sense under that editing model. EDIT: Clarification According...
2018/09/30
[ "https://emacs.stackexchange.com/questions/45059", "https://emacs.stackexchange.com", "https://emacs.stackexchange.com/users/20354/" ]
Solved it. The problem was that I had `.emacs` in `~/.emacs.d` rather than in `~/`.
This worked for me: Evil Manual installation worked for me: <https://evil.readthedocs.io/en/latest/overview.html#installation-via-package-el> clone evil repo somewhere you know the path, I recommend ~, so run: ``` git clone --depth 1 https://github.com/emacs-evil/evil.git ``` then add these line to your `.emacs...
22,341,684
It's be awhile since I touched C++, but I'm writing inside my main I have a function called "solution" and right now that line is giving me the error: "a function definition is not allowed here before '{'" Afterwards I thought I was supposed to write my funciton definitions after my main(), but that led to another slu...
2014/03/12
[ "https://Stackoverflow.com/questions/22341684", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3403364/" ]
First of all, you need to *declare* your function before you use it in your main function. You can then *define* it after your main function if you so desire. The compiler goes from top to bottom, and it only knows about what it has seen up to that point. The compiler has not yet seen the solution function when you cal...
Function definitions should go before your main() if you want to have them in the same source file
38,535,993
My app built with Phonegap Build and using the Crosswalk plugin is crashing after a little bit of use on Android. I have absolutely no idea why this is happening after constant Googling and debugging attempts. Any help is appreciated. My logcat output right before and after the crash: ``` D/XWalkLib(26498): Pre init...
2016/07/22
[ "https://Stackoverflow.com/questions/38535993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3308071/" ]
the stacktrace reads: ``` D/dalvikvm(26498): No JNI_OnLoad found in /data/app-lib/com.foo.bar-1/libxwalkdummy.so 0x42865d60, skipping init ``` this either means, that the JNI Specification within the Java source is absent and subsequently leads to the `Error loading extension` and `Failed to initialize extension` er...
i sugest you remove the android platform then add again. Then build again. This helped me a while ago.
51,397,591
I'm using `POSTGIS="2.4"` and `Postgresql 9.6` and facing following error [![https://i.stack.imgur.com/DCUCD.gif](https://i.stack.imgur.com/DCUCD.gif)](https://i.stack.imgur.com/DCUCD.gif) While trying to insert polygon data > > INSERT INTO aalis.mv\_l1\_parcelownership\_aalis (geometry) VALUES > (st\_Polygonfrom...
2018/07/18
[ "https://Stackoverflow.com/questions/51397591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10091927/" ]
You're close :-) The geometry you provided in your insert statement is invalid. Make sure that your `POLYGONS` are really correct and try one of these statements (using [`ST_GeomFromText`](http://www.postgis.net/docs/ST_GeomFromText.html) or [`ST_PolygonFromText`](https://postgis.net/docs/ST_PolygonFromText.html)): ...
Your polygon text is way off, and includes the characters `.....`, which are not valid: ``` polygon(482449.20552234241, 999758.79058533313,.....) ``` Not sure what your coordinates are, but the polygon text is generally in the form: ``` polygon((1.000 1.000, 2.000 1.500, 3.000 2.000, 1.000 1.000)) ``` Note that t...
52,285,496
I have the following data set. ``` > y DF GE 2006-12-21 -0.0004659447 -0.009960682 2006-12-22 -0.0009323238 -0.005295208 2006-12-26 -0.0032661785 0.003726377 2006-12-27 0.0042131332 0.002121453 2006-12-28 -0.0009323238 -0.008203228 2006-12-29 -0.0135313109 -0.007203842 ``` When I forti...
2018/09/11
[ "https://Stackoverflow.com/questions/52285496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5731191/" ]
Do you mean something like this? ``` library(tidyverse) df %>% rownames_to_column("date") %>% mutate(date = as.Date(date)) %>% ggplot(aes(x = DF, y = GE)) + geom_point(aes(colour = date)) ``` [![enter image description here](https://i.stack.imgur.com/uffq8.png)](https://i.stack.imgur.com/uffq8.png) ...
I wouldn't use `fortify()`. I would keep your data the way it is and do something like: ``` library(tidyverse) y %>% rownames_to_column() %>% ggplot(aes(x = DF, y = GE, color = index) + geom_point() ```
45,133,858
I have a simple Javascript code I want to run once per browser session, in a given website. To clarify: 1. I open a browser session (window), say, Firefox. 2. I go to a certain webpage matched in Greasemonkey (say, google.com). 3. My script runs. 4. I fully refresh the wepbage (CTRL+F5), and the script no longer run...
2017/07/16
[ "https://Stackoverflow.com/questions/45133858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6628219/" ]
it's list binding issue. this is the greate article about list binding in mvc: [Model Binding To A List](http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx/)
That is an indexing issue. ``` @model ICollection<string> @{ ViewBag.Title = "Home Page"; } @using (Html.BeginForm("Index", "Home", FormMethod.Post)) { @for(int index = 0; index < Mode.Count; i++) { @Html.EditorFor(x => x[index]) } <input id="btnSubmit" type="submit" value="Submit" /> } `...
45,133,858
I have a simple Javascript code I want to run once per browser session, in a given website. To clarify: 1. I open a browser session (window), say, Firefox. 2. I go to a certain webpage matched in Greasemonkey (say, google.com). 3. My script runs. 4. I fully refresh the wepbage (CTRL+F5), and the script no longer run...
2017/07/16
[ "https://Stackoverflow.com/questions/45133858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6628219/" ]
Possible duplicate of [Strange behaviour in ASP.NET MVC: removing item from a list in a nested structure always removes the last item](https://stackoverflow.com/questions/4438904/strange-behaviour-in-asp-net-mvc-removing-item-from-a-list-in-a-nested-structur) When removing items from a list on a postback, I don't need...
That is an indexing issue. ``` @model ICollection<string> @{ ViewBag.Title = "Home Page"; } @using (Html.BeginForm("Index", "Home", FormMethod.Post)) { @for(int index = 0; index < Mode.Count; i++) { @Html.EditorFor(x => x[index]) } <input id="btnSubmit" type="submit" value="Submit" /> } `...
45,133,858
I have a simple Javascript code I want to run once per browser session, in a given website. To clarify: 1. I open a browser session (window), say, Firefox. 2. I go to a certain webpage matched in Greasemonkey (say, google.com). 3. My script runs. 4. I fully refresh the wepbage (CTRL+F5), and the script no longer run...
2017/07/16
[ "https://Stackoverflow.com/questions/45133858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6628219/" ]
it's list binding issue. this is the greate article about list binding in mvc: [Model Binding To A List](http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx/)
Using the information in the answer that Masound posted, I was able to create a solution to this problem. It turns out the problem is that I was using a sequential collection where each index relies on the previous one being present. So when I removed one element from the collection, I lost the link to the other items ...
45,133,858
I have a simple Javascript code I want to run once per browser session, in a given website. To clarify: 1. I open a browser session (window), say, Firefox. 2. I go to a certain webpage matched in Greasemonkey (say, google.com). 3. My script runs. 4. I fully refresh the wepbage (CTRL+F5), and the script no longer run...
2017/07/16
[ "https://Stackoverflow.com/questions/45133858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6628219/" ]
Possible duplicate of [Strange behaviour in ASP.NET MVC: removing item from a list in a nested structure always removes the last item](https://stackoverflow.com/questions/4438904/strange-behaviour-in-asp-net-mvc-removing-item-from-a-list-in-a-nested-structur) When removing items from a list on a postback, I don't need...
it's list binding issue. this is the greate article about list binding in mvc: [Model Binding To A List](http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx/)
45,133,858
I have a simple Javascript code I want to run once per browser session, in a given website. To clarify: 1. I open a browser session (window), say, Firefox. 2. I go to a certain webpage matched in Greasemonkey (say, google.com). 3. My script runs. 4. I fully refresh the wepbage (CTRL+F5), and the script no longer run...
2017/07/16
[ "https://Stackoverflow.com/questions/45133858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6628219/" ]
Possible duplicate of [Strange behaviour in ASP.NET MVC: removing item from a list in a nested structure always removes the last item](https://stackoverflow.com/questions/4438904/strange-behaviour-in-asp-net-mvc-removing-item-from-a-list-in-a-nested-structur) When removing items from a list on a postback, I don't need...
Using the information in the answer that Masound posted, I was able to create a solution to this problem. It turns out the problem is that I was using a sequential collection where each index relies on the previous one being present. So when I removed one element from the collection, I lost the link to the other items ...
16,609,358
I have made a custom combo files that is using in my project.Those files are here [UICombo.h](http://pastebin.com/VzbzSsFu) and [UICombo.m](http://pastebin.com/1jcek1B0). All is working fine except it add white mark over my super view on which it is added while scrolling. I am not able to understand why it is happeni...
2013/05/17
[ "https://Stackoverflow.com/questions/16609358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1305001/" ]
set tableview z-position to -100 that is less than 0.And it is working as I have implemented in your example codes.Try adding following line before adding table view to self in init method in UICombo.m file. ``` [_tableView.layer setZPosition:-100]; ```
I think you need to use the `clipsoBounds` property of your `UICombo` or on some of the views that it uses internally to draw itself. If you have structured this class nicely it will manage any other views that get created when it expands and on one of those views you should set `clipsToBounds` to `YES`, perhaps on the...
39,894,993
In cassandra I have a list column type. I am new to spark and scala, and have no idea where to start. In spark I want get count of each values, is it possible to do so. Below is the dataframe ``` +--------------------+------------+ | id| data| +--------------------+------------+ |53e5c3b0-8c83-...
2016/10/06
[ "https://Stackoverflow.com/questions/39894993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2539103/" ]
Here you go : ``` scala> val rdd = sc.parallelize( Seq( ("53e5c3b0-8c83-11e", Array("b", "c")), ("53e5c3b0-8c83-11e1", Array("a", "b")), ("53e5c3b0-8c83-11e2", Array("a", "b", "c")), ("53e5c3b0-8c83-11e3", Array("a", "b", "c", "d")))) // rdd: org.apache.spark.rdd.RDD[(String, Array[String])] = Parall...
You need something like this (from [Apache Spark Examples](http://spark.apache.org/examples.html)): ``` val textFile = sc.textFile("hdfs://...") val counts = textFile .flatMap(line => line.split(" ")) .map(word => (word, 1)) .reduceByKey(_ + _) ``` Guessing that you already hav...
69,627,255
Say I have the following function: ```py def sub1(a,b,foo="bar"): print(a+b) print(foo) def main(*args,**kwargs): a,b = args sub1(a,b,**kwargs) ``` I can do ```py main(2,3) #5, bar main(2,3,foo="baz") #5, baz ``` which works fine. But say I have parse an additioanl keyword-argument like ```py m...
2021/10/19
[ "https://Stackoverflow.com/questions/69627255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6224975/" ]
it is because of the class h-auto. if you change it to an absolute value, the transition will works. <https://play.tailwindcss.com/C68QXPaQs0>
Maik's answer works perfectly, but you also have the option of using scale on hover if you want it to centrally stay in the same place. <https://play.tailwindcss.com/JISPGXFeIT>
72,052
I've heard Steam will support Linux, but I can't wait. So I want to know if it is possible to play Dota 2 using wine or something. Has anyone tried? I'm on Ubuntu 12.04, and I have never used Wine, so I'm not sure how it works.
2012/06/04
[ "https://gaming.stackexchange.com/questions/72052", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/20550/" ]
Yes, actually. Wine will run Steam and DotA 2 (along with other source games, including TF2) fine. There are some particle rendering and lighting issues though. Also, performance varies by desktop environment. XFCE and LXDE have the best track record, where Unity and KDE have the worse. There is also a pulseaudio bug t...
[Dota 2 is now supported on Linux](http://blog.dota2.com/2013/07/wish-you-were-here/)! > > Not only can you now watch games in client on Mac and Linux computers, the complete Dota 2 game is available for Mac and Linux players. > [Grab it here](http://store.steampowered.com/app/570/). > > >
344,191
I was wondering what "Online" actually means. It seems to me as though people waiting in lobby are "*BATTLE ROYALE LOBBY n/4*", and people in a game are "*PLAYING BR ..*" but what is "*Online*"? Launcher open on the desktop but game closed? Creative? STW? Or is it just the same as br lobby?
2018/12/30
[ "https://gaming.stackexchange.com/questions/344191", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/224628/" ]
Online usually refers to console players. ========================================= It's when they exited out of Fortnite but didn't actually stop the application, i.e it's when they just press home while they were playing and are now playing a different game. Otherwise it means that they are still entering the game....
I am not completely sure but I think "online" means that they are on the loading screen or they are selecting the gamemode.
52,488,040
So I've been trying to get this running but can't figure out what's wrong. My only intention is to create pthreads and output their IDs on the console. Just got started with c++ so I'm not sure where I'm going wrong. Can you take a look at this and perhaps help me out? Thanks ``` void *printer(void* temp) { pthrea...
2018/09/24
[ "https://Stackoverflow.com/questions/52488040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9865875/" ]
A simple way to do this is change `mini` to `i` for everything except the assignment of `i` and then change `i++` to `i +=7` ``` for(int i = mini ; i <= maxi; i+=7) { if(i<maxi) { System.out.print(i + ", "); } else { System.out.print(i); } } ``` ***Output:*** ``` 26, 33, 40, 47, 5...
You can use this solution: ``` for(; mini <= maxi ; mini+=7 ) { if(mini <maxi) { System.out.print( mini + ", "); } else { System.out.print( mini ); } } ```
52,488,040
So I've been trying to get this running but can't figure out what's wrong. My only intention is to create pthreads and output their IDs on the console. Just got started with c++ so I'm not sure where I'm going wrong. Can you take a look at this and perhaps help me out? Thanks ``` void *printer(void* temp) { pthrea...
2018/09/24
[ "https://Stackoverflow.com/questions/52488040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9865875/" ]
A simple way to do this is change `mini` to `i` for everything except the assignment of `i` and then change `i++` to `i +=7` ``` for(int i = mini ; i <= maxi; i+=7) { if(i<maxi) { System.out.print(i + ", "); } else { System.out.print(i); } } ``` ***Output:*** ``` 26, 33, 40, 47, 5...
there is really no need to check if i is less than maxi again, I guess it's for the comma sake but it can be simplify as below. ``` for(int i = mini ; i <= maxi; i+=7) {System.out.println(i); } ```
52,488,040
So I've been trying to get this running but can't figure out what's wrong. My only intention is to create pthreads and output their IDs on the console. Just got started with c++ so I'm not sure where I'm going wrong. Can you take a look at this and perhaps help me out? Thanks ``` void *printer(void* temp) { pthrea...
2018/09/24
[ "https://Stackoverflow.com/questions/52488040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9865875/" ]
A simple way to do this is change `mini` to `i` for everything except the assignment of `i` and then change `i++` to `i +=7` ``` for(int i = mini ; i <= maxi; i+=7) { if(i<maxi) { System.out.print(i + ", "); } else { System.out.print(i); } } ``` ***Output:*** ``` 26, 33, 40, 47, 5...
You do not need to change the mini value, let it be as it is and use i instead of mini for the for loop, this much should do, further do you want the last comma to be printed ? ``` for(int i = mini ; i <= maxi;i=i+7) { if(i<maxi) { System.out.print( i + ", "); } } ```
4,884,860
I've codes below: (Please check out codes below on Google Chrome 8+) codes 1: ``` <!DOCTYPE html> <meta charset="utf-8"> <title>An HTML5 document</title> <div style="background:red; height:300px; width:1500px;"> WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW <img src="http://www.google.com/im...
2011/02/03
[ "https://Stackoverflow.com/questions/4884860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563609/" ]
As I wrote in [another question](https://stackoverflow.com/questions/313555/light-c-unicode-library/313559#313559), [utf8proc](https://julialang.org/utf8proc/) is a very nice, lightweight, library for basic Unicode functionality, including Unicode string normalization.
"Lightweight" in your context means "with limited functionality". I would use ICU source as an example, and reference <http://unicode.org/reports/tr15/> to implement this "lightweight" functionality.
4,884,860
I've codes below: (Please check out codes below on Google Chrome 8+) codes 1: ``` <!DOCTYPE html> <meta charset="utf-8"> <title>An HTML5 document</title> <div style="background:red; height:300px; width:1500px;"> WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW <img src="http://www.google.com/im...
2011/02/03
[ "https://Stackoverflow.com/questions/4884860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563609/" ]
As I wrote in [another question](https://stackoverflow.com/questions/313555/light-c-unicode-library/313559#313559), [utf8proc](https://julialang.org/utf8proc/) is a very nice, lightweight, library for basic Unicode functionality, including Unicode string normalization.
You could build ICU with minimal (or possibly, no other data- I think all of the normalization data is now internal), and then statically link. I haven't tried this recently, but I believe the total size is pretty small in that case.
4,884,860
I've codes below: (Please check out codes below on Google Chrome 8+) codes 1: ``` <!DOCTYPE html> <meta charset="utf-8"> <title>An HTML5 document</title> <div style="background:red; height:300px; width:1500px;"> WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW <img src="http://www.google.com/im...
2011/02/03
[ "https://Stackoverflow.com/questions/4884860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563609/" ]
As I wrote in [another question](https://stackoverflow.com/questions/313555/light-c-unicode-library/313559#313559), [utf8proc](https://julialang.org/utf8proc/) is a very nice, lightweight, library for basic Unicode functionality, including Unicode string normalization.
For Windows, there is the `NormalizeString()` function (unfortunately for Vista and later only - as far as I see on MSDN): <http://msdn.microsoft.com/en-us/library/windows/desktop/dd319093%28v=vs.85%29.aspx> It's the simplest way to go that I have found so far. I guess it's quite lightweight too. ``` int NormalizeSt...
4,884,860
I've codes below: (Please check out codes below on Google Chrome 8+) codes 1: ``` <!DOCTYPE html> <meta charset="utf-8"> <title>An HTML5 document</title> <div style="background:red; height:300px; width:1500px;"> WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW <img src="http://www.google.com/im...
2011/02/03
[ "https://Stackoverflow.com/questions/4884860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563609/" ]
As I wrote in [another question](https://stackoverflow.com/questions/313555/light-c-unicode-library/313559#313559), [utf8proc](https://julialang.org/utf8proc/) is a very nice, lightweight, library for basic Unicode functionality, including Unicode string normalization.
A good UTF-8 solution is glib's [g\_utf8\_normalize()](https://developer.gnome.org/glib/unstable/glib-Unicode-Manipulation.html#g-utf8-normalize) function. Would require to convert std::wstring to std::string (utf16 to utf8) if you need this for wstring too (which would make it quite an expensive solution, hence I'm lo...
4,884,860
I've codes below: (Please check out codes below on Google Chrome 8+) codes 1: ``` <!DOCTYPE html> <meta charset="utf-8"> <title>An HTML5 document</title> <div style="background:red; height:300px; width:1500px;"> WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW <img src="http://www.google.com/im...
2011/02/03
[ "https://Stackoverflow.com/questions/4884860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563609/" ]
You could build ICU with minimal (or possibly, no other data- I think all of the normalization data is now internal), and then statically link. I haven't tried this recently, but I believe the total size is pretty small in that case.
"Lightweight" in your context means "with limited functionality". I would use ICU source as an example, and reference <http://unicode.org/reports/tr15/> to implement this "lightweight" functionality.
4,884,860
I've codes below: (Please check out codes below on Google Chrome 8+) codes 1: ``` <!DOCTYPE html> <meta charset="utf-8"> <title>An HTML5 document</title> <div style="background:red; height:300px; width:1500px;"> WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW <img src="http://www.google.com/im...
2011/02/03
[ "https://Stackoverflow.com/questions/4884860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563609/" ]
For Windows, there is the `NormalizeString()` function (unfortunately for Vista and later only - as far as I see on MSDN): <http://msdn.microsoft.com/en-us/library/windows/desktop/dd319093%28v=vs.85%29.aspx> It's the simplest way to go that I have found so far. I guess it's quite lightweight too. ``` int NormalizeSt...
"Lightweight" in your context means "with limited functionality". I would use ICU source as an example, and reference <http://unicode.org/reports/tr15/> to implement this "lightweight" functionality.
4,884,860
I've codes below: (Please check out codes below on Google Chrome 8+) codes 1: ``` <!DOCTYPE html> <meta charset="utf-8"> <title>An HTML5 document</title> <div style="background:red; height:300px; width:1500px;"> WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW<br>WWWWWWW <img src="http://www.google.com/im...
2011/02/03
[ "https://Stackoverflow.com/questions/4884860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563609/" ]
A good UTF-8 solution is glib's [g\_utf8\_normalize()](https://developer.gnome.org/glib/unstable/glib-Unicode-Manipulation.html#g-utf8-normalize) function. Would require to convert std::wstring to std::string (utf16 to utf8) if you need this for wstring too (which would make it quite an expensive solution, hence I'm lo...
"Lightweight" in your context means "with limited functionality". I would use ICU source as an example, and reference <http://unicode.org/reports/tr15/> to implement this "lightweight" functionality.
73,481,330
In Wildfly 22.0.0 or later, the following error occurs. ``` 2022-08-24 15:59:43,380 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "shcm")]) - failure description: { "WFLYCTL0412: Required services that are not installed...
2022/08/25
[ "https://Stackoverflow.com/questions/73481330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11982647/" ]
Seems like it was never supported to be enable for non-`standalone.xml` builds, so it was likely removed in [this PR](https://github.com/wildfly/wildfly/pull/13839/files#diff-9a272ab7d21cd902d57ccde4a9b818dfecd4e8af8c39651b129d33a2506d9d3dL18) ([`distributable-web.xml`](https://github.com/wildfly/wildfly/blob/c5e18f5a8...
This was really unfortunate decision. It is killing EAP v. 7.4.5 (7.4.6) deployments. I had replication-config as a part of jboss-web.xml file, that causes this issue. The application runs in ha mode in production, so the configuration is needed, but for the development there is no reason to maintain the whole cluster...
36,536,402
I have an array which looks like this: ``` array ( 'id' => 1, 'channel_id' => 1, 'field_group' => 1, 'url_title' => 'the_very_first_entry', 'title' => 'The Very First Entry', 'fields' => array ( 0 => array ( 'label' => 'Enter Item Name:', 'type' => 'text', 'channel_data_id' =>...
2016/04/10
[ "https://Stackoverflow.com/questions/36536402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/521392/" ]
> > Is there a better solution that iterating through the original array with a foreach loop > > > You know the split-key so there's no real use for `foreach`: ``` $src = array(...); // your source array $fields_array = $src['fields']; unset($src['fields']); ```
As an alternative solution, *if* the `fields` key is always the last element of the array, you can use `array_pop`. ``` $fields = array_pop($array); ``` And that's it. [Demo](https://3v4l.org/QPZ5J).
36,536,402
I have an array which looks like this: ``` array ( 'id' => 1, 'channel_id' => 1, 'field_group' => 1, 'url_title' => 'the_very_first_entry', 'title' => 'The Very First Entry', 'fields' => array ( 0 => array ( 'label' => 'Enter Item Name:', 'type' => 'text', 'channel_data_id' =>...
2016/04/10
[ "https://Stackoverflow.com/questions/36536402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/521392/" ]
> > Is there a better solution that iterating through the original array with a foreach loop > > > You know the split-key so there's no real use for `foreach`: ``` $src = array(...); // your source array $fields_array = $src['fields']; unset($src['fields']); ```
If I understood your question correct. ``` <?php $base = array(...); // your array // array values $baseArrays = array_filter($base, function($item){ return is_array($item); }); // not array values $not = array_diff($base, $baseArrays); ```
36,536,402
I have an array which looks like this: ``` array ( 'id' => 1, 'channel_id' => 1, 'field_group' => 1, 'url_title' => 'the_very_first_entry', 'title' => 'The Very First Entry', 'fields' => array ( 0 => array ( 'label' => 'Enter Item Name:', 'type' => 'text', 'channel_data_id' =>...
2016/04/10
[ "https://Stackoverflow.com/questions/36536402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/521392/" ]
If I understood your question correct. ``` <?php $base = array(...); // your array // array values $baseArrays = array_filter($base, function($item){ return is_array($item); }); // not array values $not = array_diff($base, $baseArrays); ```
As an alternative solution, *if* the `fields` key is always the last element of the array, you can use `array_pop`. ``` $fields = array_pop($array); ``` And that's it. [Demo](https://3v4l.org/QPZ5J).
1,009,311
I'm trying to dual boot Ubuntu alongside Windows on my laptop. I already know how to install it. A tutorial that I watched recommended selecting the *Something else* option of the *Installation type* screen of the Ubuntu installer rather than installing Ubuntu alongside Windows Boot Manager. [![Install Ubuntu alongsi...
2018/02/24
[ "https://askubuntu.com/questions/1009311", "https://askubuntu.com", "https://askubuntu.com/users/791441/" ]
On a personal note, I would recommend you to stick with the *"Something else"* option only. The reason is that I have personally created issues with 4 laptop hard disks simply because I failed to understand the right process. Choosing *"Install alongside Windows boot manager"* is safe, but please do take note of every...
Sometimes the *Install Ubuntu alongside Windows Boot Manager* option in the *Installation type* screen of the Ubuntu installer is the way that the Ubuntu installer incorrectly identified Windows, because that is the way that the existing Windows OS is identified in the system's configuration. > > Is it safe to choose...
33,066,813
I have an array of people as follows: ``` people = ['personA', 'personB', 'personC']; ``` I want to be able to display a page about the person based on the url. For example, `localhost:3000/people/personA` would direct me to a page about personA. How do I do so without having to specify the following multiple times...
2015/10/11
[ "https://Stackoverflow.com/questions/33066813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5245267/" ]
You should do it with a parameter in the url. You can add a parameter using **:param\_here** and get its value using `req.params.param_here` Like so: ``` app.get('/people/:person', (req, res) => { var person = req.params.person; // Variable telling you which person to show } }); ```
here is the solution ``` app.get('/people/:person', funcation (req, res){ res.render("views/"+req.params.person+".html"); } }); ```
60,768
There have uncommitted changes, but `show | compare` do not show it. ``` {master}[edit] un@HK-MX-RE0# exit The configuration has been changed but not committed Exit wi...
2019/08/01
[ "https://networkengineering.stackexchange.com/questions/60768", "https://networkengineering.stackexchange.com", "https://networkengineering.stackexchange.com/users/51231/" ]
Try this one: `show | compare rollback 1` Also this situation may rise in case when you change value(option), then in the same session revert this changed value to previous state. < This is my mention, not confirmed by the documentation.
If there is no delta showing, just type `rollback` before `exit` and this error will go away.
7,020,020
Alright, so I'm trying to store data in Sqlite. So I'm trying to store the id of the user with the a "line". Yet, it seems that the where clause is failing me. ``` String query = "SELECT * FROM Users WHERE username='Fellixombc"; ResultSet result = this.sqlStatement.executeQuery(query); int userId = 0; ...
2011/08/11
[ "https://Stackoverflow.com/questions/7020020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/405055/" ]
Essentially, you want to store the username, correct? Your current query will retrieve all information on relative to a username. It's what a SELECT query does, it retrieves. If you need to create a new user, use: ``` INSERT INTO Users (username) Values ('Fellixombc'); ``` I should tell you that you might need to ...
Try doing a trim on your username field. Its possible there's a spurious space somewhere in the data thats causing your where clause to fail. ``` "SELECT * FROM Users WHERE trim(username) ='Fellixombc'" ``` Also, agree with @MPelletier. You should definitely be using PreparedStatements.
286,534
I have to layout kind of several boiler plates for layouts. I thought of designing it as a package in the library editor. Some drawing elements have to be present on any layer and some other have to be present on several different layers. I could copy them to one layer after another, but this is tedious, error pron...
2017/02/14
[ "https://electronics.stackexchange.com/questions/286534", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/54969/" ]
It's not clear what you are really asking about, but it seems you have a polygon in one layer, and you want to copy it to another layer. At least that's what I'll answer. As far as I know, there is no direct way to copy to another layer. However, this can be done in a few relatively simple steps: - Copy the polygon t...
I think, that my answer is similar to that of @Olin, but looks like quicker and simpler. It covers the case, when you want to copy a polygon to another layer, but have it exactly in the same spot (like when beefing-up a heatsink plane and needing it for example on both top layer and bottom layer). Of course, you can mo...
111,812
What is the best practice for naming UI controls (textboxes, drop-downs, etc.) on forms and reports for reference in the code-behind pages? I develop a lot of reports and forms in my office. I have several web applications providing about 80+ "live" reports being generated from various and multiple data sources (Acces...
2008/09/21
[ "https://Stackoverflow.com/questions/111812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19747/" ]
For GUI controls, I suffix the variable name with the control name: * firstNameTextBox * lastNameTextBox * submitButton This makes the relationship obvious between for example \_firstName and firstNameTextBox.Text, and no one has to remember what the hungarian notation equivalent is. I would always choose clarity ove...
I've always felt that the only real reason for the prefixes was so you could have things like txtFirstName and lblFirstName on the same form/page. Since, the vast majority of the time, I'm really only working with the actual field control itself, I skip the prefix for that, and only use the prefixes for associated cont...
111,812
What is the best practice for naming UI controls (textboxes, drop-downs, etc.) on forms and reports for reference in the code-behind pages? I develop a lot of reports and forms in my office. I have several web applications providing about 80+ "live" reports being generated from various and multiple data sources (Acces...
2008/09/21
[ "https://Stackoverflow.com/questions/111812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19747/" ]
The main product I work on at work uses the txt\_ pnl\_ etc prefixes. This does work, though it is a bit of a pain at times when switching something that just hides/shows controls from say, a tr to a panel because you have to rename it. What I've started doing in new projects, is naming my UI controls with a ui prefi...
I still use Hungarian Notation for Controls but no longer for variables. ``` btn Button cbo ComboBox chk CheckBox clb CheckedListBox grp GroupBox iml ImageList lbl Label lnk Hyperlink mnu Menu pbr ProgressBar pic Picture pnl Panel rtb RichTextBox tmr Timer tvw TreeView txt TextBox ```
111,812
What is the best practice for naming UI controls (textboxes, drop-downs, etc.) on forms and reports for reference in the code-behind pages? I develop a lot of reports and forms in my office. I have several web applications providing about 80+ "live" reports being generated from various and multiple data sources (Acces...
2008/09/21
[ "https://Stackoverflow.com/questions/111812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19747/" ]
Your answers here will be very subjective. Different tastes and programming backgrounds will give you different preferences. Perhaps what will be most important to you in the long run is consistency among all of your projects, so that regardless of who developed the code you will be able to understand it when reading....
2-char prefixes for iOS UI components I prefer: `bt_` : `UIButton` `lb_` : `UILabel` `tx_` : `UITextField` `tv_` : `UITextView` `vw_` : `UIView` `im_` : `UIImageView` `sc_` : `UIScrollView` `tb_` : `UITableView` `cl_` : `UICollectionView` `st_` : `UIStackView` `pk_` : `UIPickerView` `p...
111,812
What is the best practice for naming UI controls (textboxes, drop-downs, etc.) on forms and reports for reference in the code-behind pages? I develop a lot of reports and forms in my office. I have several web applications providing about 80+ "live" reports being generated from various and multiple data sources (Acces...
2008/09/21
[ "https://Stackoverflow.com/questions/111812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19747/" ]
For GUI controls, I suffix the variable name with the control name: * firstNameTextBox * lastNameTextBox * submitButton This makes the relationship obvious between for example \_firstName and firstNameTextBox.Text, and no one has to remember what the hungarian notation equivalent is. I would always choose clarity ove...
Your answers here will be very subjective. Different tastes and programming backgrounds will give you different preferences. Perhaps what will be most important to you in the long run is consistency among all of your projects, so that regardless of who developed the code you will be able to understand it when reading....
111,812
What is the best practice for naming UI controls (textboxes, drop-downs, etc.) on forms and reports for reference in the code-behind pages? I develop a lot of reports and forms in my office. I have several web applications providing about 80+ "live" reports being generated from various and multiple data sources (Acces...
2008/09/21
[ "https://Stackoverflow.com/questions/111812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19747/" ]
I still use Hungarian Notation for Controls but no longer for variables. ``` btn Button cbo ComboBox chk CheckBox clb CheckedListBox grp GroupBox iml ImageList lbl Label lnk Hyperlink mnu Menu pbr ProgressBar pic Picture pnl Panel rtb RichTextBox tmr Timer tvw TreeView txt TextBox ```
I do similarly to you. When you have tons of controls it all becomes messy, so I prefix each name with the capitals of the control class. For example: TextBox -> tbName DataGrid -> dgName Panel -> pName This makes it clear how to handle new controls (i.e. how to derive the prefix)
111,812
What is the best practice for naming UI controls (textboxes, drop-downs, etc.) on forms and reports for reference in the code-behind pages? I develop a lot of reports and forms in my office. I have several web applications providing about 80+ "live" reports being generated from various and multiple data sources (Acces...
2008/09/21
[ "https://Stackoverflow.com/questions/111812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19747/" ]
The main product I work on at work uses the txt\_ pnl\_ etc prefixes. This does work, though it is a bit of a pain at times when switching something that just hides/shows controls from say, a tr to a panel because you have to rename it. What I've started doing in new projects, is naming my UI controls with a ui prefi...
2-char prefixes for iOS UI components I prefer: `bt_` : `UIButton` `lb_` : `UILabel` `tx_` : `UITextField` `tv_` : `UITextView` `vw_` : `UIView` `im_` : `UIImageView` `sc_` : `UIScrollView` `tb_` : `UITableView` `cl_` : `UICollectionView` `st_` : `UIStackView` `pk_` : `UIPickerView` `p...
111,812
What is the best practice for naming UI controls (textboxes, drop-downs, etc.) on forms and reports for reference in the code-behind pages? I develop a lot of reports and forms in my office. I have several web applications providing about 80+ "live" reports being generated from various and multiple data sources (Acces...
2008/09/21
[ "https://Stackoverflow.com/questions/111812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19747/" ]
I still use Hungarian Notation for Controls but no longer for variables. ``` btn Button cbo ComboBox chk CheckBox clb CheckedListBox grp GroupBox iml ImageList lbl Label lnk Hyperlink mnu Menu pbr ProgressBar pic Picture pnl Panel rtb RichTextBox tmr Timer tvw TreeView txt TextBox ```
I've always felt that the only real reason for the prefixes was so you could have things like txtFirstName and lblFirstName on the same form/page. Since, the vast majority of the time, I'm really only working with the actual field control itself, I skip the prefix for that, and only use the prefixes for associated cont...
111,812
What is the best practice for naming UI controls (textboxes, drop-downs, etc.) on forms and reports for reference in the code-behind pages? I develop a lot of reports and forms in my office. I have several web applications providing about 80+ "live" reports being generated from various and multiple data sources (Acces...
2008/09/21
[ "https://Stackoverflow.com/questions/111812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19747/" ]
I do similarly to you. When you have tons of controls it all becomes messy, so I prefix each name with the capitals of the control class. For example: TextBox -> tbName DataGrid -> dgName Panel -> pName This makes it clear how to handle new controls (i.e. how to derive the prefix)
2-char prefixes for iOS UI components I prefer: `bt_` : `UIButton` `lb_` : `UILabel` `tx_` : `UITextField` `tv_` : `UITextView` `vw_` : `UIView` `im_` : `UIImageView` `sc_` : `UIScrollView` `tb_` : `UITableView` `cl_` : `UICollectionView` `st_` : `UIStackView` `pk_` : `UIPickerView` `p...
111,812
What is the best practice for naming UI controls (textboxes, drop-downs, etc.) on forms and reports for reference in the code-behind pages? I develop a lot of reports and forms in my office. I have several web applications providing about 80+ "live" reports being generated from various and multiple data sources (Acces...
2008/09/21
[ "https://Stackoverflow.com/questions/111812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19747/" ]
I still use Hungarian Notation for Controls but no longer for variables. ``` btn Button cbo ComboBox chk CheckBox clb CheckedListBox grp GroupBox iml ImageList lbl Label lnk Hyperlink mnu Menu pbr ProgressBar pic Picture pnl Panel rtb RichTextBox tmr Timer tvw TreeView txt TextBox ```
2-char prefixes for iOS UI components I prefer: `bt_` : `UIButton` `lb_` : `UILabel` `tx_` : `UITextField` `tv_` : `UITextView` `vw_` : `UIView` `im_` : `UIImageView` `sc_` : `UIScrollView` `tb_` : `UITableView` `cl_` : `UICollectionView` `st_` : `UIStackView` `pk_` : `UIPickerView` `p...
111,812
What is the best practice for naming UI controls (textboxes, drop-downs, etc.) on forms and reports for reference in the code-behind pages? I develop a lot of reports and forms in my office. I have several web applications providing about 80+ "live" reports being generated from various and multiple data sources (Acces...
2008/09/21
[ "https://Stackoverflow.com/questions/111812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19747/" ]
I do similarly to you. When you have tons of controls it all becomes messy, so I prefix each name with the capitals of the control class. For example: TextBox -> tbName DataGrid -> dgName Panel -> pName This makes it clear how to handle new controls (i.e. how to derive the prefix)
I've always felt that the only real reason for the prefixes was so you could have things like txtFirstName and lblFirstName on the same form/page. Since, the vast majority of the time, I'm really only working with the actual field control itself, I skip the prefix for that, and only use the prefixes for associated cont...
36,518,623
I cannot get my program to take the data in textbox and tell if it is blank, holds a integer or decimal number. If it is blank I want it to assign variable `PropAmt` to 0.00. If it has an integer, I want it to assign `PropAmt` to a decimal. And if it is a decimal, leave `PropAmt` alone. This is what I have so far: ``...
2016/04/09
[ "https://Stackoverflow.com/questions/36518623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6181353/" ]
Your *instructions* seem clear enough to me, let's start with `method1`; you're to pass in the start of the range and the end of the range and return a random value between those two values. You have a `Random`, so let's use it. Something like, ``` private static Random generator = new Random(); public static int meth...
You have declared unused variables and passing unnecessary variables. It can be done easily by declaring the `Array` inside the main and then passing just the array in the two functions. You need not to pass the `SIZE` and other variables. Here is the code snippet: ``` class Main { private static final Random R...
18,482,018
I try to do simple online radio player. Here is adress of stream <http://radio-electron.ru:8000/96> Here is my code. MyActivity.java ``` package com.example.untitled2; import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; i...
2013/08/28
[ "https://Stackoverflow.com/questions/18482018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1356701/" ]
-38 refers to `ENOSYS` error code from [errno.h](http://www.virtsync.com/c-error-codes-include-errno) (see this explanation <https://stackoverflow.com/a/15206308/768935>) You seem to try to start the playing before the preparation is complete. Use the [`setOnPreparedListener()`](http://developer.android.com/reference/...
The error code -38 ought to correspond to [`INVALID_OPERATION`](https://www.codeaurora.org/cgit/quic/la/platform/frameworks/base/tree/include/utils/Errors.h?id=refs/heads/ics_chocolate#n45). A likely cause of this is that you don't wait for `prepareAsync` to finish before you call `start`. You should set an [onPrepare...
18,482,018
I try to do simple online radio player. Here is adress of stream <http://radio-electron.ru:8000/96> Here is my code. MyActivity.java ``` package com.example.untitled2; import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; i...
2013/08/28
[ "https://Stackoverflow.com/questions/18482018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1356701/" ]
I was getting my `-38` error by calling `getDuration();` on the MediaPlayer *before* it was prepared. --- It's worth checking the [MediaPlayer](http://developer.android.com/reference/android/media/MediaPlayer.html) doc. There is a paragraph that starts `It is a programming error to invoke methods such as getCurren...
The error code -38 ought to correspond to [`INVALID_OPERATION`](https://www.codeaurora.org/cgit/quic/la/platform/frameworks/base/tree/include/utils/Errors.h?id=refs/heads/ics_chocolate#n45). A likely cause of this is that you don't wait for `prepareAsync` to finish before you call `start`. You should set an [onPrepare...
18,482,018
I try to do simple online radio player. Here is adress of stream <http://radio-electron.ru:8000/96> Here is my code. MyActivity.java ``` package com.example.untitled2; import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; i...
2013/08/28
[ "https://Stackoverflow.com/questions/18482018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1356701/" ]
-38 refers to `ENOSYS` error code from [errno.h](http://www.virtsync.com/c-error-codes-include-errno) (see this explanation <https://stackoverflow.com/a/15206308/768935>) You seem to try to start the playing before the preparation is complete. Use the [`setOnPreparedListener()`](http://developer.android.com/reference/...
@allprog and @Michael are right. But there is another way, if you don't want to use prepareAsync(), use prepare(). That is blocking, which is returned only when it is prepared.
18,482,018
I try to do simple online radio player. Here is adress of stream <http://radio-electron.ru:8000/96> Here is my code. MyActivity.java ``` package com.example.untitled2; import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; i...
2013/08/28
[ "https://Stackoverflow.com/questions/18482018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1356701/" ]
-38 refers to `ENOSYS` error code from [errno.h](http://www.virtsync.com/c-error-codes-include-errno) (see this explanation <https://stackoverflow.com/a/15206308/768935>) You seem to try to start the playing before the preparation is complete. Use the [`setOnPreparedListener()`](http://developer.android.com/reference/...
I was getting my `-38` error by calling `getDuration();` on the MediaPlayer *before* it was prepared. --- It's worth checking the [MediaPlayer](http://developer.android.com/reference/android/media/MediaPlayer.html) doc. There is a paragraph that starts `It is a programming error to invoke methods such as getCurren...
18,482,018
I try to do simple online radio player. Here is adress of stream <http://radio-electron.ru:8000/96> Here is my code. MyActivity.java ``` package com.example.untitled2; import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; i...
2013/08/28
[ "https://Stackoverflow.com/questions/18482018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1356701/" ]
-38 refers to `ENOSYS` error code from [errno.h](http://www.virtsync.com/c-error-codes-include-errno) (see this explanation <https://stackoverflow.com/a/15206308/768935>) You seem to try to start the playing before the preparation is complete. Use the [`setOnPreparedListener()`](http://developer.android.com/reference/...
You better check if you are executing any operation that is related to the *playing state* like `getCurrentPosition()` before the Mediaplayer is started.
18,482,018
I try to do simple online radio player. Here is adress of stream <http://radio-electron.ru:8000/96> Here is my code. MyActivity.java ``` package com.example.untitled2; import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; i...
2013/08/28
[ "https://Stackoverflow.com/questions/18482018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1356701/" ]
I was getting my `-38` error by calling `getDuration();` on the MediaPlayer *before* it was prepared. --- It's worth checking the [MediaPlayer](http://developer.android.com/reference/android/media/MediaPlayer.html) doc. There is a paragraph that starts `It is a programming error to invoke methods such as getCurren...
@allprog and @Michael are right. But there is another way, if you don't want to use prepareAsync(), use prepare(). That is blocking, which is returned only when it is prepared.
18,482,018
I try to do simple online radio player. Here is adress of stream <http://radio-electron.ru:8000/96> Here is my code. MyActivity.java ``` package com.example.untitled2; import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; i...
2013/08/28
[ "https://Stackoverflow.com/questions/18482018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1356701/" ]
I was getting my `-38` error by calling `getDuration();` on the MediaPlayer *before* it was prepared. --- It's worth checking the [MediaPlayer](http://developer.android.com/reference/android/media/MediaPlayer.html) doc. There is a paragraph that starts `It is a programming error to invoke methods such as getCurren...
You better check if you are executing any operation that is related to the *playing state* like `getCurrentPosition()` before the Mediaplayer is started.
134,234
Im using squid as a reverse proxy to host multiple web servers on one internet IP. It works fine and has been doing so for the past few months. I have just noticed that every request sent to my servers is logged as comming from the squid servers IP address. Is there anyway to make squid pass the originating IP to the ...
2010/04/20
[ "https://serverfault.com/questions/134234", "https://serverfault.com", "https://serverfault.com/users/28697/" ]
Squid uses the X-Forwarded-For header to pass the client IP through the reverse proxy. You'll need to configure `forwarded_for on` for Squid, and tell your backend servers to log the new header.
There are two things which I observed. You need to enable `forward_for` on and if you `iptables MASQUERADE` rule for inbound traffic from your in interface you might need to remove it. In my case I have a rule for outbound which causes the same I just removed that masquerade rule and things worked for me Here is the...
17,241,021
In one of my tables, I have a column where it has a comma-separated list of users that have bought that item. [IMAGE](https://i.stack.imgur.com/8MMm9.png) How can I read the list and run a PHP script to find if the user that is logged in (that is stored in the Session) is in that list. For example, how could I see if ...
2013/06/21
[ "https://Stackoverflow.com/questions/17241021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2505117/" ]
Use [FIND\_IN\_SET()](http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_find-in-set) to find the records that contain your user ``` select * from your_table where find_in_set('MTNOfficial', usersBought) > 0 ```
Get the comma separated list, then try the php function explode() to get an array that you can loop over. <http://php.net/manual/en/function.explode.php> ``` $target = "MTNOfficial"; $query = "select usersBought from table_name"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $users = ...
64,346,315
Good day, I'm having trouble with my query, as I can't seem to understand why I keep getting the error "syntax error at or near "AS" here's my query: ``` CREATE TRIGGER updateAvailableQuantity AFTER INSERT ON sale_item FOR EACH ROW AS $$ BEGIN IF NEW.quantity > 0 THEN UPDATE products...
2020/10/14
[ "https://Stackoverflow.com/questions/64346315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11056747/" ]
You can not write trigger in PostgreSQL in this way. Here its a 2 step process. 1. First create a Trigger function: ``` CREATE OR REPLACE FUNCTION updateAvailableQuantity() RETURNS TRIGGER AS $$ BEGIN IF NEW.quantity > 0 THEN UPDATE products SET quantity_instock = quantity_instock - NEW.quantity WHERE pro...
You have an error in your syntax. See the [documentation page](https://www.postgresql.org/docs/current/sql-createtrigger.html) on `create trigger`. `FOR EACH ROW` can not go before `REFERENCING AS` statement. The documentation also has a plenty examples.
57,423,163
I need to access (in order to set up fast lane) a file on my iCloud Desktop. I would prefer for this file to remain here but have had difficulty accessing it. I have already tried the following commands: ``` cd ~/Library/Mobile\ Desktop/com~apple~CloudDocs/fileName cd ~/Library/Mobile\ Desktop/com~apple~CloudDocs/De...
2019/08/09
[ "https://Stackoverflow.com/questions/57423163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11332082/" ]
You can use `.filter()` and `.includes()` methods to get the desired output: ```js const categorys = [1, 2]; const data = [ {c_id:0, name:'phone',useType:0}, {c_id:1, name: "milk",useType:1}, {c_id:2, name: "apple",useType:1}, {c_id:3, name: "orang",useType:1}, {c_id:4, name: "red",useType:1} ...
You need to use `includes`: ``` let result = data.filter((item,index)=>{ if(item.useType === 0){ return true }else if(item.useType === 1 && categorys.includes(item.c_id)){ return true } else{ return false } }); ``` But to avoid iterations on the categories array, you can mak...
57,423,163
I need to access (in order to set up fast lane) a file on my iCloud Desktop. I would prefer for this file to remain here but have had difficulty accessing it. I have already tried the following commands: ``` cd ~/Library/Mobile\ Desktop/com~apple~CloudDocs/fileName cd ~/Library/Mobile\ Desktop/com~apple~CloudDocs/De...
2019/08/09
[ "https://Stackoverflow.com/questions/57423163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11332082/" ]
You can use [`Array.prototype.includes()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) to check whether the `categories` array contains a specific `c_id` value: ```js const categories = [1, 2]; const data = [ {c_id: 0, name: "phone", useType: 0}, {c_id: 1, name...
You need to use `includes`: ``` let result = data.filter((item,index)=>{ if(item.useType === 0){ return true }else if(item.useType === 1 && categorys.includes(item.c_id)){ return true } else{ return false } }); ``` But to avoid iterations on the categories array, you can mak...
57,423,163
I need to access (in order to set up fast lane) a file on my iCloud Desktop. I would prefer for this file to remain here but have had difficulty accessing it. I have already tried the following commands: ``` cd ~/Library/Mobile\ Desktop/com~apple~CloudDocs/fileName cd ~/Library/Mobile\ Desktop/com~apple~CloudDocs/De...
2019/08/09
[ "https://Stackoverflow.com/questions/57423163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11332082/" ]
You can use [`Array.prototype.includes()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) to check whether the `categories` array contains a specific `c_id` value: ```js const categories = [1, 2]; const data = [ {c_id: 0, name: "phone", useType: 0}, {c_id: 1, name...
You can use `.filter()` and `.includes()` methods to get the desired output: ```js const categorys = [1, 2]; const data = [ {c_id:0, name:'phone',useType:0}, {c_id:1, name: "milk",useType:1}, {c_id:2, name: "apple",useType:1}, {c_id:3, name: "orang",useType:1}, {c_id:4, name: "red",useType:1} ...
14,817,281
I am trying to incorporate annotated validation rules along with some custom validation. I have a details entity which looks like the following: ``` public class DetailsEntity { @NotEmpty(message = "Name is required") private String name; private String customField; public String getName() { ...
2013/02/11
[ "https://Stackoverflow.com/questions/14817281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/749423/" ]
Use `SpringValidatorAdapter` as base class of your custom validator and override validate() method: ``` public void validate(Object target, Errors errors) { // check JSR-303 Constraints super.validate(target, errors); // Add you custom validation here. } ``` Or inject a `...
@NotEmpty is a JSR-303 annotation, and we need to use an implementation of it like HiberanteValidator, we need to add Hibernate-Validator jar to your lib directory. Using this jar we can use @NotEmpty, @NotNull...all JSR 303 annotations.
19,408,567
I'm having some difficulty getting this to work. What I want to do is take dynamic variables from the onclick and place them into a div I am appending to another div in the document. Since each each item will have variables associated from a database query, I figured populating the buildTicket() variables from the data...
2013/10/16
[ "https://Stackoverflow.com/questions/19408567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2711002/" ]
Triggers aren't solid, so a box with a trigger and a rigid body would fall through a solid object. Generally the object with a rigid body should not be set to trigger, and stationary volumes should be set to trigger. Besides that, I tried your code and it works correctly. Are you sure you have this script applied to th...
Moving the object using the Translate function will teleport the object into a new Vector3 position instead of smoothly moving it. Also, check which Physics layer each object is set to. Then, go to Edit -> Physics to edit which Physics layer can collide with each other. Other than that I would speculate it would due ...
9,031,297
Using the zipfile module I have created a script to extract my archived files, but the method is corrupting everything other than txt files. ``` def unzip(zip): filelist = [] dumpfold = r'M:\SVN_EReportingZones\eReportingZones\data\input\26012012' storage = r'M:\SVN_EReportingZones\eReporti...
2012/01/27
[ "https://Stackoverflow.com/questions/9031297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1173162/" ]
You are opening the file in a *text* mode. Try: ``` fout = open(zfilename, 'wb')# reads and copies the data ``` The `b` opens the file in a *binary* mode, where the runtime libraries don't try to do any newline conversion.
To answer the second section of your question, I suggest the [envoy library](https://github.com/kennethreitz/envoy). To use winRar with envoy: ``` import envoy r = envoy.run('unrar e {0}'.format(zfilename)) if r.status_code > 0: print r.std_err print r.std_out ``` To do it without envoy: ``` import subprocess r...
614,281
I have an issue where whenever I use OpenVPN client to connect to the remote server to (obviously) set up a VPN tunnel, I can no longer see my nginx server. I can connect on the local network but it seems like it's dropping any remote access to the nginx web server. The VPN tunnel works perfectly. The nginx works fine ...
2014/07/21
[ "https://serverfault.com/questions/614281", "https://serverfault.com", "https://serverfault.com/users/233835/" ]
`a2ensite` does not expect the full path as its argument. Try ``` sudo a2ensite test.x.com.conf ``` As an aside, the `.conf` extension is not customary with vhost definition files. That's up to you, though.
It seems like an error suggesting that `/etc/apache2/sites-available/test.x.com` "does not exists, not `/etc/apache2/sites-available/test.x.com.conf`. You have a reference for `/etc/apache2/sites-available/test.x.com` inside of `/etc/apache2/sites-available/test.x.com.conf`.
16,428,755
I want to send a json message over http to a php server.I used the gson library as you can see. ``` Gson gson = new Gson(); String[] data = {"value1", "value2", "value3"}; String json = gson.toJson(data); String message = "jdata"+json; //I did this because of the server implementation String path= "http://localhost/j...
2013/05/07
[ "https://Stackoverflow.com/questions/16428755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1811869/" ]
Have a look at the [HttpPost](http://developer.android.com/reference/org/apache/http/client/methods/HttpPost.html) class. A [Google search](https://www.google.com/search?q=android%20httppost) will show you tons of examples.
In android long operation such as internet interaction should (in latest versions **must**) be done in separate thread. You can accomplish this task in many ways, but i think the simplest consists in creating a subclass of [AsyncTask](http://developer.android.com/reference/android/os/AsyncTask.html) and put the networ...
16,428,755
I want to send a json message over http to a php server.I used the gson library as you can see. ``` Gson gson = new Gson(); String[] data = {"value1", "value2", "value3"}; String json = gson.toJson(data); String message = "jdata"+json; //I did this because of the server implementation String path= "http://localhost/j...
2013/05/07
[ "https://Stackoverflow.com/questions/16428755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1811869/" ]
You say you want it in the path but: ``` //If it's a parameter it would have to be "jdata="+json String message = "jdata"+json; //And you didn't append it to the path either... String path= "http://localhost/joomla/index.php?option=com_up1"; ``` However, you should really be sending this in the message body.
In android long operation such as internet interaction should (in latest versions **must**) be done in separate thread. You can accomplish this task in many ways, but i think the simplest consists in creating a subclass of [AsyncTask](http://developer.android.com/reference/android/os/AsyncTask.html) and put the networ...
57,290,142
Given a list of prices, I want to find the *index* of the the largest price that exceeds a certain minimum. My current solution looks like this: ``` public class Price { public static Integer maxPriceIndex(List<Integer> prices, Integer minPrice) { OptionalInt maxPriceIndexResult = IntStream.range(0, price...
2019/07/31
[ "https://Stackoverflow.com/questions/57290142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
You can do the filter before finding the max. ``` IntStream.range(0, prices.size()) .filter(i -> prices.get(i) > minPrice) .reduce((a, b) -> prices.get(a) > prices.get(b) ? a : b); ```
First filter all values greater than `minPrice` and then sort them in `reverseOrder`, next get the index of first max element using `findFirst` value or if list is empty return `null` ``` return list.stream() .filter(i->i>minPrice) .sorted(Comparator.reverseOrder()) .findFirst() ...
57,290,142
Given a list of prices, I want to find the *index* of the the largest price that exceeds a certain minimum. My current solution looks like this: ``` public class Price { public static Integer maxPriceIndex(List<Integer> prices, Integer minPrice) { OptionalInt maxPriceIndexResult = IntStream.range(0, price...
2019/07/31
[ "https://Stackoverflow.com/questions/57290142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
You can do the filter before finding the max. ``` IntStream.range(0, prices.size()) .filter(i -> prices.get(i) > minPrice) .reduce((a, b) -> prices.get(a) > prices.get(b) ? a : b); ```
Apart from `filter`ing the stream as you process, you can perform a `max` based on the custom comparator instead of `reduce` as: ``` return IntStream.range(0, prices.size()) .filter(i -> prices.get(i) > minPrice) .boxed() .max(Comparator.comparingInt(prices::get)) ...
57,290,142
Given a list of prices, I want to find the *index* of the the largest price that exceeds a certain minimum. My current solution looks like this: ``` public class Price { public static Integer maxPriceIndex(List<Integer> prices, Integer minPrice) { OptionalInt maxPriceIndexResult = IntStream.range(0, price...
2019/07/31
[ "https://Stackoverflow.com/questions/57290142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
You can do the filter before finding the max. ``` IntStream.range(0, prices.size()) .filter(i -> prices.get(i) > minPrice) .reduce((a, b) -> prices.get(a) > prices.get(b) ? a : b); ```
Judging from all the answers you got, it's easy to make poorly performing implementations by accident. Not one of the other answers is as fast as the code you originally wrote. (@MikeFHay's is pretty good, though) Maybe just do: ``` int index = IntStream.range(0, prices.size()) .reduce((a, b) -> prices.get(a)...