qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
7,706,699 | What is the best method for adding time to a timestamp?
I have in a database
**2011-10-09 10:29:23**
and I would like add to this 20 days. How can I do that?
I need an example for:
1. 20 hours
2. 20 days | 2011/10/09 | [
"https://Stackoverflow.com/questions/7706699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/964920/"
] | <http://www.php.net/manual/en/function.strtotime.php>
Use PHP's strtotime function like:
```
$newtimestamp = strtotime("+20 days", $yourtimestamp);
``` | I recommend you to use unix\_timestamps, with these you're able to work faster, and if the times were to be displayed to the user, you can use gmdate(). |
7,706,699 | What is the best method for adding time to a timestamp?
I have in a database
**2011-10-09 10:29:23**
and I would like add to this 20 days. How can I do that?
I need an example for:
1. 20 hours
2. 20 days | 2011/10/09 | [
"https://Stackoverflow.com/questions/7706699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/964920/"
] | You can use [Date::add](http://fr.php.net/manual/fr/datetime.add.php) like this:
```
<?php
$date = new DateTime('2011-10-09 10:29:23');
$date->add(new DateInterval('P20D')); //use PT20H for 20 hours
echo $date->format('Y-m-d H:i:s');
?>
``` | I recommend you to use unix\_timestamps, with these you're able to work faster, and if the times were to be displayed to the user, you can use gmdate(). |
7,706,699 | What is the best method for adding time to a timestamp?
I have in a database
**2011-10-09 10:29:23**
and I would like add to this 20 days. How can I do that?
I need an example for:
1. 20 hours
2. 20 days | 2011/10/09 | [
"https://Stackoverflow.com/questions/7706699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/964920/"
] | You can use [Date::add](http://fr.php.net/manual/fr/datetime.add.php) like this:
```
<?php
$date = new DateTime('2011-10-09 10:29:23');
$date->add(new DateInterval('P20D')); //use PT20H for 20 hours
echo $date->format('Y-m-d H:i:s');
?>
``` | Another method that works well with Frame is
```
$time = date('Y-m-d H:i:s', time($foo->time_stamp + (24*60*60)));
```
where the number at the end is the old php method `(*days*hours*mins*secs)` |
7,706,699 | What is the best method for adding time to a timestamp?
I have in a database
**2011-10-09 10:29:23**
and I would like add to this 20 days. How can I do that?
I need an example for:
1. 20 hours
2. 20 days | 2011/10/09 | [
"https://Stackoverflow.com/questions/7706699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/964920/"
] | Another method that works well with Frame is
```
$time = date('Y-m-d H:i:s', time($foo->time_stamp + (24*60*60)));
```
where the number at the end is the old php method `(*days*hours*mins*secs)` | I recommend you to use unix\_timestamps, with these you're able to work faster, and if the times were to be displayed to the user, you can use gmdate(). |
58,754,538 | I recently posted [this answer](https://stackoverflow.com/a/58740194/11715606) as a way to get user input when creating a MS Access query or report. The general behaviour is that if an undeclared variable is placed in SQL query code or a report (e.g. `[UndeclaredVariable]`), a small input/dialog box appears for the use... | 2019/11/07 | [
"https://Stackoverflow.com/questions/58754538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11715606/"
] | To summarize the above comments:
* the behavior is called a "parameter query" and is like normal parameterized queries (see [here](https://support.office.com/en-us/article/use-parameters-in-queries-forms-and-reports-8209eb5c-1589-42e2-9b20-4181f4c7a356))
* The behavior with `IIf()` is because Access requires a paramet... | Ok, as to why they work the way they do? Well a lot of people use Access for just working with data tables. They don't necessary build forms and reports. So, if you place a [parm] box in a query, it will prompt you, and you don't need code. So, a really handy feature.
And of course if you do build a report, and need a... |
36,856,676 | I am new to bash scripting.
i wrote a simple code to find the average of all the multiples of ten from 10 to 190 inclusive.
The code is:
```
#!/bin/bash
a=10
ans=0
while[ $a -le 190 ]
do
ans=`expr $a + $ans'
a=`expr $a + 10'
done
echo "$ans"
```
So what is wrong in this program? | 2016/04/26 | [
"https://Stackoverflow.com/questions/36856676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6243463/"
] | You have syntax error in your code, try this instead -
```
#!/bin/bash
a=10
ans=0
while [ $a -le 190 ]
do
ans=`expr $a + $ans`
a=`expr $a + 10`
done
echo "$ans"
```
>
> Errors you were facing -
>
>
> * No space after **while**
> * Use of **'** instead of **`** in *ans=`expr $a + $an... | It's more efficient to use a closed form solution like this:
```
lower=10
upper=190
echo $(( ($upper + $lower) / 2 ))
``` |
36,856,676 | I am new to bash scripting.
i wrote a simple code to find the average of all the multiples of ten from 10 to 190 inclusive.
The code is:
```
#!/bin/bash
a=10
ans=0
while[ $a -le 190 ]
do
ans=`expr $a + $ans'
a=`expr $a + 10'
done
echo "$ans"
```
So what is wrong in this program? | 2016/04/26 | [
"https://Stackoverflow.com/questions/36856676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6243463/"
] | so you have couple of mistakes in your code, this is the correct version of yours:
```
a=10
ans=0
while test $a -le 190
do
a=$(expr $a + 10)
ans=$(expr $a + $ans)
done
echo $ans
```
problem was that you have to use `test` in loops like `while` or `if` statements, also for the `expr` to work you have to... | It's more efficient to use a closed form solution like this:
```
lower=10
upper=190
echo $(( ($upper + $lower) / 2 ))
``` |
36,856,676 | I am new to bash scripting.
i wrote a simple code to find the average of all the multiples of ten from 10 to 190 inclusive.
The code is:
```
#!/bin/bash
a=10
ans=0
while[ $a -le 190 ]
do
ans=`expr $a + $ans'
a=`expr $a + 10'
done
echo "$ans"
```
So what is wrong in this program? | 2016/04/26 | [
"https://Stackoverflow.com/questions/36856676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6243463/"
] | Your script has some syntax issues. One suggestion you can use "let" instead of "expr" command it makes your code more readable. Ex: let a=10+1. Save your file with executable permission or use "source " to execute.
```
#!/bin/bash
a=10
ans=0
count=0
while [ $a -le 190 ]; do
ans=`expr $a + $ans`
a=`expr $a +... | It's more efficient to use a closed form solution like this:
```
lower=10
upper=190
echo $(( ($upper + $lower) / 2 ))
``` |
36,856,676 | I am new to bash scripting.
i wrote a simple code to find the average of all the multiples of ten from 10 to 190 inclusive.
The code is:
```
#!/bin/bash
a=10
ans=0
while[ $a -le 190 ]
do
ans=`expr $a + $ans'
a=`expr $a + 10'
done
echo "$ans"
```
So what is wrong in this program? | 2016/04/26 | [
"https://Stackoverflow.com/questions/36856676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6243463/"
] | You have syntax error in your code, try this instead -
```
#!/bin/bash
a=10
ans=0
while [ $a -le 190 ]
do
ans=`expr $a + $ans`
a=`expr $a + 10`
done
echo "$ans"
```
>
> Errors you were facing -
>
>
> * No space after **while**
> * Use of **'** instead of **`** in *ans=`expr $a + $an... | so you have couple of mistakes in your code, this is the correct version of yours:
```
a=10
ans=0
while test $a -le 190
do
a=$(expr $a + 10)
ans=$(expr $a + $ans)
done
echo $ans
```
problem was that you have to use `test` in loops like `while` or `if` statements, also for the `expr` to work you have to... |
36,856,676 | I am new to bash scripting.
i wrote a simple code to find the average of all the multiples of ten from 10 to 190 inclusive.
The code is:
```
#!/bin/bash
a=10
ans=0
while[ $a -le 190 ]
do
ans=`expr $a + $ans'
a=`expr $a + 10'
done
echo "$ans"
```
So what is wrong in this program? | 2016/04/26 | [
"https://Stackoverflow.com/questions/36856676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6243463/"
] | You have syntax error in your code, try this instead -
```
#!/bin/bash
a=10
ans=0
while [ $a -le 190 ]
do
ans=`expr $a + $ans`
a=`expr $a + 10`
done
echo "$ans"
```
>
> Errors you were facing -
>
>
> * No space after **while**
> * Use of **'** instead of **`** in *ans=`expr $a + $an... | Your script has some syntax issues. One suggestion you can use "let" instead of "expr" command it makes your code more readable. Ex: let a=10+1. Save your file with executable permission or use "source " to execute.
```
#!/bin/bash
a=10
ans=0
count=0
while [ $a -le 190 ]; do
ans=`expr $a + $ans`
a=`expr $a +... |
24,718,874 | What is the difference between \* and \*& in function parameters. For example,
What is the difference between this,
```
void a(SomeType *s)
{
}
```
and this,
```
void a(SomeType *&s)
{
}
``` | 2014/07/13 | [
"https://Stackoverflow.com/questions/24718874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3711299/"
] | First, let's add some "meat" to `a`:
```
void a1(SomeType *s)
{
s = new SomeType;
}
void a2(SomeType *&s)
{
s = new SomeType;
}
```
Now assume you have this code, which calls `a`:
```
void func()
{
SomeType *p1 = nullptr;
a1(p1);
if (p == nullptr)
std::cout << "p1 is null" << std::endl;... | When you pass a reference (using `&`) into a function, you can modify the value and the modifications will not be local. If you don't pass a reference (no `&`), the modifications will be local to the function.
```
#include <cstdio>
int one = 1, two = 2;
// x is a pointer passed *by value*, so changes are local
void f... |
24,718,874 | What is the difference between \* and \*& in function parameters. For example,
What is the difference between this,
```
void a(SomeType *s)
{
}
```
and this,
```
void a(SomeType *&s)
{
}
``` | 2014/07/13 | [
"https://Stackoverflow.com/questions/24718874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3711299/"
] | When you pass a reference (using `&`) into a function, you can modify the value and the modifications will not be local. If you don't pass a reference (no `&`), the modifications will be local to the function.
```
#include <cstdio>
int one = 1, two = 2;
// x is a pointer passed *by value*, so changes are local
void f... | In first case the function accepts the value of a pointer. In second case the function accepts non-constant reference to the pointer variable and that means that you can change this pointer location through the reference. |
24,718,874 | What is the difference between \* and \*& in function parameters. For example,
What is the difference between this,
```
void a(SomeType *s)
{
}
```
and this,
```
void a(SomeType *&s)
{
}
``` | 2014/07/13 | [
"https://Stackoverflow.com/questions/24718874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3711299/"
] | First, let's add some "meat" to `a`:
```
void a1(SomeType *s)
{
s = new SomeType;
}
void a2(SomeType *&s)
{
s = new SomeType;
}
```
Now assume you have this code, which calls `a`:
```
void func()
{
SomeType *p1 = nullptr;
a1(p1);
if (p == nullptr)
std::cout << "p1 is null" << std::endl;... | In first case the function accepts the value of a pointer. In second case the function accepts non-constant reference to the pointer variable and that means that you can change this pointer location through the reference. |
13,740,572 | I have a number of tables with data in `Schema1` and I would like to copy these tables, with the data, to a new schema I have created, `Schema2`.
Is there an elegant way of doing this? I am using SQL Server Management studio. | 2012/12/06 | [
"https://Stackoverflow.com/questions/13740572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1107474/"
] | In SQL Management studio right click the database that has the source table, select Tasks -> Export data.
You will be able to set source and destination server and schema, select the tables you wish to copy and you can have the destination schema create the tables that will be exported.
Also, if copying to the same s... | Assuming the schema has structural changes, so you can't just do a backup and restore to a new database you can right-mouse click on the database and select tasks | generate scripts. On the second page there is an option (off by default) to script the data.
That creates a series of SQL insert statements along with the... |
13,740,572 | I have a number of tables with data in `Schema1` and I would like to copy these tables, with the data, to a new schema I have created, `Schema2`.
Is there an elegant way of doing this? I am using SQL Server Management studio. | 2012/12/06 | [
"https://Stackoverflow.com/questions/13740572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1107474/"
] | In SQL Management studio right click the database that has the source table, select Tasks -> Export data.
You will be able to set source and destination server and schema, select the tables you wish to copy and you can have the destination schema create the tables that will be exported.
Also, if copying to the same s... | Here is what I did:
1. right click on source table and select "select top 1000 rows".
2. remove "top 1000" from select.
3. add "INTO newschema.newtable" above the from clause
4. run that query.
5. create the indexes on the new table.
This will not work for everyone because it requires the new schema to be available f... |
1,703,259 | Let $G$ be a group, $H\_{1},H\_{1} \leq G $. Then $H\_1 \cup H\_2 \leq G \iff H\_1 \subset H\_2$ or $H\_2 \subset H\_1$
I'm stucked at this very trivial proof of groups. Here's my attempt:
$(\Leftarrow)$
$x \in H\_{1} \Rightarrow x \in H\_{2} $ or $x \in H\_{2} \Rightarrow x \in H\_{1} $
Let $x,y \in H\_1 \cup H\_2... | 2016/03/18 | [
"https://math.stackexchange.com/questions/1703259",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | I will show it using induction. Observe that
$$ \frac{k}{(k-k)!} = k(k-1)\dots(k-k+1)
$$
Hence the case holds for $n = k$. Suppose that it holds for $n - 1$. Then
$$\begin{align\*}
\frac{n!}{(n-k)!}
&= \frac{n (n-1)!}{(n-k) (n-k-1)!}\\
&= \frac{n}{(n-k)} (n-1)(n-2)\dots(n-k)\\
&= n(n-1)(n-2)\dots(n-k+1)
\end{align\*}$$ | from equations
$$\binom{n}{k}=\frac{n}{k}\binom{n-1}{k-1}$$ and$$\binom{n}{0}=1$$ we get
$$\binom{n}{k}=\frac{n}{k}\binom{n-1}{k-1}=\frac{n}{k}\frac{n-1}{k-1}\binom{n-2}{k-2}=\frac{n}{k}\frac{n-1}{k-1}\frac{n-2}{k-2}\binom{n-3}{k-3}=$$
$$=\frac{n}{k}\frac{n-1}{k-1}\frac{n-2}{k-2}...\frac{n-(k-1)}{k-(k-1)}\binom{n-k}{... |
1,703,259 | Let $G$ be a group, $H\_{1},H\_{1} \leq G $. Then $H\_1 \cup H\_2 \leq G \iff H\_1 \subset H\_2$ or $H\_2 \subset H\_1$
I'm stucked at this very trivial proof of groups. Here's my attempt:
$(\Leftarrow)$
$x \in H\_{1} \Rightarrow x \in H\_{2} $ or $x \in H\_{2} \Rightarrow x \in H\_{1} $
Let $x,y \in H\_1 \cup H\_2... | 2016/03/18 | [
"https://math.stackexchange.com/questions/1703259",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | I will show it using induction. Observe that
$$ \frac{k}{(k-k)!} = k(k-1)\dots(k-k+1)
$$
Hence the case holds for $n = k$. Suppose that it holds for $n - 1$. Then
$$\begin{align\*}
\frac{n!}{(n-k)!}
&= \frac{n (n-1)!}{(n-k) (n-k-1)!}\\
&= \frac{n}{(n-k)} (n-1)(n-2)\dots(n-k)\\
&= n(n-1)(n-2)\dots(n-k+1)
\end{align\*}$$ | Seriously?
$n! = n\*(n-1)...........\*3\*2\*1$
$(n-k)! = (n-k)\*...... \*3\*2\*1$
So $\frac {n!}{(n-k)!} = \frac {n\*(n-1)\*.....\*(n-k + 1)(n-k)\*(n-k - 1)\*....\*3\*2\*1}{(n-k)\*(n-k - 1)\*....\*3\*2\*1} = n\*(n-1)\*.....\*(n-k + 1)$
And $\frac {n!}{k!(n-k)!} = \frac 1 {k!}\frac {n!}{(n-k)!} = \frac 1 {k!}n\*(n-1... |
61,197,978 | I have my cursor between two lines in vim:
[](https://i.stack.imgur.com/LfiYP.png)
I would do this in a 'normal' editor by pressing ctrl-d to delete the characters after the cursor. What would be the most efficient way to do this in vim? | 2020/04/13 | [
"https://Stackoverflow.com/questions/61197978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/651174/"
] | Your current cursor is at `,`:
* if you want to remove the linebreak: press `J`
* if you want to remove the ',' : press `x`
* if you want to remove the closing single-quote `'`: press `X` | If you want to join lines with no space in beewin them press
```
gJ
```
If you want to remove the rest of the line in insert mode:
```
Ctrl-o D
```
To map this action, you can put this on your ~/.vimrc
```
" delete the rest of the current line
inoremap <c-k> <c-o>d
```
I'm not suggesting maping `Ctrl``d` beca... |
21,215,926 | I am trying to read a string of characters in C:
If I use gets, the compiler doesnt read my word, because it considers ENTER as being my string, I guess. I tried using
```
scanf("%*c")
```
but then if i do that and type "flower", the variable stores the string "lower". If I use
```
scanf("%s",s)
```
then the c... | 2014/01/19 | [
"https://Stackoverflow.com/questions/21215926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3078259/"
] | Simply "remove" the newline if it's in the end of the string:
```
if (fgets(s, 20, stdin) != NULL)
{
while (strlen(s) > 0 && s[strlen(s) - 1] == '\n')
s[strlen(s) - 1] = '\0';
}
``` | You can use `getchar()` and `ungetchar()` to solve this problem , Like this :
```
char c;
while((c=getchar())<=' ');
ungetchar(c);
```
the code above will remove any unwanted spaces or enters before the string , then you can `gets` as you want |
21,215,926 | I am trying to read a string of characters in C:
If I use gets, the compiler doesnt read my word, because it considers ENTER as being my string, I guess. I tried using
```
scanf("%*c")
```
but then if i do that and type "flower", the variable stores the string "lower". If I use
```
scanf("%s",s)
```
then the c... | 2014/01/19 | [
"https://Stackoverflow.com/questions/21215926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3078259/"
] | Simply "remove" the newline if it's in the end of the string:
```
if (fgets(s, 20, stdin) != NULL)
{
while (strlen(s) > 0 && s[strlen(s) - 1] == '\n')
s[strlen(s) - 1] = '\0';
}
``` | scanf() does not read the string after space. In short, it reads continuous string but fgets() is defined to read characters(space also). In my compiler Dev-C++ & 64-bit operating system, fgets() is reading characters including space. Note space is also a character defined with ASCII value. |
39,281,104 | how can we merge two styles blocks of different classes which are having same properties except "Padding" as shown in below code in to one block.
Here i am using SASS(Syntactically Awesome Style Sheets).Any help would be appreciable. Thank you.
```css
.bookstyle {
color: $alt-dark-blue;
padding-left:82.1px... | 2016/09/01 | [
"https://Stackoverflow.com/questions/39281104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6785154/"
] | One way of doing this is to have one extend the other. Here's an example of it
```
.bookstyle {
@extend .pagestyle;
padding-left:82.1px;
}
.pagestyle {
color: red;
clear : both;
cursor: pointer;
font-size: 10px;
}
```
Alternatively you could use mixins to add the required rules.
I'm a... | You can use `@extend` rule
```
%pagestyle {
color: $alt-dark-blue;
clear : both;
cursor: pointer;
font-size: 10px;
}
.bookstyle {
@extend %pagestyle;
padding-left:82.1px;
}
``` |
45,715 | I'm working on a sensor project which uses [TelosB](http://www.memsic.com/products/wireless-sensor-networks/wireless-modules.html) based on MSP430F1611 running [TinyOS](http://tinyos.net/). My program is reset some time after boot up. After the PUC reset, IFG1 is found with WDTIFG bit set, indicating the watchdog timer... | 2012/10/29 | [
"https://electronics.stackexchange.com/questions/45715",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/15664/"
] | If the problem is repeatable it will help a tremendous amount. The debug process can be addressed if you have a couple of key embedded development tools available. These tools would include a digital oscilloscope and two spare GPIO pins on your processor. In the absence of two spare pins it is often possible to tempora... | Indeed this is one of the challenges of embedded programming.
I see several options to try and narrow down the issue:
1) Use JTAG connected to the TelosB and put a breakpoint on an access to the Watchdog timer. At some point hopefully it will manifest and it will break and you can look at it.
2) use the FLASH (eithe... |
39,956,788 | I need help here. I have a system developed with Yii framework. I have the CKEDITOR widget in Yii Booster. When user press the enter key, I want to have '**br**'instead of '**p**'.
Below is my script:
```
$this->widget('booster.widgets.TbCKEditor',array(
'model'=>$model,
'attribute'=>'qualification... | 2016/10/10 | [
"https://Stackoverflow.com/questions/39956788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1767592/"
] | you can have solution from here <https://github.com/2amigos/yii2-ckeditor-widget/issues/41>
you need to use `clientOptions` like below:
```
$form->field($model, 'text')->widget(CKEditor::className(), [
'options' => ['rows' => 6],
'preset' => 'standard',
'clientOptions'=>[
'enterMod... | Solution for this post:
```
$this->widget('booster.widgets.TbCKEditor',array(
'model'=>$model,
'attribute'=>'qualifications',
'editorOptions'=>array(
'enterMode'=> 2,
),
) );
``` |
27,402,938 | I have the following code, T1 need to access "a" which is the constructor parameter of Test (extends T1), but compile failed. How to fix it?
```
trait T1 {
def x=a.length
}
class Test(a:String) extends T1{
}
``` | 2014/12/10 | [
"https://Stackoverflow.com/questions/27402938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/266185/"
] | There are several possibilities:
1. Declare `a` in your trait as an abstract member:
`trait T1 { def a: String; def x = a.length }
class Test(val a: String) extends T1`
2. Create a different trait that declares `a`:
`trait HasA { def a: String }
trait T1 extends HashA { def x = a.length; }
class Test(val a: String)... | As I said before in a comment it doesn't make much sense to me, anyway you can use a self type reference to the trait and make the variable accessible using `val`:
```
trait T1 {
self: Test => // self type reference.
def x= a.length
}
class Test(val a: String) extends T1{ }
```
In this way though `T1` will be ... |
59,295,944 | I'm trying to add "<" and ">" to every element in my csv file.
For example:
```
Data1,Data2,Data3
Number1,Number2,Number3
```
Converting to this:
```
<Data1>,<Data2>,<Data3>
<Number1>,<Number2>,<Number3>
```
My code:
```
with open(os.path.join(args["input"],file), 'r') as infile, open(os.path.join(args["... | 2019/12/12 | [
"https://Stackoverflow.com/questions/59295944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12520377/"
] | Jquery toggle() method was removed in version 1.9. So you can try the following alternative method I wrote. This should work exactly same.
```
$.fn.toggleIt = function() {
var _args = arguments, i = 0;
$(this).click(function() {
i = (i == _args.length) ? 0: i;
_args[i++].call(this);
});
};... | try following code
```
$(document).on('toggle', '.dots-menu', function() {
console.log( $(this).data('menu') )
$( this ).children().addClass( "on" );
$( '#dot-menu-event').addClass('open');
}, function() {
$( this ).children().removeClass( "on" );
$( '#dot-menu-event').remov... |
19,072,884 | I have a php script that creates a random 10 digit order number:
```
// Assign order number length
$digits = 10;
// Create random order number to be stored with this order
$order_number = rand(pow(10, $digits-1), pow(10, $digits)-1);
```
How do I prevent this from ever including the digit zero `0` in the random 10... | 2013/09/28 | [
"https://Stackoverflow.com/questions/19072884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2759889/"
] | You can do fancy base conversions, but in the end, the most straightforward way is to just get a string:
```
function random_string($count, $available) {
$result = '';
$max = strlen($available) - 1;
for($i = 0; $i < $count; $i++) {
$result .= $available[rand(0, $max)];
}
return $result;
}... | I would make a function.
```
<?php
function myRandomNumberWithoutZeros($digits)
{
$result = str_replace("0", "",rand(pow(10,$digits-1), pow(10, $digits)-1)."");
$resultLength = strlen($result);
if($resultLength < $digits)
{
return intval($result.myRandomNumberWithoutZeros($digits-$resultLengt... |
19,072,884 | I have a php script that creates a random 10 digit order number:
```
// Assign order number length
$digits = 10;
// Create random order number to be stored with this order
$order_number = rand(pow(10, $digits-1), pow(10, $digits)-1);
```
How do I prevent this from ever including the digit zero `0` in the random 10... | 2013/09/28 | [
"https://Stackoverflow.com/questions/19072884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2759889/"
] | You could use a simple function like this:
```
function getRandom($length) {
$numbers = '';
for($i = 0; $i < $length; $i++) {
$numbers .= rand(1, 9);
}
return $numbers;
}
echo getRandom(10);
``` | I would make a function.
```
<?php
function myRandomNumberWithoutZeros($digits)
{
$result = str_replace("0", "",rand(pow(10,$digits-1), pow(10, $digits)-1)."");
$resultLength = strlen($result);
if($resultLength < $digits)
{
return intval($result.myRandomNumberWithoutZeros($digits-$resultLengt... |
19,072,884 | I have a php script that creates a random 10 digit order number:
```
// Assign order number length
$digits = 10;
// Create random order number to be stored with this order
$order_number = rand(pow(10, $digits-1), pow(10, $digits)-1);
```
How do I prevent this from ever including the digit zero `0` in the random 10... | 2013/09/28 | [
"https://Stackoverflow.com/questions/19072884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2759889/"
] | Try this :D
```
function getRandom($from, $to){
$num = rand($from, $to);
$have_zero = true;
$strNum = strval($num);
while ($have_zero){
$have_zero = false;
for ($i = 0; $i < sizeof($strNum); $i++){
if ($strNum[$i] == '0'){
$have_zero = true;
$... | I would make a function.
```
<?php
function myRandomNumberWithoutZeros($digits)
{
$result = str_replace("0", "",rand(pow(10,$digits-1), pow(10, $digits)-1)."");
$resultLength = strlen($result);
if($resultLength < $digits)
{
return intval($result.myRandomNumberWithoutZeros($digits-$resultLengt... |
19,072,884 | I have a php script that creates a random 10 digit order number:
```
// Assign order number length
$digits = 10;
// Create random order number to be stored with this order
$order_number = rand(pow(10, $digits-1), pow(10, $digits)-1);
```
How do I prevent this from ever including the digit zero `0` in the random 10... | 2013/09/28 | [
"https://Stackoverflow.com/questions/19072884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2759889/"
] | You can treat it as a number of base 9
```
base_convert(rand(0, pow(9, $digits) - 1), 10, 9)
```
This will give you numbers with digits from 0 to 8.
Now just add 1 to every digit to make it 1 to 9
```
(pow(10, $digits) - 1) / 9
```
will give you a number filled with ones. Now just add it to your previous number ... | I would make a function.
```
<?php
function myRandomNumberWithoutZeros($digits)
{
$result = str_replace("0", "",rand(pow(10,$digits-1), pow(10, $digits)-1)."");
$resultLength = strlen($result);
if($resultLength < $digits)
{
return intval($result.myRandomNumberWithoutZeros($digits-$resultLengt... |
36,007,995 | I have a very simple AngularJS SPA, using UI Router to switch between two views. Upon clicking on the Home link, the user will see a line of text. The About link should do the same, but its routing is configured to use a templateUrl instead of a template string:
```
$stateProvider
.state("home", {
url: "/home"... | 2016/03/15 | [
"https://Stackoverflow.com/questions/36007995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127826/"
] | I figured it out after many hours of research. These are the things I needed to do:
1. [requireJS](http://requirejs.org/), to allow me to easily load scripts at runtime. This ended up being a huge volume of work, because *everything* needs to be loaded dynamically and I needed to set up the dependencies for all our di... | For routing in angular, you should use routeProvider it you can then use it like this for navigation:
```
var app = angular.module('moduleName', [
'ngRoute',
'angularModalService'
]);
app.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/home', {
templateUrl: 'partials/ho... |
36,007,995 | I have a very simple AngularJS SPA, using UI Router to switch between two views. Upon clicking on the Home link, the user will see a line of text. The About link should do the same, but its routing is configured to use a templateUrl instead of a template string:
```
$stateProvider
.state("home", {
url: "/home"... | 2016/03/15 | [
"https://Stackoverflow.com/questions/36007995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127826/"
] | I figured it out after many hours of research. These are the things I needed to do:
1. [requireJS](http://requirejs.org/), to allow me to easily load scripts at runtime. This ended up being a huge volume of work, because *everything* needs to be loaded dynamically and I needed to set up the dependencies for all our di... | To answer your question, Angular is designed in such a way that it loads all its js files and the gives the control to angular. While loading the Js files, all the controllers, Services etc., are registered with the ngApp. That is why it is recommended to give all the script files in the index.html itself.
If you thi... |
37,058,852 | I have an HTML form that contains regular inputs as well as a file input. When a user selects one or more files to upload, I instantly change the `target` attribute of the form to the `name` attribute of a hidden iframe on the page as well as change the `action` attribute of the form to the script that I want to send t... | 2016/05/05 | [
"https://Stackoverflow.com/questions/37058852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1992973/"
] | **Below are some explaining refer to your bug**
* [Rerendering components with iframe leads to browser history duplicates](https://github.com/ReactTraining/react-router/issues/6259)
>
> The navigation events of the iframe (change its src attribute in this case) are propagated up to the parent window as well.
>
>
>... | I figured out the problem and a solution. The problem was that I had an iframe on the form page when the form was first loaded and somehow (I don't know why) that was causing the problem described above.
However, I decided to remove the iframe from page-load, and instead dynamically create an iframe via JS when it was... |
42,421 | How to create multiple thunderbird mail accounts in ubuntu 10.10 ? I just want to show only one account in each thunderbird shortcuts.. Is it possible ? | 2011/05/13 | [
"https://askubuntu.com/questions/42421",
"https://askubuntu.com",
"https://askubuntu.com/users/5691/"
] | As with **firefox**, you can create a new profile starting the application with
```
thunderbird -no-remote -ProfileManager
```
(the `-no-remote` option is required to start a new instance, if another is already running).
Once created one or more profiles, to start with a given profile you can create a launcher wit... | To add multiple account go to Edit>Account Settings then use the button in bottom left corner.
You can change the account visualization using the left column. |
42,421 | How to create multiple thunderbird mail accounts in ubuntu 10.10 ? I just want to show only one account in each thunderbird shortcuts.. Is it possible ? | 2011/05/13 | [
"https://askubuntu.com/questions/42421",
"https://askubuntu.com",
"https://askubuntu.com/users/5691/"
] | As with **firefox**, you can create a new profile starting the application with
```
thunderbird -no-remote -ProfileManager
```
(the `-no-remote` option is required to start a new instance, if another is already running).
Once created one or more profiles, to start with a given profile you can create a launcher wit... | Just step by step,
1. You can see I have already had an account which is called zhuxu...3.com. I am sure about you already have one, what you need to do is to click your created account in your thunderbird.
2. Then you will see "Create a new account" (it so big that you can find it easily), click it and fills your an... |
48,772,110 | I'm trying to follow the tutorial [here](https://www.joshmorony.com/creating-role-based-authentication-with-passport-in-ionic-2-part-2/) but since I'm using a newer version of Angular and Ionic (Angular 5 and Ionic 3), I got errors on these lines below
```
this.token = data.token;
this.storage.set('token', data.token)... | 2018/02/13 | [
"https://Stackoverflow.com/questions/48772110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/301584/"
] | Try parsing it as,
```
this.token = data['token'];
this.storage.set('token', this.token);
``` | If Typescript not able to identify the property 'token' on your object 'res' change to res: any
```
this.http.post(api.url, params)
.subscribe((res:any) => {
...
..
}
``` |
21,573,878 | How foreach this array to `< a href="path-to-jpg-file">name< /a>`
```
Array
(
[0] => Array
(
[0] => 01-siena-rosso-new.jpg
[1] => Siena Rosso
)
[1] => Array
(
[0] => 02-siena-noce-new.jpg
[1] => Siena Noce
)
[2... | 2014/02/05 | [
"https://Stackoverflow.com/questions/21573878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1546396/"
] | Try loop like this:-
```
foreach($array as $value) {
echo '<a href="'.$value[0].'">'.$value[1].'</a>';
}
```
[Working Demo](https://eval.in/98124) | Expanding on Roopendras, you just need preg\_replace:
```
foreach($array as $value) {
echo '<a href="'.preg_replace('/^\d\d-/','',$value[0]).'">'.$value[1].'</a>';
}
``` |
21,372,098 | I am new to using NumPy and trying to work with arrays, tried building a 1D,2D and now a 3D array. But I wasn't sure why ndim thinks that this is a 2D array even though it has 3 rows
```
In [26]: c= array ([[1,1,1,1],[2,2,2,2],[3,3,3,3]])
In [27]: c
Out[27]:
array([[1, 1, 1, 1],
[2, 2, 2, 2],
[3, 3, 3,... | 2014/01/27 | [
"https://Stackoverflow.com/questions/21372098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3172057/"
] | Look at the nested list you're passing to the `array` constructor. What kind of expression would you use to retrieve an element?
```
A[i][j] # This?
A[i][j][k] # Or this?
```
If it's the first option, you have a 2D array. If it's the second option, you have a 3D array. The number of indexes you need is the dimens... | Dimensions are different than items. In your situation, you can check if you have a 2d array by asking for the length,
```
len(c)
```
would give you 3, since you have 3 elements at the top index c. If you want to check how many elements are in each of those top three, you would do
```
len(c[0])
len(c[1])
len(c[2])
... |
21,372,098 | I am new to using NumPy and trying to work with arrays, tried building a 1D,2D and now a 3D array. But I wasn't sure why ndim thinks that this is a 2D array even though it has 3 rows
```
In [26]: c= array ([[1,1,1,1],[2,2,2,2],[3,3,3,3]])
In [27]: c
Out[27]:
array([[1, 1, 1, 1],
[2, 2, 2, 2],
[3, 3, 3,... | 2014/01/27 | [
"https://Stackoverflow.com/questions/21372098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3172057/"
] | Look at the nested list you're passing to the `array` constructor. What kind of expression would you use to retrieve an element?
```
A[i][j] # This?
A[i][j][k] # Or this?
```
If it's the first option, you have a 2D array. If it's the second option, you have a 3D array. The number of indexes you need is the dimens... | The dimensions depend on the number of groupings, not the number of rows. The first example is an array of arrays, so it's 2D. The second is an array of arrays of arrays (with 1 number in them) so it's 3D. |
21,372,098 | I am new to using NumPy and trying to work with arrays, tried building a 1D,2D and now a 3D array. But I wasn't sure why ndim thinks that this is a 2D array even though it has 3 rows
```
In [26]: c= array ([[1,1,1,1],[2,2,2,2],[3,3,3,3]])
In [27]: c
Out[27]:
array([[1, 1, 1, 1],
[2, 2, 2, 2],
[3, 3, 3,... | 2014/01/27 | [
"https://Stackoverflow.com/questions/21372098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3172057/"
] | Look at the nested list you're passing to the `array` constructor. What kind of expression would you use to retrieve an element?
```
A[i][j] # This?
A[i][j][k] # Or this?
```
If it's the first option, you have a 2D array. If it's the second option, you have a 3D array. The number of indexes you need is the dimens... | You're not talking about dimension. I think you're looking for shape:
```
In [8]: c.shape
Out[8]: (3, 4)
```
Which gives you rows and columns.
```
In [9]: c.ndim
Out[9]: 2
```
Gives number of dimensions you can index/subscript by. If you have a small raster of pixels as 2D, 3D would be a volume of voxels. |
74,112,747 | I am seeking to find first date of the month in the corresponding table:
[](https://i.stack.imgur.com/sdzoa.png)
So if i have 26/08/2011 August as date and 2 months to add, it becomes 26/10/2011. I need the first date of the resulting month- like 01/... | 2022/10/18 | [
"https://Stackoverflow.com/questions/74112747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2458552/"
] | You could try using date\_add for add two months and date\_sub for sub the days -1
```
set @my_date = "2017-06-15";
SELECT DATE_SUB( DATE_ADD(@my_date, INTERVAL 2 MONTH),
INTERVAL DAYOFMONTH(@my_date)-1 DAY);
``` | Assuming your date is currently a `varchar` in `dd/MM/yyyy` format, you can use `STR_TO_DATE` to convert it to a `DATE` type column, then use `DATE_ADD` with your `months_add` column to dynamically add months then finally use `DATE_FORMAT` to display it back in a `01/MM/yyyy` format with the first day of the month.
``... |
74,112,747 | I am seeking to find first date of the month in the corresponding table:
[](https://i.stack.imgur.com/sdzoa.png)
So if i have 26/08/2011 August as date and 2 months to add, it becomes 26/10/2011. I need the first date of the resulting month- like 01/... | 2022/10/18 | [
"https://Stackoverflow.com/questions/74112747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2458552/"
] | ```sql
SELECT table.date,
table.month_add,
DATE_FORMAT(table.date + INTERVAL table.month_add MONTH,
'%Y-%m-01') AS beginning_of_month
FROM table
``` | Assuming your date is currently a `varchar` in `dd/MM/yyyy` format, you can use `STR_TO_DATE` to convert it to a `DATE` type column, then use `DATE_ADD` with your `months_add` column to dynamically add months then finally use `DATE_FORMAT` to display it back in a `01/MM/yyyy` format with the first day of the month.
``... |
147,996 | Say, a planet has the same orbital periods as Earth (365 days in a year, 24 hours in a day, etc. with respect to Earth-bound clocks), but the planet has double the mass. So, time must pass more slowly on that planet compared to Earth, right? What would it feel like to live on that planet? What would be the length of da... | 2014/11/21 | [
"https://physics.stackexchange.com/questions/147996",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/63456/"
] | Your group theory text probably betrayed you if it did not spend much time contrasting the two cases. A possibly related question is [254461](https://physics.stackexchange.com/questions/162417/tensor-product-of-two-different-pauli-matrices-sigma-2-otimes-eta-1/254461#254461). People use loose language and symbols that ... | I guess what you are missing is the following:
given a representation $\rho(g)$ of $g\in$SU(2) acting on some vector space $V$. We define the representation $\rho\_\otimes$ of SU(2) (**not of SU(2)$\times$SU(2)**) on $V\otimes V$ as
$$\rho\_\otimes(g) (v\_1 \otimes v\_2) = \rho(g) v\_1 \otimes \rho(g) v\_2.$$
So in fa... |
46,394,847 | I am a newbie to android and trying to use Dagger2. I spend whole night and still dont know why my dagger does not provide presenter. Here are my code (I use Kotlin)
AppComponent
```
@Singleton
@Component(modules = arrayOf(PresenterModule::class))
interface AppComponent {
fun inject(target: SplashActivity)
}
`... | 2017/09/24 | [
"https://Stackoverflow.com/questions/46394847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8244178/"
] | Since you're not using constructor injection here (which you can't, because you don't 'own' the activity's constructor) Dagger does not 'know' that it has to inject something into your `Activity`.
You have to manually inject like this:
```
(applicationContext as App).appComponent.inject(this)
```
in your `SplashAc... | You forgot to inject the SplashActivity:
```
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
App.appComponent.inject(this)
setContentView(R.layout.activity_splash)
...
``` |
53,628,622 | I'm trying to write a neural Network for binary classification in PyTorch and I'm confused about the loss function.
I see that BCELoss is a common function specifically geared for binary classification. I also see that an output layer of N outputs for N possible classes is standard for general classification. However,... | 2018/12/05 | [
"https://Stackoverflow.com/questions/53628622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6186822/"
] | For binary outputs you can use ***1*** output unit, so then:
```
self.outputs = nn.Linear(NETWORK_WIDTH, 1)
```
Then you use [`sigmoid`](https://pytorch.org/docs/stable/nn.html#torch.nn.functional.sigmoid) activation to map the values of your output unit to a range between ***0*** and ***1*** *(of course you need to... | *Some theoretical add up:*
For binary classification (say class 0 & class 1), the network should have only 1 output unit. Its output will be 1 (for class 1 present or class 0 absent) and 0 (for class 1 absent or class 0 present).
For loss calculation, you should first pass it through sigmoid and then through BinaryC... |
68,994,934 | I need to import a few python files stored in my local memory as modules in my Jupyter Notebook.
My jupyter notebook is store in C:\snip\Pictures\demo and I need to import python files stored in C:\snip\Pictures\demo\mrcnn.
When I try this:
```
from mrcnn import utils
from mrcnn import visualize
from mrcnn.visualize... | 2021/08/31 | [
"https://Stackoverflow.com/questions/68994934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15042277/"
] | What you are doing works with using .py files, but Jupyter files are a bit different. You need to import modules by adding %run
If you wish to also use the variables in the py file, use %run -i. | Do this. Print the `sys.path` like this. This lists the directories that the python interpreter is looking inside when doing `import`.
```
import sys
print(sys.path)
```
```
Output (Something like this):
['/mnt/c/Users/lapto/Desktop/demos', '/home/elaaf/anaconda3/lib/python38.zip', '/home/elaaf/anaconda3/lib/pytho... |
68,994,934 | I need to import a few python files stored in my local memory as modules in my Jupyter Notebook.
My jupyter notebook is store in C:\snip\Pictures\demo and I need to import python files stored in C:\snip\Pictures\demo\mrcnn.
When I try this:
```
from mrcnn import utils
from mrcnn import visualize
from mrcnn.visualize... | 2021/08/31 | [
"https://Stackoverflow.com/questions/68994934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15042277/"
] | What you are doing works with using .py files, but Jupyter files are a bit different. You need to import modules by adding %run
If you wish to also use the variables in the py file, use %run -i. | This might be outdated. I came across this post as I have the same issue. And when I saw Vedant Modi's comment saying that "Made a new notebook and it worked, no idea why", it comes to me that it might works to try to restart the kernel. And yes, restart the kernel fix the problem. |
68,994,934 | I need to import a few python files stored in my local memory as modules in my Jupyter Notebook.
My jupyter notebook is store in C:\snip\Pictures\demo and I need to import python files stored in C:\snip\Pictures\demo\mrcnn.
When I try this:
```
from mrcnn import utils
from mrcnn import visualize
from mrcnn.visualize... | 2021/08/31 | [
"https://Stackoverflow.com/questions/68994934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15042277/"
] | What you are doing works with using .py files, but Jupyter files are a bit different. You need to import modules by adding %run
If you wish to also use the variables in the py file, use %run -i. | I am using Jupyter notebooks from VS Code and I faced a similar challenge. I adopted this approach:
Folder structure
----------------
I would like to explain my solution using the simplified folder structure shown below. I want to re-use the code in `mymodule.py` in my notebooks `mynotebook1.ipynb`
```
root
|
... |
59,351,198 | I am trying to get values of hidden input which is added dynamically on click of `insert more` button.
Here is stackblitz link: [get hidden input value](https://stackblitz.com/edit/get-dynamic-added-component-values-qgky91)
I tried to use `patchValue()` method on `linkTo()` function but no luck, I am getting empty st... | 2019/12/16 | [
"https://Stackoverflow.com/questions/59351198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3292482/"
] | I have try something with code and added the Value in the SelectLinkTo.
```
linkTo(where: string, btnId: number) {
console.log(btnId);
let formArray = (<FormArray>this.loginForm[this.currentTab].get('loginFromArr')).at(btnId)
console.log(formArray);
formArray.patchValue({
selectedLinkTo :wh... | You can just pass form and set the control value like this.
```
<a style="border: 1px solid red;margin-top: 10px; margin-left: 5px;" id="a-{{i}}"
(click)="linkTo('a',item)"
class="btn-link-group border-right-0 first-btn"
mat-button>A link</a>
```
---
```
linkTo(where: string, form: any) {
//debugger;
... |
59,351,198 | I am trying to get values of hidden input which is added dynamically on click of `insert more` button.
Here is stackblitz link: [get hidden input value](https://stackblitz.com/edit/get-dynamic-added-component-values-qgky91)
I tried to use `patchValue()` method on `linkTo()` function but no luck, I am getting empty st... | 2019/12/16 | [
"https://Stackoverflow.com/questions/59351198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3292482/"
] | I have try something with code and added the Value in the SelectLinkTo.
```
linkTo(where: string, btnId: number) {
console.log(btnId);
let formArray = (<FormArray>this.loginForm[this.currentTab].get('loginFromArr')).at(btnId)
console.log(formArray);
formArray.patchValue({
selectedLinkTo :wh... | ```
linkTo(where: string, btnId: number) {
this.loginForm[this.currentTab].get('loginFromArr').controls[btnId].get('selectedLinkTo').setValue(where);}
```
Please replace your linkTo function with above code. |
59,351,198 | I am trying to get values of hidden input which is added dynamically on click of `insert more` button.
Here is stackblitz link: [get hidden input value](https://stackblitz.com/edit/get-dynamic-added-component-values-qgky91)
I tried to use `patchValue()` method on `linkTo()` function but no luck, I am getting empty st... | 2019/12/16 | [
"https://Stackoverflow.com/questions/59351198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3292482/"
] | I have try something with code and added the Value in the SelectLinkTo.
```
linkTo(where: string, btnId: number) {
console.log(btnId);
let formArray = (<FormArray>this.loginForm[this.currentTab].get('loginFromArr')).at(btnId)
console.log(formArray);
formArray.patchValue({
selectedLinkTo :wh... | linkTo function patchValue():
```
linkTo(where: string, btnId: number) {
let formArray = this.loginForm[this.currentTab].get('loginFromArr').at(btnId)
formArray.patchValue({
selectedLinkTo :where
})
}
```
Checkout Demo : <https://stackblitz.com/edit/get-dynamic-added-component-v... |
59,351,198 | I am trying to get values of hidden input which is added dynamically on click of `insert more` button.
Here is stackblitz link: [get hidden input value](https://stackblitz.com/edit/get-dynamic-added-component-values-qgky91)
I tried to use `patchValue()` method on `linkTo()` function but no luck, I am getting empty st... | 2019/12/16 | [
"https://Stackoverflow.com/questions/59351198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3292482/"
] | You can just pass form and set the control value like this.
```
<a style="border: 1px solid red;margin-top: 10px; margin-left: 5px;" id="a-{{i}}"
(click)="linkTo('a',item)"
class="btn-link-group border-right-0 first-btn"
mat-button>A link</a>
```
---
```
linkTo(where: string, form: any) {
//debugger;
... | linkTo function patchValue():
```
linkTo(where: string, btnId: number) {
let formArray = this.loginForm[this.currentTab].get('loginFromArr').at(btnId)
formArray.patchValue({
selectedLinkTo :where
})
}
```
Checkout Demo : <https://stackblitz.com/edit/get-dynamic-added-component-v... |
59,351,198 | I am trying to get values of hidden input which is added dynamically on click of `insert more` button.
Here is stackblitz link: [get hidden input value](https://stackblitz.com/edit/get-dynamic-added-component-values-qgky91)
I tried to use `patchValue()` method on `linkTo()` function but no luck, I am getting empty st... | 2019/12/16 | [
"https://Stackoverflow.com/questions/59351198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3292482/"
] | ```
linkTo(where: string, btnId: number) {
this.loginForm[this.currentTab].get('loginFromArr').controls[btnId].get('selectedLinkTo').setValue(where);}
```
Please replace your linkTo function with above code. | linkTo function patchValue():
```
linkTo(where: string, btnId: number) {
let formArray = this.loginForm[this.currentTab].get('loginFromArr').at(btnId)
formArray.patchValue({
selectedLinkTo :where
})
}
```
Checkout Demo : <https://stackblitz.com/edit/get-dynamic-added-component-v... |
55,215,663 | I have a query Like below in .net Core 2.2 with EF.
```
var data = context.Customer
.GroupJoin(context.Orders, c=> c.Id, o => o.CustoerId, (c, o) => new
{
customer = c,
orders= o
}).Select(s => new
... | 2019/03/18 | [
"https://Stackoverflow.com/questions/55215663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3252143/"
] | It depends on what you are going to accomplish.
Naturally there is no *empty* date.
* If the value of the date is irrelevant declare it with the current date
```
let date = Date()
```
* If the date is supposed to be quite unspecified in the distant past or future there are
```
let date = Date.distantPast
let da... | You can initialize a `Date` object by its default constructor.
```
var date = Date()
```
The above line will initialize the `date` object with the current date.
Hope this helps |
55,215,663 | I have a query Like below in .net Core 2.2 with EF.
```
var data = context.Customer
.GroupJoin(context.Orders, c=> c.Id, o => o.CustoerId, (c, o) => new
{
customer = c,
orders= o
}).Select(s => new
... | 2019/03/18 | [
"https://Stackoverflow.com/questions/55215663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3252143/"
] | It depends on what you are going to accomplish.
Naturally there is no *empty* date.
* If the value of the date is irrelevant declare it with the current date
```
let date = Date()
```
* If the date is supposed to be quite unspecified in the distant past or future there are
```
let date = Date.distantPast
let da... | You can declare a `Date = nil`
Which means when we assign a value to data like
```
var date = Date() // means its current data
```
**OR else**
Use following codes to set a date from string format
```
let dateFormatterGet = DateFormatter()
dateFormatterGet.dateFormat = "yyyy-MM-dd HH:mm:ss"
let dateFormatterPrint... |
55,215,663 | I have a query Like below in .net Core 2.2 with EF.
```
var data = context.Customer
.GroupJoin(context.Orders, c=> c.Id, o => o.CustoerId, (c, o) => new
{
customer = c,
orders= o
}).Select(s => new
... | 2019/03/18 | [
"https://Stackoverflow.com/questions/55215663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3252143/"
] | It depends on what you are going to accomplish.
Naturally there is no *empty* date.
* If the value of the date is irrelevant declare it with the current date
```
let date = Date()
```
* If the date is supposed to be quite unspecified in the distant past or future there are
```
let date = Date.distantPast
let da... | The obvious answer is that there is no empty `Date`.
A `String` has 3 possible states:
1. there is some string, e.g. `"abc"`
2. there is an empty string, that is, `""`
3. there is no string, that is, `nil`.
With strings, case 2 and 3 are usually interchangeable. That means that we can use either an empty string or `... |
25,757,114 | ```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(int argc,char **argv)
{
int x[3] = {42, 44, 48};
int *y;
int *z;
z=y;
y=x;
printf("%d, %d, %d\n", x[0], x[1], x[2]);
printf("%d, %d, %d\n", y[0], y[1], y[2]);
printf("%d, %d, %d\n", z[0], z[1], z[2]);
return 0... | 2014/09/10 | [
"https://Stackoverflow.com/questions/25757114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3981021/"
] | As suggested (though BLUEPIXY also gave the same core information, hence a CW answer).
You have the sequence of assignments to `z` and `y` in the wrong order. You assign an uninitialized value to `z`, then set `y`. You would avoid problems if you first set `y` and then copy the result to `z`.
And it is good to pay at... | include the following header file
```
#include <stdlib.h>
```
Allocate memory to y
```
int x[3] = {42, 44, 48};
int *y;
int *z;
y=(int *) malloc (3 * sizeof (int));
z=y;
y=x;
```
before returning from the main remember to free the memory
```
free (y);
```
This should work fine. |
25,757,114 | ```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(int argc,char **argv)
{
int x[3] = {42, 44, 48};
int *y;
int *z;
z=y;
y=x;
printf("%d, %d, %d\n", x[0], x[1], x[2]);
printf("%d, %d, %d\n", y[0], y[1], y[2]);
printf("%d, %d, %d\n", z[0], z[1], z[2]);
return 0... | 2014/09/10 | [
"https://Stackoverflow.com/questions/25757114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3981021/"
] | As suggested (though BLUEPIXY also gave the same core information, hence a CW answer).
You have the sequence of assignments to `z` and `y` in the wrong order. You assign an uninitialized value to `z`, then set `y`. You would avoid problems if you first set `y` and then copy the result to `z`.
And it is good to pay at... | Initially both y and z are uninitialized. That is why
you get warning when you set z=y(y is uninitialized here).
Now setting y=x doesn't change the value of z(still uninitialized).
So eventually you are trying to access an uninitialized pointer(z)
that is why getting error. |
25,757,114 | ```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(int argc,char **argv)
{
int x[3] = {42, 44, 48};
int *y;
int *z;
z=y;
y=x;
printf("%d, %d, %d\n", x[0], x[1], x[2]);
printf("%d, %d, %d\n", y[0], y[1], y[2]);
printf("%d, %d, %d\n", z[0], z[1], z[2]);
return 0... | 2014/09/10 | [
"https://Stackoverflow.com/questions/25757114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3981021/"
] | Initially both y and z are uninitialized. That is why
you get warning when you set z=y(y is uninitialized here).
Now setting y=x doesn't change the value of z(still uninitialized).
So eventually you are trying to access an uninitialized pointer(z)
that is why getting error. | include the following header file
```
#include <stdlib.h>
```
Allocate memory to y
```
int x[3] = {42, 44, 48};
int *y;
int *z;
y=(int *) malloc (3 * sizeof (int));
z=y;
y=x;
```
before returning from the main remember to free the memory
```
free (y);
```
This should work fine. |
33,760,162 | I have a function that can be used only inside a class and don't want it to be accessible outside the class.
```
class Auth {
/*@ngInject*/
constructor($http, $cookies, $q, User) {
this.$http = $http;
this.$cookies = $cookies;
this.$q = $q;
this.User = User;
localFunc(); // Need to create this... | 2015/11/17 | [
"https://Stackoverflow.com/questions/33760162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1998136/"
] | No, there is no way to declare local functions in a `class`. You can of course declare (static) helper methods and mark them as "private" using underscore prefixes, but that's probably not what you want. And you can always declare the local function inside of a method.
But if you need it multiple times then the only w... | You could use a Symbol:
```
const localFunc = Symbol();
class Auth {
/*@ngInject*/
constructor($http, $cookies, $q, User) {
this.$http = $http;
this.$cookies = $cookies;
this.$q = $q;
this.User = User;
this[localFunc] = function() {
// I am private
};
}
}
``` |
58,617,019 | What are the hybrid identity management and federation options in GCP? For example, in Azure, there are Password Hash Synch, Pass-Through, ADFS and in AWS, AD Connector, Managed MS AD, etc.
What are they in GCP and what are the pros/cons and requirements or best practice, etc. for each approach? | 2019/10/30 | [
"https://Stackoverflow.com/questions/58617019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12294315/"
] | Google has extensive documentation here: <https://cloud.google.com/solutions/authenticating-corporate-users-in-a-hybrid-environment>
You might want to be more specific about the nature of your hybrid cloud. For instance, if you are using active directory, the docs are here:
<https://cloud.google.com/solutions/federati... | Google Cloud supports Cloud Identity as their managed IDaaS. How to manage the hybrid identity are well documented <https://cloud.google.com/solutions/patterns-for-authenticating-corporate-users-in-a-hybrid-environment> |
51,678 | Can "my death" be an abstract entity? I don't think it's a universal, because, in the manner I mean it, "my death" only occurs once. But, and this is what motivates the question, it seems strange to say that it's an abstract entity, because as soon as it exists it can't exist for me. Obviously that's not an argument, a... | 2018/05/02 | [
"https://philosophy.stackexchange.com/questions/51678",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/33054/"
] | The following description of the dichotomy between abstract and concrete may be useful to decide if "my death" is abstract or concrete:
>
> The abstract/concrete distinction has a curious status in contemporary
> philosophy. It is widely agreed that the distinction is of fundamental
> importance. And yet there is n... | I definitely think "my death" is a concrete object, though, perhaps, 'my mortality' is an abstract one.
There's lots of experiences I will never experience, but I don't think that necessarily means they are abstractions. |
40,713,851 | I am trying to develop an app extension using sirikit, but when i am trying to run it on simulator iphone 7plus, it is giving the following error :-
**SpringBoard was unable to service the request.**
Can anyone please tell me whether IOS Simulator support SIRIKit extension or not ! | 2016/11/21 | [
"https://Stackoverflow.com/questions/40713851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6160393/"
] | Yes update your XCode Version :8.3.1 and above support SIRI in simulator.
**STEP-1 :**
[](https://i.stack.imgur.com/70q1A.png)
**STEP-2**
Enable SIRI from Settings in Simulator
**STEP-3**
Hardware--->SIRI
[ WWDC session.
Basically it looks kinda like this:
```
let siri = XCUIDevice.shared.siriService
siri.activate(voiceRecognitionText: "How many points are on my credit ca... | [Apple docs](https://developer.apple.com/library/content/documentation/Intents/Conceptual/SiriIntegrationGuide/CreatingtheIntentsExtension.html) say:
>
> You cannot debug your Intents extension in the simulator.
>
>
>
Update: This has changed in Xcode 8.3. |
40,713,851 | I am trying to develop an app extension using sirikit, but when i am trying to run it on simulator iphone 7plus, it is giving the following error :-
**SpringBoard was unable to service the request.**
Can anyone please tell me whether IOS Simulator support SIRIKit extension or not ! | 2016/11/21 | [
"https://Stackoverflow.com/questions/40713851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6160393/"
] | In Xcode 9 you can test Siri tasks by UI Tests. They talk about it in the end of [this](https://developer.apple.com/videos/play/wwdc2017/228/) WWDC session.
Basically it looks kinda like this:
```
let siri = XCUIDevice.shared.siriService
siri.activate(voiceRecognitionText: "How many points are on my credit ca... | Starting from Xcode 8.3 you can invoke Siri using Hardware > Siri after enabling Siri in the Settings app on Simulator. |
40,713,851 | I am trying to develop an app extension using sirikit, but when i am trying to run it on simulator iphone 7plus, it is giving the following error :-
**SpringBoard was unable to service the request.**
Can anyone please tell me whether IOS Simulator support SIRIKit extension or not ! | 2016/11/21 | [
"https://Stackoverflow.com/questions/40713851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6160393/"
] | **Edit**
For Xcode 8.3 or above you will be able to use Siri in Simulator. The steps are -
**1) Enable Siri from the settings of Simulator.**
**2) From the Hardware select Siri**
Here are some images for reference -
**Step 1 -**
[](https://i.... | Yes update your XCode Version :8.3.1 and above support SIRI in simulator.
**STEP-1 :**
[](https://i.stack.imgur.com/70q1A.png)
**STEP-2**
Enable SIRI from Settings in Simulator
**STEP-3**
Hardware--->SIRI
[ say:
>
> You cannot debug your Intents extension in the simulator.
>
>
>
Update: This has changed in Xcode 8.3. | Starting from Xcode 8.3 you can invoke Siri using Hardware > Siri after enabling Siri in the Settings app on Simulator. |
40,713,851 | I am trying to develop an app extension using sirikit, but when i am trying to run it on simulator iphone 7plus, it is giving the following error :-
**SpringBoard was unable to service the request.**
Can anyone please tell me whether IOS Simulator support SIRIKit extension or not ! | 2016/11/21 | [
"https://Stackoverflow.com/questions/40713851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6160393/"
] | Now You can use in Xcode 8.3.1
[PREVIOUS ANSWER]
According to the [Apple Docs](https://developer.apple.com/library/content/documentation/Intents/Conceptual/SiriIntegrationGuide/CreatingtheIntentsExtension.html)
No, you can't | Starting from Xcode 8.3 you can invoke Siri using Hardware > Siri after enabling Siri in the Settings app on Simulator. |
40,713,851 | I am trying to develop an app extension using sirikit, but when i am trying to run it on simulator iphone 7plus, it is giving the following error :-
**SpringBoard was unable to service the request.**
Can anyone please tell me whether IOS Simulator support SIRIKit extension or not ! | 2016/11/21 | [
"https://Stackoverflow.com/questions/40713851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6160393/"
] | In Xcode 9 you can test Siri tasks by UI Tests. They talk about it in the end of [this](https://developer.apple.com/videos/play/wwdc2017/228/) WWDC session.
Basically it looks kinda like this:
```
let siri = XCUIDevice.shared.siriService
siri.activate(voiceRecognitionText: "How many points are on my credit ca... | Now You can use in Xcode 8.3.1
[PREVIOUS ANSWER]
According to the [Apple Docs](https://developer.apple.com/library/content/documentation/Intents/Conceptual/SiriIntegrationGuide/CreatingtheIntentsExtension.html)
No, you can't |
40,713,851 | I am trying to develop an app extension using sirikit, but when i am trying to run it on simulator iphone 7plus, it is giving the following error :-
**SpringBoard was unable to service the request.**
Can anyone please tell me whether IOS Simulator support SIRIKit extension or not ! | 2016/11/21 | [
"https://Stackoverflow.com/questions/40713851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6160393/"
] | **Edit**
For Xcode 8.3 or above you will be able to use Siri in Simulator. The steps are -
**1) Enable Siri from the settings of Simulator.**
**2) From the Hardware select Siri**
Here are some images for reference -
**Step 1 -**
[](https://i.... | Now You can use in Xcode 8.3.1
[PREVIOUS ANSWER]
According to the [Apple Docs](https://developer.apple.com/library/content/documentation/Intents/Conceptual/SiriIntegrationGuide/CreatingtheIntentsExtension.html)
No, you can't |
40,713,851 | I am trying to develop an app extension using sirikit, but when i am trying to run it on simulator iphone 7plus, it is giving the following error :-
**SpringBoard was unable to service the request.**
Can anyone please tell me whether IOS Simulator support SIRIKit extension or not ! | 2016/11/21 | [
"https://Stackoverflow.com/questions/40713851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6160393/"
] | **Edit**
For Xcode 8.3 or above you will be able to use Siri in Simulator. The steps are -
**1) Enable Siri from the settings of Simulator.**
**2) From the Hardware select Siri**
Here are some images for reference -
**Step 1 -**
[](https://i.... | [Apple docs](https://developer.apple.com/library/content/documentation/Intents/Conceptual/SiriIntegrationGuide/CreatingtheIntentsExtension.html) say:
>
> You cannot debug your Intents extension in the simulator.
>
>
>
Update: This has changed in Xcode 8.3. |
40,713,851 | I am trying to develop an app extension using sirikit, but when i am trying to run it on simulator iphone 7plus, it is giving the following error :-
**SpringBoard was unable to service the request.**
Can anyone please tell me whether IOS Simulator support SIRIKit extension or not ! | 2016/11/21 | [
"https://Stackoverflow.com/questions/40713851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6160393/"
] | Yes update your XCode Version :8.3.1 and above support SIRI in simulator.
**STEP-1 :**
[](https://i.stack.imgur.com/70q1A.png)
**STEP-2**
Enable SIRI from Settings in Simulator
**STEP-3**
Hardware--->SIRI
[ say:
>
> You cannot debug your Intents extension in the simulator.
>
>
>
Update: This has changed in Xcode 8.3. |
35,504,578 | I am facing of a client request, he has 100 products with pagination ( 10 per page), he wants only random on the first 10 products and for the rest of the pages no random ( for others paginations other than 1 )
I have this query :
```
$args = array(
'post_type' => array('products'),
'paged'=> ( get_query_var(... | 2016/02/19 | [
"https://Stackoverflow.com/questions/35504578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If you hit the question mark next to "Download Size," you will see that it says "This is the compressed size of the app downloaded over the air." This is the size used by Apple to determine if your app can be downloaded on a cellular connection.
The "Size" listed in the App Store can be different on different devices ... | OTA is download size - the data the client needs to download in order to unpack and install the application. |
35,504,578 | I am facing of a client request, he has 100 products with pagination ( 10 per page), he wants only random on the first 10 products and for the rest of the pages no random ( for others paginations other than 1 )
I have this query :
```
$args = array(
'post_type' => array('products'),
'paged'=> ( get_query_var(... | 2016/02/19 | [
"https://Stackoverflow.com/questions/35504578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If you hit the question mark next to "Download Size," you will see that it says "This is the compressed size of the app downloaded over the air." This is the size used by Apple to determine if your app can be downloaded on a cellular connection.
The "Size" listed in the App Store can be different on different devices ... | Apple has increased the cellular download limit from 100 MB to 150 MB, letting customers download more apps from the App Store over their cellular network.
[apple](https://developer.apple.com/news/?id=09192017b&1505856301) |
10,074,544 | I need a help for pattern for float value.
String that i have:
```
[[-307.,16.01,-171.31],[0.84528,-0.503623,-0.142485,-0.107531],[-1,-2,1,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], [[-306.43,24.47,-176],[0.845282,-0.503624,-0.142472,-0.107528],[-1,-2,1,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]
```
Pattern that I'm... | 2012/04/09 | [
"https://Stackoverflow.com/questions/10074544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1213444/"
] | No need for regex. You can use [JavaScriptSerializer](http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx)
```
var list = new JavaScriptSerializer()
.Deserialize<List<List<List<Double>>>>("[" + yourstr + "]");
``` | It seems you are missing a + or \* for the decimal places:
```
\s*[-+]?([0-9].)?[0-9]+([eE][-+]?[0-9]+)?\s*
``` |
12,977,803 | I'm trying to alert when a input box is greater than a second box, in example:
```
<td align="center"> <input type='text' name='cantidad{{=i+1}}' id='cantidad' value='{{=(x.cantidad)}}' size='3' readonly="readonly" /></td>
<td align="center"> <input type='text' name='desp{{=i+1}}' id='desp' value='' size='3' require... | 2012/10/19 | [
"https://Stackoverflow.com/questions/12977803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1489249/"
] | You can try by giving the ID's something like this:-
```
if(document.getElementById("first").value == document.getElementById("second").value){
//they are the same, do stuff for the same
}else if(document.getElementById("first").value >= document.getElementById("second").value
//first is more than second
}
```
or yo... | If you add a css class to the last textbox, say we call it "textbox-last", then you can use jQuery to bind a function to the blur event as follows:
```
$('#yourtable').on('blur', '.textbox-last', function() {
var td = $(this).parent();
var prevTextboxValue = td.prev().find('input').val();
...
});
```
... |
54,352,987 | I am running Jenkins inside docker container on Ubuntu. I tried to access jenkins initial password from var/jenkins\_home folder by `docker -it exec CONTAINER_ID bash` and `cat /var/jenkins_home/secrets/initialAdminPassword`. I know how to access the folder and see what is inside var/jenkins\_home but I want to underst... | 2019/01/24 | [
"https://Stackoverflow.com/questions/54352987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9273701/"
] | Try:
```
/var/lib/docker/volumes/jenkins-data
```
or
```
/your/home:/var/jenkins_home
``` | try this /var/lib/docker/jenkins-data |
54,352,987 | I am running Jenkins inside docker container on Ubuntu. I tried to access jenkins initial password from var/jenkins\_home folder by `docker -it exec CONTAINER_ID bash` and `cat /var/jenkins_home/secrets/initialAdminPassword`. I know how to access the folder and see what is inside var/jenkins\_home but I want to underst... | 2019/01/24 | [
"https://Stackoverflow.com/questions/54352987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9273701/"
] | Try:
```
/var/lib/docker/volumes/jenkins-data
```
or
```
/your/home:/var/jenkins_home
``` | By Default Jenkins docker images are installed Jenkins in below path
```
/var/lib/docker/
```
also, you can install Jenkins docker according to your suitable path using below method:
```
docker run -p 8080:8080 -p 50000:50000 -v /your/home:/var/jenkins_home jenkins
``` |
54,352,987 | I am running Jenkins inside docker container on Ubuntu. I tried to access jenkins initial password from var/jenkins\_home folder by `docker -it exec CONTAINER_ID bash` and `cat /var/jenkins_home/secrets/initialAdminPassword`. I know how to access the folder and see what is inside var/jenkins\_home but I want to underst... | 2019/01/24 | [
"https://Stackoverflow.com/questions/54352987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9273701/"
] | Try:
```
/var/lib/docker/volumes/jenkins-data
```
or
```
/your/home:/var/jenkins_home
``` | If launched with docker, and if in your run command you put "volume jenkins-data:/var/jenkins\_home", then try this :
* docker container exec -it JENKINS\_CONTAINER\_ID bash
then once connected :
* cat /var/jenkins\_home/secrets/initialAdminPassword
it'll show up the password you're looking for. |
66,685,515 | Does the following zero out a list and then add the first entry? Or does it just add the first entry to `handlers`?
```
Logger = (struct logger) {.level=INFO, .format=DEFAULT_FORMAT, .num_handlers=1, .handlers[0]=stdout};
```
For example, does this do:
```
Logger.handlers = {0};
Logger.handlers[0] = stdout;
```
... | 2021/03/18 | [
"https://Stackoverflow.com/questions/66685515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12283181/"
] | >
> For example, does this do:
>
>
>
> ```
> Logger.handlers = {0};
> Logger.handlers[0] = stdout;
>
> ```
>
>
*Answer: Yes (but not specifically in that order)*
There are three standard sections (actually 4 if you take the section that specifically makes the following two applicable to "aggregate objects" (st... | The latter `Logger.handlers[0] = stdout;`. This is why the API has a .num\_handlers field to tell called code know how many of the handlers are valid. |
8,600,337 | I have a C++ program that insert about a million of records into MS Access DB using OLEDBConnection. To do that, I ran the `INSERT INTO` query a millions time in order to get the records inserted which take quite a long time.
The data is generated in the program in form of array, will that be any other way that i can ... | 2011/12/22 | [
"https://Stackoverflow.com/questions/8600337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1051586/"
] | It seems *very inefficient* to open/close the connection for each insert statement.
The standard approach goes something like:
1. Open connection.
2. Start transaction, if supported. (This is often *very* important for databases with transactions.)
3. Insert. *Repeat this step as needed.*
4. Commit transaction, if su... | Don't do ONE insertion per command.
Change your code to something like, this:
```
string strSQLCommand;
for (int i = 0; i < populationSize; i++){
strSQLCommand += "INSERT INTO [" + pTableName + "] (" + columnsName + ") VALUES (" + columnsValue[i] + ");";`
}
outputDBConn->runSQLEdit(strSQLCommand );
```
I'm not sure ... |
138,996 | Well, I’m not talking about the mainnet but an ᴇᴠᴍ compatible ʟ2 still using an Ethereum smart‑contract for storing its state : Optimistic Ethereum.
A recent contract creation on Optimism seems to prove it is possible to create a contract at an arbitrary address, or a system address since system contracts start by `0x... | 2022/11/08 | [
"https://ethereum.stackexchange.com/questions/138996",
"https://ethereum.stackexchange.com",
"https://ethereum.stackexchange.com/users/25002/"
] | I found the reason how Optimism was able to reserve both the [`0x4200000000000000000000000000000000000014`](https://optimistic.etherscan.io/address/0x4200000000000000000000000000000000000014) and [`0x4200000000000000000000000000000000000042`](https://optimistic.etherscan.io/address/0x42000000000000000000000000000000000... | `0x4200000000000000000000000000000000000014` is a system address reserved for future pre-deploys.
See: <https://twitter.com/scottfits/status/1531798505198481408/photo/1>
And contracts that start by `0x42` are considered pre-deploys that are marked as created by Genesis, meaning they are available from the blockchain'... |
138,996 | Well, I’m not talking about the mainnet but an ᴇᴠᴍ compatible ʟ2 still using an Ethereum smart‑contract for storing its state : Optimistic Ethereum.
A recent contract creation on Optimism seems to prove it is possible to create a contract at an arbitrary address, or a system address since system contracts start by `0x... | 2022/11/08 | [
"https://ethereum.stackexchange.com/questions/138996",
"https://ethereum.stackexchange.com",
"https://ethereum.stackexchange.com/users/25002/"
] | I found the reason how Optimism was able to reserve both the [`0x4200000000000000000000000000000000000014`](https://optimistic.etherscan.io/address/0x4200000000000000000000000000000000000014) and [`0x4200000000000000000000000000000000000042`](https://optimistic.etherscan.io/address/0x42000000000000000000000000000000000... | use `create2` opcode. From [deploying-with-create2](https://docs.openzeppelin.com/cli/2.8/deploying-with-create2)
>
> The whole idea behind this opcode is to make the resulting address
> independent of future events. Regardless of what may happen on the
> blockchain, it will always be possible to deploy the contract ... |
958,147 | I have a Samsung Series 5 530U3C-A01 model. My system says I currently have 4GB RAM. I want to add more to make it faster, but can't figure out:
1. What's the max RAM it can run, and max speed
2. How many slots does it have - Only 1, or perhaps 2 (And then I can buy an additional cheaper 4GB rather than a replacement ... | 2015/08/16 | [
"https://superuser.com/questions/958147",
"https://superuser.com",
"https://superuser.com/users/373104/"
] | While you are still looking at a website in your browser, use the key combination Ctrl + 0 (that's the number zero). This restores the zoom level if you have accidentally changed it (which may cause the symptoms you have described).
If that does not do it, check these solutions provided at Mozilla forums:
* <https://... | **2020-05-29 Blurry Font issue in Chrome. Hard to read web pages.**
I was having a font issue in chrome. The body font would always render in a kind of skinny font that was poorly defined. I tried all the suggested fixes for windows clear type, changing the fonts in chrome, clearing cache, turning off hardware acceler... |
958,147 | I have a Samsung Series 5 530U3C-A01 model. My system says I currently have 4GB RAM. I want to add more to make it faster, but can't figure out:
1. What's the max RAM it can run, and max speed
2. How many slots does it have - Only 1, or perhaps 2 (And then I can buy an additional cheaper 4GB rather than a replacement ... | 2015/08/16 | [
"https://superuser.com/questions/958147",
"https://superuser.com",
"https://superuser.com/users/373104/"
] | I fixed my problem on Google Chrome running on Windows 10 by installing all 12 Roboto fonts from <https://fonts.google.com/specimen/Roboto>
After installing them and restarting the browser everything started to look normal again. | **2020-05-29 Blurry Font issue in Chrome. Hard to read web pages.**
I was having a font issue in chrome. The body font would always render in a kind of skinny font that was poorly defined. I tried all the suggested fixes for windows clear type, changing the fonts in chrome, clearing cache, turning off hardware acceler... |
958,147 | I have a Samsung Series 5 530U3C-A01 model. My system says I currently have 4GB RAM. I want to add more to make it faster, but can't figure out:
1. What's the max RAM it can run, and max speed
2. How many slots does it have - Only 1, or perhaps 2 (And then I can buy an additional cheaper 4GB rather than a replacement ... | 2015/08/16 | [
"https://superuser.com/questions/958147",
"https://superuser.com",
"https://superuser.com/users/373104/"
] | While you are still looking at a website in your browser, use the key combination Ctrl + 0 (that's the number zero). This restores the zoom level if you have accidentally changed it (which may cause the symptoms you have described).
If that does not do it, check these solutions provided at Mozilla forums:
* <https://... | I changed SessionBuddy settings to Classic Font. That improved the readability.
[](https://i.stack.imgur.com/NF8Da.jpg) |
958,147 | I have a Samsung Series 5 530U3C-A01 model. My system says I currently have 4GB RAM. I want to add more to make it faster, but can't figure out:
1. What's the max RAM it can run, and max speed
2. How many slots does it have - Only 1, or perhaps 2 (And then I can buy an additional cheaper 4GB rather than a replacement ... | 2015/08/16 | [
"https://superuser.com/questions/958147",
"https://superuser.com",
"https://superuser.com/users/373104/"
] | Change font to Tahoma in google chrome settings. tried deleting ultra light but wouldn't let me so this worked! [Like this](https://i.stack.imgur.com/uQpPM.png) | I changed SessionBuddy settings to Classic Font. That improved the readability.
[](https://i.stack.imgur.com/NF8Da.jpg) |
958,147 | I have a Samsung Series 5 530U3C-A01 model. My system says I currently have 4GB RAM. I want to add more to make it faster, but can't figure out:
1. What's the max RAM it can run, and max speed
2. How many slots does it have - Only 1, or perhaps 2 (And then I can buy an additional cheaper 4GB rather than a replacement ... | 2015/08/16 | [
"https://superuser.com/questions/958147",
"https://superuser.com",
"https://superuser.com/users/373104/"
] | I had the exact same issue. I tried ALL the suggested fixes, like the windows update security issue and all these very technical methods. I tried re-installing fonts and at one point I even laid hands on my PC and prayed for it to repel the font demon that was cursing my computer!
MY FIX: Go to your font directory and... | **2020-05-29 Blurry Font issue in Chrome. Hard to read web pages.**
I was having a font issue in chrome. The body font would always render in a kind of skinny font that was poorly defined. I tried all the suggested fixes for windows clear type, changing the fonts in chrome, clearing cache, turning off hardware acceler... |
958,147 | I have a Samsung Series 5 530U3C-A01 model. My system says I currently have 4GB RAM. I want to add more to make it faster, but can't figure out:
1. What's the max RAM it can run, and max speed
2. How many slots does it have - Only 1, or perhaps 2 (And then I can buy an additional cheaper 4GB rather than a replacement ... | 2015/08/16 | [
"https://superuser.com/questions/958147",
"https://superuser.com",
"https://superuser.com/users/373104/"
] | **2020-05-29 Blurry Font issue in Chrome. Hard to read web pages.**
I was having a font issue in chrome. The body font would always render in a kind of skinny font that was poorly defined. I tried all the suggested fixes for windows clear type, changing the fonts in chrome, clearing cache, turning off hardware acceler... | I changed SessionBuddy settings to Classic Font. That improved the readability.
[](https://i.stack.imgur.com/NF8Da.jpg) |
958,147 | I have a Samsung Series 5 530U3C-A01 model. My system says I currently have 4GB RAM. I want to add more to make it faster, but can't figure out:
1. What's the max RAM it can run, and max speed
2. How many slots does it have - Only 1, or perhaps 2 (And then I can buy an additional cheaper 4GB rather than a replacement ... | 2015/08/16 | [
"https://superuser.com/questions/958147",
"https://superuser.com",
"https://superuser.com/users/373104/"
] | This font issue happened to me after a Windows update. I selected Tahoma as standard font in Chrome settings. Any installed font should do it. Then restart browser. | **2020-05-29 Blurry Font issue in Chrome. Hard to read web pages.**
I was having a font issue in chrome. The body font would always render in a kind of skinny font that was poorly defined. I tried all the suggested fixes for windows clear type, changing the fonts in chrome, clearing cache, turning off hardware acceler... |
958,147 | I have a Samsung Series 5 530U3C-A01 model. My system says I currently have 4GB RAM. I want to add more to make it faster, but can't figure out:
1. What's the max RAM it can run, and max speed
2. How many slots does it have - Only 1, or perhaps 2 (And then I can buy an additional cheaper 4GB rather than a replacement ... | 2015/08/16 | [
"https://superuser.com/questions/958147",
"https://superuser.com",
"https://superuser.com/users/373104/"
] | While you are still looking at a website in your browser, use the key combination Ctrl + 0 (that's the number zero). This restores the zoom level if you have accidentally changed it (which may cause the symptoms you have described).
If that does not do it, check these solutions provided at Mozilla forums:
* <https://... | To make your fonts more readable on your website, just add these lines to your CSS:
```
@media screen and (-webkit-min-device-pixel-ratio:0) { /* Safari and Chrome (font weight fix) */
BODY {text-shadow: transparent 0px 0px 0px, rgba(0,0,0,0.68) 0px 0px 0px !important;}
}
```
If you want to increase readabili... |
958,147 | I have a Samsung Series 5 530U3C-A01 model. My system says I currently have 4GB RAM. I want to add more to make it faster, but can't figure out:
1. What's the max RAM it can run, and max speed
2. How many slots does it have - Only 1, or perhaps 2 (And then I can buy an additional cheaper 4GB rather than a replacement ... | 2015/08/16 | [
"https://superuser.com/questions/958147",
"https://superuser.com",
"https://superuser.com/users/373104/"
] | To make your fonts more readable on your website, just add these lines to your CSS:
```
@media screen and (-webkit-min-device-pixel-ratio:0) { /* Safari and Chrome (font weight fix) */
BODY {text-shadow: transparent 0px 0px 0px, rgba(0,0,0,0.68) 0px 0px 0px !important;}
}
```
If you want to increase readabili... | I changed SessionBuddy settings to Classic Font. That improved the readability.
[](https://i.stack.imgur.com/NF8Da.jpg) |
958,147 | I have a Samsung Series 5 530U3C-A01 model. My system says I currently have 4GB RAM. I want to add more to make it faster, but can't figure out:
1. What's the max RAM it can run, and max speed
2. How many slots does it have - Only 1, or perhaps 2 (And then I can buy an additional cheaper 4GB rather than a replacement ... | 2015/08/16 | [
"https://superuser.com/questions/958147",
"https://superuser.com",
"https://superuser.com/users/373104/"
] | I had the exact same issue. I tried ALL the suggested fixes, like the windows update security issue and all these very technical methods. I tried re-installing fonts and at one point I even laid hands on my PC and prayed for it to repel the font demon that was cursing my computer!
MY FIX: Go to your font directory and... | Change font to Tahoma in google chrome settings. tried deleting ultra light but wouldn't let me so this worked! [Like this](https://i.stack.imgur.com/uQpPM.png) |
23,066,630 | I am using nested shell scripts.
My question is a bit similar to the ones asked [here](https://stackoverflow.com/questions/22566304/shell-script-not-waiting) and [here](https://stackoverflow.com/questions/6405039/shell-how-to-use-screen-and-wait-for-a-couple-of-background-processes-in-a-shel). But not exactly the sam... | 2014/04/14 | [
"https://Stackoverflow.com/questions/23066630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2249026/"
] | Two things:
* Source your script
* Use `wait`
Your script would not look like:
```
some commands
. ./runThisScriptX.sh # Note the leading . followed by space
wait # This would wait for the sourced script to finish
other commands
end of script
``` | Use the [`wait`](http://www.gnu.org/software/bash/manual/bash.html#Job-Control-Builtins) built-in command:
```
wait
```
This waits for all background processes started directly by the shell to complete before continuing. |
23,066,630 | I am using nested shell scripts.
My question is a bit similar to the ones asked [here](https://stackoverflow.com/questions/22566304/shell-script-not-waiting) and [here](https://stackoverflow.com/questions/6405039/shell-how-to-use-screen-and-wait-for-a-couple-of-background-processes-in-a-shel). But not exactly the sam... | 2014/04/14 | [
"https://Stackoverflow.com/questions/23066630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2249026/"
] | Inside `runThisScriptX.sh`, you should wait for the parallel children to complete before exiting:
```
child1 &
child2 &
child3 &
wait
```
Then in `OuterMostShellScript.sh`, you run `runThisScriptX.sh` itself in the background, and wait for it.
```
some commands
./runThisScriptX.sh &
wait
other commands
end of scri... | Use the [`wait`](http://www.gnu.org/software/bash/manual/bash.html#Job-Control-Builtins) built-in command:
```
wait
```
This waits for all background processes started directly by the shell to complete before continuing. |
23,066,630 | I am using nested shell scripts.
My question is a bit similar to the ones asked [here](https://stackoverflow.com/questions/22566304/shell-script-not-waiting) and [here](https://stackoverflow.com/questions/6405039/shell-how-to-use-screen-and-wait-for-a-couple-of-background-processes-in-a-shel). But not exactly the sam... | 2014/04/14 | [
"https://Stackoverflow.com/questions/23066630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2249026/"
] | Two things:
* Source your script
* Use `wait`
Your script would not look like:
```
some commands
. ./runThisScriptX.sh # Note the leading . followed by space
wait # This would wait for the sourced script to finish
other commands
end of script
``` | Use the bash built-in `wait`; from the [man page](http://linux.die.net/man/1/bash) -
>
> Wait for each specified process and return its termination status. Each n may be a
> process ID or a job specification; if a job spec is given, all processes in that job's
> pipeline are waited for. If n is not given, all cur... |
23,066,630 | I am using nested shell scripts.
My question is a bit similar to the ones asked [here](https://stackoverflow.com/questions/22566304/shell-script-not-waiting) and [here](https://stackoverflow.com/questions/6405039/shell-how-to-use-screen-and-wait-for-a-couple-of-background-processes-in-a-shel). But not exactly the sam... | 2014/04/14 | [
"https://Stackoverflow.com/questions/23066630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2249026/"
] | Inside `runThisScriptX.sh`, you should wait for the parallel children to complete before exiting:
```
child1 &
child2 &
child3 &
wait
```
Then in `OuterMostShellScript.sh`, you run `runThisScriptX.sh` itself in the background, and wait for it.
```
some commands
./runThisScriptX.sh &
wait
other commands
end of scri... | Use the bash built-in `wait`; from the [man page](http://linux.die.net/man/1/bash) -
>
> Wait for each specified process and return its termination status. Each n may be a
> process ID or a job specification; if a job spec is given, all processes in that job's
> pipeline are waited for. If n is not given, all cur... |
383,115 | So, I installed and have been using Ubuntu 12.04 LTS for a bout a year and a half now, and I am quite happy with it. My only problem is that a lot of games are not supported. I would use WINE for all of them that I could, but my laptop SUCKS, and it would crash if I did use WINE for most of the games I want to play. (Y... | 2013/11/27 | [
"https://askubuntu.com/questions/383115",
"https://askubuntu.com",
"https://askubuntu.com/users/219997/"
] | If you've already installed ubuntu on your computer when you install xp on a (empty) partition you'll need to restore your grub (with an added boot line for xp).
To do this you'll need to create an empty partition where you want to install xp (since you do not want xp to install on top of you linux system, effectively... | I consider installing Windows XP in a virtual machine the best option. The only drawback is performance. But if you have a new lapttop and want to run just simple games, I think that is it!
In Ubuntu, the command to install is
apt-get install virtualbox |
46,971 | Can i use Petrol: **Super 95 E10** in my car? I basically use **Super 98** on my car but the price is very expensive now 1.50 Euro cent. Where as Super 95 E10 is 1.20 Euro cent.
My car manual says i can use 95 RON or higher. Does 95 RON means Super 95 E10?
[ or regular 95 RON, it will give you the same amount of detonation resistance (in theory). There is a tradeoff with using Super 95 E10 over regular 95 RON fuel, that being energy density. Ethanol has a lower energy densit... | Note that not all cars are specified to use E10. The higher ethanol concentration may be detrimental to seals or other parts of the fuel preparation system.
Advice #1: Check with manufacturer if E10 is compatible
Advice #2: Use Super 95 (without "E10") if available.
Apart from that, @Paulster2's answer is the one yo... |
3,278,850 | Like `csv.reader()` are there any other functions which can read `.rtf`, `.txt`, `.doc` files in Python? | 2010/07/19 | [
"https://Stackoverflow.com/questions/3278850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277603/"
] | You can read a text file with
```
txt = open("file.txt").read()
```
Try [PyRTF](http://pyrtf.sourceforge.net/) for RTF files. I would think that reading MS Word .doc files are pretty unlikely unless you are on Windows and you can use some of the native MS interfaces for reading those files. [This article](http://www... | `csv` is a specific format so you need a "parser" to read it. This is what the csv module provides as you've mentioned. Text files (usually suffixed with `.txt`) don't have any fixed "format" so you can just read them after `open`ing them (Jesse's answer gives the details). CSV files are commonly text files so your dis... |
3,278,850 | Like `csv.reader()` are there any other functions which can read `.rtf`, `.txt`, `.doc` files in Python? | 2010/07/19 | [
"https://Stackoverflow.com/questions/3278850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277603/"
] | You can read a text file with
```
txt = open("file.txt").read()
```
Try [PyRTF](http://pyrtf.sourceforge.net/) for RTF files. I would think that reading MS Word .doc files are pretty unlikely unless you are on Windows and you can use some of the native MS interfaces for reading those files. [This article](http://www... | I've had a real headache trying to do this simple thing for word and writer documents.
There is a simple solution: call openoffice on the command line to convert your target document to text, then load the text into Python.
Other conversion tools I tried produced unreliable output, while other Python oOo libraries we... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.