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
4,008,345
I have a string: ``` TFS[MAD,GRO,BCN],ALC[GRO,PMI,ZAZ,MAD,BCN],BCN[ALC,...]... ``` I want to convert it into a list: ``` list = ( [0] => "TFS" [0] => "MAD" [1] => "GRO" [2] => "BCN" [1] => "ALC" [0] => "GRO" [1] => "PMI" [2] => "ZAZ" [3] => "MAD" [4] => "BCN" [2] => "BCN" [1] => ...
2010/10/24
[ "https://Stackoverflow.com/questions/4008345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/434461/" ]
You need to tell the regex that the `,` is not required after each element, but instead in front of each argument except the first. This leads to the following regex: ``` str="TFS[MAD,GRO,BCN],ALC[GRO,PMI,ZAZ,MAD,BCN],BCN[ALC]" str.scan(/[A-Z]{3}\[[A-Z]{3}(?:,[A-Z]{3})*\]/) #=> ["TFS[MAD,GRO,BCN]", "ALC[GRO,PMI,ZAZ,MA...
If I understood correctly, you may want to get such array. ``` yourexamplestring.scan(/([A-Z]{3})\[([^\]]+)/).map{|a,b|[a,b.split(',')]} [["TFS", ["MAD", "GRO", "BCN"]], ["ALC", ["GRO", "PMI", "ZAZ", "MAD", "BCN"]], ["BCN", ["ALC", "..."]]] ```
4,008,345
I have a string: ``` TFS[MAD,GRO,BCN],ALC[GRO,PMI,ZAZ,MAD,BCN],BCN[ALC,...]... ``` I want to convert it into a list: ``` list = ( [0] => "TFS" [0] => "MAD" [1] => "GRO" [2] => "BCN" [1] => "ALC" [0] => "GRO" [1] => "PMI" [2] => "ZAZ" [3] => "MAD" [4] => "BCN" [2] => "BCN" [1] => ...
2010/10/24
[ "https://Stackoverflow.com/questions/4008345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/434461/" ]
You need to tell the regex that the `,` is not required after each element, but instead in front of each argument except the first. This leads to the following regex: ``` str="TFS[MAD,GRO,BCN],ALC[GRO,PMI,ZAZ,MAD,BCN],BCN[ALC]" str.scan(/[A-Z]{3}\[[A-Z]{3}(?:,[A-Z]{3})*\]/) #=> ["TFS[MAD,GRO,BCN]", "ALC[GRO,PMI,ZAZ,MA...
Here's another way using a hash to store your contents, and less regex. ``` string = "TFS[MAD,GRO,BCN],ALC[GRO,PMI,ZAZ,MAD,BCN],BCN[ALC]" z=Hash.new([]) string.split(/][ \t]*,/).each do |x| o,p=x.split("[") z[o]=p.split(",") end z.each_pair{|x,y| print "#{x}:#{y}\n"} ``` output ``` $ ruby test.rb TFS:["MAD", ...
4,008,345
I have a string: ``` TFS[MAD,GRO,BCN],ALC[GRO,PMI,ZAZ,MAD,BCN],BCN[ALC,...]... ``` I want to convert it into a list: ``` list = ( [0] => "TFS" [0] => "MAD" [1] => "GRO" [2] => "BCN" [1] => "ALC" [0] => "GRO" [1] => "PMI" [2] => "ZAZ" [3] => "MAD" [4] => "BCN" [2] => "BCN" [1] => ...
2010/10/24
[ "https://Stackoverflow.com/questions/4008345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/434461/" ]
Here's another way using a hash to store your contents, and less regex. ``` string = "TFS[MAD,GRO,BCN],ALC[GRO,PMI,ZAZ,MAD,BCN],BCN[ALC]" z=Hash.new([]) string.split(/][ \t]*,/).each do |x| o,p=x.split("[") z[o]=p.split(",") end z.each_pair{|x,y| print "#{x}:#{y}\n"} ``` output ``` $ ruby test.rb TFS:["MAD", ...
first split the groups ``` groups = s.scan(/[^,][^\[]*\[[^\[]*\]/) # => ["TFS[MAD,GRO,BCN]", "ALC[GRO,PMI,ZAZ,MAD,BCN]"] ``` Now you have the groups, the rest is pretty straightforward: ``` groups.map {|x| [x[0..2], x[4..-2].split(',')] } # => [["TFS", ["MAD", "GRO", "BCN"]], ["ALC", ["GRO", "PMI", "ZAZ", "MAD", "...
4,008,345
I have a string: ``` TFS[MAD,GRO,BCN],ALC[GRO,PMI,ZAZ,MAD,BCN],BCN[ALC,...]... ``` I want to convert it into a list: ``` list = ( [0] => "TFS" [0] => "MAD" [1] => "GRO" [2] => "BCN" [1] => "ALC" [0] => "GRO" [1] => "PMI" [2] => "ZAZ" [3] => "MAD" [4] => "BCN" [2] => "BCN" [1] => ...
2010/10/24
[ "https://Stackoverflow.com/questions/4008345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/434461/" ]
Here's another way using a hash to store your contents, and less regex. ``` string = "TFS[MAD,GRO,BCN],ALC[GRO,PMI,ZAZ,MAD,BCN],BCN[ALC]" z=Hash.new([]) string.split(/][ \t]*,/).each do |x| o,p=x.split("[") z[o]=p.split(",") end z.each_pair{|x,y| print "#{x}:#{y}\n"} ``` output ``` $ ruby test.rb TFS:["MAD", ...
If I understood correctly, you may want to get such array. ``` yourexamplestring.scan(/([A-Z]{3})\[([^\]]+)/).map{|a,b|[a,b.split(',')]} [["TFS", ["MAD", "GRO", "BCN"]], ["ALC", ["GRO", "PMI", "ZAZ", "MAD", "BCN"]], ["BCN", ["ALC", "..."]]] ```
3,636,280
I'm using Ubuntu 10, python 2.6.5 I'm following this tutorial: <http://www.djangobook.com/en/2.0/chapter02> I followed all of the steps using cut-and-paste. The following directory structure was automatically created: ``` bill@ed-desktop:~/projects$ ls -l mysite total 36 -rw-r--r-- 1 bill bill 0 2010-09-01...
2010/09/03
[ "https://Stackoverflow.com/questions/3636280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/438952/" ]
I think it's not possible using 9-Patch to make repeated patterns (only stretching certain area), perhaps you could find more about it in official [documentation](http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch)
First make sure you save your 9 patch image as your\_image\_name.9.png and store it in the res/drawable folder. Then in your xml just set the layout background with-- android:background="@drawable/your\_image\_name" and that should work. If it's still not working can you post your layout xml?
3,636,280
I'm using Ubuntu 10, python 2.6.5 I'm following this tutorial: <http://www.djangobook.com/en/2.0/chapter02> I followed all of the steps using cut-and-paste. The following directory structure was automatically created: ``` bill@ed-desktop:~/projects$ ls -l mysite total 36 -rw-r--r-- 1 bill bill 0 2010-09-01...
2010/09/03
[ "https://Stackoverflow.com/questions/3636280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/438952/" ]
... Correction: If you want the orange dots to repeat, you will not succeed using 9 patch. 9 patch can only stretch the part you told it to stretch and leave untouched, the remaining areas. There is no repeat mode with 9 patch PNG. You might want to look into Bitmap class. There is a tileMode you might be able to use...
First make sure you save your 9 patch image as your\_image\_name.9.png and store it in the res/drawable folder. Then in your xml just set the layout background with-- android:background="@drawable/your\_image\_name" and that should work. If it's still not working can you post your layout xml?
3,636,280
I'm using Ubuntu 10, python 2.6.5 I'm following this tutorial: <http://www.djangobook.com/en/2.0/chapter02> I followed all of the steps using cut-and-paste. The following directory structure was automatically created: ``` bill@ed-desktop:~/projects$ ls -l mysite total 36 -rw-r--r-- 1 bill bill 0 2010-09-01...
2010/09/03
[ "https://Stackoverflow.com/questions/3636280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/438952/" ]
I think it's not possible using 9-Patch to make repeated patterns (only stretching certain area), perhaps you could find more about it in official [documentation](http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch)
... Correction: If you want the orange dots to repeat, you will not succeed using 9 patch. 9 patch can only stretch the part you told it to stretch and leave untouched, the remaining areas. There is no repeat mode with 9 patch PNG. You might want to look into Bitmap class. There is a tileMode you might be able to use...
62,405,689
I'm trying to model a system with 5 inverters but there is no parameter for PVSystem object that takes number of inverters, only modules per string and strings per inverter (but still it assumes that there is only one inverter). Also there is no argument for power installed which would allow to skip sizing details. Fo...
2020/06/16
[ "https://Stackoverflow.com/questions/62405689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12872566/" ]
As of 2020-06-21, you can only simulate a system with multiple inverters "manually". That means, you need to calculate the topology yourself: * Number of required inverters * Strings per inverter (and modules per string) Then you can simulate each inverter separately. Hopefully, this will change in the future. :-D
If your arrays are the same you don't need to make complex your code. just run it for one array and multiply the results by 5. if they are different in orientation, you should import them one by one.
8,545,561
I want to make a unique constraint in my Doctrine 2 entity such that `name` & `test` are unique column wise. Meaning * obj1 + name: name1 + test: test * obj2 + name: name2 + test: test <---- duplicated This should trigger an error as test is duplicated. I tried using the unique constraint (`Symfony\Bridge\Do...
2011/12/17
[ "https://Stackoverflow.com/questions/8545561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/292291/" ]
These check for the fields individually: ``` @UniqueEntity("name") @UniqueEntity("test") ``` That is, the first one will get triggered when there is a duplicate `name` value, while the second one — when there is a duplicate `test` values. If you want the validation fail when *both* `name` and `test` contain the sam...
In the Table annotation, you can also set an index for multiple [columns](http://docs.doctrine-project.org/en/2.0.x/reference/annotations-reference.html#uniqueconstraint). ``` /** * @ORM\Entity * @ORM\Table(name="ecommerce_products",uniqueConstraints={ * @ORM\UniqueConstraint(name="search_idx", columns={"name"...
31,091,353
So this is my code for sending an email. When I try to send an email i get right message, in this case "User Exist" and "Email is sent", but i can't receive an email. So can somebody find mistake and try to help me? ``` <form action="forgot2.php" method="post"> Enter you email ID: <input type="text" name="email"> <in...
2015/06/27
[ "https://Stackoverflow.com/questions/31091353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
First of all, you need to check if the mail is actually sent: ``` if (mail($email, "Subject Goes Here", $message)) { // then it's actually sent. } ``` If `mail()` doesn't return `false`, then the mail was passed to your local mail server for delivery. Presume you already have a mail server set up on your local t...
Are you sure your script is actually sending the mail? Replace: ``` mail($email, "Subject Goes Here", $message); echo "Email sent"; ``` By: ``` if(@mail($email, "Subject Goes Here", $message)) { echo "Email sent"; } else { echo "Email not sent"; } ```
31,091,353
So this is my code for sending an email. When I try to send an email i get right message, in this case "User Exist" and "Email is sent", but i can't receive an email. So can somebody find mistake and try to help me? ``` <form action="forgot2.php" method="post"> Enter you email ID: <input type="text" name="email"> <in...
2015/06/27
[ "https://Stackoverflow.com/questions/31091353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
First of all, you need to check if the mail is actually sent: ``` if (mail($email, "Subject Goes Here", $message)) { // then it's actually sent. } ``` If `mail()` doesn't return `false`, then the mail was passed to your local mail server for delivery. Presume you already have a mail server set up on your local t...
Just try I use this works fine for me ``` $headers = 'From: support@example.com'; mail($payer_email, 'Tokens', "Thank you for purchase tokens $additional-message", $headers); ```
31,091,353
So this is my code for sending an email. When I try to send an email i get right message, in this case "User Exist" and "Email is sent", but i can't receive an email. So can somebody find mistake and try to help me? ``` <form action="forgot2.php" method="post"> Enter you email ID: <input type="text" name="email"> <in...
2015/06/27
[ "https://Stackoverflow.com/questions/31091353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
First of all, you need to check if the mail is actually sent: ``` if (mail($email, "Subject Goes Here", $message)) { // then it's actually sent. } ``` If `mail()` doesn't return `false`, then the mail was passed to your local mail server for delivery. Presume you already have a mail server set up on your local t...
Assuming mail() does return true and that the email is a valid one, you want to make you have a valid smtp server configured in php.ini in the [mail function] section.
31,091,353
So this is my code for sending an email. When I try to send an email i get right message, in this case "User Exist" and "Email is sent", but i can't receive an email. So can somebody find mistake and try to help me? ``` <form action="forgot2.php" method="post"> Enter you email ID: <input type="text" name="email"> <in...
2015/06/27
[ "https://Stackoverflow.com/questions/31091353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
First of all, you need to check if the mail is actually sent: ``` if (mail($email, "Subject Goes Here", $message)) { // then it's actually sent. } ``` If `mail()` doesn't return `false`, then the mail was passed to your local mail server for delivery. Presume you already have a mail server set up on your local t...
change this one. ``` $query="select * from clanovi where email='".$email."'"; ```
37,106,532
I need to make a data frame that has all possibilities in which seven variables sum up 100, every variable could be 0 to 100. I implement the following code but it takes to long. ``` combina <- function(U){ d<- NULL for (i in 0:U) { for (j in 0:U) { for (k in 0:U) { ...
2016/05/09
[ "https://Stackoverflow.com/questions/37106532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6308157/" ]
Here is a solution with `dplyr` package, you may need to convert the value columns from factor to character. ``` library(dplyr) DF1$Value <- as.character(DF1$Value) DF2$Value <- as.character(DF2$Value) merge(DF1, DF2, by = "group", all.x = T) %>% mutate(Value = ifelse(!is.na(Value.y), Value.y, Value.x)) %>% ...
Here is a `base R` option with `match` ``` i1 <- with(DF1, match(group, DF2$group)) DF1$Value <- with(DF1, ifelse(is.na(i1), Value, DF2$Value[i1])) DF1 # group Value #1 12357 ABCD #2 12575 GHIJK #3 19718 LMNO #4 19716 LMN OP #5 18947 QR STV ```
37,106,532
I need to make a data frame that has all possibilities in which seven variables sum up 100, every variable could be 0 to 100. I implement the following code but it takes to long. ``` combina <- function(U){ d<- NULL for (i in 0:U) { for (j in 0:U) { for (k in 0:U) { ...
2016/05/09
[ "https://Stackoverflow.com/questions/37106532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6308157/" ]
Here is a solution with `dplyr` package, you may need to convert the value columns from factor to character. ``` library(dplyr) DF1$Value <- as.character(DF1$Value) DF2$Value <- as.character(DF2$Value) merge(DF1, DF2, by = "group", all.x = T) %>% mutate(Value = ifelse(!is.na(Value.y), Value.y, Value.x)) %>% ...
Here's a base solution using `merge`: ``` transform(merge(df1,df2, by='group', all.x=TRUE), Value = ifelse(is.na(Value.y), Value.x, Value.y) )[c('group','Value')] ## group Value ## 1 12357 ABCD ## 2 12575 GHIJK ## 3 18947 QR STV ## 4 19716 LMN OP ## 5 19718 LMNO ``` This assumes that you have `cha...
37,106,532
I need to make a data frame that has all possibilities in which seven variables sum up 100, every variable could be 0 to 100. I implement the following code but it takes to long. ``` combina <- function(U){ d<- NULL for (i in 0:U) { for (j in 0:U) { for (k in 0:U) { ...
2016/05/09
[ "https://Stackoverflow.com/questions/37106532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6308157/" ]
And of course a `data.table` solution ``` library(data.table) setDT(DF1) setDT(DF2) DF1[ DF2, on = c("group"), Value := i.Value] ## here the 'Value' of DF1 is being updated with the 'Value' of DF2 ## where there is a common 'group' value between the two tables. DF1 group Value 1: 12357 ABCD 2: 12575 GHIJ...
Here is a `base R` option with `match` ``` i1 <- with(DF1, match(group, DF2$group)) DF1$Value <- with(DF1, ifelse(is.na(i1), Value, DF2$Value[i1])) DF1 # group Value #1 12357 ABCD #2 12575 GHIJK #3 19718 LMNO #4 19716 LMN OP #5 18947 QR STV ```
37,106,532
I need to make a data frame that has all possibilities in which seven variables sum up 100, every variable could be 0 to 100. I implement the following code but it takes to long. ``` combina <- function(U){ d<- NULL for (i in 0:U) { for (j in 0:U) { for (k in 0:U) { ...
2016/05/09
[ "https://Stackoverflow.com/questions/37106532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6308157/" ]
And of course a `data.table` solution ``` library(data.table) setDT(DF1) setDT(DF2) DF1[ DF2, on = c("group"), Value := i.Value] ## here the 'Value' of DF1 is being updated with the 'Value' of DF2 ## where there is a common 'group' value between the two tables. DF1 group Value 1: 12357 ABCD 2: 12575 GHIJ...
Here's a base solution using `merge`: ``` transform(merge(df1,df2, by='group', all.x=TRUE), Value = ifelse(is.na(Value.y), Value.x, Value.y) )[c('group','Value')] ## group Value ## 1 12357 ABCD ## 2 12575 GHIJK ## 3 18947 QR STV ## 4 19716 LMN OP ## 5 19718 LMNO ``` This assumes that you have `cha...
50,169,910
I am running Python 3.5, using JetBrains as the IDE. The following code will create a file with the correct text if I enter it directly to console, but not as a script. I get no errors when running the script. ``` with open('test.txt', 'w', encoding='utf-8') as f: print(123, True, 'blah', file=f) ```
2018/05/04
[ "https://Stackoverflow.com/questions/50169910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3032519/" ]
You can simply try this query ``` show status where `variable_name` = 'Threads_connected'; ``` [![result from phpmyadmin](https://i.stack.imgur.com/5Bm7c.png)](https://i.stack.imgur.com/5Bm7c.png)
this should solve the problem and return the correct number of DB connections. ``` $connection=mysqli_connect("localhost","$mysql_user","$mysql_pwd", "$mysql_db"); if (mysqli_connect_errno()) { echo "NO CONNECTION"; } else { if ($result = mysqli_query($connection, "SHOW FULL PROCESSLIST")) { $n_connections=...
1,645,275
I know this is a common error, but bear with me. I've pursued the CLASSPATH problem and I don't *think* that is the issue. I'm getting an error like this. ``` ./src/process.java:2: package javax.servlet does not exist import javax.servlet.*; ``` I installed Tomcat and the Java SDK, and I know that Tomcat is supposed...
2009/10/29
[ "https://Stackoverflow.com/questions/1645275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/92407/" ]
You need to set your classpath to point **specifically** to your JAR: ``` CLASSPATH=/usr/share/java/tomcat/tomcat6-servlet-2.5-api-6.0.18.jar ``` When you specify a folder in classpath, it's only used to locate all **classes** within that folder. JARs by themselves are libraries (packaged folders, if you will) of cl...
You write something in console or \*.bat-file. > > SET CLASSPATH=C:\java\apache-tomcat-7.0.53\lib\servlet-api.jar > > >
23,274,482
I am using [webdriver.io](http://webdriver.io/) with chai and mocha for testing. In one of my tests I need to count how many elements with the same CSS class are in the page. None of the [webdriver.io API](http://webdriver.io/docs.html) seems to return an array. How can it be achieved?
2014/04/24
[ "https://Stackoverflow.com/questions/23274482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1503534/" ]
This is how you do it: ``` client.elements('.myElements', function(err,res) { console.log('element count: ',res.value.length); }); ``` Explanation: with `elements` you fetch all elements according given selector. It returns an array of webdriver elements which represents the amount of existing elements on the pa...
For version 4 of webdriver.io, this is the way ``` client.elements('.selector').then(function (elems) { console.log(elems.value.length); }); ```
23,274,482
I am using [webdriver.io](http://webdriver.io/) with chai and mocha for testing. In one of my tests I need to count how many elements with the same CSS class are in the page. None of the [webdriver.io API](http://webdriver.io/docs.html) seems to return an array. How can it be achieved?
2014/04/24
[ "https://Stackoverflow.com/questions/23274482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1503534/" ]
This is how you do it: ``` client.elements('.myElements', function(err,res) { console.log('element count: ',res.value.length); }); ``` Explanation: with `elements` you fetch all elements according given selector. It returns an array of webdriver elements which represents the amount of existing elements on the pa...
Or you can write to a variable and later use it ``` let smth = browser.elements('selector').value.length; ```
23,274,482
I am using [webdriver.io](http://webdriver.io/) with chai and mocha for testing. In one of my tests I need to count how many elements with the same CSS class are in the page. None of the [webdriver.io API](http://webdriver.io/docs.html) seems to return an array. How can it be achieved?
2014/04/24
[ "https://Stackoverflow.com/questions/23274482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1503534/" ]
This is how you do it: ``` client.elements('.myElements', function(err,res) { console.log('element count: ',res.value.length); }); ``` Explanation: with `elements` you fetch all elements according given selector. It returns an array of webdriver elements which represents the amount of existing elements on the pa...
For version 7.13.2 of webdriver.io, you can try this ``` const count = await $$('selector').length ```
23,274,482
I am using [webdriver.io](http://webdriver.io/) with chai and mocha for testing. In one of my tests I need to count how many elements with the same CSS class are in the page. None of the [webdriver.io API](http://webdriver.io/docs.html) seems to return an array. How can it be achieved?
2014/04/24
[ "https://Stackoverflow.com/questions/23274482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1503534/" ]
For version 4 of webdriver.io, this is the way ``` client.elements('.selector').then(function (elems) { console.log(elems.value.length); }); ```
Or you can write to a variable and later use it ``` let smth = browser.elements('selector').value.length; ```
23,274,482
I am using [webdriver.io](http://webdriver.io/) with chai and mocha for testing. In one of my tests I need to count how many elements with the same CSS class are in the page. None of the [webdriver.io API](http://webdriver.io/docs.html) seems to return an array. How can it be achieved?
2014/04/24
[ "https://Stackoverflow.com/questions/23274482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1503534/" ]
For version 4 of webdriver.io, this is the way ``` client.elements('.selector').then(function (elems) { console.log(elems.value.length); }); ```
For version 7.13.2 of webdriver.io, you can try this ``` const count = await $$('selector').length ```
23,274,482
I am using [webdriver.io](http://webdriver.io/) with chai and mocha for testing. In one of my tests I need to count how many elements with the same CSS class are in the page. None of the [webdriver.io API](http://webdriver.io/docs.html) seems to return an array. How can it be achieved?
2014/04/24
[ "https://Stackoverflow.com/questions/23274482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1503534/" ]
For version 7.13.2 of webdriver.io, you can try this ``` const count = await $$('selector').length ```
Or you can write to a variable and later use it ``` let smth = browser.elements('selector').value.length; ```
12,883,507
I am having difficulty in reading data from my SQLite database from MonoTouch. I can read and write without any difficulty for the first few screens and then suddenly I am unable to create any further connections with the error: ``` Mono.Data.Sqlite.SqliteException: Unable to open the database file at Mono.Data.Sq...
2012/10/14
[ "https://Stackoverflow.com/questions/12883507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1484970/" ]
I would suggest using the "using" block..That will make sure that everything is disposed off correctly and also that you are not closing connections when it is already closed.. ``` using (SqliteConnection conn = new SqliteConnection(GlobalVars.connectionString)) { conn.Open (); SqliteCommand ...
OK - i've got it working now by moving the close and dispose into a "finally". ``` var mySqlConn = new SqliteConnection (GlobalVars.connectionString); mySqlConn.Open (); try { // CODE HERE } finally { mySqlConn.Close(); mySqlConn.Dispose(); } ```
12,883,507
I am having difficulty in reading data from my SQLite database from MonoTouch. I can read and write without any difficulty for the first few screens and then suddenly I am unable to create any further connections with the error: ``` Mono.Data.Sqlite.SqliteException: Unable to open the database file at Mono.Data.Sq...
2012/10/14
[ "https://Stackoverflow.com/questions/12883507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1484970/" ]
I'm pretty sure you guess is right. However it's pretty hard to guess what went wrong (e.g. what's defined in your `connectionString` will affect how Sqlite is initialized and will work). From your example you seem to be disposing the `SqliteConnection` correctly but things could still go wrong. E.g. if some code thro...
I would suggest using the "using" block..That will make sure that everything is disposed off correctly and also that you are not closing connections when it is already closed.. ``` using (SqliteConnection conn = new SqliteConnection(GlobalVars.connectionString)) { conn.Open (); SqliteCommand ...
12,883,507
I am having difficulty in reading data from my SQLite database from MonoTouch. I can read and write without any difficulty for the first few screens and then suddenly I am unable to create any further connections with the error: ``` Mono.Data.Sqlite.SqliteException: Unable to open the database file at Mono.Data.Sq...
2012/10/14
[ "https://Stackoverflow.com/questions/12883507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1484970/" ]
I'm pretty sure you guess is right. However it's pretty hard to guess what went wrong (e.g. what's defined in your `connectionString` will affect how Sqlite is initialized and will work). From your example you seem to be disposing the `SqliteConnection` correctly but things could still go wrong. E.g. if some code thro...
OK - i've got it working now by moving the close and dispose into a "finally". ``` var mySqlConn = new SqliteConnection (GlobalVars.connectionString); mySqlConn.Open (); try { // CODE HERE } finally { mySqlConn.Close(); mySqlConn.Dispose(); } ```
29,699,329
I am trying to make request to a webpage which requires a login. I successfully take the cookie with the SESSID and write it to a file with curl: ``` $username = 'xxx'; $password = 'xxxxxxx'; $url = 'http://example.com'; $cookie="cookie.txt"; $postdata = "username=$username&userpass=$password&autologin=1&userlogin=Log...
2015/04/17
[ "https://Stackoverflow.com/questions/29699329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4801075/" ]
I find curl's cookie jar problematic so I wrote my own routine. There are other times I need to add cookies scraped from the page. For this `CURLOPT_HEADER` must be true. ``` curl_setopt($ch, CURLOPT_HEADER, true); $data = curl_exec($ch); $skip = intval(curl_getinfo($ch, CURLINFO_HEADER_SIZE)); $requestH...
Maybe you would try [guzzle](http://guzzle.readthedocs.org/en/latest/)? I wrote proxy for some game engine, and i got similar problem with cookies. **Important**: I didn't find easy way to manipulate cookies in key-value style. So, as for me, it decision closer to hack than solution. I glued cookie to string: ``` for...
29,699,329
I am trying to make request to a webpage which requires a login. I successfully take the cookie with the SESSID and write it to a file with curl: ``` $username = 'xxx'; $password = 'xxxxxxx'; $url = 'http://example.com'; $cookie="cookie.txt"; $postdata = "username=$username&userpass=$password&autologin=1&userlogin=Log...
2015/04/17
[ "https://Stackoverflow.com/questions/29699329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4801075/" ]
Thanks guys for your hints. How I got it working is with this code(I actually had used wrong post data): ``` $username = 'xxx'; $password = 'xxxx'; $url = 'http://example.com'; //request to the page i want the content from $cookie="cookie.txt"; $url1 = "http://example.com/command.."; //login form action url $postinf...
Maybe you would try [guzzle](http://guzzle.readthedocs.org/en/latest/)? I wrote proxy for some game engine, and i got similar problem with cookies. **Important**: I didn't find easy way to manipulate cookies in key-value style. So, as for me, it decision closer to hack than solution. I glued cookie to string: ``` for...
29,699,329
I am trying to make request to a webpage which requires a login. I successfully take the cookie with the SESSID and write it to a file with curl: ``` $username = 'xxx'; $password = 'xxxxxxx'; $url = 'http://example.com'; $cookie="cookie.txt"; $postdata = "username=$username&userpass=$password&autologin=1&userlogin=Log...
2015/04/17
[ "https://Stackoverflow.com/questions/29699329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4801075/" ]
Thanks guys for your hints. How I got it working is with this code(I actually had used wrong post data): ``` $username = 'xxx'; $password = 'xxxx'; $url = 'http://example.com'; //request to the page i want the content from $cookie="cookie.txt"; $url1 = "http://example.com/command.."; //login form action url $postinf...
I find curl's cookie jar problematic so I wrote my own routine. There are other times I need to add cookies scraped from the page. For this `CURLOPT_HEADER` must be true. ``` curl_setopt($ch, CURLOPT_HEADER, true); $data = curl_exec($ch); $skip = intval(curl_getinfo($ch, CURLINFO_HEADER_SIZE)); $requestH...
997,454
Not sure where to ask my question. I might have many hundred Linux devices, each device uses a 4G connection to connect the Internet and each of them have SSH service running at port 22 and a dynamic IP address. My question is how do I use SSH to connect to each of them? Do I need to have them in a VPN?
2020/01/03
[ "https://serverfault.com/questions/997454", "https://serverfault.com", "https://serverfault.com/users/554229/" ]
With hundreds of endpoints that may or may not be available at various times - and with the added complication of ISPs possibly putting devices behind CGNAT or blocking inbound connections in other ways, you really don't want to risk using a solution that's dependent on calling out to each individual device. Instead ...
<https://aws.amazon.com/blogs/iot/introducing-secure-tunneling-for-aws-iot-device-management-a-new-secure-way-to-troubleshoot-iot-devices/> Yes I agree with @HermanB , but somecase if we need more investigation I ask AWS and this seems to be another good solution Thank you!
997,454
Not sure where to ask my question. I might have many hundred Linux devices, each device uses a 4G connection to connect the Internet and each of them have SSH service running at port 22 and a dynamic IP address. My question is how do I use SSH to connect to each of them? Do I need to have them in a VPN?
2020/01/03
[ "https://serverfault.com/questions/997454", "https://serverfault.com", "https://serverfault.com/users/554229/" ]
With hundreds of endpoints that may or may not be available at various times - and with the added complication of ISPs possibly putting devices behind CGNAT or blocking inbound connections in other ways, you really don't want to risk using a solution that's dependent on calling out to each individual device. Instead ...
Maybe you can use a dynamic IP solution like [duckdns](https://duckdns.org), it has an android setting so even if your IP is changin all the time you can have an static address
997,454
Not sure where to ask my question. I might have many hundred Linux devices, each device uses a 4G connection to connect the Internet and each of them have SSH service running at port 22 and a dynamic IP address. My question is how do I use SSH to connect to each of them? Do I need to have them in a VPN?
2020/01/03
[ "https://serverfault.com/questions/997454", "https://serverfault.com", "https://serverfault.com/users/554229/" ]
In my case, I had several base stations to connect to the core network. I used openvpn. Openvpn server in the core and generated openvpn client certificates and installed them in the other devices.
<https://aws.amazon.com/blogs/iot/introducing-secure-tunneling-for-aws-iot-device-management-a-new-secure-way-to-troubleshoot-iot-devices/> Yes I agree with @HermanB , but somecase if we need more investigation I ask AWS and this seems to be another good solution Thank you!
997,454
Not sure where to ask my question. I might have many hundred Linux devices, each device uses a 4G connection to connect the Internet and each of them have SSH service running at port 22 and a dynamic IP address. My question is how do I use SSH to connect to each of them? Do I need to have them in a VPN?
2020/01/03
[ "https://serverfault.com/questions/997454", "https://serverfault.com", "https://serverfault.com/users/554229/" ]
In my case, I had several base stations to connect to the core network. I used openvpn. Openvpn server in the core and generated openvpn client certificates and installed them in the other devices.
Maybe you can use a dynamic IP solution like [duckdns](https://duckdns.org), it has an android setting so even if your IP is changin all the time you can have an static address
2,774,737
In the code below I have a function `int GetTempString(char Query[]);` calling it in main works fine. However, when calling the function from a fork the fork hangs (stops running, no errors, no output) before this line: `pch = strtok (Query," ,");` the **printf shows that the pointer to pch is null**. Again this only ...
2010/05/05
[ "https://Stackoverflow.com/questions/2774737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/293008/" ]
`strtok` modifies the string pointed to by its first argument (replacing delimiter characters with NULs), but you're passing in a string literal, which is implicitly const. You need to copy the string into a writable buffer before calling strtok. With your example, this happens in both processes, so both will crash. W...
Your function is returning a local variable, so you have undefined behaviour - anything could happen after that. You need to allocate the string you are returning dynamically using malloc(), or pass it to the function as a parameter.
2,774,737
In the code below I have a function `int GetTempString(char Query[]);` calling it in main works fine. However, when calling the function from a fork the fork hangs (stops running, no errors, no output) before this line: `pch = strtok (Query," ,");` the **printf shows that the pointer to pch is null**. Again this only ...
2010/05/05
[ "https://Stackoverflow.com/questions/2774737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/293008/" ]
`strtok` modifies the string pointed to by its first argument (replacing delimiter characters with NULs), but you're passing in a string literal, which is implicitly const. You need to copy the string into a writable buffer before calling strtok. With your example, this happens in both processes, so both will crash. W...
TempString variable is allocated on GetTempString function's stack. Using this variable makes sens only inside the context of GetTempString. Use static TempString[50] in order to solve this problem.
38,355
In lay-mans terms, what does a clause in a contract mean when it says: > > The employee is generally prohibited from assigning or pledging salary requested to third parties. > > > The employer shall charge a reimbursement of expenses in the lump of 15 EURO for the initial processing and for each subsequent transfer...
2019/03/23
[ "https://law.stackexchange.com/questions/38355", "https://law.stackexchange.com", "https://law.stackexchange.com/users/22248/" ]
If the translation is correct, an assignment or pledge is an irrevocable pre-dispute grant of a property interest in future wages, and such an arrangement will not honored by the employer in the absence of a specific exception to the general rule of law prohibiting such arrangements (these arrangements are functionally...
In the absence of more context --and perhaps there being some translation inaccuracy--, my understanding is that the clause entitles the employer to charge the employee a fee of 15 Euros (or deduct it from from employee's paycheck) each time the employer complies with employee's request to set up transfers (such as don...
8,733,568
in my c application I have this typedef: ``` typedef double mat[2][2]; ``` this is my declaration of function: ``` aaa(mat bbb, mat ccc, mat * ddd) ``` in my code I want to compute the sum of each member in math and write the result in ddd. I did it over loops and this is the main line: ``` *ddd[i][j] = bbb[i][j...
2012/01/04
[ "https://Stackoverflow.com/questions/8733568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/500387/" ]
You're writing at the wrong address. It should be: ``` (*ddd)[i][j] = bbb[i][j] + ccc[i][j]; ``` or simply change the prototype to ``` aaa(mat bbb, mat ccc, mat ddd) ``` since arrays decay to pointers anyway. `ddd` will be a copy, but the address it points to will be the same as the original.
Passing array is the same as passing the address of the first member. Since your type is an array, you don't need the `*` in the function definition. Do: ``` aaa(mat bbb, mat ccc, mat ddd) { // whatever ddd[i][j] = bbb[i][j] + ccc[i][j]; // whatever else } ``` And you're good
8,733,568
in my c application I have this typedef: ``` typedef double mat[2][2]; ``` this is my declaration of function: ``` aaa(mat bbb, mat ccc, mat * ddd) ``` in my code I want to compute the sum of each member in math and write the result in ddd. I did it over loops and this is the main line: ``` *ddd[i][j] = bbb[i][j...
2012/01/04
[ "https://Stackoverflow.com/questions/8733568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/500387/" ]
You're writing at the wrong address. It should be: ``` (*ddd)[i][j] = bbb[i][j] + ccc[i][j]; ``` or simply change the prototype to ``` aaa(mat bbb, mat ccc, mat ddd) ``` since arrays decay to pointers anyway. `ddd` will be a copy, but the address it points to will be the same as the original.
In C, arrays used as function arguments decay to pointers to the first member of the array and are therefore already passed by reference. So in your case, there is no need to pass an explicit pointer to the array, since a pointer-conversion is already taking place under-the-hood during compilation by the C-compiler.
8,733,568
in my c application I have this typedef: ``` typedef double mat[2][2]; ``` this is my declaration of function: ``` aaa(mat bbb, mat ccc, mat * ddd) ``` in my code I want to compute the sum of each member in math and write the result in ddd. I did it over loops and this is the main line: ``` *ddd[i][j] = bbb[i][j...
2012/01/04
[ "https://Stackoverflow.com/questions/8733568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/500387/" ]
You're writing at the wrong address. It should be: ``` (*ddd)[i][j] = bbb[i][j] + ccc[i][j]; ``` or simply change the prototype to ``` aaa(mat bbb, mat ccc, mat ddd) ``` since arrays decay to pointers anyway. `ddd` will be a copy, but the address it points to will be the same as the original.
[ ] have a higher precedence than \* you should use parentheses. ``` (*ddd)[i][j] = bbb[i][j] + ccc[i][j]; ``` Passing ddd as a pointer is not necessary. ``` aaa(mat bbb, mat ccc, mat ddd) ddd[i][j] = bbb[i][j] + ccc[i][j]; ``` ddd is already a pointer to a matrix and the code above will work fine.
178,403
Let's say I have two web application and inside those I have 2 site collections each. If I deploy a visual web part for sitecollection1 then it does IISRESET which means all sites will be down for a moment. Isn't this a SharePoint design issue? I mean why would changes in one site should affect other sites?
2016/05/01
[ "https://sharepoint.stackexchange.com/questions/178403", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/15263/" ]
Actually, there's no such thing as "deploying a Web part to a site collection". You deploy a Web part with a WSP package; WSP packages (at least ones that contain Web parts) are deployed against specific Web applications. After that the feature containing the Web part is activated per site collection, but "activating a...
I don't think it is SharePoint Design issue, It is more IIS issue. When you deploy a solution, it deploys the DLL in GAC folder. IIS can't read those Dll until iisreset performed.Basically, IISreset does two things 1. clear the memory 2. reload all the DLLs from the GAC folder. One thing you can do, During your code ...
178,403
Let's say I have two web application and inside those I have 2 site collections each. If I deploy a visual web part for sitecollection1 then it does IISRESET which means all sites will be down for a moment. Isn't this a SharePoint design issue? I mean why would changes in one site should affect other sites?
2016/05/01
[ "https://sharepoint.stackexchange.com/questions/178403", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/15263/" ]
Actually, there's no such thing as "deploying a Web part to a site collection". You deploy a Web part with a WSP package; WSP packages (at least ones that contain Web parts) are deployed against specific Web applications. After that the feature containing the Web part is activated per site collection, but "activating a...
It is a usual behavior of SharePoint... When you deploy SharePoint package , it will place the files & it's related DLLs to their appropriate location.. It is necessary to reset is to connect those file with each other to get a reference from different locations ... This is the simple definition from my end to understa...
61,030,283
I have a table with 3 columns and these values: ``` col1 col2 col3 ------------------- 1 2 8 1 3 5 1 10 15 2 4 6 2 9 7 3 5 6 ``` I join a query LEFT JOIN and RIGHT JOIN a grouping and counting query for each number (MS-ACCESS). ``` SELECT C...
2020/04/04
[ "https://Stackoverflow.com/questions/61030283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13220315/" ]
Had tried to find documentation for the activity settings icon. Not found proper documentation. Just add the below code in your custom UIActivity, Working fine for me with Swift 5.2 ``` @objc var _activitySettingsImage: UIImage? { return UIImage(named: "activitySettingsIcon") } ``` Don't forgot to activitySettin...
I solved the same issue by adding the following (in Objective C, but you get the idea). ``` - (UIImage *)_activitySettingsImage { return [UIImage imageNamed:@"message-app-icon-for-setting"]; } ``` Apparently, image for more section should be smaller than the one in \_activityImage. At the time of writing (XC...
50,465,130
I think this might be a repeated question but I can't find the answer so here it goes. If I have a matrix X: ``` > X [,1] [,2] [,3] [,4] [,5] [1,] 1 4 55 1 8 [2,] 48 2 0 1 2 [3,] 67 23 53 55 78 [4,] 0 78 0 0 0 [5,] 85 91 23 65 83 ``` What is ...
2018/05/22
[ "https://Stackoverflow.com/questions/50465130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9015471/" ]
``` X <- as.matrix(read.table(text=" 1 4 55 1 8 48 2 0 1 2 67 23 53 55 78 0 78 0 0 0 85 91 23 65 83")) which(rowSums(X!=0)==1) # [1] 4 ``` Here are 2 ways to correct your approach, note they focus on observing column 2 while my solution doesn't: ``` which(X[,2] !=...
Try this easy example code: ``` m<-as.matrix(cbind(a=c(1,1,1,0,0,1),b=c(1,1,1,1,0,0),c=c(1,1,1,0,0,0))) > m a b c [1,] 1 1 1 [2,] 1 1 1 [3,] 1 1 1 [4,] 0 1 0 [5,] 0 0 0 [6,] 1 0 0 > > #Row detection > which(rowSums(m!=0)==1) [1] 4 6 > > #Column with elemnte !=0 > apply(m[which(rowSums(m!=0)==1),],1,which.ma...
56,621,788
I removed query params from url in index.html, but i want in app.component.html work with those query params, and my app.component.ts using ActivatedRoute, Now when i have this script in index.html then my app.componen.ts also does not receive those queru params, how can i let app.component.ts have my query params? th...
2019/06/16
[ "https://Stackoverflow.com/questions/56621788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2156084/" ]
Could you not just place those query parameters into session storage and then access session storage inside app.component.ts? ``` <script type="text/javascript"> var url = window.location.toString(); if(url.indexOf("?") > 0) { var [ sanitizedUrl, queryParams ] = url.split('?') window.history.repla...
After some research, there's no clear cut solution for it but still, I did manage to create some solution that should work. Idea behind it in order to make it works is to keep query params in service. Make a service that will hold the data: ``` import { Injectable } from '@angular/core'; import { BehaviorSubject, O...
73,548,610
*I have defined a function to convert Epoch time to CET and using that function after wrapping as UDF in Spark dataFrame. It is throwing error and not allowing me to use it. Please find below my code.* ***Function used to convert Epoch time to CET:*** ``` import java.text.SimpleDateFormat import java.util.{Calendar, ...
2022/08/30
[ "https://Stackoverflow.com/questions/73548610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10537622/" ]
The spark optimizer execution tells you that your function is not a Function1, that means that it is not a function that accepts one parameter. You have a function with four input parameters. And, although you may think that in Scala you are allowed to call that function with only one parameter because you have default...
*I found why the error is due to and resolved it. The problem is when I wrap the scala function as UDF, its expecting 4 parameters, but I was passing only one parameter. Now, I removed 3 parameters from the function and took those values inside the function itself, since they are constant values. Now in Spark Dataframe...
5,697,524
For my data structures class our assignment is to implement a PriorityQueue class that uses an already created array based queue. Everything is working in the PriorityQueue class except for the clone method. When the clone method is activated nothing is returned even though there is data in the queue that is being clon...
2011/04/18
[ "https://Stackoverflow.com/questions/5697524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/712600/" ]
Try using ``` @Override public Object clone() throws CloneNotSupportedException { // your method here. ... } ``` as the method signature. It looks as though you are not correctly overriding the clone method by using a slightly different signature. See [information](http://download.oracle.com/javase/tutorial/java...
If you see the declaration of Priority Queue it does not implement the clonable interface. ``` public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable ```
5,697,524
For my data structures class our assignment is to implement a PriorityQueue class that uses an already created array based queue. Everything is working in the PriorityQueue class except for the clone method. When the clone method is activated nothing is returned even though there is data in the queue that is being clon...
2011/04/18
[ "https://Stackoverflow.com/questions/5697524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/712600/" ]
I think that the problem is that `queues` is not being cloned properly. Try this: ``` public PriorityQueueArray<E> clone() { PriorityQueueArray<E> answer; answer.manyItems = manyItems; answer.highest = highest; answer.queues = new ArrayQueue<E>[queues.length]; // This is the key! for (int i = 0; i ...
If you see the declaration of Priority Queue it does not implement the clonable interface. ``` public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable ```
1,918,332
I have some code that does custom drawing. Basically it is form fill program that has a WYSIWYG editor. The editor allows a zoom level to be set. I am having problems with the width of my labels jumping to different sizes relative to everything else on the form. An example of the code I am using to output the text is ...
2009/12/16
[ "https://Stackoverflow.com/questions/1918332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6174/" ]
The fundamental problem is that you try to zoom the text by changing its `Height`. Given that the Windows API uses an integer coordinate system it follows that only certain discrete font heights are possible. If for example you have a font 20 pixels high at a scale value of 100%, then you can basically set only scale v...
Solution, introduced by **mghie** works well with graphics but fails while scaling fonts. There are another method of scaling with opposite properties: `SetWorldTransform` . This method works well while scaling TrueType fonts, but fails when drawing graphics with GDI. Therefore my suggestion is swithcing DC mode wi...
1,918,332
I have some code that does custom drawing. Basically it is form fill program that has a WYSIWYG editor. The editor allows a zoom level to be set. I am having problems with the width of my labels jumping to different sizes relative to everything else on the form. An example of the code I am using to output the text is ...
2009/12/16
[ "https://Stackoverflow.com/questions/1918332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6174/" ]
The fundamental problem is that you try to zoom the text by changing its `Height`. Given that the Windows API uses an integer coordinate system it follows that only certain discrete font heights are possible. If for example you have a font 20 pixels high at a scale value of 100%, then you can basically set only scale v...
Another way to deal with font scaling is to paint it to in-memory bitmap and then stretch with `StretchBlt()` to desired size. Same idea as in previous answer, but realization are more clear. Base steps is: 1. Set MM\_ISOTROPIC mapping mode with `SetMapMode()` 2. Define coordinate mappings with `SetWindowExtEx()` ...
1,918,332
I have some code that does custom drawing. Basically it is form fill program that has a WYSIWYG editor. The editor allows a zoom level to be set. I am having problems with the width of my labels jumping to different sizes relative to everything else on the form. An example of the code I am using to output the text is ...
2009/12/16
[ "https://Stackoverflow.com/questions/1918332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6174/" ]
The fundamental problem is that you try to zoom the text by changing its `Height`. Given that the Windows API uses an integer coordinate system it follows that only certain discrete font heights are possible. If for example you have a font 20 pixels high at a scale value of 100%, then you can basically set only scale v...
OK based on mghie's suggestion to alter the spaces between the chars here is what I came up with. I didn't end up using the array of char spacing but instead used [SetTextCharacterExtra](http://msdn.microsoft.com/en-us/library/dd145092(VS.85).aspx) and [SetTextJustification](http://msdn.microsoft.com/en-us/library/dd14...
1,918,332
I have some code that does custom drawing. Basically it is form fill program that has a WYSIWYG editor. The editor allows a zoom level to be set. I am having problems with the width of my labels jumping to different sizes relative to everything else on the form. An example of the code I am using to output the text is ...
2009/12/16
[ "https://Stackoverflow.com/questions/1918332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6174/" ]
The fundamental problem is that you try to zoom the text by changing its `Height`. Given that the Windows API uses an integer coordinate system it follows that only certain discrete font heights are possible. If for example you have a font 20 pixels high at a scale value of 100%, then you can basically set only scale v...
There is test code to compare different solutions. Code outputs real width of long scaled line to font\_cmp.csv file. [Link](http://img224.imagevenue.com/img.php?image=65935_line_length_compare_122_911lo.JPG) to picture of comparasion Example code: ``` procedure TForm1.Button1Click(Sender: TObject); const Long...
1,918,332
I have some code that does custom drawing. Basically it is form fill program that has a WYSIWYG editor. The editor allows a zoom level to be set. I am having problems with the width of my labels jumping to different sizes relative to everything else on the form. An example of the code I am using to output the text is ...
2009/12/16
[ "https://Stackoverflow.com/questions/1918332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6174/" ]
Another way to deal with font scaling is to paint it to in-memory bitmap and then stretch with `StretchBlt()` to desired size. Same idea as in previous answer, but realization are more clear. Base steps is: 1. Set MM\_ISOTROPIC mapping mode with `SetMapMode()` 2. Define coordinate mappings with `SetWindowExtEx()` ...
Solution, introduced by **mghie** works well with graphics but fails while scaling fonts. There are another method of scaling with opposite properties: `SetWorldTransform` . This method works well while scaling TrueType fonts, but fails when drawing graphics with GDI. Therefore my suggestion is swithcing DC mode wi...
1,918,332
I have some code that does custom drawing. Basically it is form fill program that has a WYSIWYG editor. The editor allows a zoom level to be set. I am having problems with the width of my labels jumping to different sizes relative to everything else on the form. An example of the code I am using to output the text is ...
2009/12/16
[ "https://Stackoverflow.com/questions/1918332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6174/" ]
OK based on mghie's suggestion to alter the spaces between the chars here is what I came up with. I didn't end up using the array of char spacing but instead used [SetTextCharacterExtra](http://msdn.microsoft.com/en-us/library/dd145092(VS.85).aspx) and [SetTextJustification](http://msdn.microsoft.com/en-us/library/dd14...
Solution, introduced by **mghie** works well with graphics but fails while scaling fonts. There are another method of scaling with opposite properties: `SetWorldTransform` . This method works well while scaling TrueType fonts, but fails when drawing graphics with GDI. Therefore my suggestion is swithcing DC mode wi...
1,918,332
I have some code that does custom drawing. Basically it is form fill program that has a WYSIWYG editor. The editor allows a zoom level to be set. I am having problems with the width of my labels jumping to different sizes relative to everything else on the form. An example of the code I am using to output the text is ...
2009/12/16
[ "https://Stackoverflow.com/questions/1918332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6174/" ]
There is test code to compare different solutions. Code outputs real width of long scaled line to font\_cmp.csv file. [Link](http://img224.imagevenue.com/img.php?image=65935_line_length_compare_122_911lo.JPG) to picture of comparasion Example code: ``` procedure TForm1.Button1Click(Sender: TObject); const Long...
Solution, introduced by **mghie** works well with graphics but fails while scaling fonts. There are another method of scaling with opposite properties: `SetWorldTransform` . This method works well while scaling TrueType fonts, but fails when drawing graphics with GDI. Therefore my suggestion is swithcing DC mode wi...
1,918,332
I have some code that does custom drawing. Basically it is form fill program that has a WYSIWYG editor. The editor allows a zoom level to be set. I am having problems with the width of my labels jumping to different sizes relative to everything else on the form. An example of the code I am using to output the text is ...
2009/12/16
[ "https://Stackoverflow.com/questions/1918332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6174/" ]
Another way to deal with font scaling is to paint it to in-memory bitmap and then stretch with `StretchBlt()` to desired size. Same idea as in previous answer, but realization are more clear. Base steps is: 1. Set MM\_ISOTROPIC mapping mode with `SetMapMode()` 2. Define coordinate mappings with `SetWindowExtEx()` ...
OK based on mghie's suggestion to alter the spaces between the chars here is what I came up with. I didn't end up using the array of char spacing but instead used [SetTextCharacterExtra](http://msdn.microsoft.com/en-us/library/dd145092(VS.85).aspx) and [SetTextJustification](http://msdn.microsoft.com/en-us/library/dd14...
1,918,332
I have some code that does custom drawing. Basically it is form fill program that has a WYSIWYG editor. The editor allows a zoom level to be set. I am having problems with the width of my labels jumping to different sizes relative to everything else on the form. An example of the code I am using to output the text is ...
2009/12/16
[ "https://Stackoverflow.com/questions/1918332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6174/" ]
Another way to deal with font scaling is to paint it to in-memory bitmap and then stretch with `StretchBlt()` to desired size. Same idea as in previous answer, but realization are more clear. Base steps is: 1. Set MM\_ISOTROPIC mapping mode with `SetMapMode()` 2. Define coordinate mappings with `SetWindowExtEx()` ...
There is test code to compare different solutions. Code outputs real width of long scaled line to font\_cmp.csv file. [Link](http://img224.imagevenue.com/img.php?image=65935_line_length_compare_122_911lo.JPG) to picture of comparasion Example code: ``` procedure TForm1.Button1Click(Sender: TObject); const Long...
49,186,376
How to use click to write a command line prompt which looks like: ``` choose name: [1] Karen [2] Bob [3] Jo [4] Steve ``` And calls a function such as: ``` def print_function(name): if name == 'Karen': print('CEO') elif name == 'Bob': print('CFO') elif name == 'Jo': print('COO')...
2018/03/09
[ "https://Stackoverflow.com/questions/49186376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4605629/" ]
Using a custom class which inherits from `click.Option`, you can intercept the option processing and display the desired menu, and then validate the response like: ### Custom Class ``` import click class EnumMenuPromptFromDict(click.Option): def __init__(self, *args, **kwargs): super(EnumMenuPromptFromD...
Well, I'm not the right guy to ask about the arguments thing (sys.argv would be a good place to start), but I CAN help you with your first problem: ``` choice = int (input ("[1] Karen \n[2] Bob \n[3] Jo \n[4] Steve\n")) - 1 positions = ["CEO", "CFO", "COO", "CIO"] print (positions [choice]) ``` This basically takes ...
49,186,376
How to use click to write a command line prompt which looks like: ``` choose name: [1] Karen [2] Bob [3] Jo [4] Steve ``` And calls a function such as: ``` def print_function(name): if name == 'Karen': print('CEO') elif name == 'Bob': print('CFO') elif name == 'Jo': print('COO')...
2018/03/09
[ "https://Stackoverflow.com/questions/49186376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4605629/" ]
Using a custom class which inherits from `click.Option`, you can intercept the option processing and display the desired menu, and then validate the response like: ### Custom Class ``` import click class EnumMenuPromptFromDict(click.Option): def __init__(self, *args, **kwargs): super(EnumMenuPromptFromD...
You can use `argparse` to manually build it. ``` import argparse parser = argparse.ArgumentParser() parser.add_argument("--name") args = parser.parse_args() def print_function(name): if name == 'Karen': print('CEO') elif name == 'Bob': print('CFO') elif name == 'Jo': print('COO') ...
49,186,376
How to use click to write a command line prompt which looks like: ``` choose name: [1] Karen [2] Bob [3] Jo [4] Steve ``` And calls a function such as: ``` def print_function(name): if name == 'Karen': print('CEO') elif name == 'Bob': print('CFO') elif name == 'Jo': print('COO')...
2018/03/09
[ "https://Stackoverflow.com/questions/49186376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4605629/" ]
Using a custom class which inherits from `click.Option`, you can intercept the option processing and display the desired menu, and then validate the response like: ### Custom Class ``` import click class EnumMenuPromptFromDict(click.Option): def __init__(self, *args, **kwargs): super(EnumMenuPromptFromD...
This is easy to do with a dictionary ``` names = { 1: 'Karen', 2: 'Bob', 3: 'Jo', 4: 'Steve' } ``` Make the prompt using string.format() and iterating over the dictionary's items: ``` str_items = ['[{}] {}\n'.format(val, name) for val, name in names.items()] prompt = ''.join(str_items) val = input('...
49,186,376
How to use click to write a command line prompt which looks like: ``` choose name: [1] Karen [2] Bob [3] Jo [4] Steve ``` And calls a function such as: ``` def print_function(name): if name == 'Karen': print('CEO') elif name == 'Bob': print('CFO') elif name == 'Jo': print('COO')...
2018/03/09
[ "https://Stackoverflow.com/questions/49186376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4605629/" ]
Using a custom class which inherits from `click.Option`, you can intercept the option processing and display the desired menu, and then validate the response like: ### Custom Class ``` import click class EnumMenuPromptFromDict(click.Option): def __init__(self, *args, **kwargs): super(EnumMenuPromptFromD...
It would be nice to have just **one** structure holding the data (names and job titles) instead of two. Just for maintainability when people change job titles or join or leave, then you just have one thing to update instead of two (list of names + list of titles, or dict of names and dict of titles). One way is with a...
38,599,667
I am using sql server and I ran a query that resulted in 5000 rows. I want each row to be saved as a separate text file. Is there a way to do that?
2016/07/26
[ "https://Stackoverflow.com/questions/38599667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6292114/" ]
If you rather do it in TSQL. Now, I can't take credit for stored procedure, it was lifted from SO some time ago. You would have to modify the initial query and DESTINATION in Step 3. > > 1) Required provided you have the appropriate rights > > > ``` EXEC sp_configure 'show advanced options', 1 GO EXEC sp_confi...
Use SSIS, I was going to type it all out, but here is a site where he has it detailed with screenshots. <https://coldlogics.wordpress.com/2011/04/09/using-ssis-to-dynamically-create-data-files-from-a-full-result-set/>
27,705,787
I have a class like this ``` class myClass{ public function getContent() { $products = 'something'; } } ``` Now there is another file called file.php. In that I have included the class file ike this ``` include_once(dirname(__FILE__).'/class.php'); ``` Now inside file.php I have made my code like...
2014/12/30
[ "https://Stackoverflow.com/questions/27705787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614208/" ]
You need to call the function to set the variable. ``` $test = new myClass(); $test->getContent(); echo $test->products; ``` Anyway, this is confusing, since getContent does not get anything. So, do this. ``` //Rename it to set not get public function setContent() { $this->products = 'something'; } $test = ...
You have to run the function first. use the code below ``` $p = new myClass; $p->getContent(); $p->products; ``` Just specify product property ``` class myClass{ public function getContent() { $products = 'something'; $this->products = $products; } } ``` Hope this helps you
27,705,787
I have a class like this ``` class myClass{ public function getContent() { $products = 'something'; } } ``` Now there is another file called file.php. In that I have included the class file ike this ``` include_once(dirname(__FILE__).'/class.php'); ``` Now inside file.php I have made my code like...
2014/12/30
[ "https://Stackoverflow.com/questions/27705787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614208/" ]
You need to call the function to set the variable. ``` $test = new myClass(); $test->getContent(); echo $test->products; ``` Anyway, this is confusing, since getContent does not get anything. So, do this. ``` //Rename it to set not get public function setContent() { $this->products = 'something'; } $test = ...
It wont, because the way you declared `$products` variable has made it local to the `function getContent()`. SO either you can access the function `$test->getContent()` and `return $products` from in there, or you can declare `$products` as a `global` member variable to the class as ``` class myClass{ $products; ...
27,705,787
I have a class like this ``` class myClass{ public function getContent() { $products = 'something'; } } ``` Now there is another file called file.php. In that I have included the class file ike this ``` include_once(dirname(__FILE__).'/class.php'); ``` Now inside file.php I have made my code like...
2014/12/30
[ "https://Stackoverflow.com/questions/27705787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614208/" ]
You need to call the function to set the variable. ``` $test = new myClass(); $test->getContent(); echo $test->products; ``` Anyway, this is confusing, since getContent does not get anything. So, do this. ``` //Rename it to set not get public function setContent() { $this->products = 'something'; } $test = ...
You need to define a global variable for myClass: ``` class myClass{ public $products = ''; public function getContent() { $this->products = 'something'; } } ``` In file.php: ``` $test = new myClass(); $test->getContent(); echo $test->products; // Print something ``` If you want to get all ...
27,705,787
I have a class like this ``` class myClass{ public function getContent() { $products = 'something'; } } ``` Now there is another file called file.php. In that I have included the class file ike this ``` include_once(dirname(__FILE__).'/class.php'); ``` Now inside file.php I have made my code like...
2014/12/30
[ "https://Stackoverflow.com/questions/27705787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614208/" ]
There's a number of things going wrong here. First up: in order to have a function call return a value, it needs to actually have a `return` statement in it. So your `getContent` does not currently return anything. Then, in order to store something in a class, you need to make a class property for it. Otherwise the v...
You have to run the function first. use the code below ``` $p = new myClass; $p->getContent(); $p->products; ``` Just specify product property ``` class myClass{ public function getContent() { $products = 'something'; $this->products = $products; } } ``` Hope this helps you
27,705,787
I have a class like this ``` class myClass{ public function getContent() { $products = 'something'; } } ``` Now there is another file called file.php. In that I have included the class file ike this ``` include_once(dirname(__FILE__).'/class.php'); ``` Now inside file.php I have made my code like...
2014/12/30
[ "https://Stackoverflow.com/questions/27705787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614208/" ]
try this: ``` class myClass{ public function getContent() { $products = 'something'; return $products; } } $test = new myClass(); echo $test->getContent(); ```
You have to run the function first. use the code below ``` $p = new myClass; $p->getContent(); $p->products; ``` Just specify product property ``` class myClass{ public function getContent() { $products = 'something'; $this->products = $products; } } ``` Hope this helps you
27,705,787
I have a class like this ``` class myClass{ public function getContent() { $products = 'something'; } } ``` Now there is another file called file.php. In that I have included the class file ike this ``` include_once(dirname(__FILE__).'/class.php'); ``` Now inside file.php I have made my code like...
2014/12/30
[ "https://Stackoverflow.com/questions/27705787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614208/" ]
There's a number of things going wrong here. First up: in order to have a function call return a value, it needs to actually have a `return` statement in it. So your `getContent` does not currently return anything. Then, in order to store something in a class, you need to make a class property for it. Otherwise the v...
It wont, because the way you declared `$products` variable has made it local to the `function getContent()`. SO either you can access the function `$test->getContent()` and `return $products` from in there, or you can declare `$products` as a `global` member variable to the class as ``` class myClass{ $products; ...
27,705,787
I have a class like this ``` class myClass{ public function getContent() { $products = 'something'; } } ``` Now there is another file called file.php. In that I have included the class file ike this ``` include_once(dirname(__FILE__).'/class.php'); ``` Now inside file.php I have made my code like...
2014/12/30
[ "https://Stackoverflow.com/questions/27705787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614208/" ]
try this: ``` class myClass{ public function getContent() { $products = 'something'; return $products; } } $test = new myClass(); echo $test->getContent(); ```
It wont, because the way you declared `$products` variable has made it local to the `function getContent()`. SO either you can access the function `$test->getContent()` and `return $products` from in there, or you can declare `$products` as a `global` member variable to the class as ``` class myClass{ $products; ...
27,705,787
I have a class like this ``` class myClass{ public function getContent() { $products = 'something'; } } ``` Now there is another file called file.php. In that I have included the class file ike this ``` include_once(dirname(__FILE__).'/class.php'); ``` Now inside file.php I have made my code like...
2014/12/30
[ "https://Stackoverflow.com/questions/27705787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614208/" ]
There's a number of things going wrong here. First up: in order to have a function call return a value, it needs to actually have a `return` statement in it. So your `getContent` does not currently return anything. Then, in order to store something in a class, you need to make a class property for it. Otherwise the v...
You need to define a global variable for myClass: ``` class myClass{ public $products = ''; public function getContent() { $this->products = 'something'; } } ``` In file.php: ``` $test = new myClass(); $test->getContent(); echo $test->products; // Print something ``` If you want to get all ...
27,705,787
I have a class like this ``` class myClass{ public function getContent() { $products = 'something'; } } ``` Now there is another file called file.php. In that I have included the class file ike this ``` include_once(dirname(__FILE__).'/class.php'); ``` Now inside file.php I have made my code like...
2014/12/30
[ "https://Stackoverflow.com/questions/27705787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614208/" ]
try this: ``` class myClass{ public function getContent() { $products = 'something'; return $products; } } $test = new myClass(); echo $test->getContent(); ```
You need to define a global variable for myClass: ``` class myClass{ public $products = ''; public function getContent() { $this->products = 'something'; } } ``` In file.php: ``` $test = new myClass(); $test->getContent(); echo $test->products; // Print something ``` If you want to get all ...
53,339,113
The method written in the below code needs to take integer and result sum of 1st digit and last digit in the integer. NOTE: The reason i am asking this question though i got to know the correct solution is i need to understand why my code is not working also as that makes me a better programmer please help. ``` publ...
2018/11/16
[ "https://Stackoverflow.com/questions/53339113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9893325/" ]
Lets break this up into two parts. Get the last digit of the number, and getting the first digit of the number. The first part of the problem is easy. Its exactly what you already have; just take modulo 10 of the number. ``` int lastdigit = number % 10; ``` The second part is a little trickier, but not too much. W...
This is not a direct solution to your problem, but we can fairly easily handle this using regex and the base methods: ``` int number = 12345678; String val = String.valueOf(number); val = val.replaceAll("(?<=\\d)\\d+(?=\\d)", ""); number = Integer.parseInt(val); int sum = number % 10 + number / 10; System.out.println(...
53,339,113
The method written in the below code needs to take integer and result sum of 1st digit and last digit in the integer. NOTE: The reason i am asking this question though i got to know the correct solution is i need to understand why my code is not working also as that makes me a better programmer please help. ``` publ...
2018/11/16
[ "https://Stackoverflow.com/questions/53339113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9893325/" ]
In this case: ``` while(number>0) { number/=10; if(number<=9 & number>=0){ firstdigit=number; } } ``` Note that you change `number` after you check `number > 0`. That means that number can be 0 when reaches the if statement and if it is 0 it will be accepted as first digit because it satisfies th...
This is not a direct solution to your problem, but we can fairly easily handle this using regex and the base methods: ``` int number = 12345678; String val = String.valueOf(number); val = val.replaceAll("(?<=\\d)\\d+(?=\\d)", ""); number = Integer.parseInt(val); int sum = number % 10 + number / 10; System.out.println(...
53,339,113
The method written in the below code needs to take integer and result sum of 1st digit and last digit in the integer. NOTE: The reason i am asking this question though i got to know the correct solution is i need to understand why my code is not working also as that makes me a better programmer please help. ``` publ...
2018/11/16
[ "https://Stackoverflow.com/questions/53339113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9893325/" ]
If the number is less than 0 then return -1. Otherwise the last number can be found by modulus 10, and the first number found by dividing by 10 until that number is less than 10. ``` public static int sumFirstAndLastDigit(int number) { if (number < 0) { return -1; } int last = number % 10; int...
This is not a direct solution to your problem, but we can fairly easily handle this using regex and the base methods: ``` int number = 12345678; String val = String.valueOf(number); val = val.replaceAll("(?<=\\d)\\d+(?=\\d)", ""); number = Integer.parseInt(val); int sum = number % 10 + number / 10; System.out.println(...
53,339,113
The method written in the below code needs to take integer and result sum of 1st digit and last digit in the integer. NOTE: The reason i am asking this question though i got to know the correct solution is i need to understand why my code is not working also as that makes me a better programmer please help. ``` publ...
2018/11/16
[ "https://Stackoverflow.com/questions/53339113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9893325/" ]
Lets break this up into two parts. Get the last digit of the number, and getting the first digit of the number. The first part of the problem is easy. Its exactly what you already have; just take modulo 10 of the number. ``` int lastdigit = number % 10; ``` The second part is a little trickier, but not too much. W...
In this case: ``` while(number>0) { number/=10; if(number<=9 & number>=0){ firstdigit=number; } } ``` Note that you change `number` after you check `number > 0`. That means that number can be 0 when reaches the if statement and if it is 0 it will be accepted as first digit because it satisfies th...
53,339,113
The method written in the below code needs to take integer and result sum of 1st digit and last digit in the integer. NOTE: The reason i am asking this question though i got to know the correct solution is i need to understand why my code is not working also as that makes me a better programmer please help. ``` publ...
2018/11/16
[ "https://Stackoverflow.com/questions/53339113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9893325/" ]
Lets break this up into two parts. Get the last digit of the number, and getting the first digit of the number. The first part of the problem is easy. Its exactly what you already have; just take modulo 10 of the number. ``` int lastdigit = number % 10; ``` The second part is a little trickier, but not too much. W...
If the number is less than 0 then return -1. Otherwise the last number can be found by modulus 10, and the first number found by dividing by 10 until that number is less than 10. ``` public static int sumFirstAndLastDigit(int number) { if (number < 0) { return -1; } int last = number % 10; int...
53,339,113
The method written in the below code needs to take integer and result sum of 1st digit and last digit in the integer. NOTE: The reason i am asking this question though i got to know the correct solution is i need to understand why my code is not working also as that makes me a better programmer please help. ``` publ...
2018/11/16
[ "https://Stackoverflow.com/questions/53339113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9893325/" ]
If the number is less than 0 then return -1. Otherwise the last number can be found by modulus 10, and the first number found by dividing by 10 until that number is less than 10. ``` public static int sumFirstAndLastDigit(int number) { if (number < 0) { return -1; } int last = number % 10; int...
In this case: ``` while(number>0) { number/=10; if(number<=9 & number>=0){ firstdigit=number; } } ``` Note that you change `number` after you check `number > 0`. That means that number can be 0 when reaches the if statement and if it is 0 it will be accepted as first digit because it satisfies th...
377,186
I've got a name-based virtual host setup on port 443 such that requests on host 'apple.fruitdomain' are proxied to the apple-app and requests on host 'orange.fruitdomain' are proxied to orange-app. This is working, but I'd like to add a ServerAlias for each such that requests on host 'apple' are proxied to apple-app an...
2012/04/05
[ "https://serverfault.com/questions/377186", "https://serverfault.com", "https://serverfault.com/users/107456/" ]
Well, from my testing it appears that the ServerAlias directive is ignored when using name-based virtual hosting on port 443 with Apache 2.2.15. This is probably due to the special SNI protocol requirement ([SNI - Wikipedia](http://en.wikipedia.org/wiki/Server_Name_Indication); [SNI - Apache Wiki](http://wiki.apache.or...
<http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI>
377,186
I've got a name-based virtual host setup on port 443 such that requests on host 'apple.fruitdomain' are proxied to the apple-app and requests on host 'orange.fruitdomain' are proxied to orange-app. This is working, but I'd like to add a ServerAlias for each such that requests on host 'apple' are proxied to apple-app an...
2012/04/05
[ "https://serverfault.com/questions/377186", "https://serverfault.com", "https://serverfault.com/users/107456/" ]
In order to fix underlined configuration you need to create another VirtualHost for "default" purposes using: ``` ServerName localhost or ServerName your_server_name ``` Please check apache httpd docs (Ex.) - <http://httpd.apache.org/docs/2.2/mod/core.html#servername> > > The ServerName directive sets the ...
<http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI>
377,186
I've got a name-based virtual host setup on port 443 such that requests on host 'apple.fruitdomain' are proxied to the apple-app and requests on host 'orange.fruitdomain' are proxied to orange-app. This is working, but I'd like to add a ServerAlias for each such that requests on host 'apple' are proxied to apple-app an...
2012/04/05
[ "https://serverfault.com/questions/377186", "https://serverfault.com", "https://serverfault.com/users/107456/" ]
Well, from my testing it appears that the ServerAlias directive is ignored when using name-based virtual hosting on port 443 with Apache 2.2.15. This is probably due to the special SNI protocol requirement ([SNI - Wikipedia](http://en.wikipedia.org/wiki/Server_Name_Indication); [SNI - Apache Wiki](http://wiki.apache.or...
comment the listen 443 line because listening start with the ssl automaticaly and if you start it before it will see a conflict.
377,186
I've got a name-based virtual host setup on port 443 such that requests on host 'apple.fruitdomain' are proxied to the apple-app and requests on host 'orange.fruitdomain' are proxied to orange-app. This is working, but I'd like to add a ServerAlias for each such that requests on host 'apple' are proxied to apple-app an...
2012/04/05
[ "https://serverfault.com/questions/377186", "https://serverfault.com", "https://serverfault.com/users/107456/" ]
Well, from my testing it appears that the ServerAlias directive is ignored when using name-based virtual hosting on port 443 with Apache 2.2.15. This is probably due to the special SNI protocol requirement ([SNI - Wikipedia](http://en.wikipedia.org/wiki/Server_Name_Indication); [SNI - Apache Wiki](http://wiki.apache.or...
In order to fix underlined configuration you need to create another VirtualHost for "default" purposes using: ``` ServerName localhost or ServerName your_server_name ``` Please check apache httpd docs (Ex.) - <http://httpd.apache.org/docs/2.2/mod/core.html#servername> > > The ServerName directive sets the ...
377,186
I've got a name-based virtual host setup on port 443 such that requests on host 'apple.fruitdomain' are proxied to the apple-app and requests on host 'orange.fruitdomain' are proxied to orange-app. This is working, but I'd like to add a ServerAlias for each such that requests on host 'apple' are proxied to apple-app an...
2012/04/05
[ "https://serverfault.com/questions/377186", "https://serverfault.com", "https://serverfault.com/users/107456/" ]
In order to fix underlined configuration you need to create another VirtualHost for "default" purposes using: ``` ServerName localhost or ServerName your_server_name ``` Please check apache httpd docs (Ex.) - <http://httpd.apache.org/docs/2.2/mod/core.html#servername> > > The ServerName directive sets the ...
comment the listen 443 line because listening start with the ssl automaticaly and if you start it before it will see a conflict.
31,572,136
I am just looking for a quick fix how to make this field black . As of right now the CSS makes it `blue` but i want to override it just for this particular field. Here is the `ASP.NET` code. Not sure where to put a `style` element because it cant go inside a `itemtemplate` tag ``` <itemtemplate> <%# String.For...
2015/07/22
[ "https://Stackoverflow.com/questions/31572136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4796973/" ]
UIImagePickerController is derived from UINavigationController, which is why you can't push it onto another UINavigationController (or set as the root view controller).
It sounds like you are trying to push a navigation controller on another navigation controller. You should instead do something like this: ``` UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init]; imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; imagePicker.delegate = self; i...
8,969,878
When the user loads the page, I immediately do a window redirect to another location. The problem is, when the user clicks back, it'll go back to the page which does the redirect. Can I "cancel" the history of the previous page? So that when the user clicks back, it goes back TWO pages instead?
2012/01/23
[ "https://Stackoverflow.com/questions/8969878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/179736/" ]
Instead of using `window.location = url;` to redirect, try: ``` window.location.replace(url); ``` > > after using replace() the current page will not be saved in session > history, meaning the user won't be able to use the Back button to > navigate to it. > > >
You can use [`location.replace`](https://developer.mozilla.org/en/DOM/window.location#replace) to replace the current location entry (the redirect page) with the new one (the target). That requires that you do the redirection via JavaScript rather than with meta tags or a 302. E.g.: ``` // In the redirecting page loca...
8,969,878
When the user loads the page, I immediately do a window redirect to another location. The problem is, when the user clicks back, it'll go back to the page which does the redirect. Can I "cancel" the history of the previous page? So that when the user clicks back, it goes back TWO pages instead?
2012/01/23
[ "https://Stackoverflow.com/questions/8969878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/179736/" ]
You can use [`location.replace`](https://developer.mozilla.org/en/DOM/window.location#replace) to replace the current location entry (the redirect page) with the new one (the target). That requires that you do the redirection via JavaScript rather than with meta tags or a 302. E.g.: ``` // In the redirecting page loca...
For anyone coming across this page and looking for an AngularJS way to accomplish this (rather than javascript), use the $location service's replace() method ([documentation](https://docs.angularjs.org/guide/$location)) : Use `$location.url('/newpath');` or `$location.path('/newpath');` as you normally would to do the...
8,969,878
When the user loads the page, I immediately do a window redirect to another location. The problem is, when the user clicks back, it'll go back to the page which does the redirect. Can I "cancel" the history of the previous page? So that when the user clicks back, it goes back TWO pages instead?
2012/01/23
[ "https://Stackoverflow.com/questions/8969878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/179736/" ]
Instead of using `window.location = url;` to redirect, try: ``` window.location.replace(url); ``` > > after using replace() the current page will not be saved in session > history, meaning the user won't be able to use the Back button to > navigate to it. > > >
For anyone coming across this page and looking for an AngularJS way to accomplish this (rather than javascript), use the $location service's replace() method ([documentation](https://docs.angularjs.org/guide/$location)) : Use `$location.url('/newpath');` or `$location.path('/newpath');` as you normally would to do the...
436,951
I was looking into a folder where I normally store data that I've unpacked and found that some files I thought were lost were actually in a folder that started with a `.`. Using Nautilus the folder was invisible. Performing an `ls` command from terminal also didn't expose it. It was after I ran some Java app that I'm w...
2012/06/14
[ "https://superuser.com/questions/436951", "https://superuser.com", "https://superuser.com/users/31929/" ]
In Nautilus, to display/hide files that start with `.` or end with `~`, press `Ctrl` + `H`.
Like Dennis said, in Nautilus, to display/hide files that start with `.` or end with `~`, press `Ctrl` + `H`. Also `ls -a` will display all files in terminal, hidden or no.
36,011,056
When I am using `Auth::check()` or `Auth::logout()` or `Auth::attempt(['email' => $email, 'password' => $password], $remember)` I am getting following error, ``` InvalidArgumentException in Manager.php line 90: Driver [session] not supported. ``` [![enter image description here](https://i.stack.imgur.com/zWGKi.png)...
2016/03/15
[ "https://Stackoverflow.com/questions/36011056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4617250/" ]
Change config/session.php driver to database or file and don't forget to restart your laravel app(close your terminal and open your terminal again and enter "php artisan serve") after you make the changes
Change config/session.php driver to database or file
13,351,840
<http://jsfiddle.net/adamadam123/qv2yR/> Above is the code I'm currently working with. Below is an image of what I'm trying to achieve. ![enter image description here](https://i.stack.imgur.com/WZmWA.png) Its basically a chat box 'IM' and I have a blue & pink image and need to be able to get different amounts of tex...
2012/11/12
[ "https://Stackoverflow.com/questions/13351840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/880413/" ]
Subversion never completely deletes a file from the repository. In fact, this is a well requested feature. You do a `svn delete` or `svn rm`, and the file is no longer in the working copy. However, it is definitely still there. What's probably is convincing you that the file has been permanently removed is that you're...
I accepted David W.'s answer - it correctly described the state of things from Subversion's point of view (command-line based). Since I'm using SmartSVN as a GUI front-end, I would like to add the appropriate information from this perspective. To see the deleted file's history using SmartSVN, * Open a Repository Brow...
13,351,840
<http://jsfiddle.net/adamadam123/qv2yR/> Above is the code I'm currently working with. Below is an image of what I'm trying to achieve. ![enter image description here](https://i.stack.imgur.com/WZmWA.png) Its basically a chat box 'IM' and I have a blue & pink image and need to be able to get different amounts of tex...
2012/11/12
[ "https://Stackoverflow.com/questions/13351840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/880413/" ]
Subversion never completely deletes a file from the repository. In fact, this is a well requested feature. You do a `svn delete` or `svn rm`, and the file is no longer in the working copy. However, it is definitely still there. What's probably is convincing you that the file has been permanently removed is that you're...
In SmartSVN: Select File/Folder -> right click -> "Open in Repository Browser" -> right click on file/folder you want to remove -> "Remove..."
13,351,840
<http://jsfiddle.net/adamadam123/qv2yR/> Above is the code I'm currently working with. Below is an image of what I'm trying to achieve. ![enter image description here](https://i.stack.imgur.com/WZmWA.png) Its basically a chat box 'IM' and I have a blue & pink image and need to be able to get different amounts of tex...
2012/11/12
[ "https://Stackoverflow.com/questions/13351840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/880413/" ]
In SmartSVN: Select File/Folder -> right click -> "Open in Repository Browser" -> right click on file/folder you want to remove -> "Remove..."
I accepted David W.'s answer - it correctly described the state of things from Subversion's point of view (command-line based). Since I'm using SmartSVN as a GUI front-end, I would like to add the appropriate information from this perspective. To see the deleted file's history using SmartSVN, * Open a Repository Brow...
7,332,110
There is a strange thing happening when I execute the following code: ``` private void doStuff(Long inLong) { long theNumber = inLong; /* ... */ } ``` Sometimes I see a NullPointerException in the logs at the assignment line and I can't understand why it happens. Any idea?
2011/09/07
[ "https://Stackoverflow.com/questions/7332110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932457/" ]
You passed in null. Check what you are passing in.
if inLong is null, then NPE is the expected behaviour. ``` long theNumber = inLong; ``` is semantically equivalent to ``` long theNumber = inLong.longValue(); ``` which should make the cause of the NPE obvious.
7,332,110
There is a strange thing happening when I execute the following code: ``` private void doStuff(Long inLong) { long theNumber = inLong; /* ... */ } ``` Sometimes I see a NullPointerException in the logs at the assignment line and I can't understand why it happens. Any idea?
2011/09/07
[ "https://Stackoverflow.com/questions/7332110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932457/" ]
You passed in null. Check what you are passing in.
inLong is probably `null`. Then you try to assign a `null` reference and unbox it into a primitive type.
7,332,110
There is a strange thing happening when I execute the following code: ``` private void doStuff(Long inLong) { long theNumber = inLong; /* ... */ } ``` Sometimes I see a NullPointerException in the logs at the assignment line and I can't understand why it happens. Any idea?
2011/09/07
[ "https://Stackoverflow.com/questions/7332110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932457/" ]
inLong is probably `null`. Then you try to assign a `null` reference and unbox it into a primitive type.
That's because the inLong parameter is null. Whenever you assign a `Long` object to a `long` variable, Java automatically tries to unbox it to the proper type, but it fails if value of the Long variable is null. Just put a null-check before that assignment and you'll get rid of that error, but you may have to raise an...
7,332,110
There is a strange thing happening when I execute the following code: ``` private void doStuff(Long inLong) { long theNumber = inLong; /* ... */ } ``` Sometimes I see a NullPointerException in the logs at the assignment line and I can't understand why it happens. Any idea?
2011/09/07
[ "https://Stackoverflow.com/questions/7332110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932457/" ]
You passed in null. Check what you are passing in.
because `inLong` can be null and will not be automatically mapped to 0. I guess what you want to do is this: ``` theNumber = 0; // or Long.MIN_VALUE or Long.MAX_VALUE or whatever you prefer if (inLong != null) { theNumber = inLong; } // ... ```
7,332,110
There is a strange thing happening when I execute the following code: ``` private void doStuff(Long inLong) { long theNumber = inLong; /* ... */ } ``` Sometimes I see a NullPointerException in the logs at the assignment line and I can't understand why it happens. Any idea?
2011/09/07
[ "https://Stackoverflow.com/questions/7332110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932457/" ]
For `long theNumber = inLong;`, the long value of inLong is fetched by implicitly calling `inLong.longValue()`. This is called auto-unboxing (sometimes more general auto-boxing). When inLong is null, you therefore get a NullPointerException just like calling any other method on null. Therefore, you should think of som...
That's because the inLong parameter is null. Whenever you assign a `Long` object to a `long` variable, Java automatically tries to unbox it to the proper type, but it fails if value of the Long variable is null. Just put a null-check before that assignment and you'll get rid of that error, but you may have to raise an...
7,332,110
There is a strange thing happening when I execute the following code: ``` private void doStuff(Long inLong) { long theNumber = inLong; /* ... */ } ``` Sometimes I see a NullPointerException in the logs at the assignment line and I can't understand why it happens. Any idea?
2011/09/07
[ "https://Stackoverflow.com/questions/7332110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932457/" ]
For `long theNumber = inLong;`, the long value of inLong is fetched by implicitly calling `inLong.longValue()`. This is called auto-unboxing (sometimes more general auto-boxing). When inLong is null, you therefore get a NullPointerException just like calling any other method on null. Therefore, you should think of som...
inLong is probably `null`. Then you try to assign a `null` reference and unbox it into a primitive type.
7,332,110
There is a strange thing happening when I execute the following code: ``` private void doStuff(Long inLong) { long theNumber = inLong; /* ... */ } ``` Sometimes I see a NullPointerException in the logs at the assignment line and I can't understand why it happens. Any idea?
2011/09/07
[ "https://Stackoverflow.com/questions/7332110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932457/" ]
For `long theNumber = inLong;`, the long value of inLong is fetched by implicitly calling `inLong.longValue()`. This is called auto-unboxing (sometimes more general auto-boxing). When inLong is null, you therefore get a NullPointerException just like calling any other method on null. Therefore, you should think of som...
because `inLong` can be null and will not be automatically mapped to 0. I guess what you want to do is this: ``` theNumber = 0; // or Long.MIN_VALUE or Long.MAX_VALUE or whatever you prefer if (inLong != null) { theNumber = inLong; } // ... ```
7,332,110
There is a strange thing happening when I execute the following code: ``` private void doStuff(Long inLong) { long theNumber = inLong; /* ... */ } ``` Sometimes I see a NullPointerException in the logs at the assignment line and I can't understand why it happens. Any idea?
2011/09/07
[ "https://Stackoverflow.com/questions/7332110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/932457/" ]
inLong is probably `null`. Then you try to assign a `null` reference and unbox it into a primitive type.
if inLong is null, then NPE is the expected behaviour. ``` long theNumber = inLong; ``` is semantically equivalent to ``` long theNumber = inLong.longValue(); ``` which should make the cause of the NPE obvious.