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 |
|---|---|---|---|---|---|
12,532,398 | I'm trying for hours now to get the following working:
I'd like to have three divs in an container div.
1. They need to be stacked vertically (topDiv, middleDiv, bottomDiv)
2. the topDiv should be 20px tall (fixed)
3. the middleDiv should take the rest of space left (like \* in a table or \vfill in LaTeX)
4. the bott... | 2012/09/21 | [
"https://Stackoverflow.com/questions/12532398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/638344/"
] | It's easy with [Flexbox](http://dev.w3.org/csswg/css3-flexbox/#flex-direction-property) but it is still being developed and only really works in Chrome at the moment.
Otherwise, you can use [`* {box-sizing: border-box;}`](http://paulirish.com/2012/box-sizing-border-box-ftw/) to make your life easier. There is even an ... | I did something very similar on this website:
<http://www.probusllandudno.org.uk/>
click the dinners 2012 link (and, if using FF web developer, u can use view generated source)
The main points are putting the divs in order in the doc, assigning fixed width (in my case) or width=100%, top and botom divs have fixed he... |
68,545,514 | I have a time tracking project in React. What I'm trying to do is the following:
* in each project I have a form to add activities and time;
* I want to get the amount of time to be added and displayed at the end like a total - so if I have two activities, one with 2 hours, another with 3, "Total" should display the s... | 2021/07/27 | [
"https://Stackoverflow.com/questions/68545514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16393024/"
] | `context.times` is an array containing activities, right? Well, in javascript, `.length` of an array represents the length of the array itself, so it represents how many activities you have. Javascript has no way to know what you're trying to sum or achieve.
You need to sum the durations yourself by iterating the arra... | You can use `.reduce()` method of Array, something like
```
const timesSum = context.times.reduce((acc, {time}) => {
return acc + time
}, 0)
```
Take into account that I assumed `time` as numeric type. In real life you may need to cast time to number on manipulate it's value the way you need. Maybe you'll have to ... |
22,281,180 | How do you write a runtime-dynamic function call in C which would take a variable number of arguments during runtime?
For example, consider `long sum(int count, ...);`, which returns the sum of the values of the (integer) arguments passed to it.
```
$./a.out 1 2 3 4
10
$./a.out 1 2 3 4 -5
5
``` | 2014/03/09 | [
"https://Stackoverflow.com/questions/22281180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2410205/"
] | You just can't. Alas, you only can call a variadic function with a given number of arguments, but not with an array.
Depending on the architecture, you can call the function "behind" the variadic one - the one which takes a `va_list`, provided there is one, such as `vprintf()` "behind" `printf()` - with the array's ad... | The signature of main is
```
int main(int argc, char *argv[])
```
You can then access the arguments that are provided when the program.
Just parse those. Do the maths. Spit out the answer |
22,281,180 | How do you write a runtime-dynamic function call in C which would take a variable number of arguments during runtime?
For example, consider `long sum(int count, ...);`, which returns the sum of the values of the (integer) arguments passed to it.
```
$./a.out 1 2 3 4
10
$./a.out 1 2 3 4 -5
5
``` | 2014/03/09 | [
"https://Stackoverflow.com/questions/22281180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2410205/"
] | You just can't. Alas, you only can call a variadic function with a given number of arguments, but not with an array.
Depending on the architecture, you can call the function "behind" the variadic one - the one which takes a `va_list`, provided there is one, such as `vprintf()` "behind" `printf()` - with the array's ad... | Yes you can! Oh how the stack overflow is full of such nay-sayers.
Look at this library: <http://www.dyncall.org>
You can build up dynamic argument lists, and then execute an arbitrary function. |
46,949,486 | How do I sum all products of the columns in table with another table?
To make it more clear, look at the image attached. I want the column `Cost` of table `TableA` to be equal to
```
=sum([A]*Lookup([[A];[#Headers]]; Parameters[What]; Parameters[Cost]); ....)
```
And so on for every column of `TableA`.
I am how... | 2017/10/26 | [
"https://Stackoverflow.com/questions/46949486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/190281/"
] | TLDR: the only tables which could be cleared are cache tables, but they cost you performance and will build up again soon.
you might clear these tables and these propably will build up again, but you will suffer.
* tx\_realurl\_urlcache - here realurl stores the generated urls, if you truncate it the url decoding m... | Do not delete the table! You can truncate some tables.
If you want to clean up some cache just flush all Typo3 caches in backend or just use the 'clear all cache' button inside the typo3-install tool. |
212,124 | I'm desperately trying to find the solution of this simple ODE:
$$\frac{dx}{dt}= C +\frac{x-a\_1}{b\_1} + \frac{x-a\_2}{b\_2} $$
Where C is a constant.
Someone has a clue?
Thanks for the feedback already:
Ok some more info: I think I can solve this by substituting $x$ by $e^{t}$.
In that case I get:
$$ e^t = C+\frac... | 2012/10/13 | [
"https://math.stackexchange.com/questions/212124",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/44558/"
] | **Hints**:
* Write the equation in the form: $x' + c\_1 x = c\_2$.
* Use an integrating factor or notice that the equation is separable.
Don't forget to handle any special cases when calculating $c\_1$ and $c\_2$. | This is a time-invariant linear ODE with constant coefficients. The solution is therefore $x(t) = a+be^{\lambda t}$ for some $a,b,\lambda \in \mathbb{R}$. By substituting that for $x$ in your ODE and comparing the coefficients you can easily find the particular values of $a,b,\lambda$. |
57,993 | I find it interesting that the idea of combining bracketed exposures to increase the recorded range of brightness has gone mainstream (known as HDR) to, the point where it is built into the camera's jpeg rendering. (Aside: now that cameras are powerful enough to do that, sensor latitude has improved so we don't need to... | 2015/01/02 | [
"https://photo.stackexchange.com/questions/57993",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/33948/"
] | If you have a reasonable statistical model of the noise sources then yes, you can do better than median filtering, but not by that much. It's much easier to boost performance by simply shooting more images.
With regards to exploiting the slight misalignment of images, this can be used to increase resolution, the techn... | There is software that does what you are looking for. Fundamentally, averaging is the most effective way to reduce noise and increase signal strength. When you have no other algorithmic capability to identify and reject outliers, a median is usually the best approach. However, median will usually not give you the best ... |
61,141,819 | I have a query related to summing of value based on group of data available in a csv file.
My file is test.csv file and data looks like below where the first line is a header, followed by 6 lines of data.
```
EntryId,datasource,Id,bookID,securId,Type,transfer,event,ActivityType,curr_code,sourceSystemDate,actualDate,a... | 2020/04/10 | [
"https://Stackoverflow.com/questions/61141819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10013411/"
] | Here is your solution, hopefully will fix
No need of Formgroup to be emit without a specific requirement. In your case, there is nothing
Create your trip formgroup inside Create component
```
export class CreateCustomerComponent implements OnInit {
constructor(private fb: FormBuilder, private createService: Cr... | Error happen because `addControl` assume you pass in `formControl` but you pass in JSON value. your child component emit form value instead of `FormGroup`, your parent component `tripFormChangeEvent` define parameter as `FormGroup` too, change your child component emit to `this.onFormGroupChange.emit(this.tripForm)`. |
29,558,015 | we designed the WebService application in vs 2010 using AWS SDK toolkit which connect to AWS SNS Service.
It Perfectly works when we directly run from VS 2010 Development studio,
but when we publish webservice to Local IIS or dedicated webserver it fails with
following error Messages.
```
Amazon.Runtime.AmazonService... | 2015/04/10 | [
"https://Stackoverflow.com/questions/29558015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2002511/"
] | Create a credentials file at any path where you can access this path from web service application
e.g. C:\awsfile\credentials
but remember don't give any extension this file
File should contains following data.
```
[default]
aws_access_key_id=[your_access_key]
aws_secret_access_key=[your_secret_key]
```
After this y... | In AWS Explorer for Visual Studio you can create user profiles that give you different permissions on AWS, then you can choose which profile you want to use in AWS Explorer. These profiles are available only to your Windows user account, if anyone else uses your computer then they will have to create their own profiles... |
41,514,743 | I am working on a school project where we are supposed to save user inputted data to a database we created within the project. I created a database, called 'db1', in the App\_Data folder of my project, and created a table along with it, called 'Video\_Games.' My code is somewhat of a Frankenstein's Monster, where it is... | 2017/01/06 | [
"https://Stackoverflow.com/questions/41514743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6501342/"
] | Here is what I ended up doing - completely naked and without any test/check/exception-handling:
```
from importlib import import_module
from django.utils.translation import get_language
fm = import_module('.formats', 'django.conf.locale.%s' % get_language())
try:
return getattr(fm, 'DECIMAL_SEPARATOR')
except A... | Django has [native localization](https://docs.djangoproject.com/en/1.10/topics/i18n/formatting/) built in for both templates and forms.
Where are you determining this?
In a template:
>
> `{% load l10n %}{% localize on %}{{ value }}{% endlocalize %}`
>
>
>
Or in a form:
>
> To enable a form field to localize i... |
41,514,743 | I am working on a school project where we are supposed to save user inputted data to a database we created within the project. I created a database, called 'db1', in the App\_Data folder of my project, and created a table along with it, called 'Video\_Games.' My code is somewhat of a Frankenstein's Monster, where it is... | 2017/01/06 | [
"https://Stackoverflow.com/questions/41514743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6501342/"
] | Here is what I ended up doing - completely naked and without any test/check/exception-handling:
```
from importlib import import_module
from django.utils.translation import get_language
fm = import_module('.formats', 'django.conf.locale.%s' % get_language())
try:
return getattr(fm, 'DECIMAL_SEPARATOR')
except A... | ```
from django.util.format import get_format #or get_format_lazy
from django.utils.translation import get_language
decimal_seperator = get_format('DECIMAL_SEPARATOR',get_language())
```
Feel free to use 'DATE\_FORMAT', 'THOUSAND\_SEPARATOR','NUMBER\_GROUPING' etc instead of 'DECIMAL\_SEPARATOR'
I got import error ... |
70,885,037 | This is my table : [](https://i.stack.imgur.com/6w5lR.jpg)
I am taking an online course on Udemy in SQL, the video has this code and it is running. I do not know why I get error below when I run it. I appreciate any help.
the code is supposed to retur... | 2022/01/27 | [
"https://Stackoverflow.com/questions/70885037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16354132/"
] | These sorts of questions come up often, alas SMT solvers are just not a good match with quantifier heavy problems. The best you have is specifying patterns (See [E-matching based quantifier instantiation](https://theory.stanford.edu/%7Enikolaj/programmingz3.html#sec-e-matching-based-quantifier-instantiation) for detail... | Given the current formulation of your fragment, you're still in an undecidable fragment of FOL. If you could restrict what your P are allowed to talk about then you might end up in a decidable fragment (e.g. monadic, guarded, effectively propositional, there are a few).
Besides SMT solvers and proof assistants, there ... |
48,223,571 | I am new to GIT and not able to understand how the second rebase command resulted in merge issue:
```
$ git rebase origin/develop
Current branch feature/featurename is up to date.
$ git fetch
remote: Microsoft (R) Visual Studio (R) Team Services
remote: We noticed you're using an older version of Git. For the best ex... | 2018/01/12 | [
"https://Stackoverflow.com/questions/48223571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/304974/"
] | Git just told you in its output what happened:
```
Current branch feature/featurename is up to date.
```
This means that, at the moment, before fetch, your branch indeed is based on origin/development. So your history looks something like this:
```
feature/featurename
/
-o---o
\
origin/development
```
... | >
> I understand that both rebase and fetch will refer to `origin/develop` ...
>
>
>
This isn't quite right.
What `git fetch` does is connect *your* Git (which has an independent copy of all of its commits—your own commits and everyone else's commits as of the last time you connected your Git to all the other Git... |
50,301 | I am creating a Document Set for a library using powershell and that document set contains some mandatory managed metadata fields. I am able to create document set but how can I insert data into those managed metadata fields at runtime? | 2012/10/30 | [
"https://sharepoint.stackexchange.com/questions/50301",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/11396/"
] | You have to connect to the term store and then construct a TaxonomyFieldValue and then use the target field's SetFieldValue() method to assign the value.
See here: <http://social.technet.microsoft.com/Forums/da-DK/sharepointadminprevious/thread/4c63fff1-8681-42a1-9fd2-256f1f80935b>
regards,
KS | Hope this helps someone.
You have to get a reference to the Managed metadata item from term store as shown below
```
$someTerm = $term.Terms | where-object {$_.Name -eq "SomeTerm" }
```
Create the document set as shown below
```
[Hashtable]$docSetProperties = @{}
$newDocumentSet=Microsoft.Office.DocumentManagement... |
50,301 | I am creating a Document Set for a library using powershell and that document set contains some mandatory managed metadata fields. I am able to create document set but how can I insert data into those managed metadata fields at runtime? | 2012/10/30 | [
"https://sharepoint.stackexchange.com/questions/50301",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/11396/"
] | You have to connect to the term store and then construct a TaxonomyFieldValue and then use the target field's SetFieldValue() method to assign the value.
See here: <http://social.technet.microsoft.com/Forums/da-DK/sharepointadminprevious/thread/4c63fff1-8681-42a1-9fd2-256f1f80935b>
regards,
KS | Complete sample
```
$webUrl = "http://portaladdress.local"
$inputDir = "C:\sampledata"
$spWeb = Get-SPWeb $webUrl
$spsite = $spWeb.Site
$docLibrary = $spWeb.Lists["DocumentLibraryListName"]
$spFolder = $spWeb.GetFolder($docLibrary.rootFolder.URL + "/")
$taxonomySession = Get-SPTaxonomySession -Site $spsite
$taxono... |
50,301 | I am creating a Document Set for a library using powershell and that document set contains some mandatory managed metadata fields. I am able to create document set but how can I insert data into those managed metadata fields at runtime? | 2012/10/30 | [
"https://sharepoint.stackexchange.com/questions/50301",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/11396/"
] | Hope this helps someone.
You have to get a reference to the Managed metadata item from term store as shown below
```
$someTerm = $term.Terms | where-object {$_.Name -eq "SomeTerm" }
```
Create the document set as shown below
```
[Hashtable]$docSetProperties = @{}
$newDocumentSet=Microsoft.Office.DocumentManagement... | Complete sample
```
$webUrl = "http://portaladdress.local"
$inputDir = "C:\sampledata"
$spWeb = Get-SPWeb $webUrl
$spsite = $spWeb.Site
$docLibrary = $spWeb.Lists["DocumentLibraryListName"]
$spFolder = $spWeb.GetFolder($docLibrary.rootFolder.URL + "/")
$taxonomySession = Get-SPTaxonomySession -Site $spsite
$taxono... |
184,298 | So, the microstructure of abalone shells is 95% calcium carbonate, such as aragonite, tiles and 5% organic polymer that binds them together. This binding fails in a graceful manner, allowing the shell to take a lot of punishment before shattering.
This composite material is around 3,000 times more resistant to fractur... | 2020/08/24 | [
"https://worldbuilding.stackexchange.com/questions/184298",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/32097/"
] | In essence, if I'm understanding correctly, you are looking for a biological material that exhibits a high degree of toughness. To achieve this, we could look at some very strong materials that could replace (or at least compete with) our standard bulletproofing materials. One of these is [spider silk](https://inchemis... | One possibility could be a [Boron Carbide](https://en.wikipedia.org/wiki/Boron#High-hardness_and_abrasive_compounds), specifically cubic-BC5, which has a Vickers hardness of 71 GPa and a fracture toughness of 9.5 MPa m½.
Both of which are higher than the values for hydroxyapatite (5 GPa and 1.2 MPa m½, I. Hervas, *Fra... |
58,263,267 | I need to access the custom settings passed from the CLI using:
`-s SETTING_NAME="SETTING_VAL"`
**from the \_\_init\_\_() method of the spider class**.
`get_project_settings()` allows me to access only the static settings.
The docs explain how you can access those custom settings by from a pipeline setting up a new ... | 2019/10/07 | [
"https://Stackoverflow.com/questions/58263267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4764353/"
] | Just use [`settings.get`](https://docs.scrapy.org/en/latest/topics/api.html#scrapy.settings.BaseSettings.get) e.g.
```
print(self.settings.get('SETTING_NAME'))
```
will print
```
SETTING_VAL
```
If you want to access a setting in your spider `__init__` you have a couple of options. If you command-line options is ... | The answer of @tomjn works, I just want to point out that if you are using extensions or middlewares which need the crawler object, you need to alter his factory method this way:
```
@classmethod
def from_crawler(cls, crawler, *args, **kwargs):
obj = cls(
*args,
my_setting=crawler.settings.get("MY_... |
58,263,267 | I need to access the custom settings passed from the CLI using:
`-s SETTING_NAME="SETTING_VAL"`
**from the \_\_init\_\_() method of the spider class**.
`get_project_settings()` allows me to access only the static settings.
The docs explain how you can access those custom settings by from a pipeline setting up a new ... | 2019/10/07 | [
"https://Stackoverflow.com/questions/58263267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4764353/"
] | Just use [`settings.get`](https://docs.scrapy.org/en/latest/topics/api.html#scrapy.settings.BaseSettings.get) e.g.
```
print(self.settings.get('SETTING_NAME'))
```
will print
```
SETTING_VAL
```
If you want to access a setting in your spider `__init__` you have a couple of options. If you command-line options is ... | None of the responses work when using `CrawlSpider`, because some methods such as [`_follow_links`](https://github.com/scrapy/scrapy/blob/7b1bc9b7fefce60c51f89f7ed47e1d172e43b2a7/scrapy/spiders/crawl.py#L138) will be missing.
The following code works:
```py
@classmethod
def from_crawler(cls, crawler, *args, **kwargs)... |
58,263,267 | I need to access the custom settings passed from the CLI using:
`-s SETTING_NAME="SETTING_VAL"`
**from the \_\_init\_\_() method of the spider class**.
`get_project_settings()` allows me to access only the static settings.
The docs explain how you can access those custom settings by from a pipeline setting up a new ... | 2019/10/07 | [
"https://Stackoverflow.com/questions/58263267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4764353/"
] | None of the responses work when using `CrawlSpider`, because some methods such as [`_follow_links`](https://github.com/scrapy/scrapy/blob/7b1bc9b7fefce60c51f89f7ed47e1d172e43b2a7/scrapy/spiders/crawl.py#L138) will be missing.
The following code works:
```py
@classmethod
def from_crawler(cls, crawler, *args, **kwargs)... | The answer of @tomjn works, I just want to point out that if you are using extensions or middlewares which need the crawler object, you need to alter his factory method this way:
```
@classmethod
def from_crawler(cls, crawler, *args, **kwargs):
obj = cls(
*args,
my_setting=crawler.settings.get("MY_... |
53,129,004 | I am a python beginner, the situation is:
**In test.py**:
```
import numpy as np
import pandas as pd
from numpy import *
def model(file):
import numpy as np
import pandas as pd
data0 = pd.ExcelFile(file)
data = data0.parse('For Stata')
data1 = data.values
varnames = list(data)
for i ... | 2018/11/03 | [
"https://Stackoverflow.com/questions/53129004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10599296/"
] | ID's have to be **unique**. Give each *carousel* and each *thumbcarousel* an ID of its own and you're good to go. Use classes for styling them.
```css
.product-slider {
padding: 45px;
}
.product-slider .carousel {
border: 4px solid #1089c0;
margin: 0;
}
.product-slider .thumbcarousel {
margin: 12px 0... | It is the issue of duplicated ids. All the carousels have id="carousel". Make it unique like this,
```
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="h... |
4,090,867 | Want to prove that $$\arctan(x) = \frac{\pi}{2} - \frac{1}{x} + O\left(\frac{1}{x^3}\right) \ \text{as}~~~ x \to +\infty$$
Wolfram says that it's true but I'm trying to find some formal prove of this equality.
Here's what i found about that:
We know that $\arctan(x) = \frac{\pi}{2} - \int\_x^{+\infty}\frac{dt}{1 + t... | 2021/04/05 | [
"https://math.stackexchange.com/questions/4090867",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/840330/"
] | Welcome to MSE!
You have the exact right idea!
Why not let your holes be $\{1,2\}$, $\{3,4\}$, $\{5,6\}$, $\{7,8\}$, and $\{9,10\}$?
Then you're guaranteed $2$ pigeons in the same hole, but the sum of two consecutive numbers is odd.
---
I hope this helps ^\_^ | Let $n$ be even. Notice that there are $n/2$ even and odd numbers. (The problem is equivalent to choosing $n/2$+$1$ integers from [$n$]). So partition [$n$] into two sets, one containing all of the $n/2$ even numbers, and the other $n/2$ odd numbers. By the pigeonhole principle, there are two integers with opposite par... |
45,922,355 | When the date is NULL I want to display 'N/A', but if the date is not null I want to display the date in the dB. This is what I currently have and I get a DataType Mismatch in the THEN/ELSE expressions. I am assuming it is because I am trying to display a character in a date field.
```
SELECT
CASE WHEN created_at IS N... | 2017/08/28 | [
"https://Stackoverflow.com/questions/45922355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8328455/"
] | You can't mix data types.
```
SELECT COALESCE(CAST(created_at AS VARCHAR(100)),'NA') AS created_at
FROM example.example_id
```
Alternatively, if you are just concerned about presentation, you can just adjust your user preferences. ex. SQL Assistant -> Options -> Data Format -> then set 'Display this string for Nul... | Your assumption is correct: you can't mix a date(time) datatype with a varchar datatype. The solution is to cast the date to a varchar:
```
SELECT CASE WHEN created_at IS NULL THEN 'N/A'
ELSE CAST (created_at as char(8) format 'YYYYMMDD')
END AS created_at
FROM example.example_id
```
the conver... |
45,922,355 | When the date is NULL I want to display 'N/A', but if the date is not null I want to display the date in the dB. This is what I currently have and I get a DataType Mismatch in the THEN/ELSE expressions. I am assuming it is because I am trying to display a character in a date field.
```
SELECT
CASE WHEN created_at IS N... | 2017/08/28 | [
"https://Stackoverflow.com/questions/45922355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8328455/"
] | Instead of CASE you can use COALESCE, too, but you still need to convert the date to a string first:
```
Coalesce(To_Char(created_at, 'yyyy-mm-dd'), 'N/A')
``` | Your assumption is correct: you can't mix a date(time) datatype with a varchar datatype. The solution is to cast the date to a varchar:
```
SELECT CASE WHEN created_at IS NULL THEN 'N/A'
ELSE CAST (created_at as char(8) format 'YYYYMMDD')
END AS created_at
FROM example.example_id
```
the conver... |
45,922,355 | When the date is NULL I want to display 'N/A', but if the date is not null I want to display the date in the dB. This is what I currently have and I get a DataType Mismatch in the THEN/ELSE expressions. I am assuming it is because I am trying to display a character in a date field.
```
SELECT
CASE WHEN created_at IS N... | 2017/08/28 | [
"https://Stackoverflow.com/questions/45922355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8328455/"
] | You can't mix data types.
```
SELECT COALESCE(CAST(created_at AS VARCHAR(100)),'NA') AS created_at
FROM example.example_id
```
Alternatively, if you are just concerned about presentation, you can just adjust your user preferences. ex. SQL Assistant -> Options -> Data Format -> then set 'Display this string for Nul... | Simply you can try
```
SELECT CAST(VARCHAR, ISNULL(Created_at, 'N/A')) As 'Created_at'
FROM example.example_id
``` |
45,922,355 | When the date is NULL I want to display 'N/A', but if the date is not null I want to display the date in the dB. This is what I currently have and I get a DataType Mismatch in the THEN/ELSE expressions. I am assuming it is because I am trying to display a character in a date field.
```
SELECT
CASE WHEN created_at IS N... | 2017/08/28 | [
"https://Stackoverflow.com/questions/45922355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8328455/"
] | Instead of CASE you can use COALESCE, too, but you still need to convert the date to a string first:
```
Coalesce(To_Char(created_at, 'yyyy-mm-dd'), 'N/A')
``` | Simply you can try
```
SELECT CAST(VARCHAR, ISNULL(Created_at, 'N/A')) As 'Created_at'
FROM example.example_id
``` |
5,937,653 | I am currently working in Ubuntu9.10 - c++.
I need to define an generic object in a method. I have to define the method in .h file. How can I do it? I did the following:
*file.h*
```
class ana
{
//code
public:
template <class T> bool method (T &Data);
};
```
*file.cpp*
```
//code
template <class T>
bool ana::me... | 2011/05/09 | [
"https://Stackoverflow.com/questions/5937653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/726736/"
] | The usual problem. Have a look: <http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13>.
Just put everything into a header file.
file.hpp
```
class ana
{
//code
public:
template <class T> bool method (T &Data)
{
//code
}
};
```
Include this in your main.cpp and it should work fine... | 1. You forgot to build `file.cpp` into the binary.
2. You should put the function template definition in the header, anyway. |
5,937,653 | I am currently working in Ubuntu9.10 - c++.
I need to define an generic object in a method. I have to define the method in .h file. How can I do it? I did the following:
*file.h*
```
class ana
{
//code
public:
template <class T> bool method (T &Data);
};
```
*file.cpp*
```
//code
template <class T>
bool ana::me... | 2011/05/09 | [
"https://Stackoverflow.com/questions/5937653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/726736/"
] | The usual problem. Have a look: <http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13>.
Just put everything into a header file.
file.hpp
```
class ana
{
//code
public:
template <class T> bool method (T &Data)
{
//code
}
};
```
Include this in your main.cpp and it should work fine... | You need to change the definition of your `method()` method to be in the header file:
```
class ana
{
public:
template <class T>
bool method (T &Data)
{
// Do whatever you want in here
}
};
```
Check the following link out for a detailed explanation - <http://www.parashift.com/c++-faq-lite/te... |
5,937,653 | I am currently working in Ubuntu9.10 - c++.
I need to define an generic object in a method. I have to define the method in .h file. How can I do it? I did the following:
*file.h*
```
class ana
{
//code
public:
template <class T> bool method (T &Data);
};
```
*file.cpp*
```
//code
template <class T>
bool ana::me... | 2011/05/09 | [
"https://Stackoverflow.com/questions/5937653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/726736/"
] | The usual problem. Have a look: <http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13>.
Just put everything into a header file.
file.hpp
```
class ana
{
//code
public:
template <class T> bool method (T &Data)
{
//code
}
};
```
Include this in your main.cpp and it should work fine... | Just include cpp file in **main.cpp** like this: **#include "ana.cpp"** and you will not have errors. |
5,937,653 | I am currently working in Ubuntu9.10 - c++.
I need to define an generic object in a method. I have to define the method in .h file. How can I do it? I did the following:
*file.h*
```
class ana
{
//code
public:
template <class T> bool method (T &Data);
};
```
*file.cpp*
```
//code
template <class T>
bool ana::me... | 2011/05/09 | [
"https://Stackoverflow.com/questions/5937653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/726736/"
] | Putting function definitions together with declarations (in the header files itself) definitely helps and is the way of choice. But, in case you want to separate the function definitions, have the following lines at the end of the `.cpp` file. Its called `explicit instantiation`.This will take care of linker errors. I ... | 1. You forgot to build `file.cpp` into the binary.
2. You should put the function template definition in the header, anyway. |
5,937,653 | I am currently working in Ubuntu9.10 - c++.
I need to define an generic object in a method. I have to define the method in .h file. How can I do it? I did the following:
*file.h*
```
class ana
{
//code
public:
template <class T> bool method (T &Data);
};
```
*file.cpp*
```
//code
template <class T>
bool ana::me... | 2011/05/09 | [
"https://Stackoverflow.com/questions/5937653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/726736/"
] | Putting function definitions together with declarations (in the header files itself) definitely helps and is the way of choice. But, in case you want to separate the function definitions, have the following lines at the end of the `.cpp` file. Its called `explicit instantiation`.This will take care of linker errors. I ... | You need to change the definition of your `method()` method to be in the header file:
```
class ana
{
public:
template <class T>
bool method (T &Data)
{
// Do whatever you want in here
}
};
```
Check the following link out for a detailed explanation - <http://www.parashift.com/c++-faq-lite/te... |
5,937,653 | I am currently working in Ubuntu9.10 - c++.
I need to define an generic object in a method. I have to define the method in .h file. How can I do it? I did the following:
*file.h*
```
class ana
{
//code
public:
template <class T> bool method (T &Data);
};
```
*file.cpp*
```
//code
template <class T>
bool ana::me... | 2011/05/09 | [
"https://Stackoverflow.com/questions/5937653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/726736/"
] | Putting function definitions together with declarations (in the header files itself) definitely helps and is the way of choice. But, in case you want to separate the function definitions, have the following lines at the end of the `.cpp` file. Its called `explicit instantiation`.This will take care of linker errors. I ... | Just include cpp file in **main.cpp** like this: **#include "ana.cpp"** and you will not have errors. |
25,460,106 | I am trying to setup a Jersey RESTful service, the problem is that I am getting the following error when trying to do GET request to the following API: `http://localhost:8080/GroupAppServer/api/status`:
```
com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource ... | 2014/08/23 | [
"https://Stackoverflow.com/questions/25460106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1691423/"
] | You are calling your changeTextOnLoad function before the main.js file has loaded. Either put the function call in an onload event callback or put the include above the call
```
window.onload = function(){
var object = $('#text_object');
changeTextOnLoad(object);
};
//Or using addEventListener
window.addEventLis... | because main.js is another file, browser takes time to download it. But you run `changeTextOnLoad(object);` before that. |
40,839,832 | i am developing an app where facebook login is there . i am trying to get user information and send that to my server.i am using sdk 4.i am trying to use shared preference to save info but i have no idea about shared preference . This is my facebook login activity . this is launcher activity.
```
public class LoginAct... | 2016/11/28 | [
"https://Stackoverflow.com/questions/40839832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7197844/"
] | >
> Android SharedPreferences allows us to store private primitive
> application data in the form of key-value pair.For More details follow [this](http://androidopentutorials.com/android-sharedpreferences-tutorial-and-example/).
>
>
>
To read from shared preference use something like this.
```
String dateFromSha... | ```
SharedPreferences sharedPreferences;
SharedPreferences.Editor editor;
```
Write this code before going to intent.
```
sharedPreferences = getApplicationContext().getSharedPreferences("pref", MODE_PRIVATE);
editor = sharedPreferences.edit();
editor.putString("User_Name", f_name);
... |
40,839,832 | i am developing an app where facebook login is there . i am trying to get user information and send that to my server.i am using sdk 4.i am trying to use shared preference to save info but i have no idea about shared preference . This is my facebook login activity . this is launcher activity.
```
public class LoginAct... | 2016/11/28 | [
"https://Stackoverflow.com/questions/40839832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7197844/"
] | >
> Android SharedPreferences allows us to store private primitive
> application data in the form of key-value pair.For More details follow [this](http://androidopentutorials.com/android-sharedpreferences-tutorial-and-example/).
>
>
>
To read from shared preference use something like this.
```
String dateFromSha... | I know this type of question so many answer but still i am give this question's answer, I hope some one got the help. It's easy if we create method to handle all data.
When receive facebook JSON object then after do as follow.
```
try {
Bundle bFacebookData = getFacebookData(object);
progressDialog.dis... |
22,922,544 | I have a UINavigationController with a UIViewController (VC1) pushed onto it. VC1 contains a collectionView. When a user taps a cell, a child viewController (VC2) is added to VC1.
VC2 should support all orientations. Whereas VC1 only supports portrait orientation. In portrait mode, I want to be able to present VC2, r... | 2014/04/07 | [
"https://Stackoverflow.com/questions/22922544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/922200/"
] | So, this might not be what you need, but it seems like the presenting view controller maintains control of the shouldAutorotate call if your animated transition does not remove the presenting view controller's view. If you do remove the presenting view controller's view, then the control of the shouldAutorotate call mo... | Did you happen to implement `- (BOOL)shouldAutomaticallyForwardRotationMethods` on the parent controller and have it return NO?
You case may be more complex, since you support different rotations for the different parent and child view controllers, but this is a easy gotcha to miss. |
50,943,141 | i have some paragraphs. At first one of that should have red color and after click it should become black, and clicked one should become red. I need to change red each paragraph when it is clicked and remove the class when another one is clicked. I should do it with javascript
```js
var p = document.querySelectorAll("... | 2018/06/20 | [
"https://Stackoverflow.com/questions/50943141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9576063/"
] | Your code is good, just have a little logical problem :)
```js
var p = document.querySelectorAll("p");
for( var i = 0; i < p.length; i++ ){
p[i].addEventListener("click", makeRed);
p[0].classList.add("active");
}
function makeRed(){
if( this.classList.contains("active")){
this.classList.remove("active");
... | Try with below solution,
```js
var p = document.querySelectorAll("p");
for( var i = 0; i < p.length; i++ ){
p[i].addEventListener("click", makeRed);
p[0].classList.add("active");
}
function makeRed(){
var elems = document.querySelectorAll(".active");
[].forEach.call(elems, function(el) {
el.cl... |
50,943,141 | i have some paragraphs. At first one of that should have red color and after click it should become black, and clicked one should become red. I need to change red each paragraph when it is clicked and remove the class when another one is clicked. I should do it with javascript
```js
var p = document.querySelectorAll("... | 2018/06/20 | [
"https://Stackoverflow.com/questions/50943141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9576063/"
] | Your code is good, just have a little logical problem :)
```js
var p = document.querySelectorAll("p");
for( var i = 0; i < p.length; i++ ){
p[i].addEventListener("click", makeRed);
p[0].classList.add("active");
}
function makeRed(){
if( this.classList.contains("active")){
this.classList.remove("active");
... | Simply use `document.querySelectorAll` to get all elements and reset their class by removing `active` and then simply add class to current element.
```js
var p = document.querySelectorAll("p");
for( var i = 0; i < p.length; i++ ){
p[i].addEventListener("click", makeRed);
p[0].classList.add("active");
}
functio... |
22,498,086 | **Background**
Using [CakePHP](http://cakephp.org/)'s [FormHelper](http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#formhelper), I am creating multiple radio buttons, each being rendered by separate calls to [input()](http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper%3a%3ainput)... | 2014/03/19 | [
"https://Stackoverflow.com/questions/22498086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | >
> For certain input types (checkboxes, radios) a hidden input is created so that the key in `$this->request->data` will exist even without a value specified.
>
>
> If you want to create multiple blocks of inputs on a form that are all grouped together, you should use this parameter on all inputs except the first. ... | Try the following:
```
<?php echo $this->Form->input('fieldName', array(
'type' => 'radio',
'hiddenField' => false,
'options' => array('value1' => 'option label1'))
)); ?>
<?php echo $this->Form->input('fieldNam... |
51,790,824 | Is there possible to keep elements inside a DIV, in the same line, even if i put a BR tag after elements ? For example:
DIV
↑ → Full Name (a br here)
IMAGE → Address (another br here)
↓ → Tel
/DIV
And display exactly this example ?
↑
I
M → Full Name
A → Addres
G → Tel
E
↓
Keeping ne... | 2018/08/10 | [
"https://Stackoverflow.com/questions/51790824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10009861/"
] | [`querySelector()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector) only returns first match found.
You need to loop over whole collection returned by [`querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) and add listener to each instance
jQuery d... | I just changed querySelector for querySelectorAll, so i can get every element wuth my-class on it, then with a foreach loop create the handler so it does what you wanted to..
```js
document.querySelectorAll('.my-class').forEach(function(x){
x.onclick=function(){
document.getElementsByClassName('green')... |
51,790,824 | Is there possible to keep elements inside a DIV, in the same line, even if i put a BR tag after elements ? For example:
DIV
↑ → Full Name (a br here)
IMAGE → Address (another br here)
↓ → Tel
/DIV
And display exactly this example ?
↑
I
M → Full Name
A → Addres
G → Tel
E
↓
Keeping ne... | 2018/08/10 | [
"https://Stackoverflow.com/questions/51790824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10009861/"
] | [`querySelector()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector) only returns first match found.
You need to loop over whole collection returned by [`querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) and add listener to each instance
jQuery d... | I think breaking out the `querySelectors` makes it easier to read, especially when used in conjunction with descriptive names. Otherwise I think what @charlietfl is the best.
```
const myClass = document.querySelectorAll('.my-class')
const listText = document.querySelector('.green')
Array.from(myClass).forEach(functi... |
51,611,812 | The following code gives an UnhandledPromiseRejectionWarning for p2, despite errors on p2 being explicitly handled.
```
function syncFunctionReturnsPromise(val)
{
return new Promise((r,x)=> {
setTimeout(()=> {
if (val) {
r('ok');
} else {
x('not ok');
}
}, val?1000:500);
... | 2018/07/31 | [
"https://Stackoverflow.com/questions/51611812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1273906/"
] | So this is because the first await waits synchronously before the handler is attached to p2. But p2 fails before p1 completes.
So node detects that p2 failed without any error handling.
N.B. In later versions of node this may cause the program to terminate, rather than just a warning.
The fix is to attach the handle... | Here is the other way:
```
async function test(){
let p1 = await syncFunctionReturnsPromise(true)
.catch(ex => console.warn('warning:', ex));
let p2 = await syncFunctionReturnsPromise(false)
.catch(ex => console.warn('warning:', ex));
console.log('doOtherStuff');
}
``` |
51,614,852 | The code I have pulled from the production server to my localhost server is identical. On the live site, the user can login as normal however on Localhost I cannot. I am using Laravel 5.1 for this project along with a XAMMP server.
The issue cannot be with the source code- as it is the same on the live site as it is ... | 2018/07/31 | [
"https://Stackoverflow.com/questions/51614852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10160877/"
] | If page returns **HTTP 500 Error** it means that somewhere is syntax error or script can't run correctly. Maybe your settings set for non-local server? | The issue was with the XAMPP configuration file and its index.php file. I had a conversation with the original developer who guided me through how to congfigure this and all is resolved now. I needed to change some permissions with the files I had downloaded RWX etc, as well as the root file of my project files. |
24,904,494 | I am having quite a problem compiling `LibCURL` with `MinGW32-gcc` on my pc. I put the files from the LibCURL download "includes", "lib", and "bin" into the corresponding MinGW32 folders. Currently my code is below and it is extremely simple for testing if it worked(Which it is not as I am posting here.)
```
#include... | 2014/07/23 | [
"https://Stackoverflow.com/questions/24904494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3543824/"
] | I would put two or more **nullable** rows into the chatting table that are referencing the different other tables.
For example one column chatter\_colleague and one chatter\_customer. That is also not very nice but I just don't know any *really* good solution!
That would need some effort to keep the table clean but ... | Merge the rows of your reference tables into one "table" and include the name of the source table (as a literal value) so you can distinguish them from each other, then join your main table to that, joining on both the id and the source name:
```
select
c.id,
c.someColumn,
d.data
from chatting c
left join ... |
24,904,494 | I am having quite a problem compiling `LibCURL` with `MinGW32-gcc` on my pc. I put the files from the LibCURL download "includes", "lib", and "bin" into the corresponding MinGW32 folders. Currently my code is below and it is extremely simple for testing if it worked(Which it is not as I am posting here.)
```
#include... | 2014/07/23 | [
"https://Stackoverflow.com/questions/24904494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3543824/"
] | This is the classic Polymorphic Association anti-pattern. There are a number of possible solutions:
1 Exclusive Arcs (as suggested by Argeman) e.g. for the chatting table
```
id | someColumn | customerId | colleagueId
------------------------------------------
1 2 1
2 3 1
3 ... | Merge the rows of your reference tables into one "table" and include the name of the source table (as a literal value) so you can distinguish them from each other, then join your main table to that, joining on both the id and the source name:
```
select
c.id,
c.someColumn,
d.data
from chatting c
left join ... |
24,904,494 | I am having quite a problem compiling `LibCURL` with `MinGW32-gcc` on my pc. I put the files from the LibCURL download "includes", "lib", and "bin" into the corresponding MinGW32 folders. Currently my code is below and it is extremely simple for testing if it worked(Which it is not as I am posting here.)
```
#include... | 2014/07/23 | [
"https://Stackoverflow.com/questions/24904494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3543824/"
] | This is the classic Polymorphic Association anti-pattern. There are a number of possible solutions:
1 Exclusive Arcs (as suggested by Argeman) e.g. for the chatting table
```
id | someColumn | customerId | colleagueId
------------------------------------------
1 2 1
2 3 1
3 ... | I would put two or more **nullable** rows into the chatting table that are referencing the different other tables.
For example one column chatter\_colleague and one chatter\_customer. That is also not very nice but I just don't know any *really* good solution!
That would need some effort to keep the table clean but ... |
50,229,130 | I tried importing rxjs timer on my angular 6 project like
```
import { timer } from 'rxjs/observable/timer';
```
I also tried it like,
```
Rx.Observable.timer(200, 100)
```
They don't work
Here is the code on [plunker](https://stackblitz.com/edit/angular-q8rehy?file=src/app/hello.component.ts) | 2018/05/08 | [
"https://Stackoverflow.com/questions/50229130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4646531/"
] | From rxjs 6 (as used in angular 6 project), The general rule is as follows:
* rxjs: Creation methods, types, schedulers and utilities
```js
import { timer, Observable, Subject, asapScheduler, pipe, of, from,
interval, merge, fromEvent } from 'rxjs';
```
* rxjs/operators: All pipeable operators:
```js
impor... | All observable classes (<https://github.com/ReactiveX/rxjs/tree/5.5.8/src/observable>) have been removed from v6, in favor of existing or new operators that perform the same operations as the class methods.
```
import { timer } from 'rxjs';
import { timeInterval, pluck, take} from 'rxjs/operators';
var sourcef = time... |
50,229,130 | I tried importing rxjs timer on my angular 6 project like
```
import { timer } from 'rxjs/observable/timer';
```
I also tried it like,
```
Rx.Observable.timer(200, 100)
```
They don't work
Here is the code on [plunker](https://stackblitz.com/edit/angular-q8rehy?file=src/app/hello.component.ts) | 2018/05/08 | [
"https://Stackoverflow.com/questions/50229130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4646531/"
] | All observable classes (<https://github.com/ReactiveX/rxjs/tree/5.5.8/src/observable>) have been removed from v6, in favor of existing or new operators that perform the same operations as the class methods.
```
import { timer } from 'rxjs';
import { timeInterval, pluck, take} from 'rxjs/operators';
var sourcef = time... | as of rxjs 6.2.2, for this import
```
import { timer } from 'rxjs'; // gives tslint blacklisted error
```
tslint gives an error:
```
ERR: [tslint] This import is blacklisted,
import a submodule instead (import-blacklist)
```
**but this works fine without any error**
`import { timer } from 'rxjs/observable/ti... |
50,229,130 | I tried importing rxjs timer on my angular 6 project like
```
import { timer } from 'rxjs/observable/timer';
```
I also tried it like,
```
Rx.Observable.timer(200, 100)
```
They don't work
Here is the code on [plunker](https://stackblitz.com/edit/angular-q8rehy?file=src/app/hello.component.ts) | 2018/05/08 | [
"https://Stackoverflow.com/questions/50229130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4646531/"
] | All observable classes (<https://github.com/ReactiveX/rxjs/tree/5.5.8/src/observable>) have been removed from v6, in favor of existing or new operators that perform the same operations as the class methods.
```
import { timer } from 'rxjs';
import { timeInterval, pluck, take} from 'rxjs/operators';
var sourcef = time... | In my case I used import { timer } from 'rxjs/Observable/timer'; like this.
but need to use in import { timer } from 'rxjs/observable/timer'; Observable instead of observable.
that's all... enjoy your coding. |
50,229,130 | I tried importing rxjs timer on my angular 6 project like
```
import { timer } from 'rxjs/observable/timer';
```
I also tried it like,
```
Rx.Observable.timer(200, 100)
```
They don't work
Here is the code on [plunker](https://stackblitz.com/edit/angular-q8rehy?file=src/app/hello.component.ts) | 2018/05/08 | [
"https://Stackoverflow.com/questions/50229130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4646531/"
] | From rxjs 6 (as used in angular 6 project), The general rule is as follows:
* rxjs: Creation methods, types, schedulers and utilities
```js
import { timer, Observable, Subject, asapScheduler, pipe, of, from,
interval, merge, fromEvent } from 'rxjs';
```
* rxjs/operators: All pipeable operators:
```js
impor... | as of rxjs 6.2.2, for this import
```
import { timer } from 'rxjs'; // gives tslint blacklisted error
```
tslint gives an error:
```
ERR: [tslint] This import is blacklisted,
import a submodule instead (import-blacklist)
```
**but this works fine without any error**
`import { timer } from 'rxjs/observable/ti... |
50,229,130 | I tried importing rxjs timer on my angular 6 project like
```
import { timer } from 'rxjs/observable/timer';
```
I also tried it like,
```
Rx.Observable.timer(200, 100)
```
They don't work
Here is the code on [plunker](https://stackblitz.com/edit/angular-q8rehy?file=src/app/hello.component.ts) | 2018/05/08 | [
"https://Stackoverflow.com/questions/50229130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4646531/"
] | From rxjs 6 (as used in angular 6 project), The general rule is as follows:
* rxjs: Creation methods, types, schedulers and utilities
```js
import { timer, Observable, Subject, asapScheduler, pipe, of, from,
interval, merge, fromEvent } from 'rxjs';
```
* rxjs/operators: All pipeable operators:
```js
impor... | In my case I used import { timer } from 'rxjs/Observable/timer'; like this.
but need to use in import { timer } from 'rxjs/observable/timer'; Observable instead of observable.
that's all... enjoy your coding. |
50,229,130 | I tried importing rxjs timer on my angular 6 project like
```
import { timer } from 'rxjs/observable/timer';
```
I also tried it like,
```
Rx.Observable.timer(200, 100)
```
They don't work
Here is the code on [plunker](https://stackblitz.com/edit/angular-q8rehy?file=src/app/hello.component.ts) | 2018/05/08 | [
"https://Stackoverflow.com/questions/50229130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4646531/"
] | as of rxjs 6.2.2, for this import
```
import { timer } from 'rxjs'; // gives tslint blacklisted error
```
tslint gives an error:
```
ERR: [tslint] This import is blacklisted,
import a submodule instead (import-blacklist)
```
**but this works fine without any error**
`import { timer } from 'rxjs/observable/ti... | In my case I used import { timer } from 'rxjs/Observable/timer'; like this.
but need to use in import { timer } from 'rxjs/observable/timer'; Observable instead of observable.
that's all... enjoy your coding. |
30,769,636 | I'm trying to understand Maven 3's[password encryption feature. I have found that this feature is poorly documented and confusing. For example, the [feature documentation](https://maven.apache.org/guides/mini/guide-encryption.html) and [a blog post by the author of the feature](http://blog.sonatype.com/2009/10/maven-ti... | 2015/06/11 | [
"https://Stackoverflow.com/questions/30769636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/885287/"
] | My answer is based on reading the Maven source code and doing a little research.
>
> 1. Does the encrypted master password provide security simply by existing in `settings-security.xml` in a folder that only one user can
> access (`~/.m2`)? If so, why bother with encrypting a 'master
> password' (why not just use s... | I need to know this for bnd(tools) so I can share some deeper analysis.
The 'encrypted' passwords have a syntax of:
```
output ::= '{' base64(packet) '}'
packet ::= salt[8] padlen[1] encrypted[?] padding[padlen]
salt ::= <random>
padlen ::= <length of padding >
padding ::= <random to make packet lengt... |
30,769,636 | I'm trying to understand Maven 3's[password encryption feature. I have found that this feature is poorly documented and confusing. For example, the [feature documentation](https://maven.apache.org/guides/mini/guide-encryption.html) and [a blog post by the author of the feature](http://blog.sonatype.com/2009/10/maven-ti... | 2015/06/11 | [
"https://Stackoverflow.com/questions/30769636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/885287/"
] | My answer is based on reading the Maven source code and doing a little research.
>
> 1. Does the encrypted master password provide security simply by existing in `settings-security.xml` in a folder that only one user can
> access (`~/.m2`)? If so, why bother with encrypting a 'master
> password' (why not just use s... | Here is example code which shows how to decrypt the maven master password from
`~/.m2/security-settings.xml`
and also the server passwords from
`~/.m2/settings.xml`
Source of `MavenPasswordDecryptor.java`
```
import org.sonatype.plexus.components.cipher.DefaultPlexusCipher;
public class MavenPasswordDecryptor ... |
30,769,636 | I'm trying to understand Maven 3's[password encryption feature. I have found that this feature is poorly documented and confusing. For example, the [feature documentation](https://maven.apache.org/guides/mini/guide-encryption.html) and [a blog post by the author of the feature](http://blog.sonatype.com/2009/10/maven-ti... | 2015/06/11 | [
"https://Stackoverflow.com/questions/30769636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/885287/"
] | I need to know this for bnd(tools) so I can share some deeper analysis.
The 'encrypted' passwords have a syntax of:
```
output ::= '{' base64(packet) '}'
packet ::= salt[8] padlen[1] encrypted[?] padding[padlen]
salt ::= <random>
padlen ::= <length of padding >
padding ::= <random to make packet lengt... | Here is example code which shows how to decrypt the maven master password from
`~/.m2/security-settings.xml`
and also the server passwords from
`~/.m2/settings.xml`
Source of `MavenPasswordDecryptor.java`
```
import org.sonatype.plexus.components.cipher.DefaultPlexusCipher;
public class MavenPasswordDecryptor ... |
145,200 | I have a problem with amnesia game. After Intro and clicking continue button few times, when game is supposed to start it crashes. Here is console output:
```
ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(sn... | 2012/06/01 | [
"https://askubuntu.com/questions/145200",
"https://askubuntu.com",
"https://askubuntu.com/users/67765/"
] | I had same problem (Ubuntu 12.04, Ati 6450, gallium drivers).
The game is working now, after install this library:
`sudo apt-get install libtxc-dxtn-s2tc0` | Try using the additional drivers tool in system setting to search for proprietary drivers you might be able to install. Installing ATI graphics cards(ATI Catalyst) drivers and rebooting helped in my situation. |
145,200 | I have a problem with amnesia game. After Intro and clicking continue button few times, when game is supposed to start it crashes. Here is console output:
```
ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(sn... | 2012/06/01 | [
"https://askubuntu.com/questions/145200",
"https://askubuntu.com",
"https://askubuntu.com/users/67765/"
] | I had same problem (Ubuntu 12.04, Ati 6450, gallium drivers).
The game is working now, after install this library:
`sudo apt-get install libtxc-dxtn-s2tc0` | Deinstalling pulseaudio did the trick for me. But keep in mind that the sound-mixer widget might vanish. You probably should install a ALSA-based-mixer after removing pulseaudio. |
9,463,951 | I make Constructor of String as--
```
class TestString {
public static void main(String args[]) {
int arr[]={1,5,6,8,9};
String str3 = new String(arr,1,3);//public java.lang.String(int[], int, int);
System.out.println(str3);
... | 2012/02/27 | [
"https://Stackoverflow.com/questions/9463951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1245234/"
] | You've created a string consisting of three Unicode code points, [U+0005](http://www.fileformat.info/info/unicode/char/0005/index.htm), [U+0006](http://www.fileformat.info/info/unicode/char/0006/index.htm) and [U+0008](http://www.fileformat.info/info/unicode/char/0008/index.htm), and I bet your output is showing exactl... | They array should contain Unicode codePoints. Do you know what 5, 6, and 8 mean?
It concatenates Unicode characters with the codes you pass in your array, starting at offset 1, with length three. So, offset 1 is the second element of the array (5). It takes 3 elements: 5, 6, and 8. Those characters represent the funny ... |
9,463,951 | I make Constructor of String as--
```
class TestString {
public static void main(String args[]) {
int arr[]={1,5,6,8,9};
String str3 = new String(arr,1,3);//public java.lang.String(int[], int, int);
System.out.println(str3);
... | 2012/02/27 | [
"https://Stackoverflow.com/questions/9463951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1245234/"
] | You've created a string consisting of three Unicode code points, [U+0005](http://www.fileformat.info/info/unicode/char/0005/index.htm), [U+0006](http://www.fileformat.info/info/unicode/char/0006/index.htm) and [U+0008](http://www.fileformat.info/info/unicode/char/0008/index.htm), and I bet your output is showing exactl... | You craeted a String using the byte array constructor. The byte array must contain the Unicode-points. See [ascii table](http://ss64.com/ascii.html) for more information on unicode points and there representative values. |
9,463,951 | I make Constructor of String as--
```
class TestString {
public static void main(String args[]) {
int arr[]={1,5,6,8,9};
String str3 = new String(arr,1,3);//public java.lang.String(int[], int, int);
System.out.println(str3);
... | 2012/02/27 | [
"https://Stackoverflow.com/questions/9463951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1245234/"
] | You craeted a String using the byte array constructor. The byte array must contain the Unicode-points. See [ascii table](http://ss64.com/ascii.html) for more information on unicode points and there representative values. | They array should contain Unicode codePoints. Do you know what 5, 6, and 8 mean?
It concatenates Unicode characters with the codes you pass in your array, starting at offset 1, with length three. So, offset 1 is the second element of the array (5). It takes 3 elements: 5, 6, and 8. Those characters represent the funny ... |
13,788,514 | For the code below, I am getting the
```
Segmentation fault (core dumped)
```
error message, can someone help me please?
```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
char s[] = "helloWorld";
int i;
for(i = 1; i < strlen(s); i++)
{
printf("Letter is %s\n",... | 2012/12/09 | [
"https://Stackoverflow.com/questions/13788514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
printf("Letter is %s\n", s[i]);
```
is wrong, `%s` expects a `const char *`, and you're giving it a `char`. Change this line to
```
printf("Letter is %c\n", s[i]);
```
since the `%c` format specifier is intended for printing individual characters.
Also, in C, arrays are zero-based, so you should initialize `i... | You are printing character by character so use `%c` instead of `%s`.
`%s` expects a string but `s[i]` is actually a char.
Also every time you are calling `strlen(s)`. And `strlen` is not changing , so better to use one variable for it and call only once before entering into loop.
A more optimized way like this :
`... |
29,188,344 | I'm currently getting back the following json from a service that I do not own:
```
{
"auc" : 320658953,
"item" : 31294,
"owner" : "Amacid",
"ownerRealm" : "EarthenRing",
"bid" : 289493,
"buyout" : 371150,
"quantity" : 1,
"timeLeft" : "LONG",
"rand" : 0,
"seed" : 0,
"context... | 2015/03/21 | [
"https://Stackoverflow.com/questions/29188344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/462631/"
] | Here is yours example: <http://dotnetbyexample.blogspot.ru/2012/02/json-deserialization-with-jsonnet-class.html?m=1>
You just have to use overloaded method
```
JsonConvert.DeserializeObject<List<Item>>
(r.EventArgs.Result, params Newtonsoft.Json.JsonConverter[] converters)
```
And write your converters | I don't see any alternative besides creating the class hierarchy in c# and then have some sort factory that checks for the presence of signature keys on the json side, creating the right c# object. `petSpeciesId` is probably a good candidate for distinguishing between `Item` and `PetItem`.
Ask yourself whether you rea... |
47,906,642 | I'm creating a Space Invaders game with C# WinForms and when coding the movement of the player's cannon, I create this event handler:
```
private void Game_Screen_KeyDown(object sender, KeyEventArgs e)
{
for (int i = 0; i < 500; i++)
{
if (e.KeyCode == Keys.Left)
{
cannonBox.Locati... | 2017/12/20 | [
"https://Stackoverflow.com/questions/47906642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'd suggest to make that event handler `async` and use `await Task.Delay()` instead of `Thread.Sleep()`:
```
private async void Game_Screen_KeyDown(object sender, KeyEventArgs e)
{
for (int i = 0; i < 500; i++)
{
if (e.KeyCode == Keys.Left)
{
cannonBox.Location = new Point(cannonBox... | Application.DoEvents() interupts the execution of your method and the UI thread will process its events (including redrawing of the UI). From my experience there is nothing wrong with using it in the right places...
Using the 'async' pattern (as René Vogt suggested) is best practice to make reponsive UI's.
However. Y... |
47,906,642 | I'm creating a Space Invaders game with C# WinForms and when coding the movement of the player's cannon, I create this event handler:
```
private void Game_Screen_KeyDown(object sender, KeyEventArgs e)
{
for (int i = 0; i < 500; i++)
{
if (e.KeyCode == Keys.Left)
{
cannonBox.Locati... | 2017/12/20 | [
"https://Stackoverflow.com/questions/47906642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'd suggest to make that event handler `async` and use `await Task.Delay()` instead of `Thread.Sleep()`:
```
private async void Game_Screen_KeyDown(object sender, KeyEventArgs e)
{
for (int i = 0; i < 500; i++)
{
if (e.KeyCode == Keys.Left)
{
cannonBox.Location = new Point(cannonBox... | Use a **timer** that will call the game processing each 20 milliseconds.
Within the `KeyDown`/`KeyUp` events just change the current state which is used by the game processing.
Sample code:
```
[Flags]
public enum ActionState
{
MoveLeft,
MeveRight,
FireLaser,
}
// stores the current state
private Action... |
47,906,642 | I'm creating a Space Invaders game with C# WinForms and when coding the movement of the player's cannon, I create this event handler:
```
private void Game_Screen_KeyDown(object sender, KeyEventArgs e)
{
for (int i = 0; i < 500; i++)
{
if (e.KeyCode == Keys.Left)
{
cannonBox.Locati... | 2017/12/20 | [
"https://Stackoverflow.com/questions/47906642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Use a **timer** that will call the game processing each 20 milliseconds.
Within the `KeyDown`/`KeyUp` events just change the current state which is used by the game processing.
Sample code:
```
[Flags]
public enum ActionState
{
MoveLeft,
MeveRight,
FireLaser,
}
// stores the current state
private Action... | Application.DoEvents() interupts the execution of your method and the UI thread will process its events (including redrawing of the UI). From my experience there is nothing wrong with using it in the right places...
Using the 'async' pattern (as René Vogt suggested) is best practice to make reponsive UI's.
However. Y... |
28,265,892 | As homework, I must swap letters in a given string. I already figured out how to do this, but not how to display them at once. it involves a for loop. so if I include disp x in the for loop, it displays them between parentheses and a space, but I want them all together, so instead of
"a"
"b"
"c"
I want "abc". Is t... | 2015/02/01 | [
"https://Stackoverflow.com/questions/28265892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4479654/"
] | To add an element `x` to an array `A` use `augment(A, {x})`.
For your specific case, I would use a string variable (call it `string`) to which I concatenate the next letter at each iteration of the `for` loop. So if the next letter to be added is in the variable `letter`, you would put the following line of code at th... | I would answer you by an example covering your scenario. Let's say we are aiming to have a array listing the elements of binaries when we construct an integer into the base2 (binary).
```
Define LibPub develope(a,b)=
Func
Local mi,m,q
mi:=mod(a,b)
q:=((a-mi)/(b))
Disp mi
While q≥b
a:=q
m:=mod(a,b)
q:=((a-m)/(b))... |
28,265,892 | As homework, I must swap letters in a given string. I already figured out how to do this, but not how to display them at once. it involves a for loop. so if I include disp x in the for loop, it displays them between parentheses and a space, but I want them all together, so instead of
"a"
"b"
"c"
I want "abc". Is t... | 2015/02/01 | [
"https://Stackoverflow.com/questions/28265892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4479654/"
] | To add an element `x` to an array `A` use `augment(A, {x})`.
For your specific case, I would use a string variable (call it `string`) to which I concatenate the next letter at each iteration of the `for` loop. So if the next letter to be added is in the variable `letter`, you would put the following line of code at th... | here is also way:
Local array
array[dim(array)+1] := value |
28,265,892 | As homework, I must swap letters in a given string. I already figured out how to do this, but not how to display them at once. it involves a for loop. so if I include disp x in the for loop, it displays them between parentheses and a space, but I want them all together, so instead of
"a"
"b"
"c"
I want "abc". Is t... | 2015/02/01 | [
"https://Stackoverflow.com/questions/28265892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4479654/"
] | here is also way:
Local array
array[dim(array)+1] := value | I would answer you by an example covering your scenario. Let's say we are aiming to have a array listing the elements of binaries when we construct an integer into the base2 (binary).
```
Define LibPub develope(a,b)=
Func
Local mi,m,q
mi:=mod(a,b)
q:=((a-mi)/(b))
Disp mi
While q≥b
a:=q
m:=mod(a,b)
q:=((a-m)/(b))... |
26,820,253 | I am building an Android app that requires real time updates. My server is Firebase. Firebase is meant to receive its updated data when the user is connected to the server. I am very impressed with Firebase so far, however my concern is receiving the new data when the app is not active. I really do not want to try thes... | 2014/11/08 | [
"https://Stackoverflow.com/questions/26820253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1642079/"
] | You probably want to use GCM in these situations.
Firebase works fine from a background service, but it leaves a socket open, so it's going to use quite a bit of power. This power usage is fine when a user is actively engaged with your app (the screen probably uses a lot more), but when it's running in the background,... | You could also try zapier.com which has a firebase + pushover integration to send gcm. but it will require some spending.for free you will have to develop this your self on your custom server, using firebase queue. |
62,475,790 | I can't find any info anywhere on how to change the default width of a TextAreaAutosize component in material-ui.
It seems the only choice is to have this little box. Does anyone know of a better text area auto size component I can use, or how to change the width of the TextAreaAutoSize component?
The API doesn't sh... | 2020/06/19 | [
"https://Stackoverflow.com/questions/62475790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4548295/"
] | Resizing by the user is turned off (via `resize: "none"`) for `TextField` here in `InputBase`: <https://github.com/mui-org/material-ui/blob/v4.10.2/packages/material-ui/src/InputBase/InputBase.js#L140>.
Below is an example of how to turn it back on:
```
import React from "react";
import { makeStyles } from "@material... | I was able to get it to work thanks to Ryan Cogswell. Stupid me, though I wrapped the textarea in a box and applied className to the box (which didn't work), I should have applied it to the textareaautosize directly.
There's a bug in VSCODE Intellisense where it shows 'classes' as a property but not 'className' so I a... |
62,475,790 | I can't find any info anywhere on how to change the default width of a TextAreaAutosize component in material-ui.
It seems the only choice is to have this little box. Does anyone know of a better text area auto size component I can use, or how to change the width of the TextAreaAutoSize component?
The API doesn't sh... | 2020/06/19 | [
"https://Stackoverflow.com/questions/62475790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4548295/"
] | You can change the style prop of the TextareaAutosize check [here](https://github.com/mui-org/material-ui/blob/v4.10.2/packages/material-ui/src/TextareaAutosize/TextareaAutosize.js#L211)
```
<TextareaAutosize
rowsMin={3}
placeholder=''
defaultValue=''
style={{ width: "100%" }}
/>
``` | I was able to get it to work thanks to Ryan Cogswell. Stupid me, though I wrapped the textarea in a box and applied className to the box (which didn't work), I should have applied it to the textareaautosize directly.
There's a bug in VSCODE Intellisense where it shows 'classes' as a property but not 'className' so I a... |
62,475,790 | I can't find any info anywhere on how to change the default width of a TextAreaAutosize component in material-ui.
It seems the only choice is to have this little box. Does anyone know of a better text area auto size component I can use, or how to change the width of the TextAreaAutoSize component?
The API doesn't sh... | 2020/06/19 | [
"https://Stackoverflow.com/questions/62475790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4548295/"
] | Resizing by the user is turned off (via `resize: "none"`) for `TextField` here in `InputBase`: <https://github.com/mui-org/material-ui/blob/v4.10.2/packages/material-ui/src/InputBase/InputBase.js#L140>.
Below is an example of how to turn it back on:
```
import React from "react";
import { makeStyles } from "@material... | You can change the style prop of the TextareaAutosize check [here](https://github.com/mui-org/material-ui/blob/v4.10.2/packages/material-ui/src/TextareaAutosize/TextareaAutosize.js#L211)
```
<TextareaAutosize
rowsMin={3}
placeholder=''
defaultValue=''
style={{ width: "100%" }}
/>
``` |
62,475,790 | I can't find any info anywhere on how to change the default width of a TextAreaAutosize component in material-ui.
It seems the only choice is to have this little box. Does anyone know of a better text area auto size component I can use, or how to change the width of the TextAreaAutoSize component?
The API doesn't sh... | 2020/06/19 | [
"https://Stackoverflow.com/questions/62475790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4548295/"
] | Resizing by the user is turned off (via `resize: "none"`) for `TextField` here in `InputBase`: <https://github.com/mui-org/material-ui/blob/v4.10.2/packages/material-ui/src/InputBase/InputBase.js#L140>.
Below is an example of how to turn it back on:
```
import React from "react";
import { makeStyles } from "@material... | Here's the trick I used. I wrapped it in a flex container and used align-items to stretch the width to cover the size of that container.
```
<Stack
direction="column"
justifyContent="center"
alignItems="stretch"
spacing={2}
>
... |
62,475,790 | I can't find any info anywhere on how to change the default width of a TextAreaAutosize component in material-ui.
It seems the only choice is to have this little box. Does anyone know of a better text area auto size component I can use, or how to change the width of the TextAreaAutoSize component?
The API doesn't sh... | 2020/06/19 | [
"https://Stackoverflow.com/questions/62475790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4548295/"
] | You can change the style prop of the TextareaAutosize check [here](https://github.com/mui-org/material-ui/blob/v4.10.2/packages/material-ui/src/TextareaAutosize/TextareaAutosize.js#L211)
```
<TextareaAutosize
rowsMin={3}
placeholder=''
defaultValue=''
style={{ width: "100%" }}
/>
``` | Here's the trick I used. I wrapped it in a flex container and used align-items to stretch the width to cover the size of that container.
```
<Stack
direction="column"
justifyContent="center"
alignItems="stretch"
spacing={2}
>
... |
20,677,958 | i just want to get the value entered in my txtfield from other class
```
public class MyCostumizedDialog{
int x = 0 ;
public void showFrameDialog(){
// Here are my components...
txt1 = new Jtextfields;...//my jtxtfield
.......
btn1.addactionlister(....){
x = Integer.parseInt(txt1.gettext());//... | 2013/12/19 | [
"https://Stackoverflow.com/questions/20677958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3053928/"
] | you are trying to get value before setting value to it in other words your x gets value once you click on btn1, but you are trying to get value of x before clicking on that button.
```
mcd .showFrameDialog();
Double x= mcd.getNumber();
```
you should call `mcd.getNumber();` after you set value to your variable. | Since you always instantiate a new instance of MyCostumizedDialog every time btn2 is pressed you get the initial value of MyCostumizedDialog because nobody pressed the btn1 for the newly created instance that would set the value.
If the btn1 needs to be there for other purposes I would recommend to just add another me... |
48,037,601 | I am currently in the middle of migrating my REST-Server to GraphQL (at least partly). Most of the work is done, but i stumbled upon this problem which i seem to be unable to solve: OneToMany relationships in a graphql query, with FetchType.LAZY.
I am using:
<https://github.com/graphql-java/graphql-spring-boot>
and
<h... | 2017/12/30 | [
"https://Stackoverflow.com/questions/48037601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386873/"
] | My prefered solution is to have the transaction open until the Servlet sends its response. With this small code change your LazyLoad will work right:
```
import javax.servlet.Filter;
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter;
@SpringBootApplication
public class Application {
public s... | For anyone confused about the accepted answer then you need to change the java entities to include a bidirectional relationship and ensure you use the helper methods to add a `Competition` otherwise its easy to forget to set the relationship up correctly.
```
@Entity
class Show {
private Long id;
private String ... |
48,037,601 | I am currently in the middle of migrating my REST-Server to GraphQL (at least partly). Most of the work is done, but i stumbled upon this problem which i seem to be unable to solve: OneToMany relationships in a graphql query, with FetchType.LAZY.
I am using:
<https://github.com/graphql-java/graphql-spring-boot>
and
<h... | 2017/12/30 | [
"https://Stackoverflow.com/questions/48037601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386873/"
] | For anyone confused about the accepted answer then you need to change the java entities to include a bidirectional relationship and ensure you use the helper methods to add a `Competition` otherwise its easy to forget to set the relationship up correctly.
```
@Entity
class Show {
private Long id;
private String ... | For me using `AsyncTransactionalExecutionStrategy` worked incorrectly with exceptions. E.g. lazy init or app-level exception triggered transaction to rollback-only status. Spring transaction mechanism then threw on rollback-only transaction at the boundary of strategy `execute`, causing `HttpRequestHandlerImpl` to retu... |
48,037,601 | I am currently in the middle of migrating my REST-Server to GraphQL (at least partly). Most of the work is done, but i stumbled upon this problem which i seem to be unable to solve: OneToMany relationships in a graphql query, with FetchType.LAZY.
I am using:
<https://github.com/graphql-java/graphql-spring-boot>
and
<h... | 2017/12/30 | [
"https://Stackoverflow.com/questions/48037601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386873/"
] | My prefered solution is to have the transaction open until the Servlet sends its response. With this small code change your LazyLoad will work right:
```
import javax.servlet.Filter;
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter;
@SpringBootApplication
public class Application {
public s... | I am assuming that whenever you fetch an object of *Show*, you want all the associated *Competition* of the *Show* object.
By default the fetch type for all collections type in an entity is **LAZY**. You can specify the **EAGER** type to make sure hibernate fetches the collection.
In your *Show* class you can change... |
48,037,601 | I am currently in the middle of migrating my REST-Server to GraphQL (at least partly). Most of the work is done, but i stumbled upon this problem which i seem to be unable to solve: OneToMany relationships in a graphql query, with FetchType.LAZY.
I am using:
<https://github.com/graphql-java/graphql-spring-boot>
and
<h... | 2017/12/30 | [
"https://Stackoverflow.com/questions/48037601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386873/"
] | My prefered solution is to have the transaction open until the Servlet sends its response. With this small code change your LazyLoad will work right:
```
import javax.servlet.Filter;
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter;
@SpringBootApplication
public class Application {
public s... | For me using `AsyncTransactionalExecutionStrategy` worked incorrectly with exceptions. E.g. lazy init or app-level exception triggered transaction to rollback-only status. Spring transaction mechanism then threw on rollback-only transaction at the boundary of strategy `execute`, causing `HttpRequestHandlerImpl` to retu... |
48,037,601 | I am currently in the middle of migrating my REST-Server to GraphQL (at least partly). Most of the work is done, but i stumbled upon this problem which i seem to be unable to solve: OneToMany relationships in a graphql query, with FetchType.LAZY.
I am using:
<https://github.com/graphql-java/graphql-spring-boot>
and
<h... | 2017/12/30 | [
"https://Stackoverflow.com/questions/48037601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386873/"
] | For anyone confused about the accepted answer then you need to change the java entities to include a bidirectional relationship and ensure you use the helper methods to add a `Competition` otherwise its easy to forget to set the relationship up correctly.
```
@Entity
class Show {
private Long id;
private String ... | You just need to annotate your resolver classes with `@Transactional`. Then, entities returned from repositories will be able to lazily fetch data. |
48,037,601 | I am currently in the middle of migrating my REST-Server to GraphQL (at least partly). Most of the work is done, but i stumbled upon this problem which i seem to be unable to solve: OneToMany relationships in a graphql query, with FetchType.LAZY.
I am using:
<https://github.com/graphql-java/graphql-spring-boot>
and
<h... | 2017/12/30 | [
"https://Stackoverflow.com/questions/48037601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386873/"
] | For me using `AsyncTransactionalExecutionStrategy` worked incorrectly with exceptions. E.g. lazy init or app-level exception triggered transaction to rollback-only status. Spring transaction mechanism then threw on rollback-only transaction at the boundary of strategy `execute`, causing `HttpRequestHandlerImpl` to retu... | You just need to annotate your resolver classes with `@Transactional`. Then, entities returned from repositories will be able to lazily fetch data. |
48,037,601 | I am currently in the middle of migrating my REST-Server to GraphQL (at least partly). Most of the work is done, but i stumbled upon this problem which i seem to be unable to solve: OneToMany relationships in a graphql query, with FetchType.LAZY.
I am using:
<https://github.com/graphql-java/graphql-spring-boot>
and
<h... | 2017/12/30 | [
"https://Stackoverflow.com/questions/48037601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386873/"
] | For anyone confused about the accepted answer then you need to change the java entities to include a bidirectional relationship and ensure you use the helper methods to add a `Competition` otherwise its easy to forget to set the relationship up correctly.
```
@Entity
class Show {
private Long id;
private String ... | I am assuming that whenever you fetch an object of *Show*, you want all the associated *Competition* of the *Show* object.
By default the fetch type for all collections type in an entity is **LAZY**. You can specify the **EAGER** type to make sure hibernate fetches the collection.
In your *Show* class you can change... |
48,037,601 | I am currently in the middle of migrating my REST-Server to GraphQL (at least partly). Most of the work is done, but i stumbled upon this problem which i seem to be unable to solve: OneToMany relationships in a graphql query, with FetchType.LAZY.
I am using:
<https://github.com/graphql-java/graphql-spring-boot>
and
<h... | 2017/12/30 | [
"https://Stackoverflow.com/questions/48037601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386873/"
] | For me using `AsyncTransactionalExecutionStrategy` worked incorrectly with exceptions. E.g. lazy init or app-level exception triggered transaction to rollback-only status. Spring transaction mechanism then threw on rollback-only transaction at the boundary of strategy `execute`, causing `HttpRequestHandlerImpl` to retu... | I am assuming that whenever you fetch an object of *Show*, you want all the associated *Competition* of the *Show* object.
By default the fetch type for all collections type in an entity is **LAZY**. You can specify the **EAGER** type to make sure hibernate fetches the collection.
In your *Show* class you can change... |
48,037,601 | I am currently in the middle of migrating my REST-Server to GraphQL (at least partly). Most of the work is done, but i stumbled upon this problem which i seem to be unable to solve: OneToMany relationships in a graphql query, with FetchType.LAZY.
I am using:
<https://github.com/graphql-java/graphql-spring-boot>
and
<h... | 2017/12/30 | [
"https://Stackoverflow.com/questions/48037601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386873/"
] | I solved it and should have read the documentation of the graphql-java-tools library more carefully i suppose.
Beside the `GraphQLQueryResolver` which resolves the basic queries i also needed a `GraphQLResolver<T>` for my `Show`class, which looks like this:
```
@Component
public class ShowResolver implements GraphQLRe... | My prefered solution is to have the transaction open until the Servlet sends its response. With this small code change your LazyLoad will work right:
```
import javax.servlet.Filter;
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter;
@SpringBootApplication
public class Application {
public s... |
48,037,601 | I am currently in the middle of migrating my REST-Server to GraphQL (at least partly). Most of the work is done, but i stumbled upon this problem which i seem to be unable to solve: OneToMany relationships in a graphql query, with FetchType.LAZY.
I am using:
<https://github.com/graphql-java/graphql-spring-boot>
and
<h... | 2017/12/30 | [
"https://Stackoverflow.com/questions/48037601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386873/"
] | My prefered solution is to have the transaction open until the Servlet sends its response. With this small code change your LazyLoad will work right:
```
import javax.servlet.Filter;
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter;
@SpringBootApplication
public class Application {
public s... | You just need to annotate your resolver classes with `@Transactional`. Then, entities returned from repositories will be able to lazily fetch data. |
10,091 | Most of my prior genealogy research was based on family records. Very little of it came from hard sources like census records. Some folks would claim that what I have is not genealogy, but folklore. So I've recently been spending considerable time looking for "official" documents, like county marriage records, census r... | 2016/01/03 | [
"https://genealogy.stackexchange.com/questions/10091",
"https://genealogy.stackexchange.com",
"https://genealogy.stackexchange.com/users/4504/"
] | If you went around to researchers and asked them this question, I suspect you'd get a different answer for each one. Here are some of your options for recording genealogical information:
* paper systems designed for genealogy research, such as the forms in the [workbook](https://books.google.com/books/about/The_Unpuzz... | [FamilySearch](http://familysearch.org) is a free tool that lets you save multiple dates, even for the same event. You can also mark the date you think should be displayed in a person's Summary view. |
10,091 | Most of my prior genealogy research was based on family records. Very little of it came from hard sources like census records. Some folks would claim that what I have is not genealogy, but folklore. So I've recently been spending considerable time looking for "official" documents, like county marriage records, census r... | 2016/01/03 | [
"https://genealogy.stackexchange.com/questions/10091",
"https://genealogy.stackexchange.com",
"https://genealogy.stackexchange.com/users/4504/"
] | If you went around to researchers and asked them this question, I suspect you'd get a different answer for each one. Here are some of your options for recording genealogical information:
* paper systems designed for genealogy research, such as the forms in the [workbook](https://books.google.com/books/about/The_Unpuzz... | @JanMurphy in [her answer](https://genealogy.stackexchange.com/a/10092/1107) has nicely described the usefulness of source-centric software in a case like this. However, as the most widely used software is lineage-linked, you raise an important question.
There is no right or wrong way to record uncertain information, ... |
10,091 | Most of my prior genealogy research was based on family records. Very little of it came from hard sources like census records. Some folks would claim that what I have is not genealogy, but folklore. So I've recently been spending considerable time looking for "official" documents, like county marriage records, census r... | 2016/01/03 | [
"https://genealogy.stackexchange.com/questions/10091",
"https://genealogy.stackexchange.com",
"https://genealogy.stackexchange.com/users/4504/"
] | If you went around to researchers and asked them this question, I suspect you'd get a different answer for each one. Here are some of your options for recording genealogical information:
* paper systems designed for genealogy research, such as the forms in the [workbook](https://books.google.com/books/about/The_Unpuzz... | This is actually a very interesting question, and I think there is a reasonably simple and acceptable way of handling fuzzy facts.
My own genealogy adventure started many years ago with a similar set of stories from great-aunts and uncles about my ancestors. There was a tree which was handwritten by my father's aunt.... |
10,091 | Most of my prior genealogy research was based on family records. Very little of it came from hard sources like census records. Some folks would claim that what I have is not genealogy, but folklore. So I've recently been spending considerable time looking for "official" documents, like county marriage records, census r... | 2016/01/03 | [
"https://genealogy.stackexchange.com/questions/10091",
"https://genealogy.stackexchange.com",
"https://genealogy.stackexchange.com/users/4504/"
] | @JanMurphy in [her answer](https://genealogy.stackexchange.com/a/10092/1107) has nicely described the usefulness of source-centric software in a case like this. However, as the most widely used software is lineage-linked, you raise an important question.
There is no right or wrong way to record uncertain information, ... | [FamilySearch](http://familysearch.org) is a free tool that lets you save multiple dates, even for the same event. You can also mark the date you think should be displayed in a person's Summary view. |
10,091 | Most of my prior genealogy research was based on family records. Very little of it came from hard sources like census records. Some folks would claim that what I have is not genealogy, but folklore. So I've recently been spending considerable time looking for "official" documents, like county marriage records, census r... | 2016/01/03 | [
"https://genealogy.stackexchange.com/questions/10091",
"https://genealogy.stackexchange.com",
"https://genealogy.stackexchange.com/users/4504/"
] | This is actually a very interesting question, and I think there is a reasonably simple and acceptable way of handling fuzzy facts.
My own genealogy adventure started many years ago with a similar set of stories from great-aunts and uncles about my ancestors. There was a tree which was handwritten by my father's aunt.... | [FamilySearch](http://familysearch.org) is a free tool that lets you save multiple dates, even for the same event. You can also mark the date you think should be displayed in a person's Summary view. |
12,389,346 | Hello I have found a great class written in c# which I would like to use in a VB.NET project.
I found it in this thread:
[C# : Redirect console application output : How to flush the output?](https://stackoverflow.com/questions/1033648/c-sharp-redirect-console-application-output-how-to-flush-the-output)
The C# Class
l... | 2012/09/12 | [
"https://Stackoverflow.com/questions/12389346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1665789/"
] | You need to add the Overloads keyword to the BeginErrorReadLine method signature.
```
Public Overloads Sub BeginErrorReadLine() '<-------------Error 3
```
The event declarations need to be declared as Shadows because they otherwise conflict with the base class event declarations.
```
Public Shadows Event Output... | In your solution, add a new c# project. Place this c# code in it.
From your vb project, add a reference to the c# project.
You can now make calls to the c# objects from vb.
It's all the same when it's converted to IL. |
12,389,346 | Hello I have found a great class written in c# which I would like to use in a VB.NET project.
I found it in this thread:
[C# : Redirect console application output : How to flush the output?](https://stackoverflow.com/questions/1033648/c-sharp-redirect-console-application-output-how-to-flush-the-output)
The C# Class
l... | 2012/09/12 | [
"https://Stackoverflow.com/questions/12389346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1665789/"
] | In your solution, add a new c# project. Place this c# code in it.
From your vb project, add a reference to the c# project.
You can now make calls to the c# objects from vb.
It's all the same when it's converted to IL. | For your "Error 4" & "Error 5", use this instead - note that you need to set the local variable to the hidden VB backing delegate field ending in "Event". Also note that your test for the local variable being nothing is still valid since we're not checking if an event is nothing, but a local variable of a delegate type... |
12,389,346 | Hello I have found a great class written in c# which I would like to use in a VB.NET project.
I found it in this thread:
[C# : Redirect console application output : How to flush the output?](https://stackoverflow.com/questions/1033648/c-sharp-redirect-console-application-output-how-to-flush-the-output)
The C# Class
l... | 2012/09/12 | [
"https://Stackoverflow.com/questions/12389346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1665789/"
] | In your solution, add a new c# project. Place this c# code in it.
From your vb project, add a reference to the c# project.
You can now make calls to the c# objects from vb.
It's all the same when it's converted to IL. | Below is the code I am using now. I removed the namespace as I did not know how to inlcude a second namespace in my project and pasted the code into a new Module. Then as suggested in the original c# solution i just changed my "p as new process" to "p as new FixedProcess".
Thanks again for all the suggestions!
You g... |
12,389,346 | Hello I have found a great class written in c# which I would like to use in a VB.NET project.
I found it in this thread:
[C# : Redirect console application output : How to flush the output?](https://stackoverflow.com/questions/1033648/c-sharp-redirect-console-application-output-how-to-flush-the-output)
The C# Class
l... | 2012/09/12 | [
"https://Stackoverflow.com/questions/12389346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1665789/"
] | You need to add the Overloads keyword to the BeginErrorReadLine method signature.
```
Public Overloads Sub BeginErrorReadLine() '<-------------Error 3
```
The event declarations need to be declared as Shadows because they otherwise conflict with the base class event declarations.
```
Public Shadows Event Output... | For your "Error 4" & "Error 5", use this instead - note that you need to set the local variable to the hidden VB backing delegate field ending in "Event". Also note that your test for the local variable being nothing is still valid since we're not checking if an event is nothing, but a local variable of a delegate type... |
12,389,346 | Hello I have found a great class written in c# which I would like to use in a VB.NET project.
I found it in this thread:
[C# : Redirect console application output : How to flush the output?](https://stackoverflow.com/questions/1033648/c-sharp-redirect-console-application-output-how-to-flush-the-output)
The C# Class
l... | 2012/09/12 | [
"https://Stackoverflow.com/questions/12389346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1665789/"
] | You need to add the Overloads keyword to the BeginErrorReadLine method signature.
```
Public Overloads Sub BeginErrorReadLine() '<-------------Error 3
```
The event declarations need to be declared as Shadows because they otherwise conflict with the base class event declarations.
```
Public Shadows Event Output... | Below is the code I am using now. I removed the namespace as I did not know how to inlcude a second namespace in my project and pasted the code into a new Module. Then as suggested in the original c# solution i just changed my "p as new process" to "p as new FixedProcess".
Thanks again for all the suggestions!
You g... |
9,153,102 | Ok this has really got me confused.
This query returns the expected results albeit with duplicate car\_id numbers
```
SELECT car_id FROM `Updates` ORDER BY `updates`.`created` DESC
```
These 2 queries return the same set of results:
```
SELECT distinct `Updates`.`car_id` FROM `Updates` ORDER BY `updates`.`created`... | 2012/02/05 | [
"https://Stackoverflow.com/questions/9153102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222285/"
] | You're ordering by `updates.created`. Presumably this means that each distinct `carid` will come up, just not exactly where you expect it to. Try ordering by `carid` to perform the comparison. | Would Something Like This Work:
SELECT \* FROM Updates GROUP BY car\_id ORDER BY created DESC |
9,153,102 | Ok this has really got me confused.
This query returns the expected results albeit with duplicate car\_id numbers
```
SELECT car_id FROM `Updates` ORDER BY `updates`.`created` DESC
```
These 2 queries return the same set of results:
```
SELECT distinct `Updates`.`car_id` FROM `Updates` ORDER BY `updates`.`created`... | 2012/02/05 | [
"https://Stackoverflow.com/questions/9153102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222285/"
] | I don't think that this is strictly relevant with your problem but:
```
SELECT DISTINCT car_id
FROM Updates
ORDER BY created DESC
```
is not valid standard SQL syntax. There may be many rows with same `car_id` and different `created` values. Which one should be used for the ordering?
Perhaps you want to rewrite t... | You're ordering by `updates.created`. Presumably this means that each distinct `carid` will come up, just not exactly where you expect it to. Try ordering by `carid` to perform the comparison. |
9,153,102 | Ok this has really got me confused.
This query returns the expected results albeit with duplicate car\_id numbers
```
SELECT car_id FROM `Updates` ORDER BY `updates`.`created` DESC
```
These 2 queries return the same set of results:
```
SELECT distinct `Updates`.`car_id` FROM `Updates` ORDER BY `updates`.`created`... | 2012/02/05 | [
"https://Stackoverflow.com/questions/9153102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222285/"
] | I don't think that this is strictly relevant with your problem but:
```
SELECT DISTINCT car_id
FROM Updates
ORDER BY created DESC
```
is not valid standard SQL syntax. There may be many rows with same `car_id` and different `created` values. Which one should be used for the ordering?
Perhaps you want to rewrite t... | Would Something Like This Work:
SELECT \* FROM Updates GROUP BY car\_id ORDER BY created DESC |
22,847,865 | Please consider the following statement:
```
var matches = person.Contacts.Where(c => c.ContactType == searchContact.ContactType).ToList();
```
This will filter all the records with matching ContactType of searchContact object and returns only the filtered Contacts of person.
But without ToList() method call at the ... | 2014/04/03 | [
"https://Stackoverflow.com/questions/22847865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1710097/"
] | >
> But without ToList() method call at the end of the Where clause, it will return all the Contacts of person.
>
>
>
No, without `ToList` it will return a query which, when iterated, will yield all of the contacts matching the value you specified to filter on. Calling `ToList` only materializes that query into th... | >
> But without ToList() method call at the end of the Where clause, it will return all the Contacts of person.
>
>
>
You are wrong.`ToList` is just forces the iteration and gives you your *filtered elements* as a `List`.`LINQ` uses deferred execution which means until you use `foreach` loop to iterate over items ... |
22,847,865 | Please consider the following statement:
```
var matches = person.Contacts.Where(c => c.ContactType == searchContact.ContactType).ToList();
```
This will filter all the records with matching ContactType of searchContact object and returns only the filtered Contacts of person.
But without ToList() method call at the ... | 2014/04/03 | [
"https://Stackoverflow.com/questions/22847865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1710097/"
] | You are mistaken. Without calling `ToList()` or another method to force immediate execution, both statements will return an `IQueryable<T>`. Until you iterate over your query variable by using a `foreach` the query variable remains just that.
This article on MSDN should explain things well: [Query Execution](http://m... | >
> But without ToList() method call at the end of the Where clause, it will return all the Contacts of person.
>
>
>
You are wrong.`ToList` is just forces the iteration and gives you your *filtered elements* as a `List`.`LINQ` uses deferred execution which means until you use `foreach` loop to iterate over items ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.