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
1,462,272
$x^2-(2+i)x+(-1+7i)=0$ I tried to solve it and I got stuck here: $x=(2+i)±\sqrt{\frac{7-24i}{2}}$
2015/10/03
[ "https://math.stackexchange.com/questions/1462272", "https://math.stackexchange.com", "https://math.stackexchange.com/users/276466/" ]
Firstly, you correctly found the discriminant: $$D = B^2 - 4AC = [-(2+i)]^2-4(-1+7i) = 7 - 24i.$$ Then: $$x\_{1,2} = \frac{-B\pm \sqrt{D}}{2A}=\frac{2+i\pm\sqrt{7-24i}}{2}.\tag{1}$$ But: $$\sqrt{7-24i}=\pm(4-3i).$$ Why? Let $\sqrt{7-24i} = z\implies z^2 = 7-24i$. If we let $z = a+bi \implies a^2-b^2 +2ab i = 7-24i $. ...
> > By using factor method: > > > $$x^2-(2+i)x+(-1+7i)=0$$ * Rewrite the left hand side of the equation. $$x^2-(2+i)x+(-1+7i)=(-1+7i)+(-2-i)x+x^{2}$$ * Factor the left hand side. $$(( -3+i)+x)((1-2i)+x)=0$$ - Solve each term in the product separately. $(-3+i)+x=0$ or $(1-2i)+x=0$ $$x=3-i \text{ or } x=-1+2i...
1,462,272
$x^2-(2+i)x+(-1+7i)=0$ I tried to solve it and I got stuck here: $x=(2+i)±\sqrt{\frac{7-24i}{2}}$
2015/10/03
[ "https://math.stackexchange.com/questions/1462272", "https://math.stackexchange.com", "https://math.stackexchange.com/users/276466/" ]
Firstly, you correctly found the discriminant: $$D = B^2 - 4AC = [-(2+i)]^2-4(-1+7i) = 7 - 24i.$$ Then: $$x\_{1,2} = \frac{-B\pm \sqrt{D}}{2A}=\frac{2+i\pm\sqrt{7-24i}}{2}.\tag{1}$$ But: $$\sqrt{7-24i}=\pm(4-3i).$$ Why? Let $\sqrt{7-24i} = z\implies z^2 = 7-24i$. If we let $z = a+bi \implies a^2-b^2 +2ab i = 7-24i $. ...
Some other answers explained how to get square roots of complex numbers, but it's also worth mentioning that there is an explicit formula you can get by following such methods in generality (leaving the variables in). The formula obtained is that the square root of $a + bi$ with nonnegative real part is given by $$\sq...
4,889,998
I have the following problem with excel. I want to increase a variable by one without using a function. So i mean without writing a "=" before my expression. Example: B1.c\_O2\_L\_y.Value(i) B1.c\_O2\_L\_y.Value(1) B1.c\_O2\_L\_y.Value(2) B1.c\_O2\_L\_y.Value(3) B1.c\_O2\_L\_y.Value(4) B1.c\_O2\_L\_y.Va...
2011/02/03
[ "https://Stackoverflow.com/questions/4889998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/483859/" ]
How do you want to combine `dat1` and `dat2`? By rows or columns? I'd take a look at the help pages for `rbind()` (row bind) , `cbind()` (column bind), or`c()` which combines arguments to form a vector.
Let me start by a comment. In order to create a sequence of number on can use the following syntax: ``` x <- seq(from=, to=, by=) ``` A shorthand for, e.g., `x <- seq(from=1, to=10, by=1)` is simply `1:10`. So, your notation is a little bit weird... On the other hand, you can combine two or more vectors using the ...
67,633,031
I currently have a table with a quantity in it. | ID | Code | Quantity | | --- | --- | --- | | 1 | A | 1 | | 2 | B | 3 | | 3 | C | 2 | | 4 | D | 1 | Is there anyway to get this table? | ID | Code | Quantity | | --- | --- | --- | | 1 | A | 1 | | 2 | B | 1 | | 2 | B | 1 | | 2 | B | 1 | | 3 | C | 1 | | 3 | C | 1 | | 4 ...
2021/05/21
[ "https://Stackoverflow.com/questions/67633031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15989969/" ]
**Updated** Now we have stored the separated, collapsed values into a new column: ``` library(dplyr) library(tidyr) df %>% group_by(ID) %>% uncount(Quantity, .remove = FALSE) %>% mutate(NewQ = 1) # A tibble: 7 x 4 # Groups: ID [4] ID Code Quantity NewQ <int> <chr> <int> <dbl> 1 1 A ...
We could use `slice` ``` library(dplyr) df %>% group_by(ID) %>% slice(rep(1:n(), each = Quantity)) %>% mutate(Quantity= rep(1)) ``` Output: ``` ID Code Quantity <dbl> <chr> <dbl> 1 1 A 1 2 2 B 1 3 2 B 1 4 2 B 1 5 3 C 1 6 ...
67,633,031
I currently have a table with a quantity in it. | ID | Code | Quantity | | --- | --- | --- | | 1 | A | 1 | | 2 | B | 3 | | 3 | C | 2 | | 4 | D | 1 | Is there anyway to get this table? | ID | Code | Quantity | | --- | --- | --- | | 1 | A | 1 | | 2 | B | 1 | | 2 | B | 1 | | 2 | B | 1 | | 3 | C | 1 | | 3 | C | 1 | | 4 ...
2021/05/21
[ "https://Stackoverflow.com/questions/67633031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15989969/" ]
**Updated** Now we have stored the separated, collapsed values into a new column: ``` library(dplyr) library(tidyr) df %>% group_by(ID) %>% uncount(Quantity, .remove = FALSE) %>% mutate(NewQ = 1) # A tibble: 7 x 4 # Groups: ID [4] ID Code Quantity NewQ <int> <chr> <int> <dbl> 1 1 A ...
A base R option using `rep` ``` transform( `row.names<-`(df[rep(1:nrow(df), df$Quantity), ], NULL), Quantity = 1 ) ``` gives ``` ID Code Quantity 1 1 A 1 2 2 B 1 3 2 B 1 4 2 B 1 5 3 C 1 6 3 C 1 7 4 D 1 ```
46,013
I want to set the frame title as follows: * When the current buffer is visiting a file, show the full path name and the Emacs version. * When the current buffer has no file, then show the buffer name and the Emacs version. In my `init.el`, I put ``` (setq-default frame-title-format (concat (if (buffer-file-name) "...
2018/11/15
[ "https://emacs.stackexchange.com/questions/46013", "https://emacs.stackexchange.com", "https://emacs.stackexchange.com/users/16006/" ]
Because you're setting `frame-title-format` to `"%b - GNU Emacs 26.1 "`. You can try the following instead ``` (setq frame-title-format `((buffer-file-name "%f" "%b") ,(format " - GNU Emacs %s" emacs-version))) ``` The following does the same but it probably does some unneeded work (that is, computin...
Emacs is evaluating your expression at the time when you setq `frame-title-format`, whereas you want it to be evaluated dynamically. Try wrapping your code in `:eval` as explained at [Mode-Line-Data](https://www.gnu.org/software/emacs/manual/html_node/elisp/Mode-Line-Data.html#Mode-Line-Data)
34,410,662
I have a service tax calculation in my page.For that i have to get the current service tax. Service Tax table is as follows ``` Date Percentage 2015-10-01 00:00:00.000 14 2015-11-15 06:12:31.687 14.5 ``` Say if the current date is `less than 2015-11-15` I will get the t...
2015/12/22
[ "https://Stackoverflow.com/questions/34410662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/958396/" ]
You need to get all taxes which are lower and fetch only first after sorting: ``` Taxes .Where(t => t.Date < DateTime.Now) .OrderByDescending(t => t.Date) .First() ```
If you need to compare a date, it's better to do so on the database to prevent fetching useless data. To do this you can make use of `System.Data.Entity` namespace to access some functions: ``` db.Taxes.Where(t => DbFunctions.TruncateTime(t.Date) < DbFunctions.TruncateTime(dateParameter)).FirstOrD...
183,870
What's the difference between `.bashrc` and `.bash_profile` and which one should I use?
2010/09/02
[ "https://superuser.com/questions/183870", "https://superuser.com", "https://superuser.com/users/12461/" ]
Have a look at this [excellent blog post by ShreevatsaR](http://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/). Here's an extract, but go to the blog post, it includes an explanation for terms like "login shell", a flow chart, and a similar table for Zsh. > > For Bash, they...
**A BETTER COMMENT FOR THE HEAD OF /ETC/PROFILE** Building on Flimm's great answer above, I inserted this new comment at the head of my Debian `/etc/profile`, *(you might need to adjust it for your distro.)*: ``` # For BASH: Read down the appropriate column. Executes A, then B, then C, etc. # The B1, B2, B3 means it ...
183,870
What's the difference between `.bashrc` and `.bash_profile` and which one should I use?
2010/09/02
[ "https://superuser.com/questions/183870", "https://superuser.com", "https://superuser.com/users/12461/" ]
From this [short article](http://joshstaiger.org/archives/2005/07/bash_profile_vs.html) > > According to the bash man page, > .bash\_profile is executed for login > shells, while .bashrc is executed for > interactive non-login shells. > > > **What is a login or non-login shell?** > > > When you login (eg: type...
The configuration logic of bash's itself is not crazy complicated and explained in other answers in this page, on serverfault and in many blogs. The problem however is *what the Linux distributions make of bash*, I mean the complex and various ways they configure bash by default. <http://mywiki.wooledge.org/DotFiles> m...
183,870
What's the difference between `.bashrc` and `.bash_profile` and which one should I use?
2010/09/02
[ "https://superuser.com/questions/183870", "https://superuser.com", "https://superuser.com/users/12461/" ]
Traditionally, when you log into a Unix system, the system would start one program for you. That program is a shell, i.e., a program designed to start other programs. It's a command line shell: you start another program by typing its name. The default shell, a Bourne shell, reads commands from `~/.profile` when it is i...
From this [short article](http://joshstaiger.org/archives/2005/07/bash_profile_vs.html) > > According to the bash man page, > .bash\_profile is executed for login > shells, while .bashrc is executed for > interactive non-login shells. > > > **What is a login or non-login shell?** > > > When you login (eg: type...
183,870
What's the difference between `.bashrc` and `.bash_profile` and which one should I use?
2010/09/02
[ "https://superuser.com/questions/183870", "https://superuser.com", "https://superuser.com/users/12461/" ]
Traditionally, when you log into a Unix system, the system would start one program for you. That program is a shell, i.e., a program designed to start other programs. It's a command line shell: you start another program by typing its name. The default shell, a Bourne shell, reads commands from `~/.profile` when it is i...
Back in the old days, when pseudo tty's weren't pseudo and actually, well, typed, and UNIXes were accessed by modems so slow you could see each letter being printed to your screen, efficiency was paramount. To help efficiency somewhat you had a concept of a main login window and whatever other windows you used to actua...
183,870
What's the difference between `.bashrc` and `.bash_profile` and which one should I use?
2010/09/02
[ "https://superuser.com/questions/183870", "https://superuser.com", "https://superuser.com/users/12461/" ]
Traditionally, when you log into a Unix system, the system would start one program for you. That program is a shell, i.e., a program designed to start other programs. It's a command line shell: you start another program by typing its name. The default shell, a Bourne shell, reads commands from `~/.profile` when it is i...
Have a look at this [excellent blog post by ShreevatsaR](http://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/). Here's an extract, but go to the blog post, it includes an explanation for terms like "login shell", a flow chart, and a similar table for Zsh. > > For Bash, they...
183,870
What's the difference between `.bashrc` and `.bash_profile` and which one should I use?
2010/09/02
[ "https://superuser.com/questions/183870", "https://superuser.com", "https://superuser.com/users/12461/" ]
Traditionally, when you log into a Unix system, the system would start one program for you. That program is a shell, i.e., a program designed to start other programs. It's a command line shell: you start another program by typing its name. The default shell, a Bourne shell, reads commands from `~/.profile` when it is i...
The configuration logic of bash's itself is not crazy complicated and explained in other answers in this page, on serverfault and in many blogs. The problem however is *what the Linux distributions make of bash*, I mean the complex and various ways they configure bash by default. <http://mywiki.wooledge.org/DotFiles> m...
183,870
What's the difference between `.bashrc` and `.bash_profile` and which one should I use?
2010/09/02
[ "https://superuser.com/questions/183870", "https://superuser.com", "https://superuser.com/users/12461/" ]
Traditionally, when you log into a Unix system, the system would start one program for you. That program is a shell, i.e., a program designed to start other programs. It's a command line shell: you start another program by typing its name. The default shell, a Bourne shell, reads commands from `~/.profile` when it is i...
**A BETTER COMMENT FOR THE HEAD OF /ETC/PROFILE** Building on Flimm's great answer above, I inserted this new comment at the head of my Debian `/etc/profile`, *(you might need to adjust it for your distro.)*: ``` # For BASH: Read down the appropriate column. Executes A, then B, then C, etc. # The B1, B2, B3 means it ...
183,870
What's the difference between `.bashrc` and `.bash_profile` and which one should I use?
2010/09/02
[ "https://superuser.com/questions/183870", "https://superuser.com", "https://superuser.com/users/12461/" ]
Back in the old days, when pseudo tty's weren't pseudo and actually, well, typed, and UNIXes were accessed by modems so slow you could see each letter being printed to your screen, efficiency was paramount. To help efficiency somewhat you had a concept of a main login window and whatever other windows you used to actua...
**A BETTER COMMENT FOR THE HEAD OF /ETC/PROFILE** Building on Flimm's great answer above, I inserted this new comment at the head of my Debian `/etc/profile`, *(you might need to adjust it for your distro.)*: ``` # For BASH: Read down the appropriate column. Executes A, then B, then C, etc. # The B1, B2, B3 means it ...
183,870
What's the difference between `.bashrc` and `.bash_profile` and which one should I use?
2010/09/02
[ "https://superuser.com/questions/183870", "https://superuser.com", "https://superuser.com/users/12461/" ]
From this [short article](http://joshstaiger.org/archives/2005/07/bash_profile_vs.html) > > According to the bash man page, > .bash\_profile is executed for login > shells, while .bashrc is executed for > interactive non-login shells. > > > **What is a login or non-login shell?** > > > When you login (eg: type...
Have a look at this [excellent blog post by ShreevatsaR](http://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/). Here's an extract, but go to the blog post, it includes an explanation for terms like "login shell", a flow chart, and a similar table for Zsh. > > For Bash, they...
183,870
What's the difference between `.bashrc` and `.bash_profile` and which one should I use?
2010/09/02
[ "https://superuser.com/questions/183870", "https://superuser.com", "https://superuser.com/users/12461/" ]
From this [short article](http://joshstaiger.org/archives/2005/07/bash_profile_vs.html) > > According to the bash man page, > .bash\_profile is executed for login > shells, while .bashrc is executed for > interactive non-login shells. > > > **What is a login or non-login shell?** > > > When you login (eg: type...
**A BETTER COMMENT FOR THE HEAD OF /ETC/PROFILE** Building on Flimm's great answer above, I inserted this new comment at the head of my Debian `/etc/profile`, *(you might need to adjust it for your distro.)*: ``` # For BASH: Read down the appropriate column. Executes A, then B, then C, etc. # The B1, B2, B3 means it ...
8,670,530
I am new to Javascript (and programming in general) and have been trying to get a basic grasp on working with the DOM. Apologies if this is a very basic mistake, but I looked around and couldn't find an answer. I am trying to use the appendChild method to add a heading and some paragraph text into the in the very bas...
2011/12/29
[ "https://Stackoverflow.com/questions/8670530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1058180/" ]
There is an easier way to resolve this issue. Put your JavaScript inside of a function and use the window.onload. So for instance: ``` window.onload = function any_function_name() { var newHeading = document.createElement("h1"); var newParagraph = document.createElement("p"); newHeading.innerHTML = "New Heading!";...
I add an event listener to wait for DOM content to fully load ``` document.addEventListener("DOMContentLoaded", function() { place_the_code_you_want_to_run_after_page_load }) ```
8,670,530
I am new to Javascript (and programming in general) and have been trying to get a basic grasp on working with the DOM. Apologies if this is a very basic mistake, but I looked around and couldn't find an answer. I am trying to use the appendChild method to add a heading and some paragraph text into the in the very bas...
2011/12/29
[ "https://Stackoverflow.com/questions/8670530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1058180/" ]
Assuming this code is inside the `script.js` file, this is because the javascript is running before the rest of the HTML page has loaded. When an HTML page loads, when it comes across a linked resource such as a javascript file, it loads that resource, executes all code it can, and then continues running the page. So...
I add an event listener to wait for DOM content to fully load ``` document.addEventListener("DOMContentLoaded", function() { place_the_code_you_want_to_run_after_page_load }) ```
8,670,530
I am new to Javascript (and programming in general) and have been trying to get a basic grasp on working with the DOM. Apologies if this is a very basic mistake, but I looked around and couldn't find an answer. I am trying to use the appendChild method to add a heading and some paragraph text into the in the very bas...
2011/12/29
[ "https://Stackoverflow.com/questions/8670530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1058180/" ]
There is an easier way to resolve this issue. Put your JavaScript inside of a function and use the window.onload. So for instance: ``` window.onload = function any_function_name() { var newHeading = document.createElement("h1"); var newParagraph = document.createElement("p"); newHeading.innerHTML = "New Heading!";...
Because your JavaScript file is loaded first, and that time when you write `window.document.body.appendChild(btn)`, `body` element is not loaded in html, that's why you are getting error here, you can load the js file once body element is loaded in DOM. **index.html** ``` <html> <head> <script src="Java...
8,670,530
I am new to Javascript (and programming in general) and have been trying to get a basic grasp on working with the DOM. Apologies if this is a very basic mistake, but I looked around and couldn't find an answer. I am trying to use the appendChild method to add a heading and some paragraph text into the in the very bas...
2011/12/29
[ "https://Stackoverflow.com/questions/8670530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1058180/" ]
There is an easier way to resolve this issue. Put your JavaScript inside of a function and use the window.onload. So for instance: ``` window.onload = function any_function_name() { var newHeading = document.createElement("h1"); var newParagraph = document.createElement("p"); newHeading.innerHTML = "New Heading!";...
Your DOM is not loaded, so **getElementById** will return null, use **document.ready()** in jquery ``` $(document).ready(function(){ var newHeading = document.createElement("h1"); var newParagraph = document.createElement("p"); newHeading.innerHTML = "New Heading!"; newParagraph.innerHTML = "So...
8,670,530
I am new to Javascript (and programming in general) and have been trying to get a basic grasp on working with the DOM. Apologies if this is a very basic mistake, but I looked around and couldn't find an answer. I am trying to use the appendChild method to add a heading and some paragraph text into the in the very bas...
2011/12/29
[ "https://Stackoverflow.com/questions/8670530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1058180/" ]
Your script is running before the elements are available. Place your script directly before the closing `</body>` tag. ``` <html> <head> <title>JS Practice</title> </head> <body> <div id = "main"> <h1>Simple HTML Page</h1> <p>This is a very simple HTML page.</p> <p>It's about as bas...
I add an event listener to wait for DOM content to fully load ``` document.addEventListener("DOMContentLoaded", function() { place_the_code_you_want_to_run_after_page_load }) ```
8,670,530
I am new to Javascript (and programming in general) and have been trying to get a basic grasp on working with the DOM. Apologies if this is a very basic mistake, but I looked around and couldn't find an answer. I am trying to use the appendChild method to add a heading and some paragraph text into the in the very bas...
2011/12/29
[ "https://Stackoverflow.com/questions/8670530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1058180/" ]
Your DOM is not loaded, so **getElementById** will return null, use **document.ready()** in jquery ``` $(document).ready(function(){ var newHeading = document.createElement("h1"); var newParagraph = document.createElement("p"); newHeading.innerHTML = "New Heading!"; newParagraph.innerHTML = "So...
Because your JavaScript file is loaded first, and that time when you write `window.document.body.appendChild(btn)`, `body` element is not loaded in html, that's why you are getting error here, you can load the js file once body element is loaded in DOM. **index.html** ``` <html> <head> <script src="Java...
8,670,530
I am new to Javascript (and programming in general) and have been trying to get a basic grasp on working with the DOM. Apologies if this is a very basic mistake, but I looked around and couldn't find an answer. I am trying to use the appendChild method to add a heading and some paragraph text into the in the very bas...
2011/12/29
[ "https://Stackoverflow.com/questions/8670530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1058180/" ]
Assuming this code is inside the `script.js` file, this is because the javascript is running before the rest of the HTML page has loaded. When an HTML page loads, when it comes across a linked resource such as a javascript file, it loads that resource, executes all code it can, and then continues running the page. So...
Because your JavaScript file is loaded first, and that time when you write `window.document.body.appendChild(btn)`, `body` element is not loaded in html, that's why you are getting error here, you can load the js file once body element is loaded in DOM. **index.html** ``` <html> <head> <script src="Java...
8,670,530
I am new to Javascript (and programming in general) and have been trying to get a basic grasp on working with the DOM. Apologies if this is a very basic mistake, but I looked around and couldn't find an answer. I am trying to use the appendChild method to add a heading and some paragraph text into the in the very bas...
2011/12/29
[ "https://Stackoverflow.com/questions/8670530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1058180/" ]
Your script is running before the elements are available. Place your script directly before the closing `</body>` tag. ``` <html> <head> <title>JS Practice</title> </head> <body> <div id = "main"> <h1>Simple HTML Page</h1> <p>This is a very simple HTML page.</p> <p>It's about as bas...
Because your JavaScript file is loaded first, and that time when you write `window.document.body.appendChild(btn)`, `body` element is not loaded in html, that's why you are getting error here, you can load the js file once body element is loaded in DOM. **index.html** ``` <html> <head> <script src="Java...
8,670,530
I am new to Javascript (and programming in general) and have been trying to get a basic grasp on working with the DOM. Apologies if this is a very basic mistake, but I looked around and couldn't find an answer. I am trying to use the appendChild method to add a heading and some paragraph text into the in the very bas...
2011/12/29
[ "https://Stackoverflow.com/questions/8670530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1058180/" ]
I add an event listener to wait for DOM content to fully load ``` document.addEventListener("DOMContentLoaded", function() { place_the_code_you_want_to_run_after_page_load }) ```
Because your JavaScript file is loaded first, and that time when you write `window.document.body.appendChild(btn)`, `body` element is not loaded in html, that's why you are getting error here, you can load the js file once body element is loaded in DOM. **index.html** ``` <html> <head> <script src="Java...
8,670,530
I am new to Javascript (and programming in general) and have been trying to get a basic grasp on working with the DOM. Apologies if this is a very basic mistake, but I looked around and couldn't find an answer. I am trying to use the appendChild method to add a heading and some paragraph text into the in the very bas...
2011/12/29
[ "https://Stackoverflow.com/questions/8670530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1058180/" ]
There is an easier way to resolve this issue. Put your JavaScript inside of a function and use the window.onload. So for instance: ``` window.onload = function any_function_name() { var newHeading = document.createElement("h1"); var newParagraph = document.createElement("p"); newHeading.innerHTML = "New Heading!";...
Your script is running before the elements are available. Place your script directly before the closing `</body>` tag. ``` <html> <head> <title>JS Practice</title> </head> <body> <div id = "main"> <h1>Simple HTML Page</h1> <p>This is a very simple HTML page.</p> <p>It's about as bas...
12,207,541
I want parse something like a section entry in an \*.ini file: ``` line=' [ fdfd fdf f ] ' ``` What could be the sed pattern (???) for this line to split the ``` 'fdfd fdf f' ``` out? So: ``` echo "${line}" | sed -E 's/???/\1/g' ``` How can I describe all chars except `[[:spac...
2012/08/31
[ "https://Stackoverflow.com/questions/12207541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1309041/" ]
When you use the `[[:space:]]` syntax, the outer brackets are normal "match one character from this list" brackets, the same as in `[aeiou]` but the inner brackets are part of `[:space:]` which is an indivisible unit. So if you wanted to match a single character which either belongs to the `space` class or is an `x` y...
``` $ echo "$line" | sed "s/^.*\[[[:space:]]*\([^]]*[^][:space:]]\)[[:space:]]*\].*$/'\1'/" ``` You can split the pattern into two: ``` $ echo "$line" | sed "s/^.*\[[[:space:]]*/'/; s/[[:space:]]*\].*$/'/" ``` `awk` works too: ``` $ echo "$line" | awk -F' *[[\]] *' -vQ="'" '{print Q$2Q}' ```
12,207,541
I want parse something like a section entry in an \*.ini file: ``` line=' [ fdfd fdf f ] ' ``` What could be the sed pattern (???) for this line to split the ``` 'fdfd fdf f' ``` out? So: ``` echo "${line}" | sed -E 's/???/\1/g' ``` How can I describe all chars except `[[:spac...
2012/08/31
[ "https://Stackoverflow.com/questions/12207541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1309041/" ]
``` $ echo "$line" | sed "s/^.*\[[[:space:]]*\([^]]*[^][:space:]]\)[[:space:]]*\].*$/'\1'/" ``` You can split the pattern into two: ``` $ echo "$line" | sed "s/^.*\[[[:space:]]*/'/; s/[[:space:]]*\].*$/'/" ``` `awk` works too: ``` $ echo "$line" | awk -F' *[[\]] *' -vQ="'" '{print Q$2Q}' ```
When you say split, do you mean *split into an array*, or do you mean *filter* out all spaces and brackets? Assuming the value of line number 1 in file.ini is: ``` [ fdfd fdf f ] ``` If you mean array, ``` $linenumber=1; array=($(sed -n ${linenumber}p file.ini | sed 's/[][]*//g')); ``` wil...
12,207,541
I want parse something like a section entry in an \*.ini file: ``` line=' [ fdfd fdf f ] ' ``` What could be the sed pattern (???) for this line to split the ``` 'fdfd fdf f' ``` out? So: ``` echo "${line}" | sed -E 's/???/\1/g' ``` How can I describe all chars except `[[:spac...
2012/08/31
[ "https://Stackoverflow.com/questions/12207541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1309041/" ]
When you use the `[[:space:]]` syntax, the outer brackets are normal "match one character from this list" brackets, the same as in `[aeiou]` but the inner brackets are part of `[:space:]` which is an indivisible unit. So if you wanted to match a single character which either belongs to the `space` class or is an `x` y...
When you say split, do you mean *split into an array*, or do you mean *filter* out all spaces and brackets? Assuming the value of line number 1 in file.ini is: ``` [ fdfd fdf f ] ``` If you mean array, ``` $linenumber=1; array=($(sed -n ${linenumber}p file.ini | sed 's/[][]*//g')); ``` wil...
40,164,277
I need to have my html attribute submit a form. My problem is that a normal button attribute is able to use the type="submit" and other attributes using role="button" don't do anything with the type. So how do I make it submit a form? If you can give me a script to do it, that would be fine too. (I don't know javascr...
2016/10/20
[ "https://Stackoverflow.com/questions/40164277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5103780/" ]
If I understand you correctly you want to submit the form when you press the button using javascript? ``` <form id="test" action="myloc" method="post"> <div class="input-group col-lg-6"> <a type="submit" class="btn btn-default input-group-addon" role="button" onclick="document.getElementById('test').submit();"> ...
Give your `<a>` element an id, then set a jquery onclick function with that id to run whatever query you want.
40,164,277
I need to have my html attribute submit a form. My problem is that a normal button attribute is able to use the type="submit" and other attributes using role="button" don't do anything with the type. So how do I make it submit a form? If you can give me a script to do it, that would be fine too. (I don't know javascr...
2016/10/20
[ "https://Stackoverflow.com/questions/40164277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5103780/" ]
Here is your solution, ``` <form action="myloc" method="post" id="myForm"> <div class="input-group col-lg-6"> <a type="submit" class="btn btn-default input-group-addon" role="button" id="sub"> Search<span class="glyphicon glyphicon-search" aria-hidden="true"></span> </a> <input type="search" class="f...
Give your `<a>` element an id, then set a jquery onclick function with that id to run whatever query you want.
40,164,277
I need to have my html attribute submit a form. My problem is that a normal button attribute is able to use the type="submit" and other attributes using role="button" don't do anything with the type. So how do I make it submit a form? If you can give me a script to do it, that would be fine too. (I don't know javascr...
2016/10/20
[ "https://Stackoverflow.com/questions/40164277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5103780/" ]
If I understand you correctly you want to submit the form when you press the button using javascript? ``` <form id="test" action="myloc" method="post"> <div class="input-group col-lg-6"> <a type="submit" class="btn btn-default input-group-addon" role="button" onclick="document.getElementById('test').submit();"> ...
Here is your solution, ``` <form action="myloc" method="post" id="myForm"> <div class="input-group col-lg-6"> <a type="submit" class="btn btn-default input-group-addon" role="button" id="sub"> Search<span class="glyphicon glyphicon-search" aria-hidden="true"></span> </a> <input type="search" class="f...
19,073,331
I'm looking for a way to change the first character of every word in a sentence form lowercase to uppercase. I already read the [following answer](https://stackoverflow.com/questions/1159343/convert-a-char-to-upper-case-using-regular-expressions-editpad-pro/1159389#1159389) but it doesn't work. I tried to use `\U` to ...
2013/09/29
[ "https://Stackoverflow.com/questions/19073331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2827396/" ]
javascript ---------- ``` str.replace(/' '([a-z])+/, foo); function foo(x){ return x.toUpperCase(); } ```
If your coding using PHP check out the manual here: <http://php.net/manual/en/function.ucwords.php>
19,073,331
I'm looking for a way to change the first character of every word in a sentence form lowercase to uppercase. I already read the [following answer](https://stackoverflow.com/questions/1159343/convert-a-char-to-upper-case-using-regular-expressions-editpad-pro/1159389#1159389) but it doesn't work. I tried to use `\U` to ...
2013/09/29
[ "https://Stackoverflow.com/questions/19073331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2827396/" ]
If text transformations are possible depends on the regexp implementation. Most standard implementations base off Perl regular expressions and do not support this. A lot of text editors however do provide some way of transformations as they do not have any other capabilities of processing a regular expression match. F...
If your coding using PHP check out the manual here: <http://php.net/manual/en/function.ucwords.php>
19,073,331
I'm looking for a way to change the first character of every word in a sentence form lowercase to uppercase. I already read the [following answer](https://stackoverflow.com/questions/1159343/convert-a-char-to-upper-case-using-regular-expressions-editpad-pro/1159389#1159389) but it doesn't work. I tried to use `\U` to ...
2013/09/29
[ "https://Stackoverflow.com/questions/19073331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2827396/" ]
``` $ echo 'xyzzy plugh dwarf' | sed 's/\(\<.\)\.*/\u\1/g' Xyzzy Plugh Dwarf ```
If your coding using PHP check out the manual here: <http://php.net/manual/en/function.ucwords.php>
19,073,331
I'm looking for a way to change the first character of every word in a sentence form lowercase to uppercase. I already read the [following answer](https://stackoverflow.com/questions/1159343/convert-a-char-to-upper-case-using-regular-expressions-editpad-pro/1159389#1159389) but it doesn't work. I tried to use `\U` to ...
2013/09/29
[ "https://Stackoverflow.com/questions/19073331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2827396/" ]
If text transformations are possible depends on the regexp implementation. Most standard implementations base off Perl regular expressions and do not support this. A lot of text editors however do provide some way of transformations as they do not have any other capabilities of processing a regular expression match. F...
javascript ---------- ``` str.replace(/' '([a-z])+/, foo); function foo(x){ return x.toUpperCase(); } ```
19,073,331
I'm looking for a way to change the first character of every word in a sentence form lowercase to uppercase. I already read the [following answer](https://stackoverflow.com/questions/1159343/convert-a-char-to-upper-case-using-regular-expressions-editpad-pro/1159389#1159389) but it doesn't work. I tried to use `\U` to ...
2013/09/29
[ "https://Stackoverflow.com/questions/19073331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2827396/" ]
If text transformations are possible depends on the regexp implementation. Most standard implementations base off Perl regular expressions and do not support this. A lot of text editors however do provide some way of transformations as they do not have any other capabilities of processing a regular expression match. F...
``` $ echo 'xyzzy plugh dwarf' | sed 's/\(\<.\)\.*/\u\1/g' Xyzzy Plugh Dwarf ```
68,427,623
I have a database containing tickets. Each ticket has a unique number but this number is not unique in the table. So for example ticket #1000 can be multiple times in the table with different other columns (Which I have removed here for the example). ``` create table countries ( isoalpha varchar(2), pole varchar...
2021/07/18
[ "https://Stackoverflow.com/questions/68427623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/634698/" ]
You may logically combine the queries using conditional aggregation: ```sql SELECT MIN(CASE WHEN ct.pole = 'USCAN' THEN ti.created END) AS date_uscan, MIN(CASE WHEN ct.pole <> 'USCAN' THEN ti.created END) AS date_other FROM tickets ti LEFT JOIN countries ct ON ct.isoalpha = ti.isoalpha GROUP BY ti.number ORDE...
You can create unique entries for each date/country then use that value to count USCAN and non-USCAN ``` SELECT created, SUM(1) as total, SUM(CASE WHEN pole = 'USCAN' THEN 1 ELSE 0 END) as uscan, SUM(CASE WHEN pole != 'USCAN' THEN 1 ELSE 0 END) as nonuscan FROM ( SELECT created, t.isoalpha, MIN(pole) AS p...
68,427,623
I have a database containing tickets. Each ticket has a unique number but this number is not unique in the table. So for example ticket #1000 can be multiple times in the table with different other columns (Which I have removed here for the example). ``` create table countries ( isoalpha varchar(2), pole varchar...
2021/07/18
[ "https://Stackoverflow.com/questions/68427623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/634698/" ]
You may logically combine the queries using conditional aggregation: ```sql SELECT MIN(CASE WHEN ct.pole = 'USCAN' THEN ti.created END) AS date_uscan, MIN(CASE WHEN ct.pole <> 'USCAN' THEN ti.created END) AS date_other FROM tickets ti LEFT JOIN countries ct ON ct.isoalpha = ti.isoalpha GROUP BY ti.number ORDE...
Regarding the answer of SQL Hacks I found the right solution ``` SELECT created, SUM(1) as total, SUM(CASE WHEN pole = 'USCAN' THEN 1 ELSE 0 END) as uscan, SUM(CASE WHEN pole != 'USCAN' THEN 1 ELSE 0 END) as nonuscan FROM ( SELECT created, t.isoalpha, MIN(pole) AS pole FROM tickets t JOIN countries ...
68,427,623
I have a database containing tickets. Each ticket has a unique number but this number is not unique in the table. So for example ticket #1000 can be multiple times in the table with different other columns (Which I have removed here for the example). ``` create table countries ( isoalpha varchar(2), pole varchar...
2021/07/18
[ "https://Stackoverflow.com/questions/68427623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/634698/" ]
You can create unique entries for each date/country then use that value to count USCAN and non-USCAN ``` SELECT created, SUM(1) as total, SUM(CASE WHEN pole = 'USCAN' THEN 1 ELSE 0 END) as uscan, SUM(CASE WHEN pole != 'USCAN' THEN 1 ELSE 0 END) as nonuscan FROM ( SELECT created, t.isoalpha, MIN(pole) AS p...
Regarding the answer of SQL Hacks I found the right solution ``` SELECT created, SUM(1) as total, SUM(CASE WHEN pole = 'USCAN' THEN 1 ELSE 0 END) as uscan, SUM(CASE WHEN pole != 'USCAN' THEN 1 ELSE 0 END) as nonuscan FROM ( SELECT created, t.isoalpha, MIN(pole) AS pole FROM tickets t JOIN countries ...
9,842,494
So I have a fascinating problem. Despite the fact that I'm not manually or programmatically scrolling my view, my WebView is being automatically scrolled to after the data inside it loads. I've got a fragment in a viewpager. When I first load the pager, it works as expected and everything is shown. But once I "flip th...
2012/03/23
[ "https://Stackoverflow.com/questions/9842494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43790/" ]
Probably there are people who have the same problem I was having, so I'll help out. I was trying to put **android:descendantFocusability="beforeDescendants"** in my main ScrollView as following: ``` <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:descendantFocu...
I added: `android:overScrollMode="never"` in my ScrollView and set the height to `wrap_content`. My view was very complex as it was legacy code with LinearLayout inside LinearLayout inside LinearLayout. This helped me, hope it will help someone else too!
9,842,494
So I have a fascinating problem. Despite the fact that I'm not manually or programmatically scrolling my view, my WebView is being automatically scrolled to after the data inside it loads. I've got a fragment in a viewpager. When I first load the pager, it works as expected and everything is shown. But once I "flip th...
2012/03/23
[ "https://Stackoverflow.com/questions/9842494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43790/" ]
You can simply add this to your LinearLayout: android:focusableInTouchMode="true". It works for me. ``` <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:focusableInTouchMode="true" android:orientation="vertical" > ```
Adding these line in main layout solves the problem ``` android:descendantFocusability="blocksDescendants" ```
9,842,494
So I have a fascinating problem. Despite the fact that I'm not manually or programmatically scrolling my view, my WebView is being automatically scrolled to after the data inside it loads. I've got a fragment in a viewpager. When I first load the pager, it works as expected and everything is shown. But once I "flip th...
2012/03/23
[ "https://Stackoverflow.com/questions/9842494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43790/" ]
I added: `android:overScrollMode="never"` in my ScrollView and set the height to `wrap_content`. My view was very complex as it was legacy code with LinearLayout inside LinearLayout inside LinearLayout. This helped me, hope it will help someone else too!
I had to use the fully qualified name for MyScrollView, otherwise I got an inflate exception. ``` <com.mypackagename.MyScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/background" > ...
9,842,494
So I have a fascinating problem. Despite the fact that I'm not manually or programmatically scrolling my view, my WebView is being automatically scrolled to after the data inside it loads. I've got a fragment in a viewpager. When I first load the pager, it works as expected and everything is shown. But once I "flip th...
2012/03/23
[ "https://Stackoverflow.com/questions/9842494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43790/" ]
You can simply add this to your LinearLayout: android:focusableInTouchMode="true". It works for me. ``` <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:focusableInTouchMode="true" android:orientation="vertical" > ```
Probably there are people who have the same problem I was having, so I'll help out. I was trying to put **android:descendantFocusability="beforeDescendants"** in my main ScrollView as following: ``` <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:descendantFocu...
9,842,494
So I have a fascinating problem. Despite the fact that I'm not manually or programmatically scrolling my view, my WebView is being automatically scrolled to after the data inside it loads. I've got a fragment in a viewpager. When I first load the pager, it works as expected and everything is shown. But once I "flip th...
2012/03/23
[ "https://Stackoverflow.com/questions/9842494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43790/" ]
Like this: ``` <com.ya.test.view.MyScrollView android:layout_width="match_parent" android:layout_height="match_parent" > <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:descendantFocusability="beforeDescendants" android:focusabl...
I had to use the fully qualified name for MyScrollView, otherwise I got an inflate exception. ``` <com.mypackagename.MyScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/background" > ...
9,842,494
So I have a fascinating problem. Despite the fact that I'm not manually or programmatically scrolling my view, my WebView is being automatically scrolled to after the data inside it loads. I've got a fragment in a viewpager. When I first load the pager, it works as expected and everything is shown. But once I "flip th...
2012/03/23
[ "https://Stackoverflow.com/questions/9842494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43790/" ]
I had the same problem, after hours of trying several ideas, what finally worked for me was simply adding the `descendantFocusability` attribute to the ScrollView's containing LinearLayout, with the value `blocksDescendants`. In your case: ``` <LinearLayout android:layout_width="match_parent" android:layout_he...
Adding these line in main layout solves the problem ``` android:descendantFocusability="blocksDescendants" ```
9,842,494
So I have a fascinating problem. Despite the fact that I'm not manually or programmatically scrolling my view, my WebView is being automatically scrolled to after the data inside it loads. I've got a fragment in a viewpager. When I first load the pager, it works as expected and everything is shown. But once I "flip th...
2012/03/23
[ "https://Stackoverflow.com/questions/9842494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43790/" ]
I had the same problem, after hours of trying several ideas, what finally worked for me was simply adding the `descendantFocusability` attribute to the ScrollView's containing LinearLayout, with the value `blocksDescendants`. In your case: ``` <LinearLayout android:layout_width="match_parent" android:layout_he...
You should create new class extend ScrollView, then Override requestChildFocus: ``` public class MyScrollView extends ScrollView { @Override public void requestChildFocus(View child, View focused) { if (focused instanceof WebView ) return; super.requestChildFocus(child, focused);...
9,842,494
So I have a fascinating problem. Despite the fact that I'm not manually or programmatically scrolling my view, my WebView is being automatically scrolled to after the data inside it loads. I've got a fragment in a viewpager. When I first load the pager, it works as expected and everything is shown. But once I "flip th...
2012/03/23
[ "https://Stackoverflow.com/questions/9842494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43790/" ]
Probably there are people who have the same problem I was having, so I'll help out. I was trying to put **android:descendantFocusability="beforeDescendants"** in my main ScrollView as following: ``` <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:descendantFocu...
I had to use the fully qualified name for MyScrollView, otherwise I got an inflate exception. ``` <com.mypackagename.MyScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/background" > ...
9,842,494
So I have a fascinating problem. Despite the fact that I'm not manually or programmatically scrolling my view, my WebView is being automatically scrolled to after the data inside it loads. I've got a fragment in a viewpager. When I first load the pager, it works as expected and everything is shown. But once I "flip th...
2012/03/23
[ "https://Stackoverflow.com/questions/9842494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43790/" ]
You should create new class extend ScrollView, then Override requestChildFocus: ``` public class MyScrollView extends ScrollView { @Override public void requestChildFocus(View child, View focused) { if (focused instanceof WebView ) return; super.requestChildFocus(child, focused);...
Adding these line in main layout solves the problem ``` android:descendantFocusability="blocksDescendants" ```
9,842,494
So I have a fascinating problem. Despite the fact that I'm not manually or programmatically scrolling my view, my WebView is being automatically scrolled to after the data inside it loads. I've got a fragment in a viewpager. When I first load the pager, it works as expected and everything is shown. But once I "flip th...
2012/03/23
[ "https://Stackoverflow.com/questions/9842494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43790/" ]
You should create new class extend ScrollView, then Override requestChildFocus: ``` public class MyScrollView extends ScrollView { @Override public void requestChildFocus(View child, View focused) { if (focused instanceof WebView ) return; super.requestChildFocus(child, focused);...
I added: `android:overScrollMode="never"` in my ScrollView and set the height to `wrap_content`. My view was very complex as it was legacy code with LinearLayout inside LinearLayout inside LinearLayout. This helped me, hope it will help someone else too!
360,331
Is there a way to obtain a pdf file without figures and tables, while maintaining the figure numbers in the body text. Thank you very much
2017/03/25
[ "https://tex.stackexchange.com/questions/360331", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/105060/" ]
That picture looks like ``` \(\left(\frac{\partial U}{\partial T}\right)_V\). ```
The `esdiff` package makes it easy to type: the `\diffp*` command accepts 3 arguments (function in numerator, variables in denominator, evaluation point). It can calculate by itself the order of derivation in crossed derivatives. You have options to have the differential symbol upright (default) or italic, and to set...
2,080,245
I need to construct square matrices $A$ and $B$ such that $AB=0$ but $BA \neq 0$. I know matrix multiplication is not commutative, but I don't know how to construct such matrices. Thanks in advance. Edit: looking for some simple way
2017/01/02
[ "https://math.stackexchange.com/questions/2080245", "https://math.stackexchange.com", "https://math.stackexchange.com/users/369983/" ]
A whole family: $$ A=\begin{bmatrix}0&a\\0&a'\end{bmatrix}, \quad B=\begin{bmatrix}b&b'\\0&0\end{bmatrix}$$ with non-orthogonal vectors $(a,a')$ and $(b, b')$.
We can think of constructing such matrices by using the Rank-Nullity theorem. Note that one matrix should be singular by taking the determinant on both sides. Now choose columns arbitrarily in the singular matrix $A$ such that the column space doesn't equal dimension of full space, i.e, choose at least one less linearl...
2,080,245
I need to construct square matrices $A$ and $B$ such that $AB=0$ but $BA \neq 0$. I know matrix multiplication is not commutative, but I don't know how to construct such matrices. Thanks in advance. Edit: looking for some simple way
2017/01/02
[ "https://math.stackexchange.com/questions/2080245", "https://math.stackexchange.com", "https://math.stackexchange.com/users/369983/" ]
$A = \begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}$, $B = \begin{bmatrix} 0 & 0 \\ 1 & 0\end{bmatrix}.$ When thinking of examples try to think of most trivial ones like $O$, $I\_n$ etc. These are also kind of trivial right?
Pick $\mathrm u, \mathrm v, \mathrm w \in \mathbb R^n \setminus \{0\_n\}$ such that $\neg (\mathrm u \perp \mathrm v)$ and $\mathrm v \perp \mathrm w$. Define $$\mathrm A := \mathrm u \mathrm v^{\top} \qquad \qquad \qquad \mathrm B := \mathrm w \mathrm v^{\top}$$ whose traces are $$\mbox{tr} (\mathrm A) = \mathrm v^...
2,080,245
I need to construct square matrices $A$ and $B$ such that $AB=0$ but $BA \neq 0$. I know matrix multiplication is not commutative, but I don't know how to construct such matrices. Thanks in advance. Edit: looking for some simple way
2017/01/02
[ "https://math.stackexchange.com/questions/2080245", "https://math.stackexchange.com", "https://math.stackexchange.com/users/369983/" ]
A whole family: $$ A=\begin{bmatrix}0&a\\0&a'\end{bmatrix}, \quad B=\begin{bmatrix}b&b'\\0&0\end{bmatrix}$$ with non-orthogonal vectors $(a,a')$ and $(b, b')$.
Pick $\mathrm u, \mathrm v, \mathrm w \in \mathbb R^n \setminus \{0\_n\}$ such that $\neg (\mathrm u \perp \mathrm v)$ and $\mathrm v \perp \mathrm w$. Define $$\mathrm A := \mathrm u \mathrm v^{\top} \qquad \qquad \qquad \mathrm B := \mathrm w \mathrm v^{\top}$$ whose traces are $$\mbox{tr} (\mathrm A) = \mathrm v^...
2,080,245
I need to construct square matrices $A$ and $B$ such that $AB=0$ but $BA \neq 0$. I know matrix multiplication is not commutative, but I don't know how to construct such matrices. Thanks in advance. Edit: looking for some simple way
2017/01/02
[ "https://math.stackexchange.com/questions/2080245", "https://math.stackexchange.com", "https://math.stackexchange.com/users/369983/" ]
$A = \begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}$, $B = \begin{bmatrix} 0 & 0 \\ 1 & 0\end{bmatrix}.$ When thinking of examples try to think of most trivial ones like $O$, $I\_n$ etc. These are also kind of trivial right?
Yet another more powerful (and maybe more "advanced"): Let A be a given matrix, now $AB-BA$ can be rewritten with help of matrix multiplication and vectorization as: $M\_{AR}\text{vec}(B) - M\_{AL}\text{vec}(B)$, where $M\_{AR}$ is a matrix performing multiplication from the Right by $A$ and $M\_{AL}$ from Left by $A$...
2,080,245
I need to construct square matrices $A$ and $B$ such that $AB=0$ but $BA \neq 0$. I know matrix multiplication is not commutative, but I don't know how to construct such matrices. Thanks in advance. Edit: looking for some simple way
2017/01/02
[ "https://math.stackexchange.com/questions/2080245", "https://math.stackexchange.com", "https://math.stackexchange.com/users/369983/" ]
The problem reduces to solving a system of linear equations. Let $$x=\left( \begin{array}{cc} a & b \\ c & d \\ \end{array} \right)$$ $$y=\left( \begin{array}{cc} e & f \\ g & h \\ \end{array} \right)$$ Now solve the 4 linear equations resulting from $x.y=0$ The solution with the maximum number of free paramet...
Yet another more powerful (and maybe more "advanced"): Let A be a given matrix, now $AB-BA$ can be rewritten with help of matrix multiplication and vectorization as: $M\_{AR}\text{vec}(B) - M\_{AL}\text{vec}(B)$, where $M\_{AR}$ is a matrix performing multiplication from the Right by $A$ and $M\_{AL}$ from Left by $A$...
2,080,245
I need to construct square matrices $A$ and $B$ such that $AB=0$ but $BA \neq 0$. I know matrix multiplication is not commutative, but I don't know how to construct such matrices. Thanks in advance. Edit: looking for some simple way
2017/01/02
[ "https://math.stackexchange.com/questions/2080245", "https://math.stackexchange.com", "https://math.stackexchange.com/users/369983/" ]
A whole family: $$ A=\begin{bmatrix}0&a\\0&a'\end{bmatrix}, \quad B=\begin{bmatrix}b&b'\\0&0\end{bmatrix}$$ with non-orthogonal vectors $(a,a')$ and $(b, b')$.
Yet another more powerful (and maybe more "advanced"): Let A be a given matrix, now $AB-BA$ can be rewritten with help of matrix multiplication and vectorization as: $M\_{AR}\text{vec}(B) - M\_{AL}\text{vec}(B)$, where $M\_{AR}$ is a matrix performing multiplication from the Right by $A$ and $M\_{AL}$ from Left by $A$...
2,080,245
I need to construct square matrices $A$ and $B$ such that $AB=0$ but $BA \neq 0$. I know matrix multiplication is not commutative, but I don't know how to construct such matrices. Thanks in advance. Edit: looking for some simple way
2017/01/02
[ "https://math.stackexchange.com/questions/2080245", "https://math.stackexchange.com", "https://math.stackexchange.com/users/369983/" ]
The problem reduces to solving a system of linear equations. Let $$x=\left( \begin{array}{cc} a & b \\ c & d \\ \end{array} \right)$$ $$y=\left( \begin{array}{cc} e & f \\ g & h \\ \end{array} \right)$$ Now solve the 4 linear equations resulting from $x.y=0$ The solution with the maximum number of free paramet...
We can think of constructing such matrices by using the Rank-Nullity theorem. Note that one matrix should be singular by taking the determinant on both sides. Now choose columns arbitrarily in the singular matrix $A$ such that the column space doesn't equal dimension of full space, i.e, choose at least one less linearl...
2,080,245
I need to construct square matrices $A$ and $B$ such that $AB=0$ but $BA \neq 0$. I know matrix multiplication is not commutative, but I don't know how to construct such matrices. Thanks in advance. Edit: looking for some simple way
2017/01/02
[ "https://math.stackexchange.com/questions/2080245", "https://math.stackexchange.com", "https://math.stackexchange.com/users/369983/" ]
$A = \begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix}$, $B = \begin{bmatrix} 0 & 0 \\ 1 & 0\end{bmatrix}.$ When thinking of examples try to think of most trivial ones like $O$, $I\_n$ etc. These are also kind of trivial right?
We can think of constructing such matrices by using the Rank-Nullity theorem. Note that one matrix should be singular by taking the determinant on both sides. Now choose columns arbitrarily in the singular matrix $A$ such that the column space doesn't equal dimension of full space, i.e, choose at least one less linearl...
2,080,245
I need to construct square matrices $A$ and $B$ such that $AB=0$ but $BA \neq 0$. I know matrix multiplication is not commutative, but I don't know how to construct such matrices. Thanks in advance. Edit: looking for some simple way
2017/01/02
[ "https://math.stackexchange.com/questions/2080245", "https://math.stackexchange.com", "https://math.stackexchange.com/users/369983/" ]
The problem reduces to solving a system of linear equations. Let $$x=\left( \begin{array}{cc} a & b \\ c & d \\ \end{array} \right)$$ $$y=\left( \begin{array}{cc} e & f \\ g & h \\ \end{array} \right)$$ Now solve the 4 linear equations resulting from $x.y=0$ The solution with the maximum number of free paramet...
There is a quite easy general way to get an example. Saying $AB=0$ means that the image space of $B$ must be contained in the kernel of $A$, while $BA\neq0$ means the image of $A$ is not contained in the kernel of $B$. Clearly you won't get an example by choosing $A$ or $B$ to be zero or invertible, so their images and...
2,080,245
I need to construct square matrices $A$ and $B$ such that $AB=0$ but $BA \neq 0$. I know matrix multiplication is not commutative, but I don't know how to construct such matrices. Thanks in advance. Edit: looking for some simple way
2017/01/02
[ "https://math.stackexchange.com/questions/2080245", "https://math.stackexchange.com", "https://math.stackexchange.com/users/369983/" ]
$\newcommand{\im}{\mathrm{im}}$Perhaps it is worth recording a strategy to construct such an example, which may turn useful in other circumstances. Will start with a $2 \times 2$ example, and then generalize. First of all, both matrices have to have rank $1$. For, if $A$ has rank $2$, that is, it is invertibile, then...
Pick $\mathrm u, \mathrm v, \mathrm w \in \mathbb R^n \setminus \{0\_n\}$ such that $\neg (\mathrm u \perp \mathrm v)$ and $\mathrm v \perp \mathrm w$. Define $$\mathrm A := \mathrm u \mathrm v^{\top} \qquad \qquad \qquad \mathrm B := \mathrm w \mathrm v^{\top}$$ whose traces are $$\mbox{tr} (\mathrm A) = \mathrm v^...
32,140,042
Is there a way to detect the SIM phone number on a mobile device while using Meteor? Moreover, what is the correct behavior to have and precautions to make to log users using their phone number (like in Whatsapp or Viber for example)? Thank you in advance.
2015/08/21
[ "https://Stackoverflow.com/questions/32140042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3104373/" ]
You have two options: 1. Install Microsoft Windows SDK 2. Copy these files to the machine you are trying to build. take a look at these answers: [Task could not find "AxImp.exe"](https://stackoverflow.com/questions/5923258/task-could-not-find-aximp-exe) ["Task failed because AXImp.exe was not found" when using MSBu...
I had the same issue when I try to build the VS2015 solution file with Jenkins on Windows 2012 server after commit to SVN. Tried to copy AxImp.exe and related binaries and settings but failed. SO I had to install the windows 8.1 SDK and that made the successful build via Jenkins CI server. Hope this helps someone.
32,140,042
Is there a way to detect the SIM phone number on a mobile device while using Meteor? Moreover, what is the correct behavior to have and precautions to make to log users using their phone number (like in Whatsapp or Viber for example)? Thank you in advance.
2015/08/21
[ "https://Stackoverflow.com/questions/32140042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3104373/" ]
I solved my problem installing [Windows 8.1 SDK](https://developer.microsoft.com/pt-pt/windows/downloads/windows-8-1-sdk) In my case, I was trying to compile a **.csproj** using **MSBuild** on a CI **Windows 2012 R2** server (CI stands for Continuous Integration), although the most relevant web's issues on this subjec...
I had the same issue when I try to build the VS2015 solution file with Jenkins on Windows 2012 server after commit to SVN. Tried to copy AxImp.exe and related binaries and settings but failed. SO I had to install the windows 8.1 SDK and that made the successful build via Jenkins CI server. Hope this helps someone.
8,243,134
How do I accomplish the following in C++, and what is doing such things called? ``` template <bool S> class NuclearPowerplantControllerFactoryProviderFactory { // if S == true typedef int data_t; // if S == false typedef unsigned int data_t; }; ```
2011/11/23
[ "https://Stackoverflow.com/questions/8243134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/254704/" ]
By **specialization**: ``` template <bool> class Foo; template <> class Foo<true> { typedef int data_t; }; template <> class Foo<false> { typedef unsigned int data_t; }; ``` You can choose to make one of the two cases the primary template and the other one the specialization, but I prefer this more symmetric v...
@Kerrek has answered the question sufficiently, but that can be more generic as follows: ``` template<bool b, typename T, typename U> struct select { typedef T type; }; template<typename T, typename U> struct select<false, T, U> { typedef U type; }; ``` And use as: ``` template <bool S> class NuclearPowerpl...
40,636,004
suppose we have a table: MASTER\_X\_Y in the database. I want the syntax to run the query : ``` INSERT INTO MASTER_VARIABLE1_VARIABLE2 VALUES (.....); ``` where VARIABLE1 and VARIABLE2 have values X and Y respectively which have been selected from another table. Is this possible ? ( I have 38 possible combinati...
2016/11/16
[ "https://Stackoverflow.com/questions/40636004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5800086/" ]
Still need to test for the user hitting Cancel...This worked for me when hitting Cancel, or typing in 0, 1, or 11 ``` Prints: Dim NumberOfCopies As String NumberOfCopies = Application.InputBox("How many copies do you want to print? Must enter 0-10", Type:=2) If NumberOfCopies = "False" Or NumberOfCopies = "0" Then ...
Putting numbers in quotation marks turns them into a String. Since you want the user to input a number, you should make the following changes: ``` Dim NumberOfCopies As Int NumberOfCopies = Application.InputBox("How many copies do you want to print Must enter 0-10", Type:=1) If NumberofCopies >= 11 Then ... If N...
40,636,004
suppose we have a table: MASTER\_X\_Y in the database. I want the syntax to run the query : ``` INSERT INTO MASTER_VARIABLE1_VARIABLE2 VALUES (.....); ``` where VARIABLE1 and VARIABLE2 have values X and Y respectively which have been selected from another table. Is this possible ? ( I have 38 possible combinati...
2016/11/16
[ "https://Stackoverflow.com/questions/40636004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5800086/" ]
Putting numbers in quotation marks turns them into a String. Since you want the user to input a number, you should make the following changes: ``` Dim NumberOfCopies As Int NumberOfCopies = Application.InputBox("How many copies do you want to print Must enter 0-10", Type:=1) If NumberofCopies >= 11 Then ... If N...
`Type:=2` is actually for Text type. You are working with numbers, so you should set it as `Type:=1`. With that, if the user enters anything that is not a number, it will automatically pop up a message "Number is not valid" (no scripting effort required for that). You should also avoid using Position labels whenever ...
40,636,004
suppose we have a table: MASTER\_X\_Y in the database. I want the syntax to run the query : ``` INSERT INTO MASTER_VARIABLE1_VARIABLE2 VALUES (.....); ``` where VARIABLE1 and VARIABLE2 have values X and Y respectively which have been selected from another table. Is this possible ? ( I have 38 possible combinati...
2016/11/16
[ "https://Stackoverflow.com/questions/40636004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5800086/" ]
Still need to test for the user hitting Cancel...This worked for me when hitting Cancel, or typing in 0, 1, or 11 ``` Prints: Dim NumberOfCopies As String NumberOfCopies = Application.InputBox("How many copies do you want to print? Must enter 0-10", Type:=2) If NumberOfCopies = "False" Or NumberOfCopies = "0" Then ...
`Type:=2` is actually for Text type. You are working with numbers, so you should set it as `Type:=1`. With that, if the user enters anything that is not a number, it will automatically pop up a message "Number is not valid" (no scripting effort required for that). You should also avoid using Position labels whenever ...
10,005,951
I want to load the list of the groups as well as data into two separate datatables (or one, but I don't see that possible). Then I want to apply the grouping like this: Groups ``` A B Bar C Car ``` Data ``` Ale Beer Bartender Barry Coal Calm Carbon ``` The final result after grouping should be like this. ``` *A...
2012/04/04
[ "https://Stackoverflow.com/questions/10005951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1167953/" ]
Since every record has it's children, the query should also take a father for each record. Then there is a nice trick in advanced grouping tab. Choosing a father's column yields as many higher level groups as needed recursively. I learnt about that in <http://blogs.microsoft.co.il/blogs/barbaro/archive/2008/12/01/creat...
I suggest reporting from a query like this: ``` select gtop.category top_category, gsub.category sub_category, dtab.category data_category from groupTable gtop join groupTable gsub on gsub.category like gtop.category + '%' left join dataTable dtab on dtab.category like gsub.category + '%' where len(gtop....
12,169,718
Lets say I have an XML file: ``` <locations> <country name="Australia"> <city>Brisbane</city> <city>Melbourne</city> <city>Sydney</city> </country> <country name="England"> <city>Bristol</city> <city>London</city> </country> <country name="America"> <...
2012/08/29
[ "https://Stackoverflow.com/questions/12169718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/769083/" ]
[SelectMany](http://msdn.microsoft.com/en-us/library/bb534336.aspx) should do the trick here. ``` var result = XDocument.Load(@"test.xml") .Descendants("country") .SelectMany(e => (new [] { (string)e.Attribute("name")}) .Concat( e.Elements("city") .Select(c => c.Va...
Here's a way to do it with query syntax: ``` var query = from country in XDocument.Load(@"test.xml").Descendants("country") let countryName = new [] {(string)country.Attribute("name")} let cities = country.Elements("city").Select(x => (string)x) from place in countryName.Concat(citi...
17,646,509
I have a "why does it work that way?" question about garbage collection (any/all implementations: Java, Python, CLR, etc.). Garbage collectors deallocate an object when it is no longer in any scope; the number of references pointing to it is zero. It seems to me that a framework could deallocate as soon as the number o...
2013/07/15
[ "https://Stackoverflow.com/questions/17646509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1623645/" ]
To understand garbage-collection, go to a bowling alley and watch how the pinsetter removes fallen pins after the first ball has been rolled. Rather than identifying and removing individual fallen pins, the pinsetter mechanism picks up all the pins that are still standing, lifts them to safety, and then runs a sweeper ...
@Jim has answered quite some, I will add more to it. Firstly what makes you think that deallocating[A1] as soon as the count is `0` is a good alternative? Garbage Collectors not only only deallocate objects but are responsible for the complete memory management. Starting with `fragmentation`, one of the biggest Issue...
17,646,509
I have a "why does it work that way?" question about garbage collection (any/all implementations: Java, Python, CLR, etc.). Garbage collectors deallocate an object when it is no longer in any scope; the number of references pointing to it is zero. It seems to me that a framework could deallocate as soon as the number o...
2013/07/15
[ "https://Stackoverflow.com/questions/17646509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1623645/" ]
Your thoughts are generally very insightful and well considered. You're just missing some basic information. > > Garbage collectors deallocate an object when it is no longer in any scope > > > That is completely incorrect in general. Garbage collectors work at run-time on a representation in which the notion of s...
Where I've come across GC systems they wait until they need to run, so that the relocation of objects still in use can be done once, rather than many times. Consider a series of objects allocated sequentially in memory: ``` Object 1 Object 2 Object 3 Object 4 Object 5 ``` If Object 2 can be deallocated, and GC oper...
17,646,509
I have a "why does it work that way?" question about garbage collection (any/all implementations: Java, Python, CLR, etc.). Garbage collectors deallocate an object when it is no longer in any scope; the number of references pointing to it is zero. It seems to me that a framework could deallocate as soon as the number o...
2013/07/15
[ "https://Stackoverflow.com/questions/17646509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1623645/" ]
Your thoughts are generally very insightful and well considered. You're just missing some basic information. > > Garbage collectors deallocate an object when it is no longer in any scope > > > That is completely incorrect in general. Garbage collectors work at run-time on a representation in which the notion of s...
I think the reason in performance. If you create much objects in a loop and destroy them at the end of a loop step it would take more time to execute that code, then waiting until the program is idle and freeing the data at once. Or on low memory of cause.
17,646,509
I have a "why does it work that way?" question about garbage collection (any/all implementations: Java, Python, CLR, etc.). Garbage collectors deallocate an object when it is no longer in any scope; the number of references pointing to it is zero. It seems to me that a framework could deallocate as soon as the number o...
2013/07/15
[ "https://Stackoverflow.com/questions/17646509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1623645/" ]
To start with, a point of terminology: "garbage collection" means different things to different people, and some GC schemes are more sophisticated than others. Some people consider reference counting to be a form of GC, but personally I consider "true GC" to be distinct from reference counting. With refcounts, there i...
To understand garbage-collection, go to a bowling alley and watch how the pinsetter removes fallen pins after the first ball has been rolled. Rather than identifying and removing individual fallen pins, the pinsetter mechanism picks up all the pins that are still standing, lifts them to safety, and then runs a sweeper ...
17,646,509
I have a "why does it work that way?" question about garbage collection (any/all implementations: Java, Python, CLR, etc.). Garbage collectors deallocate an object when it is no longer in any scope; the number of references pointing to it is zero. It seems to me that a framework could deallocate as soon as the number o...
2013/07/15
[ "https://Stackoverflow.com/questions/17646509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1623645/" ]
To start with, a point of terminology: "garbage collection" means different things to different people, and some GC schemes are more sophisticated than others. Some people consider reference counting to be a form of GC, but personally I consider "true GC" to be distinct from reference counting. With refcounts, there i...
Garbage collection using reference counting is very slow, especially in a threaded environment. I really recommend [this post by Brian Harry](http://blogs.msdn.com/b/brada/archive/2005/02/11/371015.aspx). A code sample is provided there which more than enough to convince me (C#): ``` public interface IRefCounted : I...
17,646,509
I have a "why does it work that way?" question about garbage collection (any/all implementations: Java, Python, CLR, etc.). Garbage collectors deallocate an object when it is no longer in any scope; the number of references pointing to it is zero. It seems to me that a framework could deallocate as soon as the number o...
2013/07/15
[ "https://Stackoverflow.com/questions/17646509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1623645/" ]
To start with, a point of terminology: "garbage collection" means different things to different people, and some GC schemes are more sophisticated than others. Some people consider reference counting to be a form of GC, but personally I consider "true GC" to be distinct from reference counting. With refcounts, there i...
@Jim has answered quite some, I will add more to it. Firstly what makes you think that deallocating[A1] as soon as the count is `0` is a good alternative? Garbage Collectors not only only deallocate objects but are responsible for the complete memory management. Starting with `fragmentation`, one of the biggest Issue...
17,646,509
I have a "why does it work that way?" question about garbage collection (any/all implementations: Java, Python, CLR, etc.). Garbage collectors deallocate an object when it is no longer in any scope; the number of references pointing to it is zero. It seems to me that a framework could deallocate as soon as the number o...
2013/07/15
[ "https://Stackoverflow.com/questions/17646509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1623645/" ]
To start with, a point of terminology: "garbage collection" means different things to different people, and some GC schemes are more sophisticated than others. Some people consider reference counting to be a form of GC, but personally I consider "true GC" to be distinct from reference counting. With refcounts, there i...
Where I've come across GC systems they wait until they need to run, so that the relocation of objects still in use can be done once, rather than many times. Consider a series of objects allocated sequentially in memory: ``` Object 1 Object 2 Object 3 Object 4 Object 5 ``` If Object 2 can be deallocated, and GC oper...
17,646,509
I have a "why does it work that way?" question about garbage collection (any/all implementations: Java, Python, CLR, etc.). Garbage collectors deallocate an object when it is no longer in any scope; the number of references pointing to it is zero. It seems to me that a framework could deallocate as soon as the number o...
2013/07/15
[ "https://Stackoverflow.com/questions/17646509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1623645/" ]
To understand garbage-collection, go to a bowling alley and watch how the pinsetter removes fallen pins after the first ball has been rolled. Rather than identifying and removing individual fallen pins, the pinsetter mechanism picks up all the pins that are still standing, lifts them to safety, and then runs a sweeper ...
I think the reason in performance. If you create much objects in a loop and destroy them at the end of a loop step it would take more time to execute that code, then waiting until the program is idle and freeing the data at once. Or on low memory of cause.
17,646,509
I have a "why does it work that way?" question about garbage collection (any/all implementations: Java, Python, CLR, etc.). Garbage collectors deallocate an object when it is no longer in any scope; the number of references pointing to it is zero. It seems to me that a framework could deallocate as soon as the number o...
2013/07/15
[ "https://Stackoverflow.com/questions/17646509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1623645/" ]
To understand garbage-collection, go to a bowling alley and watch how the pinsetter removes fallen pins after the first ball has been rolled. Rather than identifying and removing individual fallen pins, the pinsetter mechanism picks up all the pins that are still standing, lifts them to safety, and then runs a sweeper ...
Where I've come across GC systems they wait until they need to run, so that the relocation of objects still in use can be done once, rather than many times. Consider a series of objects allocated sequentially in memory: ``` Object 1 Object 2 Object 3 Object 4 Object 5 ``` If Object 2 can be deallocated, and GC oper...
17,646,509
I have a "why does it work that way?" question about garbage collection (any/all implementations: Java, Python, CLR, etc.). Garbage collectors deallocate an object when it is no longer in any scope; the number of references pointing to it is zero. It seems to me that a framework could deallocate as soon as the number o...
2013/07/15
[ "https://Stackoverflow.com/questions/17646509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1623645/" ]
To start with, a point of terminology: "garbage collection" means different things to different people, and some GC schemes are more sophisticated than others. Some people consider reference counting to be a form of GC, but personally I consider "true GC" to be distinct from reference counting. With refcounts, there i...
Your thoughts are generally very insightful and well considered. You're just missing some basic information. > > Garbage collectors deallocate an object when it is no longer in any scope > > > That is completely incorrect in general. Garbage collectors work at run-time on a representation in which the notion of s...
31,984,699
I have a table with large amount of data and I need to get some information with only one query. Content of `PROCESSDATA` table: ``` PROCESSID | FIELDTIME | FIELDNAME | FIELDVALUE ------------------------------------------------------------------------- 125869 | 10/08/15 10:43:47,139000000 | ID...
2015/08/13
[ "https://Stackoverflow.com/questions/31984699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5061027/" ]
Use `MAX( ... ) KEEP ( DENSE_RANK FIRST ORDER BY ... )` to get the maximum of a column based on the maximum of another column: [SQL Fiddle](http://sqlfiddle.com/#!4/473c3f/1) **Oracle 11g R2 Schema Setup**: ``` CREATE TABLE PROCESSDATA ( PROCESSID, FIELDTIME, FIELDNAME, FIELDVALUE ) AS SELECT 125869, TO_T...
Try this ``` select t1.PROCESSID, t1.FIELDTIME,t1.FIELDNAME,t1.FIELDVALUE, t1.STATE,t1.IDREQUEST from PROCESSDATA as t1 inner join ( select PROCESSID, max(FIELDTIME) as FIELDTIME from PROCESSDATA where FIELDNAME IN ('IDREQUEST', 'state', 'MsgReq') group by PROCESSID ) as t2 on t1.PROCESSID=t2.PROCESSID and t1.FIELDTI...
31,984,699
I have a table with large amount of data and I need to get some information with only one query. Content of `PROCESSDATA` table: ``` PROCESSID | FIELDTIME | FIELDNAME | FIELDVALUE ------------------------------------------------------------------------- 125869 | 10/08/15 10:43:47,139000000 | ID...
2015/08/13
[ "https://Stackoverflow.com/questions/31984699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5061027/" ]
Use `MAX( ... ) KEEP ( DENSE_RANK FIRST ORDER BY ... )` to get the maximum of a column based on the maximum of another column: [SQL Fiddle](http://sqlfiddle.com/#!4/473c3f/1) **Oracle 11g R2 Schema Setup**: ``` CREATE TABLE PROCESSDATA ( PROCESSID, FIELDTIME, FIELDNAME, FIELDVALUE ) AS SELECT 125869, TO_T...
Here I wrote you a very fast and efficient query that gets the last 7 days of processdata. and it also handles if two records have the exact same milliseconds, it will grab just 1. ``` SELECT PD.PROCESSID, (SELECT MAX(PD1.FIELDVALUE) FROM PROCESSDATA PD1 WHERE PD.PROCESSID = PD1.PROCESSID AND PD1.FIELDNAME = 'IDRE...
15,728
When I budget for me, I usually count savings part of the expenses. **Is it the correct way to do it?** Because of this, when I look at my budget at the end of the month, it feels like my expenses are a bit high.
2012/06/25
[ "https://money.stackexchange.com/questions/15728", "https://money.stackexchange.com", "https://money.stackexchange.com/users/4904/" ]
I have found it useful to have four (yes, four) categories in a budget, rather than the traditional two (income and expenses). This may not be the "correct" way to do it, but it makes sense to me. First, **income**. This one is a no-brainer and is needed in any budget. In this scheme income also includes money taken o...
Savings isn't really an expense but I understand what your trying to say, you are allocating a specific amount to save. Which is definitely a good idea. If you're going over the budget then you have to decide what to cut down on. You can sacrifice some luxuries or if you feel comfortable enough you can cut back on how ...
15,728
When I budget for me, I usually count savings part of the expenses. **Is it the correct way to do it?** Because of this, when I look at my budget at the end of the month, it feels like my expenses are a bit high.
2012/06/25
[ "https://money.stackexchange.com/questions/15728", "https://money.stackexchange.com", "https://money.stackexchange.com/users/4904/" ]
It's a matter of semantics. If a budget is done to include every last item, by definition there would be no extra. I save about 20% of my income, but if that's in my budget, the budget is a 100% view of my gross income, a pie chart (or table) of all cash flow. Some people prefer to think of their budget as the spen...
Savings isn't really an expense but I understand what your trying to say, you are allocating a specific amount to save. Which is definitely a good idea. If you're going over the budget then you have to decide what to cut down on. You can sacrifice some luxuries or if you feel comfortable enough you can cut back on how ...
15,728
When I budget for me, I usually count savings part of the expenses. **Is it the correct way to do it?** Because of this, when I look at my budget at the end of the month, it feels like my expenses are a bit high.
2012/06/25
[ "https://money.stackexchange.com/questions/15728", "https://money.stackexchange.com", "https://money.stackexchange.com/users/4904/" ]
I have found it useful to have four (yes, four) categories in a budget, rather than the traditional two (income and expenses). This may not be the "correct" way to do it, but it makes sense to me. First, **income**. This one is a no-brainer and is needed in any budget. In this scheme income also includes money taken o...
It's a matter of semantics. If a budget is done to include every last item, by definition there would be no extra. I save about 20% of my income, but if that's in my budget, the budget is a 100% view of my gross income, a pie chart (or table) of all cash flow. Some people prefer to think of their budget as the spen...
10,317,755
I am just curious to know if at all there is any technical/theoretical reasons for a windows NT service to be more stable that created with c++ rather than .Net application or vice versa. Actually I had two Nt Services one made with cpp and other with .Net application. I observe both as showing in start mode but I ne...
2012/04/25
[ "https://Stackoverflow.com/questions/10317755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/319048/" ]
You would probably gain some performance with C++ (if it is native) than with .NET, but this would be only during the startup. Once they are both up and running, there shouldn't be much of a difference. However, creating a service through native C++ (as far as I can remembe now) was really pain and it took quite a bit...
The C++ Service, or any win32 executable, will continue to work across multiple versions of windows, both future and past. This gives win32 longevity and near immunity to changes in the server. Your C++ service will likely not have very many, or none at all, dependencies on anything installed on the server. This reduce...
13,218,191
I have Tried number of available examples which helps to load contacts from phone. It works fine on emulator but when i try on real time mobile then it crashes. Can any one send me tested piece of code which is working flawless. then i can compare with my code. one failed code example. ``` Cursor phones = getContent...
2012/11/04
[ "https://Stackoverflow.com/questions/13218191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1642500/" ]
This is me playing around with this data structure and some template tomfoolery. At the bottom of all of this mess is accessing two flat arrays, one of them containing a tree of sums, the other containing a tree of carry values to propogate down later. Conceptually they form one binary tree. The true value of a node ...
Lazy propagation means updating only when required. Its a technique that allows range updates to be carried out with asymptotic time complexity O(logN) (N here is the range). Say you want to update the range [0,15] then you update the nodes [0,15] and set a flag in the node that says that it's children nodes are to be...
8,431,133
I have an existing `SqlConnection conn;` in some controller (using `ASP.NET MVC3 + Razor`). Now, I would like to render a simple table depending on some SQL command. **The question is:** How to "bind" loaded data in Razor using `ViewBag`? Is it necessary to iterate row-after-row and produce `<tr>....</tr>` in Razor?
2011/12/08
[ "https://Stackoverflow.com/questions/8431133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/684534/" ]
There is no binding like this. And a simple for loop means it isnt much code either, example... ``` <table> @foreach(var row in Model.MyRows) { <tr> @foreach(var col in row.Columns) { <td>@(col.Value)</td> } </tr> } </table> ``` hope that gives you an idea anyway, and this way you ge...
I'd suggest you to use strongly typed views and pass a populated model to your view and as you mentioned, iterate items of the ViewModel. Binding doesn't really have a place in MVC.
57,446,980
I am trying to write a recursive function which returns a copy of a list where neighbouring elements have been swapped. For example, swapElements([2, 3, 4, 9]) would return [3, 2, 9, 4]. This is my code as of now: ``` def swapElements(mylist): if len(mylist) == 1: pass if len(mylist) == 2: m...
2019/08/11
[ "https://Stackoverflow.com/questions/57446980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
> > Comparing two slices for missing element > > > I have two slices: `a []string`, `b []string`. `b` contains all the same > elements as `a` plus an extra. > > > For example, ``` package main import ( "fmt" ) func missing(a, b []string) string { ma := make(map[string]bool, len(a)) for _, ka := ra...
``` /* An example of how to find the difference between two slices. This example uses empty struct (0 bytes) for map values. */ package main import ( "fmt" ) // empty struct (0 bytes) type void struct{} // missing compares two slices and returns slice of differences func missing(a, b []string) []string { //...
7,173,238
I having the page in that i have the gridview and page index changing also for every record i have a check box.on top of the page i have the imagebutton in that when i click that button i am redirecting it into another page in that page i have a back button which redirects to present page with checkbox and gridview....
2011/08/24
[ "https://Stackoverflow.com/questions/7173238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/422570/" ]
I will answer my own question and give credit to Quentin, who commented on the question but did not write an answer (if you post the answer, I will select you as the correct answer). There is an HTML version: ``` <div class="g-plusone" data-size="medium"></div> ```
Well, the only solution you have is to change the taglib which you are using. If you are using a taglib, the only thing you must do is add a static attribute named namespace with the name you want, like the following example: ``` static namespace = google1 ```
7,173,238
I having the page in that i have the gridview and page index changing also for every record i have a check box.on top of the page i have the imagebutton in that when i click that button i am redirecting it into another page in that page i have a back button which redirects to present page with checkbox and gridview....
2011/08/24
[ "https://Stackoverflow.com/questions/7173238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/422570/" ]
Or you may output it like this in your gsp file: ``` ${'<g:plusone annotation="inline" href="http://www.anythinggoeshere_xyz.com"></g:plusone>'} ```
Well, the only solution you have is to change the taglib which you are using. If you are using a taglib, the only thing you must do is add a static attribute named namespace with the name you want, like the following example: ``` static namespace = google1 ```
7,173,238
I having the page in that i have the gridview and page index changing also for every record i have a check box.on top of the page i have the imagebutton in that when i click that button i am redirecting it into another page in that page i have a back button which redirects to present page with checkbox and gridview....
2011/08/24
[ "https://Stackoverflow.com/questions/7173238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/422570/" ]
I will answer my own question and give credit to Quentin, who commented on the question but did not write an answer (if you post the answer, I will select you as the correct answer). There is an HTML version: ``` <div class="g-plusone" data-size="medium"></div> ```
Or you may output it like this in your gsp file: ``` ${'<g:plusone annotation="inline" href="http://www.anythinggoeshere_xyz.com"></g:plusone>'} ```
7,173,238
I having the page in that i have the gridview and page index changing also for every record i have a check box.on top of the page i have the imagebutton in that when i click that button i am redirecting it into another page in that page i have a back button which redirects to present page with checkbox and gridview....
2011/08/24
[ "https://Stackoverflow.com/questions/7173238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/422570/" ]
I will answer my own question and give credit to Quentin, who commented on the question but did not write an answer (if you post the answer, I will select you as the correct answer). There is an HTML version: ``` <div class="g-plusone" data-size="medium"></div> ```
building on the [taglib solution by James Williams](http://jameswilliams.be/blog/entry/215), I was able to render a +1 button with this taglib, which I named GooglePlusOneTagLib.grooovy in my taglib folder: ``` class GooglePlusOneTagLib { def plusone = { attrs, body -> out << "<g:plusone "+(attrs.size ? "...
7,173,238
I having the page in that i have the gridview and page index changing also for every record i have a check box.on top of the page i have the imagebutton in that when i click that button i am redirecting it into another page in that page i have a back button which redirects to present page with checkbox and gridview....
2011/08/24
[ "https://Stackoverflow.com/questions/7173238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/422570/" ]
Or you may output it like this in your gsp file: ``` ${'<g:plusone annotation="inline" href="http://www.anythinggoeshere_xyz.com"></g:plusone>'} ```
building on the [taglib solution by James Williams](http://jameswilliams.be/blog/entry/215), I was able to render a +1 button with this taglib, which I named GooglePlusOneTagLib.grooovy in my taglib folder: ``` class GooglePlusOneTagLib { def plusone = { attrs, body -> out << "<g:plusone "+(attrs.size ? "...
8,765,798
ok, my file have this structure. ``` <system.serviceModel> <services> <service name="ManyaWCF.ServiceManya" behaviorConfiguration="ServiceBehaviour"> <!-- Service Endpoints --> <!-- Unless fully qualified, address is relative to base address supplied above --> <endpoint ...
2012/01/06
[ "https://Stackoverflow.com/questions/8765798", "https://Stackoverflow.com", "https://Stackoverflow.com/users/965856/" ]
As far as I know, you only need the endpoint with the `mexHttpBinding` if you want to expose the WSDL to clients. Visual Studio (or wcfutil.exe) needs the WSDL description to create the webservice client classes. After these webservice client classes are created, you shouldn't need to expose the WSDL anymore. **UPDA...
``` <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> <httpRuntime maxRequestLength="1048576" executionTimeout="3600" /> </system.web> <appSettings> </appSettings> <connectionStrings> <add name="SQLConnect" connectionString="Y...
38,591,400
I am a Java developer (I often used Spring MVC to develop MVC web app in Java) with a very litle knowledge of PHP and I have to work on a PHP project that use **CodeIgniter 2.1.3**. So I have some doubts about how controller works in **CodeIgniter**. 1) In Spring MVC I have a controller class with some annoted method...
2016/07/26
[ "https://Stackoverflow.com/questions/38591400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1833945/" ]
The `GC.KeepAlive` method is [empty](http://referencesource.microsoft.com/#mscorlib/system/gc.cs,279). All it does is ensure that a particular variable is read from at that point in the code, because otherwise that variable is never read from again and is thus not a valid reference to keep an object alive. It's pointl...
It is pretty easy to test, here is a quick test program, be sure it is run in release mode without a debugger attached. ``` using System; namespace SandboxConsole { class Program { static void Main(string[] args) { using (var context = new TestClass()) { ...
28,115,526
I'm completely useless regarding databases, but currently I'm having to work with it. I need to make a query that compares date values between to different entries of my table. I have a query like this: ``` SELECT t1.serial_number, t1.fault_type, t2.fault_type FROM shipped_products t1 JOIN shipped_products t...
2015/01/23
[ "https://Stackoverflow.com/questions/28115526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1044735/" ]
Every record is going to match itself (in t1 and t2) in this join since the DateDiff will be the same and thus less than 90. Make sure you are not matching to the same record. If you have an ID field in your table you could do this: ``` SELECT t1.serial_number, t1.fault_type, t2.fault_type FROM shipped_products t1 ...
It is unclear to me why you would want duplicates in the results. If you have two rows that meet the condition, then both will be in the result set. Why not just look at records that come later? If you phrase the query like this: ``` SELECT t1.serial_number, t1.fault_type, t2.fault_type FROM shipped_products t1 JOIN...
34,041,384
I created a setup by Advanced Installer software for my program that I've written by c#. I installed my program on VMWare Windows7. When I try to run it this message is displayed: ![Class not registered](https://i.stack.imgur.com/efAyh.png)
2015/12/02
[ "https://Stackoverflow.com/questions/34041384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5394345/" ]
What if `monthNumber` is not between 1 and 12? In that case, `monthString` won't be initialized. You should give it some default value when you declare it : ``` String monthString = null; // or "" ```
monthString is a local variable within main(), therefore, it must be initialized to prevent the compiler error. If monthString were a Class variable then it does not have to be initialized explicitly. You can do this by moving monthString outside of main() and declare it as: static String monthString;
34,041,384
I created a setup by Advanced Installer software for my program that I've written by c#. I installed my program on VMWare Windows7. When I try to run it this message is displayed: ![Class not registered](https://i.stack.imgur.com/efAyh.png)
2015/12/02
[ "https://Stackoverflow.com/questions/34041384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5394345/" ]
It would be a good idea to add a default case to your switch statement. Example: ``` switch (monthNumber) { case 1: monthString = "January"; break; //other cases... default: monthString = "Invalid Month Number"; break; } ``` This way if `monthNumber` is not 1-12 then there is still a d...
May be this link will help to get proper understanding. ``` http://stackoverflow.com/questions/5478996/should-java-string-method-local-variables-be-initialized-to-null-or ```
34,041,384
I created a setup by Advanced Installer software for my program that I've written by c#. I installed my program on VMWare Windows7. When I try to run it this message is displayed: ![Class not registered](https://i.stack.imgur.com/efAyh.png)
2015/12/02
[ "https://Stackoverflow.com/questions/34041384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5394345/" ]
It would be a good idea to add a default case to your switch statement. Example: ``` switch (monthNumber) { case 1: monthString = "January"; break; //other cases... default: monthString = "Invalid Month Number"; break; } ``` This way if `monthNumber` is not 1-12 then there is still a d...
monthString is a local variable within main(), therefore, it must be initialized to prevent the compiler error. If monthString were a Class variable then it does not have to be initialized explicitly. You can do this by moving monthString outside of main() and declare it as: static String monthString;