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 |
|---|---|---|---|---|---|
135,152 | So it has been well documented that GUI applications (like gedit or textedit) should [NOT](https://askubuntu.com/questions/270006/why-user-should-never-use-normal-sudo-to-start-graphical-application) be run with sudo. Ubuntu et al get gksu and gksudo (and the like) so question: what do WE (Mac users) get? Given that th... | 2014/06/16 | [
"https://apple.stackexchange.com/questions/135152",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/81404/"
] | To edit `/etc/hosts` with Sublime Text:
`sudo /Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text /etc/hosts`
If you have to do this on the regular basis, you can add this snippet to your ~/.bash\_profile
```
# sudoapp: Runs .app with root privileges
# Usage: sudoapp /Applications/Name.app /etc/hosts
... | There are good reasons NOT to edit files as root. Why not just copy them to a temporary file, edit this and copy back.
You could use `visudo` although this requires some knowledge of `vi`, but is OK for making simple changes to `/etc/fstab` or similar.
You could try setting the EDITOR environment variable and running... |
135,152 | So it has been well documented that GUI applications (like gedit or textedit) should [NOT](https://askubuntu.com/questions/270006/why-user-should-never-use-normal-sudo-to-start-graphical-application) be run with sudo. Ubuntu et al get gksu and gksudo (and the like) so question: what do WE (Mac users) get? Given that th... | 2014/06/16 | [
"https://apple.stackexchange.com/questions/135152",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/81404/"
] | While is it possible to launch a graphical application as the root user, it is not recommended. It may work, most of the time, but avoid relying on this behaviour.
Avoid root
==========
Running an application as root is not recommended because it dramatically increases the risk of causing problems with your Mac. The ... | There are good reasons NOT to edit files as root. Why not just copy them to a temporary file, edit this and copy back.
You could use `visudo` although this requires some knowledge of `vi`, but is OK for making simple changes to `/etc/fstab` or similar.
You could try setting the EDITOR environment variable and running... |
135,152 | So it has been well documented that GUI applications (like gedit or textedit) should [NOT](https://askubuntu.com/questions/270006/why-user-should-never-use-normal-sudo-to-start-graphical-application) be run with sudo. Ubuntu et al get gksu and gksudo (and the like) so question: what do WE (Mac users) get? Given that th... | 2014/06/16 | [
"https://apple.stackexchange.com/questions/135152",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/81404/"
] | There are good reasons NOT to edit files as root. Why not just copy them to a temporary file, edit this and copy back.
You could use `visudo` although this requires some knowledge of `vi`, but is OK for making simple changes to `/etc/fstab` or similar.
You could try setting the EDITOR environment variable and running... | Sergei's answer didn't work for me on OS X 10.8.5
`$ sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts`
I got a permissions error message

Since `sudo`ing the binary first, then double-clicking the file in Finder worked, I came up with the following les... |
135,152 | So it has been well documented that GUI applications (like gedit or textedit) should [NOT](https://askubuntu.com/questions/270006/why-user-should-never-use-normal-sudo-to-start-graphical-application) be run with sudo. Ubuntu et al get gksu and gksudo (and the like) so question: what do WE (Mac users) get? Given that th... | 2014/06/16 | [
"https://apple.stackexchange.com/questions/135152",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/81404/"
] | To edit `/etc/hosts` with Sublime Text:
`sudo /Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text /etc/hosts`
If you have to do this on the regular basis, you can add this snippet to your ~/.bash\_profile
```
# sudoapp: Runs .app with root privileges
# Usage: sudoapp /Applications/Name.app /etc/hosts
... | While is it possible to launch a graphical application as the root user, it is not recommended. It may work, most of the time, but avoid relying on this behaviour.
Avoid root
==========
Running an application as root is not recommended because it dramatically increases the risk of causing problems with your Mac. The ... |
135,152 | So it has been well documented that GUI applications (like gedit or textedit) should [NOT](https://askubuntu.com/questions/270006/why-user-should-never-use-normal-sudo-to-start-graphical-application) be run with sudo. Ubuntu et al get gksu and gksudo (and the like) so question: what do WE (Mac users) get? Given that th... | 2014/06/16 | [
"https://apple.stackexchange.com/questions/135152",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/81404/"
] | To edit `/etc/hosts` with Sublime Text:
`sudo /Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text /etc/hosts`
If you have to do this on the regular basis, you can add this snippet to your ~/.bash\_profile
```
# sudoapp: Runs .app with root privileges
# Usage: sudoapp /Applications/Name.app /etc/hosts
... | Sergei's answer didn't work for me on OS X 10.8.5
`$ sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts`
I got a permissions error message

Since `sudo`ing the binary first, then double-clicking the file in Finder worked, I came up with the following les... |
135,152 | So it has been well documented that GUI applications (like gedit or textedit) should [NOT](https://askubuntu.com/questions/270006/why-user-should-never-use-normal-sudo-to-start-graphical-application) be run with sudo. Ubuntu et al get gksu and gksudo (and the like) so question: what do WE (Mac users) get? Given that th... | 2014/06/16 | [
"https://apple.stackexchange.com/questions/135152",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/81404/"
] | While is it possible to launch a graphical application as the root user, it is not recommended. It may work, most of the time, but avoid relying on this behaviour.
Avoid root
==========
Running an application as root is not recommended because it dramatically increases the risk of causing problems with your Mac. The ... | Sergei's answer didn't work for me on OS X 10.8.5
`$ sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts`
I got a permissions error message

Since `sudo`ing the binary first, then double-clicking the file in Finder worked, I came up with the following les... |
26,470,305 | I'm writing some test functions for a form I made. There are a couple of QMessageBox that are invoked(one through QMessageBox.question method and one through the QMessageBox.information method. While my custom widget is not shown on screen, these two actually show up on screen.
I tried dismissing them by looping throu... | 2014/10/20 | [
"https://Stackoverflow.com/questions/26470305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/868270/"
] | You can set up a timer to automatically accept the dialog. If the timeout is long, the dialog will still display for a while:
```
w = QtGui.QDialog(None)
t = QtCore.QTimer(None)
t.timeout.connect(w.accept)
t.start(1)
w.exec_()
```
For your specific case, if you don't want to touch the code being testes, you can have... | I decided to use the mock module instead. It seemed better since the other solution would actually draw on screen, which is not optimal for testing.
If you have the same problem and would like to mock a question QMessageBox you can something like this:
```
@patch.object(path.QMessageBox, "question", return_value=QtGu... |
26,470,305 | I'm writing some test functions for a form I made. There are a couple of QMessageBox that are invoked(one through QMessageBox.question method and one through the QMessageBox.information method. While my custom widget is not shown on screen, these two actually show up on screen.
I tried dismissing them by looping throu... | 2014/10/20 | [
"https://Stackoverflow.com/questions/26470305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/868270/"
] | You can set up a timer to automatically accept the dialog. If the timeout is long, the dialog will still display for a while:
```
w = QtGui.QDialog(None)
t = QtCore.QTimer(None)
t.timeout.connect(w.accept)
t.start(1)
w.exec_()
```
For your specific case, if you don't want to touch the code being testes, you can have... | I think it makes sense with Qt testing (including PySide/PyQt) to mock your GUI interaction and do dedicated GUI testing separately as necessary.
For mocking GUI interaction, I'd use the [mock](https://pypi.python.org/pypi/mock) library, as I myself do regularly. The drawback of this is that you have to depend on mock... |
9,775,150 | I have a TreeView control for which each node in it I want to share a ContextMenuStrip which has two ToolStripMenuItems ie:
```
this.BuildTree = new MyApp.MainForm.TreeView();
this.ItemMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.DeleteMenuItem = new System.Windows.Forms.ToolStripMenuIt... | 2012/03/19 | [
"https://Stackoverflow.com/questions/9775150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/176168/"
] | I suggest you to set:
`this.BuildTree.ContextMenuStrip = this.ItemMenuStrip;`
to make the menu automatically open on tree right-click.
Then subscribe [`ItemMenuStrip.Opening`](http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripdropdown.opening.aspx) event to change the visibility of items and the... | So figured out what was going wrong I was setting Visible on this.ItemMenuStrip rather than the this.BuildTree.ContextMenuStrip.
This seems rather strange to me as I would have thought BuildTree.ContextMenuStrip was just a direct reference to the ItemMenuStrip but apparently not. |
25,592,867 | I wanted to show a ProgressDialog when data need to be uploaded to the server.
I have checked this question [Best way to show a loading/progress indicator?](https://stackoverflow.com/questions/12841803/best-way-to-show-a-loading-spinner)
the best answer was
```
ProgressDialog progress = new ProgressDialog(this);
prog... | 2014/08/31 | [
"https://Stackoverflow.com/questions/25592867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1492229/"
] | The proper way of showing a `ProgressDialog` with a `AsyncTask` would be by displaying the dialog on the `onPreExecute()` method of the `AsyncTask` and hide it at `onPostExecute()` method of it:
```
private class SampleTask extends AsyncTask<Void, Integer, String> {
ProgressDialog progress = new ProgressDialog(... | A better idea would be to do this with AsyncTask class. You can take care of UI work in preExecute and postExecute methods and do your main work in doInBackground method. Nice and clean!
It seems that you already doing this. Move the dialog code to the asynctask class. You just need a reference to the context and you ... |
55,391,243 | I have created a module in which i am overwriting core functionality of product listing widget. I can achieve this using preference but i want to understand plugin method..
Below is my code for frontend/di.xml
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchema... | 2019/03/28 | [
"https://Stackoverflow.com/questions/55391243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4008990/"
] | You need to add semi-colon after insert method.
```
namespace App\Http\Controllers;
use DB;
class course_controller extends Controller {
public function show_details() {
$prospects = DB::table('prospect')->get();
foreach ($prospects as $prospect) {
DB::table('course_prospect')->inse... | You misplaced a semicolon, check here:
```
foreach ($prospects as $prospect) {
DB::table('course_prospect')->insert(['prospect_id' =>
$prospect->id, 'course_id' => $prospect->course_intrested])
}; <-- this one
```
Change it to:
```
foreach ($prospects as $prospect) {
DB::table('cour... |
55,391,243 | I have created a module in which i am overwriting core functionality of product listing widget. I can achieve this using preference but i want to understand plugin method..
Below is my code for frontend/di.xml
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchema... | 2019/03/28 | [
"https://Stackoverflow.com/questions/55391243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4008990/"
] | You need to add semi-colon after insert method.
```
namespace App\Http\Controllers;
use DB;
class course_controller extends Controller {
public function show_details() {
$prospects = DB::table('prospect')->get();
foreach ($prospects as $prospect) {
DB::table('course_prospect')->inse... | ```
public function show_details() {
$prospects = DB::table('prospect')->get();
foreach ($prospects as $prospect) {
DB::table('course_prospect')->insert(['prospect_id' =>
$prospect->id, 'course_id' => $prospect->course_intrested]); //Add semicolon here
}
}
``` |
55,391,243 | I have created a module in which i am overwriting core functionality of product listing widget. I can achieve this using preference but i want to understand plugin method..
Below is my code for frontend/di.xml
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchema... | 2019/03/28 | [
"https://Stackoverflow.com/questions/55391243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4008990/"
] | You need to add semi-colon after insert method.
```
namespace App\Http\Controllers;
use DB;
class course_controller extends Controller {
public function show_details() {
$prospects = DB::table('prospect')->get();
foreach ($prospects as $prospect) {
DB::table('course_prospect')->inse... | ```
foreach ($prospects as $prospect) {
DB::table('course_prospect')->insert(array('prospect_id' => $prospect->id, 'course_id' => $prospect->course_intrested));
}
``` |
55,391,243 | I have created a module in which i am overwriting core functionality of product listing widget. I can achieve this using preference but i want to understand plugin method..
Below is my code for frontend/di.xml
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchema... | 2019/03/28 | [
"https://Stackoverflow.com/questions/55391243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4008990/"
] | You need to add semi-colon after insert method.
```
namespace App\Http\Controllers;
use DB;
class course_controller extends Controller {
public function show_details() {
$prospects = DB::table('prospect')->get();
foreach ($prospects as $prospect) {
DB::table('course_prospect')->inse... | The semicolon(`;`) is missing in your `insert` Query:
```
foreach ($prospects as $prospect){
DB::table('course_prospect')->insert([
'prospect_id' => $prospect->id,
'course_id' => $prospect->course_intrested
]); //You missed the semicolon here
} //remove semicolon from here
```
The syntax for... |
55,391,243 | I have created a module in which i am overwriting core functionality of product listing widget. I can achieve this using preference but i want to understand plugin method..
Below is my code for frontend/di.xml
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchema... | 2019/03/28 | [
"https://Stackoverflow.com/questions/55391243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4008990/"
] | You need to add semi-colon after insert method.
```
namespace App\Http\Controllers;
use DB;
class course_controller extends Controller {
public function show_details() {
$prospects = DB::table('prospect')->get();
foreach ($prospects as $prospect) {
DB::table('course_prospect')->inse... | You've misplaced the `;` and that caused the issue
And also I'm recommending you to use the associated model instead of `DB` just like below
```
use App/Prospect;
use App/CourseProspect;
class course_controller extends Controller {
public function show_details() {
$prospects = Prospect::all();
... |
55,391,243 | I have created a module in which i am overwriting core functionality of product listing widget. I can achieve this using preference but i want to understand plugin method..
Below is my code for frontend/di.xml
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchema... | 2019/03/28 | [
"https://Stackoverflow.com/questions/55391243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4008990/"
] | ```
public function show_details() {
$prospects = DB::table('prospect')->get();
foreach ($prospects as $prospect) {
DB::table('course_prospect')->insert(['prospect_id' =>
$prospect->id, 'course_id' => $prospect->course_intrested]); //Add semicolon here
}
}
``` | You misplaced a semicolon, check here:
```
foreach ($prospects as $prospect) {
DB::table('course_prospect')->insert(['prospect_id' =>
$prospect->id, 'course_id' => $prospect->course_intrested])
}; <-- this one
```
Change it to:
```
foreach ($prospects as $prospect) {
DB::table('cour... |
55,391,243 | I have created a module in which i am overwriting core functionality of product listing widget. I can achieve this using preference but i want to understand plugin method..
Below is my code for frontend/di.xml
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchema... | 2019/03/28 | [
"https://Stackoverflow.com/questions/55391243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4008990/"
] | ```
public function show_details() {
$prospects = DB::table('prospect')->get();
foreach ($prospects as $prospect) {
DB::table('course_prospect')->insert(['prospect_id' =>
$prospect->id, 'course_id' => $prospect->course_intrested]); //Add semicolon here
}
}
``` | ```
foreach ($prospects as $prospect) {
DB::table('course_prospect')->insert(array('prospect_id' => $prospect->id, 'course_id' => $prospect->course_intrested));
}
``` |
55,391,243 | I have created a module in which i am overwriting core functionality of product listing widget. I can achieve this using preference but i want to understand plugin method..
Below is my code for frontend/di.xml
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchema... | 2019/03/28 | [
"https://Stackoverflow.com/questions/55391243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4008990/"
] | ```
public function show_details() {
$prospects = DB::table('prospect')->get();
foreach ($prospects as $prospect) {
DB::table('course_prospect')->insert(['prospect_id' =>
$prospect->id, 'course_id' => $prospect->course_intrested]); //Add semicolon here
}
}
``` | The semicolon(`;`) is missing in your `insert` Query:
```
foreach ($prospects as $prospect){
DB::table('course_prospect')->insert([
'prospect_id' => $prospect->id,
'course_id' => $prospect->course_intrested
]); //You missed the semicolon here
} //remove semicolon from here
```
The syntax for... |
55,391,243 | I have created a module in which i am overwriting core functionality of product listing widget. I can achieve this using preference but i want to understand plugin method..
Below is my code for frontend/di.xml
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchema... | 2019/03/28 | [
"https://Stackoverflow.com/questions/55391243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4008990/"
] | ```
public function show_details() {
$prospects = DB::table('prospect')->get();
foreach ($prospects as $prospect) {
DB::table('course_prospect')->insert(['prospect_id' =>
$prospect->id, 'course_id' => $prospect->course_intrested]); //Add semicolon here
}
}
``` | You've misplaced the `;` and that caused the issue
And also I'm recommending you to use the associated model instead of `DB` just like below
```
use App/Prospect;
use App/CourseProspect;
class course_controller extends Controller {
public function show_details() {
$prospects = Prospect::all();
... |
54,162,010 | Would the following two `np.dot` give the same result for a square array `x`?
```
import numpy as np
x = np.arange(4 * 4).reshape(4, 4)
np.dot(x, x.T, out=x) # method 1
x[:] = np.dot(x, x.T) # method 2
```
Thanks.
Why I ask:
`x += x.T` is not the same as `x += x.T.copy()`
I don't know how does the internal of ... | 2019/01/12 | [
"https://Stackoverflow.com/questions/54162010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8704463/"
] | Yes, they are the same, but performance wise I see interesting results for integer arrays:
```
import perfplot
def f1(x):
x = x.copy()
np.dot(x, x.T, out=x)
return x
def f2(x):
x = x.copy()
x[:] = np.dot(x, x.T)
return x
perfplot.show(
setup=lambda n: np.arange(n * n).reshape(n, n),
... | Yes, both methods produce identical arrays.
```
import numpy as np
def method_1():
x = np.arange(4 * 4).reshape(4, 4)
np.dot(x, x.T, out=x)
return x
def method_2():
x = np.arange(4 * 4).reshape(4, 4)
x[:] = np.dot(x, x.T)
return x
array_1 = method_1()
array_2 = method_2()
print(np.array_equ... |
54,162,010 | Would the following two `np.dot` give the same result for a square array `x`?
```
import numpy as np
x = np.arange(4 * 4).reshape(4, 4)
np.dot(x, x.T, out=x) # method 1
x[:] = np.dot(x, x.T) # method 2
```
Thanks.
Why I ask:
`x += x.T` is not the same as `x += x.T.copy()`
I don't know how does the internal of ... | 2019/01/12 | [
"https://Stackoverflow.com/questions/54162010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8704463/"
] | Yes, they are the same, but performance wise I see interesting results for integer arrays:
```
import perfplot
def f1(x):
x = x.copy()
np.dot(x, x.T, out=x)
return x
def f2(x):
x = x.copy()
x[:] = np.dot(x, x.T)
return x
perfplot.show(
setup=lambda n: np.arange(n * n).reshape(n, n),
... | I have an older version of numpy installed (1.11.0) where method #1 produces some weird output. I understand this is not the expected behavior, and was fixed in later versions; but just in case this happens to someone else:
```
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
>>> import n... |
188,383 | Just want to check. What is the limit of function $\frac{z}{\bar{z}-z}$ at $z=0$?
I got $\lim\_{\substack{z \to 0 \\ z \in \mathbb{R}}} \frac{z}{\overline{z}-z} =-\infty$
and $\lim\_{\substack{z \to 0 \\ z \in i\mathbb{R}}} \frac{z}{\overline{z}-z} =-\frac{1}{2}$, so $f$ is not defined at $z=0$?
Byt the way does thi... | 2012/08/29 | [
"https://math.stackexchange.com/questions/188383",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | To solve the equation
$$z\bar{z}+z+\bar{z}+iz-\overline{iz}=9+4i,$$
we can proceed much as you did. Let $z=a+ib$.
Then $z\bar{z}=(a+ib)(a-ib)=a^2+b^2$.
We have $iz=-b+ia$, so its conjugate is $-b-ia$. Our expression is therefore equal to
$$a^2+b^2+(a+ib)+(a-ib)+(-b+ia)-(-b-ia),$$
which simplifies to $a^2+b^2+2a+2ia$.... | Alternative approach: the real part of both hands must be equal: $$z\bar z + z+\bar z = 9.$$
The imaginary part of both hands must be equal: $$i(z+\bar z)=4i.$$
So $z$ and $\bar z$ are two numbers; their sum is $4$ and their product is $9-4=5$. So they satisfy
$$ z^2 - 4z + 5 = 0.$$
This you can solve. |
4,195,609 | I have an application that does some long calculations, and I would like to show a progress dialog while this is done. So far I have found that I could do this with threads/handlers, but didn't work, and then I found out about the `AsyncTask`.
In my application I use maps with markers on it, and I have implemented th... | 2010/11/16 | [
"https://Stackoverflow.com/questions/4195609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509666/"
] | Change your method to look like this:
```
String curloc = current.toString();
String itemdesc = item.mDescription;
ArrayList<String> passing = new ArrayList<String>();
passing.add(itemdesc);
passing.add(curloc);
new calc_stanica().execute(passing); //no need to pass in result list
```
And change your async task impl... | Why would you pass an ArrayList??
It should be possible to just call execute with the params directly:
```
String curloc = current.toString();
String itemdesc = item.mDescription;
new calc_stanica().execute(itemdesc, curloc)
```
That how varrargs work, right?
Making an ArrayList to pass the variable is double work. |
4,195,609 | I have an application that does some long calculations, and I would like to show a progress dialog while this is done. So far I have found that I could do this with threads/handlers, but didn't work, and then I found out about the `AsyncTask`.
In my application I use maps with markers on it, and I have implemented th... | 2010/11/16 | [
"https://Stackoverflow.com/questions/4195609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509666/"
] | Change your method to look like this:
```
String curloc = current.toString();
String itemdesc = item.mDescription;
ArrayList<String> passing = new ArrayList<String>();
passing.add(itemdesc);
passing.add(curloc);
new calc_stanica().execute(passing); //no need to pass in result list
```
And change your async task impl... | I sort of agree with leander on this one.
call:
```
new calc_stanica().execute(stringList.toArray(new String[stringList.size()]));
```
task:
```
public class calc_stanica extends AsyncTask<String, Void, ArrayList<String>> {
@Override
protected ArrayList<String> doInBackground(String... args) {
... |
4,195,609 | I have an application that does some long calculations, and I would like to show a progress dialog while this is done. So far I have found that I could do this with threads/handlers, but didn't work, and then I found out about the `AsyncTask`.
In my application I use maps with markers on it, and I have implemented th... | 2010/11/16 | [
"https://Stackoverflow.com/questions/4195609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509666/"
] | Change your method to look like this:
```
String curloc = current.toString();
String itemdesc = item.mDescription;
ArrayList<String> passing = new ArrayList<String>();
passing.add(itemdesc);
passing.add(curloc);
new calc_stanica().execute(passing); //no need to pass in result list
```
And change your async task impl... | I dont do it like this. I find it easier to overload the constructor of the asychtask class ..
public class calc\_stanica extends AsyncTask>
```
String String mWhateveryouwantToPass;
public calc_stanica( String whateveryouwantToPass)
{
this.String mWhateveryouwantToPass = String whateveryouwantToPass;
}
/*Now ... |
4,195,609 | I have an application that does some long calculations, and I would like to show a progress dialog while this is done. So far I have found that I could do this with threads/handlers, but didn't work, and then I found out about the `AsyncTask`.
In my application I use maps with markers on it, and I have implemented th... | 2010/11/16 | [
"https://Stackoverflow.com/questions/4195609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509666/"
] | Change your method to look like this:
```
String curloc = current.toString();
String itemdesc = item.mDescription;
ArrayList<String> passing = new ArrayList<String>();
passing.add(itemdesc);
passing.add(curloc);
new calc_stanica().execute(passing); //no need to pass in result list
```
And change your async task impl... | You can receive returning results like that:
`AsyncTask` class
```java
@Override
protected Boolean doInBackground(Void... params) {
if (host.isEmpty() || dbName.isEmpty() || user.isEmpty() || pass.isEmpty() || port.isEmpty()) {
try {
throw new SQLException("Database credentials missing");
... |
4,195,609 | I have an application that does some long calculations, and I would like to show a progress dialog while this is done. So far I have found that I could do this with threads/handlers, but didn't work, and then I found out about the `AsyncTask`.
In my application I use maps with markers on it, and I have implemented th... | 2010/11/16 | [
"https://Stackoverflow.com/questions/4195609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509666/"
] | Why would you pass an ArrayList??
It should be possible to just call execute with the params directly:
```
String curloc = current.toString();
String itemdesc = item.mDescription;
new calc_stanica().execute(itemdesc, curloc)
```
That how varrargs work, right?
Making an ArrayList to pass the variable is double work. | I sort of agree with leander on this one.
call:
```
new calc_stanica().execute(stringList.toArray(new String[stringList.size()]));
```
task:
```
public class calc_stanica extends AsyncTask<String, Void, ArrayList<String>> {
@Override
protected ArrayList<String> doInBackground(String... args) {
... |
4,195,609 | I have an application that does some long calculations, and I would like to show a progress dialog while this is done. So far I have found that I could do this with threads/handlers, but didn't work, and then I found out about the `AsyncTask`.
In my application I use maps with markers on it, and I have implemented th... | 2010/11/16 | [
"https://Stackoverflow.com/questions/4195609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509666/"
] | Why would you pass an ArrayList??
It should be possible to just call execute with the params directly:
```
String curloc = current.toString();
String itemdesc = item.mDescription;
new calc_stanica().execute(itemdesc, curloc)
```
That how varrargs work, right?
Making an ArrayList to pass the variable is double work. | I dont do it like this. I find it easier to overload the constructor of the asychtask class ..
public class calc\_stanica extends AsyncTask>
```
String String mWhateveryouwantToPass;
public calc_stanica( String whateveryouwantToPass)
{
this.String mWhateveryouwantToPass = String whateveryouwantToPass;
}
/*Now ... |
4,195,609 | I have an application that does some long calculations, and I would like to show a progress dialog while this is done. So far I have found that I could do this with threads/handlers, but didn't work, and then I found out about the `AsyncTask`.
In my application I use maps with markers on it, and I have implemented th... | 2010/11/16 | [
"https://Stackoverflow.com/questions/4195609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509666/"
] | Why would you pass an ArrayList??
It should be possible to just call execute with the params directly:
```
String curloc = current.toString();
String itemdesc = item.mDescription;
new calc_stanica().execute(itemdesc, curloc)
```
That how varrargs work, right?
Making an ArrayList to pass the variable is double work. | You can receive returning results like that:
`AsyncTask` class
```java
@Override
protected Boolean doInBackground(Void... params) {
if (host.isEmpty() || dbName.isEmpty() || user.isEmpty() || pass.isEmpty() || port.isEmpty()) {
try {
throw new SQLException("Database credentials missing");
... |
4,195,609 | I have an application that does some long calculations, and I would like to show a progress dialog while this is done. So far I have found that I could do this with threads/handlers, but didn't work, and then I found out about the `AsyncTask`.
In my application I use maps with markers on it, and I have implemented th... | 2010/11/16 | [
"https://Stackoverflow.com/questions/4195609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509666/"
] | I sort of agree with leander on this one.
call:
```
new calc_stanica().execute(stringList.toArray(new String[stringList.size()]));
```
task:
```
public class calc_stanica extends AsyncTask<String, Void, ArrayList<String>> {
@Override
protected ArrayList<String> doInBackground(String... args) {
... | I dont do it like this. I find it easier to overload the constructor of the asychtask class ..
public class calc\_stanica extends AsyncTask>
```
String String mWhateveryouwantToPass;
public calc_stanica( String whateveryouwantToPass)
{
this.String mWhateveryouwantToPass = String whateveryouwantToPass;
}
/*Now ... |
4,195,609 | I have an application that does some long calculations, and I would like to show a progress dialog while this is done. So far I have found that I could do this with threads/handlers, but didn't work, and then I found out about the `AsyncTask`.
In my application I use maps with markers on it, and I have implemented th... | 2010/11/16 | [
"https://Stackoverflow.com/questions/4195609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509666/"
] | I sort of agree with leander on this one.
call:
```
new calc_stanica().execute(stringList.toArray(new String[stringList.size()]));
```
task:
```
public class calc_stanica extends AsyncTask<String, Void, ArrayList<String>> {
@Override
protected ArrayList<String> doInBackground(String... args) {
... | You can receive returning results like that:
`AsyncTask` class
```java
@Override
protected Boolean doInBackground(Void... params) {
if (host.isEmpty() || dbName.isEmpty() || user.isEmpty() || pass.isEmpty() || port.isEmpty()) {
try {
throw new SQLException("Database credentials missing");
... |
4,195,609 | I have an application that does some long calculations, and I would like to show a progress dialog while this is done. So far I have found that I could do this with threads/handlers, but didn't work, and then I found out about the `AsyncTask`.
In my application I use maps with markers on it, and I have implemented th... | 2010/11/16 | [
"https://Stackoverflow.com/questions/4195609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509666/"
] | I dont do it like this. I find it easier to overload the constructor of the asychtask class ..
public class calc\_stanica extends AsyncTask>
```
String String mWhateveryouwantToPass;
public calc_stanica( String whateveryouwantToPass)
{
this.String mWhateveryouwantToPass = String whateveryouwantToPass;
}
/*Now ... | You can receive returning results like that:
`AsyncTask` class
```java
@Override
protected Boolean doInBackground(Void... params) {
if (host.isEmpty() || dbName.isEmpty() || user.isEmpty() || pass.isEmpty() || port.isEmpty()) {
try {
throw new SQLException("Database credentials missing");
... |
17,408,693 | I have just (for the first time) compiled and installed kamailio, following [this](http://www.kamailio.org/wiki/) guide. For configuration, I am following the documentation [here](http://www.kamailio.org/wiki/)
I am trying to test a new SIP user. I have created it with:
```
» kamctl add test testpasswd
```
The user... | 2013/07/01 | [
"https://Stackoverflow.com/questions/17408693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647991/"
] | The log message you pasted in the question is for debug purposes (hence DEBUG level) and it could be printed for first SIP requests that come with no credentioals (e.g., first REGISTER) -- in such case it is all ok. Those requests are challenged for authentication with 401 replies, then they are resent by phone with cr... | Kamailio is a proxy. It is not simple, so if you want something simple, try [Asterisk](http://www.asterisk.org/) instead. Kamailio configuration **requires** knowledge of SIP.
For this problem: you set the realm somewhere (in config file or in database) but are not using it for registration. Possible solutions would b... |
17,408,693 | I have just (for the first time) compiled and installed kamailio, following [this](http://www.kamailio.org/wiki/) guide. For configuration, I am following the documentation [here](http://www.kamailio.org/wiki/)
I am trying to test a new SIP user. I have created it with:
```
» kamctl add test testpasswd
```
The user... | 2013/07/01 | [
"https://Stackoverflow.com/questions/17408693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647991/"
] | I got the same issue. I that add the alias record in kamailio.cfg and it works well.
```
alias="tethys.wavilon.net"
``` | Kamailio is a proxy. It is not simple, so if you want something simple, try [Asterisk](http://www.asterisk.org/) instead. Kamailio configuration **requires** knowledge of SIP.
For this problem: you set the realm somewhere (in config file or in database) but are not using it for registration. Possible solutions would b... |
17,408,693 | I have just (for the first time) compiled and installed kamailio, following [this](http://www.kamailio.org/wiki/) guide. For configuration, I am following the documentation [here](http://www.kamailio.org/wiki/)
I am trying to test a new SIP user. I have created it with:
```
» kamctl add test testpasswd
```
The user... | 2013/07/01 | [
"https://Stackoverflow.com/questions/17408693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647991/"
] | The log message you pasted in the question is for debug purposes (hence DEBUG level) and it could be printed for first SIP requests that come with no credentioals (e.g., first REGISTER) -- in such case it is all ok. Those requests are challenged for authentication with 401 replies, then they are resent by phone with cr... | I got the same issue. I that add the alias record in kamailio.cfg and it works well.
```
alias="tethys.wavilon.net"
``` |
19,142,530 | I'm facing a problem right now.
We and our team are developing a new app with REST. The problem we are facing is we need sometimes get some kind of data and don't know how to create the URI.
for example.
If i need a list of products then api/products/ (GET) will do the trick.
A single product, api/products/1 (GET)
w... | 2013/10/02 | [
"https://Stackoverflow.com/questions/19142530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1738416/"
] | You can use "query parameters" for "filtering" in REST, it is a common approach. Keep in mind that REST is a "architectural style", i.e., a set of principles that leave some room for interpretation. In your case I would say you could create something like this:
* query all products in stock: `GET /api/products?instock... | Why not just modify your controller to take multiple parameters like id and inStock? For instance your URI could be something like `api/products?id=1&inStock=0` |
22,132,573 | I'm currently developing on a Bluetooth LE embedded project.
For discovering my BLE peripherals, I currently use some apps for Android 4.3 (e.g. Nordic [nRF Toolbox](http://www.nordicsemi.com/eng/Products/nRFready-Demo-APPS/nRF-Toolbox-for-Android-4.3) and [nRF Master Control Panel](http://www.nordicsemi.com/eng/Produ... | 2014/03/02 | [
"https://Stackoverflow.com/questions/22132573",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2880699/"
] | Linux currently does not have any GUI based BLE tools. The LightBlue referred to in [user1990's answer](https://stackoverflow.com/a/25177672/2880699) is actually an old outdated program that does not implement BLE.
Anything short of command-line BlueZ using gatttool, or hcitool to do what you want, you will not find.... | LightBlue is avaiable on linux and mac os X. [LightBlue](http://lightblue.sourceforge.net/) |
22,132,573 | I'm currently developing on a Bluetooth LE embedded project.
For discovering my BLE peripherals, I currently use some apps for Android 4.3 (e.g. Nordic [nRF Toolbox](http://www.nordicsemi.com/eng/Products/nRFready-Demo-APPS/nRF-Toolbox-for-Android-4.3) and [nRF Master Control Panel](http://www.nordicsemi.com/eng/Produ... | 2014/03/02 | [
"https://Stackoverflow.com/questions/22132573",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2880699/"
] | Linux currently does not have any GUI based BLE tools. The LightBlue referred to in [user1990's answer](https://stackoverflow.com/a/25177672/2880699) is actually an old outdated program that does not implement BLE.
Anything short of command-line BlueZ using gatttool, or hcitool to do what you want, you will not find.... | I realize this is an old thread, but maybe it can be helpful to someone anyway.
The company I work for has just released a prerelease version of a [new Bluetooth Smart tool](https://devzone.nordicsemi.com/blogs/765/new-bluetooth-smart-tool-from-nordic). It's available for Linux, OSX and Windows. Note that it requires ... |
13,219,734 | I have radiobuttons with data\_bind = "checked" binding. I need to call custom function to customize ui when one of the radiobuttons checked.
Html
Daily
Weekly
Monthly
```
<div data-bind="visible: FrequencyType() == 1">
Message 1
</div>
<div data-bind="visible: FrequencyType() == 2">
Message 2
</div>
<div ... | 2012/11/04 | [
"https://Stackoverflow.com/questions/13219734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/525278/"
] | You need to add a couple of [ProxyHTMLURLMap](http://httpd.apache.org/docs/2.4/mod/mod_proxy_html.html) directives to the above, to inspect and rewrite any hard coded URL's in the returned HTML e.g.
```
ProxyRequests Off
ProxyPass /external/ http://www.external.com/onlyforme
ProxyHTMLURLMap http://www.e... | [arober11](https://stackoverflow.com/users/1443513/arober11)'s answer greatly helped solving my similar issue. I tried to narrow it down to the shortest set of rules possible, and there is my own configuration to have an [Etherpad](http://etherpad.org) running at <https://my-domain-name.wtf/pad> :
```
<Location /pad>
... |
45,781,862 | I would like to do an operation on a 2-D matrix which somehow looks like the outer product of a vector. I already have written some codes for this task, but it is pretty slow, so I would like to know if there is anything I can do to accelerate it.
I would like to show the code I wrote first, followed by an example to ... | 2017/08/20 | [
"https://Stackoverflow.com/questions/45781862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8389552/"
] | With auto expansion:
```
function B = outer2D(A)
B=permute(permute(A,[3 1 2]).*A',[2 3 1]);
end
```
Without auto expansion:
```
function B = outer2Dold(A)
B=permute(bsxfun(@times,permute(A,[3 1 2]),A'),[2 3 1]);
end
``` | Outer products are not possible in the matlab language. |
3,842,833 | Often in programming, it is a very common requirement that some piece of functionality will require a lot of conditional logic, but not quite enough to warrant a rules engine.
For example, testing a number is divisible by x but also a multiple of something, a factor of something else, a square root of something, etc. ... | 2010/10/01 | [
"https://Stackoverflow.com/questions/3842833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32484/"
] | I would suggest that trying to do this sort of thing in your head is asking for trouble, and trying to do it with a partner is going to make it much worse. Sometimes you have to sit and think and even make some notes on paper. If you don't like propositional logic, try [decision tables](http://en.wikipedia.org/wiki/Dec... | I would say you should use propositional logic.
Suggest that:
q = age is greater than 18
p = location is within 10 miles
r = driving points are less than 3
s = age is less than 18 when points are collected
you could say...
`(^ is AND)
if (q ^ p ^ r ^ s) {
//you are eligible or something!
} else {... |
3,842,833 | Often in programming, it is a very common requirement that some piece of functionality will require a lot of conditional logic, but not quite enough to warrant a rules engine.
For example, testing a number is divisible by x but also a multiple of something, a factor of something else, a square root of something, etc. ... | 2010/10/01 | [
"https://Stackoverflow.com/questions/3842833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32484/"
] | I would add simple, readable, short methods, such as:
```
IsMinor(..)
IsRecordClean(..)
```
And then use them in conjunction to create new methods with meaningful names, such as:
```
IsMeetingPreReqs(..) //which checks several "simple" conditions
IsValidForInsurance(..)
```
(Sorry for the examples, I'm s... | I would say you should use propositional logic.
Suggest that:
q = age is greater than 18
p = location is within 10 miles
r = driving points are less than 3
s = age is less than 18 when points are collected
you could say...
`(^ is AND)
if (q ^ p ^ r ^ s) {
//you are eligible or something!
} else {... |
3,842,833 | Often in programming, it is a very common requirement that some piece of functionality will require a lot of conditional logic, but not quite enough to warrant a rules engine.
For example, testing a number is divisible by x but also a multiple of something, a factor of something else, a square root of something, etc. ... | 2010/10/01 | [
"https://Stackoverflow.com/questions/3842833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32484/"
] | I would suggest that trying to do this sort of thing in your head is asking for trouble, and trying to do it with a partner is going to make it much worse. Sometimes you have to sit and think and even make some notes on paper. If you don't like propositional logic, try [decision tables](http://en.wikipedia.org/wiki/Dec... | I would add simple, readable, short methods, such as:
```
IsMinor(..)
IsRecordClean(..)
```
And then use them in conjunction to create new methods with meaningful names, such as:
```
IsMeetingPreReqs(..) //which checks several "simple" conditions
IsValidForInsurance(..)
```
(Sorry for the examples, I'm s... |
3,609,362 | I know that Windows Sidebar Gadget API provides functionality beyond normal Javascript capabilities. Does it manipulate files? How?
I didn't find how to do it in the [API Reference](http://msdn.microsoft.com/en-us/library/aa965853(VS.85).aspx) | 2010/08/31 | [
"https://Stackoverflow.com/questions/3609362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48465/"
] | I don't think you can disable one element? If you disable it then why have it at all?
You can only disable the whole `<select>` input.
Suggest you write validation to not accept the first element.
Edit after OP's comment about being able to do this
Here is another answer
```
// Get the countries element (do this a... | Credit goes to jakenoble.
Just reformatted the code to use the formSelect-viewhelper instead of a form-element.
```
<?php
$countries = array(1 => 'Select Option', 2 => 'us', 3 =>'uk');
echo $this->formSelect('country', 2, array('disable' => array(1)), $countries)
```
This will result in:
```
<select name="count... |
3,609,362 | I know that Windows Sidebar Gadget API provides functionality beyond normal Javascript capabilities. Does it manipulate files? How?
I didn't find how to do it in the [API Reference](http://msdn.microsoft.com/en-us/library/aa965853(VS.85).aspx) | 2010/08/31 | [
"https://Stackoverflow.com/questions/3609362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48465/"
] | I don't think you can disable one element? If you disable it then why have it at all?
You can only disable the whole `<select>` input.
Suggest you write validation to not accept the first element.
Edit after OP's comment about being able to do this
Here is another answer
```
// Get the countries element (do this a... | There IS a way of doing it through Zend\_Form (at least on my current ve 1.11):
```
$this->addElement
(
"select","selectName",
array("multiOptions"=>array("one","two","three"), "disable"=>array(0,1))
);
```
That one will disable first two options. |
3,609,362 | I know that Windows Sidebar Gadget API provides functionality beyond normal Javascript capabilities. Does it manipulate files? How?
I didn't find how to do it in the [API Reference](http://msdn.microsoft.com/en-us/library/aa965853(VS.85).aspx) | 2010/08/31 | [
"https://Stackoverflow.com/questions/3609362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48465/"
] | There IS a way of doing it through Zend\_Form (at least on my current ve 1.11):
```
$this->addElement
(
"select","selectName",
array("multiOptions"=>array("one","two","three"), "disable"=>array(0,1))
);
```
That one will disable first two options. | Credit goes to jakenoble.
Just reformatted the code to use the formSelect-viewhelper instead of a form-element.
```
<?php
$countries = array(1 => 'Select Option', 2 => 'us', 3 =>'uk');
echo $this->formSelect('country', 2, array('disable' => array(1)), $countries)
```
This will result in:
```
<select name="count... |
26,308 | When I type `mail` command, I get a "No mail for USER" answer, but there's indeed mail (it's in `/home/USER/Maildir/new`)
I guess it has something to do with the mailbox being in Maildir format, instead of mbox, but I don't know how to tell mailutils (specifically the mail command) which format to use. | 2011/02/14 | [
"https://askubuntu.com/questions/26308",
"https://askubuntu.com",
"https://askubuntu.com/users/8851/"
] | Afaik "mail" utility checks mails at the location given with the MAIL environment variable. Try this command: `MAIL=/home/USER/Maildir/ mail` (for sure, replace USER with something meaningful & valid). If that works, it seems that you should set MAIL variable you can do it in your bash profile / rc file for example. Yo... | To fetch mail from users home directory, use mail with -f option
```
mail -f /home/USER/Maildir/
``` |
41,227,543 | I have installed Xcode in my machine in order to use it for desktop development (OS X/Cocoa/Command line tools). Whenever I create a new project, there are templates in the wizard for iOS, watchOS and tvOS development, but at this moment I have no interest in these SDKs.
Since Xcode.app is taking a lot of space in my ... | 2016/12/19 | [
"https://Stackoverflow.com/questions/41227543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2033517/"
] | I found out how to do this. I don't know at this moment if this can have any side-effect on other components for Xcode that could fail. In that case it may be possible to reinstall it from the Mac AppStore again.
Xcode packages the SDKs for these different products as Platforms. There is a Platform for macOS, a Platfo... | Above in incorrect. You will have to reinstall Xcode if you delete any of these folders. /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform I deleted above Xcode wanted me to reinstall.
Try to delete all folders besides "developer" inside platform folders.
Example, delete all beside this:
/Applica... |
44,429,163 | I am creating an web page in which have a `Dropdownlist`. I have to retrieve data for the drop\_down\_list from the database. Is there any way to get data from the database to the html view my html code:
`<select name="drop down"><option value="1">@test.list[i]</option></select>`
I got the database value to the list ... | 2017/06/08 | [
"https://Stackoverflow.com/questions/44429163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7689376/"
] | You need to create Select List of Items :
**Your Action with List of Items in View Bag :**
```
public ActionResult ActionName()
{
List<SelectListItem> Items = new List<SelectListItem>();
CustReportName.Add(new SelectListItem() { Text = "List1", Value = "1", Selected = false });
CustReportName.Add(new... | It is just a simple two step process:
Step1 :Action method code
```
public ActionResult Index()
{
ViewBag.users = db.users.ToList();
}
```
Step2: cshtml code
```
@Html.DropDownListFor(model => model.someId, new SelectList(ViewBag.users, "userId", "userName"), "Select users")
```
Note: with this, you can bind... |
22,991,518 | I would like to see a most concise way to do what is outlined in this SO question: [Sum values from multiple rows into one row](https://stackoverflow.com/questions/13940397/sum-values-from-multiple-rows-into-one-row?rq=1)
that is, combine multiple rows while summing a column.
But how to then delete the duplicates. In ... | 2014/04/10 | [
"https://Stackoverflow.com/questions/22991518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2788458/"
] | Not sure why not using Temp table but here's one way to avoid it (tho imho this is an overkill):
```
UPDATE MyTable SET VALUE = (SELECT SUM(Value) FROM MyTable MT WHERE MT.Person = MyTable.Person);
WITH DUP_TABLE AS
(SELECT ROW_NUMBER()
OVER (PARTITION BY Person ORDER BY Person) As ROW_NO
FROM MyTable)
DEL... | All you're asking for is a simple `SUM()` aggregate function and a `GROUP BY`
```
SELECT Person, SUM(Value)
FROM myTable
GROUP BY Person
```
The `SUM()` by itself would sum up the values in a column, but when you add a secondary column and `GROUP BY` it, SQL will show distinct values from the secondary column and pe... |
25,081,679 | I have a search button where it search the report for the input date. But when I clicked the button The table shows empty even If I input correctly the start and end date.
PHP code
```
<?php
include('konek.php');
$start = isset($_GET['d1']) ? $_GET['d1'] : '';
$end = isset($_GET['d2']) ? $_GET['d2'] : '';
if (isset... | 2014/08/01 | [
"https://Stackoverflow.com/questions/25081679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3896397/"
] | First of all, I'd revisit the idea of storing any dates or times as strings.. it leads to exactly this kind of problem.
MySQL actually treats dates as strings anyway, with added date functionality.. and stores them in the more sensible format of %Y-%m-%d, which produces the correct ordering.
If you absolutely cannot ... | The function `date_format()` formats a date and outputs a string. You want `str_to_date()`:
```
ORDER BY STR_TO_DATE(date, '%d/%m/%Y')
``` |
8,670,295 | I have a table with an integer column ranging from 1 to 32 (this column identify the type of record stored).
The types 5 and 12 represents 70% of the total number of rows, and this number is greater than 1M rows, so it seems to makes sense to partition the table.
Question is: how can I create a set of 3 partitions, o... | 2011/12/29 | [
"https://Stackoverflow.com/questions/8670295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1121513/"
] | <http://dev.mysql.com/doc/refman/5.1/en/partitioning-list.html>
```
create table some_table (
id INT NOT NULL,
some_id INT NOT NULL
)
PARTITION BY LIST(some_id) (
PARTITION fives VALUES IN (5),
PARTITION twelves VALUES IN (12),
PARTITION rest VALUES IN (1,2,3,4,6,7,8,9,10,11,13,14,15,16,17,18,19,20... | Use [Partition by list](http://dev.mysql.com/doc/refman/5.1/en/partitioning-list.html) |
8,670,295 | I have a table with an integer column ranging from 1 to 32 (this column identify the type of record stored).
The types 5 and 12 represents 70% of the total number of rows, and this number is greater than 1M rows, so it seems to makes sense to partition the table.
Question is: how can I create a set of 3 partitions, o... | 2011/12/29 | [
"https://Stackoverflow.com/questions/8670295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1121513/"
] | <http://dev.mysql.com/doc/refman/5.1/en/partitioning-list.html>
```
create table some_table (
id INT NOT NULL,
some_id INT NOT NULL
)
PARTITION BY LIST(some_id) (
PARTITION fives VALUES IN (5),
PARTITION twelves VALUES IN (12),
PARTITION rest VALUES IN (1,2,3,4,6,7,8,9,10,11,13,14,15,16,17,18,19,20... | Provided that `type` is an index, then MySQL has already logically partitioned the table for you. Unless you really need physical partitioning, it seems to me you are only making trouble for yourself. |
2,665,543 | Solve $$1001y''' + 3.2y'' + \pi y' - \sqrt{4}y = 0$$
Initial Conditions:
$$y(0) = 0, y'(0) = 0, y''(0) = 0$$
I plugged it into the characteristic equation, but I don't know where to go from there...
$$1001r^3 + 3.2r^2 + \pi r - 2 = 0$$
Some help would be appreciated, thanks. | 2018/02/25 | [
"https://math.stackexchange.com/questions/2665543",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/416804/"
] | I think the point of this problem is that, by the uniqueness theorem, there is only one solution, and from the initial conditions, it is clear that $y(t)=0$ is that solution. I don't think you were supposed to mess with the characteristic equation at all. | Case 1: Assuming the last square root applies only to 4 (thus the question becomes trivial). WolframAlpha provides the solution:
$$
y(x) = c\_3 e^{0.426569 x} + c\_1 e^{-1.81328 x} sin(1.18346 x) + c\_2 e^{-1.81328 x} cos(1.18346 x)
$$
Which comes from the characteristic equation you gave. You would have to find the ... |
19,638,090 | Why is this not working for me? I keep getting the error:
```
java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
```
My code:
```
private void speler_deleteActionPerformed(java.awt.event.ActionEvent evt) {
int row = tbl_spelers.getSelectedRow();
int SpelerID = (int) tbl_s... | 2013/10/28 | [
"https://Stackoverflow.com/questions/19638090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2854129/"
] | You have to use [`excuteUpdate()`](http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#executeUpdate%28java.lang.String%29) for **delete**.
Docs of [`excuteUpdate()`](http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#executeUpdate%28java.lang.String%29)
>
> Executes the given SQL stateme... | executeQuery() method of jdbc is to select records, you can use executeUpdate() for update operations. Please refer to [the documentation](http://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html) for the purpose/ intent of each method:
>
>
> ```
> boolean execute()
>
> ```
>
> Executes the SQL sta... |
19,638,090 | Why is this not working for me? I keep getting the error:
```
java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
```
My code:
```
private void speler_deleteActionPerformed(java.awt.event.ActionEvent evt) {
int row = tbl_spelers.getSelectedRow();
int SpelerID = (int) tbl_s... | 2013/10/28 | [
"https://Stackoverflow.com/questions/19638090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2854129/"
] | You have to use [`excuteUpdate()`](http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#executeUpdate%28java.lang.String%29) for **delete**.
Docs of [`excuteUpdate()`](http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#executeUpdate%28java.lang.String%29)
>
> Executes the given SQL stateme... | Firstly, you need to use `excuteUpdate()` for the delete, and next
```
String deleteQry = "DELETE FROM `Speler` WHERE SpelerID = " + SpelerID + ";";
```
remove the `semi-colon` and the "`" which encloses the table name "Speler", from the query. |
19,638,090 | Why is this not working for me? I keep getting the error:
```
java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
```
My code:
```
private void speler_deleteActionPerformed(java.awt.event.ActionEvent evt) {
int row = tbl_spelers.getSelectedRow();
int SpelerID = (int) tbl_s... | 2013/10/28 | [
"https://Stackoverflow.com/questions/19638090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2854129/"
] | You have to use [`excuteUpdate()`](http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#executeUpdate%28java.lang.String%29) for **delete**.
Docs of [`excuteUpdate()`](http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#executeUpdate%28java.lang.String%29)
>
> Executes the given SQL stateme... | You need to execute you query using **`executeUpdate()`**
Also, you just need to make a slight adjustment to your String `deleteQry` as follows:
```
String deleteQry = "DELETE FROM Speler WHERE SpelerID = " + SpelerID;
```
Hope this helps... |
3,285,344 | >
> How does one calculate the following integral?
>
>
> $$
> \int\_0^1\frac{x\ln (1+x)}{1+x^2}dx
> $$
>
>
>
**CONTEXT**:
Our teacher asks us to calculate the integral
using *only* [changes of variables](https://en.wikipedia.org/wiki/Change_of_variables), [integrations by parts](https://en.wikipedia.org/wiki/Int... | 2019/07/06 | [
"https://math.stackexchange.com/questions/3285344",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/417942/"
] | For start we'll prove a result that it's going to be used later.
$$\boxed{\int\_0^1 \frac{\ln(1+x)}{x}dx=\frac12 \int\_0^1 \frac{\ln x}{x-1}dx}=\frac12\cdot \frac{\pi^2}{6}$$
*proof:*
$$\int\_0^1 \frac{\ln x}{x+1}dx+\int\_0^1 \frac{\ln x}{x-1}dx=\int\_0^1 \frac{2x\ln x}{x^2-1}dx\overset{x^2\to x}=\frac12 \int\_0^1 \fr... | Alternative solution:
\begin{align}
J&=\int\_0^1 \frac{x\ln(1+x)}{1+x^2}\,dx\\
A&=\int\_0^1 \frac{\ln(1+x^2)}{1+x}\,dx\\
&=\Big[\ln(1+x^2)\ln(1+x)\Big]\_0^1-2\int\_0^1 \frac{x\ln(1+x)}{1+x^2}\,dx\\
&=\ln^2 2-2J\\
J&=\frac{1}{2}\ln^2 2-\frac{1}{2}A\\
B&=\int\_0^1 \frac{\ln\left(\frac{1-x^2}{1+x^2}\right)}{1+x}\,dx\\
C&... |
68,882,552 | Hope you are doing well.
Database created in consumer account from share is read only, so consumer won't have any storage charges right.
I have one doubt here, let say consumer created a materialized views from that database and then does the consumer incur storage charges because materialized views stores result set... | 2021/08/22 | [
"https://Stackoverflow.com/questions/68882552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7171412/"
] | [Creating a Materialized View on Shared Data](https://docs.snowflake.com/en/user-guide/views-materialized.html#creating-a-materialized-view-on-shared-data)
>
> Note
>
>
> **Remember that maintaining materialized views will consume credits. When you create a materialized view on someone else’s shared table, the chan... | Materialized views will incur additional costs based on storage and compute resources. The updates to base table can consume significant resources, resulting in credit usage. This is also applicable on the shared database created from a share in a consumer account, as a Materialized view created has to be maintained.
... |
8,605,052 | I am developing an MVC3 application and have been wondering about the following. Should the Entity Framework object (`DbContext` object) be disposed before passing data to the view?
The obvious issue with this is you will not be able to drill down into the foreign key relations.
Is there a performance hit by doing th... | 2011/12/22 | [
"https://Stackoverflow.com/questions/8605052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/601245/"
] | Yes you absolutely should dispose of the context
The performance hit should be minimal . Any object that can be disposed of should be disposed of ALWAYS.
Dependency injection can free you from having to worry about calling it if done properly as the DI framework will dispose of it for you if instructed. | If, by "entityframe work object" you mean the DbContext object, then No, don't worry about it.
...also, this should be a Controller level object, not a View level one. |
8,605,052 | I am developing an MVC3 application and have been wondering about the following. Should the Entity Framework object (`DbContext` object) be disposed before passing data to the view?
The obvious issue with this is you will not be able to drill down into the foreign key relations.
Is there a performance hit by doing th... | 2011/12/22 | [
"https://Stackoverflow.com/questions/8605052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/601245/"
] | Don't pass EF entities into your view, use the view model pattern. And don't rely too much on lazy loading, it will perform poorly. Use the Include method to eagerly load the objects you need.
And yes, you need dispose (or preferably using), otherwise your system will leak connections and probably starve the pool unde... | If, by "entityframe work object" you mean the DbContext object, then No, don't worry about it.
...also, this should be a Controller level object, not a View level one. |
8,605,052 | I am developing an MVC3 application and have been wondering about the following. Should the Entity Framework object (`DbContext` object) be disposed before passing data to the view?
The obvious issue with this is you will not be able to drill down into the foreign key relations.
Is there a performance hit by doing th... | 2011/12/22 | [
"https://Stackoverflow.com/questions/8605052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/601245/"
] | Agree with the answer of Adam Tuliper. With the addition, that if you need to access the related objects you could use the .Include(o => o.EntityName) method to make sure the data is included in the data retrieval.
This blog is writing about loading related objects:
<http://blogs.msdn.com/b/adonet/archive/2011/01/31/u... | If, by "entityframe work object" you mean the DbContext object, then No, don't worry about it.
...also, this should be a Controller level object, not a View level one. |
8,605,052 | I am developing an MVC3 application and have been wondering about the following. Should the Entity Framework object (`DbContext` object) be disposed before passing data to the view?
The obvious issue with this is you will not be able to drill down into the foreign key relations.
Is there a performance hit by doing th... | 2011/12/22 | [
"https://Stackoverflow.com/questions/8605052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/601245/"
] | Yes you absolutely should dispose of the context
The performance hit should be minimal . Any object that can be disposed of should be disposed of ALWAYS.
Dependency injection can free you from having to worry about calling it if done properly as the DI framework will dispose of it for you if instructed. | Don't pass EF entities into your view, use the view model pattern. And don't rely too much on lazy loading, it will perform poorly. Use the Include method to eagerly load the objects you need.
And yes, you need dispose (or preferably using), otherwise your system will leak connections and probably starve the pool unde... |
8,605,052 | I am developing an MVC3 application and have been wondering about the following. Should the Entity Framework object (`DbContext` object) be disposed before passing data to the view?
The obvious issue with this is you will not be able to drill down into the foreign key relations.
Is there a performance hit by doing th... | 2011/12/22 | [
"https://Stackoverflow.com/questions/8605052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/601245/"
] | Yes you absolutely should dispose of the context
The performance hit should be minimal . Any object that can be disposed of should be disposed of ALWAYS.
Dependency injection can free you from having to worry about calling it if done properly as the DI framework will dispose of it for you if instructed. | Agree with the answer of Adam Tuliper. With the addition, that if you need to access the related objects you could use the .Include(o => o.EntityName) method to make sure the data is included in the data retrieval.
This blog is writing about loading related objects:
<http://blogs.msdn.com/b/adonet/archive/2011/01/31/u... |
56,150,853 | Given a matrix `mat` and an array `arr`, for each row of the matrix if elements of Column 1 are equal to the corresponding element of the array, then print the corresponding value of Column 2 of the matrix.
```
mat = np.array([['abc','A'],['def','B'],['ghi','C'],['jkl','D']])
arr = np.array(['abc','dfe','ghi','kjl'])
... | 2019/05/15 | [
"https://Stackoverflow.com/questions/56150853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11503893/"
] | This can be solved via [numpy.where](https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html).
Extract the first row of the matrix using `mat[:,0]`, and compare it to `arr` using `np.where(mat[:,0] == arr)` to extract the indexes.
and use those indexes to get the elements you want from `mat`
```
In [1]... | Output should be `['A', 'C']``
So above code can be modified as
```
print(mat[np.where(mat[:,0]=arr)][:,1]
# output ['A' 'C']
``` |
302,239 | In the following sample document,
```
\documentclass[tikz]{standalone}
\usetikzlibrary{chains}
\begin{document}
\begin{tikzpicture}
%circle
\draw[black, thick] (0,0) circle (5);
%binding sites
\begin{scope}[start chain=bindingchain]
\foreach \a/\c in {150/green, 270/red, 390/blue}
\draw[gray] (0... | 2016/04/03 | [
"https://tex.stackexchange.com/questions/302239",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/102257/"
] | A `coordinate` is a *point*. It doesn't make sense to use this for things which have dimensions. These should be *nodes*. I'm slightly surprised that the code compiles at all.
Correcting this doesn't actually change the output:
```
\draw[gray] (0,0) -- (\a:5) node [\c, midway, thick, draw, circle, minimum width=25, ... | This can all be done without the `chains` library ...
```
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
%circle
\draw[black, thick] (0,0) circle (5);
\foreach \a/\c/\name in {150/green/a, 270/red/b, 390/blue/c}
\draw[gray] (0,0) -- (\a:5)
... |
2,890 | From what I remember, no character in Pokemon is shown going to any sort of religious house of worship, and there doesn't seem to be much if any mention of religion/religious beliefs until Sinnoh, where there is lore following Arceus's creation of the world. Are there any organized religions in the world, worshiping ei... | 2013/03/14 | [
"https://anime.stackexchange.com/questions/2890",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/93/"
] | Neither in the Anime, nor in the Games or the Manga is ever mentioned something about religions. Religious aspects can be seen sometimes (like your example of Arceus, but also the wise men in the Sprout Tower or the Slowpoke-temple in the anime), but they aren't a real topic.
Either in the anime or in one of the games... | Well, I don't know if this would work, but there was that big crystal flower tractor beam hidden underground under Geosenge Town in X and Y, and the long living AZ used it to kill off dozens of Pokémon to bring back his floette, correct? I think that Lysandre, for the sake of his 'beautiful' world, sought to unleash th... |
2,890 | From what I remember, no character in Pokemon is shown going to any sort of religious house of worship, and there doesn't seem to be much if any mention of religion/religious beliefs until Sinnoh, where there is lore following Arceus's creation of the world. Are there any organized religions in the world, worshiping ei... | 2013/03/14 | [
"https://anime.stackexchange.com/questions/2890",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/93/"
] | It's not a religion from the present Pokemon World, but in the manga series *[The Electric Tale of Pikachu (Dengeki Pikachu)](http://bulbapedia.bulbagarden.net/wiki/The_Electric_Tale_of_Pikachu)*, in the fourth chapter ([Haunting my Dreams](http://bulbapedia.bulbagarden.net/wiki/ET04)), Brock says to Ash that in "ancie... | Neither in the Anime, nor in the Games or the Manga is ever mentioned something about religions. Religious aspects can be seen sometimes (like your example of Arceus, but also the wise men in the Sprout Tower or the Slowpoke-temple in the anime), but they aren't a real topic.
Either in the anime or in one of the games... |
2,890 | From what I remember, no character in Pokemon is shown going to any sort of religious house of worship, and there doesn't seem to be much if any mention of religion/religious beliefs until Sinnoh, where there is lore following Arceus's creation of the world. Are there any organized religions in the world, worshiping ei... | 2013/03/14 | [
"https://anime.stackexchange.com/questions/2890",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/93/"
] | It's not a religion from the present Pokemon World, but in the manga series *[The Electric Tale of Pikachu (Dengeki Pikachu)](http://bulbapedia.bulbagarden.net/wiki/The_Electric_Tale_of_Pikachu)*, in the fourth chapter ([Haunting my Dreams](http://bulbapedia.bulbagarden.net/wiki/ET04)), Brock says to Ash that in "ancie... | Well, I don't know if this would work, but there was that big crystal flower tractor beam hidden underground under Geosenge Town in X and Y, and the long living AZ used it to kill off dozens of Pokémon to bring back his floette, correct? I think that Lysandre, for the sake of his 'beautiful' world, sought to unleash th... |
170,801 | What is the usual community response to questions that are posted on other sites as well? For example if the same question is posted on [StackOverflow](https://stackoverflow.com/) and on [CodeProject](http://www.codeproject.com/) what would the community do? Answer the question or direct users to the other site?
I ass... | 2013/03/07 | [
"https://meta.stackexchange.com/questions/170801",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/182146/"
] | It would in most likelihood not even be noticed. Most people are not super active on more than one site.
People would just answer it and move on. | Posting a question on both StackOverflow and Code Project is perfectly legitimate.
And it's perfectly acceptable (and even encouraged) for people to answer the question a second time on StackOverflow.
And as for this problem happening in mass quantities, and writing a tool for migration... We'll cross that bridge whe... |
170,801 | What is the usual community response to questions that are posted on other sites as well? For example if the same question is posted on [StackOverflow](https://stackoverflow.com/) and on [CodeProject](http://www.codeproject.com/) what would the community do? Answer the question or direct users to the other site?
I ass... | 2013/03/07 | [
"https://meta.stackexchange.com/questions/170801",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/182146/"
] | We don't mind cross-posting across to other sites. We **do** mind however, about cross posting inside the Stack Exchange network (i.e. don't post the same question on both Stack Overflow and, say, Programmers).
If the OP is attentive enough to respond to both questions he started on the two different sites, so be it. | Posting a question on both StackOverflow and Code Project is perfectly legitimate.
And it's perfectly acceptable (and even encouraged) for people to answer the question a second time on StackOverflow.
And as for this problem happening in mass quantities, and writing a tool for migration... We'll cross that bridge whe... |
7,930,931 | I'm working on an Asp.Net MVC 3 application using Fluent NHibernate. I'm just attempting to add an IoC container using StructureMap.
I have implemented a custom controller factory which uses StructureMap to create the controller and inject dependencies. Each controller constructor takes one or more services, which in ... | 2011/10/28 | [
"https://Stackoverflow.com/questions/7930931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/95423/"
] | Registering multiple session factories is easy - the problem is selecting the right one when you need it. For example, let's say we have some sort of laboratory that has multiple databases. Each lab has a Location and multiple Samples for that location. We could have a SampleRepository that models that. Each Location h... | Are you sure this thing works? **string ISessionFactory**
```
public string ISessionFactory SessionFactory { get; private set; }
```
should this be
```
public interface INamedSessionFactory
{
ISessionFactory SessionFactory { get; set; }
string Name { get; }
}
public class NamedSessionFactory : INamedSess... |
22,118,221 | I have a string and I need to scan for every occurrence of "foo" and read all the text following it until a second `"`. ~~Since Rust does not have a `contains` function for strings~~, I need to iterate by characters scanning for it. How would I do this?
**Edit**: Rust's `&str` has a [`contains()`](https://doc.rust-lan... | 2014/03/01 | [
"https://Stackoverflow.com/questions/22118221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2171584/"
] | >
> I need to iterate by characters scanning for it.
>
>
>
The [`.chars()` method](http://doc.rust-lang.org/std/primitive.str.html#method.chars) returns an iterator over characters in a string. e.g.
```
for c in my_str.chars() {
// do something with `c`
}
for (i, c) in my_str.chars().enumerate() {
// d... | The concept of a "character" is very ambiguous and can mean many different things depending on the type of data you are working with. The most obvious answer is the [`chars`](https://doc.rust-lang.org/std/primitive.str.html#method.chars) method. However, this does not work as advertised. What looks like a single "chara... |
22,118,221 | I have a string and I need to scan for every occurrence of "foo" and read all the text following it until a second `"`. ~~Since Rust does not have a `contains` function for strings~~, I need to iterate by characters scanning for it. How would I do this?
**Edit**: Rust's `&str` has a [`contains()`](https://doc.rust-lan... | 2014/03/01 | [
"https://Stackoverflow.com/questions/22118221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2171584/"
] | >
> I need to iterate by characters scanning for it.
>
>
>
The [`.chars()` method](http://doc.rust-lang.org/std/primitive.str.html#method.chars) returns an iterator over characters in a string. e.g.
```
for c in my_str.chars() {
// do something with `c`
}
for (i, c) in my_str.chars().enumerate() {
// d... | ```
fn main() {
let s = "Rust is a programming language";
for i in s.chars() {
print!("{}", i);
}}
```
>
> Output: Rust is a programming language
>
>
>
I use the chars() method to iterate over each element of the string. |
22,118,221 | I have a string and I need to scan for every occurrence of "foo" and read all the text following it until a second `"`. ~~Since Rust does not have a `contains` function for strings~~, I need to iterate by characters scanning for it. How would I do this?
**Edit**: Rust's `&str` has a [`contains()`](https://doc.rust-lan... | 2014/03/01 | [
"https://Stackoverflow.com/questions/22118221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2171584/"
] | The concept of a "character" is very ambiguous and can mean many different things depending on the type of data you are working with. The most obvious answer is the [`chars`](https://doc.rust-lang.org/std/primitive.str.html#method.chars) method. However, this does not work as advertised. What looks like a single "chara... | ```
fn main() {
let s = "Rust is a programming language";
for i in s.chars() {
print!("{}", i);
}}
```
>
> Output: Rust is a programming language
>
>
>
I use the chars() method to iterate over each element of the string. |
26,065,679 | I have the following code that is facing a NullPointerException error in Netbeans. The code is actually written for use with a GUI using java frames. But I edited to only use it from the cmd. I have ran through the codes but couldn't find out why the error is popping up. Can anyone highlight whats the problem here? The... | 2014/09/26 | [
"https://Stackoverflow.com/questions/26065679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1867016/"
] | Without using `for` at all, you need a lambda:
```
>>> a = [[1.2,5.8,6,3], [1,48,5], [2.,3], [4,7,5.,2,5,3,6,554,6.,6,9], [6,.3,8,45.2,.001]]
>>> reduce(lambda x, y: x*len(y), a, 1)
1320
```
Or without lambda:
```
>>> reduce(operator.mul, map(len, a), 1)
```
Or using numpy:
```
>>> import numpy as np
>>> np.prod... | This uses `reduce` and `operator.mul`:
```
>>> import operator
>>> a = [[1.2,5.8,6,3], [1,48,5], [2.,3], [4,7,5.,2,5,3,6,554,6.,6,9], [6,.3,8,45.2,.001]]
>>> reduce(operator.mul, (len(l) for l in a), 1)
1320
``` |
10,329 | Would it be possible for a an amateur who is interested in getting some "hands-on" experience in desining and training deep neural networks, to use an ordinary laptop for that purpose (no GPU), or is it hopeless to get good results in reasonable time without a powerful computer/cluster/GPU?
To be more specific, the la... | 2016/02/20 | [
"https://datascience.stackexchange.com/questions/10329",
"https://datascience.stackexchange.com",
"https://datascience.stackexchange.com/users/16424/"
] | **Yes, a laptop will work just fine for getting acquainted with some deep learning projects:**
You can pick a smallish deep learning problem and gain some tractable insight using a laptop so give it a try.
The [Theano](http://deeplearning.net/software/theano/) project has a [set of tutorials](http://deeplearning.net/... | >
> [...] is it hopeless to get good results in reasonable time without a powerful computer/cluster/GPU?
>
>
>
It's not hopeless and you can, without doubt, gain lots of relevant experience with deep learning using the computer spec you mentioned. It will come down to your neural network architecture (number of la... |
67,399,543 | I am trying to select an HTML element with an id that is a number, ie. `<div id=27047243>`
When I try to use the select method like this `soup.select("#27047243")` I get an error that says *Malformed id selector*
I figured I need to escape the number somehow, I tried like this `soup.select(r"#\3{number}"` but even th... | 2021/05/05 | [
"https://Stackoverflow.com/questions/67399543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14062581/"
] | This can be seen quite often in [Streamlit discussions](https://discuss.streamlit.io/t/the-button-inside-a-button-seems-to-reset-the-whole-app-why/1051) because it looks like a bug at the first glance, but it's not. A simple and silly answer would be "That's the way streamlit is designed".
So every time you press th... | When you click `About Python`:
* the value of `left_one` becomes `True`
* the value of all other buttons (including `generate_syntax`) becomes `False`
When you click `Generate Syntax`:
* the value of `generate_syntax` becomes `True`
* the value of `left_one` becomes `False`
The issue is that you never meet both con... |
52,401,118 | I have created a scheduler with following events and resources
```
var sampleEvents = [{ 'id': '1',
'resourceid': '27',
'start': '2018-09-19T07:00:00',
'stop': '2018-09-19T16:00:00',
'title': 'Message 1',
... | 2018/09/19 | [
"https://Stackoverflow.com/questions/52401118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In JavaScript, variable and property names are case-sensitive. Therefore
```
'resourceid': '27'`
```
should be
```
'resourceId': '27'
```
as [per the example in the documentation](https://fullcalendar.io/docs/resources-and-events). The event isn't showing the timeline view because as far as fullCalendar is conc... | ```
resources: sampleEvents,
events: sampleResources,
```
You filled them wrong. Switch them. It will work.
```
resources: sampleResources,
events: sampleEvents,
``` |
52,401,118 | I have created a scheduler with following events and resources
```
var sampleEvents = [{ 'id': '1',
'resourceid': '27',
'start': '2018-09-19T07:00:00',
'stop': '2018-09-19T16:00:00',
'title': 'Message 1',
... | 2018/09/19 | [
"https://Stackoverflow.com/questions/52401118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In JavaScript, variable and property names are case-sensitive. Therefore
```
'resourceid': '27'`
```
should be
```
'resourceId': '27'
```
as [per the example in the documentation](https://fullcalendar.io/docs/resources-and-events). The event isn't showing the timeline view because as far as fullCalendar is conc... | Assigned objects are improper. If you pass the correct objects. It will work fine
```
resources: sampleResources,
events: sampleEvents
```
You can refer below working jsfiddle link
```
http://jsfiddle.net/jso51pm6/3769/
``` |
52,401,118 | I have created a scheduler with following events and resources
```
var sampleEvents = [{ 'id': '1',
'resourceid': '27',
'start': '2018-09-19T07:00:00',
'stop': '2018-09-19T16:00:00',
'title': 'Message 1',
... | 2018/09/19 | [
"https://Stackoverflow.com/questions/52401118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Assigned objects are improper. If you pass the correct objects. It will work fine
```
resources: sampleResources,
events: sampleEvents
```
You can refer below working jsfiddle link
```
http://jsfiddle.net/jso51pm6/3769/
``` | ```
resources: sampleEvents,
events: sampleResources,
```
You filled them wrong. Switch them. It will work.
```
resources: sampleResources,
events: sampleEvents,
``` |
571,507 | I'm not really knowledgeable on physics but was curious about this and couldn't find any good answers related to it. | 2020/08/06 | [
"https://physics.stackexchange.com/questions/571507",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/271661/"
] | Energy is conserved in the whole universe \*. Nevertheless, if you delimit a system and you focus only on that system, forces can vary the energy of the system. Total energy is conserved in the universe, but in your particular system migh not.
If you wide your system to include more objects, then you'll find energy co... | To be clear, if you "lift a book at constant velocity" you are still having to provide a force against gravity and so are still "doing work". Perhaps what you mean is an object moving at constant velocity in a vacuum. If no external forces act on this object its energy doesn't change.
If you're asking if the conservat... |
571,507 | I'm not really knowledgeable on physics but was curious about this and couldn't find any good answers related to it. | 2020/08/06 | [
"https://physics.stackexchange.com/questions/571507",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/271661/"
] | Energy is conserved in the whole universe \*. Nevertheless, if you delimit a system and you focus only on that system, forces can vary the energy of the system. Total energy is conserved in the universe, but in your particular system migh not.
If you wide your system to include more objects, then you'll find energy co... | When you lift a book you are expending energy, you can accelerate it all the time you are lifting it, or you can lift it steadily at a constant speed. In both cases you are increasing the book's gravitational potential energy, also some of your energy may go to air friction and sound waves. So none of the energy you sp... |
571,507 | I'm not really knowledgeable on physics but was curious about this and couldn't find any good answers related to it. | 2020/08/06 | [
"https://physics.stackexchange.com/questions/571507",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/271661/"
] | Energy is conserved in the whole universe \*. Nevertheless, if you delimit a system and you focus only on that system, forces can vary the energy of the system. Total energy is conserved in the universe, but in your particular system migh not.
If you wide your system to include more objects, then you'll find energy co... | Yes, the conservation of energy holds when there are net forces too, and the difference between the two cases that you proposed is the behaviour of kinetic energy:
* if the net force is zero the speed is constant, as well as the kinetic energy; also consider that in reality -even when you try to lift a book at constan... |
63,754 | My players often want to see if they know something about a monster or not, specially stuff like weaknesses and resistances. I have this idea that there should be somewhere in the MM or DMG explaining the proper way to do proceed, but I can't find it.
How do I know which is the best ability (skill) check for knowing ... | 2015/06/19 | [
"https://rpg.stackexchange.com/questions/63754",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/15810/"
] | **There are no, concrete RAW monster knowledge checks in 5e**
The PHB, MM, and DMG do not mention anything like a monster knowledge check as existed in previous editions. Tied with that is the fact that monster types are not directly tied to skills. As such I can only offer guidelines based on my own experiences with ... | If you run a group focused on role-playing and stories, don't tell the players specific stats like armor class or DMG unless you see the need to. If your group is more combat-heavy, then stats would be more appropriate. No rule in the book really provides concrete guidelines to structuring knowledge checks.
I am aware... |
66,579,069 | I'm trying to grab the data feed on my blog with the help of blogger json. I made it with the help of javascript to retrieve the data, but I was confused about displaying the last data in an array of feeds.
Whereas what is shown is all the arrays based on the labels in the feeds.
My question: how to show only the last... | 2021/03/11 | [
"https://Stackoverflow.com/questions/66579069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10788263/"
] | This code shows only the last entry in the array using `arr.slice(-1)`, if you meant first element just remove `.slice(-1)` from the code
```js
function series(response) {
if (response.feed.openSearch$totalResults.$t > 0) {
var entry = response.feed.entry.slice(-1)[0],
title = entry.title.$t,
... | ```js
function series(e) {
var r, l = e.feed.entry[e.feed.entry.length - 1],
n = l.title.$t;
for (var i = 0; i < l.link.length; i++) {
if ("replies" == l.link[i].rel && "text/html" == l.link[i].type && (l.link[i].title, l.link[i].href), "alternate" == l.link[i].rel) {
r = l.link[i].href;
break
... |
66,570,424 | There is a problem with this program. I'm trying to make it so when someone types 'hi' in Discord, two bots respond. The problem is that the bots keep saying hi to the other one. Here is the code:
```
msg = message.content# Makes sure that the author of the message isn't itself
if message.author == client.user:
... | 2021/03/10 | [
"https://Stackoverflow.com/questions/66570424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14945848/"
] | Just to share with you my understanding on why do we need these 2 layers of data presentation, and convert model to entity and vise versa.
Imagine you have several backends, each having it's own data structure, but in your application it is represented by the single data class. For example, you fetch e-currency data f... | Hopefully I was able to figure this out. I am adding the questions and answers together for ease.
Questions:
So to conclude such a long writeup, here my questions are;
1. [Question] When we create data models extending entity, what should be the one called in UI - data model or domain entity? I can make it work with... |
66,570,424 | There is a problem with this program. I'm trying to make it so when someone types 'hi' in Discord, two bots respond. The problem is that the bots keep saying hi to the other one. Here is the code:
```
msg = message.content# Makes sure that the author of the message isn't itself
if message.author == client.user:
... | 2021/03/10 | [
"https://Stackoverflow.com/questions/66570424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14945848/"
] | Model should be used as a data mapping. Its only mission is mapping data from data sources (remote or local) to repository. And models should be used only in "data layer". In domain layer and presentation layer, you should use entities. In future, if you need to modify fields in model, you can modify model file only or... | Hopefully I was able to figure this out. I am adding the questions and answers together for ease.
Questions:
So to conclude such a long writeup, here my questions are;
1. [Question] When we create data models extending entity, what should be the one called in UI - data model or domain entity? I can make it work with... |
55,752 | I'm accessing TLS 1.3 test server "<https://tls13.pinterjann.is>" via a java http client using TLS 1.3. Everything seems to work fine as the html response indicates:
[](https://i.stack.imgur.com/AJmFO.png)
What I don't understand: Why does Wireshark show in the ov... | 2018/12/31 | [
"https://networkengineering.stackexchange.com/questions/55752",
"https://networkengineering.stackexchange.com",
"https://networkengineering.stackexchange.com/users/53911/"
] | Sorry, for the confusion, I was missing the exact TLS 1.3 semantics: For instance, in the Client Hello, the field "version" must contain the fixed value 0x0303 (TLS 1.2), while the prefered version is contained in the extension "supported versions".
From RFC 8446 (TLS 1.3 spec):
```
struct {
ProtocolVersion l... | >
> Why does Wireshark show in the overview Protocol TLSv1.3 but in the details Version TLS 1.2?
>
>
>
Wireshark reports TLS 1.3 in the protocol column due to Server Hello containing a [Supported Versions extension](https://www.rfc-editor.org/rfc/rfc8446#section-4.2.1) with TLS 1.3.
Recall that TLS sessions begin... |
8,413,797 | This is an extremely strange situation, but I just cannot point out what I'm doing wrong.
I'm executing a big bunch of SQL scripts (table creation scripts, mostly). They are executed through Java, using `sqlcmd`. Here's the `sqlcmd` command I use.
```
sqlcmd -m 11 -S SERVER -d DB -U USER -P PASS -r0 -i "SCRIPT.sql" 2... | 2011/12/07 | [
"https://Stackoverflow.com/questions/8413797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/398713/"
] | Have a look at the exec method with an string array as parameter:
```
java.lang.Runtime.exec(String[] cmdArray)
```
The JavaDoc for this method says:
>
> Executes the specified command and arguments in a separate process.
>
>
>
So, the first item in the array is the command and all of your arguments are appen... | I don't have privs to post comments - which is what this is - but what if you try putting in a bogus user id for the DB? Does that cause a different execution path? Will that give you a Java error? Or an Auth error in your DB? Also, def tweak the user, not the password and learn from my experience that if you tweak the... |
8,413,797 | This is an extremely strange situation, but I just cannot point out what I'm doing wrong.
I'm executing a big bunch of SQL scripts (table creation scripts, mostly). They are executed through Java, using `sqlcmd`. Here's the `sqlcmd` command I use.
```
sqlcmd -m 11 -S SERVER -d DB -U USER -P PASS -r0 -i "SCRIPT.sql" 2... | 2011/12/07 | [
"https://Stackoverflow.com/questions/8413797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/398713/"
] | I don't have privs to post comments - which is what this is - but what if you try putting in a bogus user id for the DB? Does that cause a different execution path? Will that give you a Java error? Or an Auth error in your DB? Also, def tweak the user, not the password and learn from my experience that if you tweak the... | First enable log/view commands output (since exec() returns 1), which would point out possible cause of the issue.
Use proc.getInputStream() and print the contents to a file or console. |
8,413,797 | This is an extremely strange situation, but I just cannot point out what I'm doing wrong.
I'm executing a big bunch of SQL scripts (table creation scripts, mostly). They are executed through Java, using `sqlcmd`. Here's the `sqlcmd` command I use.
```
sqlcmd -m 11 -S SERVER -d DB -U USER -P PASS -r0 -i "SCRIPT.sql" 2... | 2011/12/07 | [
"https://Stackoverflow.com/questions/8413797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/398713/"
] | Have a look at the exec method with an string array as parameter:
```
java.lang.Runtime.exec(String[] cmdArray)
```
The JavaDoc for this method says:
>
> Executes the specified command and arguments in a separate process.
>
>
>
So, the first item in the array is the command and all of your arguments are appen... | First enable log/view commands output (since exec() returns 1), which would point out possible cause of the issue.
Use proc.getInputStream() and print the contents to a file or console. |
3,061,956 | Let $x = 0.3$.
The first number of the sequence is $x$.
The second number is the first number + $(0.3\cdot 0.3)$.
The third number is the second number + $(0.3\cdot 0.3\cdot 0.3)$.
This is a recursive formula:
$a\_1 = 0.3$
$a\_{n+1} = a\_n + 0.3^{n-1}$
Is it possible to write this equation without recursion?
... | 2019/01/04 | [
"https://math.stackexchange.com/questions/3061956",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/524791/"
] | Your sequence seems to be $a\_n = x + x^2 + x^3 + ..... + x^n$
$= (1 + x + x^2 + x^3 + ...... + x^n) - 1$
$= \frac {1-x^{n+1}}{1-x}-1$
$=\frac {1-.3^{n+1}}{.7} - 1$
Google [geometric series](https://en.wikipedia.org/wiki/Geometric_series)
Or maybe more straightforward:
$a\_n = x + x^2 + ...... + x^n =$
$x(1 + ..... | You can write:
$a\_{n+1} = a\_n + 0.3^{n-1}$
$= a\_{n-1} + 0.3^{n-2} + 0.3^{n-1}$
$ = a\_{n-2} + 0.3^{n-3} + 0.3^{n-2} + 0.3^{n-1}$
$ ... $
$ = a\_1 + \sum\_{k=1}^n 0.3^{n-k+1}$
$ = a\_1 + \sum\_{k=1}^n 0.3^k$
$ = a\_1 + \frac{3}{7}(1-0.3^n)$
$ = 0.3 + \frac{3}{7}(1-0.3^n)$
$ = 0.7286 - 0.4286 \times 0.3^n$ |
3,061,956 | Let $x = 0.3$.
The first number of the sequence is $x$.
The second number is the first number + $(0.3\cdot 0.3)$.
The third number is the second number + $(0.3\cdot 0.3\cdot 0.3)$.
This is a recursive formula:
$a\_1 = 0.3$
$a\_{n+1} = a\_n + 0.3^{n-1}$
Is it possible to write this equation without recursion?
... | 2019/01/04 | [
"https://math.stackexchange.com/questions/3061956",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/524791/"
] | Your sequence seems to be $a\_n = x + x^2 + x^3 + ..... + x^n$
$= (1 + x + x^2 + x^3 + ...... + x^n) - 1$
$= \frac {1-x^{n+1}}{1-x}-1$
$=\frac {1-.3^{n+1}}{.7} - 1$
Google [geometric series](https://en.wikipedia.org/wiki/Geometric_series)
Or maybe more straightforward:
$a\_n = x + x^2 + ...... + x^n =$
$x(1 + ..... | If we write $$a\_n=1+0.3+(0.3)^2+\cdots + (0.3)^{n-2}$$then we have $$a\_{n+1}=a\_n+(0.3)^{n-1}=1+0.3+(0.3)^2+\cdots + (0.3)^{n-2}+(0.3)^{n-1}$$also $$1+0.3+(0.3)^2+\cdots + (0.3)^{n-2}={1-(0.3)^{n-1}\over 1-0.3}$$therefore $$a\_n={1-(0.3)^{n-1}\over 0.7}$$ |
90,625 | Which is correct: "Constantin" or "Constantine"? I also encountered in texts "Konstantin" and "Kostantine". Or else is another spelling preferred? | 2012/11/08 | [
"https://english.stackexchange.com/questions/90625",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/30600/"
] | The Roman emperor Flavius Valerius Aurelius Constantinus Augustus is generally rendered as *Constantine* in English, and this form is almost certainly the most common.
For personal names, however, there is no single "correct" spelling, as personal names are not regulated in most English-speaking countries. *Constantin... | It depends on the dialect.
My grandfather’s name is Constantine, When my Great Grandfather came over from Greece it was Constantine as well.
If you go by other variants you will see something along:
Constans, Constan, Constant, Constanc, Constance, Consten, Constens, Constense, Constence, Constanse, Constane, Const... |
3,879,905 | I am trying to prove this and have looked at similar questions to gauge how to approach this. I have:
Suppose that there exists a smallest rational number greater than $\sqrt{3}$.
We shall call that number $n$, which, as it is rational, can be expressed as $\frac{p}{q}$
$\frac{\sqrt{3}+n}{\sqrt{3}}$ is a number grea... | 2020/10/24 | [
"https://math.stackexchange.com/questions/3879905",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | if you have positive integers $x,y$ with
$$ \frac{x}{y} > \sqrt 3 $$
we also have
$$ x^2 - 3 y^2 > 0 $$
is an integer
so that there is some positive $T$ with
$$ x^2 - 3 y^2 = T. $$
Well we calculate that
$$ u = 2x + 3y \; \; , \hspace{9mm} v = x+2y $$
satisfy
$$ u^2 - 3 v^2 = T > 0 $$
also.
$$ u^2 > 3 v^2 $$
$$\frac{... | Let $S=\{q\in \mathbb Q:q^2>3\}$ and suppose $q\in S.$ Set $p=\frac{3q+3}{q+3}$.
Then, $p<q$ and $p\in S$ because $\left(\frac{3q+3}{q+3}\right)^2-3=\frac{6(q^2-3)}{(q+3)^2}>0.$ |
3,879,905 | I am trying to prove this and have looked at similar questions to gauge how to approach this. I have:
Suppose that there exists a smallest rational number greater than $\sqrt{3}$.
We shall call that number $n$, which, as it is rational, can be expressed as $\frac{p}{q}$
$\frac{\sqrt{3}+n}{\sqrt{3}}$ is a number grea... | 2020/10/24 | [
"https://math.stackexchange.com/questions/3879905",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | if you have positive integers $x,y$ with
$$ \frac{x}{y} > \sqrt 3 $$
we also have
$$ x^2 - 3 y^2 > 0 $$
is an integer
so that there is some positive $T$ with
$$ x^2 - 3 y^2 = T. $$
Well we calculate that
$$ u = 2x + 3y \; \; , \hspace{9mm} v = x+2y $$
satisfy
$$ u^2 - 3 v^2 = T > 0 $$
also.
$$ u^2 > 3 v^2 $$
$$\frac{... | Let $q$ be least integer greater than $\sqrt{3}$, then $q^2>3$.If we can get a rational $q-\frac1 n >\sqrt{3}$ then we'll get a contradiction.
Observe $\left(q-\frac1 n\right)^2\geq q^2-\frac{2q}{n}$.
By Archimedean principle,$\exists N $such that $\frac 1 N < \frac{q^2-3}{2q}$. $$\therefore q^2-3>\frac{2q}{n}\implie... |
3,879,905 | I am trying to prove this and have looked at similar questions to gauge how to approach this. I have:
Suppose that there exists a smallest rational number greater than $\sqrt{3}$.
We shall call that number $n$, which, as it is rational, can be expressed as $\frac{p}{q}$
$\frac{\sqrt{3}+n}{\sqrt{3}}$ is a number grea... | 2020/10/24 | [
"https://math.stackexchange.com/questions/3879905",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | if you have positive integers $x,y$ with
$$ \frac{x}{y} > \sqrt 3 $$
we also have
$$ x^2 - 3 y^2 > 0 $$
is an integer
so that there is some positive $T$ with
$$ x^2 - 3 y^2 = T. $$
Well we calculate that
$$ u = 2x + 3y \; \; , \hspace{9mm} v = x+2y $$
satisfy
$$ u^2 - 3 v^2 = T > 0 $$
also.
$$ u^2 > 3 v^2 $$
$$\frac{... | Suppose $q \in \mathbb{Q} > \sqrt{3}$; then $q^2 > 3$, or $q^2= 3 + \delta$ with $\delta \in\mathbb{Q} > 0$. Then we want to choose some rational $\varepsilon>0$ such that $$(q-\varepsilon)^2=q^2-2q\varepsilon+\varepsilon^2=3+\delta-2q\varepsilon+\varepsilon^2 > 3+\delta-2q\varepsilon\ge 3,$$
so that $q-\varepsilon\in\... |
3,879,905 | I am trying to prove this and have looked at similar questions to gauge how to approach this. I have:
Suppose that there exists a smallest rational number greater than $\sqrt{3}$.
We shall call that number $n$, which, as it is rational, can be expressed as $\frac{p}{q}$
$\frac{\sqrt{3}+n}{\sqrt{3}}$ is a number grea... | 2020/10/24 | [
"https://math.stackexchange.com/questions/3879905",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | Let $S=\{q\in \mathbb Q:q^2>3\}$ and suppose $q\in S.$ Set $p=\frac{3q+3}{q+3}$.
Then, $p<q$ and $p\in S$ because $\left(\frac{3q+3}{q+3}\right)^2-3=\frac{6(q^2-3)}{(q+3)^2}>0.$ | Suppose $q \in \mathbb{Q} > \sqrt{3}$; then $q^2 > 3$, or $q^2= 3 + \delta$ with $\delta \in\mathbb{Q} > 0$. Then we want to choose some rational $\varepsilon>0$ such that $$(q-\varepsilon)^2=q^2-2q\varepsilon+\varepsilon^2=3+\delta-2q\varepsilon+\varepsilon^2 > 3+\delta-2q\varepsilon\ge 3,$$
so that $q-\varepsilon\in\... |
3,879,905 | I am trying to prove this and have looked at similar questions to gauge how to approach this. I have:
Suppose that there exists a smallest rational number greater than $\sqrt{3}$.
We shall call that number $n$, which, as it is rational, can be expressed as $\frac{p}{q}$
$\frac{\sqrt{3}+n}{\sqrt{3}}$ is a number grea... | 2020/10/24 | [
"https://math.stackexchange.com/questions/3879905",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | Let $q$ be least integer greater than $\sqrt{3}$, then $q^2>3$.If we can get a rational $q-\frac1 n >\sqrt{3}$ then we'll get a contradiction.
Observe $\left(q-\frac1 n\right)^2\geq q^2-\frac{2q}{n}$.
By Archimedean principle,$\exists N $such that $\frac 1 N < \frac{q^2-3}{2q}$. $$\therefore q^2-3>\frac{2q}{n}\implie... | Suppose $q \in \mathbb{Q} > \sqrt{3}$; then $q^2 > 3$, or $q^2= 3 + \delta$ with $\delta \in\mathbb{Q} > 0$. Then we want to choose some rational $\varepsilon>0$ such that $$(q-\varepsilon)^2=q^2-2q\varepsilon+\varepsilon^2=3+\delta-2q\varepsilon+\varepsilon^2 > 3+\delta-2q\varepsilon\ge 3,$$
so that $q-\varepsilon\in\... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.