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 |
|---|---|---|---|---|---|
4,212,979 | Uri test = new Uri(new Uri("http://www.google.com/test"), "foo");
returns <http://www.google.com/foo>
but Uri test = new Uri(new Uri("http://www.google.com/test/"), "foo");
returns <http://www.google.com/foo/test>
It seems the last slash is very important, is there a unified way to return
<http://www.google.com/foo... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4212979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/496949/"
] | Well, you need to ensure that your base URI ends with a `/` character:
```
public Uri CombineUris(string baseUri, string relativeUri)
{
if (!baseUri.EndsWith("/")) {
baseUri += "/";
}
return new Uri(new Uri(baseUri), relativeUri);
}
``` | Make sure to pass the root URI with the trailing `/`. Last slash is very important. Consider `http://www.example.com/foo/bar.html, bar2.html`. It should be resolved to `http://www.example.com/foo/bar2.html`. |
4,212,979 | Uri test = new Uri(new Uri("http://www.google.com/test"), "foo");
returns <http://www.google.com/foo>
but Uri test = new Uri(new Uri("http://www.google.com/test/"), "foo");
returns <http://www.google.com/foo/test>
It seems the last slash is very important, is there a unified way to return
<http://www.google.com/foo... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4212979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/496949/"
] | Well, you need to ensure that your base URI ends with a `/` character:
```
public Uri CombineUris(string baseUri, string relativeUri)
{
if (!baseUri.EndsWith("/")) {
baseUri += "/";
}
return new Uri(new Uri(baseUri), relativeUri);
}
``` | ```
Uri test = new Uri(new Uri(GetSafeURIString("http://www.google.com/test")), "foo");
private static string GetSafeURIString(uri)
{
if(uri == null)
return uri;
else
return uri.EndsWith("/") ? uri : uri + "/";
}
``` |
41,069,411 | I am running docker containers on mesos / marathon. I wanted to implement health checks, basically want to run a health check script. My question is, will the health check command be run on the container itself or does it run on the slave? It probably is container level since this is per application health check, so ki... | 2016/12/09 | [
"https://Stackoverflow.com/questions/41069411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927370/"
] | The short answer is: it depends. Long answer below : ).
Command heath checks are run by the Mesos docker executor in your task container via `docker exec`. If you run your containers using the "unified containerizer", i.e., in case of docker containers without docker daemon, things are similar, with the difference the... | Mesos-level health checks (MESOS\_HTTP, MESOS\_HTTPS, MESOS\_TCP, and COMMAND) are locally executed by Mesos on the agent running the corresponding task and thus test reachability from the Mesos executor. Mesos-level health checks offer the following advantages over Marathon-level health checks:
Mesos-level health che... |
28,690,228 | I am facing difficulty in understanding relative path concept, I have seen a part of code written as
```
../../abc/file/images/picutre/down.gif
```
how the relative path is computed | 2015/02/24 | [
"https://Stackoverflow.com/questions/28690228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2210098/"
] | >
> how the relative path is computed
>
>
>
Basically a relative path is a "map" from the directory that you are located to the file you need to include. Therefore, relative path is computed based on where you want to go.
For example you have a structure
```
/ (document root)
|--home.php
|--t.php
|--common
... | it says go back up two level (parent directory) "../../" from current location. |
28,690,228 | I am facing difficulty in understanding relative path concept, I have seen a part of code written as
```
../../abc/file/images/picutre/down.gif
```
how the relative path is computed | 2015/02/24 | [
"https://Stackoverflow.com/questions/28690228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2210098/"
] | A relative path is a path relative to the working directory. In other words the starting point to look for files is from the working directory.
The "../" in a relative path means to go up one directory.
So lets say you're referencing the relative path `../../abc/file/images/picutre/down.gif` from an index.html page ... | it says go back up two level (parent directory) "../../" from current location. |
28,690,228 | I am facing difficulty in understanding relative path concept, I have seen a part of code written as
```
../../abc/file/images/picutre/down.gif
```
how the relative path is computed | 2015/02/24 | [
"https://Stackoverflow.com/questions/28690228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2210098/"
] | >
> how the relative path is computed
>
>
>
Basically a relative path is a "map" from the directory that you are located to the file you need to include. Therefore, relative path is computed based on where you want to go.
For example you have a structure
```
/ (document root)
|--home.php
|--t.php
|--common
... | So if we are on `https://example.com/my/path/here` and it loaded a file `../../abc/file/images/picutre/down.gif` then we would go up 2 directories because of the 2 `../`'s to `https://example.com/my`. Then we would go down to `/abc/file/images/picutre/down.gif`. So the final destination would be `https://example.com/my... |
28,690,228 | I am facing difficulty in understanding relative path concept, I have seen a part of code written as
```
../../abc/file/images/picutre/down.gif
```
how the relative path is computed | 2015/02/24 | [
"https://Stackoverflow.com/questions/28690228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2210098/"
] | A relative path is a path relative to the working directory. In other words the starting point to look for files is from the working directory.
The "../" in a relative path means to go up one directory.
So lets say you're referencing the relative path `../../abc/file/images/picutre/down.gif` from an index.html page ... | So if we are on `https://example.com/my/path/here` and it loaded a file `../../abc/file/images/picutre/down.gif` then we would go up 2 directories because of the 2 `../`'s to `https://example.com/my`. Then we would go down to `/abc/file/images/picutre/down.gif`. So the final destination would be `https://example.com/my... |
28,690,228 | I am facing difficulty in understanding relative path concept, I have seen a part of code written as
```
../../abc/file/images/picutre/down.gif
```
how the relative path is computed | 2015/02/24 | [
"https://Stackoverflow.com/questions/28690228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2210098/"
] | >
> how the relative path is computed
>
>
>
Basically a relative path is a "map" from the directory that you are located to the file you need to include. Therefore, relative path is computed based on where you want to go.
For example you have a structure
```
/ (document root)
|--home.php
|--t.php
|--common
... | 1. down.gif is present in the same directory
2. / starts form root directory
3. ../ one directory back from current directory
4. ../../ two directory back from current directory |
28,690,228 | I am facing difficulty in understanding relative path concept, I have seen a part of code written as
```
../../abc/file/images/picutre/down.gif
```
how the relative path is computed | 2015/02/24 | [
"https://Stackoverflow.com/questions/28690228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2210098/"
] | A relative path is a path relative to the working directory. In other words the starting point to look for files is from the working directory.
The "../" in a relative path means to go up one directory.
So lets say you're referencing the relative path `../../abc/file/images/picutre/down.gif` from an index.html page ... | 1. down.gif is present in the same directory
2. / starts form root directory
3. ../ one directory back from current directory
4. ../../ two directory back from current directory |
28,690,228 | I am facing difficulty in understanding relative path concept, I have seen a part of code written as
```
../../abc/file/images/picutre/down.gif
```
how the relative path is computed | 2015/02/24 | [
"https://Stackoverflow.com/questions/28690228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2210098/"
] | A relative path is a path relative to the working directory. In other words the starting point to look for files is from the working directory.
The "../" in a relative path means to go up one directory.
So lets say you're referencing the relative path `../../abc/file/images/picutre/down.gif` from an index.html page ... | >
> how the relative path is computed
>
>
>
Basically a relative path is a "map" from the directory that you are located to the file you need to include. Therefore, relative path is computed based on where you want to go.
For example you have a structure
```
/ (document root)
|--home.php
|--t.php
|--common
... |
386,100 | Using [this awesome tutorial](https://unix.stackexchange.com/questions/382817/uefi-bios-bootable-live-debian-stretch-amd64-with-persistence) I was able to create a bootable Debian live USB with persistence.
After some days using it, it's quite configured and I would like to be able to replicate it into another usb dri... | 2017/08/14 | [
"https://unix.stackexchange.com/questions/386100",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/241252/"
] | If you use `sudo -s` your `$HOME` is not updated, so your shell history is kept within your own account.
(Bear in mind that other configuration/history files, such as those created by `vim`, are also created as root. This means that you may end up with files owned by root in your home directory. This can create "inter... | Here's how we handled this at a previous job.
First, we had a secure bastion host that admins logged into for all root access to target machines. This host had a special `keymaster` account configured which held private keys corresponding to root on the target hosts. (We also had a system where new hosts would automat... |
62,489,471 | I am a beginner in SQL.This may be a old post but I did not get any simplified solution for that.
My concern is how to use `IN` clause in dynamic SQL where the `IN` items are based on the parameters having multiple values.
I have a table named Employee.
[ as an argument rather than a CSV string.
As for dealing with the string... | I'm not very enthusiastic about this and you'd have to beware of there being apostrophes in the department names, but a simple solution may be:
```
Declare @Department varchar(50)
Declare @SQL nvarchar(MAX)
Set @Department='IT,System'
SET @SQL = 'select * from Employee where Department IN (''' + replace(@Department, ... |
72,506,776 | If I run
```
python -m manimlib scene.py ket_bra
```
My scene renders fine into the interactive viewer, but I don't get any output file, the terminal prints the following
```
ManimGL v1.6.1
[13:55:48] INFO Using the default configuration file, which you can modify in `c:\users\miika\manim\manimlib\default_confi... | 2022/06/05 | [
"https://Stackoverflow.com/questions/72506776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6779875/"
] | You could use interfaces with default implementations which were introduced in C# 8. Then you could derive from these interfaces.
Here's an example of how you could you provide default implementations for the `MoveForward()` and `StartBroadcast()` methods:
```cs
public interface IVehicle
{
void MoveForward()
... | You can't inherit more than 1 class but you can inherit more than one interface. Is this what you are looking for?
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3
{
internal class Program
{
static void Main(s... |
72,506,776 | If I run
```
python -m manimlib scene.py ket_bra
```
My scene renders fine into the interactive viewer, but I don't get any output file, the terminal prints the following
```
ManimGL v1.6.1
[13:55:48] INFO Using the default configuration file, which you can modify in `c:\users\miika\manim\manimlib\default_confi... | 2022/06/05 | [
"https://Stackoverflow.com/questions/72506776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6779875/"
] | You can't inherit more than 1 class but you can inherit more than one interface. Is this what you are looking for?
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3
{
internal class Program
{
static void Main(s... | I think Jonas gave you the best answer that you can use default `interface` implementations. However I keep my post, because it gives information, how to achieve same effect, using technology without this language feature.
```cs
public abstract class Example : IExample
{
private readonly IVehicle vehicle;
pri... |
72,506,776 | If I run
```
python -m manimlib scene.py ket_bra
```
My scene renders fine into the interactive viewer, but I don't get any output file, the terminal prints the following
```
ManimGL v1.6.1
[13:55:48] INFO Using the default configuration file, which you can modify in `c:\users\miika\manim\manimlib\default_confi... | 2022/06/05 | [
"https://Stackoverflow.com/questions/72506776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6779875/"
] | You could use interfaces with default implementations which were introduced in C# 8. Then you could derive from these interfaces.
Here's an example of how you could you provide default implementations for the `MoveForward()` and `StartBroadcast()` methods:
```cs
public interface IVehicle
{
void MoveForward()
... | I think Jonas gave you the best answer that you can use default `interface` implementations. However I keep my post, because it gives information, how to achieve same effect, using technology without this language feature.
```cs
public abstract class Example : IExample
{
private readonly IVehicle vehicle;
pri... |
72,506,776 | If I run
```
python -m manimlib scene.py ket_bra
```
My scene renders fine into the interactive viewer, but I don't get any output file, the terminal prints the following
```
ManimGL v1.6.1
[13:55:48] INFO Using the default configuration file, which you can modify in `c:\users\miika\manim\manimlib\default_confi... | 2022/06/05 | [
"https://Stackoverflow.com/questions/72506776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6779875/"
] | You could use interfaces with default implementations which were introduced in C# 8. Then you could derive from these interfaces.
Here's an example of how you could you provide default implementations for the `MoveForward()` and `StartBroadcast()` methods:
```cs
public interface IVehicle
{
void MoveForward()
... | C# classes can only inherit from one base class, but can inherit from any number of interfaces.
If your goal is to have multiple base classes being inherited to `MyNewClass`, you could change one of your abstract classes to inherit from the other, for example:
```
public abstract class RadioSignalBroadcast : Vehicle
... |
72,506,776 | If I run
```
python -m manimlib scene.py ket_bra
```
My scene renders fine into the interactive viewer, but I don't get any output file, the terminal prints the following
```
ManimGL v1.6.1
[13:55:48] INFO Using the default configuration file, which you can modify in `c:\users\miika\manim\manimlib\default_confi... | 2022/06/05 | [
"https://Stackoverflow.com/questions/72506776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6779875/"
] | C# classes can only inherit from one base class, but can inherit from any number of interfaces.
If your goal is to have multiple base classes being inherited to `MyNewClass`, you could change one of your abstract classes to inherit from the other, for example:
```
public abstract class RadioSignalBroadcast : Vehicle
... | I think Jonas gave you the best answer that you can use default `interface` implementations. However I keep my post, because it gives information, how to achieve same effect, using technology without this language feature.
```cs
public abstract class Example : IExample
{
private readonly IVehicle vehicle;
pri... |
34,229,312 | Assuming that I have a third party class Foo with a signature like this:
```
void Execute<T>();
void Execute(string[] args);
```
Instead of calling
```
Execute<Bar>();
```
I need to use the qualified name of the Bar classe to invoke the generic method.
Example:
```
Type barType = Type.GetType("Program.Bar");
Ex... | 2015/12/11 | [
"https://Stackoverflow.com/questions/34229312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4162418/"
] | You can run it like this:
```
class A
{
public void Execute<T>() { }
public void Execute(string[] args) { }
}
var method = typeof(A).GetMethods().FirstOrDefault(
m => m.Name == "Execute"
&& !m.GetParameters().Any()
&& m.GetGenericArguments().Count() == 1
);
Type barType = Type.GetType("Prog... | Type parameters have to be known at compile time, so in order to call the method directly, you will need to either wrap the type or change the signature to take in a type.
Otherwise, you will need to use reflection to invoke the method by name. |
835 | I was thinking of putting up some questions on the site that I wasn't certain were appropriate in their scope.
We've been playing some D&D 4e lately. I've noticed that whilst we have many questions on 4e, especially 4e rules issues, we don't have many on 4e "strategy". So would questions with the following kinds of t... | 2011/01/17 | [
"https://rpg.meta.stackexchange.com/questions/835",
"https://rpg.meta.stackexchange.com",
"https://rpg.meta.stackexchange.com/users/732/"
] | I would like to answer *some* questions along those lines. For me, the most successful questions would be very specific. The below is my 2 cents on your proposed questions.
* **How do I build the most effective 4e controller?**
This question cannot be answered IMHO. It is dependent on the makeup of your party. The be... | Well, the "canonical" references would be these recent blog posts:
[Good Subjective, Bad Subjective](http://blog.stackoverflow.com/2010/09/good-subjective-bad-subjective/)
[Real Questions Have Answers](http://blog.stackoverflow.com/2011/01/real-questions-have-answers/)
I think most of those examples are a little bro... |
835 | I was thinking of putting up some questions on the site that I wasn't certain were appropriate in their scope.
We've been playing some D&D 4e lately. I've noticed that whilst we have many questions on 4e, especially 4e rules issues, we don't have many on 4e "strategy". So would questions with the following kinds of t... | 2011/01/17 | [
"https://rpg.meta.stackexchange.com/questions/835",
"https://rpg.meta.stackexchange.com",
"https://rpg.meta.stackexchange.com/users/732/"
] | I would like to answer *some* questions along those lines. For me, the most successful questions would be very specific. The below is my 2 cents on your proposed questions.
* **How do I build the most effective 4e controller?**
This question cannot be answered IMHO. It is dependent on the makeup of your party. The be... | My opinions are [here](http://chat.stackexchange.com/rooms/11/conversation/best-build-questions). Roughly speaking, questions that allow discussion of theory and design patterns are good, questions that have a specific party configuration are good, and questions that just need a link to the CharOp forum are horrible. |
835 | I was thinking of putting up some questions on the site that I wasn't certain were appropriate in their scope.
We've been playing some D&D 4e lately. I've noticed that whilst we have many questions on 4e, especially 4e rules issues, we don't have many on 4e "strategy". So would questions with the following kinds of t... | 2011/01/17 | [
"https://rpg.meta.stackexchange.com/questions/835",
"https://rpg.meta.stackexchange.com",
"https://rpg.meta.stackexchange.com/users/732/"
] | Well, the "canonical" references would be these recent blog posts:
[Good Subjective, Bad Subjective](http://blog.stackoverflow.com/2010/09/good-subjective-bad-subjective/)
[Real Questions Have Answers](http://blog.stackoverflow.com/2011/01/real-questions-have-answers/)
I think most of those examples are a little bro... | My opinions are [here](http://chat.stackexchange.com/rooms/11/conversation/best-build-questions). Roughly speaking, questions that allow discussion of theory and design patterns are good, questions that have a specific party configuration are good, and questions that just need a link to the CharOp forum are horrible. |
42,707,435 | Say I have a function:
```
x=[]
i=5
while i<=20:
x.append(i)
i=i+10
return x
```
Is there a way to convert it to a list comprehension like this?
```
newList = [i=05 while i<=20 i=i+10]
```
I get a syntax error. | 2017/03/09 | [
"https://Stackoverflow.com/questions/42707435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7687103/"
] | You don't need a list comprehension for that. `range` will just do:
```
list(range(5, 21, 10)) # [5, 15]
```
A `while` loop is not possible inside of a list comprehension. Instead, you could do something like this:
```
def your_while_generator():
i = 5
while i <= 20:
yield i
i += 10
[i for ... | There isn't any syntax for this, but you can use itertools. For example:
```
In [11]: from itertools import accumulate, repeat, takewhile
In [12]: list(takewhile(lambda x: x <= 20, accumulate(repeat(1), lambda x, _: x + 10)))
Out[12]: [1, 11]
```
*(That's not Pythonic though. The generator solution or explicit solu... |
42,707,435 | Say I have a function:
```
x=[]
i=5
while i<=20:
x.append(i)
i=i+10
return x
```
Is there a way to convert it to a list comprehension like this?
```
newList = [i=05 while i<=20 i=i+10]
```
I get a syntax error. | 2017/03/09 | [
"https://Stackoverflow.com/questions/42707435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7687103/"
] | **No, you cannot use `while` in a list comprehension.**
From the [grammar specification of Python](https://docs.python.org/3/reference/grammar.html), only the following atomic expressions are allowed:
```
atom: ('(' [yield_expr|testlist_comp] ')' | '[' [testlist_comp] ']' | '{' [dictorsetmaker] '}' | NAME | ... | There isn't any syntax for this, but you can use itertools. For example:
```
In [11]: from itertools import accumulate, repeat, takewhile
In [12]: list(takewhile(lambda x: x <= 20, accumulate(repeat(1), lambda x, _: x + 10)))
Out[12]: [1, 11]
```
*(That's not Pythonic though. The generator solution or explicit solu... |
40,596,339 | I am trying to find out the class of an element when hovered over, and I am getting a
```
TypeError: undefined is not an object (evaluating 'classString.split')
```
console error. Here is my code.
```
function findClass(){
var classString = $(this).attr('class');
var myClass = classString.split(' ')[0];
... | 2016/11/14 | [
"https://Stackoverflow.com/questions/40596339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5684416/"
] | You can *pass* `this`, by using the [`call`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call) method:
```
findClass.call(this);
```
Someone will soon say it also works with [`apply`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Functi... | You still have to let the function know what the parameter is:
```
function findClass(self) {
var classString = $(self).attr('class');
var myClass = classString.split(' ')[0];
alert(myClass);
}
``` |
40,596,339 | I am trying to find out the class of an element when hovered over, and I am getting a
```
TypeError: undefined is not an object (evaluating 'classString.split')
```
console error. Here is my code.
```
function findClass(){
var classString = $(this).attr('class');
var myClass = classString.split(' ')[0];
... | 2016/11/14 | [
"https://Stackoverflow.com/questions/40596339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5684416/"
] | You still have to let the function know what the parameter is:
```
function findClass(self) {
var classString = $(self).attr('class');
var myClass = classString.split(' ')[0];
alert(myClass);
}
``` | Use `call` or `apply` function.
Here is a slightly modified example that demonstrates how you can do this:
```
function findClass(){
var classString = this['class'];
var myClass = classString.split(' ')[0];
alert(myClass);
}
findClass.call({'class': "Hello World"})
findClass.apply({'class': "Hello World"}... |
40,596,339 | I am trying to find out the class of an element when hovered over, and I am getting a
```
TypeError: undefined is not an object (evaluating 'classString.split')
```
console error. Here is my code.
```
function findClass(){
var classString = $(this).attr('class');
var myClass = classString.split(' ')[0];
... | 2016/11/14 | [
"https://Stackoverflow.com/questions/40596339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5684416/"
] | You can *pass* `this`, by using the [`call`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call) method:
```
findClass.call(this);
```
Someone will soon say it also works with [`apply`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Functi... | Use `call` or `apply` function.
Here is a slightly modified example that demonstrates how you can do this:
```
function findClass(){
var classString = this['class'];
var myClass = classString.split(' ')[0];
alert(myClass);
}
findClass.call({'class': "Hello World"})
findClass.apply({'class': "Hello World"}... |
358,898 | I'm trying to boot a chrome application shortcut in full screen (kiosk mode).
Launching as an application shortcut is straightforward by appending the command `--app=http://website.com`. But the kiosk/fullscreen mode `--kiosk` or `--start-maximized`
doesn't work.
I've looked up the commands through `man google-chrome... | 2013/10/14 | [
"https://askubuntu.com/questions/358898",
"https://askubuntu.com",
"https://askubuntu.com/users/202580/"
] | How to use Chrome browser in kiosk-mode
=======================================
Use it like this:
```
google-chrome --kiosk http://example.com
chromium-browser --kiosk http://example.com
```
tested with Ubuntu 12.04, `google-chrome-stable 30.0.1599.66-1` and `chromium-browser 28.0.1500.71-0ubuntu1.12.04`. But **onl... | Peter Beverloo has comprised a list of command line options at <http://peter.sh/experiments/chromium-command-line-switches/> |
358,898 | I'm trying to boot a chrome application shortcut in full screen (kiosk mode).
Launching as an application shortcut is straightforward by appending the command `--app=http://website.com`. But the kiosk/fullscreen mode `--kiosk` or `--start-maximized`
doesn't work.
I've looked up the commands through `man google-chrome... | 2013/10/14 | [
"https://askubuntu.com/questions/358898",
"https://askubuntu.com",
"https://askubuntu.com/users/202580/"
] | How to use Chrome browser in kiosk-mode
=======================================
Use it like this:
```
google-chrome --kiosk http://example.com
chromium-browser --kiosk http://example.com
```
tested with Ubuntu 12.04, `google-chrome-stable 30.0.1599.66-1` and `chromium-browser 28.0.1500.71-0ubuntu1.12.04`. But **onl... | In my case only `--kiosk` didn't help that much because I wanted to run in app mode (`--app=URL`) -- which disables some distractions like navbar or bookmarks.
I've found from [Peter Beverloo's link in other answer](http://peter.sh/experiments/chromium-command-line-switches/) this `--start-fullscreen` flag. So OP woul... |
21,994,664 | ```
<?PHP
$select = 'SELECT cliente, pedido, data, valor from financial';
$result = mysql_query($select);
$medium = mysql_fetch_row($result);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf('
<form name="frmFinanceiro" id="frmFinanceiro" action="frmFinan... | 2014/02/24 | [
"https://Stackoverflow.com/questions/21994664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3347762/"
] | ```
var list = [ { _id: 1, name: "foo" },
{ _id: 2, name: "bar" },
{ _id: 3, name: "foox" },
{ _id: 4, name: "fooz" },
];
var search = [1,25,33,4,22,44,5555,63];
list.forEach(function(element){
if(search.indexOf(element._id) != -1){
console.log("found");
}
});
```
Try this, hope this is what y... | if:
```
var o = [{ _id: 1, name: "foo"}, { _id: 2, name: "bar"}, { _id: 3, name: "foox"}, { _id: 4, name: "fooz"}];
var search = [1, 25, 33, 4, 22, 44, 5555, 63];
```
try this:
```
var outPus = o.filter(function(u){
return search.some(function(t){ return t == u._id})
})
```
or this:
```
var outPut = [];
se... |
21,994,664 | ```
<?PHP
$select = 'SELECT cliente, pedido, data, valor from financial';
$result = mysql_query($select);
$medium = mysql_fetch_row($result);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf('
<form name="frmFinanceiro" id="frmFinanceiro" action="frmFinan... | 2014/02/24 | [
"https://Stackoverflow.com/questions/21994664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3347762/"
] | ```
var list = [ { _id: 1, name: "foo" },
{ _id: 2, name: "bar" },
{ _id: 3, name: "foox" },
{ _id: 4, name: "fooz" },
];
var search = [1,25,33,4,22,44,5555,63];
list.forEach(function(element){
if(search.indexOf(element._id) != -1){
console.log("found");
}
});
```
Try this, hope this is what y... | ```
var list = [ { _id: 1,
name: foo },
{ _id: 2,
name: bar },
{ _id: 3,
name: foox },
{ _id: 4,
name: fooz },
];
var isAnyOfIdsInArrayOfObject = function(arrayOfObjects, ids){
return arrayOfObjects.some(function(el) { return ids.indexOf(el._id) !== -1; });
}
``` |
21,994,664 | ```
<?PHP
$select = 'SELECT cliente, pedido, data, valor from financial';
$result = mysql_query($select);
$medium = mysql_fetch_row($result);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf('
<form name="frmFinanceiro" id="frmFinanceiro" action="frmFinan... | 2014/02/24 | [
"https://Stackoverflow.com/questions/21994664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3347762/"
] | ```
var list = [ { _id: 1, name: "foo" },
{ _id: 2, name: "bar" },
{ _id: 3, name: "foox" },
{ _id: 4, name: "fooz" },
];
var search = [1,25,33,4,22,44,5555,63];
list.forEach(function(element){
if(search.indexOf(element._id) != -1){
console.log("found");
}
});
```
Try this, hope this is what y... | ```
var list = [
{ _id: 1, name: 'foo' },
{ _id: 2, name: 'bar' },
{ _id: 3, name: 'foox' },
{ _id: 4, name: 'fooz' }
];
var search = [1,25,33,4,22,44,5555,63];
```
This code builds a list of all the elements in `search` that are also in your `list`:
```
var inArr = search.filter(function(index){
return ... |
21,994,664 | ```
<?PHP
$select = 'SELECT cliente, pedido, data, valor from financial';
$result = mysql_query($select);
$medium = mysql_fetch_row($result);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf('
<form name="frmFinanceiro" id="frmFinanceiro" action="frmFinan... | 2014/02/24 | [
"https://Stackoverflow.com/questions/21994664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3347762/"
] | ```
var list = [ { _id: 1, name: "foo" },
{ _id: 2, name: "bar" },
{ _id: 3, name: "foox" },
{ _id: 4, name: "fooz" },
];
var search = [1,25,33,4,22,44,5555,63];
list.forEach(function(element){
if(search.indexOf(element._id) != -1){
console.log("found");
}
});
```
Try this, hope this is what y... | Below is the example of find method. Hope this will help you.
```
// sample item array
const items = [
{ name : 'Bike', price : 100 },
{ name : 'Car', price : 3000 }
]
// find method example
const foundItem = items.find(( item )) => {
// you... |
21,994,664 | ```
<?PHP
$select = 'SELECT cliente, pedido, data, valor from financial';
$result = mysql_query($select);
$medium = mysql_fetch_row($result);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf('
<form name="frmFinanceiro" id="frmFinanceiro" action="frmFinan... | 2014/02/24 | [
"https://Stackoverflow.com/questions/21994664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3347762/"
] | ```
var list = [ { _id: 1, name: "foo" },
{ _id: 2, name: "bar" },
{ _id: 3, name: "foox" },
{ _id: 4, name: "fooz" },
];
var search = [1,25,33,4,22,44,5555,63];
list.forEach(function(element){
if(search.indexOf(element._id) != -1){
console.log("found");
}
});
```
Try this, hope this is what y... | A limitation of forEach loops is that you cannot return the found element from your (outer) method. Instead you can use **Array.prototype.find** as follows:
```
var elt = list.find(e => search.indexOf(e._id)>=0);
if (!elt)
console.log("Element not found");
else
console.log("Found element " + elt.name);
```
N... |
21,994,664 | ```
<?PHP
$select = 'SELECT cliente, pedido, data, valor from financial';
$result = mysql_query($select);
$medium = mysql_fetch_row($result);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf('
<form name="frmFinanceiro" id="frmFinanceiro" action="frmFinan... | 2014/02/24 | [
"https://Stackoverflow.com/questions/21994664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3347762/"
] | Use [`some`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/some) to iterate over the array of objects. If an id is found `some` short-circuits and doesn't continue with the rest of the iteration.
```js
const data=[{_id:1,name:'foo'},{_id:2,name:'bar'},{_id:3,name:'foox'},{_id:4,na... | if:
```
var o = [{ _id: 1, name: "foo"}, { _id: 2, name: "bar"}, { _id: 3, name: "foox"}, { _id: 4, name: "fooz"}];
var search = [1, 25, 33, 4, 22, 44, 5555, 63];
```
try this:
```
var outPus = o.filter(function(u){
return search.some(function(t){ return t == u._id})
})
```
or this:
```
var outPut = [];
se... |
21,994,664 | ```
<?PHP
$select = 'SELECT cliente, pedido, data, valor from financial';
$result = mysql_query($select);
$medium = mysql_fetch_row($result);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf('
<form name="frmFinanceiro" id="frmFinanceiro" action="frmFinan... | 2014/02/24 | [
"https://Stackoverflow.com/questions/21994664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3347762/"
] | Use [`some`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/some) to iterate over the array of objects. If an id is found `some` short-circuits and doesn't continue with the rest of the iteration.
```js
const data=[{_id:1,name:'foo'},{_id:2,name:'bar'},{_id:3,name:'foox'},{_id:4,na... | ```
var list = [ { _id: 1,
name: foo },
{ _id: 2,
name: bar },
{ _id: 3,
name: foox },
{ _id: 4,
name: fooz },
];
var isAnyOfIdsInArrayOfObject = function(arrayOfObjects, ids){
return arrayOfObjects.some(function(el) { return ids.indexOf(el._id) !== -1; });
}
``` |
21,994,664 | ```
<?PHP
$select = 'SELECT cliente, pedido, data, valor from financial';
$result = mysql_query($select);
$medium = mysql_fetch_row($result);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf('
<form name="frmFinanceiro" id="frmFinanceiro" action="frmFinan... | 2014/02/24 | [
"https://Stackoverflow.com/questions/21994664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3347762/"
] | Use [`some`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/some) to iterate over the array of objects. If an id is found `some` short-circuits and doesn't continue with the rest of the iteration.
```js
const data=[{_id:1,name:'foo'},{_id:2,name:'bar'},{_id:3,name:'foox'},{_id:4,na... | ```
var list = [
{ _id: 1, name: 'foo' },
{ _id: 2, name: 'bar' },
{ _id: 3, name: 'foox' },
{ _id: 4, name: 'fooz' }
];
var search = [1,25,33,4,22,44,5555,63];
```
This code builds a list of all the elements in `search` that are also in your `list`:
```
var inArr = search.filter(function(index){
return ... |
21,994,664 | ```
<?PHP
$select = 'SELECT cliente, pedido, data, valor from financial';
$result = mysql_query($select);
$medium = mysql_fetch_row($result);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf('
<form name="frmFinanceiro" id="frmFinanceiro" action="frmFinan... | 2014/02/24 | [
"https://Stackoverflow.com/questions/21994664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3347762/"
] | Use [`some`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/some) to iterate over the array of objects. If an id is found `some` short-circuits and doesn't continue with the rest of the iteration.
```js
const data=[{_id:1,name:'foo'},{_id:2,name:'bar'},{_id:3,name:'foox'},{_id:4,na... | Below is the example of find method. Hope this will help you.
```
// sample item array
const items = [
{ name : 'Bike', price : 100 },
{ name : 'Car', price : 3000 }
]
// find method example
const foundItem = items.find(( item )) => {
// you... |
21,994,664 | ```
<?PHP
$select = 'SELECT cliente, pedido, data, valor from financial';
$result = mysql_query($select);
$medium = mysql_fetch_row($result);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf('
<form name="frmFinanceiro" id="frmFinanceiro" action="frmFinan... | 2014/02/24 | [
"https://Stackoverflow.com/questions/21994664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3347762/"
] | Use [`some`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/some) to iterate over the array of objects. If an id is found `some` short-circuits and doesn't continue with the rest of the iteration.
```js
const data=[{_id:1,name:'foo'},{_id:2,name:'bar'},{_id:3,name:'foox'},{_id:4,na... | A limitation of forEach loops is that you cannot return the found element from your (outer) method. Instead you can use **Array.prototype.find** as follows:
```
var elt = list.find(e => search.indexOf(e._id)>=0);
if (!elt)
console.log("Element not found");
else
console.log("Found element " + elt.name);
```
N... |
21,358,200 | I'm trying to make an app that has images in a rounded imageView but with images of different and varying sizes. My goal is to have a small piece of the image appear if the image is too big (so the image doesn't look distorted).
I'm able to get rounded imageView but it's alway different sizes for different images--whi... | 2014/01/26 | [
"https://Stackoverflow.com/questions/21358200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1233366/"
] | If you make the corner radius figure proportional to the width, or height etc, then this will give you a constant roundness for the image. Here I've suggested div by 3, as an example.
```
self.imageview.layer.cornerRadius = self.imageview.frame.size.width/3;
```
Hope this is what you're looking for.
Cheers, Jim
ED... | Hi this is the best solution and very fast:
```
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
CALayer * l = [self layer];
[l setMasksToBounds:YES];
[l setCorne... |
21,358,200 | I'm trying to make an app that has images in a rounded imageView but with images of different and varying sizes. My goal is to have a small piece of the image appear if the image is too big (so the image doesn't look distorted).
I'm able to get rounded imageView but it's alway different sizes for different images--whi... | 2014/01/26 | [
"https://Stackoverflow.com/questions/21358200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1233366/"
] | If you make the corner radius figure proportional to the width, or height etc, then this will give you a constant roundness for the image. Here I've suggested div by 3, as an example.
```
self.imageview.layer.cornerRadius = self.imageview.frame.size.width/3;
```
Hope this is what you're looking for.
Cheers, Jim
ED... | `UIViewContentModeScaleAspectFill` is better suited for your need because it scales the image to **fill** the size of the imageView without changing the apsect ratio.
but don't forget to set `clipsToBounds` to `YES` for the imageView in order to remove the remaining parts out of the view bounds:
```
[self.imageView ... |
21,358,200 | I'm trying to make an app that has images in a rounded imageView but with images of different and varying sizes. My goal is to have a small piece of the image appear if the image is too big (so the image doesn't look distorted).
I'm able to get rounded imageView but it's alway different sizes for different images--whi... | 2014/01/26 | [
"https://Stackoverflow.com/questions/21358200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1233366/"
] | I found a solution to my problem.
For some strange reason...I was not able to use varied images for the `imageView` on the `UITableViewCell`. I ended up putting a placeholder image in the `imageView` (transparent png) and then I put my own `UIImageView` with the same code in my question and it worked fine. Something s... | Hi this is the best solution and very fast:
```
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
CALayer * l = [self layer];
[l setMasksToBounds:YES];
[l setCorne... |
21,358,200 | I'm trying to make an app that has images in a rounded imageView but with images of different and varying sizes. My goal is to have a small piece of the image appear if the image is too big (so the image doesn't look distorted).
I'm able to get rounded imageView but it's alway different sizes for different images--whi... | 2014/01/26 | [
"https://Stackoverflow.com/questions/21358200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1233366/"
] | I found a solution to my problem.
For some strange reason...I was not able to use varied images for the `imageView` on the `UITableViewCell`. I ended up putting a placeholder image in the `imageView` (transparent png) and then I put my own `UIImageView` with the same code in my question and it worked fine. Something s... | `UIViewContentModeScaleAspectFill` is better suited for your need because it scales the image to **fill** the size of the imageView without changing the apsect ratio.
but don't forget to set `clipsToBounds` to `YES` for the imageView in order to remove the remaining parts out of the view bounds:
```
[self.imageView ... |
4,643,577 | Yeah I know it's a dumb question, and that of course it wouldn't work. Any kind of work around I can think it stands very little chance of being accepted...
For example what about an accessory application for say printing that launches the main Silverlight application website where the user clicks install. Would that ... | 2011/01/10 | [
"https://Stackoverflow.com/questions/4643577",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/368810/"
] | This may not be exactly what you wanted but check this out: <http://silverlightmarket.com> | Many OOB features of Silverlight relies on COM availability and they will not work on Mac. C# - Monotouch might be usefule here - <http://monotouch.net/Documentation> |
38,472,192 | mobile hub -> create new application -> push -> ios -> p12 file upload -> save changes
When I click on save changes below error message I am getting
>
> Invalid parameter: Attributes Reason: You provided a certificate of type SANDBOX, which cannot be used to create an application of type iOS Production. Please sele... | 2016/07/20 | [
"https://Stackoverflow.com/questions/38472192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4449101/"
] | AWS Mobile Hub has simplified the configuration process for the iOS Push Notifications feature. For the iOS platform, we have removed the iOS Dev (Sandbox) option in favor of supporting the Universal Apple Certificate. This new (as of December 17, 2015) Apple Push Notification service SSL client certificate supports bo... | Then dont choose application type 'apple production' but choose 'apple development' |
46,466,765 | I have created a custom UITableViewCell class with a xib file.
In the cell xib, I have set the table view cell's separator to be "Custom Insets" with left=0, right=0:
[](https://i.stack.imgur.com/K2Z7b.png)
But when I run my app, it still shows botto... | 2017/09/28 | [
"https://Stackoverflow.com/questions/46466765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/959734/"
] | You must remove the separator line in the Attributes inspector of the tableview like in the image below:
[](https://i.stack.imgur.com/OhLug.png) | Set `Separator Style` of your `UITableView` to `none`
Or, programmatically
**Swift 3+**
```
tableView.separatorStyle = .none
```
**Objective-C**
```
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
``` |
46,466,765 | I have created a custom UITableViewCell class with a xib file.
In the cell xib, I have set the table view cell's separator to be "Custom Insets" with left=0, right=0:
[](https://i.stack.imgur.com/K2Z7b.png)
But when I run my app, it still shows botto... | 2017/09/28 | [
"https://Stackoverflow.com/questions/46466765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/959734/"
] | Set `Separator Style` of your `UITableView` to `none`
Or, programmatically
**Swift 3+**
```
tableView.separatorStyle = .none
```
**Objective-C**
```
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
``` | It seems that you are using an old version of Xcode.If you want to remove separator line, you have to select `default` option form `separator inset` and select `none` from the `separator`.
[Follow this image](https://i.stack.imgur.com/MrHtR.png)
Or else, you can also set by programmatically
**Swift 3+**
```
yourTab... |
46,466,765 | I have created a custom UITableViewCell class with a xib file.
In the cell xib, I have set the table view cell's separator to be "Custom Insets" with left=0, right=0:
[](https://i.stack.imgur.com/K2Z7b.png)
But when I run my app, it still shows botto... | 2017/09/28 | [
"https://Stackoverflow.com/questions/46466765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/959734/"
] | Set `Separator Style` of your `UITableView` to `none`
Or, programmatically
**Swift 3+**
```
tableView.separatorStyle = .none
```
**Objective-C**
```
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
``` | To remove extra saparator line from your `UITableView` you need to set `tableFooterView` of `UITableView`
```
tableView.tableFooterView = UIView()
``` |
46,466,765 | I have created a custom UITableViewCell class with a xib file.
In the cell xib, I have set the table view cell's separator to be "Custom Insets" with left=0, right=0:
[](https://i.stack.imgur.com/K2Z7b.png)
But when I run my app, it still shows botto... | 2017/09/28 | [
"https://Stackoverflow.com/questions/46466765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/959734/"
] | You must remove the separator line in the Attributes inspector of the tableview like in the image below:
[](https://i.stack.imgur.com/OhLug.png) | It seems that you are using an old version of Xcode.If you want to remove separator line, you have to select `default` option form `separator inset` and select `none` from the `separator`.
[Follow this image](https://i.stack.imgur.com/MrHtR.png)
Or else, you can also set by programmatically
**Swift 3+**
```
yourTab... |
46,466,765 | I have created a custom UITableViewCell class with a xib file.
In the cell xib, I have set the table view cell's separator to be "Custom Insets" with left=0, right=0:
[](https://i.stack.imgur.com/K2Z7b.png)
But when I run my app, it still shows botto... | 2017/09/28 | [
"https://Stackoverflow.com/questions/46466765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/959734/"
] | You must remove the separator line in the Attributes inspector of the tableview like in the image below:
[](https://i.stack.imgur.com/OhLug.png) | To remove extra saparator line from your `UITableView` you need to set `tableFooterView` of `UITableView`
```
tableView.tableFooterView = UIView()
``` |
46,466,765 | I have created a custom UITableViewCell class with a xib file.
In the cell xib, I have set the table view cell's separator to be "Custom Insets" with left=0, right=0:
[](https://i.stack.imgur.com/K2Z7b.png)
But when I run my app, it still shows botto... | 2017/09/28 | [
"https://Stackoverflow.com/questions/46466765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/959734/"
] | To remove extra saparator line from your `UITableView` you need to set `tableFooterView` of `UITableView`
```
tableView.tableFooterView = UIView()
``` | It seems that you are using an old version of Xcode.If you want to remove separator line, you have to select `default` option form `separator inset` and select `none` from the `separator`.
[Follow this image](https://i.stack.imgur.com/MrHtR.png)
Or else, you can also set by programmatically
**Swift 3+**
```
yourTab... |
25,238,030 | I've been working really hard for weeks now trying to get sprite sheet animation to work, and it isn't. I've tried, using this wiki page, <http://www.cocos2d-x.org/wiki/Sprite_Sheet_Animation>, and I've tried to make my own code, and neither have gotten e remotely close to where I want to be and I really have no idea w... | 2014/08/11 | [
"https://Stackoverflow.com/questions/25238030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1676682/"
] | For sprite sheet animation you have to make a plist for all your images.
Download texture packer : <https://www.codeandweb.com/texturepacker>
After installing the texture packer, add sprites to it and publish it.
It will create a plist.
Add that plist and png to the resources folder of your project.
Now add the fol... | You can make animations using **GIF**, i made so in my game and never had performance issues, you can make a GIF from web GIF Maker |
11,814,733 | If my web application has a specific component(widget) which make a connection to another server(which is out of control) to read from an `xml file` .
sometimes the admin of the server which i connect to put a firewall or change some configuration . and when my application try to connect to this server it takes long t... | 2012/08/05 | [
"https://Stackoverflow.com/questions/11814733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/418343/"
] | You need to add :current\_password to attr\_accessor, not attr\_accessible - they are two very different things. As so
```
attr_accessor :current_password
attr_accessible :name, :email, ... etc
```
current\_password is now a valid attribute of the User model.
That said, you still need to add code to your model to m... | One more check: Ensure you did a migration of the database
rails generate migration add\_current\_password\_to\_user current\_password:string
rake db:migrate
in case you forgot that. |
50,513,651 | Suppose i have two classes such that :
```
class base
{
int hello;
public:
base
{
hello=5;
}
void show()
{
cout<<hello;
}
};
class derived:public hello
{
int hello;
public:
derived... | 2018/05/24 | [
"https://Stackoverflow.com/questions/50513651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9842077/"
] | No, because you have two distinct and separate variables `hello`. The one in the `derived` class sort of "overrides" the one in the `base` class.
If you want it to work, you need to have only one variable. | The short answer is that, public inheritance models the *is-a* relationship. The derived class is a base class. The constructor of the derived class will implicitly call the constructor of the base class. |
13,302,848 | I have a Java app that lets users to store the data in database but while storing I store those data as byte array which is same as cassandra, Now when I get back the byte array I want to convert those data as User saved, means if user saved as Long I want to show long value, or if User saved String I want to show Stri... | 2012/11/09 | [
"https://Stackoverflow.com/questions/13302848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1249655/"
] | Your question isn't very clear as to what exactly you want but...
You could come up with some custom scheme for doing this like the first byte of the array indicates what type and the remaining bytes are the actual data. You then need to write code to convert the byte[1] through byte[length-1] into that given type. It... | I'd recommend to serialize data in some format, that stores type info, like BSON: <http://bsonspec.org/> or Smile: <http://wiki.fasterxml.com/SmileFormat>
In this case, deserialization will restore type info, and after deserialization you'll get Object of correct type.
These formats are very compact: type info takes... |
29,741 | Suppose I encountered a unique product yesterday and I'm very impressed. I'm now meeting my friend after two days. She has also seen the product.
>
> Yeah! That product really stunned me. **\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_**?
>
>
>
Fill in the blank. I want to ask her whether or not she too got stunned.
My c... | 2014/07/23 | [
"https://ell.stackexchange.com/questions/29741",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/3187/"
] | The idiomatic way of saying this would not be to use the verb "to do."
>
> The opera really moved me. Did it you?
>
>
>
would be understandable, but it would sound extremely stilted; I would expect it to be said by a wealthy elderly woman wearing a lorgnette. Using "to you" is not idiomatic under any circumstance... | 'Did it you' is correct. Though in conversation you'd probably never put it like that. |
29,741 | Suppose I encountered a unique product yesterday and I'm very impressed. I'm now meeting my friend after two days. She has also seen the product.
>
> Yeah! That product really stunned me. **\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_**?
>
>
>
Fill in the blank. I want to ask her whether or not she too got stunned.
My c... | 2014/07/23 | [
"https://ell.stackexchange.com/questions/29741",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/3187/"
] | The idiomatic way of saying this would not be to use the verb "to do."
>
> The opera really moved me. Did it you?
>
>
>
would be understandable, but it would sound extremely stilted; I would expect it to be said by a wealthy elderly woman wearing a lorgnette. Using "to you" is not idiomatic under any circumstance... | If you open your question with "Did", you have to specify *what* may have happened; you cannot leave out the subsequent verb. About the only exception to that is when you ask "Did (*pronoun*)?", and the only reason you're able to get away with that is when it's absolutely clear from context that you're talking about an... |
3,681,236 | I'm writing a Windows Phone 7 app that needs to be location aware. Specifically I want some (c#) code to run when the phone comes within a (fixed) range of a particular location, say 0.5 miles. I have all the lat / long data for the physical locations in memory. I will be using the [Geo Coordinate Watcher class](http:/... | 2010/09/09 | [
"https://Stackoverflow.com/questions/3681236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/99045/"
] | Since you are using GeoCoordinate, why implement it yourself when it is already present in that class?
```
var distance = coordinateA.GetDistanceTo(coordinateB);
```
(where coordinateA and B are of type GeoCoordinate)
See the [MDSN documentation](http://msdn.microsoft.com/en-us/library/system.device.location.geocoo... | A quick search brought up [this page](http://www.movable-type.co.uk/scripts/latlong.html) with a formula for computing distance between two points on the earth. Quoted directly from the linked page:
```
Haversine formula:
R = earth’s radius (mean radius = 6,371km)
Δlat = lat2− lat1
Δlong = long2− long1
a = sin²(Δlat/... |
21,468,643 | I'm trying to get a separator between my nav menu and I found out about the 'li + li' function, but I'm having a very hard time getting the separator in the right place. I'm trying to get it evenly place between the two placeholders centered and all. I've tried messing with the margin and padding properties with no luc... | 2014/01/30 | [
"https://Stackoverflow.com/questions/21468643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3017217/"
] | You would use [**`background-size`/`background-position`**](https://developer.mozilla.org/en-US/docs/Web/CSS/background) in order to position the background.
In this instance, just use the shorthand:
[**UPDATED EXAMPLE HERE**](http://jsfiddle.net/9k2gE/)
```
#header li + li {
background: url('http://i.imgur.com/... | I would make the `li` elements `display:block` and apply padding to all of the on left and right.. This way they have equal distances from both sides of the text
Then use `50%` on the vertical position of the background image.
```
#header li {
display:inline-block;
padding: 0 20px;
}
#header li + li {
ba... |
7,638,988 | I have searched throughout the site but I think I have a slightly different issue and could really do with some help before I either have heart failure or burn the computer.
I dynamically generate a list of month names (in the form June 2011, July 2011) and obviously I want this to be locale sensitive: hence I use the... | 2011/10/03 | [
"https://Stackoverflow.com/questions/7638988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/977184/"
] | Your problem has nothing to do with `SimpleDateFormat` - you're just doing the wrong thing with the result.
You haven't told us what you're doing with the string afterwards - how you're displaying it in the UI - but *that's* the problem. You can see that it's fetching a localized string; it's only the display of the a... | In my tests, `dtFormat.format(mCal.getTime())` returns
>
> październik 2011
>
>
>
`new SimpleDateFormat(0,0,localeObject).format(mCal.getTime())` returns:
>
> poniedziałek, 3 październik 2011 14:26:53 EDT
>
>
> |
29,087,739 | I am using [Tesseract OCR](https://code.google.com/p/tesseract-ocr/) to convert scanned PDF's into plain text. Overall it is highly effective but I am having issues with the order that the text is scanned. Documents with tabular data seem to scan down column by column when it seems like the more natural way would be to... | 2015/03/16 | [
"https://Stackoverflow.com/questions/29087739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1236202/"
] | Try running tesseract in one of the single column [Page Segmentation Modes](https://github.com/tesseract-ocr/tesseract/wiki/ImproveQuality#page-segmentation-method):
`tesseract input.tif output-filename --psm 6`
>
> By default Tesseract expects a page of text when it segments an image. If you're just seeking to OCR ... | I know this is an old question, but I've been struggling with a similar issue and found [hOCR](https://en.wikipedia.org/wiki/HOCR) output to be the solution. Running
```
tesseract input.tif output-filename hocr
```
will create `output-file.hocr` (basically HTML) that gives coordinates for the bounding boxes of each ... |
29,087,739 | I am using [Tesseract OCR](https://code.google.com/p/tesseract-ocr/) to convert scanned PDF's into plain text. Overall it is highly effective but I am having issues with the order that the text is scanned. Documents with tabular data seem to scan down column by column when it seems like the more natural way would be to... | 2015/03/16 | [
"https://Stackoverflow.com/questions/29087739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1236202/"
] | Try running tesseract in one of the single column [Page Segmentation Modes](https://github.com/tesseract-ocr/tesseract/wiki/ImproveQuality#page-segmentation-method):
`tesseract input.tif output-filename --psm 6`
>
> By default Tesseract expects a page of text when it segments an image. If you're just seeking to OCR ... | You need to use following config
```
#Read Image
r = Image.open('8.png')
r.load()
#Converting inmage to text with preserving interline spaces
text = pytesseract.image_to_string(r,config='-c preserve_interword_spaces=1x1 --psm
1 --oem 3' )
```
**OR**
Another Solution is to draw contours around text, save all contou... |
29,087,739 | I am using [Tesseract OCR](https://code.google.com/p/tesseract-ocr/) to convert scanned PDF's into plain text. Overall it is highly effective but I am having issues with the order that the text is scanned. Documents with tabular data seem to scan down column by column when it seems like the more natural way would be to... | 2015/03/16 | [
"https://Stackoverflow.com/questions/29087739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1236202/"
] | I know this is an old question, but I've been struggling with a similar issue and found [hOCR](https://en.wikipedia.org/wiki/HOCR) output to be the solution. Running
```
tesseract input.tif output-filename hocr
```
will create `output-file.hocr` (basically HTML) that gives coordinates for the bounding boxes of each ... | You need to use following config
```
#Read Image
r = Image.open('8.png')
r.load()
#Converting inmage to text with preserving interline spaces
text = pytesseract.image_to_string(r,config='-c preserve_interword_spaces=1x1 --psm
1 --oem 3' )
```
**OR**
Another Solution is to draw contours around text, save all contou... |
41,046,689 | Instead of getting text, I get something like this: **[ing]** it should be: *Premium green tea*.
```
Browser.FindElement(By.CssSelector(".prod-ing")).Text;
```
HTML:
```
<p class="prod-ing">Premium green tea</p>
```
Both in the browser and in the html file text is displayed correctly.
Atributes like
**textCo... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41046689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2037603/"
] | Try this:
rextester: <http://rextester.com/IPBQPM64562>
```
if exists (select * from tempdb.sys.objects where name like '#global%') begin; drop table #global; end;
if not exists (select * from tempdb.sys.objects where name like '#global%')
begin
create table #global (globalid varchar(32) ,service_globalid varchar(32)... | This is a little tricky. I would recommend doing a cumulative sum and some additional arithmetic:
```
select t.*,
(sum(incThisRow) over (order by globalid, service_globalid) - incThisRow + 1
) as seq_A,
(case when photo_b_globalid is not null
then sum(incThisRow) over (order by global... |
41,046,689 | Instead of getting text, I get something like this: **[ing]** it should be: *Premium green tea*.
```
Browser.FindElement(By.CssSelector(".prod-ing")).Text;
```
HTML:
```
<p class="prod-ing">Premium green tea</p>
```
Both in the browser and in the html file text is displayed correctly.
Atributes like
**textCo... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41046689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2037603/"
] | As the other answers show, there is more than one way to do it, but the most direct translation to me would be to count, using the `count` function:
```
select *,
case
when PHOTO_A_GLOBALID is not null
then count(PHOTO_A_GLOBALID)
over (order by DATE rows unbounded preceding)
+ count(PHOTO_B_GLOBALI... | This is a little tricky. I would recommend doing a cumulative sum and some additional arithmetic:
```
select t.*,
(sum(incThisRow) over (order by globalid, service_globalid) - incThisRow + 1
) as seq_A,
(case when photo_b_globalid is not null
then sum(incThisRow) over (order by global... |
41,046,689 | Instead of getting text, I get something like this: **[ing]** it should be: *Premium green tea*.
```
Browser.FindElement(By.CssSelector(".prod-ing")).Text;
```
HTML:
```
<p class="prod-ing">Premium green tea</p>
```
Both in the browser and in the html file text is displayed correctly.
Atributes like
**textCo... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41046689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2037603/"
] | Try this:
rextester: <http://rextester.com/IPBQPM64562>
```
if exists (select * from tempdb.sys.objects where name like '#global%') begin; drop table #global; end;
if not exists (select * from tempdb.sys.objects where name like '#global%')
begin
create table #global (globalid varchar(32) ,service_globalid varchar(32)... | You could...
* Unpivot the photo data into two sets (A,B) and union them
* eliminate the null photo's records from B & Number
* join back to base set to get full data
UNTESTED
```
With CTE AS (
SELECT GLOBALID, SERVICE_GLOBALID, PHOTO_A_GLOBALID, 'a' as RowID
union
SELECT GLOBALID, SERVICE_GLOBALID, PHOTO_B_GLOBAL... |
41,046,689 | Instead of getting text, I get something like this: **[ing]** it should be: *Premium green tea*.
```
Browser.FindElement(By.CssSelector(".prod-ing")).Text;
```
HTML:
```
<p class="prod-ing">Premium green tea</p>
```
Both in the browser and in the html file text is displayed correctly.
Atributes like
**textCo... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41046689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2037603/"
] | As the other answers show, there is more than one way to do it, but the most direct translation to me would be to count, using the `count` function:
```
select *,
case
when PHOTO_A_GLOBALID is not null
then count(PHOTO_A_GLOBALID)
over (order by DATE rows unbounded preceding)
+ count(PHOTO_B_GLOBALI... | You could...
* Unpivot the photo data into two sets (A,B) and union them
* eliminate the null photo's records from B & Number
* join back to base set to get full data
UNTESTED
```
With CTE AS (
SELECT GLOBALID, SERVICE_GLOBALID, PHOTO_A_GLOBALID, 'a' as RowID
union
SELECT GLOBALID, SERVICE_GLOBALID, PHOTO_B_GLOBAL... |
41,046,689 | Instead of getting text, I get something like this: **[ing]** it should be: *Premium green tea*.
```
Browser.FindElement(By.CssSelector(".prod-ing")).Text;
```
HTML:
```
<p class="prod-ing">Premium green tea</p>
```
Both in the browser and in the html file text is displayed correctly.
Atributes like
**textCo... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41046689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2037603/"
] | Try this:
rextester: <http://rextester.com/IPBQPM64562>
```
if exists (select * from tempdb.sys.objects where name like '#global%') begin; drop table #global; end;
if not exists (select * from tempdb.sys.objects where name like '#global%')
begin
create table #global (globalid varchar(32) ,service_globalid varchar(32)... | You can try like this...
```
;WITH cte
AS (SELECT *, RowN = ROW_NUMBER() OVER (ORDER BY (SELECT NULL) )
FROM (SELECT GLOBALID, SERVICE_GLOBALID, PHOTO_A_GLOBALID
FROM yourglobal WHERE PHOTO_A_GLOBALID IS NOT NULL
UNION ALL
SELECT GLOBALID, SERVICE_GLOBALID, PHOTO_B_GLOBALID
FROM yourglobal WHERE PHOTO_B_GLOBALID IS NO... |
41,046,689 | Instead of getting text, I get something like this: **[ing]** it should be: *Premium green tea*.
```
Browser.FindElement(By.CssSelector(".prod-ing")).Text;
```
HTML:
```
<p class="prod-ing">Premium green tea</p>
```
Both in the browser and in the html file text is displayed correctly.
Atributes like
**textCo... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41046689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2037603/"
] | As the other answers show, there is more than one way to do it, but the most direct translation to me would be to count, using the `count` function:
```
select *,
case
when PHOTO_A_GLOBALID is not null
then count(PHOTO_A_GLOBALID)
over (order by DATE rows unbounded preceding)
+ count(PHOTO_B_GLOBALI... | You can try like this...
```
;WITH cte
AS (SELECT *, RowN = ROW_NUMBER() OVER (ORDER BY (SELECT NULL) )
FROM (SELECT GLOBALID, SERVICE_GLOBALID, PHOTO_A_GLOBALID
FROM yourglobal WHERE PHOTO_A_GLOBALID IS NOT NULL
UNION ALL
SELECT GLOBALID, SERVICE_GLOBALID, PHOTO_B_GLOBALID
FROM yourglobal WHERE PHOTO_B_GLOBALID IS NO... |
24,866,053 | Right after setting up wampserver 2.5 (I am working on Win7, 64 bit) there have been many errors logged in the PHP error log (Wampserver trayicon -> PHP -> error log).
Errors in the log stated some missing .dll-Files although they existed in the right place (see PHP error.log). | 2014/07/21 | [
"https://Stackoverflow.com/questions/24866053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1633396/"
] | In my case this solved the problem:
Copy the allegedly missing files (see PHP error log) to the folder
```
[root]/wamp/bin/apache/bin/
```
There the .dlls will be recognized.
Seems to be a common problem with the wampserver 2.5 distribution. | Search the particular name.dll and download and place in the dll folder the issue will be solved and more easily you can use lot of dll fixer software which will fix all dll errors for you |
24,866,053 | Right after setting up wampserver 2.5 (I am working on Win7, 64 bit) there have been many errors logged in the PHP error log (Wampserver trayicon -> PHP -> error log).
Errors in the log stated some missing .dll-Files although they existed in the right place (see PHP error.log). | 2014/07/21 | [
"https://Stackoverflow.com/questions/24866053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1633396/"
] | In my case this solved the problem:
Copy the allegedly missing files (see PHP error log) to the folder
```
[root]/wamp/bin/apache/bin/
```
There the .dlls will be recognized.
Seems to be a common problem with the wampserver 2.5 distribution. | It would have been useful to know which files it was reporting as missing but I assume it is these.
```
PHP Warning: PHP Startup: Unable to load dynamic library
'd:/wamp/bin/php/php5.5.12/ext/php_ldap.dll'
- The specified module could not be found.
```
And
```
PHP Warning: PHP Startup: Unable to load dynam... |
24,866,053 | Right after setting up wampserver 2.5 (I am working on Win7, 64 bit) there have been many errors logged in the PHP error log (Wampserver trayicon -> PHP -> error log).
Errors in the log stated some missing .dll-Files although they existed in the right place (see PHP error.log). | 2014/07/21 | [
"https://Stackoverflow.com/questions/24866053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1633396/"
] | It would have been useful to know which files it was reporting as missing but I assume it is these.
```
PHP Warning: PHP Startup: Unable to load dynamic library
'd:/wamp/bin/php/php5.5.12/ext/php_ldap.dll'
- The specified module could not be found.
```
And
```
PHP Warning: PHP Startup: Unable to load dynam... | Search the particular name.dll and download and place in the dll folder the issue will be solved and more easily you can use lot of dll fixer software which will fix all dll errors for you |
14,049,237 | I'm designing a server that will initialize by **fork** / **exec**'ing four "managers" (themselves server processes) and will then accept connections from clients, **fork** / **exec**'ing "slaves" to communicate with the clients. During their lifetimes, the slaves will establish connections with the managers and send t... | 2012/12/27 | [
"https://Stackoverflow.com/questions/14049237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/522385/"
] | I'd be very tempted to create one pipe before forking off the four managers. When a manager is ready, it can write its PID on the pipe and close it. The master server can delay opening its listening port until at least one of the managers has indicated that it is ready. If it gets EOF from the pipe before all the manag... | What you are thinking of are *FIFO* pipes. *mknod* is traditionally used to create them. The pipes have *2* file descriptors, one for reading, one for writing.... they can block on that if necessary... |
18,067 | [#P](http://en.wikipedia.org/wiki/Sharp-P) is the class of counting problems for problems in NP. In other words, a solution to #P returns the number of solutions to a particular problem in NP.
I'm wondering if there have been any studies on the worst-case behaviors of current best solutions to problems in NP. My focus... | 2013/06/18 | [
"https://cstheory.stackexchange.com/questions/18067",
"https://cstheory.stackexchange.com",
"https://cstheory.stackexchange.com/users/1549/"
] | One such algorithm for $\#3\operatorname{SAT}$ is due to [Kutzkov](http://www.itu.dk/people/konk/papers/%233-sat.pdf). | I you’re looking for natural problems, you can compute many counting problems on planar graphs in time $\exp(\sqrt n)$ because of the planar separator theorem. For example, everything that can be expressed as a valuation of the Tutte polynomial [1]. Most of these problems remain #P-hard restricted to planar graphs, see... |
46,132,706 | Here is a function which intends to:
a) accept a vector of int
b) for each int in the input vector, append the inverse of this int
preconditions: none
postconditions: returned vector's size() is exacly 2 \* the input vector's size.
Note that the vector is modified in-place.
Question:
---------
Is this function s... | 2017/09/09 | [
"https://Stackoverflow.com/questions/46132706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2015579/"
] | As long as you don't exceed preallocated capacity no reallocation should happen and no references or iterators referring to vector items should get invalidated. However since iterator returned by `end()` does not refer to any vector items it may still get invalidated.
>
> 23.3.11.3 vector capacity **[vector.capacity]... | The part about the iterator invalidation rules has already been covered, so I'll take this occasion to humbly question the need to use all this machinery (with its delicate rules) for such a trivial problem. You may also consider this a stab at the
>
> ### Bonus:
>
>
> Is there a better/more succinct/robust way to ... |
41,746,028 | Does using `React.PropTypes` make sense in a TypeScript React Application or is this just a case of "belt and suspenders"?
Since the component class is declared with a `Props` type parameter:
```
interface Props {
// ...
}
export class MyComponent extends React.Component<Props, any> { ... }
```
is there any rea... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41746028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96233/"
] | There's usually not much value to maintaining both your component props as TypeScript types and `React.PropTypes` at the same time.
Here are some cases where it is useful to do so:
* Publishing a package such as a component library that will be used by plain JavaScript.
* Accepting and passing along external input su... | I guess that in some messy situations where the type of the props can't be inferred at compile time, then it would be useful to see any warnings generated from using `propTypes` at run time.
One such situation would be when processing data from an external source for which type definitions are not available, such as a... |
41,746,028 | Does using `React.PropTypes` make sense in a TypeScript React Application or is this just a case of "belt and suspenders"?
Since the component class is declared with a `Props` type parameter:
```
interface Props {
// ...
}
export class MyComponent extends React.Component<Props, any> { ... }
```
is there any rea... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41746028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96233/"
] | There's usually not much value to maintaining both your component props as TypeScript types and `React.PropTypes` at the same time.
Here are some cases where it is useful to do so:
* Publishing a package such as a component library that will be used by plain JavaScript.
* Accepting and passing along external input su... | "**InferPropTypes**" from **@types/prop-types** can be used to create type definitions from PropTypes definitions. check the below example
```
import React from "react";
import PropTypes, { InferProps } from "prop-types";
const ComponentPropTypes = {
title: PropTypes.string.isRequired,
createdAt: PropTypes.in... |
41,746,028 | Does using `React.PropTypes` make sense in a TypeScript React Application or is this just a case of "belt and suspenders"?
Since the component class is declared with a `Props` type parameter:
```
interface Props {
// ...
}
export class MyComponent extends React.Component<Props, any> { ... }
```
is there any rea... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41746028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96233/"
] | As @afonsoduarte said.
I'd just add that you can also generate Typescript types from PropTypes like this:
```
const propTypes = {
input: PropTypes.shape({
id: PropTypes.number.isRequired,
name: PropTypes.string.isRequired,
}),
};
type MyComponentProps = PropTypes.InferProps<typeof propTypes>;
const MyCo... | "**InferPropTypes**" from **@types/prop-types** can be used to create type definitions from PropTypes definitions. check the below example
```
import React from "react";
import PropTypes, { InferProps } from "prop-types";
const ComponentPropTypes = {
title: PropTypes.string.isRequired,
createdAt: PropTypes.in... |
41,746,028 | Does using `React.PropTypes` make sense in a TypeScript React Application or is this just a case of "belt and suspenders"?
Since the component class is declared with a `Props` type parameter:
```
interface Props {
// ...
}
export class MyComponent extends React.Component<Props, any> { ... }
```
is there any rea... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41746028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96233/"
] | As @afonsoduarte said.
I'd just add that you can also generate Typescript types from PropTypes like this:
```
const propTypes = {
input: PropTypes.shape({
id: PropTypes.number.isRequired,
name: PropTypes.string.isRequired,
}),
};
type MyComponentProps = PropTypes.InferProps<typeof propTypes>;
const MyCo... | I guess that in some messy situations where the type of the props can't be inferred at compile time, then it would be useful to see any warnings generated from using `propTypes` at run time.
One such situation would be when processing data from an external source for which type definitions are not available, such as a... |
41,746,028 | Does using `React.PropTypes` make sense in a TypeScript React Application or is this just a case of "belt and suspenders"?
Since the component class is declared with a `Props` type parameter:
```
interface Props {
// ...
}
export class MyComponent extends React.Component<Props, any> { ... }
```
is there any rea... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41746028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96233/"
] | There's usually not much value to maintaining both your component props as TypeScript types and `React.PropTypes` at the same time.
Here are some cases where it is useful to do so:
* Publishing a package such as a component library that will be used by plain JavaScript.
* Accepting and passing along external input su... | I recently used Proptypes and TS when bridging native code. The project is written in TypeScript on the React side, and I abstract away my native component on the React side in its own file. There was no need for worrying about PropTypes had this not been in its own file since I am already validating the data via TypeS... |
41,746,028 | Does using `React.PropTypes` make sense in a TypeScript React Application or is this just a case of "belt and suspenders"?
Since the component class is declared with a `Props` type parameter:
```
interface Props {
// ...
}
export class MyComponent extends React.Component<Props, any> { ... }
```
is there any rea... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41746028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96233/"
] | Typescript and PropTypes serve different purposes. Typescript validates types at *compile time*, whereas PropTypes are checked at *runtime*.
Typescript is useful when you are writing code: it will warn you if you pass an argument of the wrong type to your React components, give you autocomplete for function calls, et... | I guess that in some messy situations where the type of the props can't be inferred at compile time, then it would be useful to see any warnings generated from using `propTypes` at run time.
One such situation would be when processing data from an external source for which type definitions are not available, such as a... |
41,746,028 | Does using `React.PropTypes` make sense in a TypeScript React Application or is this just a case of "belt and suspenders"?
Since the component class is declared with a `Props` type parameter:
```
interface Props {
// ...
}
export class MyComponent extends React.Component<Props, any> { ... }
```
is there any rea... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41746028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96233/"
] | "**InferPropTypes**" from **@types/prop-types** can be used to create type definitions from PropTypes definitions. check the below example
```
import React from "react";
import PropTypes, { InferProps } from "prop-types";
const ComponentPropTypes = {
title: PropTypes.string.isRequired,
createdAt: PropTypes.in... | I recently used Proptypes and TS when bridging native code. The project is written in TypeScript on the React side, and I abstract away my native component on the React side in its own file. There was no need for worrying about PropTypes had this not been in its own file since I am already validating the data via TypeS... |
41,746,028 | Does using `React.PropTypes` make sense in a TypeScript React Application or is this just a case of "belt and suspenders"?
Since the component class is declared with a `Props` type parameter:
```
interface Props {
// ...
}
export class MyComponent extends React.Component<Props, any> { ... }
```
is there any rea... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41746028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96233/"
] | I guess that in some messy situations where the type of the props can't be inferred at compile time, then it would be useful to see any warnings generated from using `propTypes` at run time.
One such situation would be when processing data from an external source for which type definitions are not available, such as a... | I recently used Proptypes and TS when bridging native code. The project is written in TypeScript on the React side, and I abstract away my native component on the React side in its own file. There was no need for worrying about PropTypes had this not been in its own file since I am already validating the data via TypeS... |
41,746,028 | Does using `React.PropTypes` make sense in a TypeScript React Application or is this just a case of "belt and suspenders"?
Since the component class is declared with a `Props` type parameter:
```
interface Props {
// ...
}
export class MyComponent extends React.Component<Props, any> { ... }
```
is there any rea... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41746028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96233/"
] | As @afonsoduarte said.
I'd just add that you can also generate Typescript types from PropTypes like this:
```
const propTypes = {
input: PropTypes.shape({
id: PropTypes.number.isRequired,
name: PropTypes.string.isRequired,
}),
};
type MyComponentProps = PropTypes.InferProps<typeof propTypes>;
const MyCo... | I recently used Proptypes and TS when bridging native code. The project is written in TypeScript on the React side, and I abstract away my native component on the React side in its own file. There was no need for worrying about PropTypes had this not been in its own file since I am already validating the data via TypeS... |
41,746,028 | Does using `React.PropTypes` make sense in a TypeScript React Application or is this just a case of "belt and suspenders"?
Since the component class is declared with a `Props` type parameter:
```
interface Props {
// ...
}
export class MyComponent extends React.Component<Props, any> { ... }
```
is there any rea... | 2017/01/19 | [
"https://Stackoverflow.com/questions/41746028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96233/"
] | Typescript and PropTypes serve different purposes. Typescript validates types at *compile time*, whereas PropTypes are checked at *runtime*.
Typescript is useful when you are writing code: it will warn you if you pass an argument of the wrong type to your React components, give you autocomplete for function calls, et... | I recently used Proptypes and TS when bridging native code. The project is written in TypeScript on the React side, and I abstract away my native component on the React side in its own file. There was no need for worrying about PropTypes had this not been in its own file since I am already validating the data via TypeS... |
4,811,970 | What is the actionscript 3.0 code to make a very simple button that brings the user to the next frame? If I remember correctly in ActionScript 2.0 it was:
instance\_name.onPress = function(){
gotoAndStop(2)
}
Or something like that. However, this isn't the case for ActionScript 3.0. So could someone please let me know?... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4811970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359844/"
] | ActionScript 3 uses an event based system, so to be notified when the user clicks a DisplayObject, you need to listen for the click [MouseEvent](http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/MouseEvent.html).
```
myDisplayObject.addEventListener(MouseEvent.CLICK, clickHandler);
function clickH... | ```
function eventResponse(evt:MouseEvent):void {gotoAndStop(2);}
yourButton.addEventListener(MouseEvent.MOUSE_UP,eventResponse);
``` |
4,811,970 | What is the actionscript 3.0 code to make a very simple button that brings the user to the next frame? If I remember correctly in ActionScript 2.0 it was:
instance\_name.onPress = function(){
gotoAndStop(2)
}
Or something like that. However, this isn't the case for ActionScript 3.0. So could someone please let me know?... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4811970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359844/"
] | the answers here have the corret function for the functionality, but have a consideration user experience too, you might want to assign these values:
```
myDisplayObject.buttonMode = true //use the "hand" cursor on mouseover
myDisplayObject.mouseChildren = false //stops the children of the button firing the event, hel... | ```
function eventResponse(evt:MouseEvent):void {gotoAndStop(2);}
yourButton.addEventListener(MouseEvent.MOUSE_UP,eventResponse);
``` |
4,811,970 | What is the actionscript 3.0 code to make a very simple button that brings the user to the next frame? If I remember correctly in ActionScript 2.0 it was:
instance\_name.onPress = function(){
gotoAndStop(2)
}
Or something like that. However, this isn't the case for ActionScript 3.0. So could someone please let me know?... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4811970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359844/"
] | ActionScript 3 uses an event based system, so to be notified when the user clicks a DisplayObject, you need to listen for the click [MouseEvent](http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/MouseEvent.html).
```
myDisplayObject.addEventListener(MouseEvent.CLICK, clickHandler);
function clickH... | the answers here have the corret function for the functionality, but have a consideration user experience too, you might want to assign these values:
```
myDisplayObject.buttonMode = true //use the "hand" cursor on mouseover
myDisplayObject.mouseChildren = false //stops the children of the button firing the event, hel... |
4,811,970 | What is the actionscript 3.0 code to make a very simple button that brings the user to the next frame? If I remember correctly in ActionScript 2.0 it was:
instance\_name.onPress = function(){
gotoAndStop(2)
}
Or something like that. However, this isn't the case for ActionScript 3.0. So could someone please let me know?... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4811970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359844/"
] | ActionScript 3 uses an event based system, so to be notified when the user clicks a DisplayObject, you need to listen for the click [MouseEvent](http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/MouseEvent.html).
```
myDisplayObject.addEventListener(MouseEvent.CLICK, clickHandler);
function clickH... | private var button:Sprite = new Sprite();
```
public function ButtonInteractivity()
button.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
addChild(button);
}
private function mouseDownHandler(event:MouseEvent):void {
your code!!
}
``` |
4,811,970 | What is the actionscript 3.0 code to make a very simple button that brings the user to the next frame? If I remember correctly in ActionScript 2.0 it was:
instance\_name.onPress = function(){
gotoAndStop(2)
}
Or something like that. However, this isn't the case for ActionScript 3.0. So could someone please let me know?... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4811970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359844/"
] | the answers here have the corret function for the functionality, but have a consideration user experience too, you might want to assign these values:
```
myDisplayObject.buttonMode = true //use the "hand" cursor on mouseover
myDisplayObject.mouseChildren = false //stops the children of the button firing the event, hel... | private var button:Sprite = new Sprite();
```
public function ButtonInteractivity()
button.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
addChild(button);
}
private function mouseDownHandler(event:MouseEvent):void {
your code!!
}
``` |
29,436 | When I read about strength training, the advice often comes with the assumption that the reader wants to get "big". I want to achieve strength, but would prefer not to increase size too much if possible.
So is there a difference in how one should train to increase muscle size vs how one should train to increase streng... | 2016/04/07 | [
"https://fitness.stackexchange.com/questions/29436",
"https://fitness.stackexchange.com",
"https://fitness.stackexchange.com/users/19988/"
] | Most of the [respected strength training programs](https://fitness.stackexchange.com/a/24596/7091) focus on exactly that: strength.
In general the [rep ranges are your biggest lever to play with with strength vs hypertrophy vs endurance](https://fitness.stackexchange.com/questions/8238/what-are-the-trade-offs-of-weig... | People don't accidentally gain a lot of muscle, even by strength training. Gaining a lot of muscle requires hard work in the gym and at every meal. This is not something you should worry about.
It is important, however, to make sure that the sources you are reading and watching focus on *strength* training, not bodybu... |
29,436 | When I read about strength training, the advice often comes with the assumption that the reader wants to get "big". I want to achieve strength, but would prefer not to increase size too much if possible.
So is there a difference in how one should train to increase muscle size vs how one should train to increase streng... | 2016/04/07 | [
"https://fitness.stackexchange.com/questions/29436",
"https://fitness.stackexchange.com",
"https://fitness.stackexchange.com/users/19988/"
] | Most of the [respected strength training programs](https://fitness.stackexchange.com/a/24596/7091) focus on exactly that: strength.
In general the [rep ranges are your biggest lever to play with with strength vs hypertrophy vs endurance](https://fitness.stackexchange.com/questions/8238/what-are-the-trade-offs-of-weig... | I know of one study (<http://www.ncbi.nlm.nih.gov/pubmed/18787090>) that shows that 12 weeks of
* high rep/low weight training produced 2.6% increase in muscle size and 19% increase in strength, versus
* low rep/high weight training produced 7.6% increase in size and 35% increase in strength.
So you could conclude fr... |
29,436 | When I read about strength training, the advice often comes with the assumption that the reader wants to get "big". I want to achieve strength, but would prefer not to increase size too much if possible.
So is there a difference in how one should train to increase muscle size vs how one should train to increase streng... | 2016/04/07 | [
"https://fitness.stackexchange.com/questions/29436",
"https://fitness.stackexchange.com",
"https://fitness.stackexchange.com/users/19988/"
] | Most of the [respected strength training programs](https://fitness.stackexchange.com/a/24596/7091) focus on exactly that: strength.
In general the [rep ranges are your biggest lever to play with with strength vs hypertrophy vs endurance](https://fitness.stackexchange.com/questions/8238/what-are-the-trade-offs-of-weig... | As others have said, strength vs size is a matter of rep range and overall intensity of your working weights. If you're looking for strength while keeping the same size, much of it will depend on neural efficiency (or the ability of your nervous system to recruit more muscle fibers) which will be developed over time as... |
29,436 | When I read about strength training, the advice often comes with the assumption that the reader wants to get "big". I want to achieve strength, but would prefer not to increase size too much if possible.
So is there a difference in how one should train to increase muscle size vs how one should train to increase streng... | 2016/04/07 | [
"https://fitness.stackexchange.com/questions/29436",
"https://fitness.stackexchange.com",
"https://fitness.stackexchange.com/users/19988/"
] | People don't accidentally gain a lot of muscle, even by strength training. Gaining a lot of muscle requires hard work in the gym and at every meal. This is not something you should worry about.
It is important, however, to make sure that the sources you are reading and watching focus on *strength* training, not bodybu... | I know of one study (<http://www.ncbi.nlm.nih.gov/pubmed/18787090>) that shows that 12 weeks of
* high rep/low weight training produced 2.6% increase in muscle size and 19% increase in strength, versus
* low rep/high weight training produced 7.6% increase in size and 35% increase in strength.
So you could conclude fr... |
29,436 | When I read about strength training, the advice often comes with the assumption that the reader wants to get "big". I want to achieve strength, but would prefer not to increase size too much if possible.
So is there a difference in how one should train to increase muscle size vs how one should train to increase streng... | 2016/04/07 | [
"https://fitness.stackexchange.com/questions/29436",
"https://fitness.stackexchange.com",
"https://fitness.stackexchange.com/users/19988/"
] | People don't accidentally gain a lot of muscle, even by strength training. Gaining a lot of muscle requires hard work in the gym and at every meal. This is not something you should worry about.
It is important, however, to make sure that the sources you are reading and watching focus on *strength* training, not bodybu... | As others have said, strength vs size is a matter of rep range and overall intensity of your working weights. If you're looking for strength while keeping the same size, much of it will depend on neural efficiency (or the ability of your nervous system to recruit more muscle fibers) which will be developed over time as... |
794,663 | Is there a built in method in .NET to convert a number to the string representation of the number? For example, 1 becomes one, 2 becomes two, etc. | 2009/04/27 | [
"https://Stackoverflow.com/questions/794663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | Here is the modified code I used:
```
//Wrapper class for NumberToText(int n) to account for single zero parameter.
public static string ConvertToStringRepresentation(long number)
{
string result = null;
if (number == 0)
{
result = "Zero";
}
else
{
result = NumberToText(number)... | Here is a more complete/improved solution based on a couple ideas also posted here. Includes grammar/hyphen fixes, and optional capitalization, long support, support for zero, and yet still very succinct (VB.Net):
```
Function NumberToCapitalizedWords(ByVal n As Long) As String
Return New System.Globalization.Cult... |
794,663 | Is there a built in method in .NET to convert a number to the string representation of the number? For example, 1 becomes one, 2 becomes two, etc. | 2009/04/27 | [
"https://Stackoverflow.com/questions/794663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | ```
public string IntToString(int number)//nobody really uses negative numbers
{
if(number == 0)
return "zero";
else
if(number == 1)
return "one";
.......
else
if(number == 2147483647)
return "two billion one hundred forty seven million fou... | This thread was a great help. I like Ryan Emerle's solution the best for its clarity. Here's my version which I think makes the structure clear as day:
```
public static class Number
{
static string[] first =
{
"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine",
"Ten... |
794,663 | Is there a built in method in .NET to convert a number to the string representation of the number? For example, 1 becomes one, 2 becomes two, etc. | 2009/04/27 | [
"https://Stackoverflow.com/questions/794663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | Here's my refined version of the first answer. I hope it's useful.
```
/// <summary>
/// Converts an <see cref="int"/> to its textual representation
/// </summary>
/// <param name="num">
/// The number to convert to text
/// </param>
/// <returns>
/// A textual representation of the given number
/// </returns>
public ... | *[A conversion from integer to long form English... I could write that ;-)](http://weblogs.asp.net/justin_rogers/archive/2004/06/09/151675.aspx)* is a pretty good article on the topic:
```
using System;
public class NumberToEnglish {
private static string[] onesMapping =
new string[] {
"Zero",... |
794,663 | Is there a built in method in .NET to convert a number to the string representation of the number? For example, 1 becomes one, 2 becomes two, etc. | 2009/04/27 | [
"https://Stackoverflow.com/questions/794663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | There's no built in solution in `.net`, but there are good libraries around. The best currently is definitely [Humanizr](http://humanizr.net/):
```
Console.WriteLine(794663.ToWords()); // => seven hundred and ninety-four thousand six hundred and sixty-three
```
It also supports ordinal, and roman representations:
`... | *[A conversion from integer to long form English... I could write that ;-)](http://weblogs.asp.net/justin_rogers/archive/2004/06/09/151675.aspx)* is a pretty good article on the topic:
```
using System;
public class NumberToEnglish {
private static string[] onesMapping =
new string[] {
"Zero",... |
794,663 | Is there a built in method in .NET to convert a number to the string representation of the number? For example, 1 becomes one, 2 becomes two, etc. | 2009/04/27 | [
"https://Stackoverflow.com/questions/794663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | Based on Ryan Emerle's solution, this adds dashes at the correct locations, does not include trailing spaces, does not pluralize numbers, and properly handles an input of zero (0):
```
public static string ToText(long n) {
return _toText(n, true);
}
private static string _toText(long n, bool isFirst = false) {
... | Here is a more complete/improved solution based on a couple ideas also posted here. Includes grammar/hyphen fixes, and optional capitalization, long support, support for zero, and yet still very succinct (VB.Net):
```
Function NumberToCapitalizedWords(ByVal n As Long) As String
Return New System.Globalization.Cult... |
794,663 | Is there a built in method in .NET to convert a number to the string representation of the number? For example, 1 becomes one, 2 becomes two, etc. | 2009/04/27 | [
"https://Stackoverflow.com/questions/794663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86191/"
] | Ah, there may not be a class to do this, but there was a code golf question which I provided a C# example for:
[Code Golf: Number to Words](https://stackoverflow.com/questions/309884/code-golf-number-to-words/408776#408776)
However, it's not the easiest to read and it only goes up to decimal.MaxValue, so I've written... | There's no built in solution in `.net`, but there are good libraries around. The best currently is definitely [Humanizr](http://humanizr.net/):
```
Console.WriteLine(794663.ToWords()); // => seven hundred and ninety-four thousand six hundred and sixty-three
```
It also supports ordinal, and roman representations:
`... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.