qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
9,515,859
I have a page with a data grid and when I print it i want only the data grid to be printed. On clicking print all other elements in the page (left nav, header, footer etc) are removed and only the necessary part(which is in a div called printdiv) is displayed. But unfortunately I can't get it to display the background ...
2012/03/01
[ "https://Stackoverflow.com/questions/9515859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242577/" ]
Tokenization in C++ is often done with getline, used so: getline(input stream, string where to save it, seperator character); Try building a class for reading, that saves every line to a collection, then tokenize each line as needed and send to needed collections in an algorithm.
``` #include <string> #include <vector> using namespace std; int main() { //This is your source string string Source = "foo $RESULT :(0.2374742, 0.267722) $STATES :{1, 3, 5} fo0"; //Get the $RESULT section of the string, encapsulated by ( ) string Results = Source .substr(Source .find("(") + 1, (Source .find("...
9,515,859
I have a page with a data grid and when I print it i want only the data grid to be printed. On clicking print all other elements in the page (left nav, header, footer etc) are removed and only the necessary part(which is in a div called printdiv) is displayed. But unfortunately I can't get it to display the background ...
2012/03/01
[ "https://Stackoverflow.com/questions/9515859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242577/" ]
``` int index = s.find("RESULT: ("); int index2 = s.find("$STATE"); int length = index2 - index; if (index != string::npos) { temp = s.substr(index + 7, length - 8); } typedef tokenizer<char_separator<char> > tokenizer; char_separator<char> sep(",() "); tokenizer tokens(temp, sep); for (tokenizer::iterator tok_it...
you could use [boost tokenizer](http://www.boost.org/doc/libs/1_49_0/libs/tokenizer/index.html): it's a header only library, handy to use
9,515,859
I have a page with a data grid and when I print it i want only the data grid to be printed. On clicking print all other elements in the page (left nav, header, footer etc) are removed and only the necessary part(which is in a div called printdiv) is displayed. But unfortunately I can't get it to display the background ...
2012/03/01
[ "https://Stackoverflow.com/questions/9515859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242577/" ]
``` int index = s.find("RESULT: ("); int index2 = s.find("$STATE"); int length = index2 - index; if (index != string::npos) { temp = s.substr(index + 7, length - 8); } typedef tokenizer<char_separator<char> > tokenizer; char_separator<char> sep(",() "); tokenizer tokens(temp, sep); for (tokenizer::iterator tok_it...
Find the first acurance of the '(' and then the first of ')' sign and get the substring between the two indexes (first is the start and the length is end - start) and then you can do the same for the substring after the first ')' sign (for the states). ``` temp_str = input_str do twice { start = findChar(temp_...
9,515,859
I have a page with a data grid and when I print it i want only the data grid to be printed. On clicking print all other elements in the page (left nav, header, footer etc) are removed and only the necessary part(which is in a div called printdiv) is displayed. But unfortunately I can't get it to display the background ...
2012/03/01
[ "https://Stackoverflow.com/questions/9515859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242577/" ]
``` int index = s.find("RESULT: ("); int index2 = s.find("$STATE"); int length = index2 - index; if (index != string::npos) { temp = s.substr(index + 7, length - 8); } typedef tokenizer<char_separator<char> > tokenizer; char_separator<char> sep(",() "); tokenizer tokens(temp, sep); for (tokenizer::iterator tok_it...
Tokenization in C++ is often done with getline, used so: getline(input stream, string where to save it, seperator character); Try building a class for reading, that saves every line to a collection, then tokenize each line as needed and send to needed collections in an algorithm.
9,515,859
I have a page with a data grid and when I print it i want only the data grid to be printed. On clicking print all other elements in the page (left nav, header, footer etc) are removed and only the necessary part(which is in a div called printdiv) is displayed. But unfortunately I can't get it to display the background ...
2012/03/01
[ "https://Stackoverflow.com/questions/9515859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242577/" ]
Tokenization in C++ is often done with getline, used so: getline(input stream, string where to save it, seperator character); Try building a class for reading, that saves every line to a collection, then tokenize each line as needed and send to needed collections in an algorithm.
Find the first acurance of the '(' and then the first of ')' sign and get the substring between the two indexes (first is the start and the length is end - start) and then you can do the same for the substring after the first ')' sign (for the states). ``` temp_str = input_str do twice { start = findChar(temp_...
9,515,859
I have a page with a data grid and when I print it i want only the data grid to be printed. On clicking print all other elements in the page (left nav, header, footer etc) are removed and only the necessary part(which is in a div called printdiv) is displayed. But unfortunately I can't get it to display the background ...
2012/03/01
[ "https://Stackoverflow.com/questions/9515859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242577/" ]
you could use [boost tokenizer](http://www.boost.org/doc/libs/1_49_0/libs/tokenizer/index.html): it's a header only library, handy to use
You can use `strtok()` library function - <http://www.cplusplus.com/reference/clibrary/cstring/strtok>.
9,515,859
I have a page with a data grid and when I print it i want only the data grid to be printed. On clicking print all other elements in the page (left nav, header, footer etc) are removed and only the necessary part(which is in a div called printdiv) is displayed. But unfortunately I can't get it to display the background ...
2012/03/01
[ "https://Stackoverflow.com/questions/9515859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1242577/" ]
You can use `strtok()` library function - <http://www.cplusplus.com/reference/clibrary/cstring/strtok>.
Find the first acurance of the '(' and then the first of ')' sign and get the substring between the two indexes (first is the start and the length is end - start) and then you can do the same for the substring after the first ')' sign (for the states). ``` temp_str = input_str do twice { start = findChar(temp_...
20,739,110
I would like to add data from an html form into the database , here is my code ``` <html><?php $var1=$_POST[tag]; $var2=$_POST[name]; $var3=$_POST[surname]; echo $var1; echo $var2; echo $var3; $dbhandle=mysql_connect('localhost','root','mysql') or die ("Unable to connect to database"); mysql_select_db("arduino"); ...
2013/12/23
[ "https://Stackoverflow.com/questions/20739110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1930067/" ]
You have quotes around your `column` names, so remove those ``` //Tag,Name,Surname mysql_query("INSERT INTO door(Tag,Name,Surname) VALUES('$var1','$var2','$var3')"); ---^----^---^------^--- ``` > > Note: Your code is vulnerable to SQL injection, also `mysql_()` API is now deprecated as o...
Remove single quotes `'` from the column names in your query: ``` mysql_query("INSERT INTO door(Tag,Name,Surname) VALUES('$var1','$var2','$var3')"); ``` If your intention is to escape the column names then mysql's escape character is back tick '`'. And they are only required if the column names or table names are on...
20,739,110
I would like to add data from an html form into the database , here is my code ``` <html><?php $var1=$_POST[tag]; $var2=$_POST[name]; $var3=$_POST[surname]; echo $var1; echo $var2; echo $var3; $dbhandle=mysql_connect('localhost','root','mysql') or die ("Unable to connect to database"); mysql_select_db("arduino"); ...
2013/12/23
[ "https://Stackoverflow.com/questions/20739110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1930067/" ]
Remove single quotes `'` from the column names in your query: ``` mysql_query("INSERT INTO door(Tag,Name,Surname) VALUES('$var1','$var2','$var3')"); ``` If your intention is to escape the column names then mysql's escape character is back tick '`'. And they are only required if the column names or table names are on...
First of all i would not suggest you to use mysql but PDO or MySQLi. And your code is total vulnerable to attacks like sql injection and your db can be hacked easily. with PDO prepared statements you can use this as like ``` $pdoCon = new PDO('mysql:host=localhost;dbname=mydb', 'root', 'abc'); $stmt = $pdoCon->prepare...
20,739,110
I would like to add data from an html form into the database , here is my code ``` <html><?php $var1=$_POST[tag]; $var2=$_POST[name]; $var3=$_POST[surname]; echo $var1; echo $var2; echo $var3; $dbhandle=mysql_connect('localhost','root','mysql') or die ("Unable to connect to database"); mysql_select_db("arduino"); ...
2013/12/23
[ "https://Stackoverflow.com/questions/20739110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1930067/" ]
You have quotes around your `column` names, so remove those ``` //Tag,Name,Surname mysql_query("INSERT INTO door(Tag,Name,Surname) VALUES('$var1','$var2','$var3')"); ---^----^---^------^--- ``` > > Note: Your code is vulnerable to SQL injection, also `mysql_()` API is now deprecated as o...
First of all i would not suggest you to use mysql but PDO or MySQLi. And your code is total vulnerable to attacks like sql injection and your db can be hacked easily. with PDO prepared statements you can use this as like ``` $pdoCon = new PDO('mysql:host=localhost;dbname=mydb', 'root', 'abc'); $stmt = $pdoCon->prepare...
593,566
I am trying to compile a driver for a Netis WF2190 adapter. Yes, I just downloaded the latest from them. How can I disable the `-Werror=date-time` in the build? I can't find it anywhere in the build script so I figure it must be some global default setting. Clearly the code is just trying to embed the build date/time ...
2015/03/06
[ "https://askubuntu.com/questions/593566", "https://askubuntu.com", "https://askubuntu.com/users/385509/" ]
The date-time warning is new in gcc 4.9 I think - it is possibly turned on implicitly by `-Wall` (and turned into an error implicitly by `-Werror`). You could try turning it off explicitly using the `-Wno-` form i.e. by adding ``` -Wno-error=date-time ``` to the `CFLAGS`.
It might be better to remove the offending macro by deleting line 66 from the rtw\_debug.c file. ``` sed -i -e '66d' /home/andy/RTL8812AU_linux_v4.3.8_12175.20140902/driver/rtl8812AU_linux_v4.3.8_12175.20140902/core/rtw_debug.c ``` Now you can continue with the build: ``` cd /home/andy/RTL8812AU_linux_v4.3.8_12175...
593,566
I am trying to compile a driver for a Netis WF2190 adapter. Yes, I just downloaded the latest from them. How can I disable the `-Werror=date-time` in the build? I can't find it anywhere in the build script so I figure it must be some global default setting. Clearly the code is just trying to embed the build date/time ...
2015/03/06
[ "https://askubuntu.com/questions/593566", "https://askubuntu.com", "https://askubuntu.com/users/385509/" ]
The date-time warning is new in gcc 4.9 I think - it is possibly turned on implicitly by `-Wall` (and turned into an error implicitly by `-Werror`). You could try turning it off explicitly using the `-Wno-` form i.e. by adding ``` -Wno-error=date-time ``` to the `CFLAGS`.
I tried quite a few times adding the "Wno-error=date-time" line to the CFLAGS, but it didn't seem to work. The easiest solution by far for me was to find the file that was producing the "\_\_DATE\_\_" line by executing ``` grep -r "__DATE__" ``` which (for the source code that I'm working with) gave me the file ``...
593,566
I am trying to compile a driver for a Netis WF2190 adapter. Yes, I just downloaded the latest from them. How can I disable the `-Werror=date-time` in the build? I can't find it anywhere in the build script so I figure it must be some global default setting. Clearly the code is just trying to embed the build date/time ...
2015/03/06
[ "https://askubuntu.com/questions/593566", "https://askubuntu.com", "https://askubuntu.com/users/385509/" ]
I tried quite a few times adding the "Wno-error=date-time" line to the CFLAGS, but it didn't seem to work. The easiest solution by far for me was to find the file that was producing the "\_\_DATE\_\_" line by executing ``` grep -r "__DATE__" ``` which (for the source code that I'm working with) gave me the file ``...
It might be better to remove the offending macro by deleting line 66 from the rtw\_debug.c file. ``` sed -i -e '66d' /home/andy/RTL8812AU_linux_v4.3.8_12175.20140902/driver/rtl8812AU_linux_v4.3.8_12175.20140902/core/rtw_debug.c ``` Now you can continue with the build: ``` cd /home/andy/RTL8812AU_linux_v4.3.8_12175...
59,335,007
How do I convert a string to a dictionary, where each entry to the dictionary is assigned a value? At the minute, I have this code: ``` text = "Here's the thing. She doesn't have anything to prove, but she is going to anyway. That's just her character. She knows she doesn't have to, but she still will just to show yo...
2019/12/14
[ "https://Stackoverflow.com/questions/59335007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10447721/" ]
Don't reinvent the wheel, use an instance of a [`collections.Counter`](https://docs.python.org/3/library/collections.html#collections.Counter) in the standard library. ``` from collections import Counter def findDupeWords(text): counter = Counter(text.lower().split(" ")) for word in counter: if counte...
Well, you could replace your call to `print` with an assignment to a dictionary: ``` def findDupeWords(): duplicates = {} duplicate_counter = 0 ... #Displays the duplicate word if count is greater than 1 if(count > 1 and words[i] != "0"): duplicate_counter += 1 d...
474,976
I have a file "ingredients.txt" that has a list of 38 words (one per each line). I have figured out how to read it into an array ``` getArray() { array=() while IFS= read -r line do array+=("$line") done < "$1" } getArray "ingredients.txt" ``` But now how to get output of all combinations...
2018/10/12
[ "https://unix.stackexchange.com/questions/474976", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/164021/" ]
In Python: ``` import itertools.combinations with open('ingredients.txt') as fd: words= fd.readlines() for combination in itertools.combinations(words, 4): print(combination) ```
Well, try with below code ``` getArray() { array=() while IFS= read -r line do array+=("$line") done < "$1" for i in ${!array[@]} do if [ ${#array[$i]} == 4 ]; then echo "${array[$i]}" fi done } getArray "ingredients.txt" ```
474,976
I have a file "ingredients.txt" that has a list of 38 words (one per each line). I have figured out how to read it into an array ``` getArray() { array=() while IFS= read -r line do array+=("$line") done < "$1" } getArray "ingredients.txt" ``` But now how to get output of all combinations...
2018/10/12
[ "https://unix.stackexchange.com/questions/474976", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/164021/" ]
I tried by using python ``` >>> a ['praveen', 'ajay', 'abhi', 'chetan', 'abh', 'cat'] for i in range(0,len(a),4): ... print a[i:i+4] ... ['praveen', 'ajay', 'abhi', 'chetan'] ['abh', 'cat'] ```
Well, try with below code ``` getArray() { array=() while IFS= read -r line do array+=("$line") done < "$1" for i in ${!array[@]} do if [ ${#array[$i]} == 4 ]; then echo "${array[$i]}" fi done } getArray "ingredients.txt" ```
474,976
I have a file "ingredients.txt" that has a list of 38 words (one per each line). I have figured out how to read it into an array ``` getArray() { array=() while IFS= read -r line do array+=("$line") done < "$1" } getArray "ingredients.txt" ``` But now how to get output of all combinations...
2018/10/12
[ "https://unix.stackexchange.com/questions/474976", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/164021/" ]
Just for the fun of it, a version in plain bash (which I do not recommend using for long lists, it is quite slow (as should be expected), it takes more than two minutes to do in shell what in c gets done in half a second.): ``` #!/bin/bash - set -u readarray -t b <ingredients.txt r=${1:-3} n=${2:-5} main(){ ...
Well, try with below code ``` getArray() { array=() while IFS= read -r line do array+=("$line") done < "$1" for i in ${!array[@]} do if [ ${#array[$i]} == 4 ]; then echo "${array[$i]}" fi done } getArray "ingredients.txt" ```
474,976
I have a file "ingredients.txt" that has a list of 38 words (one per each line). I have figured out how to read it into an array ``` getArray() { array=() while IFS= read -r line do array+=("$line") done < "$1" } getArray "ingredients.txt" ``` But now how to get output of all combinations...
2018/10/12
[ "https://unix.stackexchange.com/questions/474976", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/164021/" ]
In Python: ``` import itertools.combinations with open('ingredients.txt') as fd: words= fd.readlines() for combination in itertools.combinations(words, 4): print(combination) ```
I tried by using python ``` >>> a ['praveen', 'ajay', 'abhi', 'chetan', 'abh', 'cat'] for i in range(0,len(a),4): ... print a[i:i+4] ... ['praveen', 'ajay', 'abhi', 'chetan'] ['abh', 'cat'] ```
474,976
I have a file "ingredients.txt" that has a list of 38 words (one per each line). I have figured out how to read it into an array ``` getArray() { array=() while IFS= read -r line do array+=("$line") done < "$1" } getArray "ingredients.txt" ``` But now how to get output of all combinations...
2018/10/12
[ "https://unix.stackexchange.com/questions/474976", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/164021/" ]
In Python: ``` import itertools.combinations with open('ingredients.txt') as fd: words= fd.readlines() for combination in itertools.combinations(words, 4): print(combination) ```
Just for the fun of it, a version in plain bash (which I do not recommend using for long lists, it is quite slow (as should be expected), it takes more than two minutes to do in shell what in c gets done in half a second.): ``` #!/bin/bash - set -u readarray -t b <ingredients.txt r=${1:-3} n=${2:-5} main(){ ...
44,509,375
I have multiple environments. They are debug, dev, and prod. I'd like to refer to an image by the latest dev (latest) or dev (version 1.1) or prod (latest). How would I go about tagging builds and pushes? My first thought was to create separate repositories for each environment debug, dev, and prod. But I am starting...
2017/06/12
[ "https://Stackoverflow.com/questions/44509375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184773/" ]
This is what has worked best for me and my team and I recommend it: I recommend having **a single repo per project for all environments**, it is easier to manage. Especially if you have microservices, then your project is composed by multiple microservices. Managing one repo per env per project is a pain. For example...
I think "lastest" is for the last productive image. It is what I expect in the docker hub, although there are no images in development. On the other hand you can use tags like for example 0.0.1-dev. When this image is finished you can do the tag again and push, and then the repository will detect that the layers are a...
44,509,375
I have multiple environments. They are debug, dev, and prod. I'd like to refer to an image by the latest dev (latest) or dev (version 1.1) or prod (latest). How would I go about tagging builds and pushes? My first thought was to create separate repositories for each environment debug, dev, and prod. But I am starting...
2017/06/12
[ "https://Stackoverflow.com/questions/44509375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184773/" ]
This is what has worked best for me and my team and I recommend it: I recommend having **a single repo per project for all environments**, it is easier to manage. Especially if you have microservices, then your project is composed by multiple microservices. Managing one repo per env per project is a pain. For example...
There's two schools of thought, stable tagging, where you update a single tag, and unique tagging. Each have their pros and cons. Stable tags can create instability when deploying to self healing clusters as a new node might pull a new version, while the rest of the cluster is running a slightly older version. Unique t...
44,509,375
I have multiple environments. They are debug, dev, and prod. I'd like to refer to an image by the latest dev (latest) or dev (version 1.1) or prod (latest). How would I go about tagging builds and pushes? My first thought was to create separate repositories for each environment debug, dev, and prod. But I am starting...
2017/06/12
[ "https://Stackoverflow.com/questions/44509375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184773/" ]
There's two schools of thought, stable tagging, where you update a single tag, and unique tagging. Each have their pros and cons. Stable tags can create instability when deploying to self healing clusters as a new node might pull a new version, while the rest of the cluster is running a slightly older version. Unique t...
I think "lastest" is for the last productive image. It is what I expect in the docker hub, although there are no images in development. On the other hand you can use tags like for example 0.0.1-dev. When this image is finished you can do the tag again and push, and then the repository will detect that the layers are a...
147,392
In the read world, there are many many phones(aa ae ah ao ar aw ax ay b ch d dh ...). But for brief,I only use three phones(**aa ah ae**) to illustrate my question.And it ***only need training Data,no Test Data*** in all process. There are two file, one is [**train\_forWolfram.dat(928 KB)**](https://wolfr.am/m6DMp7U1...
2017/06/01
[ "https://mathematica.stackexchange.com/questions/147392", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/15961/" ]
I find a nice way can deal with it. First thing is the same as before: ``` data = Partition[BinaryReadList["https://wolfr.am/m6DMp7U1", "Real32"], {1 + 12 + 43}]; generator = Function[<|"EmbeddingLayerInput" -> Rationalize@#[[All, 1]],"Input2" -> #[[All, 2 ;; 13]], "Output" -> #[[All, 14 ;;]]|> &@RandomSample[data, ...
I do not fully understand what you want to do with the two inputs, but here are two examples using `NetPairEmbeddingOperator` to find an embedding so that the similar objects are close in the embedding. I will use data similar to yours in the first example and some new data in the second example. Example 1 --------- ...
42,974,096
I want to create animated splash screen using gif image. I have used Glide library because it supports gif images. I have done following things to achieve this: 1. Created splash.xml with an imageview in it. ``` <ImageView android:id="@+id/iv_gif_view" android:layout_width="match_parent" android:layout_...
2017/03/23
[ "https://Stackoverflow.com/questions/42974096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Android does not support GIF so avoid using it since it is memory consuming. Glide is nice image caching library and luckily it supports gif images. I'm sharing alternate and efficient way to achieve animated splash screen. 1. Create splash.xml as usual with an image view. 2. Take out each frame from your gif image....
Try this: ``` ImageView ivImage= (ImageView) findViewById(R.id.iv_gif_view); GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(ivImage); Glide.with(this) .load(R.drawable.splash_xxhdpi_2) .into(imageViewTarget); ```
42,974,096
I want to create animated splash screen using gif image. I have used Glide library because it supports gif images. I have done following things to achieve this: 1. Created splash.xml with an imageview in it. ``` <ImageView android:id="@+id/iv_gif_view" android:layout_width="match_parent" android:layout_...
2017/03/23
[ "https://Stackoverflow.com/questions/42974096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can try this way ``` public class GifImageView extends View { private InputStream mInputStream; private Movie mMovie; private int mWidth, mHeight; private long mStart; private Context mContext; public GifImageView(Context context) { super(context); this.mContext = context...
Try this: ``` ImageView ivImage= (ImageView) findViewById(R.id.iv_gif_view); GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(ivImage); Glide.with(this) .load(R.drawable.splash_xxhdpi_2) .into(imageViewTarget); ```
42,974,096
I want to create animated splash screen using gif image. I have used Glide library because it supports gif images. I have done following things to achieve this: 1. Created splash.xml with an imageview in it. ``` <ImageView android:id="@+id/iv_gif_view" android:layout_width="match_parent" android:layout_...
2017/03/23
[ "https://Stackoverflow.com/questions/42974096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can try this way ``` public class GifImageView extends View { private InputStream mInputStream; private Movie mMovie; private int mWidth, mHeight; private long mStart; private Context mContext; public GifImageView(Context context) { super(context); this.mContext = context...
Android does not support GIF so avoid using it since it is memory consuming. Glide is nice image caching library and luckily it supports gif images. I'm sharing alternate and efficient way to achieve animated splash screen. 1. Create splash.xml as usual with an image view. 2. Take out each frame from your gif image....
18,565,634
I just logged into my EC2 via Putty on Windows and I got into my RDS instance and into one database I had created. Then I try to import a SQL dump from my machine with the following code which results into an error. ``` mysql> source C:\Users\guru\Downloads\latest.sql; ERROR: Unknown command '\U'. ERRO...
2013/09/02
[ "https://Stackoverflow.com/questions/18565634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1619619/" ]
The `Thread` constructor accepts a `Runnable` on which the `Thread` will eventually execute the `run()` method. Right now you aren't returning a `Runnable` object. you are returning `null`. So the execution you do in your `test()` and `otherTest()` methods is executed synchronously. All your execution happens in one ...
Your `Thread` implementation is *WRONG*. You should either implement `Runnable` and implement `run()` method or you should extend `Thread` class and override `run()` method. What is happening is that your `test()` method or `otherTest()` is being called just as any method calls. And since you don't have any `run()` m...
18,565,634
I just logged into my EC2 via Putty on Windows and I got into my RDS instance and into one database I had created. Then I try to import a SQL dump from my machine with the following code which results into an error. ``` mysql> source C:\Users\guru\Downloads\latest.sql; ERROR: Unknown command '\U'. ERRO...
2013/09/02
[ "https://Stackoverflow.com/questions/18565634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1619619/" ]
I think you might have better luck with this: ``` public class ThreadTest { public static void main(String args[]) throws InterruptedException { new Thread(test).start(); new Thread(test).start(); new Thread(otherTest).start(); new Thread(test).start(); new Thread(otherTest).start(); new Thread...
Your `Thread` implementation is *WRONG*. You should either implement `Runnable` and implement `run()` method or you should extend `Thread` class and override `run()` method. What is happening is that your `test()` method or `otherTest()` is being called just as any method calls. And since you don't have any `run()` m...
18,565,634
I just logged into my EC2 via Putty on Windows and I got into my RDS instance and into one database I had created. Then I try to import a SQL dump from my machine with the following code which results into an error. ``` mysql> source C:\Users\guru\Downloads\latest.sql; ERROR: Unknown command '\U'. ERRO...
2013/09/02
[ "https://Stackoverflow.com/questions/18565634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1619619/" ]
The `Thread` constructor accepts a `Runnable` on which the `Thread` will eventually execute the `run()` method. Right now you aren't returning a `Runnable` object. you are returning `null`. So the execution you do in your `test()` and `otherTest()` methods is executed synchronously. All your execution happens in one ...
You need to implement your `test` and `otherTest` methods as `Runnable` implementations. Like so: ``` private static class Test implements Runnable { @Override public void run() { try { Thread.sleep((long) (Math.random()*1000)); } catch (InterruptedException e) { Thread....
18,565,634
I just logged into my EC2 via Putty on Windows and I got into my RDS instance and into one database I had created. Then I try to import a SQL dump from my machine with the following code which results into an error. ``` mysql> source C:\Users\guru\Downloads\latest.sql; ERROR: Unknown command '\U'. ERRO...
2013/09/02
[ "https://Stackoverflow.com/questions/18565634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1619619/" ]
I think you might have better luck with this: ``` public class ThreadTest { public static void main(String args[]) throws InterruptedException { new Thread(test).start(); new Thread(test).start(); new Thread(otherTest).start(); new Thread(test).start(); new Thread(otherTest).start(); new Thread...
You need to implement your `test` and `otherTest` methods as `Runnable` implementations. Like so: ``` private static class Test implements Runnable { @Override public void run() { try { Thread.sleep((long) (Math.random()*1000)); } catch (InterruptedException e) { Thread....
325,763
I use [Sessions](https://sessions-extension.github.io/Sessions/) to keep track of browsing sessions in Safari. I was having some trouble with invalid cookies and I cleared my web history. Now all of my saved Sessions are gone. Is there any way to recover the data? Where does Sessions store it's data? I may have a backu...
2018/05/19
[ "https://apple.stackexchange.com/questions/325763", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/37876/" ]
If you go to Sessions "Help" (in the gear menu), there are two questions relevant to your issue: > > Why did my saved sessions disappear when I reset Safari or cleared its > history? > > > The option to remove website data, available when either resetting > Safari or clearing its history, will delete extension da...
Sessions seems to store its data in the browser's javascript database which, per [this stackoverflow posting](https://stackoverflow.com/a/4735298/318902), is in `~/Library/Safari/Databases`. In fact, I see a directory in mine called something like `safari-extension_yoo.david.sessions-<random number>`. The contents app...
54,940,299
I have created a sample project and have Azure server to maintain resources and security at same time. In my ASP web application i want to create Login system and i want it to protect using Azure security vault. Basically i want to store them in Azure vault. I have gone through understand of keys and secrets and Azure ...
2019/03/01
[ "https://Stackoverflow.com/questions/54940299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11134776/" ]
Do not store user credentials in Key Vault. That is not its purpose. If you store passwords, you need to store them in a database after hashing them securely. Lot of emphasis on securely. There should never be a way for you to recover a user's password.
If you are trying to keep the user information inside azure and use it in your application, what is need is Azure Active Directory. You can have a look at the [examples on how to implement AD](https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-v1-aspnet-webapp) in mvc project. You use Azure K...
34,972,340
I save phone number in Database using Spring Data JPA , In model I define this `private String directPhone;` while saving `supplier.directPhone="99250397679"` And In DB it save in exponential Form It save in this form `direct_phone: 9.925039767E9` ``` Supplier supplier=supplierRepository.findOne(new Long(1)); ...
2016/01/24
[ "https://Stackoverflow.com/questions/34972340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2019109/" ]
**Update**: You loop through the file's contents *twice*: ``` with open(filename, 'r') as file: #... with open(filename, 'r') as file: #... ``` The first time you add all the "valid" lines to an array, namely `names_list` (why this identifier?). The second time you just print the number of words in *ea...
I think you meant [`.split()`](https://docs.python.org/2/library/string.html) instead of [`.strip()`](https://docs.python.org/2/library/stdtypes.html#str.strip). Replace: ``` words = len(line.strip(' ')) ``` with: ``` words = len(line.split()) ```
34,972,340
I save phone number in Database using Spring Data JPA , In model I define this `private String directPhone;` while saving `supplier.directPhone="99250397679"` And In DB it save in exponential Form It save in this form `direct_phone: 9.925039767E9` ``` Supplier supplier=supplierRepository.findOne(new Long(1)); ...
2016/01/24
[ "https://Stackoverflow.com/questions/34972340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2019109/" ]
Use `words = len(line.split(' '))` instead of `words = len(line.strip(' '))`. Update: Instead of the second opening of the file, use: `for name in names_list:` Update2: You can simplify this further with: ``` with open(filename, 'r') as file: for line in file: print(len(line.strip().split())) ```
I think you meant [`.split()`](https://docs.python.org/2/library/string.html) instead of [`.strip()`](https://docs.python.org/2/library/stdtypes.html#str.strip). Replace: ``` words = len(line.strip(' ')) ``` with: ``` words = len(line.split()) ```
34,972,340
I save phone number in Database using Spring Data JPA , In model I define this `private String directPhone;` while saving `supplier.directPhone="99250397679"` And In DB it save in exponential Form It save in this form `direct_phone: 9.925039767E9` ``` Supplier supplier=supplierRepository.findOne(new Long(1)); ...
2016/01/24
[ "https://Stackoverflow.com/questions/34972340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2019109/" ]
**Update**: You loop through the file's contents *twice*: ``` with open(filename, 'r') as file: #... with open(filename, 'r') as file: #... ``` The first time you add all the "valid" lines to an array, namely `names_list` (why this identifier?). The second time you just print the number of words in *ea...
Use `words = len(line.split(' '))` instead of `words = len(line.strip(' '))`. Update: Instead of the second opening of the file, use: `for name in names_list:` Update2: You can simplify this further with: ``` with open(filename, 'r') as file: for line in file: print(len(line.strip().split())) ```
45,240,294
Can someone guide me how I can achieve the following: I am using selenium web driver java. Whenever I click the preview button on the webpage, the pdf is opened in a new browser and I need to save that pdf with the name given dynamically. So far I am able to click the preview button and a new browser is opened with ...
2017/07/21
[ "https://Stackoverflow.com/questions/45240294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5865526/" ]
You can try this code :-I think this is what you are looking for. let me know If this what you are expecting. ``` System.setProperty("webdriver.gecko.driver", "D:/geckodriver.exe"); WebDriver driver = new FirefoxDriver(); driver.manage().window().maximize(); driver.get("http://www.adobe.com/content/dam/Ado...
I think you should try to download the file immediately instead of trying to manage that browse window. You can set the attribute `download` of the `a` element, and then click on the element. See code below: ``` WebElement pdf = driver.findElement(By.cssSelector("a")); String script = "arguments[0].setAttribute('dow...
18,038,870
Whenever my app chooses a "random" card, it always follows the same strange pattern : Clubs only 1-3, Diamonds 4-6, Hearts 7-9, Spades 10-12. The suits are always in that number range and never change. Each suite is supposed to be allowed to go to 13! Please help me solve thing perplexing problem, thanks! Source: ``...
2013/08/04
[ "https://Stackoverflow.com/questions/18038870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2649633/" ]
You are running into a slight variation on the problem that many people have with `Random`. The default constructor is initialized with a seed that is based on `Environment.TickCount`. If you create two instances quickly they will end up with the same seed because the system timer has not updated. Thus both instances p...
If `CardValues` and `CardSuites` are enums, all that code can be effectively replaced with ``` static Random random = new Random(); static Card RandomCardDraw() { var suite = random.Next(5); var value = random.Next(14); return Card { x = suite + 1, y = value + 1, su...
73,811,997
When failing to launch an `exec` command - I can only get a bad return code from the `exec` - how can I also get the stderr? ``` #include <stdio.h> #include <unistd.h> int main(){ char* argv[] = {"bla", NULL}; execvp(argv[0], argv); printf("exec failed\n"); return 0; } ``` In this snippet the `print...
2022/09/22
[ "https://Stackoverflow.com/questions/73811997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3512538/" ]
You need to `#include <errno.h>`, you can also use `perror()` to get more information about the error: ``` #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> int main(void) { char* argv[] = {"bla", NULL}; execvp(argv[0], argv); perror("execvp"); fprintf(stderr, "errno: %d\n...
Search with keywords "c exec stderr", you can get many mature solution. Here is the top answer. [stackoverflow - R Samuel Klatchko - Redirecting exec output to a buffer or file](https://stackoverflow.com/a/2605313/5628643)
30,146,123
I have close to 100 XML files containing various stored procedure names within the tag . Each file may contain more than one SP or the same repeating again. ``` <DataSourceName>SQL300</DataSourceName> <CommandType>StoredProcedure</CommandType> <CommandText>dbDummy.dbo.abc456Audit </CommandText> ``` I to...
2015/05/09
[ "https://Stackoverflow.com/questions/30146123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2939050/" ]
You can try the below code: ``` use strict; use warnings; use Excel::Writer::XLSX; my $dir = $ARGV[0]; opendir(DIR, "$dir") || die "Couldn't open the directory - $!"; my @files = grep(/\.xml$/,readdir(DIR)); my $OutFile = "Output". "\." . "xlsx"; my $workbook = Excel::Writer::XLSX->new($OutFile); my $worksheet = $...
@Praveen' Perl solution is better (more robust, and produces richer excel); Following a simple command to build a tab-separated-value that probably will do the job: ``` ( echo -e "file\tSP" ; grep -PoH '(?<=<CommandText>).*?(?=<)' *.xml | tr ':' '\t' ) > stored_proc.tsv ``` If you prefer a `xls` file: ``` ss...
71,333,618
I am trying to parse a large text file and split it up into single words using strtok. The delimiters remove all special characters, whitespace, and new lines. For some reason when I printf() it, it only prints the first word and a bunch of (null) for the rest. ```cpp ifstream textstream(textFile); string text...
2022/03/03
[ "https://Stackoverflow.com/questions/71333618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18361715/" ]
Rather than jumping through the hoops necessary to use `strtok`, I'd write a little replacement that works directly with strings, without modifying its input, something on this general order: ```cpp std::vector<std::string> tokenize(std::string const &input, std::string const &delims = " ") { std::vector<std::stri...
Move `printf` two lines UP. ``` while (word != nullptr && wordCount(struct_ptr->dictRootNode, word) > struct_ptr->minNumOfWordsWithAPrefixForPrinting) { printf("%s", word); MyFile << word << ' ' << wordCount(struct_ptr->dictRootNode, word) << '\n'; // writes each word and number of times it appears as a prefix...
71,333,618
I am trying to parse a large text file and split it up into single words using strtok. The delimiters remove all special characters, whitespace, and new lines. For some reason when I printf() it, it only prints the first word and a bunch of (null) for the rest. ```cpp ifstream textstream(textFile); string text...
2022/03/03
[ "https://Stackoverflow.com/questions/71333618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18361715/" ]
Rather than jumping through the hoops necessary to use `strtok`, I'd write a little replacement that works directly with strings, without modifying its input, something on this general order: ```cpp std::vector<std::string> tokenize(std::string const &input, std::string const &delims = " ") { std::vector<std::stri...
As @j23 pointed out, your `printf` is in the wrong location. As @Jerry-Coffin points out, there are more c++-ish and modern ways to accomplish, what you try to do. Next to avoiding mutation, you can also avoid copying the words out of the text string. (In my code below, we read line by line, but if you know your whole...
15,044,724
Basically I have set up some members on the database side, I have also done a registration form where it posts the data to the database, but the problem I'm having is that my program will not start the activity. When I comment out the httppost parts it works, so I believe that my problem is all to do with the PHP file,...
2013/02/23
[ "https://Stackoverflow.com/questions/15044724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2103036/" ]
The simple way to have key/value in a SimpleComboBox is to use a ListStore with type BaseModel. BaseModel allows you to save data as key/value like following: ``` SimpleComboBox combo = new SimpleComboBox(); ListStore<BaseModel> store = new ListStore<BaseModel>(); combo.setStore(store); combo.setDisplayField("name");...
``` // MySimpleComboBox extends SimpleComboBox public MySimpleComboBox(){ super(new ListStore<Person>(new ModelKeyProvider<Person>() { @Override public String getKey(Person item) { return item.id(); } }), new LabelProvider<Person>() { @Override public String g...
34,638,414
I am using Binary Formatter to save/load data from a file. I have a library system, with two concrete classes - `Users` and `Items` - and an `abstract` class - Library. I am also using two lists: ``` List<Item> items = new List<Item>(); List<User> users = new List<User>(); public static void Serialize(object value, s...
2016/01/06
[ "https://Stackoverflow.com/questions/34638414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5668504/" ]
Abandon `Collection`; the interface isn't flexible enough to give you the ability to select an element by index. Abandon `HashSet`; `Set`s in general don't support random indexing. You'll want to use a `List`, and make use of [`Collections#shuffle`](https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html...
Converting a `Collection` [to an array](https://stackoverflow.com/questions/3293946/the-easiest-way-to-transform-collection-to-array) and then accessing a random cell would likely make for more compact code, but possibly less performant code. Let's consider the case that the `Collection` you're going to convert `toArr...
34,638,414
I am using Binary Formatter to save/load data from a file. I have a library system, with two concrete classes - `Users` and `Items` - and an `abstract` class - Library. I am also using two lists: ``` List<Item> items = new List<Item>(); List<User> users = new List<User>(); public static void Serialize(object value, s...
2016/01/06
[ "https://Stackoverflow.com/questions/34638414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5668504/" ]
Abandon `Collection`; the interface isn't flexible enough to give you the ability to select an element by index. Abandon `HashSet`; `Set`s in general don't support random indexing. You'll want to use a `List`, and make use of [`Collections#shuffle`](https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html...
`Collection` doesn't allow direct access to elements by index. It is the most generic interface of the JDK collection classes and thus covers both ordered and unordered lists. If you insist on using the `Collection` interface, something like this should work, which is similar to your code but more generic: ``` public...
192,551
**Side note: This is for an actual nation roleplay, and there is QUITE a bit of leeway there, but I highly recommend you base your answer on science. It's fine if you don't, but please try.** The Fortnite Zero Point is this big ball that has *unimaginable* energy. In a way, I thought of an idea like that. Let's just c...
2020/12/22
[ "https://worldbuilding.stackexchange.com/questions/192551", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/81449/" ]
It's a very, very, very small [white hole](https://en.wikipedia.org/wiki/White_hole). That is, there's a black hole out there with the usual gravity field: nothing that falls in can escape, including light. Tidal forces will tear apart anything that tries. Consequently as the remnants fall through space and time until...
**Nuclear reactor with extra steps** I am one of those people who do not know what that "Fortnite Zero point" is, but what you have described here kinda fills the bill of a nuclear reactor. By your rules: * Cannot exponentially gain energy (energy put into it makes it generate faster, but there has to be a way to st...
192,551
**Side note: This is for an actual nation roleplay, and there is QUITE a bit of leeway there, but I highly recommend you base your answer on science. It's fine if you don't, but please try.** The Fortnite Zero Point is this big ball that has *unimaginable* energy. In a way, I thought of an idea like that. Let's just c...
2020/12/22
[ "https://worldbuilding.stackexchange.com/questions/192551", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/81449/" ]
Let's begin with the obvious frame challenge here: **It WILL emit radiation**. Anything that releases energy is releasing some form of radiation, it is how the radiation acts that actually matters. The real question is what kind of radiation you are emitting and how you are generating it. First of all, there are many ...
**Nuclear reactor with extra steps** I am one of those people who do not know what that "Fortnite Zero point" is, but what you have described here kinda fills the bill of a nuclear reactor. By your rules: * Cannot exponentially gain energy (energy put into it makes it generate faster, but there has to be a way to st...
192,551
**Side note: This is for an actual nation roleplay, and there is QUITE a bit of leeway there, but I highly recommend you base your answer on science. It's fine if you don't, but please try.** The Fortnite Zero Point is this big ball that has *unimaginable* energy. In a way, I thought of an idea like that. Let's just c...
2020/12/22
[ "https://worldbuilding.stackexchange.com/questions/192551", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/81449/" ]
**Nuclear reactor with extra steps** I am one of those people who do not know what that "Fortnite Zero point" is, but what you have described here kinda fills the bill of a nuclear reactor. By your rules: * Cannot exponentially gain energy (energy put into it makes it generate faster, but there has to be a way to st...
**A zero point reactor will use zero point energy.** <https://en.wikipedia.org/wiki/Zero-point_energy> That's why they call it that, right? The TV show Stargate had Z-point energy generators that were about the size of footballs. I am sure this is where Fortnite got the idea. > > Zero-point energy (ZPE) is the lowe...
192,551
**Side note: This is for an actual nation roleplay, and there is QUITE a bit of leeway there, but I highly recommend you base your answer on science. It's fine if you don't, but please try.** The Fortnite Zero Point is this big ball that has *unimaginable* energy. In a way, I thought of an idea like that. Let's just c...
2020/12/22
[ "https://worldbuilding.stackexchange.com/questions/192551", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/81449/" ]
It's a very, very, very small [white hole](https://en.wikipedia.org/wiki/White_hole). That is, there's a black hole out there with the usual gravity field: nothing that falls in can escape, including light. Tidal forces will tear apart anything that tries. Consequently as the remnants fall through space and time until...
Let's begin with the obvious frame challenge here: **It WILL emit radiation**. Anything that releases energy is releasing some form of radiation, it is how the radiation acts that actually matters. The real question is what kind of radiation you are emitting and how you are generating it. First of all, there are many ...
192,551
**Side note: This is for an actual nation roleplay, and there is QUITE a bit of leeway there, but I highly recommend you base your answer on science. It's fine if you don't, but please try.** The Fortnite Zero Point is this big ball that has *unimaginable* energy. In a way, I thought of an idea like that. Let's just c...
2020/12/22
[ "https://worldbuilding.stackexchange.com/questions/192551", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/81449/" ]
It's a very, very, very small [white hole](https://en.wikipedia.org/wiki/White_hole). That is, there's a black hole out there with the usual gravity field: nothing that falls in can escape, including light. Tidal forces will tear apart anything that tries. Consequently as the remnants fall through space and time until...
**A zero point reactor will use zero point energy.** <https://en.wikipedia.org/wiki/Zero-point_energy> That's why they call it that, right? The TV show Stargate had Z-point energy generators that were about the size of footballs. I am sure this is where Fortnite got the idea. > > Zero-point energy (ZPE) is the lowe...
192,551
**Side note: This is for an actual nation roleplay, and there is QUITE a bit of leeway there, but I highly recommend you base your answer on science. It's fine if you don't, but please try.** The Fortnite Zero Point is this big ball that has *unimaginable* energy. In a way, I thought of an idea like that. Let's just c...
2020/12/22
[ "https://worldbuilding.stackexchange.com/questions/192551", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/81449/" ]
Let's begin with the obvious frame challenge here: **It WILL emit radiation**. Anything that releases energy is releasing some form of radiation, it is how the radiation acts that actually matters. The real question is what kind of radiation you are emitting and how you are generating it. First of all, there are many ...
**A zero point reactor will use zero point energy.** <https://en.wikipedia.org/wiki/Zero-point_energy> That's why they call it that, right? The TV show Stargate had Z-point energy generators that were about the size of footballs. I am sure this is where Fortnite got the idea. > > Zero-point energy (ZPE) is the lowe...
6,290,147
So, for my final year project, I'm using Video4Linux2 to pull YUV420 images from a camera, parse them through to x264 (which uses these images natively), and then send the encoded stream via Live555 to an RTP/RTCP compliant video player on a client over a wireless network. All of this I'm trying to do in real-time, so ...
2011/06/09
[ "https://Stackoverflow.com/questions/6290147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/392489/" ]
There is no need for three separate `mmap`s. Simply `mmap` once, then compute the base pointer for each plane relative to the base pointer of the whole map. **Edit:** You need something like this: ``` unsigned char *y = mmap(...); /* map total size of all 3 planes */ unsigned char *u = y + y_height*y_bytes_per_line; ...
If I understood what you want: you can't make mmap 'uninterleave' sequential memory into separate pointers. You have to mmap a single memory block and manually calculate the appropriate offset within the buffer? (But: there's absolutely NO REASON for not being able to mmap the same fd several times. You never said wha...
45,494,924
Given the Model class below: ``` from django.db import models class User(models.Model): friends = models.ManyToManyField('self', symmetrical=False, blank=True) ``` If I have a QuerySet of n Users, at least one of which has two friends, and retrieve the User by filtering that QuerySet by a friends id and perform...
2017/08/03
[ "https://Stackoverflow.com/questions/45494924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1597697/" ]
If you use a ManyToMany relationship, you get a new table to store relationships between two tables. yourapplabel\_user\_friends example =================================== ``` id | from_user_id | to_user_id | 1 1 2 2 2 1 3 1 1 4 3 1 ``` User.objects...
They're different because the **two queries dont mean the same thing**! `user.values_list('friends', flat=True)` ...returns the ID's of friends of **user** `user.first().friends.values_list('id', flat=True)` ...returns the ID's of friends of the **first friend of 'user'**. In other words, you're actually looking up t...
16,504,333
Novice here attempting to understand inheritance. If I initialize a new object with several properties and I want other classes to help assign values to those properties, do I need to create instances of those other classes? Visualized: ``` -(ObjA *)init{ self = [super init]; self.property1 = [method from Clas...
2013/05/12
[ "https://Stackoverflow.com/questions/16504333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2255281/" ]
> > In other words, assuming Class A, B, and C need to know what Object A > is > > > **NO**. --- You can simply call a method from ClassA/B/C etc. But the return type must match with respective `property`. Let, the `property1` is for kind `NSString` then your `ClassA` method must be ``` -(NSString *)methodCl...
``` assuming Class A, B, and C need to know what Object A is ``` The initialization code of an object should be self contained, unless it is using functionality owned by a different object, in which case the object acts as a client of that functionality. That is, objectA acts as client of A,B,C (as seen in your code)...
2,255
I have an object with a high non manifold edge count. Is there a way to resolve them automatically or a way to make it easier to solve them manually? Some of them are edges without a face and others are cubes connected to the object by one edge. The object have a high polygon count because it is the result of various ...
2013/08/09
[ "https://blender.stackexchange.com/questions/2255", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/1055/" ]
Re-topology is the best option, since it will generate a clean mesh for 3d printing and will consume less time then removing unwanted cubes, edges etc. In given situation, I'll first delete half of my model and add a mirror modifier to it. covert my mesh to Quads and remove extraneous edges and vertices manually. Use...
You can select all non-manifold edges/vertices by pressing `Ctrl` + `Alt` + `Shift` + `M`. I don't know if this works for 3D printing, but you make it so *Select non-manifold edges* does not select those edges by making them separate: ![enter image description here](https://i.stack.imgur.com/qWa8k.png) So the cubes ...
2,255
I have an object with a high non manifold edge count. Is there a way to resolve them automatically or a way to make it easier to solve them manually? Some of them are edges without a face and others are cubes connected to the object by one edge. The object have a high polygon count because it is the result of various ...
2013/08/09
[ "https://blender.stackexchange.com/questions/2255", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/1055/" ]
Re-topology is the best option, since it will generate a clean mesh for 3d printing and will consume less time then removing unwanted cubes, edges etc. In given situation, I'll first delete half of my model and add a mirror modifier to it. covert my mesh to Quads and remove extraneous edges and vertices manually. Use...
If your concerned about non-manifold edges then you plan to 3D print this model. In that case I would add some "material" to the edges being joined. By that I mean some solid printed material that will hold the pieces together rather than a flimsy paper thin join that can break easily. Start by separating the joined e...
2,255
I have an object with a high non manifold edge count. Is there a way to resolve them automatically or a way to make it easier to solve them manually? Some of them are edges without a face and others are cubes connected to the object by one edge. The object have a high polygon count because it is the result of various ...
2013/08/09
[ "https://blender.stackexchange.com/questions/2255", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/1055/" ]
If your concerned about non-manifold edges then you plan to 3D print this model. In that case I would add some "material" to the edges being joined. By that I mean some solid printed material that will hold the pieces together rather than a flimsy paper thin join that can break easily. Start by separating the joined e...
You can select all non-manifold edges/vertices by pressing `Ctrl` + `Alt` + `Shift` + `M`. I don't know if this works for 3D printing, but you make it so *Select non-manifold edges* does not select those edges by making them separate: ![enter image description here](https://i.stack.imgur.com/qWa8k.png) So the cubes ...
20,587,401
Not sure if this is possible, but it's always worth asking. I've simplified the problem below - basically, I want to use a for loop to create multiple entities of the same kind. The problem seems to be that I can't name a new entity by calling a variable. Can anybody think of a way round this problem? Any help would ...
2013/12/14
[ "https://Stackoverflow.com/questions/20587401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2839573/" ]
Assuming you are trying to create 7 entities of type `E15` with key names "0" through "6" ``` DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); for (Integer n = 0 ; n < 7 ; ++n ) { Entity entity = new Entity("E15", n.toString()); datastore.put(entity); } ``` The last bit is importan...
You can create an entity by aslo giving it key\_name or id: ``` Entity entry = new Entity("E15", key_name, roomkey); ``` or, ``` Entity entry = new Entity("E15", id, roomkey); ``` and later you can get the entity: ``` Key key = KeyFactory.createKey(roomkey, "E15", id); Entity entry = datastore.get(key); ```
20,587,401
Not sure if this is possible, but it's always worth asking. I've simplified the problem below - basically, I want to use a for loop to create multiple entities of the same kind. The problem seems to be that I can't name a new entity by calling a variable. Can anybody think of a way round this problem? Any help would ...
2013/12/14
[ "https://Stackoverflow.com/questions/20587401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2839573/" ]
Assuming you are trying to create 7 entities of type `E15` with key names "0" through "6" ``` DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); for (Integer n = 0 ; n < 7 ; ++n ) { Entity entity = new Entity("E15", n.toString()); datastore.put(entity); } ``` The last bit is importan...
``` Entity entity = new Entity("YourKindName",String|Long); Entity entity = new Entity("YourKindName",""+x);//using string as key //or Entity entity = new Entity("YourKindName",x);//using number as key ```
5,255
This is part of my quest how to test my tests and test data. I looked at the techniques that would help improve my test cases. While *code/branch coverage* can tell me whether my test suites cover my code base sufficiently, it will not tell me whether my test oracles are able to detect all faults. So, here comes [mutat...
2012/11/24
[ "https://sqa.stackexchange.com/questions/5255", "https://sqa.stackexchange.com", "https://sqa.stackexchange.com/users/1933/" ]
I'm the author of one of the tools for Java (<http://pitest.org>). I have found mutation testing useful in practice, working on large legacy corporate code bases and smaller test driven projects. I've seen a lot of dismissals of the value of mutation testing such as Bj Rollison's answer. I generally don't disagree wi...
Mutation testing is generally interesting from an academic perspective. I have never seen or heard of anyone using mutation testing on software that is delivered to customers on a schedule. The time and expense involved in mutation testing is huge compared to the perceived value returned. In complex projects with sever...
5,255
This is part of my quest how to test my tests and test data. I looked at the techniques that would help improve my test cases. While *code/branch coverage* can tell me whether my test suites cover my code base sufficiently, it will not tell me whether my test oracles are able to detect all faults. So, here comes [mutat...
2012/11/24
[ "https://sqa.stackexchange.com/questions/5255", "https://sqa.stackexchange.com", "https://sqa.stackexchange.com/users/1933/" ]
Mutation testing is generally interesting from an academic perspective. I have never seen or heard of anyone using mutation testing on software that is delivered to customers on a schedule. The time and expense involved in mutation testing is huge compared to the perceived value returned. In complex projects with sever...
Mutation testing has been used in some small systems e.g.: see article ["An intuitive approach to determine test adequacy in safety-critical software"](http://se.kaist.ac.kr/wp-content/uploads/2013/03/An-Intuitive-Approach-to-Determine-Test-Adequacy-in-Safety-critical-Software.pdf). Here's the abstract: > > Safety-cr...
5,255
This is part of my quest how to test my tests and test data. I looked at the techniques that would help improve my test cases. While *code/branch coverage* can tell me whether my test suites cover my code base sufficiently, it will not tell me whether my test oracles are able to detect all faults. So, here comes [mutat...
2012/11/24
[ "https://sqa.stackexchange.com/questions/5255", "https://sqa.stackexchange.com", "https://sqa.stackexchange.com/users/1933/" ]
I'm the author of one of the tools for Java (<http://pitest.org>). I have found mutation testing useful in practice, working on large legacy corporate code bases and smaller test driven projects. I've seen a lot of dismissals of the value of mutation testing such as Bj Rollison's answer. I generally don't disagree wi...
Mutation testing has been used in some small systems e.g.: see article ["An intuitive approach to determine test adequacy in safety-critical software"](http://se.kaist.ac.kr/wp-content/uploads/2013/03/An-Intuitive-Approach-to-Determine-Test-Adequacy-in-Safety-critical-Software.pdf). Here's the abstract: > > Safety-cr...
23,707,392
I'm trying to compare libpqxx [`c_str`](http://pqxx.org/devprojects/libpqxx/doc/2.6.8/html/Reference/a00256.html#8123fd1430eb4cfaa1f5095b44ceae86) values. If I try to compare them directly, `result1[0][0].c_str() == result2[0][0].c_str()`, for example, they do not `return true` when they have the same string values. T...
2014/05/17
[ "https://Stackoverflow.com/questions/23707392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
It happens because `std::string` is a class, while `const char*` (the type returned by `c_str`) is, well, a pointer type. Comparing pointers returns `true` if the pointers point to the same memory location. Classes, on the other hand, can define what equality means to them. Since `string`s and `const char*` are fairly...
Just use `c_str()`, too! ``` if (strcmp(result1[0][0].c_str(), some_std_string.c_str()) == 0) { ... ``` or use `operator ==` of `std::string` ``` if (result1[0][0].c_str() == some_std_string) ```
34,053,195
I'm creating a modal dialog and trying to read the fields back when the dialog is closed, but when the input is edited, the ng-model for the input field is being set to undefined. With the [Plunk](http://plnkr.co/edit/f5IkjzoN6IjewGl4RDJq), if you click the dialog button and then press Ok without modifying the text fie...
2015/12/02
[ "https://Stackoverflow.com/questions/34053195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4130999/" ]
You have declared input `type="email"` in your input field in modal ``` <input id="emailInput" type="email" class="form-control" ng-model="user.email"> ``` It'll pass value if data according to email . like `a@b.com` You can check if data has valid email HTML ``` <form name="myForm"> <input type="email" name="...
The reason it's being set to undefined is because you have the input for the email address as type=email. If you put anything but a valid email address in that field user.email will be set to undefined. I just ran your plunker and put in a valid email address and can see it's has been set correctly. This is an instanc...
15,772,375
i am learning php as well as doing a project that involves uploading files to the server. My goal is to make it as secure as possible so where do you recommend saving all the uploaded files. The files to be uploaded will all be pdf files. I read somewhere it's better to save uploaded files outside document root and in ...
2013/04/02
[ "https://Stackoverflow.com/questions/15772375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/734861/" ]
A list of the lengths of each element in a list: ``` lengths = [len(i) for i in my_list] ``` For the average: ``` def averageLen(lst): lengths = [len(i) for i in lst] return 0 if len(lengths) == 0 else (float(sum(lengths)) / len(lengths)) ``` If it's a list of lists: ``` lengths = [averageLen(i) for i i...
First, iterating over a list in python only copies the value of each item into a temporary variable. So in fact, in your example, `k` is assigned a value of each item in the list, but changing it doesn't change the original list. Second, it seems that you tried to map each item in the list to its length, and not to the...
264,546
I am going through the following blog on LSTM neural network: <http://machinelearningmastery.com/understanding-stateful-lstm-recurrent-neural-networks-python-keras/> The author reshapes the input vector X as [samples, time steps, features] for different configuration of LSTMs. The author writes > > Indeed, the seq...
2017/02/28
[ "https://stats.stackexchange.com/questions/264546", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/78390/" ]
I found this just below the [samples, time\_steps, features] you are concerned with. ``` X = numpy.reshape(dataX, (len(dataX), seq_length, 1)) ``` **Samples** - This is the len(dataX), or the amount of data points you have. **Time steps** - This is equivalent to the amount of time steps you run your recurrent neur...
It's a bit too late but just in case; A **Sample** may refer to individual training examples. A “batch\_size” variable is hence the count of samples you sent to the neural network. That is, how many different examples you feed at once to the neural network. **TimeSteps** are ticks of time. It is how long in time ea...
264,546
I am going through the following blog on LSTM neural network: <http://machinelearningmastery.com/understanding-stateful-lstm-recurrent-neural-networks-python-keras/> The author reshapes the input vector X as [samples, time steps, features] for different configuration of LSTMs. The author writes > > Indeed, the seq...
2017/02/28
[ "https://stats.stackexchange.com/questions/264546", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/78390/" ]
I found this just below the [samples, time\_steps, features] you are concerned with. ``` X = numpy.reshape(dataX, (len(dataX), seq_length, 1)) ``` **Samples** - This is the len(dataX), or the amount of data points you have. **Time steps** - This is equivalent to the amount of time steps you run your recurrent neur...
My answer with an example: ["hello this is xyz","how are you doing","great man..."] in this case "[samples, time steps, features]" means: * **sample:** 3 because there are 3 elements in the list * **time steps:** here you can take max\_length = 4 length("hello this is xyz") = 4; length("how are you doing") = 4; leng...
14,107,049
There is a recursive implementation of computing factorial N on Perl. ``` sub fact { my ($n) = shift; return $n if $n <= 2; return $n * fact($n - 1); } ``` Can someone explain me where Perl holds intermediate results before function gives a result? **UPD** and how I can see them by using debugger or by use so...
2013/01/01
[ "https://Stackoverflow.com/questions/14107049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1803586/" ]
The scalar returned by `$n` is stored on the stack. This is what the stack looks like just before calling `fact`: * Scalar returned by `$n` in recursion level 0 * List: + Scalar returned by `$n` in recursion level 1 + List: - Scalar returned by `$n` in recursion level 2 - List: * Scalar returned by `$n-1` in...
Intermediate results of any call are kept on the stack, just like local variables within a function. ``` return $n * fact($n - 1); ``` is processed equivalently to: ``` my $temp = fact($n - 1); return $n * $temp; ``` UPDATE: I see you're also interested in where the product is held before returning it. That's als...
14,107,049
There is a recursive implementation of computing factorial N on Perl. ``` sub fact { my ($n) = shift; return $n if $n <= 2; return $n * fact($n - 1); } ``` Can someone explain me where Perl holds intermediate results before function gives a result? **UPD** and how I can see them by using debugger or by use so...
2013/01/01
[ "https://Stackoverflow.com/questions/14107049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1803586/" ]
With the recursion any of the arguments that are passed in each call go on the call frame/ stack. By using Carp & cluck you can see the call frames. Intermediate results are calculated while the stack unwinds on reaching the base case ($v == 1). Could it be in CPU register only? And operator (\*) multiplies this interm...
Intermediate results of any call are kept on the stack, just like local variables within a function. ``` return $n * fact($n - 1); ``` is processed equivalently to: ``` my $temp = fact($n - 1); return $n * $temp; ``` UPDATE: I see you're also interested in where the product is held before returning it. That's als...
14,107,049
There is a recursive implementation of computing factorial N on Perl. ``` sub fact { my ($n) = shift; return $n if $n <= 2; return $n * fact($n - 1); } ``` Can someone explain me where Perl holds intermediate results before function gives a result? **UPD** and how I can see them by using debugger or by use so...
2013/01/01
[ "https://Stackoverflow.com/questions/14107049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1803586/" ]
The scalar returned by `$n` is stored on the stack. This is what the stack looks like just before calling `fact`: * Scalar returned by `$n` in recursion level 0 * List: + Scalar returned by `$n` in recursion level 1 + List: - Scalar returned by `$n` in recursion level 2 - List: * Scalar returned by `$n-1` in...
Since `$n` is declared as `my $n`, it's a lexically scoped variable and is stored in the stack and not in the system table. See [Perl Variables via my()](http://perldoc.perl.org/perlsub.html#Private-Variables-via-my%28%29) for more information.
14,107,049
There is a recursive implementation of computing factorial N on Perl. ``` sub fact { my ($n) = shift; return $n if $n <= 2; return $n * fact($n - 1); } ``` Can someone explain me where Perl holds intermediate results before function gives a result? **UPD** and how I can see them by using debugger or by use so...
2013/01/01
[ "https://Stackoverflow.com/questions/14107049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1803586/" ]
With the recursion any of the arguments that are passed in each call go on the call frame/ stack. By using Carp & cluck you can see the call frames. Intermediate results are calculated while the stack unwinds on reaching the base case ($v == 1). Could it be in CPU register only? And operator (\*) multiplies this interm...
Since `$n` is declared as `my $n`, it's a lexically scoped variable and is stored in the stack and not in the system table. See [Perl Variables via my()](http://perldoc.perl.org/perlsub.html#Private-Variables-via-my%28%29) for more information.
65,693,445
For example, we made a windows form application and converted it to setup. I want the person who installs the program on his computer to run the program only ten times on the computer he has installed, but not the eleventh time. Or in the same way, I want the program to run for ten hours on the computer where the progr...
2021/01/12
[ "https://Stackoverflow.com/questions/65693445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10809301/" ]
In a simple way - you can set a counter of loaded times and save it in Properties.Settings.Default. In Form Load event read counter value from the Settings file and check whenever it is bellow required startup times. If above prevent normal loading. If below increment the counter, save it and proceed with loading. Belo...
Best solution is to make app ask web server whether user has permission to start app again or not - but it requires to make the server in first place ... But without the web server the easiest way to restrict user from using your app is to store value on users PC. The simplest location to store value that determines if...
27,191,068
given the following grammar I have to find the appropriate semantic actions to calculate, for each string of the language, the number of pairs of parentheses in the string. **S -> (L)** **S -> a** **L -> L, S** **L -> S** Usually, to perform this type of exercise, I build a derivation tree of a sample string and t...
2014/11/28
[ "https://Stackoverflow.com/questions/27191068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
AsteriskNow is a complete distribution based on CentOS available as an ISO file. There doesn't appear to be an EC2 AMI available for it so you would have to build an image yourself. [Here's an overview of the process for Oracle Linux](http://www.rittmanmead.com/2014/09/obiee-sampleapp-in-the-cloud-importing-virtualbox...
can you not just download the ISO directly? ``` ubuntu@ip-172-31-14-19:~/iso$ ubuntu@ip-172-31-14-19:~/iso$ wget -v https://downloads.asterisk.org/pub/telephony/asterisk-now/AsteriskNow-1013-current-64.iso --2017-11-17 05:52:53-- https://downloads.asterisk.org/pub/telephony/asterisk-now/AsteriskNow-1013-current-64.i...
43,118,372
I am using Yii2 2amigos/google maps. Could someone explain how this works? I am getting the following error: Class 'vendor\dosamigos\google\maps\LatLng' not found I thought the file path to latLng would be what is above, however the file path in my vendor is: vendor/2amigos/yii2-google-maps-library/latlng Not sure a...
2017/03/30
[ "https://Stackoverflow.com/questions/43118372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7436251/" ]
Please Install composer first from yii2 site then hit the following code in the command prompt in your www basic/advance template directory. make sure you have the use dosamigos code in your site view file use dosamigos\google\maps\LatLng; i.e ``` C:\> composer require "2amigos/yii2-google-maps-library" "*" ```
This is how I solved the problem under the vendor folder go to the yii2soft folder and open the extensions.php file and add the following code: ``` '2amigos/yii2-google-maps-library' => array ( 'name' => '2amigos/yii2-google-maps-library', 'version' => '9999999-dev', 'alias' => ...
14,296
I'm trying to build a "list" which is comprised of a bunch of workflows. Example workflows would be: Travel, Reimbursement, Software Request. I would like to list these workflows and allow a user to click the Software Request workflow to launch a new instance of the Software Request workflow. The workflows do not relat...
2011/06/09
[ "https://sharepoint.stackexchange.com/questions/14296", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/3349/" ]
Since you have created site workflows and they don’t have a list item or document to start from, they must be started either: 1) manually - <http://technet.microsoft.com/en-us/library/ee662540.aspx> or 2) Using API - example - <http://unclepaul84.blogspot.com/2009/12/starting-sharepoint-2010-site-workflows.html> Le...
Create hyperlinks to the NewForm pages of the lists that hold the workflows. Workflows have to run on list or library items, so users have to submit something.
14,296
I'm trying to build a "list" which is comprised of a bunch of workflows. Example workflows would be: Travel, Reimbursement, Software Request. I would like to list these workflows and allow a user to click the Software Request workflow to launch a new instance of the Software Request workflow. The workflows do not relat...
2011/06/09
[ "https://sharepoint.stackexchange.com/questions/14296", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/3349/" ]
Create hyperlinks to the NewForm pages of the lists that hold the workflows. Workflows have to run on list or library items, so users have to submit something.
Use this code: ``` var ass = web.WorkflowAssociations.GetAssociationByName("Change Request Approval", CultureInfo.InvariantCulture); web.Site.WorkflowManager.StartWorkflow(null, ass, ass.AssociationData, SPWorkflowRunOptions.Synchronous); ```
14,296
I'm trying to build a "list" which is comprised of a bunch of workflows. Example workflows would be: Travel, Reimbursement, Software Request. I would like to list these workflows and allow a user to click the Software Request workflow to launch a new instance of the Software Request workflow. The workflows do not relat...
2011/06/09
[ "https://sharepoint.stackexchange.com/questions/14296", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/3349/" ]
Since you have created site workflows and they don’t have a list item or document to start from, they must be started either: 1) manually - <http://technet.microsoft.com/en-us/library/ee662540.aspx> or 2) Using API - example - <http://unclepaul84.blogspot.com/2009/12/starting-sharepoint-2010-site-workflows.html> Le...
Use this code: ``` var ass = web.WorkflowAssociations.GetAssociationByName("Change Request Approval", CultureInfo.InvariantCulture); web.Site.WorkflowManager.StartWorkflow(null, ass, ass.AssociationData, SPWorkflowRunOptions.Synchronous); ```
2,325,051
Is the integral $$I=\int \_0 ^{\infty} \sin (x)\sin (x^2)~\mathrm dx $$ convergent or divergent? Thus we have $$I=\frac {1}{4}\int \_{-\infty} ^{\infty} \left(\cos \left(\frac {x^2-x}{2}\right)-\cos \left(\frac{x^2+x}{2}\right)\right)~\mathrm dx $$ I have not been able to go any further. This question was asked in calc...
2017/06/16
[ "https://math.stackexchange.com/questions/2325051", "https://math.stackexchange.com", "https://math.stackexchange.com/users/275884/" ]
The number of combinations in which at least three digits are the same, equals the number of all combinations minus the ones where at most two digits are the same. We can consider five cases: 1. No double digits: ${10 \choose 8}8!$ options; 2. One double digit, six single ones: ${10 \choose 1} {8 \choose 2} {9 \choose...
Assuming we want *at least* three digits to be identical. I cannot think about anything faster than that: $A\_3$=number of ways to have exactly 3 ones $=\binom{8}{3}\*9^5$ $A\_{33}$=number of ways to have exactly 3 ones and 3 twos $=\binom{8} {3}\binom{6}{3}\*8^2$ $A\_4$=number of ways to have exactly 4 ones $=\bin...
24,182
I am going through some past exam paper questions on regular languages for some revision, and I am having a bit of trouble with converting general ideas into formal mathematical proofs. The question is: > > **Given regular expression $S$, prove formally that $S^\* = (S^\*)^\*$**. > > > My problem is expressing t...
2014/04/28
[ "https://cs.stackexchange.com/questions/24182", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/17142/" ]
As you observed, to show $S^\*=(S^\*)^\*$ it will suffice to show $S^\*\subseteq(S^\*)^\*$ and $(S^\*)^\*\subseteq S^\*$. Here's a sketch of a proof of both containments. For a language $A$, define $A^\*=\{x\_1x\_2\dots x\_n\mid n\ge 0\text{ and each }x\_i\in A\}$. Then (with $n=1$) it's clear that for all $x\in A$ we...
Let L be the set of strings derived from S. Prove that both expressions produce exactly the strings $L\_1 L\_2 ... L\_k$ for k >= 0 where each $L\_j$ is in L, and no others. You can also check what happens if you replace one, two, or three of the stars in the expression with “+”. With some changes the expression stay...
4,470,936
i am new to android app development, what i need is i have two textbox username and password,it will post to server and check it with the DB using a php page, if the login success then go to next screen else show a msg box showing login error how can i do that? ```java public void postData() { // Create a new Http...
2010/12/17
[ "https://Stackoverflow.com/questions/4470936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/404183/" ]
Use this class: ``` import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.URL; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickL...
You can use HttpClient to make POST requests. See an example [here](http://androidsamples.blogspot.com/2009/06/how-to-use-http-connection-saxparser.html).
37,995,867
If there is an array ``` array A = ["a","b","c","d"] #Index is [0,1,2,3] ``` And it's sorted to. ``` array A = ["d","c","b","a"] ``` I need an array that returns me the updated index based on the sorted order ``` [3,2,1,0] ``` I'm trying to find a solution to this ruby **UPDATE to the question** If a is sor...
2016/06/23
[ "https://Stackoverflow.com/questions/37995867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1345936/" ]
You need to create a mapping table that preserves the original order, then use that order to un-map the re-ordered version: ``` orig = %w[ a b c d ] orig_order = orig.each_with_index.to_h revised = %w[ d c b a ] revised.map { |e| orig_order[e] } # => [3, 2, 1, 0] ``` So long as your elements are unique this will b...
You can use the `map` and `index` methods. ``` arr = ["a","b","c","d"] sort_arr = ["d","c","b","a"] sort_arr.map{|s| arr.index(s)} # => [3, 2, 1, 0] ```
37,995,867
If there is an array ``` array A = ["a","b","c","d"] #Index is [0,1,2,3] ``` And it's sorted to. ``` array A = ["d","c","b","a"] ``` I need an array that returns me the updated index based on the sorted order ``` [3,2,1,0] ``` I'm trying to find a solution to this ruby **UPDATE to the question** If a is sor...
2016/06/23
[ "https://Stackoverflow.com/questions/37995867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1345936/" ]
You need to create a mapping table that preserves the original order, then use that order to un-map the re-ordered version: ``` orig = %w[ a b c d ] orig_order = orig.each_with_index.to_h revised = %w[ d c b a ] revised.map { |e| orig_order[e] } # => [3, 2, 1, 0] ``` So long as your elements are unique this will b...
Here is one way to do this: ``` original_array = ["a","b","c","d"] jumbled_array = original_array.shuffle jumbled_array.map {|i| original_array.index(i)} #=> [1, 3, 0, 2] ``` **Note:** 1. In this sample, output will change for every run as we are using `shuffle` to demonstrate the solution. 2. The solution will ...
36,790,312
I'd like to be able to manage voice skype calls using [Microsoft Bot Framework](https://dev.botframework.com) and creating Skype Bot I see this option: [![enter image description here](https://i.stack.imgur.com/xVcyC.png)](https://i.stack.imgur.com/xVcyC.png) I read **Limited Preview**, do I have to make a special re...
2016/04/22
[ "https://Stackoverflow.com/questions/36790312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2013945/" ]
The Skype Calling API is now available in the bot framework as of V3 which was released just a couple of weeks ago. The API lets your bot answer calls, record audio, recognize speech (using LUIS congnitive service) or accept digits from the user on the dial pad. You can combine these actions and create complex dialogs ...
Voice is bot yet available in the botframework. Not sure that it will be available soon.
72,585
To my knowledge, bypass air produces 80% of total thrust. But I don't understand to how it does that. By accelerating the air, by increasing the speed or increasing the pressure of the air? Is it doing this by Bernoulli's principle or something like that?
2019/12/15
[ "https://aviation.stackexchange.com/questions/72585", "https://aviation.stackexchange.com", "https://aviation.stackexchange.com/users/36594/" ]
The bypass air is accelerated by the fan at the front of the turbofan engine. This changes its velocity and therefore its momentum, which is the definition of a force (in this case: thrust): $$ F = \frac{\text{d}}{\text{d}t} p = m \frac{\text{d}}{\text{d}t} v = m \cdot a $$ This thrust contributes to the total thrust...
A bypass fan provides thrust in the same way a propeller provides thrust: by increasing the energy content of the gas mass passing through the disk. The added energy is most effectively converted into thrust by allowing it to expand until internal pressure is equal to ambient pressure, so all added energy is converted...
72,585
To my knowledge, bypass air produces 80% of total thrust. But I don't understand to how it does that. By accelerating the air, by increasing the speed or increasing the pressure of the air? Is it doing this by Bernoulli's principle or something like that?
2019/12/15
[ "https://aviation.stackexchange.com/questions/72585", "https://aviation.stackexchange.com", "https://aviation.stackexchange.com/users/36594/" ]
The bypass air is accelerated by the fan at the front of the turbofan engine. This changes its velocity and therefore its momentum, which is the definition of a force (in this case: thrust): $$ F = \frac{\text{d}}{\text{d}t} p = m \frac{\text{d}}{\text{d}t} v = m \cdot a $$ This thrust contributes to the total thrust...
It doesn't bypass *everything*, just the combustion chamber. **Notably, the air still goes through a fan**. High-bypass turbofan engines make most of their thrust from the ducted fan. Very much like a turboprop except the blades are smaller and enclosed by the cowling. @Harper's answer on [What is the difference betw...
101,068
I use the Olympus micro four thirds (MFT) system. One of the problems with this is that there are no shift lenses for this format, so taking landscape photos with buildings is problematic. I can kind of get around it by taking panoramas if there is no motion in the scene. The photo below shows the typical problem: [![...
2018/08/29
[ "https://photo.stackexchange.com/questions/101068", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/56382/" ]
I would suggest looking into a shift or tilt-shift adapter, to mount say a wide-angle Canon EF or Nikon AF-S lens. This way, you have a much wider selection of regular lenses to choose from than just looking at tilt-shift only lenses. And you will likely be able to achieve what you want much cheaper as well. * **Edit*...
Be aware that some sophisticated wide angle lenses (floating element primes, wide angle zooms) are *extremely* sensitive to flange distance mismatches, so be sure that any adapter you use is precise in that regard. A mismatch of fractions of a mm that would merely throw off infinity focus with a normal prime can wreck ...
101,068
I use the Olympus micro four thirds (MFT) system. One of the problems with this is that there are no shift lenses for this format, so taking landscape photos with buildings is problematic. I can kind of get around it by taking panoramas if there is no motion in the scene. The photo below shows the typical problem: [![...
2018/08/29
[ "https://photo.stackexchange.com/questions/101068", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/56382/" ]
I would suggest looking into a shift or tilt-shift adapter, to mount say a wide-angle Canon EF or Nikon AF-S lens. This way, you have a much wider selection of regular lenses to choose from than just looking at tilt-shift only lenses. And you will likely be able to achieve what you want much cheaper as well. * **Edit*...
There is one tilt-shift lens with an MFT mount: [the Samyang 24mm f/3.5](https://www.samyanglensglobal.com/en/product/product-view.php?seq=266). But no, you can't adapt E-mount. But you can find shift adapters (and tilt-shift adapters) for full frame lenses to MFT. Kipon and [Fotodiox](https://fotodioxpro.com/collecti...
101,068
I use the Olympus micro four thirds (MFT) system. One of the problems with this is that there are no shift lenses for this format, so taking landscape photos with buildings is problematic. I can kind of get around it by taking panoramas if there is no motion in the scene. The photo below shows the typical problem: [![...
2018/08/29
[ "https://photo.stackexchange.com/questions/101068", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/56382/" ]
Be aware that some sophisticated wide angle lenses (floating element primes, wide angle zooms) are *extremely* sensitive to flange distance mismatches, so be sure that any adapter you use is precise in that regard. A mismatch of fractions of a mm that would merely throw off infinity focus with a normal prime can wreck ...
There is one tilt-shift lens with an MFT mount: [the Samyang 24mm f/3.5](https://www.samyanglensglobal.com/en/product/product-view.php?seq=266). But no, you can't adapt E-mount. But you can find shift adapters (and tilt-shift adapters) for full frame lenses to MFT. Kipon and [Fotodiox](https://fotodioxpro.com/collecti...
2,788,426
I have a list i'm filling at server side. It's a list of "User", which implements IComparable. Now when WCF is serializing the data, i guess it's not including the CompareTo method. This is my Object class : ``` [DataContract] public class User : IComparable { private string e164, cn, h323; private int id; ...
2010/05/07
[ "https://Stackoverflow.com/questions/2788426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/213963/" ]
No, CompareTo is a method not a member. If you want to replicate this on the client side, either provide a client side library that adapts the client object as well as implements IComparable. @frogbot does have a valid suggestion but passing objects is against the true nature of SOA, the goal is to talk interfaces an...
Because your client and server are talking the same technology stack (i.e. both are using .Net), have your client side code reference the same (data object containing) assembly as what the server uses\*. Then your interface implementations will be intact, both assemblies will be using the same data object definitions, ...
2,788,426
I have a list i'm filling at server side. It's a list of "User", which implements IComparable. Now when WCF is serializing the data, i guess it's not including the CompareTo method. This is my Object class : ``` [DataContract] public class User : IComparable { private string e164, cn, h323; private int id; ...
2010/05/07
[ "https://Stackoverflow.com/questions/2788426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/213963/" ]
You do not need to implement comparable. You can use delegates to sort a list as well, without the icomparable in the class. Try following code. ``` users.Sort(delegate(User u1, User u2) { return u1.LastActive.CompareTo(u2.LastActive); }); ``` You can use this directly in your client.
No, CompareTo is a method not a member. If you want to replicate this on the client side, either provide a client side library that adapts the client object as well as implements IComparable. @frogbot does have a valid suggestion but passing objects is against the true nature of SOA, the goal is to talk interfaces an...
2,788,426
I have a list i'm filling at server side. It's a list of "User", which implements IComparable. Now when WCF is serializing the data, i guess it's not including the CompareTo method. This is my Object class : ``` [DataContract] public class User : IComparable { private string e164, cn, h323; private int id; ...
2010/05/07
[ "https://Stackoverflow.com/questions/2788426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/213963/" ]
Interfaces (code) are not serialized. You may consider switching to `NetDataContractSerializer`. In this case type info will be included in the stream and you can obtain the same object on the client (if the assembly containing the type is in `AppDomain`).
Because your client and server are talking the same technology stack (i.e. both are using .Net), have your client side code reference the same (data object containing) assembly as what the server uses\*. Then your interface implementations will be intact, both assemblies will be using the same data object definitions, ...
2,788,426
I have a list i'm filling at server side. It's a list of "User", which implements IComparable. Now when WCF is serializing the data, i guess it's not including the CompareTo method. This is my Object class : ``` [DataContract] public class User : IComparable { private string e164, cn, h323; private int id; ...
2010/05/07
[ "https://Stackoverflow.com/questions/2788426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/213963/" ]
You do not need to implement comparable. You can use delegates to sort a list as well, without the icomparable in the class. Try following code. ``` users.Sort(delegate(User u1, User u2) { return u1.LastActive.CompareTo(u2.LastActive); }); ``` You can use this directly in your client.
Interfaces (code) are not serialized. You may consider switching to `NetDataContractSerializer`. In this case type info will be included in the stream and you can obtain the same object on the client (if the assembly containing the type is in `AppDomain`).
2,788,426
I have a list i'm filling at server side. It's a list of "User", which implements IComparable. Now when WCF is serializing the data, i guess it's not including the CompareTo method. This is my Object class : ``` [DataContract] public class User : IComparable { private string e164, cn, h323; private int id; ...
2010/05/07
[ "https://Stackoverflow.com/questions/2788426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/213963/" ]
You do not need to implement comparable. You can use delegates to sort a list as well, without the icomparable in the class. Try following code. ``` users.Sort(delegate(User u1, User u2) { return u1.LastActive.CompareTo(u2.LastActive); }); ``` You can use this directly in your client.
Because your client and server are talking the same technology stack (i.e. both are using .Net), have your client side code reference the same (data object containing) assembly as what the server uses\*. Then your interface implementations will be intact, both assemblies will be using the same data object definitions, ...
2,331,177
how do you prevent the entry of duplicate records in php mysql? validating input before insertion to the table. i am currently building a user registration section for my website but want to present them with an error if a duplicate username or email address is found in the database. **EDIT** This is what I have t...
2010/02/25
[ "https://Stackoverflow.com/questions/2331177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/436493/" ]
Define unique constraints for the username and email columns: ``` ALTER TABLE your_table ADD CONSTRAINT uk_username UNIQUE (username) ALTER TABLE your_table ADD CONSTRAINT uk_email UNIQUE (email) ``` If the value attempting to be insertered or updated already exists in the table, MySQL will return an error stating t...
Before inserting, run a SQL statement something like ``` SELECT * FROM users WHERE users.name = :name OR users.email = :email ``` (using [parametrized SQL](https://stackoverflow.com/questions/60174/best-way-to-stop-sql-injection-in-php)) and count the number of rows returned. If there's more than 0, there's a dupli...
2,331,177
how do you prevent the entry of duplicate records in php mysql? validating input before insertion to the table. i am currently building a user registration section for my website but want to present them with an error if a duplicate username or email address is found in the database. **EDIT** This is what I have t...
2010/02/25
[ "https://Stackoverflow.com/questions/2331177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/436493/" ]
Define unique constraints for the username and email columns: ``` ALTER TABLE your_table ADD CONSTRAINT uk_username UNIQUE (username) ALTER TABLE your_table ADD CONSTRAINT uk_email UNIQUE (email) ``` If the value attempting to be insertered or updated already exists in the table, MySQL will return an error stating t...
i used the sql statement along with an if else statement. ``` mysql_select_db($database_speedycms, $speedycms); $query_usercheck = "SELECT * FROM tbl_users WHERE username='$user' OR email='$email'"; $usercheck = mysql_query($query_usercheck, $speedycms) or die(mysql_error()); $row_usercheck = mysql_fetch_assoc($userch...
2,331,177
how do you prevent the entry of duplicate records in php mysql? validating input before insertion to the table. i am currently building a user registration section for my website but want to present them with an error if a duplicate username or email address is found in the database. **EDIT** This is what I have t...
2010/02/25
[ "https://Stackoverflow.com/questions/2331177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/436493/" ]
i used the sql statement along with an if else statement. ``` mysql_select_db($database_speedycms, $speedycms); $query_usercheck = "SELECT * FROM tbl_users WHERE username='$user' OR email='$email'"; $usercheck = mysql_query($query_usercheck, $speedycms) or die(mysql_error()); $row_usercheck = mysql_fetch_assoc($userch...
Before inserting, run a SQL statement something like ``` SELECT * FROM users WHERE users.name = :name OR users.email = :email ``` (using [parametrized SQL](https://stackoverflow.com/questions/60174/best-way-to-stop-sql-injection-in-php)) and count the number of rows returned. If there's more than 0, there's a dupli...
13,812,509
I have a search string that is getting passed > > Eg: "a+b",a, b, "C","d+e",a-b,d > > > I want to filter out all sub strings surrounded by double quotes(""). In above sample Output should contain: > > "a+b","C","d+e" > > > Is there a way to do this without looping? Also I then need to extract a string wit...
2012/12/11
[ "https://Stackoverflow.com/questions/13812509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1436510/" ]
You can check <http://msdn.microsoft.com/en-us/library/windowsphone/develop/windows.phone.applicationmodel.applicationprofile.modes(v=vs.105).aspx> Windows.Phone.ApplicationModel.ApplicationProfile namespace
I don't currently know any way to access the starting point of an app. This would be the information necessary to know if the user was in Kids Corner or not.
52,111,920
Recently I was working with WPF and C#, and I wanted to make an editor for an A4 page (A JPG template with the size of an A4) The thing is, I want to put some text in a certain place on the JPG and to be able to see it as I write the text (like a live preview). This is what I achieved by now: XAML ``` <Window x:Cla...
2018/08/31
[ "https://Stackoverflow.com/questions/52111920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8042042/" ]
Maybe something like: ``` import json json.dump([x for x in data if "instagram" in x["origin"]["platform"]], open("post_instagram.json", "w")) json.dump([x for x in data if "facebook" in x["origin"]["platform"]], open("post_facebook.json", "w")) # other platforms ... ``` If data is very huge instead of iterating...
You can use the json module for python. Then you can `json.load` your file and get a dictionary as output, and then iterate over `your_dict['origin']['platform']` to write the line in a file named `'post_'+platform+'.json'`
52,111,920
Recently I was working with WPF and C#, and I wanted to make an editor for an A4 page (A JPG template with the size of an A4) The thing is, I want to put some text in a certain place on the JPG and to be able to see it as I write the text (like a live preview). This is what I achieved by now: XAML ``` <Window x:Cla...
2018/08/31
[ "https://Stackoverflow.com/questions/52111920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8042042/" ]
Maybe something like: ``` import json json.dump([x for x in data if "instagram" in x["origin"]["platform"]], open("post_instagram.json", "w")) json.dump([x for x in data if "facebook" in x["origin"]["platform"]], open("post_facebook.json", "w")) # other platforms ... ``` If data is very huge instead of iterating...
You can use the JSON module. **Ex:** ``` import json from collections import defaultdict with open(filename) as infile: data = json.load(infile) #Read JSON res = defaultdict(list) for i in data["data"]: res[i["origin"]["platform"]].append(i) for k,v in res.items(): with open("post_{}.json".format(k...
35,247,310
I'm writing an app in Angular 2 and I want to execute several http requests and run a function on the responses. In Angular 1, I would write something like `$q.all([$http.get(...), $http.get(...), ...]).then(doSomethingWithResponses);` But Angular 2 returns RxJS Observables and after a bunch of reading I still can't ...
2016/02/06
[ "https://Stackoverflow.com/questions/35247310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865305/" ]
As @Eric Martinez pointed out, there is [forkJoin](https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/forkjoin.md). forkJoin runs all observable sequences in parallel and collect their last elements. ``` Rx.Observable.forkJoin([a,b]).subscribe(t=> { var firstResult = t[0]; v...
I'm not sure you'd want to use [`forkJoin/zip`](http://reactivex.io/documentation/operators/zip.html), especially considering [`combineLatest`](http://reactivex.io/documentation/operators/combinelatest.html) is easier to understand and will emit on every sub-stream event, whereas `forkJoin` basically samples on every s...
35,247,310
I'm writing an app in Angular 2 and I want to execute several http requests and run a function on the responses. In Angular 1, I would write something like `$q.all([$http.get(...), $http.get(...), ...]).then(doSomethingWithResponses);` But Angular 2 returns RxJS Observables and after a bunch of reading I still can't ...
2016/02/06
[ "https://Stackoverflow.com/questions/35247310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1865305/" ]
As @Eric Martinez pointed out, there is [forkJoin](https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/forkjoin.md). forkJoin runs all observable sequences in parallel and collect their last elements. ``` Rx.Observable.forkJoin([a,b]).subscribe(t=> { var firstResult = t[0]; v...
I'm learning RxJS and I was trying to do the same thing with RxJS v5 It seems like we don't have `forkJoin` on v5 anymore, so here's how I got it working (works with `flatMap` or `mergeMap`, which are aliases): ``` const callOne = value => new window.Promise(resolve => setTimeout(() => resolve(value + 10)...