qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
1,893,955 | >
> What is the angle between the hour and minute hands of a clock at 6:05?
>
>
>
I have tried this
Hour Hand:
12 hour = 360°
1 hr = 30°
Total Hour above the Clock is $\frac{73}2$ hours
In Minute Hand:
1 Hour = 360°
1 minutes = 6°
Total Minutes covered by $6\times 5= 30$
$\frac{73}{2} \cdot30-30=345... | 2016/08/16 | [
"https://math.stackexchange.com/questions/1893955",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/359877/"
] | Think of it this way: five minutes after six, the minute hand is $\frac1{12}$ of the circle ahead from 12, while the hour hand has advanced $\frac1{12}$ of the way towards 7 from 6, or $\frac1{144}$ of the circle ahead. The initial angle between the two hands is $\frac12$ of the circle, so the solution is
$$\frac12-\fr... | Your approach is correct, but the hour is $6+\frac{5}{60}=\frac{73}{12}$, not $\frac{73}{2}$.
This yields an angle of $\frac{73}{12}\cdot30^\circ$ for the hour hand, and $6^\circ\cdot 5=30^\circ$ for the minute hand.
Thus the end result is $\frac{73}{12}\cdot30^\circ-30^\circ=152.5^\circ$ |
1,893,955 | >
> What is the angle between the hour and minute hands of a clock at 6:05?
>
>
>
I have tried this
Hour Hand:
12 hour = 360°
1 hr = 30°
Total Hour above the Clock is $\frac{73}2$ hours
In Minute Hand:
1 Hour = 360°
1 minutes = 6°
Total Minutes covered by $6\times 5= 30$
$\frac{73}{2} \cdot30-30=345... | 2016/08/16 | [
"https://math.stackexchange.com/questions/1893955",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/359877/"
] | The hours hand revolves $360°/(12\cdot60)=0.5°$ per minute and the minutes hand $360°/60=6°$ per minute, so that the angle increases by $5.5°$ per minute.
Hence working modulo $360°$, $$(6\cdot60+5)\cdot5.5°=2007.5°\equiv-152.5°=-152°30'.$$
The negative sign is because the hours hand is ahead. | Let $\alpha$ be the angle in degrees of the hour hand, measured with reference to $12$ and $\beta$ be the angle in degrees of the minute hand measured with reference to $12$.
At 6:05, the minute hand has moved $\frac{1}{12}$ of the way around the clock. Thus, $\beta=\frac{360^{\circ}}{12}=30^{\circ}$.
The hour hand ... |
1,893,955 | >
> What is the angle between the hour and minute hands of a clock at 6:05?
>
>
>
I have tried this
Hour Hand:
12 hour = 360°
1 hr = 30°
Total Hour above the Clock is $\frac{73}2$ hours
In Minute Hand:
1 Hour = 360°
1 minutes = 6°
Total Minutes covered by $6\times 5= 30$
$\frac{73}{2} \cdot30-30=345... | 2016/08/16 | [
"https://math.stackexchange.com/questions/1893955",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/359877/"
] | Think of it this way: five minutes after six, the minute hand is $\frac1{12}$ of the circle ahead from 12, while the hour hand has advanced $\frac1{12}$ of the way towards 7 from 6, or $\frac1{144}$ of the circle ahead. The initial angle between the two hands is $\frac12$ of the circle, so the solution is
$$\frac12-\fr... | >
> Here is how much the hour hand travels per hour, minute, second:
>
>
> * Per Hour:
> $$\text{H}=\frac{360^{\circ}}{12\space\text{hours}}=30^{\circ}\text{/}\space\text{hour}$$
> * Per Minute:
> $$\text{M}=\frac{\text{H}^{\circ}}{60\space\text{minutes}}=\left(\frac{1}{2}\right)^{\circ}\text{/}\space\text{minute}$$... |
37,425,502 | I've created a form using PHP in which the user has to click on a radio button before clicking on the button to submit the form. It looks as follows:
```
<form name="films" action="showing.php" method="post">
<table id="filmtable">
<tr><th>Title</th><th>Length</th><th>Description</th><th>Poster</th><th>Required</th></... | 2016/05/24 | [
"https://Stackoverflow.com/questions/37425502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4747805/"
] | This PHP fetch loop attributes multiple times the same id="wanted" to many radio buttons.
An Id should be unique.... So it's a bad practice.
Remove the id and add a class instead:
```
echo "<td><input type=\"radio\" class=\"wanted[]\" name=\"wanted[]\" value='$title'></td></tr>";
```
Then, the use of jQuery sa... | `getElementById` returns the first element matching the selector. If you just want to verify that *any of them* were checked, you could do something like:
```
var anyChecked = document.querySelectorAll('[name=wanted]:checked').length > 0;
``` |
19,854,969 | **Care: No code here, only text and some questions about bitmap caching**
I'm currently developing an App which is almost finished. The only thing left, that I would like to do is caching images. Because, at the moment, when the user opens the app the app downloads images from a server. Those images are not static, th... | 2013/11/08 | [
"https://Stackoverflow.com/questions/19854969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2823419/"
] | Check this library:
<http://code.google.com/p/android-query/wiki/ImageLoading>
It does caching automagically
example
```
//fetch a remote resource in raw bitmap
String url = "http://www.vikispot.com/z/images/vikispot/android-w.png";
aq.ajax(url, Bitmap.class, new AjaxCallback<Bitmap>() {
@Override
... | You can try <https://github.com/thest1/LazyList>
the project code was designed for listviews, but still, its purpose is to download images from URLs in the backgroud so the user doesn't have to hold on the whole downloading time.
you take these JAVA classes : `FileCache`, `ImageLoader`, `MemoryCache`, import them int... |
19,854,969 | **Care: No code here, only text and some questions about bitmap caching**
I'm currently developing an App which is almost finished. The only thing left, that I would like to do is caching images. Because, at the moment, when the user opens the app the app downloads images from a server. Those images are not static, th... | 2013/11/08 | [
"https://Stackoverflow.com/questions/19854969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2823419/"
] | my best advice on those cases is: Do not try to re-invent the wheel.
Image loading/caching is a very complex task in Android and a lot of good developers already did that. Just re-use their work.
My personal preference is Picasso <http://square.github.io/picasso/>
to load stuff with it is one very simple line of cod... | Check this library:
<http://code.google.com/p/android-query/wiki/ImageLoading>
It does caching automagically
example
```
//fetch a remote resource in raw bitmap
String url = "http://www.vikispot.com/z/images/vikispot/android-w.png";
aq.ajax(url, Bitmap.class, new AjaxCallback<Bitmap>() {
@Override
... |
19,854,969 | **Care: No code here, only text and some questions about bitmap caching**
I'm currently developing an App which is almost finished. The only thing left, that I would like to do is caching images. Because, at the moment, when the user opens the app the app downloads images from a server. Those images are not static, th... | 2013/11/08 | [
"https://Stackoverflow.com/questions/19854969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2823419/"
] | my best advice on those cases is: Do not try to re-invent the wheel.
Image loading/caching is a very complex task in Android and a lot of good developers already did that. Just re-use their work.
My personal preference is Picasso <http://square.github.io/picasso/>
to load stuff with it is one very simple line of cod... | You can try <https://github.com/thest1/LazyList>
the project code was designed for listviews, but still, its purpose is to download images from URLs in the backgroud so the user doesn't have to hold on the whole downloading time.
you take these JAVA classes : `FileCache`, `ImageLoader`, `MemoryCache`, import them int... |
6,278,133 | I'd like to split a dataframe into several component dataframes based on the values in one column.
In my example, I want to split dat into dat.1, dat.2 and dat.3 using the values in column "cond".
Is there a simple command which could achieve this?
```
dat
sub cond trial time01 time02
1 1 1 2774 8845
1 ... | 2011/06/08 | [
"https://Stackoverflow.com/questions/6278133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/789087/"
] | Is there anything not satisfying about
```
split(dat, dat$cond)
```
?
You do have R and split as tags, you know... | Just for the sake of completeness, here's a way to do it with the `plyr` package.
```
require(plyr)
> dlply( dat, .(cond))
$`1`
sub cond trial time01 time02
1 1 1 1 2774 8845
2 1 1 2 2697 9945
9 3 1 1 4219 7891
$`2`
sub cond trial time01 time02
3 1 2 1 2219 92... |
6,278,133 | I'd like to split a dataframe into several component dataframes based on the values in one column.
In my example, I want to split dat into dat.1, dat.2 and dat.3 using the values in column "cond".
Is there a simple command which could achieve this?
```
dat
sub cond trial time01 time02
1 1 1 2774 8845
1 ... | 2011/06/08 | [
"https://Stackoverflow.com/questions/6278133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/789087/"
] | Is there anything not satisfying about
```
split(dat, dat$cond)
```
?
You do have R and split as tags, you know... | ;)
```
ucond <- unique(dat$cond)
dat_by_cond <- lapply(lapply(ucond, "==", dat$cond), subset, x=dat)
names(dat_by_cond) <- paste("dat",ucond,sep=".")
``` |
6,278,133 | I'd like to split a dataframe into several component dataframes based on the values in one column.
In my example, I want to split dat into dat.1, dat.2 and dat.3 using the values in column "cond".
Is there a simple command which could achieve this?
```
dat
sub cond trial time01 time02
1 1 1 2774 8845
1 ... | 2011/06/08 | [
"https://Stackoverflow.com/questions/6278133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/789087/"
] | Yes, `split()`. For example, if your data are in `dat`, then:
```
with(dat, split(dat, cond))
```
returns a list, whose components are the data frames you wanted:
```
R> with(dat, split(dat, cond))
$`1`
sub cond trial time01 time02
1 1 1 1 2774 8845
2 1 1 2 2697 9945
9 3 1 1 4... | Just for the sake of completeness, here's a way to do it with the `plyr` package.
```
require(plyr)
> dlply( dat, .(cond))
$`1`
sub cond trial time01 time02
1 1 1 1 2774 8845
2 1 1 2 2697 9945
9 3 1 1 4219 7891
$`2`
sub cond trial time01 time02
3 1 2 1 2219 92... |
6,278,133 | I'd like to split a dataframe into several component dataframes based on the values in one column.
In my example, I want to split dat into dat.1, dat.2 and dat.3 using the values in column "cond".
Is there a simple command which could achieve this?
```
dat
sub cond trial time01 time02
1 1 1 2774 8845
1 ... | 2011/06/08 | [
"https://Stackoverflow.com/questions/6278133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/789087/"
] | Yes, `split()`. For example, if your data are in `dat`, then:
```
with(dat, split(dat, cond))
```
returns a list, whose components are the data frames you wanted:
```
R> with(dat, split(dat, cond))
$`1`
sub cond trial time01 time02
1 1 1 1 2774 8845
2 1 1 2 2697 9945
9 3 1 1 4... | ;)
```
ucond <- unique(dat$cond)
dat_by_cond <- lapply(lapply(ucond, "==", dat$cond), subset, x=dat)
names(dat_by_cond) <- paste("dat",ucond,sep=".")
``` |
6,278,133 | I'd like to split a dataframe into several component dataframes based on the values in one column.
In my example, I want to split dat into dat.1, dat.2 and dat.3 using the values in column "cond".
Is there a simple command which could achieve this?
```
dat
sub cond trial time01 time02
1 1 1 2774 8845
1 ... | 2011/06/08 | [
"https://Stackoverflow.com/questions/6278133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/789087/"
] | I think the easiest way is via `split`:
```
split(dat, dat$cond)
```
Note however, that split returns a list of the data.frames.
To obtain single data.frames from the list you could procede as follows using a loop to make the single objects (implicit in the `lapply` statement):
```
tmp <- split(dat, dat$cond)
lap... | Just for the sake of completeness, here's a way to do it with the `plyr` package.
```
require(plyr)
> dlply( dat, .(cond))
$`1`
sub cond trial time01 time02
1 1 1 1 2774 8845
2 1 1 2 2697 9945
9 3 1 1 4219 7891
$`2`
sub cond trial time01 time02
3 1 2 1 2219 92... |
6,278,133 | I'd like to split a dataframe into several component dataframes based on the values in one column.
In my example, I want to split dat into dat.1, dat.2 and dat.3 using the values in column "cond".
Is there a simple command which could achieve this?
```
dat
sub cond trial time01 time02
1 1 1 2774 8845
1 ... | 2011/06/08 | [
"https://Stackoverflow.com/questions/6278133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/789087/"
] | I think the easiest way is via `split`:
```
split(dat, dat$cond)
```
Note however, that split returns a list of the data.frames.
To obtain single data.frames from the list you could procede as follows using a loop to make the single objects (implicit in the `lapply` statement):
```
tmp <- split(dat, dat$cond)
lap... | ;)
```
ucond <- unique(dat$cond)
dat_by_cond <- lapply(lapply(ucond, "==", dat$cond), subset, x=dat)
names(dat_by_cond) <- paste("dat",ucond,sep=".")
``` |
6,278,133 | I'd like to split a dataframe into several component dataframes based on the values in one column.
In my example, I want to split dat into dat.1, dat.2 and dat.3 using the values in column "cond".
Is there a simple command which could achieve this?
```
dat
sub cond trial time01 time02
1 1 1 2774 8845
1 ... | 2011/06/08 | [
"https://Stackoverflow.com/questions/6278133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/789087/"
] | Just for the sake of completeness, here's a way to do it with the `plyr` package.
```
require(plyr)
> dlply( dat, .(cond))
$`1`
sub cond trial time01 time02
1 1 1 1 2774 8845
2 1 1 2 2697 9945
9 3 1 1 4219 7891
$`2`
sub cond trial time01 time02
3 1 2 1 2219 92... | ;)
```
ucond <- unique(dat$cond)
dat_by_cond <- lapply(lapply(ucond, "==", dat$cond), subset, x=dat)
names(dat_by_cond) <- paste("dat",ucond,sep=".")
``` |
32,330,639 | I'm trying to create a custom viewpager inside custom scroll viewthat dynamically wraps the current child's height.
```
package com.example.vihaan.dynamicviewpager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.wi... | 2015/09/01 | [
"https://Stackoverflow.com/questions/32330639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1203565/"
] | Made a few tweaks in your code and it is working fine now.
1] `onMeasure` function wasn't proper. Use below logic
```
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mCurrentView == null) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
return;
}
i... | ```
public class WrapContentViewPager extends ViewPager {
private Boolean mAnimStarted = false;
public WrapContentViewPager(Context context) {
super(context);
}
public WrapContentViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
pro... |
32,330,639 | I'm trying to create a custom viewpager inside custom scroll viewthat dynamically wraps the current child's height.
```
package com.example.vihaan.dynamicviewpager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.wi... | 2015/09/01 | [
"https://Stackoverflow.com/questions/32330639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1203565/"
] | Made a few tweaks in your code and it is working fine now.
1] `onMeasure` function wasn't proper. Use below logic
```
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mCurrentView == null) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
return;
}
i... | Just in case someone else find this post like me. Worked version without bug of initially zero height:
```
public class DynamicHeightViewPager extends ViewPager {
private View mCurrentView;
public DynamicHeightViewPager(Context context) {
super(context);
}
public DynamicHeightViewPager(Contex... |
32,330,639 | I'm trying to create a custom viewpager inside custom scroll viewthat dynamically wraps the current child's height.
```
package com.example.vihaan.dynamicviewpager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.wi... | 2015/09/01 | [
"https://Stackoverflow.com/questions/32330639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1203565/"
] | Adding to @vihaan's solution, if you have a PagerTitleStrip or PagetTabStrip, you can add this
```
// Account for pagerTitleStrip or pagerTabStrip
View tabStrip = getChildAt(0);
if (tabStrip instanceof PagerTitleStrip) {
tabStrip.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec... | This few lines of code will solve the problem.
Create a custome widget for viewpager class. and in xml use it for viewpager.
```
public class DynamicHeightViewPager extends ViewPager {
private View mCurrentView;
public DynamicHeightViewPager(Context context) {
super(context);
}
public DynamicHeightViewPager(Con... |
32,330,639 | I'm trying to create a custom viewpager inside custom scroll viewthat dynamically wraps the current child's height.
```
package com.example.vihaan.dynamicviewpager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.wi... | 2015/09/01 | [
"https://Stackoverflow.com/questions/32330639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1203565/"
] | @abhishek's ans does what is required but the code below also adds animation during height change
```
public class WrappingViewPager extends ViewPager {
private Boolean mAnimStarted = false;
public WrappingViewPager(Context context) {
super(context);
}
public WrappingViewPager(Context contex... | Just in case someone else find this post like me. Worked version without bug of initially zero height:
```
public class DynamicHeightViewPager extends ViewPager {
private View mCurrentView;
public DynamicHeightViewPager(Context context) {
super(context);
}
public DynamicHeightViewPager(Contex... |
32,330,639 | I'm trying to create a custom viewpager inside custom scroll viewthat dynamically wraps the current child's height.
```
package com.example.vihaan.dynamicviewpager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.wi... | 2015/09/01 | [
"https://Stackoverflow.com/questions/32330639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1203565/"
] | Just in case someone else find this post like me. Worked version without bug of initially zero height:
```
public class DynamicHeightViewPager extends ViewPager {
private View mCurrentView;
public DynamicHeightViewPager(Context context) {
super(context);
}
public DynamicHeightViewPager(Contex... | Adding to @vihaan's solution, if you have a PagerTitleStrip or PagetTabStrip, you can add this
```
// Account for pagerTitleStrip or pagerTabStrip
View tabStrip = getChildAt(0);
if (tabStrip instanceof PagerTitleStrip) {
tabStrip.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec... |
32,330,639 | I'm trying to create a custom viewpager inside custom scroll viewthat dynamically wraps the current child's height.
```
package com.example.vihaan.dynamicviewpager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.wi... | 2015/09/01 | [
"https://Stackoverflow.com/questions/32330639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1203565/"
] | Made a few tweaks in your code and it is working fine now.
1] `onMeasure` function wasn't proper. Use below logic
```
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mCurrentView == null) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
return;
}
i... | This few lines of code will solve the problem.
Create a custome widget for viewpager class. and in xml use it for viewpager.
```
public class DynamicHeightViewPager extends ViewPager {
private View mCurrentView;
public DynamicHeightViewPager(Context context) {
super(context);
}
public DynamicHeightViewPager(Con... |
32,330,639 | I'm trying to create a custom viewpager inside custom scroll viewthat dynamically wraps the current child's height.
```
package com.example.vihaan.dynamicviewpager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.wi... | 2015/09/01 | [
"https://Stackoverflow.com/questions/32330639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1203565/"
] | @abhishek's ans does what is required but the code below also adds animation during height change
```
public class WrappingViewPager extends ViewPager {
private Boolean mAnimStarted = false;
public WrappingViewPager(Context context) {
super(context);
}
public WrappingViewPager(Context contex... | ```
public class WrapContentViewPager extends ViewPager {
private Boolean mAnimStarted = false;
public WrapContentViewPager(Context context) {
super(context);
}
public WrapContentViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
pro... |
32,330,639 | I'm trying to create a custom viewpager inside custom scroll viewthat dynamically wraps the current child's height.
```
package com.example.vihaan.dynamicviewpager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.wi... | 2015/09/01 | [
"https://Stackoverflow.com/questions/32330639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1203565/"
] | Adding to @vihaan's solution, if you have a PagerTitleStrip or PagetTabStrip, you can add this
```
// Account for pagerTitleStrip or pagerTabStrip
View tabStrip = getChildAt(0);
if (tabStrip instanceof PagerTitleStrip) {
tabStrip.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec... | ```
public class WrapContentViewPager extends ViewPager {
private Boolean mAnimStarted = false;
public WrapContentViewPager(Context context) {
super(context);
}
public WrapContentViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
pro... |
32,330,639 | I'm trying to create a custom viewpager inside custom scroll viewthat dynamically wraps the current child's height.
```
package com.example.vihaan.dynamicviewpager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.wi... | 2015/09/01 | [
"https://Stackoverflow.com/questions/32330639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1203565/"
] | Just in case someone else find this post like me. Worked version without bug of initially zero height:
```
public class DynamicHeightViewPager extends ViewPager {
private View mCurrentView;
public DynamicHeightViewPager(Context context) {
super(context);
}
public DynamicHeightViewPager(Contex... | ```
public class WrapContentViewPager extends ViewPager {
private Boolean mAnimStarted = false;
public WrapContentViewPager(Context context) {
super(context);
}
public WrapContentViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
pro... |
32,330,639 | I'm trying to create a custom viewpager inside custom scroll viewthat dynamically wraps the current child's height.
```
package com.example.vihaan.dynamicviewpager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.wi... | 2015/09/01 | [
"https://Stackoverflow.com/questions/32330639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1203565/"
] | Just in case someone else find this post like me. Worked version without bug of initially zero height:
```
public class DynamicHeightViewPager extends ViewPager {
private View mCurrentView;
public DynamicHeightViewPager(Context context) {
super(context);
}
public DynamicHeightViewPager(Contex... | This few lines of code will solve the problem.
Create a custome widget for viewpager class. and in xml use it for viewpager.
```
public class DynamicHeightViewPager extends ViewPager {
private View mCurrentView;
public DynamicHeightViewPager(Context context) {
super(context);
}
public DynamicHeightViewPager(Con... |
67,857,366 | I know this question has been asked so many times... but i think i'm doing everything correctly still it's not working, clearInterval doesn't stop the interval, the function is still being called every 1 second.
Here is my full code:
```
const [playerState, setPlayerState] = useState({ playing: true });
let [dura... | 2021/06/06 | [
"https://Stackoverflow.com/questions/67857366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11670173/"
] | The problem is that every time your component function gets called to render the component (which is after any series of state changes), a **new** `counter` local variable is created. The one in which you stored the timer handle no longer exists. You have to save the timer handle somewhere you'll be able to use it late... | When `handlePlay` is called, it calls `setPlayerState`. This triggers a rerender, which results in a new `counter` with the value `null`. The new `handlePause` has a closure around this value. You can try assigning your counter to state/ref. |
45,028,494 | So I have 1 default publish build definition and I would like to have another one which is in sync with it and does all the same steps but with an additional step at the end.
Can I have another build definition as one of the steps within another build definition?
This question is for Visual Studio Team Services lates... | 2017/07/11 | [
"https://Stackoverflow.com/questions/45028494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2984585/"
] | There are two ways to run another build in your current build.
### Option 1: add PowerShell task in your current build definition to [queue another build by REST API](https://www.visualstudio.com/en-us/docs/integrate/api/build/builds#queue-a-build)
Assume another build id is 5, so you can add PowerShell task with the... | It appears this is now enabled without an extension through the UI: <https://github.com/MicrosoftDocs/vsts-docs/issues/561> |
54,131,948 | I have two different matplotlib graphs that I would like to switch between upon a button press. The code I have will add the second graph below the first graph when the button is pressed but I want it to replace the first graph. This is a somewhat similar stackoverflow question ([How to update a matplotlib embedded int... | 2019/01/10 | [
"https://Stackoverflow.com/questions/54131948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7542354/"
] | New answer to include Tk embedding (significant changes from the other answer, so adding new answer instead of editing that one). I moved `graph_one()` and `graph_two()` into the switch graph wrapper class, and renamed them to `draw_graph_one()` and `draw_graph_two()`. Those two new class methods replaced the `embed_gr... | Going off of matplotlib's [documentation on buttons](https://matplotlib.org/gallery/widgets/buttons.html) and the [stackoverflow question you linked](https://stackoverflow.com/questions/53241759/how-to-switch-between-diagrams-with-a-button-in-matplotlib), here is the code that does the basics of what you mean. I'm sorr... |
197,070 | I'm working on a cryptosystem that uses colour pictures as keys for encryption. I'm trying to guess what is the key size of my cryptosystem in order to find the feasibility of a brute force attack. My cryptosystem uses RGB pictures of any size M x N.
The picture is also generated by a chaotic attractor which is sensit... | 2018/11/05 | [
"https://security.stackexchange.com/questions/197070",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/190594/"
] | A picture is far too large to use as an encryption key directly, you'll want to run it through a [KDF](https://en.wikipedia.org/wiki/Key_derivation_function) first.
It also depends entirely on the picture whether it will have enough entropy to be useful. You could have a 1000x1000 image that's solid white, but it woul... | Any cryptosystem should have keys with keysizes at the 128, 192, and 256 [bit-of-entropy](https://en.wikipedia.org/wiki/Entropy_(computing)) security levels.
So the question comes back to you: where are these images coming from and how much entropy do they contain? If they are completely random bit streams that are be... |
197,070 | I'm working on a cryptosystem that uses colour pictures as keys for encryption. I'm trying to guess what is the key size of my cryptosystem in order to find the feasibility of a brute force attack. My cryptosystem uses RGB pictures of any size M x N.
The picture is also generated by a chaotic attractor which is sensit... | 2018/11/05 | [
"https://security.stackexchange.com/questions/197070",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/190594/"
] | ***tl;dr*-** You're proposing a [key-stretching algorithm](https://en.wikipedia.org/wiki/Key_stretching) that turns 128 bits of input into a much larger key. This isn't as good as simply using a much larger key of the same size, though it's not *necessarily* as weak as the 128 bits of input. That said, your bitmap look... | So, if you can manage to get past the inital problems involved in too small of keysize and too much loss, and use KDF after, there's a benefit to using these keys for auth after all.
The generation of that stuff must take forever in relation to a traditional hash, so if the initial parameters are treated like a passwo... |
197,070 | I'm working on a cryptosystem that uses colour pictures as keys for encryption. I'm trying to guess what is the key size of my cryptosystem in order to find the feasibility of a brute force attack. My cryptosystem uses RGB pictures of any size M x N.
The picture is also generated by a chaotic attractor which is sensit... | 2018/11/05 | [
"https://security.stackexchange.com/questions/197070",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/190594/"
] | Your most recent edit indicates that your pictures are procedurally-generated, so your key size will therefore be bounded by the amount of state required to generate an image. Yours [seem to be parameterized](https://www.cs.cmu.edu/~kmcrane/Projects/QuaternionJulia/paper.pdf) by four floats for the initial conditions (... | A picture is far too large to use as an encryption key directly, you'll want to run it through a [KDF](https://en.wikipedia.org/wiki/Key_derivation_function) first.
It also depends entirely on the picture whether it will have enough entropy to be useful. You could have a 1000x1000 image that's solid white, but it woul... |
197,070 | I'm working on a cryptosystem that uses colour pictures as keys for encryption. I'm trying to guess what is the key size of my cryptosystem in order to find the feasibility of a brute force attack. My cryptosystem uses RGB pictures of any size M x N.
The picture is also generated by a chaotic attractor which is sensit... | 2018/11/05 | [
"https://security.stackexchange.com/questions/197070",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/190594/"
] | A picture is far too large to use as an encryption key directly, you'll want to run it through a [KDF](https://en.wikipedia.org/wiki/Key_derivation_function) first.
It also depends entirely on the picture whether it will have enough entropy to be useful. You could have a 1000x1000 image that's solid white, but it woul... | ***tl;dr*-** You're proposing a [key-stretching algorithm](https://en.wikipedia.org/wiki/Key_stretching) that turns 128 bits of input into a much larger key. This isn't as good as simply using a much larger key of the same size, though it's not *necessarily* as weak as the 128 bits of input. That said, your bitmap look... |
197,070 | I'm working on a cryptosystem that uses colour pictures as keys for encryption. I'm trying to guess what is the key size of my cryptosystem in order to find the feasibility of a brute force attack. My cryptosystem uses RGB pictures of any size M x N.
The picture is also generated by a chaotic attractor which is sensit... | 2018/11/05 | [
"https://security.stackexchange.com/questions/197070",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/190594/"
] | A picture is far too large to use as an encryption key directly, you'll want to run it through a [KDF](https://en.wikipedia.org/wiki/Key_derivation_function) first.
It also depends entirely on the picture whether it will have enough entropy to be useful. You could have a 1000x1000 image that's solid white, but it woul... | So, if you can manage to get past the inital problems involved in too small of keysize and too much loss, and use KDF after, there's a benefit to using these keys for auth after all.
The generation of that stuff must take forever in relation to a traditional hash, so if the initial parameters are treated like a passwo... |
197,070 | I'm working on a cryptosystem that uses colour pictures as keys for encryption. I'm trying to guess what is the key size of my cryptosystem in order to find the feasibility of a brute force attack. My cryptosystem uses RGB pictures of any size M x N.
The picture is also generated by a chaotic attractor which is sensit... | 2018/11/05 | [
"https://security.stackexchange.com/questions/197070",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/190594/"
] | Your most recent edit indicates that your pictures are procedurally-generated, so your key size will therefore be bounded by the amount of state required to generate an image. Yours [seem to be parameterized](https://www.cs.cmu.edu/~kmcrane/Projects/QuaternionJulia/paper.pdf) by four floats for the initial conditions (... | I can tell from the images that your key size is significantly less than the size of the images (because otherwise most of them would look like random coloured static).
Your key size is less than or equal to the base 2 logarithm of the total number of different images your chaotic attractor program can generate.\*
Th... |
197,070 | I'm working on a cryptosystem that uses colour pictures as keys for encryption. I'm trying to guess what is the key size of my cryptosystem in order to find the feasibility of a brute force attack. My cryptosystem uses RGB pictures of any size M x N.
The picture is also generated by a chaotic attractor which is sensit... | 2018/11/05 | [
"https://security.stackexchange.com/questions/197070",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/190594/"
] | Your most recent edit indicates that your pictures are procedurally-generated, so your key size will therefore be bounded by the amount of state required to generate an image. Yours [seem to be parameterized](https://www.cs.cmu.edu/~kmcrane/Projects/QuaternionJulia/paper.pdf) by four floats for the initial conditions (... | ***tl;dr*-** You're proposing a [key-stretching algorithm](https://en.wikipedia.org/wiki/Key_stretching) that turns 128 bits of input into a much larger key. This isn't as good as simply using a much larger key of the same size, though it's not *necessarily* as weak as the 128 bits of input. That said, your bitmap look... |
197,070 | I'm working on a cryptosystem that uses colour pictures as keys for encryption. I'm trying to guess what is the key size of my cryptosystem in order to find the feasibility of a brute force attack. My cryptosystem uses RGB pictures of any size M x N.
The picture is also generated by a chaotic attractor which is sensit... | 2018/11/05 | [
"https://security.stackexchange.com/questions/197070",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/190594/"
] | Any cryptosystem should have keys with keysizes at the 128, 192, and 256 [bit-of-entropy](https://en.wikipedia.org/wiki/Entropy_(computing)) security levels.
So the question comes back to you: where are these images coming from and how much entropy do they contain? If they are completely random bit streams that are be... | ***tl;dr*-** You're proposing a [key-stretching algorithm](https://en.wikipedia.org/wiki/Key_stretching) that turns 128 bits of input into a much larger key. This isn't as good as simply using a much larger key of the same size, though it's not *necessarily* as weak as the 128 bits of input. That said, your bitmap look... |
197,070 | I'm working on a cryptosystem that uses colour pictures as keys for encryption. I'm trying to guess what is the key size of my cryptosystem in order to find the feasibility of a brute force attack. My cryptosystem uses RGB pictures of any size M x N.
The picture is also generated by a chaotic attractor which is sensit... | 2018/11/05 | [
"https://security.stackexchange.com/questions/197070",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/190594/"
] | A picture is far too large to use as an encryption key directly, you'll want to run it through a [KDF](https://en.wikipedia.org/wiki/Key_derivation_function) first.
It also depends entirely on the picture whether it will have enough entropy to be useful. You could have a 1000x1000 image that's solid white, but it woul... | I can tell from the images that your key size is significantly less than the size of the images (because otherwise most of them would look like random coloured static).
Your key size is less than or equal to the base 2 logarithm of the total number of different images your chaotic attractor program can generate.\*
Th... |
197,070 | I'm working on a cryptosystem that uses colour pictures as keys for encryption. I'm trying to guess what is the key size of my cryptosystem in order to find the feasibility of a brute force attack. My cryptosystem uses RGB pictures of any size M x N.
The picture is also generated by a chaotic attractor which is sensit... | 2018/11/05 | [
"https://security.stackexchange.com/questions/197070",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/190594/"
] | Your most recent edit indicates that your pictures are procedurally-generated, so your key size will therefore be bounded by the amount of state required to generate an image. Yours [seem to be parameterized](https://www.cs.cmu.edu/~kmcrane/Projects/QuaternionJulia/paper.pdf) by four floats for the initial conditions (... | Any cryptosystem should have keys with keysizes at the 128, 192, and 256 [bit-of-entropy](https://en.wikipedia.org/wiki/Entropy_(computing)) security levels.
So the question comes back to you: where are these images coming from and how much entropy do they contain? If they are completely random bit streams that are be... |
221,824 | I need to get data from a function as below.
```
GetServiceListData():any
{
var resultData;
pnp.sp.web.lists.getByTitle('Test').items.select('Title,FullName,DOJ,ManagerName/Title').expand('ManagerName').get(asy).then(function(data) {
resultData= data;
});
}
```
This method is calling synchrono... | 2017/07/27 | [
"https://sharepoint.stackexchange.com/questions/221824",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/61247/"
] | I have tested it out and was able to do it using CSR and JS Link. Save the below code to say:projectCode.js and upload it to site assets and then refer it in the JS Link of the list view :
```
(function () {
var overrideCurrentContext = {};
overrideCurrentContext.Templates = {};
overrideCurrentContext.Templates.Fiel... | You can do it using CSR as well as using javascript. Here i'm giving simple and easy javascript solution.
**Working Javascript solution:**
```
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("table[summa... |
221,824 | I need to get data from a function as below.
```
GetServiceListData():any
{
var resultData;
pnp.sp.web.lists.getByTitle('Test').items.select('Title,FullName,DOJ,ManagerName/Title').expand('ManagerName').get(asy).then(function(data) {
resultData= data;
});
}
```
This method is calling synchrono... | 2017/07/27 | [
"https://sharepoint.stackexchange.com/questions/221824",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/61247/"
] | You can do it using CSR as well as using javascript. Here i'm giving simple and easy javascript solution.
**Working Javascript solution:**
```
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("table[summa... | Interesting. I had to use both the answers in 1 and 2 above for it to work with SP Online. Possibly because some js files I've used for altering formats must be posted in [master site]/\_catalogs/masterpage/Forms/AllItems.aspx and uploaded as a Javascript Display Template with a specified Target Type (view, form, etc.)... |
221,824 | I need to get data from a function as below.
```
GetServiceListData():any
{
var resultData;
pnp.sp.web.lists.getByTitle('Test').items.select('Title,FullName,DOJ,ManagerName/Title').expand('ManagerName').get(asy).then(function(data) {
resultData= data;
});
}
```
This method is calling synchrono... | 2017/07/27 | [
"https://sharepoint.stackexchange.com/questions/221824",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/61247/"
] | I have tested it out and was able to do it using CSR and JS Link. Save the below code to say:projectCode.js and upload it to site assets and then refer it in the JS Link of the list view :
```
(function () {
var overrideCurrentContext = {};
overrideCurrentContext.Templates = {};
overrideCurrentContext.Templates.Fiel... | You can try CSR concept. It will be applied to the List View Web Part, so you need to following script in all the places where you are using List View Web Part (if you are) otherwise, just follow the below steps.
1. Open the List `All Items` view or the desired view.
2. Now click on gear icon and select `Edit Page`.
3... |
221,824 | I need to get data from a function as below.
```
GetServiceListData():any
{
var resultData;
pnp.sp.web.lists.getByTitle('Test').items.select('Title,FullName,DOJ,ManagerName/Title').expand('ManagerName').get(asy).then(function(data) {
resultData= data;
});
}
```
This method is calling synchrono... | 2017/07/27 | [
"https://sharepoint.stackexchange.com/questions/221824",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/61247/"
] | I have tested it out and was able to do it using CSR and JS Link. Save the below code to say:projectCode.js and upload it to site assets and then refer it in the JS Link of the list view :
```
(function () {
var overrideCurrentContext = {};
overrideCurrentContext.Templates = {};
overrideCurrentContext.Templates.Fiel... | Interesting. I had to use both the answers in 1 and 2 above for it to work with SP Online. Possibly because some js files I've used for altering formats must be posted in [master site]/\_catalogs/masterpage/Forms/AllItems.aspx and uploaded as a Javascript Display Template with a specified Target Type (view, form, etc.)... |
221,824 | I need to get data from a function as below.
```
GetServiceListData():any
{
var resultData;
pnp.sp.web.lists.getByTitle('Test').items.select('Title,FullName,DOJ,ManagerName/Title').expand('ManagerName').get(asy).then(function(data) {
resultData= data;
});
}
```
This method is calling synchrono... | 2017/07/27 | [
"https://sharepoint.stackexchange.com/questions/221824",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/61247/"
] | You can try CSR concept. It will be applied to the List View Web Part, so you need to following script in all the places where you are using List View Web Part (if you are) otherwise, just follow the below steps.
1. Open the List `All Items` view or the desired view.
2. Now click on gear icon and select `Edit Page`.
3... | Interesting. I had to use both the answers in 1 and 2 above for it to work with SP Online. Possibly because some js files I've used for altering formats must be posted in [master site]/\_catalogs/masterpage/Forms/AllItems.aspx and uploaded as a Javascript Display Template with a specified Target Type (view, form, etc.)... |
1,467,228 | I've used a hover function where you do x on mouseover and y and mouseout. I'm trying the same for click but it doesn't seem to work:
```
$('.offer').click(function(){
$(this).find(':checkbox').attr('checked', true );
},function(){
$(this).find(':checkbox').attr('checked', false );
});
```
I want the checkbox... | 2009/09/23 | [
"https://Stackoverflow.com/questions/1467228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172637/"
] | This is easily done by flipping the current 'checked' state of the checkbox upon each click. Examples:
```
$(".offer").on("click", function () {
var $checkbox = $(this).find(':checkbox');
$checkbox.attr('checked', !$checkbox.attr('checked'));
});
```
or:
```
$(".offer").on("click", function () {
... | Another alternative solution to toggle checkbox value:
```
<div id="parent">
<img src="" class="avatar" />
<input type="checkbox" name="" />
</div>
$("img.avatar").click(function(){
var op = !$(this).parent().find(':checkbox').attr('checked');
$(this).parent().find(':checkbox').attr('checked', op);
... |
1,467,228 | I've used a hover function where you do x on mouseover and y and mouseout. I'm trying the same for click but it doesn't seem to work:
```
$('.offer').click(function(){
$(this).find(':checkbox').attr('checked', true );
},function(){
$(this).find(':checkbox').attr('checked', false );
});
```
I want the checkbox... | 2009/09/23 | [
"https://Stackoverflow.com/questions/1467228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172637/"
] | You could use the [`toggle`](http://docs.jquery.com/Events/toggle) function:
```
$('.offer').toggle(function() {
$(this).find(':checkbox').attr('checked', true);
}, function() {
$(this).find(':checkbox').attr('checked', false);
});
``` | Easiest solution
```
$('.offer').click(function(){
var cc = $(this).attr('checked') == undefined ? false : true;
$(this).find(':checkbox').attr('checked',cc);
});
``` |
1,467,228 | I've used a hover function where you do x on mouseover and y and mouseout. I'm trying the same for click but it doesn't seem to work:
```
$('.offer').click(function(){
$(this).find(':checkbox').attr('checked', true );
},function(){
$(this).find(':checkbox').attr('checked', false );
});
```
I want the checkbox... | 2009/09/23 | [
"https://Stackoverflow.com/questions/1467228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172637/"
] | Warning: using **attr()** or **prop()** to change the state of a checkbox **does not** fire the **change event** in most browsers I've tested with. The checked state will change but no event bubbling. You must trigger the change event manually after setting the checked attribute. I had some other event handlers monitor... | I have a single checkbox named `chkDueDate` and an HTML object with a click event as follows:
```
$('#chkDueDate').attr('checked', !$('#chkDueDate').is(':checked'));
```
Clicking the HTML object (in this case a `<span>`) toggles the checked property of the checkbox. |
1,467,228 | I've used a hover function where you do x on mouseover and y and mouseout. I'm trying the same for click but it doesn't seem to work:
```
$('.offer').click(function(){
$(this).find(':checkbox').attr('checked', true );
},function(){
$(this).find(':checkbox').attr('checked', false );
});
```
I want the checkbox... | 2009/09/23 | [
"https://Stackoverflow.com/questions/1467228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172637/"
] | Another approach would be to extended jquery like this:
```
$.fn.toggleCheckbox = function() {
this.attr('checked', !this.attr('checked'));
}
```
Then call:
```
$('.offer').find(':checkbox').toggleCheckbox();
``` | try changing this:
```
$(this).find(':checkbox').attr('checked', true );
```
to this:
```
$(this).find(':checkbox').attr('checked', 'checked');
```
Not 100% sure if that will do it, but I seem to recall having a similar problem. Good luck! |
1,467,228 | I've used a hover function where you do x on mouseover and y and mouseout. I'm trying the same for click but it doesn't seem to work:
```
$('.offer').click(function(){
$(this).find(':checkbox').attr('checked', true );
},function(){
$(this).find(':checkbox').attr('checked', false );
});
```
I want the checkbox... | 2009/09/23 | [
"https://Stackoverflow.com/questions/1467228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172637/"
] | Warning: using **attr()** or **prop()** to change the state of a checkbox **does not** fire the **change event** in most browsers I've tested with. The checked state will change but no event bubbling. You must trigger the change event manually after setting the checked attribute. I had some other event handlers monitor... | Why not in one line?
```
$('.offer').click(function(){
$(this).find(':checkbox').attr('checked', !$(this).find(':checkbox').attr('checked'));
});
``` |
1,467,228 | I've used a hover function where you do x on mouseover and y and mouseout. I'm trying the same for click but it doesn't seem to work:
```
$('.offer').click(function(){
$(this).find(':checkbox').attr('checked', true );
},function(){
$(this).find(':checkbox').attr('checked', false );
});
```
I want the checkbox... | 2009/09/23 | [
"https://Stackoverflow.com/questions/1467228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172637/"
] | You could use the [`toggle`](http://docs.jquery.com/Events/toggle) function:
```
$('.offer').toggle(function() {
$(this).find(':checkbox').attr('checked', true);
}, function() {
$(this).find(':checkbox').attr('checked', false);
});
``` | ```
$('.offer').click(function() {
$(':checkbox', this).each(function() {
this.checked = !this.checked;
});
});
``` |
1,467,228 | I've used a hover function where you do x on mouseover and y and mouseout. I'm trying the same for click but it doesn't seem to work:
```
$('.offer').click(function(){
$(this).find(':checkbox').attr('checked', true );
},function(){
$(this).find(':checkbox').attr('checked', false );
});
```
I want the checkbox... | 2009/09/23 | [
"https://Stackoverflow.com/questions/1467228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172637/"
] | This is easily done by flipping the current 'checked' state of the checkbox upon each click. Examples:
```
$(".offer").on("click", function () {
var $checkbox = $(this).find(':checkbox');
$checkbox.attr('checked', !$checkbox.attr('checked'));
});
```
or:
```
$(".offer").on("click", function () {
... | ```
$('.offer').click(function() {
$(':checkbox', this).each(function() {
this.checked = !this.checked;
});
});
``` |
1,467,228 | I've used a hover function where you do x on mouseover and y and mouseout. I'm trying the same for click but it doesn't seem to work:
```
$('.offer').click(function(){
$(this).find(':checkbox').attr('checked', true );
},function(){
$(this).find(':checkbox').attr('checked', false );
});
```
I want the checkbox... | 2009/09/23 | [
"https://Stackoverflow.com/questions/1467228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172637/"
] | Why not in one line?
```
$('.offer').click(function(){
$(this).find(':checkbox').attr('checked', !$(this).find(':checkbox').attr('checked'));
});
``` | ```
<label>
<input
type="checkbox"
onclick="$('input[type=checkbox]').attr('checked', $(this).is(':checked'));"
/>
Check all
</label>
``` |
1,467,228 | I've used a hover function where you do x on mouseover and y and mouseout. I'm trying the same for click but it doesn't seem to work:
```
$('.offer').click(function(){
$(this).find(':checkbox').attr('checked', true );
},function(){
$(this).find(':checkbox').attr('checked', false );
});
```
I want the checkbox... | 2009/09/23 | [
"https://Stackoverflow.com/questions/1467228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172637/"
] | You could use the [`toggle`](http://docs.jquery.com/Events/toggle) function:
```
$('.offer').toggle(function() {
$(this).find(':checkbox').attr('checked', true);
}, function() {
$(this).find(':checkbox').attr('checked', false);
});
``` | Why not in one line?
```
$('.offer').click(function(){
$(this).find(':checkbox').attr('checked', !$(this).find(':checkbox').attr('checked'));
});
``` |
1,467,228 | I've used a hover function where you do x on mouseover and y and mouseout. I'm trying the same for click but it doesn't seem to work:
```
$('.offer').click(function(){
$(this).find(':checkbox').attr('checked', true );
},function(){
$(this).find(':checkbox').attr('checked', false );
});
```
I want the checkbox... | 2009/09/23 | [
"https://Stackoverflow.com/questions/1467228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172637/"
] | Warning: using **attr()** or **prop()** to change the state of a checkbox **does not** fire the **change event** in most browsers I've tested with. The checked state will change but no event bubbling. You must trigger the change event manually after setting the checked attribute. I had some other event handlers monitor... | ```
<label>
<input
type="checkbox"
onclick="$('input[type=checkbox]').attr('checked', $(this).is(':checked'));"
/>
Check all
</label>
``` |
61,449,900 | Let's say I have a dict that looks like this:
```
d['a']['1'] = 'foo'
d['a']['2'] = 'bar'
d['b']['1'] = 'baz'
d['b']['2'] = 'boo'
```
If I want to get every item where the first key is 'a', I can just do `d['a']` and I will get all of them. However, what if I want to get all items where the second key is '1'? The on... | 2020/04/27 | [
"https://Stackoverflow.com/questions/61449900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4855256/"
] | You're dealing with three dictionaries in this example: One with the values "foo" and "bar", one with the values "baz" and "boo", and an outer dictionary that maps the keys "a" and "b" to those first two inner dictionaries. You can iterate over the keys of both the outer and inner dictionaries with a nested for loop:
... | What you want sounds very similar to a tree-structure which can be implemented as a dictionary-of-dictionaries. Here's a simple implement taken from one of the answers to the question [What is the best way to implement nested dictionaries?](https://stackoverflow.com/questions/635483/what-is-the-best-way-to-implement-ne... |
61,449,900 | Let's say I have a dict that looks like this:
```
d['a']['1'] = 'foo'
d['a']['2'] = 'bar'
d['b']['1'] = 'baz'
d['b']['2'] = 'boo'
```
If I want to get every item where the first key is 'a', I can just do `d['a']` and I will get all of them. However, what if I want to get all items where the second key is '1'? The on... | 2020/04/27 | [
"https://Stackoverflow.com/questions/61449900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4855256/"
] | You're dealing with three dictionaries in this example: One with the values "foo" and "bar", one with the values "baz" and "boo", and an outer dictionary that maps the keys "a" and "b" to those first two inner dictionaries. You can iterate over the keys of both the outer and inner dictionaries with a nested for loop:
... | So after sleeping on it the solution I came up with was to make three dicts, the main one where the data is actually stored and identified by a tuple (`d['a', '1'] = 'foo'`) and the other two are indexes that store all possible values of key B under key A where (A,B) is a valid combination (so `a['a'] = ['1', '2']`, `b... |
55,110,483 | New to regex. How to combine multiple replace like this into a single regex (ie with variables) over all or a range of hex values?
`s.replace(r'\xF1', '\xF1').replace(r'\xE1', '\xE1').replace(r'\xEA', '\xEA')`
where s are strings to be parsed by json.load, eg
`s = 'M : AU : \\xA0MDA:CON'`
Certain fragments containi... | 2019/03/11 | [
"https://Stackoverflow.com/questions/55110483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1472770/"
] | ```
^REF-\w{4}-\w{4}$
```
`^REF` matches the characters REF- literally at start (case sensitive)
`\w{4}` matches any word character exactly 4 times
`\w` equal to `[a-zA-Z0-9_]`, if you don't need to include `_` you can replace it with `[a-zA-Z0-9]`
```
^(REF)-([a-zA-Z0-9]{4})-([a-zA-Z0-9]{4})
``` | What about this?
`REF-([0-9a-zA-Z]{4})-\1` |
55,110,483 | New to regex. How to combine multiple replace like this into a single regex (ie with variables) over all or a range of hex values?
`s.replace(r'\xF1', '\xF1').replace(r'\xE1', '\xE1').replace(r'\xEA', '\xEA')`
where s are strings to be parsed by json.load, eg
`s = 'M : AU : \\xA0MDA:CON'`
Certain fragments containi... | 2019/03/11 | [
"https://Stackoverflow.com/questions/55110483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1472770/"
] | You will want something like this:
```
^REF-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}$
```
you were missing the hyphen and there is no need for the "\*" inside the list | What about this?
`REF-([0-9a-zA-Z]{4})-\1` |
55,110,483 | New to regex. How to combine multiple replace like this into a single regex (ie with variables) over all or a range of hex values?
`s.replace(r'\xF1', '\xF1').replace(r'\xE1', '\xE1').replace(r'\xEA', '\xEA')`
where s are strings to be parsed by json.load, eg
`s = 'M : AU : \\xA0MDA:CON'`
Certain fragments containi... | 2019/03/11 | [
"https://Stackoverflow.com/questions/55110483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1472770/"
] | You will want something like this:
```
^REF-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}$
```
you were missing the hyphen and there is no need for the "\*" inside the list | ```
^REF-\w{4}-\w{4}$
```
`^REF` matches the characters REF- literally at start (case sensitive)
`\w{4}` matches any word character exactly 4 times
`\w` equal to `[a-zA-Z0-9_]`, if you don't need to include `_` you can replace it with `[a-zA-Z0-9]`
```
^(REF)-([a-zA-Z0-9]{4})-([a-zA-Z0-9]{4})
``` |
48,353,778 | in my music app i created listView and fetched songs from sd card.everything is perfect but when when i click on listItem songs doesnt play.it doesnt give any response.i m lost.please give me some idea how to fix this problem.its been long i m finding solution for this.i looked every single line of code but coudnt find... | 2018/01/20 | [
"https://Stackoverflow.com/questions/48353778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9220213/"
] | A real time command pipe for redis.log. (you can call `bgsave` to test it.)
```
package main
import (
"os"
"os/exec"
"fmt"
"bufio"
)
func main() {
cmd := exec.Command("tail", "-f", "/usr/local/var/log/redis.log")
// create a pipe for the output of the script
cmdReader, err := cmd.Stdout... | I haven't found a solution to your problem, but I have found something strange.
I wrote three versions of a program that repeatingly output a short string with one second interval, one in Python, one in C, and one in Go:
talker.py
---------
```
import time
while True:
print("Now!")
time.sleep(1)
``... |
13,774,909 | i am designing one drop down list with css
Here is my html code:

>
> i have set each `li a` property border-right to `border-right:1px dashed silver`; i want to delete that property for last `li a` element
>
>
>
and here is css code :
```
#n... | 2012/12/08 | [
"https://Stackoverflow.com/questions/13774909",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1537107/"
] | you can do this by
```
border: none !important;
```
it will remove all border
to remove right border ony try
```
border-right: none !important;
```
**Good Read**
[**Is !important bad for performance?**](https://stackoverflow.com/questions/13743671/is-important-bad-for-performance/13745254) | ```
#navigation {
display: inline - table;
text - align: center;
background: silver;
}
#navigationli {
float: left;
list - style: none;
padding: 2px 10px 2px 10px;
}
#navigationa {
display: block;
text - decoration: none;
color: green;
font - weight: bold;
padding: 5px;
... |
13,774,909 | i am designing one drop down list with css
Here is my html code:

>
> i have set each `li a` property border-right to `border-right:1px dashed silver`; i want to delete that property for last `li a` element
>
>
>
and here is css code :
```
#n... | 2012/12/08 | [
"https://Stackoverflow.com/questions/13774909",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1537107/"
] | Am not sure which border are you talking about but try this if you want to remove the border from last `li`
```
.noBorder {
border-right: none !important;
}
``` | ```
#navigation {
display: inline - table;
text - align: center;
background: silver;
}
#navigationli {
float: left;
list - style: none;
padding: 2px 10px 2px 10px;
}
#navigationa {
display: block;
text - decoration: none;
color: green;
font - weight: bold;
padding: 5px;
... |
13,774,909 | i am designing one drop down list with css
Here is my html code:

>
> i have set each `li a` property border-right to `border-right:1px dashed silver`; i want to delete that property for last `li a` element
>
>
>
and here is css code :
```
#n... | 2012/12/08 | [
"https://Stackoverflow.com/questions/13774909",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1537107/"
] | Try this, it will work
```
.noBorder
{
border-right:0px!important;
}
``` | ```
#navigation {
display: inline - table;
text - align: center;
background: silver;
}
#navigationli {
float: left;
list - style: none;
padding: 2px 10px 2px 10px;
}
#navigationa {
display: block;
text - decoration: none;
color: green;
font - weight: bold;
padding: 5px;
... |
13,774,909 | i am designing one drop down list with css
Here is my html code:

>
> i have set each `li a` property border-right to `border-right:1px dashed silver`; i want to delete that property for last `li a` element
>
>
>
and here is css code :
```
#n... | 2012/12/08 | [
"https://Stackoverflow.com/questions/13774909",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1537107/"
] | Am not sure which border are you talking about but try this if you want to remove the border from last `li`
```
.noBorder {
border-right: none !important;
}
``` | you can do this by
```
border: none !important;
```
it will remove all border
to remove right border ony try
```
border-right: none !important;
```
**Good Read**
[**Is !important bad for performance?**](https://stackoverflow.com/questions/13743671/is-important-bad-for-performance/13745254) |
13,774,909 | i am designing one drop down list with css
Here is my html code:

>
> i have set each `li a` property border-right to `border-right:1px dashed silver`; i want to delete that property for last `li a` element
>
>
>
and here is css code :
```
#n... | 2012/12/08 | [
"https://Stackoverflow.com/questions/13774909",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1537107/"
] | Am not sure which border are you talking about but try this if you want to remove the border from last `li`
```
.noBorder {
border-right: none !important;
}
``` | Try this, it will work
```
.noBorder
{
border-right:0px!important;
}
``` |
6,719,946 | I am currently trying to declare a public string within a while loop, as I would like to use it (the string) in other methods
The string in question is "s"
```
private void CheckLog()
{
bool _found;
while (true)
{
_found = false;
Thread.Sleep(5000);
if (!System.IO.File.Exists("Comm... | 2011/07/16 | [
"https://Stackoverflow.com/questions/6719946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/848081/"
] | you can't declare `public` string inside the method.
Try this:
```
string s = "";
private void CheckLog()
{
bool _found;
while (true)
{
_found = false;
Thread.Sleep(5000);
if (!System.IO.File.Exists("Command.bat")) continue;
using (System.IO.StreamReader sr = System.IO.File.... | You should create a global variable and assign that instead for example
```
public class MyClass
{
public string s;
private void CheckLog() { ... }
}
```
In any method you might use it remember to check if `s.IsNullOrEmpty()` to avoid getting a NullPointerException (also I'm assuming that the string should c... |
6,719,946 | I am currently trying to declare a public string within a while loop, as I would like to use it (the string) in other methods
The string in question is "s"
```
private void CheckLog()
{
bool _found;
while (true)
{
_found = false;
Thread.Sleep(5000);
if (!System.IO.File.Exists("Comm... | 2011/07/16 | [
"https://Stackoverflow.com/questions/6719946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/848081/"
] | you can't declare `public` string inside the method.
Try this:
```
string s = "";
private void CheckLog()
{
bool _found;
while (true)
{
_found = false;
Thread.Sleep(5000);
if (!System.IO.File.Exists("Command.bat")) continue;
using (System.IO.StreamReader sr = System.IO.File.... | Better pass the string as by-ref argument to function, or return it from the function. Declaring it as member doesn't seem to be a good idea.
```
public string CheckLog(){}
``` |
30,463 | So I've created this planet that's about 90% the size of Earth, orbits a binary yellow dwarf star and has an extremely electrified atmosphere. Cloud plumes coming from volcanoes contain various conducting compounds, resulting in huge lightning storms which occur almost every night globally.
This planet's equivalent t... | 2015/11/25 | [
"https://worldbuilding.stackexchange.com/questions/30463",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/15567/"
] | Why would you 'produce energy' from electricity? IT IS ENERGY. Likely they would utilize as much as possible in it's native form. The human body uses electric impulses all to pass information back and forth throughout the body.
Adding in capacitors to hold this energy would be fairly important, it would be kind of lik... | The Asian Hornet converts sunlight into electricity, then appears to use it directly:
```
The sunlight that these hornets capture is likely converted into electrical
energy. There exists a voltage between the inner and outer layers of the
yellow stripe that increases in response to illumination. The harvested
energ... |
50,874,400 | I am using node.js,express and postgres db for my project. I have few queries in async function which I am not able to execute in a sequence. sample code for reference.
```
for(let i=0;i<person_size;i++)
{
var check_person_query="select per_id_pk from person_tbl where per_fname='"+person_fname[i]+"' and per_lname=... | 2018/06/15 | [
"https://Stackoverflow.com/questions/50874400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5142959/"
] | Yes, it's definitely possible:
```
## create matrix
#set($matrix = [
['A','B',0,'hello',0,0],
['C','D',0.56,'there',0,0],
[0,0,0,0,0,0],
[0,0,0,0,0,0],
[0,0,0,0,0,0],
[0,0,0,0,0,0] ])
## display a cell
$matrix[0][3]
## change some cells
## (warning, indices are zero-based)
#set($matrix[2][3] = 'how are y... | ##You can use that, i try a 2D array but i can do it, i find this solution
#set ( $test= { "mytest": [[], []]
} )
#set($dummy = $test.get('mytest').get(0).add('hello'))
#set($dummy = $test.get('mytest').get(1).add('World'))
$test.get('mytest').get(0).get(0) ## hello
$test.get('mytest').get(1).get(0) ## world |
33,328,187 | I am relatively new at this and have been racking my brain attempting to get my program to work properly and it just won't. I am working in Visual Studio 2012 C# on a Forms Application.
I need it to produce a distinct error message when the user input value is more than `0` but less than `10,000`. It also must produce... | 2015/10/25 | [
"https://Stackoverflow.com/questions/33328187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3473475/"
] | As I already mentioned in comment you should consider moving your code out of catch block.
In this case you should think of creating a simple method which will validate your input and produces output message.
An example is for you:
```
private bool IsPageValid()
{
string errorMessage = string.Empty;... | Code should look like this
```
try {
decimal subtotal = Convert.ToDecimal(txtSubtotal.Text);
try {
if(x<0 || x>10000){
throw new OverFlowException("");
}
//Do what ever you want
}
catch(Exception ex){
// catch overflow
}
}
catch(Exception ex){
// catc... |
33,328,187 | I am relatively new at this and have been racking my brain attempting to get my program to work properly and it just won't. I am working in Visual Studio 2012 C# on a Forms Application.
I need it to produce a distinct error message when the user input value is more than `0` but less than `10,000`. It also must produce... | 2015/10/25 | [
"https://Stackoverflow.com/questions/33328187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3473475/"
] | I would used KeyEvent press enter or Leave event for this, first I need to create generic class for verification if the input from the user is not a string.
Condition:
1 verify if the input is not a string Im using generic for general purposes class.
```
public class iCnF()
{
public static System.Boolean IsN... | As I already mentioned in comment you should consider moving your code out of catch block.
In this case you should think of creating a simple method which will validate your input and produces output message.
An example is for you:
```
private bool IsPageValid()
{
string errorMessage = string.Empty;... |
33,328,187 | I am relatively new at this and have been racking my brain attempting to get my program to work properly and it just won't. I am working in Visual Studio 2012 C# on a Forms Application.
I need it to produce a distinct error message when the user input value is more than `0` but less than `10,000`. It also must produce... | 2015/10/25 | [
"https://Stackoverflow.com/questions/33328187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3473475/"
] | I would used KeyEvent press enter or Leave event for this, first I need to create generic class for verification if the input from the user is not a string.
Condition:
1 verify if the input is not a string Im using generic for general purposes class.
```
public class iCnF()
{
public static System.Boolean IsN... | Code should look like this
```
try {
decimal subtotal = Convert.ToDecimal(txtSubtotal.Text);
try {
if(x<0 || x>10000){
throw new OverFlowException("");
}
//Do what ever you want
}
catch(Exception ex){
// catch overflow
}
}
catch(Exception ex){
// catc... |
2,047,165 | **Background**
I'm trying to learn to program a little & python seems like a good choice for my purpose. I have no ambition of ever being a serious programmer.I already know bits and pieces of html, css, javascript (mostly how to cut & paste without understanding what I'm doing). The last time I actually "learned progr... | 2010/01/12 | [
"https://Stackoverflow.com/questions/2047165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Lots of great "Python tutorials for non-programmers" are listed [here](http://wiki.python.org/moin/BeginnersGuide/NonProgrammers)! | If you are a true beginner; **ALWAYS** keep the interactive shell handy (even if you write your code and tutorials in an editor) and use `help(whatever_you_need_help_with)`and `dir(whatever)` extensively.
For example;
```
>>> a = "foobar"
>>> dir(a)
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '... |
2,047,165 | **Background**
I'm trying to learn to program a little & python seems like a good choice for my purpose. I have no ambition of ever being a serious programmer.I already know bits and pieces of html, css, javascript (mostly how to cut & paste without understanding what I'm doing). The last time I actually "learned progr... | 2010/01/12 | [
"https://Stackoverflow.com/questions/2047165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Since you're on OSX, you don't actually need to install anything to get started. Simply open up the Terminal application, and type `python`. You'll go straight into the Python shell (command line) where you can type simple Python programs.
When you want to write longer ones, simply do as you did with PHP - write them ... | The easiest way to start will be an online interpreter like [Try Python](http://try-python.mired.org/) or [codepad](http://codepad.org/).
Type `print "Hello world"` after the `>>>` in the input field and press enter. Your first Python program should be done.
There are lots of excellent python tutorials out there, you... |
2,047,165 | **Background**
I'm trying to learn to program a little & python seems like a good choice for my purpose. I have no ambition of ever being a serious programmer.I already know bits and pieces of html, css, javascript (mostly how to cut & paste without understanding what I'm doing). The last time I actually "learned progr... | 2010/01/12 | [
"https://Stackoverflow.com/questions/2047165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I recommend biting the bullet and using the command line version to start with.
Later you'll get onto writing scripts and you'll need a good editor, but not necessarily a python IDE.
For learning I found the "Python Tutorial" by Guido van Rossum, the author of python, to be a good starting point. ( <http://docs.python... | I was in the same boat, two books really helped me:
* Python 3 for Absolute Beginners
* Learning Python 4th Edition
* Python Pocket Reference (for when you've started coding basic stuff and need a handy reference book) |
2,047,165 | **Background**
I'm trying to learn to program a little & python seems like a good choice for my purpose. I have no ambition of ever being a serious programmer.I already know bits and pieces of html, css, javascript (mostly how to cut & paste without understanding what I'm doing). The last time I actually "learned progr... | 2010/01/12 | [
"https://Stackoverflow.com/questions/2047165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Start with the very basics:
[Python 2.6.4 Installer](http://www.python.org/download/)
[The Official Python Tutorial](http://docs.python.org/tutorial/)
That's how I did it. | Buy
[Head First Programming](https://rads.stackoverflow.com/amzn/click/com/0596802374)
Seems like a really neat book ^^ |
2,047,165 | **Background**
I'm trying to learn to program a little & python seems like a good choice for my purpose. I have no ambition of ever being a serious programmer.I already know bits and pieces of html, css, javascript (mostly how to cut & paste without understanding what I'm doing). The last time I actually "learned progr... | 2010/01/12 | [
"https://Stackoverflow.com/questions/2047165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Since you're on OSX, you don't actually need to install anything to get started. Simply open up the Terminal application, and type `python`. You'll go straight into the Python shell (command line) where you can type simple Python programs.
When you want to write longer ones, simply do as you did with PHP - write them ... | Buy
[Head First Programming](https://rads.stackoverflow.com/amzn/click/com/0596802374)
Seems like a really neat book ^^ |
2,047,165 | **Background**
I'm trying to learn to program a little & python seems like a good choice for my purpose. I have no ambition of ever being a serious programmer.I already know bits and pieces of html, css, javascript (mostly how to cut & paste without understanding what I'm doing). The last time I actually "learned progr... | 2010/01/12 | [
"https://Stackoverflow.com/questions/2047165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I recommend biting the bullet and using the command line version to start with.
Later you'll get onto writing scripts and you'll need a good editor, but not necessarily a python IDE.
For learning I found the "Python Tutorial" by Guido van Rossum, the author of python, to be a good starting point. ( <http://docs.python... | The easiest way to start will be an online interpreter like [Try Python](http://try-python.mired.org/) or [codepad](http://codepad.org/).
Type `print "Hello world"` after the `>>>` in the input field and press enter. Your first Python program should be done.
There are lots of excellent python tutorials out there, you... |
2,047,165 | **Background**
I'm trying to learn to program a little & python seems like a good choice for my purpose. I have no ambition of ever being a serious programmer.I already know bits and pieces of html, css, javascript (mostly how to cut & paste without understanding what I'm doing). The last time I actually "learned progr... | 2010/01/12 | [
"https://Stackoverflow.com/questions/2047165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Start with the very basics:
[Python 2.6.4 Installer](http://www.python.org/download/)
[The Official Python Tutorial](http://docs.python.org/tutorial/)
That's how I did it. | The easiest way to start will be an online interpreter like [Try Python](http://try-python.mired.org/) or [codepad](http://codepad.org/).
Type `print "Hello world"` after the `>>>` in the input field and press enter. Your first Python program should be done.
There are lots of excellent python tutorials out there, you... |
2,047,165 | **Background**
I'm trying to learn to program a little & python seems like a good choice for my purpose. I have no ambition of ever being a serious programmer.I already know bits and pieces of html, css, javascript (mostly how to cut & paste without understanding what I'm doing). The last time I actually "learned progr... | 2010/01/12 | [
"https://Stackoverflow.com/questions/2047165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Start with the very basics:
[Python 2.6.4 Installer](http://www.python.org/download/)
[The Official Python Tutorial](http://docs.python.org/tutorial/)
That's how I did it. | If you are a true beginner; **ALWAYS** keep the interactive shell handy (even if you write your code and tutorials in an editor) and use `help(whatever_you_need_help_with)`and `dir(whatever)` extensively.
For example;
```
>>> a = "foobar"
>>> dir(a)
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '... |
2,047,165 | **Background**
I'm trying to learn to program a little & python seems like a good choice for my purpose. I have no ambition of ever being a serious programmer.I already know bits and pieces of html, css, javascript (mostly how to cut & paste without understanding what I'm doing). The last time I actually "learned progr... | 2010/01/12 | [
"https://Stackoverflow.com/questions/2047165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I wrote Building Skills in Programming for folks who are struggling, it may help.
<http://homepage.mac.com/s_lott/books/nonprogrammer.html> | Buy
[Head First Programming](https://rads.stackoverflow.com/amzn/click/com/0596802374)
Seems like a really neat book ^^ |
2,047,165 | **Background**
I'm trying to learn to program a little & python seems like a good choice for my purpose. I have no ambition of ever being a serious programmer.I already know bits and pieces of html, css, javascript (mostly how to cut & paste without understanding what I'm doing). The last time I actually "learned progr... | 2010/01/12 | [
"https://Stackoverflow.com/questions/2047165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Start with the very basics:
[Python 2.6.4 Installer](http://www.python.org/download/)
[The Official Python Tutorial](http://docs.python.org/tutorial/)
That's how I did it. | Since you're on OSX, you don't actually need to install anything to get started. Simply open up the Terminal application, and type `python`. You'll go straight into the Python shell (command line) where you can type simple Python programs.
When you want to write longer ones, simply do as you did with PHP - write them ... |
54,830,272 | Just starting out with f#, I come OO C# background and I have the following code that reads a text file of uk postscodes, it then hits an api end point with post codes, I test the result to see if post is valid or not:
```
let postCodeFile = "c:\\tmp\\randomPostCodes.txt"
let readLines filePath = System.IO.File.ReadL... | 2019/02/22 | [
"https://Stackoverflow.com/questions/54830272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/719625/"
] | ### Critique / code review
You've already made this about as functional as it can be. I'll go through your code and explain why your decisions were good, and in a few cases, where you could make minor improvements.
```
let postCodeFile = "c:\\tmp\\randomPostCodes.txt"
```
Good to have this as a named variable; in r... | This is just my style, it is not necessarily more functional or better:
```
open System.IO
let postCodeFile = "c:\\tmp\\randomPostCodes.txt"
let postCodeValidDaterUrl = "https://api.postcodes.io/postcodes/"
let validatePostCode postCode =
Request.createUrl Get (postCodeValidDaterUrl + postCode)
|> g... |
54,830,272 | Just starting out with f#, I come OO C# background and I have the following code that reads a text file of uk postscodes, it then hits an api end point with post codes, I test the result to see if post is valid or not:
```
let postCodeFile = "c:\\tmp\\randomPostCodes.txt"
let readLines filePath = System.IO.File.ReadL... | 2019/02/22 | [
"https://Stackoverflow.com/questions/54830272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/719625/"
] | I don't think the aim here should be to make the code "more functional". Being functional is not an inherent value. In F#, it makes sense to keep the core of your logic functional, but if you are doing a lot of I/O, then it makes sense to follow more imperative style.
My version of your code would look like this (some... | This is just my style, it is not necessarily more functional or better:
```
open System.IO
let postCodeFile = "c:\\tmp\\randomPostCodes.txt"
let postCodeValidDaterUrl = "https://api.postcodes.io/postcodes/"
let validatePostCode postCode =
Request.createUrl Get (postCodeValidDaterUrl + postCode)
|> g... |
459,552 | Find all the values of $x \in \mathbb{R}$ from this inequality:
$$\left|\frac3{x^3-8}\right|=\left|\frac1{x-2}\right|$$
This is my work:
$$\frac{\left|\frac3{x^3-8}\right|}{\left|\frac1{x-2}\right|}=1$$
$$\left|\frac{3(x-2)}{x^3-8}\right|=1$$
$$\left|\frac {x-2}{x^3-2^3}\right|=\frac13$$ | 2013/08/04 | [
"https://math.stackexchange.com/questions/459552",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/88419/"
] | $$\left|\;\frac3{x^3-8}\;\right|=\left|\;\frac1{x-2}\;\right|\iff3|x-2|=|x-2||x^2+2x+4|$$
Now, it obviously *has* to be $\,x\ne 2\,$ , so... | HINT:
$x^3-8=x^3-2^3=(x-2)\{x^2+2x+2^2\}=(x-2)\{(x+1)^2+3\}$
So assuming $x-2\ne0,$ we can safely cancel $x-2$ and utilize $|x^2+2x+4|=x^2+2x+4$ |
459,552 | Find all the values of $x \in \mathbb{R}$ from this inequality:
$$\left|\frac3{x^3-8}\right|=\left|\frac1{x-2}\right|$$
This is my work:
$$\frac{\left|\frac3{x^3-8}\right|}{\left|\frac1{x-2}\right|}=1$$
$$\left|\frac{3(x-2)}{x^3-8}\right|=1$$
$$\left|\frac {x-2}{x^3-2^3}\right|=\frac13$$ | 2013/08/04 | [
"https://math.stackexchange.com/questions/459552",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/88419/"
] | $$\left|\;\frac3{x^3-8}\;\right|=\left|\;\frac1{x-2}\;\right|\iff3|x-2|=|x-2||x^2+2x+4|$$
Now, it obviously *has* to be $\,x\ne 2\,$ , so... | $$\left|\;\frac3{x^3-8}\;\right|=\left|\;\frac1{x-2}\;\right|\iff3|x-2|=|x-2||x^2+2x+4|$$
Since $x-2\ne0$ we can cancel both sides and get a quadratic $|x^2+2x+4|$ which has no solution in the real axis. |
14,245,233 | I want to have a customer testimonial quote centered in the middle of a page. The quote might be arbitrary length, but doesn't span two lines. Then I want a new line and then the name of the person that provided the testimonial, just under the testimonial but right justified.
```
<div class="quote">
"Wow! Thanks, cr... | 2013/01/09 | [
"https://Stackoverflow.com/questions/14245233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/793454/"
] | This will do, probably:
HTML:
```
<blockquote>
<p>
<span class="quote">
"Wow! Thanks, create customer service."
<cite>
-- John S. - California
</cite>
</span>
</p>
</blockquote>
```
CSS:
```
blockquote {
text-align: center;
}
.quo... | Basically: you can't without going too ugly and hack-y with your markup. (See THiCE's answer for such a solution).
I do **not** recommend this, but if you're okay with using JavaScript, then this is fairly simple: (below uses jQuery, but can be achieved without it)
```
$(".quote").each(function() {
var $this = $(... |
14,245,233 | I want to have a customer testimonial quote centered in the middle of a page. The quote might be arbitrary length, but doesn't span two lines. Then I want a new line and then the name of the person that provided the testimonial, just under the testimonial but right justified.
```
<div class="quote">
"Wow! Thanks, cr... | 2013/01/09 | [
"https://Stackoverflow.com/questions/14245233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/793454/"
] | This will do, probably:
HTML:
```
<blockquote>
<p>
<span class="quote">
"Wow! Thanks, create customer service."
<cite>
-- John S. - California
</cite>
</span>
</p>
</blockquote>
```
CSS:
```
blockquote {
text-align: center;
}
.quo... | Change your markup a bit and nest the source into the quote.
```
<div class="quote">
"Wow! Thanks, create customer service."
<div class="source">
-- John S. - California
</div>
</div>
```
The CSS for it:
```
.quote {
display:table;
text-align: center;
margin:0 auto;
}
.quote .source ... |
14,245,233 | I want to have a customer testimonial quote centered in the middle of a page. The quote might be arbitrary length, but doesn't span two lines. Then I want a new line and then the name of the person that provided the testimonial, just under the testimonial but right justified.
```
<div class="quote">
"Wow! Thanks, cr... | 2013/01/09 | [
"https://Stackoverflow.com/questions/14245233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/793454/"
] | Change your markup a bit and nest the source into the quote.
```
<div class="quote">
"Wow! Thanks, create customer service."
<div class="source">
-- John S. - California
</div>
</div>
```
The CSS for it:
```
.quote {
display:table;
text-align: center;
margin:0 auto;
}
.quote .source ... | Basically: you can't without going too ugly and hack-y with your markup. (See THiCE's answer for such a solution).
I do **not** recommend this, but if you're okay with using JavaScript, then this is fairly simple: (below uses jQuery, but can be achieved without it)
```
$(".quote").each(function() {
var $this = $(... |
3,379 | What is the best torrent client and is there a client that has a search feature? I mean not to search for local torrent files, but to search for files to download. | 2015/12/05 | [
"https://elementaryos.stackexchange.com/questions/3379",
"https://elementaryos.stackexchange.com",
"https://elementaryos.stackexchange.com/users/3333/"
] | Transmission will be your best bet since it is also written in GTK+, it is integrated well with elementary OS. Note that it doesn't have a search features but it is the [best client](http://pastehtml.com/view/5tx16jw.html) in terms of CPU usage and RAM usage while downloading. | I quite like qBittorrent (`sudo apt install qbittorent` if the command-line is your thing)
I don't know if it is the best - I haven't done that much testing - but it satisfies your requirement for searching (it has a whole bunch of built-in searches, and you can add more), and I think the interface is quite nice
If y... |
3,379 | What is the best torrent client and is there a client that has a search feature? I mean not to search for local torrent files, but to search for files to download. | 2015/12/05 | [
"https://elementaryos.stackexchange.com/questions/3379",
"https://elementaryos.stackexchange.com",
"https://elementaryos.stackexchange.com/users/3333/"
] | Transmission will be your best bet since it is also written in GTK+, it is integrated well with elementary OS. Note that it doesn't have a search features but it is the [best client](http://pastehtml.com/view/5tx16jw.html) in terms of CPU usage and RAM usage while downloading. | I'm going to preface this with a nod to the fact that I work on [elementary.io](https://elementary.io), and thanks to that have access to lots of lovely metrics mere mortals are not normally privy to.
---
Transmission (38%)
==================
[Transmission](https://transmissionbt.com/) is by far the most popular tor... |
29,363,978 | This is my first attempt to create a sample angular application.
In `app.js` I defined the following -
```
var app = angular.module('myTestApp', ['ngCookies',
'ngResource',
'ngRoute',
'ngSanitize',
... | 2015/03/31 | [
"https://Stackoverflow.com/questions/29363978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3396009/"
] | As they are separate files and grunt/jshint will not know that the variable is available in other files. Instead of that it would be a best practice to use it in this way:
Instead use this:
```
angular.module('myTestApp')
.controller('SampleCtrl', function ($scope,
$location,
... | If everything else is fine, this line is causing the issue in your code -
```
app.config(function ($routeProvider) {
routeProvider
```
you should instead use -
```
app.config(function ($routeProvider) {
$routeProvider
```
And yes, if `var app` is not working, try using
```
angular.module('myTestApp')
.contro... |
2,494,862 | I have the following code:
```
ifstream initFile;
initFile.open("D:\\InitTLM.csv");
if(initFile.is_open())
{
// Process file
}
```
The file is not opening. The file does exist on the D: drive. Is there a way to find out exactly why this file cannot be found? Like an "errno"? | 2010/03/22 | [
"https://Stackoverflow.com/questions/2494862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/257569/"
] | Answered here I believe: [Get std::fstream failure error messages and/or exceptions](https://stackoverflow.com/questions/839644/get-stdfstream-failure-error-messages-and-or-exceptions) | The STL is not great at reporting errors. Here's the best you can do within the standard:
```
ifstream initFile;
initFile.exceptions(ifstream::eofbit|ifstream::failbit|ifstream::badbit);
try
{
initFile.open("D:\\InitTLM.csv");
// Process File
}
catch(ifstream::failure e)
{
cout ... |
2,494,862 | I have the following code:
```
ifstream initFile;
initFile.open("D:\\InitTLM.csv");
if(initFile.is_open())
{
// Process file
}
```
The file is not opening. The file does exist on the D: drive. Is there a way to find out exactly why this file cannot be found? Like an "errno"? | 2010/03/22 | [
"https://Stackoverflow.com/questions/2494862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/257569/"
] | You should be able to use your OS's underlying error reporting mechanism to get the reason (because the standard library is built on the OS primitives). The code won't be portable, but it should get you to the bottom of your issue.
Since you appear to be using Windows, you would use [GetLastError](http://msdn.microsof... | Answered here I believe: [Get std::fstream failure error messages and/or exceptions](https://stackoverflow.com/questions/839644/get-stdfstream-failure-error-messages-and-or-exceptions) |
2,494,862 | I have the following code:
```
ifstream initFile;
initFile.open("D:\\InitTLM.csv");
if(initFile.is_open())
{
// Process file
}
```
The file is not opening. The file does exist on the D: drive. Is there a way to find out exactly why this file cannot be found? Like an "errno"? | 2010/03/22 | [
"https://Stackoverflow.com/questions/2494862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/257569/"
] | Answered here I believe: [Get std::fstream failure error messages and/or exceptions](https://stackoverflow.com/questions/839644/get-stdfstream-failure-error-messages-and-or-exceptions) | Check the permissions on the root of the D: drive. You may find that your compiled executable, or the service under which your debugger is running, does not have sufficient access privileges to open that file.
Try changing the permissions on the D:\ root directory temporarily to "Everyone --> Full Control", and see if... |
2,494,862 | I have the following code:
```
ifstream initFile;
initFile.open("D:\\InitTLM.csv");
if(initFile.is_open())
{
// Process file
}
```
The file is not opening. The file does exist on the D: drive. Is there a way to find out exactly why this file cannot be found? Like an "errno"? | 2010/03/22 | [
"https://Stackoverflow.com/questions/2494862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/257569/"
] | You should be able to use your OS's underlying error reporting mechanism to get the reason (because the standard library is built on the OS primitives). The code won't be portable, but it should get you to the bottom of your issue.
Since you appear to be using Windows, you would use [GetLastError](http://msdn.microsof... | The STL is not great at reporting errors. Here's the best you can do within the standard:
```
ifstream initFile;
initFile.exceptions(ifstream::eofbit|ifstream::failbit|ifstream::badbit);
try
{
initFile.open("D:\\InitTLM.csv");
// Process File
}
catch(ifstream::failure e)
{
cout ... |
2,494,862 | I have the following code:
```
ifstream initFile;
initFile.open("D:\\InitTLM.csv");
if(initFile.is_open())
{
// Process file
}
```
The file is not opening. The file does exist on the D: drive. Is there a way to find out exactly why this file cannot be found? Like an "errno"? | 2010/03/22 | [
"https://Stackoverflow.com/questions/2494862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/257569/"
] | You should be able to use your OS's underlying error reporting mechanism to get the reason (because the standard library is built on the OS primitives). The code won't be portable, but it should get you to the bottom of your issue.
Since you appear to be using Windows, you would use [GetLastError](http://msdn.microsof... | Check the permissions on the root of the D: drive. You may find that your compiled executable, or the service under which your debugger is running, does not have sufficient access privileges to open that file.
Try changing the permissions on the D:\ root directory temporarily to "Everyone --> Full Control", and see if... |
53,060,993 | We have a large app built on `Laravel 5.1` and `October CMS`. Right now we are trying to get rid of october, but we are facing some problems. We managed to remove all october's dependencies, including those in `Application`, but there is something strange going on.
When I try to run the app, i.e. run `php artisan tink... | 2018/10/30 | [
"https://Stackoverflow.com/questions/53060993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177167/"
] | You're using relative path. While running a python project, the present working directory is considered to be the directory of the file you run.
So, when you run `process_json.py` directly, it searches `data/cities` in `project/plugins/plugin_one`, and when you import `process_json.py` in `test1.py`, it searches `data... | If you want a path relative to process\_json.py, you could use the **file** attribute of that module, and build the path from there:
```
# process_json.py
import os
datadir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data', 'cities')
```
Of course, you may also consider moving your data directory so... |
4,172,306 | I would like to hide a piece of Javascript from my source code. Ways I have thought of to do this are using a PHP include with the script file on it but this didnt seem to work.
Does anyone have any suggestions for me?
If you need a copy of my script just ask.
Thanks in advance,
Callum | 2010/11/13 | [
"https://Stackoverflow.com/questions/4172306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/506399/"
] | You can't prevent a user from seeing your JavaScript source...no matter how you deliver it. Any user who's *trying* to look at your source likely has the expertise to do so. You're delivering a script to the client to run, so whether it's in the page, included in the page, AJAX fetched or packed, it doesn't matter, it'... | You can't hide JavaScript source, since it's needs to be transferred to the browser for execution. What you can do is obfuscate your code by using a compressor. I believe jQuery uses Google's [Closure compiler](http://googlecode.blogspot.com/2009/11/introducing-closure-tools.html). |
4,172,306 | I would like to hide a piece of Javascript from my source code. Ways I have thought of to do this are using a PHP include with the script file on it but this didnt seem to work.
Does anyone have any suggestions for me?
If you need a copy of my script just ask.
Thanks in advance,
Callum | 2010/11/13 | [
"https://Stackoverflow.com/questions/4172306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/506399/"
] | You can't prevent a user from seeing your JavaScript source...no matter how you deliver it. Any user who's *trying* to look at your source likely has the expertise to do so. You're delivering a script to the client to run, so whether it's in the page, included in the page, AJAX fetched or packed, it doesn't matter, it'... | Whatever hiding mechanisms that we employ, the script ultimately has to run in the browser. Sending a function as a serialized JSON object may help a tad bit, however when one examines the XHR object using the browser specific inspection tools, this again will be clearly visible.
[Here](http://tallymobile.com/test3.ht... |
4,172,306 | I would like to hide a piece of Javascript from my source code. Ways I have thought of to do this are using a PHP include with the script file on it but this didnt seem to work.
Does anyone have any suggestions for me?
If you need a copy of my script just ask.
Thanks in advance,
Callum | 2010/11/13 | [
"https://Stackoverflow.com/questions/4172306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/506399/"
] | You can't prevent a user from seeing your JavaScript source...no matter how you deliver it. Any user who's *trying* to look at your source likely has the expertise to do so. You're delivering a script to the client to run, so whether it's in the page, included in the page, AJAX fetched or packed, it doesn't matter, it'... | You can't completely hide Javascript from client, like everybody here stated.
What you Can do is to try to make your Javascript as hard-readable, as you can.
One way of doing this is to [obfuscate](http://javascriptobfuscator.com/default.aspx) it. Before obfuscating, name your functions and variables randomly, so th... |
4,172,306 | I would like to hide a piece of Javascript from my source code. Ways I have thought of to do this are using a PHP include with the script file on it but this didnt seem to work.
Does anyone have any suggestions for me?
If you need a copy of my script just ask.
Thanks in advance,
Callum | 2010/11/13 | [
"https://Stackoverflow.com/questions/4172306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/506399/"
] | You can't prevent a user from seeing your JavaScript source...no matter how you deliver it. Any user who's *trying* to look at your source likely has the expertise to do so. You're delivering a script to the client to run, so whether it's in the page, included in the page, AJAX fetched or packed, it doesn't matter, it'... | I think the best you could do is 1) put it into a separate .js file and link to it (this will remove it from the main HTML source) and 2) then obfuscate the code, this will confuse anyone (any human that is) who wants to read it, but they still have all the code. Since JavaScript is run client-side a copy of the script... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.