qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
102,593
I'm playing Minecraft on the Xbox, and the only way to identify current position is by looking at the map. The X and Z co-ordinates are what they are, as you only take up one block in those dimensions. However, I'm unsure how to interpret the Y co-ordinate. Is it at my head or my feet? I found [this question](https:/...
2013/01/24
[ "https://gaming.stackexchange.com/questions/102593", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/30989/" ]
The easiest trick to solo Hyperius is to use the Evil Masher Glitch/Exploit. It hasn't been patched yet, but it's been around a long time. Basically, the Evil Masher is an assault rifle with sub-par stats, a reward from Marcus's mission (Kai). When reloading however, there is a chance to "power up" the weapon. Taken ...
I personally when fighting him alone went for his robots first and then targeted him he has a shield that makes it so I think you have to do it that way. I used corrosive rocket launchers and a turtle shield and managed to kill him by myself
15,187
I'd like to take an existing application (written in OCaml) and create an Emacs "interface" for it (like, for example, the Emacs GDB mode). I would prefer to do this without writing a ton of Lisp code. In MVC terms, I'd like for the View to be Emacs, but for the Model and Controller to remain (primarily) OCaml. Does a...
2008/08/18
[ "https://Stackoverflow.com/questions/15187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
<http://www.emacswiki.org/cgi-bin/emacs-en?CategoryExtensionLanguage> is a list of all non-Elisp extension languages you can use. It does appear to be dynamic language centric. <http://common-lisp.net/project/slime/> is missing from that list, as it is not quite an extension language, but an Elisp-Common Lisp bridge....
I don't know if this will work for your particular problem, but I have been doing something similar using the shell-command-to-string function: ``` (shell-command-to-string "bash -c \"script-to-exec args\"") ``` So for example, we have existing scripts written in python which will mangle a file, so the above let...
15,187
I'd like to take an existing application (written in OCaml) and create an Emacs "interface" for it (like, for example, the Emacs GDB mode). I would prefer to do this without writing a ton of Lisp code. In MVC terms, I'd like for the View to be Emacs, but for the Model and Controller to remain (primarily) OCaml. Does a...
2008/08/18
[ "https://Stackoverflow.com/questions/15187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
I don't know if this will work for your particular problem, but I have been doing something similar using the shell-command-to-string function: ``` (shell-command-to-string "bash -c \"script-to-exec args\"") ``` So for example, we have existing scripts written in python which will mangle a file, so the above let...
There is no "Extension API". Emacs Lisp is way in there, and it ain't moving. You can run Emacs commands from your other process. Have a look at Gnuserv. There are plenty of applications where Emacs is the View for a Model/Controller in a separate process. The Emacs GDB interface is a good example. I'm not sure of a ...
15,187
I'd like to take an existing application (written in OCaml) and create an Emacs "interface" for it (like, for example, the Emacs GDB mode). I would prefer to do this without writing a ton of Lisp code. In MVC terms, I'd like for the View to be Emacs, but for the Model and Controller to remain (primarily) OCaml. Does a...
2008/08/18
[ "https://Stackoverflow.com/questions/15187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
<http://www.emacswiki.org/cgi-bin/emacs-en?CategoryExtensionLanguage> is a list of all non-Elisp extension languages you can use. It does appear to be dynamic language centric. <http://common-lisp.net/project/slime/> is missing from that list, as it is not quite an extension language, but an Elisp-Common Lisp bridge....
There is no "Extension API". Emacs Lisp is way in there, and it ain't moving. You can run Emacs commands from your other process. Have a look at Gnuserv. There are plenty of applications where Emacs is the View for a Model/Controller in a separate process. The Emacs GDB interface is a good example. I'm not sure of a ...
15,187
I'd like to take an existing application (written in OCaml) and create an Emacs "interface" for it (like, for example, the Emacs GDB mode). I would prefer to do this without writing a ton of Lisp code. In MVC terms, I'd like for the View to be Emacs, but for the Model and Controller to remain (primarily) OCaml. Does a...
2008/08/18
[ "https://Stackoverflow.com/questions/15187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
<http://www.emacswiki.org/cgi-bin/emacs-en?CategoryExtensionLanguage> is a list of all non-Elisp extension languages you can use. It does appear to be dynamic language centric. <http://common-lisp.net/project/slime/> is missing from that list, as it is not quite an extension language, but an Elisp-Common Lisp bridge....
Try [PyMacs](https://github.com/pinard/Pymacs), which allows extending Emacs in Python. *edit*: updated link.
15,187
I'd like to take an existing application (written in OCaml) and create an Emacs "interface" for it (like, for example, the Emacs GDB mode). I would prefer to do this without writing a ton of Lisp code. In MVC terms, I'd like for the View to be Emacs, but for the Model and Controller to remain (primarily) OCaml. Does a...
2008/08/18
[ "https://Stackoverflow.com/questions/15187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
<http://www.emacswiki.org/cgi-bin/emacs-en?CategoryExtensionLanguage> is a list of all non-Elisp extension languages you can use. It does appear to be dynamic language centric. <http://common-lisp.net/project/slime/> is missing from that list, as it is not quite an extension language, but an Elisp-Common Lisp bridge....
From the statically typed languages side, there is something that looks quite performant and well featured for Haskell: <https://github.com/knupfer/haskell-emacs> there is also probably something useful for Scala to be reused from the Ensime project (has a bridge for both Emacs and Vim): <https://github.com/ensime/e...
15,187
I'd like to take an existing application (written in OCaml) and create an Emacs "interface" for it (like, for example, the Emacs GDB mode). I would prefer to do this without writing a ton of Lisp code. In MVC terms, I'd like for the View to be Emacs, but for the Model and Controller to remain (primarily) OCaml. Does a...
2008/08/18
[ "https://Stackoverflow.com/questions/15187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
<http://www.emacswiki.org/cgi-bin/emacs-en?CategoryExtensionLanguage> is a list of all non-Elisp extension languages you can use. It does appear to be dynamic language centric. <http://common-lisp.net/project/slime/> is missing from that list, as it is not quite an extension language, but an Elisp-Common Lisp bridge....
Some Extension Api is now possible with the incoming emacs 25.1 and dynamic modules A Library, [`emacs-ffi`](https://github.com/tromey/emacs-ffi) offer a foreign function interface based on `libffi`. Check out complete documentation on the [README](https://github.com/tromey/emacs-ffi/blob/master/README.md).
15,187
I'd like to take an existing application (written in OCaml) and create an Emacs "interface" for it (like, for example, the Emacs GDB mode). I would prefer to do this without writing a ton of Lisp code. In MVC terms, I'd like for the View to be Emacs, but for the Model and Controller to remain (primarily) OCaml. Does a...
2008/08/18
[ "https://Stackoverflow.com/questions/15187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
Try [PyMacs](https://github.com/pinard/Pymacs), which allows extending Emacs in Python. *edit*: updated link.
There is no "Extension API". Emacs Lisp is way in there, and it ain't moving. You can run Emacs commands from your other process. Have a look at Gnuserv. There are plenty of applications where Emacs is the View for a Model/Controller in a separate process. The Emacs GDB interface is a good example. I'm not sure of a ...
15,187
I'd like to take an existing application (written in OCaml) and create an Emacs "interface" for it (like, for example, the Emacs GDB mode). I would prefer to do this without writing a ton of Lisp code. In MVC terms, I'd like for the View to be Emacs, but for the Model and Controller to remain (primarily) OCaml. Does a...
2008/08/18
[ "https://Stackoverflow.com/questions/15187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
From the statically typed languages side, there is something that looks quite performant and well featured for Haskell: <https://github.com/knupfer/haskell-emacs> there is also probably something useful for Scala to be reused from the Ensime project (has a bridge for both Emacs and Vim): <https://github.com/ensime/e...
There is no "Extension API". Emacs Lisp is way in there, and it ain't moving. You can run Emacs commands from your other process. Have a look at Gnuserv. There are plenty of applications where Emacs is the View for a Model/Controller in a separate process. The Emacs GDB interface is a good example. I'm not sure of a ...
15,187
I'd like to take an existing application (written in OCaml) and create an Emacs "interface" for it (like, for example, the Emacs GDB mode). I would prefer to do this without writing a ton of Lisp code. In MVC terms, I'd like for the View to be Emacs, but for the Model and Controller to remain (primarily) OCaml. Does a...
2008/08/18
[ "https://Stackoverflow.com/questions/15187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
Some Extension Api is now possible with the incoming emacs 25.1 and dynamic modules A Library, [`emacs-ffi`](https://github.com/tromey/emacs-ffi) offer a foreign function interface based on `libffi`. Check out complete documentation on the [README](https://github.com/tromey/emacs-ffi/blob/master/README.md).
There is no "Extension API". Emacs Lisp is way in there, and it ain't moving. You can run Emacs commands from your other process. Have a look at Gnuserv. There are plenty of applications where Emacs is the View for a Model/Controller in a separate process. The Emacs GDB interface is a good example. I'm not sure of a ...
42,169,357
Using javascript, I'm trying to do the following. I'll boil this down into it's simplest version. I'd like to pass a variable from a text field to a URL, and have the URL be visited when the form is submitted. 1. user enters a number into a text input field "123" 2. user clicks the submit button 3. Browser redirects ...
2017/02/10
[ "https://Stackoverflow.com/questions/42169357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3366838/" ]
This would be my solution to the problem: ``` from time import sleep def pumpcheck(timer_in_minutes): time_clicked = datetime.datetime.now() now = time_clicked timeDiff = datetime.timedelta(minutes=int(timer_in_minutes)) while (time_clicked + timeDiff > now): print 'pumpOn' now = datet...
This sounds like something outside the scope of a single function. Either split the logic into two functions, or use a class to preserve `start_time`
42,169,357
Using javascript, I'm trying to do the following. I'll boil this down into it's simplest version. I'd like to pass a variable from a text field to a URL, and have the URL be visited when the form is submitted. 1. user enters a number into a text input field "123" 2. user clicks the submit button 3. Browser redirects ...
2017/02/10
[ "https://Stackoverflow.com/questions/42169357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3366838/" ]
There is some information missing as to how timedPump is evaluated. I guess it's a simple loop. What needs to happen is there have to be two functions, one that sets a turnOff-time and one that evaluates weather to turn on / off the pump. This can be implemented as two methods of a class: ``` class PumpControl(object...
This sounds like something outside the scope of a single function. Either split the logic into two functions, or use a class to preserve `start_time`
15,316,068
I have an MVC 4 app that contains a View where the user can enter search criteria (in a form) and then displays results in a table below the search form. For each row in the table, the user can click on a link that loads another View that shows him/her details about the item selected. On this details view, I have a li...
2013/03/09
[ "https://Stackoverflow.com/questions/15316068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/418384/" ]
The easiest way is to use javascript [history API](https://developer.mozilla.org/en/docs/DOM/Manipulating_the_browser_history): ``` window.history.back(); ``` [here](http://jsfiddle.net/QKreA/) is the fiddle
Here a HtmlHelper extension that does the trick. ``` public static class Helpers { public static MvcHtmlString BackViaHistory(this HtmlHelper helper, string linkText) { return new MvcHtmlString("<a onclick='javascript: window.history.back();'>" + linkText + "</a>"); } } ```
192,616
> > Looking for another ways to write a query that finds for each student his average in each subject. > > > **Students table:** ``` pk-INT VARCHAR VARCHAR +-----------+------------------+-----------------+ | StudentID | StudentFirstName | StudentLastName | +-----------+------------------+...
2017/12/07
[ "https://dba.stackexchange.com/questions/192616", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/136986/" ]
Something like this? ``` SELECT StudentFirstName,StudentLastName, ClassName, avg_grade AS 'average for this subject' FROM (SELECT StudentID, ClassName, AVG(Grade) AS avg_grade FROM tests GROUP BY StudentID, ClassName) t INNER JOIN students ON t.StudentID=students.StudentID ``` Horses for courses. Works ...
Cast your Grade field as Float or change the column type (best approach). E.g.: (AVG(CAST(Grade AS FLOAT))
4,777,230
I have a registration form, and i want to use a password field. The problem is, i want it to have a placeholder saying "Password" at the begining so i'm using a text field instead. I need to turn the characters into asterisks or black circles like a password field when the user starts typing. I've tried changing the...
2011/01/23
[ "https://Stackoverflow.com/questions/4777230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/470772/" ]
1. Use a regular password field 2. Don't abuse the `value` as a placeholder — it becomes invisible to, among others, screen reader users. 3. Put the label in a `<label>` 4. Position the label behind the input 5. Restyle the input with JS to change the background Demo at <http://dorward.me.uk/tmp/label-work/example.htm...
Hover a `div` or a `span` tag over your text (password) field, then hide it when the password field takes focus or the div/span is clicked.
4,777,230
I have a registration form, and i want to use a password field. The problem is, i want it to have a placeholder saying "Password" at the begining so i'm using a text field instead. I need to turn the characters into asterisks or black circles like a password field when the user starts typing. I've tried changing the...
2011/01/23
[ "https://Stackoverflow.com/questions/4777230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/470772/" ]
1. Use a regular password field 2. Don't abuse the `value` as a placeholder — it becomes invisible to, among others, screen reader users. 3. Put the label in a `<label>` 4. Position the label behind the input 5. Restyle the input with JS to change the background Demo at <http://dorward.me.uk/tmp/label-work/example.htm...
Generally, browsers frown at changing the `type` attribute of `input` elements via JavaScript. Most workarounds involve cloning the `input` with the new `type`, and removing the original. You could absolutely position the label over the input form, and remove it on focus. You should consider the implications of not u...
4,777,230
I have a registration form, and i want to use a password field. The problem is, i want it to have a placeholder saying "Password" at the begining so i'm using a text field instead. I need to turn the characters into asterisks or black circles like a password field when the user starts typing. I've tried changing the...
2011/01/23
[ "https://Stackoverflow.com/questions/4777230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/470772/" ]
1. Use a regular password field 2. Don't abuse the `value` as a placeholder — it becomes invisible to, among others, screen reader users. 3. Put the label in a `<label>` 4. Position the label behind the input 5. Restyle the input with JS to change the background Demo at <http://dorward.me.uk/tmp/label-work/example.htm...
You could use the HTML5 [`placeholder` attribute](http://www.w3schools.com/html5/att_input_placeholder.asp) However, that will not work in all browsers (especially older ones). ``` <input type="password" name="pwd" placeholder="Enter Password" /> ```
4,777,230
I have a registration form, and i want to use a password field. The problem is, i want it to have a placeholder saying "Password" at the begining so i'm using a text field instead. I need to turn the characters into asterisks or black circles like a password field when the user starts typing. I've tried changing the...
2011/01/23
[ "https://Stackoverflow.com/questions/4777230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/470772/" ]
1. Use a regular password field 2. Don't abuse the `value` as a placeholder — it becomes invisible to, among others, screen reader users. 3. Put the label in a `<label>` 4. Position the label behind the input 5. Restyle the input with JS to change the background Demo at <http://dorward.me.uk/tmp/label-work/example.htm...
I had a similar problem, where I had the Value of the inputs as my labels, and when you clicked inside one, some Javascript would run, clearing the input. But on the password field, you needed to change the input type from "text" to "password", which works in browsers like Safari or Firefox, but not IE (IE doesn't supp...
4,777,230
I have a registration form, and i want to use a password field. The problem is, i want it to have a placeholder saying "Password" at the begining so i'm using a text field instead. I need to turn the characters into asterisks or black circles like a password field when the user starts typing. I've tried changing the...
2011/01/23
[ "https://Stackoverflow.com/questions/4777230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/470772/" ]
Hover a `div` or a `span` tag over your text (password) field, then hide it when the password field takes focus or the div/span is clicked.
Generally, browsers frown at changing the `type` attribute of `input` elements via JavaScript. Most workarounds involve cloning the `input` with the new `type`, and removing the original. You could absolutely position the label over the input form, and remove it on focus. You should consider the implications of not u...
4,777,230
I have a registration form, and i want to use a password field. The problem is, i want it to have a placeholder saying "Password" at the begining so i'm using a text field instead. I need to turn the characters into asterisks or black circles like a password field when the user starts typing. I've tried changing the...
2011/01/23
[ "https://Stackoverflow.com/questions/4777230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/470772/" ]
Hover a `div` or a `span` tag over your text (password) field, then hide it when the password field takes focus or the div/span is clicked.
You could use the HTML5 [`placeholder` attribute](http://www.w3schools.com/html5/att_input_placeholder.asp) However, that will not work in all browsers (especially older ones). ``` <input type="password" name="pwd" placeholder="Enter Password" /> ```
4,777,230
I have a registration form, and i want to use a password field. The problem is, i want it to have a placeholder saying "Password" at the begining so i'm using a text field instead. I need to turn the characters into asterisks or black circles like a password field when the user starts typing. I've tried changing the...
2011/01/23
[ "https://Stackoverflow.com/questions/4777230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/470772/" ]
Hover a `div` or a `span` tag over your text (password) field, then hide it when the password field takes focus or the div/span is clicked.
I had a similar problem, where I had the Value of the inputs as my labels, and when you clicked inside one, some Javascript would run, clearing the input. But on the password field, you needed to change the input type from "text" to "password", which works in browsers like Safari or Firefox, but not IE (IE doesn't supp...
4,777,230
I have a registration form, and i want to use a password field. The problem is, i want it to have a placeholder saying "Password" at the begining so i'm using a text field instead. I need to turn the characters into asterisks or black circles like a password field when the user starts typing. I've tried changing the...
2011/01/23
[ "https://Stackoverflow.com/questions/4777230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/470772/" ]
You could use the HTML5 [`placeholder` attribute](http://www.w3schools.com/html5/att_input_placeholder.asp) However, that will not work in all browsers (especially older ones). ``` <input type="password" name="pwd" placeholder="Enter Password" /> ```
Generally, browsers frown at changing the `type` attribute of `input` elements via JavaScript. Most workarounds involve cloning the `input` with the new `type`, and removing the original. You could absolutely position the label over the input form, and remove it on focus. You should consider the implications of not u...
4,777,230
I have a registration form, and i want to use a password field. The problem is, i want it to have a placeholder saying "Password" at the begining so i'm using a text field instead. I need to turn the characters into asterisks or black circles like a password field when the user starts typing. I've tried changing the...
2011/01/23
[ "https://Stackoverflow.com/questions/4777230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/470772/" ]
You could use the HTML5 [`placeholder` attribute](http://www.w3schools.com/html5/att_input_placeholder.asp) However, that will not work in all browsers (especially older ones). ``` <input type="password" name="pwd" placeholder="Enter Password" /> ```
I had a similar problem, where I had the Value of the inputs as my labels, and when you clicked inside one, some Javascript would run, clearing the input. But on the password field, you needed to change the input type from "text" to "password", which works in browsers like Safari or Firefox, but not IE (IE doesn't supp...
7,346,895
I have a string that contains some values I need to extract. Each of these values is surrounded by a common character. What is the most efficient way to extract all of these values into an array? For example, given the following string: ``` stackoverflowis%value1%butyouarevery%value2% ``` I would like to get an a...
2011/09/08
[ "https://Stackoverflow.com/questions/7346895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/181748/" ]
``` $s = "stackoverflowis%value1%butyouarevery%value2%"; preg_match_all('~%(.+?)%~', $s, $m); $values = $m[1]; ``` [preg\_match\_all](http://php.net/manual/en/function.preg-match-all.php)
Give a try to explode. Like $array = explode('%', $string); LE: ``` <?php $s = 'stackoverflowis%value1%butyouarevery%value2%'; $a = explode('%', $s); $a = array_filter($a, 'strlen'); // removing NULL values $last = ''; // last value inserted; for($i=0;$i<=count($a);$i++) if (isset($a[$i+1]) && $a[$i] <> $last) ...
7,346,895
I have a string that contains some values I need to extract. Each of these values is surrounded by a common character. What is the most efficient way to extract all of these values into an array? For example, given the following string: ``` stackoverflowis%value1%butyouarevery%value2% ``` I would like to get an a...
2011/09/08
[ "https://Stackoverflow.com/questions/7346895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/181748/" ]
Give a try to explode. Like $array = explode('%', $string); LE: ``` <?php $s = 'stackoverflowis%value1%butyouarevery%value2%'; $a = explode('%', $s); $a = array_filter($a, 'strlen'); // removing NULL values $last = ''; // last value inserted; for($i=0;$i<=count($a);$i++) if (isset($a[$i+1]) && $a[$i] <> $last) ...
``` preg_match_all('/%([^%]+)%/', $s, $match); var_dump($match[1]); ```
7,346,895
I have a string that contains some values I need to extract. Each of these values is surrounded by a common character. What is the most efficient way to extract all of these values into an array? For example, given the following string: ``` stackoverflowis%value1%butyouarevery%value2% ``` I would like to get an a...
2011/09/08
[ "https://Stackoverflow.com/questions/7346895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/181748/" ]
``` $s = "stackoverflowis%value1%butyouarevery%value2%"; preg_match_all('~%(.+?)%~', $s, $m); $values = $m[1]; ``` [preg\_match\_all](http://php.net/manual/en/function.preg-match-all.php)
``` $string = 'stackoverflowis%value1%butyouarevery%value2%'; $string = trim( $string, '%' ); $array = explode( '%' , $string ); ```
7,346,895
I have a string that contains some values I need to extract. Each of these values is surrounded by a common character. What is the most efficient way to extract all of these values into an array? For example, given the following string: ``` stackoverflowis%value1%butyouarevery%value2% ``` I would like to get an a...
2011/09/08
[ "https://Stackoverflow.com/questions/7346895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/181748/" ]
``` $s = "stackoverflowis%value1%butyouarevery%value2%"; preg_match_all('~%(.+?)%~', $s, $m); $values = $m[1]; ``` [preg\_match\_all](http://php.net/manual/en/function.preg-match-all.php)
``` preg_match_all('/%([^%]+)%/', $s, $match); var_dump($match[1]); ```
7,346,895
I have a string that contains some values I need to extract. Each of these values is surrounded by a common character. What is the most efficient way to extract all of these values into an array? For example, given the following string: ``` stackoverflowis%value1%butyouarevery%value2% ``` I would like to get an a...
2011/09/08
[ "https://Stackoverflow.com/questions/7346895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/181748/" ]
``` $s = "stackoverflowis%value1%butyouarevery%value2%"; preg_match_all('~%(.+?)%~', $s, $m); $values = $m[1]; ``` [preg\_match\_all](http://php.net/manual/en/function.preg-match-all.php)
``` $str = "stackoverflowis%value1%butyouarevery%value2%"; preg_match_all('/%([a-z0-9]+)%/',$str,$m); var_dump($m[1]); array(2) { [0]=> string(6) "value1" [1]=> string(6) "value2" } ```
7,346,895
I have a string that contains some values I need to extract. Each of these values is surrounded by a common character. What is the most efficient way to extract all of these values into an array? For example, given the following string: ``` stackoverflowis%value1%butyouarevery%value2% ``` I would like to get an a...
2011/09/08
[ "https://Stackoverflow.com/questions/7346895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/181748/" ]
``` $s = "stackoverflowis%value1%butyouarevery%value2%"; preg_match_all('~%(.+?)%~', $s, $m); $values = $m[1]; ``` [preg\_match\_all](http://php.net/manual/en/function.preg-match-all.php)
Use `explode` and take the odd-indexed values from the resulting array. You indicated you wanted the most efficient method, and this will be faster than a regex solution. ``` $str = 'stackoverflowis%value1%butyouarevery%value2%'; $arr = explode('%', $str); $ct = count($arr); for ($i = 1; $i < $ct; $i += 2) { ech...
7,346,895
I have a string that contains some values I need to extract. Each of these values is surrounded by a common character. What is the most efficient way to extract all of these values into an array? For example, given the following string: ``` stackoverflowis%value1%butyouarevery%value2% ``` I would like to get an a...
2011/09/08
[ "https://Stackoverflow.com/questions/7346895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/181748/" ]
``` $string = 'stackoverflowis%value1%butyouarevery%value2%'; $string = trim( $string, '%' ); $array = explode( '%' , $string ); ```
``` preg_match_all('/%([^%]+)%/', $s, $match); var_dump($match[1]); ```
7,346,895
I have a string that contains some values I need to extract. Each of these values is surrounded by a common character. What is the most efficient way to extract all of these values into an array? For example, given the following string: ``` stackoverflowis%value1%butyouarevery%value2% ``` I would like to get an a...
2011/09/08
[ "https://Stackoverflow.com/questions/7346895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/181748/" ]
``` $str = "stackoverflowis%value1%butyouarevery%value2%"; preg_match_all('/%([a-z0-9]+)%/',$str,$m); var_dump($m[1]); array(2) { [0]=> string(6) "value1" [1]=> string(6) "value2" } ```
``` preg_match_all('/%([^%]+)%/', $s, $match); var_dump($match[1]); ```
7,346,895
I have a string that contains some values I need to extract. Each of these values is surrounded by a common character. What is the most efficient way to extract all of these values into an array? For example, given the following string: ``` stackoverflowis%value1%butyouarevery%value2% ``` I would like to get an a...
2011/09/08
[ "https://Stackoverflow.com/questions/7346895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/181748/" ]
Use `explode` and take the odd-indexed values from the resulting array. You indicated you wanted the most efficient method, and this will be faster than a regex solution. ``` $str = 'stackoverflowis%value1%butyouarevery%value2%'; $arr = explode('%', $str); $ct = count($arr); for ($i = 1; $i < $ct; $i += 2) { ech...
``` preg_match_all('/%([^%]+)%/', $s, $match); var_dump($match[1]); ```
13,108,327
I am not very skilled in Java so I consider my question as basic. I am writing an interface for something like ArrayResult. There will be methods add and get. Problem is that ArrayResult can obtain values of Integer or Double. So I need to define methods in interface more generally. I figured out that it is possible t...
2012/10/28
[ "https://Stackoverflow.com/questions/13108327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/711143/" ]
I guess what you want is ``` interface ArrayResult<N extends Number> { public N get(Integer index); public void add(N value); } ``` Then you can write two separate specific implementers ``` class IntegerResult implements ArrayResult<Integer> { @Override public void add(Integer value) { } ...
``` interface ArrayResult<N extends Number> { public N get(Integer index); public void add(N value); } ```
13,108,327
I am not very skilled in Java so I consider my question as basic. I am writing an interface for something like ArrayResult. There will be methods add and get. Problem is that ArrayResult can obtain values of Integer or Double. So I need to define methods in interface more generally. I figured out that it is possible t...
2012/10/28
[ "https://Stackoverflow.com/questions/13108327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/711143/" ]
I guess what you want is ``` interface ArrayResult<N extends Number> { public N get(Integer index); public void add(N value); } ``` Then you can write two separate specific implementers ``` class IntegerResult implements ArrayResult<Integer> { @Override public void add(Integer value) { } ...
Just return `Number`. ``` Number get(Integer index); ``` This will also allow you to return any `Number` descendants like `Integer` and `Double`. In Java parent type can hold any descendant type. Also use integral type `int` in getter argument. ``` Number get(int index) ``` Also you can use predefined class l...
13,108,327
I am not very skilled in Java so I consider my question as basic. I am writing an interface for something like ArrayResult. There will be methods add and get. Problem is that ArrayResult can obtain values of Integer or Double. So I need to define methods in interface more generally. I figured out that it is possible t...
2012/10/28
[ "https://Stackoverflow.com/questions/13108327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/711143/" ]
``` interface ArrayResult<N extends Number> { public N get(Integer index); public void add(N value); } ```
Just return `Number`. ``` Number get(Integer index); ``` This will also allow you to return any `Number` descendants like `Integer` and `Double`. In Java parent type can hold any descendant type. Also use integral type `int` in getter argument. ``` Number get(int index) ``` Also you can use predefined class l...
3,540,187
I have $(X,d) \text{ and } (Y,d')$ two metric spaces. I define the metric space $(X \times Y, d\_{\infty})$ and the projections $\pi\_1:X \times Y \rightarrow X$, $\pi\_2:X \times Y \rightarrow Y$. I've already shown that these functions are continous and open, but can't find an example for where it's not closed
2020/02/09
[ "https://math.stackexchange.com/questions/3540187", "https://math.stackexchange.com", "https://math.stackexchange.com/users/432563/" ]
Let $X=Y=\mathbb{R}$ and let $C=\{(x,y)\in (0,\infty)\times (0,\infty)\;|y\geq 1/x \}$ Then, $C$ is closed. Indeed, if $(x\_n,y\_n)\in C$ with limit $(x,y)$, then either $x\neq 0$, in which case $(x,y)\in C$ by continuity of $x\mapsto \frac{1}{x}$, or $x=0$, in which case the $y\_n$ sequence is unbounded and thus, not...
The set $\{(x,y)\in\mathbb R^2\mid xy\geq1\}$ is a closed subset of $\mathbb R^2$. However it is projected to $\mathbb R-\{0\}$ which is not closed in $\mathbb R$.
3,540,187
I have $(X,d) \text{ and } (Y,d')$ two metric spaces. I define the metric space $(X \times Y, d\_{\infty})$ and the projections $\pi\_1:X \times Y \rightarrow X$, $\pi\_2:X \times Y \rightarrow Y$. I've already shown that these functions are continous and open, but can't find an example for where it's not closed
2020/02/09
[ "https://math.stackexchange.com/questions/3540187", "https://math.stackexchange.com", "https://math.stackexchange.com/users/432563/" ]
A classical example is $X=Y=\mathbb R$. The sup metric on $\mathbb R^2$ induces the Euclidean topology. Let now $C=\{xy=1\}$. It is closed in $\mathbb R^2$ but it's project on the X-axis is $\{x\neq0\}$, which is not closed.
Let $X=Y=\mathbb{R}$ and let $C=\{(x,y)\in (0,\infty)\times (0,\infty)\;|y\geq 1/x \}$ Then, $C$ is closed. Indeed, if $(x\_n,y\_n)\in C$ with limit $(x,y)$, then either $x\neq 0$, in which case $(x,y)\in C$ by continuity of $x\mapsto \frac{1}{x}$, or $x=0$, in which case the $y\_n$ sequence is unbounded and thus, not...
3,540,187
I have $(X,d) \text{ and } (Y,d')$ two metric spaces. I define the metric space $(X \times Y, d\_{\infty})$ and the projections $\pi\_1:X \times Y \rightarrow X$, $\pi\_2:X \times Y \rightarrow Y$. I've already shown that these functions are continous and open, but can't find an example for where it's not closed
2020/02/09
[ "https://math.stackexchange.com/questions/3540187", "https://math.stackexchange.com", "https://math.stackexchange.com/users/432563/" ]
The "standard" example: Take $(X,d)=(\Bbb R, d\_e)=(Y,d')$ where $d\_e(x,y)=|x-y|$ the usual Euclidean metric. $d\_\infty$ is equivalent to the usual metric on $\Bbb R^2$. Show that $A=\{(x,y) \in \Bbb R^2: xy=1\}$ is a closed set (the inverse image of $\{1\}$ under a continuous map) and $\pi\_1[A]=\pi\_2[A]= \Bbb R...
The set $\{(x,y)\in\mathbb R^2\mid xy\geq1\}$ is a closed subset of $\mathbb R^2$. However it is projected to $\mathbb R-\{0\}$ which is not closed in $\mathbb R$.
3,540,187
I have $(X,d) \text{ and } (Y,d')$ two metric spaces. I define the metric space $(X \times Y, d\_{\infty})$ and the projections $\pi\_1:X \times Y \rightarrow X$, $\pi\_2:X \times Y \rightarrow Y$. I've already shown that these functions are continous and open, but can't find an example for where it's not closed
2020/02/09
[ "https://math.stackexchange.com/questions/3540187", "https://math.stackexchange.com", "https://math.stackexchange.com/users/432563/" ]
A classical example is $X=Y=\mathbb R$. The sup metric on $\mathbb R^2$ induces the Euclidean topology. Let now $C=\{xy=1\}$. It is closed in $\mathbb R^2$ but it's project on the X-axis is $\{x\neq0\}$, which is not closed.
The "standard" example: Take $(X,d)=(\Bbb R, d\_e)=(Y,d')$ where $d\_e(x,y)=|x-y|$ the usual Euclidean metric. $d\_\infty$ is equivalent to the usual metric on $\Bbb R^2$. Show that $A=\{(x,y) \in \Bbb R^2: xy=1\}$ is a closed set (the inverse image of $\{1\}$ under a continuous map) and $\pi\_1[A]=\pi\_2[A]= \Bbb R...
3,540,187
I have $(X,d) \text{ and } (Y,d')$ two metric spaces. I define the metric space $(X \times Y, d\_{\infty})$ and the projections $\pi\_1:X \times Y \rightarrow X$, $\pi\_2:X \times Y \rightarrow Y$. I've already shown that these functions are continous and open, but can't find an example for where it's not closed
2020/02/09
[ "https://math.stackexchange.com/questions/3540187", "https://math.stackexchange.com", "https://math.stackexchange.com/users/432563/" ]
A classical example is $X=Y=\mathbb R$. The sup metric on $\mathbb R^2$ induces the Euclidean topology. Let now $C=\{xy=1\}$. It is closed in $\mathbb R^2$ but it's project on the X-axis is $\{x\neq0\}$, which is not closed.
The set $\{(x,y)\in\mathbb R^2\mid xy\geq1\}$ is a closed subset of $\mathbb R^2$. However it is projected to $\mathbb R-\{0\}$ which is not closed in $\mathbb R$.
4,164,949
I know that the only really correct way to protect SQL queries against SQL injection in Java is using PreparedStatements. However, such a statement requires that the basic structure (selected attributes, joined tables, the structure of the WHERE condition) will not vary. I have here a JSP application that contains a ...
2010/11/12
[ "https://Stackoverflow.com/questions/4164949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235203/" ]
Have you seen the JDBC [NamedParameterJDBCTemplate](http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.html) ? > > The NamedParameterJdbcTemplate class > adds support for programming JDBC > statements using named parameters (as > opposed to prog...
The best solution is to use a middle that does data validation and binding and acts as an intermediary between the JSP and the database. There might be a list of column names, but it's finite and countable. Let the JSP worry about making the user's selection known to the middle tier; let the middle tier bind and vali...
4,164,949
I know that the only really correct way to protect SQL queries against SQL injection in Java is using PreparedStatements. However, such a statement requires that the basic structure (selected attributes, joined tables, the structure of the WHERE condition) will not vary. I have here a JSP application that contains a ...
2010/11/12
[ "https://Stackoverflow.com/questions/4164949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235203/" ]
The best solution is to use a middle that does data validation and binding and acts as an intermediary between the JSP and the database. There might be a list of column names, but it's finite and countable. Let the JSP worry about making the user's selection known to the middle tier; let the middle tier bind and vali...
I'm not confident if there is a quote() method, which was widely used in PHP's PDO. This would allow you a more flexible query building approach. Also, one of the possible ideas could be creating special class, which would process filter criterias and would save into a stack all placeholders and their values.
4,164,949
I know that the only really correct way to protect SQL queries against SQL injection in Java is using PreparedStatements. However, such a statement requires that the basic structure (selected attributes, joined tables, the structure of the WHERE condition) will not vary. I have here a JSP application that contains a ...
2010/11/12
[ "https://Stackoverflow.com/questions/4164949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235203/" ]
I think that fundamentally, this question *is* the same as the other questions that I referred to in my comment above, but I do see why you disagree — you're changing what's in your `where` clause based on what the user supplied. That still isn't the same as using user-supplied data in the SQL query, though, which you...
The best solution is to use a middle that does data validation and binding and acts as an intermediary between the JSP and the database. There might be a list of column names, but it's finite and countable. Let the JSP worry about making the user's selection known to the middle tier; let the middle tier bind and vali...
4,164,949
I know that the only really correct way to protect SQL queries against SQL injection in Java is using PreparedStatements. However, such a statement requires that the basic structure (selected attributes, joined tables, the structure of the WHERE condition) will not vary. I have here a JSP application that contains a ...
2010/11/12
[ "https://Stackoverflow.com/questions/4164949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235203/" ]
Have you seen the JDBC [NamedParameterJDBCTemplate](http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.html) ? > > The NamedParameterJdbcTemplate class > adds support for programming JDBC > statements using named parameters (as > opposed to prog...
I'm not confident if there is a quote() method, which was widely used in PHP's PDO. This would allow you a more flexible query building approach. Also, one of the possible ideas could be creating special class, which would process filter criterias and would save into a stack all placeholders and their values.
4,164,949
I know that the only really correct way to protect SQL queries against SQL injection in Java is using PreparedStatements. However, such a statement requires that the basic structure (selected attributes, joined tables, the structure of the WHERE condition) will not vary. I have here a JSP application that contains a ...
2010/11/12
[ "https://Stackoverflow.com/questions/4164949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235203/" ]
Have you seen the JDBC [NamedParameterJDBCTemplate](http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.html) ? > > The NamedParameterJdbcTemplate class > adds support for programming JDBC > statements using named parameters (as > opposed to prog...
I think that fundamentally, this question *is* the same as the other questions that I referred to in my comment above, but I do see why you disagree — you're changing what's in your `where` clause based on what the user supplied. That still isn't the same as using user-supplied data in the SQL query, though, which you...
4,164,949
I know that the only really correct way to protect SQL queries against SQL injection in Java is using PreparedStatements. However, such a statement requires that the basic structure (selected attributes, joined tables, the structure of the WHERE condition) will not vary. I have here a JSP application that contains a ...
2010/11/12
[ "https://Stackoverflow.com/questions/4164949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235203/" ]
Have you seen the JDBC [NamedParameterJDBCTemplate](http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.html) ? > > The NamedParameterJdbcTemplate class > adds support for programming JDBC > statements using named parameters (as > opposed to prog...
Here is a useful technique for this particular case, where you have a number of clauses in your `WHERE` but you don't know in advance which ones you need to apply. Will your user search by title? ``` select id, title, author from book where title = :title ``` Or by author? ``` select id, title, author from book w...
4,164,949
I know that the only really correct way to protect SQL queries against SQL injection in Java is using PreparedStatements. However, such a statement requires that the basic structure (selected attributes, joined tables, the structure of the WHERE condition) will not vary. I have here a JSP application that contains a ...
2010/11/12
[ "https://Stackoverflow.com/questions/4164949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235203/" ]
I think that fundamentally, this question *is* the same as the other questions that I referred to in my comment above, but I do see why you disagree — you're changing what's in your `where` clause based on what the user supplied. That still isn't the same as using user-supplied data in the SQL query, though, which you...
I'm not confident if there is a quote() method, which was widely used in PHP's PDO. This would allow you a more flexible query building approach. Also, one of the possible ideas could be creating special class, which would process filter criterias and would save into a stack all placeholders and their values.
4,164,949
I know that the only really correct way to protect SQL queries against SQL injection in Java is using PreparedStatements. However, such a statement requires that the basic structure (selected attributes, joined tables, the structure of the WHERE condition) will not vary. I have here a JSP application that contains a ...
2010/11/12
[ "https://Stackoverflow.com/questions/4164949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235203/" ]
Here is a useful technique for this particular case, where you have a number of clauses in your `WHERE` but you don't know in advance which ones you need to apply. Will your user search by title? ``` select id, title, author from book where title = :title ``` Or by author? ``` select id, title, author from book w...
I'm not confident if there is a quote() method, which was widely used in PHP's PDO. This would allow you a more flexible query building approach. Also, one of the possible ideas could be creating special class, which would process filter criterias and would save into a stack all placeholders and their values.
4,164,949
I know that the only really correct way to protect SQL queries against SQL injection in Java is using PreparedStatements. However, such a statement requires that the basic structure (selected attributes, joined tables, the structure of the WHERE condition) will not vary. I have here a JSP application that contains a ...
2010/11/12
[ "https://Stackoverflow.com/questions/4164949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235203/" ]
I think that fundamentally, this question *is* the same as the other questions that I referred to in my comment above, but I do see why you disagree — you're changing what's in your `where` clause based on what the user supplied. That still isn't the same as using user-supplied data in the SQL query, though, which you...
Here is a useful technique for this particular case, where you have a number of clauses in your `WHERE` but you don't know in advance which ones you need to apply. Will your user search by title? ``` select id, title, author from book where title = :title ``` Or by author? ``` select id, title, author from book w...
15,788,989
Is it possible to get the status of the process triggered by a request. Suppose, I have a request, that will trigger the long running process, like copying some files in the server side, or some other really long running process. Now I want to show user about the percentage completion of that task. How to do it in J...
2013/04/03
[ "https://Stackoverflow.com/questions/15788989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1281377/" ]
Pass a reference to the div contained within the button to the circleTextShow / Hide functions. ``` //MOUSEOVER $(".blockButton").mouseenter(function() { //Passing on .class div to a function circleTextShow($(this).find('.blockButtonTips')); }) //MOUSEOUT $(".blo...
send `$(this).find('.blockButtonTips')` to the function and use that to show or hide ``` //MOUSEOVER $(".blockButton").mouseenter(function() { //Passing on .class div to a function circleTextShow($(this).find('.blockButtonTips')); }) //MOUSEOUT $(".blockButton").mouseleave(function() { ...
15,788,989
Is it possible to get the status of the process triggered by a request. Suppose, I have a request, that will trigger the long running process, like copying some files in the server side, or some other really long running process. Now I want to show user about the percentage completion of that task. How to do it in J...
2013/04/03
[ "https://Stackoverflow.com/questions/15788989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1281377/" ]
Pass a reference to the div contained within the button to the circleTextShow / Hide functions. ``` //MOUSEOVER $(".blockButton").mouseenter(function() { //Passing on .class div to a function circleTextShow($(this).find('.blockButtonTips')); }) //MOUSEOUT $(".blo...
A slightly modified bulletproof approach using `.on([delegated events])`, `Ternary operator (?:)`, `inversed-hover-intent` using the `data-*` attribute, and moving the `setTimeout` in your function **gives this beautiful result:** `**[LIVE DEMO](http://jsbin.com/ewusuq/3/edit)**` ``` $(".blockButton")...
39,142
While we do some server maintenance, how might be prohibit our users from editing or adding content but not put the site in offline mode. That is, we'd like to have content browseable but temporarily prohibit content from changing.
2012/08/06
[ "https://drupal.stackexchange.com/questions/39142", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/5966/" ]
I have never used this module, but seems to do what you want: [Read only mode](http://drupal.org/project/readonlymode/).
This will take some effort to accomplish what you are asking for, but as a high level overview, you could use CTools' panel variants for `user/%user/edit` and `node/%node/edit` or whatever is equivalent in D6. And then you selection criteria as php code and then write some logic. Not done this myself, but it should be...
39,142
While we do some server maintenance, how might be prohibit our users from editing or adding content but not put the site in offline mode. That is, we'd like to have content browseable but temporarily prohibit content from changing.
2012/08/06
[ "https://drupal.stackexchange.com/questions/39142", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/5966/" ]
I have never used this module, but seems to do what you want: [Read only mode](http://drupal.org/project/readonlymode/).
I haven't done this (seems to be the common thread here!) but [Boost](https://drupal.org/project/boost) has a feature for running entirely without the database. It also has a crawler to ensure pages are cached. Note the warning! ![screenshot](https://i.imgur.com/ti8Bf.png)
22,202,630
I'm trying to create confirmation boxes after clicking to "Delete This" links. I can do this with the use of `onClick` event. However, I read that this is not cool. So, I found a cool library to make confirmation boxes for me. It's called Bootbox, but I guess that does not matter. This is what I did (pasted, actual...
2014/03/05
[ "https://Stackoverflow.com/questions/22202630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1652575/" ]
`Console.WriteLine` will show the output vertically try this instead ``` Console.Write("{0} ", array[i]); //<<< display orgininal value array[i] *= 2; //here I use = to separate the output put you can use any other string you want Console.Write(" = {0}", array[i]) ```
Use `Console.Write()` instead of `Console.WriteLine()`
22,202,630
I'm trying to create confirmation boxes after clicking to "Delete This" links. I can do this with the use of `onClick` event. However, I read that this is not cool. So, I found a cool library to make confirmation boxes for me. It's called Bootbox, but I guess that does not matter. This is what I did (pasted, actual...
2014/03/05
[ "https://Stackoverflow.com/questions/22202630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1652575/" ]
`Console.WriteLine` will show the output vertically try this instead ``` Console.Write("{0} ", array[i]); //<<< display orgininal value array[i] *= 2; //here I use = to separate the output put you can use any other string you want Console.Write(" = {0}", array[i]) ```
Try this: You can change all your code for this ;) ``` int i = -1; A.ToList().ForEach(x => Console.WriteLine(string.Format("\n=====================\nOriginal value: {0}\nNew value: {1}\n=====================\n", x, A[++i] *= 2))); ``` ===================== Original value: -2 New value: -4 ===================== ...
22,202,630
I'm trying to create confirmation boxes after clicking to "Delete This" links. I can do this with the use of `onClick` event. However, I read that this is not cool. So, I found a cool library to make confirmation boxes for me. It's called Bootbox, but I guess that does not matter. This is what I did (pasted, actual...
2014/03/05
[ "https://Stackoverflow.com/questions/22202630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1652575/" ]
`Console.WriteLine` will show the output vertically try this instead ``` Console.Write("{0} ", array[i]); //<<< display orgininal value array[i] *= 2; //here I use = to separate the output put you can use any other string you want Console.Write(" = {0}", array[i]) ```
in case like this I always used to use String.Join() method. ``` int[] A = { -2, 5, -1, 9, -6, 23, 67, 1, -8, 7, -3, 90 }; Console.WriteLine("\n=====================\n"); Changes(A); //<<< original index value Console.WriteLine("\nEvery Value gets doubled"); Changes(A); //<<< new changes static void Changes(int[] ...
22,202,630
I'm trying to create confirmation boxes after clicking to "Delete This" links. I can do this with the use of `onClick` event. However, I read that this is not cool. So, I found a cool library to make confirmation boxes for me. It's called Bootbox, but I guess that does not matter. This is what I did (pasted, actual...
2014/03/05
[ "https://Stackoverflow.com/questions/22202630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1652575/" ]
Use `Console.Write()` instead of `Console.WriteLine()`
Try this: You can change all your code for this ;) ``` int i = -1; A.ToList().ForEach(x => Console.WriteLine(string.Format("\n=====================\nOriginal value: {0}\nNew value: {1}\n=====================\n", x, A[++i] *= 2))); ``` ===================== Original value: -2 New value: -4 ===================== ...
22,202,630
I'm trying to create confirmation boxes after clicking to "Delete This" links. I can do this with the use of `onClick` event. However, I read that this is not cool. So, I found a cool library to make confirmation boxes for me. It's called Bootbox, but I guess that does not matter. This is what I did (pasted, actual...
2014/03/05
[ "https://Stackoverflow.com/questions/22202630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1652575/" ]
Use `Console.Write()` instead of `Console.WriteLine()`
in case like this I always used to use String.Join() method. ``` int[] A = { -2, 5, -1, 9, -6, 23, 67, 1, -8, 7, -3, 90 }; Console.WriteLine("\n=====================\n"); Changes(A); //<<< original index value Console.WriteLine("\nEvery Value gets doubled"); Changes(A); //<<< new changes static void Changes(int[] ...
22,202,630
I'm trying to create confirmation boxes after clicking to "Delete This" links. I can do this with the use of `onClick` event. However, I read that this is not cool. So, I found a cool library to make confirmation boxes for me. It's called Bootbox, but I guess that does not matter. This is what I did (pasted, actual...
2014/03/05
[ "https://Stackoverflow.com/questions/22202630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1652575/" ]
in case like this I always used to use String.Join() method. ``` int[] A = { -2, 5, -1, 9, -6, 23, 67, 1, -8, 7, -3, 90 }; Console.WriteLine("\n=====================\n"); Changes(A); //<<< original index value Console.WriteLine("\nEvery Value gets doubled"); Changes(A); //<<< new changes static void Changes(int[] ...
Try this: You can change all your code for this ;) ``` int i = -1; A.ToList().ForEach(x => Console.WriteLine(string.Format("\n=====================\nOriginal value: {0}\nNew value: {1}\n=====================\n", x, A[++i] *= 2))); ``` ===================== Original value: -2 New value: -4 ===================== ...
22,554,740
I create a weekly report on sales opportunities and am being asked to report on changes (e.g. change in deal size, new deals, closed deals), specifically looking at the biggest changes. Any tips on how to accomplish this?
2014/03/21
[ "https://Stackoverflow.com/questions/22554740", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118337/" ]
Replace `\.` by `[.,]`. You'll get the following regex ``` ^[0-9]{1,5}([.,][0-9]{0,2})?$ ```
You can use a character class: ``` ^[0-9]{1,5}([.,][0-9]{0,2})?$ ```
22,554,740
I create a weekly report on sales opportunities and am being asked to report on changes (e.g. change in deal size, new deals, closed deals), specifically looking at the biggest changes. Any tips on how to accomplish this?
2014/03/21
[ "https://Stackoverflow.com/questions/22554740", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118337/" ]
Replace `\.` by `[.,]`. You'll get the following regex ``` ^[0-9]{1,5}([.,][0-9]{0,2})?$ ```
Just add the comma and dot inside the character class to handle both `[]` ``` ^[0-9]{1,5}([.,][0-9]{0,2})?$ ^ ``` But I am not sure why you are checking `{0,2}` at the end? Which means only it will accept `1111.` as a valid input. So better make it `{1,2}`
22,554,740
I create a weekly report on sales opportunities and am being asked to report on changes (e.g. change in deal size, new deals, closed deals), specifically looking at the biggest changes. Any tips on how to accomplish this?
2014/03/21
[ "https://Stackoverflow.com/questions/22554740", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118337/" ]
Replace `\.` by `[.,]`. You'll get the following regex ``` ^[0-9]{1,5}([.,][0-9]{0,2})?$ ```
Try this ``` ^[0-9]{1,5}([.,][0-9]{0,2})?$ ``` [**Regex Demo**](http://rubular.com/r/A5bF9uL7yN)
286,018
There was [this question on Aviation.SE](https://aviation.stackexchange.com/q/32506/15982) which I though was unclear about what they were asking (initial revision). I went to flag to close but accidentally clicked the wrong reason. After reading the Meta.SE post on [Cancel misclicked flags](https://meta.stackexchan...
2016/10/19
[ "https://meta.stackexchange.com/questions/286018", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/335608/" ]
In some cases you do want to retract your flag when you have second thoughts. If you accidentally flagged something as spam, you should retract the flag. If you flagged as unclear when it is actually too broad, I would leave it as is. If a question warrants closure, generally the close reason picked isn't the most imp...
Adding to @PatrickHofman's great answer, you need to note that even if you raised the flag with the right reason, it could be declined by a moderator if (s)he (personally) doesn't agree with your reason as evidenced in this Meta question on Japanese SE, [Can I ask why my flag was declined?](https://japanese.meta.stacke...
8,432
In English, most loanwords from Japanese are pronounced similarly to the Japanese word. It isn't an exact match, for example with "karaoke" the pronunciation of the second "a" differs between English and Japanese, but it's fairly similar. Likewise, many languages that are unrelated to English, but are not from East As...
2014/06/22
[ "https://linguistics.stackexchange.com/questions/8432", "https://linguistics.stackexchange.com", "https://linguistics.stackexchange.com/users/421/" ]
Yes as you speculate, when Chinese borrows a Japanese word, its pronunciation is often determined by the Chinese characters, no matter how it is pronounced in Japan. This results in loanwords that sound totally different, especially when they are native Japanese words, rather than Sino-Japanese words (i.e. Japanese-coi...
Yes it is the case. Chinese usually read a Japanese loan word according to the pronunciation of the characters in Chinese. > > "they didn't understand some Japanese loanwords I used" > > > That's because English borrow a Japanese word by its pronunciation, while Chinese borrow the same Japanese word by its meani...
3,625,865
I'm recently getting a bit confused with interfaces and abstract classes and I feel I dont fully grasp it like I thought I did. I think I'm using them incorrectly. I'll describe what I'm doing at the moment, the problem I have faced, and then hopefully it be clear what I'm doing wrong if anything. I wanted to write so...
2010/09/02
[ "https://Stackoverflow.com/questions/3625865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/264273/" ]
You declare the new function only in `userTypeB`, not in `IParser`. Thus it is not visible via `IParser`'s interface. Since `userParser` is declared as an `IParser`, you can't directly access `userTypeB`'s functions via it - you need to either downcast it to `userTypeB`, or add the new function to `IParser` to achieve ...
In order to access functions for a specific sub-type (UserTypeB, for example) you need the variable to be of that type (requires explicit casting). The use of interfaces and abstract classes is useful when you only require the methods defined in the interface. If you build the interface correctly, this should be most ...
3,625,865
I'm recently getting a bit confused with interfaces and abstract classes and I feel I dont fully grasp it like I thought I did. I think I'm using them incorrectly. I'll describe what I'm doing at the moment, the problem I have faced, and then hopefully it be clear what I'm doing wrong if anything. I wanted to write so...
2010/09/02
[ "https://Stackoverflow.com/questions/3625865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/264273/" ]
You declare the new function only in `userTypeB`, not in `IParser`. Thus it is not visible via `IParser`'s interface. Since `userParser` is declared as an `IParser`, you can't directly access `userTypeB`'s functions via it - you need to either downcast it to `userTypeB`, or add the new function to `IParser` to achieve ...
As Peter Torok says (+1), the IParser declares just one function `parse(xml)`. When you create a variable userParser of type IParser, you will be allowed to call ony the parse() method. In order to call a function defined in the subtype, you will have to explicitly cast it into that subtype. In that case IMO your shou...
57,536,494
I am using bootstrap 4.3.1 popper 1.10.1 and jquery 3.4.1 loaded in the order of popper jquery bootstrap But using data-spy="scroll" in combination with a target doesnt work, and calling the scrollSpy function myself produces the error: `TypeError: $(...).scrollSpy is not a function` I tried using that data attribu...
2019/08/17
[ "https://Stackoverflow.com/questions/57536494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8703931/" ]
You want to loop over the array with an iterator variable. Initialize `i` with your starting point and `length` to your exclusive ending i (in your example, it's 5). ``` //gets the length of the array int length = sizeof(delete)/sizeof(delete[0]); for(int i=0; i<length; i++){ if (Directory.Exists(delete[i])) ...
You can write a function to delete directory, ``` public bool PurgeDirectory(string filePath) { if (Directory.Exists(filePath)) { Directory.Delete(filePath); return true; } return false; } ``` Now iterate n times to get your expected result, here n is 4 ``` int n = 4; string[] dirPaths = new...
57,536,494
I am using bootstrap 4.3.1 popper 1.10.1 and jquery 3.4.1 loaded in the order of popper jquery bootstrap But using data-spy="scroll" in combination with a target doesnt work, and calling the scrollSpy function myself produces the error: `TypeError: $(...).scrollSpy is not a function` I tried using that data attribu...
2019/08/17
[ "https://Stackoverflow.com/questions/57536494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8703931/" ]
You can write a function to delete directory, ``` public bool PurgeDirectory(string filePath) { if (Directory.Exists(filePath)) { Directory.Delete(filePath); return true; } return false; } ``` Now iterate n times to get your expected result, here n is 4 ``` int n = 4; string[] dirPaths = new...
@pr0f3ss answer worked after he helped me on discord so final answer is ``` int length = 5; //5 since i had 5 lines for(int i=0; i<length; i++){ if (Directory.Exists(delete[i])) { Directory.Delete(delete[i]); Console.WriteLine("You didnt fail"); } else { Console.WriteLine("You failed!"...
57,536,494
I am using bootstrap 4.3.1 popper 1.10.1 and jquery 3.4.1 loaded in the order of popper jquery bootstrap But using data-spy="scroll" in combination with a target doesnt work, and calling the scrollSpy function myself produces the error: `TypeError: $(...).scrollSpy is not a function` I tried using that data attribu...
2019/08/17
[ "https://Stackoverflow.com/questions/57536494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8703931/" ]
You want to loop over the array with an iterator variable. Initialize `i` with your starting point and `length` to your exclusive ending i (in your example, it's 5). ``` //gets the length of the array int length = sizeof(delete)/sizeof(delete[0]); for(int i=0; i<length; i++){ if (Directory.Exists(delete[i])) ...
@pr0f3ss answer worked after he helped me on discord so final answer is ``` int length = 5; //5 since i had 5 lines for(int i=0; i<length; i++){ if (Directory.Exists(delete[i])) { Directory.Delete(delete[i]); Console.WriteLine("You didnt fail"); } else { Console.WriteLine("You failed!"...
210,261
Can anyone direct me to any algorithms or theorems that describe the difficulty of solving a non-smooth convex optimization problem for the special case where the full subdifferential is available? All of the results that I can find are designed for the case where one has an oracle that can generate a single subgradien...
2015/06/27
[ "https://mathoverflow.net/questions/210261", "https://mathoverflow.net", "https://mathoverflow.net/users/70190/" ]
The difficulty with non-differentiable convex functions in optimization stems from the fact that an arbitrary subgradient need not be a descent direction, and hence classical first-order methods cannot be guaranteed to work. (But see Lewis' and Overton's works on nonsmooth quasi-Newton methods, e.g., <http://people.ori...
Regarding difficulty results (i.e., lower bounds) for iterative methods, worst-case complexity results in the oracle model hold regardless of whether you provide the full subgradient to the algorithm. What happens is that lower bounds for nonsmooth convex optimization are obtained by piecewise linear functions, and the...
51,150,785
I have a nested Json file with arrays. I want to flat it so there won't be nested Jsons. For example: [![enter image description here](https://i.stack.imgur.com/2mFT4.png)](https://i.stack.imgur.com/2mFT4.png) Code for Json: <https://jsonblob.com/4b255e51-7e9f-11e8-b89c-37203846213e> This Json has sub-Json and also...
2018/07/03
[ "https://Stackoverflow.com/questions/51150785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9895993/" ]
Try using [this](https://towardsdatascience.com/flattening-json-objects-in-python-f5343c794b10): ``` import pandas as pd import json response = {u'total': 1245, u'limit': 2, u'results': [{u'customer': {u'lastName': u'rtyrtyrt', u'userAccountId': None, u'id': 637, u'firstName': u'rtyrtyrty', u'email': u'ddfgdfg@dfsdfg...
I personally use this procedure. **First store the JSON data as string** (or, load from url or file) [![enter image description here](https://i.stack.imgur.com/T7NTD.png)](https://i.stack.imgur.com/T7NTD.png) **use *nested\_to\_record()* method from pandas** ``` import json from pandas.io.json.normalize import ne...
47,532,073
I'm using map box SDK on my android application. Total apk size will be 24MB. How to reduce that size? Please give solutions ``` compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.0.2@aar') { transitive = true } ```
2017/11/28
[ "https://Stackoverflow.com/questions/47532073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8477076/" ]
You can use the following formula to return what you're looking for. It is an array formula so will need to be entered with `Ctrl`+`Shift`+`Enter` ``` =INDEX(Sheet2!$C$2:$C$22; MATCH(1; (Sheet2!$A$2:$A$22=Sheet1!$A2)*(Sheet2!$B$2:$B$22=Sheet1!$B2);0)) ``` As it is an array formula I recommend defining your ranges fr...
Use the following as a matrix formula: `=INDEX(Sheet2!$C:$C; MATCH(Sheet1!$A2&$B2; Sheet2!$A&$B; 0))`
47,532,073
I'm using map box SDK on my android application. Total apk size will be 24MB. How to reduce that size? Please give solutions ``` compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.0.2@aar') { transitive = true } ```
2017/11/28
[ "https://Stackoverflow.com/questions/47532073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8477076/" ]
You can use the following formula to return what you're looking for. It is an array formula so will need to be entered with `Ctrl`+`Shift`+`Enter` ``` =INDEX(Sheet2!$C$2:$C$22; MATCH(1; (Sheet2!$A$2:$A$22=Sheet1!$A2)*(Sheet2!$B$2:$B$22=Sheet1!$B2);0)) ``` As it is an array formula I recommend defining your ranges fr...
Paste this into cell `C2`: ``` =INDEX(C2:C22,MATCH(G2&H2,A2:A22&B2:B22,0)) ``` and use `Ctrl`+`Shift`+`Enter` instead of `Enter` since it's an array formula. Then copy that cell as many rows down as needed. Here are some [more examples](http://www.excel-easy.com/examples/two-column-lookup.html).
773,349
I have got a Jibx bean which is used as both input and output to a webservice. The bean is very large and complex with deep parent child relationship. The webservice does not return the request object but returns a new bean with some properties populated. I would like to merge my request and the response. I tried using...
2009/04/21
[ "https://Stackoverflow.com/questions/773349", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
By "too big and deep to do a isNull check" I'm assuming that you don't want to hardcode those checks. Nor should you. However, the beautiful thing about beans is that they can be inspected, and you can write an automated check to work your way through the object graph, check for null, and update if not. Yes, that's C...
As the object is a bean, why not associate the bean with the request and when replying use the request bean? I'm not advocating pushing objects that might just be interface objects deep into your system, but keeping hold of the request bean and making it the response bean too. I'm not sure what I understand the deepne...
6,969,810
``` <style> input[type="text"] { width: 200px; border: 1px solid #CCC; } </style> <body> <input type="text" name="test" value="test" size="5" /> </body> ``` When this is viewed on browser (Firefox 5), the "size" it appears is a fixed 200px. It seems the size I specified is completely ignored. This is fr...
2011/08/07
[ "https://Stackoverflow.com/questions/6969810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1355137/" ]
If you want to override the CSS width at the element level, try applying the style tag to the element directly: ``` <input type="text" name="test" value="test" style="width: 50px;" /> ``` This works for me: ``` <html> <style> input[type="text"] { width: 200px; border: 1px solid #C...
Remove either ``` input[type="text"] { width: 200px; //THIS } ``` or `<input type="text" name="test" value="test" size="5" <--//THIS />` Choose to style using one or the other.
6,969,810
``` <style> input[type="text"] { width: 200px; border: 1px solid #CCC; } </style> <body> <input type="text" name="test" value="test" size="5" /> </body> ``` When this is viewed on browser (Firefox 5), the "size" it appears is a fixed 200px. It seems the size I specified is completely ignored. This is fr...
2011/08/07
[ "https://Stackoverflow.com/questions/6969810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1355137/" ]
If you want to override the CSS width at the element level, try applying the style tag to the element directly: ``` <input type="text" name="test" value="test" style="width: 50px;" /> ``` This works for me: ``` <html> <style> input[type="text"] { width: 200px; border: 1px solid #C...
Don't set display ***style*** in the HTML. Use: ``` <input class="narrowInput" type="text" name="test" value="test" /> ``` Or: ``` <input id="narrowInput" type="text" name="test" value="test" /> ``` Only don't use "narrowInput". Use a name that has a business meaning, that is: one that describes the purpose of t...
6,969,810
``` <style> input[type="text"] { width: 200px; border: 1px solid #CCC; } </style> <body> <input type="text" name="test" value="test" size="5" /> </body> ``` When this is viewed on browser (Firefox 5), the "size" it appears is a fixed 200px. It seems the size I specified is completely ignored. This is fr...
2011/08/07
[ "https://Stackoverflow.com/questions/6969810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1355137/" ]
Don't set display ***style*** in the HTML. Use: ``` <input class="narrowInput" type="text" name="test" value="test" /> ``` Or: ``` <input id="narrowInput" type="text" name="test" value="test" /> ``` Only don't use "narrowInput". Use a name that has a business meaning, that is: one that describes the purpose of t...
Remove either ``` input[type="text"] { width: 200px; //THIS } ``` or `<input type="text" name="test" value="test" size="5" <--//THIS />` Choose to style using one or the other.
236,156
Programming is learned by writing programs. But code reading is said to be another good way of learning. I would like to improve my unit-testing skills by reading, examining real-world code. Could you recommend any open source projects where the source is extensively tested with unit tests? I'm interested in code writ...
2008/10/25
[ "https://Stackoverflow.com/questions/236156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26449/" ]
AFAIK C++ Boost libraries - <http://boost.org/> - have broadly covered code base, and a policy that every new piece of code must have unit tests with it. Might be worth checking.
I wouldn't call it extensively, but [wxWidgets](http://www.wxwidgets.org/) does some UnitTest with [CppUnit](http://cppunit.sourceforge.net).
236,156
Programming is learned by writing programs. But code reading is said to be another good way of learning. I would like to improve my unit-testing skills by reading, examining real-world code. Could you recommend any open source projects where the source is extensively tested with unit tests? I'm interested in code writ...
2008/10/25
[ "https://Stackoverflow.com/questions/236156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26449/" ]
AFAIK C++ Boost libraries - <http://boost.org/> - have broadly covered code base, and a policy that every new piece of code must have unit tests with it. Might be worth checking.
The [Bazaar](http://bazaar-vcs.org/) version control system is obsessive about automated testing. Unit testing, feature testing, integration testing, blackbox testing, test doubles testing, testing framework testing, parameterized test suites, platform-specific tests, etc. This has all sorts of nice consequences for t...
236,156
Programming is learned by writing programs. But code reading is said to be another good way of learning. I would like to improve my unit-testing skills by reading, examining real-world code. Could you recommend any open source projects where the source is extensively tested with unit tests? I'm interested in code writ...
2008/10/25
[ "https://Stackoverflow.com/questions/236156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26449/" ]
AFAIK C++ Boost libraries - <http://boost.org/> - have broadly covered code base, and a policy that every new piece of code must have unit tests with it. Might be worth checking.
The [Chromium](http://code.google.com/chromium/) project.
236,156
Programming is learned by writing programs. But code reading is said to be another good way of learning. I would like to improve my unit-testing skills by reading, examining real-world code. Could you recommend any open source projects where the source is extensively tested with unit tests? I'm interested in code writ...
2008/10/25
[ "https://Stackoverflow.com/questions/236156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26449/" ]
AFAIK C++ Boost libraries - <http://boost.org/> - have broadly covered code base, and a policy that every new piece of code must have unit tests with it. Might be worth checking.
The [trucov](http://code.google.com/p/trucov/) project is an open source tool used to verify unit test coverage. The tool itself is [extensively](http://code.google.com/p/trucov/wiki/Final_Package_Report) unit tested using [google's test framework](http://code.google.com/p/googletest/). *Disclaimer*: though I did not ...
236,156
Programming is learned by writing programs. But code reading is said to be another good way of learning. I would like to improve my unit-testing skills by reading, examining real-world code. Could you recommend any open source projects where the source is extensively tested with unit tests? I'm interested in code writ...
2008/10/25
[ "https://Stackoverflow.com/questions/236156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26449/" ]
The [Chromium](http://code.google.com/chromium/) project.
I wouldn't call it extensively, but [wxWidgets](http://www.wxwidgets.org/) does some UnitTest with [CppUnit](http://cppunit.sourceforge.net).
236,156
Programming is learned by writing programs. But code reading is said to be another good way of learning. I would like to improve my unit-testing skills by reading, examining real-world code. Could you recommend any open source projects where the source is extensively tested with unit tests? I'm interested in code writ...
2008/10/25
[ "https://Stackoverflow.com/questions/236156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26449/" ]
The [Chromium](http://code.google.com/chromium/) project.
The [Bazaar](http://bazaar-vcs.org/) version control system is obsessive about automated testing. Unit testing, feature testing, integration testing, blackbox testing, test doubles testing, testing framework testing, parameterized test suites, platform-specific tests, etc. This has all sorts of nice consequences for t...
236,156
Programming is learned by writing programs. But code reading is said to be another good way of learning. I would like to improve my unit-testing skills by reading, examining real-world code. Could you recommend any open source projects where the source is extensively tested with unit tests? I'm interested in code writ...
2008/10/25
[ "https://Stackoverflow.com/questions/236156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26449/" ]
The [Chromium](http://code.google.com/chromium/) project.
The [trucov](http://code.google.com/p/trucov/) project is an open source tool used to verify unit test coverage. The tool itself is [extensively](http://code.google.com/p/trucov/wiki/Final_Package_Report) unit tested using [google's test framework](http://code.google.com/p/googletest/). *Disclaimer*: though I did not ...
26,563,745
I posted something simpler because I thought it could be easy to understand, but referring to your comments, I was wrong, so I edit this question : So here is the code. I want to do it without a loop, should it be done in pandas ? ``` import pandas as pd myval = [0.0,1.1, 2.2, 3.3, 4.4, 5.5,6.6, 7.7, 8.8,9.9] s1 = [...
2014/10/25
[ "https://Stackoverflow.com/questions/26563745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4180859/" ]
Variable length arrays are strictly a C99 feature. Compilers like GCC and Clang allow them to be used in C90 (ansi and C89) mode as well as C++. For example, see the [GCC docs](https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html) and the [Clang docs](http://clang.llvm.org/compatibility.html). Both compilers have ca...
Yes it works in C-99 and other language like C++ ``` printf("Array size: "); scanf("%d", &n); int array[n]; ```
70,801,736
I export Excel files from a website. The exported files have number values with a currency sign before them in a number of columns although the number format of the cells is "General". I want to remove the currency sign. Another tricky thing is the headers of these columns and even the column indexes are not consta...
2022/01/21
[ "https://Stackoverflow.com/questions/70801736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16592362/" ]
You could do it by combining the colors into a key, and switching on that key: ``` function colorMix (color1, color2){ const key = color1 < color2 ? color1 + " \t " + color2 : color2 + " \t " + color1; switch (key) { case "blue \t red": return "violet"; case "red \t yellow"); ...
Instead of using too much comparisons with a `switch` statement, you could get all colors in an array and sort them, then check with a normalized order. ```js function colorMix(...colors) { colors.sort(); if (color[0] === 'blue' && color[1] === 'red') return 'violet'; if (color[0] === 'red' && color[1] ===...
70,801,736
I export Excel files from a website. The exported files have number values with a currency sign before them in a number of columns although the number format of the cells is "General". I want to remove the currency sign. Another tricky thing is the headers of these columns and even the column indexes are not consta...
2022/01/21
[ "https://Stackoverflow.com/questions/70801736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16592362/" ]
The expression `(color1, color2)` evaluates to `color2` because the comma is an [operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_Operator) here. So that is not useful for a `switch` statement. One way to make it work, is to translate color *strings* to color *numbers*, in su...
Instead of using too much comparisons with a `switch` statement, you could get all colors in an array and sort them, then check with a normalized order. ```js function colorMix(...colors) { colors.sort(); if (color[0] === 'blue' && color[1] === 'red') return 'violet'; if (color[0] === 'red' && color[1] ===...
70,801,736
I export Excel files from a website. The exported files have number values with a currency sign before them in a number of columns although the number format of the cells is "General". I want to remove the currency sign. Another tricky thing is the headers of these columns and even the column indexes are not consta...
2022/01/21
[ "https://Stackoverflow.com/questions/70801736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16592362/" ]
You could do it by combining the colors into a key, and switching on that key: ``` function colorMix (color1, color2){ const key = color1 < color2 ? color1 + " \t " + color2 : color2 + " \t " + color1; switch (key) { case "blue \t red": return "violet"; case "red \t yellow"); ...
Here I'm using bitwise to add the colors, so no matter the order they will always generate a unique ID, with switch I check the color id which would be the sum of the ids of the two colors. ```js function getColorIndex(color1, color2) { const colors = { "red": 1, "blue": 2, "yellow": 4 // n...
70,801,736
I export Excel files from a website. The exported files have number values with a currency sign before them in a number of columns although the number format of the cells is "General". I want to remove the currency sign. Another tricky thing is the headers of these columns and even the column indexes are not consta...
2022/01/21
[ "https://Stackoverflow.com/questions/70801736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16592362/" ]
The expression `(color1, color2)` evaluates to `color2` because the comma is an [operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_Operator) here. So that is not useful for a `switch` statement. One way to make it work, is to translate color *strings* to color *numbers*, in su...
Here I'm using bitwise to add the colors, so no matter the order they will always generate a unique ID, with switch I check the color id which would be the sum of the ids of the two colors. ```js function getColorIndex(color1, color2) { const colors = { "red": 1, "blue": 2, "yellow": 4 // n...
130,803
We have a requirement: We have fields in the opportunity called as **`MIDescription`** Whenever we entered in the description field it should create a new brand task in the Open Activities related list. For that we have created a one trigger in opportunity mentioned below. Trigger is working but we haven't updated a...
2016/07/11
[ "https://salesforce.stackexchange.com/questions/130803", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/33222/" ]
It is creating every time you are updating opportunity. You need to put some check in your code to verify if the MIDescription is updated. You can use **trigger.oldMap** to verify the changes in the value of MIDescription and then create a task. Use following code and let me know if it works. ``` Trigger Description...
``` Trigger.isInsert trigger context is used to check whether Trigger was fired due to Insert operation, in that case we want to create Task. Trigger.isUpdate trigger context is used during Update operation, get Old map from Trigger context check if Description(or any other field) got changed, then create Task trigge...
301,719
What is the standard way to measure a current of about 10,000 A? DC clamp meters seem to have only scales up to 2,000 A. **Edit** Some background of this question: I am a high school physics teacher and I am trying to improve some classical experiments using high currents from ultra-capacitor discharge. In partic...
2017/04/25
[ "https://electronics.stackexchange.com/questions/301719", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/7602/" ]
If there is a way to run the experiment setup at a lower current temporarily, one could pick any two exposed spots on any conductor in the setup, attach a voltmeter, calibrate with a known current, and use that length of conductor as an intrinsic shunt.
Most other answers have assumed you want to measure 10KA **continuously**. However, your referenced use shows that it is only for a **pulse** of around 5 milliseconds. Because of this short time, the only way you can get a measurement is by using a storage scope to capture the waveform. You also need a sensor connec...
301,719
What is the standard way to measure a current of about 10,000 A? DC clamp meters seem to have only scales up to 2,000 A. **Edit** Some background of this question: I am a high school physics teacher and I am trying to improve some classical experiments using high currents from ultra-capacitor discharge. In partic...
2017/04/25
[ "https://electronics.stackexchange.com/questions/301719", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/7602/" ]
You can get shunts at that current level. Here is one product series from one company. They have other models and there are other suppliers. **[Series G Shunts](http://www.cshunt.com/pdf/g.pdf)**
Cap discharge starting below 50V and making 10kA? It is worth calculating what |Z| has to be to pull that off.... I make it no more then \$5 \cdot 10^{-3} \Omega\$, and if much of that is inductive then the value will need to be even lower as the inductance will limit the rate of rise. Usually the starting point fo...
301,719
What is the standard way to measure a current of about 10,000 A? DC clamp meters seem to have only scales up to 2,000 A. **Edit** Some background of this question: I am a high school physics teacher and I am trying to improve some classical experiments using high currents from ultra-capacitor discharge. In partic...
2017/04/25
[ "https://electronics.stackexchange.com/questions/301719", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/7602/" ]
My company has provided current meters up to 15kA for plating baths. They just used [shunts](http://www.lumel.com.pl/en/our_offer/measuring_instruments/boczniki_pomiarowe/art34,b4-shunts-1a-15ka-nominal-current-50mv-voltage-drops.html) (50mV or 60mV = 15kA IIRC). [![enter image description here](https://i.stack.imgur...
> > What is the standard way to measure a current of about 10,000 A? DC clamp meters seem to have only scales up to 2,000 A. > > > your discharge current probably wouldn't get anywhere near that kind of current. with that said, a current transformer would be my way of going it: simple, effective, and cheap: just ...
301,719
What is the standard way to measure a current of about 10,000 A? DC clamp meters seem to have only scales up to 2,000 A. **Edit** Some background of this question: I am a high school physics teacher and I am trying to improve some classical experiments using high currents from ultra-capacitor discharge. In partic...
2017/04/25
[ "https://electronics.stackexchange.com/questions/301719", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/7602/" ]
Most other answers have assumed you want to measure 10KA **continuously**. However, your referenced use shows that it is only for a **pulse** of around 5 milliseconds. Because of this short time, the only way you can get a measurement is by using a storage scope to capture the waveform. You also need a sensor connec...
My suggestion would be to either measure the displacement of the ring/the force, and work back to the current. Or you could just build one beauty of an electromagnet...and measure it's field from the other side of your classroom...
301,719
What is the standard way to measure a current of about 10,000 A? DC clamp meters seem to have only scales up to 2,000 A. **Edit** Some background of this question: I am a high school physics teacher and I am trying to improve some classical experiments using high currents from ultra-capacitor discharge. In partic...
2017/04/25
[ "https://electronics.stackexchange.com/questions/301719", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/7602/" ]
I worked on an electric locomotive starter years ago, running the companion alternator in reverse to start the engine with a 3 phase IGBT inverter that we developed. We easily got 10kA per phase of current to break the stiction of the locomotive diesel engine. We measured phase current (for vector control purposes) wit...
Most other answers have assumed you want to measure 10KA **continuously**. However, your referenced use shows that it is only for a **pulse** of around 5 milliseconds. Because of this short time, the only way you can get a measurement is by using a storage scope to capture the waveform. You also need a sensor connec...
301,719
What is the standard way to measure a current of about 10,000 A? DC clamp meters seem to have only scales up to 2,000 A. **Edit** Some background of this question: I am a high school physics teacher and I am trying to improve some classical experiments using high currents from ultra-capacitor discharge. In partic...
2017/04/25
[ "https://electronics.stackexchange.com/questions/301719", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/7602/" ]
My company has provided current meters up to 15kA for plating baths. They just used [shunts](http://www.lumel.com.pl/en/our_offer/measuring_instruments/boczniki_pomiarowe/art34,b4-shunts-1a-15ka-nominal-current-50mv-voltage-drops.html) (50mV or 60mV = 15kA IIRC). [![enter image description here](https://i.stack.imgur...
Most other answers have assumed you want to measure 10KA **continuously**. However, your referenced use shows that it is only for a **pulse** of around 5 milliseconds. Because of this short time, the only way you can get a measurement is by using a storage scope to capture the waveform. You also need a sensor connec...
301,719
What is the standard way to measure a current of about 10,000 A? DC clamp meters seem to have only scales up to 2,000 A. **Edit** Some background of this question: I am a high school physics teacher and I am trying to improve some classical experiments using high currents from ultra-capacitor discharge. In partic...
2017/04/25
[ "https://electronics.stackexchange.com/questions/301719", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/7602/" ]
Regarding the general part of the question of how to measure extremly large currents, there are also devices called FOCS which use the faraday effect to determine the magnetic field of the wire and then calculate the current. For example [ABB](http://new.abb.com/power-electronics/focs) sells such devices for measuring ...
When I was 13 I did a similar experiment, and what I did was make a pair of manifolds of copper with copper pipes soldered between the manifolds. Effectively a shunt. Then I put a hall clamp on it and used a scope to measure the pulse, and integrated the area under the curve. I am sure there are lots of better ways to...
301,719
What is the standard way to measure a current of about 10,000 A? DC clamp meters seem to have only scales up to 2,000 A. **Edit** Some background of this question: I am a high school physics teacher and I am trying to improve some classical experiments using high currents from ultra-capacitor discharge. In partic...
2017/04/25
[ "https://electronics.stackexchange.com/questions/301719", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/7602/" ]
Regarding the general part of the question of how to measure extremly large currents, there are also devices called FOCS which use the faraday effect to determine the magnetic field of the wire and then calculate the current. For example [ABB](http://new.abb.com/power-electronics/focs) sells such devices for measuring ...
My suggestion would be to either measure the displacement of the ring/the force, and work back to the current. Or you could just build one beauty of an electromagnet...and measure it's field from the other side of your classroom...
301,719
What is the standard way to measure a current of about 10,000 A? DC clamp meters seem to have only scales up to 2,000 A. **Edit** Some background of this question: I am a high school physics teacher and I am trying to improve some classical experiments using high currents from ultra-capacitor discharge. In partic...
2017/04/25
[ "https://electronics.stackexchange.com/questions/301719", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/7602/" ]
My company has provided current meters up to 15kA for plating baths. They just used [shunts](http://www.lumel.com.pl/en/our_offer/measuring_instruments/boczniki_pomiarowe/art34,b4-shunts-1a-15ka-nominal-current-50mv-voltage-drops.html) (50mV or 60mV = 15kA IIRC). [![enter image description here](https://i.stack.imgur...
Cap discharge starting below 50V and making 10kA? It is worth calculating what |Z| has to be to pull that off.... I make it no more then \$5 \cdot 10^{-3} \Omega\$, and if much of that is inductive then the value will need to be even lower as the inductance will limit the rate of rise. Usually the starting point fo...
301,719
What is the standard way to measure a current of about 10,000 A? DC clamp meters seem to have only scales up to 2,000 A. **Edit** Some background of this question: I am a high school physics teacher and I am trying to improve some classical experiments using high currents from ultra-capacitor discharge. In partic...
2017/04/25
[ "https://electronics.stackexchange.com/questions/301719", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/7602/" ]
If there is a way to run the experiment setup at a lower current temporarily, one could pick any two exposed spots on any conductor in the setup, attach a voltmeter, calibrate with a known current, and use that length of conductor as an intrinsic shunt.
My suggestion would be to either measure the displacement of the ring/the force, and work back to the current. Or you could just build one beauty of an electromagnet...and measure it's field from the other side of your classroom...