qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
4,971,909 | Is there any way of getting the "Windows Live Anonymous ID" from a PC based on the users e-mail-adress, logged in Windows-account, registry, Zune, currently usb-connected phone or else? | 2011/02/11 | [
"https://Stackoverflow.com/questions/4971909",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/382838/"
] | There are several guides besides the [Core Data Programming Guide](http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreData/) that are relevant:
* [Model Object Implementation Guide](http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ModelObjects/)
* [Key-Value Coding Programmi... | Marcus S. Zarra's "Core Data" book gets good reviews. |
23,774,871 | I have a dc.js ordinal chart whose x-axis consists of things like 'Cosmetics' and the y-axis is the number of sales. I want to sort the chart by sales decreasing, however when I use `.ordering(function(d){return -d.value.ty})` the path of the line chart is still ordered by the x-axis. is faster than top(Infinity). For some reason I couldn't get [Gordon's answer](https://stackoverflow.com/questions/23774871/dc-js-sort-ordinal-line-chart-by-y-axis-value/23788922#23788922) to work, but in theor... | No doubt this is a bug.
As a workaround, you could sort the data yourself instead of using the ordering function, [as described in the FAQ](https://github.com/dc-js/dc.js/wiki/FAQ#filter-the-data-before-its-charted).
I filed a bug report: <https://github.com/dc-js/dc.js/issues/598> |
23,774,871 | I have a dc.js ordinal chart whose x-axis consists of things like 'Cosmetics' and the y-axis is the number of sales. I want to sort the chart by sales decreasing, however when I use `.ordering(function(d){return -d.value.ty})` the path of the line chart is still ordered by the x-axis. is faster than top(Infinity). For some reason I couldn't get [Gordon's answer](https://stackoverflow.com/questions/23774871/dc-js-sort-ordinal-line-chart-by-y-axis-value/23788922#23788922) to work, but in theor... | It does appear to be a bug. I too couldn't make it work as intended.
I implemented a workaround; I added an example in a Plunker, link is (also) in the dc.js issue at github.
It is based upon a recent snapshot of dc.js 2.0.0-dev.
(So for now I guess this could be considered an answer)
<http://embed.plnkr.co/VItIQ4ZcW9... |
417,952 | I have a question that is similar to [How can I make a custom theorem for a definition?](https://tex.stackexchange.com/questions/83446/how-can-i-make-a-custom-theorem-for-a-definition) and also to [Custom theorem numbering italicized](https://tex.stackexchange.com/questions/286129/custom-theorem-numbering-italicized), ... | 2018/03/01 | [
"https://tex.stackexchange.com/questions/417952",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/81928/"
] | (edited the answer after the OP provided more information about the desired appearance of the theorem-like environment.
I would like to suggest that you use the `amsthm` package and define a new theorem style, called `sltheoremstyle` in the example below.
[ ahead...
```
\documentclass{article}
\usepackage{blindtext}
\usepackage[most]{tcolorbox}
\newtcbtheorem{slantedtheorem}{Theorems from hell}{colback=yellow!20!white,colbacktitle={yellow!40!white},coltitle={black},fontupper=\slshape,fonttitle={\slshape}}{sltheo}
\begin{document}
\begin{slant... |
56,123,544 | I have a list as follows:
```
number_list = (1, 2, 3, 4, 5, 6, 7).
```
I want to get a list which contain elements greater than 3. It should be something like this.
```
new_list = (4, 5, 6, 7)
```
I can do something like foreach, to check every elements until it is smaller than 3. But is there other way to do th... | 2019/05/14 | [
"https://Stackoverflow.com/questions/56123544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4566981/"
] | Have you tried *Linq* and [`Where`](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.where?view=netframework-4.8)
>
> Filters a sequence of values based on a predicate.
>
>
>
```
var results = number_list.Where(x => x > someAwesomeNumber)
``` | One way is `FindAll` which returns a `List`
```
List<int> items = new List<int>() { 1, 2, 3, 4, 5, 6, 7 };
items = items.FindAll(x => x < 3);
```
another way is `Where` combined with `ToList`
```
List<int> items = new List<int>() { 1, 2, 3, 4, 5, 6, 7 };
items = items.Where(x => x < 3).ToList();
``` |
2,192,560 | Hi to all you mighty SQLsuperheros out there..
Can anyone rescue me from imminent disaster and ruin?
I'm working with Microsoft Access SQL. I'd like to select records in one table (table1) that don't appear in another (table2) .. and then insert new records into table2 that are based on records in table1, as follows:
... | 2010/02/03 | [
"https://Stackoverflow.com/questions/2192560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265323/"
] | Will this do? Obviously add some square brackets and stuff. Not too into Access myself.
```
INSERT INTO table2 (file_index, celeb_name)
SELECT file_index, 'Audrey Hepburn'
FROM table1
WHERE filename = 'aud'
AND file_index NOT IN (SELECT DISTINCT file_index
FROM table2
... | In the original question I'd modified my table and field names and inserted square brackets in to make it easier to read.
Below is the final SQL statement that worked in MS Access format. Awesome result, thanks again Tor!!
```
INSERT INTO photos_by_celebrity ( ORIG_FILE_INDEX, celebrity_name )
SELECT tblOriginal_Fi... |
2,192,560 | Hi to all you mighty SQLsuperheros out there..
Can anyone rescue me from imminent disaster and ruin?
I'm working with Microsoft Access SQL. I'd like to select records in one table (table1) that don't appear in another (table2) .. and then insert new records into table2 that are based on records in table1, as follows:
... | 2010/02/03 | [
"https://Stackoverflow.com/questions/2192560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265323/"
] | Will this do? Obviously add some square brackets and stuff. Not too into Access myself.
```
INSERT INTO table2 (file_index, celeb_name)
SELECT file_index, 'Audrey Hepburn'
FROM table1
WHERE filename = 'aud'
AND file_index NOT IN (SELECT DISTINCT file_index
FROM table2
... | As I said in comments, NOT IN is not well-optimized by Jet/ACE and it's usually more efficient to use an OUTER JOIN. In this case, because you need to filter on the outer side of the join, you'll need a subquery:
```
INSERT INTO photos_by_celebrity ( ORIG_FILE_INDEX, celebrity_name )
SELECT tblOriginal_Files.ORIG_... |
2,192,560 | Hi to all you mighty SQLsuperheros out there..
Can anyone rescue me from imminent disaster and ruin?
I'm working with Microsoft Access SQL. I'd like to select records in one table (table1) that don't appear in another (table2) .. and then insert new records into table2 that are based on records in table1, as follows:
... | 2010/02/03 | [
"https://Stackoverflow.com/questions/2192560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265323/"
] | Will this do? Obviously add some square brackets and stuff. Not too into Access myself.
```
INSERT INTO table2 (file_index, celeb_name)
SELECT file_index, 'Audrey Hepburn'
FROM table1
WHERE filename = 'aud'
AND file_index NOT IN (SELECT DISTINCT file_index
FROM table2
... | You can use `NOT Exists`
I think it is the best way from the side of performance.
As Follow:
```
INSERT INTO table2 (file_index, celeb_name)
SELECT file_index, 'Audrey Hepburn'
FROM table1
WHERE filename = 'aud'
AND NOT Exists (SELECT file_index
FROM table2
WHERE... |
2,192,560 | Hi to all you mighty SQLsuperheros out there..
Can anyone rescue me from imminent disaster and ruin?
I'm working with Microsoft Access SQL. I'd like to select records in one table (table1) that don't appear in another (table2) .. and then insert new records into table2 that are based on records in table1, as follows:
... | 2010/02/03 | [
"https://Stackoverflow.com/questions/2192560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265323/"
] | As I said in comments, NOT IN is not well-optimized by Jet/ACE and it's usually more efficient to use an OUTER JOIN. In this case, because you need to filter on the outer side of the join, you'll need a subquery:
```
INSERT INTO photos_by_celebrity ( ORIG_FILE_INDEX, celebrity_name )
SELECT tblOriginal_Files.ORIG_... | In the original question I'd modified my table and field names and inserted square brackets in to make it easier to read.
Below is the final SQL statement that worked in MS Access format. Awesome result, thanks again Tor!!
```
INSERT INTO photos_by_celebrity ( ORIG_FILE_INDEX, celebrity_name )
SELECT tblOriginal_Fi... |
2,192,560 | Hi to all you mighty SQLsuperheros out there..
Can anyone rescue me from imminent disaster and ruin?
I'm working with Microsoft Access SQL. I'd like to select records in one table (table1) that don't appear in another (table2) .. and then insert new records into table2 that are based on records in table1, as follows:
... | 2010/02/03 | [
"https://Stackoverflow.com/questions/2192560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/265323/"
] | As I said in comments, NOT IN is not well-optimized by Jet/ACE and it's usually more efficient to use an OUTER JOIN. In this case, because you need to filter on the outer side of the join, you'll need a subquery:
```
INSERT INTO photos_by_celebrity ( ORIG_FILE_INDEX, celebrity_name )
SELECT tblOriginal_Files.ORIG_... | You can use `NOT Exists`
I think it is the best way from the side of performance.
As Follow:
```
INSERT INTO table2 (file_index, celeb_name)
SELECT file_index, 'Audrey Hepburn'
FROM table1
WHERE filename = 'aud'
AND NOT Exists (SELECT file_index
FROM table2
WHERE... |
50,097,378 | I am hoping someone can help me!
I am trying to work out the formula(s) on how to auto populate data from two different columns based on another cells value in excel.
I have the following headings shown on the sheet that contains all the data:-
**System Size Panels | Inverter Type | Sell - FINANCE PRICE | Sell - cas... | 2018/04/30 | [
"https://Stackoverflow.com/questions/50097378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9720407/"
] | If you have only two different price levels (cash and finance) then an if statement combined with a vlookup should do it the syntax would similar to
```
=IF(payment = "Cash", vlookup(system size ,data table,cash price),vlookup(system size,datatable,finance price)
```
If you have more than two or 3 price levels IF s... | I've looked at the screen shots but as they don't show the column letters and row numbers it's difficult to provide an exact syntax, but it should look a bit like the attached screenshot - you'll need to adjust the references to reflect the layout of your worksheets and use absolute ($) references for the data table so... |
24,878 | What is the longest -1 word (or the word worth most in Scrabble for words with the same amount of letters (which is just the addition of all the letter values of the original 'word', no constraints)), where a -1 word is defined as:
* This 'word' does not have to be an actual word, just a string of letters.
* one can r... | 2015/12/27 | [
"https://puzzling.stackexchange.com/questions/24878",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/167/"
] | Here's a 7-letter -1 word:
>
> **PASTERS** ([English word](http://dictionary.reference.com/browse/pasters), score: 9)
>
>
>
> [**M**ASTERS](http://dictionary.reference.com/browse/masters)
>
> [P**O**STERS](http://dictionary.reference.com/browse/posters)
>
> [PA**T**TERS](http://dictionary.reference.com/... | Ok, let's get the ball rolling with a simple 5-letter word:
>
> **SLOPS**
>
>
>
> With the changed words being:
>
> **F**LOPS
>
> S**T**OPS
>
> SL**A**PS
>
> SLO**T**S
>
> SLOP**E**
>
>
> |
24,878 | What is the longest -1 word (or the word worth most in Scrabble for words with the same amount of letters (which is just the addition of all the letter values of the original 'word', no constraints)), where a -1 word is defined as:
* This 'word' does not have to be an actual word, just a string of letters.
* one can r... | 2015/12/27 | [
"https://puzzling.stackexchange.com/questions/24878",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/167/"
] | Here's a 7-letter -1 word:
>
> **PASTERS** ([English word](http://dictionary.reference.com/browse/pasters), score: 9)
>
>
>
> [**M**ASTERS](http://dictionary.reference.com/browse/masters)
>
> [P**O**STERS](http://dictionary.reference.com/browse/posters)
>
> [PA**T**TERS](http://dictionary.reference.com/... | 7 letters, score 13
-------------------
There are no 8 to 15 letter solutions using SOWPODS. The best word which is valid with both SOWPODS and dictionary.com scores 13:
>
> POPPIES
>
>
>
> KOPPIES
>
> PAPPIES or PUPPIES
>
> POTPIES
>
> POPSIES
>
> POPPLES
>
> POPPITS
>
> POPPIED
> ... |
64,664,374 | I have the following PHP function which works well in almost all cases:
```
function NormalizeWords($str, $disallowAllUppercase = false){
$parts = explode(' ', $str);
if($disallowAllUppercase){
$result = array_map(function($x){
return ucwords(strtolower($x));
}, $parts);
}else{... | 2020/11/03 | [
"https://Stackoverflow.com/questions/64664374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1136267/"
] | I just wanted to play a little and i made this
```
function normalize($str, $disallowAllUppercase = false) {
$arr = array_map(function ($w) use ($disallowAllUppercase) {
return ucfirst((strtoupper($w) !== $w || $disallowAllUppercase) ? strtolower($w) : $w);
}, explode(" ", $str));
return implode(" ... | As described in the documentation for `ucwords` you can use the second parameter:
<https://www.php.net/manual/en/function.ucwords.php>
>
> The optional delimiters contains the word separator characters.
>
>
>
You can define the ampersand as an additional delimiter. Note that you should pass the default values (l... |
1,296,667 | Suppose we are given that $\phi : \mathbb{R}^4 \rightarrow \mathbb{R}^3$, and also that $\ker\phi$ is the span of
$\{\begin{pmatrix} 1 \\ 0 \\ 1 \\ 1 \end{pmatrix}, \begin{pmatrix} 2 \\ 1 \\ 0 \\ 1 \end{pmatrix}\}$
How can we find a matrix which corresponds to the linear map $\phi$?
Edit: I'm not looking for the uni... | 2015/05/24 | [
"https://math.stackexchange.com/questions/1296667",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/243088/"
] | Call your vectors $v\_1,v\_2$. Pick two vectors $v\_3,v\_4$ such that $\{ v\_1,\dots,v\_4 \}$ is a linearly independent set. Pick linearly independent images $w\_1,w\_2$ for them. (The linear independence ensures that the kernel contains *only* your given vectors.) Then you want $A$ such that
$$A \begin{bmatrix} v\_1 ... | **Short answer:** Knowing the kernel is not enough to determine the whole matrix (unless the kernel is not the whole domain).
**Explanation:** To determine a matrix uniquely, you have to know the image of each basis vector of the domain (after you fix a certain basis in the domain). So you can complete the basis of th... |
403,510 | A user uses the following strategy: when they open a new question, they go to an answer of mine (which is possibly totally unrelated to the question) and uses a comment to ask me to take a look at their question. Comments are not intended to such a practice. What should I do? Should I flag this comment? | 2020/12/09 | [
"https://meta.stackoverflow.com/questions/403510",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/1100107/"
] | Flag them as:
>
> **It's no longer needed.**
>
> This comment is outdated, conversational or not relevant to this post.
>
>
>
The comment will then be deleted by a moderator.
As for what you do after, it's up to you; you can go and answer their question or ignore it. I, personally, tend to do the latter as I ... | This is plain and simple harassment - Stack Overflow does not exist to be an on-demand helpdesk. Immediately flag such comments for moderation attention with an appropriate explanation.
If the user is smart and/or just wasn't aware of the rules (reminder: not an excuse, it's *their duty* to know those), they will desi... |
30,287,381 | I've googled some around the internet and found some articles about the subject, but none of them satisfied me. I want to know is it good to use object-object mapper to map objects to each other? I know it depends on situation to use, but how will I realize a good or best situation to use? | 2015/05/17 | [
"https://Stackoverflow.com/questions/30287381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3569825/"
] | You should concatenate lists, and put nested list to brackets
```
>>> [[-1, y] for y in range(-1, 2)] + [[0, 1], [[1, z] for z in range(1, -2, -1)], [0, -1]]
[[-1, -1], [-1, 0], [-1, 1], [0, 1], [[1, 1], [1, 0], [1, -1]], [0, -1]]
``` | Check out [itertools](https://docs.python.org/2/library/itertools.html). Not sure from your question whether you're going to want `product`, `permutations` or `combinations` but I think one of those will be what you need.
edit: On closer inspection, you're doing something much simpler and you just missed a few bracket... |
567,250 | I have a lot of places in my dissertation where the plus sign appears surrounded by capital letters in text, e.g. NNLL+NNLO.
The problem is that by default, the + is aligned so low vertically, that among caps it looks badly aligned.
By playing around with the `\raisebox`, I found that it looks quite a bit better ... | 2020/10/17 | [
"https://tex.stackexchange.com/questions/567250",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/35990/"
] | I'm not sure that 0.25ex is the right choice: it actually makes the + sign to be slightly higher than a capital letter.
Using different fonts might also make the situation even worse. For instance, with Times you'd get
[](https://i.stack.imgur.com/2c... | [](https://i.stack.imgur.com/9Yoch.png)
You could make + active and raise itself in text mode and not in math, but something would break, it is quite hard to catch all cases of `\dimexpr \parindent + 5pt\relax` and ensure you don't add a `\raisebox` m... |
567,250 | I have a lot of places in my dissertation where the plus sign appears surrounded by capital letters in text, e.g. NNLL+NNLO.
The problem is that by default, the + is aligned so low vertically, that among caps it looks badly aligned.
By playing around with the `\raisebox`, I found that it looks quite a bit better ... | 2020/10/17 | [
"https://tex.stackexchange.com/questions/567250",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/35990/"
] | [](https://i.stack.imgur.com/9Yoch.png)
You could make + active and raise itself in text mode and not in math, but something would break, it is quite hard to catch all cases of `\dimexpr \parindent + 5pt\relax` and ensure you don't add a `\raisebox` m... | Here my solution for a `+` sign between text letters (inspired in [this answer](https://tex.stackexchange.com/questions/52503/sign-in-international-phone-numbers#52517)). It has following features:
* I offer both a solution for **capital** (`\Plus`) and **lower case** (`\plus`) letters. For the lower case, I recommend... |
567,250 | I have a lot of places in my dissertation where the plus sign appears surrounded by capital letters in text, e.g. NNLL+NNLO.
The problem is that by default, the + is aligned so low vertically, that among caps it looks badly aligned.
By playing around with the `\raisebox`, I found that it looks quite a bit better ... | 2020/10/17 | [
"https://tex.stackexchange.com/questions/567250",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/35990/"
] | I'm not sure that 0.25ex is the right choice: it actually makes the + sign to be slightly higher than a capital letter.
Using different fonts might also make the situation even worse. For instance, with Times you'd get
[](https://i.stack.imgur.com/2c... | Here my solution for a `+` sign between text letters (inspired in [this answer](https://tex.stackexchange.com/questions/52503/sign-in-international-phone-numbers#52517)). It has following features:
* I offer both a solution for **capital** (`\Plus`) and **lower case** (`\plus`) letters. For the lower case, I recommend... |
158,339 | I have removed Transparent Data Encryption (TDE) from my server, dropped the key and switched the databases to *Simple*, shrunk the log and then back to *Full*.
The LOG backups are now smaller as well as the full backups but the main mdf files are still the same size after removing TDE.
Is this normal? Is there a way... | 2016/12/16 | [
"https://dba.stackexchange.com/questions/158339",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/33758/"
] | Yes this is normal. SQL Server will only automatically reduce the size of data files if you have `AUTO SHRINK` switched on and there is space available in the files. This setting is not recommended as it will introduce considerable fragmentation and consume considerable IO resources.
You could do a one time shrink wit... | *Answer originally left in a comment*
TDE doesn't always double the data file sizes. It will increase because of the post-encryption data format. but depending on the original data types and sizes, you might have a much bigger (double) or just somewhat bigger data file.
If your data prior to TDE was already not highl... |
1,969,085 | >
> Created by Microsoft as the foundation
> of its .NET technology, the Common
> Language Infrastructure (CLI) is an
> ECMA standard (ECMA-335) that allows
> applications to be written in a
> variety of high-level programming
> languages and executed in different
> *system environments*. Programming languages ... | 2009/12/28 | [
"https://Stackoverflow.com/questions/1969085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239522/"
] | "System environments" means things like Linux, Windows x86, Windows x64, etc. Notice how they use the term "architecture" interchangeably at the end of the paragraph.
---
A native C++ program is one where you take standard (ANSI/ISO) C++ and you compile it into a .exe. Usually you will be compiling this for a specifi... | I am getting a bit rusty and cannot recall when exactly the word "native" popped up into the common parlance. I believe it was massively used by designers of environments destined to simplify programming running on the top of other ones designed to offer optimal access to system resources with limited focus on the prog... |
20,045,459 | I have 'Strict On' and am getting the error quoted below. Normally, the program breaks and would offer possible ways to correct error, but not in this case. As I am a new user to VB.Net, I need to understand why this error is happening in Strict mode and not when it is turned off.
I would be grateful if someone could... | 2013/11/18 | [
"https://Stackoverflow.com/questions/20045459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1532468/"
] | [`ListViewItemCollection.Add`](http://msdn.microsoft.com/en-us/library/ttzhk9y3%28v=vs.110%29.aspx) has no overload that takes a `Date` but one for `String` and one for `ListVieItem`. But you are passing a `Date` which is not convertible to string implicitely. If you want to show the short date pattern you could use `T... | Try change it to this.
>
> ListView1.Items.Add(CDate(dr(4)).ToString()).UseItemStyleForSubItems =
> False
>
>
> |
68,500,490 | here's my table data
| firstname | lastname |
| --- | --- |
| boy | 5 |
| boy | 55 |
| boy | 6 |
| boy | 7 |
here's my codes inside a search function
```
$search = $request->search;
$users = \DB::table('users')
->where(function($query) use ($search){
$query->where('firstname', 'like', '%'.$searc... | 2021/07/23 | [
"https://Stackoverflow.com/questions/68500490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/133392/"
] | Replace
```
$query->orWhereRaw(" concat(firstname, ' ', lastname) like '%?%' ", [$search])
```
With
```
$query->orWhereRaw("concat(firstname, ' ', lastname) like ?", ['%'.$search.'%'])
``` | check out the below example and adjust your query function accordingly
```
//what is provided from search bar
$query = $request->input('query');
//db tbl that gets queried
$spa = spa::latest()->where('spa_name', 'LIKE', '%'.$query.'%')
->orwhere('more_details','LIKE', '%'.$query.'%')->get();
``` |
48,802,463 | I have a non-linear minimization problem that takes a combination of continuous and binary variables as input. Think of it as a network flow problem with valves, for which the throughput can be controlled, and with pumps, for which you can change the direction.
A "natural," minimalistic formulation could be:
```
arg(... | 2018/02/15 | [
"https://Stackoverflow.com/questions/48802463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2918960/"
] | As Martin Smith suggested, you just need to use a string splitting function and `join` the results together:
```
declare @NameList nvarchar(100) = 'Hi|Hi1|Hi2';
declare @DESCLIST nvarchar(100) = 'Hii|Hii1|Hii2';
declare @SEQList nvarchar(100) = '1|2|3';
select s1.item as Name
,s2.item as [Desc]
,s3.item a... | I would use the function:
```
STRING_SPLIT (string, separator)
```
with table values that divides a string into rows of substrings, according to a specified separator character and would return the records by assigning them an id through the Row\_number function that returns a sequential number to each row within a ... |
16,458,166 | I have commented out csrf processor and middleware lines in `settings.py`:
```
122
123 TEMPLATE_CONTEXT_PROCESSORS = (
124 'django.contrib.auth.context_processors.auth',
125 # 'django.core.context_processors.csrf',
126 'django.core.context_processors.request',
127 'django.core.context_processors.static... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16458166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/802585/"
] | For **Django 2**:
```
from django.utils.deprecation import MiddlewareMixin
class DisableCSRF(MiddlewareMixin):
def process_request(self, request):
setattr(request, '_dont_enforce_csrf_checks', True)
```
That middleware must be added to `settings.MIDDLEWARE` when appropriate (in your test settings for ex... | Before using this solution, please read [this link from documentation](https://docs.djangoproject.com/en/dev/ref/csrf/#contrib-and-reusable-apps)
-------------------------------------------------------------------------------------------------------------------------------------------------
---
I solved this problem ... |
16,458,166 | I have commented out csrf processor and middleware lines in `settings.py`:
```
122
123 TEMPLATE_CONTEXT_PROCESSORS = (
124 'django.contrib.auth.context_processors.auth',
125 # 'django.core.context_processors.csrf',
126 'django.core.context_processors.request',
127 'django.core.context_processors.static... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16458166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/802585/"
] | The answer might be inappropriate, but I hope it helps you
```
class DisableCSRFOnDebug(object):
def process_request(self, request):
if settings.DEBUG:
setattr(request, '_dont_enforce_csrf_checks', True)
```
Having middleware like this helps to debug requests and to check csrf in production s... | Before using this solution, please read [this link from documentation](https://docs.djangoproject.com/en/dev/ref/csrf/#contrib-and-reusable-apps)
-------------------------------------------------------------------------------------------------------------------------------------------------
---
I solved this problem ... |
16,458,166 | I have commented out csrf processor and middleware lines in `settings.py`:
```
122
123 TEMPLATE_CONTEXT_PROCESSORS = (
124 'django.contrib.auth.context_processors.auth',
125 # 'django.core.context_processors.csrf',
126 'django.core.context_processors.request',
127 'django.core.context_processors.static... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16458166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/802585/"
] | To disable CSRF for class-based views, the following worked for me.
I'm using Django 1.10 and Python 3.5.2
```
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
@method_decorator(csrf_exempt, name='dispatch')
class TestView(View):
def post(self, request, *a... | Before using this solution, please read [this link from documentation](https://docs.djangoproject.com/en/dev/ref/csrf/#contrib-and-reusable-apps)
-------------------------------------------------------------------------------------------------------------------------------------------------
---
I solved this problem ... |
16,458,166 | I have commented out csrf processor and middleware lines in `settings.py`:
```
122
123 TEMPLATE_CONTEXT_PROCESSORS = (
124 'django.contrib.auth.context_processors.auth',
125 # 'django.core.context_processors.csrf',
126 'django.core.context_processors.request',
127 'django.core.context_processors.static... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16458166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/802585/"
] | To disable CSRF for class-based views, the following worked for me.
I'm using Django 1.10 and Python 3.5.2
```
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
@method_decorator(csrf_exempt, name='dispatch')
class TestView(View):
def post(self, request, *a... | The problem here is that SessionAuthentication performs its own CSRF validation. That is why you get the CSRF missing error even when the CSRF Middleware is commented.
You could add @csrf\_exempt to every view, but if you want to disable CSRF and have session authentication for the whole app, you can add an extra middl... |
16,458,166 | I have commented out csrf processor and middleware lines in `settings.py`:
```
122
123 TEMPLATE_CONTEXT_PROCESSORS = (
124 'django.contrib.auth.context_processors.auth',
125 # 'django.core.context_processors.csrf',
126 'django.core.context_processors.request',
127 'django.core.context_processors.static... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16458166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/802585/"
] | If you just need some views not to use CSRF, you can use `@csrf_exempt`:
```
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def my_view(request):
return HttpResponse('Hello world')
```
You can find more examples and other scenarios in the Django documentation:
* <https://docs.djangoproject.c... | If you want disable it in Global, you can write a custom middleware, like this
```
from django.utils.deprecation import MiddlewareMixin
class DisableCsrfCheck(MiddlewareMixin):
def process_request(self, req):
attr = '_dont_enforce_csrf_checks'
if not getattr(req, attr, False):
setattr... |
16,458,166 | I have commented out csrf processor and middleware lines in `settings.py`:
```
122
123 TEMPLATE_CONTEXT_PROCESSORS = (
124 'django.contrib.auth.context_processors.auth',
125 # 'django.core.context_processors.csrf',
126 'django.core.context_processors.request',
127 'django.core.context_processors.static... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16458166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/802585/"
] | To disable CSRF for class-based views, the following worked for me.
I'm using Django 1.10 and Python 3.5.2
```
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
@method_decorator(csrf_exempt, name='dispatch')
class TestView(View):
def post(self, request, *a... | For **Django 2**:
```
from django.utils.deprecation import MiddlewareMixin
class DisableCSRF(MiddlewareMixin):
def process_request(self, request):
setattr(request, '_dont_enforce_csrf_checks', True)
```
That middleware must be added to `settings.MIDDLEWARE` when appropriate (in your test settings for ex... |
16,458,166 | I have commented out csrf processor and middleware lines in `settings.py`:
```
122
123 TEMPLATE_CONTEXT_PROCESSORS = (
124 'django.contrib.auth.context_processors.auth',
125 # 'django.core.context_processors.csrf',
126 'django.core.context_processors.request',
127 'django.core.context_processors.static... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16458166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/802585/"
] | For **Django 2**:
```
from django.utils.deprecation import MiddlewareMixin
class DisableCSRF(MiddlewareMixin):
def process_request(self, request):
setattr(request, '_dont_enforce_csrf_checks', True)
```
That middleware must be added to `settings.MIDDLEWARE` when appropriate (in your test settings for ex... | CSRF can be enforced at the view level, which **can't be disabled globally**.
In some cases this is a pain, but um, "it's for security". Gotta retain those AAA ratings.
<https://docs.djangoproject.com/en/dev/ref/csrf/#contrib-and-reusable-apps> |
16,458,166 | I have commented out csrf processor and middleware lines in `settings.py`:
```
122
123 TEMPLATE_CONTEXT_PROCESSORS = (
124 'django.contrib.auth.context_processors.auth',
125 # 'django.core.context_processors.csrf',
126 'django.core.context_processors.request',
127 'django.core.context_processors.static... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16458166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/802585/"
] | In `setting.py` in MIDDLEWARE you can simply remove/comment this line:
```
'django.middleware.csrf.CsrfViewMiddleware',
``` | The answer might be inappropriate, but I hope it helps you
```
class DisableCSRFOnDebug(object):
def process_request(self, request):
if settings.DEBUG:
setattr(request, '_dont_enforce_csrf_checks', True)
```
Having middleware like this helps to debug requests and to check csrf in production s... |
16,458,166 | I have commented out csrf processor and middleware lines in `settings.py`:
```
122
123 TEMPLATE_CONTEXT_PROCESSORS = (
124 'django.contrib.auth.context_processors.auth',
125 # 'django.core.context_processors.csrf',
126 'django.core.context_processors.request',
127 'django.core.context_processors.static... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16458166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/802585/"
] | The problem here is that SessionAuthentication performs its own CSRF validation. That is why you get the CSRF missing error even when the CSRF Middleware is commented.
You could add @csrf\_exempt to every view, but if you want to disable CSRF and have session authentication for the whole app, you can add an extra middl... | CSRF can be enforced at the view level, which **can't be disabled globally**.
In some cases this is a pain, but um, "it's for security". Gotta retain those AAA ratings.
<https://docs.djangoproject.com/en/dev/ref/csrf/#contrib-and-reusable-apps> |
16,458,166 | I have commented out csrf processor and middleware lines in `settings.py`:
```
122
123 TEMPLATE_CONTEXT_PROCESSORS = (
124 'django.contrib.auth.context_processors.auth',
125 # 'django.core.context_processors.csrf',
126 'django.core.context_processors.request',
127 'django.core.context_processors.static... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16458166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/802585/"
] | The problem here is that SessionAuthentication performs its own CSRF validation. That is why you get the CSRF missing error even when the CSRF Middleware is commented.
You could add @csrf\_exempt to every view, but if you want to disable CSRF and have session authentication for the whole app, you can add an extra middl... | If you want disable it in Global, you can write a custom middleware, like this
```
from django.utils.deprecation import MiddlewareMixin
class DisableCsrfCheck(MiddlewareMixin):
def process_request(self, req):
attr = '_dont_enforce_csrf_checks'
if not getattr(req, attr, False):
setattr... |
11,138 | In many germanic languages you change the word order if you want it to be a question.
Statement: You are tired.
Question: Are you tired?
If I put “Are” at the beginning it becomes a question.
*Sei un po' stanco?* in Italian means “Are you tired?” but it also sounds like a statement.
In Italian you cannot simply cha... | 2019/10/14 | [
"https://italian.stackexchange.com/questions/11138",
"https://italian.stackexchange.com",
"https://italian.stackexchange.com/users/-1/"
] | >
> How do Italians then ask questions? By adding a question mark in texts and changing the pitch in speech?
>
>
>
That's exactly how you do it, for questions implying a yes/no answer. | That's correct; it's explained on the [Wikipedia page on Italian grammar](https://en.wikipedia.org/wiki/Italian_grammar#Syntax):
>
> Questions are formed by a rising intonation at the end of the sentence (in written form, a question mark). There is usually no other special marker, although [wh-movement](https://en.wi... |
632,593 | From Newton’s second law, $F=ma$, a massless object will always have zero net force. So can a massless pulley accelerate? | 2021/04/28 | [
"https://physics.stackexchange.com/questions/632593",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/297131/"
] | Yes.
As an example from life, consider a transformer. When the primary current is zero, there is no current in the secondary circuit too. All the electrons are stationary (from a classical perspective). After you have started the primary current, the magnetic field in the core will change. This leads to an electrical ... | >
> Will a stationary charge be affected by changing magnetic field?
>
>
>
Yes. The force on a charge by an electro-magnetic field is called the Lorentz force, and is given by the equation
$$\vec{F} = q(\vec{E} + (\vec{v} \times \vec{B}))$$
Where
* $q$ is the charge
* $\vec{E}$ is the electric field
* $\vec{v}$... |
48,508,820 | I am building a system for writing code about people who take pictures of birds (the real system isn't actually about that, I use birds here to replace the business logic that I can't post). I'm having trouble keeping my code type safe while also enforcing all of the relationships I want and avoiding the code becoming ... | 2018/01/29 | [
"https://Stackoverflow.com/questions/48508820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5848944/"
] | Your specific example can be done without warnings as follows:
```
Photographer<?, ?, ?> typicalTourist = photographerProvider.get(mostCommonBirdType);
foo(typicalTourist);
<BT extends BirdType,
CAM extends BirdCamera<BT>> void foo(Photographer<BT, CAM, ?> typicalTourist) {
CAM cam = typicalTourist.getPhotograph... | In addition to [Andy's answer](https://stackoverflow.com/a/48509029/7294647), your `PhotographerProvider#get` method issues a compiler warning due to its raw return type `Photographer`. To fix that, you can use the following:
```
public class PhotographerProvider {
public Photographer<?, ?, ?> get(int birdCode) {
... |
48,508,820 | I am building a system for writing code about people who take pictures of birds (the real system isn't actually about that, I use birds here to replace the business logic that I can't post). I'm having trouble keeping my code type safe while also enforcing all of the relationships I want and avoiding the code becoming ... | 2018/01/29 | [
"https://Stackoverflow.com/questions/48508820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5848944/"
] | Your specific example can be done without warnings as follows:
```
Photographer<?, ?, ?> typicalTourist = photographerProvider.get(mostCommonBirdType);
foo(typicalTourist);
<BT extends BirdType,
CAM extends BirdCamera<BT>> void foo(Photographer<BT, CAM, ?> typicalTourist) {
CAM cam = typicalTourist.getPhotograph... | Your method PhotographerProvider.get return a raw Photographer of unknow type of camera and birds:
```
public Photographer get(int birdCode) {
[...]
}
```
you could instead write something like
```
public <BT extends BirdType, CAM extends BirdCamera<BT>, CAL extends BirdCall<BT>> Photographer<BT, CAM, CALL> get(i... |
58,008,297 | I wrote a project using CMake (with ninja and Visual Studio 2017 C++ compiler), with two modules `lib_A` and `lib_B`
* `lib_B` depends one `lib_A`.
* Both `lib_B` and `lib_A` define `std::vector < size_t >`.
Finally, the compiler told me: `LNK2005 lib_A: std::vector < size_t > already defined in lib_B`
I searched an... | 2019/09/19 | [
"https://Stackoverflow.com/questions/58008297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5287343/"
] | You can use [target\_link\_options](https://cmake.org/cmake/help/latest/command/target_link_options.html) in CMake ≥ 3.13 or [set\_target\_properties](https://cmake.org/cmake/help/latest/command/set_target_properties.html) with the `LINK_FLAGS` property before.
i.e. `target_link_options(${PROJECT_NAME} PUBLIC $<$<CXX... | Adding the following line worked for me:
```
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /FORCE:MULTIPLE")
``` |
2,109,695 | I'd like to create my own custom HTTP requests. The WebClient class is very cool, but it creates the HTTP requests automatically. I'm thinking I need to create a network connection to the web server and pass my data over that stream, but I'm unfamiliar with the library classes that would support that kind of thing.
(... | 2010/01/21 | [
"https://Stackoverflow.com/questions/2109695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13338/"
] | To really understand the internals of the HTTP protocol you could use [TcpClient](http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx) class:
```
using (var client = new TcpClient("www.google.com", 80))
{
using (var stream = client.GetStream())
using (var writer = new StreamWriter(stream)... | Use the [WebRequest](http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx) or [WebResponse](http://msdn.microsoft.com/en-us/library/system.net.webresponse.aspx) classes, as required.
If you need to go lower level than these provide, look at the other System.Net.Sockets.\*Client classes such as [TcpClient... |
2,109,695 | I'd like to create my own custom HTTP requests. The WebClient class is very cool, but it creates the HTTP requests automatically. I'm thinking I need to create a network connection to the web server and pass my data over that stream, but I'm unfamiliar with the library classes that would support that kind of thing.
(... | 2010/01/21 | [
"https://Stackoverflow.com/questions/2109695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13338/"
] | Use the [WebRequest](http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx) or [WebResponse](http://msdn.microsoft.com/en-us/library/system.net.webresponse.aspx) classes, as required.
If you need to go lower level than these provide, look at the other System.Net.Sockets.\*Client classes such as [TcpClient... | Use [WFetch](http://www.microsoft.com/downloads/details.aspx?FamilyID=b134a806-d50e-4664-8348-da5c17129210) for the demonstration.
As for programming, [HttpWebRequest](http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx) lets you control quite a bit about the request - again if it's for a demonstra... |
2,109,695 | I'd like to create my own custom HTTP requests. The WebClient class is very cool, but it creates the HTTP requests automatically. I'm thinking I need to create a network connection to the web server and pass my data over that stream, but I'm unfamiliar with the library classes that would support that kind of thing.
(... | 2010/01/21 | [
"https://Stackoverflow.com/questions/2109695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13338/"
] | To really understand the internals of the HTTP protocol you could use [TcpClient](http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx) class:
```
using (var client = new TcpClient("www.google.com", 80))
{
using (var stream = client.GetStream())
using (var writer = new StreamWriter(stream)... | Check out [`System.Net.Sockets.TcpClient`](http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx) if you want to write your own low level client. For HTTP GET's and POST's you can use the [`HttpWebRequest`](http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx) and [`HttpWebResponse... |
2,109,695 | I'd like to create my own custom HTTP requests. The WebClient class is very cool, but it creates the HTTP requests automatically. I'm thinking I need to create a network connection to the web server and pass my data over that stream, but I'm unfamiliar with the library classes that would support that kind of thing.
(... | 2010/01/21 | [
"https://Stackoverflow.com/questions/2109695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13338/"
] | Check out [`System.Net.Sockets.TcpClient`](http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx) if you want to write your own low level client. For HTTP GET's and POST's you can use the [`HttpWebRequest`](http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx) and [`HttpWebResponse... | Use [WFetch](http://www.microsoft.com/downloads/details.aspx?FamilyID=b134a806-d50e-4664-8348-da5c17129210) for the demonstration.
As for programming, [HttpWebRequest](http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx) lets you control quite a bit about the request - again if it's for a demonstra... |
2,109,695 | I'd like to create my own custom HTTP requests. The WebClient class is very cool, but it creates the HTTP requests automatically. I'm thinking I need to create a network connection to the web server and pass my data over that stream, but I'm unfamiliar with the library classes that would support that kind of thing.
(... | 2010/01/21 | [
"https://Stackoverflow.com/questions/2109695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13338/"
] | To really understand the internals of the HTTP protocol you could use [TcpClient](http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx) class:
```
using (var client = new TcpClient("www.google.com", 80))
{
using (var stream = client.GetStream())
using (var writer = new StreamWriter(stream)... | In my response to this SO post [SharePoint 2007, how to check if a folder exists in a document library](https://stackoverflow.com/questions/1948552/2005855#2005855) I have included the basics of creating HttpWebRequest and reading response.
Edit: added a code example from the post above
```
System.Net.HttpWebRequest ... |
2,109,695 | I'd like to create my own custom HTTP requests. The WebClient class is very cool, but it creates the HTTP requests automatically. I'm thinking I need to create a network connection to the web server and pass my data over that stream, but I'm unfamiliar with the library classes that would support that kind of thing.
(... | 2010/01/21 | [
"https://Stackoverflow.com/questions/2109695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13338/"
] | In my response to this SO post [SharePoint 2007, how to check if a folder exists in a document library](https://stackoverflow.com/questions/1948552/2005855#2005855) I have included the basics of creating HttpWebRequest and reading response.
Edit: added a code example from the post above
```
System.Net.HttpWebRequest ... | Use [WFetch](http://www.microsoft.com/downloads/details.aspx?FamilyID=b134a806-d50e-4664-8348-da5c17129210) for the demonstration.
As for programming, [HttpWebRequest](http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx) lets you control quite a bit about the request - again if it's for a demonstra... |
2,109,695 | I'd like to create my own custom HTTP requests. The WebClient class is very cool, but it creates the HTTP requests automatically. I'm thinking I need to create a network connection to the web server and pass my data over that stream, but I'm unfamiliar with the library classes that would support that kind of thing.
(... | 2010/01/21 | [
"https://Stackoverflow.com/questions/2109695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13338/"
] | To really understand the internals of the HTTP protocol you could use [TcpClient](http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx) class:
```
using (var client = new TcpClient("www.google.com", 80))
{
using (var stream = client.GetStream())
using (var writer = new StreamWriter(stream)... | Use [WFetch](http://www.microsoft.com/downloads/details.aspx?FamilyID=b134a806-d50e-4664-8348-da5c17129210) for the demonstration.
As for programming, [HttpWebRequest](http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx) lets you control quite a bit about the request - again if it's for a demonstra... |
141 | When I run my LaTeX document through `pdflatex`, some of the pages (the ones where figures appear) have all the text bolded. Why, and what can I do to make it stop? | 2010/07/26 | [
"https://tex.stackexchange.com/questions/141",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/112/"
] | I had such an issue when mixing pages with images with and without transparency. If you experience this in Acrobat Reader (almost all including recent versions), but not other PDF readers, the following code in the preamble might do the trick and enforce the same RGB rendering for all pages (for xelatex):
```
\AddToSh... | To prime the answer pump with something else I observed: It appears to be a bug in pdflatex stemming from the handling of images with transparency; converting the PNG images to PDFs seems to fix the problem whenever it crops up. |
141 | When I run my LaTeX document through `pdflatex`, some of the pages (the ones where figures appear) have all the text bolded. Why, and what can I do to make it stop? | 2010/07/26 | [
"https://tex.stackexchange.com/questions/141",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/112/"
] | I had such an issue when mixing pages with images with and without transparency. If you experience this in Acrobat Reader (almost all including recent versions), but not other PDF readers, the following code in the preamble might do the trick and enforce the same RGB rendering for all pages (for xelatex):
```
\AddToSh... | Download the latest version of adobe reader 11 . it's working now
<http://get.adobe.com/reader/>
or see any other pdf readers |
141 | When I run my LaTeX document through `pdflatex`, some of the pages (the ones where figures appear) have all the text bolded. Why, and what can I do to make it stop? | 2010/07/26 | [
"https://tex.stackexchange.com/questions/141",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/112/"
] | I guess you are using Adobe Reader? If you use transparency in your illustrations, it seems that Adobe Reader renders text incorrectly (something like the wrong gamma correction in anti-aliasing perhaps), which makes the text look a bit too bold. It should look OK if you use other PDF readers, and it should also look O... | I was also wrestling with the "PDF printing bold" issue, and had some success when I flattened transparency. But even when I followed all of the "rules" (images on layer below text, all transparent effects rasterized), the text in my color proofs was still getting inexplicably **bold**, or more accurately: the text loo... |
141 | When I run my LaTeX document through `pdflatex`, some of the pages (the ones where figures appear) have all the text bolded. Why, and what can I do to make it stop? | 2010/07/26 | [
"https://tex.stackexchange.com/questions/141",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/112/"
] | This may just be your PDF viewer that acting strangely. Even though PDF files are supposedly seen as you would get them, there are some differences in how it looks on screen and on paper.
Back when I was using Windows with Adobe Reader, sometimes scrolling past a page and then back it again would get rid of this "bold... | I had this problem today and I was quite desperate.
Only way to fix this is to break your text into separate paragraphs near the areas where this issue happens.
Apparently Photoshop exports some texts twice, so you get the same text on top of itself which makes it look bold in the previews.
Sometimes it helps to ju... |
141 | When I run my LaTeX document through `pdflatex`, some of the pages (the ones where figures appear) have all the text bolded. Why, and what can I do to make it stop? | 2010/07/26 | [
"https://tex.stackexchange.com/questions/141",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/112/"
] | I was also wrestling with the "PDF printing bold" issue, and had some success when I flattened transparency. But even when I followed all of the "rules" (images on layer below text, all transparent effects rasterized), the text in my color proofs was still getting inexplicably **bold**, or more accurately: the text loo... | I had this problem today and I was quite desperate.
Only way to fix this is to break your text into separate paragraphs near the areas where this issue happens.
Apparently Photoshop exports some texts twice, so you get the same text on top of itself which makes it look bold in the previews.
Sometimes it helps to ju... |
141 | When I run my LaTeX document through `pdflatex`, some of the pages (the ones where figures appear) have all the text bolded. Why, and what can I do to make it stop? | 2010/07/26 | [
"https://tex.stackexchange.com/questions/141",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/112/"
] | I had such an issue when mixing pages with images with and without transparency. If you experience this in Acrobat Reader (almost all including recent versions), but not other PDF readers, the following code in the preamble might do the trick and enforce the same RGB rendering for all pages (for xelatex):
```
\AddToSh... | I had this problem today and I was quite desperate.
Only way to fix this is to break your text into separate paragraphs near the areas where this issue happens.
Apparently Photoshop exports some texts twice, so you get the same text on top of itself which makes it look bold in the previews.
Sometimes it helps to ju... |
141 | When I run my LaTeX document through `pdflatex`, some of the pages (the ones where figures appear) have all the text bolded. Why, and what can I do to make it stop? | 2010/07/26 | [
"https://tex.stackexchange.com/questions/141",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/112/"
] | I guess you are using Adobe Reader? If you use transparency in your illustrations, it seems that Adobe Reader renders text incorrectly (something like the wrong gamma correction in anti-aliasing perhaps), which makes the text look a bit too bold. It should look OK if you use other PDF readers, and it should also look O... | To prime the answer pump with something else I observed: It appears to be a bug in pdflatex stemming from the handling of images with transparency; converting the PNG images to PDFs seems to fix the problem whenever it crops up. |
141 | When I run my LaTeX document through `pdflatex`, some of the pages (the ones where figures appear) have all the text bolded. Why, and what can I do to make it stop? | 2010/07/26 | [
"https://tex.stackexchange.com/questions/141",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/112/"
] | I guess you are using Adobe Reader? If you use transparency in your illustrations, it seems that Adobe Reader renders text incorrectly (something like the wrong gamma correction in anti-aliasing perhaps), which makes the text look a bit too bold. It should look OK if you use other PDF readers, and it should also look O... | I had such an issue when mixing pages with images with and without transparency. If you experience this in Acrobat Reader (almost all including recent versions), but not other PDF readers, the following code in the preamble might do the trick and enforce the same RGB rendering for all pages (for xelatex):
```
\AddToSh... |
141 | When I run my LaTeX document through `pdflatex`, some of the pages (the ones where figures appear) have all the text bolded. Why, and what can I do to make it stop? | 2010/07/26 | [
"https://tex.stackexchange.com/questions/141",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/112/"
] | I had such an issue when mixing pages with images with and without transparency. If you experience this in Acrobat Reader (almost all including recent versions), but not other PDF readers, the following code in the preamble might do the trick and enforce the same RGB rendering for all pages (for xelatex):
```
\AddToSh... | I was also wrestling with the "PDF printing bold" issue, and had some success when I flattened transparency. But even when I followed all of the "rules" (images on layer below text, all transparent effects rasterized), the text in my color proofs was still getting inexplicably **bold**, or more accurately: the text loo... |
141 | When I run my LaTeX document through `pdflatex`, some of the pages (the ones where figures appear) have all the text bolded. Why, and what can I do to make it stop? | 2010/07/26 | [
"https://tex.stackexchange.com/questions/141",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/112/"
] | To prime the answer pump with something else I observed: It appears to be a bug in pdflatex stemming from the handling of images with transparency; converting the PNG images to PDFs seems to fix the problem whenever it crops up. | Download the latest version of adobe reader 11 . it's working now
<http://get.adobe.com/reader/>
or see any other pdf readers |
37,059,968 | I am currently stuck at getting a distinct set of values with value of `<NAME>` being the key.
I have the following sample XML:
```
<SAMPLE>
<FIRST>
<SUBSET>
<DATA>
<NAME>DataName1</NAME>
</DATA>
<FILE>
<NAME>DataName5</NAME>
<... | 2016/05/05 | [
"https://Stackoverflow.com/questions/37059968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5822164/"
] | In XSLT 2.0, this is rather trivial:
```
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<SAMPLE>
<xsl:for-each select="distinct-values(//NAME)">
<NAME>
... | A simple XSLT-1.0 solution is excluding duplicates and sorting them by their lexical order. Generating an `xsl:key` of all `NAME` nodes and comparing this list again to all `NAME` nodes:
```
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" />
<xsl:key name="n... |
37,059,968 | I am currently stuck at getting a distinct set of values with value of `<NAME>` being the key.
I have the following sample XML:
```
<SAMPLE>
<FIRST>
<SUBSET>
<DATA>
<NAME>DataName1</NAME>
</DATA>
<FILE>
<NAME>DataName5</NAME>
<... | 2016/05/05 | [
"https://Stackoverflow.com/questions/37059968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5822164/"
] | **I. Just use** (XSLT 2.0):
```
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="vDoc" select="document('file:///C:/temp/delete/sample.xml')"/>
<xsl:template match="/*">
<... | A simple XSLT-1.0 solution is excluding duplicates and sorting them by their lexical order. Generating an `xsl:key` of all `NAME` nodes and comparing this list again to all `NAME` nodes:
```
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" />
<xsl:key name="n... |
2,849,377 | I am running into some problems while trying to get DAAB from Enterprise library 5.0 running. I have followed the steps as per the tutorial, but am getting errors...
1) Download / install enterprise library
2) Add references to the blocks I need (common / data)
3) Imports
```
Imports Microsoft.Practices.EnterpriseL... | 2010/05/17 | [
"https://Stackoverflow.com/questions/2849377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/261660/"
] | The answer:
I had accidentaly referenced the assemblies from the src code folder. Which means the public tokens would have = null. I re-referenced to the assemblies in C:\Program Files\Microsoft Enterprise Library 5.0\Bin and the problem is now solved. | generate
```
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<section name="exceptionHandling" typ... |
2,849,377 | I am running into some problems while trying to get DAAB from Enterprise library 5.0 running. I have followed the steps as per the tutorial, but am getting errors...
1) Download / install enterprise library
2) Add references to the blocks I need (common / data)
3) Imports
```
Imports Microsoft.Practices.EnterpriseL... | 2010/05/17 | [
"https://Stackoverflow.com/questions/2849377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/261660/"
] | The answer:
I had accidentaly referenced the assemblies from the src code folder. Which means the public tokens would have = null. I re-referenced to the assemblies in C:\Program Files\Microsoft Enterprise Library 5.0\Bin and the problem is now solved. | In addition to what @Nicolas answered you can over come this problem by removing public token in app.config where ever it being used with Enterprise Library 5.0 dll |
2,849,377 | I am running into some problems while trying to get DAAB from Enterprise library 5.0 running. I have followed the steps as per the tutorial, but am getting errors...
1) Download / install enterprise library
2) Add references to the blocks I need (common / data)
3) Imports
```
Imports Microsoft.Practices.EnterpriseL... | 2010/05/17 | [
"https://Stackoverflow.com/questions/2849377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/261660/"
] | Enterprise library has 2 downloads ...
* Enterprise Library 5.0 - Source Code.msi
* Enterprise Library 5.0.msi
Only the second one has the signed binaries ... which is what's necessary to resolve the "manifest definition does not match the assembly reference" error
(and FYI, the second one also includes the source... | What probably you need to do is change Target framework in property of your project from ".NET Framework 4 Client Profile" to ".NET Framework 4".
When you first create a console project, VS 2010 by default creates ."NET Framework 4 Client Profile". EL 5 compiled with ".NET Framework 4" and your project has hard time t... |
2,849,377 | I am running into some problems while trying to get DAAB from Enterprise library 5.0 running. I have followed the steps as per the tutorial, but am getting errors...
1) Download / install enterprise library
2) Add references to the blocks I need (common / data)
3) Imports
```
Imports Microsoft.Practices.EnterpriseL... | 2010/05/17 | [
"https://Stackoverflow.com/questions/2849377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/261660/"
] | I already saw you got the answer; however, I wanted to point out that when you open the Config tool from VS, you have the option to tell the config tool what assemblies you want to have referenced:
1. In VS2010: open the properties editor window, and select from the solution explorer the Solution file.
2. You'll see t... | generate
```
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<section name="exceptionHandling" typ... |
2,849,377 | I am running into some problems while trying to get DAAB from Enterprise library 5.0 running. I have followed the steps as per the tutorial, but am getting errors...
1) Download / install enterprise library
2) Add references to the blocks I need (common / data)
3) Imports
```
Imports Microsoft.Practices.EnterpriseL... | 2010/05/17 | [
"https://Stackoverflow.com/questions/2849377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/261660/"
] | I already saw you got the answer; however, I wanted to point out that when you open the Config tool from VS, you have the option to tell the config tool what assemblies you want to have referenced:
1. In VS2010: open the properties editor window, and select from the solution explorer the Solution file.
2. You'll see t... | What probably you need to do is change Target framework in property of your project from ".NET Framework 4 Client Profile" to ".NET Framework 4".
When you first create a console project, VS 2010 by default creates ."NET Framework 4 Client Profile". EL 5 compiled with ".NET Framework 4" and your project has hard time t... |
2,849,377 | I am running into some problems while trying to get DAAB from Enterprise library 5.0 running. I have followed the steps as per the tutorial, but am getting errors...
1) Download / install enterprise library
2) Add references to the blocks I need (common / data)
3) Imports
```
Imports Microsoft.Practices.EnterpriseL... | 2010/05/17 | [
"https://Stackoverflow.com/questions/2849377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/261660/"
] | Enterprise library has 2 downloads ...
* Enterprise Library 5.0 - Source Code.msi
* Enterprise Library 5.0.msi
Only the second one has the signed binaries ... which is what's necessary to resolve the "manifest definition does not match the assembly reference" error
(and FYI, the second one also includes the source... | generate
```
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<section name="exceptionHandling" typ... |
2,849,377 | I am running into some problems while trying to get DAAB from Enterprise library 5.0 running. I have followed the steps as per the tutorial, but am getting errors...
1) Download / install enterprise library
2) Add references to the blocks I need (common / data)
3) Imports
```
Imports Microsoft.Practices.EnterpriseL... | 2010/05/17 | [
"https://Stackoverflow.com/questions/2849377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/261660/"
] | In addition to what @Nicolas answered you can over come this problem by removing public token in app.config where ever it being used with Enterprise Library 5.0 dll | What probably you need to do is change Target framework in property of your project from ".NET Framework 4 Client Profile" to ".NET Framework 4".
When you first create a console project, VS 2010 by default creates ."NET Framework 4 Client Profile". EL 5 compiled with ".NET Framework 4" and your project has hard time t... |
2,849,377 | I am running into some problems while trying to get DAAB from Enterprise library 5.0 running. I have followed the steps as per the tutorial, but am getting errors...
1) Download / install enterprise library
2) Add references to the blocks I need (common / data)
3) Imports
```
Imports Microsoft.Practices.EnterpriseL... | 2010/05/17 | [
"https://Stackoverflow.com/questions/2849377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/261660/"
] | The answer:
I had accidentaly referenced the assemblies from the src code folder. Which means the public tokens would have = null. I re-referenced to the assemblies in C:\Program Files\Microsoft Enterprise Library 5.0\Bin and the problem is now solved. | Enterprise library has 2 downloads ...
* Enterprise Library 5.0 - Source Code.msi
* Enterprise Library 5.0.msi
Only the second one has the signed binaries ... which is what's necessary to resolve the "manifest definition does not match the assembly reference" error
(and FYI, the second one also includes the source... |
2,849,377 | I am running into some problems while trying to get DAAB from Enterprise library 5.0 running. I have followed the steps as per the tutorial, but am getting errors...
1) Download / install enterprise library
2) Add references to the blocks I need (common / data)
3) Imports
```
Imports Microsoft.Practices.EnterpriseL... | 2010/05/17 | [
"https://Stackoverflow.com/questions/2849377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/261660/"
] | The answer:
I had accidentaly referenced the assemblies from the src code folder. Which means the public tokens would have = null. I re-referenced to the assemblies in C:\Program Files\Microsoft Enterprise Library 5.0\Bin and the problem is now solved. | I already saw you got the answer; however, I wanted to point out that when you open the Config tool from VS, you have the option to tell the config tool what assemblies you want to have referenced:
1. In VS2010: open the properties editor window, and select from the solution explorer the Solution file.
2. You'll see t... |
2,849,377 | I am running into some problems while trying to get DAAB from Enterprise library 5.0 running. I have followed the steps as per the tutorial, but am getting errors...
1) Download / install enterprise library
2) Add references to the blocks I need (common / data)
3) Imports
```
Imports Microsoft.Practices.EnterpriseL... | 2010/05/17 | [
"https://Stackoverflow.com/questions/2849377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/261660/"
] | The answer:
I had accidentaly referenced the assemblies from the src code folder. Which means the public tokens would have = null. I re-referenced to the assemblies in C:\Program Files\Microsoft Enterprise Library 5.0\Bin and the problem is now solved. | What probably you need to do is change Target framework in property of your project from ".NET Framework 4 Client Profile" to ".NET Framework 4".
When you first create a console project, VS 2010 by default creates ."NET Framework 4 Client Profile". EL 5 compiled with ".NET Framework 4" and your project has hard time t... |
69,893,773 | I'm trying to have an interface with a conditional statement.
In an interface, I know we could have something like this below to have the conditional.
```
interface exampleInterface {
a: 'A' | 'B'
}
```
This way, we could ensure the input 'a' must be either 'A' or 'B'.
I would like to populate this kind of cond... | 2021/11/09 | [
"https://Stackoverflow.com/questions/69893773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9644087/"
] | The solution turned out to be really simple.
```
const { Op } = require("sequelize");
```
```
let arr = []
for(let animal of animals) {
arr.push({
[Op.contains]: [animal],
});
}
abc.findAll({
where: {
animals: {
[Op.or]: arr
}
},
})
``` | `sql` solution could be something like :
```
SELECT *
FROM your_table
WHERE your_json_column :: jsonb @? '$[*].animals[*] ? (@ <@ HasAnimals)'
``` |
28,092,267 | Scenario is represented with the graph below:
```
0 -- A -- B -- C -- D
\
E -- F -- G
```
At some point, EFG become another project, and I want to completely cut the tie from 0ABCD and EFG:
```
0 -- A -- B -- C -- D
E' - F' - G'
``` | 2015/01/22 | [
"https://Stackoverflow.com/questions/28092267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1420625/"
] | You usually should use [Seq](http://www.scala-lang.org/api/current/index.html#scala.collection.Seq) as input parameter for method or class, defined for sequences in general (just general, not necessarily with generic):
```
def mySort[T](seq: Seq[T]) = ...
case class Wrapper[T](seq: Seq[T])
implicit class RichSeq[T](s... | The principal here is the same as in a number of languages (E.g. in Java should often use List instead of ArrayList, or Map instead of HashMap). If you can deal with the more abstract concept of a Seq, you should, especially when they are parameters to methods.
2 main reasons that come to mind:
1) reuse of your code... |
12,379,520 | I have an audio file that plays using avaudioplayer, I want to able to play the sound on the device receiver or speaker when the audio is playing when the user presses a button. How can I do that ? Currently it just plays on whatever was selected before the audio started playing. | 2012/09/11 | [
"https://Stackoverflow.com/questions/12379520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/845232/"
] | ```
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
OSStatus result = AudioSessionSetProperty( kAudioSessionProperty_OverrideAudioRoute, sizeof(audioRouteOverride), &audioRouteOverride );
Assert(result == kAudioSessionNoError);
``` | You can add MPVolume control ([link to documentation](http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPVolumeView_Class/Reference/Reference.html)) to your user interface and set showsVolumeSlider = NO and showsRouteButton = YES.
User will have a route button to route the audio to a device ... |
12,379,520 | I have an audio file that plays using avaudioplayer, I want to able to play the sound on the device receiver or speaker when the audio is playing when the user presses a button. How can I do that ? Currently it just plays on whatever was selected before the audio started playing. | 2012/09/11 | [
"https://Stackoverflow.com/questions/12379520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/845232/"
] | ```
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
OSStatus result = AudioSessionSetProperty( kAudioSessionProperty_OverrideAudioRoute, sizeof(audioRouteOverride), &audioRouteOverride );
Assert(result == kAudioSessionNoError);
``` | iOS 6+ version
```
NSError* error;
AVAudioSession* session = [AVAudioSession sharedInstance];
[session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&error];
``` |
12,379,520 | I have an audio file that plays using avaudioplayer, I want to able to play the sound on the device receiver or speaker when the audio is playing when the user presses a button. How can I do that ? Currently it just plays on whatever was selected before the audio started playing. | 2012/09/11 | [
"https://Stackoverflow.com/questions/12379520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/845232/"
] | iOS 6+ version
```
NSError* error;
AVAudioSession* session = [AVAudioSession sharedInstance];
[session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&error];
``` | You can add MPVolume control ([link to documentation](http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPVolumeView_Class/Reference/Reference.html)) to your user interface and set showsVolumeSlider = NO and showsRouteButton = YES.
User will have a route button to route the audio to a device ... |
27,320,166 | I have a variable that gets defined by user input. I want to replace its value only if it's `undefined`. But not if it's `NaN`. How can I do it?
I tried doing `x || 0` but that also replaces `NaN` values. | 2014/12/05 | [
"https://Stackoverflow.com/questions/27320166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3312508/"
] | You can do a strict comparison to the `undefined` value.
```
if (x === undefined) {
x = 0;
}
```
Naturally you'll want to be sure that `x` has been properly declared as usual.
If you have any sensitivities about the `undefined` value being plagued by really bad code (overwritten with a new value), then you can ... | You can test using typeof (among other things):
```
if (typeof x == 'undefined') x = y;
```
Another approach is to test strict equality against undefined:
```
if (x === void 0) x = y
```
In this case we use `void 0` as a safety since `undefined` can actually be redefined. |
27,320,166 | I have a variable that gets defined by user input. I want to replace its value only if it's `undefined`. But not if it's `NaN`. How can I do it?
I tried doing `x || 0` but that also replaces `NaN` values. | 2014/12/05 | [
"https://Stackoverflow.com/questions/27320166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3312508/"
] | You can do a strict comparison to the `undefined` value.
```
if (x === undefined) {
x = 0;
}
```
Naturally you'll want to be sure that `x` has been properly declared as usual.
If you have any sensitivities about the `undefined` value being plagued by really bad code (overwritten with a new value), then you can ... | You can do this quite quickly with just a
```
x === undefined && (x = 0);
``` |
27,320,166 | I have a variable that gets defined by user input. I want to replace its value only if it's `undefined`. But not if it's `NaN`. How can I do it?
I tried doing `x || 0` but that also replaces `NaN` values. | 2014/12/05 | [
"https://Stackoverflow.com/questions/27320166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3312508/"
] | You can do a strict comparison to the `undefined` value.
```
if (x === undefined) {
x = 0;
}
```
Naturally you'll want to be sure that `x` has been properly declared as usual.
If you have any sensitivities about the `undefined` value being plagued by really bad code (overwritten with a new value), then you can ... | For ES6 users you can simply do:
```
x ?? 0
```
`??` is a [Nullish coalescing operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator):
>
> a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined, and... |
27,320,166 | I have a variable that gets defined by user input. I want to replace its value only if it's `undefined`. But not if it's `NaN`. How can I do it?
I tried doing `x || 0` but that also replaces `NaN` values. | 2014/12/05 | [
"https://Stackoverflow.com/questions/27320166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3312508/"
] | You can do a strict comparison to the `undefined` value.
```
if (x === undefined) {
x = 0;
}
```
Naturally you'll want to be sure that `x` has been properly declared as usual.
If you have any sensitivities about the `undefined` value being plagued by really bad code (overwritten with a new value), then you can ... | boy. Maybe you could try this,Hello, boy. Maybe you could try this,Hello, boy. Maybe you could try this,Hello, boy. Maybe you could try this,Hello, boy. Maybe you could try this
```js
var a;//undefined
a = ~~a
console.log(a)//0
``` |
27,320,166 | I have a variable that gets defined by user input. I want to replace its value only if it's `undefined`. But not if it's `NaN`. How can I do it?
I tried doing `x || 0` but that also replaces `NaN` values. | 2014/12/05 | [
"https://Stackoverflow.com/questions/27320166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3312508/"
] | You can test using typeof (among other things):
```
if (typeof x == 'undefined') x = y;
```
Another approach is to test strict equality against undefined:
```
if (x === void 0) x = y
```
In this case we use `void 0` as a safety since `undefined` can actually be redefined. | You can do this quite quickly with just a
```
x === undefined && (x = 0);
``` |
27,320,166 | I have a variable that gets defined by user input. I want to replace its value only if it's `undefined`. But not if it's `NaN`. How can I do it?
I tried doing `x || 0` but that also replaces `NaN` values. | 2014/12/05 | [
"https://Stackoverflow.com/questions/27320166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3312508/"
] | For ES6 users you can simply do:
```
x ?? 0
```
`??` is a [Nullish coalescing operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator):
>
> a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined, and... | You can test using typeof (among other things):
```
if (typeof x == 'undefined') x = y;
```
Another approach is to test strict equality against undefined:
```
if (x === void 0) x = y
```
In this case we use `void 0` as a safety since `undefined` can actually be redefined. |
27,320,166 | I have a variable that gets defined by user input. I want to replace its value only if it's `undefined`. But not if it's `NaN`. How can I do it?
I tried doing `x || 0` but that also replaces `NaN` values. | 2014/12/05 | [
"https://Stackoverflow.com/questions/27320166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3312508/"
] | You can test using typeof (among other things):
```
if (typeof x == 'undefined') x = y;
```
Another approach is to test strict equality against undefined:
```
if (x === void 0) x = y
```
In this case we use `void 0` as a safety since `undefined` can actually be redefined. | boy. Maybe you could try this,Hello, boy. Maybe you could try this,Hello, boy. Maybe you could try this,Hello, boy. Maybe you could try this,Hello, boy. Maybe you could try this
```js
var a;//undefined
a = ~~a
console.log(a)//0
``` |
27,320,166 | I have a variable that gets defined by user input. I want to replace its value only if it's `undefined`. But not if it's `NaN`. How can I do it?
I tried doing `x || 0` but that also replaces `NaN` values. | 2014/12/05 | [
"https://Stackoverflow.com/questions/27320166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3312508/"
] | For ES6 users you can simply do:
```
x ?? 0
```
`??` is a [Nullish coalescing operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator):
>
> a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined, and... | You can do this quite quickly with just a
```
x === undefined && (x = 0);
``` |
27,320,166 | I have a variable that gets defined by user input. I want to replace its value only if it's `undefined`. But not if it's `NaN`. How can I do it?
I tried doing `x || 0` but that also replaces `NaN` values. | 2014/12/05 | [
"https://Stackoverflow.com/questions/27320166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3312508/"
] | boy. Maybe you could try this,Hello, boy. Maybe you could try this,Hello, boy. Maybe you could try this,Hello, boy. Maybe you could try this,Hello, boy. Maybe you could try this
```js
var a;//undefined
a = ~~a
console.log(a)//0
``` | You can do this quite quickly with just a
```
x === undefined && (x = 0);
``` |
27,320,166 | I have a variable that gets defined by user input. I want to replace its value only if it's `undefined`. But not if it's `NaN`. How can I do it?
I tried doing `x || 0` but that also replaces `NaN` values. | 2014/12/05 | [
"https://Stackoverflow.com/questions/27320166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3312508/"
] | For ES6 users you can simply do:
```
x ?? 0
```
`??` is a [Nullish coalescing operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator):
>
> a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined, and... | boy. Maybe you could try this,Hello, boy. Maybe you could try this,Hello, boy. Maybe you could try this,Hello, boy. Maybe you could try this,Hello, boy. Maybe you could try this
```js
var a;//undefined
a = ~~a
console.log(a)//0
``` |
47,983 | When I cook things, such as scallop and salmon, I found that the food may be more tender if I wait till the water boils (at 100 C) and immediately turn the fire lower so that the water is not bubbling in the cook pot and maintain the fire at this level. But I noticed that at this point, there is more steam coming out o... | 2012/12/31 | [
"https://physics.stackexchange.com/questions/47983",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/2701/"
] | I must admit that I have never noticed this, and indeed it runs somewhat contrary to what I would expect.
It's a suggestion rather than an answer, but when the heat is high there will be a strong updraught of hot air so is it possible that the steam is being carried away from the pan before it has a chance to condense... | I have been boiling water in our house for humidity at times during the cold weather. I noticed this phenomenon, but never with any food involved. I suspect it has more to do with the rapidity of which the matter is getting excited gives it less time to make the physical change. When the application of heat/energy is d... |
47,983 | When I cook things, such as scallop and salmon, I found that the food may be more tender if I wait till the water boils (at 100 C) and immediately turn the fire lower so that the water is not bubbling in the cook pot and maintain the fire at this level. But I noticed that at this point, there is more steam coming out o... | 2012/12/31 | [
"https://physics.stackexchange.com/questions/47983",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/2701/"
] | I tried the experiment with a pot and 5mm of water and with a pan and 5mm of water. When it is just water steam at boiling is proportional to the fire as more bubbles form at the bottom of the pan and turn to steam.
So it must be the combined effect of food and water.
I suspect:
The surface of the scallops or salmon... | I have been boiling water in our house for humidity at times during the cold weather. I noticed this phenomenon, but never with any food involved. I suspect it has more to do with the rapidity of which the matter is getting excited gives it less time to make the physical change. When the application of heat/energy is d... |
14,739 | My problem: I have a lot of MP3s and finding the right music to listen to is difficult.
What I'd like: I'd like to be able to tag the individual files, similar to how you would tag photos on Flickr, or questions on this site. It's very difficult to search for this, since every "mp3 tagging" search ends up with ID3 tag... | 2009/07/28 | [
"https://superuser.com/questions/14739",
"https://superuser.com",
"https://superuser.com/users/2936/"
] | [Songbird](http://getsongbird.com) with the [Tag Cloud Generator](http://addons.songbirdnest.com/addon/1642) add-on looks like it will do exactly what you are looking for. | I would certainly like to see a well implemented version of such a feature too. Until then, you can try [Media Monkey](http://www.mediamonkey.com/). Its tag editor has 5 custom fields which are straight text fields.
I did a quick experiment where I edited the Custom 1 field of the mp3 tag of one track to contain the s... |
14,739 | My problem: I have a lot of MP3s and finding the right music to listen to is difficult.
What I'd like: I'd like to be able to tag the individual files, similar to how you would tag photos on Flickr, or questions on this site. It's very difficult to search for this, since every "mp3 tagging" search ends up with ID3 tag... | 2009/07/28 | [
"https://superuser.com/questions/14739",
"https://superuser.com",
"https://superuser.com/users/2936/"
] | [Songbird](http://getsongbird.com) with the [Tag Cloud Generator](http://addons.songbirdnest.com/addon/1642) add-on looks like it will do exactly what you are looking for. | Here is an approach that saves the tags to a common, but seldom-used field in your ID3 tags. This is important because the tags will be backed up with your music and usable by any media player.
Use the "grouping" field as a free-form tag field. This is a standard field, used by most media player software that is not u... |
14,739 | My problem: I have a lot of MP3s and finding the right music to listen to is difficult.
What I'd like: I'd like to be able to tag the individual files, similar to how you would tag photos on Flickr, or questions on this site. It's very difficult to search for this, since every "mp3 tagging" search ends up with ID3 tag... | 2009/07/28 | [
"https://superuser.com/questions/14739",
"https://superuser.com",
"https://superuser.com/users/2936/"
] | I was thinking of this for myself some time back,
Had found the [**TaggTool**](http://www.taggtool.com/support.php).
>
> **Tagg** only stores pointers to your files and will never change or move files. Tagg does allow you to copy files but the original file is left untouched.
> When Removing Tags remember that on... | I agree with Andi, but I would you use the comment-field.
Je simply add ie. ;nostalgic;ballad;carmusic;whatever....
You could get more tags in the ID3-tag if you use short codes like ;Q;car;w.ever;... |
14,739 | My problem: I have a lot of MP3s and finding the right music to listen to is difficult.
What I'd like: I'd like to be able to tag the individual files, similar to how you would tag photos on Flickr, or questions on this site. It's very difficult to search for this, since every "mp3 tagging" search ends up with ID3 tag... | 2009/07/28 | [
"https://superuser.com/questions/14739",
"https://superuser.com",
"https://superuser.com/users/2936/"
] | I agree with Andi, but I would you use the comment-field.
Je simply add ie. ;nostalgic;ballad;carmusic;whatever....
You could get more tags in the ID3-tag if you use short codes like ;Q;car;w.ever;... | Well, for what regards winamp: why not using any of the unused ID3 tags? I mean: you could use the "Composer" or "Publisher" fields to write whatever you want... and then find anything from within winamp. |
14,739 | My problem: I have a lot of MP3s and finding the right music to listen to is difficult.
What I'd like: I'd like to be able to tag the individual files, similar to how you would tag photos on Flickr, or questions on this site. It's very difficult to search for this, since every "mp3 tagging" search ends up with ID3 tag... | 2009/07/28 | [
"https://superuser.com/questions/14739",
"https://superuser.com",
"https://superuser.com/users/2936/"
] | I agree with Andi, but I would you use the comment-field.
Je simply add ie. ;nostalgic;ballad;carmusic;whatever....
You could get more tags in the ID3-tag if you use short codes like ;Q;car;w.ever;... | I would certainly like to see a well implemented version of such a feature too. Until then, you can try [Media Monkey](http://www.mediamonkey.com/). Its tag editor has 5 custom fields which are straight text fields.
I did a quick experiment where I edited the Custom 1 field of the mp3 tag of one track to contain the s... |
14,739 | My problem: I have a lot of MP3s and finding the right music to listen to is difficult.
What I'd like: I'd like to be able to tag the individual files, similar to how you would tag photos on Flickr, or questions on this site. It's very difficult to search for this, since every "mp3 tagging" search ends up with ID3 tag... | 2009/07/28 | [
"https://superuser.com/questions/14739",
"https://superuser.com",
"https://superuser.com/users/2936/"
] | I was thinking of this for myself some time back,
Had found the [**TaggTool**](http://www.taggtool.com/support.php).
>
> **Tagg** only stores pointers to your files and will never change or move files. Tagg does allow you to copy files but the original file is left untouched.
> When Removing Tags remember that on... | I'd like to find a media manager that does this correctly, the problem is either you store the tag information in the ID3 tag or you store it in an external library. If you store it in ID3 tags, it has a good possibility of getting clobbered by all the media library software out there (Winamp, iTunes, etc). If you use ... |
14,739 | My problem: I have a lot of MP3s and finding the right music to listen to is difficult.
What I'd like: I'd like to be able to tag the individual files, similar to how you would tag photos on Flickr, or questions on this site. It's very difficult to search for this, since every "mp3 tagging" search ends up with ID3 tag... | 2009/07/28 | [
"https://superuser.com/questions/14739",
"https://superuser.com",
"https://superuser.com/users/2936/"
] | I was thinking of this for myself some time back,
Had found the [**TaggTool**](http://www.taggtool.com/support.php).
>
> **Tagg** only stores pointers to your files and will never change or move files. Tagg does allow you to copy files but the original file is left untouched.
> When Removing Tags remember that on... | Here is an approach that saves the tags to a common, but seldom-used field in your ID3 tags. This is important because the tags will be backed up with your music and usable by any media player.
Use the "grouping" field as a free-form tag field. This is a standard field, used by most media player software that is not u... |
14,739 | My problem: I have a lot of MP3s and finding the right music to listen to is difficult.
What I'd like: I'd like to be able to tag the individual files, similar to how you would tag photos on Flickr, or questions on this site. It's very difficult to search for this, since every "mp3 tagging" search ends up with ID3 tag... | 2009/07/28 | [
"https://superuser.com/questions/14739",
"https://superuser.com",
"https://superuser.com/users/2936/"
] | I was thinking of this for myself some time back,
Had found the [**TaggTool**](http://www.taggtool.com/support.php).
>
> **Tagg** only stores pointers to your files and will never change or move files. Tagg does allow you to copy files but the original file is left untouched.
> When Removing Tags remember that on... | with [foobar2000](http://www.foobar2000.org/) you could use multiple tags in one ID3 tag (separated by ";") and show them like you want using [title formating](http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Titleformat_Reference) with %<"field">% (Default UI components: [album list](http://wiki.hydrogenaudio.... |
14,739 | My problem: I have a lot of MP3s and finding the right music to listen to is difficult.
What I'd like: I'd like to be able to tag the individual files, similar to how you would tag photos on Flickr, or questions on this site. It's very difficult to search for this, since every "mp3 tagging" search ends up with ID3 tag... | 2009/07/28 | [
"https://superuser.com/questions/14739",
"https://superuser.com",
"https://superuser.com/users/2936/"
] | I agree with Andi, but I would you use the comment-field.
Je simply add ie. ;nostalgic;ballad;carmusic;whatever....
You could get more tags in the ID3-tag if you use short codes like ;Q;car;w.ever;... | Here is an approach that saves the tags to a common, but seldom-used field in your ID3 tags. This is important because the tags will be backed up with your music and usable by any media player.
Use the "grouping" field as a free-form tag field. This is a standard field, used by most media player software that is not u... |
14,739 | My problem: I have a lot of MP3s and finding the right music to listen to is difficult.
What I'd like: I'd like to be able to tag the individual files, similar to how you would tag photos on Flickr, or questions on this site. It's very difficult to search for this, since every "mp3 tagging" search ends up with ID3 tag... | 2009/07/28 | [
"https://superuser.com/questions/14739",
"https://superuser.com",
"https://superuser.com/users/2936/"
] | [Songbird](http://getsongbird.com) with the [Tag Cloud Generator](http://addons.songbirdnest.com/addon/1642) add-on looks like it will do exactly what you are looking for. | Well, for what regards winamp: why not using any of the unused ID3 tags? I mean: you could use the "Composer" or "Publisher" fields to write whatever you want... and then find anything from within winamp. |
36,985,520 | This problem has been bugging me for the last while.. i cant seem to be able to update the stock value of the vehicle that i'm selling. I understand how to search the array and locate the model that the user is looking for but i don't understand how to update the number of that specific model vehicle that are in stock.... | 2016/05/02 | [
"https://Stackoverflow.com/questions/36985520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6026545/"
] | You're almost there.
Change:
```
Vehicles.setStock() = stock - 1;
```
to:
```
v.setStock(v.getStock() - 1);
```
---
As clarification, this is the same as:
```
int stock = v.getStock(); // Get the current stock value of 'v'
int newStock = stock - 1; // The new stock value after the purchase
v.setStock(newStock)... | You are not invoking the `Vehicles.setStock()` on the object you want to update. And in addition this method doesn't receive any parameter to update the new stock.
You should call the method on the instance you want to update passing it the new value of the stock.
Try this
```
v.setStock(v.getStock() - 1);
```
If ... |
43,035,302 | Is there a way to close a window when an input element has a flag value in the side output of a DoFn? E.g. event which indicates closing of a session closes the window.
I've been reading the docs, and triggers are time based mostly. An example would be great.
Edit: Trigger.OnElementContext.forTrigger(ExecutableTrigge... | 2017/03/26 | [
"https://Stackoverflow.com/questions/43035302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4939922/"
] | I don't think that this is available. There is only one Data Driven Trigger right now, elementCountAtLeast.
<https://cloud.google.com/dataflow/model/triggers#data-driven-triggers>
A work around for this would be to copy the sessions window function code and write a custom window function.
<https://github.com/apache/... | At present, there is no way to trigger off the content of an element, unfortunately. From the [Apache Beam Docs](https://beam.apache.org/documentation/programming-guide/#data-driven-triggers):
>
> Beam provides one data-driven trigger, `AfterPane.elementCountAtLeast()`. This trigger works on an element count; it fire... |
25,648,393 | So about a year ago I started a project and like all new developers I didn't really focus too much on the structure, however now I am further along with Django it has started to appear that my project layout mainly my models are horrible in structure.
I have models mainly held in a single app and really most of these ... | 2014/09/03 | [
"https://Stackoverflow.com/questions/25648393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2848524/"
] | Another hacky alternative if the data is not big or too complicated, but still important to maintain, is to:
* Get data fixtures using [manage.py dumpdata](https://docs.djangoproject.com/en/1.11/ref/django-admin/#dumpdata)
* Proceed to model changes and migrations properly, without relating the changes
* Global replac... | **This is tested roughly, so do not forget to backup your DB!!!**
For example, there are two apps: `src_app` and `dst_app`, we want to move model `MoveMe` from `src_app` to `dst_app`.
Create empty migrations for both apps:
```
python manage.py makemigrations --empty src_app
python manage.py makemigrations --empty d... |
25,648,393 | So about a year ago I started a project and like all new developers I didn't really focus too much on the structure, however now I am further along with Django it has started to appear that my project layout mainly my models are horrible in structure.
I have models mainly held in a single app and really most of these ... | 2014/09/03 | [
"https://Stackoverflow.com/questions/25648393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2848524/"
] | You can try the following (untested):
1. move the model from `src_app` to `dest_app`
2. migrate `dest_app`; make sure the schema migration depends on the latest `src_app` migration (<https://docs.djangoproject.com/en/dev/topics/migrations/#migration-files>)
3. add a data migration to `dest_app`, that copies all data f... | Lets say you are moving model TheModel from app\_a to app\_b.
An alternate solution is to alter the existing migrations by hand. The idea is that each time you see an operation altering TheModel in app\_a's migrations, you copy that operation to the end of app\_b's initial migration. And each time you see a reference ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.