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
57,925,994
I was looking at a question involving how the `std::cin` works. This was the question: What does the following program do if, when it asks you for input, you type two names(for example Samuel Beckett)? ``` #include <iostream> #include <string> int main() { std::cout << "What is your name? "; std::string nam...
2019/09/13
[ "https://Stackoverflow.com/questions/57925994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11674974/" ]
Given your first example, you could then process it like this to separate the json array into individual objects and stuff them into a table as separate rows: ``` create table real_json as select value::jsonb from temp_json join lateral json_array_elements(values::json) on true; ``` However, this depends on the larg...
Removing the ''pretty format'' from the file helped in using the COPY function but it puts the whole content of the file in one row, making it impossible to run a simple SELECT query on an existing column ... Here is what I used : ``` CREATE TEMP TABLE target(data jsonb); copy target from '/home/cae/test_without_new_...
57,925,994
I was looking at a question involving how the `std::cin` works. This was the question: What does the following program do if, when it asks you for input, you type two names(for example Samuel Beckett)? ``` #include <iostream> #include <string> int main() { std::cout << "What is your name? "; std::string nam...
2019/09/13
[ "https://Stackoverflow.com/questions/57925994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11674974/" ]
Same code of @jjanes with a real, working command line tool. `\copy json_table FROM PROGRAM 'jq --stream -nc -f myfile.json';`
Removing the ''pretty format'' from the file helped in using the COPY function but it puts the whole content of the file in one row, making it impossible to run a simple SELECT query on an existing column ... Here is what I used : ``` CREATE TEMP TABLE target(data jsonb); copy target from '/home/cae/test_without_new_...
7,489,439
I am create a little game just to get more experience in Action Script 3.0. What I want is: If you shoot. And the bullet hits. Than the text above should -20.. Say It has 100(health). And we hit. It will display 80. Second hit 60 etc. This is what I am having but it does not seem to work out. ``` var a; var b; a...
2011/09/20
[ "https://Stackoverflow.com/questions/7489439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` select name from employee e1 join ( select dept, avg(salary) avg_sal from employee e2 where emp_id = 'a10' group by dept ) e2 on e2.dept = e1.dept and e1.salary > e2.avg_sal ``` Try that
No, unfortunately I think what you have is about as short and simple as you can make it to accomplish your desired result.
7,489,439
I am create a little game just to get more experience in Action Script 3.0. What I want is: If you shoot. And the bullet hits. Than the text above should -20.. Say It has 100(health). And we hit. It will display 80. Second hit 60 etc. This is what I am having but it does not seem to work out. ``` var a; var b; a...
2011/09/20
[ "https://Stackoverflow.com/questions/7489439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This query is Oracle specific, but it has the advantage of only hitting the `employee` table once: ``` select name from (select name, salary, avg(salary) over (partition by dept) as avg_salary from employee) where salary > avg_salary; ```
No, unfortunately I think what you have is about as short and simple as you can make it to accomplish your desired result.
7,489,439
I am create a little game just to get more experience in Action Script 3.0. What I want is: If you shoot. And the bullet hits. Than the text above should -20.. Say It has 100(health). And we hit. It will display 80. Second hit 60 etc. This is what I am having but it does not seem to work out. ``` var a; var b; a...
2011/09/20
[ "https://Stackoverflow.com/questions/7489439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` select name from employee e1 join ( select dept, avg(salary) avg_sal from employee e2 where emp_id = 'a10' group by dept ) e2 on e2.dept = e1.dept and e1.salary > e2.avg_sal ``` Try that
Maybe not much simpler but from 3 to 2 queries: ``` SELECT e3.name FROM employee e3 INNER JOIN ( SELECT e1.dept, AVG(e1.salary) avg_salary FROM employee e1 INNER JOIN employee e1 ON e1.dept = e2.dept AND e2.emp_id='a10' GROUP BY e1.dept ) t ON t.dept = e3.dept AND e3.salary > avg_salary ``` Pretty sure I can g...
7,489,439
I am create a little game just to get more experience in Action Script 3.0. What I want is: If you shoot. And the bullet hits. Than the text above should -20.. Say It has 100(health). And we hit. It will display 80. Second hit 60 etc. This is what I am having but it does not seem to work out. ``` var a; var b; a...
2011/09/20
[ "https://Stackoverflow.com/questions/7489439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This query is Oracle specific, but it has the advantage of only hitting the `employee` table once: ``` select name from (select name, salary, avg(salary) over (partition by dept) as avg_salary from employee) where salary > avg_salary; ```
Maybe not much simpler but from 3 to 2 queries: ``` SELECT e3.name FROM employee e3 INNER JOIN ( SELECT e1.dept, AVG(e1.salary) avg_salary FROM employee e1 INNER JOIN employee e1 ON e1.dept = e2.dept AND e2.emp_id='a10' GROUP BY e1.dept ) t ON t.dept = e3.dept AND e3.salary > avg_salary ``` Pretty sure I can g...
7,489,439
I am create a little game just to get more experience in Action Script 3.0. What I want is: If you shoot. And the bullet hits. Than the text above should -20.. Say It has 100(health). And we hit. It will display 80. Second hit 60 etc. This is what I am having but it does not seem to work out. ``` var a; var b; a...
2011/09/20
[ "https://Stackoverflow.com/questions/7489439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` select name from employee e1 join ( select dept, avg(salary) avg_sal from employee e2 where emp_id = 'a10' group by dept ) e2 on e2.dept = e1.dept and e1.salary > e2.avg_sal ``` Try that
normally short or long query should not be focus but efficient query should be focus. It may be off-topic, but ensure proper indexing.
7,489,439
I am create a little game just to get more experience in Action Script 3.0. What I want is: If you shoot. And the bullet hits. Than the text above should -20.. Say It has 100(health). And we hit. It will display 80. Second hit 60 etc. This is what I am having but it does not seem to work out. ``` var a; var b; a...
2011/09/20
[ "https://Stackoverflow.com/questions/7489439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This query is Oracle specific, but it has the advantage of only hitting the `employee` table once: ``` select name from (select name, salary, avg(salary) over (partition by dept) as avg_salary from employee) where salary > avg_salary; ```
normally short or long query should not be focus but efficient query should be focus. It may be off-topic, but ensure proper indexing.
9,925,245
I am still new in writing function in R. I try to write a function that requires: EITHER an argument "a", OR arguments "b" and "c" together. Additionally this function has some arguments with default values. How can I handle the either/or- arguments best. If "a" is provided I don't need "b" and "c" and vice versa, ...
2012/03/29
[ "https://Stackoverflow.com/questions/9925245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1035346/" ]
``` dfrm <- data.frame(a=LETTERS[1:3], b=letters[1:3], c=letters[5:7], res=c("one", "two", "three") ) dfrm # a b c res 1 A a e one 2 B b f two 3 C c g three f <- function(a=NA,b=NA,c=NA,d=1,e=2){ if ( is.na(a) & (is.na(b) | is.na(c) ) ) {stop()} if...
Check out the definition here of polar() for a good though simpler example: <http://blog.moertel.com/articles/2006/01/20/wondrous-oddities-rs-function-call-semantics>
9,925,245
I am still new in writing function in R. I try to write a function that requires: EITHER an argument "a", OR arguments "b" and "c" together. Additionally this function has some arguments with default values. How can I handle the either/or- arguments best. If "a" is provided I don't need "b" and "c" and vice versa, ...
2012/03/29
[ "https://Stackoverflow.com/questions/9925245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1035346/" ]
The `missing` function should help: ``` f <- function(a,b,c,d=1,e=2) { if (missing(a)) { # use b and c b+c # you'll get an error here if b or c wasn't specified } else { # use a nchar(a) } } f('foo') # 3 f(b=2, c=4) # 6 f(d=3) # Error in b + c : 'b' is missin...
Check out the definition here of polar() for a good though simpler example: <http://blog.moertel.com/articles/2006/01/20/wondrous-oddities-rs-function-call-semantics>
9,925,245
I am still new in writing function in R. I try to write a function that requires: EITHER an argument "a", OR arguments "b" and "c" together. Additionally this function has some arguments with default values. How can I handle the either/or- arguments best. If "a" is provided I don't need "b" and "c" and vice versa, ...
2012/03/29
[ "https://Stackoverflow.com/questions/9925245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1035346/" ]
``` dfrm <- data.frame(a=LETTERS[1:3], b=letters[1:3], c=letters[5:7], res=c("one", "two", "three") ) dfrm # a b c res 1 A a e one 2 B b f two 3 C c g three f <- function(a=NA,b=NA,c=NA,d=1,e=2){ if ( is.na(a) & (is.na(b) | is.na(c) ) ) {stop()} if...
The `missing` function should help: ``` f <- function(a,b,c,d=1,e=2) { if (missing(a)) { # use b and c b+c # you'll get an error here if b or c wasn't specified } else { # use a nchar(a) } } f('foo') # 3 f(b=2, c=4) # 6 f(d=3) # Error in b + c : 'b' is missin...
40,237,155
I have a Table View Controller with 3 variables from Firebase Database. I would like to pass this data to Details View Controller. At now, I have only "title"(label1) passed from TableVC to Details VC. How could I pass rest of data (label2 and label3) to DetailsVC? **MondayTableVC:** ``` override func tableView(tabl...
2016/10/25
[ "https://Stackoverflow.com/questions/40237155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5736917/" ]
if you want to show the output in x.xx format you can use: ``` Console.WriteLine("{0:F2}+{1:F2}={2:F2}",d,d1,d+d1); ```
Try it with `ToString()` on each double ``` Console.WriteLine($"{d.ToString("G1")}+{d1.ToString("G1")}=(d + d1).ToString("G1")}); ```
40,237,155
I have a Table View Controller with 3 variables from Firebase Database. I would like to pass this data to Details View Controller. At now, I have only "title"(label1) passed from TableVC to Details VC. How could I pass rest of data (label2 and label3) to DetailsVC? **MondayTableVC:** ``` override func tableView(tabl...
2016/10/25
[ "https://Stackoverflow.com/questions/40237155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5736917/" ]
Try this ``` Console.WriteLine( String.Format("{0:0.0}", d + d2)); ```
Try it with `ToString()` on each double ``` Console.WriteLine($"{d.ToString("G1")}+{d1.ToString("G1")}=(d + d1).ToString("G1")}); ```
40,237,155
I have a Table View Controller with 3 variables from Firebase Database. I would like to pass this data to Details View Controller. At now, I have only "title"(label1) passed from TableVC to Details VC. How could I pass rest of data (label2 and label3) to DetailsVC? **MondayTableVC:** ``` override func tableView(tabl...
2016/10/25
[ "https://Stackoverflow.com/questions/40237155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5736917/" ]
if you want to show the output in x.xx format you can use: ``` Console.WriteLine("{0:F2}+{1:F2}={2:F2}",d,d1,d+d1); ```
Use this ``` Console.WriteLine("{0:F}+{1:F}={2:F}",d,d1,d+d1); ``` "F" is Fixed-Point Format Specifier. You can also specify the desired number of decimal places by changing the "F" to "F2,F3 and so on" as per your requirement or leave it as "F" so that it can return output according to the variable.
40,237,155
I have a Table View Controller with 3 variables from Firebase Database. I would like to pass this data to Details View Controller. At now, I have only "title"(label1) passed from TableVC to Details VC. How could I pass rest of data (label2 and label3) to DetailsVC? **MondayTableVC:** ``` override func tableView(tabl...
2016/10/25
[ "https://Stackoverflow.com/questions/40237155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5736917/" ]
Try this ``` Console.WriteLine( String.Format("{0:0.0}", d + d2)); ```
Use this ``` Console.WriteLine("{0:F}+{1:F}={2:F}",d,d1,d+d1); ``` "F" is Fixed-Point Format Specifier. You can also specify the desired number of decimal places by changing the "F" to "F2,F3 and so on" as per your requirement or leave it as "F" so that it can return output according to the variable.
56,704,620
I'm quite new in Scala world In my Scala tests I have java.time.OffsetDateTime and java.sql.Timestamp ``` offsetDateTimeValue shouldBe timestampValue ``` Result: ``` Expected :2019-06-20T16:19:57.988Z Actual :2019-06-20 16:19:57.988 ``` Any ideas? I was thinking to implement a custom matcher but got stuck with...
2019/06/21
[ "https://Stackoverflow.com/questions/56704620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4832342/" ]
I ended up implementing a custom matcher since I needed it in many tests ``` def beTheSameDate(right: OffsetDateTime) = DateTestMatcher(right) case class DateTestMatcher(right: OffsetDateTime) extends Matcher[Timestamp] { override def apply(left: Timestamp): MatchResult = { val areEqual = left.toLocalDateTime ...
Try converting them both to a `Long` value like so ``` val expected = OffsetDateTime.parse(offsetDateTimeValue, DateTimeFormatter.ISO_OFFSET_DATE_TIME).toInstant.toEpochMilli val actual = timestampValue.toInstant(ZoneOffset.UTC).toEpochMilli expected shouldBe actual ```
56,704,620
I'm quite new in Scala world In my Scala tests I have java.time.OffsetDateTime and java.sql.Timestamp ``` offsetDateTimeValue shouldBe timestampValue ``` Result: ``` Expected :2019-06-20T16:19:57.988Z Actual :2019-06-20 16:19:57.988 ``` Any ideas? I was thinking to implement a custom matcher but got stuck with...
2019/06/21
[ "https://Stackoverflow.com/questions/56704620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4832342/" ]
I ended up implementing a custom matcher since I needed it in many tests ``` def beTheSameDate(right: OffsetDateTime) = DateTestMatcher(right) case class DateTestMatcher(right: OffsetDateTime) extends Matcher[Timestamp] { override def apply(left: Timestamp): MatchResult = { val areEqual = left.toLocalDateTime ...
Custom equality solution - ``` implicit val timeEquality : Equality[OffsetDateTime] = (a: OffsetDateTime, b: Any) => b match { case timestamp: Timestamp => a.toInstant == timestamp.toInstant // can also go via epoch milliseconds as per Mario's solution case other => a == other } val instant = Instant.now() val of...
20,566,517
I have a c# code, which must be ported to java. And now I encounter this instruction mentioned in my topic. ``` this.SynchronizingObject.Invoke((MethodInvoker)delegate() { // do my stuff }, null); ``` Now I must ask in here, what can I do to implement this in java....
2013/12/13
[ "https://Stackoverflow.com/questions/20566517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2029625/" ]
The solution using rank works nicely when you have an odd number of members in each group, i.e. the median exists within the sample, where you have an even number of members the rank method will fall down, e.g. ``` 1 2 3 4 ``` The median here is 2.5 (i.e. half the group is smaller, and half the group is larger) but ...
SQL Server does not have a function to calculate medians, but you could use the ROW\_NUMBER function like this: ``` WITH RankedTable AS ( SELECT Code, Value, ROW_NUMBER() OVER (PARTITION BY Code ORDER BY VALUE) AS Rnk, COUNT(*) OVER (PARTITION BY Code) AS Cnt FROM MyTable ) SELECT Code, Value ...
47,965
I would like to prevent scrapers grabbing all my content except Google, Bing and other search engines. I am thinking of going with Fail2ban and limiting hits from an IP maybe at around 1000 per day. Is this a good idea? Would there be a better way?
2013/05/01
[ "https://webmasters.stackexchange.com/questions/47965", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/27371/" ]
A CDN service could sit in front of your site and filter out known crawlers; they also filter out spammers and since they cache your images at locations around the world your site would be faster. I have been using CloudFlare for about a month on a site for a client and they have seen a decrease in bandwidth use, and ...
There is an Apache module called "robotcop" that is designed for this particular purpose. Unfortunately, the website for that Apache module (`www.robotcop.org`) is no longer in service. Here is a [slashdot article announcing the launch of the robotcop module](http://tech.slashdot.org/story/02/03/11/2228242/robotcop-i...
47,965
I would like to prevent scrapers grabbing all my content except Google, Bing and other search engines. I am thinking of going with Fail2ban and limiting hits from an IP maybe at around 1000 per day. Is this a good idea? Would there be a better way?
2013/05/01
[ "https://webmasters.stackexchange.com/questions/47965", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/27371/" ]
A CDN service could sit in front of your site and filter out known crawlers; they also filter out spammers and since they cache your images at locations around the world your site would be faster. I have been using CloudFlare for about a month on a site for a client and they have seen a decrease in bandwidth use, and ...
Another approach to limiting scrapers and bots would be to implement a honey pot. Put a page up that only bots would be able to find and restrict bots from accessing it via robots.txt. Any bot that then hits this url would get blacklisted. [WPoison](http://www.monkeys.com/wpoison/) is a project that provides the sourc...
47,965
I would like to prevent scrapers grabbing all my content except Google, Bing and other search engines. I am thinking of going with Fail2ban and limiting hits from an IP maybe at around 1000 per day. Is this a good idea? Would there be a better way?
2013/05/01
[ "https://webmasters.stackexchange.com/questions/47965", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/27371/" ]
There are many ways this can be done within Apache using Modules, or alternatively you can setup IP tables to do the job though personally I just use the modules. **[mod\_security](http://johnleach.co.uk/words/1073/rate-limiting-with-apache-and-mod-security)** I've personally used this and it does the job well, a goo...
A CDN service could sit in front of your site and filter out known crawlers; they also filter out spammers and since they cache your images at locations around the world your site would be faster. I have been using CloudFlare for about a month on a site for a client and they have seen a decrease in bandwidth use, and ...
47,965
I would like to prevent scrapers grabbing all my content except Google, Bing and other search engines. I am thinking of going with Fail2ban and limiting hits from an IP maybe at around 1000 per day. Is this a good idea? Would there be a better way?
2013/05/01
[ "https://webmasters.stackexchange.com/questions/47965", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/27371/" ]
A CDN service could sit in front of your site and filter out known crawlers; they also filter out spammers and since they cache your images at locations around the world your site would be faster. I have been using CloudFlare for about a month on a site for a client and they have seen a decrease in bandwidth use, and ...
I think the most efficient ways to limit unwanted hosts and IP's are: 1. Block them outside your server to reduce the load on it. 2. Use internal IP filtering/firewall rules, which reduces the load on your web server application. 3. Bock them using your web server. The first requires dedicated hardware or a proxy ser...
47,965
I would like to prevent scrapers grabbing all my content except Google, Bing and other search engines. I am thinking of going with Fail2ban and limiting hits from an IP maybe at around 1000 per day. Is this a good idea? Would there be a better way?
2013/05/01
[ "https://webmasters.stackexchange.com/questions/47965", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/27371/" ]
There are many ways this can be done within Apache using Modules, or alternatively you can setup IP tables to do the job though personally I just use the modules. **[mod\_security](http://johnleach.co.uk/words/1073/rate-limiting-with-apache-and-mod-security)** I've personally used this and it does the job well, a goo...
There is an Apache module called "robotcop" that is designed for this particular purpose. Unfortunately, the website for that Apache module (`www.robotcop.org`) is no longer in service. Here is a [slashdot article announcing the launch of the robotcop module](http://tech.slashdot.org/story/02/03/11/2228242/robotcop-i...
47,965
I would like to prevent scrapers grabbing all my content except Google, Bing and other search engines. I am thinking of going with Fail2ban and limiting hits from an IP maybe at around 1000 per day. Is this a good idea? Would there be a better way?
2013/05/01
[ "https://webmasters.stackexchange.com/questions/47965", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/27371/" ]
There are many ways this can be done within Apache using Modules, or alternatively you can setup IP tables to do the job though personally I just use the modules. **[mod\_security](http://johnleach.co.uk/words/1073/rate-limiting-with-apache-and-mod-security)** I've personally used this and it does the job well, a goo...
Another approach to limiting scrapers and bots would be to implement a honey pot. Put a page up that only bots would be able to find and restrict bots from accessing it via robots.txt. Any bot that then hits this url would get blacklisted. [WPoison](http://www.monkeys.com/wpoison/) is a project that provides the sourc...
47,965
I would like to prevent scrapers grabbing all my content except Google, Bing and other search engines. I am thinking of going with Fail2ban and limiting hits from an IP maybe at around 1000 per day. Is this a good idea? Would there be a better way?
2013/05/01
[ "https://webmasters.stackexchange.com/questions/47965", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/27371/" ]
There are many ways this can be done within Apache using Modules, or alternatively you can setup IP tables to do the job though personally I just use the modules. **[mod\_security](http://johnleach.co.uk/words/1073/rate-limiting-with-apache-and-mod-security)** I've personally used this and it does the job well, a goo...
I think the most efficient ways to limit unwanted hosts and IP's are: 1. Block them outside your server to reduce the load on it. 2. Use internal IP filtering/firewall rules, which reduces the load on your web server application. 3. Bock them using your web server. The first requires dedicated hardware or a proxy ser...
1,371,198
I am working on a signup form, I am using PHP and on my processing part I run some code, if a submitted item fails I then add it to an errors array. Below is a snip of the code, I am at the point where I need to find the best method to determine if I should trigger an error. So if there is a value set in the error a...
2009/09/03
[ "https://Stackoverflow.com/questions/1371198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143030/" ]
Use array\_filter if you already have keys, but want to check for non-boolean evaluated values. ``` <?php $errors = ['foo' => '', 'bar' => null]; var_dump(array_filter($errors)); $errors = ['foo' => 'Oops', 'bar' => null]; var_dump(array_filter($errors)); ``` Output: ``` array(0) { } array(1) { ["foo"]=> strin...
I should add an obvious answer here. If you initialise your error array as an empty array. And later want to check if it is no longer an empty array: ``` <?php $errors = []; if($errors !== []) { // We have errors. } ```
1,371,198
I am working on a signup form, I am using PHP and on my processing part I run some code, if a submitted item fails I then add it to an errors array. Below is a snip of the code, I am at the point where I need to find the best method to determine if I should trigger an error. So if there is a value set in the error a...
2009/09/03
[ "https://Stackoverflow.com/questions/1371198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143030/" ]
``` if ($signup_errors) { // there was an error } else { // there wasn't } ``` How does it work? When converting to boolean, an empty array converts to false. Every other array converts to true. From the [PHP manual](http://us2.php.net/manual/en/language.types.boolean.php): > > Converting to boolean > ---------...
Check if... ``` if(count($array) > 0) { ... } ``` ...if it is, then at least one key-value pair is set. Alternatively, check if the array is not empty(): ``` if(!empty($array)) { ... } ```
1,371,198
I am working on a signup form, I am using PHP and on my processing part I run some code, if a submitted item fails I then add it to an errors array. Below is a snip of the code, I am at the point where I need to find the best method to determine if I should trigger an error. So if there is a value set in the error a...
2009/09/03
[ "https://Stackoverflow.com/questions/1371198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143030/" ]
Use array\_filter if you already have keys, but want to check for non-boolean evaluated values. ``` <?php $errors = ['foo' => '', 'bar' => null]; var_dump(array_filter($errors)); $errors = ['foo' => 'Oops', 'bar' => null]; var_dump(array_filter($errors)); ``` Output: ``` array(0) { } array(1) { ["foo"]=> strin...
You could check on both the minimum and maximum values of the array, in this case you can have a large array filled with keys and empty values and you don't have to iterate through every key-value pair ``` if(!min($array) && !max($array)) { ... } ```
1,371,198
I am working on a signup form, I am using PHP and on my processing part I run some code, if a submitted item fails I then add it to an errors array. Below is a snip of the code, I am at the point where I need to find the best method to determine if I should trigger an error. So if there is a value set in the error a...
2009/09/03
[ "https://Stackoverflow.com/questions/1371198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143030/" ]
Perhaps [empty()](http://php.net/empty)? From Docs: > > Return Values > ------------- > > > Returns FALSE if var has a non-empty > and non-zero value. > > > The following things are considered to > be empty: > > > > ``` > "" (an empty string) > 0 (0 as an integer) > "0" (0 as a string) > NULL > FALSE > arra...
Check if... ``` if(count($array) > 0) { ... } ``` ...if it is, then at least one key-value pair is set. Alternatively, check if the array is not empty(): ``` if(!empty($array)) { ... } ```
1,371,198
I am working on a signup form, I am using PHP and on my processing part I run some code, if a submitted item fails I then add it to an errors array. Below is a snip of the code, I am at the point where I need to find the best method to determine if I should trigger an error. So if there is a value set in the error a...
2009/09/03
[ "https://Stackoverflow.com/questions/1371198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143030/" ]
``` if ($signup_errors) { // there was an error } else { // there wasn't } ``` How does it work? When converting to boolean, an empty array converts to false. Every other array converts to true. From the [PHP manual](http://us2.php.net/manual/en/language.types.boolean.php): > > Converting to boolean > ---------...
You could check on both the minimum and maximum values of the array, in this case you can have a large array filled with keys and empty values and you don't have to iterate through every key-value pair ``` if(!min($array) && !max($array)) { ... } ```
1,371,198
I am working on a signup form, I am using PHP and on my processing part I run some code, if a submitted item fails I then add it to an errors array. Below is a snip of the code, I am at the point where I need to find the best method to determine if I should trigger an error. So if there is a value set in the error a...
2009/09/03
[ "https://Stackoverflow.com/questions/1371198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143030/" ]
``` if ($signup_errors) { // there was an error } else { // there wasn't } ``` How does it work? When converting to boolean, an empty array converts to false. Every other array converts to true. From the [PHP manual](http://us2.php.net/manual/en/language.types.boolean.php): > > Converting to boolean > ---------...
Use array\_filter if you already have keys, but want to check for non-boolean evaluated values. ``` <?php $errors = ['foo' => '', 'bar' => null]; var_dump(array_filter($errors)); $errors = ['foo' => 'Oops', 'bar' => null]; var_dump(array_filter($errors)); ``` Output: ``` array(0) { } array(1) { ["foo"]=> strin...
1,371,198
I am working on a signup form, I am using PHP and on my processing part I run some code, if a submitted item fails I then add it to an errors array. Below is a snip of the code, I am at the point where I need to find the best method to determine if I should trigger an error. So if there is a value set in the error a...
2009/09/03
[ "https://Stackoverflow.com/questions/1371198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143030/" ]
Perhaps [empty()](http://php.net/empty)? From Docs: > > Return Values > ------------- > > > Returns FALSE if var has a non-empty > and non-zero value. > > > The following things are considered to > be empty: > > > > ``` > "" (an empty string) > 0 (0 as an integer) > "0" (0 as a string) > NULL > FALSE > arra...
Use array\_filter if you already have keys, but want to check for non-boolean evaluated values. ``` <?php $errors = ['foo' => '', 'bar' => null]; var_dump(array_filter($errors)); $errors = ['foo' => 'Oops', 'bar' => null]; var_dump(array_filter($errors)); ``` Output: ``` array(0) { } array(1) { ["foo"]=> strin...
1,371,198
I am working on a signup form, I am using PHP and on my processing part I run some code, if a submitted item fails I then add it to an errors array. Below is a snip of the code, I am at the point where I need to find the best method to determine if I should trigger an error. So if there is a value set in the error a...
2009/09/03
[ "https://Stackoverflow.com/questions/1371198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143030/" ]
``` if ($signup_errors) { // there was an error } else { // there wasn't } ``` How does it work? When converting to boolean, an empty array converts to false. Every other array converts to true. From the [PHP manual](http://us2.php.net/manual/en/language.types.boolean.php): > > Converting to boolean > ---------...
I should add an obvious answer here. If you initialise your error array as an empty array. And later want to check if it is no longer an empty array: ``` <?php $errors = []; if($errors !== []) { // We have errors. } ```
1,371,198
I am working on a signup form, I am using PHP and on my processing part I run some code, if a submitted item fails I then add it to an errors array. Below is a snip of the code, I am at the point where I need to find the best method to determine if I should trigger an error. So if there is a value set in the error a...
2009/09/03
[ "https://Stackoverflow.com/questions/1371198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143030/" ]
Check if... ``` if(count($array) > 0) { ... } ``` ...if it is, then at least one key-value pair is set. Alternatively, check if the array is not empty(): ``` if(!empty($array)) { ... } ```
You could check on both the minimum and maximum values of the array, in this case you can have a large array filled with keys and empty values and you don't have to iterate through every key-value pair ``` if(!min($array) && !max($array)) { ... } ```
1,371,198
I am working on a signup form, I am using PHP and on my processing part I run some code, if a submitted item fails I then add it to an errors array. Below is a snip of the code, I am at the point where I need to find the best method to determine if I should trigger an error. So if there is a value set in the error a...
2009/09/03
[ "https://Stackoverflow.com/questions/1371198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143030/" ]
Perhaps [empty()](http://php.net/empty)? From Docs: > > Return Values > ------------- > > > Returns FALSE if var has a non-empty > and non-zero value. > > > The following things are considered to > be empty: > > > > ``` > "" (an empty string) > 0 (0 as an integer) > "0" (0 as a string) > NULL > FALSE > arra...
I should add an obvious answer here. If you initialise your error array as an empty array. And later want to check if it is no longer an empty array: ``` <?php $errors = []; if($errors !== []) { // We have errors. } ```
67,610,593
Beginner question but I wanted to handle data from multiple dictionaries in a single variable. For example: ``` x = {"age":"24","name":"Bob"}, {"age":"21","name":"George"} ``` In this case, how would I find out what "age" is in each dictionary in x, and put them in a list? This should be the desired outcome: ``` ag...
2021/05/19
[ "https://Stackoverflow.com/questions/67610593", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15579672/" ]
Use `ages.append(y["age"])` - note the **y** which references each dictionary in the tuple of dictionaries referenced by `x`
You can just check whether the dictionary contains the key you want. ```py if "age" in y: ages.append(y["age"]) ```
67,610,593
Beginner question but I wanted to handle data from multiple dictionaries in a single variable. For example: ``` x = {"age":"24","name":"Bob"}, {"age":"21","name":"George"} ``` In this case, how would I find out what "age" is in each dictionary in x, and put them in a list? This should be the desired outcome: ``` ag...
2021/05/19
[ "https://Stackoverflow.com/questions/67610593", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15579672/" ]
Maybe because you try and find the key of a tuple? You need to use `y`. ``` ages = [] for y in x: ages.append(y["age"]) print(ages) ```
You can just check whether the dictionary contains the key you want. ```py if "age" in y: ages.append(y["age"]) ```
43,166,393
My first thought is to `map` the `Option`, but I can't use `try!` from inside of the closure. The `match` statement looks unnecessary, but I can't figure out how to simplify it. ``` fn example<T, E>(val: Option<Result<T, E>>) -> Result<Option<T>, E> { Ok(match val { Some(v) => Some(v?), None => Non...
2017/04/02
[ "https://Stackoverflow.com/questions/43166393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/704969/" ]
In Rust 1.33, [`transpose()`](https://doc.rust-lang.org/std/option/enum.Option.html#method.transpose) is stable, so you can just call it: ``` fn main() { let x: Result<Option<i32>, ()> = Ok(Some(5)); let y: Option<Result<i32, ()>> = Some(Ok(5)); assert_eq!(x, y.transpose()); } ```
You can use [`Option::map_or()`](https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.map_or): ``` val.map_or(Ok(None), |v| v.map(Some)) ```
12,432,796
I am creating a login form using post method. It is working fine. The logout button work fine. But when I pressed back button the browser and reach the login page where user submit the id and password the resend option is there. Then it resend the id and password again.. How can I overcome the problem.
2012/09/14
[ "https://Stackoverflow.com/questions/12432796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1672589/" ]
You mix up two concepts: * The file path **on the server** where a file is stored * The URL for **the client** where to find that file it is one of the more important functions of a webserver to abstract apart these two locations. If you want to server a file from **outside** of your www-root, you need to create a ...
Outsiders can't access files on your computer just by providing the link to them! This would be a huge security issue! See this answer here [Allow users to download files outside webroot](https://stackoverflow.com/questions/3884677/allow-users-to-download-files-outside-webroot)
22,845,176
A while back if I built an html 4 page I would use div, span h1,h2,h3, strong, p and then style my css accordingly. <https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5> why are these tags here? Now I want to use HTML 5 and I am very confused because after doing some research I see that there is allot of co...
2014/04/03
[ "https://Stackoverflow.com/questions/22845176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1477816/" ]
Many of the new tags are to provide **semantic** and **structural** meaning to your document, even if you're not using them directly for styling. This improves machine-readability of your document. Semantic markup allows software to more effectively identify and classify portions of your document. For example, you can...
1.How do you know what tags should be used? * identify the header of your page or the header of a section and use - [header](http://w3-video.com/Web_Technologies/HTML5/html5_header_tag.php) tag * which part represents the footer of your page or the footer of a section ? - use [footer](http://w3-video.com/Web_Technolog...
7,202,315
I am working on a java app that utilizes PreparedStatement. ``` SELECT FIELD1, FIELD2 FROM MYTABLE WHERE (FIELD1='firstFieldValue' OR FIELD1='' or 'firstFieldValue'=''); ``` firstFieldValue is a parameter. And it is necessary to check that its value is empty in SQL. I created a prepared statement with the following...
2011/08/26
[ "https://Stackoverflow.com/questions/7202315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Just check it in java. ``` if firstFieldValue.equals("") then SELECT FIELD1, FIELD2 FROM MYTABLE else SELECT FIELD1, FIELD2 FROM MYTABLE WHERE (FIELD1=? OR FIELD1=''); preparedStatementInstance.setString(1, this.firstFieldValue); ```
there is no 'i think it is wrong' in executing sql's, either it is correct and it executes the query or the sql is wrong and you get an sqlexception If it fails you should provide the forum with the stacktrace so we dont have to mindread. what do you mean with 'empty'? empty as a empty string or as null in the db
160,515
I want to show items and labels in the legend only for those features shown on map. I hid some of them with a query definition in layer properties, but they're still visible in the legend. I know that converting the legend to graphic I can manage manually each item, thus delete those I don't want, but I would like to p...
2015/09/02
[ "https://gis.stackexchange.com/questions/160515", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/19118/" ]
There is an even simpler way to do this, especially if you have a lot of layers in your map, as your method would be a bit time consuming. In the Layout View, right click on your Legend and select "Properties". Go to the "Items" tab and tick the box "Only show classes that are visible in the current map extent" found ...
I'm going to answer my own post because I found a solution and realized it was a very easy one. I just needed to clear those items from the symbology properties of the layer and they also disappeared from the legend.
70,724,350
I need to read special configuration for my app in Laravel 8, all my settings are stored in a single filename naned mydata.php inside folder/config inside mydata.php ``` return [ 'setting1' => 99, ]; ``` I have tried to read it using ``` dd(config('mydata.setting1')); ``` but always return null, I need to ge...
2022/01/15
[ "https://Stackoverflow.com/questions/70724350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11732255/" ]
Simply replace the `pass` in the `except` block with `return res`, as the `return` statement would terminate the calculation and return the cumulative sum up to but excluding the invalid value. : ``` def list_sum(numbers, n): res = 0 for i in range(n): try: res += numbers[i] except ...
``` def list_sum(numbers,n): res = 0 for i in range(n): try: res += numbers[i] except (TypeError, ValueError): break return res ```
45,895,186
Recently I spent quite some time to figure it out the issue with my unit test. The error that I saw in my unit test is : ``` Ambiguous type name 'AssetIdentifier' in 'UIImage' ``` This is the complete code : ``` import XCTest import module @testable import module class VoucherOptionsViewControllerTests: XCTestCase...
2017/08/26
[ "https://Stackoverflow.com/questions/45895186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5175944/" ]
I think your issue lays in the double import of the module `module`. ``` import module @testable import module ``` By importing it twice you give the compiler two (identical) versions of every type and function defined in `module`. That's why it's complaining about the ambiguity of `AssetIdentifier`, there's two of ...
Although that thread does not give the real answer, it gives great clue about the issue. So the fix that I found is by removing : ``` @testable import module ``` I keep the UIImage extension in the test module so the compiler does not complain.
18,540,998
In the following code I want to read the first 2 chars in the hex string 'a', convert them into the corresponding byte value with sscanf and put the result in 'b'. No modifications should be performed on 'a'. ``` #include <stdio.h> #include <string.h> int main() { unsigned char a[]="fa23456789abcdef"; // 0-9 a-f ...
2013/08/30
[ "https://Stackoverflow.com/questions/18540998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2464424/" ]
Your `sscanf` doesn't support `hh`, which means it's converting as an `unsigned int` and trying to stuff that into an `unsigned char`-sized variable, causing undefined behaviour. In your case, that means apparently overwriting part of `a`. Fix your warnings! If your `sscanf` *did* support `hh`, you'd be fine, but you ...
The variable `a` should be `char`, not `unsigned char`. With this change, I have the expected behaviour in my computer. [Here is the sscanf documentation](http://en.cppreference.com/w/c/io/fscanf)
123
You see this in quite a bunch of movies / books (think avatar). What could be a reasoned physical explanation of such phenomenon? Would this explanation impact other things on a planet? Like most things in nature, I'm assuming it could come from a combination of many factors. Magnetic repel (suggested by @smithkm), h...
2014/09/17
[ "https://worldbuilding.stackexchange.com/questions/123", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/90/" ]
This is a trope that I have used before, and probably will again, and in every single instance, I have never tried to explain it as anything other than magic, given that it is so unlikely to occur in the real scientifically explicable universe that it can be nothing other than magic. With a sufficiently powerful magne...
There is no GOOD way to do this with the physics we know: 1) low density rocks: very difficult as a solid is much heavier than a gas in all cases. The best exceptions are trapping voids or lighter gasses in the rocks. Rocks though are made of silicas which are too dense and porous. A tiny amount of success might be po...
123
You see this in quite a bunch of movies / books (think avatar). What could be a reasoned physical explanation of such phenomenon? Would this explanation impact other things on a planet? Like most things in nature, I'm assuming it could come from a combination of many factors. Magnetic repel (suggested by @smithkm), h...
2014/09/17
[ "https://worldbuilding.stackexchange.com/questions/123", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/90/" ]
Near surface geostationary orbit ================================ Perfectly still or slowly rotating rocks suspended above one point on a planet's surface can be achieved, and might be found in nature, although rare. However, since this explanation only works on a planet without an atmosphere (or else only works for r...
The only thing I can think of that remotely comes close is the combination of a superconductor and a powerful magnet, but even if there were gigantic lumps of superconductor and immensely powerful permanent magnets occurring naturally. You couldn't get them to levitate very high if you could get it to work at all. Aer...
123
You see this in quite a bunch of movies / books (think avatar). What could be a reasoned physical explanation of such phenomenon? Would this explanation impact other things on a planet? Like most things in nature, I'm assuming it could come from a combination of many factors. Magnetic repel (suggested by @smithkm), h...
2014/09/17
[ "https://worldbuilding.stackexchange.com/questions/123", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/90/" ]
Near surface geostationary orbit ================================ Perfectly still or slowly rotating rocks suspended above one point on a planet's surface can be achieved, and might be found in nature, although rare. However, since this explanation only works on a planet without an atmosphere (or else only works for r...
This is a trope that I have used before, and probably will again, and in every single instance, I have never tried to explain it as anything other than magic, given that it is so unlikely to occur in the real scientifically explicable universe that it can be nothing other than magic. With a sufficiently powerful magne...
123
You see this in quite a bunch of movies / books (think avatar). What could be a reasoned physical explanation of such phenomenon? Would this explanation impact other things on a planet? Like most things in nature, I'm assuming it could come from a combination of many factors. Magnetic repel (suggested by @smithkm), h...
2014/09/17
[ "https://worldbuilding.stackexchange.com/questions/123", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/90/" ]
Near surface geostationary orbit ================================ Perfectly still or slowly rotating rocks suspended above one point on a planet's surface can be achieved, and might be found in nature, although rare. However, since this explanation only works on a planet without an atmosphere (or else only works for r...
There is no GOOD way to do this with the physics we know: 1) low density rocks: very difficult as a solid is much heavier than a gas in all cases. The best exceptions are trapping voids or lighter gasses in the rocks. Rocks though are made of silicas which are too dense and porous. A tiny amount of success might be po...
123
You see this in quite a bunch of movies / books (think avatar). What could be a reasoned physical explanation of such phenomenon? Would this explanation impact other things on a planet? Like most things in nature, I'm assuming it could come from a combination of many factors. Magnetic repel (suggested by @smithkm), h...
2014/09/17
[ "https://worldbuilding.stackexchange.com/questions/123", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/90/" ]
Near surface geostationary orbit ================================ Perfectly still or slowly rotating rocks suspended above one point on a planet's surface can be achieved, and might be found in nature, although rare. However, since this explanation only works on a planet without an atmosphere (or else only works for r...
Science-based, you need upward forces to be equal to downward forces. Downward forces are easy: they can be resumed as gravity. Making them smaller points to low density materials and low gravity worlds. Low density not only involves low density mineral but also incrusted gas in hollows. Upward forces need a lot of h...
123
You see this in quite a bunch of movies / books (think avatar). What could be a reasoned physical explanation of such phenomenon? Would this explanation impact other things on a planet? Like most things in nature, I'm assuming it could come from a combination of many factors. Magnetic repel (suggested by @smithkm), h...
2014/09/17
[ "https://worldbuilding.stackexchange.com/questions/123", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/90/" ]
Using currently known physics it's essentially impossible. To move into more speculative realms though if you posited a material that repelled itself similar to opposed magnetic fields you could generate "floating rocks". The material would need to not repel when held together, but chunks of it would act to repel each...
Near surface geostationary orbit ================================ Perfectly still or slowly rotating rocks suspended above one point on a planet's surface can be achieved, and might be found in nature, although rare. However, since this explanation only works on a planet without an atmosphere (or else only works for r...
123
You see this in quite a bunch of movies / books (think avatar). What could be a reasoned physical explanation of such phenomenon? Would this explanation impact other things on a planet? Like most things in nature, I'm assuming it could come from a combination of many factors. Magnetic repel (suggested by @smithkm), h...
2014/09/17
[ "https://worldbuilding.stackexchange.com/questions/123", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/90/" ]
> > Any sort of floating ground that could harbor life was the first > desire. > > > That's easier than rocks. Mars size world orbiting a gas giant. To terraform it, mass off the gas giants atmosphere are blown off, turned to plasma and dumped on the moon. Atmosphere is mostly helium and large amounts of fluoro...
Chemical reaction in some short ways. Let me explain: If the small Stones are of some light kind (volcanic or likewise) and of some chemical active matter it could be possible for them to lift up for some little time when they react to some other lequid or chemical substance. There could be a burning that boost them ...
123
You see this in quite a bunch of movies / books (think avatar). What could be a reasoned physical explanation of such phenomenon? Would this explanation impact other things on a planet? Like most things in nature, I'm assuming it could come from a combination of many factors. Magnetic repel (suggested by @smithkm), h...
2014/09/17
[ "https://worldbuilding.stackexchange.com/questions/123", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/90/" ]
Using currently known physics it's essentially impossible. To move into more speculative realms though if you posited a material that repelled itself similar to opposed magnetic fields you could generate "floating rocks". The material would need to not repel when held together, but chunks of it would act to repel each...
Science-based, you need upward forces to be equal to downward forces. Downward forces are easy: they can be resumed as gravity. Making them smaller points to low density materials and low gravity worlds. Low density not only involves low density mineral but also incrusted gas in hollows. Upward forces need a lot of h...
123
You see this in quite a bunch of movies / books (think avatar). What could be a reasoned physical explanation of such phenomenon? Would this explanation impact other things on a planet? Like most things in nature, I'm assuming it could come from a combination of many factors. Magnetic repel (suggested by @smithkm), h...
2014/09/17
[ "https://worldbuilding.stackexchange.com/questions/123", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/90/" ]
Using currently known physics it's essentially impossible. To move into more speculative realms though if you posited a material that repelled itself similar to opposed magnetic fields you could generate "floating rocks". The material would need to not repel when held together, but chunks of it would act to repel each...
> > Any sort of floating ground that could harbor life was the first > desire. > > > That's easier than rocks. Mars size world orbiting a gas giant. To terraform it, mass off the gas giants atmosphere are blown off, turned to plasma and dumped on the moon. Atmosphere is mostly helium and large amounts of fluoro...
123
You see this in quite a bunch of movies / books (think avatar). What could be a reasoned physical explanation of such phenomenon? Would this explanation impact other things on a planet? Like most things in nature, I'm assuming it could come from a combination of many factors. Magnetic repel (suggested by @smithkm), h...
2014/09/17
[ "https://worldbuilding.stackexchange.com/questions/123", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/90/" ]
This is a trope that I have used before, and probably will again, and in every single instance, I have never tried to explain it as anything other than magic, given that it is so unlikely to occur in the real scientifically explicable universe that it can be nothing other than magic. With a sufficiently powerful magne...
Chemical reaction in some short ways. Let me explain: If the small Stones are of some light kind (volcanic or likewise) and of some chemical active matter it could be possible for them to lift up for some little time when they react to some other lequid or chemical substance. There could be a burning that boost them ...
28,015,278
I have a feeling I'm missing something here. I found myself doing the following ``` private static int getHighestValue(Map<Character, Integer> countMap) { return countMap.values().stream().mapToInt(Integer::intValue).max().getAsInt(); } ``` My problem is with the silly conversion from `Stream` to `IntStream` via...
2015/01/18
[ "https://Stackoverflow.com/questions/28015278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1086540/" ]
Due to type erasure, the `Stream` implementation has no knowledge about the type of its elements and can’t provide you with neither, a simplified `max` operation nor a conversion to `IntStream` method. In both cases it requires a function, a `Comparator` or a `ToIntFunction`, respectively, to perform the operation usi...
I realize you are trying to avoid a comparator, but you could use the built-in for this by referring to `Integer.compareTo`: ``` private static int getHighestValue(Map<Character, Integer> countMap) { return countMap.values().stream().max(Integer::compareTo).get(); } ``` Or as @fge suggests, using `::compare`: `...
28,015,278
I have a feeling I'm missing something here. I found myself doing the following ``` private static int getHighestValue(Map<Character, Integer> countMap) { return countMap.values().stream().mapToInt(Integer::intValue).max().getAsInt(); } ``` My problem is with the silly conversion from `Stream` to `IntStream` via...
2015/01/18
[ "https://Stackoverflow.com/questions/28015278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1086540/" ]
I realize you are trying to avoid a comparator, but you could use the built-in for this by referring to `Integer.compareTo`: ``` private static int getHighestValue(Map<Character, Integer> countMap) { return countMap.values().stream().max(Integer::compareTo).get(); } ``` Or as @fge suggests, using `::compare`: `...
If the question is "Can I avoid passing converter while converting from `Stream<T>` to `IntStream`?" one possible answer might be "There is no way in Java to make such conversion type-safe and make it part of the `Stream` interface at the same time". Indeed method which converts `Stream<T>` to `IntStream` without a co...
28,015,278
I have a feeling I'm missing something here. I found myself doing the following ``` private static int getHighestValue(Map<Character, Integer> countMap) { return countMap.values().stream().mapToInt(Integer::intValue).max().getAsInt(); } ``` My problem is with the silly conversion from `Stream` to `IntStream` via...
2015/01/18
[ "https://Stackoverflow.com/questions/28015278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1086540/" ]
Due to type erasure, the `Stream` implementation has no knowledge about the type of its elements and can’t provide you with neither, a simplified `max` operation nor a conversion to `IntStream` method. In both cases it requires a function, a `Comparator` or a `ToIntFunction`, respectively, to perform the operation usi...
Another way you could do the conversion is with a lambda: `mapToInt(i -> i)`. Whether you should use a lambda or a method reference is discussed in detail [here](https://stackoverflow.com/a/24493905/3179759), but the summary is that you should use whichever you find more readable.
28,015,278
I have a feeling I'm missing something here. I found myself doing the following ``` private static int getHighestValue(Map<Character, Integer> countMap) { return countMap.values().stream().mapToInt(Integer::intValue).max().getAsInt(); } ``` My problem is with the silly conversion from `Stream` to `IntStream` via...
2015/01/18
[ "https://Stackoverflow.com/questions/28015278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1086540/" ]
Another way you could do the conversion is with a lambda: `mapToInt(i -> i)`. Whether you should use a lambda or a method reference is discussed in detail [here](https://stackoverflow.com/a/24493905/3179759), but the summary is that you should use whichever you find more readable.
If the question is "Can I avoid passing converter while converting from `Stream<T>` to `IntStream`?" one possible answer might be "There is no way in Java to make such conversion type-safe and make it part of the `Stream` interface at the same time". Indeed method which converts `Stream<T>` to `IntStream` without a co...
28,015,278
I have a feeling I'm missing something here. I found myself doing the following ``` private static int getHighestValue(Map<Character, Integer> countMap) { return countMap.values().stream().mapToInt(Integer::intValue).max().getAsInt(); } ``` My problem is with the silly conversion from `Stream` to `IntStream` via...
2015/01/18
[ "https://Stackoverflow.com/questions/28015278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1086540/" ]
Due to type erasure, the `Stream` implementation has no knowledge about the type of its elements and can’t provide you with neither, a simplified `max` operation nor a conversion to `IntStream` method. In both cases it requires a function, a `Comparator` or a `ToIntFunction`, respectively, to perform the operation usi...
If the question is "Can I avoid passing converter while converting from `Stream<T>` to `IntStream`?" one possible answer might be "There is no way in Java to make such conversion type-safe and make it part of the `Stream` interface at the same time". Indeed method which converts `Stream<T>` to `IntStream` without a co...
13,687,095
In a JSP file I wanto to replace newlines (`\n`) with `<br />`. I tried ``` ${fn:replace(someString, '\n', '<br />')} ``` But I get an error `'\n' ecnountered, was expeting one of...` Which I guess it means the parser doesn't like something like this. Is it possible to do something like this using EL?
2012/12/03
[ "https://Stackoverflow.com/questions/13687095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1029825/" ]
Create an EL function for that. First create a static method which does the desired job: ``` package com.example; public final class Functions { private Functions() {} public static String nl2br(String string) { return (string != null) ? string.replace("\n", "<br/>") : null; } } ``` Then c...
Your way is a lot easier. Why didn't I think of that. Here is a demo page. ``` <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <c:set var="newLine" value="\n" /> <c:set var="myText" value="one\ntwo\nthree" /> ${fn:replace(myText, n...
13,687,095
In a JSP file I wanto to replace newlines (`\n`) with `<br />`. I tried ``` ${fn:replace(someString, '\n', '<br />')} ``` But I get an error `'\n' ecnountered, was expeting one of...` Which I guess it means the parser doesn't like something like this. Is it possible to do something like this using EL?
2012/12/03
[ "https://Stackoverflow.com/questions/13687095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1029825/" ]
Your way is a lot easier. Why didn't I think of that. Here is a demo page. ``` <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <c:set var="newLine" value="\n" /> <c:set var="myText" value="one\ntwo\nthree" /> ${fn:replace(myText, n...
For me, it worked by first defining a variable `newLine`, either with ``` <% pageContext.setAttribute("newLine", "\n"); %> ``` Or ``` <c:set var="newLine" value="<%= '\n' %>" /> ``` And then ``` ${fn:replace(someString, newLine, '<br/>')} ```
13,687,095
In a JSP file I wanto to replace newlines (`\n`) with `<br />`. I tried ``` ${fn:replace(someString, '\n', '<br />')} ``` But I get an error `'\n' ecnountered, was expeting one of...` Which I guess it means the parser doesn't like something like this. Is it possible to do something like this using EL?
2012/12/03
[ "https://Stackoverflow.com/questions/13687095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1029825/" ]
Create an EL function for that. First create a static method which does the desired job: ``` package com.example; public final class Functions { private Functions() {} public static String nl2br(String string) { return (string != null) ? string.replace("\n", "<br/>") : null; } } ``` Then c...
For me, it worked by first defining a variable `newLine`, either with ``` <% pageContext.setAttribute("newLine", "\n"); %> ``` Or ``` <c:set var="newLine" value="<%= '\n' %>" /> ``` And then ``` ${fn:replace(someString, newLine, '<br/>')} ```
708,528
We have a stored procedure written using a CL and RPG program combination. When called locally on the iSeries all is fine. When called externally (for example from a SQL frontend) the RPG program cannot get a hadle on the spool file it produces because the spool file appears under a different (random?) job number and u...
2009/04/02
[ "https://Stackoverflow.com/questions/708528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86034/" ]
If you're running a stored procedure (running in job QZDASOINIT), you will no be able to access the spooled output via the program status data structure. Those spooled files reside in a job named, user/QPRTJOB, where user is the "current user" running the stored procedure. To access the spooled files, run api QSPRILSP ...
I need a bit more information, but I'll make some assumptions. Please clarify if I assumed wrong. The QUSER in QUSRWRK behavior is correct. You are now running through the SQL server (or similar server). All connections run under these settings. There are a couple approaches. 1) Assuming that this all runs in one j...
708,528
We have a stored procedure written using a CL and RPG program combination. When called locally on the iSeries all is fine. When called externally (for example from a SQL frontend) the RPG program cannot get a hadle on the spool file it produces because the spool file appears under a different (random?) job number and u...
2009/04/02
[ "https://Stackoverflow.com/questions/708528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86034/" ]
A server job (e.g., a database server instance for ODBC/JDBC) runs under a system user profile. For stored procs, the system user will usually be QUSER. Objects created within a job are usually owned by the job user. Server jobs generally perform work **on behalf** of other users. You tell the server job which user wh...
I need a bit more information, but I'll make some assumptions. Please clarify if I assumed wrong. The QUSER in QUSRWRK behavior is correct. You are now running through the SQL server (or similar server). All connections run under these settings. There are a couple approaches. 1) Assuming that this all runs in one j...
708,528
We have a stored procedure written using a CL and RPG program combination. When called locally on the iSeries all is fine. When called externally (for example from a SQL frontend) the RPG program cannot get a hadle on the spool file it produces because the spool file appears under a different (random?) job number and u...
2009/04/02
[ "https://Stackoverflow.com/questions/708528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86034/" ]
If you're running a stored procedure (running in job QZDASOINIT), you will no be able to access the spooled output via the program status data structure. Those spooled files reside in a job named, user/QPRTJOB, where user is the "current user" running the stored procedure. To access the spooled files, run api QSPRILSP ...
If you can modify the RPG program you can retrieve job information from the [Program Status Data Structure](http://publib.boulder.ibm.com/iseries/v5r1/ic2924/books/c092508381.htm) while the [File Information Data Structure](http://publib.boulder.ibm.com/iseries/v5r1/ic2924/books/c092508378.htm) has the spool file numbe...
708,528
We have a stored procedure written using a CL and RPG program combination. When called locally on the iSeries all is fine. When called externally (for example from a SQL frontend) the RPG program cannot get a hadle on the spool file it produces because the spool file appears under a different (random?) job number and u...
2009/04/02
[ "https://Stackoverflow.com/questions/708528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86034/" ]
A server job (e.g., a database server instance for ODBC/JDBC) runs under a system user profile. For stored procs, the system user will usually be QUSER. Objects created within a job are usually owned by the job user. Server jobs generally perform work **on behalf** of other users. You tell the server job which user wh...
If you can modify the RPG program you can retrieve job information from the [Program Status Data Structure](http://publib.boulder.ibm.com/iseries/v5r1/ic2924/books/c092508381.htm) while the [File Information Data Structure](http://publib.boulder.ibm.com/iseries/v5r1/ic2924/books/c092508378.htm) has the spool file numbe...
708,528
We have a stored procedure written using a CL and RPG program combination. When called locally on the iSeries all is fine. When called externally (for example from a SQL frontend) the RPG program cannot get a hadle on the spool file it produces because the spool file appears under a different (random?) job number and u...
2009/04/02
[ "https://Stackoverflow.com/questions/708528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86034/" ]
If you're running a stored procedure (running in job QZDASOINIT), you will no be able to access the spooled output via the program status data structure. Those spooled files reside in a job named, user/QPRTJOB, where user is the "current user" running the stored procedure. To access the spooled files, run api QSPRILSP ...
The job itself knows or can find out (see previous answers) so, if all else fails, modify the program to place a message on a queue that provides the information you need. Read it off at your leisure. .
708,528
We have a stored procedure written using a CL and RPG program combination. When called locally on the iSeries all is fine. When called externally (for example from a SQL frontend) the RPG program cannot get a hadle on the spool file it produces because the spool file appears under a different (random?) job number and u...
2009/04/02
[ "https://Stackoverflow.com/questions/708528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86034/" ]
A server job (e.g., a database server instance for ODBC/JDBC) runs under a system user profile. For stored procs, the system user will usually be QUSER. Objects created within a job are usually owned by the job user. Server jobs generally perform work **on behalf** of other users. You tell the server job which user wh...
The job itself knows or can find out (see previous answers) so, if all else fails, modify the program to place a message on a queue that provides the information you need. Read it off at your leisure. .
44,579,191
I have 2 models ``` class Task(models.Model): taskid = models.AutoField(primary_key=True,default = increment_booking_number) projectcode = models.ForeignKey('Project', models.DO_NOTHING, db_column='projectid') taskname = models.CharField(max_length=100) taskdescription = models.TextField(max_length=500...
2017/06/16
[ "https://Stackoverflow.com/questions/44579191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7536943/" ]
Not supported today. Here is a related UserVoice [link](https://wpdev.uservoice.com/forums/110705-universal-windows-platform/suggestions/13052589-uwp-input-validation) for you to comment and vote:
The answer is in this channel9 video: <https://channel9.msdn.com/events/Build/2018/BRK3502?term=lob%20uwp&lang-en=true> There will be System.ComponententModel.INotifyDataErrorInfo to re-use existing .NET code, and also Windows.UI.Xaml.Data.INotifyDataErrorInfo to make the functionality also available to C++ developers...
29,768,709
I have a string say "abcd/data/efgh". Now I need to replace text between two '/' character in this string with some other data. for ex: I want "abcd/data/efgh" to be replaced with "abcd/newtext/efgh". how can I do it with reg exp in javascript?
2015/04/21
[ "https://Stackoverflow.com/questions/29768709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4729505/" ]
Using replace, but because javascript doesn't have lookbehinds, you need to replace it with a string concatenated with slashes: ``` var x = 'abcd/data/efgh'; var s = 'newtext'; console.log(x.replace(/\/[^/]+\//, '/'+s+'/'));// gives: abcd/newtext/efgh ```
Have e try with: ``` 'abcd/data/efgh'.replace(/\/[^/]+\//, '/newtest/') ``` **Output:** ``` abcd/newtest/efgh ```
29,768,709
I have a string say "abcd/data/efgh". Now I need to replace text between two '/' character in this string with some other data. for ex: I want "abcd/data/efgh" to be replaced with "abcd/newtext/efgh". how can I do it with reg exp in javascript?
2015/04/21
[ "https://Stackoverflow.com/questions/29768709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4729505/" ]
Using replace, but because javascript doesn't have lookbehinds, you need to replace it with a string concatenated with slashes: ``` var x = 'abcd/data/efgh'; var s = 'newtext'; console.log(x.replace(/\/[^/]+\//, '/'+s+'/'));// gives: abcd/newtext/efgh ```
Try this: ``` "abcd/data/efgh".replace(/\/(.+)\//, '/newtext/') ``` or ``` "abcd/data/efgh".replace(/^(.+\/)(.+)(\/.+)$/, '$1newtext$3') ```
29,768,709
I have a string say "abcd/data/efgh". Now I need to replace text between two '/' character in this string with some other data. for ex: I want "abcd/data/efgh" to be replaced with "abcd/newtext/efgh". how can I do it with reg exp in javascript?
2015/04/21
[ "https://Stackoverflow.com/questions/29768709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4729505/" ]
Using replace, but because javascript doesn't have lookbehinds, you need to replace it with a string concatenated with slashes: ``` var x = 'abcd/data/efgh'; var s = 'newtext'; console.log(x.replace(/\/[^/]+\//, '/'+s+'/'));// gives: abcd/newtext/efgh ```
you should try this code snippet ``` var x = 'abcd/data/efgh'; var s = 'newtext'; console.log(x.replace(/(/.[^/]+/)/g, '/'+s+'/')); ``` Hope this would help you. Thanks!!
46,475,420
Is it possible to set three dot context menu using "react-native-popup-menu" in "react-native-navigation" navbar? or do we have any other approach to set three dot context menu in both IOS and Android with "react-native-navigation" navbar?
2017/09/28
[ "https://Stackoverflow.com/questions/46475420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6306447/" ]
You can control the priority and positioning of each button (On Android) using the `showAsAction` property. See the [docs](https://wix.github.io/react-native-navigation/#/adding-buttons-to-the-navigator) for more details. In short, the following snippet will add two buttons to the menu and one outside: ``` static nav...
I've been wondering about this as well, and found a solution: Generally, all the Menu parts **have to** be inside of the `Menu` tag, so the `MenuTrigger` as well. You can style the `MenuTrigger` but I didn't get it into the top bar with that. Good news: It's even easier than that, simply place the whole `Menu` into yo...
46,475,420
Is it possible to set three dot context menu using "react-native-popup-menu" in "react-native-navigation" navbar? or do we have any other approach to set three dot context menu in both IOS and Android with "react-native-navigation" navbar?
2017/09/28
[ "https://Stackoverflow.com/questions/46475420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6306447/" ]
You can control the priority and positioning of each button (On Android) using the `showAsAction` property. See the [docs](https://wix.github.io/react-native-navigation/#/adding-buttons-to-the-navigator) for more details. In short, the following snippet will add two buttons to the menu and one outside: ``` static nav...
I actually made my own context menu with this library: <https://github.com/react-native-community/react-native-modal> So basically it is a modal with its background completely transparent. The content of the modal is rendered just below the "three dot context menu" - button. By using their onBackdropPress function, y...
32,710,005
I am new to Mule and I need to call a flow from Java class. Can anyone give steps please?
2015/09/22
[ "https://Stackoverflow.com/questions/32710005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4243459/" ]
Use: ``` String date = "22-10-2015"; SimpleDateFormat format = new SimpleDateFormat("dd-mm-yyyy"); try { Date d = format.parse(date); Date dateBefore = new Date(d.getTime() - 7 * 24 * 3600 * 1000l ); System.out.print(format.format(dateBefore)); // print 15-10-2015 } catch(ParseExceptio...
try this, ``` Calendar cal = Calendar.getInstance();//here is your selected event date ok. cal.setTime(dateInstance); cal.add(Calendar.DATE, -7); Date dateBefore30Days = cal.getTime(); ```
32,710,005
I am new to Mule and I need to call a flow from Java class. Can anyone give steps please?
2015/09/22
[ "https://Stackoverflow.com/questions/32710005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4243459/" ]
Try this: ``` // If reminterDate is a string DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); // Here use what format you use. Date date1 = dateFormat.parse(reminterDate);; Calendar calendar = Calendar.getInstance(); calendar.setTime(date1 ); calendar.add(Calendar.DAY_OF_MONTH, -7); date1 = calendar.getTi...
try this, ``` Calendar cal = Calendar.getInstance();//here is your selected event date ok. cal.setTime(dateInstance); cal.add(Calendar.DATE, -7); Date dateBefore30Days = cal.getTime(); ```
67,002,618
I am trying to use requireJs and AngularJs together. when I want to inject some factories I get the following error: angular.js:15697 Error: [$injector:unpr] Unknown provider: StudentQueriesProvider <- StudentQueries <- schoolCtrl search.js ``` define([ 'angular', ],function (angular) { angular.module('app',...
2021/04/08
[ "https://Stackoverflow.com/questions/67002618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9145373/" ]
If I correct understand you. Try to add `fileNameToStore` variable in `foreach`: ``` $errors = []; $post = new Post; if ($request->hasFile('cover_image')) { foreach ($request->file('cover_image') as $file) { $filenameWithExt =$request->file('image')->getClientOriginalName(); $filename = pathinfo($f...
your getting `Undefined variable: fileNameToStore` it means you not getting file and still try to access `$fileNameToStore` so you need to add this to inside if condition like this ```php if ($request->hasFile('image')) { foreach ($request->file('image') as $file) { $filenameWithExt = $request->file('ima...
20,901,021
``` public class frame extends JFrame { /** * Creates new form frame8 */ public frame8() { initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jMenuBar1 = new javax.swing.JMenuBar(); ...
2014/01/03
[ "https://Stackoverflow.com/questions/20901021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2818060/" ]
``` import json with open("string.txt", "rb") as fin: content = json.load(fin) with open("stringJson.txt", "wb") as fout: json.dump(content, fout, indent=1) ``` See <http://docs.python.org/2/library/json.html#basic-usage>
It really depends on how your `txt` file is structured. But suppose you have a structured `txt` file like the following: ``` BASE|30-06-2008|2007|2|projected BASE|30-06-2007|2010|1|projected BASE|30-06-2007|2009|3|projected BASE|30-06-2007|2020|2|projected ... ``` You could use a script like this: ```py import code...
66,219,886
I have two radio buttons, the second with an additional input field for value. I am trying to determine which of the buttons is selected (if it is the second plus the value from the input field) and as a result change the value of a var. ``` <!DOCTYPE html> <html> <head> <script type="text/javascript" src=".../jquery-...
2021/02/16
[ "https://Stackoverflow.com/questions/66219886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10651655/" ]
You can use several methods to increase the distance from them: 1. `SizedBox()` 2. `Padding()` 3. `Container(margin , child: ...)` > > **1-** **`SizedBox()`**: > > > ``` child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Image.asset('assets/images/logo.png')...
Please wrap TextFormField in the Container and set margin like as top, left, right, bottom according your ui. Please check this and If this it's correct so please tell me. ``` Container( margin: EdgeInsets.only(top: 10,left: 0,right: 0,bottom: 0), child: TextFormField( decor...
66,219,886
I have two radio buttons, the second with an additional input field for value. I am trying to determine which of the buttons is selected (if it is the second plus the value from the input field) and as a result change the value of a var. ``` <!DOCTYPE html> <html> <head> <script type="text/javascript" src=".../jquery-...
2021/02/16
[ "https://Stackoverflow.com/questions/66219886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10651655/" ]
You can use several methods to increase the distance from them: 1. `SizedBox()` 2. `Padding()` 3. `Container(margin , child: ...)` > > **1-** **`SizedBox()`**: > > > ``` child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Image.asset('assets/images/logo.png')...
you can add SizedBox. ``` TextFormField( decoration: InputDecoration( fillColor: Colors.white, filled: true, border: new OutlineInputBorder( borderRadius: const BorderRadius.all( const Radius.circular(10.0), ...
66,219,886
I have two radio buttons, the second with an additional input field for value. I am trying to determine which of the buttons is selected (if it is the second plus the value from the input field) and as a result change the value of a var. ``` <!DOCTYPE html> <html> <head> <script type="text/javascript" src=".../jquery-...
2021/02/16
[ "https://Stackoverflow.com/questions/66219886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10651655/" ]
You can use several methods to increase the distance from them: 1. `SizedBox()` 2. `Padding()` 3. `Container(margin , child: ...)` > > **1-** **`SizedBox()`**: > > > ``` child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Image.asset('assets/images/logo.png')...
You can insert sizedbox in between the textformfield like:- ``` child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Image.asset('assets/images/logo.png'), TextFormField( decoration: InputDecoration( fillColor: Colors.white, ...
66,219,886
I have two radio buttons, the second with an additional input field for value. I am trying to determine which of the buttons is selected (if it is the second plus the value from the input field) and as a result change the value of a var. ``` <!DOCTYPE html> <html> <head> <script type="text/javascript" src=".../jquery-...
2021/02/16
[ "https://Stackoverflow.com/questions/66219886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10651655/" ]
To apply horizontal padding just add `Padding` widget above your `Column`: ``` Padding( padding: EdgeInsets.symmetric(horizontal: 16.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset('assets/images/logo.png'), // your text fields ], ... ``` To add ver...
You can insert sizedbox in between the textformfield like:- ``` child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Image.asset('assets/images/logo.png'), TextFormField( decoration: InputDecoration( fillColor: Colors.white, ...
66,219,886
I have two radio buttons, the second with an additional input field for value. I am trying to determine which of the buttons is selected (if it is the second plus the value from the input field) and as a result change the value of a var. ``` <!DOCTYPE html> <html> <head> <script type="text/javascript" src=".../jquery-...
2021/02/16
[ "https://Stackoverflow.com/questions/66219886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10651655/" ]
InputDecoration takes a contentPadding value. Just use that directly.
you can add SizedBox. ``` TextFormField( decoration: InputDecoration( fillColor: Colors.white, filled: true, border: new OutlineInputBorder( borderRadius: const BorderRadius.all( const Radius.circular(10.0), ...
66,219,886
I have two radio buttons, the second with an additional input field for value. I am trying to determine which of the buttons is selected (if it is the second plus the value from the input field) and as a result change the value of a var. ``` <!DOCTYPE html> <html> <head> <script type="text/javascript" src=".../jquery-...
2021/02/16
[ "https://Stackoverflow.com/questions/66219886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10651655/" ]
Please wrap TextFormField in the Container and set margin like as top, left, right, bottom according your ui. Please check this and If this it's correct so please tell me. ``` Container( margin: EdgeInsets.only(top: 10,left: 0,right: 0,bottom: 0), child: TextFormField( decor...
you can add SizedBox. ``` TextFormField( decoration: InputDecoration( fillColor: Colors.white, filled: true, border: new OutlineInputBorder( borderRadius: const BorderRadius.all( const Radius.circular(10.0), ...
66,219,886
I have two radio buttons, the second with an additional input field for value. I am trying to determine which of the buttons is selected (if it is the second plus the value from the input field) and as a result change the value of a var. ``` <!DOCTYPE html> <html> <head> <script type="text/javascript" src=".../jquery-...
2021/02/16
[ "https://Stackoverflow.com/questions/66219886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10651655/" ]
Please wrap TextFormField in the Container and set margin like as top, left, right, bottom according your ui. Please check this and If this it's correct so please tell me. ``` Container( margin: EdgeInsets.only(top: 10,left: 0,right: 0,bottom: 0), child: TextFormField( decor...
You can insert sizedbox in between the textformfield like:- ``` child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Image.asset('assets/images/logo.png'), TextFormField( decoration: InputDecoration( fillColor: Colors.white, ...
66,219,886
I have two radio buttons, the second with an additional input field for value. I am trying to determine which of the buttons is selected (if it is the second plus the value from the input field) and as a result change the value of a var. ``` <!DOCTYPE html> <html> <head> <script type="text/javascript" src=".../jquery-...
2021/02/16
[ "https://Stackoverflow.com/questions/66219886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10651655/" ]
Please wrap TextFormField in the Container and set margin like as top, left, right, bottom according your ui. Please check this and If this it's correct so please tell me. ``` Container( margin: EdgeInsets.only(top: 10,left: 0,right: 0,bottom: 0), child: TextFormField( decor...
InputDecoration takes a contentPadding value. Just use that directly.
66,219,886
I have two radio buttons, the second with an additional input field for value. I am trying to determine which of the buttons is selected (if it is the second plus the value from the input field) and as a result change the value of a var. ``` <!DOCTYPE html> <html> <head> <script type="text/javascript" src=".../jquery-...
2021/02/16
[ "https://Stackoverflow.com/questions/66219886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10651655/" ]
InputDecoration takes a contentPadding value. Just use that directly.
You can insert sizedbox in between the textformfield like:- ``` child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Image.asset('assets/images/logo.png'), TextFormField( decoration: InputDecoration( fillColor: Colors.white, ...
66,219,886
I have two radio buttons, the second with an additional input field for value. I am trying to determine which of the buttons is selected (if it is the second plus the value from the input field) and as a result change the value of a var. ``` <!DOCTYPE html> <html> <head> <script type="text/javascript" src=".../jquery-...
2021/02/16
[ "https://Stackoverflow.com/questions/66219886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10651655/" ]
Please wrap TextFormField in the Container and set margin like as top, left, right, bottom according your ui. Please check this and If this it's correct so please tell me. ``` Container( margin: EdgeInsets.only(top: 10,left: 0,right: 0,bottom: 0), child: TextFormField( decor...
To apply horizontal padding just add `Padding` widget above your `Column`: ``` Padding( padding: EdgeInsets.symmetric(horizontal: 16.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset('assets/images/logo.png'), // your text fields ], ... ``` To add ver...
2,676,566
There are several integral representations of fractional Brownian motion (Hurst parameter $H$) with respect to standard Brownian motion. One of the most commonly used one is Mandelbrot-van Ness. However, I've seen two slightly different versions of Mandelbrot-van Ness and am not sure how they are consistent with each o...
2018/03/04
[ "https://math.stackexchange.com/questions/2676566", "https://math.stackexchange.com", "https://math.stackexchange.com/users/537355/" ]
The fractional Brownian motion as defined by the Mandelbrot Van Ness Representation actually defines a processes $W^H$ which has the correlation structure $$\mathbb{E}W^H\_s W^H\_t = \frac{V\_H}{2}\{|t|^{2H} + |s|^{2H} - |t-s|^{2H}\},$$ with $$V\_H = \left(\frac{1}{\Gamma(H+\frac{1}{2})}\right)^2\left\{\int\_{0}^{\inft...
If you let $B\_{0}^{H}=0$, then $W\_t^{H} = C\_H \left\{ \int\_{-\infty}^t \frac{dW\_s}{(t-s)^{1/2-H}} - \int\_{-\infty}^0 \frac{dW\_s}{(-s)^{1/2-H}}\right\}$ with $C\_H = \sqrt{\frac{2H\times \Gamma(3/2- H)}{\Gamma(1/2 + H)\times \Gamma(2-2H)}}$. In Definition 2.1. of Mandelbrot and Van Ness (1968), $B\_{0}^{H}=b\_0$...
17,239,476
This isn't a question but maybe a request for comments about general unit testing in grails. I've been banging my head against writing unit tests and except for very, very simple use cases, I most always run into some snag. What I'm finding is anytime something needs to be mocked, like grailsApplication, or some other...
2013/06/21
[ "https://Stackoverflow.com/questions/17239476", "https://Stackoverflow.com", "https://Stackoverflow.com/users/491924/" ]
Would not agree to that. Unit tests are the building blocks of a perfectly written app following the concept of TDD. The rationale of having a unit test is to isolate a module from injections and try to test a it with all the dependencies provided by the test environment instead of the dependencies provided by the co...
I also ignore unit test for most part. It causes problem for me more than it worth. However, I wrote integration tests for almost all part. (though not all combinations, that's impossible.) My main purpose of test is to prevent regression, mostly from code change in related part. Integration test suits me perfectly.
17,239,476
This isn't a question but maybe a request for comments about general unit testing in grails. I've been banging my head against writing unit tests and except for very, very simple use cases, I most always run into some snag. What I'm finding is anytime something needs to be mocked, like grailsApplication, or some other...
2013/06/21
[ "https://Stackoverflow.com/questions/17239476", "https://Stackoverflow.com", "https://Stackoverflow.com/users/491924/" ]
Would not agree to that. Unit tests are the building blocks of a perfectly written app following the concept of TDD. The rationale of having a unit test is to isolate a module from injections and try to test a it with all the dependencies provided by the test environment instead of the dependencies provided by the co...
I both agree and disagree with the original asker's post. My response is, there are some things that unit tests are better for, but his current sticking point might not be one of them. In my opinion, the best code has regions of complex behavior with extremely well defined input and output and regions of simple behavi...
17,239,476
This isn't a question but maybe a request for comments about general unit testing in grails. I've been banging my head against writing unit tests and except for very, very simple use cases, I most always run into some snag. What I'm finding is anytime something needs to be mocked, like grailsApplication, or some other...
2013/06/21
[ "https://Stackoverflow.com/questions/17239476", "https://Stackoverflow.com", "https://Stackoverflow.com/users/491924/" ]
I both agree and disagree with the original asker's post. My response is, there are some things that unit tests are better for, but his current sticking point might not be one of them. In my opinion, the best code has regions of complex behavior with extremely well defined input and output and regions of simple behavi...
I also ignore unit test for most part. It causes problem for me more than it worth. However, I wrote integration tests for almost all part. (though not all combinations, that's impossible.) My main purpose of test is to prevent regression, mostly from code change in related part. Integration test suits me perfectly.
27,370,981
I'm sorry for taking a bit of your time i've been trying to figure out this error for hours I have the following error: ``` Notice: Undefined index: Action in C:\xampp\htdocs\Earl.com\Earl.com\EditEverything.php on line 71 Notice: Undefined index: BUSSINESSID in C:\xampp\htdocs\Earl.com\Earl.com\EditEverything.php on...
2014/12/09
[ "https://Stackoverflow.com/questions/27370981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4339788/" ]
set html,body min-height to 100% Child occupies the height of parent so 100% height of parent will give 100% height to child Considering that you div is direct child of html,body(if not then you need to maintain the height ratio with its parent) ``` html,body{ height:100%; min-height:100%; } ```
I think that problem is in your `border` properties as they are adding extra space. So, I am not sure if this fit best your needs, but I would do something like this: ``` .left_menu { height:100% !important; width:29%; border:1px solid grey; float:left; } .right_menu { height:100% !important; width:...
27,370,981
I'm sorry for taking a bit of your time i've been trying to figure out this error for hours I have the following error: ``` Notice: Undefined index: Action in C:\xampp\htdocs\Earl.com\Earl.com\EditEverything.php on line 71 Notice: Undefined index: BUSSINESSID in C:\xampp\htdocs\Earl.com\Earl.com\EditEverything.php on...
2014/12/09
[ "https://Stackoverflow.com/questions/27370981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4339788/" ]
set html,body min-height to 100% Child occupies the height of parent so 100% height of parent will give 100% height to child Considering that you div is direct child of html,body(if not then you need to maintain the height ratio with its parent) ``` html,body{ height:100%; min-height:100%; } ```
You set the height of the div to 100% but 100% of what? It's always 100% of the parent element but what is the parent element of the div set to? My bet is you don't have it set to anything and the browser has no way of calculating what 100% of nothing is.
27,370,981
I'm sorry for taking a bit of your time i've been trying to figure out this error for hours I have the following error: ``` Notice: Undefined index: Action in C:\xampp\htdocs\Earl.com\Earl.com\EditEverything.php on line 71 Notice: Undefined index: BUSSINESSID in C:\xampp\htdocs\Earl.com\Earl.com\EditEverything.php on...
2014/12/09
[ "https://Stackoverflow.com/questions/27370981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4339788/" ]
set html,body min-height to 100% Child occupies the height of parent so 100% height of parent will give 100% height to child Considering that you div is direct child of html,body(if not then you need to maintain the height ratio with its parent) ``` html,body{ height:100%; min-height:100%; } ```
Just add `display: inline-block;` and it should solve the problem (did for me)
27,370,981
I'm sorry for taking a bit of your time i've been trying to figure out this error for hours I have the following error: ``` Notice: Undefined index: Action in C:\xampp\htdocs\Earl.com\Earl.com\EditEverything.php on line 71 Notice: Undefined index: BUSSINESSID in C:\xampp\htdocs\Earl.com\Earl.com\EditEverything.php on...
2014/12/09
[ "https://Stackoverflow.com/questions/27370981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4339788/" ]
Just add `display: inline-block;` and it should solve the problem (did for me)
I think that problem is in your `border` properties as they are adding extra space. So, I am not sure if this fit best your needs, but I would do something like this: ``` .left_menu { height:100% !important; width:29%; border:1px solid grey; float:left; } .right_menu { height:100% !important; width:...
27,370,981
I'm sorry for taking a bit of your time i've been trying to figure out this error for hours I have the following error: ``` Notice: Undefined index: Action in C:\xampp\htdocs\Earl.com\Earl.com\EditEverything.php on line 71 Notice: Undefined index: BUSSINESSID in C:\xampp\htdocs\Earl.com\Earl.com\EditEverything.php on...
2014/12/09
[ "https://Stackoverflow.com/questions/27370981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4339788/" ]
Just add `display: inline-block;` and it should solve the problem (did for me)
You set the height of the div to 100% but 100% of what? It's always 100% of the parent element but what is the parent element of the div set to? My bet is you don't have it set to anything and the browser has no way of calculating what 100% of nothing is.
263,636
Currently I'm working on a resume, but I'm having trouble getting the formatting I want. An example of what I'm trying to do can be seen [here](https://i.imgur.com/QoGiZn1.png) - however, I couldn't even get that to work right (LibreOffice) because the whole document is in 3 columns, when I just need the header as disp...
2015/08/28
[ "https://tex.stackexchange.com/questions/263636", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/62053/" ]
I think three `minipage`s are enough: ``` \documentclass{article} \usepackage[margin=1in]{geometry} % set margins to 1 inch \begin{document} \begin{center} {\Huge DaimyoKirby}\par\bigskip \begin{minipage}[b]{0.33333\textwidth} \raggedright 123 Main Street \par MyTown, USA 12345 \end{minipage}% \begin{minipage}[b]{0...
You could also use the fancyhdr package for this: ``` \usepackage{fancyhdr} \usepackage[margin=1in]{geometry} \pagestyle{fancy} \lhead{123 Main Street\\ MyTown, USA 12345} \chead{{\Huge DaimyoKirby}\\ abc1234@myUni.edu\\ 123.456.7890} \rhead{123 Campus Postoffice\\ CollegeTown, MyState 09876} \renewcommand{\headrul...
66,142,441
I'm creating a dynamic form, there may be X fields to fill, for example there may be 10 inputs texts, 5 selects, 3 Radio etc. I created the entire structure to assemble this form dynamically and it is working as expected. However my biggest problem is when I will check if at least one RADIO BUTTON has been checked. I...
2021/02/10
[ "https://Stackoverflow.com/questions/66142441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12055252/" ]
You can use find here very well. Consider that your name is an ID, so put in fron of your *name* the hashtag *#name*. Also I would recommend using an event listener. I updated your code to use it therefore I gave your btn an id. ```js document.getElementById('btn').addEventListener('click', function(){checkAll('Locati...
simply use [querySelectorAll()](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) : ```js function checkAll(name) { document.querySelectorAll(`#${name} input[type=checkbox]`).forEach(nod=> { if (!nod.disabled) nod.checked = true; }); } ```