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 |
|---|---|---|---|---|---|
2,699,270 | >
> Let $p\_1=t^5+t^4,p\_2=t^5-7t^3, p\_3=t^5-1,p\_4=t^5+3t \in\mathbb Q\_{\le5}[t]$. Show $(p\_1,p\_2,p\_3,p\_4)$ is linearly independent.
>
>
>
My attempt with the definition of linearly independence: Let $\lambda\_{1,2,3,4}\in \mathbb Q$ and consider $0=\lambda\_1(t^5+t^4)+\lambda\_2(t^5-7t^3)+\lambda\_3(t^5-1)... | 2018/03/19 | [
"https://math.stackexchange.com/questions/2699270",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | First, you can divide your equality with $t$, thus obtaining:
$$0 = (\lambda\_1 + \lambda\_2 + \lambda\_4)t^4 + \lambda\_1t^3 - 7\lambda\_2t^2 - 3\lambda\_4$$
Plugging in $t = -1$ gives
$$0 = -6\lambda\_2-2\lambda\_4 \implies \lambda\_4 = -3\lambda\_2$$
Plugging in $t = 1$ gives
$$0 = 2\lambda\_1 -6\lambda\_2 - 2\... | Each given polynomial in the form $a+bt+ct^2+dt^3+et^4+ft^5$ in the basis $\cal B=\{1,t,t^2,t^3,t^4,t^5\}$ can be represented by its components (a,b,c,d,e,f).
Consider the matrix of the components (it is not a transormation matrix) and reduce to RREF.
If we obtain rank=4 then yes the polynomials are linearly indepen... |
2,699,270 | >
> Let $p\_1=t^5+t^4,p\_2=t^5-7t^3, p\_3=t^5-1,p\_4=t^5+3t \in\mathbb Q\_{\le5}[t]$. Show $(p\_1,p\_2,p\_3,p\_4)$ is linearly independent.
>
>
>
My attempt with the definition of linearly independence: Let $\lambda\_{1,2,3,4}\in \mathbb Q$ and consider $0=\lambda\_1(t^5+t^4)+\lambda\_2(t^5-7t^3)+\lambda\_3(t^5-1)... | 2018/03/19 | [
"https://math.stackexchange.com/questions/2699270",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | First, you can divide your equality with $t$, thus obtaining:
$$0 = (\lambda\_1 + \lambda\_2 + \lambda\_4)t^4 + \lambda\_1t^3 - 7\lambda\_2t^2 - 3\lambda\_4$$
Plugging in $t = -1$ gives
$$0 = -6\lambda\_2-2\lambda\_4 \implies \lambda\_4 = -3\lambda\_2$$
Plugging in $t = 1$ gives
$$0 = 2\lambda\_1 -6\lambda\_2 - 2\... | In your first approach you must remember that the $0$ at LHS in $$0=\lambda\_1(t^5+t^4)+\lambda\_2(t^5-7t^3)+\lambda\_3(t^5-1)+\lambda\_4(t^5+3t)$$
is the zero polynomial, that is the polinomial that is null for all values of $t$. So , reordering the RHS we find:
$$0=t^5(\lambda\_1+\lambda\_2+\lambda\_3+\lambda\_4 )+\... |
26,087,850 | I would like to give incrementing variable name to each post value and take the assigned variable and build array. The below is what I tried
```
$list = array();
$x = 0;
$prefix = '$var_';
foreach(array_slice($_POST, 1) as $test){
$x++;
$list[] = "{$prefix}{$x} = {$test};":
}
echo implode(" ", $list);
```
S... | 2014/09/28 | [
"https://Stackoverflow.com/questions/26087850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2666310/"
] | I believe you're looking for the [**extract()**](http://ua2.php.net/manual/en/function.extract.php) function:
```
$list = array();
$prefix = 'var_';
$_POST = array("TEST",1,2,3,"XYZ"); // post example
$x = 0;
foreach(array_slice($_POST, 0) as $test) {
$x++;
$list[$prefix.$x] = "{$test}";
}
extract($list);
ech... | A bad and dirty way of doing it (no security)
```
$list = implode(" ", $list);
eval($list)
```
Now, you have $var\_1, $var\_2 defined. :)
Beware, eval is dangerous, dont use it. |
26,087,850 | I would like to give incrementing variable name to each post value and take the assigned variable and build array. The below is what I tried
```
$list = array();
$x = 0;
$prefix = '$var_';
foreach(array_slice($_POST, 1) as $test){
$x++;
$list[] = "{$prefix}{$x} = {$test};":
}
echo implode(" ", $list);
```
S... | 2014/09/28 | [
"https://Stackoverflow.com/questions/26087850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2666310/"
] | I believe you're looking for the [**extract()**](http://ua2.php.net/manual/en/function.extract.php) function:
```
$list = array();
$prefix = 'var_';
$_POST = array("TEST",1,2,3,"XYZ"); // post example
$x = 0;
foreach(array_slice($_POST, 0) as $test) {
$x++;
$list[$prefix.$x] = "{$test}";
}
extract($list);
ech... | You can achieve the first part with list: as this example [PHP Assign array to variables](https://stackoverflow.com/questions/3340750/php-assign-array-to-variables)
You could skip all of that and do something like this:
```
$vars = $_POST
```
and use the array as-is (ovbiously you will need to sanitise your data be... |
24,514 | It has been my belief that one of the nice features of the original Atari ST is that it has support "out-of-the-box" for a hard disk drive connected via its built-in ACSI port- similar to the way you can connect an external SCSI drive to a Macintosh Plus and have it just work.
However, I see a lot of information onlin... | 2022/05/17 | [
"https://retrocomputing.stackexchange.com/questions/24514",
"https://retrocomputing.stackexchange.com",
"https://retrocomputing.stackexchange.com/users/4335/"
] | All models of the Atari ST1 had code in ROM to attempt to read and run a boot sector from the first sector an ACSI2-attached drive. The bootloader3 contained in that sector would4 load the hard disk driver from a known file5 in the hard drive's root directory6. This program would install the full hard disk driver and b... | >
> Question: Can a bare stock, original Atari 520ST, with TOS 1.0x ROM, boot from a connected hard drive, without any special boot floppy or 3rd party driver?
>
>
>
Yes, as long as it's fitted with a proper partition/boot sector and hard disk driver (usually AHDI.SYS).
>
> Assuming the answer is affirmative, wh... |
24,514 | It has been my belief that one of the nice features of the original Atari ST is that it has support "out-of-the-box" for a hard disk drive connected via its built-in ACSI port- similar to the way you can connect an external SCSI drive to a Macintosh Plus and have it just work.
However, I see a lot of information onlin... | 2022/05/17 | [
"https://retrocomputing.stackexchange.com/questions/24514",
"https://retrocomputing.stackexchange.com",
"https://retrocomputing.stackexchange.com/users/4335/"
] | >
> Question: Can a bare stock, original Atari 520ST, with TOS 1.0x ROM, boot from a connected hard drive, without any special boot floppy or 3rd party driver?
>
>
>
Yes, as long as it's fitted with a proper partition/boot sector and hard disk driver (usually AHDI.SYS).
>
> Assuming the answer is affirmative, wh... | Yes you can boot any Atari/TT/Falcon from a hard disk you just need a driver there are a couple of commercial drivers still available with active support. Peter Putnik's driver he's still active on all the big atari forums and <https://www.hddriver.net/en/>
There are some limits on partition sizes -
TOS limitations:
... |
24,514 | It has been my belief that one of the nice features of the original Atari ST is that it has support "out-of-the-box" for a hard disk drive connected via its built-in ACSI port- similar to the way you can connect an external SCSI drive to a Macintosh Plus and have it just work.
However, I see a lot of information onlin... | 2022/05/17 | [
"https://retrocomputing.stackexchange.com/questions/24514",
"https://retrocomputing.stackexchange.com",
"https://retrocomputing.stackexchange.com/users/4335/"
] | All models of the Atari ST1 had code in ROM to attempt to read and run a boot sector from the first sector an ACSI2-attached drive. The bootloader3 contained in that sector would4 load the hard disk driver from a known file5 in the hard drive's root directory6. This program would install the full hard disk driver and b... | Yes you can boot any Atari/TT/Falcon from a hard disk you just need a driver there are a couple of commercial drivers still available with active support. Peter Putnik's driver he's still active on all the big atari forums and <https://www.hddriver.net/en/>
There are some limits on partition sizes -
TOS limitations:
... |
65,741 | I'm LaTeXing some category theory, and typeset the names of my categories in boldface (**Set**, **Rel**, ...). Since I might want to change that, I put
```
\newcommand{\catname}[1]{\textbf{#1}}
\newcommand{\Set}{\catname{Set}}
\newcommand{\Rel}{\catname{Rel}}
...
```
in my document header. But `textbf` very kindly r... | 2012/08/03 | [
"https://tex.stackexchange.com/questions/65741",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/12544/"
] | You can wrap it in a group and add `\normalfont` to it; this will localize the font change initiated by `\normalfont`. This way it will revert back to the default before setting it in **bold**:

```
\documentclass{article}
\newcommand{\catname}[1]{{\... | Replacing `\textbf` by `\mathbf` seems to work fine.
```
\documentclass{article}
\newcommand{\catname}[1]{\mathbf{#1}}
\begin{document}
\emph{\dots in the category $\catname{Set}$.}
\end{document}
``` |
3,789,223 | Here is my color XML
```
<resources>
<drawable name="red">#7f00</drawable>
<drawable name="blue">#770000ff</drawable>
<drawable name="green">#7700ff00</drawable>
<drawable name="yellow">#77ffff00</drawable>
<drawable name="screen_background_black">#ff000000</drawable>
<drawable name="transluce... | 2010/09/24 | [
"https://Stackoverflow.com/questions/3789223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19875/"
] | Do like this:
In your XML-file, use **style**:
```
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="YourCustomText">
<item name="android:textColor">#FFFF00</item>
</style>
</resources>
```
then, in your .java code:
```
//Here you assign the style that is defined in YourCustomText
your... | Sorry about answering an old question, but here is the correct answer for others with the same problem:
From <http://developer.android.com/guide/topics/resources/more-resources.html#Color>
```
Resources res = getResources();
int color = res.getColor(R.color.opaque_red);
```
So just change your Java code to
```
if... |
51,672,563 | Input
when A, B, C are this:
A = 27.629999
B = 29.709202
C = -0.070
```
Then output need to be:
**it should not print anything as 27(=A) matches with {B+ (B*C)} =27 or
(val2+ val3)= 27
```
below is the code I've use abs to take the integer value before decimal but it's taking full integer like 27.8978 instead... | 2018/08/03 | [
"https://Stackoverflow.com/questions/51672563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9475065/"
] | You are using the wrong function `abs()` doesn't do what you think it does. `abs()` converts a negative number to a positive one. you need `int()` to remove the part of the number after the decimal point. | You have been using [`abs()`](https://perldoc.pl/functions/abs).
>
> **abs VALUE**
>
>
> **abs**
>
>
> Returns the absolute value of its argument. If VALUE is omitted, uses `$_`.
>
>
>
`abs()` basically removes the minus sign from a number. Pass it -27.8978 and it will return 27.8978. Pass it 27.8978 and it w... |
12,736,286 | How can I put a drop down list in a DetailView control? I have converted the field into template but having some issues when I add the drop down list, basically it is not binding the data into my table. I simply want to have some static data in the drop down but it should save it when I hit the Update button. I have th... | 2012/10/04 | [
"https://Stackoverflow.com/questions/12736286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1669621/"
] | Create two versions of the class, one which throws and one which returns error codes. They can both derive from a common base that contains the bulk of the code. | Never tried such a thing, but here's what I would do.
Error type:
```
extern const bool exceptionmode;
enum error_codes {no_error, whatever};
struct error_type {
error_codes id;
//maybe also a non-owning const char* message?
error_type() :id(no_error) {}
error_type(error_codes code) :id(code)
{... |
12,736,286 | How can I put a drop down list in a DetailView control? I have converted the field into template but having some issues when I add the drop down list, basically it is not binding the data into my table. I simply want to have some static data in the drop down but it should save it when I hit the Update button. I have th... | 2012/10/04 | [
"https://Stackoverflow.com/questions/12736286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1669621/"
] | Create two versions of the class, one which throws and one which returns error codes. They can both derive from a common base that contains the bulk of the code. | I like Mark Ransom's answer better than mine, unless creating two classes is unworkable for some other reason.
As an alternative, you can create the interface so that every function has a final argument with a default, such as int \*pRet = NULL. If pRet == NULL that indicates to use exceptions. If pRet != NULL, the ca... |
12,736,286 | How can I put a drop down list in a DetailView control? I have converted the field into template but having some issues when I add the drop down list, basically it is not binding the data into my table. I simply want to have some static data in the drop down but it should save it when I hit the Update button. I have th... | 2012/10/04 | [
"https://Stackoverflow.com/questions/12736286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1669621/"
] | I like Mark Ransom's answer better than mine, unless creating two classes is unworkable for some other reason.
As an alternative, you can create the interface so that every function has a final argument with a default, such as int \*pRet = NULL. If pRet == NULL that indicates to use exceptions. If pRet != NULL, the ca... | Never tried such a thing, but here's what I would do.
Error type:
```
extern const bool exceptionmode;
enum error_codes {no_error, whatever};
struct error_type {
error_codes id;
//maybe also a non-owning const char* message?
error_type() :id(no_error) {}
error_type(error_codes code) :id(code)
{... |
45,831,852 | I am trying Material theme and changing the background and text color of Menu and items. Using the below style it works fine on the Toolbar, but the menu pop up while pressing device menu button shows no change in text color though the background got changed. Please help to change the text color as mentioned.
[![enter ... | 2017/08/23 | [
"https://Stackoverflow.com/questions/45831852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4955383/"
] | **try this create this theme**
```
<style name="TextAppearance" parent="@style/Theme.Sherlock.Light">
<item name="actionMenuTextColor">@color/white</item>
<item name="android:actionMenuTextColor">@color/white</item>
</style>
```
**than apply this theme in your Activity theme like this**
```
<style name="your_... | One simple line in your theme :)
```
<item name="android:actionMenuTextColor">@color/your_color</item>
``` |
45,831,852 | I am trying Material theme and changing the background and text color of Menu and items. Using the below style it works fine on the Toolbar, but the menu pop up while pressing device menu button shows no change in text color though the background got changed. Please help to change the text color as mentioned.
[![enter ... | 2017/08/23 | [
"https://Stackoverflow.com/questions/45831852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4955383/"
] | One simple line in your theme :)
```
<item name="android:actionMenuTextColor">@color/your_color</item>
``` | You can change the color of the overflow menu background by adding a new style in style.xml.
```
<style name="OverflowMenu"
parent="@android:style/Theme.Holo">
<item name="android:popupMenuStyle">@style/MyOverflowMenu</item>
<item name="android:itemTextAppearance">@style/TextAppearance</item>
</style>
<style name="MyO... |
45,831,852 | I am trying Material theme and changing the background and text color of Menu and items. Using the below style it works fine on the Toolbar, but the menu pop up while pressing device menu button shows no change in text color though the background got changed. Please help to change the text color as mentioned.
[![enter ... | 2017/08/23 | [
"https://Stackoverflow.com/questions/45831852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4955383/"
] | One simple line in your theme :)
```
<item name="android:actionMenuTextColor">@color/your_color</item>
``` | Add one simple line in your theme .I hope this will solve your problem.
```
<item name="android:textColor">@color/button_color</item>
```
enjoy.. |
45,831,852 | I am trying Material theme and changing the background and text color of Menu and items. Using the below style it works fine on the Toolbar, but the menu pop up while pressing device menu button shows no change in text color though the background got changed. Please help to change the text color as mentioned.
[![enter ... | 2017/08/23 | [
"https://Stackoverflow.com/questions/45831852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4955383/"
] | One simple line in your theme :)
```
<item name="android:actionMenuTextColor">@color/your_color</item>
``` | ```
// note if you want to style popup menu in toolbar
step 1-- Add your theme in toolbar
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/MyPopupTheme" />
... |
45,831,852 | I am trying Material theme and changing the background and text color of Menu and items. Using the below style it works fine on the Toolbar, but the menu pop up while pressing device menu button shows no change in text color though the background got changed. Please help to change the text color as mentioned.
[![enter ... | 2017/08/23 | [
"https://Stackoverflow.com/questions/45831852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4955383/"
] | **try this create this theme**
```
<style name="TextAppearance" parent="@style/Theme.Sherlock.Light">
<item name="actionMenuTextColor">@color/white</item>
<item name="android:actionMenuTextColor">@color/white</item>
</style>
```
**than apply this theme in your Activity theme like this**
```
<style name="your_... | You can change the color of the overflow menu background by adding a new style in style.xml.
```
<style name="OverflowMenu"
parent="@android:style/Theme.Holo">
<item name="android:popupMenuStyle">@style/MyOverflowMenu</item>
<item name="android:itemTextAppearance">@style/TextAppearance</item>
</style>
<style name="MyO... |
45,831,852 | I am trying Material theme and changing the background and text color of Menu and items. Using the below style it works fine on the Toolbar, but the menu pop up while pressing device menu button shows no change in text color though the background got changed. Please help to change the text color as mentioned.
[![enter ... | 2017/08/23 | [
"https://Stackoverflow.com/questions/45831852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4955383/"
] | **try this create this theme**
```
<style name="TextAppearance" parent="@style/Theme.Sherlock.Light">
<item name="actionMenuTextColor">@color/white</item>
<item name="android:actionMenuTextColor">@color/white</item>
</style>
```
**than apply this theme in your Activity theme like this**
```
<style name="your_... | Add one simple line in your theme .I hope this will solve your problem.
```
<item name="android:textColor">@color/button_color</item>
```
enjoy.. |
45,831,852 | I am trying Material theme and changing the background and text color of Menu and items. Using the below style it works fine on the Toolbar, but the menu pop up while pressing device menu button shows no change in text color though the background got changed. Please help to change the text color as mentioned.
[![enter ... | 2017/08/23 | [
"https://Stackoverflow.com/questions/45831852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4955383/"
] | **try this create this theme**
```
<style name="TextAppearance" parent="@style/Theme.Sherlock.Light">
<item name="actionMenuTextColor">@color/white</item>
<item name="android:actionMenuTextColor">@color/white</item>
</style>
```
**than apply this theme in your Activity theme like this**
```
<style name="your_... | ```
// note if you want to style popup menu in toolbar
step 1-- Add your theme in toolbar
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/MyPopupTheme" />
... |
45,831,852 | I am trying Material theme and changing the background and text color of Menu and items. Using the below style it works fine on the Toolbar, but the menu pop up while pressing device menu button shows no change in text color though the background got changed. Please help to change the text color as mentioned.
[![enter ... | 2017/08/23 | [
"https://Stackoverflow.com/questions/45831852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4955383/"
] | You can change the color of the overflow menu background by adding a new style in style.xml.
```
<style name="OverflowMenu"
parent="@android:style/Theme.Holo">
<item name="android:popupMenuStyle">@style/MyOverflowMenu</item>
<item name="android:itemTextAppearance">@style/TextAppearance</item>
</style>
<style name="MyO... | Add one simple line in your theme .I hope this will solve your problem.
```
<item name="android:textColor">@color/button_color</item>
```
enjoy.. |
45,831,852 | I am trying Material theme and changing the background and text color of Menu and items. Using the below style it works fine on the Toolbar, but the menu pop up while pressing device menu button shows no change in text color though the background got changed. Please help to change the text color as mentioned.
[![enter ... | 2017/08/23 | [
"https://Stackoverflow.com/questions/45831852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4955383/"
] | ```
// note if you want to style popup menu in toolbar
step 1-- Add your theme in toolbar
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/MyPopupTheme" />
... | Add one simple line in your theme .I hope this will solve your problem.
```
<item name="android:textColor">@color/button_color</item>
```
enjoy.. |
42,527,451 | I am monitoring application logs in Cloud Watch using custom metrics. I get those logs in UTC in Cloud Watch Logs. I work from India but I use the Sydney region because that is my client location.
As far as I know, there is a possibility of getting them either in UTC or our local time.When I select my local time, it ... | 2017/03/01 | [
"https://Stackoverflow.com/questions/42527451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5946143/"
] | It would appear that CloudWatch Logs is using the timezone configured in the web browser / computer.
For example, I accessed some CloudWatch Logs in Sydney (UTC+11) while I was in the Perth timezone (UTC+8), and the "Local Timezone" showed as Perth time.
So, please check the Regional Settings / Timezone of your compu... | You can add a region setting into your local aws config which should be [userHome].aws\config:
```
[default]
region = us-east-1
# please change to your region
``` |
62,118,673 | My Spring boot application packaged as ROOT.war on tomcat9 using Java 11 appears to load successfully but fails to map the controllers. I can view every page by going right to the .jsp but my controller's map the URL's without .jsp. If I go to the mapped URL I get the standard 404 page.
This app works locally but expr... | 2020/05/31 | [
"https://Stackoverflow.com/questions/62118673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3977363/"
] | Yes, you can do that. It's nothing inherently wrong with it. However, it can make it impossible to recover from a failed allocation. If you're planning to exit the program if the allocation fails, it (usually) does not matter.
So this is perfectly fine:
```
ptr = realloc(ptr, newsize);
if(!ptr) exit(EXIT_FAILURE);
`... | You can reuse it but you should first check that the reallocation has succeeded.
If the reallocation failed, then after
```
ptr= realloc(ptr, newsize);
```
you've lost a reference to the old memory block, i.e., you have most likely created a memory leak.
What you probably want is:
```
void *newptr;
if ( (newptr=r... |
16,321,178 | I am trying to create a dynamic form using a UIScrollView, but I noticed when I used a `NSLog` that my scrollView's `contentSize.height = 0.00000` I built the scrollView to the width and height of the screen on storyboard with elements inside it. So why does it return 0? All the elements inside the scrollView are showi... | 2013/05/01 | [
"https://Stackoverflow.com/questions/16321178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1270257/"
] | Yes is 0 by default.
You should set the content size of your scrollview by summing all the views height and the spaces between them, example:
```
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 60)];
scrollView.backgroundColor = [UIColor blueColor];
[self.view addSubview:scrollVie... | Yes the content size for UIScrollView is 0 zero by default . In order to introduce scrolling into your scrollView , you need to set certain properties like setScrollEnabled , set Bouncing , set Horizontal/Vertical scrolling and the most important contentSize for the UIScrollView . A UIScrollView would not possess scrol... |
16,321,178 | I am trying to create a dynamic form using a UIScrollView, but I noticed when I used a `NSLog` that my scrollView's `contentSize.height = 0.00000` I built the scrollView to the width and height of the screen on storyboard with elements inside it. So why does it return 0? All the elements inside the scrollView are showi... | 2013/05/01 | [
"https://Stackoverflow.com/questions/16321178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1270257/"
] | Yes is 0 by default.
You should set the content size of your scrollview by summing all the views height and the spaces between them, example:
```
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 60)];
scrollView.backgroundColor = [UIColor blueColor];
[self.view addSubview:scrollVie... | Try placing a UIView inside the ScrollView do not set any constraints on the UIView. Next place all your form controls inside the UIView and constrain them as normal.
Now the **key** is to set the **last control on the form's bottom constraint to the UIView** (ie bottom of the form) This will then translate thru Auto... |
16,321,178 | I am trying to create a dynamic form using a UIScrollView, but I noticed when I used a `NSLog` that my scrollView's `contentSize.height = 0.00000` I built the scrollView to the width and height of the screen on storyboard with elements inside it. So why does it return 0? All the elements inside the scrollView are showi... | 2013/05/01 | [
"https://Stackoverflow.com/questions/16321178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1270257/"
] | Yes the content size for UIScrollView is 0 zero by default . In order to introduce scrolling into your scrollView , you need to set certain properties like setScrollEnabled , set Bouncing , set Horizontal/Vertical scrolling and the most important contentSize for the UIScrollView . A UIScrollView would not possess scrol... | Try placing a UIView inside the ScrollView do not set any constraints on the UIView. Next place all your form controls inside the UIView and constrain them as normal.
Now the **key** is to set the **last control on the form's bottom constraint to the UIView** (ie bottom of the form) This will then translate thru Auto... |
61,362,534 | I would like to graphically reduce a View or a `VStack` like I saw in a video. The guy selects the `VStack` and by pressing on his keyboard he gets a thumbnail of his `VStack`.
I have this :
```
VStack {
TextField("Placeholder", text: $newValue)
.background(Color.white)
Button(action: {}) {
Tex... | 2020/04/22 | [
"https://Stackoverflow.com/questions/61362534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13342633/"
] | It's called Code Folding. Can be done by pressing the following keys together.
`Opt + Cmd + Left Arrow Key` (⌥ + ⌘ + ⇠) after the opening brace of your VStack
More shortcuts here: <https://swifteducation.github.io/assets/pdfs/XcodeKeyboardShortcuts.pdf> | Ctrl + Alt + Cmd + ← (arrow left)| collapse method
Ctrl + Alt + Cmd + → (arrow right) | expand metnod |
61,362,534 | I would like to graphically reduce a View or a `VStack` like I saw in a video. The guy selects the `VStack` and by pressing on his keyboard he gets a thumbnail of his `VStack`.
I have this :
```
VStack {
TextField("Placeholder", text: $newValue)
.background(Color.white)
Button(action: {}) {
Tex... | 2020/04/22 | [
"https://Stackoverflow.com/questions/61362534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13342633/"
] | What you describe is called "Code Folding" and can be accessed in multiple ways:
* (Menu) Editor > Code Folding > Fold
[](https://i.stack.imgur.com/KA8Wj.png)
* By clicking the left ribbon of the scope you want to fold
[![enter image description here]... | Ctrl + Alt + Cmd + ← (arrow left)| collapse method
Ctrl + Alt + Cmd + → (arrow right) | expand metnod |
35,089,329 | So I'm trying to make it so that when a user clicks one of the options, nothing happens, but the second they click select an option on the other selector (whose value isn't empty), the page will instantly submit. I know I could use a submit button, but I really dislike those.
Does anyone know how to fix this?
Here's... | 2016/01/29 | [
"https://Stackoverflow.com/questions/35089329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5838614/"
] | You are only checking on page load
You need to check within a change event handler after user has selected
```
$(document).ready(function() {
$('#select,#select2').on('change', function() {
if ($('#select').val() && $('#select2').val()) {
alert("aa");
$('#formID').submit();
}
});
});
``` | Rather than checking on document ready you need to check on change. So when the drop down is changed check if both have a value.
Updated fiddle : <https://jsfiddle.net/bcknhe36/4/>
```
$(document).ready(function() {
$( "#select,#select2" ).change(function() {
if ($('#select').val() && $('#select2').val()) {
al... |
43,601,085 | I have a code below which copies a specific worksheets form all active or open workbooks.
But how to copy the same Worksheet without opening the workbooks, like if we can provide the path in the code , it should be able to pick the given worksheet from all the workbooks form that path.
Below is the code that am cur... | 2017/04/25 | [
"https://Stackoverflow.com/questions/43601085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7877763/"
] | *Work with **[Workbooks.Open Method](https://msdn.microsoft.com/en-us/library/office/ff193498.aspx)** to open it in in the background, and hide any alerts with Application / ScreenUpdating / EnableEvents / DisplayAlerts*
---
>
> [Application.ScreenUpdating Property (Excel)](https://msdn.microsoft.com/en-us/library... | I am assuming that you don't want to display the opened workbook to the user so the operation is not visible on screen.
If that's the case, you can use the following line before your code
```
Application.ScreenUpdating = False
'open the new/target excel workbook and put all the sheets in there
```
And followi... |
43,601,085 | I have a code below which copies a specific worksheets form all active or open workbooks.
But how to copy the same Worksheet without opening the workbooks, like if we can provide the path in the code , it should be able to pick the given worksheet from all the workbooks form that path.
Below is the code that am cur... | 2017/04/25 | [
"https://Stackoverflow.com/questions/43601085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7877763/"
] | *Work with **[Workbooks.Open Method](https://msdn.microsoft.com/en-us/library/office/ff193498.aspx)** to open it in in the background, and hide any alerts with Application / ScreenUpdating / EnableEvents / DisplayAlerts*
---
>
> [Application.ScreenUpdating Property (Excel)](https://msdn.microsoft.com/en-us/library... | It seems then that you have to manually open the workbooks. You can automate this process in VBA as follows;
```
Sub CopySheets1()
Dim wkb As Workbook
Dim dirPath As String ' Path to the directory with workbooks
dim wkbName as String
dirPath="C:\folder\"
sWksName = "SHEET NAME"
wkbName=Dir(dirPath & "*.xlsx")
```... |
351,123 | Anyone knows where I can get list of Autonomous system number users by country ?
If it is not possible to get it by country, any kind of list will suffice.
thnx | 2012/01/18 | [
"https://serverfault.com/questions/351123",
"https://serverfault.com",
"https://serverfault.com/users/107439/"
] | One good list can be found at: <http://bgp.potaroo.net/cidr/autnums.html>
Its harder to get them sorted by "country" since lots of organisations span several continents and might use the same AS globally, but the world is split up into regional registries so you can see atleast what region gave out the specific AS num... | You can get all AS-numbers registered to a given country using the services on [cc2asn.com](http://www.cc2asn.com). Input a two-letter country code (ISO 3166-1 Alpha-2), and all ASNs are returned. Options available to get IPv4 or IPv6 prefixes. Examples:
Using **whois** to get all ASNs for Sweden:
```
whois -h cc2asn... |
351,123 | Anyone knows where I can get list of Autonomous system number users by country ?
If it is not possible to get it by country, any kind of list will suffice.
thnx | 2012/01/18 | [
"https://serverfault.com/questions/351123",
"https://serverfault.com",
"https://serverfault.com/users/107439/"
] | One good list can be found at: <http://bgp.potaroo.net/cidr/autnums.html>
Its harder to get them sorted by "country" since lots of organisations span several continents and might use the same AS globally, but the world is split up into regional registries so you can see atleast what region gave out the specific AS num... | The [ipinfo.io country reports](http://ipinfo.io/countries) include a list of all of the ASNs for each country. The screenshot below shows the data for Brazil, which is available at <http://ipinfo.io/countries/br>
[](https://i.stack.imgur.com/zI51b.png) |
351,123 | Anyone knows where I can get list of Autonomous system number users by country ?
If it is not possible to get it by country, any kind of list will suffice.
thnx | 2012/01/18 | [
"https://serverfault.com/questions/351123",
"https://serverfault.com",
"https://serverfault.com/users/107439/"
] | You can get all AS-numbers registered to a given country using the services on [cc2asn.com](http://www.cc2asn.com). Input a two-letter country code (ISO 3166-1 Alpha-2), and all ASNs are returned. Options available to get IPv4 or IPv6 prefixes. Examples:
Using **whois** to get all ASNs for Sweden:
```
whois -h cc2asn... | The [ipinfo.io country reports](http://ipinfo.io/countries) include a list of all of the ASNs for each country. The screenshot below shows the data for Brazil, which is available at <http://ipinfo.io/countries/br>
[](https://i.stack.imgur.com/zI51b.png) |
29,890,581 | It is not clear the logic behind this PHP code to give out the answer 19. How can the answer be 19? What is the logic?
```
$i=5;
$i +=$i++ + ++$i;
echo $i;
``` | 2015/04/27 | [
"https://Stackoverflow.com/questions/29890581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4485052/"
] | ```
$i=5;
$i +=$i++ + ++$i;
^
Take value of $i as 5 then increment to 6
^
increment value of $i from 6 to 7, and use the 7
^
5 + 7 = 12
^ $i is already 7, because of the increments in the previous operations,
so add the 12 we've just calculated, giving 1... | First, let's consider the following code:
```
<?php
$e = 0;
$e += ++$e;
echo $e;
```
Will the output be `2`, or will it be `1`?
One the second line, the right hand side of the equation `++$e;` will increment the value of `$e`, making `$e` (temporarily) equal 1.
When the left hand side of the equation is run, `$e`... |
29,890,581 | It is not clear the logic behind this PHP code to give out the answer 19. How can the answer be 19? What is the logic?
```
$i=5;
$i +=$i++ + ++$i;
echo $i;
``` | 2015/04/27 | [
"https://Stackoverflow.com/questions/29890581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4485052/"
] | ```
$i=5;
$i +=$i++ + ++$i;
^
Take value of $i as 5 then increment to 6
^
increment value of $i from 6 to 7, and use the 7
^
5 + 7 = 12
^ $i is already 7, because of the increments in the previous operations,
so add the 12 we've just calculated, giving 1... | ```
$i += $i++ + ++$i ;
$i = $i + ($i+1 + 1+$i);
19 = 7 + (5 + 7);
``` |
29,890,581 | It is not clear the logic behind this PHP code to give out the answer 19. How can the answer be 19? What is the logic?
```
$i=5;
$i +=$i++ + ++$i;
echo $i;
``` | 2015/04/27 | [
"https://Stackoverflow.com/questions/29890581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4485052/"
] | First, let's consider the following code:
```
<?php
$e = 0;
$e += ++$e;
echo $e;
```
Will the output be `2`, or will it be `1`?
One the second line, the right hand side of the equation `++$e;` will increment the value of `$e`, making `$e` (temporarily) equal 1.
When the left hand side of the equation is run, `$e`... | ```
$i += $i++ + ++$i ;
$i = $i + ($i+1 + 1+$i);
19 = 7 + (5 + 7);
``` |
7,448,976 | Why if I create a local repository, then create a github repository and then add that as remote, I commit to local and then I push to remote, but I have no ability to pull from remote to local?
If I add remote using git bash all is well remote is properly configured and I can pull, and push and fetch to upstream but ... | 2011/09/16 | [
"https://Stackoverflow.com/questions/7448976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1031362/"
] | simply add
```
[branch "master"]
remote = origin
merge = refs/heads/master
```
into .git/config
to pull from origin/master into master | There's a discussion on this providing a proposed solution, and pointing to a bugzilla bug report at <http://www.eclipse.org/forums/index.php/m/683377/> .
In short, the issue seems to be that the Egit system does not know which branch on the remote corresponds to the master branch in eclipse, and the solution is addin... |
7,448,976 | Why if I create a local repository, then create a github repository and then add that as remote, I commit to local and then I push to remote, but I have no ability to pull from remote to local?
If I add remote using git bash all is well remote is properly configured and I can pull, and push and fetch to upstream but ... | 2011/09/16 | [
"https://Stackoverflow.com/questions/7448976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1031362/"
] | There's a discussion on this providing a proposed solution, and pointing to a bugzilla bug report at <http://www.eclipse.org/forums/index.php/m/683377/> .
In short, the issue seems to be that the Egit system does not know which branch on the remote corresponds to the master branch in eclipse, and the solution is addin... | The change in the config file didnt work in my case.
So I deleted the local project after the initial push and did a pull afterwards. Now everything's fine. |
7,448,976 | Why if I create a local repository, then create a github repository and then add that as remote, I commit to local and then I push to remote, but I have no ability to pull from remote to local?
If I add remote using git bash all is well remote is properly configured and I can pull, and push and fetch to upstream but ... | 2011/09/16 | [
"https://Stackoverflow.com/questions/7448976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1031362/"
] | You can do this in the "Git Repositories" tab.
>
> Window > Show view > Other... > Git > Git Repositories
>
>
>
Expend your project's repository > Right click on "Remotes" > Create Remote... | There's a discussion on this providing a proposed solution, and pointing to a bugzilla bug report at <http://www.eclipse.org/forums/index.php/m/683377/> .
In short, the issue seems to be that the Egit system does not know which branch on the remote corresponds to the master branch in eclipse, and the solution is addin... |
7,448,976 | Why if I create a local repository, then create a github repository and then add that as remote, I commit to local and then I push to remote, but I have no ability to pull from remote to local?
If I add remote using git bash all is well remote is properly configured and I can pull, and push and fetch to upstream but ... | 2011/09/16 | [
"https://Stackoverflow.com/questions/7448976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1031362/"
] | simply add
```
[branch "master"]
remote = origin
merge = refs/heads/master
```
into .git/config
to pull from origin/master into master | The change in the config file didnt work in my case.
So I deleted the local project after the initial push and did a pull afterwards. Now everything's fine. |
7,448,976 | Why if I create a local repository, then create a github repository and then add that as remote, I commit to local and then I push to remote, but I have no ability to pull from remote to local?
If I add remote using git bash all is well remote is properly configured and I can pull, and push and fetch to upstream but ... | 2011/09/16 | [
"https://Stackoverflow.com/questions/7448976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1031362/"
] | simply add
```
[branch "master"]
remote = origin
merge = refs/heads/master
```
into .git/config
to pull from origin/master into master | You can do this in the "Git Repositories" tab.
>
> Window > Show view > Other... > Git > Git Repositories
>
>
>
Expend your project's repository > Right click on "Remotes" > Create Remote... |
7,448,976 | Why if I create a local repository, then create a github repository and then add that as remote, I commit to local and then I push to remote, but I have no ability to pull from remote to local?
If I add remote using git bash all is well remote is properly configured and I can pull, and push and fetch to upstream but ... | 2011/09/16 | [
"https://Stackoverflow.com/questions/7448976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1031362/"
] | You can do this in the "Git Repositories" tab.
>
> Window > Show view > Other... > Git > Git Repositories
>
>
>
Expend your project's repository > Right click on "Remotes" > Create Remote... | The change in the config file didnt work in my case.
So I deleted the local project after the initial push and did a pull afterwards. Now everything's fine. |
33,478,902 | My code for finding reverse by recursion says **Segmentation Fault**
Why?And how to find reverse by recursion?
What is wrong with my code?
```
#include<stdio.h>
int rev(int);
main()
{
int a,b;
scanf("%d",&a);
b=rev(a);
printf("%d",b);
}
int rev(int x)
{
int q,r;
static int p=0;
p=p*10+(x%1... | 2015/11/02 | [
"https://Stackoverflow.com/questions/33478902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5516017/"
] | You are using `q=rev(r);` without any conditions, i.e. you jump deeper and deeper into the recursive calls, and this never ends.
In the end, you get a stack overflow. | Add any breaking condition in your code in you rev() function
```
if x == 0:
return 0
``` |
33,478,902 | My code for finding reverse by recursion says **Segmentation Fault**
Why?And how to find reverse by recursion?
What is wrong with my code?
```
#include<stdio.h>
int rev(int);
main()
{
int a,b;
scanf("%d",&a);
b=rev(a);
printf("%d",b);
}
int rev(int x)
{
int q,r;
static int p=0;
p=p*10+(x%1... | 2015/11/02 | [
"https://Stackoverflow.com/questions/33478902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5516017/"
] | A recursive function needs a way to know when the recursion ends. This is referred to as the **base case**. Without a base case, the recursion will keep happening until you run out of stack space, which typically causes your program to crash.
For your code, you want to get out when the argument is 0. So you need to to... | Add any breaking condition in your code in you rev() function
```
if x == 0:
return 0
``` |
14,557,473 | in my android application there is group of buttons.i have given them id as b1,b2,b3...
and using random function i'm generating a number and by using that number i'm changing button image.
ex. if random number is 6.then i want to change image of button whose id is b6.
how can i create id b6 using integer 6 and b and p... | 2013/01/28 | [
"https://Stackoverflow.com/questions/14557473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1501644/"
] | You can simply declare an array with all the button IDs like that:
```
int[] buttonIds = new int[] {R.b1, R.b2, ...};
```
and use it to access the ID of a random button:
```
num = rand.nextInt(buttonIds.length);
int buttonId = buttonIds[num];
findViewById(buttonId).doSomething();
```
But it'll be tedious if the n... | The Resources class has this method:
```
public int getIdentifier (String name, String defType, String defPackage)
```
Have a look at it. |
29,404,532 | this is the URL im
```
http://127.0.0.1/vikum/symfony/web/index.php/messenger/getConversation
```
using i need to get the URL up to
```
http://127.0.0.1/vikum/symfony/web/index.php/messenger/
```
how to do this in javascript
remember that the number of / may change what i need is to the point before last / | 2015/04/02 | [
"https://Stackoverflow.com/questions/29404532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4121294/"
] | You can use [lastIndexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf) to get the position of the last forward slash and then use [substring()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring) to get the url subs... | You can use:
```
url.substring(0,url.lastIndexOf('/') + 1);
``` |
595,867 | How do I configure Ruby on Rails to output standard HTML code instead of XHTML when using helpers (form, javascript, css, etc.)?
I **don't** want to have the slash at the end:
```
<input name="email" type="text" />
``` | 2009/02/27 | [
"https://Stackoverflow.com/questions/595867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | This answer is contained in the link provided by MarkusQ, but I figured I could spell it out exactly.
You have to modify the code than renders all tags, you can do that by including the following code into something like lib/dont\_use\_xhtml.rb
```
module ActionView::Helpers::TagHelper
alias :tag_without_backslash ... | See <http://railsforum.com/viewtopic.php?id=21941>
-- MarkusQ |
595,867 | How do I configure Ruby on Rails to output standard HTML code instead of XHTML when using helpers (form, javascript, css, etc.)?
I **don't** want to have the slash at the end:
```
<input name="email" type="text" />
``` | 2009/02/27 | [
"https://Stackoverflow.com/questions/595867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | The solution does not work with the latest version of Rails. Some helpers will override the open method argument of 'open' to 'false'.
The following works for me in Rails 2.3.5:
```
module ActionView::Helpers::TagHelper
def tag_with_html_patch(name, options = nil, open = true, escape = true)
tag_without_html_pa... | See <http://railsforum.com/viewtopic.php?id=21941>
-- MarkusQ |
595,867 | How do I configure Ruby on Rails to output standard HTML code instead of XHTML when using helpers (form, javascript, css, etc.)?
I **don't** want to have the slash at the end:
```
<input name="email" type="text" />
``` | 2009/02/27 | [
"https://Stackoverflow.com/questions/595867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | See <http://railsforum.com/viewtopic.php?id=21941>
-- MarkusQ | For rails `2.3`:
Install the gem `haml` then add the following initializer `config/initializers/force_html4.rb`:
```
Haml::Template::options[:format] = :html4
module StandardistaHelper
def tag(name, options = nil, open = false, escape = true)
"<#{name}#{tag_options(options, escape) if options}>"
end
end
Act... |
595,867 | How do I configure Ruby on Rails to output standard HTML code instead of XHTML when using helpers (form, javascript, css, etc.)?
I **don't** want to have the slash at the end:
```
<input name="email" type="text" />
``` | 2009/02/27 | [
"https://Stackoverflow.com/questions/595867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | This answer is contained in the link provided by MarkusQ, but I figured I could spell it out exactly.
You have to modify the code than renders all tags, you can do that by including the following code into something like lib/dont\_use\_xhtml.rb
```
module ActionView::Helpers::TagHelper
alias :tag_without_backslash ... | The solution does not work with the latest version of Rails. Some helpers will override the open method argument of 'open' to 'false'.
The following works for me in Rails 2.3.5:
```
module ActionView::Helpers::TagHelper
def tag_with_html_patch(name, options = nil, open = true, escape = true)
tag_without_html_pa... |
595,867 | How do I configure Ruby on Rails to output standard HTML code instead of XHTML when using helpers (form, javascript, css, etc.)?
I **don't** want to have the slash at the end:
```
<input name="email" type="text" />
``` | 2009/02/27 | [
"https://Stackoverflow.com/questions/595867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | This answer is contained in the link provided by MarkusQ, but I figured I could spell it out exactly.
You have to modify the code than renders all tags, you can do that by including the following code into something like lib/dont\_use\_xhtml.rb
```
module ActionView::Helpers::TagHelper
alias :tag_without_backslash ... | For rails `2.3`:
Install the gem `haml` then add the following initializer `config/initializers/force_html4.rb`:
```
Haml::Template::options[:format] = :html4
module StandardistaHelper
def tag(name, options = nil, open = false, escape = true)
"<#{name}#{tag_options(options, escape) if options}>"
end
end
Act... |
595,867 | How do I configure Ruby on Rails to output standard HTML code instead of XHTML when using helpers (form, javascript, css, etc.)?
I **don't** want to have the slash at the end:
```
<input name="email" type="text" />
``` | 2009/02/27 | [
"https://Stackoverflow.com/questions/595867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21473/"
] | The solution does not work with the latest version of Rails. Some helpers will override the open method argument of 'open' to 'false'.
The following works for me in Rails 2.3.5:
```
module ActionView::Helpers::TagHelper
def tag_with_html_patch(name, options = nil, open = true, escape = true)
tag_without_html_pa... | For rails `2.3`:
Install the gem `haml` then add the following initializer `config/initializers/force_html4.rb`:
```
Haml::Template::options[:format] = :html4
module StandardistaHelper
def tag(name, options = nil, open = false, escape = true)
"<#{name}#{tag_options(options, escape) if options}>"
end
end
Act... |
1,332,454 | >
> Let $V$ be a vector space over a field $\mathbb K$ and $f$ be a nonnegative Hermitian form on $V$. Then, $\forall x,y \in V$:
>
>
> $$|f(x,y)|^2 \le f(x,x)f(y,y)$$
>
>
>
Here's one proof:
For an arbitrary $\alpha \in \mathbb K$, compute: $f(x + \alpha y, x + \alpha y)$ and $f(\alpha x + y, \alpha x + y)$ an... | 2015/06/20 | [
"https://math.stackexchange.com/questions/1332454",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | *I'm modifiyng Bernard's approach for nonnegative Hermitian form.*
Let $t\in \mathbb R$ and $\mathbb K \in \{ \mathbb R,\mathbb C \}$ , then $$0\leq f(tx+y,tx+y)=t^2f(x,x)+t(f(x,y)+\overline{f(x,y)})+h(y,y)$$
Since $z+\overline z = 2Re(z)$, it follows
$$0\leq f(tx+y,tx+y)=t^2f(x,x)+2tRe(f(x,y))+h(y,y).$$
It's discr... | You have alternate (and simpler) proofs on [Cauchy-Schwarz wikipedia](https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality#Proof) |
1,332,454 | >
> Let $V$ be a vector space over a field $\mathbb K$ and $f$ be a nonnegative Hermitian form on $V$. Then, $\forall x,y \in V$:
>
>
> $$|f(x,y)|^2 \le f(x,x)f(y,y)$$
>
>
>
Here's one proof:
For an arbitrary $\alpha \in \mathbb K$, compute: $f(x + \alpha y, x + \alpha y)$ and $f(\alpha x + y, \alpha x + y)$ an... | 2015/06/20 | [
"https://math.stackexchange.com/questions/1332454",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | *I'm modifiyng Bernard's approach for nonnegative Hermitian form.*
Let $t\in \mathbb R$ and $\mathbb K \in \{ \mathbb R,\mathbb C \}$ , then $$0\leq f(tx+y,tx+y)=t^2f(x,x)+t(f(x,y)+\overline{f(x,y)})+h(y,y)$$
Since $z+\overline z = 2Re(z)$, it follows
$$0\leq f(tx+y,tx+y)=t^2f(x,x)+2tRe(f(x,y))+h(y,y).$$
It's discr... | Same idea, but somewhat simpler:
$$f(\alpha x+y,\alpha x+y)\ge 0\iff \alpha^2f(x,x)+2\alpha f(x,y)+f(y,y)\ge 0. $$
Now, if $f(x,x)\neq 0$, this is a quadratic polynomial in $\alpha$ which is nonnegative for all $\alpha$, so its reduced discriminant:
$$\Delta'=\bigl(f(x,y)\bigr)^2-f(x,x)f(y,y)\le 0.$$
If $f(x,x)=0$, th... |
14,417,660 | I am trying to create a loop with the switch statement. If user does not enter between 1 and 4 a message of "You enter incorrect option" keeps re-occurring. I am working on Lynda video. I am not sure where to put the loop. I cannot currently find a way to get it to loop. Is it in the switch or in the getInput method. I... | 2013/01/19 | [
"https://Stackoverflow.com/questions/14417660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/364712/"
] | Put `switch-case` inside loop.
```
do{
String op = getInput("Enter 1=Add, 2=Subtract, 3=Multiply,
4=Divide");
int opInt = Integer.parseInt(op);
switch(opInt){
case 1: ... break;
case 2: ... break;
case 3: ... break;
case 4: ... break;
}
}while(opInt<1 || opInt >4);
``` | In case you don't change the opInt variable:
```
while(opInt < 1 || opInt > 4)
{
switch (opInt)
{
case 1:
break;
case 2:
break;
default:
}
}
``` |
14,417,660 | I am trying to create a loop with the switch statement. If user does not enter between 1 and 4 a message of "You enter incorrect option" keeps re-occurring. I am working on Lynda video. I am not sure where to put the loop. I cannot currently find a way to get it to loop. Is it in the switch or in the getInput method. I... | 2013/01/19 | [
"https://Stackoverflow.com/questions/14417660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/364712/"
] | Put it around the last getInput call, the one reading the user's option.
LE:
This is what I originally meant.
```
String s1 = getInput("Enter a numeric value: ");
String s2 = getInput("Enter a numeric value: ");
int opInt = 0;
do {
String op = getInput("Enter 1=Add, 2=Subtract, 3=Multiply, 4=Divide");
tr... | In case you don't change the opInt variable:
```
while(opInt < 1 || opInt > 4)
{
switch (opInt)
{
case 1:
break;
case 2:
break;
default:
}
}
``` |
39,237 | With Natty, the default music-player changed from Rhythmbox to Banshee. While my music seems to have moved along, the podcasts didn't. I have therefore two questions :
* How can I listen the podcasts I downloaded with Rhythmbox from Banshee ?
* How can I ask Banshee to automatically download the podcasts Rhythmbox was... | 2011/05/02 | [
"https://askubuntu.com/questions/39237",
"https://askubuntu.com",
"https://askubuntu.com/users/6963/"
] | Someone already reported the bug to the ubuntu makers: [Bug #857243: (oneiric) mplayer does not install .desktop file and does not have an icon](https://bugs.launchpad.net/ubuntu/+source/mplayer/+bug/857243).
---
To add an icon manually, create a file `~/.local/share/applications/mplayer.desktop` and put the followin... | try using UMplayer its mplayer with a nice ui,or make a launcher and add a icon of your choice,right click on the desktop than make new launcher give it a name and a command,then click on the little icon and browse for a new icon of your liking,form there drag and drop it into the unity launcher and put the launcher th... |
35,909 | Brass bands were being discussed today which naturally led to someone claiming to be *brassed off* about something, meaning disgruntled or annoyed. Does anyone know the origin of this expression? Michael Quinion over at [World Wide Words](http://www.worldwidewords.org/qa/qa-bra2.htm) suggests the phrase may have arisen... | 2011/07/28 | [
"https://english.stackexchange.com/questions/35909",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/305/"
] | Eric Partridge, *A Dictionary of Slang and Unconventional English*, fifth edition (1961) has this roundabout explanation for the origin of the phrase:
>
> **brass off,** *v.i.* To grumble : military : C. 20. F[raser] & Gibbons[, *Soldier and Sailor Words and Phrases* (1925)]. Perhaps ex *part brass-rags*.
>
>
>
A... | "Top Brass" meant command, because of their brass insignia. "Brassed Off" might mean told off by military authority, in a slang sense. |
35,909 | Brass bands were being discussed today which naturally led to someone claiming to be *brassed off* about something, meaning disgruntled or annoyed. Does anyone know the origin of this expression? Michael Quinion over at [World Wide Words](http://www.worldwidewords.org/qa/qa-bra2.htm) suggests the phrase may have arisen... | 2011/07/28 | [
"https://english.stackexchange.com/questions/35909",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/305/"
] | This NGram suggests **brassed off** came later than **brass monkey**, as used in the expression *cold enough to freeze the balls/nose off a brass monkey*. I know some of the earlier usages for *brass monkey* here don't actually have that figurative meaning, but plenty do.
In light of that, I would simply say that "bra... | My understanding of the phrase is that it originated from the practise of sharpening an engineer's twist drill. The sharp cutting edge was dulled. Otherwise the sharp cutting edge would bite into the brass and chatter. If the cutting edge was removed it could cut into brass sheet or solid bar without any trouble. Hence... |
35,909 | Brass bands were being discussed today which naturally led to someone claiming to be *brassed off* about something, meaning disgruntled or annoyed. Does anyone know the origin of this expression? Michael Quinion over at [World Wide Words](http://www.worldwidewords.org/qa/qa-bra2.htm) suggests the phrase may have arisen... | 2011/07/28 | [
"https://english.stackexchange.com/questions/35909",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/305/"
] | This NGram suggests **brassed off** came later than **brass monkey**, as used in the expression *cold enough to freeze the balls/nose off a brass monkey*. I know some of the earlier usages for *brass monkey* here don't actually have that figurative meaning, but plenty do.
In light of that, I would simply say that "bra... | Eric Partridge, *A Dictionary of Slang and Unconventional English*, fifth edition (1961) has this roundabout explanation for the origin of the phrase:
>
> **brass off,** *v.i.* To grumble : military : C. 20. F[raser] & Gibbons[, *Soldier and Sailor Words and Phrases* (1925)]. Perhaps ex *part brass-rags*.
>
>
>
A... |
35,909 | Brass bands were being discussed today which naturally led to someone claiming to be *brassed off* about something, meaning disgruntled or annoyed. Does anyone know the origin of this expression? Michael Quinion over at [World Wide Words](http://www.worldwidewords.org/qa/qa-bra2.htm) suggests the phrase may have arisen... | 2011/07/28 | [
"https://english.stackexchange.com/questions/35909",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/305/"
] | The OED reckons it came from "Service slang", and cites 'browned off' as a comparison. The earliest use there is 1941; taken together with the Ngram, this leads me to believe it arose suddenly and untraceably, as slang does, among the troops (probably the RAF, who were very inventive in such matters), and proved so use... | My understanding of the phrase is that it originated from the practise of sharpening an engineer's twist drill. The sharp cutting edge was dulled. Otherwise the sharp cutting edge would bite into the brass and chatter. If the cutting edge was removed it could cut into brass sheet or solid bar without any trouble. Hence... |
35,909 | Brass bands were being discussed today which naturally led to someone claiming to be *brassed off* about something, meaning disgruntled or annoyed. Does anyone know the origin of this expression? Michael Quinion over at [World Wide Words](http://www.worldwidewords.org/qa/qa-bra2.htm) suggests the phrase may have arisen... | 2011/07/28 | [
"https://english.stackexchange.com/questions/35909",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/305/"
] | Eric Partridge, *A Dictionary of Slang and Unconventional English*, fifth edition (1961) has this roundabout explanation for the origin of the phrase:
>
> **brass off,** *v.i.* To grumble : military : C. 20. F[raser] & Gibbons[, *Soldier and Sailor Words and Phrases* (1925)]. Perhaps ex *part brass-rags*.
>
>
>
A... | Brassed off comes from the over cleaning of brass, with a rag and abrasive polish, which resulted in the brass being rubbed through to the base metal underneath the brass coating, and certainly a centaury before the nineteen thirty’s as some ‘experts’ suggest. |
35,909 | Brass bands were being discussed today which naturally led to someone claiming to be *brassed off* about something, meaning disgruntled or annoyed. Does anyone know the origin of this expression? Michael Quinion over at [World Wide Words](http://www.worldwidewords.org/qa/qa-bra2.htm) suggests the phrase may have arisen... | 2011/07/28 | [
"https://english.stackexchange.com/questions/35909",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/305/"
] | The OED reckons it came from "Service slang", and cites 'browned off' as a comparison. The earliest use there is 1941; taken together with the Ngram, this leads me to believe it arose suddenly and untraceably, as slang does, among the troops (probably the RAF, who were very inventive in such matters), and proved so use... | Brassed off comes from the over cleaning of brass, with a rag and abrasive polish, which resulted in the brass being rubbed through to the base metal underneath the brass coating, and certainly a centaury before the nineteen thirty’s as some ‘experts’ suggest. |
35,909 | Brass bands were being discussed today which naturally led to someone claiming to be *brassed off* about something, meaning disgruntled or annoyed. Does anyone know the origin of this expression? Michael Quinion over at [World Wide Words](http://www.worldwidewords.org/qa/qa-bra2.htm) suggests the phrase may have arisen... | 2011/07/28 | [
"https://english.stackexchange.com/questions/35909",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/305/"
] | The OED reckons it came from "Service slang", and cites 'browned off' as a comparison. The earliest use there is 1941; taken together with the Ngram, this leads me to believe it arose suddenly and untraceably, as slang does, among the troops (probably the RAF, who were very inventive in such matters), and proved so use... | "Top Brass" meant command, because of their brass insignia. "Brassed Off" might mean told off by military authority, in a slang sense. |
35,909 | Brass bands were being discussed today which naturally led to someone claiming to be *brassed off* about something, meaning disgruntled or annoyed. Does anyone know the origin of this expression? Michael Quinion over at [World Wide Words](http://www.worldwidewords.org/qa/qa-bra2.htm) suggests the phrase may have arisen... | 2011/07/28 | [
"https://english.stackexchange.com/questions/35909",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/305/"
] | "Top Brass" meant command, because of their brass insignia. "Brassed Off" might mean told off by military authority, in a slang sense. | Brassed off comes from the over cleaning of brass, with a rag and abrasive polish, which resulted in the brass being rubbed through to the base metal underneath the brass coating, and certainly a centaury before the nineteen thirty’s as some ‘experts’ suggest. |
35,909 | Brass bands were being discussed today which naturally led to someone claiming to be *brassed off* about something, meaning disgruntled or annoyed. Does anyone know the origin of this expression? Michael Quinion over at [World Wide Words](http://www.worldwidewords.org/qa/qa-bra2.htm) suggests the phrase may have arisen... | 2011/07/28 | [
"https://english.stackexchange.com/questions/35909",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/305/"
] | "Top Brass" meant command, because of their brass insignia. "Brassed Off" might mean told off by military authority, in a slang sense. | My understanding of the phrase is that it originated from the practise of sharpening an engineer's twist drill. The sharp cutting edge was dulled. Otherwise the sharp cutting edge would bite into the brass and chatter. If the cutting edge was removed it could cut into brass sheet or solid bar without any trouble. Hence... |
35,909 | Brass bands were being discussed today which naturally led to someone claiming to be *brassed off* about something, meaning disgruntled or annoyed. Does anyone know the origin of this expression? Michael Quinion over at [World Wide Words](http://www.worldwidewords.org/qa/qa-bra2.htm) suggests the phrase may have arisen... | 2011/07/28 | [
"https://english.stackexchange.com/questions/35909",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/305/"
] | This NGram suggests **brassed off** came later than **brass monkey**, as used in the expression *cold enough to freeze the balls/nose off a brass monkey*. I know some of the earlier usages for *brass monkey* here don't actually have that figurative meaning, but plenty do.
In light of that, I would simply say that "bra... | "Top Brass" meant command, because of their brass insignia. "Brassed Off" might mean told off by military authority, in a slang sense. |
19,743,228 | I have tried using kinetic.js and the code below, however when I try this in IE11 it keeps jumping to the top every time I scroll:
```
$("html").kinetic();
```
I want to make the page scrollable on tablets and IE10 and 11 so that users can just push the page up to scroll down as you would on mobile devices.
How ca... | 2013/11/02 | [
"https://Stackoverflow.com/questions/19743228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2875977/"
] | Base on Rory McCrossan's idea, implemented with AngularJS2.
```
import {Directive, ElementRef, OnDestroy, Input} from "@angular/core";
declare var jQuery: any;
@Directive({
selector: '[appDragScroll]'
})
export class DragScrollDirective implements OnDestroy {
@Input() scrollVertical: boolean = true;
@In... | Here follows a simple scroll solution based on a class for individual elements
```
var cursordown = false;
var cursorypos = 0;
var cursorxpos = 0;
$('.cursorgrab').mousedown(function(e){
cursordown = true;
cursorxpos = $(this).scrollLeft() + e.clientX;
cursorypos = $(t... |
19,743,228 | I have tried using kinetic.js and the code below, however when I try this in IE11 it keeps jumping to the top every time I scroll:
```
$("html").kinetic();
```
I want to make the page scrollable on tablets and IE10 and 11 so that users can just push the page up to scroll down as you would on mobile devices.
How ca... | 2013/11/02 | [
"https://Stackoverflow.com/questions/19743228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2875977/"
] | I just like to add. Using Rory's code I made horizontal scrolling.
```
var clicked = false, base = 0;
$('#someDiv').on({
mousemove: function(e) {
clicked && function(xAxis) {
var _this = $(this);
if(base > xAxis) {
base = xAxis;
_this.css('margin-lef... | Based on the first answer, this is the code for horizontal scroll on mouse drag:
```
var clicked = false, clickX;
$(document).on({
'mousemove': function(e) {
clicked && updateScrollPos(e);
},
'mousedown': function(e) {
e.preventDefault();
clicked = true;
clickX = e.p... |
19,743,228 | I have tried using kinetic.js and the code below, however when I try this in IE11 it keeps jumping to the top every time I scroll:
```
$("html").kinetic();
```
I want to make the page scrollable on tablets and IE10 and 11 so that users can just push the page up to scroll down as you would on mobile devices.
How ca... | 2013/11/02 | [
"https://Stackoverflow.com/questions/19743228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2875977/"
] | This code will work on horizontal and vertical mouse drag scroll. It's pretty simple.
```
var curYPos = 0,
curXPos = 0,
curDown = false;
window.addEventListener('mousemove', function(e){
if(curDown === true){
window.scrollTo(document.body.scrollLeft + (curXPos - e.pageX), document.body.scrollTop + (cur... | Base on Rory McCrossan's idea, implemented with AngularJS2.
```
import {Directive, ElementRef, OnDestroy, Input} from "@angular/core";
declare var jQuery: any;
@Directive({
selector: '[appDragScroll]'
})
export class DragScrollDirective implements OnDestroy {
@Input() scrollVertical: boolean = true;
@In... |
19,743,228 | I have tried using kinetic.js and the code below, however when I try this in IE11 it keeps jumping to the top every time I scroll:
```
$("html").kinetic();
```
I want to make the page scrollable on tablets and IE10 and 11 so that users can just push the page up to scroll down as you would on mobile devices.
How ca... | 2013/11/02 | [
"https://Stackoverflow.com/questions/19743228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2875977/"
] | I just like to add. Using Rory's code I made horizontal scrolling.
```
var clicked = false, base = 0;
$('#someDiv').on({
mousemove: function(e) {
clicked && function(xAxis) {
var _this = $(this);
if(base > xAxis) {
base = xAxis;
_this.css('margin-lef... | Base on Rory McCrossan's idea, implemented with AngularJS2.
```
import {Directive, ElementRef, OnDestroy, Input} from "@angular/core";
declare var jQuery: any;
@Directive({
selector: '[appDragScroll]'
})
export class DragScrollDirective implements OnDestroy {
@Input() scrollVertical: boolean = true;
@In... |
19,743,228 | I have tried using kinetic.js and the code below, however when I try this in IE11 it keeps jumping to the top every time I scroll:
```
$("html").kinetic();
```
I want to make the page scrollable on tablets and IE10 and 11 so that users can just push the page up to scroll down as you would on mobile devices.
How ca... | 2013/11/02 | [
"https://Stackoverflow.com/questions/19743228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2875977/"
] | This code will work on horizontal and vertical mouse drag scroll. It's pretty simple.
```
var curYPos = 0,
curXPos = 0,
curDown = false;
window.addEventListener('mousemove', function(e){
if(curDown === true){
window.scrollTo(document.body.scrollLeft + (curXPos - e.pageX), document.body.scrollTop + (cur... | This framework is written in vanilla javascript, and worked best for me.
It also supports scroller inside divs.
Note: If you create dynamic content, call `dragscroll.reset();` after render.
[dragscroll](https://github.com/asvd/dragscroll)
[Usage](https://github.com/asvd/dragscroll#usage)
[demo](http://asvd.github.... |
19,743,228 | I have tried using kinetic.js and the code below, however when I try this in IE11 it keeps jumping to the top every time I scroll:
```
$("html").kinetic();
```
I want to make the page scrollable on tablets and IE10 and 11 so that users can just push the page up to scroll down as you would on mobile devices.
How ca... | 2013/11/02 | [
"https://Stackoverflow.com/questions/19743228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2875977/"
] | You can do this quite simply by recording the position of the mouse when clicked, and the current position when being dragged. Try this:
```
var clicked = false, clickY;
$(document).on({
'mousemove': function(e) {
clicked && updateScrollPos(e);
},
'mousedown': function(e) {
clicked = true;
... | I just like to add. Using Rory's code I made horizontal scrolling.
```
var clicked = false, base = 0;
$('#someDiv').on({
mousemove: function(e) {
clicked && function(xAxis) {
var _this = $(this);
if(base > xAxis) {
base = xAxis;
_this.css('margin-lef... |
19,743,228 | I have tried using kinetic.js and the code below, however when I try this in IE11 it keeps jumping to the top every time I scroll:
```
$("html").kinetic();
```
I want to make the page scrollable on tablets and IE10 and 11 so that users can just push the page up to scroll down as you would on mobile devices.
How ca... | 2013/11/02 | [
"https://Stackoverflow.com/questions/19743228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2875977/"
] | This code will work on horizontal and vertical mouse drag scroll. It's pretty simple.
```
var curYPos = 0,
curXPos = 0,
curDown = false;
window.addEventListener('mousemove', function(e){
if(curDown === true){
window.scrollTo(document.body.scrollLeft + (curXPos - e.pageX), document.body.scrollTop + (cur... | Here follows a simple scroll solution based on a class for individual elements
```
var cursordown = false;
var cursorypos = 0;
var cursorxpos = 0;
$('.cursorgrab').mousedown(function(e){
cursordown = true;
cursorxpos = $(this).scrollLeft() + e.clientX;
cursorypos = $(t... |
19,743,228 | I have tried using kinetic.js and the code below, however when I try this in IE11 it keeps jumping to the top every time I scroll:
```
$("html").kinetic();
```
I want to make the page scrollable on tablets and IE10 and 11 so that users can just push the page up to scroll down as you would on mobile devices.
How ca... | 2013/11/02 | [
"https://Stackoverflow.com/questions/19743228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2875977/"
] | You can do this quite simply by recording the position of the mouse when clicked, and the current position when being dragged. Try this:
```
var clicked = false, clickY;
$(document).on({
'mousemove': function(e) {
clicked && updateScrollPos(e);
},
'mousedown': function(e) {
clicked = true;
... | Here follows a simple scroll solution based on a class for individual elements
```
var cursordown = false;
var cursorypos = 0;
var cursorxpos = 0;
$('.cursorgrab').mousedown(function(e){
cursordown = true;
cursorxpos = $(this).scrollLeft() + e.clientX;
cursorypos = $(t... |
19,743,228 | I have tried using kinetic.js and the code below, however when I try this in IE11 it keeps jumping to the top every time I scroll:
```
$("html").kinetic();
```
I want to make the page scrollable on tablets and IE10 and 11 so that users can just push the page up to scroll down as you would on mobile devices.
How ca... | 2013/11/02 | [
"https://Stackoverflow.com/questions/19743228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2875977/"
] | I just like to add. Using Rory's code I made horizontal scrolling.
```
var clicked = false, base = 0;
$('#someDiv').on({
mousemove: function(e) {
clicked && function(xAxis) {
var _this = $(this);
if(base > xAxis) {
base = xAxis;
_this.css('margin-lef... | This framework is written in vanilla javascript, and worked best for me.
It also supports scroller inside divs.
Note: If you create dynamic content, call `dragscroll.reset();` after render.
[dragscroll](https://github.com/asvd/dragscroll)
[Usage](https://github.com/asvd/dragscroll#usage)
[demo](http://asvd.github.... |
19,743,228 | I have tried using kinetic.js and the code below, however when I try this in IE11 it keeps jumping to the top every time I scroll:
```
$("html").kinetic();
```
I want to make the page scrollable on tablets and IE10 and 11 so that users can just push the page up to scroll down as you would on mobile devices.
How ca... | 2013/11/02 | [
"https://Stackoverflow.com/questions/19743228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2875977/"
] | I just like to add. Using Rory's code I made horizontal scrolling.
```
var clicked = false, base = 0;
$('#someDiv').on({
mousemove: function(e) {
clicked && function(xAxis) {
var _this = $(this);
if(base > xAxis) {
base = xAxis;
_this.css('margin-lef... | I modified Rory's code quite a bit, and I got per-element side scrolling to work. I needed that for a project that had multiple scrollable tiles in a single view for a webapp. Add the `.drag` class to any element, possibly do a bit of styling, and it should be good to go.
```
// jQuery sidescroll code. Can easily be m... |
69,683,018 | I would like to have it round up to 100 using stringformat, not math.round because the way in the code I can't use math.round. | 2021/10/22 | [
"https://Stackoverflow.com/questions/69683018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2690460/"
] | If you set your precision to a single digit like this, the number will be rounded up to 100.0. You can use string interpolation and not have to specify String.Format like this:
```
Console.WriteLine($"{99.99:0.0}");
``` | If you want to round the number to the nearest integer, you can try:
```
var str = string.Format("{0:.}", 99.99); // Will return "100"
```
If you want to always have one digit after the delimiter, you can change it to:
```
var str = string.Format("{0:.0}", 99.99); // Will return "100.0"
```
You can always check t... |
16,640,785 | It'll be weeks that I'm stuck with EclipseLink. I can not persist an object in my database. I use netbeans 7.3. I encountered this problem when I started designing a web application. What follows is the approach I have adopted. It may be that I do without me realize a mistake.
After that netbeans has finished generati... | 2013/05/20 | [
"https://Stackoverflow.com/questions/16640785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2360354/"
] | ```
range = sin(* angle)*velocity pow(2);
```
This is not valid C++.
`pow` is a function that takes two arguments. x^y would be represented as `pow(x, y)`.
Also, `sin(*angle)` is invalid as `angle` is neither a pointer nor a class with a defined `*` operator.
I think this is what you're looking for:
```
range = s... | You defined `angle` as a double, so you don't want to dereference it by writing `*angle`.
`pow()` takes two arguments, so you probably want to write `pow(velocity,2)`.
`sin(angle)*pow(velocity,2)` should work. I'd recommend `sin(angle)*velocity*velocity`, as you don't need to use `pow(x,2)` if you only want to calculat... |
1,081,658 | I have tried to use the Lebesgue Dominated Convergence Theorem to evaluate:
$$\lim\_{n\rightarrow \infty} \int\_{(0,1]} f\_n \;d\mu $$ with $f\_n(x)=\dfrac{n\sqrt{x}}{1+n^2x^2}$ and $f\_n(x)=\dfrac{n\;x\log(x)}{1+n^2x^2}$.
The problem is I can't find the function $g$ such that $\lvert f\_n(x) \rvert \leq g(x)$ with $g... | 2014/12/26 | [
"https://math.stackexchange.com/questions/1081658",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/203327/"
] | For $|f\_n(x)| = \left|\dfrac{nx \log (x)}{1+n^2x^2}\right| \leq 2|\log x| = -2\log x, x \in (0,1]$. Take $g(x) = - 2 \log x$.
For $|f\_n(x)| = \left|\dfrac{n\sqrt{x}}{1+n^2x^2}\right| = \left|\dfrac{nx}{1+n^2x^2}\right|\cdot \dfrac{1}{\sqrt{x}} \leq \dfrac{1}{2\sqrt{x}}$. Take $g(x) = \dfrac{1}{2\sqrt{x}}$. | For $|f\_{n}(x)|=|\dfrac{nx\log(x)}{1+n^{2}x^{2}}|\leq |\dfrac{\log(x)}{2}|\leq |\log(x)|$. So for $g(x) = \log(x)$. Is that right?? |
55,626,021 | How to filter the record in the table based on the date column. I am using the following code for the filter, but its throwing error like
>
> ***ERROR TypeError: Cannot read property 'indexOf' of null***
>
>
>
```
temp = [{ "firstName":"Ravi", "date":"2019-04-04T06:12:43.541Z", "status":"created" }, { "firstName... | 2019/04/11 | [
"https://Stackoverflow.com/questions/55626021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10689405/"
] | The problem here is that the `"%s"` format reads *space* delimited strings, and since there's no space in `03f8ab8,1` it will all be read as a single string.
You can solve this with the `"%["` format, which allows you to have some very simple pattern matching. You can for example use it to tell `fscanf` to read everyt... | ```
fscanf(input_fp, "%30[^ ,\n\t]%30[^ ,\n\t]%30[^ ,\n\t]", ...
```
does not consume the ',' nor the '\n' in the text file. Subsequent fscanf() attempts also fail and return a value of 0, which not being EOF, causes an infinite loop.
---
`fscanf()` solution, to a `fgets()/sscanf()` better handles potential IO and ... |
7,409,502 | Given the following constructs for defining a function in Scala, can you explain what the difference is, and what the implications will be?
```
def foo = {}
```
vs.
```
def foo() = {}
```
*Update*
Thanks for the quick responses. These are great. The only question that remains for me is:
If I omit the parenthesi... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7409502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293064/"
] | If you include the parentheses in the definition you can optionally omit them when you call the method. If you omit them in the definition you can't use them when you call the method.
```
scala> def foo() {}
foo: ()Unit
scala> def bar {}
bar: Unit
scala> foo
scala> bar()
<console>:12: error: Unit does not take para... | Let me copy my answer I posted on [a duplicated question](https://stackoverflow.com/questions/7600910/difference-between-function-with-parentheses-and-without/7601150#7601150):
A Scala 2.x method of 0-arity can be defined with or without parentheses `()`. This is used to signal the user that the method has some kind o... |
7,409,502 | Given the following constructs for defining a function in Scala, can you explain what the difference is, and what the implications will be?
```
def foo = {}
```
vs.
```
def foo() = {}
```
*Update*
Thanks for the quick responses. These are great. The only question that remains for me is:
If I omit the parenthesi... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7409502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293064/"
] | If you include the parentheses in the definition you can optionally omit them when you call the method. If you omit them in the definition you can't use them when you call the method.
```
scala> def foo() {}
foo: ()Unit
scala> def bar {}
bar: Unit
scala> foo
scala> bar()
<console>:12: error: Unit does not take para... | To answer your second question, just add an `_`:
```
scala> def foo = println("foo!")
foo: Unit
scala> def test(arg: () => Unit) = { arg }
test: (arg: () => Unit)() => Unit
scala> test(foo _)
res10: () => Unit = <function0>
scala> test(foo _)()
foo!
scala>
``` |
7,409,502 | Given the following constructs for defining a function in Scala, can you explain what the difference is, and what the implications will be?
```
def foo = {}
```
vs.
```
def foo() = {}
```
*Update*
Thanks for the quick responses. These are great. The only question that remains for me is:
If I omit the parenthesi... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7409502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293064/"
] | If you include the parentheses in the definition you can optionally omit them when you call the method. If you omit them in the definition you can't use them when you call the method.
```
scala> def foo() {}
foo: ()Unit
scala> def bar {}
bar: Unit
scala> foo
scala> bar()
<console>:12: error: Unit does not take para... | I would recommend always start definition with a function like:
```
def bar {}
```
and only in cases, when you are forced, to change it to:
```
def bar() {}
```
Reason: Let's consider these 2 functions from a point of possible usage. How they can be infoked AND where they can be passed.
I would not call this a f... |
7,409,502 | Given the following constructs for defining a function in Scala, can you explain what the difference is, and what the implications will be?
```
def foo = {}
```
vs.
```
def foo() = {}
```
*Update*
Thanks for the quick responses. These are great. The only question that remains for me is:
If I omit the parenthesi... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7409502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293064/"
] | Let me copy my answer I posted on [a duplicated question](https://stackoverflow.com/questions/7600910/difference-between-function-with-parentheses-and-without/7601150#7601150):
A Scala 2.x method of 0-arity can be defined with or without parentheses `()`. This is used to signal the user that the method has some kind o... | To answer your second question, just add an `_`:
```
scala> def foo = println("foo!")
foo: Unit
scala> def test(arg: () => Unit) = { arg }
test: (arg: () => Unit)() => Unit
scala> test(foo _)
res10: () => Unit = <function0>
scala> test(foo _)()
foo!
scala>
``` |
7,409,502 | Given the following constructs for defining a function in Scala, can you explain what the difference is, and what the implications will be?
```
def foo = {}
```
vs.
```
def foo() = {}
```
*Update*
Thanks for the quick responses. These are great. The only question that remains for me is:
If I omit the parenthesi... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7409502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293064/"
] | Let me copy my answer I posted on [a duplicated question](https://stackoverflow.com/questions/7600910/difference-between-function-with-parentheses-and-without/7601150#7601150):
A Scala 2.x method of 0-arity can be defined with or without parentheses `()`. This is used to signal the user that the method has some kind o... | I would recommend always start definition with a function like:
```
def bar {}
```
and only in cases, when you are forced, to change it to:
```
def bar() {}
```
Reason: Let's consider these 2 functions from a point of possible usage. How they can be infoked AND where they can be passed.
I would not call this a f... |
7,409,502 | Given the following constructs for defining a function in Scala, can you explain what the difference is, and what the implications will be?
```
def foo = {}
```
vs.
```
def foo() = {}
```
*Update*
Thanks for the quick responses. These are great. The only question that remains for me is:
If I omit the parenthesi... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7409502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293064/"
] | To answer your second question, just add an `_`:
```
scala> def foo = println("foo!")
foo: Unit
scala> def test(arg: () => Unit) = { arg }
test: (arg: () => Unit)() => Unit
scala> test(foo _)
res10: () => Unit = <function0>
scala> test(foo _)()
foo!
scala>
``` | I would recommend always start definition with a function like:
```
def bar {}
```
and only in cases, when you are forced, to change it to:
```
def bar() {}
```
Reason: Let's consider these 2 functions from a point of possible usage. How they can be infoked AND where they can be passed.
I would not call this a f... |
16,261,415 | I am using Kinetic JS on iPhone and Android.
I copied the example from
<http://www.html5canvastutorials.com/labs/html5-canvas-multi-touch-scale-stage-with-kineticjs/>
to enable stage scaling and then I realized that when I zoom the zooming does not occur on the place where I pinch my zoom at, instead it happens at ... | 2013/04/28 | [
"https://Stackoverflow.com/questions/16261415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/745270/"
] | This was taken care of by another developer who made a plugin. Try this out and see if it works for you
<https://github.com/eduplus/pinchlayer> | Here is the updated version of the tutorial: <http://jsfiddle.net/9eaBq/>
Just replace lines from 69 to 71 by this code:
```
var scale = {
x: stage.scale().x * dist / lastDist,
y: stage.scale().y * dist / lastDist
};
stage.scale(scale);
```
Working on an iPad (Chrome & Safari) under iOS7. |
70,902,875 | I'm practicing with RoR with a CRUD, but when I want delete some product, I got this error (like in the image), I don't know why got this error, someone can help me pleas?
This is my routes.rb
```
Rails.application.routes.draw do
get '/products', to: 'products#index'
get '/products/new', to: 'products#new'
pos... | 2022/01/29 | [
"https://Stackoverflow.com/questions/70902875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18063575/"
] | Looks like you are using Rails 7 since `method: :delete` is no longer working without `ujs`.
So, it leads to GET request and there is really no such route in your config.
This issue was discussed in this [question](https://stackoverflow.com/questions/70474422/rails-7-link-to-with-method-delete-still-performs-get-reque... | I infer that you try to do the `show` action. If it is the case, the HTML verb is wrong. You are using `post` instead of `get`.
The **POST** verb is most often utilized to **create** new resources.
The HTTP **GET** method is used to **read** (or retrieve) a representation of a resource |
48,617 | I want to go to [Medan city center (Indonesia)](https://www.google.com.sg/maps/place/Medan,+Medan+City,+North+Sumatra,+Republic+of+Indonesia/@2.7016627,101.5396721,7z/data=!4m2!3m1!1s0x303131cc1c3eb2fd:0x23d431c8a6908262) when arriving by plane at [Medan International airport (called Kualanamu International Airport).](... | 2015/06/02 | [
"https://travel.stackexchange.com/questions/48617",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/9395/"
] | ### Your Options Include Airport Train, Airport Shuttle, Buses, Taxis, and Renting a Car
[The Kualanamu airport website has a page dedicated to airport transfer information.](http://www.kualanamu-airport.co.id/en/guides/transportation) Several options are listed there along with the approximate prices for each solutio... | The best and cheapest option is a public bus, the Perum Damri bus.
The last bus departs at 12pm to Medan city. |
48,617 | I want to go to [Medan city center (Indonesia)](https://www.google.com.sg/maps/place/Medan,+Medan+City,+North+Sumatra,+Republic+of+Indonesia/@2.7016627,101.5396721,7z/data=!4m2!3m1!1s0x303131cc1c3eb2fd:0x23d431c8a6908262) when arriving by plane at [Medan International airport (called Kualanamu International Airport).](... | 2015/06/02 | [
"https://travel.stackexchange.com/questions/48617",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/9395/"
] | The airport is about 16km from the city center.
---
The information below is from **May 2015**
Options I know of:
* Public bus: charges 20'000 IDR, it takes about 45min.
* Taxi: charges circa 150'000 IDR
---
### Resources
<http://www.virtualtourist.com/travel/Asia/Indonesia/North_Sumatra_Province/Medan-1213225/T... | The best and cheapest option is a public bus, the Perum Damri bus.
The last bus departs at 12pm to Medan city. |
30,433,965 | I have created a database with a table (`UserPass`) which essentially stores Usernames and Passwords.
Now in my form I want to ask a user to input his username and password and while testing this, I realized that I can input any username from the database and any password to login.
Is it possible to select in the SQL... | 2015/05/25 | [
"https://Stackoverflow.com/questions/30433965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4638032/"
] | >
> So I think the 'this' in the prototype method points to the 'A.prototype' (prototype is also an object, right?)
>
>
>
In **that example**, yes. But that's an extremely unusual way to call a function on a prototype. If you called it in a more typical way:
```
var a = new A();
a.B();
```
...then `this` would ... | if you instanciate the constructor `A` like this
```
var myVariable = new A();
```
then the method `B` returns the instance of `myVariable`
```
myVariable.B() === myVariable // true
``` |
30,433,965 | I have created a database with a table (`UserPass`) which essentially stores Usernames and Passwords.
Now in my form I want to ask a user to input his username and password and while testing this, I realized that I can input any username from the database and any password to login.
Is it possible to select in the SQL... | 2015/05/25 | [
"https://Stackoverflow.com/questions/30433965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4638032/"
] | >
> So I think the 'this' in the prototype method points to the 'A.prototype' (prototype is also an object, right?)
>
>
>
In **that example**, yes. But that's an extremely unusual way to call a function on a prototype. If you called it in a more typical way:
```
var a = new A();
a.B();
```
...then `this` would ... | >
> `this` refers to the object that called the function.
>
>
>
So whatever object you create. If that object calls the function then `this` refers to it. |
46,772,976 | So I have a `<div>` and inside that i have a `<p>` with `<asp:ListBox>` and I am trying to make this list box so that it can display at least 10 items at a time. I have tried `Rows="10"` or `Size="10"` and also `Height"100%".
It might be worthing adding that it is in a popup rather than a page itself (the size may be ... | 2017/10/16 | [
"https://Stackoverflow.com/questions/46772976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | `Rows="10"` should work. You can use CSS to style it too...
```css
#lstHospital { height: 200px;}
```
Be sure it fits within the popup (define the min height for pop-up itself). | Try to add Rows="10" into the ListBox
```
<asp:ListBox>
ID="lstHospital"
Rows="10"
....
SelectionMode="Multiple">
</asp:ListBox>
``` |
22,501,581 | I have a problem trying to add a set of Keys to a dictionary of string and a list of bool, and below is my Code:
```
private Dictionary<string, List<bool>> _properties = new Dictionary<string, List<bool>>();
private void Getconfiguration(PropertyInfo[] properties, object vCapabilities, object fCapabilities, objec... | 2014/03/19 | [
"https://Stackoverflow.com/questions/22501581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1183088/"
] | A new instance of `propertyValue` should be created inside foreach for each iteration!
This should work:
```
private Dictionary<string, List<bool>> _properties = new Dictionary<string, List<bool>>();
private void Getconfiguration(PropertyInfo[] properties, object vCapabilities, object fCapabilities, object mCapabilit... | You need to move the list initialisation into the loop. |
56,338,420 | I have a table:
table1
```
col1 col2 col3 col4
a b (null) c
a b (null) c
a (null) (null) c
(null) b (null) (null)
a b (null) (null)
a b (null) (null)
```
I... | 2019/05/28 | [
"https://Stackoverflow.com/questions/56338420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/893394/"
] | You need a dynamic PL/SQL to write conditional aggregation kind of queries:
```
select 'col1' col, count(case when col1 is null then 1 end) from table1
union all
select 'col2' col, count(case when col2 is null then 1 end) from table1
```
Therefore, your PL/SQL code will be along these lines
```
declare
v_cmd var... | I hope you can achieve using the below query.
```
select col,cnt from (
select col1 col, sum(case when col1 is not null then 1 else 0 end) cnt from tableA group by col1
union all
select col2 col, sum(case when col2 is not null then 1 else 0 end) cnt from tableA group by col2
union all
select col3 col, sum(case when c... |
28,634,221 | I was reading this blogpost <http://www.hydrogen18.com/blog/golang-embedding.html> and came across these lines
>
> There is an important distinction to observe here. If myParent is an instance of Parent the value myParent cannot act as a Valueable. You must use the the value &myParent, a pointer to the instance, to ... | 2015/02/20 | [
"https://Stackoverflow.com/questions/28634221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1144896/"
] | This issue has nothing to do with JavaScript or AngularJS.
You are querying an OData service where it appears that `foo` is an `Edm.Decimal` value, but you are trying to compare it against `100.5`, which is an `Edm.Double` literal. The `eq` operator does not support comparing an `Edm.Decimal` to an `Edm.Double`.
To r... | I've never seen a `$filter` param to an `$http` call, so I don't quite follow what you're doing. However, if you just want to filter the result, you can do that with a strict comparison via the built in `filter` `$filter` ([Angular Docs](https://docs.angularjs.org/api/ng/filter/filter))
Check out this Plunker for an e... |
72,018,013 | I'm trying to create a list of dictionaries in Python.
```
send_this = []
fruits = {'a': 'apricot', 'b': 'bagel', 'c': 'carrot'}
template = {'a': 'apple', 'b': 'banana', 'c': 'coconut'}
for i in fruits.keys():
send_this.append(template[i] = fruits[i])
```
This updates `template` and adds it to `send_this` but e... | 2022/04/26 | [
"https://Stackoverflow.com/questions/72018013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18955547/"
] | You're using foreach with `GetComponentInChildren<Hotbarbuttun>()`.
The Get Component SINGULAR will only return one item, so where you think you're iterating over a collection of `Hotbarbuttun` you're actually trying to iterate on a `Hotbarbuttun`, which itself is not a collection. It doesn't implement GetEnumerator, ... | You are calling a method that returns a single component which cannot be enumerated.
From the [documentation](https://docs.unity3d.com/ScriptReference/Component.GetComponentInChildren.html):
```
public Component GetComponentInChildren(Type t);
Returns
A Component of the matching type, otherwise null if no Component ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.