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 |
|---|---|---|---|---|---|
13,801,418 | I am working on graph using opengl, I want to set timer for 512 values per second I did like this:
```
self.animationTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/512.0
target:self
selector:@selector(drawView)
userInfo... | 2012/12/10 | [
"https://Stackoverflow.com/questions/13801418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1564844/"
] | That's just not going to work.
There are (at least) two reasons.
1. "[Because of the various input sources a typical run loop manages, the effective resolution of the time interval for a timer is limited to on the order of 50-100 milliseconds](http://developer.apple.com/library/ios/#documentation/cocoa/reference/Foun... | I am able to plot 512 values per second.. same timeinterval i used but i refer Accelerometer graph: <http://developer.apple.com/library/ios/#samplecode/AccelerometerGraph/Listings/MainViewController_m.html#//apple_ref/doc/uid/DTS40007410-MainViewController_m-DontLinkElementID_10>
I customized it according to my require... |
13,801,418 | I am working on graph using opengl, I want to set timer for 512 values per second I did like this:
```
self.animationTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/512.0
target:self
selector:@selector(drawView)
userInfo... | 2012/12/10 | [
"https://Stackoverflow.com/questions/13801418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1564844/"
] | An NSTimer probably just can't fire that fast.
>
> A timer is not a real-time mechanism; it fires only when one of the run loop modes to which the timer has been added is running and able to check if the timer’s firing time has passed. Because of the various input sources a typical run loop manages, the effective res... | I am able to plot 512 values per second.. same timeinterval i used but i refer Accelerometer graph: <http://developer.apple.com/library/ios/#samplecode/AccelerometerGraph/Listings/MainViewController_m.html#//apple_ref/doc/uid/DTS40007410-MainViewController_m-DontLinkElementID_10>
I customized it according to my require... |
60,315,418 | Could somebody please help with getting UTC-converted Java timestamp of current local time?
The main goal is to get current date and time, convert into UTC Timestamp and then store in Ignite cache as a Timestamp `yyyy-MM-dd hh:mm:ss[.nnnnnnnnn]`.
My attempt was `Timestamp.from(Instant.now())`. However, it still consid... | 2020/02/20 | [
"https://Stackoverflow.com/questions/60315418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11162101/"
] | You can do it like this :
```
LocalDateTime localDateTime = Instant.now().atOffset(ZoneOffset.UTC).toLocalDateTime();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
System.out.println(localDateTime.format(formatter));
``` | Don’t use Timestamp
-------------------
You most probably don’t need a `Timestamp`. Which is good because the `Timestamp` class is poorly designed, indeed a true hack on top of the already poorly designed `Date` class. Both classes are also long outdated. Instead nearly 6 years ago we got java.time, the modern Java da... |
60,315,418 | Could somebody please help with getting UTC-converted Java timestamp of current local time?
The main goal is to get current date and time, convert into UTC Timestamp and then store in Ignite cache as a Timestamp `yyyy-MM-dd hh:mm:ss[.nnnnnnnnn]`.
My attempt was `Timestamp.from(Instant.now())`. However, it still consid... | 2020/02/20 | [
"https://Stackoverflow.com/questions/60315418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11162101/"
] | You can do it like this :
```
LocalDateTime localDateTime = Instant.now().atOffset(ZoneOffset.UTC).toLocalDateTime();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
System.out.println(localDateTime.format(formatter));
``` | Despite what the [Ignite docs say](https://ignite.apache.org/docs/latest/sql-reference/data-types#timestamp) you can pass in a 24hr time.
The docs says `yyyy-MM-dd hh:mm:ss[.nnnnnnnnn]` so you may be tempted in your code to use this to format your dates but this will lead to times after midday being wrong. Instead, for... |
60,315,418 | Could somebody please help with getting UTC-converted Java timestamp of current local time?
The main goal is to get current date and time, convert into UTC Timestamp and then store in Ignite cache as a Timestamp `yyyy-MM-dd hh:mm:ss[.nnnnnnnnn]`.
My attempt was `Timestamp.from(Instant.now())`. However, it still consid... | 2020/02/20 | [
"https://Stackoverflow.com/questions/60315418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11162101/"
] | Don’t use Timestamp
-------------------
You most probably don’t need a `Timestamp`. Which is good because the `Timestamp` class is poorly designed, indeed a true hack on top of the already poorly designed `Date` class. Both classes are also long outdated. Instead nearly 6 years ago we got java.time, the modern Java da... | Despite what the [Ignite docs say](https://ignite.apache.org/docs/latest/sql-reference/data-types#timestamp) you can pass in a 24hr time.
The docs says `yyyy-MM-dd hh:mm:ss[.nnnnnnnnn]` so you may be tempted in your code to use this to format your dates but this will lead to times after midday being wrong. Instead, for... |
8,937,324 | Let's say that I have a file (file1.php) with a simple form with the action attribute:
```
echo'
<form action="foo.php" method="post">
Name: <input type="text" name="username" /><br />
Email: <input type="text" name="email" /><br />
<input type="submit" name="submit" value="Submit me!" />
</form>';
$another_var = $us... | 2012/01/20 | [
"https://Stackoverflow.com/questions/8937324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/935480/"
] | Here's how I would do it.
**The html:**
```
<form id="form1" action="foo.php" method="post">
<!-- form elements -->
</form>
<form id="form2" action="bar.php" method = "post">
<input type="hidden" name="filename" value="" />
<!-- other form elements -->
</form>
```
**The javascript**
```
$('#form1').su... | I can think of two ways off the top of my head.
1.
```
session_start();
$_SESSION['user'] = $row['user_id']
```
Then, you can refer to $\_SESSION['user'] whenever until the session is destroyed.
Another way would be to include the file that defines $user\_id (foo.php) into file1.php with:
```
include("file1.php")... |
4,527,881 | 
---
This is my question. When it gets the upper bound of $\tan^{-1}(1)$ and lower bound of $\tan^{-1}(-1)$, how does he know $\tan^{-1}(-1)$ is equal to $-\frac{\pi}{4}$ rather than $\frac{3\pi}{4}$, and $\tan^{-1}(1)$ is equal to $\frac{\pi}{4}$ ra... | 2022/09/09 | [
"https://math.stackexchange.com/questions/4527881",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/1094051/"
] | $\tan^{-1}$ is a function and so it must be defined in a unique way. By convention, $\tan^{-1}(x)$ is the only real number $\theta$ such that $x=\tan \theta$ but also
$$-\frac{\pi}{2}< \theta < \frac{\pi}{2}$$ | >
> how does he know $\tan^{−1}(−1)$ is equal to $−\fracπ4$ rather than $\frac{3π}4$
>
>
>
The definition of $\arctan$ is basically a matter of convention and convenience. The usual definition of $\arctan$ is such that:
* It is an odd function.
* It is continuous.
* The value it produces are the smallest possible... |
49,815,596 | I'd like to use regex to scan a few Cobol files for a specific word but skipping comment lines. Cobol comments have an asterisk on the 7. column. The regex i've gotten so far using a negative lookbehind looks like this:
`^(?<!.{6}\*).+?COPY`
It matches both lines:
```
* COPY
COPY
```
I would ... | 2018/04/13 | [
"https://Stackoverflow.com/questions/49815596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2931702/"
] | You may use a lookahead instead of a lookbehind:
```
^(?!.{6}\*).+?COPY
```
See the [regex demo](https://regex101.com/r/wX56EK/2).
The lookbehind required some pattern to be absent before the start of the string, and thus was redundant, it always returned *true*. Lookaheads check for a pattern that is *to the right... | If you want to filter out EVERY comment you could use:
```
^ {6}(?!\*)
```
That will match only lines starting with spaces that DOES NOT have an '\*' at the 7th position.
COBOL can use the position 1-6 for numbering the lines, so may be safter to just use:
```
^.{6}(?!\*).*$
``` |
56,120,751 | I am working on upgrading Slim 2.x to 3.x to fix security findings. Currently in Slim 2 we are using configureMode to store environment specific database connections. The 3.0 upgrade guide only says that configureMode has been removed but doesn't tell you what to use instead. I've never worked in PHP as well as anyone ... | 2019/05/13 | [
"https://Stackoverflow.com/questions/56120751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10807522/"
] | As stated by @jacki360, the closest you will get is to use [func\_get\_args()](http://docs.php.net/manual/da/function.func-get-args.php).
```
abstract class Car
{
abstract public function handle();
}
class CarA extends Car
{
public function handle()
{
$args = func_get_args();
if ( count($... | Your function must have the same signature, so what you can try is making the function without argument: handle()
and when you need an argument just pass it when calling the method and retrieve them with
[func\_get\_args](http://docs.php.net/manual/da/function.func-get-args.php) |
56,120,751 | I am working on upgrading Slim 2.x to 3.x to fix security findings. Currently in Slim 2 we are using configureMode to store environment specific database connections. The 3.0 upgrade guide only says that configureMode has been removed but doesn't tell you what to use instead. I've never worked in PHP as well as anyone ... | 2019/05/13 | [
"https://Stackoverflow.com/questions/56120751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10807522/"
] | As stated by @jacki360, the closest you will get is to use [func\_get\_args()](http://docs.php.net/manual/da/function.func-get-args.php).
```
abstract class Car
{
abstract public function handle();
}
class CarA extends Car
{
public function handle()
{
$args = func_get_args();
if ( count($... | ```
abstract class Car {
abstract public function handle();
public $data;
public $color;
public function setArguments(Array $arguments, $recursive = false) {
$this->data = $recursive === true ? $this->data : array();
// Do additional formatting here if needed
foreach ($argument... |
74,499,834 | I have Three datasets that I want to MERGE/JOIN.
This This examples only include the first participants I have a total of 25
df1
```
ID Grup pretest
1 1 A 2
2 1 A 1
3 1 A 3
4 2 B NA
5 2 B 1
6 2 B 3
7 3... | 2022/11/19 | [
"https://Stackoverflow.com/questions/74499834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19944455/"
] | You can add a helper column *iid* to separate the entries.
```
df1 <- cbind(iid = 1:nrow(df1), df1)
df2 <- cbind(iid = 1:nrow(df2), df2)
```
With `dplyr`
```
library(dplyr)
left_join(df1, df2, c("iid", "ID", "Grup"))[,-1]
ID Grup pretest posttest
1 1 A 2 NA
2 1 A 1 5
3 1 ... | Another option is joining by rownames, eg. row numbers:
```
library(tibble)
library(dplyr)
left_join(rownames_to_column(df1), df2 %>% rownames_to_column() , by="rowname") %>%
select(ID = ID.x, Grup = Grup.x, pretest, posttest)
```
```
ID Grup pretest posttest
1 1 A 2 NA
2 1 A 1 ... |
74,499,834 | I have Three datasets that I want to MERGE/JOIN.
This This examples only include the first participants I have a total of 25
df1
```
ID Grup pretest
1 1 A 2
2 1 A 1
3 1 A 3
4 2 B NA
5 2 B 1
6 2 B 3
7 3... | 2022/11/19 | [
"https://Stackoverflow.com/questions/74499834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19944455/"
] | Since you are relying on the order of the frames, you can simply use `cbind()`
```
cbind(df1,df2[,3,F])
```
Output:
```
ID Grup pretest posttest
1 1 A 2 NA
2 1 A 1 5
3 1 A 3 4
4 2 B NA 2
5 2 B 1 4
6 2 B 3 3
... | Another option is joining by rownames, eg. row numbers:
```
library(tibble)
library(dplyr)
left_join(rownames_to_column(df1), df2 %>% rownames_to_column() , by="rowname") %>%
select(ID = ID.x, Grup = Grup.x, pretest, posttest)
```
```
ID Grup pretest posttest
1 1 A 2 NA
2 1 A 1 ... |
16,692 | How do I change a data type for a field in a table?
To change the field name we can use [db\_change\_field()](http://api.drupal.org/api/drupal/includes--database.mysql-common.inc/function/db_change_field/6). | 2011/12/03 | [
"https://drupal.stackexchange.com/questions/16692",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/823/"
] | The same function can be used to change the type of the field.
Suppose you are the following field defined for the "foo" schema.
```
$schema['foo'] = array(
'fields' => array(
'bar' => array('type' => 'int', 'not null' => TRUE)
),
'primary key' => array('bar')
);
```
You can change its type to "serial" us... | For DRUPAL 7
There are 4 places that you have to change when the above answer does not work or you really want to do this by hand. To change my INT file into an VARCHAR 64 I did like this:
1. Change the database table for the field. I created a field with the same name with txt at the end (the value field). Since text... |
34,271 | We have several reasonably well functioning small software development teams working on different areas of the business. Each team has its own lead and roughly 8 other developers on it. The teams have no overarching boss except for the CEO, who is not involved in the day to day development activities at all.
These tea... | 2022/08/19 | [
"https://pm.stackexchange.com/questions/34271",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/52499/"
] | My 2 cents:
There is no need to unify the way they work if they are working well. Don’t try to fix something that is not broken!
So I would suggest something different here coming from Fractal. Make one of the engineers in each team a champion of cross-functional collaboration and facilitate meetings with them to exc... | **Hello Carthage.** While agile does encourage teams to adapt working practices I can see the advantage of having just enough consistency to make collaboration easier. It also makes it easier for people to understand what everyone else is doing and for people to move between teams.
From a finance department perspectiv... |
37,459,080 | I am using an HTML as a REST client. I need to send form data to a server.
On a server side (implemented with java), a path to my POST(i`m using POST to update my table) method is something like : @Path("<http://www.something.com/>{id}")
The path works fine, I have tested it with Postman and browser, but for my HTML cl... | 2016/05/26 | [
"https://Stackoverflow.com/questions/37459080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5119159/"
] | You are sending string to the image. You must load image from url like this:
```
NSString *urlImage = [dictdetails objectForKey:@"profile_pic"];
cell.profileImage.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:urlImage]]];
```
EDIT: This is synchronous image loading.
I would like... | Just addition to the @Stefan and @balkaranSingh's answers. I think your `@"age"` key is holding `NSNumber` not `NSString`, for this reason convert it into string.
```
cell.lblAge.text = [[dictdetails objectForKey:@"age"] stringValue];
``` |
37,459,080 | I am using an HTML as a REST client. I need to send form data to a server.
On a server side (implemented with java), a path to my POST(i`m using POST to update my table) method is something like : @Path("<http://www.something.com/>{id}")
The path works fine, I have tested it with Postman and browser, but for my HTML cl... | 2016/05/26 | [
"https://Stackoverflow.com/questions/37459080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5119159/"
] | ```
dispatch_async(dispatch_get_global_queue(0,0), ^{
NSData * data = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString:[dictdetails objectForKey:@"profile_pic"]]];
if ( data == nil )
return;
dispatch_async(dispatch_get_main_queue(), ^{
cell.image = [UIImage imageWithData: data];
... | Just addition to the @Stefan and @balkaranSingh's answers. I think your `@"age"` key is holding `NSNumber` not `NSString`, for this reason convert it into string.
```
cell.lblAge.text = [[dictdetails objectForKey:@"age"] stringValue];
``` |
17,216,966 | Lets say I have an array with following data:
```
@array[0] = "hello this is a text"
@array[1] = "this is a cat"
@array[2] = "this is a dog"
@array[3] = "this is a person"
@array[4] = "this is a computer"
@array[5] = "this is a code"
@array[6] = "this is an array"
@array[7] = "this is an element"
@array[8] = "this is... | 2013/06/20 | [
"https://Stackoverflow.com/questions/17216966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1535062/"
] | `@array = grep not /dog/, @array;`
```
@array = grep !/dog/, @array;
``` | ```
@array = grep(!/dog/, @array);
``` |
17,216,966 | Lets say I have an array with following data:
```
@array[0] = "hello this is a text"
@array[1] = "this is a cat"
@array[2] = "this is a dog"
@array[3] = "this is a person"
@array[4] = "this is a computer"
@array[5] = "this is a code"
@array[6] = "this is an array"
@array[7] = "this is an element"
@array[8] = "this is... | 2013/06/20 | [
"https://Stackoverflow.com/questions/17216966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1535062/"
] | Clearly just reassigning the whole array is easier, but to actually loop through and delete, you do something like this:
```
use strict;
use warnings;
my @array = (
'hello this is a text',
'this is a cat',
'this is a dog',
'this is a person',
'this is a computer',
'this is a code',
'this i... | ```
@array = grep(!/dog/, @array);
``` |
4,620,391 | I have a MySQL statement that inserts some variables into the database. I recently added 2 fields which are optional ($intLat, $intLng). Right now, if these values are not entered I pass along an empty string as a value. How do I pass an explicit NULL value to MySQL (if empty)?
```
$query = "INSERT INTO data (notes, i... | 2011/01/06 | [
"https://Stackoverflow.com/questions/4620391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547794/"
] | To pass a NULL to MySQL, you do just that.
```
INSERT INTO table (field,field2) VALUES (NULL,3)
```
So, in your code, check `if $intLat, $intLng` are `empty`, if they are, use `NULL` instead of `'$intLat'` or `'$intLng'`.
```
$intLat = !empty($intLat) ? "'$intLat'" : "NULL";
$intLng = !empty($intLng) ? "'$intLng'" ... | **2022 | PHP 7.3 | MySQL 5.7**
Accepted answer by Rocket Hazmat gives me "NULL" as a string. So I change it to:
```
$intLat = !empty($intLat) ? "'$intLat'" : NULL;
$intLng = !empty($intLng) ? "'$intLng'" : NULL;
``` |
4,620,391 | I have a MySQL statement that inserts some variables into the database. I recently added 2 fields which are optional ($intLat, $intLng). Right now, if these values are not entered I pass along an empty string as a value. How do I pass an explicit NULL value to MySQL (if empty)?
```
$query = "INSERT INTO data (notes, i... | 2011/01/06 | [
"https://Stackoverflow.com/questions/4620391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547794/"
] | This works just fine for me:
```
INSERT INTO table VALUES ('', NULLIF('$date',''))
```
(first `''` increments id field) | All you have to do is: `$variable =NULL;` // and pass it in the insert query. This will store the value as NULL in mysql db |
4,620,391 | I have a MySQL statement that inserts some variables into the database. I recently added 2 fields which are optional ($intLat, $intLng). Right now, if these values are not entered I pass along an empty string as a value. How do I pass an explicit NULL value to MySQL (if empty)?
```
$query = "INSERT INTO data (notes, i... | 2011/01/06 | [
"https://Stackoverflow.com/questions/4620391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547794/"
] | To pass a NULL to MySQL, you do just that.
```
INSERT INTO table (field,field2) VALUES (NULL,3)
```
So, in your code, check `if $intLat, $intLng` are `empty`, if they are, use `NULL` instead of `'$intLat'` or `'$intLng'`.
```
$intLat = !empty($intLat) ? "'$intLat'" : "NULL";
$intLng = !empty($intLng) ? "'$intLng'" ... | >
> For some reason, radhoo's solution wouldn't work for me. When I used the following expression:
>
>
>
```
$query = "INSERT INTO uradmonitor (db_value1, db_value2) VALUES (".
(($val1=='')?"NULL":("'".$val1."'")) . ", ".
(($val2=='')?"NULL":("'".$val2."'")) .
")";
```
>
> 'null' (with quotes) was ... |
4,620,391 | I have a MySQL statement that inserts some variables into the database. I recently added 2 fields which are optional ($intLat, $intLng). Right now, if these values are not entered I pass along an empty string as a value. How do I pass an explicit NULL value to MySQL (if empty)?
```
$query = "INSERT INTO data (notes, i... | 2011/01/06 | [
"https://Stackoverflow.com/questions/4620391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547794/"
] | This works just fine for me:
```
INSERT INTO table VALUES ('', NULLIF('$date',''))
```
(first `''` increments id field) | If you don't pass values, you'll get nulls for defaults.
But you can just pass the word NULL without quotes. |
4,620,391 | I have a MySQL statement that inserts some variables into the database. I recently added 2 fields which are optional ($intLat, $intLng). Right now, if these values are not entered I pass along an empty string as a value. How do I pass an explicit NULL value to MySQL (if empty)?
```
$query = "INSERT INTO data (notes, i... | 2011/01/06 | [
"https://Stackoverflow.com/questions/4620391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547794/"
] | If you don't pass values, you'll get nulls for defaults.
But you can just pass the word NULL without quotes. | Normally, you add regular values to mySQL, from PHP like this:
```
function addValues($val1, $val2) {
db_open(); // just some code ot open the DB
$query = "INSERT INTO uradmonitor (db_value1, db_value2) VALUES ('$val1', '$val2')";
$result = mysql_query($query);
db_close(); // just some code to close t... |
4,620,391 | I have a MySQL statement that inserts some variables into the database. I recently added 2 fields which are optional ($intLat, $intLng). Right now, if these values are not entered I pass along an empty string as a value. How do I pass an explicit NULL value to MySQL (if empty)?
```
$query = "INSERT INTO data (notes, i... | 2011/01/06 | [
"https://Stackoverflow.com/questions/4620391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547794/"
] | your query can go as follows:
```
$query = "INSERT INTO data (notes, id, filesUploaded, lat, lng, intLat, intLng)
VALUES ('$notes', '$id', TRIM('$imageUploaded'), '$lat', '$lng', '" . ($lat == '')?NULL:$lat . "', '" . ($long == '')?NULL:$long . "')";
mysql_query($query);
``` | Check the variables before building the query, if they are empty, change them to the string NULL |
4,620,391 | I have a MySQL statement that inserts some variables into the database. I recently added 2 fields which are optional ($intLat, $intLng). Right now, if these values are not entered I pass along an empty string as a value. How do I pass an explicit NULL value to MySQL (if empty)?
```
$query = "INSERT INTO data (notes, i... | 2011/01/06 | [
"https://Stackoverflow.com/questions/4620391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547794/"
] | If you don't pass values, you'll get nulls for defaults.
But you can just pass the word NULL without quotes. | **2022 | PHP 7.3 | MySQL 5.7**
Accepted answer by Rocket Hazmat gives me "NULL" as a string. So I change it to:
```
$intLat = !empty($intLat) ? "'$intLat'" : NULL;
$intLng = !empty($intLng) ? "'$intLng'" : NULL;
``` |
4,620,391 | I have a MySQL statement that inserts some variables into the database. I recently added 2 fields which are optional ($intLat, $intLng). Right now, if these values are not entered I pass along an empty string as a value. How do I pass an explicit NULL value to MySQL (if empty)?
```
$query = "INSERT INTO data (notes, i... | 2011/01/06 | [
"https://Stackoverflow.com/questions/4620391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547794/"
] | This works just fine for me:
```
INSERT INTO table VALUES ('', NULLIF('$date',''))
```
(first `''` increments id field) | **2022 | PHP 7.3 | MySQL 5.7**
Accepted answer by Rocket Hazmat gives me "NULL" as a string. So I change it to:
```
$intLat = !empty($intLat) ? "'$intLat'" : NULL;
$intLng = !empty($intLng) ? "'$intLng'" : NULL;
``` |
4,620,391 | I have a MySQL statement that inserts some variables into the database. I recently added 2 fields which are optional ($intLat, $intLng). Right now, if these values are not entered I pass along an empty string as a value. How do I pass an explicit NULL value to MySQL (if empty)?
```
$query = "INSERT INTO data (notes, i... | 2011/01/06 | [
"https://Stackoverflow.com/questions/4620391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547794/"
] | your query can go as follows:
```
$query = "INSERT INTO data (notes, id, filesUploaded, lat, lng, intLat, intLng)
VALUES ('$notes', '$id', TRIM('$imageUploaded'), '$lat', '$lng', '" . ($lat == '')?NULL:$lat . "', '" . ($long == '')?NULL:$long . "')";
mysql_query($query);
``` | you can do it for example with
```
UPDATE `table` SET `date`='', `newdate`=NULL WHERE id='$id'
``` |
4,620,391 | I have a MySQL statement that inserts some variables into the database. I recently added 2 fields which are optional ($intLat, $intLng). Right now, if these values are not entered I pass along an empty string as a value. How do I pass an explicit NULL value to MySQL (if empty)?
```
$query = "INSERT INTO data (notes, i... | 2011/01/06 | [
"https://Stackoverflow.com/questions/4620391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547794/"
] | To pass a NULL to MySQL, you do just that.
```
INSERT INTO table (field,field2) VALUES (NULL,3)
```
So, in your code, check `if $intLat, $intLng` are `empty`, if they are, use `NULL` instead of `'$intLat'` or `'$intLng'`.
```
$intLat = !empty($intLat) ? "'$intLat'" : "NULL";
$intLng = !empty($intLng) ? "'$intLng'" ... | This works just fine for me:
```
INSERT INTO table VALUES ('', NULLIF('$date',''))
```
(first `''` increments id field) |
32,431,074 | I'm creating a eDM newsletter as a template in Marketo and it views fine in nearly everything but gmail. Divs with images seem to be creating a bottom-margin or something and I can't figure out how to get rid of it. Please see mark up below and an image with red rectangles representing the problem margin areas.
Thanks... | 2015/09/07 | [
"https://Stackoverflow.com/questions/32431074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1027005/"
] | It's giving you a `syntax error` because you are using a reserved MySQL keyword "long". To fix this, you need to either rename your column or escape it the "MySQL" way using backticks
```
UPDATE `a2418693_GCM`.`driver` SET
`lat` ='78.54555',
`long` ='78.45544252'
WHERE `username` ='rakesh'
``` | ```
UPDATE a2418693_GCM.driver SET lat = 78.54555,
longitude = 78.45544252 WHERE username = 'rakesh'
```
since long is a data type
so I used longitude in place of long |
4,524,063 | Could someone point me to snippet for making parallel web-requests? I need to make 6 web requests and concatenate the HTML result.
Is there a quick way to accomplish this or do i have to go the threading way?
Thank you. | 2010/12/24 | [
"https://Stackoverflow.com/questions/4524063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304151/"
] | Use [`ExecutorService`](http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html) with [`Callable<InputStream>`](http://download.oracle.com/javase/6/docs/api/java/util/concurrent/Callable.html).
Kickoff example:
```
ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRunti... | I'd recommend learning about [java.util.concurrent.ExecutorService](http://download.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/ExecutorService.html "Executor"). It allows you to run tasks simultaneously and would work well for the scenario you describe. |
651,839 | How can I create nodes such that every word in a node gets put to a new line?
MWE:
```
\usepackage{tikz} % used instead of adt_web.sty here
\usetikzlibrary{calc, positioning, shapes.multipart}
\begin{tikzpicture}[
every node/.style = {
draw,
fill = gray!10,
... | 2022/07/24 | [
"https://tex.stackexchange.com/questions/651839",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/215052/"
] | You can take advantage of the fact that `\tcbset` applies to all `tcolorbox`es in the same group level.
```
\documentclass{article}
\usepackage{tcolorbox}
\NewDocumentCommand{\mycommand}{sm}{%
\begingroup
\IfBooleanT{#1}{\tcbset{center,colback=black!20!white}}%
\begin{tcolorbox}[
width=.75\textwidth,
bo... | A variation of egreg's answer which takes into account that square brackets of optional arguments don't need to be matched when occurring within undelimited arguments:
```latex
\documentclass{article}
\usepackage{tcolorbox}
\NewDocumentCommand{\mycommand}{sm}{%
\IfBooleanTF{#1}{\begin{tcolorbox}[center, colback=b... |
9,355,104 | I just started with java a few weeks ago, and am trying to make a program to verify that a password is at least 10 characters, has at least one each of:upper case, lower case, number, and is only alphanumeric characters.
Below is the code I have so far. It's more English than code actually, but what I'm trying to do i... | 2012/02/20 | [
"https://Stackoverflow.com/questions/9355104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1219997/"
] | I just give the correct code undocumented. Because I think you've got the right ideas, but are missing a bit of Java syntax. You might debug the code with single-step through all commands.
```
public class ValidatingPassword {
public static void main(String[] args) {
String[] passwords = { "testcase", "T3... | Yes it is possible to nest the boolean statements... your bracers are all messed up though.
You have:
```
for (int x = 0; x < lengthPassword; x++){
if ('A' <=x && x <= 'Z');}
else if {
return false;
```
which should look more like:
```
for (int x = 0; x < lengthPassword; x++)
{
if ('A' <=x && x <= ... |
3,997,056 | Is there any possible way that a generic type can be used to contain a child of a base class.
From the assignment given to me, I am to create something similar to the following in structure.
```
template <class T>
class Fruit {
private:
int count;
int location_id;
T type;
public:
virtual void disp... | 2010/10/22 | [
"https://Stackoverflow.com/questions/3997056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267493/"
] | I don't know the name, but you are better with not implementing the template - just declaring it will throw a compilation error if someone tries to instantiate :
```
template< Fruit T >
struct SomeFruit;
``` | This is called template specialization. In this case it is explicit (aka full) specialization, which is recognized by `template <>`, as opposed to partial specialization. |
3,997,056 | Is there any possible way that a generic type can be used to contain a child of a base class.
From the assignment given to me, I am to create something similar to the following in structure.
```
template <class T>
class Fruit {
private:
int count;
int location_id;
T type;
public:
virtual void disp... | 2010/10/22 | [
"https://Stackoverflow.com/questions/3997056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267493/"
] | That's usually used like this (to catch errors at compile-time)
```
template< Fruit T >
struct SomeFruit;
template<>
struct SomeFruit< eApple > {
void eatIt() { // eat an apple };
};
template<>
struct SomeFruit< eBanana > {
void eatIt() { // eat a banana };
};
```
and often called ***compile-time polymorph... | I don't know the name, but you are better with not implementing the template - just declaring it will throw a compilation error if someone tries to instantiate :
```
template< Fruit T >
struct SomeFruit;
``` |
3,997,056 | Is there any possible way that a generic type can be used to contain a child of a base class.
From the assignment given to me, I am to create something similar to the following in structure.
```
template <class T>
class Fruit {
private:
int count;
int location_id;
T type;
public:
virtual void disp... | 2010/10/22 | [
"https://Stackoverflow.com/questions/3997056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267493/"
] | That's usually used like this (to catch errors at compile-time)
```
template< Fruit T >
struct SomeFruit;
template<>
struct SomeFruit< eApple > {
void eatIt() { // eat an apple };
};
template<>
struct SomeFruit< eBanana > {
void eatIt() { // eat a banana };
};
```
and often called ***compile-time polymorph... | This is called template specialization. In this case it is explicit (aka full) specialization, which is recognized by `template <>`, as opposed to partial specialization. |
31,809,388 | What all can be the third parameter in for\_each in C++ ?
I read its unary function but the code which I encountered had object of some class as third arguement. | 2015/08/04 | [
"https://Stackoverflow.com/questions/31809388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5184267/"
] | The third argument can be a function object that is an object that can be used in the postfix expression of function call.
From the C++ Standard (20.9 Function objects)
>
> 1 A function object type is an object type (3.9) that can be the type
> of the postfix-expression in a function call (5.2.2, 13.3.1.1).231 A
> ... | From [cplusplus.com](http://www.cplusplus.com/reference/algorithm/for_each/) :
>
>
> ```
> template<class InputIterator, class Function>
> Function for_each (InputIterator first, InputIterator last, Function fn);
> ```
>
> **Parameters**
>
>
> `first`, `last`
>
> Input iterators to the initial and final posit... |
227,027 | I am trying to implement a navigation mechanism for my community
So I am trying to implement the new [lightning:navigation](https://developer.salesforce.com/docs/component-library/bundle/lightning:navigation) component.
This is my component - `main`:
**MARKUP**
```
<aura:component implements="forceCommunity:availa... | 2018/07/30 | [
"https://salesforce.stackexchange.com/questions/227027",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/33798/"
] | lightning:navigation is not supported in communities .Take a look at Summer18 release notes [here](https://releasenotes.docs.salesforce.com/en-us/summer18/release-notes/rn_lc_components_navigation.htm) that clearly mentions below
>
> These resources aren’t supported in other containers, such as Lightning Components f... | There's been an update for this since the best answer was posted and it's now possible to navigate around at your heart's content.
Here's how:
On the component:
```
<!-- exampleComponent.cmp -->
<aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
<lightning:navigation aura:id="... |
29,574,327 | I have a code like this:
```
super dooper pooper but dooper super pooper
```
I need to match everything from `super` to `pooper` (which can include ALL chars) but stop at the first `pooper`.
How can I do this? | 2015/04/11 | [
"https://Stackoverflow.com/questions/29574327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4584318/"
] | You can use this script for convert PNG image into JPEG image.
```
$input_file = "test.png";
$output_file = "test.jpg";
$input = imagecreatefrompng($input_file);
list($width, $height) = getimagesize($input_file);
$output = imagecreatetruecolor($width, $height);
imagecopy($output, $input, 0, 0, 0, 0, $width, $height);... | yes it is possible, you can google it using phrase "**png convert to jpg php**"
[Use PHP to convert PNG to JPG with compression?](https://stackoverflow.com/questions/1201798/use-php-to-convert-png-to-jpg-with-compression) |
17,363,063 | I am trying to put my website in production with capifony (capistrano) symfony2 app
Everything goes well but at some point it asks about Github credentials for private repos.
here is my error
>
> [out :: web-dev.domain.com] Could not fetch
> <https://api.github.com/repos/sensio/SensioDistributionBundle/zipball/4a2... | 2013/06/28 | [
"https://Stackoverflow.com/questions/17363063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/867101/"
] | I ran into the same problem running composer install (not with capifony).
The fix I found was explained here: <https://coderwall.com/p/xanheg>
It seems sensio has renamed their repo from sensio to sensiolabs. So I:
* removed the vendors/sensio folder
* in composer.lock renamed all instances of <https://github.com/se... | To avoid interactive (but disruptive) credentials ask, you can add this line in your `deploy.rb` file :
```
ssh_options[:forward_agent] = true
```
It transfers your SSH key for github access. |
27,587,179 | I am using restangular, but I have a problem with "Put" method, its not working as expected
My angularService code
```
var userService = function (restangular) {
var resourceBase = restangular.all("account/");
restangular.addResponseInterceptor(function (data, operation, what, url, response... | 2014/12/21 | [
"https://Stackoverflow.com/questions/27587179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3196883/"
] | You can only 'put' on a data object.
`customPUT([elem, path, params, headers])` is what you want. use it like this:
```
Restangular.all('yourTargetInSetPath').customPUT({'something': 'hello'}).then(
function(data) { /** do something **/ },
function(error) { /** do some other thing **/ }
);
``` | You can have put method only in restangularized objects. To fire put on any object, you need to check for put method, if object does not contain any put method then you need to convert that object in restangularized object.
Change your updateUser to following :
```
this.updateUser = function(user) {
if(user.put... |
62,314,474 | I am trying to make a functional login and registration pages (I know that in real life I need to store the login info in a database but for now I would like to see my pages "working"). I created two pages with forms one for registration and one for login. I also have two JS files one for locally storing input values (... | 2020/06/10 | [
"https://Stackoverflow.com/questions/62314474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13554908/"
] | As I explained in the other thread, at runtime, this code is not able to find the element IDs you are looking for.
Please move this code to the lowest point in the page body (i.e., before closing `</body>` tag) to ensure it is not executing before the elements are ready.
If you are executing this code on every page,... | In your document, in DOM, elements with ID "author" and/or "email" and/or "url" do not exists. Therefore, `elementAuthor`, `elementEmail` or `elementUrl` are null and you can't access `classList` property of a null error, hence the error.
Check in your HTML if you have declared elements with those missing IDs. |
11,161,788 | I'm trying to log the information from a cURL hit into a log file but am unable to do so,
I run windows with wamp and have given full control to all users in the machine and the log and php file that invokes cURL are in same directory for this test. I've used the below code:
```
$session = curl_init();
$logfh = fopen(... | 2012/06/22 | [
"https://Stackoverflow.com/questions/11161788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/749129/"
] | Note: If the URL you are trying to curl redirects to another URL, then writing output to a file WILL fail.
Please make sure you add the following line also-
```
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
```
Also as a side note, make sure you close the file with `fclose()` to make sure the file is complete. | If you've added `fclose()`, and made the various "little fixes" listed in the comments above, but it's still not working... then I suspect that you're seeing conflicting options:
* `CURLOPT_RETURNTRANSFER` tells curl to return the response as the *return value* of the `curl_exec()` call.
* `CURLOPT_FILE` and `CURLOPT_... |
11,161,788 | I'm trying to log the information from a cURL hit into a log file but am unable to do so,
I run windows with wamp and have given full control to all users in the machine and the log and php file that invokes cURL are in same directory for this test. I've used the below code:
```
$session = curl_init();
$logfh = fopen(... | 2012/06/22 | [
"https://Stackoverflow.com/questions/11161788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/749129/"
] | Note: If the URL you are trying to curl redirects to another URL, then writing output to a file WILL fail.
Please make sure you add the following line also-
```
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
```
Also as a side note, make sure you close the file with `fclose()` to make sure the file is complete. | There could be also issue while using `CURLINFO_HEADER_OUT` = true. I guess there is something in `CURLINFO_VERBOSE` that uses this option and just supress VERBOSE information...
```
curl_setopt($ch, CURLINFO_HEADER_OUT, false);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR, fopen('log.log',... |
11,161,788 | I'm trying to log the information from a cURL hit into a log file but am unable to do so,
I run windows with wamp and have given full control to all users in the machine and the log and php file that invokes cURL are in same directory for this test. I've used the below code:
```
$session = curl_init();
$logfh = fopen(... | 2012/06/22 | [
"https://Stackoverflow.com/questions/11161788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/749129/"
] | If you've added `fclose()`, and made the various "little fixes" listed in the comments above, but it's still not working... then I suspect that you're seeing conflicting options:
* `CURLOPT_RETURNTRANSFER` tells curl to return the response as the *return value* of the `curl_exec()` call.
* `CURLOPT_FILE` and `CURLOPT_... | There could be also issue while using `CURLINFO_HEADER_OUT` = true. I guess there is something in `CURLINFO_VERBOSE` that uses this option and just supress VERBOSE information...
```
curl_setopt($ch, CURLINFO_HEADER_OUT, false);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR, fopen('log.log',... |
7,487,244 | I’m trying to reorder divs on the base of certain values they contain. My code is the following
HTML
```
<div id="content_id_1">
<ul>
<li> some text, not important for the reordering but it must move with it's parent div</li>
<li> some text, not important for the reordering but it must move with it's parent... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7487244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/676683/"
] | something like this:
```
$("#data_filter").change(function(){
function sortDateASC(a, b){
var keya = new Date($(a).find('div[class^="date--"]').text().replace("'","")).getTime();
var keyb = new Date($(b).find('div[class^="date--"]').text().replace("'","")).getTime();
return keya > keyb ? 1 : keya < keyb ... | you can only compare values, not jquery objects. so you could try:
```
return $(a).find(div[class^=date--]).attr('class') > $(b).find(div[class^=date--]).attr('class') ? 1 : -1;
```
not sure if it works though. |
53,978,610 | Given a call to a function `bar::foo()`, I would like to be able to programmatically switch the package `bar` so that the same syntax calls `hello::foo()`.
**An example**:
* Let's say I have three packages, `parentPkg`, `childPkg1` and `childPkg2`.
* In `parentPkg` I have a call to function `childPkg1::foo()`
* `foo... | 2018/12/30 | [
"https://Stackoverflow.com/questions/53978610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5276212/"
] | Since `::` can be seen as a function, it looks like
```
`::`(dummy_pkg_name, foo)()
```
is what you want. Alternatively,
```
getFromNamespace("foo", ns = dummy_pkg_name)()
```
---
For instance,
```
`::`(stats, t.test)
# function (x, ...)
# UseMethod("t.test")
# <bytecode: 0x102fd4b00>
# <environment: namespace... | You could also create a `call()` that could then be evaluated.
```
call("::", quote(bar), quote(foo()))
# bar::foo()
```
Put into use:
```
c <- call("::", quote(stats), quote(t.test))
eval(c)
# function (x, ...)
# UseMethod("t.test")
# <bytecode: 0x4340988>
# <environment: namespace:stats>
```
Wrapped up in a fu... |
53,978,610 | Given a call to a function `bar::foo()`, I would like to be able to programmatically switch the package `bar` so that the same syntax calls `hello::foo()`.
**An example**:
* Let's say I have three packages, `parentPkg`, `childPkg1` and `childPkg2`.
* In `parentPkg` I have a call to function `childPkg1::foo()`
* `foo... | 2018/12/30 | [
"https://Stackoverflow.com/questions/53978610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5276212/"
] | Since `::` can be seen as a function, it looks like
```
`::`(dummy_pkg_name, foo)()
```
is what you want. Alternatively,
```
getFromNamespace("foo", ns = dummy_pkg_name)()
```
---
For instance,
```
`::`(stats, t.test)
# function (x, ...)
# UseMethod("t.test")
# <bytecode: 0x102fd4b00>
# <environment: namespace... | To adhere to [KISS](https://en.wikipedia.org/wiki/KISS_principle), simply re-assign to new named functions in global environment. Be sure to leave out `()` since you are not requesting to run the function.
```
parent_foo <- parentPkg::foo
child1_foo <- childPkg1::foo
child2_foo <- childPkg2::foo
child3_foo <- childPk... |
11,754,675 | I have a string of numbers that i would like to make shorter for use in a URL. This string always consists of numbers only. For example: 9587661771112
In theory, encrypting a numeric string into an alphanumeric(0-9a-zA-Z) string should always return a shorter result, which is what i want.
I've created an algorithm th... | 2012/08/01 | [
"https://Stackoverflow.com/questions/11754675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1131773/"
] | Solution:
```
string Chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
private static string Base10To62(string S)
{
string R = "";
var N = long.Parse(S);
do { R += Chars[(int)(N % 0x3E)]; } while ((N /= 0x3E) != 0);
return R;
}
private static s... | Linq version for 62 to 10, just for fun:
```
long Base62To10(string N)
{
return N.Select((t, i) => Chars.IndexOf(t)*(long) Math.Pow(62, i)).Sum();
}
``` |
11,754,675 | I have a string of numbers that i would like to make shorter for use in a URL. This string always consists of numbers only. For example: 9587661771112
In theory, encrypting a numeric string into an alphanumeric(0-9a-zA-Z) string should always return a shorter result, which is what i want.
I've created an algorithm th... | 2012/08/01 | [
"https://Stackoverflow.com/questions/11754675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1131773/"
] | Solution:
```
string Chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
private static string Base10To62(string S)
{
string R = "";
var N = long.Parse(S);
do { R += Chars[(int)(N % 0x3E)]; } while ((N /= 0x3E) != 0);
return R;
}
private static s... | If you can add two more characters to your set to make it a nice even 64, then there is a simple, fast algorithm I can describe here.
Encode the digits into a three or four-bit code as follows:
```
0: 000
1: 001
2: 010
3: 011
4: 100
5: 101
6: 1100
7: 1101
8: 1110
9: 1111
```
This is a prefix code, which means that ... |
39,756,565 | I'm having some troubles trying to develop a webapp for uploading files to my owncloud server trough a form using PHP, I'm using curl to PUT a request through the webDav, so here's the code:
Index.php
```
<html>
<head>
<title>Theform is here</title>
</head>
<body>
<div ... | 2016/09/28 | [
"https://Stackoverflow.com/questions/39756565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2127909/"
] | You don't need to pass an JQuery instance to `isDataTable()`.
`isDataTable()` requires an ID.
For more information : [isDataTable()](https://datatables.net/reference/api/$.fn.dataTable.isDataTable%28%29)
Please check this:
[How to check if DataTables are initialized](https://stackoverflow.com/questions/18919790/how... | From Documentacion of DataTable:
<https://datatables.net/reference/api/>$.fn.dataTable.isDataTable()
>
> This method provides the ability to check if a ***table (tag)*** node is already a
> DataTable or not. This can be useful to ensure that you don't
> re-initialise a table that is already a DataTable.
>
>
> |
39,756,565 | I'm having some troubles trying to develop a webapp for uploading files to my owncloud server trough a form using PHP, I'm using curl to PUT a request through the webDav, so here's the code:
Index.php
```
<html>
<head>
<title>Theform is here</title>
</head>
<body>
<div ... | 2016/09/28 | [
"https://Stackoverflow.com/questions/39756565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2127909/"
] | I [asked this question](https://datatables.net/forums/discussion/38053/how-to-check-if-a-variable-is-an-initialized-datatable) to the creator of DataTables, and he suggested **using `instanceof`**:
```
var table = $("#table").DataTable(); // Valid initialized DataTable
if (table instanceof $.fn.dataTable.Api) {
//... | You don't need to pass an JQuery instance to `isDataTable()`.
`isDataTable()` requires an ID.
For more information : [isDataTable()](https://datatables.net/reference/api/$.fn.dataTable.isDataTable%28%29)
Please check this:
[How to check if DataTables are initialized](https://stackoverflow.com/questions/18919790/how... |
39,756,565 | I'm having some troubles trying to develop a webapp for uploading files to my owncloud server trough a form using PHP, I'm using curl to PUT a request through the webDav, so here's the code:
Index.php
```
<html>
<head>
<title>Theform is here</title>
</head>
<body>
<div ... | 2016/09/28 | [
"https://Stackoverflow.com/questions/39756565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2127909/"
] | I [asked this question](https://datatables.net/forums/discussion/38053/how-to-check-if-a-variable-is-an-initialized-datatable) to the creator of DataTables, and he suggested **using `instanceof`**:
```
var table = $("#table").DataTable(); // Valid initialized DataTable
if (table instanceof $.fn.dataTable.Api) {
//... | From Documentacion of DataTable:
<https://datatables.net/reference/api/>$.fn.dataTable.isDataTable()
>
> This method provides the ability to check if a ***table (tag)*** node is already a
> DataTable or not. This can be useful to ensure that you don't
> re-initialise a table that is already a DataTable.
>
>
> |
8,382,203 | I want to retrieve time zone from struct tm as the format below
2011-12-32 12:13:05 +0530(obtained using gtime)
I could get the first two sets but could not get the way getting the time zone value. Please let me know how it should get the time zone using c++ time.
Regards,
iSight | 2011/12/05 | [
"https://Stackoverflow.com/questions/8382203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/276989/"
] | If you really want to use standard C library to get timezone, try using external variable 'timezone' declared in time.h. Keep in mind that its value is set after tzset() function call. Every time conversion function that depends on the timezone implicitly calls this function. As an alternative you can call tzset() expl... | I think tm structure retrieved via time.h contains timezone information, if all you require is difference from GMT.
```
struct tm {
int tm_sec; /* seconds after the minute [0-60] */
int tm_min; /* minutes after the hour [0-59] */
int tm_hour; /* hours since midnight [0-23] */
int tm_mday; /* day of the m... |
2,821,381 | $a,b,c$ are real;
$a<b<c$ ;
$a+b+c=6$ ;
$ab+bc+ca = 9$.
Prove that $0<a<1<b<3<c<4$.
I solved this by treating $a,b,c$ as roots of $x^3 - 6x^2 + 9x + d$ for some $d$, but I have not been able to solve it in a more direct way. | 2018/06/16 | [
"https://math.stackexchange.com/questions/2821381",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/435462/"
] | I think you are going in the right direction. You need some estimates of the coefficient $d$. Note that the polynomial
$$P(x)=x^3 - 6x^2 + 9x + d=x(x-3)^2+d$$
has three real distinct roots $a<b<c$ if and only if $P(1)=4+d>0$ and $P(3)=d<0$ where $1$ is the local maximum of $P$ and and $3$ is local minimum of $P$ (che... | *Partial solution:*
Let $\{x,y,z\} =\{a,b,c\}$. Since $z=6-x-y$ we get a quadratic equation:
$$ x^2+x(y-6)+(y-3)^2 =0$$
and since this one has to have a real solution we have a discriminant nonnegative, so
$$ -3y(y-4)\geq 0 \implies y\in [0,4]$$
and the same we can say for $x$ and $z$.
---
Now can any of $x,y... |
2,821,381 | $a,b,c$ are real;
$a<b<c$ ;
$a+b+c=6$ ;
$ab+bc+ca = 9$.
Prove that $0<a<1<b<3<c<4$.
I solved this by treating $a,b,c$ as roots of $x^3 - 6x^2 + 9x + d$ for some $d$, but I have not been able to solve it in a more direct way. | 2018/06/16 | [
"https://math.stackexchange.com/questions/2821381",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/435462/"
] | I think you are going in the right direction. You need some estimates of the coefficient $d$. Note that the polynomial
$$P(x)=x^3 - 6x^2 + 9x + d=x(x-3)^2+d$$
has three real distinct roots $a<b<c$ if and only if $P(1)=4+d>0$ and $P(3)=d<0$ where $1$ is the local maximum of $P$ and and $3$ is local minimum of $P$ (che... | I want to note that solving this problem using polynomials may be the most natural and, in fact, direct way to do. You can for example prove each inequality individually. To show $a>0$, you have $$0 < (b-c)^2=(b+c)^2-4bc=(6-a)^2-4\big(9-a(b+c)\big)=(6-a)^2-4\big(9-a(6-a)\big)\,,$$
which gives $3a(4-a)>0$, whence $a>0$ ... |
2,821,381 | $a,b,c$ are real;
$a<b<c$ ;
$a+b+c=6$ ;
$ab+bc+ca = 9$.
Prove that $0<a<1<b<3<c<4$.
I solved this by treating $a,b,c$ as roots of $x^3 - 6x^2 + 9x + d$ for some $d$, but I have not been able to solve it in a more direct way. | 2018/06/16 | [
"https://math.stackexchange.com/questions/2821381",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/435462/"
] | I want to note that solving this problem using polynomials may be the most natural and, in fact, direct way to do. You can for example prove each inequality individually. To show $a>0$, you have $$0 < (b-c)^2=(b+c)^2-4bc=(6-a)^2-4\big(9-a(b+c)\big)=(6-a)^2-4\big(9-a(6-a)\big)\,,$$
which gives $3a(4-a)>0$, whence $a>0$ ... | *Partial solution:*
Let $\{x,y,z\} =\{a,b,c\}$. Since $z=6-x-y$ we get a quadratic equation:
$$ x^2+x(y-6)+(y-3)^2 =0$$
and since this one has to have a real solution we have a discriminant nonnegative, so
$$ -3y(y-4)\geq 0 \implies y\in [0,4]$$
and the same we can say for $x$ and $z$.
---
Now can any of $x,y... |
531,801 | I'm working on a project in which I need a small heater pad. I'm limited to a 12V supply which can provide 12.5A and I am drawing about 3.5A of that with my other electronics.
I have an old AnyCubic I3 Mega heated bed shown below which I thought I might be able to use. Based on [this](https://www.banggood.com/Anycubic... | 2020/11/11 | [
"https://electronics.stackexchange.com/questions/531801",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/110116/"
] | I cut the tracks to the top half heating element and connected to 12V. My supply draws 4.85A and half the plate gets hot so I guess the answer is yes. Disconnecting one half of the tracks will result in half the current draw. Simple ohms law. | Seeing as the link lists temperature setpoints the bed is capable of maintaining implies that the control circuit isn't just putting 12V to the heating element and counting on the resistance to limit current. Also, given the likely amount of resistance change due to temperature, I recommend using something like a switc... |
3,027,952 | In Ruby 1.8.7, `Array("hello\nhello")` gives you `["hello\n", "hello"]`. This does two things that I don't expect:
1. It splits the string on newlines. I'd expect it simply to give me an array with the string I pass in as its single element without modifying the data I pass in.
2. Even if you accept that it's reasonab... | 2010/06/12 | [
"https://Stackoverflow.com/questions/3027952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43004/"
] | >
> It splits the string on newlines. I'd expect it simply to give me an array with the string I pass in as its single element without modifying the data I pass in.
>
>
>
That's a convention as good as any other. For example, the `list` constructor in Python does something entirely different:
```
>>> list("foo")
... | If you replace the double-quotes with single-quotes it works as expected:
```
>> Array.[] "foo\nbar"
=> ["foo\nbar"]
>> Array.[] 'foo\nbar'
=> ["foo\\nbar"]
``` |
3,027,952 | In Ruby 1.8.7, `Array("hello\nhello")` gives you `["hello\n", "hello"]`. This does two things that I don't expect:
1. It splits the string on newlines. I'd expect it simply to give me an array with the string I pass in as its single element without modifying the data I pass in.
2. Even if you accept that it's reasonab... | 2010/06/12 | [
"https://Stackoverflow.com/questions/3027952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43004/"
] | >
> It splits the string on newlines. I'd expect it simply to give me an array with the string I pass in as its single element without modifying the data I pass in.
>
>
>
That's a convention as good as any other. For example, the `list` constructor in Python does something entirely different:
```
>>> list("foo")
... | You may try:
```
"foo\nbar".split(/w/)
"foo\nbar".split(/^/)
"foo\nbar".split(/$/)
```
and other regular expressions. |
42,567,367 | I have this code
```
public App()
{
...
MainPage = new NavigationPage(content);
App.Navigation.PushAsync(new homePage());
}
```
the PushAsync does not work, it said the navigation is not defined, so can I prove to the compiler that Navigation is defined | 2017/03/02 | [
"https://Stackoverflow.com/questions/42567367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7612389/"
] | Looks to me like the compiler is right. Your `App` won't have a `Navigation` property. What you probably need is:
```
MainPage.Navigation.PushAsync(new homePage());
``` | Also
```
await Application.Current.MainPage.Navigation.PushAsync(new homePage());
``` |
42,567,367 | I have this code
```
public App()
{
...
MainPage = new NavigationPage(content);
App.Navigation.PushAsync(new homePage());
}
```
the PushAsync does not work, it said the navigation is not defined, so can I prove to the compiler that Navigation is defined | 2017/03/02 | [
"https://Stackoverflow.com/questions/42567367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7612389/"
] | Looks to me like the compiler is right. Your `App` won't have a `Navigation` property. What you probably need is:
```
MainPage.Navigation.PushAsync(new homePage());
``` | I've got my App() setup like this:
```
public App()
{
InitializeComponent();
MainPage = new NavigationPage(new MasterDetail());
}
```
My MasterDetail looks like this:
```
<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.... |
13,947,211 | I do a performance test on WSO2 ESB. And I found the log is too big that can not open. The biggest file is 7.20GB. I think this is a big problem. I want to set every log file less than 20MB, and I want delete old logs automatic. How to set this? Anyone can help me?

{
UIAlertView *missingInfo=[[UIAlertView alloc]initWithTitle:@"Missing Details" message:@"All Fields Are Necessary" delegate:nil... | For MacOS application
```
if([_text.stringValue isNotEqualTo:@""]){
NSLog(@"contains");
}
else{
NSLog(@"empty");
}
```
EDIT:
For ios:
```
NSString *textString=_text.text;
if(textString==NULL){
NSLog(@"NULL");
}
else{
NSLog(@"contains");
}
``` |
13,947,211 | I do a performance test on WSO2 ESB. And I found the log is too big that can not open. The biggest file is 7.20GB. I think this is a big problem. I want to set every log file less than 20MB, and I want delete old logs automatic. How to set this? Anyone can help me?
{
NSLog(@"contains");
}
else{
NSLog(@"empty");
}
```
EDIT:
For ios:
```
NSString *textString=_text.text;
if(textString==NULL){
NSLog(@"NULL");
}
else{
NSLog(@"contains");
}
``` | ```
if(Fname.length==0)
{
NSLog(@"null");
}
``` |
13,947,211 | I do a performance test on WSO2 ESB. And I found the log is too big that can not open. The biggest file is 7.20GB. I think this is a big problem. I want to set every log file less than 20MB, and I want delete old logs automatic. How to set this? Anyone can help me?
 {
NSLog(@"Text field empty");
} else {
NSLog(@"Text field has value");
}
``` | For MacOS application
```
if([_text.stringValue isNotEqualTo:@""]){
NSLog(@"contains");
}
else{
NSLog(@"empty");
}
```
EDIT:
For ios:
```
NSString *textString=_text.text;
if(textString==NULL){
NSLog(@"NULL");
}
else{
NSLog(@"contains");
}
``` |
13,947,211 | I do a performance test on WSO2 ESB. And I found the log is too big that can not open. The biggest file is 7.20GB. I think this is a big problem. I want to set every log file less than 20MB, and I want delete old logs automatic. How to set this? Anyone can help me?
{
NSLog(@"contains");
}
else{
NSLog(@"empty");
}
```
EDIT:
For ios:
```
NSString *textString=_text.text;
if(textString==NULL){
NSLog(@"NULL");
}
else{
NSLog(@"contains");
}
``` | You can just do this:
```
if ([myString isEqualtoString:@""])
{
}
else
{
}
``` |
13,947,211 | I do a performance test on WSO2 ESB. And I found the log is too big that can not open. The biggest file is 7.20GB. I think this is a big problem. I want to set every log file less than 20MB, and I want delete old logs automatic. How to set this? Anyone can help me?

{
UIAlertView *missingInfo=[[UIAlertView alloc]initWithTitle:@"Missing Details" message:@"All Fields Are Necessary" delegate:nil... | ```
if(Fname.length==0)
{
NSLog(@"null");
}
``` |
13,947,211 | I do a performance test on WSO2 ESB. And I found the log is too big that can not open. The biggest file is 7.20GB. I think this is a big problem. I want to set every log file less than 20MB, and I want delete old logs automatic. How to set this? Anyone can help me?

{
UIAlertView *missingInfo=[[UIAlertView alloc]initWithTitle:@"Missing Details" message:@"All Fields Are Necessary" delegate:nil... | You can just do this:
```
if ([myString isEqualtoString:@""])
{
}
else
{
}
``` |
13,947,211 | I do a performance test on WSO2 ESB. And I found the log is too big that can not open. The biggest file is 7.20GB. I think this is a big problem. I want to set every log file less than 20MB, and I want delete old logs automatic. How to set this? Anyone can help me?
 {
NSLog(@"Text field empty");
} else {
NSLog(@"Text field has value");
}
``` | ```
if(Fname.length==0)
{
NSLog(@"null");
}
``` |
13,947,211 | I do a performance test on WSO2 ESB. And I found the log is too big that can not open. The biggest file is 7.20GB. I think this is a big problem. I want to set every log file less than 20MB, and I want delete old logs automatic. How to set this? Anyone can help me?

{
}
else
{
}
``` | ```
if(Fname.length==0)
{
NSLog(@"null");
}
``` |
13,947,211 | I do a performance test on WSO2 ESB. And I found the log is too big that can not open. The biggest file is 7.20GB. I think this is a big problem. I want to set every log file less than 20MB, and I want delete old logs automatic. How to set this? Anyone can help me?
 {
NSLog(@"Text field empty");
} else {
NSLog(@"Text field has value");
}
``` | You can just do this:
```
if ([myString isEqualtoString:@""])
{
}
else
{
}
``` |
27,527 | Can someone help me fixing `NoSuchElementException`. Let me explain what I am trying to do.
I am trying to login into an application with multiple sets of data. Lets say,
1) Valid username and password.
2) Valid username and invalid password.
Now what's happening is, I am trying to find element is present or not.
... | 2017/05/31 | [
"https://sqa.stackexchange.com/questions/27527",
"https://sqa.stackexchange.com",
"https://sqa.stackexchange.com/users/1782/"
] | **Solution : Write one method for element present or not and call it.**
1]
--
**Method :**
```
public static boolean checkElementPresent(WebElement webe)
{
try
{
if(webe.isDisplayed())
{
//doing something.
}
return true;
}
catch (Exception e)
{
r... | Try this :
```
if(!driver.findElements(By.id("<id-of-the-element>")).size>0){
//then do your normal operation
}
else{
//do something else
}
``` |
54,399,377 | I have the following scenario:
I have a check-in kinda app, where after 8am (included) the user is able to check-in again if the user has not checked-in in the meantime between D-1 8AM and D 8AM.
For instance:
LastCheckin -> JAN 28th 08:01AM
Today -> JAN 29th 07:50AM
Cannot check-in above
LastCheckin -> JAN 28th 0... | 2019/01/28 | [
"https://Stackoverflow.com/questions/54399377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1232131/"
] | the requirements can be simplified like this: the last check in datetime needs to be 24 hours after yesterday at 8 AM.
so the method can be written like this
```
private Boolean validateLastCheckIn(LocalDateTime lastCheckinDate){
LocalTime checkinTime = LocalTime.MIDNIGHT.plusHours(8);
LocalDate yesterday =... | Ended up solving it that way:
```
private Boolean canCheckin(LocalDateTime nextValidCheckinTime){
return timeFactory.now().isAfter(nextValidCheckinTime);
}
private LocalDateTime nextValidCheckinTime(LocalDateTime lastCheckinDate){
LocalTime checkinTime = LocalTime.of(7, 59, 59);
i... |
2,205,835 | There are many datastores written in Erlang, for example Riak, Dynomite, CouchDb, Scalaris, have I missed any?
I know that Java and C/C++ have also been used to write datastores (Cassandra, Hypertable, etc), but have any Datastores been written in any other functional languages such as F#, Scala, Haskell, Clojure, etc... | 2010/02/05 | [
"https://Stackoverflow.com/questions/2205835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/190822/"
] | 1. [Data.Tcache](http://hackage.haskell.org/package/TCache) is a transactional cache with configurable persistence for Haskell.
2. [Elephant](http://common-lisp.net/project/elephant/) is a persistent object database for Common Lisp with full transaction semantics.
3. [CLSQL](http://clsql.b9.com/) - a SQL database for C... | Your question puzzles me a little. You ask about datastores written **in** a variety of languages. Generally, when I program I look for a library or API to get and put data from and to the datastore in my chosen language. What the underlying datastore is written in (if it's written in anything, some datastores are no m... |
2,205,835 | There are many datastores written in Erlang, for example Riak, Dynomite, CouchDb, Scalaris, have I missed any?
I know that Java and C/C++ have also been used to write datastores (Cassandra, Hypertable, etc), but have any Datastores been written in any other functional languages such as F#, Scala, Haskell, Clojure, etc... | 2010/02/05 | [
"https://Stackoverflow.com/questions/2205835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/190822/"
] | 1. [Data.Tcache](http://hackage.haskell.org/package/TCache) is a transactional cache with configurable persistence for Haskell.
2. [Elephant](http://common-lisp.net/project/elephant/) is a persistent object database for Common Lisp with full transaction semantics.
3. [CLSQL](http://clsql.b9.com/) - a SQL database for C... | In one sense you have already answered your own question. The systems you mention, and others from the comments, **ARE** written in functional langauges and **ARE** definitely real world projects, so the answer is **yes**. |
2,205,835 | There are many datastores written in Erlang, for example Riak, Dynomite, CouchDb, Scalaris, have I missed any?
I know that Java and C/C++ have also been used to write datastores (Cassandra, Hypertable, etc), but have any Datastores been written in any other functional languages such as F#, Scala, Haskell, Clojure, etc... | 2010/02/05 | [
"https://Stackoverflow.com/questions/2205835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/190822/"
] | 1. [Data.Tcache](http://hackage.haskell.org/package/TCache) is a transactional cache with configurable persistence for Haskell.
2. [Elephant](http://common-lisp.net/project/elephant/) is a persistent object database for Common Lisp with full transaction semantics.
3. [CLSQL](http://clsql.b9.com/) - a SQL database for C... | [FleetDB](http://fleetdb.org/) is schema-free database in Clojure. |
3,647,714 | When I am running mysql in the terminal
I can do something like `\! python ~/run.py` to run the the file.
However when I copy this to php and do mysql\_query it doesnt work. | 2010/09/05 | [
"https://Stackoverflow.com/questions/3647714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335016/"
] | You cannot run any of the **\** prefix mysql commands in PHP's `mysql_query`.
Only valid SQL commands can be used. | You can't do that.
The `\!` commands in the MySQL Console are provided by the Console itself, not by the MySQL server proper. In other words, these commands are not sent to the MySQL server, but they are passed to the shell from which the console was launched (e.g. bash). This is a convenience shortcut, but won't work... |
53,823,435 | I am using the below VBA-code to make certain text between "!" characters bold (Example: !**example**!.).
Now I want to remove the "!" from the left and right side of the text. How can I manage to do that?
```
Sub change()
Dim r As Range, st As String, boo As Boolean
Dim L As Long, i As Long
Dim rng As Range: Set rn... | 2018/12/17 | [
"https://Stackoverflow.com/questions/53823435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10803271/"
] | If you Split on the exclamation marks, you're automatically removing them. The text can be resurrected with Join and the array from the split allows multiple elements to be bolded.
By tackling each bold section as a whole and skipping over non-bold sections altogether, this should be substantially more efficient than ... | innerString = replace(fullString,"!","") |
53,823,435 | I am using the below VBA-code to make certain text between "!" characters bold (Example: !**example**!.).
Now I want to remove the "!" from the left and right side of the text. How can I manage to do that?
```
Sub change()
Dim r As Range, st As String, boo As Boolean
Dim L As Long, i As Long
Dim rng As Range: Set rn... | 2018/12/17 | [
"https://Stackoverflow.com/questions/53823435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10803271/"
] | If you Split on the exclamation marks, you're automatically removing them. The text can be resurrected with Join and the array from the split allows multiple elements to be bolded.
By tackling each bold section as a whole and skipping over non-bold sections altogether, this should be substantially more efficient than ... | You can also use Regular expressions -- in my opinion a very underused capability of VBA.
```
Dim r1 As New RegExp
Dim r2 As New RegExp
r1.Pattern = "^!"
r2.Pattern = "!$"
st = r1.Replace(st, "")
st = r2.Replace(st, "")
```
The `^` atom means "begins with" and the `$` atom means "ends with."
Alternatively you coul... |
120,022 | I'm facing the following problem:
I started software development internship year and a half ago, I've passed the internship and now I'm full time software developer.
The thing is my company has zero development over the past year and a half, my company lost a lot of projects and employees. My career got stuck, I'm not... | 2018/09/30 | [
"https://workplace.stackexchange.com/questions/120022",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/92766/"
] | >
> I want to change my job...
>
>
> I'm feeling guilty to quit my job...
>
>
> I've been to few interviews and got very good offers...
>
>
> Kind of afraid to tell my boss that I want to quit.
>
>
>
Don't feel guilty. Don't be afraid.
Your first resignation will be difficult. But we all go through it and i... | >
> I'm feeling guilty to quit my job, because my boss gave me a chance with the internship when I really needed it.
>
>
>
Your boss didn't do it for the sake of helping you. They needed workforce, you gave them workforce in exchange of salary. Neither of the two sides was receiving without giving.
>
> My career... |
20,595,540 | I simply want to have a SQL statement to `GROUP BY`, however I would want it to try and choose one row if that row is available.
For example, I have this statement:
```
SELECT *
FROM `translations`
WHERE `lang` = "pl" OR `lang` = "en"
GROUP BY `key`
```
In this statement, I am trying to select all where the `lang`... | 2013/12/15 | [
"https://Stackoverflow.com/questions/20595540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/811814/"
] | You can phrase this as a `union all` statement. My assumption is that the `key`,`lang` pair uniquely identifies one row (otherwise you can still do the `group by` to get one row per key).
The idea is to select all rows with `lang = 'pl'`. Then select the rows where `lang = 'en'` that have no corresponding row with `'p... | Not an optimal, but it should give the desired result :
```
SELECT a.*
FROM
(
SELECT * FROM `translations` where `lang` = "pl"
UNION ALL
SELECT * FROM `translations` a where `lang` = "en"
WHERE NOT EXISTS (SELECT NULL FROM `translations` b WHERE b.lang="pl")
)a GROUP BY `key`
``` |
20,595,540 | I simply want to have a SQL statement to `GROUP BY`, however I would want it to try and choose one row if that row is available.
For example, I have this statement:
```
SELECT *
FROM `translations`
WHERE `lang` = "pl" OR `lang` = "en"
GROUP BY `key`
```
In this statement, I am trying to select all where the `lang`... | 2013/12/15 | [
"https://Stackoverflow.com/questions/20595540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/811814/"
] | You can phrase this as a `union all` statement. My assumption is that the `key`,`lang` pair uniquely identifies one row (otherwise you can still do the `group by` to get one row per key).
The idea is to select all rows with `lang = 'pl'`. Then select the rows where `lang = 'en'` that have no corresponding row with `'p... | I would do it like this:
```
SELECT COALESCE(`translation_foreign`.`value`, `translations`.`value`) AS `value`
FROM `translations`
LEFT JOIN `translation` as `translations_foreign` ON
translations_foreign.key = translations.key AND
translations_foreign.lang = "pl"
WHERE lang = "en"
GROUP BY... |
68,622,542 | On the 13th of May 2021 GCP added composer-1.17.0-preview.0-airflow-2.0.1 to their composer version list.
It has already been upgraded a few times since then with "Full support end date" for each version, however it is still flagged as a Preview version.
I have already created a composer instance of composer-1.17.0-pr... | 2021/08/02 | [
"https://Stackoverflow.com/questions/68622542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2326286/"
] | I think it should run smoothly and is ready to run production traffic, the main thing you don't get with preview, I believe, the main difference is that this version has no full guarantees that "official" release has.
I think this is mainly about <https://cloud.google.com/composer/docs/concepts/versioning/composer-ver... | Composer's support for Airflow 2 is now on the GA level. Please, take a look at the release notes: <https://cloud.google.com/composer/docs/release-notes#September_15_2021> |
8,935,575 | I want to align the `DIV c` in the bottom of the `DIV b` not `DIV a`
```
<div id="a">
<div id="b">
<div id="c">
Div c
</div>
</div>
</div>
``` | 2012/01/20 | [
"https://Stackoverflow.com/questions/8935575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508377/"
] | This should work:
```
#b {
position: relative;
}
#c {
position: absolute;
bottom: 0px;
}
```
The trick is `position: relative;` on the parent element. Without that, `#c` will float away to the bottom of the page. | It will take `div#c` out of the flow of the document. It may not be perfect, but you can do something like the following:
```
#b {
position: relative;
}
#c {
position: absolute;
bottom: 0;
}
``` |
8,935,575 | I want to align the `DIV c` in the bottom of the `DIV b` not `DIV a`
```
<div id="a">
<div id="b">
<div id="c">
Div c
</div>
</div>
</div>
``` | 2012/01/20 | [
"https://Stackoverflow.com/questions/8935575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508377/"
] | This should work:
```
#b {
position: relative;
}
#c {
position: absolute;
bottom: 0px;
}
```
The trick is `position: relative;` on the parent element. Without that, `#c` will float away to the bottom of the page. | Click in this link, maybe it can help you
```
#b {
display: -webkit-inline-flex;
display: -moz-inline-flex;
display: inline-flex;
-webkit-flex-flow: row nowrap;
-moz-flex-flow: row nowrap;
flex-flow: row nowrap;
-webkit-align-items: flex-end;
-moz-align-items: flex-end;
align-items: flex-end;}
```
<http://jsfiddl... |
8,935,575 | I want to align the `DIV c` in the bottom of the `DIV b` not `DIV a`
```
<div id="a">
<div id="b">
<div id="c">
Div c
</div>
</div>
</div>
``` | 2012/01/20 | [
"https://Stackoverflow.com/questions/8935575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508377/"
] | It will take `div#c` out of the flow of the document. It may not be perfect, but you can do something like the following:
```
#b {
position: relative;
}
#c {
position: absolute;
bottom: 0;
}
``` | Click in this link, maybe it can help you
```
#b {
display: -webkit-inline-flex;
display: -moz-inline-flex;
display: inline-flex;
-webkit-flex-flow: row nowrap;
-moz-flex-flow: row nowrap;
flex-flow: row nowrap;
-webkit-align-items: flex-end;
-moz-align-items: flex-end;
align-items: flex-end;}
```
<http://jsfiddl... |
17,491,324 | I am getting this error in my winform when trying to connect to sql server and dont understand why. Here is the error: Configuration system failed to initialize.
Here is my code:
```
connectionString = ConfigurationManager.ConnectionStrings("Connect5").ConnectionString
Dim myConnection As New SqlCo... | 2013/07/05 | [
"https://Stackoverflow.com/questions/17491324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/841297/"
] | WriteProcessMemory() is a function often used to inject code into another process - and it also requires enough privileges to work - if you call CreateProcess() you have PROCESS\_ALL\_PRIVILEGES rights, but if you call OpenProcess() the privileges assigned depends on the process security token, and WriteProcessMemory()... | You ~~may~~ actually have a virus, have you checked for: <http://nakedsecurity.sophos.com/2009/08/19/w32induca-spread-delphi-software-houses/>
`Win32/Injector.CKX trojan`, Yep it is the famous Delphi virus.
You need to get a virus cleaner for that one: <http://www.sophos.com/en-us/threat-center/threat-analyses/viru... |
135,526 | When users registers on my site, they choose their *State of Origin*.
Using [Rules](http://drupal.org/project/rules) I would like to configure a rule which sends an email to all users from the same state when a user from that state edits his/her profile.
Is this possible using [Rules](http://drupal.org/project/rules)... | 2014/10/31 | [
"https://drupal.stackexchange.com/questions/135526",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/16615/"
] | Without knowing anything about your entity & field setup I can't give you an exact rules that will work however it is possible and I can give you a pseudo rule:
* Install the [rules bonus pack](https://www.drupal.org/project/rb) module.
* Install the [rules conditional](https://www.drupal.org/project/rules_conditional... | Yes this is possible with [Rules](https://www.drupal.org/project/rules), if combined with [Views Bulk Operations](https://www.drupal.org/project/views_bulk_operations), as further detailed below ...
What you actually need to do is similar to what is shown in the video about [Using VBO to load list of objects into Rule... |
53,111,071 | I am trying to scale up my ECS cluster programmatically with the `aws-sdk` package using node.js
I've read through the ECS portion of the API documentation (<https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/ECS.html>) a few times but cannot find an API method to update the configuration of an ECS cluster.
You ... | 2018/11/02 | [
"https://Stackoverflow.com/questions/53111071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2939594/"
] | It appears, your cluster was created with the console first-run experience and that's why you were able to see Scale ECS Instances Option.
<https://docs.aws.amazon.com/AmazonECS/latest/developerguide/scale_cluster.html>
*If your cluster was created with the console first-run experience after November 24, 2015, then t... | There is no way to do it via SDK directly. You have to use underlying ASG to set the desired count. As in the backend, ECS Cluster setup is done by the cloudformation template which creates an Auto-Scaling group for that EC2 pool.
You will be able to find the associated autoscaling group with the cluster in the ASG se... |
71,683,993 | Here is a small sample of my data:
```
dat<-read.table (text=" ID A S T R1 R2 R3
1 10 21 80 60 80 44
2 15 14 90 70 76 40
3 22 10 20 90 55 33
", header=TRUE)
```
Column A searches in column S to find the nearest number. ID1 Corespondes to R1, ID2 coresponds to R2 and ID3 corespondes to R... | 2022/03/30 | [
"https://Stackoverflow.com/questions/71683993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13095591/"
] | In base R you could do:
```r
rows <- apply(outer(dat$A, dat$S, function(a, b) abs(a - b)), 1, which.min)
cols <- grep("R\\d+", names(dat))
indices <- cbind(rows, cols)
cbind(dat[1:4], out = dat[indices])
``` | Very similar to a solution already presented but without `rowwise`
```r
dat %>%
mutate(idx = map_int(A, ~ which.min(abs(.x - S)))) %>%
mutate(., out = select(., R1:R3)[cbind(row_number(), idx)]) |>
select(-idx, -c(R1:R3))
##> ID A S T out
##> 1 1 10 21 80 44
##> 2 2 15 14 90 76
##> 3 3 22 10 20 90
`... |
36,152,822 | I am building a self-contained Chocolatey package. The package folder contains: `app.nuspec`, `app.exe`, `app.nupkg`, and the `tools` subfolder. The `chocolateyInstall.ps1` is like this:
```
$packageName = 'app'
$fileType = 'exe'
$silentArgs = '/VERYSILENT'
$url = '../app.exe' # the location of the file relative to th... | 2016/03/22 | [
"https://Stackoverflow.com/questions/36152822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3719713/"
] | For doing a Chocolatey Package that contains the exe/msi, you can use the `Install-ChocolateyInstallPackage` helper method, rather than the `Install-ChocolateyPackage` helper method. This is documented on the Chocolatey Wiki [here](https://github.com/chocolatey/choco/wiki/HelpersInstallChocolateyInstallPackage)
This w... | Somehow we're still missing the explanation of script- and caller-relative paths. In this case, Chocolatey is executing from
```
%PROGRAMDATA%\Chocolatey\choco.exe
```
Your script is telling it to go up one level and look for `app.exe`, that's
```
%PROGRAMDATA%\app.exe
```
What Gary's answer implies, by using `$... |
31,406,868 | My program goes through all files in a folder, reads them, and without altering their information moves them to another location under a different name. However I cannot use the `File.Move` method because I get the following `IOException`:
>
> The process cannot access the file because it is being used by another
> ... | 2015/07/14 | [
"https://Stackoverflow.com/questions/31406868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1612814/"
] | >
> I thought using the using statement is supposed to garbage-collect and
> release the file after being used. How can I release the file so I can
> move it and why my file stays locked?
>
>
>
Not really. Using statement is nothing but :
```
try { var resource = new SomeResource(); }
finally { resource.Dispo... | **You could use:**
```
string dpath = "D:\\Destination\\";
string spath = "D:\\Source";
string[] flist = Directory.GetFiles(spath);
foreach (string item in flist)
{
File.Move(item, dpath + new FileInfo(item).Name);
}
```
**Replace D:\\Source... |
67,420,585 | Together with <https://www.codementor.io/@robertverdes>
we fixed the activity stream compatibility issue between DIVI and BuddyBoss -- it was showing shortcodes. The change is to be made in the buddyboss-theme/buddypress/activity/entry.php file.
```
'''
<div class="activity-inner"><?php
$res=preg_replace... | 2021/05/06 | [
"https://Stackoverflow.com/questions/67420585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15854307/"
] | How about
`days.filter(day =>!found.some(f => day.contains(f))`
The some function returns true when the predicate matches for any element | ```js
const days = ['monday, april 26, 2021 11:00 pm','tuesday, april 27, 2021 13:00 am','tuesday, april 27, 2021 12:00 am', 'friday, april 27, 2021 12:00 am', 'saturday, april 27, 2021 12:00 am']
const found = /monday|tuesday/
const removeFalseDay = days.filter(day => !found.test(day));
console.log(removeFalseDay);
c... |
67,420,585 | Together with <https://www.codementor.io/@robertverdes>
we fixed the activity stream compatibility issue between DIVI and BuddyBoss -- it was showing shortcodes. The change is to be made in the buddyboss-theme/buddypress/activity/entry.php file.
```
'''
<div class="activity-inner"><?php
$res=preg_replace... | 2021/05/06 | [
"https://Stackoverflow.com/questions/67420585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15854307/"
] | How about
`days.filter(day =>!found.some(f => day.contains(f))`
The some function returns true when the predicate matches for any element | so I got it to work like this
```
const days = ['monday, april 26, 2021 11:00 pm','tuesday, april 27, 2021 13:00 am','tuesday, april 27, 2021 12:00 am', 'friday, april 27, 2021 12:00 am', 'saturday, april 27, 2021 12:00 am']
const found = ['monday', 'tuesday', 'friday']
const removeFalseDay = days.filter(days =>!foun... |
67,242,177 | I'm using the following snippet to limit the number of products in search results on my website from 10 to only 8.
However, I noticed that it's also limiting the number of products shown via WP Admin Dashboard > Products > All Products to 8 if you use the filter. When you use the filter, it also only shows 8 products ... | 2021/04/24 | [
"https://Stackoverflow.com/questions/67242177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13607873/"
] | Your function is correct. You will just need to add the `is_admin()` control to make sure the query is executed only in the frontend.
Also you should add the `is_main_query()` control to make sure it is the main query.
Finally, the `posts_per_page` parameter is an integer and not a string.
```
// change the number o... | You can use `woocommerce_product_query` to change `posts_per_page`. check the below code.
```
add_action( 'woocommerce_product_query', 'myprefix_search_posts_per_page', 999 );
function myprefix_search_posts_per_page( $query ) {
if( is_admin() )
return;
if ( $query->is_search() ) {
$query->set... |
24,829,905 | Please review my [**Fiddle**](http://jsfiddle.net/webfrogs/RE6Fu/)...
I have a file upload button, which works fine. You'll see it when you barely scroll down in the fiddle. The image uploads, but it uploads down at the bottom of the page, and I'm trying to get it to display within a div, immediately below the upload... | 2014/07/18 | [
"https://Stackoverflow.com/questions/24829905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2464865/"
] | Just figured it out myself. The datepicker object takes it's z-index from the item it is being attached to. It turns out that `.input-group .from-control` sets the z-index in a way that, in this case, was causing it to appear underneath that item's container instead of on top. I just increased the z-index of that item ... | I had this problem too. I ended up using the [TopZIndex](https://code.google.com/archive/p/topzindex/) jQuery plugin.
Just download the plugin and load it into your page:
```
<script src='/path/to/jquery.topzindex.js'></script>
```
And include this simple script (written by yours truly) in your page:
```
$('.hasDa... |
48,659,778 | Here is my procedure and I am newbie at VBA, I always find the struggle to work with such type of misstake.
Please help me.
```
Sub findsub()
Dim t As Range
Dim j As Range
Set j = Range("j1")
If j Is Nothing Then
Debug.Print "please enter the number"
Else
Set t = Range("G2:G19").Find("j1", LookIn:=xlValues)
Range("J... | 2018/02/07 | [
"https://Stackoverflow.com/questions/48659778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9326481/"
] | so I managed to resolve my issue by combining different answers from the website: [How to use google test for C++ to run through combinations of data](https://stackoverflow.com/questions/13213022/how-to-use-google-test-for-c-to-run-through-combinations-of-data) & [Can gmock be used for stubbing C functions?](https://st... | One option is to build your application for your host machine and then, when your HW arrives, you can just recompile it for that HW.
It is possible to run FreeRTOS on a host PC as the OS on the CPU, however this is not the intention of FreeRTOS so it may be tricky and or lead to some unrealistic hacks when it comes to... |
150,487 | I just restored my Raspberry Pi server from an `rsync` image. During the backup, I had excluded `/var/cache/*`, thinking that this would restore an empty directory. This worked, but when I rebooted, a process complained that it couldn't write to it in the following mail.
```
Subject: status report from ddclient@raspbe... | 2014/08/16 | [
"https://unix.stackexchange.com/questions/150487",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/18887/"
] | `/var/cache` is not a free-for-all like `/var/tmp`. Each service that requires it has a subdirectory in `/var/cache` with appropriate permissions for it to store files.
On Debian and derived distributions, you can run `dpkg -S /var/cache` to find what packages have set up directories under `/var/cache`, and `apt-get -... | Fortunately I still had a copy of the corrupted filesystem, so I had some idea of what should go in `/var/cache` for my system.
```
cd /var/cache
sudo mkdir apache2 apt ddclient debconf dictionaries-common fontconfig ldconfig man modsecurity
sudo chmod a=,u=rwx ldconfig
sudo chmod g=rsx man
sudo chown man man
sudo cho... |
21,047,249 | Current directory is `C:/Sites/todo` and I want to change it to `C:/Sites/todo/app/assets`. The problem is I need specify directory like `Dir.pwd("/app/assets")` but there is an error because I should write the whole path `C:/Sites/todo/app/assets`. How can I change directory with `/app/assets` path?
Thanks! | 2014/01/10 | [
"https://Stackoverflow.com/questions/21047249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2394732/"
] | Write as below :
```
Dir.chdir(Dir.pwd+"/app/assets")
```
[`Dir::pwd`](http://www.ruby-doc.org/core-2.1.0/Dir.html#method-c-pwd) *Returns the path to the current working directory of this process as a string.* Then [`Dir::chdir`](http://www.ruby-doc.org/core-2.1.0/Dir.html#method-c-chdir) *Changes the current workin... | ```
require 'fileutils'
FileUtils.cd('app/assets')
``` |
21,047,249 | Current directory is `C:/Sites/todo` and I want to change it to `C:/Sites/todo/app/assets`. The problem is I need specify directory like `Dir.pwd("/app/assets")` but there is an error because I should write the whole path `C:/Sites/todo/app/assets`. How can I change directory with `/app/assets` path?
Thanks! | 2014/01/10 | [
"https://Stackoverflow.com/questions/21047249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2394732/"
] | Write as below :
```
Dir.chdir(Dir.pwd+"/app/assets")
```
[`Dir::pwd`](http://www.ruby-doc.org/core-2.1.0/Dir.html#method-c-pwd) *Returns the path to the current working directory of this process as a string.* Then [`Dir::chdir`](http://www.ruby-doc.org/core-2.1.0/Dir.html#method-c-chdir) *Changes the current workin... | To change to app/assets from your application root:
```
Dir.chdir("app/assets")
``` |
21,047,249 | Current directory is `C:/Sites/todo` and I want to change it to `C:/Sites/todo/app/assets`. The problem is I need specify directory like `Dir.pwd("/app/assets")` but there is an error because I should write the whole path `C:/Sites/todo/app/assets`. How can I change directory with `/app/assets` path?
Thanks! | 2014/01/10 | [
"https://Stackoverflow.com/questions/21047249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2394732/"
] | ```
require 'fileutils'
FileUtils.cd('app/assets')
``` | To change to app/assets from your application root:
```
Dir.chdir("app/assets")
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.