qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
45,680,686 | I got this custome directive:
```
angular.module('uvox-player').directive('customOnChange', function() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var onChangeHandler = scope.$eval(attrs.customOnChange);
element.bind('change', onChangeHandler);
... | 2017/08/14 | [
"https://Stackoverflow.com/questions/45680686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1433073/"
] | This is because virtualenv not link include and lib directory to virtualenv's directory. I solve this by using anaconda virtual env.
wish helps. | I believe python-dev will already be installed. you may not be including the header files path while compiling.
u can search for Python.h by:
`find <venv folder> | grep Python.h`
If it is not able to find the file in your virtual environment, a simple command like below should install it:
`pip install python-dev (o... |
45,680,686 | I got this custome directive:
```
angular.module('uvox-player').directive('customOnChange', function() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var onChangeHandler = scope.$eval(attrs.customOnChange);
element.bind('change', onChangeHandler);
... | 2017/08/14 | [
"https://Stackoverflow.com/questions/45680686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1433073/"
] | I am currently having issue in Ubuntu 20 where the default python is python 3.8. This causes issue when I try to install Pillow in a virtualenv created by `pipenv` that need to use python 3.9.
The simplest solution I found so far is to install python-dev for 3.9
```
sudo apt install python3.9-dev
```
Previously I i... | This is because virtualenv not link include and lib directory to virtualenv's directory. I solve this by using anaconda virtual env.
wish helps. |
45,680,686 | I got this custome directive:
```
angular.module('uvox-player').directive('customOnChange', function() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var onChangeHandler = scope.$eval(attrs.customOnChange);
element.bind('change', onChangeHandler);
... | 2017/08/14 | [
"https://Stackoverflow.com/questions/45680686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1433073/"
] | Maybe not the best way but my solution was installing [miniconda](https://docs.conda.io/en/latest/miniconda.html). You can also probably try the larger Anaconda distribution. I believe these distributions have built-in python-dev. | On Ubuntu 16.04, I followed [these instructions](https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-programming-environment-on-an-ubuntu-16-04-server) to successfully set up a Python virtual environment with python3-dev. |
45,680,686 | I got this custome directive:
```
angular.module('uvox-player').directive('customOnChange', function() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var onChangeHandler = scope.$eval(attrs.customOnChange);
element.bind('change', onChangeHandler);
... | 2017/08/14 | [
"https://Stackoverflow.com/questions/45680686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1433073/"
] | On Ubuntu 16.04, I followed [these instructions](https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-programming-environment-on-an-ubuntu-16-04-server) to successfully set up a Python virtual environment with python3-dev. | I believe python-dev will already be installed. you may not be including the header files path while compiling.
u can search for Python.h by:
`find <venv folder> | grep Python.h`
If it is not able to find the file in your virtual environment, a simple command like below should install it:
`pip install python-dev (o... |
45,680,686 | I got this custome directive:
```
angular.module('uvox-player').directive('customOnChange', function() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var onChangeHandler = scope.$eval(attrs.customOnChange);
element.bind('change', onChangeHandler);
... | 2017/08/14 | [
"https://Stackoverflow.com/questions/45680686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1433073/"
] | I am currently having issue in Ubuntu 20 where the default python is python 3.8. This causes issue when I try to install Pillow in a virtualenv created by `pipenv` that need to use python 3.9.
The simplest solution I found so far is to install python-dev for 3.9
```
sudo apt install python3.9-dev
```
Previously I i... | On Ubuntu 16.04, I followed [these instructions](https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-programming-environment-on-an-ubuntu-16-04-server) to successfully set up a Python virtual environment with python3-dev. |
45,680,686 | I got this custome directive:
```
angular.module('uvox-player').directive('customOnChange', function() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var onChangeHandler = scope.$eval(attrs.customOnChange);
element.bind('change', onChangeHandler);
... | 2017/08/14 | [
"https://Stackoverflow.com/questions/45680686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1433073/"
] | Maybe not the best way but my solution was installing [miniconda](https://docs.conda.io/en/latest/miniconda.html). You can also probably try the larger Anaconda distribution. I believe these distributions have built-in python-dev. | I believe python-dev will already be installed. you may not be including the header files path while compiling.
u can search for Python.h by:
`find <venv folder> | grep Python.h`
If it is not able to find the file in your virtual environment, a simple command like below should install it:
`pip install python-dev (o... |
45,680,686 | I got this custome directive:
```
angular.module('uvox-player').directive('customOnChange', function() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var onChangeHandler = scope.$eval(attrs.customOnChange);
element.bind('change', onChangeHandler);
... | 2017/08/14 | [
"https://Stackoverflow.com/questions/45680686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1433073/"
] | I am currently having issue in Ubuntu 20 where the default python is python 3.8. This causes issue when I try to install Pillow in a virtualenv created by `pipenv` that need to use python 3.9.
The simplest solution I found so far is to install python-dev for 3.9
```
sudo apt install python3.9-dev
```
Previously I i... | Maybe not the best way but my solution was installing [miniconda](https://docs.conda.io/en/latest/miniconda.html). You can also probably try the larger Anaconda distribution. I believe these distributions have built-in python-dev. |
45,680,686 | I got this custome directive:
```
angular.module('uvox-player').directive('customOnChange', function() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var onChangeHandler = scope.$eval(attrs.customOnChange);
element.bind('change', onChangeHandler);
... | 2017/08/14 | [
"https://Stackoverflow.com/questions/45680686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1433073/"
] | I am currently having issue in Ubuntu 20 where the default python is python 3.8. This causes issue when I try to install Pillow in a virtualenv created by `pipenv` that need to use python 3.9.
The simplest solution I found so far is to install python-dev for 3.9
```
sudo apt install python3.9-dev
```
Previously I i... | I believe python-dev will already be installed. you may not be including the header files path while compiling.
u can search for Python.h by:
`find <venv folder> | grep Python.h`
If it is not able to find the file in your virtual environment, a simple command like below should install it:
`pip install python-dev (o... |
36,584,122 | I'm trying to remove an image and I get:
```
# docker rmi f50f9524513f
Failed to remove image (f50f9524513f): Error response from daemon: conflict: unable to delete f50f9524513f (cannot be forced) - image has dependent child images
```
This is the docker version:
```
# docker version
Client:
Version: 1.10.3... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36584122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2342229/"
] | If you don't have a huge number of images, there's always the brute-force approach:
```
for i in $(docker images -q)
do
docker history $i | grep -q f50f9524513f && echo $i
done | sort -u
``` | Based on [slushy](https://stackoverflow.com/a/53037893/3364871) and [Michael Hoffman](https://stackoverflow.com/a/11532197/3364871) answers, if you don't have a ton of images you can use this shell function:
```
docker_image_desc() {
for image in $(docker images --quiet --filter "since=${1}"); do
if [ $(docker h... |
36,584,122 | I'm trying to remove an image and I get:
```
# docker rmi f50f9524513f
Failed to remove image (f50f9524513f): Error response from daemon: conflict: unable to delete f50f9524513f (cannot be forced) - image has dependent child images
```
This is the docker version:
```
# docker version
Client:
Version: 1.10.3... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36584122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2342229/"
] | I've created a [gist](https://gist.github.com/mlinhard/d460b2a6b3f6cd4426e554da040c0658) with shell script to print out descendant tree of a docker image, should anyone be interested in bash solution:
```sh
#!/bin/bash
parent_short_id=$1
parent_id=`docker inspect --format '{{.Id}}' $1`
get_kids() {
local parent_i... | This is what I did in order to preserve my final "image" (layer, really - which is what threw me off, as I am just getting into docker builds).
I was getting the whole "... cannot be forced..." message. I realized I couldn't delete the images I didn't need because they are not really independent images created by 'doc... |
36,584,122 | I'm trying to remove an image and I get:
```
# docker rmi f50f9524513f
Failed to remove image (f50f9524513f): Error response from daemon: conflict: unable to delete f50f9524513f (cannot be forced) - image has dependent child images
```
This is the docker version:
```
# docker version
Client:
Version: 1.10.3... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36584122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2342229/"
] | Based on [slushy](https://stackoverflow.com/a/53037893/3364871) and [Michael Hoffman](https://stackoverflow.com/a/11532197/3364871) answers, if you don't have a ton of images you can use this shell function:
```
docker_image_desc() {
for image in $(docker images --quiet --filter "since=${1}"); do
if [ $(docker h... | You can delete Docker images irrespective of parent and child relation through the below directory of Docker
```
/var/lib/docker/image/devicemapper/imagedb/content/sha256
```
In this directory you can find Docker images, so you can delete what you want. |
36,584,122 | I'm trying to remove an image and I get:
```
# docker rmi f50f9524513f
Failed to remove image (f50f9524513f): Error response from daemon: conflict: unable to delete f50f9524513f (cannot be forced) - image has dependent child images
```
This is the docker version:
```
# docker version
Client:
Version: 1.10.3... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36584122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2342229/"
] | If you don't have a huge number of images, there's always the brute-force approach:
```
for i in $(docker images -q)
do
docker history $i | grep -q f50f9524513f && echo $i
done | sort -u
``` | I was also facing the same issue. Fallowed steps below to resolve the issue.
**Stop all running containers**
docker stop $(docker ps -aq)
**Remove all containers**
docker rm $(docker ps -aq)
**Remove all images**
docker rmi $(docker images -q) |
36,584,122 | I'm trying to remove an image and I get:
```
# docker rmi f50f9524513f
Failed to remove image (f50f9524513f): Error response from daemon: conflict: unable to delete f50f9524513f (cannot be forced) - image has dependent child images
```
This is the docker version:
```
# docker version
Client:
Version: 1.10.3... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36584122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2342229/"
] | Install [dockviz](https://github.com/justone/dockviz/releases/latest) and follow the branches from the image id in the tree view:
```
dockviz images --tree -l
``` | I cooked up this to recursively find children, their repo tags, and print what they're doing:
```
docker_img_tree() {
for i in $(docker image ls -qa) ; do
[ -f "/tmp/dii-$i" ] || ( docker image inspect $i > /tmp/dii-$i)
if grep -qiE 'Parent.*'$1 /tmp/dii-$i ; then
echo "$2=============... |
36,584,122 | I'm trying to remove an image and I get:
```
# docker rmi f50f9524513f
Failed to remove image (f50f9524513f): Error response from daemon: conflict: unable to delete f50f9524513f (cannot be forced) - image has dependent child images
```
This is the docker version:
```
# docker version
Client:
Version: 1.10.3... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36584122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2342229/"
] | **Short answer:**
[Here is a python3 script](https://gist.github.com/altaurog/21ea7afe578a523e3dfe8d8a746f1e7d) that lists dependent docker images.
**Long answer:**
You can see the image id and parent id for all image created after the image in question with the following:
```
docker inspect --format='{{.Id}} {{.Pare... | I was also facing the same issue. Fallowed steps below to resolve the issue.
**Stop all running containers**
docker stop $(docker ps -aq)
**Remove all containers**
docker rm $(docker ps -aq)
**Remove all images**
docker rmi $(docker images -q) |
36,584,122 | I'm trying to remove an image and I get:
```
# docker rmi f50f9524513f
Failed to remove image (f50f9524513f): Error response from daemon: conflict: unable to delete f50f9524513f (cannot be forced) - image has dependent child images
```
This is the docker version:
```
# docker version
Client:
Version: 1.10.3... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36584122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2342229/"
] | If you don't have a huge number of images, there's always the brute-force approach:
```
for i in $(docker images -q)
do
docker history $i | grep -q f50f9524513f && echo $i
done | sort -u
``` | This is what I did in order to preserve my final "image" (layer, really - which is what threw me off, as I am just getting into docker builds).
I was getting the whole "... cannot be forced..." message. I realized I couldn't delete the images I didn't need because they are not really independent images created by 'doc... |
36,584,122 | I'm trying to remove an image and I get:
```
# docker rmi f50f9524513f
Failed to remove image (f50f9524513f): Error response from daemon: conflict: unable to delete f50f9524513f (cannot be forced) - image has dependent child images
```
This is the docker version:
```
# docker version
Client:
Version: 1.10.3... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36584122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2342229/"
] | Install [dockviz](https://github.com/justone/dockviz/releases/latest) and follow the branches from the image id in the tree view:
```
dockviz images --tree -l
``` | I was also facing the same issue. Fallowed steps below to resolve the issue.
**Stop all running containers**
docker stop $(docker ps -aq)
**Remove all containers**
docker rm $(docker ps -aq)
**Remove all images**
docker rmi $(docker images -q) |
36,584,122 | I'm trying to remove an image and I get:
```
# docker rmi f50f9524513f
Failed to remove image (f50f9524513f): Error response from daemon: conflict: unable to delete f50f9524513f (cannot be forced) - image has dependent child images
```
This is the docker version:
```
# docker version
Client:
Version: 1.10.3... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36584122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2342229/"
] | **Short answer:**
[Here is a python3 script](https://gist.github.com/altaurog/21ea7afe578a523e3dfe8d8a746f1e7d) that lists dependent docker images.
**Long answer:**
You can see the image id and parent id for all image created after the image in question with the following:
```
docker inspect --format='{{.Id}} {{.Pare... | Here's a simple way to get a list of child images that are dependent on a parent image:
```sh
image_id=123456789012
docker images -a -q --filter since=$image_id |
xargs docker inspect --format='{{.Id}} {{.Parent}}' |
grep $image_id
```
That will generate a list of child/parent images IDs, for example (truncated for... |
36,584,122 | I'm trying to remove an image and I get:
```
# docker rmi f50f9524513f
Failed to remove image (f50f9524513f): Error response from daemon: conflict: unable to delete f50f9524513f (cannot be forced) - image has dependent child images
```
This is the docker version:
```
# docker version
Client:
Version: 1.10.3... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36584122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2342229/"
] | If you don't have a huge number of images, there's always the brute-force approach:
```
for i in $(docker images -q)
do
docker history $i | grep -q f50f9524513f && echo $i
done | sort -u
``` | Here's a simple way to get a list of child images that are dependent on a parent image:
```sh
image_id=123456789012
docker images -a -q --filter since=$image_id |
xargs docker inspect --format='{{.Id}} {{.Parent}}' |
grep $image_id
```
That will generate a list of child/parent images IDs, for example (truncated for... |
4,819,406 | I'm trying to save some lines of text in a codepage different from my system's such as Cyrillic to a TFileStream using Delphi XE. However I can't find any code sample to produce those encoded file ?
I tried using the same code as TStrings.SaveToStream however I'm not sure I implemented it correctly (the WriteBom part ... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4819406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/184404/"
] | If I understand it's pretty simple. Declare an AnsiString with affinity for Cyrillic 1251:
```
type
// The code page for ANSI-Cyrillic is 1251
CyrillicString = type AnsiString(1251);
```
Then assign your Unicode string to one of these:
```
var
UnicodeText: string;
CyrillicText: CyrillicString;
....
Cyrill... | Not sure what example are you looking for; may be the following can help - the example converts unicode strings (SL) to ANSI Cyrillic:
```
procedure SaveCyrillic(SL: TStrings; Stream: TStream);
var
CyrillicEncoding: TEncoding;
begin
CyrillicEncoding := TEncoding.GetEncoding(1251);
try
SL.SaveToStream(Stream... |
2,250,311 | I am trying to determine what control called a `Set property`. Say textbox *Pet* is bound to a Property. I am using `INotifyPropertyChanged` but I am wondering if there is a way to get the actual control.
The `sender` in my `PropertyChanged Event` is the **Class** containing the properties and not the **control** that... | 2010/02/12 | [
"https://Stackoverflow.com/questions/2250311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46724/"
] | you could go for capturing the `StackTrace`, eg.
```
var methodBase = new StackTrace().GetFrame(1/* depends on your depth*/).GetMethod();
var reflecedType = methodBase.ReflectedType;
var methodName = methodBase.Name;
``` | If you need to know which control did something, just attach an event to the control and handle that event in the view's codebehind.
The INPC model object that's having bindings applied to it should be view-agnostic...
This applies to WPF or Winforms, but out of curiousity, which are you using? |
31,925,511 | I have problem with integration the newest version StyleCop with Visual Studio 2013 Ultimate. I have also installed Re# 9.
[This answer](https://stackoverflow.com/questions/23639815/how-do-i-integrate-stylecop-4-7-with-visual-studio-2013) not working on my pc :/
I have installed StyleCop nuget packages.
[![enter ima... | 2015/08/10 | [
"https://Stackoverflow.com/questions/31925511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/650148/"
] | The [nuget package](https://www.nuget.org/packages/StyleCop.MSBuild/) `StyleCop.MSBuild` simplifies the adding of the properties to a csproj required to run StyleCop as part of the build. It also references a StyleCop instance inside `/packages/` which means that it is downloaded from sourcecontrol and each developer d... | You should have 'Run StyleCop' options in the Tools menu and the context menu of the Solution Explorer. I have ReSharper installed, but I don't think it is ReSharper that adds these menu items. VS Express edition does not support integration of add-ins if you are using an Express/Community edition..
[;
string csstring = s;
// done
```
Alternatively, you can use `NSString`'s `ToString()` method:
```
NSString s = NSString.FromData(deviceToken, NSStringEncoding.UTF8);
st... | I've managed to implement this, and I used the following code:
```
NSString newDeviceToken = new NSString(MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(new MonoTouch.ObjCRuntime.Class("NSString").Handle, new MonoTouch.ObjCRuntime.Selector("stringWithFormat:").Handle, strFormat.Handle, deviceToken.H... |
4,421,354 | I am trying to implement push notifications for MonoTouch but I couldn´t find samples of this anywhere. My problem is trying to read the deviceID into a .NET string.
The output below is just a lot of question marks so I am doing something wrong here.
Any help would be greatly appreciated!
```
public override v... | 2010/12/12 | [
"https://Stackoverflow.com/questions/4421354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/437762/"
] | There is an operator for implicit conversion in MonoTouch.
So you just do:
```
NSString s = NSString.FromData(deviceToken, NSStringEncoding.UTF8);
string csstring = s;
// done
```
Alternatively, you can use `NSString`'s `ToString()` method:
```
NSString s = NSString.FromData(deviceToken, NSStringEncoding.UTF8);
st... | Here's a great article showing how to do push notifications with MonoTouch:
<http://weblogs.thinktecture.com/cweyer/2010/12/implementing-push-notifications-for-ios-with-c-monotouch-using-the-cloud-urban-airship.html>
Here's the snippet that does what you want:
```
var str = (NSString)Runtime.GetNSObject (
... |
4,421,354 | I am trying to implement push notifications for MonoTouch but I couldn´t find samples of this anywhere. My problem is trying to read the deviceID into a .NET string.
The output below is just a lot of question marks so I am doing something wrong here.
Any help would be greatly appreciated!
```
public override v... | 2010/12/12 | [
"https://Stackoverflow.com/questions/4421354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/437762/"
] | Here's a great article showing how to do push notifications with MonoTouch:
<http://weblogs.thinktecture.com/cweyer/2010/12/implementing-push-notifications-for-ios-with-c-monotouch-using-the-cloud-urban-airship.html>
Here's the snippet that does what you want:
```
var str = (NSString)Runtime.GetNSObject (
... | I've managed to implement this, and I used the following code:
```
NSString newDeviceToken = new NSString(MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(new MonoTouch.ObjCRuntime.Class("NSString").Handle, new MonoTouch.ObjCRuntime.Selector("stringWithFormat:").Handle, strFormat.Handle, deviceToken.H... |
21,446,492 | I'm using `elastic-mapreduce` to spun new clusters from the command line. After reading [this](http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emr-mapr-launch-m7.html) tutorial, I have:
```
elastic-mapreduce --create --alive \
--instance-type m1.xlarge\
--num-instances 5 \
--supported-product mapr \
... | 2014/01/30 | [
"https://Stackoverflow.com/questions/21446492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1040718/"
] | When you create your EMR cluster make sure you enable a key pair. On EMR console you can see it like below:
 | To augment [Rico](https://stackoverflow.com/users/2989261/rico "Rico's")'s comment, above; I would add that you can pull down the key on the command line when you --create the cluster: for your example:
```
elastic-mapreduce --create --alive \
--instance-type m1.xlarge\
--num-instances 5 \
--supported-product mapr \
-... |
2,593,442 | I have the following question:
If $X$ is a continuous random variable that is uniformly distributed on the interval $(1,2)$ what is the distribution function of $Y=X+\frac{2}{X}?$\
I have tried to calculate the inverse of the function $f(x)=x+\frac{2}{x}$ but didn't manage to complete the calculation. Any ideas? | 2018/01/05 | [
"https://math.stackexchange.com/questions/2593442",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/482390/"
] | Setting
$$x+\frac1x=t$$
we have
$$x^2-10+\frac1{x^2}=\left(x+\frac1x\right)^2-12=t^2-12$$
thus
$$x^2+x-10+\frac1x+\frac1{x^2}=0\implies t^2+t-12=0$$ | The idea here is to find some change of variable which makes the equation easier to solve. We might have guesses as to what to change, but we know we were right only if it ends up working out.
Here, you might guess to substitute $t = x + \frac{1}{x}$ because there are four different powers of $x$ in the equation -- $x... |
2,593,442 | I have the following question:
If $X$ is a continuous random variable that is uniformly distributed on the interval $(1,2)$ what is the distribution function of $Y=X+\frac{2}{X}?$\
I have tried to calculate the inverse of the function $f(x)=x+\frac{2}{x}$ but didn't manage to complete the calculation. Any ideas? | 2018/01/05 | [
"https://math.stackexchange.com/questions/2593442",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/482390/"
] | Setting
$$x+\frac1x=t$$
we have
$$x^2-10+\frac1{x^2}=\left(x+\frac1x\right)^2-12=t^2-12$$
thus
$$x^2+x-10+\frac1x+\frac1{x^2}=0\implies t^2+t-12=0$$ | Another technique worth considering is that on the real field you can theoretically factor polynomials into polynomials of degree at most $2$.
[Can all real polynomials be factored into quadratic and linear factors?](https://math.stackexchange.com/questions/1041908/can-all-real-polynomials-be-factored-into-quadratic-a... |
2,593,442 | I have the following question:
If $X$ is a continuous random variable that is uniformly distributed on the interval $(1,2)$ what is the distribution function of $Y=X+\frac{2}{X}?$\
I have tried to calculate the inverse of the function $f(x)=x+\frac{2}{x}$ but didn't manage to complete the calculation. Any ideas? | 2018/01/05 | [
"https://math.stackexchange.com/questions/2593442",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/482390/"
] | For all real $k$ we obtain:
$$x^4+x^3-10x^2+x+1=\left(x^2+\frac{1}{2}x+k\right)^2-\frac{1}{4}x^2-k^2-kx-2kx^2-10x^2+x+1=$$
$$=\left(x^2+\frac{1}{2}x+k\right)^2-\left(\left(2k+\frac{41}{4}\right)x^2+(k-1)x+k^2-1\right).$$
Thus, for $k=1$ we obtain:
$$x^4+x^3-10x^2+x+1=\left(x^2+\frac{1}{2}x+1\right)^2-\frac{49}{4}x^2=$$... | The idea here is to find some change of variable which makes the equation easier to solve. We might have guesses as to what to change, but we know we were right only if it ends up working out.
Here, you might guess to substitute $t = x + \frac{1}{x}$ because there are four different powers of $x$ in the equation -- $x... |
2,593,442 | I have the following question:
If $X$ is a continuous random variable that is uniformly distributed on the interval $(1,2)$ what is the distribution function of $Y=X+\frac{2}{X}?$\
I have tried to calculate the inverse of the function $f(x)=x+\frac{2}{x}$ but didn't manage to complete the calculation. Any ideas? | 2018/01/05 | [
"https://math.stackexchange.com/questions/2593442",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/482390/"
] | Because the coefficients are palindromic (read the same backwards as forwards), whenever $x=a$ is a solution of the equation, so is $x=\frac 1a$.
Thus the roots will be $x=\pm 1$ (which are easily identified and factored out) or come in pairs which will give factors of the form $$(x-a)(x-\frac 1a)=x^2-(a+\frac 1a)x+1$... | The idea here is to find some change of variable which makes the equation easier to solve. We might have guesses as to what to change, but we know we were right only if it ends up working out.
Here, you might guess to substitute $t = x + \frac{1}{x}$ because there are four different powers of $x$ in the equation -- $x... |
2,593,442 | I have the following question:
If $X$ is a continuous random variable that is uniformly distributed on the interval $(1,2)$ what is the distribution function of $Y=X+\frac{2}{X}?$\
I have tried to calculate the inverse of the function $f(x)=x+\frac{2}{x}$ but didn't manage to complete the calculation. Any ideas? | 2018/01/05 | [
"https://math.stackexchange.com/questions/2593442",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/482390/"
] | For all real $k$ we obtain:
$$x^4+x^3-10x^2+x+1=\left(x^2+\frac{1}{2}x+k\right)^2-\frac{1}{4}x^2-k^2-kx-2kx^2-10x^2+x+1=$$
$$=\left(x^2+\frac{1}{2}x+k\right)^2-\left(\left(2k+\frac{41}{4}\right)x^2+(k-1)x+k^2-1\right).$$
Thus, for $k=1$ we obtain:
$$x^4+x^3-10x^2+x+1=\left(x^2+\frac{1}{2}x+1\right)^2-\frac{49}{4}x^2=$$... | Another technique worth considering is that on the real field you can theoretically factor polynomials into polynomials of degree at most $2$.
[Can all real polynomials be factored into quadratic and linear factors?](https://math.stackexchange.com/questions/1041908/can-all-real-polynomials-be-factored-into-quadratic-a... |
2,593,442 | I have the following question:
If $X$ is a continuous random variable that is uniformly distributed on the interval $(1,2)$ what is the distribution function of $Y=X+\frac{2}{X}?$\
I have tried to calculate the inverse of the function $f(x)=x+\frac{2}{x}$ but didn't manage to complete the calculation. Any ideas? | 2018/01/05 | [
"https://math.stackexchange.com/questions/2593442",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/482390/"
] | Because the coefficients are palindromic (read the same backwards as forwards), whenever $x=a$ is a solution of the equation, so is $x=\frac 1a$.
Thus the roots will be $x=\pm 1$ (which are easily identified and factored out) or come in pairs which will give factors of the form $$(x-a)(x-\frac 1a)=x^2-(a+\frac 1a)x+1$... | Another technique worth considering is that on the real field you can theoretically factor polynomials into polynomials of degree at most $2$.
[Can all real polynomials be factored into quadratic and linear factors?](https://math.stackexchange.com/questions/1041908/can-all-real-polynomials-be-factored-into-quadratic-a... |
4,259,662 | I am trying to check checkboxes based on values in a smarty array.
In my php
```
$smarty->assign('locations_array',array(4,6,9,7));
```
I want to search through the array and if there is a match check the checkbox.
Here is what I have tried in my template but I can't get it to work.I'm not sure how I can pass arr... | 2010/11/23 | [
"https://Stackoverflow.com/questions/4259662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/203170/"
] | Without actually answering your main question (I don't know whether you can pass two vars to the function from the template), this could all be avoided by making a new array instead of `$locations` in the php file. Just looking at your posted code, you would want each element to have three sub-elements: `title`, `id`, ... | For reference I think that this is the correct syntax when using array\_search.
```
{if $x.id|array_search:$locations_array}
```
where $x.id is the needle and $locations\_array is the array haystack.
I decided to go for a different approach based on eknals feedback |
4,259,662 | I am trying to check checkboxes based on values in a smarty array.
In my php
```
$smarty->assign('locations_array',array(4,6,9,7));
```
I want to search through the array and if there is a match check the checkbox.
Here is what I have tried in my template but I can't get it to work.I'm not sure how I can pass arr... | 2010/11/23 | [
"https://Stackoverflow.com/questions/4259662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/203170/"
] | Without actually answering your main question (I don't know whether you can pass two vars to the function from the template), this could all be avoided by making a new array instead of `$locations` in the php file. Just looking at your posted code, you would want each element to have three sub-elements: `title`, `id`, ... | i didnt works with array\_search but i have some simply solution for your issue.
you can check your checkbox value with the locations\_array in the foreach loop.
```
**$i = 0;**
{foreach $locations as $x}
**{if $x.id == $locations_array[$i]}**
<label><input checked type="checkbox" name="... |
4,259,662 | I am trying to check checkboxes based on values in a smarty array.
In my php
```
$smarty->assign('locations_array',array(4,6,9,7));
```
I want to search through the array and if there is a match check the checkbox.
Here is what I have tried in my template but I can't get it to work.I'm not sure how I can pass arr... | 2010/11/23 | [
"https://Stackoverflow.com/questions/4259662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/203170/"
] | For reference I think that this is the correct syntax when using array\_search.
```
{if $x.id|array_search:$locations_array}
```
where $x.id is the needle and $locations\_array is the array haystack.
I decided to go for a different approach based on eknals feedback | i didnt works with array\_search but i have some simply solution for your issue.
you can check your checkbox value with the locations\_array in the foreach loop.
```
**$i = 0;**
{foreach $locations as $x}
**{if $x.id == $locations_array[$i]}**
<label><input checked type="checkbox" name="... |
264,067 | I have created a MC application (Component Type: API Application) so I can insert Subscribers into a Journey using API event.
Here is the scope
[](https://i.stack.imgur.com/FV5jQ.png)
So I am stuck at the first hurdle, which is trying to authenticate... | 2019/05/29 | [
"https://salesforce.stackexchange.com/questions/264067",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/8296/"
] | So it turns out I've only hit the domain but not the correct resource.
I appended `/v2/token` to the URL and used parameters set out in this [page](https://developer.salesforce.com/docs/atlas.en-us.mc-app-development.meta/mc-app-development/access-token-s2s.htm). | Authentication and Triggered Send API are different. I was getting the same issue and after correcting i was able to resolve it. Please see the URLs below:
Auth URL =https://<>.auth.marketingcloudapis.com/v2/token
Triggered Send URL=https://<>.rest.marketingcloudapis.com/messaging/v1/messageDefinitionSends/key:xxxxx/... |
12,733,147 | <http://www.frostjedi.com/terra/scripts/demo/jquery-datepicker.html>
If you click outside of the textarea and reclick inside of it a calendar will appear. How can I make it appear when the page is first loaded?
Thanks! | 2012/10/04 | [
"https://Stackoverflow.com/questions/12733147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/569976/"
] | ```
$(function() {
$('#datepicker').datepicker('show');
});
```
This should give you the date picker without setting the focus. | This should work,
```
$(function() {
$('#datepicker').focus();
});
```
but the whole Jquery lib is not corectly included.
Try grabing jquery with :
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
``` |
12,733,147 | <http://www.frostjedi.com/terra/scripts/demo/jquery-datepicker.html>
If you click outside of the textarea and reclick inside of it a calendar will appear. How can I make it appear when the page is first loaded?
Thanks! | 2012/10/04 | [
"https://Stackoverflow.com/questions/12733147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/569976/"
] | This should work,
```
$(function() {
$('#datepicker').focus();
});
```
but the whole Jquery lib is not corectly included.
Try grabing jquery with :
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
``` | You can display it on DOM Ready:
```
$(function() {
$( "#datepicker" ).datepicker('show');
});
```
Also on the demo link you posted you are loading the jQuery js/css files from `jqueryui.com` domain and you get a 403 Forbidden HTTP error, so jQuery is not loaded.
If you want to use a CDN you should use <http://... |
12,733,147 | <http://www.frostjedi.com/terra/scripts/demo/jquery-datepicker.html>
If you click outside of the textarea and reclick inside of it a calendar will appear. How can I make it appear when the page is first loaded?
Thanks! | 2012/10/04 | [
"https://Stackoverflow.com/questions/12733147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/569976/"
] | ```
$(function() {
$('#datepicker').datepicker('show');
});
```
This should give you the date picker without setting the focus. | You can display it on DOM Ready:
```
$(function() {
$( "#datepicker" ).datepicker('show');
});
```
Also on the demo link you posted you are loading the jQuery js/css files from `jqueryui.com` domain and you get a 403 Forbidden HTTP error, so jQuery is not loaded.
If you want to use a CDN you should use <http://... |
31,832,766 | I have a SQL query that performs an INNER JOIN on two tables having >50M rows each. I wish to reduce the time it takes to search through the join by reducing the rows that are joined based on a column present on one of the tables.
Say I have table1 with columns A,B,C and table2 with columns A,D,E. I wish to join base... | 2015/08/05 | [
"https://Stackoverflow.com/questions/31832766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2400394/"
] | ```
SELECT one.B, two.D
FROM table1 one
INNER JOIN table2 two -- WHERE two.E IN ('e') --> shouldn't use where here
ON one.A = two.A and two.E = 'e'
WHERE one.B > 10
AND two.D IN ('...')
```
Comments included in the code. | You could also put the condition in the Where clause
```
SELECT one.B, two.D
FROM table1 a
JOIN table2 b
ON b.A = a.A
WHERE a.B > 10
And b.E = 'e'
AND b.D In ('...')
```
EDITED to remove 2nd incorrect suggestion |
31,832,766 | I have a SQL query that performs an INNER JOIN on two tables having >50M rows each. I wish to reduce the time it takes to search through the join by reducing the rows that are joined based on a column present on one of the tables.
Say I have table1 with columns A,B,C and table2 with columns A,D,E. I wish to join base... | 2015/08/05 | [
"https://Stackoverflow.com/questions/31832766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2400394/"
] | ```
SELECT one.B, two.D
FROM table1 one
INNER JOIN table2 two -- WHERE two.E IN ('e') --> shouldn't use where here
ON one.A = two.A and two.E = 'e'
WHERE one.B > 10
AND two.D IN ('...')
```
Comments included in the code. | As vkp pointed out, the WHERE is improperly used. Instead you could also make a subquery to include that where statement. So that:
```
INNER JOIN table2 two WHERE two.E IN ('e')
```
becomes
```
INNER JOIN (select * from table2 WHERE E IN ('e')) two
``` |
48,401 | How do I disable the auto-updating of the Top Sites in Safari? I don't want to turn the feature off altogether, I just want to prevent auto-update. I know this may seem like an attempt to defeat the purpose of Top Sites in the first place, but I find that if it auto-updates any of the Top Sites that are forum-based, al... | 2012/04/12 | [
"https://apple.stackexchange.com/questions/48401",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/21538/"
] | I found this somwhere else which may solve your problem:
* Quit Safari
* Open Terminal (Applications/Utilities) & paste:
```
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
```
then hit return & quit Terminal.
To reactivate:
```
defaults delete com.apple.Safari DebugSnapshotsUpdatePolicy
``` | If you use Safari's Private Browsing mode, Top Sites will not update at all. However, this solution might not completely address your original question - I haven't found any solution that could turn-off auto-updates of Top Sites, either completely or selectively for certain URLs/domains. |
48,401 | How do I disable the auto-updating of the Top Sites in Safari? I don't want to turn the feature off altogether, I just want to prevent auto-update. I know this may seem like an attempt to defeat the purpose of Top Sites in the first place, but I find that if it auto-updates any of the Top Sites that are forum-based, al... | 2012/04/12 | [
"https://apple.stackexchange.com/questions/48401",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/21538/"
] | To disable TopSites, quit Safari, open Terminal and type or paste:
`defaults write com.apple.Safari DebugSafari4IncludeTopSites false`
Press Return key. Relaunch Safari. | If you use Safari's Private Browsing mode, Top Sites will not update at all. However, this solution might not completely address your original question - I haven't found any solution that could turn-off auto-updates of Top Sites, either completely or selectively for certain URLs/domains. |
48,401 | How do I disable the auto-updating of the Top Sites in Safari? I don't want to turn the feature off altogether, I just want to prevent auto-update. I know this may seem like an attempt to defeat the purpose of Top Sites in the first place, but I find that if it auto-updates any of the Top Sites that are forum-based, al... | 2012/04/12 | [
"https://apple.stackexchange.com/questions/48401",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/21538/"
] | I found this somwhere else which may solve your problem:
* Quit Safari
* Open Terminal (Applications/Utilities) & paste:
```
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
```
then hit return & quit Terminal.
To reactivate:
```
defaults delete com.apple.Safari DebugSnapshotsUpdatePolicy
``` | To disable TopSites, quit Safari, open Terminal and type or paste:
`defaults write com.apple.Safari DebugSafari4IncludeTopSites false`
Press Return key. Relaunch Safari. |
89,782 | Florida is close to passing [HB.543](https://www.flsenate.gov/Session/Bill/2023/543) dubbed “constitutional carry”. This would allow people to carry concealed loaded guns without permits under legislation.
* For people with concealed weapons permits, does this change anything?
* Are the benefits of concealed weapons p... | 2023/02/26 | [
"https://law.stackexchange.com/questions/89782",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/134/"
] | 1. Effectively they would stop being required to pay fees for renewal and/or obtaining permits, plus no longer required to attend any required safety courses or self-report on any other information that such permits would typically require. There may be an issue with other states honoring a state's constitutional carry... | Two questions here:
1. For people who already have a FL issued permit, there is likely no change. Their permit is still valid and some may opt to continue to obtain one as there are other states that don't have "constitutional carry" and may recognized the FL permit.
2. This depends on the law but in most cases where ... |
43,697,550 | The constructor and function:
```
constructor(props) {
super(props);
this.state = {
tagline: 'We rank what people are talking about.',
year: new Date().getFullYear()
};
this.onFormSubmit = this.onFormSubmit.bind(this);
}
onFormSubmit(e) {
console.log('onFormSubmit', e)
consol... | 2017/04/29 | [
"https://Stackoverflow.com/questions/43697550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168738/"
] | Suggestions:
**1.** You are using value property with input fields but you didn't defined the onChange method so your input fields will be **read-only** because state value will not get updated.
**2.** You need to define a onChange event will all the input fields or make them uncontrolled element by removing the valu... | So how I would approach this is to store the values in your state using what is called a controlled component. Making a controlled component is very simple, this is a basic implementation:
```
class NameForm extends React.Component {
constructor(props) {
super(props);
this.state = {value: ''};
this.hand... |
43,697,550 | The constructor and function:
```
constructor(props) {
super(props);
this.state = {
tagline: 'We rank what people are talking about.',
year: new Date().getFullYear()
};
this.onFormSubmit = this.onFormSubmit.bind(this);
}
onFormSubmit(e) {
console.log('onFormSubmit', e)
consol... | 2017/04/29 | [
"https://Stackoverflow.com/questions/43697550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168738/"
] | You are not getting email or password information because you're passing in the state `console.log('this.state', this.state);` and you haven't set a state for the email and password.
Now, you got two options:
1. Set the state and get the form info from there
2. Pass the input value to a function that handles the info... | So how I would approach this is to store the values in your state using what is called a controlled component. Making a controlled component is very simple, this is a basic implementation:
```
class NameForm extends React.Component {
constructor(props) {
super(props);
this.state = {value: ''};
this.hand... |
43,697,550 | The constructor and function:
```
constructor(props) {
super(props);
this.state = {
tagline: 'We rank what people are talking about.',
year: new Date().getFullYear()
};
this.onFormSubmit = this.onFormSubmit.bind(this);
}
onFormSubmit(e) {
console.log('onFormSubmit', e)
consol... | 2017/04/29 | [
"https://Stackoverflow.com/questions/43697550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168738/"
] | Suggestions:
**1.** You are using value property with input fields but you didn't defined the onChange method so your input fields will be **read-only** because state value will not get updated.
**2.** You need to define a onChange event will all the input fields or make them uncontrolled element by removing the valu... | You are not getting email or password information because you're passing in the state `console.log('this.state', this.state);` and you haven't set a state for the email and password.
Now, you got two options:
1. Set the state and get the form info from there
2. Pass the input value to a function that handles the info... |
18,192,891 | I am working on an Android application. In my app I have to convert a string to JSON Object, then parse the values. I checked for a solution in Stackoverflow and found similar issue here [link](https://stackoverflow.com/questions/5245840/how-to-convert-string-to-jsonobject-in-java)
The solution is like this
```
... | 2013/08/12 | [
"https://Stackoverflow.com/questions/18192891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220296/"
] | Using Kotlin
```
val data = "{\"ApiInfo\":{\"description\":\"userDetails\",\"status\":\"success\"},\"userDetails\":{\"Name\":\"somename\",\"userName\":\"value\"},\"pendingPushDetails\":[]}\n"
try {
val jsonObject = JSONObject(data)
val infoObj = jsonObject.getJSONObject("ApiInfo")
} catch (e: Exce... | Here is the code, and you can decide which
(synchronized)StringBuffer or
faster StringBuilder to use.
Benchmark shows StringBuilder is Faster.
```
public class Main {
int times = 777;
long t;
{
StringBuffer sb = new StringBuffer();
t = System.cu... |
18,192,891 | I am working on an Android application. In my app I have to convert a string to JSON Object, then parse the values. I checked for a solution in Stackoverflow and found similar issue here [link](https://stackoverflow.com/questions/5245840/how-to-convert-string-to-jsonobject-in-java)
The solution is like this
```
... | 2013/08/12 | [
"https://Stackoverflow.com/questions/18192891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220296/"
] | You just need the lines of code as below:
```
try {
String myjsonString = "{\"phonetype\":\"N95\",\"cat\":\"WP\"}";
JSONObject jsonObject = new JSONObject(myjsonString );
//displaying the JSONObject as a String
Log.d("JSONObject = ", jsonObject.toString());
//getting specific... | Using Kotlin
```
val data = "{\"ApiInfo\":{\"description\":\"userDetails\",\"status\":\"success\"},\"userDetails\":{\"Name\":\"somename\",\"userName\":\"value\"},\"pendingPushDetails\":[]}\n"
try {
val jsonObject = JSONObject(data)
val infoObj = jsonObject.getJSONObject("ApiInfo")
} catch (e: Exce... |
18,192,891 | I am working on an Android application. In my app I have to convert a string to JSON Object, then parse the values. I checked for a solution in Stackoverflow and found similar issue here [link](https://stackoverflow.com/questions/5245840/how-to-convert-string-to-jsonobject-in-java)
The solution is like this
```
... | 2013/08/12 | [
"https://Stackoverflow.com/questions/18192891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220296/"
] | Remove the slashes:
```
String json = {"phonetype":"N95","cat":"WP"};
try {
JSONObject obj = new JSONObject(json);
Log.d("My App", obj.toString());
} catch (Throwable t) {
Log.e("My App", "Could not parse malformed JSON: \"" + json + "\"");
}
``` | This method works
```
String json = "{\"phonetype\":\"N95\",\"cat\":\"WP\"}";
try {
JSONObject obj = new JSONObject(json);
Log.d("My App", obj.toString());
Log.d("phonetype value ", obj.getString("phonetype"));
} catch (Throwable tx) {
Log.e("My App", "Could not parse ma... |
18,192,891 | I am working on an Android application. In my app I have to convert a string to JSON Object, then parse the values. I checked for a solution in Stackoverflow and found similar issue here [link](https://stackoverflow.com/questions/5245840/how-to-convert-string-to-jsonobject-in-java)
The solution is like this
```
... | 2013/08/12 | [
"https://Stackoverflow.com/questions/18192891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220296/"
] | Remove the slashes:
```
String json = {"phonetype":"N95","cat":"WP"};
try {
JSONObject obj = new JSONObject(json);
Log.d("My App", obj.toString());
} catch (Throwable t) {
Log.e("My App", "Could not parse malformed JSON: \"" + json + "\"");
}
``` | May be below is better.
```
JSONObject jsonObject=null;
try {
jsonObject=new JSONObject();
jsonObject.put("phonetype","N95");
jsonObject.put("cat","wp");
String jsonStr=jsonObject.toString();
} catch (JSONException e) {
e.printStackTrace();
}
``` |
18,192,891 | I am working on an Android application. In my app I have to convert a string to JSON Object, then parse the values. I checked for a solution in Stackoverflow and found similar issue here [link](https://stackoverflow.com/questions/5245840/how-to-convert-string-to-jsonobject-in-java)
The solution is like this
```
... | 2013/08/12 | [
"https://Stackoverflow.com/questions/18192891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220296/"
] | This method works
```
String json = "{\"phonetype\":\"N95\",\"cat\":\"WP\"}";
try {
JSONObject obj = new JSONObject(json);
Log.d("My App", obj.toString());
Log.d("phonetype value ", obj.getString("phonetype"));
} catch (Throwable tx) {
Log.e("My App", "Could not parse ma... | Using Kotlin
```
val data = "{\"ApiInfo\":{\"description\":\"userDetails\",\"status\":\"success\"},\"userDetails\":{\"Name\":\"somename\",\"userName\":\"value\"},\"pendingPushDetails\":[]}\n"
try {
val jsonObject = JSONObject(data)
val infoObj = jsonObject.getJSONObject("ApiInfo")
} catch (e: Exce... |
18,192,891 | I am working on an Android application. In my app I have to convert a string to JSON Object, then parse the values. I checked for a solution in Stackoverflow and found similar issue here [link](https://stackoverflow.com/questions/5245840/how-to-convert-string-to-jsonobject-in-java)
The solution is like this
```
... | 2013/08/12 | [
"https://Stackoverflow.com/questions/18192891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220296/"
] | just try this ,
finally this works for me :
```
//delete backslashes ( \ ) :
data = data.replaceAll("[\\\\]{1}[\"]{1}","\"");
//delete first and last double quotation ( " ) :
data = data.substring(data.indexOf("{"),data.lastIndexOf("}")+1);
JSONObject json = new JSONObject(data);
`... | Using Kotlin
```
val data = "{\"ApiInfo\":{\"description\":\"userDetails\",\"status\":\"success\"},\"userDetails\":{\"Name\":\"somename\",\"userName\":\"value\"},\"pendingPushDetails\":[]}\n"
try {
val jsonObject = JSONObject(data)
val infoObj = jsonObject.getJSONObject("ApiInfo")
} catch (e: Exce... |
18,192,891 | I am working on an Android application. In my app I have to convert a string to JSON Object, then parse the values. I checked for a solution in Stackoverflow and found similar issue here [link](https://stackoverflow.com/questions/5245840/how-to-convert-string-to-jsonobject-in-java)
The solution is like this
```
... | 2013/08/12 | [
"https://Stackoverflow.com/questions/18192891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220296/"
] | try this:
```
String json = "{'phonetype':'N95','cat':'WP'}";
``` | Here is the code, and you can decide which
(synchronized)StringBuffer or
faster StringBuilder to use.
Benchmark shows StringBuilder is Faster.
```
public class Main {
int times = 777;
long t;
{
StringBuffer sb = new StringBuffer();
t = System.cu... |
18,192,891 | I am working on an Android application. In my app I have to convert a string to JSON Object, then parse the values. I checked for a solution in Stackoverflow and found similar issue here [link](https://stackoverflow.com/questions/5245840/how-to-convert-string-to-jsonobject-in-java)
The solution is like this
```
... | 2013/08/12 | [
"https://Stackoverflow.com/questions/18192891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220296/"
] | Remove the slashes:
```
String json = {"phonetype":"N95","cat":"WP"};
try {
JSONObject obj = new JSONObject(json);
Log.d("My App", obj.toString());
} catch (Throwable t) {
Log.e("My App", "Could not parse malformed JSON: \"" + json + "\"");
}
``` | You just need the lines of code as below:
```
try {
String myjsonString = "{\"phonetype\":\"N95\",\"cat\":\"WP\"}";
JSONObject jsonObject = new JSONObject(myjsonString );
//displaying the JSONObject as a String
Log.d("JSONObject = ", jsonObject.toString());
//getting specific... |
18,192,891 | I am working on an Android application. In my app I have to convert a string to JSON Object, then parse the values. I checked for a solution in Stackoverflow and found similar issue here [link](https://stackoverflow.com/questions/5245840/how-to-convert-string-to-jsonobject-in-java)
The solution is like this
```
... | 2013/08/12 | [
"https://Stackoverflow.com/questions/18192891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220296/"
] | Using Kotlin
```
val data = "{\"ApiInfo\":{\"description\":\"userDetails\",\"status\":\"success\"},\"userDetails\":{\"Name\":\"somename\",\"userName\":\"value\"},\"pendingPushDetails\":[]}\n"
try {
val jsonObject = JSONObject(data)
val infoObj = jsonObject.getJSONObject("ApiInfo")
} catch (e: Exce... | May be below is better.
```
JSONObject jsonObject=null;
try {
jsonObject=new JSONObject();
jsonObject.put("phonetype","N95");
jsonObject.put("cat","wp");
String jsonStr=jsonObject.toString();
} catch (JSONException e) {
e.printStackTrace();
}
``` |
18,192,891 | I am working on an Android application. In my app I have to convert a string to JSON Object, then parse the values. I checked for a solution in Stackoverflow and found similar issue here [link](https://stackoverflow.com/questions/5245840/how-to-convert-string-to-jsonobject-in-java)
The solution is like this
```
... | 2013/08/12 | [
"https://Stackoverflow.com/questions/18192891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220296/"
] | Remove the slashes:
```
String json = {"phonetype":"N95","cat":"WP"};
try {
JSONObject obj = new JSONObject(json);
Log.d("My App", obj.toString());
} catch (Throwable t) {
Log.e("My App", "Could not parse malformed JSON: \"" + json + "\"");
}
``` | Here is the code, and you can decide which
(synchronized)StringBuffer or
faster StringBuilder to use.
Benchmark shows StringBuilder is Faster.
```
public class Main {
int times = 777;
long t;
{
StringBuffer sb = new StringBuffer();
t = System.cu... |
27,774,071 | I need to replace `'http://'` with `'https://'` in a URL (if the former exists); and if `'http://'` or `'https://'` is not the prefix (schema), then I need to prefix the URL with `'https://'`.
I can simply check if the URL begins with `'http'` and prefix it to `'https'` accordingly or replace `'http'` if it exists. It... | 2015/01/05 | [
"https://Stackoverflow.com/questions/27774071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3658423/"
] | ```js
function simpleHttpsPrefixer(url) {
return url.replace(/^(?:https?:\/\/)?(.*)/, "https://$1");
}
``` | Just do
```
var str = "http://www.whatever.com.au";
str = str.replace("http://", "https://");
alert(str);
```
If you want to one-line it:
```
url = url.replace("http://", "https://");
``` |
27,774,071 | I need to replace `'http://'` with `'https://'` in a URL (if the former exists); and if `'http://'` or `'https://'` is not the prefix (schema), then I need to prefix the URL with `'https://'`.
I can simply check if the URL begins with `'http'` and prefix it to `'https'` accordingly or replace `'http'` if it exists. It... | 2015/01/05 | [
"https://Stackoverflow.com/questions/27774071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3658423/"
] | ```js
function simpleHttpsPrefixer(url) {
return url.replace(/^(?:https?:\/\/)?(.*)/, "https://$1");
}
``` | Regex Solution
--------------
Yes, it is possible to do this in one statement using a JS regex replace:
```
url = url.replace(/^(?:https?:\/\/)?(.*)/, "https://$1");
```
The snippet below demonstrates the above single-statement, regex solution with `http`, `https`, and schemaless URLs.
```js
var schemalessUrl = "w... |
326,262 | I need to create an application that when a user copies a file into an specific folder, my application will be activated and the file will be changed, also, when the user reads back any file in the folder, changes will also be made to the file.
Is it possible?
I'll use .net for this.
I think the folder C:\WINDOWS\as... | 2008/11/28 | [
"https://Stackoverflow.com/questions/326262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17648/"
] | Well, I'm sure you could write an explorer extension that would do that, but the more typical method that I know of is to write a windows service that monitors the directory in question using the FileSystemWatcher class to monitor events.
The service can then perform the requested actions (or spawn an executable to do ... | You can monitor for changes with [FileSystemWatcher](http://msdn.microsoft.com/en-us/library/ch2s8yd7.aspx).
>
> You can configure the component to
> watch either an entire directory and
> its contents or a specific file or set
> of files within a given directory. The
> FileSystemWatcher component raises an
> ev... |
326,262 | I need to create an application that when a user copies a file into an specific folder, my application will be activated and the file will be changed, also, when the user reads back any file in the folder, changes will also be made to the file.
Is it possible?
I'll use .net for this.
I think the folder C:\WINDOWS\as... | 2008/11/28 | [
"https://Stackoverflow.com/questions/326262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17648/"
] | Well, I'm sure you could write an explorer extension that would do that, but the more typical method that I know of is to write a windows service that monitors the directory in question using the FileSystemWatcher class to monitor events.
The service can then perform the requested actions (or spawn an executable to do ... | The closest thing you'll get in .net is the FileSystemWatcher class, it will monitor for changes (creating and writing) but not for reading activity.
There are many samples online and on MSDN
<http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx> |
326,262 | I need to create an application that when a user copies a file into an specific folder, my application will be activated and the file will be changed, also, when the user reads back any file in the folder, changes will also be made to the file.
Is it possible?
I'll use .net for this.
I think the folder C:\WINDOWS\as... | 2008/11/28 | [
"https://Stackoverflow.com/questions/326262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17648/"
] | You can detect users copying files into a folder with a service that uses FileSystemWatcher. Altering the contents of a file when an app reads the file requires viral techniques that patch the operating system. Like a rootkit or a file system filter driver. Not something I'd recommend considering, alter the file after ... | You can monitor for changes with [FileSystemWatcher](http://msdn.microsoft.com/en-us/library/ch2s8yd7.aspx).
>
> You can configure the component to
> watch either an entire directory and
> its contents or a specific file or set
> of files within a given directory. The
> FileSystemWatcher component raises an
> ev... |
326,262 | I need to create an application that when a user copies a file into an specific folder, my application will be activated and the file will be changed, also, when the user reads back any file in the folder, changes will also be made to the file.
Is it possible?
I'll use .net for this.
I think the folder C:\WINDOWS\as... | 2008/11/28 | [
"https://Stackoverflow.com/questions/326262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17648/"
] | You can detect users copying files into a folder with a service that uses FileSystemWatcher. Altering the contents of a file when an app reads the file requires viral techniques that patch the operating system. Like a rootkit or a file system filter driver. Not something I'd recommend considering, alter the file after ... | The closest thing you'll get in .net is the FileSystemWatcher class, it will monitor for changes (creating and writing) but not for reading activity.
There are many samples online and on MSDN
<http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx> |
87,946 | I'm a little confused...
When I log into the main SharePoint web interface (SharePoint 2007) I'll see a specific user under People and Groups.
Then if I log into Central Admin > Shared Services > User Profiles and Properties > View User Profiles and attempt to search for that user I can't find it.
How is that possi... | 2014/01/16 | [
"https://sharepoint.stackexchange.com/questions/87946",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/8699/"
] | Yes you can certainly invoke a .exe file using C#. You would use the Process.Start command from the System.Diagnostics namespace. Remember all servers that run this code will need a copy of the exe in the location you specify to run it from.
<http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start(v=v... | No, but if its an activeX component you can call it through javascript, if you are sure that all the users are running IE.
If you should call the exe, it should be on the server and then with a lot of hacks you could access the client computer if its on a network where you can control the security.. Not a very clean ... |
87,946 | I'm a little confused...
When I log into the main SharePoint web interface (SharePoint 2007) I'll see a specific user under People and Groups.
Then if I log into Central Admin > Shared Services > User Profiles and Properties > View User Profiles and attempt to search for that user I can't find it.
How is that possi... | 2014/01/16 | [
"https://sharepoint.stackexchange.com/questions/87946",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/8699/"
] | If you want to call the exe from server side code then you can use the below code, All you need to do is to include the namespace, `using System.Diagnostics;,` and at the place where you wish to start the application, call the `Process.Start` method
```
System.Diagnostics.Process.Start( @"C:\Windows\System32\Notepad.e... | No, but if its an activeX component you can call it through javascript, if you are sure that all the users are running IE.
If you should call the exe, it should be on the server and then with a lot of hacks you could access the client computer if its on a network where you can control the security.. Not a very clean ... |
87,946 | I'm a little confused...
When I log into the main SharePoint web interface (SharePoint 2007) I'll see a specific user under People and Groups.
Then if I log into Central Admin > Shared Services > User Profiles and Properties > View User Profiles and attempt to search for that user I can't find it.
How is that possi... | 2014/01/16 | [
"https://sharepoint.stackexchange.com/questions/87946",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/8699/"
] | If you want to call the exe from server side code then you can use the below code, All you need to do is to include the namespace, `using System.Diagnostics;,` and at the place where you wish to start the application, call the `Process.Start` method
```
System.Diagnostics.Process.Start( @"C:\Windows\System32\Notepad.e... | Yes you can certainly invoke a .exe file using C#. You would use the Process.Start command from the System.Diagnostics namespace. Remember all servers that run this code will need a copy of the exe in the location you specify to run it from.
<http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start(v=v... |
439,086 | I'm looking for a word that describes the backward, dependency between items that must be completed in a specific order, one after another.
"A series of *interdependent* tasks."
Is there a word that is more specific than interdependent? I don't want to imply that multiple tasks might depend on multiple other tasks. I... | 2018/03/29 | [
"https://english.stackexchange.com/questions/439086",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/261646/"
] | **in succession** from succeed [dictionary.com](http://www.dictionary.com/browse/succession?s=t)
>
> To come **next** in time or order; the coming of one person or thing after another in order, sequence, or in the course of events:
>
>
>
As in:
"A set of tasks done in succession" | **List** has a very precise meaning in mathematical or computer science domains, which seems to apply here.
Would a *”a **list** of tasks”* make sense?
>
> In computer science, a **list** or **sequence** is an abstract data type that represents a countable number of **ordered** values, where the same value may occu... |
439,086 | I'm looking for a word that describes the backward, dependency between items that must be completed in a specific order, one after another.
"A series of *interdependent* tasks."
Is there a word that is more specific than interdependent? I don't want to imply that multiple tasks might depend on multiple other tasks. I... | 2018/03/29 | [
"https://english.stackexchange.com/questions/439086",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/261646/"
] | The Oxford Reference has '**sequentially dependent task**'. | **List** has a very precise meaning in mathematical or computer science domains, which seems to apply here.
Would a *”a **list** of tasks”* make sense?
>
> In computer science, a **list** or **sequence** is an abstract data type that represents a countable number of **ordered** values, where the same value may occu... |
439,086 | I'm looking for a word that describes the backward, dependency between items that must be completed in a specific order, one after another.
"A series of *interdependent* tasks."
Is there a word that is more specific than interdependent? I don't want to imply that multiple tasks might depend on multiple other tasks. I... | 2018/03/29 | [
"https://english.stackexchange.com/questions/439086",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/261646/"
] | You can use **subsequent**
As in, set of subsequent tasks. | **List** has a very precise meaning in mathematical or computer science domains, which seems to apply here.
Would a *”a **list** of tasks”* make sense?
>
> In computer science, a **list** or **sequence** is an abstract data type that represents a countable number of **ordered** values, where the same value may occu... |
439,086 | I'm looking for a word that describes the backward, dependency between items that must be completed in a specific order, one after another.
"A series of *interdependent* tasks."
Is there a word that is more specific than interdependent? I don't want to imply that multiple tasks might depend on multiple other tasks. I... | 2018/03/29 | [
"https://english.stackexchange.com/questions/439086",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/261646/"
] | [Procedure](https://en.oxforddictionaries.com/definition/procedure) : A *series* of actions conducted *in a certain order* or manner. | **List** has a very precise meaning in mathematical or computer science domains, which seems to apply here.
Would a *”a **list** of tasks”* make sense?
>
> In computer science, a **list** or **sequence** is an abstract data type that represents a countable number of **ordered** values, where the same value may occu... |
439,086 | I'm looking for a word that describes the backward, dependency between items that must be completed in a specific order, one after another.
"A series of *interdependent* tasks."
Is there a word that is more specific than interdependent? I don't want to imply that multiple tasks might depend on multiple other tasks. I... | 2018/03/29 | [
"https://english.stackexchange.com/questions/439086",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/261646/"
] | The Oxford Reference has '**sequentially dependent task**'. | **in succession** from succeed [dictionary.com](http://www.dictionary.com/browse/succession?s=t)
>
> To come **next** in time or order; the coming of one person or thing after another in order, sequence, or in the course of events:
>
>
>
As in:
"A set of tasks done in succession" |
439,086 | I'm looking for a word that describes the backward, dependency between items that must be completed in a specific order, one after another.
"A series of *interdependent* tasks."
Is there a word that is more specific than interdependent? I don't want to imply that multiple tasks might depend on multiple other tasks. I... | 2018/03/29 | [
"https://english.stackexchange.com/questions/439086",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/261646/"
] | You can use **subsequent**
As in, set of subsequent tasks. | **in succession** from succeed [dictionary.com](http://www.dictionary.com/browse/succession?s=t)
>
> To come **next** in time or order; the coming of one person or thing after another in order, sequence, or in the course of events:
>
>
>
As in:
"A set of tasks done in succession" |
439,086 | I'm looking for a word that describes the backward, dependency between items that must be completed in a specific order, one after another.
"A series of *interdependent* tasks."
Is there a word that is more specific than interdependent? I don't want to imply that multiple tasks might depend on multiple other tasks. I... | 2018/03/29 | [
"https://english.stackexchange.com/questions/439086",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/261646/"
] | The Oxford Reference has '**sequentially dependent task**'. | [Procedure](https://en.oxforddictionaries.com/definition/procedure) : A *series* of actions conducted *in a certain order* or manner. |
439,086 | I'm looking for a word that describes the backward, dependency between items that must be completed in a specific order, one after another.
"A series of *interdependent* tasks."
Is there a word that is more specific than interdependent? I don't want to imply that multiple tasks might depend on multiple other tasks. I... | 2018/03/29 | [
"https://english.stackexchange.com/questions/439086",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/261646/"
] | You can use **subsequent**
As in, set of subsequent tasks. | [Procedure](https://en.oxforddictionaries.com/definition/procedure) : A *series* of actions conducted *in a certain order* or manner. |
5,841,503 | Hi i have a problem with assembly.
I have a program, who create a some class. Into that class i use some other classes from my difrent DLL. In that DLL class method i must use Assembly class, but i will have reference to the program Assembly, and i don't know how to do it.
If (in dll) i user Assembly.GetExecutingAsse... | 2011/04/30 | [
"https://Stackoverflow.com/questions/5841503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/732355/"
] | As a workaround, you could have your main assembly pass the correct Assembly to the referenced dll, but GetEntryAssembly() should also work.
I guess Lasee is right, there has to be some other problem with your code. Show us the code and the stacktrace.
**EDIT:**
In DLL you instantiate types from "Entry" assembly. O... | how about adding a reference from the satellite assembly to the main assembly, then you can use the types directly |
4,018 | Newbie to Tor. I installed Tor via Tor browser-launcher on a deb-based distribution. Apparently the torrc is a sort of configuration file which affects behavior of Tor. Now a little investigation revealed that torrc is at two places in my system.
The first is /etc/tor/torrc .
```
/etc/tor$cat torrc
## Configuration ... | 2014/09/05 | [
"https://tor.stackexchange.com/questions/4018",
"https://tor.stackexchange.com",
"https://tor.stackexchange.com/users/3547/"
] | If you are new to Tor I would recommend spending some time using it and understanding how it works before considering any tweaks. After you become more comfortable with it, you may want to test different modifications of the torrc file. Make sure you don't engage in any sensitive activities during this period. From exp... | The
>
> /etc/tor/torrc
>
>
>
is the default configuration file for when you install the tor standalone package.
The other one is for your browser bundle.
The recommended way is to just use the defaults for both if you just want to 'use' it.
If you have some specific things you want to enable with it then you ha... |
611,119 | I have a data file with some sample data (First Name, Last Name, Income, Rax rate). I need to do some calculations, but when displaying the result, I'm having trouble as it's a loop and it is not displaying in order. Yes, I must use bash.
Example file:
```
------------------------------------
example-file.txt:
John,... | 2020/09/24 | [
"https://unix.stackexchange.com/questions/611119",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/338638/"
] | Your script has several issues. First, you are treating strings as arrays (there's no reason or point in doing `for foo in $bar` when `$bar` is just one string). Second, you are reading the file multiple times when all you need to do is read it once. Third, you are not quoting your variables, which means the script wil... | Since you are using `awk` to extract fields from your lines, why don't you just let it do all the work? It should have sufficient arithmetic capabilities and converting your script into an AWK script may be easier than fixing it.
```none
$ cat example-file.txt
John,Rambo,99880,2%
Elon,Musk,144000,2%
```
```none
$ a... |
18,423,965 | Can some please advise why I'm getting this error when doing a git push heroku master on windows 7 for a basic mean stack app?
I'm trying a basic mean stack app and did the following commands and finally "git push heroku master" command which resulted in the error - bower install
sh: bower: not found, npm ERR! weir... | 2013/08/24 | [
"https://Stackoverflow.com/questions/18423965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2712585/"
] | You have bower listed in you `devDependencies` but not in your `dependencies`. `devDependencies` are only installed in the development environment.
```
-----> Installing dependencies with npm
```
So when Heroku runs `npm install` its running the production environment and is not installing the `devDeps`, including ... | I was running into the same issue.
Remove this line from your "scripts" dependency in your package.json file.
```
"postinstall": "./node_modules/bower/bin/bower install"
```
courtesy of <https://github.com/isaacs/npm/issues/3609> |
22,209 | In [an article on Ars Technica](https://arstechnica.com/science/2017/08/heres-what-happens-to-your-retina-if-you-view-an-eclipse-without-protection/) about safely viewing a solar eclipse, they say this:
>
> First, what not to do: Don’t view the eclipse with your naked eye or unfiltered telescopes, binoculars, sunglas... | 2017/08/20 | [
"https://astronomy.stackexchange.com/questions/22209",
"https://astronomy.stackexchange.com",
"https://astronomy.stackexchange.com/users/13850/"
] | Yes, it's safe :). Your eyeglasses are just correcting your vision. The net effect is just to give the equivalent of normal vision - and in any case, you'd normally be holding the eclipse glasses in front of your eyeglasses, in the same way that front-of-scope solar filters work to reduce the incoming light to a safe l... | Yes, it is fine to wear eclipse glasses over your eyeglasses. What the article in Ars Technica is talking about is looking through a telescope with eclipse glasses. The telescope would focus the light, burning right through the eclipse glasses. But wearing normal eyeglasses behind eclipse glasses is perfectly fine. |
32,886,391 | I am looking for a command that creates a `Range` Object containing all cells of a given worksheet.
`Sheets(1).Range("A1:AAZ1000000")` would be a safe bet, but you never know how many rows or columns you might encounter so something like
`Sheets(1).Range("All")` would be better. | 2015/10/01 | [
"https://Stackoverflow.com/questions/32886391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3258942/"
] | `Sheets(1).Cells` returns a `Range` object and when called with no parameters returns a range encompassing all the cells in the sheet. | `Sheets(1).EntireRow.EntireColumn` is one way |
26,930,520 | I have a Library that uses sockets that I'm trying to edit to emit an event, broadly the code looks like this:
```
function Library(port, host) {
this.myData = [];
this.socket = net.connect( ... );
this.socket.on('data', this._ondata.bind(this));
this.socket.on('error', this._onerror.bind(this));
this.socket... | 2014/11/14 | [
"https://Stackoverflow.com/questions/26930520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12854/"
] | I was able to fix this error on Ubuntu by adding a cell to the top of the notebook appending the module directory to the path:
```
import sys
sys.path.append('/usr/lib/python2.7/dist-packages')
```
The path to add can be found when running `pip install <something>`, (such as numpy) and it tells you where each packag... | Is it possible that /usr/bin/python is actually a symlink?
The better solution is that you should be running your ipython notebook from a virtualenv that contains all the modules that you need. |
22,372,269 | I want to create 3x3 gridview programmatically for displaying images. And I want to set each item height and width by getting screen dimensions. Like:
```
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
int width = metrics.widthPixels;
int height = metrics.heightPixels;
```
Then each item `width... | 2014/03/13 | [
"https://Stackoverflow.com/questions/22372269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2739372/"
] | This is how you can create gridview programmatically,
```
GridView grid = new GridView(this);
grid.setId(ViewIdentification.getId());
grid.setLayoutParams(new GridView.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
grid.setBackgroundColor(Color.WHITE);
grid.setNumColumns(3);
... | In your Activity:
```
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GridView gridView = new GridView(this);
gridView.setNumColumns(3);
setContentView(gridView);
gridView.setAdapter(new GridViewAdapter(this));
}
```
And Adapter:
```
private class GridViewAdapter exte... |
60,716,244 | Say I have some column names which ends with '\_undo', Now I need to remove this columns. Now instead of dropping one by one or storing them in a list before dropping, can i drop at one go?
```
df.drop(//drop at one go for those columns ending with _undo)
``` | 2020/03/17 | [
"https://Stackoverflow.com/questions/60716244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11934502/"
] | ```
val customDF = df.select(df.columns.filter(colName => checkname(colName)) .map(colName => new Column(colName)): _*)
```
where checkname is simple user function which returns colname if matches and null if not. Use your pattern to check inside that function.
```
def checkname () : [return type] = {
return [exp... | What about this?
```
df.drop(df.columns.filter(c => "regexp".r.pattern.matcher(c).matches): _*)
```
or
```
df.drop(df.columns.filter(_.endsWith("_undo")): _*)
``` |
202,799 | Is there a way to typeset a right double quote directly above a period (if the quotation ends with a period)? Not to the left (for example, ."), not to the right (for example, ".), but directly above. The photo below is an example from *Trees, maps and, theorems* by Jean-luc Doumont.
![Right double quote directly abov... | 2014/09/23 | [
"https://tex.stackexchange.com/questions/202799",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/4430/"
] | One way is to add some negative "kerning" between the quotation mark and the period:
```
\documentclass{article}
\begin{document}
Here is an unkerned quotation mark: ``\dots''.
Here is a kerned quotation mark: ``\dots''\kern-0.5em.
\end{document}
```

The T... | I would set this merely as an `\rlap`-ed period (or, for LaTeX's sense, `\makebox[0pt][l]`), wrapped in a macro:

```
\documentclass{article}
\newcommand{\qperiod}{\rlap{.}}
\begin{document}
Some text: ``\dots''.
Some text: ``\dots''
Some text: ``\... |
202,799 | Is there a way to typeset a right double quote directly above a period (if the quotation ends with a period)? Not to the left (for example, ."), not to the right (for example, ".), but directly above. The photo below is an example from *Trees, maps and, theorems* by Jean-luc Doumont.
![Right double quote directly abov... | 2014/09/23 | [
"https://tex.stackexchange.com/questions/202799",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/4430/"
] | One way is to add some negative "kerning" between the quotation mark and the period:
```
\documentclass{article}
\begin{document}
Here is an unkerned quotation mark: ``\dots''.
Here is a kerned quotation mark: ``\dots''\kern-0.5em.
\end{document}
```

The T... | Here I use a stack. The `stacktype` is either "L" for Long or "S" for Short (default). If "L", the stacking "distance" is from baseline to baseline. By setting to `0pt`, it says that the two components share the same baseline (in contrast, a short stack distance is the vertical gap between the top of the "anchor" and t... |
202,799 | Is there a way to typeset a right double quote directly above a period (if the quotation ends with a period)? Not to the left (for example, ."), not to the right (for example, ".), but directly above. The photo below is an example from *Trees, maps and, theorems* by Jean-luc Doumont.
![Right double quote directly abov... | 2014/09/23 | [
"https://tex.stackexchange.com/questions/202799",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/4430/"
] | I would set this merely as an `\rlap`-ed period (or, for LaTeX's sense, `\makebox[0pt][l]`), wrapped in a macro:

```
\documentclass{article}
\newcommand{\qperiod}{\rlap{.}}
\begin{document}
Some text: ``\dots''.
Some text: ``\dots''
Some text: ``\... | Here I use a stack. The `stacktype` is either "L" for Long or "S" for Short (default). If "L", the stacking "distance" is from baseline to baseline. By setting to `0pt`, it says that the two components share the same baseline (in contrast, a short stack distance is the vertical gap between the top of the "anchor" and t... |
43,933,747 | Let's consider following illustrative example code:
```
using matrix_t = double[2][2];
constexpr matrix_t zero_matrix = {
{0.0, 0.0},
{0.0, 0.0}
};
constexpr matrix_t identity_matrix = {
{1.0, 0.0},
{0.0, 1.0}
};
struct wrapped_matrix_t
{
matrix_t matrix;
};
constexpr wrapped_matrix_t zero_wrap... | 2017/05/12 | [
"https://Stackoverflow.com/questions/43933747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/422489/"
] | If you cannot use `std::array` and don't have access to the implementation of `wrapped_matrix_t`, you can use *metaprogramming* to generate the indexing of the source array when initializing your wrappers. The final code will look like this:
```
constexpr wrapped_matrix_t zero_wrapped_matrix = from_array(zero_matrix);... | You could use `std::array` and change your representation to an 1D array.
```
using matrix_t = std::array<double, 2 * 2>;
constexpr matrix_t zero_matrix = {
{0.0, 0.0,
0.0, 0.0}
};
constexpr matrix_t identity_matrix = {
{1.0, 0.0,
0.0, 1.0}
};
struct wrapped_matrix_t
{
matrix_t matrix;
};
co... |
17,909,840 | I have following SelectList declaration in `CourseRegisterModel`:
```
public class CourseRegisterModel
{
public StudentModel Student { get; set; }
public CourseModel Course { get; set; }
public IEnumerable<SelectListItem> CoursesList { get; set; }
public DateTime RegisterDate { get; set; }
}
```
In `... | 2013/07/28 | [
"https://Stackoverflow.com/questions/17909840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/946225/"
] | For starters, your `RegisterCourses.cshtml` needs to use:
```
@model <namespace>.CourseRegisterModel
```
Then, your controller code would be:
```
public ViewResult Index()
{
ServiceCourseClient client = new ServiceCourseClient();
Course[] courses;
courses = client.GetAllCourses();
... | Use the Html.DropDownList method: <http://msdn.microsoft.com/en-us/library/dd492738(v=vs.108).aspx>
Pass in the desired name of the drop down list as first argument, as second argument pass in your CourseList:
@Html.DropDownList("CoursesList", Model.CoursesList) |
5,024 | Some people usually use a spoon when eating spaghetti, and some do not.
The proportion seems to be dependent on the country/region.
Has any data been published on the topic?
Preferably raw poll result files, but aggregated data as CSV is OK too.
Bonus if the data is also sorted by age group and by formal/inform... | 2015/04/17 | [
"https://opendata.stackexchange.com/questions/5024",
"https://opendata.stackexchange.com",
"https://opendata.stackexchange.com/users/754/"
] | No dataset was available, so I got 300+ people to answer a questionnaire about the topic.
General view of the data (green=spoon, red=no spoon):

* Detailed analysis: <http://aegif-labo.blogspot.jp/2015/04/eating-spaghetti-spoon-or-not.html>
* [Raw... | I find this question kind of silly, but it's a good "placeholder" for anecdotal questions that are popular with data-blogs and data-driven journalism.
See, for example, the "[Dear Mona](http://fivethirtyeight.com/tag/dear-mona/)" column at [fivethirtyeight.com](http://fivethirtyeight.com/).
To randomly select two:
*... |
30,843 | I need to encrypt social security column in a list. What are my options?
ps: Did not find Encryption in the Tags.
Actually, looking for something like this (Column Level Security, but non commercial solution)
<http://store.bamboosolutions.com/sharepoint-column-level-security.aspx>
This may be new topic or a topic n... | 2012/03/05 | [
"https://sharepoint.stackexchange.com/questions/30843",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/7222/"
] | You can use Transparent Data Encryption for the entire SharePoint Content database. | You can create custom secure field. see this codeplex solution: <http://cryptocollaboration.codeplex.com/>
FYI: I have seen issues with custom fields (almost all the time) either with jquery or 3rd party or nintex. So that's something you will have calculate when implementing custom fields.
Good Luck |
30,843 | I need to encrypt social security column in a list. What are my options?
ps: Did not find Encryption in the Tags.
Actually, looking for something like this (Column Level Security, but non commercial solution)
<http://store.bamboosolutions.com/sharepoint-column-level-security.aspx>
This may be new topic or a topic n... | 2012/03/05 | [
"https://sharepoint.stackexchange.com/questions/30843",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/7222/"
] | I don't if this is acceptable by your business user or policy. This help hide or set permission who can see a given field.
<http://splistdisplaysetting.codeplex.com/> | You can create custom secure field. see this codeplex solution: <http://cryptocollaboration.codeplex.com/>
FYI: I have seen issues with custom fields (almost all the time) either with jquery or 3rd party or nintex. So that's something you will have calculate when implementing custom fields.
Good Luck |
6,726,024 | New to TDD here, d'oh!
Here's what I want to test ([ruby library](https://www.twilio.com/docs/ruby/install)), in brief:
```
account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)
resp = account.request(
"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages",
'POST',
smsInfo
)
... | 2011/07/17 | [
"https://Stackoverflow.com/questions/6726024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478354/"
] | Use database relations. Your three tables are `concept`, `idea`, and `comment`. Each concept has many ideas, and each idea has many comments (though I find it more intuitive so say "each idea is related to one concept, each comment is related to one idea").
Your tables will look something like:
```
concept: id timest... | Just 3 tables, `concepts`, `ideas`, and `comments`, with a field referencing the related 'parent'. Using the proper *indexes* will mean they will be as fast, or actually due to in-memory-caching of tables, open file descriptors, cross-concepts-queries etc., *faster* then any multi-table setup. Rule of thumb: if there i... |
6,726,024 | New to TDD here, d'oh!
Here's what I want to test ([ruby library](https://www.twilio.com/docs/ruby/install)), in brief:
```
account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)
resp = account.request(
"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages",
'POST',
smsInfo
)
... | 2011/07/17 | [
"https://Stackoverflow.com/questions/6726024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478354/"
] | >
> each concept would also have a table
>
>
>
tables are not meant to be dynamic elements. of course they can be, but seriously.
a relational database structure has a static amount of tables.
please read about the [fundamentals of relational database design](http://www.deeptraining.com/litwin/dbdesign/Fundament... | Generally, the way to implement topics/responses/subcomment type of structure is to have three tables with foreign keys:
1. Concepts table:
* Primary key
* Name
* timestamp
* user\_id
* ... whatever
3. ideas table:
* Primary key
* Key which references Concept table primary key
* Name
* timestamp
* user\_id
* ... what... |
6,726,024 | New to TDD here, d'oh!
Here's what I want to test ([ruby library](https://www.twilio.com/docs/ruby/install)), in brief:
```
account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)
resp = account.request(
"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages",
'POST',
smsInfo
)
... | 2011/07/17 | [
"https://Stackoverflow.com/questions/6726024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478354/"
] | Generally, the way to implement topics/responses/subcomment type of structure is to have three tables with foreign keys:
1. Concepts table:
* Primary key
* Name
* timestamp
* user\_id
* ... whatever
3. ideas table:
* Primary key
* Key which references Concept table primary key
* Name
* timestamp
* user\_id
* ... what... | Just 3 tables, `concepts`, `ideas`, and `comments`, with a field referencing the related 'parent'. Using the proper *indexes* will mean they will be as fast, or actually due to in-memory-caching of tables, open file descriptors, cross-concepts-queries etc., *faster* then any multi-table setup. Rule of thumb: if there i... |
6,726,024 | New to TDD here, d'oh!
Here's what I want to test ([ruby library](https://www.twilio.com/docs/ruby/install)), in brief:
```
account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)
resp = account.request(
"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages",
'POST',
smsInfo
)
... | 2011/07/17 | [
"https://Stackoverflow.com/questions/6726024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478354/"
] | >
> each concept would also have a table
>
>
>
tables are not meant to be dynamic elements. of course they can be, but seriously.
a relational database structure has a static amount of tables.
please read about the [fundamentals of relational database design](http://www.deeptraining.com/litwin/dbdesign/Fundament... | Just 3 tables, `concepts`, `ideas`, and `comments`, with a field referencing the related 'parent'. Using the proper *indexes* will mean they will be as fast, or actually due to in-memory-caching of tables, open file descriptors, cross-concepts-queries etc., *faster* then any multi-table setup. Rule of thumb: if there i... |
6,726,024 | New to TDD here, d'oh!
Here's what I want to test ([ruby library](https://www.twilio.com/docs/ruby/install)), in brief:
```
account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)
resp = account.request(
"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages",
'POST',
smsInfo
)
... | 2011/07/17 | [
"https://Stackoverflow.com/questions/6726024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478354/"
] | I would use three different tables with foreign keys to link them. But you may also nest comments (or whatever) by having a 'parent'-row on the comment-table, which is a foreign-key to this tables primary key.
```
CREATE TABLE IF NOT EXISTS `comment` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_comment` int(11)... | You're looking for "foreign key references." You will likely find yourself with three tables: questions, answers, and comments on answers. Answers will have a field referencing the id of the question it's responding to, and likewise you will have a field in the comments table referencing the id of the answer it's respo... |
6,726,024 | New to TDD here, d'oh!
Here's what I want to test ([ruby library](https://www.twilio.com/docs/ruby/install)), in brief:
```
account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)
resp = account.request(
"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages",
'POST',
smsInfo
)
... | 2011/07/17 | [
"https://Stackoverflow.com/questions/6726024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478354/"
] | >
> each concept would also have a table
>
>
>
tables are not meant to be dynamic elements. of course they can be, but seriously.
a relational database structure has a static amount of tables.
please read about the [fundamentals of relational database design](http://www.deeptraining.com/litwin/dbdesign/Fundament... | You're looking for "foreign key references." You will likely find yourself with three tables: questions, answers, and comments on answers. Answers will have a field referencing the id of the question it's responding to, and likewise you will have a field in the comments table referencing the id of the answer it's respo... |
6,726,024 | New to TDD here, d'oh!
Here's what I want to test ([ruby library](https://www.twilio.com/docs/ruby/install)), in brief:
```
account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)
resp = account.request(
"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages",
'POST',
smsInfo
)
... | 2011/07/17 | [
"https://Stackoverflow.com/questions/6726024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478354/"
] | >
> each concept would also have a table
>
>
>
tables are not meant to be dynamic elements. of course they can be, but seriously.
a relational database structure has a static amount of tables.
please read about the [fundamentals of relational database design](http://www.deeptraining.com/litwin/dbdesign/Fundament... | Use database relations. Your three tables are `concept`, `idea`, and `comment`. Each concept has many ideas, and each idea has many comments (though I find it more intuitive so say "each idea is related to one concept, each comment is related to one idea").
Your tables will look something like:
```
concept: id timest... |
6,726,024 | New to TDD here, d'oh!
Here's what I want to test ([ruby library](https://www.twilio.com/docs/ruby/install)), in brief:
```
account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)
resp = account.request(
"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages",
'POST',
smsInfo
)
... | 2011/07/17 | [
"https://Stackoverflow.com/questions/6726024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478354/"
] | Generally, the way to implement topics/responses/subcomment type of structure is to have three tables with foreign keys:
1. Concepts table:
* Primary key
* Name
* timestamp
* user\_id
* ... whatever
3. ideas table:
* Primary key
* Key which references Concept table primary key
* Name
* timestamp
* user\_id
* ... what... | You're looking for "foreign key references." You will likely find yourself with three tables: questions, answers, and comments on answers. Answers will have a field referencing the id of the question it's responding to, and likewise you will have a field in the comments table referencing the id of the answer it's respo... |
6,726,024 | New to TDD here, d'oh!
Here's what I want to test ([ruby library](https://www.twilio.com/docs/ruby/install)), in brief:
```
account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)
resp = account.request(
"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages",
'POST',
smsInfo
)
... | 2011/07/17 | [
"https://Stackoverflow.com/questions/6726024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478354/"
] | Use database relations. Your three tables are `concept`, `idea`, and `comment`. Each concept has many ideas, and each idea has many comments (though I find it more intuitive so say "each idea is related to one concept, each comment is related to one idea").
Your tables will look something like:
```
concept: id timest... | You're looking for "foreign key references." You will likely find yourself with three tables: questions, answers, and comments on answers. Answers will have a field referencing the id of the question it's responding to, and likewise you will have a field in the comments table referencing the id of the answer it's respo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.