qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
1,118,375 | I want to set the border of a table to be "1px solid black" except on the bottom, where I want to use an image which provides a pointer into the link - as a visual aid.
Is it possible to set an image as the bottom border when the other borders are regular css. | 2009/07/13 | [
"https://Stackoverflow.com/questions/1118375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69803/"
] | Now there is **CSS3** and a `border-image` property for that, but still it does not work for all browsers.
OK, let's there be a [W3Schools link](http://www.w3schools.com/cssref/css3_pr_border-image.asp) on this topic. | No. Why don't you try another table row for that purpose? |
1,118,375 | I want to set the border of a table to be "1px solid black" except on the bottom, where I want to use an image which provides a pointer into the link - as a visual aid.
Is it possible to set an image as the bottom border when the other borders are regular css. | 2009/07/13 | [
"https://Stackoverflow.com/questions/1118375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69803/"
] | Try putting a below your table then set his style like
```
.bottomborder {
height:1px;
background-image:url("yourImage.png");
}
```
Should work good.
Edit : and of course border-top, left, right for your table a "solid 1px black" | You can set the borders like that except the bottom border :
```
border-top:1px solid black;
border-right:1px solid black;
border-left:1px solid black;
```
For the bottom border, you can set your image as background of a row maybe. |
1,118,375 | I want to set the border of a table to be "1px solid black" except on the bottom, where I want to use an image which provides a pointer into the link - as a visual aid.
Is it possible to set an image as the bottom border when the other borders are regular css. | 2009/07/13 | [
"https://Stackoverflow.com/questions/1118375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69803/"
] | Try putting the table inside `<div class="myTableContainer"></div>` and then:
```
.myTableContainer{
padding-bottom: 1px;
background: url(myBorderImage.png) bottom left;
}
```
This should work well across all browsers. | No. Why don't you try another table row for that purpose? |
1,118,375 | I want to set the border of a table to be "1px solid black" except on the bottom, where I want to use an image which provides a pointer into the link - as a visual aid.
Is it possible to set an image as the bottom border when the other borders are regular css. | 2009/07/13 | [
"https://Stackoverflow.com/questions/1118375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69803/"
] | CSS3 has added support for border-image. You can find more information at <http://www.w3.org/TR/css3-background/#border-images>. At this point (early 2012), it's probably not safe to use due to lack of support in all versions of IE. To track when it is safe to use you can visit <http://caniuse.com/#search=border-image>... | You can set the borders like that except the bottom border :
```
border-top:1px solid black;
border-right:1px solid black;
border-left:1px solid black;
```
For the bottom border, you can set your image as background of a row maybe. |
1,118,375 | I want to set the border of a table to be "1px solid black" except on the bottom, where I want to use an image which provides a pointer into the link - as a visual aid.
Is it possible to set an image as the bottom border when the other borders are regular css. | 2009/07/13 | [
"https://Stackoverflow.com/questions/1118375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69803/"
] | Now there is **CSS3** and a `border-image` property for that, but still it does not work for all browsers.
OK, let's there be a [W3Schools link](http://www.w3schools.com/cssref/css3_pr_border-image.asp) on this topic. | You can set the borders like that except the bottom border :
```
border-top:1px solid black;
border-right:1px solid black;
border-left:1px solid black;
```
For the bottom border, you can set your image as background of a row maybe. |
1,925,781 | Let $p$ be a power series with integer coefficients of the special form $p(z)=z+a\_2z^2+a\_3z^3+..$. I wonder if the inverse (composition not $1/p$) series has again integer coefficients.
I have calculated some of such series so I guess yes. What do you think? | 2016/09/13 | [
"https://math.stackexchange.com/questions/1925781",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | Given
$$
f(x)=x+a\_2x^2+a\_3x^3+\dots\tag{1}
$$
and
$$
g(x)=x+b\_2x^2+b\_3x^3+\dots\tag{2}
$$
formally, for $n\ge2$, the coefficient of $x^n$ in $g\circ f$ is
$$
0=a\_n+b\_n+\left[x^n\right]\sum\_{k=2}^{n-1}b\_k\left(x+a\_2x^2+a\_3x^3+\dots+a\_{n-1}x^{n-1}\right)^k\tag{3}
$$
For $n=2$, $(3)$ says that $b\_2=-a\_2$. The... | Yes it is correct, either you assume
1) the original series converges in some where as a Taylor series; or
2) just "formal" calculations.
The key is you can list out a series of equations
b\_1a\_1=1
b\_n + b\_{n-1}a\_1 + .. = 0 (n>1)
And you can decide one by one b\_n. |
11,209,643 | There are a lot of ways to replace many characters with one.
```
s/a\{100\}/a/
```
Is there any way to replace it vice versa (one `a` with hundred `a`) without typing `a` 100 times?
ps. I use regexes in `sed`. | 2012/06/26 | [
"https://Stackoverflow.com/questions/11209643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1466222/"
] | How about:
```
sed ':x;/a\{100\}/b;s/a/aa/;tx'
``` | Not exactly as terse as you would like, but you could do something like this:
```
sed -e 's/a/aaaaaaaaaa/' -e 's/\(aaaaaaaaaa\)/\1\1\1\1\1\1\1\1\1\1/'
```
Basically replace the original `a` with 10 of them, then replace the sequence of 10 with 10 copies. For numbers other than 100, obviously, you'd factor it differe... |
715,830 | If you divide the polynomial $p(x)$ by $x-1$ the remainder is $2$.
If you divide $p(x)$ by $x-2$ the remainder is $1$.
Which is the remainder of $\dfrac{p(x)}{(x-1)(x-2)}$? | 2014/03/17 | [
"https://math.stackexchange.com/questions/715830",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/136081/"
] | **Hint:** Let $P(x)=(x-1)(x-2)Q(x)+ax+b$. You know $P(1)$ and $P(2)$. | Given information:
$$\frac{P(x)}{x-1} \ \text{has remainder $2$}$$
$$\frac{P(x)}{x-2} \ \text{has remainder $1$}$$
We need to find the remainder of:
$$\frac{P(x)}{(x-1)(x-2)}$$
---
Remainder theorem:
$$\dfrac{P(x)}{D(x)}=Q(x)D(x)+R(x)$$
Where $P(x)$ is the dividend, $D(x)$ is the divisor, $Q(x)$ is the quotient and $... |
715,830 | If you divide the polynomial $p(x)$ by $x-1$ the remainder is $2$.
If you divide $p(x)$ by $x-2$ the remainder is $1$.
Which is the remainder of $\dfrac{p(x)}{(x-1)(x-2)}$? | 2014/03/17 | [
"https://math.stackexchange.com/questions/715830",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/136081/"
] | **Hint:** Let $P(x)=(x-1)(x-2)Q(x)+ax+b$. You know $P(1)$ and $P(2)$. | It's a simple case of the Chinese Remainder Theorem where the moduli $\,m,\, m\!+\!1\,$ differ by $1.\,$
$${\rm mod}\ (m,m\!+\!1)\!:\ \ \begin{array}{} m\!+\!1\equiv (1,0)\\
\ \ {-}m\equiv (0,1)\end{array}\ \Rightarrow\,\begin{eqnarray}(a,b) &\equiv& a(1,0)+b(0,1)\\ &\equiv& a(m\!+\!1)-bm\end{eqnarray}\qquad\ $$
In ... |
715,830 | If you divide the polynomial $p(x)$ by $x-1$ the remainder is $2$.
If you divide $p(x)$ by $x-2$ the remainder is $1$.
Which is the remainder of $\dfrac{p(x)}{(x-1)(x-2)}$? | 2014/03/17 | [
"https://math.stackexchange.com/questions/715830",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/136081/"
] | Given information:
$$\frac{P(x)}{x-1} \ \text{has remainder $2$}$$
$$\frac{P(x)}{x-2} \ \text{has remainder $1$}$$
We need to find the remainder of:
$$\frac{P(x)}{(x-1)(x-2)}$$
---
Remainder theorem:
$$\dfrac{P(x)}{D(x)}=Q(x)D(x)+R(x)$$
Where $P(x)$ is the dividend, $D(x)$ is the divisor, $Q(x)$ is the quotient and $... | It's a simple case of the Chinese Remainder Theorem where the moduli $\,m,\, m\!+\!1\,$ differ by $1.\,$
$${\rm mod}\ (m,m\!+\!1)\!:\ \ \begin{array}{} m\!+\!1\equiv (1,0)\\
\ \ {-}m\equiv (0,1)\end{array}\ \Rightarrow\,\begin{eqnarray}(a,b) &\equiv& a(1,0)+b(0,1)\\ &\equiv& a(m\!+\!1)-bm\end{eqnarray}\qquad\ $$
In ... |
72,806,671 | I am using apache kafka in 1st server and apache zookeeper in 2nd server.
I want to have kafka connect service in other server.Is it possible to use a standalone service. I need to have apache kafka connect or confluent kafka connect | 2022/06/29 | [
"https://Stackoverflow.com/questions/72806671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16101004/"
] | To filter the dataframe, we can count the not nan value along columns
```py
cols = ['pass', 'shoot', 'flick', 'through-ball']
filtered = df[df[cols].notna().sum(axis=1).eq(1)]
```
```
print(filtered)
index id pass shoot flick through-ball
0 22450 123 NaN NaN NaN 600.0
1 22451 6565 ... | We can filter it
```
df = df[df.notna().sum(1)==3]
Out[262]:
index id pass shoot flick through-ball
0 22450 123 NaN NaN NaN 600.0
1 22451 6565 NaN NaN NaN 625.0
3 22453 101 NaN NaN 119.0 NaN
```
Then `count`
```
df.drop(['index', 'id'],axis=1).count... |
72,806,671 | I am using apache kafka in 1st server and apache zookeeper in 2nd server.
I want to have kafka connect service in other server.Is it possible to use a standalone service. I need to have apache kafka connect or confluent kafka connect | 2022/06/29 | [
"https://Stackoverflow.com/questions/72806671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16101004/"
] | ```
df.set_index(['index', 'id'], inplace=True)
out = df[df.count(axis=1).eq(1)]
print(out)
counts = out.count().reset_index(name='unique_count').rename(columns={'index':'actions'})
print(counts)
```
output:
```
pass shoot flick through-ball
index id
22450 123 NaN NaN NaN 600.0
22451... | We can filter it
```
df = df[df.notna().sum(1)==3]
Out[262]:
index id pass shoot flick through-ball
0 22450 123 NaN NaN NaN 600.0
1 22451 6565 NaN NaN NaN 625.0
3 22453 101 NaN NaN 119.0 NaN
```
Then `count`
```
df.drop(['index', 'id'],axis=1).count... |
72,806,671 | I am using apache kafka in 1st server and apache zookeeper in 2nd server.
I want to have kafka connect service in other server.Is it possible to use a standalone service. I need to have apache kafka connect or confluent kafka connect | 2022/06/29 | [
"https://Stackoverflow.com/questions/72806671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16101004/"
] | ```
df.set_index(['index', 'id'], inplace=True)
out = df[df.count(axis=1).eq(1)]
print(out)
counts = out.count().reset_index(name='unique_count').rename(columns={'index':'actions'})
print(counts)
```
output:
```
pass shoot flick through-ball
index id
22450 123 NaN NaN NaN 600.0
22451... | To filter the dataframe, we can count the not nan value along columns
```py
cols = ['pass', 'shoot', 'flick', 'through-ball']
filtered = df[df[cols].notna().sum(axis=1).eq(1)]
```
```
print(filtered)
index id pass shoot flick through-ball
0 22450 123 NaN NaN NaN 600.0
1 22451 6565 ... |
16,948,064 | First of all, I know this question is all over this site but I have looked at almost all of them and can't seem to find out what is wrong. This is in VS 2012. Thanks.
```
//Socket.h
#pragma once
#include <iostream>
#include <WinSock2.h>
using namespace std;
const int STRLEN = 256;
class Socket
{
protected:
... | 2013/06/05 | [
"https://Stackoverflow.com/questions/16948064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808640/"
] | The problem is you are not linking against the Ws2\_32.lib library. To fix this you can add that to your additional dependencies tab of linker/Input settings for your project. Alternatively (as pointed out by SChepurin in the comments) you can add
```
#pragma comment(lib, "Ws2_32.lib")
```
to a source file of your ... | Add `runtimeobject.lib` to the linker *Additional Dependencies* (in the project property page, under *Linker*->*Input*). |
16,948,064 | First of all, I know this question is all over this site but I have looked at almost all of them and can't seem to find out what is wrong. This is in VS 2012. Thanks.
```
//Socket.h
#pragma once
#include <iostream>
#include <WinSock2.h>
using namespace std;
const int STRLEN = 256;
class Socket
{
protected:
... | 2013/06/05 | [
"https://Stackoverflow.com/questions/16948064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808640/"
] | The problem is you are not linking against the Ws2\_32.lib library. To fix this you can add that to your additional dependencies tab of linker/Input settings for your project. Alternatively (as pointed out by SChepurin in the comments) you can add
```
#pragma comment(lib, "Ws2_32.lib")
```
to a source file of your ... | Another way is that click right in your project in visual studio and go to following path and add "Ws2\_32.lib" in that.
Linker>Input> Additional Dependencies
 |
16,948,064 | First of all, I know this question is all over this site but I have looked at almost all of them and can't seem to find out what is wrong. This is in VS 2012. Thanks.
```
//Socket.h
#pragma once
#include <iostream>
#include <WinSock2.h>
using namespace std;
const int STRLEN = 256;
class Socket
{
protected:
... | 2013/06/05 | [
"https://Stackoverflow.com/questions/16948064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808640/"
] | The problem is you are not linking against the Ws2\_32.lib library. To fix this you can add that to your additional dependencies tab of linker/Input settings for your project. Alternatively (as pointed out by SChepurin in the comments) you can add
```
#pragma comment(lib, "Ws2_32.lib")
```
to a source file of your ... | Even though this is a linker error. the problem can also occur if you set wrong "***Runtime Library***" option in
**Properties > Configuration properties > C/C++ > Code Generation > Runtime Library**
both called binary and calling binary should have the same values
* if the property in the calling binary is **MTd**,... |
16,948,064 | First of all, I know this question is all over this site but I have looked at almost all of them and can't seem to find out what is wrong. This is in VS 2012. Thanks.
```
//Socket.h
#pragma once
#include <iostream>
#include <WinSock2.h>
using namespace std;
const int STRLEN = 256;
class Socket
{
protected:
... | 2013/06/05 | [
"https://Stackoverflow.com/questions/16948064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808640/"
] | Another way is that click right in your project in visual studio and go to following path and add "Ws2\_32.lib" in that.
Linker>Input> Additional Dependencies
 | Add `runtimeobject.lib` to the linker *Additional Dependencies* (in the project property page, under *Linker*->*Input*). |
16,948,064 | First of all, I know this question is all over this site but I have looked at almost all of them and can't seem to find out what is wrong. This is in VS 2012. Thanks.
```
//Socket.h
#pragma once
#include <iostream>
#include <WinSock2.h>
using namespace std;
const int STRLEN = 256;
class Socket
{
protected:
... | 2013/06/05 | [
"https://Stackoverflow.com/questions/16948064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808640/"
] | Add `runtimeobject.lib` to the linker *Additional Dependencies* (in the project property page, under *Linker*->*Input*). | Even though this is a linker error. the problem can also occur if you set wrong "***Runtime Library***" option in
**Properties > Configuration properties > C/C++ > Code Generation > Runtime Library**
both called binary and calling binary should have the same values
* if the property in the calling binary is **MTd**,... |
16,948,064 | First of all, I know this question is all over this site but I have looked at almost all of them and can't seem to find out what is wrong. This is in VS 2012. Thanks.
```
//Socket.h
#pragma once
#include <iostream>
#include <WinSock2.h>
using namespace std;
const int STRLEN = 256;
class Socket
{
protected:
... | 2013/06/05 | [
"https://Stackoverflow.com/questions/16948064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808640/"
] | Another way is that click right in your project in visual studio and go to following path and add "Ws2\_32.lib" in that.
Linker>Input> Additional Dependencies
 | Even though this is a linker error. the problem can also occur if you set wrong "***Runtime Library***" option in
**Properties > Configuration properties > C/C++ > Code Generation > Runtime Library**
both called binary and calling binary should have the same values
* if the property in the calling binary is **MTd**,... |
18,259,654 | I have one form, textarea & one button.
On button click I call one php function.
From that I call service to get data as per value inserted in textbox.
function code is
```
function fire_btn(btnvalue) {
if(btnvalue=="Create Widget") {
var dataString = $("form").serialize();
receiveReq.open("GET",... | 2013/08/15 | [
"https://Stackoverflow.com/questions/18259654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1498159/"
] | Use [`IF...ELSE`](http://technet.microsoft.com/en-us/library/ms182717.aspx) syntax for control flow:
```
DECLARE @myVar int;
SET @myVar = 1;
IF @myVar = 0
SELECT 0;
ELSE
SELECT GETDATE();
``` | Use IF not CASE if you want to have differnt select statments. IF is a control flow item, case is for picking alternatives from within a select only. |
18,259,654 | I have one form, textarea & one button.
On button click I call one php function.
From that I call service to get data as per value inserted in textbox.
function code is
```
function fire_btn(btnvalue) {
if(btnvalue=="Create Widget") {
var dataString = $("form").serialize();
receiveReq.open("GET",... | 2013/08/15 | [
"https://Stackoverflow.com/questions/18259654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1498159/"
] | Use IF not CASE if you want to have differnt select statments. IF is a control flow item, case is for picking alternatives from within a select only. | Use this format:
```
IF (@myVar = 0)
BEGIN
SELECT <something>
END
ELSE
BEGIN
SELECT <something else>
END
``` |
18,259,654 | I have one form, textarea & one button.
On button click I call one php function.
From that I call service to get data as per value inserted in textbox.
function code is
```
function fire_btn(btnvalue) {
if(btnvalue=="Create Widget") {
var dataString = $("form").serialize();
receiveReq.open("GET",... | 2013/08/15 | [
"https://Stackoverflow.com/questions/18259654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1498159/"
] | brother, for CASE function, it can only return single value such as string, in order to execute different query based on certain condition, if else will be the options.
```
DECLARE @myVar INT
SET @myVar = 1
IF @myVar = 0
SELECT '0 0'
ELSE
SELECT GETDATE()
``` | Use IF not CASE if you want to have differnt select statments. IF is a control flow item, case is for picking alternatives from within a select only. |
18,259,654 | I have one form, textarea & one button.
On button click I call one php function.
From that I call service to get data as per value inserted in textbox.
function code is
```
function fire_btn(btnvalue) {
if(btnvalue=="Create Widget") {
var dataString = $("form").serialize();
receiveReq.open("GET",... | 2013/08/15 | [
"https://Stackoverflow.com/questions/18259654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1498159/"
] | Use [`IF...ELSE`](http://technet.microsoft.com/en-us/library/ms182717.aspx) syntax for control flow:
```
DECLARE @myVar int;
SET @myVar = 1;
IF @myVar = 0
SELECT 0;
ELSE
SELECT GETDATE();
``` | I guess it should be
```
DECLARE @myVar int;
SET @myVar = 1;
IF @myVar = 0
SELECT 0;
ELSE
SELECT getDate();
```
And if you are just learning some syntax elements, you should also start right away to end every statement with a semicolon.
([When should I use semicolons in SQL Server?](https://stackoverflow.... |
18,259,654 | I have one form, textarea & one button.
On button click I call one php function.
From that I call service to get data as per value inserted in textbox.
function code is
```
function fire_btn(btnvalue) {
if(btnvalue=="Create Widget") {
var dataString = $("form").serialize();
receiveReq.open("GET",... | 2013/08/15 | [
"https://Stackoverflow.com/questions/18259654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1498159/"
] | Use [`IF...ELSE`](http://technet.microsoft.com/en-us/library/ms182717.aspx) syntax for control flow:
```
DECLARE @myVar int;
SET @myVar = 1;
IF @myVar = 0
SELECT 0;
ELSE
SELECT GETDATE();
``` | Use this format:
```
IF (@myVar = 0)
BEGIN
SELECT <something>
END
ELSE
BEGIN
SELECT <something else>
END
``` |
18,259,654 | I have one form, textarea & one button.
On button click I call one php function.
From that I call service to get data as per value inserted in textbox.
function code is
```
function fire_btn(btnvalue) {
if(btnvalue=="Create Widget") {
var dataString = $("form").serialize();
receiveReq.open("GET",... | 2013/08/15 | [
"https://Stackoverflow.com/questions/18259654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1498159/"
] | Use [`IF...ELSE`](http://technet.microsoft.com/en-us/library/ms182717.aspx) syntax for control flow:
```
DECLARE @myVar int;
SET @myVar = 1;
IF @myVar = 0
SELECT 0;
ELSE
SELECT GETDATE();
``` | brother, for CASE function, it can only return single value such as string, in order to execute different query based on certain condition, if else will be the options.
```
DECLARE @myVar INT
SET @myVar = 1
IF @myVar = 0
SELECT '0 0'
ELSE
SELECT GETDATE()
``` |
18,259,654 | I have one form, textarea & one button.
On button click I call one php function.
From that I call service to get data as per value inserted in textbox.
function code is
```
function fire_btn(btnvalue) {
if(btnvalue=="Create Widget") {
var dataString = $("form").serialize();
receiveReq.open("GET",... | 2013/08/15 | [
"https://Stackoverflow.com/questions/18259654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1498159/"
] | I guess it should be
```
DECLARE @myVar int;
SET @myVar = 1;
IF @myVar = 0
SELECT 0;
ELSE
SELECT getDate();
```
And if you are just learning some syntax elements, you should also start right away to end every statement with a semicolon.
([When should I use semicolons in SQL Server?](https://stackoverflow.... | Use this format:
```
IF (@myVar = 0)
BEGIN
SELECT <something>
END
ELSE
BEGIN
SELECT <something else>
END
``` |
18,259,654 | I have one form, textarea & one button.
On button click I call one php function.
From that I call service to get data as per value inserted in textbox.
function code is
```
function fire_btn(btnvalue) {
if(btnvalue=="Create Widget") {
var dataString = $("form").serialize();
receiveReq.open("GET",... | 2013/08/15 | [
"https://Stackoverflow.com/questions/18259654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1498159/"
] | brother, for CASE function, it can only return single value such as string, in order to execute different query based on certain condition, if else will be the options.
```
DECLARE @myVar INT
SET @myVar = 1
IF @myVar = 0
SELECT '0 0'
ELSE
SELECT GETDATE()
``` | I guess it should be
```
DECLARE @myVar int;
SET @myVar = 1;
IF @myVar = 0
SELECT 0;
ELSE
SELECT getDate();
```
And if you are just learning some syntax elements, you should also start right away to end every statement with a semicolon.
([When should I use semicolons in SQL Server?](https://stackoverflow.... |
18,259,654 | I have one form, textarea & one button.
On button click I call one php function.
From that I call service to get data as per value inserted in textbox.
function code is
```
function fire_btn(btnvalue) {
if(btnvalue=="Create Widget") {
var dataString = $("form").serialize();
receiveReq.open("GET",... | 2013/08/15 | [
"https://Stackoverflow.com/questions/18259654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1498159/"
] | brother, for CASE function, it can only return single value such as string, in order to execute different query based on certain condition, if else will be the options.
```
DECLARE @myVar INT
SET @myVar = 1
IF @myVar = 0
SELECT '0 0'
ELSE
SELECT GETDATE()
``` | Use this format:
```
IF (@myVar = 0)
BEGIN
SELECT <something>
END
ELSE
BEGIN
SELECT <something else>
END
``` |
146,319 | I'm designing a constant-current dummy load for testing my power supplies. This load should be able to handle a maximum of \$2\mathrm{A}\$ at \$24\mathrm{V}\$. My current design, so far, is loosely based on the design found at [EEVblog #102](http://www.eevblog.com/2010/08/01/eevblog-102-diy-constant-current-dummy-load-... | 2015/01/03 | [
"https://electronics.stackexchange.com/questions/146319",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/9402/"
] | Directly paralleling the transistors is a terrible idea- the threshold voltages of the MOSFETs will be different and one transistor will take much more current than the other- further you are only measuring one current so the total current may be greatly in error. It's worse than with BJTs.
Fortunately op-amps are che... | You are right to worry about that power level in an MTP3055, but it's nowhere near the limit of the package. For instance, the Vishay IRL540 is a TO220, and it's rated for 150 watts. You just need to make sure you've got a good heat sink. And by good heat sink I mean a big honker. No clip-on jobbers.
Assuming you stil... |
146,319 | I'm designing a constant-current dummy load for testing my power supplies. This load should be able to handle a maximum of \$2\mathrm{A}\$ at \$24\mathrm{V}\$. My current design, so far, is loosely based on the design found at [EEVblog #102](http://www.eevblog.com/2010/08/01/eevblog-102-diy-constant-current-dummy-load-... | 2015/01/03 | [
"https://electronics.stackexchange.com/questions/146319",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/9402/"
] | You are right to worry about that power level in an MTP3055, but it's nowhere near the limit of the package. For instance, the Vishay IRL540 is a TO220, and it's rated for 150 watts. You just need to make sure you've got a good heat sink. And by good heat sink I mean a big honker. No clip-on jobbers.
Assuming you stil... | I think you should parallel two resistors if 4ohms each if the resistance is your concern.
Since one MOSFET can handle up to 22W then from my little end, I feel you should use only one MOSFET and parralel the resistors then add a heat sink if possible (if you are creative enough to do that). |
146,319 | I'm designing a constant-current dummy load for testing my power supplies. This load should be able to handle a maximum of \$2\mathrm{A}\$ at \$24\mathrm{V}\$. My current design, so far, is loosely based on the design found at [EEVblog #102](http://www.eevblog.com/2010/08/01/eevblog-102-diy-constant-current-dummy-load-... | 2015/01/03 | [
"https://electronics.stackexchange.com/questions/146319",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/9402/"
] | Directly paralleling the transistors is a terrible idea- the threshold voltages of the MOSFETs will be different and one transistor will take much more current than the other- further you are only measuring one current so the total current may be greatly in error. It's worse than with BJTs.
Fortunately op-amps are che... | I would use a separate op-amp for each switch, each with its own resistor so that you have multiple independent current control loops in parallel. The general rule of thumb is it OK to use MOFSETs in parallel because as they heat up their on-resistance increases, and so they generally share current well, but this is fo... |
146,319 | I'm designing a constant-current dummy load for testing my power supplies. This load should be able to handle a maximum of \$2\mathrm{A}\$ at \$24\mathrm{V}\$. My current design, so far, is loosely based on the design found at [EEVblog #102](http://www.eevblog.com/2010/08/01/eevblog-102-diy-constant-current-dummy-load-... | 2015/01/03 | [
"https://electronics.stackexchange.com/questions/146319",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/9402/"
] | I would use a separate op-amp for each switch, each with its own resistor so that you have multiple independent current control loops in parallel. The general rule of thumb is it OK to use MOFSETs in parallel because as they heat up their on-resistance increases, and so they generally share current well, but this is fo... | I think you should parallel two resistors if 4ohms each if the resistance is your concern.
Since one MOSFET can handle up to 22W then from my little end, I feel you should use only one MOSFET and parralel the resistors then add a heat sink if possible (if you are creative enough to do that). |
146,319 | I'm designing a constant-current dummy load for testing my power supplies. This load should be able to handle a maximum of \$2\mathrm{A}\$ at \$24\mathrm{V}\$. My current design, so far, is loosely based on the design found at [EEVblog #102](http://www.eevblog.com/2010/08/01/eevblog-102-diy-constant-current-dummy-load-... | 2015/01/03 | [
"https://electronics.stackexchange.com/questions/146319",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/9402/"
] | Directly paralleling the transistors is a terrible idea- the threshold voltages of the MOSFETs will be different and one transistor will take much more current than the other- further you are only measuring one current so the total current may be greatly in error. It's worse than with BJTs.
Fortunately op-amps are che... | The datasheet for the power transistors states the threshold voltage varies @Troom from 2V up to 4V.
If you plan to sink 2A (1A per transistor) and you use 2 Ohm sense resistors, the voltage accross these would be 2V. In worst case this means one transistor will conduct more than the other.
You can do several things:... |
146,319 | I'm designing a constant-current dummy load for testing my power supplies. This load should be able to handle a maximum of \$2\mathrm{A}\$ at \$24\mathrm{V}\$. My current design, so far, is loosely based on the design found at [EEVblog #102](http://www.eevblog.com/2010/08/01/eevblog-102-diy-constant-current-dummy-load-... | 2015/01/03 | [
"https://electronics.stackexchange.com/questions/146319",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/9402/"
] | Directly paralleling the transistors is a terrible idea- the threshold voltages of the MOSFETs will be different and one transistor will take much more current than the other- further you are only measuring one current so the total current may be greatly in error. It's worse than with BJTs.
Fortunately op-amps are che... | I think you should parallel two resistors if 4ohms each if the resistance is your concern.
Since one MOSFET can handle up to 22W then from my little end, I feel you should use only one MOSFET and parralel the resistors then add a heat sink if possible (if you are creative enough to do that). |
146,319 | I'm designing a constant-current dummy load for testing my power supplies. This load should be able to handle a maximum of \$2\mathrm{A}\$ at \$24\mathrm{V}\$. My current design, so far, is loosely based on the design found at [EEVblog #102](http://www.eevblog.com/2010/08/01/eevblog-102-diy-constant-current-dummy-load-... | 2015/01/03 | [
"https://electronics.stackexchange.com/questions/146319",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/9402/"
] | The datasheet for the power transistors states the threshold voltage varies @Troom from 2V up to 4V.
If you plan to sink 2A (1A per transistor) and you use 2 Ohm sense resistors, the voltage accross these would be 2V. In worst case this means one transistor will conduct more than the other.
You can do several things:... | I think you should parallel two resistors if 4ohms each if the resistance is your concern.
Since one MOSFET can handle up to 22W then from my little end, I feel you should use only one MOSFET and parralel the resistors then add a heat sink if possible (if you are creative enough to do that). |
1,897 | It can be a chore to figure out what is going on in code when all the variables/methods/function/etc. are in another language, like in [this question](https://codereview.stackexchange.com/q/51213/18427). Or [this one.](https://codereview.stackexchange.com/q/43290)
How should we approach this? I don't see an easy way f... | 2014/05/20 | [
"https://codereview.meta.stackexchange.com/questions/1897",
"https://codereview.meta.stackexchange.com",
"https://codereview.meta.stackexchange.com/users/18427/"
] | As much as it is disappointing, and discriminatory, etc.... StackExchange has a broadly applied Primarily-English slant:
>
> Since this came up on meta, here’s our official policy towards
> non-English questions on Stack Overflow, Server Fault, and Super User.
>
>
> (note that I say “programming” below, but this p... | Limiting Code Review to English-fluent users reduces diversity and hurts the site, in my opinion. As long as the English in the question is clear enough, it's fine.
Deal with it just like any other question. If the foreign-language comments or identifiers bother you, you can
* mention it as a problem in your review
*... |
69,739,748 | With this definition
```c
struct A {
int x;
};
```
why is
```c
struct A a = {0};
```
valid syntax while
```c
struct A a;
a = {0};
```
produces the error, "expected expression before '{' token"?
If I replace that line with
```c
a = (struct A){0};
```
then everything is fine so it's not a problem with a... | 2021/10/27 | [
"https://Stackoverflow.com/questions/69739748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8075540/"
] | The curly brace syntax `{}` designates an initializer list, and such a list can only be used in an initialization.
In this case:
```
struct A a = {0};
```
`a` is being declared and initialized with `{0}` and is valid syntax.
This is not valid:
```
a = {0};
```
Because this is an expression an initializer list c... | You can only use initializers in a declaration, so statement `a = {0};` is invalid.
In statement `a = (struct A){0};` you are actually assigning using a compound literal expression, which is valid. |
27,963,946 | I have a create criteria using multiple params with pagination.
The issue that I´m having that if is possible to re-use the code inside the and for others create-criteria totally differents, witouth having to duplicate the code.
I reffer that if I have the cases createcriteria and want to do the same "filters" on the c... | 2015/01/15 | [
"https://Stackoverflow.com/questions/27963946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2533880/"
] | I'm not sure what you mean when you say "unify both createCriteria is not an option", especially considering in the code above you are executing the exact same query twice and ending up with two lists containing the same rows.
One way to reuse your criteria is to just define the criteria as a seperate closure, and pas... | You can do this by using named query :
have look to documentation .[namedQueries](http://grails.org/doc/2.4.x/ref/Domain%20Classes/namedQueries.html) |
27,963,946 | I have a create criteria using multiple params with pagination.
The issue that I´m having that if is possible to re-use the code inside the and for others create-criteria totally differents, witouth having to duplicate the code.
I reffer that if I have the cases createcriteria and want to do the same "filters" on the c... | 2015/01/15 | [
"https://Stackoverflow.com/questions/27963946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2533880/"
] | I'm not sure what you mean when you say "unify both createCriteria is not an option", especially considering in the code above you are executing the exact same query twice and ending up with two lists containing the same rows.
One way to reuse your criteria is to just define the criteria as a seperate closure, and pas... | I'd use ["where" queries](http://grails.org/doc/latest/guide/GORM.html#whereQueries), which use `DetachedCriteria` under the hood, or [`DetachedCriteria` directly](http://grails.org/doc/latest/guide/GORM.html#detachedCriteria). where queries don't run until you call `list`/`get`/`count`/`exists`/`deleteAll`/`updateAll`... |
12,161,374 | I have a file which looks like:
```
uniprotkb:Q9VNB0|intact:EBI-102551 uniprotkb:A1ZBG6|intact:EBI-195768
uniprotkb:P91682|intact:EBI-142245 uniprotkb:Q24117|intact:EBI-156442
uniprotkb:P92177-3|intact:EBI-204491 uniprotkb:Q9VDK2|intact:EBI-87444
```
and I wish to extract strings between `:` and `|` separato... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12161374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1630510/"
] | The expression you give is too greedy and thus consumes more characters than you wanted. The following expression works on your sample data set:
```
perl -l -ne '/:([^|]*)\|.*:([^|]*)\|/ and print($1,"\t",$2)'
```
It anchors the search with explicit matches for something between a `":"` and `"|"` pair. If your data ... | Try `m/: ( [^:|]+ ) \| .+ : ( [^:|]+ ) \| /x` instead. |
12,161,374 | I have a file which looks like:
```
uniprotkb:Q9VNB0|intact:EBI-102551 uniprotkb:A1ZBG6|intact:EBI-195768
uniprotkb:P91682|intact:EBI-142245 uniprotkb:Q24117|intact:EBI-156442
uniprotkb:P92177-3|intact:EBI-204491 uniprotkb:Q9VDK2|intact:EBI-87444
```
and I wish to extract strings between `:` and `|` separato... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12161374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1630510/"
] | The expression you give is too greedy and thus consumes more characters than you wanted. The following expression works on your sample data set:
```
perl -l -ne '/:([^|]*)\|.*:([^|]*)\|/ and print($1,"\t",$2)'
```
It anchors the search with explicit matches for something between a `":"` and `"|"` pair. If your data ... | A fix could be to use a greeding expression between the first string and the second one. With `.*` it goes until the end and begins to backtrack searching for the last colon followed by a pipe.
```
perl -l -ne '/:([^|]*).*:([^|]*)\|/ and print($1,"\t",$2)' <file>
```
Output:
```
Q9VNB0 A1ZBG6
P91682 Q24117
P92177... |
12,161,374 | I have a file which looks like:
```
uniprotkb:Q9VNB0|intact:EBI-102551 uniprotkb:A1ZBG6|intact:EBI-195768
uniprotkb:P91682|intact:EBI-142245 uniprotkb:Q24117|intact:EBI-156442
uniprotkb:P92177-3|intact:EBI-204491 uniprotkb:Q9VDK2|intact:EBI-87444
```
and I wish to extract strings between `:` and `|` separato... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12161374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1630510/"
] | The expression you give is too greedy and thus consumes more characters than you wanted. The following expression works on your sample data set:
```
perl -l -ne '/:([^|]*)\|.*:([^|]*)\|/ and print($1,"\t",$2)'
```
It anchors the search with explicit matches for something between a `":"` and `"|"` pair. If your data ... | See it **[in action](http://regexr.com?31vj7)**:
```
:([\w\-]*?)\|
```
**[Another](http://regexr.com?31vja)** method:
```
:(\S*?)\|
``` |
12,161,374 | I have a file which looks like:
```
uniprotkb:Q9VNB0|intact:EBI-102551 uniprotkb:A1ZBG6|intact:EBI-195768
uniprotkb:P91682|intact:EBI-142245 uniprotkb:Q24117|intact:EBI-156442
uniprotkb:P92177-3|intact:EBI-204491 uniprotkb:Q9VDK2|intact:EBI-87444
```
and I wish to extract strings between `:` and `|` separato... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12161374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1630510/"
] | The expression you give is too greedy and thus consumes more characters than you wanted. The following expression works on your sample data set:
```
perl -l -ne '/:([^|]*)\|.*:([^|]*)\|/ and print($1,"\t",$2)'
```
It anchors the search with explicit matches for something between a `":"` and `"|"` pair. If your data ... | The way you've specified it, it has to match that way. You want a single colon
followed by any number of non-pipe, followed by any number of non-colon.
```
single colon -> :
non-pipe -> Q9VNB0
non-colon -> |intact
colon -> :
non-pipe -> EBI-102551 uniprotkb:A1ZBG6
```
Instead I make a space the... |
12,161,374 | I have a file which looks like:
```
uniprotkb:Q9VNB0|intact:EBI-102551 uniprotkb:A1ZBG6|intact:EBI-195768
uniprotkb:P91682|intact:EBI-142245 uniprotkb:Q24117|intact:EBI-156442
uniprotkb:P92177-3|intact:EBI-204491 uniprotkb:Q9VDK2|intact:EBI-87444
```
and I wish to extract strings between `:` and `|` separato... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12161374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1630510/"
] | The expression you give is too greedy and thus consumes more characters than you wanted. The following expression works on your sample data set:
```
perl -l -ne '/:([^|]*)\|.*:([^|]*)\|/ and print($1,"\t",$2)'
```
It anchors the search with explicit matches for something between a `":"` and `"|"` pair. If your data ... | ```
perl -nle'print "$1\t$2" if /:([^|]*)\S*\s[^:]*:([^|]*)/'
```
Or with 5.10+:
```
perl -nE'say "$1\t$2" if /:([^|]*)\S*\s[^:]*:([^|]*)/'
```
Explanation:
```
: Matches the start of the first "word".
([^|]*) Matches the desired part of the first "word".
\S* Matches the end of the first "word"... |
12,161,374 | I have a file which looks like:
```
uniprotkb:Q9VNB0|intact:EBI-102551 uniprotkb:A1ZBG6|intact:EBI-195768
uniprotkb:P91682|intact:EBI-142245 uniprotkb:Q24117|intact:EBI-156442
uniprotkb:P92177-3|intact:EBI-204491 uniprotkb:Q9VDK2|intact:EBI-87444
```
and I wish to extract strings between `:` and `|` separato... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12161374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1630510/"
] | The expression you give is too greedy and thus consumes more characters than you wanted. The following expression works on your sample data set:
```
perl -l -ne '/:([^|]*)\|.*:([^|]*)\|/ and print($1,"\t",$2)'
```
It anchors the search with explicit matches for something between a `":"` and `"|"` pair. If your data ... | Why do you not want to use the `split` function. On the face of it this would be easily solved by writing
```
my @fields = map /:([^|]+)/, split
```
I am not sure how your regex is supposed to work. Using the `/x` modifier to allow non-significant whitespace it looks like this
```
/ : ([^|]*)? [^:]* : ([^|]*) /x
`... |
20,898,772 | I have a singleton name `CoreDataManager` which register the `mergeContextChangesForNotification` in it:
```
+ (id) sharedManager{
static CoreDataManager *mSharedManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
mSharedManager = [[CoreDataManager alloc] init];
});
... | 2014/01/03 | [
"https://Stackoverflow.com/questions/20898772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1564584/"
] | With the managed object concurrency types introduced in iOS 5/OS X 10.7 it is preferred
to use the `performBlock` methods to ensure that a Core Data operation is executed
on the right thread (more precisely: on the right queue).
So you would create the shared context with
```
shareContext = [[NSManagedObjectContext ... | Check [TopSongs](https://developer.apple.com/library/ios/samplecode/TopSongs/Introduction/Intro.html#//apple_ref/doc/uid/DTS40008925) sample application, keep in mind they are not perfect but most of the time may be used for reference. They are synchronizing `mergeChangesFromContextDidSaveNotification` calls to be made... |
9,696,145 | Can OCR detection be done in iphone? If so can anyone provide me links which help me in developing OCR recognition in iphone?
Thanks
Rakesh | 2012/03/14 | [
"https://Stackoverflow.com/questions/9696145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1042822/"
] | Try working out TesserAct api.its working very well. i have Send you a demo Application Link Below.
Sample Code Of the OCR .
<http://github.com/nolanbrown/Tesseract-iPhone-Demo>
Thanks
Parag | The Nolan Brown project which parag mentioned uses an earlier version of tesseract(I guess 2.04) and also incorporating it in your project is not easy as it might seem.
My advise is to use [3.0 version](http://code.google.com/p/tesseract-ocr/downloads/list) of tesseract and it also requires the [leptonica](http://www... |
38,751,051 | In our controller, we are trying to show a video series, which should return JSON similar to this:
```
{
id: 1,
name: "Series Name",
videos: [
id: 2,
name: "Video Name",
isInPlaylist: true,
isFavorite: false
]
}
```
We are adding the isInPlaylist and isInFavorite attribu... | 2016/08/03 | [
"https://Stackoverflow.com/questions/38751051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3287927/"
] | Wrapping the alias in double quotes preserves case-sensitivity.
`.select('foo as Bar') # => { bar: true }`
`.select('foo as "Bar"') # => { Bar: true }`
The change to lower case is not an issue with the Rails `.select()` method but is enforced by the DB, in our case PostgreSQL, and is a practice called "Folding". It... | I like you answer. The behaviour you see is rails default. As an alternative and
a more classic 'rails way' would be to use a json serializing library like [jBuilder](https://github.com/rails/jbuilder#faster-json-backends). It gives you lot more control over your API but your problem would be easy to fix in that using... |
38,751,051 | In our controller, we are trying to show a video series, which should return JSON similar to this:
```
{
id: 1,
name: "Series Name",
videos: [
id: 2,
name: "Video Name",
isInPlaylist: true,
isFavorite: false
]
}
```
We are adding the isInPlaylist and isInFavorite attribu... | 2016/08/03 | [
"https://Stackoverflow.com/questions/38751051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3287927/"
] | This is not a Rails behavior, but rather a SQL behavior. Alias's are folded to lower case unless explicitly quoted. For an example, here is the output of a simple query in psql (the Postgres CLI program).
```
=# select created_at as theTimeNow from users limit 5;
thetimenow
--------------------------... | Wrapping the alias in double quotes preserves case-sensitivity.
`.select('foo as Bar') # => { bar: true }`
`.select('foo as "Bar"') # => { Bar: true }`
The change to lower case is not an issue with the Rails `.select()` method but is enforced by the DB, in our case PostgreSQL, and is a practice called "Folding". It... |
38,751,051 | In our controller, we are trying to show a video series, which should return JSON similar to this:
```
{
id: 1,
name: "Series Name",
videos: [
id: 2,
name: "Video Name",
isInPlaylist: true,
isFavorite: false
]
}
```
We are adding the isInPlaylist and isInFavorite attribu... | 2016/08/03 | [
"https://Stackoverflow.com/questions/38751051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3287927/"
] | This is not a Rails behavior, but rather a SQL behavior. Alias's are folded to lower case unless explicitly quoted. For an example, here is the output of a simple query in psql (the Postgres CLI program).
```
=# select created_at as theTimeNow from users limit 5;
thetimenow
--------------------------... | I like you answer. The behaviour you see is rails default. As an alternative and
a more classic 'rails way' would be to use a json serializing library like [jBuilder](https://github.com/rails/jbuilder#faster-json-backends). It gives you lot more control over your API but your problem would be easy to fix in that using... |
37,401,372 | I'm making a game, where when a player steps outside the screen, the level starts. I wish to show an image of "LEVEL 1" before the game starts, yet the program shows the image too quickly. My framerate is at 60.
I am wondering if there is a way to delay time for about 5 seconds during the screen blitting but after it... | 2016/05/23 | [
"https://Stackoverflow.com/questions/37401372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6308337/"
] | You could set up a timer and keep track of the time. when the timer reaches the delay you want you can do something.
In the example below I set up the timer and I set the level1yay to true only once the timer has reached the delay value.
I added a condition canexit so the game doesn't terminate on the first loop. I a... | I don't know if this will really work, but you could try displaying the same image of "LEVEL 1" multiple times in a row, so it appears to stay around longer, but the program itself is never actually delayed. |
37,401,372 | I'm making a game, where when a player steps outside the screen, the level starts. I wish to show an image of "LEVEL 1" before the game starts, yet the program shows the image too quickly. My framerate is at 60.
I am wondering if there is a way to delay time for about 5 seconds during the screen blitting but after it... | 2016/05/23 | [
"https://Stackoverflow.com/questions/37401372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6308337/"
] | You could set up a timer and keep track of the time. when the timer reaches the delay you want you can do something.
In the example below I set up the timer and I set the level1yay to true only once the timer has reached the delay value.
I added a condition canexit so the game doesn't terminate on the first loop. I a... | `pygame.time.wait(5000)` is a delay of 5 seconds, 500 is half a second. You did set the level1 variable to True just before this code fragment, right? |
54,903,379 | It seems like it would be reasonable for the Typescript compiler to emit non-undefined & non-null checks into the resulting JS when using the non-null assertion operator. I.e.,:
```
function fun1(node: SomeType | undefined) {
fun2(node!);
}
```
should get converted to:
```
function fun1(node) {
if (node ==... | 2019/02/27 | [
"https://Stackoverflow.com/questions/54903379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1841545/"
] | The point of the non-null assertion operator is to tell the TypeScript compiler that you already know the variable is not null. Consider the following scenario:
```
function fun1(node: SomeType | undefined) {
throwIfUndefined(node);
node!.fun2();
}
```
You call a function which you know will throw an excepti... | That is type assertion, that means you tell the compiler that that variable is not null, not to ask the compiler to check that variable. Basically, your idea is possible, but throwing an error is not the purpose of type assertion. And that's the different between TypeScript and Javascript (type check and value check) |
12,234,118 | I've been developing Python server using SocketServer.TCPServer and SocketServer.BaseRequestHandler base classes. I'm using host "localhost" and port 2304 (not used by any other program).
The problem is that my server wont respond to remote request. I'm using Amazon AWS and have an static IP address for access.
When ... | 2012/09/02 | [
"https://Stackoverflow.com/questions/12234118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/733134/"
] | Of course it wont respond to remote requests, "localhost" means exactly what it says, it's the "local host". You have to bind to the external interface instead, or to the generic "catch-all" interface.
To bind to all interfaces use e.g.
```
self.m_pServer = CTSRSThreadedTCPServer(('', 2304), CTSRSThreadedTCPRequestHa... | Try listen at "127.0.0.1:2304":
self.m\_pServer = CTSRSThreadedTCPServer(("127.0.0.1", 2304), CTSRSThreadedTCPRequestHandler) |
11,606,847 | What is the use of width in the `printf()` statement? Why is the output 7 in the example below?
### Code
```
int add(int x, int y)
{
return printf("%*c%*c", x, '\r', y, '\r');
}
int main()
{
printf("Sum = %d", add(3, 4));
return 0;
}
```
### Output
>
> Sum = 7
>
>
> | 2012/07/23 | [
"https://Stackoverflow.com/questions/11606847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890623/"
] | `printf` returns the number of characters output. `%*c` means print a character and pad to the width specified by an argument. So `printf("%*c", 3, '\r')` means to print a carriage return with 2 spaces before it. `printf("%*c%*c", n, '\r', m, '\r')` therefore prints `n` + `m` characters - that's `n` - 1 spaces to pad t... | printf returns the number of characters printed. In this case you are printing 7 characters by specifying x and y as output lengths. If you change the return statement to:
```
return printf("%*c%*c\n", x, '\r', y, '\r');
```
The output will be 8, since a new line is also printed. |
11,606,847 | What is the use of width in the `printf()` statement? Why is the output 7 in the example below?
### Code
```
int add(int x, int y)
{
return printf("%*c%*c", x, '\r', y, '\r');
}
int main()
{
printf("Sum = %d", add(3, 4));
return 0;
}
```
### Output
>
> Sum = 7
>
>
> | 2012/07/23 | [
"https://Stackoverflow.com/questions/11606847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890623/"
] | Consulting any [manual](http://linux.die.net/man/3/printf) shows that `printf` returns the number of characters that were printed, excluding the null terminator. `%*c` takes *two* arguments, the first being the field width (which is thus respectively 3 and 4), and the second being the actual character printed. In this ... | printf returns the number of characters printed. In this case you are printing 7 characters by specifying x and y as output lengths. If you change the return statement to:
```
return printf("%*c%*c\n", x, '\r', y, '\r');
```
The output will be 8, since a new line is also printed. |
11,606,847 | What is the use of width in the `printf()` statement? Why is the output 7 in the example below?
### Code
```
int add(int x, int y)
{
return printf("%*c%*c", x, '\r', y, '\r');
}
int main()
{
printf("Sum = %d", add(3, 4));
return 0;
}
```
### Output
>
> Sum = 7
>
>
> | 2012/07/23 | [
"https://Stackoverflow.com/questions/11606847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890623/"
] | If successful [printf](http://en.cppreference.com/w/cpp/io/c/fprintf) returns the number of characters printed. So, your `printf`call in `main` is printing the number of characters printed by the `printf` in the `add` function, because this is what `add` returns. | printf returns the number of characters printed. In this case you are printing 7 characters by specifying x and y as output lengths. If you change the return statement to:
```
return printf("%*c%*c\n", x, '\r', y, '\r');
```
The output will be 8, since a new line is also printed. |
11,606,847 | What is the use of width in the `printf()` statement? Why is the output 7 in the example below?
### Code
```
int add(int x, int y)
{
return printf("%*c%*c", x, '\r', y, '\r');
}
int main()
{
printf("Sum = %d", add(3, 4));
return 0;
}
```
### Output
>
> Sum = 7
>
>
> | 2012/07/23 | [
"https://Stackoverflow.com/questions/11606847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890623/"
] | Consulting any [manual](http://linux.die.net/man/3/printf) shows that `printf` returns the number of characters that were printed, excluding the null terminator. `%*c` takes *two* arguments, the first being the field width (which is thus respectively 3 and 4), and the second being the actual character printed. In this ... | Given that the name of your function is add, I highly doubt this is what you meant to do.
printf() returns the number of characters printed, which in this case is apparently 7 characters. You are then returning the value returned by printf() and printing it.
Seems like an odd thing to do. What were you expecting? |
11,606,847 | What is the use of width in the `printf()` statement? Why is the output 7 in the example below?
### Code
```
int add(int x, int y)
{
return printf("%*c%*c", x, '\r', y, '\r');
}
int main()
{
printf("Sum = %d", add(3, 4));
return 0;
}
```
### Output
>
> Sum = 7
>
>
> | 2012/07/23 | [
"https://Stackoverflow.com/questions/11606847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890623/"
] | A) this is a totally crazy thing to do with printf. But since you asked...
B) the `%*c` says to take the next two of printf's arguments, and interpret them as a width and a character. Print that character in a field of the specified width. In this case, print a field `x` wide containing the character `\r`. Same for `y... | If successful [printf](http://en.cppreference.com/w/cpp/io/c/fprintf) returns the number of characters printed. So, your `printf`call in `main` is printing the number of characters printed by the `printf` in the `add` function, because this is what `add` returns. |
11,606,847 | What is the use of width in the `printf()` statement? Why is the output 7 in the example below?
### Code
```
int add(int x, int y)
{
return printf("%*c%*c", x, '\r', y, '\r');
}
int main()
{
printf("Sum = %d", add(3, 4));
return 0;
}
```
### Output
>
> Sum = 7
>
>
> | 2012/07/23 | [
"https://Stackoverflow.com/questions/11606847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890623/"
] | `printf` returns the number of characters output. `%*c` means print a character and pad to the width specified by an argument. So `printf("%*c", 3, '\r')` means to print a carriage return with 2 spaces before it. `printf("%*c%*c", n, '\r', m, '\r')` therefore prints `n` + `m` characters - that's `n` - 1 spaces to pad t... | Given that the name of your function is add, I highly doubt this is what you meant to do.
printf() returns the number of characters printed, which in this case is apparently 7 characters. You are then returning the value returned by printf() and printing it.
Seems like an odd thing to do. What were you expecting? |
11,606,847 | What is the use of width in the `printf()` statement? Why is the output 7 in the example below?
### Code
```
int add(int x, int y)
{
return printf("%*c%*c", x, '\r', y, '\r');
}
int main()
{
printf("Sum = %d", add(3, 4));
return 0;
}
```
### Output
>
> Sum = 7
>
>
> | 2012/07/23 | [
"https://Stackoverflow.com/questions/11606847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890623/"
] | A) this is a totally crazy thing to do with printf. But since you asked...
B) the `%*c` says to take the next two of printf's arguments, and interpret them as a width and a character. Print that character in a field of the specified width. In this case, print a field `x` wide containing the character `\r`. Same for `y... | Given that the name of your function is add, I highly doubt this is what you meant to do.
printf() returns the number of characters printed, which in this case is apparently 7 characters. You are then returning the value returned by printf() and printing it.
Seems like an odd thing to do. What were you expecting? |
11,606,847 | What is the use of width in the `printf()` statement? Why is the output 7 in the example below?
### Code
```
int add(int x, int y)
{
return printf("%*c%*c", x, '\r', y, '\r');
}
int main()
{
printf("Sum = %d", add(3, 4));
return 0;
}
```
### Output
>
> Sum = 7
>
>
> | 2012/07/23 | [
"https://Stackoverflow.com/questions/11606847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890623/"
] | `printf` returns the number of characters output. `%*c` means print a character and pad to the width specified by an argument. So `printf("%*c", 3, '\r')` means to print a carriage return with 2 spaces before it. `printf("%*c%*c", n, '\r', m, '\r')` therefore prints `n` + `m` characters - that's `n` - 1 spaces to pad t... | A) this is a totally crazy thing to do with printf. But since you asked...
B) the `%*c` says to take the next two of printf's arguments, and interpret them as a width and a character. Print that character in a field of the specified width. In this case, print a field `x` wide containing the character `\r`. Same for `y... |
11,606,847 | What is the use of width in the `printf()` statement? Why is the output 7 in the example below?
### Code
```
int add(int x, int y)
{
return printf("%*c%*c", x, '\r', y, '\r');
}
int main()
{
printf("Sum = %d", add(3, 4));
return 0;
}
```
### Output
>
> Sum = 7
>
>
> | 2012/07/23 | [
"https://Stackoverflow.com/questions/11606847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890623/"
] | A) this is a totally crazy thing to do with printf. But since you asked...
B) the `%*c` says to take the next two of printf's arguments, and interpret them as a width and a character. Print that character in a field of the specified width. In this case, print a field `x` wide containing the character `\r`. Same for `y... | Consulting any [manual](http://linux.die.net/man/3/printf) shows that `printf` returns the number of characters that were printed, excluding the null terminator. `%*c` takes *two* arguments, the first being the field width (which is thus respectively 3 and 4), and the second being the actual character printed. In this ... |
11,606,847 | What is the use of width in the `printf()` statement? Why is the output 7 in the example below?
### Code
```
int add(int x, int y)
{
return printf("%*c%*c", x, '\r', y, '\r');
}
int main()
{
printf("Sum = %d", add(3, 4));
return 0;
}
```
### Output
>
> Sum = 7
>
>
> | 2012/07/23 | [
"https://Stackoverflow.com/questions/11606847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890623/"
] | A) this is a totally crazy thing to do with printf. But since you asked...
B) the `%*c` says to take the next two of printf's arguments, and interpret them as a width and a character. Print that character in a field of the specified width. In this case, print a field `x` wide containing the character `\r`. Same for `y... | printf returns the number of characters printed. In this case you are printing 7 characters by specifying x and y as output lengths. If you change the return statement to:
```
return printf("%*c%*c\n", x, '\r', y, '\r');
```
The output will be 8, since a new line is also printed. |
16,148,223 | I am a beginner android developer.
I have a database table that counts the following columns: \_id, fistName, lastName and username what is set to unique.
When I add another person in my table and the username already exist I create an AlertDialog, but this AlertDialog does not appear.
This is my source code:
```
t... | 2013/04/22 | [
"https://Stackoverflow.com/questions/16148223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/985482/"
] | try this
```
AlertDialog alert;
alert=new AlertDialog.Builder(YourActivity.this)
.setCancelable(false)
.setMessage("Message")
.setPositiveButton("Okay", new DialogInterface.OnClickListener()
{
@Override
public void... | If your `AddPerson` method call `insertOrThrow` then change
```
catch (SQLiteConstraintException ex)
```
to
```
catch (SQLException ex)
``` |
3,308,723 | I am dynamically creating dragrids in different rows of an existing datagrid in asp.NET
My generated datagrids have a column which is TemplateColumn (a CheckBox Column).
In my parent datagrid, I have a template column with checkboxes. when I check or uncheck the value of the check box, the check\_change method is cal... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3308723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/367319/"
] | It's simple, the browser caches the response. So if you press F5, you'd generally see your grid with the checked checkboxes each time. But if you do a post-back in code, you force the browser to connect to the server and post the data.
It will then wait for a response from the server, and return whatever the reason fo... | A "Refresh" simply calls the last request made for a page. So, if
you just browsed to a page then hit refresh, it simply asks for that page
again.
A Postback is essentially an action on the page that sends
information back to the server. |
3,308,723 | I am dynamically creating dragrids in different rows of an existing datagrid in asp.NET
My generated datagrids have a column which is TemplateColumn (a CheckBox Column).
In my parent datagrid, I have a template column with checkboxes. when I check or uncheck the value of the check box, the check\_change method is cal... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3308723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/367319/"
] | A "Refresh" simply calls the last request made for a page. So, if
you just browsed to a page then hit refresh, it simply asks for that page
again.
A Postback is essentially an action on the page that sends
information back to the server. | Ideally it is a PostBack but it will depend on your Browser Settings if you have set it to Request page from Server for every visit or it picks from the Local Histroy Cache.
Hitting the Refresh button will make a new request to the page from the server ,
and it will not change the status of the `Http Method(Get , Post... |
3,308,723 | I am dynamically creating dragrids in different rows of an existing datagrid in asp.NET
My generated datagrids have a column which is TemplateColumn (a CheckBox Column).
In my parent datagrid, I have a template column with checkboxes. when I check or uncheck the value of the check box, the check\_change method is cal... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3308723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/367319/"
] | It's simple, the browser caches the response. So if you press F5, you'd generally see your grid with the checked checkboxes each time. But if you do a post-back in code, you force the browser to connect to the server and post the data.
It will then wait for a response from the server, and return whatever the reason fo... | Ideally it is a PostBack but it will depend on your Browser Settings if you have set it to Request page from Server for every visit or it picks from the Local Histroy Cache.
Hitting the Refresh button will make a new request to the page from the server ,
and it will not change the status of the `Http Method(Get , Post... |
45,722,122 | I need to delete specific rows in a table with a order number. When I put this code in Excel it delete the entire table. What I want is to delete only specific rows. The tbxOrder is a text box. I want that when the text box equals x command number the code will select all the rows with the same number in the "Paginatio... | 2017/08/16 | [
"https://Stackoverflow.com/questions/45722122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8345911/"
] | Try it without the ListRows; use DataBodyRange instead. Work from the bottom to the top or you risk skipping rows when you delete.
```
Option Explicit
Public Sub DeleteOrderRows()
Dim strNoOrder As String
Dim strNoFunction As String, noOrder As String
Dim noCommande As Integer
Dim i As Long, tbxOrder... | An other option :
```
Public Sub DeleteOrderRows()
Dim rngToDelete As Range
Set rngToDelete = Nothing
Dim tblPagination As ListObject
Set tblPagination = Worksheets("Pagination").ListObjects.Item("tblPagination")
Dim strNopage As String
Dim strNoOrder As String
For Each currentRow In tblPagination.ListRows
strN... |
10,351,582 | I have create SharePoint 2010 site collection backup through Power shell, by using the command
**Backup-SPSite "http://sitename:85" -path "C:\backup.bak" -Force**
and i am restoring this backup on same SharePoint 2010 server/same machine on different port by using the command
**Restore--SPSite "http://sitename:81" -... | 2012/04/27 | [
"https://Stackoverflow.com/questions/10351582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/416066/"
] | I had similar issue migrating SPF2010 to different server.
Sollution: database upgrade on source server.
How: Open Sharepoint PowerShell, and type **Upgrade-SPContentDatabase** command, hit R(maybe Y) when promt.
Cheers | It appears that you applied SP1 to your SharePoint server. *Service Packs and Community Updates (CUs) may alter database schemes and backups made before applying such update may be unusable.* Microsoft mentions this at the description of [Restore-SPSite](http://technet.microsoft.com/en-us/library/ff607788.aspx). See [R... |
28,269,787 | I have a text field, and I made a reset button for my app. I want the reset button to set the text of the text field to `@""`, or empty string. Which function do I use?
PS I created the IBOutlet, and the textfield is called textFieldX. | 2015/02/02 | [
"https://Stackoverflow.com/questions/28269787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4493622/"
] | Did you try textFieldX.text = @"" ? | Just use setStringValue: and pass @"" |
1,391,791 | I have a field of type image in my database which is mapped as binary in my model (ADO.NET Entity Framework).
But somehow the image that I get from the input file box is not being passed to the object. I know this because I debuged my action and the object Language (the image I trying to upload to the database is a fl... | 2009/09/08 | [
"https://Stackoverflow.com/questions/1391791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/169034/"
] | I've been able to upload files by adding a HttpPostedFileBase parameter to my action method. I don't believe ASP.NET MVC will automatically populate a property on the language parameter for you under these circumstances. | File uploads work totally differently to normal post fields. You have the uploads in Request.Files. I'm doing something like this to *pick it up*:
```
if (Request.Files.Count != 1 || Request.Files[0].ContentLength == 0) {
ModelState.AddModelError("Picture", "Picture is missing");
} else if (!IsImage(Request.Files[... |
1,391,791 | I have a field of type image in my database which is mapped as binary in my model (ADO.NET Entity Framework).
But somehow the image that I get from the input file box is not being passed to the object. I know this because I debuged my action and the object Language (the image I trying to upload to the database is a fl... | 2009/09/08 | [
"https://Stackoverflow.com/questions/1391791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/169034/"
] | I've been able to upload files by adding a HttpPostedFileBase parameter to my action method. I don't believe ASP.NET MVC will automatically populate a property on the language parameter for you under these circumstances. | Thank you for your responses, but fortunately I found a better way.
I changed the action method signature:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(Language language)
to:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(HttpPostedFileBase Flag, Language language)
Then I attribute th... |
32,799,203 | So I'm making a program which utilizes a Robot to copy and paste text. However, I've hit a wall when it comes to how to stop the Robot in the middle of its actions (I prefer using a button since the whole application is in a GUI). Right now I have it so that the Robot is created and starts when a different button is cl... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32799203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1642234/"
] | I have no idea why you are trying to do this, so I may have missed the point entirely, but this is the closest I can get to it...
```
enum IntOrFunction {
case Number(Int)
case Function((Int -> Int))
var function: (Int -> Int) {
switch self {
case .Function(let f):
return f
... | Currying is a method of translating function with multiple parameters into sequence of function. So no, there is no way to do that. Only thing you can do is to create "interface"
```
func sum(a: Int) -> (Int -> Int) {
return { b in a + b }
}
func sum(a: Int, _ b: Int) -> Int {
return sum(a)(b)
}
``` |
32,799,203 | So I'm making a program which utilizes a Robot to copy and paste text. However, I've hit a wall when it comes to how to stop the Robot in the middle of its actions (I prefer using a button since the whole application is in a GUI). Right now I have it so that the Robot is created and starts when a different button is cl... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32799203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1642234/"
] | Currying is a method of translating function with multiple parameters into sequence of function. So no, there is no way to do that. Only thing you can do is to create "interface"
```
func sum(a: Int) -> (Int -> Int) {
return { b in a + b }
}
func sum(a: Int, _ b: Int) -> Int {
return sum(a)(b)
}
``` | Maybe you can use something like this:
```
func *<A, B, C>(lhs: A -> B -> C, rhs: (A, B)) -> C {
return lhs(rhs.0)(rhs.1)
}
func sum(a: Int)(_ b: Int) -> Int {
return a + b
}
sum(1)(2)
sum*(1, 2)
``` |
32,799,203 | So I'm making a program which utilizes a Robot to copy and paste text. However, I've hit a wall when it comes to how to stop the Robot in the middle of its actions (I prefer using a button since the whole application is in a GUI). Right now I have it so that the Robot is created and starts when a different button is cl... | 2015/09/26 | [
"https://Stackoverflow.com/questions/32799203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1642234/"
] | I have no idea why you are trying to do this, so I may have missed the point entirely, but this is the closest I can get to it...
```
enum IntOrFunction {
case Number(Int)
case Function((Int -> Int))
var function: (Int -> Int) {
switch self {
case .Function(let f):
return f
... | Maybe you can use something like this:
```
func *<A, B, C>(lhs: A -> B -> C, rhs: (A, B)) -> C {
return lhs(rhs.0)(rhs.1)
}
func sum(a: Int)(_ b: Int) -> Int {
return a + b
}
sum(1)(2)
sum*(1, 2)
``` |
17,320,062 | I'm trying to use JMX for measuring how long a method call took and how much of that was CPU time, how much was the thread being blocked and how much was waiting. Ideally, I would expect that **CPU time + Block time + Wait time = Wall time**, but I've noticed that it's not the case - and it's not just slightly inaccura... | 2013/06/26 | [
"https://Stackoverflow.com/questions/17320062",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2454811/"
] | CPU time tells you how much time the thread took utilizing the CPU, i.e. actually executing code. Block or wait times increase if the thread had been suspended because of e.g. waiting for I/O or entering a monitor.
However, it's up to the JVM and OS to assign CPU time to threads and processes. They may choose to suspe... | Another way you might be able to improve the precision of your measurements is:
* Do your calculations in nano-seconds, so elapsed time (using `System.nanoTime()` and CPU time are natively in nanos. Blocked and Waiting times should be converted since they are in millis.
* Implement an approximation of how long it take... |
17,320,062 | I'm trying to use JMX for measuring how long a method call took and how much of that was CPU time, how much was the thread being blocked and how much was waiting. Ideally, I would expect that **CPU time + Block time + Wait time = Wall time**, but I've noticed that it's not the case - and it's not just slightly inaccura... | 2013/06/26 | [
"https://Stackoverflow.com/questions/17320062",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2454811/"
] | CPU time tells you how much time the thread took utilizing the CPU, i.e. actually executing code. Block or wait times increase if the thread had been suspended because of e.g. waiting for I/O or entering a monitor.
However, it's up to the JVM and OS to assign CPU time to threads and processes. They may choose to suspe... | From a code execution perspective, a thread can be running, blocked on a monitor, or waiting for io. A running thread, however, must compete with other running threads to be assigned to a cpu to run - until it is assigned to a cpu, it is effectively idling, not taking cpu time but taking wall time. If you you have 1000... |
17,320,062 | I'm trying to use JMX for measuring how long a method call took and how much of that was CPU time, how much was the thread being blocked and how much was waiting. Ideally, I would expect that **CPU time + Block time + Wait time = Wall time**, but I've noticed that it's not the case - and it's not just slightly inaccura... | 2013/06/26 | [
"https://Stackoverflow.com/questions/17320062",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2454811/"
] | Another way you might be able to improve the precision of your measurements is:
* Do your calculations in nano-seconds, so elapsed time (using `System.nanoTime()` and CPU time are natively in nanos. Blocked and Waiting times should be converted since they are in millis.
* Implement an approximation of how long it take... | From a code execution perspective, a thread can be running, blocked on a monitor, or waiting for io. A running thread, however, must compete with other running threads to be assigned to a cpu to run - until it is assigned to a cpu, it is effectively idling, not taking cpu time but taking wall time. If you you have 1000... |
70,000,272 | On website <https://www.expedia.com/> i need to type on the Leaving from colum,but it only gives me an error:AttributeError: 'NoneType' object has no attribute 'send\_keys'. How can i write on Leaving from?
```
import time
from selenium import webdriver
driver=webdriver.Chrome(executable_path="D:\ChromeDriverExtract... | 2021/11/17 | [
"https://Stackoverflow.com/questions/70000272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17431121/"
] | To send a *character sequence* to the element you need to induce [WebDriverWait](https://stackoverflow.com/questions/59130200/selenium-wait-until-element-is-present-visible-and-interactable/59130336#59130336) for the [`element_to_be_clickable()`](https://stackoverflow.com/questions/65140218/selenium-not-able-to-click-o... | It seems like your last "find\_element\_by\_xpath" does not correctly locate the element you are looking for. An xpath that does locate your element is
```
"//input[@id='location-field-leg1-origin-input']"
```
I don't think this will completely solve your problem though. One thing is that you need to click on this e... |
25,158,517 | I am trying to archive same thing as done in "hierarchyviewer" tool, which dumps the tree of Views present at any given moment on the device or emulator screen.
But i want it to be an Application running on a Android device. This app will keep running in background like a Serve and will dump the currently displayed V... | 2014/08/06 | [
"https://Stackoverflow.com/questions/25158517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/314247/"
] | >
> Is it possible?
>
>
>
No.
The closest you can come is to implement an `AccessibilityService`. This would more closely mirror the **`uiautomatorviewer`** functionality, giving you a subset of what you see in Hierarchy View. This also requires a double-opt-in by the user: the user must install your app *and* ac... | As far as I know, you couldn't access other apps if they do not explicity share that info with you by the use of Intents (or if you own these other apps).
So, based on this limitation, my bets are you can't access another app's View Tree by regular means. And if you chould, I think you shouldn't, as this is somehow "s... |
8,681,868 | I could use:
```
File.open('/dev/null', 'w')
```
on Unix systems, but if there is a Ruby way to achieve this, I'd like to use it. I am just looking for an I/O stream, that immediately "trashes" all writes, kind of like a null-object. | 2011/12/30 | [
"https://Stackoverflow.com/questions/8681868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/907986/"
] | If you want the full behavior of streams, the best is probably to use:
```
File.open(File::NULL, "w")
```
Note that `File::NULL` is new to Ruby 1.9.3; you can use my [`backports`](https://github.com/marcandre/backports) gem:
```
require 'backports/1.9.3/file/null' # => Won't do anything in 1.9.3+
File.open(File::NU... | No, I don't believe there is anything like a null stream in Ruby, at least in earlier versions. In that case, you must make one yourself. Depending on the methods that it will call, you will need to write
stub methods on the null stream class, like this:
```
class NullStream
def <<(o); self; end
end
```
The above... |
8,681,868 | I could use:
```
File.open('/dev/null', 'w')
```
on Unix systems, but if there is a Ruby way to achieve this, I'd like to use it. I am just looking for an I/O stream, that immediately "trashes" all writes, kind of like a null-object. | 2011/12/30 | [
"https://Stackoverflow.com/questions/8681868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/907986/"
] | No, I don't believe there is anything like a null stream in Ruby, at least in earlier versions. In that case, you must make one yourself. Depending on the methods that it will call, you will need to write
stub methods on the null stream class, like this:
```
class NullStream
def <<(o); self; end
end
```
The above... | There's stringIO, which I find useful when I want to introduce a dummy filestream:
```
require "stringio"
f = StringIO.new
f.gets # => nil
```
And here's some code from heckle that finds the bit bucket for both Unix and Windows, slightly modified:
```
# Is this platform MS Windows-like?
# Actually, I suspect the fo... |
8,681,868 | I could use:
```
File.open('/dev/null', 'w')
```
on Unix systems, but if there is a Ruby way to achieve this, I'd like to use it. I am just looking for an I/O stream, that immediately "trashes" all writes, kind of like a null-object. | 2011/12/30 | [
"https://Stackoverflow.com/questions/8681868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/907986/"
] | No, I don't believe there is anything like a null stream in Ruby, at least in earlier versions. In that case, you must make one yourself. Depending on the methods that it will call, you will need to write
stub methods on the null stream class, like this:
```
class NullStream
def <<(o); self; end
end
```
The above... | There's a gem called [devnull](https://rubygems.org/gems/devnull)
>
> Ruby implementation of null file (like /dev/null on Un\*x, NUL on
> Windows)
>
>
>
It doesn't interact with the null file, but instead has dummy methods for all the methods that IO objects implement. |
8,681,868 | I could use:
```
File.open('/dev/null', 'w')
```
on Unix systems, but if there is a Ruby way to achieve this, I'd like to use it. I am just looking for an I/O stream, that immediately "trashes" all writes, kind of like a null-object. | 2011/12/30 | [
"https://Stackoverflow.com/questions/8681868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/907986/"
] | No, I don't believe there is anything like a null stream in Ruby, at least in earlier versions. In that case, you must make one yourself. Depending on the methods that it will call, you will need to write
stub methods on the null stream class, like this:
```
class NullStream
def <<(o); self; end
end
```
The above... | `Logger.new("/dev/null")` does the trick |
8,681,868 | I could use:
```
File.open('/dev/null', 'w')
```
on Unix systems, but if there is a Ruby way to achieve this, I'd like to use it. I am just looking for an I/O stream, that immediately "trashes" all writes, kind of like a null-object. | 2011/12/30 | [
"https://Stackoverflow.com/questions/8681868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/907986/"
] | If you want the full behavior of streams, the best is probably to use:
```
File.open(File::NULL, "w")
```
Note that `File::NULL` is new to Ruby 1.9.3; you can use my [`backports`](https://github.com/marcandre/backports) gem:
```
require 'backports/1.9.3/file/null' # => Won't do anything in 1.9.3+
File.open(File::NU... | There's stringIO, which I find useful when I want to introduce a dummy filestream:
```
require "stringio"
f = StringIO.new
f.gets # => nil
```
And here's some code from heckle that finds the bit bucket for both Unix and Windows, slightly modified:
```
# Is this platform MS Windows-like?
# Actually, I suspect the fo... |
8,681,868 | I could use:
```
File.open('/dev/null', 'w')
```
on Unix systems, but if there is a Ruby way to achieve this, I'd like to use it. I am just looking for an I/O stream, that immediately "trashes" all writes, kind of like a null-object. | 2011/12/30 | [
"https://Stackoverflow.com/questions/8681868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/907986/"
] | If you want the full behavior of streams, the best is probably to use:
```
File.open(File::NULL, "w")
```
Note that `File::NULL` is new to Ruby 1.9.3; you can use my [`backports`](https://github.com/marcandre/backports) gem:
```
require 'backports/1.9.3/file/null' # => Won't do anything in 1.9.3+
File.open(File::NU... | There's a gem called [devnull](https://rubygems.org/gems/devnull)
>
> Ruby implementation of null file (like /dev/null on Un\*x, NUL on
> Windows)
>
>
>
It doesn't interact with the null file, but instead has dummy methods for all the methods that IO objects implement. |
8,681,868 | I could use:
```
File.open('/dev/null', 'w')
```
on Unix systems, but if there is a Ruby way to achieve this, I'd like to use it. I am just looking for an I/O stream, that immediately "trashes" all writes, kind of like a null-object. | 2011/12/30 | [
"https://Stackoverflow.com/questions/8681868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/907986/"
] | If you want the full behavior of streams, the best is probably to use:
```
File.open(File::NULL, "w")
```
Note that `File::NULL` is new to Ruby 1.9.3; you can use my [`backports`](https://github.com/marcandre/backports) gem:
```
require 'backports/1.9.3/file/null' # => Won't do anything in 1.9.3+
File.open(File::NU... | `Logger.new("/dev/null")` does the trick |
8,681,868 | I could use:
```
File.open('/dev/null', 'w')
```
on Unix systems, but if there is a Ruby way to achieve this, I'd like to use it. I am just looking for an I/O stream, that immediately "trashes" all writes, kind of like a null-object. | 2011/12/30 | [
"https://Stackoverflow.com/questions/8681868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/907986/"
] | There's stringIO, which I find useful when I want to introduce a dummy filestream:
```
require "stringio"
f = StringIO.new
f.gets # => nil
```
And here's some code from heckle that finds the bit bucket for both Unix and Windows, slightly modified:
```
# Is this platform MS Windows-like?
# Actually, I suspect the fo... | There's a gem called [devnull](https://rubygems.org/gems/devnull)
>
> Ruby implementation of null file (like /dev/null on Un\*x, NUL on
> Windows)
>
>
>
It doesn't interact with the null file, but instead has dummy methods for all the methods that IO objects implement. |
8,681,868 | I could use:
```
File.open('/dev/null', 'w')
```
on Unix systems, but if there is a Ruby way to achieve this, I'd like to use it. I am just looking for an I/O stream, that immediately "trashes" all writes, kind of like a null-object. | 2011/12/30 | [
"https://Stackoverflow.com/questions/8681868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/907986/"
] | There's stringIO, which I find useful when I want to introduce a dummy filestream:
```
require "stringio"
f = StringIO.new
f.gets # => nil
```
And here's some code from heckle that finds the bit bucket for both Unix and Windows, slightly modified:
```
# Is this platform MS Windows-like?
# Actually, I suspect the fo... | `Logger.new("/dev/null")` does the trick |
70,379,904 | I have put together a script to output all fields from a json file.
I have running into issues getting it to print each `finding` from `highsev` and specifically the `id` field from each finding.
Here is the code:
```
json_object=json.load(f)
vulnsBySeverity["HIGHSEVERITY"] = []
for result in json_object['results']:... | 2021/12/16 | [
"https://Stackoverflow.com/questions/70379904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/700070/"
] | You're already looping through `highsev` with your `for finding in highsev:`
If your highsev list contains dictionaries like this `{'id': 'CVE-2020-15999'}`, you can do this:
```
for finding in highsev:
print(finding['id'])
``` | You can change last line to:
```
print(finding['id'])
```
As you are looping through highsev. |
22,900,073 | After compiling if i make any change in kernel source code . What should i do , compile kernel from starting by cleaning "make clean" and running make or can run make directly. I am facing difficulty because make takes around 2 hr to complete. Every time it is difficult to wait for 2 hrs . | 2014/04/06 | [
"https://Stackoverflow.com/questions/22900073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1895706/"
] | Just running `make` will rebuild only the parts that have changed. You need `make clean` if you change anything major (like 64/32 bit architecture, etc.) And if you are just changing modules, you can just `make modules` to rebuild only the modules that have changed. | In almost all cases calling just `make`, without cleaning will be working OK and this is exactly what you should do. This will only recompile files that were changed and some dependent files, if needed.
There are occasional errors in kernel makefiles which led to wrong dependencies between files which in turn may some... |
37,738,868 | Does the C++ standard say that `std::initializer_list<T>` is a reference to a local anonymous array? If it says, then we should never return such an object. Any section in the standard say so?
Another question, are the underlying objects of a `std::initializer_list<T>` mutable? I tried to modify it:
```
#include <ini... | 2016/06/10 | [
"https://Stackoverflow.com/questions/37738868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5890784/"
] | From [dcl.init.list]:
>
> An object of type `std::initializer_list<E>` is constructed from an initializer list as if the implementation
> allocated a temporary array of `N` elements of type `const E`, where `N` is the number of elements in the
> initializer list. Each element of that array is copy-initialized with ... | From the [cppreference](http://en.cppreference.com/w/cpp/utility/initializer_list) article
```
Copying a std::initializer_list does not copy the underlying objects.
``` |
172,229 | On my linux pc i access webisite by going <http://site1.local>
I have setup virtual host in httpd.conf
I want that when i should be able to access that address from windows PC.
In the windows hosts file i have written
```
192.168.1.81 site1.local
```
But still i can't access the page.
i can ping that adress but ... | 2010/08/19 | [
"https://serverfault.com/questions/172229",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | You can change your virtual host from 127.0.0.1 to your network ip which is `192.168.1.81:80` or you can make it `*:80`.
I would recommend the 2nd option so it will keep working on both, internaly on the server and within your internal ip.
The reason it won't work for your other computer is probably because it is bou... | It should be a matter of checking if apache is listening on port 80 with
```
sudo netstat -anp | grep :80
```
for which you should see your apache and IP:PORT that it is listening on.
If it listens on the right interface (or on all interfaces) then it can be a problem of the right firewall or name resolution on the... |
27,736,178 | I have this very simple Python function, but there is one part I am confused about. The function is called bigger and it takes two numbers as inputs and outputs the bigger number. (I could only use if statements, no elses)
Here's the code:
```
def bigger(x, y):
if x > y:
return x
return y
```
I woul... | 2015/01/02 | [
"https://Stackoverflow.com/questions/27736178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4087357/"
] | Python functions can only return one value. It would be possible to return both x and y as a tuple, but the way this function is set up, it will return a single value and then exit the function. | Try this
```
def bigger(x, y):
if x > y:
a=(x,y)
# or a=[x,y]
return a
return y
```
This way it will return x and y if x is bigger, but y if y is bigger. I assume this was your question?
The reason for this is that return gives back that 1 value, then exits the function. So it would leave
the function ... |
27,736,178 | I have this very simple Python function, but there is one part I am confused about. The function is called bigger and it takes two numbers as inputs and outputs the bigger number. (I could only use if statements, no elses)
Here's the code:
```
def bigger(x, y):
if x > y:
return x
return y
```
I woul... | 2015/01/02 | [
"https://Stackoverflow.com/questions/27736178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4087357/"
] | The `return` statement not only returns a value, but also terminates the current function and returns control to the calling function. So, this function will only return a single value. In my opinion it would be slightly more clear to write this:
```
def bigger(x, y):
if x > y:
return x
else:
r... | In a Python function, when a `return` statement is encountered, execution of that function is terminated. Execution context then goes back to the context that called the function.
So, even though you see two `return` statements, if that first one is encountered (as a result of x being bigger than y), nothing else in t... |
27,736,178 | I have this very simple Python function, but there is one part I am confused about. The function is called bigger and it takes two numbers as inputs and outputs the bigger number. (I could only use if statements, no elses)
Here's the code:
```
def bigger(x, y):
if x > y:
return x
return y
```
I woul... | 2015/01/02 | [
"https://Stackoverflow.com/questions/27736178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4087357/"
] | In a Python function, when a `return` statement is encountered, execution of that function is terminated. Execution context then goes back to the context that called the function.
So, even though you see two `return` statements, if that first one is encountered (as a result of x being bigger than y), nothing else in t... | Python functions only returns one value.
You can try,
```
def bigger(x, y):
#this is optional: value = None
if x > y:
value = x
else:
value = y
return value
``` |
27,736,178 | I have this very simple Python function, but there is one part I am confused about. The function is called bigger and it takes two numbers as inputs and outputs the bigger number. (I could only use if statements, no elses)
Here's the code:
```
def bigger(x, y):
if x > y:
return x
return y
```
I woul... | 2015/01/02 | [
"https://Stackoverflow.com/questions/27736178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4087357/"
] | The `return` statement not only returns a value, but also terminates the current function and returns control to the calling function. So, this function will only return a single value. In my opinion it would be slightly more clear to write this:
```
def bigger(x, y):
if x > y:
return x
else:
r... | Python functions can only return one value. It would be possible to return both x and y as a tuple, but the way this function is set up, it will return a single value and then exit the function. |
27,736,178 | I have this very simple Python function, but there is one part I am confused about. The function is called bigger and it takes two numbers as inputs and outputs the bigger number. (I could only use if statements, no elses)
Here's the code:
```
def bigger(x, y):
if x > y:
return x
return y
```
I woul... | 2015/01/02 | [
"https://Stackoverflow.com/questions/27736178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4087357/"
] | Python functions can only return one value. It would be possible to return both x and y as a tuple, but the way this function is set up, it will return a single value and then exit the function. | Python functions only returns one value.
You can try,
```
def bigger(x, y):
#this is optional: value = None
if x > y:
value = x
else:
value = y
return value
``` |
27,736,178 | I have this very simple Python function, but there is one part I am confused about. The function is called bigger and it takes two numbers as inputs and outputs the bigger number. (I could only use if statements, no elses)
Here's the code:
```
def bigger(x, y):
if x > y:
return x
return y
```
I woul... | 2015/01/02 | [
"https://Stackoverflow.com/questions/27736178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4087357/"
] | ```
def bigger(x, y):
if x > y:
# when x>y, x will be returned and 'return y' in the last line will not be executed.
return x
# only if x<y, this line will be executed.
return y
``` | Python functions only returns one value.
You can try,
```
def bigger(x, y):
#this is optional: value = None
if x > y:
value = x
else:
value = y
return value
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.