qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
44,981,265 | I have a json response as shown below :
```
[
{"id":10,
"list_file":["/var/a.txt",
"/dev/b.txt"]}
]
```
I need to extract values of list\_file and store it shell variable as an array. I tried doing it looping through and reading the values.
```
#!/bin/bash
x=()
while read -r value
do
#echo "$value"... | 2017/07/08 | [
"https://Stackoverflow.com/questions/44981265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8273311/"
] | In order to handle all values properly, you need to use the `declare` command to incorporate the output of `jq` into an array assignment.
Here's some input with some corner cases to worry about: whitespace, a newline, and a glob character.
```
$ cat input.json
[
{"id":10,
"list_file":[
"/var/a b.txt",... | You can use the [`@tsv`](https://stedolan.github.io/jq/manual/#Formatstringsandescaping) string formatter in combination with [`--raw-output`/`-r`](https://stedolan.github.io/jq/manual/#Invokingjq) option and split the output to `bash` array on tabs:
```
$ IFS=$'\t'
$ x=($(jq -r '.[] | .list_file | @tsv' input.json))
... |
44,981,265 | I have a json response as shown below :
```
[
{"id":10,
"list_file":["/var/a.txt",
"/dev/b.txt"]}
]
```
I need to extract values of list\_file and store it shell variable as an array. I tried doing it looping through and reading the values.
```
#!/bin/bash
x=()
while read -r value
do
#echo "$value"... | 2017/07/08 | [
"https://Stackoverflow.com/questions/44981265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8273311/"
] | You can use the [`@tsv`](https://stedolan.github.io/jq/manual/#Formatstringsandescaping) string formatter in combination with [`--raw-output`/`-r`](https://stedolan.github.io/jq/manual/#Invokingjq) option and split the output to `bash` array on tabs:
```
$ IFS=$'\t'
$ x=($(jq -r '.[] | .list_file | @tsv' input.json))
... | 1. On a Mac, it's easy enough to install a bash with `readarray` (e.g. using homebrew: `brew install bash`), so in the following I'll assume it's available, but you could just as well use the `while read -r value` technique to read values on a line-by-line basis. (One advantage of these line-oriented methods is that th... |
44,981,265 | I have a json response as shown below :
```
[
{"id":10,
"list_file":["/var/a.txt",
"/dev/b.txt"]}
]
```
I need to extract values of list\_file and store it shell variable as an array. I tried doing it looping through and reading the values.
```
#!/bin/bash
x=()
while read -r value
do
#echo "$value"... | 2017/07/08 | [
"https://Stackoverflow.com/questions/44981265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8273311/"
] | In order to handle all values properly, you need to use the `declare` command to incorporate the output of `jq` into an array assignment.
Here's some input with some corner cases to worry about: whitespace, a newline, and a glob character.
```
$ cat input.json
[
{"id":10,
"list_file":[
"/var/a b.txt",... | 1. On a Mac, it's easy enough to install a bash with `readarray` (e.g. using homebrew: `brew install bash`), so in the following I'll assume it's available, but you could just as well use the `while read -r value` technique to read values on a line-by-line basis. (One advantage of these line-oriented methods is that th... |
9,530,056 | I am writing a user script for youtube.com, and want to insert a button with the same look and feel as the other buttons on YouTube page. Things were working in the past, but have suddenly stopped working.
Have a look at the buttons in this image on top of any youtube video:
. You would use this image as a background image on your element that has a width/height defined to the size of the icon t... | This technique is called "CSS sprites":
* <http://css-tricks.com/css-sprites/>
* <http://www.alistapart.com/articles/sprites>
* <http://coding.smashingmagazine.com/2009/04/27/the-mystery-of-css-sprites-techniques-tools-and-tutorials/>
* <https://stackoverflow.com/search?q=css+sprites>
They're using [one image with al... |
9,530,056 | I am writing a user script for youtube.com, and want to insert a button with the same look and feel as the other buttons on YouTube page. Things were working in the past, but have suddenly stopped working.
Have a look at the buttons in this image on top of any youtube video:
. You would use this image as a background image on your element that has a width/height defined to the size of the icon t... | Look at the CSS declaration for that tag. For example, the like button has this html:
```
<button onclick=";return false;" title="I like this" type="button" class="start yt-uix-tooltip-reverse yt-uix-button yt-uix-button-default yt-uix-tooltip" id="watch-like" data-button-toggle="true" data-button-action="yt.www.watc... |
9,530,056 | I am writing a user script for youtube.com, and want to insert a button with the same look and feel as the other buttons on YouTube page. Things were working in the past, but have suddenly stopped working.
Have a look at the buttons in this image on top of any youtube video:
. You would use this image as a background image on your element that has a width/height defined to the size of the icon t... | >
> I writing a user script for youtube.com, and want to insert a button with the same look and feel as the other buttons on YouTube page.
>
>
>
Just give your button a class of `yt-uix-button yt-uix-button-default` and it will have the same look and feel of the other buttons. I do the same thing in my own YouTub... |
9,530,056 | I am writing a user script for youtube.com, and want to insert a button with the same look and feel as the other buttons on YouTube page. Things were working in the past, but have suddenly stopped working.
Have a look at the buttons in this image on top of any youtube video:

What am I doing wrong ? | 2012/06/24 | [
"https://Stackoverflow.com/questions/11177520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199222/"
] | You should use `modify` keyword instead of your second `alter` .
```
alter table
emp
modify
(
sal varchar2(10)
);
```
When modifying a tables column datatype , you need to use `modify` keyword.
Of course, you must deal with existing column data. When modifying a tables column datatype you may want to expor... | It does not seem a smart idea to take a perfectly good number and ruin in for the rest of the user by appending a piece of string.
Just add the string on the select directly or through a view?
Something like:
```
SQL> create view emp_horked
as
select ename, sal, sal || '#' hash, to_char(SAL,'9999.99') || ... |
14,515,523 | I was making a search for project i was working on. when someone search for a term it will be save in a MySQL database. im using `mysql_real_escape_string` to escape special characters but still special characters are saving in the database for a example
Don't become Don\'t
then i tried `htmlspecialchars` it is still... | 2013/01/25 | [
"https://Stackoverflow.com/questions/14515523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/455961/"
] | use this regex for removing special characters from string
```
$addSearch = preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%&-]/s', '', $search);
mysql_query("INSERT INTO search (term) VALUES('$addSearch') ") or die(mysql_error());
```
and use `mysqli` or `pdo` instead of `mysql` because it is deprecated and can be removed... | Actually, there are many way to do this. Maybe there is something wrong that you couldn't see.
```
$str = addslashes($str);
$str = addcslashes($str, "'\"");
$str = str_replace(array("'", '"'), array("\\'", '\\"'), $str);
$str = preg_replace("~([\"'])~", "\\\\1", $str);
``` |
14,515,523 | I was making a search for project i was working on. when someone search for a term it will be save in a MySQL database. im using `mysql_real_escape_string` to escape special characters but still special characters are saving in the database for a example
Don't become Don\'t
then i tried `htmlspecialchars` it is still... | 2013/01/25 | [
"https://Stackoverflow.com/questions/14515523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/455961/"
] | Try like this....
```
$height='aA1`';
$value=preg_replace("/[^\`a-z,. \'\-\d]/i", "", $height);
$value=mysql_real_escape_string($value);
mysql_query("INSERT INTO `table` SET `column`='$value'") or die(mysql_error());
``` | use this regex for removing special characters from string
```
$addSearch = preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%&-]/s', '', $search);
mysql_query("INSERT INTO search (term) VALUES('$addSearch') ") or die(mysql_error());
```
and use `mysqli` or `pdo` instead of `mysql` because it is deprecated and can be removed... |
14,515,523 | I was making a search for project i was working on. when someone search for a term it will be save in a MySQL database. im using `mysql_real_escape_string` to escape special characters but still special characters are saving in the database for a example
Don't become Don\'t
then i tried `htmlspecialchars` it is still... | 2013/01/25 | [
"https://Stackoverflow.com/questions/14515523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/455961/"
] | I would advise checking your PHP config (php.ini) to see if "Magic Quotes" are enabled. And if so, turn them off & restart your web service. More [info here](http://php.net/manual/en/security.magicquotes.disabling.php).
```
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off
; Magic quotes for ru... | Actually, there are many way to do this. Maybe there is something wrong that you couldn't see.
```
$str = addslashes($str);
$str = addcslashes($str, "'\"");
$str = str_replace(array("'", '"'), array("\\'", '\\"'), $str);
$str = preg_replace("~([\"'])~", "\\\\1", $str);
``` |
14,515,523 | I was making a search for project i was working on. when someone search for a term it will be save in a MySQL database. im using `mysql_real_escape_string` to escape special characters but still special characters are saving in the database for a example
Don't become Don\'t
then i tried `htmlspecialchars` it is still... | 2013/01/25 | [
"https://Stackoverflow.com/questions/14515523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/455961/"
] | Try like this....
```
$height='aA1`';
$value=preg_replace("/[^\`a-z,. \'\-\d]/i", "", $height);
$value=mysql_real_escape_string($value);
mysql_query("INSERT INTO `table` SET `column`='$value'") or die(mysql_error());
``` | I would advise checking your PHP config (php.ini) to see if "Magic Quotes" are enabled. And if so, turn them off & restart your web service. More [info here](http://php.net/manual/en/security.magicquotes.disabling.php).
```
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off
; Magic quotes for ru... |
14,515,523 | I was making a search for project i was working on. when someone search for a term it will be save in a MySQL database. im using `mysql_real_escape_string` to escape special characters but still special characters are saving in the database for a example
Don't become Don\'t
then i tried `htmlspecialchars` it is still... | 2013/01/25 | [
"https://Stackoverflow.com/questions/14515523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/455961/"
] | Try like this....
```
$height='aA1`';
$value=preg_replace("/[^\`a-z,. \'\-\d]/i", "", $height);
$value=mysql_real_escape_string($value);
mysql_query("INSERT INTO `table` SET `column`='$value'") or die(mysql_error());
``` | Actually, there are many way to do this. Maybe there is something wrong that you couldn't see.
```
$str = addslashes($str);
$str = addcslashes($str, "'\"");
$str = str_replace(array("'", '"'), array("\\'", '\\"'), $str);
$str = preg_replace("~([\"'])~", "\\\\1", $str);
``` |
6,353,156 | I have an array of arrays, called `guid_pairs`:
```
[['a','b','c'],['c','g'],['z','f','b']]
```
I also have an array, called `array_to_check`:
```
['c','a','b']
```
How can I determine if the array `guid_pairs` has an element that is equal to `array_to_check`. Equality should not consider the position of the arra... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6353156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/173634/"
] | There is a [set class](http://ruby-doc.org/stdlib/libdoc/set/rdoc/classes/Set.html) in the standard library and using sets nicely matches your intent:
```
require 'set'
a = ['c','a','b']
aa = [['a','b','c'],['c','g'],['z','f','b']]
find_this = Set.new(a)
the_match = aa.find { |x| find_this == Set.new(x) }
```
Tha... | A possible solution is to sort the arrays before comparing (or even during comparing):
```
guid_pairs.any?{|pair| pair.sort.eql?(array_to_check.sort)}
```
Note that this may not be an optimal solution - it would be more appropriate to have your arrays sorted (nevertheless they are sets in your use case). |
6,353,156 | I have an array of arrays, called `guid_pairs`:
```
[['a','b','c'],['c','g'],['z','f','b']]
```
I also have an array, called `array_to_check`:
```
['c','a','b']
```
How can I determine if the array `guid_pairs` has an element that is equal to `array_to_check`. Equality should not consider the position of the arra... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6353156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/173634/"
] | There is a [set class](http://ruby-doc.org/stdlib/libdoc/set/rdoc/classes/Set.html) in the standard library and using sets nicely matches your intent:
```
require 'set'
a = ['c','a','b']
aa = [['a','b','c'],['c','g'],['z','f','b']]
find_this = Set.new(a)
the_match = aa.find { |x| find_this == Set.new(x) }
```
Tha... | You can use the following:
```
sorted_array_to_check = array_to_check.sort
guid_pairs.any?{|pair| pair.sort.eql?(sorted_array_to_check)}
``` |
6,353,156 | I have an array of arrays, called `guid_pairs`:
```
[['a','b','c'],['c','g'],['z','f','b']]
```
I also have an array, called `array_to_check`:
```
['c','a','b']
```
How can I determine if the array `guid_pairs` has an element that is equal to `array_to_check`. Equality should not consider the position of the arra... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6353156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/173634/"
] | To see if two arrays contain the same elements, regardless of order, you can use the XOR (exclusive or) operation. It will return an array which contains only elements that are in one array and not the other. If the length of the XOR is zero then the input arrays contain the same elements.
```
def xor(a, b)
(a | b) ... | A possible solution is to sort the arrays before comparing (or even during comparing):
```
guid_pairs.any?{|pair| pair.sort.eql?(array_to_check.sort)}
```
Note that this may not be an optimal solution - it would be more appropriate to have your arrays sorted (nevertheless they are sets in your use case). |
6,353,156 | I have an array of arrays, called `guid_pairs`:
```
[['a','b','c'],['c','g'],['z','f','b']]
```
I also have an array, called `array_to_check`:
```
['c','a','b']
```
How can I determine if the array `guid_pairs` has an element that is equal to `array_to_check`. Equality should not consider the position of the arra... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6353156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/173634/"
] | There is a [set class](http://ruby-doc.org/stdlib/libdoc/set/rdoc/classes/Set.html) in the standard library and using sets nicely matches your intent:
```
require 'set'
a = ['c','a','b']
aa = [['a','b','c'],['c','g'],['z','f','b']]
find_this = Set.new(a)
the_match = aa.find { |x| find_this == Set.new(x) }
```
Tha... | To see if two arrays contain the same elements, regardless of order, you can use the XOR (exclusive or) operation. It will return an array which contains only elements that are in one array and not the other. If the length of the XOR is zero then the input arrays contain the same elements.
```
def xor(a, b)
(a | b) ... |
6,353,156 | I have an array of arrays, called `guid_pairs`:
```
[['a','b','c'],['c','g'],['z','f','b']]
```
I also have an array, called `array_to_check`:
```
['c','a','b']
```
How can I determine if the array `guid_pairs` has an element that is equal to `array_to_check`. Equality should not consider the position of the arra... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6353156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/173634/"
] | for equality of two arrays A and B i normally use:
```
if(((A-B) + (B-A)).blank?)
puts "equal"
else
"unequal"
end
``` | You can use the following:
```
sorted_array_to_check = array_to_check.sort
guid_pairs.any?{|pair| pair.sort.eql?(sorted_array_to_check)}
``` |
6,353,156 | I have an array of arrays, called `guid_pairs`:
```
[['a','b','c'],['c','g'],['z','f','b']]
```
I also have an array, called `array_to_check`:
```
['c','a','b']
```
How can I determine if the array `guid_pairs` has an element that is equal to `array_to_check`. Equality should not consider the position of the arra... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6353156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/173634/"
] | To see if two arrays contain the same elements, regardless of order, you can use the XOR (exclusive or) operation. It will return an array which contains only elements that are in one array and not the other. If the length of the XOR is zero then the input arrays contain the same elements.
```
def xor(a, b)
(a | b) ... | You can use the following:
```
sorted_array_to_check = array_to_check.sort
guid_pairs.any?{|pair| pair.sort.eql?(sorted_array_to_check)}
``` |
6,353,156 | I have an array of arrays, called `guid_pairs`:
```
[['a','b','c'],['c','g'],['z','f','b']]
```
I also have an array, called `array_to_check`:
```
['c','a','b']
```
How can I determine if the array `guid_pairs` has an element that is equal to `array_to_check`. Equality should not consider the position of the arra... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6353156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/173634/"
] | A possible solution is to sort the arrays before comparing (or even during comparing):
```
guid_pairs.any?{|pair| pair.sort.eql?(array_to_check.sort)}
```
Note that this may not be an optimal solution - it would be more appropriate to have your arrays sorted (nevertheless they are sets in your use case). | You can use the following:
```
sorted_array_to_check = array_to_check.sort
guid_pairs.any?{|pair| pair.sort.eql?(sorted_array_to_check)}
``` |
6,353,156 | I have an array of arrays, called `guid_pairs`:
```
[['a','b','c'],['c','g'],['z','f','b']]
```
I also have an array, called `array_to_check`:
```
['c','a','b']
```
How can I determine if the array `guid_pairs` has an element that is equal to `array_to_check`. Equality should not consider the position of the arra... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6353156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/173634/"
] | There is a [set class](http://ruby-doc.org/stdlib/libdoc/set/rdoc/classes/Set.html) in the standard library and using sets nicely matches your intent:
```
require 'set'
a = ['c','a','b']
aa = [['a','b','c'],['c','g'],['z','f','b']]
find_this = Set.new(a)
the_match = aa.find { |x| find_this == Set.new(x) }
```
Tha... | for equality of two arrays A and B i normally use:
```
if(((A-B) + (B-A)).blank?)
puts "equal"
else
"unequal"
end
``` |
6,353,156 | I have an array of arrays, called `guid_pairs`:
```
[['a','b','c'],['c','g'],['z','f','b']]
```
I also have an array, called `array_to_check`:
```
['c','a','b']
```
How can I determine if the array `guid_pairs` has an element that is equal to `array_to_check`. Equality should not consider the position of the arra... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6353156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/173634/"
] | A possible solution is to sort the arrays before comparing (or even during comparing):
```
guid_pairs.any?{|pair| pair.sort.eql?(array_to_check.sort)}
```
Note that this may not be an optimal solution - it would be more appropriate to have your arrays sorted (nevertheless they are sets in your use case). | Three solutions:
```
class Array
def check1 other; other.any?{|e| self - e == e - self} end
def check2 other; other.any?{|e| self | e == self and e | self == e} end
def check3 other; other.any?{|e| self & e == self and e & self == e} end
end
array_to_check.check1(guid_pairs) # => true
array_to_check.check2(guid_... |
6,353,156 | I have an array of arrays, called `guid_pairs`:
```
[['a','b','c'],['c','g'],['z','f','b']]
```
I also have an array, called `array_to_check`:
```
['c','a','b']
```
How can I determine if the array `guid_pairs` has an element that is equal to `array_to_check`. Equality should not consider the position of the arra... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6353156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/173634/"
] | To see if two arrays contain the same elements, regardless of order, you can use the XOR (exclusive or) operation. It will return an array which contains only elements that are in one array and not the other. If the length of the XOR is zero then the input arrays contain the same elements.
```
def xor(a, b)
(a | b) ... | for equality of two arrays A and B i normally use:
```
if(((A-B) + (B-A)).blank?)
puts "equal"
else
"unequal"
end
``` |
54,038,174 | Hello I want to delete all rows in my mysql table called "kosik" and pass them to another table called "obj\_zoznam".
I'm using this code in java:
```
String orderstatus = "Accepted";
try {
stmt = con.createStatement();
stmt2 = con.createStatement();
stmt3 = con.createState... | 2019/01/04 | [
"https://Stackoverflow.com/questions/54038174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10867207/"
] | Remove the `LIMIT 1` from your `SELECT` so you bring up all records and not just 1. On this line:
```
rs = stmt.executeQuery("select ID as idzaz, ID_pouzivatela as idpou, ID_tovaru as idtov, cena as suma, ks as kusy from kosik order by ID limit 1");
```
Remove the limit 1:
```
rs = stmt.executeQuery("select ID as i... | >
> I'm trying to figure how to delete all records in this table.
>
>
>
Then remove that filter `where` condition from your `delete` statement
```
delete from kosik
``` |
54,038,174 | Hello I want to delete all rows in my mysql table called "kosik" and pass them to another table called "obj\_zoznam".
I'm using this code in java:
```
String orderstatus = "Accepted";
try {
stmt = con.createStatement();
stmt2 = con.createStatement();
stmt3 = con.createState... | 2019/01/04 | [
"https://Stackoverflow.com/questions/54038174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10867207/"
] | >
> I'm trying to figure how to delete all records in this table.
>
>
>
Then remove that filter `where` condition from your `delete` statement
```
delete from kosik
``` | you limit the result from the query to one row, so you always will have only one id.
the execution of the sstr2 will always delete records with first id |
54,038,174 | Hello I want to delete all rows in my mysql table called "kosik" and pass them to another table called "obj\_zoznam".
I'm using this code in java:
```
String orderstatus = "Accepted";
try {
stmt = con.createStatement();
stmt2 = con.createStatement();
stmt3 = con.createState... | 2019/01/04 | [
"https://Stackoverflow.com/questions/54038174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10867207/"
] | >
> I'm trying to figure how to delete all records in this table.
>
>
>
Then remove that filter `where` condition from your `delete` statement
```
delete from kosik
``` | If you want to delete the entries retaining the table structure, using the truncate command should work.
```
truncate table kosik
``` |
54,038,174 | Hello I want to delete all rows in my mysql table called "kosik" and pass them to another table called "obj\_zoznam".
I'm using this code in java:
```
String orderstatus = "Accepted";
try {
stmt = con.createStatement();
stmt2 = con.createStatement();
stmt3 = con.createState... | 2019/01/04 | [
"https://Stackoverflow.com/questions/54038174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10867207/"
] | Remove the `LIMIT 1` from your `SELECT` so you bring up all records and not just 1. On this line:
```
rs = stmt.executeQuery("select ID as idzaz, ID_pouzivatela as idpou, ID_tovaru as idtov, cena as suma, ks as kusy from kosik order by ID limit 1");
```
Remove the limit 1:
```
rs = stmt.executeQuery("select ID as i... | you limit the result from the query to one row, so you always will have only one id.
the execution of the sstr2 will always delete records with first id |
54,038,174 | Hello I want to delete all rows in my mysql table called "kosik" and pass them to another table called "obj\_zoznam".
I'm using this code in java:
```
String orderstatus = "Accepted";
try {
stmt = con.createStatement();
stmt2 = con.createStatement();
stmt3 = con.createState... | 2019/01/04 | [
"https://Stackoverflow.com/questions/54038174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10867207/"
] | Remove the `LIMIT 1` from your `SELECT` so you bring up all records and not just 1. On this line:
```
rs = stmt.executeQuery("select ID as idzaz, ID_pouzivatela as idpou, ID_tovaru as idtov, cena as suma, ks as kusy from kosik order by ID limit 1");
```
Remove the limit 1:
```
rs = stmt.executeQuery("select ID as i... | If you want to delete the entries retaining the table structure, using the truncate command should work.
```
truncate table kosik
``` |
15,165,371 | I know that
```
WHERE column ~ 'regexp'
```
is this is sqlalchemy:
```
where(column.op('~')('regexp'))
```
but how could I create this?
```
WHERE 'string' ~ column
```
(the regex is stored in the database) | 2013/03/01 | [
"https://Stackoverflow.com/questions/15165371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/579260/"
] | You need to create either a [`literal()`](https://docs.sqlalchemy.org/core/sqlelement.html#sqlalchemy.sql.expression.literal) or a [`bindparam()`](https://docs.sqlalchemy.org/core/sqlelement.html#sqlalchemy.sql.expression.bindparam):
```
from sqlalchemy.sql import expression
expression.literal('string').op('~')(colum... | An non-Sqlalchemy-specific solution would be to create your own operator in the PostgreSQL backend that has the operands reversed. That would also allow you to do things like
```
string ### ANY(ARRAY[regexp1, regexp2, ...])
```
where `###` is your operator. (Finding a good name might be a challenge.) |
623,841 | What information have you been able to gather regarding how do the amazon web services work?
* What hardware do they use
* What web server
* What Operating System
* What storage for AWS
* What virtualization software for EC2/EBS
* What software for they distributed firewall for EC2
* Physical location of their data ce... | 2009/03/08 | [
"https://Stackoverflow.com/questions/623841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63051/"
] | This might be interesting: <http://highscalability.com/amazon-architecture> | You can use `linux` instances or `windows` instances in `Amazon` *aws*. But first of all you shoul run an instance and then select it's operating system. For it's storage they have an instance that called it `S3`. it is a storage that you can save any kind of file format in it. They have many locations for their data c... |
623,841 | What information have you been able to gather regarding how do the amazon web services work?
* What hardware do they use
* What web server
* What Operating System
* What storage for AWS
* What virtualization software for EC2/EBS
* What software for they distributed firewall for EC2
* Physical location of their data ce... | 2009/03/08 | [
"https://Stackoverflow.com/questions/623841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63051/"
] | This might be interesting: <http://highscalability.com/amazon-architecture> | While this question can't be answered in precision, I'll try to shed some light on internal workings that Amazon announced publicly.
Below are some details for commonly used `c` and `m` instance types, as well as recently released bare metal instances. Also,
this can be starting point for further research as specifi... |
623,841 | What information have you been able to gather regarding how do the amazon web services work?
* What hardware do they use
* What web server
* What Operating System
* What storage for AWS
* What virtualization software for EC2/EBS
* What software for they distributed firewall for EC2
* Physical location of their data ce... | 2009/03/08 | [
"https://Stackoverflow.com/questions/623841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63051/"
] | While this question can't be answered in precision, I'll try to shed some light on internal workings that Amazon announced publicly.
Below are some details for commonly used `c` and `m` instance types, as well as recently released bare metal instances. Also,
this can be starting point for further research as specifi... | You can use `linux` instances or `windows` instances in `Amazon` *aws*. But first of all you shoul run an instance and then select it's operating system. For it's storage they have an instance that called it `S3`. it is a storage that you can save any kind of file format in it. They have many locations for their data c... |
7,048,520 | I have a site utilizing a background image that resizes to the window's size. This is achieved by placing an `<img>` in the body, and some custom CSS ( [Technique #2](http://css-tricks.com/3458-perfect-full-page-background-image/) ).
I use a simple conditional statement in the header to determine which image to displ... | 2011/08/13 | [
"https://Stackoverflow.com/questions/7048520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/875652/"
] | I noticed this question a while ago but hoped you'd get an answer that worked for you.
Seeing as nothing has worked for you so far, I have one piece of advice: When you save your .jpg files (the big background images), you might want to save them in "progressive" format if possible.
>
> <http://en.wikipedia.org/wiki... | Use CSS instead.
```
<style>
body.weddings {
background-image: url('http://www.lookingglassstudio.ca/wp-content/uploads/2011/08/weddingsbg.jpg');
}
body.styling {
background-image: url('http://www.lookingglassstudio.ca/wp-content/uploads/2011/08/stylingbg.jpg');
}
</style>
```
Then in PHP:
```
<?php if (is... |
7,048,520 | I have a site utilizing a background image that resizes to the window's size. This is achieved by placing an `<img>` in the body, and some custom CSS ( [Technique #2](http://css-tricks.com/3458-perfect-full-page-background-image/) ).
I use a simple conditional statement in the header to determine which image to displ... | 2011/08/13 | [
"https://Stackoverflow.com/questions/7048520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/875652/"
] | I checked your website and found everything to be working as expected. When the browser requests the page with an empty cache, the image will take a few seconds to download. When you navigate to any other page of the website, the browser fetches the image from the cache -- I do not see any flash on FF4, nor I see the b... | Use CSS instead.
```
<style>
body.weddings {
background-image: url('http://www.lookingglassstudio.ca/wp-content/uploads/2011/08/weddingsbg.jpg');
}
body.styling {
background-image: url('http://www.lookingglassstudio.ca/wp-content/uploads/2011/08/stylingbg.jpg');
}
</style>
```
Then in PHP:
```
<?php if (is... |
7,048,520 | I have a site utilizing a background image that resizes to the window's size. This is achieved by placing an `<img>` in the body, and some custom CSS ( [Technique #2](http://css-tricks.com/3458-perfect-full-page-background-image/) ).
I use a simple conditional statement in the header to determine which image to displ... | 2011/08/13 | [
"https://Stackoverflow.com/questions/7048520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/875652/"
] | I noticed this question a while ago but hoped you'd get an answer that worked for you.
Seeing as nothing has worked for you so far, I have one piece of advice: When you save your .jpg files (the big background images), you might want to save them in "progressive" format if possible.
>
> <http://en.wikipedia.org/wiki... | I've discovered the source of the issue, and I appreciate previous comments as they have helped immensely!
The problem is Wordpress 3.2, and underlying conflicts with jQuery. These conflicts result in the return of the dreaded FOUC in webkit browsers and sometimes IE.
There is no perfect solution, but all three of t... |
7,048,520 | I have a site utilizing a background image that resizes to the window's size. This is achieved by placing an `<img>` in the body, and some custom CSS ( [Technique #2](http://css-tricks.com/3458-perfect-full-page-background-image/) ).
I use a simple conditional statement in the header to determine which image to displ... | 2011/08/13 | [
"https://Stackoverflow.com/questions/7048520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/875652/"
] | I checked your website and found everything to be working as expected. When the browser requests the page with an empty cache, the image will take a few seconds to download. When you navigate to any other page of the website, the browser fetches the image from the cache -- I do not see any flash on FF4, nor I see the b... | I've discovered the source of the issue, and I appreciate previous comments as they have helped immensely!
The problem is Wordpress 3.2, and underlying conflicts with jQuery. These conflicts result in the return of the dreaded FOUC in webkit browsers and sometimes IE.
There is no perfect solution, but all three of t... |
46,836,864 | I have a dictionary that has keys of different word lengths, for example:
```
d={'longggg':'a', 'short':'b', 'medium':'c', 'shor':'d'}
```
and I want to end up with a dictionary that only has keys that are greater than a certain length. For example, I want to only keep entries that are 6 letters long or more. So I w... | 2017/10/19 | [
"https://Stackoverflow.com/questions/46836864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8802895/"
] | Use `Dictionary comprehensions`. No need to do `for k in d.keys()`. Just use `for k in d` as `d.keys()` will return a list which is not needed at all. (A lesson I learnt from Stackoverflow itself!!)
Also as @roganjosh pointed out use `len()` instead of `len[]` (`len()` is a function). Square brackets are used for inde... | You can try this:
```
d={'longggg':'a', 'short':'b', 'medium':'c', 'shor':'d'}
final_d = {a:b for a, b in d.items() if len(a) >= 6}
```
Output:
```
{'medium': 'c', 'longggg': 'a'}
``` |
46,836,864 | I have a dictionary that has keys of different word lengths, for example:
```
d={'longggg':'a', 'short':'b', 'medium':'c', 'shor':'d'}
```
and I want to end up with a dictionary that only has keys that are greater than a certain length. For example, I want to only keep entries that are 6 letters long or more. So I w... | 2017/10/19 | [
"https://Stackoverflow.com/questions/46836864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8802895/"
] | You can try this:
```
d={'longggg':'a', 'short':'b', 'medium':'c', 'shor':'d'}
final_d = {a:b for a, b in d.items() if len(a) >= 6}
```
Output:
```
{'medium': 'c', 'longggg': 'a'}
``` | `len` is a built-in function in Python, and therefore uses parentheses (not the square brackets operator).
The big issue (among other things) with your first solution is that you are creating a separate dictionary for each `k, v`.
Your second solution should work if you fix the `len` function call, but I would rewrit... |
46,836,864 | I have a dictionary that has keys of different word lengths, for example:
```
d={'longggg':'a', 'short':'b', 'medium':'c', 'shor':'d'}
```
and I want to end up with a dictionary that only has keys that are greater than a certain length. For example, I want to only keep entries that are 6 letters long or more. So I w... | 2017/10/19 | [
"https://Stackoverflow.com/questions/46836864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8802895/"
] | Use `Dictionary comprehensions`. No need to do `for k in d.keys()`. Just use `for k in d` as `d.keys()` will return a list which is not needed at all. (A lesson I learnt from Stackoverflow itself!!)
Also as @roganjosh pointed out use `len()` instead of `len[]` (`len()` is a function). Square brackets are used for inde... | `len` is a built-in function in Python, and therefore uses parentheses (not the square brackets operator).
The big issue (among other things) with your first solution is that you are creating a separate dictionary for each `k, v`.
Your second solution should work if you fix the `len` function call, but I would rewrit... |
17,782 | I'm site collection administrator/(physical server administrator) in SharePoint (3.0), and I'm debugging other users' rights to access some of our own features. Is it possible, in any way, to log in as another user(with his/her rights) without knowing his password? I can create my own 'dummy' user assigned to same grou... | 2009/06/02 | [
"https://serverfault.com/questions/17782",
"https://serverfault.com",
"https://serverfault.com/users/7531/"
] | I don't know of any way to user an account without the password. However, you could just make a copy of the user in AD, this will retain the same group membership, and you can then set the password to whatever you like.
All you need to do is right click on the user, click copy and then complete the details required. | Short answer - No it is not.
Long answer - The best practice for this is to set up test user accounts in AD and SharePoint in a logical and structured way and to add this task to Admin processes for adding a new user group. This is the only way you will be able to test properly. And of course these users should really... |
17,782 | I'm site collection administrator/(physical server administrator) in SharePoint (3.0), and I'm debugging other users' rights to access some of our own features. Is it possible, in any way, to log in as another user(with his/her rights) without knowing his password? I can create my own 'dummy' user assigned to same grou... | 2009/06/02 | [
"https://serverfault.com/questions/17782",
"https://serverfault.com",
"https://serverfault.com/users/7531/"
] | I don't know of any way to user an account without the password. However, you could just make a copy of the user in AD, this will retain the same group membership, and you can then set the password to whatever you like.
All you need to do is right click on the user, click copy and then complete the details required. | You cannot login as another user without password (afaik)
Some of approaches you might wanna try are described in [this article](http://www.sharepointusecases.com/index.php/2008/09/tamming-sharepoint-security/).
However if you really want to "login" as another user to check particular permissions you might wanna try... |
17,782 | I'm site collection administrator/(physical server administrator) in SharePoint (3.0), and I'm debugging other users' rights to access some of our own features. Is it possible, in any way, to log in as another user(with his/her rights) without knowing his password? I can create my own 'dummy' user assigned to same grou... | 2009/06/02 | [
"https://serverfault.com/questions/17782",
"https://serverfault.com",
"https://serverfault.com/users/7531/"
] | I don't know of any way to user an account without the password. However, you could just make a copy of the user in AD, this will retain the same group membership, and you can then set the password to whatever you like.
All you need to do is right click on the user, click copy and then complete the details required. | So. The solution is following: (not clean, but working)
1) write own IHttpModule, containing:
```
class LoginModule {
public void Init(HttpApplication context)
{
context.PreRequestHandlerExecute += new EventHandler(UglyHack);
}
void UglyHack(object sender, EventArgs e)
{
HttpCookie wannabe = (HttpConte... |
17,782 | I'm site collection administrator/(physical server administrator) in SharePoint (3.0), and I'm debugging other users' rights to access some of our own features. Is it possible, in any way, to log in as another user(with his/her rights) without knowing his password? I can create my own 'dummy' user assigned to same grou... | 2009/06/02 | [
"https://serverfault.com/questions/17782",
"https://serverfault.com",
"https://serverfault.com/users/7531/"
] | Short answer - No it is not.
Long answer - The best practice for this is to set up test user accounts in AD and SharePoint in a logical and structured way and to add this task to Admin processes for adding a new user group. This is the only way you will be able to test properly. And of course these users should really... | You cannot login as another user without password (afaik)
Some of approaches you might wanna try are described in [this article](http://www.sharepointusecases.com/index.php/2008/09/tamming-sharepoint-security/).
However if you really want to "login" as another user to check particular permissions you might wanna try... |
17,782 | I'm site collection administrator/(physical server administrator) in SharePoint (3.0), and I'm debugging other users' rights to access some of our own features. Is it possible, in any way, to log in as another user(with his/her rights) without knowing his password? I can create my own 'dummy' user assigned to same grou... | 2009/06/02 | [
"https://serverfault.com/questions/17782",
"https://serverfault.com",
"https://serverfault.com/users/7531/"
] | Short answer - No it is not.
Long answer - The best practice for this is to set up test user accounts in AD and SharePoint in a logical and structured way and to add this task to Admin processes for adding a new user group. This is the only way you will be able to test properly. And of course these users should really... | So. The solution is following: (not clean, but working)
1) write own IHttpModule, containing:
```
class LoginModule {
public void Init(HttpApplication context)
{
context.PreRequestHandlerExecute += new EventHandler(UglyHack);
}
void UglyHack(object sender, EventArgs e)
{
HttpCookie wannabe = (HttpConte... |
17,782 | I'm site collection administrator/(physical server administrator) in SharePoint (3.0), and I'm debugging other users' rights to access some of our own features. Is it possible, in any way, to log in as another user(with his/her rights) without knowing his password? I can create my own 'dummy' user assigned to same grou... | 2009/06/02 | [
"https://serverfault.com/questions/17782",
"https://serverfault.com",
"https://serverfault.com/users/7531/"
] | So. The solution is following: (not clean, but working)
1) write own IHttpModule, containing:
```
class LoginModule {
public void Init(HttpApplication context)
{
context.PreRequestHandlerExecute += new EventHandler(UglyHack);
}
void UglyHack(object sender, EventArgs e)
{
HttpCookie wannabe = (HttpConte... | You cannot login as another user without password (afaik)
Some of approaches you might wanna try are described in [this article](http://www.sharepointusecases.com/index.php/2008/09/tamming-sharepoint-security/).
However if you really want to "login" as another user to check particular permissions you might wanna try... |
64,991,009 | Does anyone know why the following JQuery isn't working properly? When I click a link in the navbar I want it to change style (background and font color):
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
... | 2020/11/24 | [
"https://Stackoverflow.com/questions/64991009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14619040/"
] | [Array#index](https://ruby-doc.org/core-2.7.2/Array.html#method-i-index) might help in cases like these (assuming the size of `a` and `b` is the same):
```
brand = b[a.index(a.max)]
```
In cases in which the array `a` might be empty, you will need an additional condition to avoid an error:
```
index = a.index(a.max... | If your array has multiple maxima, you may want to get the indices of the array that correspond to all the maxima:
```
a = [10, 12, 12]
b = [:a, :b, :c]
# Compute and store the maximum once, to avoid re-computing it in the
# loops below:
a_max = a.max
idxs = a.each_with_index.select{ |el, idx| el == a_max }.map{ |el... |
64,991,009 | Does anyone know why the following JQuery isn't working properly? When I click a link in the navbar I want it to change style (background and font color):
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
... | 2020/11/24 | [
"https://Stackoverflow.com/questions/64991009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14619040/"
] | [Array#index](https://ruby-doc.org/core-2.7.2/Array.html#method-i-index) might help in cases like these (assuming the size of `a` and `b` is the same):
```
brand = b[a.index(a.max)]
```
In cases in which the array `a` might be empty, you will need an additional condition to avoid an error:
```
index = a.index(a.max... | Two more ways:
```
a = [3, 1, 6, 4]
b = [2, 8, 5, 7]
```
```
b[a.each_index.max_by { |i| a[i] }]
#=> 5
```
or
```
b[a.each_with_index.max_by(&:first).last]
#=> 5
``` |
64,991,009 | Does anyone know why the following JQuery isn't working properly? When I click a link in the navbar I want it to change style (background and font color):
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
... | 2020/11/24 | [
"https://Stackoverflow.com/questions/64991009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14619040/"
] | [Array#index](https://ruby-doc.org/core-2.7.2/Array.html#method-i-index) might help in cases like these (assuming the size of `a` and `b` is the same):
```
brand = b[a.index(a.max)]
```
In cases in which the array `a` might be empty, you will need an additional condition to avoid an error:
```
index = a.index(a.max... | Assuming `a` and `b` have the same size, e.g.
```
a = [2, 5, 8, 1]
b = [:a, :b, :c, :d]
```
you could combine [`zip`](https://ruby-doc.org/core-2.7.2/Array.html#zip-method) and [`max`](https://ruby-doc.org/core-2.7.2/Array.html#max-method):
```
a.zip(b).max.last # or more explicit: a.zip(b).max_by(&:first).last
#=... |
47,799,793 | How do I configure elastalert so it will connect to any available server in the cluster? The [docs](http://elastalert.readthedocs.io/en/latest/running_elastalert.html#downloading-and-configuring) say:
>
> **es\_host** is the address of an Elasticsearch cluster where ElastAlert
> will store data about its state, que... | 2017/12/13 | [
"https://Stackoverflow.com/questions/47799793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196626/"
] | I guess you would need a upstream load balancer to wrap up those es nodes.
In my case, I use nginx to do load balancing for my es nodes. So the topology is something like this:
```
ElastAlert -> Nginx -> ES node 1
-> ES node 2
...
-> ES node n
```
Sample n... | As you identified in your answer elastalert targets a cluster not a node: "The hostname of the Elasticsearch cluster the rule will use to query." |
1,759,145 | I have a MySQL database that has a few very simple tables.
I would like to find an app (implemented in Perl, Python or PHP) that will do the following:
1. Point the app to a database table, and it automatically retrieves the table's schema from the database.
2. It then generates an HTML view of the table's data. The ... | 2009/11/18 | [
"https://Stackoverflow.com/questions/1759145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161368/"
] | Thanks for the responses, but none of those exactly fit the bill, so I decided to implement it myself.
The result is a new open source project called DWI, which stands for Database Web Interface. It took me about 3 days to get it working, and I did it in about 600 lines of PHP and javascript.
If you want to check it ... | See if Java NakedObejcts is what you want. <http://www.nakedobjects.org> |
1,759,145 | I have a MySQL database that has a few very simple tables.
I would like to find an app (implemented in Perl, Python or PHP) that will do the following:
1. Point the app to a database table, and it automatically retrieves the table's schema from the database.
2. It then generates an HTML view of the table's data. The ... | 2009/11/18 | [
"https://Stackoverflow.com/questions/1759145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161368/"
] | Use [phpGrid](http://phpgrid.com). This is all you need.
```
$dg = new C_DataGrid(“SELECT * FROM orders”, “orderNumber”, “orders”);
$dg -> display();
```
Outcome:
 | See if Java NakedObejcts is what you want. <http://www.nakedobjects.org> |
1,759,145 | I have a MySQL database that has a few very simple tables.
I would like to find an app (implemented in Perl, Python or PHP) that will do the following:
1. Point the app to a database table, and it automatically retrieves the table's schema from the database.
2. It then generates an HTML view of the table's data. The ... | 2009/11/18 | [
"https://Stackoverflow.com/questions/1759145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161368/"
] | Thanks for the responses, but none of those exactly fit the bill, so I decided to implement it myself.
The result is a new open source project called DWI, which stands for Database Web Interface. It took me about 3 days to get it working, and I did it in about 600 lines of PHP and javascript.
If you want to check it ... | If you can use groovy then [Grails](http://www.grails.org/) can get you jump started. It will build an ORM of your entire DB, build views and your basic CRUD is all built in.
If you have a real aversion to anything thats Java-based then perl's [Catalyst](http://www.catalystframework.org/) can help build all your mapp... |
1,759,145 | I have a MySQL database that has a few very simple tables.
I would like to find an app (implemented in Perl, Python or PHP) that will do the following:
1. Point the app to a database table, and it automatically retrieves the table's schema from the database.
2. It then generates an HTML view of the table's data. The ... | 2009/11/18 | [
"https://Stackoverflow.com/questions/1759145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161368/"
] | Use [phpGrid](http://phpgrid.com). This is all you need.
```
$dg = new C_DataGrid(“SELECT * FROM orders”, “orderNumber”, “orders”);
$dg -> display();
```
Outcome:
 | If you can use groovy then [Grails](http://www.grails.org/) can get you jump started. It will build an ORM of your entire DB, build views and your basic CRUD is all built in.
If you have a real aversion to anything thats Java-based then perl's [Catalyst](http://www.catalystframework.org/) can help build all your mapp... |
1,759,145 | I have a MySQL database that has a few very simple tables.
I would like to find an app (implemented in Perl, Python or PHP) that will do the following:
1. Point the app to a database table, and it automatically retrieves the table's schema from the database.
2. It then generates an HTML view of the table's data. The ... | 2009/11/18 | [
"https://Stackoverflow.com/questions/1759145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161368/"
] | Thanks for the responses, but none of those exactly fit the bill, so I decided to implement it myself.
The result is a new open source project called DWI, which stands for Database Web Interface. It took me about 3 days to get it working, and I did it in about 600 lines of PHP and javascript.
If you want to check it ... | Use **[CakeApp.com](http://cakeapp.com)**, it does exactly what you want!
>
> CakeApp.com is a rapid development online tool. It's easy to use, no
> other software than your browser is needed. Benefit from ER-Diagrams
> of others and share your visions too.
>
>
> |
1,759,145 | I have a MySQL database that has a few very simple tables.
I would like to find an app (implemented in Perl, Python or PHP) that will do the following:
1. Point the app to a database table, and it automatically retrieves the table's schema from the database.
2. It then generates an HTML view of the table's data. The ... | 2009/11/18 | [
"https://Stackoverflow.com/questions/1759145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161368/"
] | Use [phpGrid](http://phpgrid.com). This is all you need.
```
$dg = new C_DataGrid(“SELECT * FROM orders”, “orderNumber”, “orders”);
$dg -> display();
```
Outcome:
 | Use **[CakeApp.com](http://cakeapp.com)**, it does exactly what you want!
>
> CakeApp.com is a rapid development online tool. It's easy to use, no
> other software than your browser is needed. Benefit from ER-Diagrams
> of others and share your visions too.
>
>
> |
1,759,145 | I have a MySQL database that has a few very simple tables.
I would like to find an app (implemented in Perl, Python or PHP) that will do the following:
1. Point the app to a database table, and it automatically retrieves the table's schema from the database.
2. It then generates an HTML view of the table's data. The ... | 2009/11/18 | [
"https://Stackoverflow.com/questions/1759145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161368/"
] | Use [phpGrid](http://phpgrid.com). This is all you need.
```
$dg = new C_DataGrid(“SELECT * FROM orders”, “orderNumber”, “orders”);
$dg -> display();
```
Outcome:
 | Thanks for the responses, but none of those exactly fit the bill, so I decided to implement it myself.
The result is a new open source project called DWI, which stands for Database Web Interface. It took me about 3 days to get it working, and I did it in about 600 lines of PHP and javascript.
If you want to check it ... |
6,300,972 | I have 3 fields: `urlName`, `displayName` and `active`. This is check for edit record. What I want to do here is to check `UrlName` is unique in Db, but at the same time, if user has already saved the Url but changed `DisplayName` and `Active` then the record should update.
Any one tell me how to solve that.
```
publ... | 2011/06/10 | [
"https://Stackoverflow.com/questions/6300972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/521706/"
] | Based on the updated question, and if I understand it correctly, I think this solution will work for you.
```
var urlNameExists = _sb.Any(x => x.UrlName == urlName && x.Id != currentEditId);
if (urlNameExists)
throw Exception("A record with that UrlName already exists");
TryUpdateModel(existingMenu);
_menu.Add(... | ```
bool alreadyInDb = (from p in _db.SubMenus where p.UrlName = urlName select p).Count() > 0;
if (alreadyInDb)
{
bool shouldAddRecord = (from p in _db.SubMenus where p.DisplayName == displayName && p.Active == active select p).Count() == 0;
if (shouldAddRecord)
{
TryUpdateModel(existingMenu);
... |
6,300,972 | I have 3 fields: `urlName`, `displayName` and `active`. This is check for edit record. What I want to do here is to check `UrlName` is unique in Db, but at the same time, if user has already saved the Url but changed `DisplayName` and `Active` then the record should update.
Any one tell me how to solve that.
```
publ... | 2011/06/10 | [
"https://Stackoverflow.com/questions/6300972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/521706/"
] | Based on the updated question, and if I understand it correctly, I think this solution will work for you.
```
var urlNameExists = _sb.Any(x => x.UrlName == urlName && x.Id != currentEditId);
if (urlNameExists)
throw Exception("A record with that UrlName already exists");
TryUpdateModel(existingMenu);
_menu.Add(... | ```
private void Update(string urlName, string display, bool active)
{
item = db_.SubMenus.SingleOrDefault(x => x.UrlName == urlName);
if (item == null)
{
// Save new item here
}
else
{
if (item.DisplayName == display && item.Active == active)
{
// Error, fie... |
31,369,906 | They are saying in the [AccessToken docu](https://developers.facebook.com/docs/facebook-login/access-tokens#extending) the following: "Native mobile applications using Facebook's SDKs will get long-lived access tokens, good for about 60 days. These tokens will be refreshed once per day when the person using your app ma... | 2015/07/12 | [
"https://Stackoverflow.com/questions/31369906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2205582/"
] | You can use the [`refreshCurrentAccessTokenAsync`](https://developers.facebook.com/docs/reference/android/current/class/AccessToken/) method:
```
AccessToken.refreshCurrentAccessTokenAsync();
``` | The documentation states (emphasis mine):
>
> When you use the iOS, Android, or JavaScript SDK, the SDK will
> **automatically refresh tokens** if the person has used your app within
> the last 90 days. Native mobile apps using Facebook's SDKs get
> long-lived User access tokens, good for about 60 days. These tokens
... |
37,348,328 | This question follows my previous question [output multiple files based on column value python pandas](https://stackoverflow.com/questions/37216230/output-multiple-files-based-on-column-value-python-pandas)
but this time i want to go a bit further.
so this time i have a small sample data set:
```
import pandas as ... | 2016/05/20 | [
"https://Stackoverflow.com/questions/37348328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5516874/"
] | You can `groupby` `CloneID` and write to csv directly in the `apply` method:
```
df.groupby('CloneID').apply(lambda gp: gp.to_csv('CloneID{}.txt'.format(gp.name)))
```
This will retain the original index, but it can be fixed by `.set_index('CloneID')` before `to_csv` call.
Edit: To retain only the groups where corr... | Create a list of clone id's to iterate through, and then filter the dataframe to that clone ID where the first value of the ID string is H, and then output to text.
**Code**
```
import pandas as pd
df = {'ID': ['H900','H901','H902','M1436','M1435','M149','M157','M213','M699','M920','M871','M789','M617','M991','H903'... |
37,348,328 | This question follows my previous question [output multiple files based on column value python pandas](https://stackoverflow.com/questions/37216230/output-multiple-files-based-on-column-value-python-pandas)
but this time i want to go a bit further.
so this time i have a small sample data set:
```
import pandas as ... | 2016/05/20 | [
"https://Stackoverflow.com/questions/37348328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5516874/"
] | You can first [`filter`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.filter.html) by condition in [`any`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.any.html) value in column `ID` [`startswith`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.str.s... | Create a list of clone id's to iterate through, and then filter the dataframe to that clone ID where the first value of the ID string is H, and then output to text.
**Code**
```
import pandas as pd
df = {'ID': ['H900','H901','H902','M1436','M1435','M149','M157','M213','M699','M920','M871','M789','M617','M991','H903'... |
37,348,328 | This question follows my previous question [output multiple files based on column value python pandas](https://stackoverflow.com/questions/37216230/output-multiple-files-based-on-column-value-python-pandas)
but this time i want to go a bit further.
so this time i have a small sample data set:
```
import pandas as ... | 2016/05/20 | [
"https://Stackoverflow.com/questions/37348328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5516874/"
] | You can first [`filter`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.filter.html) by condition in [`any`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.any.html) value in column `ID` [`startswith`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.str.s... | You can `groupby` `CloneID` and write to csv directly in the `apply` method:
```
df.groupby('CloneID').apply(lambda gp: gp.to_csv('CloneID{}.txt'.format(gp.name)))
```
This will retain the original index, but it can be fixed by `.set_index('CloneID')` before `to_csv` call.
Edit: To retain only the groups where corr... |
53,279,445 | I have a large edge list (~26 million) with first two columns as nodes and with a variable number of optional columns:
```
Node1 Node2 OptionalCol1 OptionalCol2 ...
Gene A Gene D -- --
Gene C Gene F -- --
Gene D Gene C -- --
Gene F Gene A -- ... | 2018/11/13 | [
"https://Stackoverflow.com/questions/53279445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2012575/"
] | Assuming the delimiter is a tab (`\t`). If it's a bunch of space (a bunch being more than one) instead of `-F"\t"` use: `-F" +"`:
```
$ awk -F"\t" 'NR>2{a[$1];a[$2]}END{for(i in a)print i}' file
Gene A
Gene C
Gene D
Gene F
```
The output is not in any particular order but it could be. Explained:
```
$ awk -F"\t" '
... | You could combine awk with sort unique:
```
$ awk '/Gene/ {print $1, $2; print $3, $4}' file | sort -u
Gene A
Gene C
Gene D
Gene F
```
Or if your columns are tab-separated:
```
$ awk -F'\t' '/Gene/ {print $1; print $2}' file | sort -u
Gene A
Gene C
Gene D
Gene F
``` |
53,279,445 | I have a large edge list (~26 million) with first two columns as nodes and with a variable number of optional columns:
```
Node1 Node2 OptionalCol1 OptionalCol2 ...
Gene A Gene D -- --
Gene C Gene F -- --
Gene D Gene C -- --
Gene F Gene A -- ... | 2018/11/13 | [
"https://Stackoverflow.com/questions/53279445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2012575/"
] | Assuming the delimiter is a tab (`\t`). If it's a bunch of space (a bunch being more than one) instead of `-F"\t"` use: `-F" +"`:
```
$ awk -F"\t" 'NR>2{a[$1];a[$2]}END{for(i in a)print i}' file
Gene A
Gene C
Gene D
Gene F
```
The output is not in any particular order but it could be. Explained:
```
$ awk -F"\t" '
... | If your file is separated by tabs you can use this, but you can change the `sep` parameter to whatever your delimiter is.
```
import pandas as pd
import numpy as np
df = pd.read_csv('input.txt', sep='\t', usecols=['Node1', 'Node2'])
node_list = np.concatenate((df['Node1'].unique(), df['Node2'].unique()))
```
When w... |
53,279,445 | I have a large edge list (~26 million) with first two columns as nodes and with a variable number of optional columns:
```
Node1 Node2 OptionalCol1 OptionalCol2 ...
Gene A Gene D -- --
Gene C Gene F -- --
Gene D Gene C -- --
Gene F Gene A -- ... | 2018/11/13 | [
"https://Stackoverflow.com/questions/53279445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2012575/"
] | Assuming the delimiter is a tab (`\t`). If it's a bunch of space (a bunch being more than one) instead of `-F"\t"` use: `-F" +"`:
```
$ awk -F"\t" 'NR>2{a[$1];a[$2]}END{for(i in a)print i}' file
Gene A
Gene C
Gene D
Gene F
```
The output is not in any particular order but it could be. Explained:
```
$ awk -F"\t" '
... | make use of `set()` in `python` like so:
```
file1=open("input.txt",'r')
lines = file1.read().split('\n')
all_nodes_as_string=' '.join(lines) #you can use '\t' here if that's what sepparates the nodes on each line
all_nodes_with_dupes = all_nodes_as_string.split(' ')
all_unique_nodes = set(all_nodes_with_dupes)
`... |
41,564,413 | Is it possible to use string interpolation for the below (Note the dynamic attributes)
```
document.body.innerHTML += <form id="digSigForm" action="${myObj.Url}" method="post"><input type="hidden" name="data" value="${myObj.someVal}"></form>
``` | 2017/01/10 | [
"https://Stackoverflow.com/questions/41564413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485743/"
] | ```
document.body.innerHTML += `<form id="digSigForm" action="${myObj.Url}" method="post"><input type="hidden" name="data" value="${myObj.someVal}"></form>`;
```
You forgot the backticks | You should use the backticks to define a string with string interpollation: ``
Like this:
```
console.log(`1 and 1 make ${1 + 1}`);
```
**This is from the [typescript documentation](https://basarat.gitbooks.io/typescript/content/docs/template-strings.html) :**
>
> Another common use case is when you want to gene... |
41,564,413 | Is it possible to use string interpolation for the below (Note the dynamic attributes)
```
document.body.innerHTML += <form id="digSigForm" action="${myObj.Url}" method="post"><input type="hidden" name="data" value="${myObj.someVal}"></form>
``` | 2017/01/10 | [
"https://Stackoverflow.com/questions/41564413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485743/"
] | This currently doesn't work.
I have a string like this, where the row's data attribute is relied upon for some functionality.
```
`<tr class="row ${rowHiddenClass}" data-someId="${this.someId}">
<td class="cell">${this.Notes}</td>
<td class="cell amount">$${this.Amount}</td>
</tr>`
```
And it outputs like this ... | You should use the backticks to define a string with string interpollation: ``
Like this:
```
console.log(`1 and 1 make ${1 + 1}`);
```
**This is from the [typescript documentation](https://basarat.gitbooks.io/typescript/content/docs/template-strings.html) :**
>
> Another common use case is when you want to gene... |
42,453,310 | I have successfully installed **Laravel** project on the server but its not working. I am getting error like "page isn’t working
>
> HTTP ERROR 500".
>
>
>
I have execute command
```
composer create-project --prefer-dist laravel/laravel
```
and created a directory name Laravel. But it's not working while same ... | 2017/02/25 | [
"https://Stackoverflow.com/questions/42453310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7383044/"
] | This is just Typescript complaining since the [default MouseEvent interface](https://developer.mozilla.org/es/docs/Web/API/MouseEvent) doesn't have the `coords` property, but since you're using `angular2-google-maps` you know the `coords` property will be there ([ng2 google maps MouseEvent interface](https://angular-ma... | The accepted answer is correct in pointing out that the default MouseEvent doesn't have a `coords` property.
But AGM does ship with its own `MouseEvent` interface which does contain a [coords](https://angular-maps.com/api-docs/agm-core/interfaces/MouseEvent.html#coords) property of type `LatLngLiteral` as expected.
Yo... |
42,453,310 | I have successfully installed **Laravel** project on the server but its not working. I am getting error like "page isn’t working
>
> HTTP ERROR 500".
>
>
>
I have execute command
```
composer create-project --prefer-dist laravel/laravel
```
and created a directory name Laravel. But it's not working while same ... | 2017/02/25 | [
"https://Stackoverflow.com/questions/42453310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7383044/"
] | This is just Typescript complaining since the [default MouseEvent interface](https://developer.mozilla.org/es/docs/Web/API/MouseEvent) doesn't have the `coords` property, but since you're using `angular2-google-maps` you know the `coords` property will be there ([ng2 google maps MouseEvent interface](https://angular-ma... | Check your `@agm/core installed version`.
Use this one:
`npm i @agm/core@1.1.0` |
29,052,256 | I am trying to set a icon variable so that I can use it within my library fragment.
The icons ive put in the drawable folders...
When I try the following it does not work?
```
private final static int ICON_FOLDER = R.drawable.ic_folder;
```
Says cannot resolve R? I even tried to import the library R however this ... | 2015/03/14 | [
"https://Stackoverflow.com/questions/29052256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4370449/"
] | Java arrays have a fixed length, so there's no such method.
You could imagine writing a utility function similar to splice in Java but it would return a different array. There's no point in having arrays in java if you resize them: it's not efficient and you can't share the instance.
The usual and clean solution is t... | **In standard Java libraries, there is no equivalent functionality.**
There is `java.util.Arrays` class, but no similar functionality there. |
29,052,256 | I am trying to set a icon variable so that I can use it within my library fragment.
The icons ive put in the drawable folders...
When I try the following it does not work?
```
private final static int ICON_FOLDER = R.drawable.ic_folder;
```
Says cannot resolve R? I even tried to import the library R however this ... | 2015/03/14 | [
"https://Stackoverflow.com/questions/29052256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4370449/"
] | Java arrays have a fixed length, so there's no such method.
You could imagine writing a utility function similar to splice in Java but it would return a different array. There's no point in having arrays in java if you resize them: it's not efficient and you can't share the instance.
The usual and clean solution is t... | I misread your question and mixed up `splice` and `slice`.
The class `java.util.Arrays` provides some static functions useful when working with arrays. See the official documentation for other functions: **<http://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html>**.
Java's equivalent for `slice` is: `Arrays.co... |
29,052,256 | I am trying to set a icon variable so that I can use it within my library fragment.
The icons ive put in the drawable folders...
When I try the following it does not work?
```
private final static int ICON_FOLDER = R.drawable.ic_folder;
```
Says cannot resolve R? I even tried to import the library R however this ... | 2015/03/14 | [
"https://Stackoverflow.com/questions/29052256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4370449/"
] | Java arrays have a fixed length, so there's no such method.
You could imagine writing a utility function similar to splice in Java but it would return a different array. There's no point in having arrays in java if you resize them: it's not efficient and you can't share the instance.
The usual and clean solution is t... | Java arrays have a fixed length, so this cannot be done directly.
If you want to combine two arrays, look at [this answer](https://stackoverflow.com/a/80503/4428462).
If you want to add to the array, you should use a `List` or an `ArrayList` instead. |
29,052,256 | I am trying to set a icon variable so that I can use it within my library fragment.
The icons ive put in the drawable folders...
When I try the following it does not work?
```
private final static int ICON_FOLDER = R.drawable.ic_folder;
```
Says cannot resolve R? I even tried to import the library R however this ... | 2015/03/14 | [
"https://Stackoverflow.com/questions/29052256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4370449/"
] | Here is a Java implementation of the `Array.prototype.splice()` method as per the [JavaScript MDN specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice).
```
public static <T>T[] splice(final T[] array, int start) {
if (start < 0)
start += array.length... | Java arrays have a fixed length, so there's no such method.
You could imagine writing a utility function similar to splice in Java but it would return a different array. There's no point in having arrays in java if you resize them: it's not efficient and you can't share the instance.
The usual and clean solution is t... |
29,052,256 | I am trying to set a icon variable so that I can use it within my library fragment.
The icons ive put in the drawable folders...
When I try the following it does not work?
```
private final static int ICON_FOLDER = R.drawable.ic_folder;
```
Says cannot resolve R? I even tried to import the library R however this ... | 2015/03/14 | [
"https://Stackoverflow.com/questions/29052256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4370449/"
] | Java arrays have a fixed length, so there's no such method.
You could imagine writing a utility function similar to splice in Java but it would return a different array. There's no point in having arrays in java if you resize them: it's not efficient and you can't share the instance.
The usual and clean solution is t... | Arrays in Java have a fixed number of elements. But you can make that element null like this:
array[element]==null;
And that is the same as removing it from the array. You can also have a variable that keeps track of how many elements aren't null, so that you can even have an array.length kind of thing that follows t... |
29,052,256 | I am trying to set a icon variable so that I can use it within my library fragment.
The icons ive put in the drawable folders...
When I try the following it does not work?
```
private final static int ICON_FOLDER = R.drawable.ic_folder;
```
Says cannot resolve R? I even tried to import the library R however this ... | 2015/03/14 | [
"https://Stackoverflow.com/questions/29052256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4370449/"
] | Here is a Java implementation of the `Array.prototype.splice()` method as per the [JavaScript MDN specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice).
```
public static <T>T[] splice(final T[] array, int start) {
if (start < 0)
start += array.length... | **In standard Java libraries, there is no equivalent functionality.**
There is `java.util.Arrays` class, but no similar functionality there. |
29,052,256 | I am trying to set a icon variable so that I can use it within my library fragment.
The icons ive put in the drawable folders...
When I try the following it does not work?
```
private final static int ICON_FOLDER = R.drawable.ic_folder;
```
Says cannot resolve R? I even tried to import the library R however this ... | 2015/03/14 | [
"https://Stackoverflow.com/questions/29052256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4370449/"
] | Here is a Java implementation of the `Array.prototype.splice()` method as per the [JavaScript MDN specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice).
```
public static <T>T[] splice(final T[] array, int start) {
if (start < 0)
start += array.length... | I misread your question and mixed up `splice` and `slice`.
The class `java.util.Arrays` provides some static functions useful when working with arrays. See the official documentation for other functions: **<http://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html>**.
Java's equivalent for `slice` is: `Arrays.co... |
29,052,256 | I am trying to set a icon variable so that I can use it within my library fragment.
The icons ive put in the drawable folders...
When I try the following it does not work?
```
private final static int ICON_FOLDER = R.drawable.ic_folder;
```
Says cannot resolve R? I even tried to import the library R however this ... | 2015/03/14 | [
"https://Stackoverflow.com/questions/29052256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4370449/"
] | Here is a Java implementation of the `Array.prototype.splice()` method as per the [JavaScript MDN specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice).
```
public static <T>T[] splice(final T[] array, int start) {
if (start < 0)
start += array.length... | Java arrays have a fixed length, so this cannot be done directly.
If you want to combine two arrays, look at [this answer](https://stackoverflow.com/a/80503/4428462).
If you want to add to the array, you should use a `List` or an `ArrayList` instead. |
29,052,256 | I am trying to set a icon variable so that I can use it within my library fragment.
The icons ive put in the drawable folders...
When I try the following it does not work?
```
private final static int ICON_FOLDER = R.drawable.ic_folder;
```
Says cannot resolve R? I even tried to import the library R however this ... | 2015/03/14 | [
"https://Stackoverflow.com/questions/29052256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4370449/"
] | Here is a Java implementation of the `Array.prototype.splice()` method as per the [JavaScript MDN specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice).
```
public static <T>T[] splice(final T[] array, int start) {
if (start < 0)
start += array.length... | Arrays in Java have a fixed number of elements. But you can make that element null like this:
array[element]==null;
And that is the same as removing it from the array. You can also have a variable that keeps track of how many elements aren't null, so that you can even have an array.length kind of thing that follows t... |
55,561,633 | I have a project in Xcode (I'm relatively new to Swift).
I was adding objects (text fields and labels to my storyboard).
I started connecting the text fields and labels to the code (control+drag). I was able to perform this several times.
Now all of a sudden, I can no longer perform this action (connect an outlet t... | 2019/04/07 | [
"https://Stackoverflow.com/questions/55561633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8877368/"
] | Yes, it's documented in the official Microsoft docs, it's called **Overload Resolution**.
Although it's a general thing (as in, it applies everywhere), so the results you're getting are normal.
<https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/named-and-optional-arguments#overlo... | As @Haytam point out, this process is call [Overload Resolution](https://en.wikipedia.org/wiki/Function_overloading).
It's described in the [Expressions](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/expressions) section in the [C# language specifications](https://learn.micro... |
10,452,544 | I am doing some stuff in my Javascript function and then I have to refresh the page using `location.reload();`
Is there a simple way with jQuery to show a spinning wheel from the point where the page starts to refresh to the point where the page is loaded?
Thanks for your help. | 2012/05/04 | [
"https://Stackoverflow.com/questions/10452544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/569077/"
] | While there might be a solution to just wrap `.reload()` call info your own function and show spinner before it I seriously doubt the effectiveness. As soon as you issues navigational request, your browser starts killing loaded resources (that also means images) and that's when all GIF's are going to halt with animatio... | If you need to avoid doing Ajax, my approach will be the following
* simply show an [animated gif as an image](http://ajaxload.info/) just before calling `location.reload();`
* always have the spinner image displayed (first item after your `<body>` tag, and hide it onload (window.onload / jQuery [ready](http://api.jq... |
10,452,544 | I am doing some stuff in my Javascript function and then I have to refresh the page using `location.reload();`
Is there a simple way with jQuery to show a spinning wheel from the point where the page starts to refresh to the point where the page is loaded?
Thanks for your help. | 2012/05/04 | [
"https://Stackoverflow.com/questions/10452544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/569077/"
] | While there might be a solution to just wrap `.reload()` call info your own function and show spinner before it I seriously doubt the effectiveness. As soon as you issues navigational request, your browser starts killing loaded resources (that also means images) and that's when all GIF's are going to halt with animatio... | Thanks @Jovan Perovic you found me a solution for this..the load() seems to be very usefull to me..Thanks once again |
399,035 | I want to forward different domain names to single IP Address (local for testing), but how can i recognize in pc that which domain name should be linked to which folder?
for example, in windows host file, I wrote
```
127.0.0.1 abc.com
127.0.0.1 test.abc.com
127.0.0.1 test1.abc.com
``` | 2012/06/15 | [
"https://serverfault.com/questions/399035",
"https://serverfault.com",
"https://serverfault.com/users/114555/"
] | Huge data is not problem with any protocols, problem is how many files you have and what you need to transfer (just a bunch of data or file permissions, owners etc).
FTP is a bad solution for this and inefficient. rsync, glusterfs is a good thing (tm) and so on... depends...
10 TB over LAN will take a lot of time if y... | I think webdav or rsync will be good too.
Even Cifs or NFS are good too, in windows enviroment probably I will use robocopy + cifs with multithread to improve the speed copy.
On Linux may be cp + NFS and GNU parallel <https://savannah.gnu.org/projects/parallel/>
I hope it will be usefull to you :) |
399,035 | I want to forward different domain names to single IP Address (local for testing), but how can i recognize in pc that which domain name should be linked to which folder?
for example, in windows host file, I wrote
```
127.0.0.1 abc.com
127.0.0.1 test.abc.com
127.0.0.1 test1.abc.com
``` | 2012/06/15 | [
"https://serverfault.com/questions/399035",
"https://serverfault.com",
"https://serverfault.com/users/114555/"
] | Huge data is not problem with any protocols, problem is how many files you have and what you need to transfer (just a bunch of data or file permissions, owners etc).
FTP is a bad solution for this and inefficient. rsync, glusterfs is a good thing (tm) and so on... depends...
10 TB over LAN will take a lot of time if y... | FTP works, but I'd make sure the client and server are both reasonably efficient and - most critically - offer the ability to resume transfers.
I would also suggest taking a look at rsync, as it's quite efficient and offers a bunch of options for controlling bandwidth and ongoing synchronization (if that's necessary). |
399,035 | I want to forward different domain names to single IP Address (local for testing), but how can i recognize in pc that which domain name should be linked to which folder?
for example, in windows host file, I wrote
```
127.0.0.1 abc.com
127.0.0.1 test.abc.com
127.0.0.1 test1.abc.com
``` | 2012/06/15 | [
"https://serverfault.com/questions/399035",
"https://serverfault.com",
"https://serverfault.com/users/114555/"
] | Huge data is not problem with any protocols, problem is how many files you have and what you need to transfer (just a bunch of data or file permissions, owners etc).
FTP is a bad solution for this and inefficient. rsync, glusterfs is a good thing (tm) and so on... depends...
10 TB over LAN will take a lot of time if y... | If Unix based, use Rsync with --archive option. It also allows easy stopping-and-starting. FTP doesn't. My advice is to not use FTP.
When using windows, you might want to take a look at synctoy. I'm not sure, but it also allows for stopping and starting.
And, is it Gigabit? If not, do you have the ability to wire the... |
399,035 | I want to forward different domain names to single IP Address (local for testing), but how can i recognize in pc that which domain name should be linked to which folder?
for example, in windows host file, I wrote
```
127.0.0.1 abc.com
127.0.0.1 test.abc.com
127.0.0.1 test1.abc.com
``` | 2012/06/15 | [
"https://serverfault.com/questions/399035",
"https://serverfault.com",
"https://serverfault.com/users/114555/"
] | Huge data is not problem with any protocols, problem is how many files you have and what you need to transfer (just a bunch of data or file permissions, owners etc).
FTP is a bad solution for this and inefficient. rsync, glusterfs is a good thing (tm) and so on... depends...
10 TB over LAN will take a lot of time if y... | While on Linux I usually do on receiving side:
```
nc -l 43210 | tar xf -
```
And on sending side:
```
tar cf - . | dd bs=1M | nc receiving_hostname 43210
```
And then I run in another terminal on sending side to get real time transfer statistics on sending console:
```
while sleep 10; do killall -USR1 dd; done
... |
399,035 | I want to forward different domain names to single IP Address (local for testing), but how can i recognize in pc that which domain name should be linked to which folder?
for example, in windows host file, I wrote
```
127.0.0.1 abc.com
127.0.0.1 test.abc.com
127.0.0.1 test1.abc.com
``` | 2012/06/15 | [
"https://serverfault.com/questions/399035",
"https://serverfault.com",
"https://serverfault.com/users/114555/"
] | Huge data is not problem with any protocols, problem is how many files you have and what you need to transfer (just a bunch of data or file permissions, owners etc).
FTP is a bad solution for this and inefficient. rsync, glusterfs is a good thing (tm) and so on... depends...
10 TB over LAN will take a lot of time if y... | How far are the machines from each other? Is it possible (i.e. practical) to disconnect the disk array from the first machine, physically attach it to the second machine, and do a local copy?
(Or the other way around - connect the second machine's disk array to the first machine) |
399,035 | I want to forward different domain names to single IP Address (local for testing), but how can i recognize in pc that which domain name should be linked to which folder?
for example, in windows host file, I wrote
```
127.0.0.1 abc.com
127.0.0.1 test.abc.com
127.0.0.1 test1.abc.com
``` | 2012/06/15 | [
"https://serverfault.com/questions/399035",
"https://serverfault.com",
"https://serverfault.com/users/114555/"
] | Huge data is not problem with any protocols, problem is how many files you have and what you need to transfer (just a bunch of data or file permissions, owners etc).
FTP is a bad solution for this and inefficient. rsync, glusterfs is a good thing (tm) and so on... depends...
10 TB over LAN will take a lot of time if y... | I have recently transferred 10 TB through a 1 Gbps connection. The major problem was keeping the 1 Gbps filled at all time. That was no problem when transferring big files, but proved to be a problem when transferring small files as the sender could not seek fast enough.
The solution was to run multiple transfers in p... |
46,991,709 | In my MVC5 application can get the Username in **\_Layout.cshtml** page by using
```
@User.Identity.Name
```
I added new field to the table **AspNetUsers** called FullName but I cant't display it in \_Layout.cshtml, It's show just Name!
[](https://... | 2017/10/28 | [
"https://Stackoverflow.com/questions/46991709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890313/"
] | Okay .. I solve it by using session to share FullName across all my application
```
HttpContext.Current.Session.Add("UserFullName", UserFullName);
```
Then I can use it in everywhere
```
@Session["UserFullName"]
```
Hope this help | You can do this by working with the user's Claims on `User.Identity`. When you handle your user's login, you should be able to retrieve the user's information from the database, including the FullName property you wish to store.
You cannot directly set this value to be what User.Identity.Name provides, however you can... |
46,991,709 | In my MVC5 application can get the Username in **\_Layout.cshtml** page by using
```
@User.Identity.Name
```
I added new field to the table **AspNetUsers** called FullName but I cant't display it in \_Layout.cshtml, It's show just Name!
[](https://... | 2017/10/28 | [
"https://Stackoverflow.com/questions/46991709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890313/"
] | You can do this by working with the user's Claims on `User.Identity`. When you handle your user's login, you should be able to retrieve the user's information from the database, including the FullName property you wish to store.
You cannot directly set this value to be what User.Identity.Name provides, however you can... | You can use TempData or ViewData. I think u can use reflection.
You can look this link.
[You can look this link](https://stackoverflow.com/questions/32282863/asp-net-mvc-model-binding-with-reflection) |
46,991,709 | In my MVC5 application can get the Username in **\_Layout.cshtml** page by using
```
@User.Identity.Name
```
I added new field to the table **AspNetUsers** called FullName but I cant't display it in \_Layout.cshtml, It's show just Name!
[](https://... | 2017/10/28 | [
"https://Stackoverflow.com/questions/46991709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890313/"
] | You can do this by working with the user's Claims on `User.Identity`. When you handle your user's login, you should be able to retrieve the user's information from the database, including the FullName property you wish to store.
You cannot directly set this value to be what User.Identity.Name provides, however you can... | The solution above from "Abdulsalam Elsharif" worked fine with me, but I can't resolve HttpContext.Current in asp.net mvc4
so in controller:
```
System.Web.HttpContext.Current.Session.Add("UserFullName", FullName);
```
and in view:
```
@Session["UserFullName"]
``` |
46,991,709 | In my MVC5 application can get the Username in **\_Layout.cshtml** page by using
```
@User.Identity.Name
```
I added new field to the table **AspNetUsers** called FullName but I cant't display it in \_Layout.cshtml, It's show just Name!
[](https://... | 2017/10/28 | [
"https://Stackoverflow.com/questions/46991709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890313/"
] | Okay .. I solve it by using session to share FullName across all my application
```
HttpContext.Current.Session.Add("UserFullName", UserFullName);
```
Then I can use it in everywhere
```
@Session["UserFullName"]
```
Hope this help | You can use TempData or ViewData. I think u can use reflection.
You can look this link.
[You can look this link](https://stackoverflow.com/questions/32282863/asp-net-mvc-model-binding-with-reflection) |
46,991,709 | In my MVC5 application can get the Username in **\_Layout.cshtml** page by using
```
@User.Identity.Name
```
I added new field to the table **AspNetUsers** called FullName but I cant't display it in \_Layout.cshtml, It's show just Name!
[](https://... | 2017/10/28 | [
"https://Stackoverflow.com/questions/46991709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890313/"
] | Okay .. I solve it by using session to share FullName across all my application
```
HttpContext.Current.Session.Add("UserFullName", UserFullName);
```
Then I can use it in everywhere
```
@Session["UserFullName"]
```
Hope this help | The solution above from "Abdulsalam Elsharif" worked fine with me, but I can't resolve HttpContext.Current in asp.net mvc4
so in controller:
```
System.Web.HttpContext.Current.Session.Add("UserFullName", FullName);
```
and in view:
```
@Session["UserFullName"]
``` |
25,325,972 | I want to run a query using EntityFramework
```
Get(u => u.Roles.Contains("Administrator"));
```
where the Get action is the same as the one from the tutorial:
<http://www.asp.net/mvc/tutorials/getting-started-with-ef-5-using-mvc-4/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-applicat... | 2014/08/15 | [
"https://Stackoverflow.com/questions/25325972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1693096/"
] | You aren't using `.Contains()` how it is intended to be used. Look at the doc: <http://msdn.microsoft.com/en-us/library/system.linq.enumerable.contains(v=vs.100).ASPX>
Doc says it "Determines whether a sequence contains a specified element." Whether means T/F. It wont grab the users that have contain the specified ro... | Try it with `U.Roles.Name == "Administrator"` or something like that? |
25,325,972 | I want to run a query using EntityFramework
```
Get(u => u.Roles.Contains("Administrator"));
```
where the Get action is the same as the one from the tutorial:
<http://www.asp.net/mvc/tutorials/getting-started-with-ef-5-using-mvc-4/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-applicat... | 2014/08/15 | [
"https://Stackoverflow.com/questions/25325972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1693096/"
] | The other answer is close, but you'll need to look up the `RoleId` of the `Administrators` role first (because an `IdentityUserRole` doesn't have a `Name` property, unfortunately.) Once you've gotten that, it's relatively simple.
In the example below I've nested another query to pull all users who's collection of `Rol... | Try it with `U.Roles.Name == "Administrator"` or something like that? |
25,325,972 | I want to run a query using EntityFramework
```
Get(u => u.Roles.Contains("Administrator"));
```
where the Get action is the same as the one from the tutorial:
<http://www.asp.net/mvc/tutorials/getting-started-with-ef-5-using-mvc-4/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-applicat... | 2014/08/15 | [
"https://Stackoverflow.com/questions/25325972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1693096/"
] | The other answer is close, but you'll need to look up the `RoleId` of the `Administrators` role first (because an `IdentityUserRole` doesn't have a `Name` property, unfortunately.) Once you've gotten that, it's relatively simple.
In the example below I've nested another query to pull all users who's collection of `Rol... | You aren't using `.Contains()` how it is intended to be used. Look at the doc: <http://msdn.microsoft.com/en-us/library/system.linq.enumerable.contains(v=vs.100).ASPX>
Doc says it "Determines whether a sequence contains a specified element." Whether means T/F. It wont grab the users that have contain the specified ro... |
129,620 | In a galaxy far far away, during a fit of inspiration for a super massive marvel of technology, the Imperator dedicates an astounding 10% of energy and materials from his civilization's dyson sphere and solar materials processing units to attempt an innovative (and possibly insane) plan to create a matryoshka world. By... | 2018/11/08 | [
"https://worldbuilding.stackexchange.com/questions/129620",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/57129/"
] | You *do* want to freeze the outer shells and bake the inner shells. That is the entire point of a Matryoshka Brain. The entire point is to be able to create a multi-stage Carnot engine with a massive number of stages, and an incredibly high efficiency. This will implicitly call for hot inner shells and cold outer shell... | Your comments suggest your already aware of Septerra Core, so maybe use it's solutions.
The upper shells are a desert, the top being a polar desert, the second being a warmer windy desert, and the bottom being a warm dark jungle with plants competing for the little light available and the heat coming from the lava on ... |
129,620 | In a galaxy far far away, during a fit of inspiration for a super massive marvel of technology, the Imperator dedicates an astounding 10% of energy and materials from his civilization's dyson sphere and solar materials processing units to attempt an innovative (and possibly insane) plan to create a matryoshka world. By... | 2018/11/08 | [
"https://worldbuilding.stackexchange.com/questions/129620",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/57129/"
] | You *do* want to freeze the outer shells and bake the inner shells. That is the entire point of a Matryoshka Brain. The entire point is to be able to create a multi-stage Carnot engine with a massive number of stages, and an incredibly high efficiency. This will implicitly call for hot inner shells and cold outer shell... | You want to insulate the outside layer and let heat through to the inside layer.
The outside layer is going to have a temperature dominated by the cold of space, at something like -270C. It's really cold. Heat is going to constantly flow through it. You need to make sure that the energy from 1 star can pass through th... |
129,620 | In a galaxy far far away, during a fit of inspiration for a super massive marvel of technology, the Imperator dedicates an astounding 10% of energy and materials from his civilization's dyson sphere and solar materials processing units to attempt an innovative (and possibly insane) plan to create a matryoshka world. By... | 2018/11/08 | [
"https://worldbuilding.stackexchange.com/questions/129620",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/57129/"
] | You *do* want to freeze the outer shells and bake the inner shells. That is the entire point of a Matryoshka Brain. The entire point is to be able to create a multi-stage Carnot engine with a massive number of stages, and an incredibly high efficiency. This will implicitly call for hot inner shells and cold outer shell... | This has been said in some of the comments to the answers, but no one has stated it outright:
**Why does a civilization capable of producing a Dyson Sphere require this boondoggle?**
If it's a vanity project, because the Imperator wants to build one, sure, no problem. But the inner (or outer, depending on star type) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.