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 |
|---|---|---|---|---|---|
43,565,912 | I need to call a method in my ViewController class in AppDelegate. This is what the method looks like this:
```
class ViewController: UIViewController {
func myFunction() {
...
}
}
```
I've tried using window.rootViewController, but it's telling me the method myFunction does not exist, since rootVie... | 2017/04/22 | [
"https://Stackoverflow.com/questions/43565912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7806880/"
] | if its the root its easy:
```
(window.rootViewController as? ViewController)?.myFunction()
```
if its on top of a navigationController
```
((window.rootViewController as? UINavigationController)?.topViewController as? ViewController)?.myFunction()
```
But in either case its weird and probably not the right thing ... | You shouldn't call view controllers methods from the appdelegate. Is a bad practice and generally is not required.
If you want to react to methods such as:
`willResignActive
willTerminate`
you should listen to notifications for those events using the NotificationCenter. |
43,565,912 | I need to call a method in my ViewController class in AppDelegate. This is what the method looks like this:
```
class ViewController: UIViewController {
func myFunction() {
...
}
}
```
I've tried using window.rootViewController, but it's telling me the method myFunction does not exist, since rootVie... | 2017/04/22 | [
"https://Stackoverflow.com/questions/43565912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7806880/"
] | if its the root its easy:
```
(window.rootViewController as? ViewController)?.myFunction()
```
if its on top of a navigationController
```
((window.rootViewController as? UINavigationController)?.topViewController as? ViewController)?.myFunction()
```
But in either case its weird and probably not the right thing ... | Sending a Notification sounds like a cleaner way. But to do what the OP is trying although not clean I used to do it on the early Xcode days and I had no issues when done.
Let's say you want to call myMethod in myViewCtlr from AppDelegate.m
in App Delegate do this
```
//In AppDelegate.h define
...
UIViewController *... |
43,565,912 | I need to call a method in my ViewController class in AppDelegate. This is what the method looks like this:
```
class ViewController: UIViewController {
func myFunction() {
...
}
}
```
I've tried using window.rootViewController, but it's telling me the method myFunction does not exist, since rootVie... | 2017/04/22 | [
"https://Stackoverflow.com/questions/43565912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7806880/"
] | You shouldn't call view controllers methods from the appdelegate. Is a bad practice and generally is not required.
If you want to react to methods such as:
`willResignActive
willTerminate`
you should listen to notifications for those events using the NotificationCenter. | Sending a Notification sounds like a cleaner way. But to do what the OP is trying although not clean I used to do it on the early Xcode days and I had no issues when done.
Let's say you want to call myMethod in myViewCtlr from AppDelegate.m
in App Delegate do this
```
//In AppDelegate.h define
...
UIViewController *... |
71,156,710 | why it doesn't work, it worked fine in without null safety something might be missed.
but I don't understand what's wrong
It would be great help if you give some time to this
```
builder: (context, snapshot) {
if (snapshot.hasData) {
List<Homes> homelist = snapshot.data;
... | 2022/02/17 | [
"https://Stackoverflow.com/questions/71156710",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12777374/"
] | It's not working anymore because now you have **null safety** on.
With it, variables cannot be null if they haven't got a `?` at the end. For example:
```
String myString = "Hello World"; //This CANNOT be null
String? myString = null; //This CAN be null
```
In your code, you will need to check if your `List<Homes>?... | The reason for the error you're getting is that you're trying to assign a nullable value to a non-nullable. What you can do here is add null check or utilize the bang (!) operator when assigning the value to determine that the object is indeed non-null. |
42,250,996 | I'd like to check whether a NSDate is in the same week as today. Therefore I'm consider the `weekOfYear`s from a `NSDateComponents` like mentioned in this [post](https://stackoverflow.com/questions/10143811/check-if-nsdate-is-in-this-week-or-next-week).
```
- (BOOL)dateIsThisWeek:(NSDate *)date
{
NSCalendar *cal =... | 2017/02/15 | [
"https://Stackoverflow.com/questions/42250996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3191334/"
] | Try this maybe? (Copied from my own project code)
```
NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
[gregorianCalendar setLocale:[NSLocale localeWithLocaleIdentifier:@"be_NL"]];
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setDay:19... | This is a *very slight* modification to Sneak's code... Call it with:
```
//
// startDayOfWeek: Sunday == 1, Monday == 2, Tues == 3, etc
Bool b = [self dateIsThisWeek:date startDayOfWeek:2];
- (BOOL)dateIsThisWeek:(NSDate *)dateToTest startDayOfWeek:(NSInteger)iStart {
NSCalendar *gregorianCalendar = [[NSCalend... |
1,638,847 | I'm trying to replace a div with created elements, going from:
```
<div id='links'></div>
```
to
```
<div id='links'>
<ul>
<li><a href='#'>No</a></li>
</li>
</div>
```
I want to attach a function to the link in the `<a>` element that I create. Creating the desired link is working, but wrapping the link in an `<li... | 2009/10/28 | [
"https://Stackoverflow.com/questions/1638847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/189513/"
] | `no.wrap('<li></li>')` will still return the `<a>` element, but it adds a `<li>` element around it. So you can do `no.wrap('<li></li>').parent()` to wrap it and return the `<li>` element. | ```
<script type="text/javascript">
$(function(){
var list = $("<ul />");
var no = $('<a />')
.attr({ href: '#' })
.click(function () {
alert('clicked no');
return false;
})
.text('no')
.wrap("<li />")
.parent()
.appendTo(... |
1,638,847 | I'm trying to replace a div with created elements, going from:
```
<div id='links'></div>
```
to
```
<div id='links'>
<ul>
<li><a href='#'>No</a></li>
</li>
</div>
```
I want to attach a function to the link in the `<a>` element that I create. Creating the desired link is working, but wrapping the link in an `<li... | 2009/10/28 | [
"https://Stackoverflow.com/questions/1638847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/189513/"
] | `no.wrap('<li></li>')` will still return the `<a>` element, but it adds a `<li>` element around it. So you can do `no.wrap('<li></li>').parent()` to wrap it and return the `<li>` element. | With jQuery can actually just nest everything into a wrapper, especially if you don't need to address the individual items themselves.
You can also create new elements to be nested on the fly. No need to create a bunch of temporary variables to hold them all.
Multiple items can be appended at the same time by simply... |
1,638,847 | I'm trying to replace a div with created elements, going from:
```
<div id='links'></div>
```
to
```
<div id='links'>
<ul>
<li><a href='#'>No</a></li>
</li>
</div>
```
I want to attach a function to the link in the `<a>` element that I create. Creating the desired link is working, but wrapping the link in an `<li... | 2009/10/28 | [
"https://Stackoverflow.com/questions/1638847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/189513/"
] | ```
<script type="text/javascript">
$(function(){
var list = $("<ul />");
var no = $('<a />')
.attr({ href: '#' })
.click(function () {
alert('clicked no');
return false;
})
.text('no')
.wrap("<li />")
.parent()
.appendTo(... | With jQuery can actually just nest everything into a wrapper, especially if you don't need to address the individual items themselves.
You can also create new elements to be nested on the fly. No need to create a bunch of temporary variables to hold them all.
Multiple items can be appended at the same time by simply... |
49,199,750 | I'm trying to slowly introduce Styled-Components into my existing codebase which relies heavily on global SASS variables (partials imported into a `main.scss`).
How do I reference the SCSS variables? The following doesn't work:
```
import React from 'react';
import styled from 'styled-components';
const Button = sty... | 2018/03/09 | [
"https://Stackoverflow.com/questions/49199750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572747/"
] | Variables play a very important role in `.scss` or `.sass`, but the functionality cannot be extended outside the file.
Instead, you have to create a separate `.js` file *(**For example:** variable.js)* and define all your variables as an object. | I recommend using the ThemeProvider component. I'm also moving away from sass and towards styled components. The Theming with styled-components uses React's context api and is quite nice. Check out the this documentation [Styled Components Theming](https://www.styled-components.com/docs/advanced#theming). |
49,199,750 | I'm trying to slowly introduce Styled-Components into my existing codebase which relies heavily on global SASS variables (partials imported into a `main.scss`).
How do I reference the SCSS variables? The following doesn't work:
```
import React from 'react';
import styled from 'styled-components';
const Button = sty... | 2018/03/09 | [
"https://Stackoverflow.com/questions/49199750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572747/"
] | I wrote up an article about solving this very issue. <https://medium.com/styled-components/getting-sassy-with-sass-styled-theme-9a375cfb78e8>
Essentially, you can use the excellent [sass-extract](https://github.com/jgranstrom/sass-extract) library along with [sass-extract-loader](https://github.com/jgranstrom/sass-ext... | I recommend using the ThemeProvider component. I'm also moving away from sass and towards styled components. The Theming with styled-components uses React's context api and is quite nice. Check out the this documentation [Styled Components Theming](https://www.styled-components.com/docs/advanced#theming). |
49,199,750 | I'm trying to slowly introduce Styled-Components into my existing codebase which relies heavily on global SASS variables (partials imported into a `main.scss`).
How do I reference the SCSS variables? The following doesn't work:
```
import React from 'react';
import styled from 'styled-components';
const Button = sty... | 2018/03/09 | [
"https://Stackoverflow.com/questions/49199750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572747/"
] | Pardon me if this is an old question but I thought I chip in on how I use CSS variables for both my `.scss` and `styled-components` when the need arises.
**Basic Usage:**
Declaring a global variable (preferably at `_variables.scss`)
```
:root {
--primary-color: #fec85b;
}
```
Using the global property:
```
.... | I recommend using the ThemeProvider component. I'm also moving away from sass and towards styled components. The Theming with styled-components uses React's context api and is quite nice. Check out the this documentation [Styled Components Theming](https://www.styled-components.com/docs/advanced#theming). |
50,510,052 | I have two computers with seemingly equal code and configurations, one compiles a solution, the other does not.
The problem is related to the `R Type Provider`.
This is the code:
```
/// Path to project data folder.
[<Literal>]
let projDataPath = __SOURCE_DIRECTORY__ + @"\data\"
[<Literal>]
let jsonPath = projData... | 2018/05/24 | [
"https://Stackoverflow.com/questions/50510052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1675230/"
] | I had the same issue. Resolved it by downgrading from R v3.5.0 to 3.4.4. | I had the same issue. Resolved it by downgrading from R 4.0.3 to 3.4.4
* R v3.4.4
* RProvider v1.1.22
* VS Community 2019 v16.7.4
* Windows 10 Home |
53,646,482 | [](https://i.stack.imgur.com/hKaxJ.png)
How to make jersey and @webservlet working together ?
jersey ResourceConfig:
```
@ApplicationPath("/*")
public class ApplicationConfig extends ResourceConfig {
public ApplicationConfig() {
register(Greeti... | 2018/12/06 | [
"https://Stackoverflow.com/questions/53646482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6745483/"
] | Try this
```js
$(".tank_id").on('change', function() {
var current = $(this);
var inputs = $('.tank_id').not(this);
var result = inputs.filter(function(i, el) {
return $(current).prop("selectedIndex") === $(el).prop("selectedIndex");
});
if (result.length > 0) {
alert('Error: Selected Alread... | This will only check if the value you're currently selecting is already selected in another list. So if you have selected `2` in the first two dropdowns, and then selects `1` in the last, the last won't give an error message.
```js
$(".tank_id").on('change', function() {
var currentValue = $(this).val();
var inp... |
42,402,923 | I receive an array like this:
```
[
[{"name":"one","team":"------","checked":false,"position":"-"},
{"name":"two","team":"------","checked":false,"position":"1"}],
[{"name":"three","team":"------","checked":false,"position":"3"},
{"name":"four","team":"------","checked":false,"position":"7"}]
]
```
... | 2017/02/22 | [
"https://Stackoverflow.com/questions/42402923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1664599/"
] | There's no built-in method to do it in Java, but it's simple math.
The equation of a line is:
```
a * x + b * y = c1 (1)
```
The equation of a line parallel to this is:
```
a * x + b * y = c2 (2)
```
The equation of two lines perpendicular to these are:
```
-b * x + a * y = c3 (3)
-b * x + a * y = c4 ... | In this case i think you could try to program the manhattan distance from the point to the center of the square and compare it with the manhattan distance from the center of the square to one of the corners , if distance(point,center)< distance (center,limit) |
33,473,713 | How can i drop tables with constraints,
```
use my_db0
if exists(select* from sys.tables where name='Tbl1')
drop table Tbl1 --cascade constraints;
Create table Tbl1(
nameID int primary key
)
if exists (select* from sys.tables where name='Tbl2')
drop table Tbl2
Create table Tbl2(
lastNameID int primary key,
nameID ... | 2015/11/02 | [
"https://Stackoverflow.com/questions/33473713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5294428/"
] | The table **Tbl2** contains **nameID** as a foreign key , so you have to first wipe the the data in **Tbl2** and then drop the **Tbl1**
```
if exists (select* from sys.tables where name='Tbl2')
drop table Tbl2
if exists(select* from sys.tables where name='Tbl1')
drop table Tbl1
``` | You can use this query:
```
Select Query =
'If EXISTS (Select * FROM sys.foreign_keys Where '
+ ' object_id = OBJECT_ID(N''' + QUOTENAME(OBJECT_SCHEMA_NAME(fk.parent_object_id)) + '.' + QUOTENAME(fk.name) + ''')'
+ ' And parent_object_id = OBJECT_ID(N''' + QUOTENAME(OBJECT_SCHEMA_NAME(fk.parent_... |
33,473,713 | How can i drop tables with constraints,
```
use my_db0
if exists(select* from sys.tables where name='Tbl1')
drop table Tbl1 --cascade constraints;
Create table Tbl1(
nameID int primary key
)
if exists (select* from sys.tables where name='Tbl2')
drop table Tbl2
Create table Tbl2(
lastNameID int primary key,
nameID ... | 2015/11/02 | [
"https://Stackoverflow.com/questions/33473713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5294428/"
] | In SQL Server 2016 you can use DROP IF EXISTS:
```
ALTER TABLE my_table
DROP CONSTRAINT IF EXISTS <name>
DROP TABLE IF EXISTS my_table
```
See <http://blogs.msdn.com/b/sqlserverstorageengine/archive/2015/11/03/drop-if-exists-new-thing-in-sql-server-2016.aspx>
Jovan | You can use this query:
```
Select Query =
'If EXISTS (Select * FROM sys.foreign_keys Where '
+ ' object_id = OBJECT_ID(N''' + QUOTENAME(OBJECT_SCHEMA_NAME(fk.parent_object_id)) + '.' + QUOTENAME(fk.name) + ''')'
+ ' And parent_object_id = OBJECT_ID(N''' + QUOTENAME(OBJECT_SCHEMA_NAME(fk.parent_... |
55,727 | Any natural gas experts out there?
Any time I am away from home for two days or longer, my stove takes 30 seconds to light. After that it works fine day after day after day!
Another similar problem is with my high eff modulating / condensing boiler every year at first fire-up. The boiler fails with error for no ignit... | 2014/12/25 | [
"https://diy.stackexchange.com/questions/55727",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/30014/"
] | The short answer is no, natural gas does not go bad in any reasonable amount of time.
I wonder if you have a slow leak somewhere that is letting gas out, or air/moisture in. | You haven't mentioned it, but are you closing the shut-off valve for the stove and/or the shut-off valve for your furnace while it's not being used for these few days or longer time periods?
If that's the case, then that could explain what you're experiencing. When you close one of the shut-off valves, the natural gas... |
55,727 | Any natural gas experts out there?
Any time I am away from home for two days or longer, my stove takes 30 seconds to light. After that it works fine day after day after day!
Another similar problem is with my high eff modulating / condensing boiler every year at first fire-up. The boiler fails with error for no ignit... | 2014/12/25 | [
"https://diy.stackexchange.com/questions/55727",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/30014/"
] | The short answer is no, natural gas does not go bad in any reasonable amount of time.
I wonder if you have a slow leak somewhere that is letting gas out, or air/moisture in. | I have also experienced this occurrence, otherwise-quick-to-respond gas appliances (stoves, but especially water heaters) becoming slow to ignite after not being used for several days. It happens whether or not the gas shutoff valve is closed, though the effect is stronger/quicker when it is. Hank's suggestion above is... |
55,727 | Any natural gas experts out there?
Any time I am away from home for two days or longer, my stove takes 30 seconds to light. After that it works fine day after day after day!
Another similar problem is with my high eff modulating / condensing boiler every year at first fire-up. The boiler fails with error for no ignit... | 2014/12/25 | [
"https://diy.stackexchange.com/questions/55727",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/30014/"
] | The short answer is no, natural gas does not go bad in any reasonable amount of time.
I wonder if you have a slow leak somewhere that is letting gas out, or air/moisture in. | The only valve closed is the burner control; the burner tube itself sits directly over the orifice at the valve output. |
156,783 | I have an ipad 2 and its just 2nd hand. My ipad 2 had been reset and then when I open it up it says that I need to connect/sign in to an Icloud account while I dont have one. What should I do? | 2014/11/17 | [
"https://apple.stackexchange.com/questions/156783",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/101056/"
] | It sounds like the previous owner left the Activation Lock turned on. You will need to turn the device off and then the pre-owner can turn it off via iCloud.com
<https://support.apple.com/en-us/HT201365> | First of all (just in case you have one and didn't know), if you have an iTunes account, you have an iCloud account. If that's not the case, you could make one, which is free, easy, and takes almost no time. Is it setup that is asking for an account or an app? |
718,618 | \begin{cases}
c\_2=\dfrac{c\_1}{a} \left( \left(\dfrac{c\_3}{b}\right)^3 - 1 \right) \\[2ex]
b^2 = a^2 + c\_3^2 + 2(a)\, (c\_3)\, (c\_4) \\
\end{cases}
I am stuck at this point. Not sure on how to move forward. ( A small change made) | 2014/03/19 | [
"https://math.stackexchange.com/questions/718618",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/136573/"
] | $a=(\frac{c\_1}{c\_2})((\frac{c\_3}{b})^3-1)$
$a^2=(\frac{c\_1}{c\_2})^2((\frac{c\_3}{b})^3-1)^2$
substitute $a^2$ and $a$ in the second equation
$b^2=(\frac{c\_1}{c\_2})^2((\frac{c\_3}{b})^3-1)^2+c\_3^2+2c\_3c\_4(\frac{c\_1}{c\_2})((\frac{c\_3}{b})^3-1)$
$b^2c\_2^2=c\_1^2(c\_3^3-b^3)^2+c\_3^2c\_2^2b^3+2c\_3c\_4c\_... | sub your equational value for a into your second line (b squared etc)
ie sub c1c2((c3b)3−1) into b2=a2+c23+2(a)(c3)(c4)
Hope this helps you :) |
718,618 | \begin{cases}
c\_2=\dfrac{c\_1}{a} \left( \left(\dfrac{c\_3}{b}\right)^3 - 1 \right) \\[2ex]
b^2 = a^2 + c\_3^2 + 2(a)\, (c\_3)\, (c\_4) \\
\end{cases}
I am stuck at this point. Not sure on how to move forward. ( A small change made) | 2014/03/19 | [
"https://math.stackexchange.com/questions/718618",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/136573/"
] | The system \begin{cases}
c\_2=\dfrac{c\_1}{a} \left( \left(\dfrac{c\_3}{b}\right)^3 - 1 \right) \\[2ex]
b^2 = a^2 + c\_3^2 + 2ac\_3c\_4 \\
\end{cases}
is equivalent to
\begin{cases}
a=c\_{1}\dfrac{c\_{3}^{3}-x^{3}}{c\_{2}x^{3}}\\[2ex]
b=x ,
\end{cases}
where $x$ is a solution of the following [septic equation](http:... | sub your equational value for a into your second line (b squared etc)
ie sub c1c2((c3b)3−1) into b2=a2+c23+2(a)(c3)(c4)
Hope this helps you :) |
718,618 | \begin{cases}
c\_2=\dfrac{c\_1}{a} \left( \left(\dfrac{c\_3}{b}\right)^3 - 1 \right) \\[2ex]
b^2 = a^2 + c\_3^2 + 2(a)\, (c\_3)\, (c\_4) \\
\end{cases}
I am stuck at this point. Not sure on how to move forward. ( A small change made) | 2014/03/19 | [
"https://math.stackexchange.com/questions/718618",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/136573/"
] | The system \begin{cases}
c\_2=\dfrac{c\_1}{a} \left( \left(\dfrac{c\_3}{b}\right)^3 - 1 \right) \\[2ex]
b^2 = a^2 + c\_3^2 + 2ac\_3c\_4 \\
\end{cases}
is equivalent to
\begin{cases}
a=c\_{1}\dfrac{c\_{3}^{3}-x^{3}}{c\_{2}x^{3}}\\[2ex]
b=x ,
\end{cases}
where $x$ is a solution of the following [septic equation](http:... | $a=(\frac{c\_1}{c\_2})((\frac{c\_3}{b})^3-1)$
$a^2=(\frac{c\_1}{c\_2})^2((\frac{c\_3}{b})^3-1)^2$
substitute $a^2$ and $a$ in the second equation
$b^2=(\frac{c\_1}{c\_2})^2((\frac{c\_3}{b})^3-1)^2+c\_3^2+2c\_3c\_4(\frac{c\_1}{c\_2})((\frac{c\_3}{b})^3-1)$
$b^2c\_2^2=c\_1^2(c\_3^3-b^3)^2+c\_3^2c\_2^2b^3+2c\_3c\_4c\_... |
38,082 | >
> God never met him,
>
>
> But sometimes kings did.
>
>
> People like you and I always meet him,
>
>
> And the mathematicians love him.
>
>
>
Who/what is it? | 2016/07/22 | [
"https://puzzling.stackexchange.com/questions/38082",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/25957/"
] | Is it
>
> sin?
>
>
>
Mathematicians love him.
>
> sin as mathematical formula
>
>
>
God never met him,
>
> God does not accept such things as sins, he forgivess all we do
>
>
>
But sometimes kings did.
>
> Dont know about this one.. maybe Kings threw you into jail / killed you for your sins
>
... | Is it
>
> Pi or Pie
>
>
>
Explanation
Mathematicians love him.
>
> Mathematicians use Pi in calculations
>
>
>
God never met him,
>
> Pie was human made and was not exist from the beginning.
>
>
>
But sometimes kings did.
>
> Evidence were found that Pie was found in Egypt at the time of phara... |
38,082 | >
> God never met him,
>
>
> But sometimes kings did.
>
>
> People like you and I always meet him,
>
>
> And the mathematicians love him.
>
>
>
Who/what is it? | 2016/07/22 | [
"https://puzzling.stackexchange.com/questions/38082",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/25957/"
] | Is it
>
> Pi or Pie
>
>
>
Explanation
Mathematicians love him.
>
> Mathematicians use Pi in calculations
>
>
>
God never met him,
>
> Pie was human made and was not exist from the beginning.
>
>
>
But sometimes kings did.
>
> Evidence were found that Pie was found in Egypt at the time of phara... | I know it. Is it "colleague" ??
>
> God never met him,
>
>
>
For my country there is one God So he can't meet a colleague.
(PS:please read my comment . This riddle is [a little common](http://www.bilmecelerimiz.com/soforun-hergun-gordugucobanin-ara-sira-gordugu-ama-allahin-hic-goremedigi-bisey-bilmecesi-1655.htm... |
38,082 | >
> God never met him,
>
>
> But sometimes kings did.
>
>
> People like you and I always meet him,
>
>
> And the mathematicians love him.
>
>
>
Who/what is it? | 2016/07/22 | [
"https://puzzling.stackexchange.com/questions/38082",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/25957/"
] | There is an old question along these lines whose answer is
>
> an equal
>
>
>
and I think this is probably what you have in mind. (I think it may also be what Hilal meant by his answer, with "colleague" presumably being a not-very-good translation from another language.)
The explanations are all pretty obvious,... | Is it
>
> Pi or Pie
>
>
>
Explanation
Mathematicians love him.
>
> Mathematicians use Pi in calculations
>
>
>
God never met him,
>
> Pie was human made and was not exist from the beginning.
>
>
>
But sometimes kings did.
>
> Evidence were found that Pie was found in Egypt at the time of phara... |
38,082 | >
> God never met him,
>
>
> But sometimes kings did.
>
>
> People like you and I always meet him,
>
>
> And the mathematicians love him.
>
>
>
Who/what is it? | 2016/07/22 | [
"https://puzzling.stackexchange.com/questions/38082",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/25957/"
] | Is it
>
> sin?
>
>
>
Mathematicians love him.
>
> sin as mathematical formula
>
>
>
God never met him,
>
> God does not accept such things as sins, he forgivess all we do
>
>
>
But sometimes kings did.
>
> Dont know about this one.. maybe Kings threw you into jail / killed you for your sins
>
... | I know it. Is it "colleague" ??
>
> God never met him,
>
>
>
For my country there is one God So he can't meet a colleague.
(PS:please read my comment . This riddle is [a little common](http://www.bilmecelerimiz.com/soforun-hergun-gordugucobanin-ara-sira-gordugu-ama-allahin-hic-goremedigi-bisey-bilmecesi-1655.htm... |
38,082 | >
> God never met him,
>
>
> But sometimes kings did.
>
>
> People like you and I always meet him,
>
>
> And the mathematicians love him.
>
>
>
Who/what is it? | 2016/07/22 | [
"https://puzzling.stackexchange.com/questions/38082",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/25957/"
] | There is an old question along these lines whose answer is
>
> an equal
>
>
>
and I think this is probably what you have in mind. (I think it may also be what Hilal meant by his answer, with "colleague" presumably being a not-very-good translation from another language.)
The explanations are all pretty obvious,... | Is it
>
> sin?
>
>
>
Mathematicians love him.
>
> sin as mathematical formula
>
>
>
God never met him,
>
> God does not accept such things as sins, he forgivess all we do
>
>
>
But sometimes kings did.
>
> Dont know about this one.. maybe Kings threw you into jail / killed you for your sins
>
... |
38,082 | >
> God never met him,
>
>
> But sometimes kings did.
>
>
> People like you and I always meet him,
>
>
> And the mathematicians love him.
>
>
>
Who/what is it? | 2016/07/22 | [
"https://puzzling.stackexchange.com/questions/38082",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/25957/"
] | There is an old question along these lines whose answer is
>
> an equal
>
>
>
and I think this is probably what you have in mind. (I think it may also be what Hilal meant by his answer, with "colleague" presumably being a not-very-good translation from another language.)
The explanations are all pretty obvious,... | I know it. Is it "colleague" ??
>
> God never met him,
>
>
>
For my country there is one God So he can't meet a colleague.
(PS:please read my comment . This riddle is [a little common](http://www.bilmecelerimiz.com/soforun-hergun-gordugucobanin-ara-sira-gordugu-ama-allahin-hic-goremedigi-bisey-bilmecesi-1655.htm... |
220,721 | Another labelling question. I have shape-points which are shown as circles in QGIS. The bigger the data, the bigger the circle. Now i want to label the points with the data defined properties, so that the label of each point is directly shown on top of the circle. How to do that? I have to move the y-coordinate...
Ba... | 2016/12/08 | [
"https://gis.stackexchange.com/questions/220721",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/86151/"
] | You could add the main rule $id = $atlasfeatureid, without adding symbols:
[](https://i.stack.imgur.com/Moomr.png)
[](https://i.stack.imgur.com/EQYP1.png)
Then select and drag all... | You could also use the following in the **Python Console** to change all expressions of each rule to `$id = $atlasfeatureid`:
```
layer = qgis.utils.iface.activeLayer()
renderer = layer.rendererV2()
for rule in renderer.rootRule().children():
rule.setFilterExpression('$id = $atlasfeatureid')
```
---
**Edit:**
... |
47,311,651 | I need to write C++ code that will open a binary file and will write 5 MB of '1' in to it.
Currently my code is:
```
#define BYTES_BUFFER_SIZE_5MB (1024*1024*5)
static char buffer[BYTES_BUFFER_SIZE_5MB];
memset(buffer, 0xff, BYTES_BUFFER_SIZE_5MB);
ofstream myFile ("data.bin", ios::out | ios::binary);
myFile.write(b... | 2017/11/15 | [
"https://Stackoverflow.com/questions/47311651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5553670/"
] | I think we can do this in one line with stream manipulators:
```
fout << std::setw(BYTES_BUFFER_SIZE_5MB - 1) << std::setfill(char(0xFF)) << char(0xFF);
```
* [`setw`](http://en.cppreference.com/w/cpp/io/manip/setw) to set the number of bytes to write out
* [`setfill`](http://en.cppreference.com/w/cpp/io/manip/setfi... | You can use a smaller buffer and write it several times with a `for` loop.
If you have to write 5Mb you can do something like
```
#define BYTES_SIZE_5MB (5242880) // Bathsheba comment have to be considered
#define BUFFER_SIZE (1024) // Chunk size to be written (this is an arbitrary amount)
static char buffer[BUFFER_... |
47,311,651 | I need to write C++ code that will open a binary file and will write 5 MB of '1' in to it.
Currently my code is:
```
#define BYTES_BUFFER_SIZE_5MB (1024*1024*5)
static char buffer[BYTES_BUFFER_SIZE_5MB];
memset(buffer, 0xff, BYTES_BUFFER_SIZE_5MB);
ofstream myFile ("data.bin", ios::out | ios::binary);
myFile.write(b... | 2017/11/15 | [
"https://Stackoverflow.com/questions/47311651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5553670/"
] | I think we can do this in one line with stream manipulators:
```
fout << std::setw(BYTES_BUFFER_SIZE_5MB - 1) << std::setfill(char(0xFF)) << char(0xFF);
```
* [`setw`](http://en.cppreference.com/w/cpp/io/manip/setw) to set the number of bytes to write out
* [`setfill`](http://en.cppreference.com/w/cpp/io/manip/setfi... | It's not simpler, but you can use [memory-mapped files](https://en.wikipedia.org/wiki/Memory-mapped_file). They give you exactly what you asked for - you can write the file as if you're writing to memory.
Each (popular) operating system have different API for them, but there are a few libraries that provide portable s... |
28,337,702 | I assign tests for mocha.js at runtime in browser.
How to clean or clear mocha.js state and test state added with `describe()`, `it()` and `mocha.run()` methods? | 2015/02/05 | [
"https://Stackoverflow.com/questions/28337702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1444743/"
] | `mocha.suite.suites = [];` resets all suites. I removed previous HTML DOM output manually. | In addition to `mocha.suite.suites = [];`
I've found that you also need to set `mocha.suite._bail = false;`
Without this, mocha will abort subsequent test runs on the first failed assertion. |
898,529 | I'm adding envers to an existing hibernate entities. Everything is working smoothly so far as far as auditing, however querying is a different issue because the revision tables aren’t populated with the existing data. Has anyone else already solved this issue? Maybe you’ve found some way to populate the revision tables... | 2009/05/22 | [
"https://Stackoverflow.com/questions/898529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/95363/"
] | We populated the initial data by running a series of raw SQL queries to simulate "inserting" all the existing entities as if they had just been created at the same time. For example:
```
insert into REVINFO(REV,REVTSTMP) values (1,1322687394907);
-- this is the initial revision, with an arbitrary timestamp
insert in... | We have solved the issue of populating the audit logs with the existing data as follows:
```
SessionFactory defaultSessionFactory;
// special configured sessionfactory with envers audit listener + an interceptor
// which flags all properties as dirty, even if they are not.
SessionFactory replicationSessionFactory;
... |
898,529 | I'm adding envers to an existing hibernate entities. Everything is working smoothly so far as far as auditing, however querying is a different issue because the revision tables aren’t populated with the existing data. Has anyone else already solved this issue? Maybe you’ve found some way to populate the revision tables... | 2009/05/22 | [
"https://Stackoverflow.com/questions/898529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/95363/"
] | You'll have a problem in this category if you are using Envers [ValidityAuditStrategy](http://docs.jboss.org/hibernate/core/4.2/devguide/en-US/html/ch15.html) and have data which has been created other than with Envers enabled.
In our case (Hibernate 4.2.8.Final) a basic object update throws "Cannot update previous re... | We have solved the issue of populating the audit logs with the existing data as follows:
```
SessionFactory defaultSessionFactory;
// special configured sessionfactory with envers audit listener + an interceptor
// which flags all properties as dirty, even if they are not.
SessionFactory replicationSessionFactory;
... |
898,529 | I'm adding envers to an existing hibernate entities. Everything is working smoothly so far as far as auditing, however querying is a different issue because the revision tables aren’t populated with the existing data. Has anyone else already solved this issue? Maybe you’ve found some way to populate the revision tables... | 2009/05/22 | [
"https://Stackoverflow.com/questions/898529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/95363/"
] | We have solved the issue of populating the audit logs with the existing data as follows:
```
SessionFactory defaultSessionFactory;
// special configured sessionfactory with envers audit listener + an interceptor
// which flags all properties as dirty, even if they are not.
SessionFactory replicationSessionFactory;
... | I've checked many ways, but the best way for me is to write a PL/SQL script as below.
The below script is written for PostgreSQL. Didn't check other vendors, but they must have the same feature.
```
CREATE SEQUENCE hibernate_sequence START 1;
DO
$$
DECLARE
u RECORD;
next_id BIGINT;
BEG... |
898,529 | I'm adding envers to an existing hibernate entities. Everything is working smoothly so far as far as auditing, however querying is a different issue because the revision tables aren’t populated with the existing data. Has anyone else already solved this issue? Maybe you’ve found some way to populate the revision tables... | 2009/05/22 | [
"https://Stackoverflow.com/questions/898529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/95363/"
] | We populated the initial data by running a series of raw SQL queries to simulate "inserting" all the existing entities as if they had just been created at the same time. For example:
```
insert into REVINFO(REV,REVTSTMP) values (1,1322687394907);
-- this is the initial revision, with an arbitrary timestamp
insert in... | You'll have a problem in this category if you are using Envers [ValidityAuditStrategy](http://docs.jboss.org/hibernate/core/4.2/devguide/en-US/html/ch15.html) and have data which has been created other than with Envers enabled.
In our case (Hibernate 4.2.8.Final) a basic object update throws "Cannot update previous re... |
898,529 | I'm adding envers to an existing hibernate entities. Everything is working smoothly so far as far as auditing, however querying is a different issue because the revision tables aren’t populated with the existing data. Has anyone else already solved this issue? Maybe you’ve found some way to populate the revision tables... | 2009/05/22 | [
"https://Stackoverflow.com/questions/898529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/95363/"
] | You don't need to.
AuditQuery allows you to get both RevisionEntity and data revision by :
```
AuditQuery query = getAuditReader().createQuery()
.forRevisionsOfEntity(YourAuditedEntity.class, false, false);
```
This will construct a query which returns a list of Object [3]. Fisrt element is your d... | Take a look at <http://www.jboss.org/files/envers/docs/index.html#revisionlog>
Basically you can define your own 'revision type' using @RevisionEntity annotation,
and then implement a RevisionListener interface to insert your additional audit data,
like current user and high level operation. Usually those are pulled f... |
898,529 | I'm adding envers to an existing hibernate entities. Everything is working smoothly so far as far as auditing, however querying is a different issue because the revision tables aren’t populated with the existing data. Has anyone else already solved this issue? Maybe you’ve found some way to populate the revision tables... | 2009/05/22 | [
"https://Stackoverflow.com/questions/898529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/95363/"
] | We populated the initial data by running a series of raw SQL queries to simulate "inserting" all the existing entities as if they had just been created at the same time. For example:
```
insert into REVINFO(REV,REVTSTMP) values (1,1322687394907);
-- this is the initial revision, with an arbitrary timestamp
insert in... | I've checked many ways, but the best way for me is to write a PL/SQL script as below.
The below script is written for PostgreSQL. Didn't check other vendors, but they must have the same feature.
```
CREATE SEQUENCE hibernate_sequence START 1;
DO
$$
DECLARE
u RECORD;
next_id BIGINT;
BEG... |
898,529 | I'm adding envers to an existing hibernate entities. Everything is working smoothly so far as far as auditing, however querying is a different issue because the revision tables aren’t populated with the existing data. Has anyone else already solved this issue? Maybe you’ve found some way to populate the revision tables... | 2009/05/22 | [
"https://Stackoverflow.com/questions/898529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/95363/"
] | You'll have a problem in this category if you are using Envers [ValidityAuditStrategy](http://docs.jboss.org/hibernate/core/4.2/devguide/en-US/html/ch15.html) and have data which has been created other than with Envers enabled.
In our case (Hibernate 4.2.8.Final) a basic object update throws "Cannot update previous re... | You could extend the `AuditReaderImpl` with a fallback option for the find method, like:
```
public class AuditReaderWithFallback extends AuditReaderImpl {
public AuditReaderWithFallback(
EnversService enversService,
Session session,
SessionImplementor sessionImplementor) {... |
898,529 | I'm adding envers to an existing hibernate entities. Everything is working smoothly so far as far as auditing, however querying is a different issue because the revision tables aren’t populated with the existing data. Has anyone else already solved this issue? Maybe you’ve found some way to populate the revision tables... | 2009/05/22 | [
"https://Stackoverflow.com/questions/898529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/95363/"
] | We have solved the issue of populating the audit logs with the existing data as follows:
```
SessionFactory defaultSessionFactory;
// special configured sessionfactory with envers audit listener + an interceptor
// which flags all properties as dirty, even if they are not.
SessionFactory replicationSessionFactory;
... | Take a look at <http://www.jboss.org/files/envers/docs/index.html#revisionlog>
Basically you can define your own 'revision type' using @RevisionEntity annotation,
and then implement a RevisionListener interface to insert your additional audit data,
like current user and high level operation. Usually those are pulled f... |
898,529 | I'm adding envers to an existing hibernate entities. Everything is working smoothly so far as far as auditing, however querying is a different issue because the revision tables aren’t populated with the existing data. Has anyone else already solved this issue? Maybe you’ve found some way to populate the revision tables... | 2009/05/22 | [
"https://Stackoverflow.com/questions/898529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/95363/"
] | We populated the initial data by running a series of raw SQL queries to simulate "inserting" all the existing entities as if they had just been created at the same time. For example:
```
insert into REVINFO(REV,REVTSTMP) values (1,1322687394907);
-- this is the initial revision, with an arbitrary timestamp
insert in... | You could extend the `AuditReaderImpl` with a fallback option for the find method, like:
```
public class AuditReaderWithFallback extends AuditReaderImpl {
public AuditReaderWithFallback(
EnversService enversService,
Session session,
SessionImplementor sessionImplementor) {... |
898,529 | I'm adding envers to an existing hibernate entities. Everything is working smoothly so far as far as auditing, however querying is a different issue because the revision tables aren’t populated with the existing data. Has anyone else already solved this issue? Maybe you’ve found some way to populate the revision tables... | 2009/05/22 | [
"https://Stackoverflow.com/questions/898529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/95363/"
] | You could extend the `AuditReaderImpl` with a fallback option for the find method, like:
```
public class AuditReaderWithFallback extends AuditReaderImpl {
public AuditReaderWithFallback(
EnversService enversService,
Session session,
SessionImplementor sessionImplementor) {... | I've checked many ways, but the best way for me is to write a PL/SQL script as below.
The below script is written for PostgreSQL. Didn't check other vendors, but they must have the same feature.
```
CREATE SEQUENCE hibernate_sequence START 1;
DO
$$
DECLARE
u RECORD;
next_id BIGINT;
BEG... |
40,360,307 | I'm trying to delete a line with a the last character of the prior line with sed:
I have a json file :
```
{
"name":"John",
"age":"16",
"country":"Spain"
}
```
I would like to delete country of all entries, to do that I have to delete the comma for the json syntax of the prior line.
I'm using this pattern :
```
s... | 2016/11/01 | [
"https://Stackoverflow.com/questions/40360307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2841703/"
] | As pointed out before you should really consider using a JSON parser to parse JSON.
When that is said you can slurp the whole file, remove newlines and then replace
accordantly:
```
$ sed ':a;N;$!ba;s/\n//g;s/,"country"[^}]*//' test.json
{"name":"John","age":"16"}
```
Breakdown:
```
:a; # Define la... | You can use a JSON parser like [`jq`](https://stedolan.github.io/jq/) to parse json file. The following will return the document without the `country` field and write the new document in `result.json` :
```
jq 'del(.country)' file.json > result.json
``` |
40,360,307 | I'm trying to delete a line with a the last character of the prior line with sed:
I have a json file :
```
{
"name":"John",
"age":"16",
"country":"Spain"
}
```
I would like to delete country of all entries, to do that I have to delete the comma for the json syntax of the prior line.
I'm using this pattern :
```
s... | 2016/11/01 | [
"https://Stackoverflow.com/questions/40360307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2841703/"
] | **Using a proper JSON parser such as `jq` is generally the best choic**e (see below), but if installing a utility is not an option, try this ***GNU* `sed` command**:
```
$ sed -zr 's/,\s*"country":[^\n]+//g' test.json
{
"name":"John",
"age":"16"
}
```
* `-z` splits the input into records by `NUL`s, which, in this ca... | You can use a JSON parser like [`jq`](https://stedolan.github.io/jq/) to parse json file. The following will return the document without the `country` field and write the new document in `result.json` :
```
jq 'del(.country)' file.json > result.json
``` |
40,360,307 | I'm trying to delete a line with a the last character of the prior line with sed:
I have a json file :
```
{
"name":"John",
"age":"16",
"country":"Spain"
}
```
I would like to delete country of all entries, to do that I have to delete the comma for the json syntax of the prior line.
I'm using this pattern :
```
s... | 2016/11/01 | [
"https://Stackoverflow.com/questions/40360307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2841703/"
] | This might work for you (GNU sed):
```
sed 'N;s/,\s*\n\s*"country".*//;P;D' file
```
Read two lines into the pattern space and remove substitution string.
N.B. Allows for spaces either side of the line. | You can use a JSON parser like [`jq`](https://stedolan.github.io/jq/) to parse json file. The following will return the document without the `country` field and write the new document in `result.json` :
```
jq 'del(.country)' file.json > result.json
``` |
40,360,307 | I'm trying to delete a line with a the last character of the prior line with sed:
I have a json file :
```
{
"name":"John",
"age":"16",
"country":"Spain"
}
```
I would like to delete country of all entries, to do that I have to delete the comma for the json syntax of the prior line.
I'm using this pattern :
```
s... | 2016/11/01 | [
"https://Stackoverflow.com/questions/40360307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2841703/"
] | **Using a proper JSON parser such as `jq` is generally the best choic**e (see below), but if installing a utility is not an option, try this ***GNU* `sed` command**:
```
$ sed -zr 's/,\s*"country":[^\n]+//g' test.json
{
"name":"John",
"age":"16"
}
```
* `-z` splits the input into records by `NUL`s, which, in this ca... | As pointed out before you should really consider using a JSON parser to parse JSON.
When that is said you can slurp the whole file, remove newlines and then replace
accordantly:
```
$ sed ':a;N;$!ba;s/\n//g;s/,"country"[^}]*//' test.json
{"name":"John","age":"16"}
```
Breakdown:
```
:a; # Define la... |
40,360,307 | I'm trying to delete a line with a the last character of the prior line with sed:
I have a json file :
```
{
"name":"John",
"age":"16",
"country":"Spain"
}
```
I would like to delete country of all entries, to do that I have to delete the comma for the json syntax of the prior line.
I'm using this pattern :
```
s... | 2016/11/01 | [
"https://Stackoverflow.com/questions/40360307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2841703/"
] | **Using a proper JSON parser such as `jq` is generally the best choic**e (see below), but if installing a utility is not an option, try this ***GNU* `sed` command**:
```
$ sed -zr 's/,\s*"country":[^\n]+//g' test.json
{
"name":"John",
"age":"16"
}
```
* `-z` splits the input into records by `NUL`s, which, in this ca... | This might work for you (GNU sed):
```
sed 'N;s/,\s*\n\s*"country".*//;P;D' file
```
Read two lines into the pattern space and remove substitution string.
N.B. Allows for spaces either side of the line. |
1,627 | What do Russians consider their authentic (not necessarily Russian-original) dishes? | 2012/12/29 | [
"https://russian.stackexchange.com/questions/1627",
"https://russian.stackexchange.com",
"https://russian.stackexchange.com/users/5/"
] | First of all it is `rye-bread (ржаной хлеб)`. People grew wheat and produced flour. Then they cooked `kolatch (калач)`, `oat meal (толокно)`, `pies (пироги пряженые и подовые)`.
Soups have always played an important role in the Russian meal. The traditional staple of soups such as `borscht (борщ)`, `shchi (щи)`, `ukha... | I don't think that this is a constructive question, and voted to close, but here are some examples...
* пельмени
* окрошка
* борщ
* щи
* уха
* холоде́ц
* шашлы́к
* блины
* сы́рники
* пирожки |
54,752,513 | I am dealing with the following problem, I have two vectors namely:
```
index1<-c(10 ,11 ,12 ,13 ,14 ,15 ,16 ,17 ,18 ,19 ,20 ,21, 22, 23, 24, 25, 26, 27, 28, 29)
index2<-c(17 ,18, 19, 20 ,22 ,23, 24, 25, 26, 27, 28, 29, 30 ,31 ,32, 33 ,42, 43, 44,45, 46 ,47 ,48, 49, 50, 51, 52 ,53, 54 ,55, 56)
```
I want to keep al... | 2019/02/18 | [
"https://Stackoverflow.com/questions/54752513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10541626/"
] | `ok` consists of all values of `2*index1[i]+k` so if `index2[j]` is not found in `ok` then NA it out:
```
ok <- outer(2*index1, 0:3, `+`)
replace(index2, ! (index2 %in% ok), NA)
```
Alternately, to only keep the elements found in `ok`:
```
index2[index2 %in% ok]
``` | Here's an idea withou the `for()`:
```
library(dplyr)
index1.1 = unique(2*rep(index1,4) + c(rep(1,length(index1)),rep(2,length(index1)),rep(3,length(index1)),rep(4,length(index1))))
index2[index2 %in% index1.1]
[1] 22 23 24 25 26 27 28 29 30 31 32 33 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
```
Also, as Paolo p... |
18,289,023 | I want to add select class on clok of paragraph tag. I written code but it is not working. please suggest.
code is given below:
```
<style type="text/css">
#elm p { background:#FF0000; color:#FFFFFF; font-weight:bold;}
.select{ background:#000099;}
</style>
<script type="text/javascript" src="js/jquery-1.10.... | 2013/08/17 | [
"https://Stackoverflow.com/questions/18289023",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1655395/"
] | Try with `.toggleClass()` like
```
$(document).ready(function(){
$('#elm').on('click',function(){
$("p").toggleClass('hover');
});
});
``` | Your code is a bit of a mess to be perfectly honest. Try clean it up a little and you should be able to notice what you're doing wrong.
If I understood your requirements, you want to add/remove a class upon click of the parent div id="elm". If that is the case you can use toggleClass as mentioned by Gautam3164, take a... |
41,017,022 | I'm facing a problem in my code, where I have properties of two different models whose type cannot be changed by me. One is a string array and one is a collection of string. Now I need to add all the elements in the string array to the collection. I'm providing a sample code below.
```
Collection<string> collection = ... | 2016/12/07 | [
"https://Stackoverflow.com/questions/41017022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7187746/"
] | If the `Collection` is already created you can enumerate the items of the array and call `Add`
```
Collection<string> collection = new Collection<string>();
string[] arraystring = new string[]{"Now","Today","Tomorrow"};
foreach(var s in arrayString)
collection.Add(s);
```
Otherwise you can initialize a `Collecti... | Use the correct ctor, passing in the array:
```
Collection<string> collection = new Collection<string>(arraystring);
``` |
41,017,022 | I'm facing a problem in my code, where I have properties of two different models whose type cannot be changed by me. One is a string array and one is a collection of string. Now I need to add all the elements in the string array to the collection. I'm providing a sample code below.
```
Collection<string> collection = ... | 2016/12/07 | [
"https://Stackoverflow.com/questions/41017022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7187746/"
] | If the `Collection` is already created you can enumerate the items of the array and call `Add`
```
Collection<string> collection = new Collection<string>();
string[] arraystring = new string[]{"Now","Today","Tomorrow"};
foreach(var s in arrayString)
collection.Add(s);
```
Otherwise you can initialize a `Collecti... | You can give your string array by parameter to `Collection<string>` ctor, like here:
```
var collection = new Collection<string>(new[] { "Now", "Today", "Tomorrow" });
```
About `Collection<T>` you can read here: <https://msdn.microsoft.com/ru-ru/library/ms132397(v=vs.110).aspx>. |
41,017,022 | I'm facing a problem in my code, where I have properties of two different models whose type cannot be changed by me. One is a string array and one is a collection of string. Now I need to add all the elements in the string array to the collection. I'm providing a sample code below.
```
Collection<string> collection = ... | 2016/12/07 | [
"https://Stackoverflow.com/questions/41017022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7187746/"
] | If the `Collection` is already created you can enumerate the items of the array and call `Add`
```
Collection<string> collection = new Collection<string>();
string[] arraystring = new string[]{"Now","Today","Tomorrow"};
foreach(var s in arrayString)
collection.Add(s);
```
Otherwise you can initialize a `Collecti... | For a clean solution, you could use the ForEach static method of Array like so:
```
Collection<string> collection = new Collection<string>();
string[] arraystring = new string[] { "Now", "Today", "Tomorrow" };
Array.ForEach(arraystring, str => collection.Add(str));
``` |
41,017,022 | I'm facing a problem in my code, where I have properties of two different models whose type cannot be changed by me. One is a string array and one is a collection of string. Now I need to add all the elements in the string array to the collection. I'm providing a sample code below.
```
Collection<string> collection = ... | 2016/12/07 | [
"https://Stackoverflow.com/questions/41017022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7187746/"
] | Use the correct ctor, passing in the array:
```
Collection<string> collection = new Collection<string>(arraystring);
``` | You can give your string array by parameter to `Collection<string>` ctor, like here:
```
var collection = new Collection<string>(new[] { "Now", "Today", "Tomorrow" });
```
About `Collection<T>` you can read here: <https://msdn.microsoft.com/ru-ru/library/ms132397(v=vs.110).aspx>. |
41,017,022 | I'm facing a problem in my code, where I have properties of two different models whose type cannot be changed by me. One is a string array and one is a collection of string. Now I need to add all the elements in the string array to the collection. I'm providing a sample code below.
```
Collection<string> collection = ... | 2016/12/07 | [
"https://Stackoverflow.com/questions/41017022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7187746/"
] | Use the correct ctor, passing in the array:
```
Collection<string> collection = new Collection<string>(arraystring);
``` | For a clean solution, you could use the ForEach static method of Array like so:
```
Collection<string> collection = new Collection<string>();
string[] arraystring = new string[] { "Now", "Today", "Tomorrow" };
Array.ForEach(arraystring, str => collection.Add(str));
``` |
147,089 | What are all the translation invariant measures on $\mathbb{R}$?
Except Lebesgue measure on $\mathbb R$ I didn't find any translation invariant measure. So I put this question?
I know that if $\mu$ is a measure then $c \times \mu$ is again a measure where $c>0$. | 2012/05/19 | [
"https://math.stackexchange.com/questions/147089",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/31526/"
] | Here is a way to argue out. I will let you fill in the details.
1. If we let $\mu([0,1))=C$, then $\mu([0,1/n)) = C/n$, where $n \in \mathbb{Z}^+$. This follows from additivity and translation invariance.
2. Now prove that if $(b-a) \in \mathbb{Q}^+$, then $\mu([a,b)) = C(b-a)$ using translation invariance and what yo... | Let $\lambda$ be a translation-invariant measure on the Borel sets that puts positive and finite measure on the right-open unit interval $[0,1)$ then $\lambda$ is a positive multiple of Lebesgue measure. Here is an outline of the proof: Every Borel measure is determined by its behavior on finite intervals. By translati... |
147,089 | What are all the translation invariant measures on $\mathbb{R}$?
Except Lebesgue measure on $\mathbb R$ I didn't find any translation invariant measure. So I put this question?
I know that if $\mu$ is a measure then $c \times \mu$ is again a measure where $c>0$. | 2012/05/19 | [
"https://math.stackexchange.com/questions/147089",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/31526/"
] | Here is a way to argue out. I will let you fill in the details.
1. If we let $\mu([0,1))=C$, then $\mu([0,1/n)) = C/n$, where $n \in \mathbb{Z}^+$. This follows from additivity and translation invariance.
2. Now prove that if $(b-a) \in \mathbb{Q}^+$, then $\mu([a,b)) = C(b-a)$ using translation invariance and what yo... | $\mathbb{R}$ is a locally compact group with respect to addition and the *translation invariant* measures are the Haar measures on this group. A general theorem by Von Neumann states that such a measure is unique up to a multiplicative constant. |
147,089 | What are all the translation invariant measures on $\mathbb{R}$?
Except Lebesgue measure on $\mathbb R$ I didn't find any translation invariant measure. So I put this question?
I know that if $\mu$ is a measure then $c \times \mu$ is again a measure where $c>0$. | 2012/05/19 | [
"https://math.stackexchange.com/questions/147089",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/31526/"
] | Here is a way to argue out. I will let you fill in the details.
1. If we let $\mu([0,1))=C$, then $\mu([0,1/n)) = C/n$, where $n \in \mathbb{Z}^+$. This follows from additivity and translation invariance.
2. Now prove that if $(b-a) \in \mathbb{Q}^+$, then $\mu([a,b)) = C(b-a)$ using translation invariance and what yo... | Lebesgue measure and its multiples are not the only measures that are invariant under translations. Take, for example, the counting measure over the integers or over the rationals. Sure, they are infinite, but your question doesn't mention finiteness. |
47,976,895 | I have the HTML as follows:
```
<div class="col-md-4">{{ctrl.serviceInstance.additionalPorts}}<span
ng-if="ctrl.serviceInstanceOfActiveDeployment != null && !ctrl.compareArrays(ctrl.serviceInstanceOfActiveDeployment.additionalPorts,ctrl.serviceInstance.additionalPorts)"... | 2017/12/26 | [
"https://Stackoverflow.com/questions/47976895",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4071741/"
] | You can use a php library for this purpose:
```
https://github.com/serbanghita/Mobile-Detect
```
It has a lot of functions to detect any device eg: **isMobile()**, **isTablet()**, **isiPhone()** etc.
**Only for php:**
```
<?php
// include library file
require_once 'Mobile_Detect.php';
$object = new Mobile_Detect;
... | ```
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" media="screen and (min-device-width: 800px)" href="mobile.css" />
```
use both the stylesheets as above. So if the device width is 800px or lesser the mobile.css would be used to render. Or else by default the style.css is used. |
2,566,568 | Let $x$ be some positive number and $n \in \{1,2,\dots\}$. I would like to solve the following integral:
$$\int\_0^{x} \frac{v^{1/n}}{(1+v)^{(n+1)/n}} dv$$ | 2017/12/14 | [
"https://math.stackexchange.com/questions/2566568",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/255123/"
] | The result is expressible in terms of the [incomplete Beta function](https://en.wikipedia.org/wiki/Beta_function#Incomplete_beta_function). Set $$y=\dfrac{v}{1+v}=1-\dfrac{1}{1+v}$$ so $dy=\dfrac{dv}{(1+v)^2}=(1-y)^2dv$ and $dv=(1-y)^{-2}dy$. Since $1+v=\dfrac{1}{1-y}$ and $$v=\dfrac{1}{1-y}-1=\dfrac{y}{1-y},$$ the int... | I've decided to use this:
$$dx={1\over a}d(ax)$$
Maybe I've been wrong.
$$\int\_0^x{v^{1\over n}\over {(1+v)}^{{n+1}\over n}}dv = \int\_0^x{v^{1\over n}\over {(1+v)}^{{1}\over n}{(1+v)}}dv = \int\_0^x{v^{1\over n}\over {(1+v)}^{{1}\over n}{(1+v)}} \cdot (1+v)\cdot d({v\over 1+v})$$
$$\int\_0^x{v^{1\over n}\over {(1+v)}... |
43,299,221 | I am building a study planner.
I have designed a draft interface and the database and I am currently trying to insert test registration details into the database but I have been on this for three days now with no success. I will highly appreciate some kind help with pointing out what I have been doing wrong, please.
... | 2017/04/08 | [
"https://Stackoverflow.com/questions/43299221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7133465/"
] | You can use `pre` tag , which defines `preformatted` text.
```
foreach(item in collection) {
<pre>@item @item</pre>
}
``` | One more variant:
```
@(string.Format("{0} {1}", item, item))
``` |
43,299,221 | I am building a study planner.
I have designed a draft interface and the database and I am currently trying to insert test registration details into the database but I have been on this for three days now with no success. I will highly appreciate some kind help with pointing out what I have been doing wrong, please.
... | 2017/04/08 | [
"https://Stackoverflow.com/questions/43299221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7133465/"
] | You can use `pre` tag , which defines `preformatted` text.
```
foreach(item in collection) {
<pre>@item @item</pre>
}
``` | ```
//This will work for sure, as MVC C# using razor syntax then you just need to put space between those two only
foreach(var item in collection) {
<span>@item @item</span>
}
``` |
43,299,221 | I am building a study planner.
I have designed a draft interface and the database and I am currently trying to insert test registration details into the database but I have been on this for three days now with no success. I will highly appreciate some kind help with pointing out what I have been doing wrong, please.
... | 2017/04/08 | [
"https://Stackoverflow.com/questions/43299221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7133465/"
] | You can use `pre` tag , which defines `preformatted` text.
```
foreach(item in collection) {
<pre>@item @item</pre>
}
``` | have you tried ` ` this can be repeated i.e. ` ` you can do line breaks with `<br />` |
43,299,221 | I am building a study planner.
I have designed a draft interface and the database and I am currently trying to insert test registration details into the database but I have been on this for three days now with no success. I will highly appreciate some kind help with pointing out what I have been doing wrong, please.
... | 2017/04/08 | [
"https://Stackoverflow.com/questions/43299221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7133465/"
] | In my application I have used a space after the link's name ("Details ") as shown here
```
@Html.ActionLink("Details ","Details", new { Variable_ID = item.VIP_ID})
@Html.ActionLink("Edit", "Edit", new { Variable_ID = item.VIP_ID })
```
so my links will look like this: Details Edit, instead ... | ```
<span> </span>
```
Insert "` `" to add more blank spaces |
43,299,221 | I am building a study planner.
I have designed a draft interface and the database and I am currently trying to insert test registration details into the database but I have been on this for three days now with no success. I will highly appreciate some kind help with pointing out what I have been doing wrong, please.
... | 2017/04/08 | [
"https://Stackoverflow.com/questions/43299221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7133465/"
] | have you tried ` ` this can be repeated i.e. ` ` you can do line breaks with `<br />` | If you wish to add single space between item:
```
foreach(item in collection)
{
<p>@item @item</p>
}
```
But you will have better flexibility if you wrap it in a HTML element like div or span,
and then add padding/margin to the element using CSS.
```
foreach(item in collection)
{
<div class="user-def... |
43,299,221 | I am building a study planner.
I have designed a draft interface and the database and I am currently trying to insert test registration details into the database but I have been on this for three days now with no success. I will highly appreciate some kind help with pointing out what I have been doing wrong, please.
... | 2017/04/08 | [
"https://Stackoverflow.com/questions/43299221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7133465/"
] | have you tried ` ` this can be repeated i.e. ` ` you can do line breaks with `<br />` | ```
//This will work for sure, as MVC C# using razor syntax then you just need to put space between those two only
foreach(var item in collection) {
<span>@item @item</span>
}
``` |
43,299,221 | I am building a study planner.
I have designed a draft interface and the database and I am currently trying to insert test registration details into the database but I have been on this for three days now with no success. I will highly appreciate some kind help with pointing out what I have been doing wrong, please.
... | 2017/04/08 | [
"https://Stackoverflow.com/questions/43299221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7133465/"
] | have you tried ` ` this can be repeated i.e. ` ` you can do line breaks with `<br />` | One more variant:
```
@(string.Format("{0} {1}", item, item))
``` |
43,299,221 | I am building a study planner.
I have designed a draft interface and the database and I am currently trying to insert test registration details into the database but I have been on this for three days now with no success. I will highly appreciate some kind help with pointing out what I have been doing wrong, please.
... | 2017/04/08 | [
"https://Stackoverflow.com/questions/43299221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7133465/"
] | In my application I have used a space after the link's name ("Details ") as shown here
```
@Html.ActionLink("Details ","Details", new { Variable_ID = item.VIP_ID})
@Html.ActionLink("Edit", "Edit", new { Variable_ID = item.VIP_ID })
```
so my links will look like this: Details Edit, instead ... | One more variant:
```
@(string.Format("{0} {1}", item, item))
``` |
43,299,221 | I am building a study planner.
I have designed a draft interface and the database and I am currently trying to insert test registration details into the database but I have been on this for three days now with no success. I will highly appreciate some kind help with pointing out what I have been doing wrong, please.
... | 2017/04/08 | [
"https://Stackoverflow.com/questions/43299221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7133465/"
] | In my application I have used a space after the link's name ("Details ") as shown here
```
@Html.ActionLink("Details ","Details", new { Variable_ID = item.VIP_ID})
@Html.ActionLink("Edit", "Edit", new { Variable_ID = item.VIP_ID })
```
so my links will look like this: Details Edit, instead ... | If you wish to add single space between item:
```
foreach(item in collection)
{
<p>@item @item</p>
}
```
But you will have better flexibility if you wrap it in a HTML element like div or span,
and then add padding/margin to the element using CSS.
```
foreach(item in collection)
{
<div class="user-def... |
43,299,221 | I am building a study planner.
I have designed a draft interface and the database and I am currently trying to insert test registration details into the database but I have been on this for three days now with no success. I will highly appreciate some kind help with pointing out what I have been doing wrong, please.
... | 2017/04/08 | [
"https://Stackoverflow.com/questions/43299221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7133465/"
] | You can use `pre` tag , which defines `preformatted` text.
```
foreach(item in collection) {
<pre>@item @item</pre>
}
``` | In my application I have used a space after the link's name ("Details ") as shown here
```
@Html.ActionLink("Details ","Details", new { Variable_ID = item.VIP_ID})
@Html.ActionLink("Edit", "Edit", new { Variable_ID = item.VIP_ID })
```
so my links will look like this: Details Edit, instead ... |
12,256,238 | There seems to be a difference between `main(String[] args)` and other string arrays that i can not figure out, my example.
```
public class TestArgs
{
public static void main(String[] args) {
String[] x = {"1","2","3"};
System.out.print( x[2] == "3" );
System.out.print( args[2] == "3" );
}}
```
I run t... | 2012/09/04 | [
"https://Stackoverflow.com/questions/12256238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1243152/"
] | in java, you have to use `"test".equals("test")` to test for string-equality ;)
strings are objects and the objects are not the SAME, they just have the same VALUE | The `==` operator compares objects by reference. |
12,256,238 | There seems to be a difference between `main(String[] args)` and other string arrays that i can not figure out, my example.
```
public class TestArgs
{
public static void main(String[] args) {
String[] x = {"1","2","3"};
System.out.print( x[2] == "3" );
System.out.print( args[2] == "3" );
}}
```
I run t... | 2012/09/04 | [
"https://Stackoverflow.com/questions/12256238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1243152/"
] | in java, you have to use `"test".equals("test")` to test for string-equality ;)
strings are objects and the objects are not the SAME, they just have the same VALUE | That is because you're comparing the reference of the objects when you use `==`. When you're comparing `String`, use `.equals()` instead of `==`. This [SO answer](https://stackoverflow.com/a/767379/1168372) better explains why.
So your code would become something like this:
```
public class TestArgs {
public stat... |
12,256,238 | There seems to be a difference between `main(String[] args)` and other string arrays that i can not figure out, my example.
```
public class TestArgs
{
public static void main(String[] args) {
String[] x = {"1","2","3"};
System.out.print( x[2] == "3" );
System.out.print( args[2] == "3" );
}}
```
I run t... | 2012/09/04 | [
"https://Stackoverflow.com/questions/12256238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1243152/"
] | That is because you're comparing the reference of the objects when you use `==`. When you're comparing `String`, use `.equals()` instead of `==`. This [SO answer](https://stackoverflow.com/a/767379/1168372) better explains why.
So your code would become something like this:
```
public class TestArgs {
public stat... | The `==` operator compares objects by reference. |
515,440 | **Before lightdm installed:**

When starting there is no issue, after some time the screen becomes like this. along with icons right and left click menus are also unable to read.
what to do?
The issue is in Ubuntu 14.04
uname -a => .... | 2014/08/21 | [
"https://askubuntu.com/questions/515440",
"https://askubuntu.com",
"https://askubuntu.com/users/320207/"
] | lightdm and gdm are just login greeters and they disappear after you login.
What you see here is a terminal on top of browser, i.e. a user session when lightm/gdm are already gone into background.
So lightdm/gdm have nothing to do with it, they still might trigger some bugs which corrupt memory and hence your experienc... | I was facing similar issues with my laptop before. I found that I could fix this by running the command `unity --replace` from command line (`alt` + `F2`). On my laptop this temporarily fixed the issue. |
19,926,258 | Is it possible to use collections as Parameters in precompiled Slick queries?
Something like:
```
private val findByIds = for {
ids <- Parameters[Set[Int]]
meta <- AssetMetadatas if meta.id inSet ids
} yield meta
```
Unfortunately the above does not compile:
Don't know how to unpack scala.collection.immutable.... | 2013/11/12 | [
"https://Stackoverflow.com/questions/19926258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/665679/"
] | You can't precompile queries using inSet at the moment, neither in Slick 1 nor in Slick 2. It makes sense when you think about that the queries have to be different in SQL for different Set sizes.
* for 0: `WHERE false`
* for 1: `WHERE id = ?`
* for 2: `WHERE id IN (?,?)`
* for 3: `WHERE id IN (?,?,?)`
* ...
This can... | There's `inSetBind` for that:
```
private def findByIds(ids: Set[Int]) = for {
meta <- AssetMetadatas if meta.id inSetBind ids
} yield meta
```
Yes, this will invoke the query compiler each time you call `findByIds`, but it will always yield the same SQL for the same cardinality of `ids`.
So for `ids` of `Set(1,... |
59,607 | I am seeking some general advice from applied mathematicians at American universities. In my statement of purpose, would my stating that I want to pursue a PhD in applied mathematics primarily for the purpose of working in industry be a bad idea, in general?
This would be sort of "keeping it real" and being honest, w... | 2015/12/08 | [
"https://academia.stackexchange.com/questions/59607",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/45678/"
] | I have done graduate admissions for my math department. I am a "pure mathematician" but my department is just the math department: there is no formal separation between pure and applied.
Others can speak for themselves, but I always find honesty refreshing, and the idea that a prospective PhD student does not want to ... | If you mean by a job in industry working at a research lab sponsored by a company (or the government) that is like being at a university minus the teaching, then you can ignore the rest of this answer. Those positions are practically like being in academia, minus the teaching. They are also almost non-existent these da... |
59,607 | I am seeking some general advice from applied mathematicians at American universities. In my statement of purpose, would my stating that I want to pursue a PhD in applied mathematics primarily for the purpose of working in industry be a bad idea, in general?
This would be sort of "keeping it real" and being honest, w... | 2015/12/08 | [
"https://academia.stackexchange.com/questions/59607",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/45678/"
] | I have done graduate admissions for my math department. I am a "pure mathematician" but my department is just the math department: there is no formal separation between pure and applied.
Others can speak for themselves, but I always find honesty refreshing, and the idea that a prospective PhD student does not want to ... | With applied math, the sky's the limit. The variety of areas math can be applied to is more than one person can conceive of.
Yes, you can go out and get a real job with a PhD in applied math. Here's a small example for you: Carl de Boor, whom I think of as Mr. Spline, did a lot of work for the automotive industry in D... |
59,607 | I am seeking some general advice from applied mathematicians at American universities. In my statement of purpose, would my stating that I want to pursue a PhD in applied mathematics primarily for the purpose of working in industry be a bad idea, in general?
This would be sort of "keeping it real" and being honest, w... | 2015/12/08 | [
"https://academia.stackexchange.com/questions/59607",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/45678/"
] | I have done graduate admissions for my math department. I am a "pure mathematician" but my department is just the math department: there is no formal separation between pure and applied.
Others can speak for themselves, but I always find honesty refreshing, and the idea that a prospective PhD student does not want to ... | You might get several possible reactions.
* That's great, industry needs more people with solid academic training and it's our role to provide the educated workforce that's needed in our competitive industrial economy.
* You're being naive. Do you really think you will be more employable in industry if you have a PhD?... |
59,607 | I am seeking some general advice from applied mathematicians at American universities. In my statement of purpose, would my stating that I want to pursue a PhD in applied mathematics primarily for the purpose of working in industry be a bad idea, in general?
This would be sort of "keeping it real" and being honest, w... | 2015/12/08 | [
"https://academia.stackexchange.com/questions/59607",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/45678/"
] | If you mean by a job in industry working at a research lab sponsored by a company (or the government) that is like being at a university minus the teaching, then you can ignore the rest of this answer. Those positions are practically like being in academia, minus the teaching. They are also almost non-existent these da... | With applied math, the sky's the limit. The variety of areas math can be applied to is more than one person can conceive of.
Yes, you can go out and get a real job with a PhD in applied math. Here's a small example for you: Carl de Boor, whom I think of as Mr. Spline, did a lot of work for the automotive industry in D... |
59,607 | I am seeking some general advice from applied mathematicians at American universities. In my statement of purpose, would my stating that I want to pursue a PhD in applied mathematics primarily for the purpose of working in industry be a bad idea, in general?
This would be sort of "keeping it real" and being honest, w... | 2015/12/08 | [
"https://academia.stackexchange.com/questions/59607",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/45678/"
] | If you mean by a job in industry working at a research lab sponsored by a company (or the government) that is like being at a university minus the teaching, then you can ignore the rest of this answer. Those positions are practically like being in academia, minus the teaching. They are also almost non-existent these da... | You might get several possible reactions.
* That's great, industry needs more people with solid academic training and it's our role to provide the educated workforce that's needed in our competitive industrial economy.
* You're being naive. Do you really think you will be more employable in industry if you have a PhD?... |
59,607 | I am seeking some general advice from applied mathematicians at American universities. In my statement of purpose, would my stating that I want to pursue a PhD in applied mathematics primarily for the purpose of working in industry be a bad idea, in general?
This would be sort of "keeping it real" and being honest, w... | 2015/12/08 | [
"https://academia.stackexchange.com/questions/59607",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/45678/"
] | With applied math, the sky's the limit. The variety of areas math can be applied to is more than one person can conceive of.
Yes, you can go out and get a real job with a PhD in applied math. Here's a small example for you: Carl de Boor, whom I think of as Mr. Spline, did a lot of work for the automotive industry in D... | You might get several possible reactions.
* That's great, industry needs more people with solid academic training and it's our role to provide the educated workforce that's needed in our competitive industrial economy.
* You're being naive. Do you really think you will be more employable in industry if you have a PhD?... |
56,815,603 | I've been trying to code this app using Flutter and I want to make a Dropdown Button which displays the values received from a JSON response by an API made with Django.
The JSON response is as follows,
```
[{"name": "FC1", "username": "admin"}, {"name": "FC2", "username": "admin"}]
```
This is the Object class used... | 2019/06/29 | [
"https://Stackoverflow.com/questions/56815603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10045858/"
] | You have to set two things first as per **@saed's** answer
```
items: snapshot.data.map((fc) =>
DropdownMenuItem<String>(
child: Text(fc.name),
value: fc.name,
)
).toList();
```
and Second thing at `FutureBuilder` set type like
```
FutureBuilder<List<FoodCourt>>(..... Your code
``` | Your items is not a list use this code instead :
```
items: snapshot.data.map((fc) =>
DropdownMenuItem<String>(
child: Text(fc.name),
value: fc.name,
)
).toList();
``` |
130,017 | I’m thinking of buying a Sony A7c, but I’m concerned about the flash sync speed and max shutter speed . The flash sync speed is 1/160 and max shutter speed is 1/4000. From what I’ve read and understood, 1/160, that’s the fastest shutter that I can use with a flash . But then I watched this video <https://youtu.be/vEnAh... | 2022/08/13 | [
"https://photo.stackexchange.com/questions/130017",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/20752/"
] | >
> Can I use a flash on a Sony a7c that, during bright daylight I would
> be able to make the background black/low key (like a black wall - the
> ambient exposure ) while the subject to be correctly exposed ?
>
>
>
Assuming full sun falling on the subject and the wall? With a *really big* flash (like a 600-1200 W... | It is possible using a flash with high speed sync. High Speed Sync (HSS) allows faster shutter speeds in exchange for delivering less power for the increased period of time required to evenly expose a picture using a slit shutter configuration rather than firing when the shutter is fully open.
However, to achieve the ... |
130,017 | I’m thinking of buying a Sony A7c, but I’m concerned about the flash sync speed and max shutter speed . The flash sync speed is 1/160 and max shutter speed is 1/4000. From what I’ve read and understood, 1/160, that’s the fastest shutter that I can use with a flash . But then I watched this video <https://youtu.be/vEnAh... | 2022/08/13 | [
"https://photo.stackexchange.com/questions/130017",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/20752/"
] | >
> Can I use a flash on a Sony a7c that, during bright daylight I would
> be able to make the background black/low key (like a black wall - the
> ambient exposure ) while the subject to be correctly exposed ?
>
>
>
Assuming full sun falling on the subject and the wall? With a *really big* flash (like a 600-1200 W... | Maximum flash sync speed is about the camera shutter, not about the flash. Your Sony model has a focal plane shutter, meaning any and every shutter speed takes about the 1/160 second for it to fully open. The flash has to wait until the shutter is fully open, or it will see the shutter partially open making some of the... |
40,121,822 | How can I parse the foll. in python to extract the year:
```
'years since 1250-01-01 0:0:0'
```
The answer should be 1250 | 2016/10/19 | [
"https://Stackoverflow.com/questions/40121822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/308827/"
] | There are all sorts of ways to do it, here are several options:
* [`dateutil` parser](https://pypi.python.org/pypi/python-dateutil) in a "fuzzy" mode:
```
In [1]: s = 'years since 1250-01-01 0:0:0'
In [2]: from dateutil.parser import parse
In [3]: parse(s, fuzzy=True).year # resulting year would be an integer
Out[... | You can use a regex with a capture group around the four digits, while also making sure you have a particular pattern around it. I would probably look for something that:
* 4 digits and a capture `(\d{4})`
* hyphen `-`
* two digits `\d{2}`
* hyphen `-`
* two digits `\d{2}`
Giving: `(\d{4})-\d{2}-\d{2}`
Demo:
```
>>... |
40,121,822 | How can I parse the foll. in python to extract the year:
```
'years since 1250-01-01 0:0:0'
```
The answer should be 1250 | 2016/10/19 | [
"https://Stackoverflow.com/questions/40121822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/308827/"
] | There are all sorts of ways to do it, here are several options:
* [`dateutil` parser](https://pypi.python.org/pypi/python-dateutil) in a "fuzzy" mode:
```
In [1]: s = 'years since 1250-01-01 0:0:0'
In [2]: from dateutil.parser import parse
In [3]: parse(s, fuzzy=True).year # resulting year would be an integer
Out[... | The following regex should make the four digit year available as the first capture group:
```
^.*\(d{4})-\d{2}-\d{2}.*$
``` |
40,121,822 | How can I parse the foll. in python to extract the year:
```
'years since 1250-01-01 0:0:0'
```
The answer should be 1250 | 2016/10/19 | [
"https://Stackoverflow.com/questions/40121822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/308827/"
] | You can use a regex with a capture group around the four digits, while also making sure you have a particular pattern around it. I would probably look for something that:
* 4 digits and a capture `(\d{4})`
* hyphen `-`
* two digits `\d{2}`
* hyphen `-`
* two digits `\d{2}`
Giving: `(\d{4})-\d{2}-\d{2}`
Demo:
```
>>... | The following regex should make the four digit year available as the first capture group:
```
^.*\(d{4})-\d{2}-\d{2}.*$
``` |
55,633 | I have search a lot but cannot find any solution for my problem.
I when i entered the search term to the search box of my website, it goes to `mysite.com/search/search+term`. However, the result page does not have meta keywords and meta description. I trying to find way to add these values into the header of the resul... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55633",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17226/"
] | First of all you probably created an isolated file that is not under the umbrella of WP files. That's why you are not getting $wpdb. I guess you may not following the general rules/conventions of theme development. my question is now how are you accessing the file?
whatever, if you include the wp\_config.php in your ... | ```
require_once( 'path/to/wordpress/wp-includes/wp-db.php' );
if ( file_exists( 'path/to/wordpress/wp-content/db.php' ) )
require_once( 'path/to/wordpress/wp-content/db.php' );
$wpdb = new wpdb( 'user', 'password', 'database', 'host' );
```
To see how WordPress initialize it, see wp-includes/load.php, line 326. |
55,633 | I have search a lot but cannot find any solution for my problem.
I when i entered the search term to the search box of my website, it goes to `mysite.com/search/search+term`. However, the result page does not have meta keywords and meta description. I trying to find way to add these values into the header of the resul... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55633",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17226/"
] | ```
require_once( 'path/to/wordpress/wp-includes/wp-db.php' );
if ( file_exists( 'path/to/wordpress/wp-content/db.php' ) )
require_once( 'path/to/wordpress/wp-content/db.php' );
$wpdb = new wpdb( 'user', 'password', 'database', 'host' );
```
To see how WordPress initialize it, see wp-includes/load.php, line 326. | First, notice what user HungryCoder is saying is correct:
[your file, is not being liked to WordPress](https://wordpress.stackexchange.com/a/55632/45567)
One possible solution, that will work on your dev, and Linux servers is:
```
include( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php');
``` |
55,633 | I have search a lot but cannot find any solution for my problem.
I when i entered the search term to the search box of my website, it goes to `mysite.com/search/search+term`. However, the result page does not have meta keywords and meta description. I trying to find way to add these values into the header of the resul... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55633",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17226/"
] | ```
require_once( 'path/to/wordpress/wp-includes/wp-db.php' );
if ( file_exists( 'path/to/wordpress/wp-content/db.php' ) )
require_once( 'path/to/wordpress/wp-content/db.php' );
$wpdb = new wpdb( 'user', 'password', 'database', 'host' );
```
To see how WordPress initialize it, see wp-includes/load.php, line 326. | Excellent solution is:
```
my_wpdb('test','pass', 'database', 'host', '../path/to/wp/');
```
function
```
function my_wpdb($user, $pass, $db, $host, $path_to_root= '/../../../../../../', $run_wp_config=true){
$path_to_wp= dirname(__DIR__) .$path_to_root;
//execute wp-config, if not run already
if($exec_... |
55,633 | I have search a lot but cannot find any solution for my problem.
I when i entered the search term to the search box of my website, it goes to `mysite.com/search/search+term`. However, the result page does not have meta keywords and meta description. I trying to find way to add these values into the header of the resul... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55633",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17226/"
] | ```
require_once( 'path/to/wordpress/wp-includes/wp-db.php' );
if ( file_exists( 'path/to/wordpress/wp-content/db.php' ) )
require_once( 'path/to/wordpress/wp-content/db.php' );
$wpdb = new wpdb( 'user', 'password', 'database', 'host' );
```
To see how WordPress initialize it, see wp-includes/load.php, line 326. | Since immediately after solving this issue begins a new one - where to PUT the initialization (it's simple, but still if you don't know this, you may do some nasty things instead - like trying to modify `wp-db.php`). The answer is kind of implicitly hidden in @sorich87's answer, so just let's add it here explicitly:
C... |
55,633 | I have search a lot but cannot find any solution for my problem.
I when i entered the search term to the search box of my website, it goes to `mysite.com/search/search+term`. However, the result page does not have meta keywords and meta description. I trying to find way to add these values into the header of the resul... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55633",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17226/"
] | First of all you probably created an isolated file that is not under the umbrella of WP files. That's why you are not getting $wpdb. I guess you may not following the general rules/conventions of theme development. my question is now how are you accessing the file?
whatever, if you include the wp\_config.php in your ... | First, notice what user HungryCoder is saying is correct:
[your file, is not being liked to WordPress](https://wordpress.stackexchange.com/a/55632/45567)
One possible solution, that will work on your dev, and Linux servers is:
```
include( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php');
``` |
55,633 | I have search a lot but cannot find any solution for my problem.
I when i entered the search term to the search box of my website, it goes to `mysite.com/search/search+term`. However, the result page does not have meta keywords and meta description. I trying to find way to add these values into the header of the resul... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55633",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17226/"
] | First of all you probably created an isolated file that is not under the umbrella of WP files. That's why you are not getting $wpdb. I guess you may not following the general rules/conventions of theme development. my question is now how are you accessing the file?
whatever, if you include the wp\_config.php in your ... | Excellent solution is:
```
my_wpdb('test','pass', 'database', 'host', '../path/to/wp/');
```
function
```
function my_wpdb($user, $pass, $db, $host, $path_to_root= '/../../../../../../', $run_wp_config=true){
$path_to_wp= dirname(__DIR__) .$path_to_root;
//execute wp-config, if not run already
if($exec_... |
55,633 | I have search a lot but cannot find any solution for my problem.
I when i entered the search term to the search box of my website, it goes to `mysite.com/search/search+term`. However, the result page does not have meta keywords and meta description. I trying to find way to add these values into the header of the resul... | 2012/06/18 | [
"https://wordpress.stackexchange.com/questions/55633",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17226/"
] | First of all you probably created an isolated file that is not under the umbrella of WP files. That's why you are not getting $wpdb. I guess you may not following the general rules/conventions of theme development. my question is now how are you accessing the file?
whatever, if you include the wp\_config.php in your ... | Since immediately after solving this issue begins a new one - where to PUT the initialization (it's simple, but still if you don't know this, you may do some nasty things instead - like trying to modify `wp-db.php`). The answer is kind of implicitly hidden in @sorich87's answer, so just let's add it here explicitly:
C... |
61,997,774 | The gallery and the camera are correctly opened in debug (both with emulator and real device), the package asks for permissions (i set them up in the android manifest) and after accepting them the gallery opens. without warnings/errors. When I release the app with `flutter build apk --release` and test it on my phone (... | 2020/05/25 | [
"https://Stackoverflow.com/questions/61997774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12558470/"
] | The solution in my case was to run `flutter run --release` (with the device connected) and the image picker worked fine. The app is automatically installed on your device but you can find the working apk usually there `build\app\outputs\apk\release\app-release.apk` (the console will print the path).
Thanks to the comm... | I thinks this issue is mainly because of the compiledsdkversion, as the image\_picker compiledsdkversion is 28. For android 10 it should require the compiledsdkversion 29 |
5,377,782 | The following regular expression will match "Saturday" or "Sunday" : `(?:(Sat)ur|(Sun))day`
But in one case backreference 1 is filled while backreference 2 is empty and in the other case vice-versa.
PHP (pcre) provides a nice operator "?|" that circumvents this problem. The previous regex would become `(?|(Sat)ur|(Su... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5377782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/363573/"
] | .NET doesn't support the branch-reset operator, but it does support named groups, and it lets you reuse group names without restriction (something no other flavor does, AFAIK). So you could use this:
```
(?:(?<abbr>Sat)ur|(?<abbr>Sun))day
```
...and the abbreviated name will be stored in `Match.Groups["abbr"]`. | should be possible to concat backref1 and backref2.
As one of each is always empty and a string concat with empty is still the same string...
with your regex `(?:(Sat)ur|(Sun))day` and replacement `$1$2`
you get `Sat` for `Saturday` and `Sun` for `Sunday`.
```
regex (?:(Sat)ur|(Sun))day
input | backref1 _... |
5,377,782 | The following regular expression will match "Saturday" or "Sunday" : `(?:(Sat)ur|(Sun))day`
But in one case backreference 1 is filled while backreference 2 is empty and in the other case vice-versa.
PHP (pcre) provides a nice operator "?|" that circumvents this problem. The previous regex would become `(?|(Sat)ur|(Su... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5377782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/363573/"
] | should be possible to concat backref1 and backref2.
As one of each is always empty and a string concat with empty is still the same string...
with your regex `(?:(Sat)ur|(Sun))day` and replacement `$1$2`
you get `Sat` for `Saturday` and `Sun` for `Sunday`.
```
regex (?:(Sat)ur|(Sun))day
input | backref1 _... | You can use the branch-reset operator:
```
(?|foo(bar)|still(life)|(like)so)
```
That will only set group one no matter which branch matches. |
5,377,782 | The following regular expression will match "Saturday" or "Sunday" : `(?:(Sat)ur|(Sun))day`
But in one case backreference 1 is filled while backreference 2 is empty and in the other case vice-versa.
PHP (pcre) provides a nice operator "?|" that circumvents this problem. The previous regex would become `(?|(Sat)ur|(Su... | 2011/03/21 | [
"https://Stackoverflow.com/questions/5377782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/363573/"
] | .NET doesn't support the branch-reset operator, but it does support named groups, and it lets you reuse group names without restriction (something no other flavor does, AFAIK). So you could use this:
```
(?:(?<abbr>Sat)ur|(?<abbr>Sun))day
```
...and the abbreviated name will be stored in `Match.Groups["abbr"]`. | You can use the branch-reset operator:
```
(?|foo(bar)|still(life)|(like)so)
```
That will only set group one no matter which branch matches. |
43,790 | I read -
total fixed and variable length data are still limited to 8019 bytes total
But my data can possibly be more than this. What happens if it's more. Does it still store the data correctly?
Also can someone tell me how I can store for example over 4000 bytes of text data in a column. Is that possible? | 2013/06/04 | [
"https://dba.stackexchange.com/questions/43790",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/-1/"
] | Data exceeding the total of 8060 bytes will be pushed over to an 'overflow page', increasing the amount of pages required to be read from the buffer pool. | You can use `varchar(max)`, `nvarchar(max)` datatypes to store such data |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.