qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
8,354,986 | I'm trying to write a small program in C# to calculate a equation with a few known variables. A few textboxes (where each variable need to be typed) and a single "calculate" button.
What I'm trying to implement now is that my keyboard cursor is active in a selected textbox when the program starts.
But I can't figure ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8354986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077186/"
] | I see, you forgot to write down your C# (when i post my first answer).
If you're using C# it would be lot easier thank HTML or PHP.
Simply type this in form\_load() :
```
<your textboxname>.Focus()
```
Example :
```
TextBox1.Focus()
``` | You can do that using JQuery.
Simple use that code:
**$('#TextBox').focus();**
where the TextBox is a ID from your TextBox Control.
I hope that helps. |
8,354,986 | I'm trying to write a small program in C# to calculate a equation with a few known variables. A few textboxes (where each variable need to be typed) and a single "calculate" button.
What I'm trying to implement now is that my keyboard cursor is active in a selected textbox when the program starts.
But I can't figure ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8354986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077186/"
] | For Winforms : View > Tab Order. Set tab order of start textbox to 0. | You can do that using JQuery.
Simple use that code:
**$('#TextBox').focus();**
where the TextBox is a ID from your TextBox Control.
I hope that helps. |
8,354,986 | I'm trying to write a small program in C# to calculate a equation with a few known variables. A few textboxes (where each variable need to be typed) and a single "calculate" button.
What I'm trying to implement now is that my keyboard cursor is active in a selected textbox when the program starts.
But I can't figure ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8354986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077186/"
] | write this in your head tag
```
<script type='text/javascript'>
document.getElementById('txtName').focus();
</script>
``` | You can do that using JQuery.
Simple use that code:
**$('#TextBox').focus();**
where the TextBox is a ID from your TextBox Control.
I hope that helps. |
8,354,986 | I'm trying to write a small program in C# to calculate a equation with a few known variables. A few textboxes (where each variable need to be typed) and a single "calculate" button.
What I'm trying to implement now is that my keyboard cursor is active in a selected textbox when the program starts.
But I can't figure ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8354986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077186/"
] | I see, you forgot to write down your C# (when i post my first answer).
If you're using C# it would be lot easier thank HTML or PHP.
Simply type this in form\_load() :
```
<your textboxname>.Focus()
```
Example :
```
TextBox1.Focus()
``` | You can set up the order of focus with tabindex
e.g.
```
<input id="thing" tabindex="1" />
```
tabindex is ordinal. When set, the element with the lowest tab index value will be the first to gain focus.
You can also use tabindex to ensure the next element that the user will hit if he or she presses tab. |
8,354,986 | I'm trying to write a small program in C# to calculate a equation with a few known variables. A few textboxes (where each variable need to be typed) and a single "calculate" button.
What I'm trying to implement now is that my keyboard cursor is active in a selected textbox when the program starts.
But I can't figure ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8354986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077186/"
] | I see, you forgot to write down your C# (when i post my first answer).
If you're using C# it would be lot easier thank HTML or PHP.
Simply type this in form\_load() :
```
<your textboxname>.Focus()
```
Example :
```
TextBox1.Focus()
``` | So, what programming language that you are using?
In php you could use simple javascript :
```
<form>
<input type="text" id="mytext1" name="mytext1" value="1"><br>
<input type="text" id="mytext2" name="mytext2" value="2"><br>
<input type="text" id="mytext3" name="mytext3" value="3"><br>
</form>
<script language="jav... |
8,354,986 | I'm trying to write a small program in C# to calculate a equation with a few known variables. A few textboxes (where each variable need to be typed) and a single "calculate" button.
What I'm trying to implement now is that my keyboard cursor is active in a selected textbox when the program starts.
But I can't figure ... | 2011/12/02 | [
"https://Stackoverflow.com/questions/8354986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077186/"
] | For Winforms : View > Tab Order. Set tab order of start textbox to 0. | You can set up the order of focus with tabindex
e.g.
```
<input id="thing" tabindex="1" />
```
tabindex is ordinal. When set, the element with the lowest tab index value will be the first to gain focus.
You can also use tabindex to ensure the next element that the user will hit if he or she presses tab. |
58,240 | Is there a widget for WordPress to show posts from one category with a thumbnail and description for latest post?
WIDGET LIKE: Top news section of WWW.GOAL.com.
 | 2012/07/12 | [
"https://wordpress.stackexchange.com/questions/58240",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/18091/"
] | I don't know of any widgets or plugins that do this by default. To create this within your theme you would need to write multiple query loop that goes through each category then queries the latest posts from each with a counter so the top post can be styled differently.
Quick example.
```
$cats = get_categories();
f... | This will do trick,
```
<?php $postCount = 0; ?>
<h1 class="section_title">Category-1</h1>
<?php query_posts('cat=1&showposts=4'); ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<?php if($postCount == 0) { the_excerpt(); }?>
<?php $... |
410,559 | Can we apply dimensional analysis for variables inside integrals? Ex: if we have integral $$\int \frac{\text{d}x}{\sqrt{a^2 - x^2}} = \frac{1}{a} \sin^{-1} \left(\frac{a}{x}\right),$$ the LHS has no dimensions, while the RHS has dimensions of $\frac{1}{length}$. So let me know , whether I am correct? | 2018/06/07 | [
"https://physics.stackexchange.com/questions/410559",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/157245/"
] | Yes, you can apply dimensional analysis to integrals. You count differentials like $dx$ as having the units of the associated variable, because $dx$ can be interpreted as an infinitesimal change in $x$.
In your example, if $a$ and $x$ have units of distance, then checking the units in your result shows that it's incor... | Yes you may. Think of an integral $\int g(x) dx$ as the sum $\sum g(x) \Delta x$. In each term in your (very large) summation, you may apply dimensional analysis. |
410,559 | Can we apply dimensional analysis for variables inside integrals? Ex: if we have integral $$\int \frac{\text{d}x}{\sqrt{a^2 - x^2}} = \frac{1}{a} \sin^{-1} \left(\frac{a}{x}\right),$$ the LHS has no dimensions, while the RHS has dimensions of $\frac{1}{length}$. So let me know , whether I am correct? | 2018/06/07 | [
"https://physics.stackexchange.com/questions/410559",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/157245/"
] | Yes, you can apply dimensional analysis to integrals. You count differentials like $dx$ as having the units of the associated variable, because $dx$ can be interpreted as an infinitesimal change in $x$.
In your example, if $a$ and $x$ have units of distance, then checking the units in your result shows that it's incor... | To be more explicit about Ben Crowell's remarks:
Let $u = \frac xa$, so $dx = adu$ and the integration becomes $$\int \frac{dx}{\sqrt{a^2-x^2}} = \int \frac{adu}{\sqrt{a^2-a^2u^2}} = \int \frac{du}{\sqrt{1 - u^2}} = \sin^{-1} u + C = \sin^{-1}\frac xa + C$$
(assuming that $a> 0$).
Since $a$ and $x$ must have the same ... |
410,559 | Can we apply dimensional analysis for variables inside integrals? Ex: if we have integral $$\int \frac{\text{d}x}{\sqrt{a^2 - x^2}} = \frac{1}{a} \sin^{-1} \left(\frac{a}{x}\right),$$ the LHS has no dimensions, while the RHS has dimensions of $\frac{1}{length}$. So let me know , whether I am correct? | 2018/06/07 | [
"https://physics.stackexchange.com/questions/410559",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/157245/"
] | Yes, you can apply dimensional analysis to integrals. You count differentials like $dx$ as having the units of the associated variable, because $dx$ can be interpreted as an infinitesimal change in $x$.
In your example, if $a$ and $x$ have units of distance, then checking the units in your result shows that it's incor... | Your integral has a symmetry: if you map $a \mapsto k a$ and then $x \mapsto kx$ your RHS reads:
$$ \sin^{-1} \frac{a}{x} \mapsto \sin^{-1} \frac{ka}{kx} = \sin^{-1} \frac{a}{x} $$
That went well... what about the left hand side? Does was that also invariant?
$$ \int \frac{dx}{\sqrt{a^2 -x^2}} \mapsto \int \frac{d(k... |
410,559 | Can we apply dimensional analysis for variables inside integrals? Ex: if we have integral $$\int \frac{\text{d}x}{\sqrt{a^2 - x^2}} = \frac{1}{a} \sin^{-1} \left(\frac{a}{x}\right),$$ the LHS has no dimensions, while the RHS has dimensions of $\frac{1}{length}$. So let me know , whether I am correct? | 2018/06/07 | [
"https://physics.stackexchange.com/questions/410559",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/157245/"
] | To be more explicit about Ben Crowell's remarks:
Let $u = \frac xa$, so $dx = adu$ and the integration becomes $$\int \frac{dx}{\sqrt{a^2-x^2}} = \int \frac{adu}{\sqrt{a^2-a^2u^2}} = \int \frac{du}{\sqrt{1 - u^2}} = \sin^{-1} u + C = \sin^{-1}\frac xa + C$$
(assuming that $a> 0$).
Since $a$ and $x$ must have the same ... | Yes you may. Think of an integral $\int g(x) dx$ as the sum $\sum g(x) \Delta x$. In each term in your (very large) summation, you may apply dimensional analysis. |
410,559 | Can we apply dimensional analysis for variables inside integrals? Ex: if we have integral $$\int \frac{\text{d}x}{\sqrt{a^2 - x^2}} = \frac{1}{a} \sin^{-1} \left(\frac{a}{x}\right),$$ the LHS has no dimensions, while the RHS has dimensions of $\frac{1}{length}$. So let me know , whether I am correct? | 2018/06/07 | [
"https://physics.stackexchange.com/questions/410559",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/157245/"
] | Yes you may. Think of an integral $\int g(x) dx$ as the sum $\sum g(x) \Delta x$. In each term in your (very large) summation, you may apply dimensional analysis. | Your integral has a symmetry: if you map $a \mapsto k a$ and then $x \mapsto kx$ your RHS reads:
$$ \sin^{-1} \frac{a}{x} \mapsto \sin^{-1} \frac{ka}{kx} = \sin^{-1} \frac{a}{x} $$
That went well... what about the left hand side? Does was that also invariant?
$$ \int \frac{dx}{\sqrt{a^2 -x^2}} \mapsto \int \frac{d(k... |
410,559 | Can we apply dimensional analysis for variables inside integrals? Ex: if we have integral $$\int \frac{\text{d}x}{\sqrt{a^2 - x^2}} = \frac{1}{a} \sin^{-1} \left(\frac{a}{x}\right),$$ the LHS has no dimensions, while the RHS has dimensions of $\frac{1}{length}$. So let me know , whether I am correct? | 2018/06/07 | [
"https://physics.stackexchange.com/questions/410559",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/157245/"
] | To be more explicit about Ben Crowell's remarks:
Let $u = \frac xa$, so $dx = adu$ and the integration becomes $$\int \frac{dx}{\sqrt{a^2-x^2}} = \int \frac{adu}{\sqrt{a^2-a^2u^2}} = \int \frac{du}{\sqrt{1 - u^2}} = \sin^{-1} u + C = \sin^{-1}\frac xa + C$$
(assuming that $a> 0$).
Since $a$ and $x$ must have the same ... | Your integral has a symmetry: if you map $a \mapsto k a$ and then $x \mapsto kx$ your RHS reads:
$$ \sin^{-1} \frac{a}{x} \mapsto \sin^{-1} \frac{ka}{kx} = \sin^{-1} \frac{a}{x} $$
That went well... what about the left hand side? Does was that also invariant?
$$ \int \frac{dx}{\sqrt{a^2 -x^2}} \mapsto \int \frac{d(k... |
1,308,615 | I want to find a primitive element for the field extension $\mathbb{F}\_{125}/\mathbb{F}\_5$.
I constructed $\mathbb{F}\_{125}$ as $\mathbb{F}\_5[X]/\langle X^3 + X + 1 \rangle$. Since the degree of the polynomial is $3$, there are no intermediate fields, so every element from $\mathbb{F}\_{125}$ which is not in $\mat... | 2015/06/02 | [
"https://math.stackexchange.com/questions/1308615",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/190908/"
] | The extension field $\mathbf{F}\_{125}$ contains prime field as a subfield, and as a vector space over it has $\{1,\bar X, \bar X^2\}$ as its basis. This shows that $\bar X$ is not in the prime field.
When the degree of a field extension is a prime number any element that is not in the base field will be a primitive e... | Keep in mind that $X$ is an element of $\Bbb F\_5[X]$, and its coset $\overline{X}$ in $\Bbb F\_5[X]/\langle X^3+X+1\rangle$ is not in $\Bbb F\_5$. |
1,308,615 | I want to find a primitive element for the field extension $\mathbb{F}\_{125}/\mathbb{F}\_5$.
I constructed $\mathbb{F}\_{125}$ as $\mathbb{F}\_5[X]/\langle X^3 + X + 1 \rangle$. Since the degree of the polynomial is $3$, there are no intermediate fields, so every element from $\mathbb{F}\_{125}$ which is not in $\mat... | 2015/06/02 | [
"https://math.stackexchange.com/questions/1308615",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/190908/"
] | Let $u$ be a root of $x^3 + x + 1$ in the algebraic closure of $\Bbb F\_5$. Pretty much all we know about $u$ is that: $u^3 + u + 1 = 0$, that is: $u^3 = 4u + 4$.
Note that the vector space (over $\Bbb F\_5$) spanned by $\{1,u,u^2\}$ has dimension $3$, giving us that $|\Bbb F\_5[u]| = 125$ (we have $5$ choice for each... | Keep in mind that $X$ is an element of $\Bbb F\_5[X]$, and its coset $\overline{X}$ in $\Bbb F\_5[X]/\langle X^3+X+1\rangle$ is not in $\Bbb F\_5$. |
1,308,615 | I want to find a primitive element for the field extension $\mathbb{F}\_{125}/\mathbb{F}\_5$.
I constructed $\mathbb{F}\_{125}$ as $\mathbb{F}\_5[X]/\langle X^3 + X + 1 \rangle$. Since the degree of the polynomial is $3$, there are no intermediate fields, so every element from $\mathbb{F}\_{125}$ which is not in $\mat... | 2015/06/02 | [
"https://math.stackexchange.com/questions/1308615",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/190908/"
] | The extension field $\mathbf{F}\_{125}$ contains prime field as a subfield, and as a vector space over it has $\{1,\bar X, \bar X^2\}$ as its basis. This shows that $\bar X$ is not in the prime field.
When the degree of a field extension is a prime number any element that is not in the base field will be a primitive e... | Let $u$ be a root of $x^3 + x + 1$ in the algebraic closure of $\Bbb F\_5$. Pretty much all we know about $u$ is that: $u^3 + u + 1 = 0$, that is: $u^3 = 4u + 4$.
Note that the vector space (over $\Bbb F\_5$) spanned by $\{1,u,u^2\}$ has dimension $3$, giving us that $|\Bbb F\_5[u]| = 125$ (we have $5$ choice for each... |
32,203,879 | I know that there are several answers for this question, but I was not clear about the result. Here are a few questions:
1) If I created a project as an iPhone project, selecting device as iPhone in deployment info, and designed the app using universal storyboard (i.e any width and any height (600x600) ). Once the des... | 2015/08/25 | [
"https://Stackoverflow.com/questions/32203879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1280338/"
] | NET 4.5 is an "in-place upgrade" of .NET 4, so even if you target .Net 4 you will be using .NET 4.5, see <http://www.hanselman.com/blog/NETVersioningAndMultiTargetingNET45IsAnInplaceUpgradeToNET40.aspx>.
Summarising this blog, there are three major version of .NET that can be installed side by side:
* .NET 1 (1.1)
* ... | I've had *massive* problems with HgLab (which is an on-premise ASP.NET application) targeting .NET 4.0 and being built on a server with .NET 4.5 installed.
I don't use anything fancy, only stable public APIs and *explicitly* target .NET 4.0. Yet it kept on crashing deep inside `kernelbase.dll` on 64-bit systems, prod... |
32,203,879 | I know that there are several answers for this question, but I was not clear about the result. Here are a few questions:
1) If I created a project as an iPhone project, selecting device as iPhone in deployment info, and designed the app using universal storyboard (i.e any width and any height (600x600) ). Once the des... | 2015/08/25 | [
"https://Stackoverflow.com/questions/32203879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1280338/"
] | NET 4.5 is an "in-place upgrade" of .NET 4, so even if you target .Net 4 you will be using .NET 4.5, see <http://www.hanselman.com/blog/NETVersioningAndMultiTargetingNET45IsAnInplaceUpgradeToNET40.aspx>.
Summarising this blog, there are three major version of .NET that can be installed side by side:
* .NET 1 (1.1)
* ... | Yes, here's an example:
The following console app should throw an `UnobservedTaskException` on a system without .Net 4.5 or later installed, but it will loop forever if .Net 4.5 or later has been installed:
```
private static void Main()
{
Task.Factory.StartNew(() => { throw new InvalidOperationException("Erk"); ... |
3,597,396 | When/why/how would you use these methods?
```
- navigationController:willShowViewController:animated:
– navigationController:didShowViewController:animated:
```
Can't you just use these UIViewController Instance Methods instead?
```
– viewWillAppear:
– viewDidAppear:
– viewWillDisappear:
– viewDidDisappear:
``` | 2010/08/30 | [
"https://Stackoverflow.com/questions/3597396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/242933/"
] | You'd use the first ones if you want to be informed about these events *outside* the visible view controllers. The delegates allow you to get a notification at a single point. Using `UIViewController`'s methods bind you within these controllers, where you'd have to write/call same code multiple times to achieve the sam... | >
> The UINavigationControllerDelegate protocol defines methods a navigation controller delegate can implement to change the behavior when view controllers are pushed and popped from the stack of a navigation controller.
>
>
>
These method are important when you need to perform some actions that would not be on th... |
47,590 | I asked how to make resizable chessboard in here. nickjamesuk help me . [Here](https://mathematica.stackexchange.com/questions/47441/how-to-make-a-resizable-chess-board) is the code. I thought I can put queens on the board chess board easily after created resizable board, but it didn't work out. Now, I want to write wh... | 2014/05/10 | [
"https://mathematica.stackexchange.com/questions/47590",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/14114/"
] | Since you already have an answer for the resizable part I will use a fixed chess board. In fact I replicated the graphics in the Wikipedia article for the eight queens problem a while back, and solved it, so I'll just share my solution. I guess the task left is to 1) Replace my solution with yours and 2) adapt the grap... | In the same spirit as the answer of Pickett, here is my 5-6 years old code for the queens problem.
```
ClearAll[shiftBits, rowsToExclude, processRow, getSolutions];
shiftBits[bits_List, n_Integer] :=
IntegerDigits[IntegerPart[FromDigits[bits, 2]/2^n], 2, Length[bits]];
rowsToExclude[{}] = {};
rowsToExclude[board_... |
47,590 | I asked how to make resizable chessboard in here. nickjamesuk help me . [Here](https://mathematica.stackexchange.com/questions/47441/how-to-make-a-resizable-chess-board) is the code. I thought I can put queens on the board chess board easily after created resizable board, but it didn't work out. Now, I want to write wh... | 2014/05/10 | [
"https://mathematica.stackexchange.com/questions/47590",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/14114/"
] | Since you already have an answer for the resizable part I will use a fixed chess board. In fact I replicated the graphics in the Wikipedia article for the eight queens problem a while back, and solved it, so I'll just share my solution. I guess the task left is to 1) Replace my solution with yours and 2) adapt the grap... | Adapted from C.E. here is a way to do it with recursive backtracking. We backtrack in this solution because I use a variable which is accessible to all the local scoping constructs and is deliberately passed by reference:
```
With[{num = 10},
Block[{queen =
Import@"https://cdn3.iconfinder.com/data/icons/chess-2/51... |
47,590 | I asked how to make resizable chessboard in here. nickjamesuk help me . [Here](https://mathematica.stackexchange.com/questions/47441/how-to-make-a-resizable-chess-board) is the code. I thought I can put queens on the board chess board easily after created resizable board, but it didn't work out. Now, I want to write wh... | 2014/05/10 | [
"https://mathematica.stackexchange.com/questions/47590",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/14114/"
] | In the same spirit as the answer of Pickett, here is my 5-6 years old code for the queens problem.
```
ClearAll[shiftBits, rowsToExclude, processRow, getSolutions];
shiftBits[bits_List, n_Integer] :=
IntegerDigits[IntegerPart[FromDigits[bits, 2]/2^n], 2, Length[bits]];
rowsToExclude[{}] = {};
rowsToExclude[board_... | Adapted from C.E. here is a way to do it with recursive backtracking. We backtrack in this solution because I use a variable which is accessible to all the local scoping constructs and is deliberately passed by reference:
```
With[{num = 10},
Block[{queen =
Import@"https://cdn3.iconfinder.com/data/icons/chess-2/51... |
19,727,269 | I have to display few deployment level parameters from the running app without using external database. First one is the war build date time. Is there any way that my tomcat deployed grails application know when the build was made?
Also, Is there any way through which we can specify commit revision for the war which c... | 2013/11/01 | [
"https://Stackoverflow.com/questions/19727269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2177492/"
] | You can do this through `scripts/_Events.groovy` by adding an `eventCreateWarStart`. This event fires after the final webapp's contents have been assembled in the staging directory but before they are zipped up to make a WAR. You can create new files in the staging directory to have them included in the WAR. For exampl... | The above answer is for grails2, however any one looking for a grails 3 solution can use the [buildProperties](https://github.com/snimavat/grails-core/blob/c02aafd2d478396e59c09cacc4d0aa30b3698dfb/grails-gradle-plugin/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy#L231-L231) task
```
buildProp... |
36,364,352 | How do I make a string such as "You did it!" appear from a boolean pass/fail instead of just "True" or "False"? I'm only ever able to find the ToString method, but all that does is change "True" to "true". I want to know how to make the string output whatever I want. | 2016/04/01 | [
"https://Stackoverflow.com/questions/36364352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6146241/"
] | A `bool` is a type, the same way a `string` is a type. You'll never be able to get a bool type to show "You did it!", because its a bool - it can only be true or false.
What you want is to create a string based on the result of boolean. Sounds like you want an `if` statement:
```
string myString;
if(myBool) // if tru... | To display the string in your view when using data binding you can use a custom IValueConverter:
```
public class BoolToStringConverter : IValueConverter
{
public string TrueString { get; set; }
public string FalseString { get; set; }
public object Convert(object value, Type targetType, object parameter, ... |
36,364,352 | How do I make a string such as "You did it!" appear from a boolean pass/fail instead of just "True" or "False"? I'm only ever able to find the ToString method, but all that does is change "True" to "true". I want to know how to make the string output whatever I want. | 2016/04/01 | [
"https://Stackoverflow.com/questions/36364352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6146241/"
] | A `bool` is a type, the same way a `string` is a type. You'll never be able to get a bool type to show "You did it!", because its a bool - it can only be true or false.
What you want is to create a string based on the result of boolean. Sounds like you want an `if` statement:
```
string myString;
if(myBool) // if tru... | I think that creating an `Extension Method` is the closer you can get from what you want.
Create a `BoolExtensions` class:
```
public static class BoolExtensions
{
public static string ToString(this bool boolean, string valueIfTrue, string valueIfFalse)
{
return boolean ? valueIfTrue : valueIfFalse;
... |
36,364,352 | How do I make a string such as "You did it!" appear from a boolean pass/fail instead of just "True" or "False"? I'm only ever able to find the ToString method, but all that does is change "True" to "true". I want to know how to make the string output whatever I want. | 2016/04/01 | [
"https://Stackoverflow.com/questions/36364352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6146241/"
] | A `bool` is a type, the same way a `string` is a type. You'll never be able to get a bool type to show "You did it!", because its a bool - it can only be true or false.
What you want is to create a string based on the result of boolean. Sounds like you want an `if` statement:
```
string myString;
if(myBool) // if tru... | You cannot override the ToString method of a known type in c#, but you can create extension methods, if you will use this string in many parts of your code you can create a method for this like:
```
public static class Extensions
{
public static string ToStringCustom(this bool booleanValue)
{
if(boolea... |
36,364,352 | How do I make a string such as "You did it!" appear from a boolean pass/fail instead of just "True" or "False"? I'm only ever able to find the ToString method, but all that does is change "True" to "true". I want to know how to make the string output whatever I want. | 2016/04/01 | [
"https://Stackoverflow.com/questions/36364352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6146241/"
] | A `bool` is a type, the same way a `string` is a type. You'll never be able to get a bool type to show "You did it!", because its a bool - it can only be true or false.
What you want is to create a string based on the result of boolean. Sounds like you want an `if` statement:
```
string myString;
if(myBool) // if tru... | If you are using C# 3.0 or higher, you can also put this in an [extension method](https://msdn.microsoft.com/en-us/library/bb383977.aspx) for *bool* like this:
```
public static string ToDidItOrNotString(this bool b)
{
return b ? "You did it!" : "You did not do it.";
}
```
Then you can just call it like this:
`... |
36,364,352 | How do I make a string such as "You did it!" appear from a boolean pass/fail instead of just "True" or "False"? I'm only ever able to find the ToString method, but all that does is change "True" to "true". I want to know how to make the string output whatever I want. | 2016/04/01 | [
"https://Stackoverflow.com/questions/36364352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6146241/"
] | A `bool` is a type, the same way a `string` is a type. You'll never be able to get a bool type to show "You did it!", because its a bool - it can only be true or false.
What you want is to create a string based on the result of boolean. Sounds like you want an `if` statement:
```
string myString;
if(myBool) // if tru... | If you want to use this functionality in multiple places, you can create an extension method like;
```
public static string YouDidIt(this bool value )
{
if (value) return "You did it!";
return "You failed";
}
```
Then you can use it like;
```
bool a = true;
string s = a.YouDidIt();
``` |
36,364,352 | How do I make a string such as "You did it!" appear from a boolean pass/fail instead of just "True" or "False"? I'm only ever able to find the ToString method, but all that does is change "True" to "true". I want to know how to make the string output whatever I want. | 2016/04/01 | [
"https://Stackoverflow.com/questions/36364352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6146241/"
] | If you are using C# 3.0 or higher, you can also put this in an [extension method](https://msdn.microsoft.com/en-us/library/bb383977.aspx) for *bool* like this:
```
public static string ToDidItOrNotString(this bool b)
{
return b ? "You did it!" : "You did not do it.";
}
```
Then you can just call it like this:
`... | To display the string in your view when using data binding you can use a custom IValueConverter:
```
public class BoolToStringConverter : IValueConverter
{
public string TrueString { get; set; }
public string FalseString { get; set; }
public object Convert(object value, Type targetType, object parameter, ... |
36,364,352 | How do I make a string such as "You did it!" appear from a boolean pass/fail instead of just "True" or "False"? I'm only ever able to find the ToString method, but all that does is change "True" to "true". I want to know how to make the string output whatever I want. | 2016/04/01 | [
"https://Stackoverflow.com/questions/36364352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6146241/"
] | If you are using C# 3.0 or higher, you can also put this in an [extension method](https://msdn.microsoft.com/en-us/library/bb383977.aspx) for *bool* like this:
```
public static string ToDidItOrNotString(this bool b)
{
return b ? "You did it!" : "You did not do it.";
}
```
Then you can just call it like this:
`... | I think that creating an `Extension Method` is the closer you can get from what you want.
Create a `BoolExtensions` class:
```
public static class BoolExtensions
{
public static string ToString(this bool boolean, string valueIfTrue, string valueIfFalse)
{
return boolean ? valueIfTrue : valueIfFalse;
... |
36,364,352 | How do I make a string such as "You did it!" appear from a boolean pass/fail instead of just "True" or "False"? I'm only ever able to find the ToString method, but all that does is change "True" to "true". I want to know how to make the string output whatever I want. | 2016/04/01 | [
"https://Stackoverflow.com/questions/36364352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6146241/"
] | If you are using C# 3.0 or higher, you can also put this in an [extension method](https://msdn.microsoft.com/en-us/library/bb383977.aspx) for *bool* like this:
```
public static string ToDidItOrNotString(this bool b)
{
return b ? "You did it!" : "You did not do it.";
}
```
Then you can just call it like this:
`... | You cannot override the ToString method of a known type in c#, but you can create extension methods, if you will use this string in many parts of your code you can create a method for this like:
```
public static class Extensions
{
public static string ToStringCustom(this bool booleanValue)
{
if(boolea... |
36,364,352 | How do I make a string such as "You did it!" appear from a boolean pass/fail instead of just "True" or "False"? I'm only ever able to find the ToString method, but all that does is change "True" to "true". I want to know how to make the string output whatever I want. | 2016/04/01 | [
"https://Stackoverflow.com/questions/36364352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6146241/"
] | If you are using C# 3.0 or higher, you can also put this in an [extension method](https://msdn.microsoft.com/en-us/library/bb383977.aspx) for *bool* like this:
```
public static string ToDidItOrNotString(this bool b)
{
return b ? "You did it!" : "You did not do it.";
}
```
Then you can just call it like this:
`... | If you want to use this functionality in multiple places, you can create an extension method like;
```
public static string YouDidIt(this bool value )
{
if (value) return "You did it!";
return "You failed";
}
```
Then you can use it like;
```
bool a = true;
string s = a.YouDidIt();
``` |
54,266,047 | I would like to hash feature ‘Genre’ into 6 columns and separately feature ‘Publisher’ into another six columns. I want something like below:
```
Genre Publisher 0 1 2 3 4 5 0 1 2 3 4 5
0 Platform Nintendo 0.0 2.0 2.0 -1.0 1.0 0.0 0.0 2.0 2.0 -1.0 1.0 0.... | 2019/01/19 | [
"https://Stackoverflow.com/questions/54266047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10129270/"
] | **Hashing (Update)**
Assuming that new categories might show up in some of the features, hashing is the way to go. Just 2 notes:
* Be aware of the possibility of collision and adjust the number of features accordingly
* In your case, you want to hash each feature separately
**One Hot Vector**
In case the number of ... | Even though, I am late here, from the examples I have seen on Kaggle , FeatureHashing is performed at once for multiple columns (ie on a DataFrame) rather than for individual columns and concatenating the sparse matrices. See Notebooks on Kaggle, [here](https://www.kaggle.com/insaff/feature-hashing-with-partial-fitting... |
38,422,736 | I have a data frame with 107 columns and 745000 rows (much bigger than in my example).
The case is, that I have character type columns which I want to separate, because they seem to contain some type-ish ending at the end of each sequence.
I want to saparate these type-ending parts to new columns.
I have made my own... | 2016/07/17 | [
"https://Stackoverflow.com/questions/38422736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6126355/"
] | First we pre-allocate the results data.frame to the desired final length. This is very important; see [The R Inferno, Circle 2](http://www.burns-stat.com/pages/Tutor/R_inferno.pdf). Then we vectorize the inner loop. We also use `fixed = TRUE` and avoid the regex in `strsplit`.
```
system.time({
df_new1 <- data.frame... | Another possibility:
```
setNames(do.call(rbind.data.frame, lapply(1:nrow(df), function(i) {
x <- stri_split_fixed(df[i, 1:4], "_", 2, simplify=TRUE)
y <- c(x[,1], x[,2])
y[y==""] <- NA
y
})), colnames(df)) -> df_new
```
or
```
setNames(do.call(rbind.data.frame, lapply(1:nrow(df), function(i) {
x <- stri_... |
38,422,736 | I have a data frame with 107 columns and 745000 rows (much bigger than in my example).
The case is, that I have character type columns which I want to separate, because they seem to contain some type-ish ending at the end of each sequence.
I want to saparate these type-ending parts to new columns.
I have made my own... | 2016/07/17 | [
"https://Stackoverflow.com/questions/38422736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6126355/"
] | First we pre-allocate the results data.frame to the desired final length. This is very important; see [The R Inferno, Circle 2](http://www.burns-stat.com/pages/Tutor/R_inferno.pdf). Then we vectorize the inner loop. We also use `fixed = TRUE` and avoid the regex in `strsplit`.
```
system.time({
df_new1 <- data.frame... | Here's another way, using `gsub` inside a custom function in combination with `purrr::dmap()` - which is equivalent to `lapply`, but outputs a `data.frame` instead of a `list`.
```
library(purrr)
# Define function which gets rid of everything after and including "_"
replace01 <- function(df, ptrn = "_.*")
dmap(... |
38,422,736 | I have a data frame with 107 columns and 745000 rows (much bigger than in my example).
The case is, that I have character type columns which I want to separate, because they seem to contain some type-ish ending at the end of each sequence.
I want to saparate these type-ending parts to new columns.
I have made my own... | 2016/07/17 | [
"https://Stackoverflow.com/questions/38422736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6126355/"
] | Here's another way, using `gsub` inside a custom function in combination with `purrr::dmap()` - which is equivalent to `lapply`, but outputs a `data.frame` instead of a `list`.
```
library(purrr)
# Define function which gets rid of everything after and including "_"
replace01 <- function(df, ptrn = "_.*")
dmap(... | Another possibility:
```
setNames(do.call(rbind.data.frame, lapply(1:nrow(df), function(i) {
x <- stri_split_fixed(df[i, 1:4], "_", 2, simplify=TRUE)
y <- c(x[,1], x[,2])
y[y==""] <- NA
y
})), colnames(df)) -> df_new
```
or
```
setNames(do.call(rbind.data.frame, lapply(1:nrow(df), function(i) {
x <- stri_... |
14,322,660 | I'm using reflection to map out objects. These objects are in managed code but I have no visibility into their source code, underlying structure, etc. other than through reflection. The overarching goal of all this is a rudimentary memory map of an object (similar in functionality to SOS.dll `DumpObject` and `!ObjSize`... | 2013/01/14 | [
"https://Stackoverflow.com/questions/14322660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106760/"
] | The name of a property's backing field is a compiler implementation detail and can always change in the future, even if you figure out the pattern.
I think you've already hit on the answer to your question: *ignore all properties*.
Remember that a property is just one or two functions in disguise. A property will onl... | You *can* ignore all properties completely. If a property doesn't have a backing field, then it simply doesn't consume any memory.
Also, unless you're willing to (try to) parse CIL, you won't be able to get such mapping. Consider this code:
```
private DateTime today;
public DateTime CurrentDay
{
get { return to... |
14,322,660 | I'm using reflection to map out objects. These objects are in managed code but I have no visibility into their source code, underlying structure, etc. other than through reflection. The overarching goal of all this is a rudimentary memory map of an object (similar in functionality to SOS.dll `DumpObject` and `!ObjSize`... | 2013/01/14 | [
"https://Stackoverflow.com/questions/14322660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106760/"
] | The name of a property's backing field is a compiler implementation detail and can always change in the future, even if you figure out the pattern.
I think you've already hit on the answer to your question: *ignore all properties*.
Remember that a property is just one or two functions in disguise. A property will onl... | To answer your other question:Under what circumstances do properties not have backing fields?
```
public DateTime CurrentDay
{
get { return DateTime.Now; }
}
```
or property may use any other number of backing fields/classes
```
public string FullName
{
get {return firstName + " " + lastName;}
}
``` |
14,322,660 | I'm using reflection to map out objects. These objects are in managed code but I have no visibility into their source code, underlying structure, etc. other than through reflection. The overarching goal of all this is a rudimentary memory map of an object (similar in functionality to SOS.dll `DumpObject` and `!ObjSize`... | 2013/01/14 | [
"https://Stackoverflow.com/questions/14322660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106760/"
] | You *can* ignore all properties completely. If a property doesn't have a backing field, then it simply doesn't consume any memory.
Also, unless you're willing to (try to) parse CIL, you won't be able to get such mapping. Consider this code:
```
private DateTime today;
public DateTime CurrentDay
{
get { return to... | To answer your other question:Under what circumstances do properties not have backing fields?
```
public DateTime CurrentDay
{
get { return DateTime.Now; }
}
```
or property may use any other number of backing fields/classes
```
public string FullName
{
get {return firstName + " " + lastName;}
}
``` |
56,914 | Say that I am listening to a record. Is it fair use to take a picture of the record cover, e.g. standing behind the turntable, and share it on social media or a blog?
Similarly, is it fair use to take a picture of a book that I am reading, e.g. laying on a table, and share it on social media or a blog?
If the above i... | 2020/10/05 | [
"https://law.stackexchange.com/questions/56914",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/15097/"
] | **Final Result:** The 117th Congress did actually meet and swear in on a *Sunday*, January 3, 2021. Per the other answer by @NateEldredge, this was the first Sunday swearing in for at least several decades.
---
**December Update:** There still does not appear to be a bill to change the date of convening the 117th Con... | They will probably not be sworn in on a Sunday
==============================================
As far as I can tell, they have so far not passed a law to change the date. However, you can see [here](https://www.senate.gov/legislative/DatesofSessionsofCongress.htm) a list of past dates of convening; they very frequently... |
115,357 | I am going to clean install windows 7 upgrade version on my Thinkpad T61(currently running Windows Vista) without any bloatwares like ThinkVantage software. I am worried about the drivers. I mean what are the important drivers i should download first to get my system going after the machine is formatted. | 2010/03/02 | [
"https://superuser.com/questions/115357",
"https://superuser.com",
"https://superuser.com/users/-1/"
] | I found all the drivers I needed at the Lenovo site for my recent upgrade of my T61. I did a clean install of 7 Ultimate. Once I had the NIC and video drivers loaded from a USB stick, I downloaded the Lenovo maintenance package that includes the update applet. This found all other drivers and updates. The TPM driver an... | I did a clean install of Windows 7 64-bit on my Thinkpad recently. Windows recognized all my hardware out of the box. Saved me the trouble of installing Lenovo bloatware. A few optional Lenovo drivers appeared in Windows Update (under optional updates), but I chose not to install them. |
115,357 | I am going to clean install windows 7 upgrade version on my Thinkpad T61(currently running Windows Vista) without any bloatwares like ThinkVantage software. I am worried about the drivers. I mean what are the important drivers i should download first to get my system going after the machine is formatted. | 2010/03/02 | [
"https://superuser.com/questions/115357",
"https://superuser.com",
"https://superuser.com/users/-1/"
] | I found all the drivers I needed at the Lenovo site for my recent upgrade of my T61. I did a clean install of 7 Ultimate. Once I had the NIC and video drivers loaded from a USB stick, I downloaded the Lenovo maintenance package that includes the update applet. This found all other drivers and updates. The TPM driver an... | Lenovo had posted some instructions on their website for how to do this. The page has since been deleted but [an archived version](http://web.archive.org/web/20110427062636/http://www-307.ibm.com/pc/support/site.wss/MIGR-74108.html) is available. |
115,357 | I am going to clean install windows 7 upgrade version on my Thinkpad T61(currently running Windows Vista) without any bloatwares like ThinkVantage software. I am worried about the drivers. I mean what are the important drivers i should download first to get my system going after the machine is formatted. | 2010/03/02 | [
"https://superuser.com/questions/115357",
"https://superuser.com",
"https://superuser.com/users/-1/"
] | I found all the drivers I needed at the Lenovo site for my recent upgrade of my T61. I did a clean install of 7 Ultimate. Once I had the NIC and video drivers loaded from a USB stick, I downloaded the Lenovo maintenance package that includes the update applet. This found all other drivers and updates. The TPM driver an... | It takes a little digging but [lenovo](http://support.lenovo.com/en_US/research/hints-or-tips/detail.page?&LegacyDocID=MIGR-67853) has drivers on their site - IBM no longer maintains the thinkpad support and driver site - though the drivers for that specfic model seem incomplete for windows 7 but if there's a missing d... |
115,357 | I am going to clean install windows 7 upgrade version on my Thinkpad T61(currently running Windows Vista) without any bloatwares like ThinkVantage software. I am worried about the drivers. I mean what are the important drivers i should download first to get my system going after the machine is formatted. | 2010/03/02 | [
"https://superuser.com/questions/115357",
"https://superuser.com",
"https://superuser.com/users/-1/"
] | I did a clean install of Windows 7 64-bit on my Thinkpad recently. Windows recognized all my hardware out of the box. Saved me the trouble of installing Lenovo bloatware. A few optional Lenovo drivers appeared in Windows Update (under optional updates), but I chose not to install them. | Lenovo had posted some instructions on their website for how to do this. The page has since been deleted but [an archived version](http://web.archive.org/web/20110427062636/http://www-307.ibm.com/pc/support/site.wss/MIGR-74108.html) is available. |
115,357 | I am going to clean install windows 7 upgrade version on my Thinkpad T61(currently running Windows Vista) without any bloatwares like ThinkVantage software. I am worried about the drivers. I mean what are the important drivers i should download first to get my system going after the machine is formatted. | 2010/03/02 | [
"https://superuser.com/questions/115357",
"https://superuser.com",
"https://superuser.com/users/-1/"
] | I did a clean install of Windows 7 64-bit on my Thinkpad recently. Windows recognized all my hardware out of the box. Saved me the trouble of installing Lenovo bloatware. A few optional Lenovo drivers appeared in Windows Update (under optional updates), but I chose not to install them. | It takes a little digging but [lenovo](http://support.lenovo.com/en_US/research/hints-or-tips/detail.page?&LegacyDocID=MIGR-67853) has drivers on their site - IBM no longer maintains the thinkpad support and driver site - though the drivers for that specfic model seem incomplete for windows 7 but if there's a missing d... |
115,357 | I am going to clean install windows 7 upgrade version on my Thinkpad T61(currently running Windows Vista) without any bloatwares like ThinkVantage software. I am worried about the drivers. I mean what are the important drivers i should download first to get my system going after the machine is formatted. | 2010/03/02 | [
"https://superuser.com/questions/115357",
"https://superuser.com",
"https://superuser.com/users/-1/"
] | It takes a little digging but [lenovo](http://support.lenovo.com/en_US/research/hints-or-tips/detail.page?&LegacyDocID=MIGR-67853) has drivers on their site - IBM no longer maintains the thinkpad support and driver site - though the drivers for that specfic model seem incomplete for windows 7 but if there's a missing d... | Lenovo had posted some instructions on their website for how to do this. The page has since been deleted but [an archived version](http://web.archive.org/web/20110427062636/http://www-307.ibm.com/pc/support/site.wss/MIGR-74108.html) is available. |
18,838,781 | so basically user enters a sequence from an scanner input.
`12, 3, 4`, etc.
It can be of any length long and it has to be integers.
I want to convert the string input to an integer array.
so `int[0]` would be `12`, `int[1]` would be `3`, etc.
Any tips and ideas? I was thinking of implementing `if charat(i) ==... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18838781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/850673/"
] | You could read the entire input line from scanner, then split the line by `,` then you have a `String[]`, parse each number into `int[]` with index one to one matching...(assuming valid input and no `NumberFormatExceptions`) like
```
String line = scanner.nextLine();
String[] numberStrs = line.split(",");
int[] number... | ```
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
class MultiArg {
Scanner sc;
int n;
String as;
List<Integer> numList = new ArrayList<Integer>();
public void fun() {
sc = new Scanner(System.in);
System.out.println("enter value");
while (sc.h... |
18,838,781 | so basically user enters a sequence from an scanner input.
`12, 3, 4`, etc.
It can be of any length long and it has to be integers.
I want to convert the string input to an integer array.
so `int[0]` would be `12`, `int[1]` would be `3`, etc.
Any tips and ideas? I was thinking of implementing `if charat(i) ==... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18838781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/850673/"
] | For Java 8 and higher:
```
String[] test = {"1", "2", "3", "4", "5"};
int[] ints = Arrays.stream(test).mapToInt(Integer::parseInt).toArray();
``` | Java has a method for this, "convertStringArrayToIntArray".
```
String numbers = sc.nextLine();
int[] intArray = convertStringArrayToIntArray(numbers.split(", "));
``` |
18,838,781 | so basically user enters a sequence from an scanner input.
`12, 3, 4`, etc.
It can be of any length long and it has to be integers.
I want to convert the string input to an integer array.
so `int[0]` would be `12`, `int[1]` would be `3`, etc.
Any tips and ideas? I was thinking of implementing `if charat(i) ==... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18838781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/850673/"
] | You could read the entire input line from scanner, then split the line by `,` then you have a `String[]`, parse each number into `int[]` with index one to one matching...(assuming valid input and no `NumberFormatExceptions`) like
```
String line = scanner.nextLine();
String[] numberStrs = line.split(",");
int[] number... | Java has a method for this, "convertStringArrayToIntArray".
```
String numbers = sc.nextLine();
int[] intArray = convertStringArrayToIntArray(numbers.split(", "));
``` |
18,838,781 | so basically user enters a sequence from an scanner input.
`12, 3, 4`, etc.
It can be of any length long and it has to be integers.
I want to convert the string input to an integer array.
so `int[0]` would be `12`, `int[1]` would be `3`, etc.
Any tips and ideas? I was thinking of implementing `if charat(i) ==... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18838781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/850673/"
] | `Stream.of().mapToInt().toArray()` seems to be the best options.
```
int[] arr = Stream.of(new String[]{"1", "2", "3"})
.mapToInt(Integer::parseInt).toArray();
System.out.println(Arrays.toString(arr));
``` | ```
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
class MultiArg {
Scanner sc;
int n;
String as;
List<Integer> numList = new ArrayList<Integer>();
public void fun() {
sc = new Scanner(System.in);
System.out.println("enter value");
while (sc.h... |
18,838,781 | so basically user enters a sequence from an scanner input.
`12, 3, 4`, etc.
It can be of any length long and it has to be integers.
I want to convert the string input to an integer array.
so `int[0]` would be `12`, `int[1]` would be `3`, etc.
Any tips and ideas? I was thinking of implementing `if charat(i) ==... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18838781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/850673/"
] | You could read the entire input line from scanner, then split the line by `,` then you have a `String[]`, parse each number into `int[]` with index one to one matching...(assuming valid input and no `NumberFormatExceptions`) like
```
String line = scanner.nextLine();
String[] numberStrs = line.split(",");
int[] number... | `Stream.of().mapToInt().toArray()` seems to be the best options.
```
int[] arr = Stream.of(new String[]{"1", "2", "3"})
.mapToInt(Integer::parseInt).toArray();
System.out.println(Arrays.toString(arr));
``` |
18,838,781 | so basically user enters a sequence from an scanner input.
`12, 3, 4`, etc.
It can be of any length long and it has to be integers.
I want to convert the string input to an integer array.
so `int[0]` would be `12`, `int[1]` would be `3`, etc.
Any tips and ideas? I was thinking of implementing `if charat(i) ==... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18838781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/850673/"
] | ```
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
class MultiArg {
Scanner sc;
int n;
String as;
List<Integer> numList = new ArrayList<Integer>();
public void fun() {
sc = new Scanner(System.in);
System.out.println("enter value");
while (sc.h... | Java has a method for this, "convertStringArrayToIntArray".
```
String numbers = sc.nextLine();
int[] intArray = convertStringArrayToIntArray(numbers.split(", "));
``` |
18,838,781 | so basically user enters a sequence from an scanner input.
`12, 3, 4`, etc.
It can be of any length long and it has to be integers.
I want to convert the string input to an integer array.
so `int[0]` would be `12`, `int[1]` would be `3`, etc.
Any tips and ideas? I was thinking of implementing `if charat(i) ==... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18838781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/850673/"
] | `Stream.of().mapToInt().toArray()` seems to be the best options.
```
int[] arr = Stream.of(new String[]{"1", "2", "3"})
.mapToInt(Integer::parseInt).toArray();
System.out.println(Arrays.toString(arr));
``` | Converting String array into stream and mapping to int is the best option available in java 8.
```
String[] stringArray = new String[] { "0", "1", "2" };
int[] intArray = Stream.of(stringArray).mapToInt(Integer::parseInt).toArray();
System.out.println(Arrays.toString(intArray));
``` |
18,838,781 | so basically user enters a sequence from an scanner input.
`12, 3, 4`, etc.
It can be of any length long and it has to be integers.
I want to convert the string input to an integer array.
so `int[0]` would be `12`, `int[1]` would be `3`, etc.
Any tips and ideas? I was thinking of implementing `if charat(i) ==... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18838781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/850673/"
] | You could read the entire input line from scanner, then split the line by `,` then you have a `String[]`, parse each number into `int[]` with index one to one matching...(assuming valid input and no `NumberFormatExceptions`) like
```
String line = scanner.nextLine();
String[] numberStrs = line.split(",");
int[] number... | Converting String array into stream and mapping to int is the best option available in java 8.
```
String[] stringArray = new String[] { "0", "1", "2" };
int[] intArray = Stream.of(stringArray).mapToInt(Integer::parseInt).toArray();
System.out.println(Arrays.toString(intArray));
``` |
18,838,781 | so basically user enters a sequence from an scanner input.
`12, 3, 4`, etc.
It can be of any length long and it has to be integers.
I want to convert the string input to an integer array.
so `int[0]` would be `12`, `int[1]` would be `3`, etc.
Any tips and ideas? I was thinking of implementing `if charat(i) ==... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18838781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/850673/"
] | You could read the entire input line from scanner, then split the line by `,` then you have a `String[]`, parse each number into `int[]` with index one to one matching...(assuming valid input and no `NumberFormatExceptions`) like
```
String line = scanner.nextLine();
String[] numberStrs = line.split(",");
int[] number... | For Java 8 and higher:
```
String[] test = {"1", "2", "3", "4", "5"};
int[] ints = Arrays.stream(test).mapToInt(Integer::parseInt).toArray();
``` |
18,838,781 | so basically user enters a sequence from an scanner input.
`12, 3, 4`, etc.
It can be of any length long and it has to be integers.
I want to convert the string input to an integer array.
so `int[0]` would be `12`, `int[1]` would be `3`, etc.
Any tips and ideas? I was thinking of implementing `if charat(i) ==... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18838781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/850673/"
] | Converting String array into stream and mapping to int is the best option available in java 8.
```
String[] stringArray = new String[] { "0", "1", "2" };
int[] intArray = Stream.of(stringArray).mapToInt(Integer::parseInt).toArray();
System.out.println(Arrays.toString(intArray));
``` | ```
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
class MultiArg {
Scanner sc;
int n;
String as;
List<Integer> numList = new ArrayList<Integer>();
public void fun() {
sc = new Scanner(System.in);
System.out.println("enter value");
while (sc.h... |
46,955,418 | I am wondering why I do not get se same output from:
`ls -1 -tF | head -n 1`
and
`echo $(ls -1 -tF | head -n 1)`
I tried to get the last modified file, but using it inside a sub shell sometimes I get more than one file as result?
Why that and how to avoid? | 2017/10/26 | [
"https://Stackoverflow.com/questions/46955418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7226415/"
] | The problem arises because you are using an unquoted subshell and `-F` flag for ls outputs shell special characters appended to filenames.
>
> **-F, --classify**
>
> append indicator (one of \*/=>@|) to entries
>
>
>
Executable files are appended with \*.
When you run
```
echo $(ls -1 -tF | head -n 1)
```... | I just found the error:
If you use `echo $(ls -1 -tF | head -n 1)`
the file globing mechanism may result in additional matches.
So `echo "$(ls -1 -tF | head -n 1)"` would avoid this.
Because if the result is an executable it contains a \* at the end.
I tried to place the **why -F** in a comment, but now I decided to... |
19,725,068 | I am trying to follow the instructions on <http://unslider.com/> but I can't get it to work.
This is what I have, nothing displays.
```
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://unslider.com/unslider.min.js"></script>
<style>
.banner { ... | 2013/11/01 | [
"https://Stackoverflow.com/questions/19725068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843900/"
] | Because you don't have any `css` added in your code, where original side has following css added
```
http://unslider.com/style.css
```
[Check this working example.](http://jsfiddle.net/Zq8vm/) | Probably you miss the CSS styles. Put this in your `<head>`:
```
<style>
@import url("http://unslider.com/style.css");
.banner { position: relative; overflow: auto; }
.banner li { list-style: none; }
.banner ul li { float: left; }
</style>
```
[**JSBIN**](http://jsbin.com/AmUXimE/2/edit) |
19,725,068 | I am trying to follow the instructions on <http://unslider.com/> but I can't get it to work.
This is what I have, nothing displays.
```
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://unslider.com/unslider.min.js"></script>
<style>
.banner { ... | 2013/11/01 | [
"https://Stackoverflow.com/questions/19725068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843900/"
] | If you want to see some images , add some images
```
<html>
<head>
<style>
.banner { position: relative; overflow: auto; }
.banner li { list-style: none; }
.banner ul li { float: left; }
</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://unslider.com/unslider.... | Probably you miss the CSS styles. Put this in your `<head>`:
```
<style>
@import url("http://unslider.com/style.css");
.banner { position: relative; overflow: auto; }
.banner li { list-style: none; }
.banner ul li { float: left; }
</style>
```
[**JSBIN**](http://jsbin.com/AmUXimE/2/edit) |
19,725,068 | I am trying to follow the instructions on <http://unslider.com/> but I can't get it to work.
This is what I have, nothing displays.
```
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://unslider.com/unslider.min.js"></script>
<style>
.banner { ... | 2013/11/01 | [
"https://Stackoverflow.com/questions/19725068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843900/"
] | Check this nice tutorial!
<http://www.youtube.com/watch?v=qBOB9scHnwo>
1. You need to include the scripts
```
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://unslider.com/unslider.min.js"></script>
```
2. the styles for the banner div
```
<style>
.banner {
positi... | Probably you miss the CSS styles. Put this in your `<head>`:
```
<style>
@import url("http://unslider.com/style.css");
.banner { position: relative; overflow: auto; }
.banner li { list-style: none; }
.banner ul li { float: left; }
</style>
```
[**JSBIN**](http://jsbin.com/AmUXimE/2/edit) |
19,725,068 | I am trying to follow the instructions on <http://unslider.com/> but I can't get it to work.
This is what I have, nothing displays.
```
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://unslider.com/unslider.min.js"></script>
<style>
.banner { ... | 2013/11/01 | [
"https://Stackoverflow.com/questions/19725068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843900/"
] | If you want to see some images , add some images
```
<html>
<head>
<style>
.banner { position: relative; overflow: auto; }
.banner li { list-style: none; }
.banner ul li { float: left; }
</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://unslider.com/unslider.... | Because you don't have any `css` added in your code, where original side has following css added
```
http://unslider.com/style.css
```
[Check this working example.](http://jsfiddle.net/Zq8vm/) |
19,725,068 | I am trying to follow the instructions on <http://unslider.com/> but I can't get it to work.
This is what I have, nothing displays.
```
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://unslider.com/unslider.min.js"></script>
<style>
.banner { ... | 2013/11/01 | [
"https://Stackoverflow.com/questions/19725068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843900/"
] | Because you don't have any `css` added in your code, where original side has following css added
```
http://unslider.com/style.css
```
[Check this working example.](http://jsfiddle.net/Zq8vm/) | Check this nice tutorial!
<http://www.youtube.com/watch?v=qBOB9scHnwo>
1. You need to include the scripts
```
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://unslider.com/unslider.min.js"></script>
```
2. the styles for the banner div
```
<style>
.banner {
positi... |
19,725,068 | I am trying to follow the instructions on <http://unslider.com/> but I can't get it to work.
This is what I have, nothing displays.
```
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://unslider.com/unslider.min.js"></script>
<style>
.banner { ... | 2013/11/01 | [
"https://Stackoverflow.com/questions/19725068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843900/"
] | If you want to see some images , add some images
```
<html>
<head>
<style>
.banner { position: relative; overflow: auto; }
.banner li { list-style: none; }
.banner ul li { float: left; }
</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://unslider.com/unslider.... | Check this nice tutorial!
<http://www.youtube.com/watch?v=qBOB9scHnwo>
1. You need to include the scripts
```
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://unslider.com/unslider.min.js"></script>
```
2. the styles for the banner div
```
<style>
.banner {
positi... |
2,109,352 | Django settings includes a list of python variables that are used for a plethora of things from database settings to installed apps. Even many of the reusable apps make some of the settings required.
With a dozens of sites, it is hard to manage the settings of all the projects.
Fortunately settings is just a python m... | 2010/01/21 | [
"https://Stackoverflow.com/questions/2109352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55562/"
] | Often I've seen settings files with something like:
```
from localsettings import *
```
and in `localsettings.py` things like database connections and `DEBUG` values are defined. `localsettings.py` is (or may be) different for each deployment environment (dev/staging/production etc), and doesn't live in source contr... | Follow this settings override example to handle dev, staging, and production environments.
<http://djangodose.com/articles/2009/09/handling-development-staging-and-production-enviro/>
[(archived version at Wayback Machine)](http://web.archive.org/web/20110207112935/http://djangodose.com/articles/2009/09/handling-deve... |
2,109,352 | Django settings includes a list of python variables that are used for a plethora of things from database settings to installed apps. Even many of the reusable apps make some of the settings required.
With a dozens of sites, it is hard to manage the settings of all the projects.
Fortunately settings is just a python m... | 2010/01/21 | [
"https://Stackoverflow.com/questions/2109352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55562/"
] | Often I've seen settings files with something like:
```
from localsettings import *
```
and in `localsettings.py` things like database connections and `DEBUG` values are defined. `localsettings.py` is (or may be) different for each deployment environment (dev/staging/production etc), and doesn't live in source contr... | Personally, I like it to make a module out of settings like
```
project/
settings/
__init__.py
settings.py
local.py
```
The file `__init__.py` looks like:
```
from .settings import *
from .local import *
```
You have adopt the variable BASE\_DIR to point to the directory one level higher.
Using thi... |
1,392 | I have seen code in an answer to this [question](https://wordpress.stackexchange.com/questions/1059?tab=newest#tab-top), how to remove the promotional back link to WordPress.org in my theme. I have added this to my theme's CSS but there is no change.
Am I missing see some thing? Apologies for my Ignorance .
Code I ha... | 2010/09/06 | [
"https://wordpress.stackexchange.com/questions/1392",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/391/"
] | Here is the code I always use whenever I setup a new wordpress blog:
CUSTOM ADMIN FOOTER TEXT
```
// CUSTOMIZE ADMIN FOOTER TEXT
function custom_admin_footer() {
echo '<a href="http://www.netconstructor.com/">Website Design by NetConstructor, Inc.</a>';
}
add_filter('admin_footer_text', 'custom_admin_foo... | "site-generator" is the div id assigned to the Powered by WordPress link in Twentyten, the default theme. Many other themes also contain a powered by WordPress link in the footer but might not assign the same div id as Twentyten.
To find the div id or class assigned to the the link in the footer of your theme you can... |
1,392 | I have seen code in an answer to this [question](https://wordpress.stackexchange.com/questions/1059?tab=newest#tab-top), how to remove the promotional back link to WordPress.org in my theme. I have added this to my theme's CSS but there is no change.
Am I missing see some thing? Apologies for my Ignorance .
Code I ha... | 2010/09/06 | [
"https://wordpress.stackexchange.com/questions/1392",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/391/"
] | "site-generator" is the div id assigned to the Powered by WordPress link in Twentyten, the default theme. Many other themes also contain a powered by WordPress link in the footer but might not assign the same div id as Twentyten.
To find the div id or class assigned to the the link in the footer of your theme you can... | This plugin works pretty well <http://wordpress.org/extend/plugins/white-label-cms/> |
1,392 | I have seen code in an answer to this [question](https://wordpress.stackexchange.com/questions/1059?tab=newest#tab-top), how to remove the promotional back link to WordPress.org in my theme. I have added this to my theme's CSS but there is no change.
Am I missing see some thing? Apologies for my Ignorance .
Code I ha... | 2010/09/06 | [
"https://wordpress.stackexchange.com/questions/1392",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/391/"
] | Here is the code I always use whenever I setup a new wordpress blog:
CUSTOM ADMIN FOOTER TEXT
```
// CUSTOMIZE ADMIN FOOTER TEXT
function custom_admin_footer() {
echo '<a href="http://www.netconstructor.com/">Website Design by NetConstructor, Inc.</a>';
}
add_filter('admin_footer_text', 'custom_admin_foo... | When doing it with CSS, make sure you are using firebug to see if the rule you are trying to apply is being applied to the element. It could be that there is a more specific rule, an equally specific but later defined rule, or even an inline rule overriding that your custom rule. |
1,392 | I have seen code in an answer to this [question](https://wordpress.stackexchange.com/questions/1059?tab=newest#tab-top), how to remove the promotional back link to WordPress.org in my theme. I have added this to my theme's CSS but there is no change.
Am I missing see some thing? Apologies for my Ignorance .
Code I ha... | 2010/09/06 | [
"https://wordpress.stackexchange.com/questions/1392",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/391/"
] | Here is the code I always use whenever I setup a new wordpress blog:
CUSTOM ADMIN FOOTER TEXT
```
// CUSTOMIZE ADMIN FOOTER TEXT
function custom_admin_footer() {
echo '<a href="http://www.netconstructor.com/">Website Design by NetConstructor, Inc.</a>';
}
add_filter('admin_footer_text', 'custom_admin_foo... | This plugin works pretty well <http://wordpress.org/extend/plugins/white-label-cms/> |
1,392 | I have seen code in an answer to this [question](https://wordpress.stackexchange.com/questions/1059?tab=newest#tab-top), how to remove the promotional back link to WordPress.org in my theme. I have added this to my theme's CSS but there is no change.
Am I missing see some thing? Apologies for my Ignorance .
Code I ha... | 2010/09/06 | [
"https://wordpress.stackexchange.com/questions/1392",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/391/"
] | When doing it with CSS, make sure you are using firebug to see if the rule you are trying to apply is being applied to the element. It could be that there is a more specific rule, an equally specific but later defined rule, or even an inline rule overriding that your custom rule. | This plugin works pretty well <http://wordpress.org/extend/plugins/white-label-cms/> |
2,230 | This morning I woke up to find my iPhone dark. If I pressed the home button to turn on the screen, the backlight would flash on briefly and then die. I've turned it on and off, done a hard reboot (home+lock), and I'm in the process of trying a restore.
Has anyone ever seen a similar issue?
The phone was purchased las... | 2010/07/31 | [
"https://apple.stackexchange.com/questions/2230",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/-1/"
] | You should take your phone in. They will fix it if they can and it's cheaper for them than giving you a new.
If you try to fix it yourself they can put the blame on you, so don't touch the hardware. | It may be your proximity sensor. It's what causes the backlight to turn off when you put the phone to your face and turn back on when you move away. I was told that that's one of the few things Apple Care does actually cover.
But before you take it in, do you have a bumper on your iPhone? If so, it may be covering th... |
38,625,617 | I have a custom log window using RichTextBox, where I highlight log messages from a third party console app (running in a `Process` with Standard Input/Error redirect).
The log messages appears like this:
```
[Info] Bla bla bla
[Status] Bla bla bla
[SQL] Bla bla bla
```
I want to highlight the text according to out... | 2016/07/28 | [
"https://Stackoverflow.com/questions/38625617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2332336/"
] | If you want to find the term nearest the start of the string you can't use `Contains` because it doesn't tell you where in the string the term is. To do that you're going to have to sort the position of each term in the string, and select the first term. You can do that in LINQ with:
```
var termHighlight = new Dictio... | Why don't simply find the substring you are interested in? For example:
```
this.UIThread(() =>
{
// Workout message colour
Color messageColor = normalText;
int closingBracketIndex = outputMessage.IndexOf(']');
if (closingBracketIndex > 2)
{
string msgType = outputMessage.Substring(1, clos... |
38,625,617 | I have a custom log window using RichTextBox, where I highlight log messages from a third party console app (running in a `Process` with Standard Input/Error redirect).
The log messages appears like this:
```
[Info] Bla bla bla
[Status] Bla bla bla
[SQL] Bla bla bla
```
I want to highlight the text according to out... | 2016/07/28 | [
"https://Stackoverflow.com/questions/38625617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2332336/"
] | If you want to find the term nearest the start of the string you can't use `Contains` because it doesn't tell you where in the string the term is. To do that you're going to have to sort the position of each term in the string, and select the first term. You can do that in LINQ with:
```
var termHighlight = new Dictio... | You never delare the "[Info]" status.
When you put this as first "if", the "else" statements would not be hit.
```
// Workout message colour
Color messageColor;
If (outputMessage.Contains("[Info]"))
messageColor=normalText;
if (outputMessage.Contains("[SQL]"))
messageColor = sqlText;
else if (outputMessage.Co... |
38,625,617 | I have a custom log window using RichTextBox, where I highlight log messages from a third party console app (running in a `Process` with Standard Input/Error redirect).
The log messages appears like this:
```
[Info] Bla bla bla
[Status] Bla bla bla
[SQL] Bla bla bla
```
I want to highlight the text according to out... | 2016/07/28 | [
"https://Stackoverflow.com/questions/38625617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2332336/"
] | If you want to find the term nearest the start of the string you can't use `Contains` because it doesn't tell you where in the string the term is. To do that you're going to have to sort the position of each term in the string, and select the first term. You can do that in LINQ with:
```
var termHighlight = new Dictio... | Do something like use a regex:
```
var regex = new System.Text.RegularExpressions.Regex(@"^\[ \d{2}:\d{2}:\d{2} \] (\[\w+\])");
var match = regex.Match("[ 22:11:22 ] [Info]: [SQL] Blah");
if (string.Equals(match.Groups[1], "[Info]")) {
...
}
``` |
38,625,617 | I have a custom log window using RichTextBox, where I highlight log messages from a third party console app (running in a `Process` with Standard Input/Error redirect).
The log messages appears like this:
```
[Info] Bla bla bla
[Status] Bla bla bla
[SQL] Bla bla bla
```
I want to highlight the text according to out... | 2016/07/28 | [
"https://Stackoverflow.com/questions/38625617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2332336/"
] | If you want to find the term nearest the start of the string you can't use `Contains` because it doesn't tell you where in the string the term is. To do that you're going to have to sort the position of each term in the string, and select the first term. You can do that in LINQ with:
```
var termHighlight = new Dictio... | You could implement a base class for every status and their especializations:
```
public abstract class Status
{
public abstract Color Color { get; }
public abstract string Pattern { get; }
public int GetIndex(string lookup)
{
return lookup.IndexOf(Pattern);
}
}
public class StatusSql : ... |
35,585,040 | I have an app / site where I'm using `-webkit-overflow-scrolling: touch;` to make the scrolling smooth on iOS.
However, recently it started causing my navbar disappear upon initial load (using iOS) and it only appears when certain elements were scrolled up or down, it makes the navbar completely unusable.
If I commen... | 2016/02/23 | [
"https://Stackoverflow.com/questions/35585040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4263307/"
] | I had the same problem. I had a list of items with `-webkit-transform: translate3d(0,0,0);` that were not showing as soon as I enabled `-webkit-overflow-scrolling: touch;`. My problem was that I had the elements with `-webkit-transform: translate3d(0,0,0);` nested inside another div.
In other words, there was a div i... | I had the same problem. In my case I was trying to use `::before` to display an overlay. I worked on Chrome, but not in Safari/iPhone. I end up not using it in the end, I replace it with `::after` |
52,677,689 | I have a `Scanner` and i am getting day of the week from console then i want to show day in `JOptionPane.showMessageDialog` method but its not working.
```
public class TestClass {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String day = scan.nextLine();
... | 2018/10/06 | [
"https://Stackoverflow.com/questions/52677689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6485135/"
] | Not sure if this helps, but I could find no issue with your code. Sharing what I've tried and maybe that'll help you debug your issue.
```
package simple.concepts.com;
import java.util.Scanner;
import javax.swing.JOptionPane;
public class Test {
public static void main(String[] args) {
Scanner scan = ne... | As a temporary solution you could create a JFrame and call the JOptionpane with the frame as it's parent component.
```
import javax.swing.*
// Other imp code
JFrame m = new JFrame();
JOptionpane.showMessageDialog(m,day);
``` |
19,040 | For the 2017 elections, the Labour Party [proposes](http://www.labour.org.uk/index.php/manifesto2017/economy):
>
> Bring private rail companies back into public ownership as their franchises expire.
>
>
>
[Eurostar](https://en.wikipedia.org/wiki/Eurostar) is not subject to franchising, and the UK government sold ... | 2017/05/17 | [
"https://politics.stackexchange.com/questions/19040",
"https://politics.stackexchange.com",
"https://politics.stackexchange.com/users/130/"
] | The Eurostar ownership is not subject to franchising, and there is no proposal to repurchase the shares in Eurostar that were sold. There is no public policy in the Labour Party to re-nationalise any part of Eurostar.
This could change, particularly if Eurostar were to start having significant financial problems. Or i... | The Channel Tunnel concession operated by Eurostar is established by British-French Treaty. By international law, parties can withdraw from treaties in a manner specified in that treaty. But only if a treaty does not specify a means of withdrawal can a party withdraw by giving the other parties notice of its intent to ... |
69,829,699 | I have a webpage where I want user to take a picture with his laptop/phone camera.
Once he clicks on a button a modal is shown and the following js will start the camera stream to take the picture:
```
function startStreaming() {
if (null != cameraStream) {
var track = cameraStream.getTracks()[... | 2021/11/03 | [
"https://Stackoverflow.com/questions/69829699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2399035/"
] | If any track has not been stopped then your camera will still be active. In your `stopStreaming` function you only stop the first track in the returned array.
If you instead iterate through the tracks you may catch ones you aren't currently:
```
function stopStreaming() {
if (null != cameraStream) {
... | ```
this.camera_stream.getTracks().forEach((track) => {
console.log(track);
track.stop();
**track.enabled = false**
});
video.load()
this.camera_stream = null
``` |
15,894,182 | Just starting out with Python, so this is probably my mistake, but...
I'm trying out Python. I like to use it as a calculator, and I'm slowly working through some tutorials.
I ran into something weird today. I wanted to find out 2013\*2013, but I wrote the wrong thing and wrote 2013\*013, and got this:
```
>>> 2013*... | 2013/04/09 | [
"https://Stackoverflow.com/questions/15894182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2174862/"
] | Because of octal arithmetic, 013 is actually the integer 11.
```
>>> 013
11
```
With a leading zero, `013` is interpreted as a base-8 number and 1\*81 + 3\*80 = 11.
Note: this behaviour was [changed in python 3](http://docs.python.org/release/3.0.1/whatsnew/2.6.html#pep-3127-integer-literal-support-and-syntax). H... | `013` is an octal integer literal (equivalent to the decimal integer literal `11`), due to the leading 0.
```
>>> 2013*013
22143
>>> 2013*11
22143
>>> 2013*13
26169
```
It is very common (certainly in most of the languages I'm familiar with) to have octal integer literals start with `0` and hexadecimal integer liter... |
15,894,182 | Just starting out with Python, so this is probably my mistake, but...
I'm trying out Python. I like to use it as a calculator, and I'm slowly working through some tutorials.
I ran into something weird today. I wanted to find out 2013\*2013, but I wrote the wrong thing and wrote 2013\*013, and got this:
```
>>> 2013*... | 2013/04/09 | [
"https://Stackoverflow.com/questions/15894182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2174862/"
] | Because of octal arithmetic, 013 is actually the integer 11.
```
>>> 013
11
```
With a leading zero, `013` is interpreted as a base-8 number and 1\*81 + 3\*80 = 11.
Note: this behaviour was [changed in python 3](http://docs.python.org/release/3.0.1/whatsnew/2.6.html#pep-3127-integer-literal-support-and-syntax). H... | This is mostly just expanding on @Wim's answer a bit, but Python indicates the base of integer literals using certain prefixes. Without a prefix, integers are interpreted as being in base-10. With an "0x", the integer will be interpreted as a hexadecimal int. The full grammar specification is here, though it's a bit tr... |
15,894,182 | Just starting out with Python, so this is probably my mistake, but...
I'm trying out Python. I like to use it as a calculator, and I'm slowly working through some tutorials.
I ran into something weird today. I wanted to find out 2013\*2013, but I wrote the wrong thing and wrote 2013\*013, and got this:
```
>>> 2013*... | 2013/04/09 | [
"https://Stackoverflow.com/questions/15894182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2174862/"
] | Because of octal arithmetic, 013 is actually the integer 11.
```
>>> 013
11
```
With a leading zero, `013` is interpreted as a base-8 number and 1\*81 + 3\*80 = 11.
Note: this behaviour was [changed in python 3](http://docs.python.org/release/3.0.1/whatsnew/2.6.html#pep-3127-integer-literal-support-and-syntax). H... | Python's 'leading zero' syntax for octal literals is a common gotcha:
```
Python 2.7.3
>>> 010
8
```
The syntax was changed in Python 3.x <http://docs.python.org/3.0/whatsnew/3.0.html#integers> |
15,894,182 | Just starting out with Python, so this is probably my mistake, but...
I'm trying out Python. I like to use it as a calculator, and I'm slowly working through some tutorials.
I ran into something weird today. I wanted to find out 2013\*2013, but I wrote the wrong thing and wrote 2013\*013, and got this:
```
>>> 2013*... | 2013/04/09 | [
"https://Stackoverflow.com/questions/15894182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2174862/"
] | `013` is an octal integer literal (equivalent to the decimal integer literal `11`), due to the leading 0.
```
>>> 2013*013
22143
>>> 2013*11
22143
>>> 2013*13
26169
```
It is very common (certainly in most of the languages I'm familiar with) to have octal integer literals start with `0` and hexadecimal integer liter... | This is mostly just expanding on @Wim's answer a bit, but Python indicates the base of integer literals using certain prefixes. Without a prefix, integers are interpreted as being in base-10. With an "0x", the integer will be interpreted as a hexadecimal int. The full grammar specification is here, though it's a bit tr... |
15,894,182 | Just starting out with Python, so this is probably my mistake, but...
I'm trying out Python. I like to use it as a calculator, and I'm slowly working through some tutorials.
I ran into something weird today. I wanted to find out 2013\*2013, but I wrote the wrong thing and wrote 2013\*013, and got this:
```
>>> 2013*... | 2013/04/09 | [
"https://Stackoverflow.com/questions/15894182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2174862/"
] | `013` is an octal integer literal (equivalent to the decimal integer literal `11`), due to the leading 0.
```
>>> 2013*013
22143
>>> 2013*11
22143
>>> 2013*13
26169
```
It is very common (certainly in most of the languages I'm familiar with) to have octal integer literals start with `0` and hexadecimal integer liter... | Python's 'leading zero' syntax for octal literals is a common gotcha:
```
Python 2.7.3
>>> 010
8
```
The syntax was changed in Python 3.x <http://docs.python.org/3.0/whatsnew/3.0.html#integers> |
118,676 | I have recently read about the german enigma machine in WW2, It worked in a way that every day the machine configuration was sent per mail to the different operators.
(I couldn't find official sources on this, please do suggest an edit if i said something wrong)
Obviously these ciphers could be confiscated by the alli... | 2016/03/27 | [
"https://security.stackexchange.com/questions/118676",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/105715/"
] | Take a look at [this](https://security.stackexchange.com/a/45971) explanation of the Diffie-Hellman key exchange. The central point is that due to some clever mathematics, both parties are able to compute the secret key, while being certain that no one else could have done the same.
If you spend a couple of minutes lo... | With public key cryptography everyone knows the public key but it is useless if you want to decrypt data. You can only encrpyt data to be sent to the user that has the private key associated with that specific public key.
So the public key has an associated private key that is used to decrypt.
Read about RSA. |
118,676 | I have recently read about the german enigma machine in WW2, It worked in a way that every day the machine configuration was sent per mail to the different operators.
(I couldn't find official sources on this, please do suggest an edit if i said something wrong)
Obviously these ciphers could be confiscated by the alli... | 2016/03/27 | [
"https://security.stackexchange.com/questions/118676",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/105715/"
] | There are a lot of complex concepts here, but they can be broken down into a few simple statements. I'll explain the RSA key exchange here as it's pretty straightforward. First, we have to start with a couple of basic facts:
Given: Symmetric encryption uses the same key for encryption as decryption.
* The symmetric k... | With public key cryptography everyone knows the public key but it is useless if you want to decrypt data. You can only encrpyt data to be sent to the user that has the private key associated with that specific public key.
So the public key has an associated private key that is used to decrypt.
Read about RSA. |
118,676 | I have recently read about the german enigma machine in WW2, It worked in a way that every day the machine configuration was sent per mail to the different operators.
(I couldn't find official sources on this, please do suggest an edit if i said something wrong)
Obviously these ciphers could be confiscated by the alli... | 2016/03/27 | [
"https://security.stackexchange.com/questions/118676",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/105715/"
] | Several other people have contributed answers on the technical issues you are having trouble understanding. But I notice at least two poor assumptions in your question(s).
1) The German Enigma machine was a quite an innovative device, and we were lucky to defeat it. It wasn't just brute force, at least one device was ... | With public key cryptography everyone knows the public key but it is useless if you want to decrypt data. You can only encrpyt data to be sent to the user that has the private key associated with that specific public key.
So the public key has an associated private key that is used to decrypt.
Read about RSA. |
118,676 | I have recently read about the german enigma machine in WW2, It worked in a way that every day the machine configuration was sent per mail to the different operators.
(I couldn't find official sources on this, please do suggest an edit if i said something wrong)
Obviously these ciphers could be confiscated by the alli... | 2016/03/27 | [
"https://security.stackexchange.com/questions/118676",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/105715/"
] | Take a look at [this](https://security.stackexchange.com/a/45971) explanation of the Diffie-Hellman key exchange. The central point is that due to some clever mathematics, both parties are able to compute the secret key, while being certain that no one else could have done the same.
If you spend a couple of minutes lo... | There are a lot of complex concepts here, but they can be broken down into a few simple statements. I'll explain the RSA key exchange here as it's pretty straightforward. First, we have to start with a couple of basic facts:
Given: Symmetric encryption uses the same key for encryption as decryption.
* The symmetric k... |
118,676 | I have recently read about the german enigma machine in WW2, It worked in a way that every day the machine configuration was sent per mail to the different operators.
(I couldn't find official sources on this, please do suggest an edit if i said something wrong)
Obviously these ciphers could be confiscated by the alli... | 2016/03/27 | [
"https://security.stackexchange.com/questions/118676",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/105715/"
] | Take a look at [this](https://security.stackexchange.com/a/45971) explanation of the Diffie-Hellman key exchange. The central point is that due to some clever mathematics, both parties are able to compute the secret key, while being certain that no one else could have done the same.
If you spend a couple of minutes lo... | Several other people have contributed answers on the technical issues you are having trouble understanding. But I notice at least two poor assumptions in your question(s).
1) The German Enigma machine was a quite an innovative device, and we were lucky to defeat it. It wasn't just brute force, at least one device was ... |
10,028,370 | I have a page in a modal window where I am displaying a slide show. The intended audience is for tablet users and they navigate the show by swiping from the right to the left or the left to the right to see the next or previous slide. This all works beautifully.
However, in the event that someone does view the page u... | 2012/04/05 | [
"https://Stackoverflow.com/questions/10028370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/708964/"
] | Try attaching the event to `document.documentElement` instead of just `document`.
If this fails, try adding `document.body.focus()` to ensure the document is ready to receive keyboard input.
EDIT: Inside an iFrame, the event needs to be attached to the `top.document.documentElement` instead, or attached to all frames... | Maybe your key codes are wrong. Here is a page which shows you the codes for your browser: <http://asquare.net/javascript/tests/KeyCode.html>
If the codes are correct, compare the event handling code on this page with your version. |
10,028,370 | I have a page in a modal window where I am displaying a slide show. The intended audience is for tablet users and they navigate the show by swiping from the right to the left or the left to the right to see the next or previous slide. This all works beautifully.
However, in the event that someone does view the page u... | 2012/04/05 | [
"https://Stackoverflow.com/questions/10028370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/708964/"
] | Try attaching the event to `document.documentElement` instead of just `document`.
If this fails, try adding `document.body.focus()` to ensure the document is ready to receive keyboard input.
EDIT: Inside an iFrame, the event needs to be attached to the `top.document.documentElement` instead, or attached to all frames... | `document` is fine for attaching key events. Also, `keyCode` is the correct property in all major browsers for `keydown` and `keyup` events, so there's no need to mess around with `which`.
For attaching to the parent document from within an iframe, as one of your comments suggests, you need to use `parent` (for the im... |
10,028,370 | I have a page in a modal window where I am displaying a slide show. The intended audience is for tablet users and they navigate the show by swiping from the right to the left or the left to the right to see the next or previous slide. This all works beautifully.
However, in the event that someone does view the page u... | 2012/04/05 | [
"https://Stackoverflow.com/questions/10028370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/708964/"
] | `document` is fine for attaching key events. Also, `keyCode` is the correct property in all major browsers for `keydown` and `keyup` events, so there's no need to mess around with `which`.
For attaching to the parent document from within an iframe, as one of your comments suggests, you need to use `parent` (for the im... | Maybe your key codes are wrong. Here is a page which shows you the codes for your browser: <http://asquare.net/javascript/tests/KeyCode.html>
If the codes are correct, compare the event handling code on this page with your version. |
47,937,693 | In my personal Computer, I installed Ubuntu server. I want to host my website that ubuntu server.What should I do? what are the tools(software) are required? I do not know about this, So i am asking.Anybody know about this, Please clarify. Thanks!!! | 2017/12/22 | [
"https://Stackoverflow.com/questions/47937693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8541348/"
] | The [documentation](https://activeadmin.info/2-resource-customization.html#customize-the-menu) has an example for how to do this.
Using the information you've given, this might solve your problem:
```
ActiveAdmin.register Custom1 do
menu parent: "basic_entities", if: proc { request.subdomain == "foo" }
end
``` | Here is the example like, below
```
require 'domainatrix'
url = Domainatrix.parse("#{request.host}") #=> test.example.com, will change based on request
subdomain = url.subdomain # => "test.example"
if subdomain == 'test.example'
// Your code staff like hiding menu
elsif subdomain == 'test1.example'
// ... |
47,937,693 | In my personal Computer, I installed Ubuntu server. I want to host my website that ubuntu server.What should I do? what are the tools(software) are required? I do not know about this, So i am asking.Anybody know about this, Please clarify. Thanks!!! | 2017/12/22 | [
"https://Stackoverflow.com/questions/47937693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8541348/"
] | The [documentation](https://activeadmin.info/2-resource-customization.html#customize-the-menu) has an example for how to do this.
Using the information you've given, this might solve your problem:
```
ActiveAdmin.register Custom1 do
menu parent: "basic_entities", if: proc { request.subdomain == "foo" }
end
``` | you can use `request.subdomains` in your controller which return an array of current request subdomains
[subdomain docs](http://api.rubyonrails.org/v5.0/classes/ActionDispatch/Http/URL.html#method-i-subdomain) for more info |
43,959,589 | This page (<https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities>) says:
>
> Note that no more than 15 discrete comparisons are permitted within a $filter string.
>
>
>
However in my experiments I have hit that limit and not had any side effects. For example, this is from Azure ... | 2017/05/14 | [
"https://Stackoverflow.com/questions/43959589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5988923/"
] | I also tested it with REST API and Client Library. I also found that the 15 discrete comparisons limit does not exist. I can add lots of comparisons until reach the URL length limit. Here were what I tested.
1. Table REST API, 1000+ comparisons of PK.
2. Table REST API, 1000+ comparisons with different columns.
3. Tab... | I just wanted to echo what others have observed.
There doesn't seem to be a 15 comparison limitation.
Building a high-performance application on table storage requires doing as few round trips to the service as possible which means sending as much work for the server to do in a single request as possible.
It's a sha... |
43,959,589 | This page (<https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities>) says:
>
> Note that no more than 15 discrete comparisons are permitted within a $filter string.
>
>
>
However in my experiments I have hit that limit and not had any side effects. For example, this is from Azure ... | 2017/05/14 | [
"https://Stackoverflow.com/questions/43959589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5988923/"
] | I also tested it with REST API and Client Library. I also found that the 15 discrete comparisons limit does not exist. I can add lots of comparisons until reach the URL length limit. Here were what I tested.
1. Table REST API, 1000+ comparisons of PK.
2. Table REST API, 1000+ comparisons with different columns.
3. Tab... | I reached out to the appropriate Azure product group and confirmed that no 15 item limit exists in the Azure code. There will be a documentation update to reflect this. Sorry about the confusion here! |
43,959,589 | This page (<https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities>) says:
>
> Note that no more than 15 discrete comparisons are permitted within a $filter string.
>
>
>
However in my experiments I have hit that limit and not had any side effects. For example, this is from Azure ... | 2017/05/14 | [
"https://Stackoverflow.com/questions/43959589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5988923/"
] | I just wanted to echo what others have observed.
There doesn't seem to be a 15 comparison limitation.
Building a high-performance application on table storage requires doing as few round trips to the service as possible which means sending as much work for the server to do in a single request as possible.
It's a sha... | I reached out to the appropriate Azure product group and confirmed that no 15 item limit exists in the Azure code. There will be a documentation update to reflect this. Sorry about the confusion here! |
63,526,361 | I have a step function that runs a series of lambda functions. I would like to set up a lambda that will trigger this each day when ALL of the 3 input files have been updated.
I know you can trigger off of s3 events, but how can I have the requirement that all three have to have been updated? That is, I don't want the... | 2020/08/21 | [
"https://Stackoverflow.com/questions/63526361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4458718/"
] | There is no way to define a trigger that says "only run after these 3 files have been uploaded".
You would need to implement this logic yourself.
The uploads would trigger an AWS Lambda function. This function should check for the existence of the other two files. If they are present, it should continue processing. I... | As if now, there is no direct way to tigger Lambda on the basis of such conditions. You need to write your logic in a separate lambda which will trigger your step function.
You can refer [here](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/stepfunctions.html#SFN.Client.start_execution) abo... |
63,526,361 | I have a step function that runs a series of lambda functions. I would like to set up a lambda that will trigger this each day when ALL of the 3 input files have been updated.
I know you can trigger off of s3 events, but how can I have the requirement that all three have to have been updated? That is, I don't want the... | 2020/08/21 | [
"https://Stackoverflow.com/questions/63526361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4458718/"
] | Here is the solution I ended using. I'm using a single lambda with a trigger for each file. For each trigger, the lambda adds the name of the file that triggered it to a file stored on s3. It then checks if the file has all the required file names to continue. If it does, it kicks off the stepfunction and clears out th... | As if now, there is no direct way to tigger Lambda on the basis of such conditions. You need to write your logic in a separate lambda which will trigger your step function.
You can refer [here](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/stepfunctions.html#SFN.Client.start_execution) abo... |
55,114,172 | ```
import java.util.*;
import java.io.*;
class TreeSetPro
{
public static void main(String $[] )throws IOException
{
TreeSet<String> alpha=new TreeSet<String>();
alpha.add("apple");
alpha.add("Apple");
alpha.add("Ab");
alpha.add("applet");
System.out.println(a... | 2019/03/12 | [
"https://Stackoverflow.com/questions/55114172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8234870/"
] | You're confusing a few things and are possibly confused about a few confusing things.
`__len__` is not referring to `len()`, rather `len(something)` will call the `__len__` method of `something`. Any object that has a `__len__` method can be asked for its length by calling `len(something)`. Note how this is different ... | Depends on what type of object you are talking about. Say the object in question is a class, then all the attributes that come under class's namespace are listed by dir. And that includes any methods, class level variables that are specifically declared by the user + anything that is inherited. Remember classes inherit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.