text:
Q: zxing decoding qrcode including vcard data: wrong field separation, etc Encoding a vCard with N and ADR and decoding it with Barcode Scanner 4.3.2 on Android (ICS 4.0.4) and adding it as a contact works very poorly: separated fields (separation by semi-columns like this N:Last;First;;;) in name and address are not preserved. Also URL is converted to 'Note'. What is the reason no Qr code scanner in Android preserves this.
BTW other QR scanners I tried (Qr Barcode, Qr Droid) behave even poorer: they don't respect TEL;WORK: TEL;MOBILE: ADR;WORK: (WORK replaced with home, etc).
I can still suspect some strict format or version in vCard that makes QR decoder to contact stutter in Android but I doubt.
For example I used goqr.me to encode this:
BEGIN:VCARD
VERSION:2.1
FN:FN LN
N:LN;FN
TITLE:Title
TEL;CELL:+33666
TEL;WORK;VOICE:+33999
TEL;HOME;VOICE:+33000
EMAIL;HOME;INTERNET:home@home
EMAIL;WORK;INTERNET:work@work
URL:http://my.not
ADR:;;Street, Nb;City;;37000;Country
ORG:organz
END:VCARD

The result is acceptable on Barcode Scanner (though: no first name / last name separation and two space characters instead of one between them, no separations preserved in address and URL not decoded as such, but as a note). Forget about the other Android scanners mentioned above: all the inaccuracies already met with Barcod Scanner + wrong phone and address type, title ignored, url ignored...)
Is there no way to improve this? Where is the limitation/bottleneck: API for adding contacts, QR address book format and decoding limitations?
After many hours working and trying on ways to encode vCards in Qr Codes (just on Android) it seems to me this is conceptually half-baked. Did I miss something?
Thank you.


text:
Q: Is there a difference between transform and transformation? I was told that there is a difference between a transform and a transformation. Can anyone point out clearly?
For example, is Laplace transform not a transformation?

A: A transformation is certainly a process. The word "transform" can be used as short for "transfomation", but also for a transformed object. An example for the first usage is
"The Fourier transform is an automorphism of the Schwartz space ${\cal S}\,$",
an example for the second usage is
"The Laplace transform of $t\mapsto e^{\lambda t}$ $\>(t\geq0)$ is $s\mapsto{\displaystyle{1\over s-\lambda}}\>$".

A: From the accepted question on ELU: Transform or transformation?

In the particular domain you're referencing, both transform and
  transformation have an established history of usage.
For example, we speak of the Hough transform or the Fourier transform.
  We also talk about affine transformations or homothetic
  transformations.
I'm not aware of any specific rules, but in general, I've noticed that
  "named" objects tend to be referenced as the foo transform, while
  unnamed or otherwise generic ones use the foo transformation.

A: To my mind (a mathematical physicist), a transform is a specific kind of transformation, namely, a transformation not of values, but of functions. So, a transformation $N$ maps a value $x$ onto its image value:
$N: x \to N(x)$
whereas the transform $M$ maps a function $f$ onto its image function:
$M: f(x) \to F(y)$
The reason we call the Fourier transform a transform is because, although it is indeed a transformation, it is in particular a transformation of functions, since it maps an entire function $f(x)$ onto its frequency spectrum $F(p)$.

A: This is a solidly common-usage question, which I was asked many decades ago, and has now come up again.
In common usage, when referring to the alteration of elements of a set, as an abstraction, (or as Niall says, a "process"), the word transformation is always applied.  The set is transformed, action is a transformation.
When referring to the transformation itself as an object, as a thing that performs the transformation, the word transform is often applied.  (This includes the "named" transformations that Ooker refers to.)  But clearly, there is a direct correspondence here between the action and the actor --- it could be viewed as a matter of emphasis.
But the terminology isn't cut-and-dried at all.
P.S. The terms operator and transform are usually restricted to mappings whose range and domain are homomorphic.  These are used in very much the same way, except, I don't think I've ever seen transform applied to mappings of finite-dimensional spaces.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to Render Date Object on React App application? I was learning React and tried to display current date. But I am getting this error.
I created a Date object and stored it in a variable and then displayed it on the h2 tag.
Here's My code:
import logo from './logo.svg';
import './App.css';
function App() {
  const curr_tim= new Date();
  console.log(curr_tim);
  return (

      React Clock

Current Date is:{curr_tim}

  );
}
export default App;

and I am getting this as error.
Uncaught Error: Objects are not valid as a React child (found: [object Date]). If you meant to render a collection of children, use an array instead.
    at throwOnInvalidObjectType (react-dom.development.js:14887:1)
    at updateSlot (react-dom.development.js:15202:1)
    at reconcileChildrenArray (react-dom.development.js:15349:1)
    at reconcileChildFibers (react-dom.development.js:15821:1)
    at reconcileChildren (react-dom.development.js:19174:1)
    at updateHostComponent (react-dom.development.js:19924:1)
    at beginWork (react-dom.development.js:21618:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
    at invokeGuardedCallback (react-dom.development.js:4277:1)

A: Like the error suggested, curr_tim is an object and React can't render object on the UI. You can try to turn it to something like new Date().toDateString(), or any kind of date you would like. As long as it's a primitive type it would be fine

A: Replace your code with This,
import logo from './logo.svg';
import './App.css';
function App() {
  const curr_tim= new Date().toDateString();
  console.log(curr_tim);
  return (

      React Clock

Current Date is:{curr_tim}

  );
}
export default App;

Or With This,
import logo from './logo.svg';
import './App.css';
function App() {
  const curr_tim= new Date();
  console.log(curr_tim);
  return (

      React Clock

Current Date is:{curr_tim.toDateString()}

  );
}
export default App;


text:
Q: Javacript [ document.write ("___"); ] Shortcut to not start each line with document.write (" or some alternative In this code I want to insert some HTML and normal text in JavaScript and don't want it to always enter document.write(" in starting of each line like this:
document.write ("");

document.write ("
Website Name
");
document.write ("
Some text i gathered here
");

It'll be very helpful if someone could solve this problem or give me some alternative.

A: *

*You can write all at once using ``:

document.write(`

Website Name

Some text i gathered here

`)

*You can create function for it and call it where you need it:

...

Warning:

*

*write tags names in lowercase:


text:
Q: Setting UITableViewCell height and the cell's text label based on the text height I have followed the instructions I have been able to find on stackoverflow to fix the following but none have worked. Below is my code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

static NSString *CellIdentifier = @"DoCCell";
DoCCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[DoCCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...

CGSize constraintSize = CGSizeMake(cell.infoLabel.frame.size.width, MAXFLOAT);
CGSize labelSize = [_content[[indexPath row] * 2] sizeWithFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:12.0f]
                                             constrainedToSize:constraintSize
                                                 lineBreakMode:NSLineBreakByWordWrapping];
CGRect frame = CGRectMake (cell.infoLabel.frame.origin.x, cell.infoLabel.frame.origin.y, labelSize.width, labelSize.height);
[cell.infoLabel setFrame:frame];

cell.infoLabel.lineBreakMode = NSLineBreakByWordWrapping;
cell.infoLabel.numberOfLines = 10;

_font = cell.infoLabel.font;
cell.infoLabel.text = _content[[indexPath row] * 2];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGSize constraintSize = CGSizeMake(280.0f, MAXFLOAT);

CGSize size = [_content[[indexPath row] * 2] sizeWithFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:12.0f]
               constrainedToSize:constraintSize
                   lineBreakMode:NSLineBreakByWordWrapping];
return size.height + 30.0;
}

but when I run my code the height of the cells is changed appropriately while the label size is not.
The cell is a custom cell and I have added the label via the .xib file. I tried manually stretching the label which worked in the sense that it would display all of the text so the issue is not in the wrapping of the label. I have also tested the cell.infoLabel.frame.size.height and the height value DOES change with the height of the cell as far as the value is concerned but it is not displayed as such.  What am I doing wrong?

A: I think that the problem might be of adjusting the vertical alignment of the text in the UILabel instance.
I think you should do the following inside cellForRowAtIndexPath:
cell.infoLabel.text = _content[[indexPath row] * 2];
cell.infoLabel.numberOfLines = 0;
[cell.infoLabel sizeToFit];

More details about it can be found in the following link: Vertical Alignment of UILabel Text
Hope this helps! :)

A: Use below code in cellForRowAtIndexPath delegate of tableView :
    // getDynamicHeight function calculates height based on text length
    //Dynamically determine height for cell text
    CGFloat calculatedHeight = [self getDynamicHeight:@"Some very long text here"];

    //Set name label frame based on text height
    cell.infoLabel.frame = CGRectMake(cell.infoLabel.frame.origin.x,cell.infoLabel.frame.origin.y, cell.infoLabel.frame.size.width,calculatedHeight);
    cell.infoLabel.numberOfLines = 5;

    cell.infoLabel.text = @"Some very long text here";

// getDynamicHeight function
//Dynamically determine height for cell based in containing Text
-(CGFloat) getDynamicHeight : (NSString *) strCellTextName {

UILabel *lblGetDynamicHeight = [[UILabel alloc] init];
lblGetDynamicHeight.lineBreakMode = UILineBreakModeWordWrap;

lblGetDynamicHeight.text = strCellTextName;

CGSize labelStringSize = [lblGetDynamicHeight.text sizeWithFont:lblGetDynamicHeight.font constrainedToSize:CGSizeMake(142, 9999) lineBreakMode:lblGetDynamicHeight.lineBreakMode];

return  labelStringSize.height; }


text:
Q: SQL update/delete performance with using BATCH execution vs single statement with IN clause? Lets say I have TABLE T with columns COL1, COL2, COL3.
I am wondering which of these two options would be better in terms of performance?
1) DELETE FROM T WHERE COL1 = <something> AND COL2 = <something> AND COL3 in (a, b, c, d, ... , z);

2) Create BATCH containing:
    DELETE FROM T WHERE COL1 = <something> AND COL2 = <something> AND COL3 = a
    DELETE FROM T WHERE COL1 = <something> AND COL2 = <something> AND COL3 = b
    DELETE FROM T WHERE COL1 = <something> AND COL2 = <something> AND COL3 = c
    DELETE FROM T WHERE COL1 = <something> AND COL2 = <something> AND COL3 = d
    .....
    DELETE FROM T WHERE COL1 = <something> AND COL2 = <something> AND COL3 = z

I would be interest to know if there will be any difference with small number of rows and huge number of rows?
Thanks in advance!

A: The first option should be faster as you are running only a single query, so there's less overheads. However, if you run the batch queries as parameterized queries, the query engine should be able to buffer the queries, and the difference should thus be small.
This assumes you have an index on columns 1 and/or 2 to filter. If you don't, the first approach will always be way faster, parameterized or not.
Perhaps the only case I can think of where the 2nd approach would be faster is when you only have a hash index on all three columns combined - then the query optimizer may not be smart enough to utilize the index in the first approach (depending when DB vendor you use).

A: it depends on the Recovery Model of your database combined with the Indexing on the table.
If you are in a situation where your Deletes are fully logged then do it in Batches.(Full Recovery & Indexes on Table)
If you meet the conditions for minimal logging then do the whole lot in one go.
(Simple & Heap)
Do a search on "Traceflag 610" you'll get some really helpful advice.


text:
Q: haw to find the values of binary numbers in octal? what is the value of 101111.0111 of base 2 (binary) in octal(base 8)
we know that in order to translate from binary to octal we need to group the bits in groups of three and the value is going to be in octal.
can anyone please explain for me haw to convert 101111.0111 from binary to octal.

A: First you have to form 3-digit groups adding leading zeroes to the integer part and trailing zeroes to the fractional part to make both of these parts containing number of digits divisible by $3$. In your case you have $101111.0111 = 101\ 111.011\ 100$. Each group before the dot refers to $8^0, 8^1$ and so on from right to left, each group after the dot refers to $8^{-1}, 8^{-2}$ and so on from left to right. So, here we have $101_2 * 8^1 + 111_2*8^0 + 011_2 * 8^{-1} + 100_2*8^{-2} = 5*8^1 + 7 * 8^0 + 3 * 8^{-1} + 4 * 8^{-2} = 57.34_8$


text:
Q: NodeJS + Express slowly consuming more and more CPU We have a strange issue where we have an endpoint in NodeJS+Express, this endpoint is called once every x minutes.
And each time it has been called, we see in our logs (Application insights in Azure to be specific) that the CPU usage have increased slightly.
Over time, CPU usage will end up at 100% and become unresponsive.
What I find strange is that we really do not do anything funky in this endpoint.
We fetch a lot of mongodb documents, iterate over them, do some processing, saving back a few. and that's it.
Are there any known pitfalls where CPU might leak using any of the above tools/frameworks ?
I'm thinking if we have configured something wrong that makes requests linger on forever somehow.
I cannot specify much more as I don't have a clue what could be the origin of this.

A: It sounds like the job is not completing before the next job? I can't tell from your explanation.
I have a couple of suggestions though:
Time the requests, if it is consistently failing around x minutes, then set that as the timeout, at least so that it won't kill other processes, or put this job on a separate thread.

*

*Maybe go to a batch system (have a flag on the documents, query if it exists or false and set a $limit the result set, then set the flag accordingly once that document has been processed)

*What does your memory look like? Are you able to use projections to limit the data processed on the back-end.

*If you are only updating a few documents, maybe you should re-visit the query. I would rather filter the result-set with the query, then bringing in a bunch of documents irrelevant to filter with JS.

*Memory management in the code - unfetch the queries, set the arrays to null once your done using them, etc.


text:
Q: Usage of "hysterical" meaning "very funny." One meaning (I am personally not very familiar with) of the adjective hysterical  is:

*

*causing unrestrained laughter; very funny:
  Oh, that joke is hysterical! (Dictionary.com)

*

*No other European language, as far as I know, uses "hysterical" with the meaning of "very funny", and the term has  definitely  a negative connotation.
According to Etymonline this connotation of hysterical is from the late '30s:

*

*Meaning "very funny" (by 1939) is from the notion of uncontrollable fits of laughter.

The following extract comments on the origin of the meaning  "very funny" but suggests that this connotation is debatable and should be avoided:

*

*It's true that hysterical "funny" is not especially ancient. The OED didn't add a listing for the sense until 1993,  with the earliest example from Mario Pei in 1969:  "To describe something as really funny, a woman will use 'hysterical'." As, indeed, Elizabeth Janeway did in her 1943 novel, "The Walsh Girls":

*

*She had never seen anything so funny in the world as Alice's face when Connie called her a bitch. It was the funniest thing that could have happened. It was hysterical.

Its connotation appears to derive from the earlier expression: hysterically funny:

Hysterically funny, the long form of our "hilarious" hysterical, shows up quite a bit earlier. This example from an 1886 short story may be transitional – the narrator is both trying to amuse a young woman and being driven slightly crazy:

*

*My behaviour was often fatuously absurd. Anon I became hysterically funny. Altogether I compared very unfavourably with the bright and facile Stephen.

but its usage should be avoided:

*

*Don't use it to mean "funny," she (Mignon Fogarty),advised in "The Grammar Devotional" (2009). "Hysterical means 'excited.'"  And she made hilarious/hysterical one of the confusable word pairs in her 2011 book, "Grammar Girl's 101 Misused Words You'll Never Confuse Again."  "People will say 'hysterical' when they think something is funny," she told Neal Conan in an NPR broadcast.

*

*But hysterical actually means excited in a negative way … when you're saying someone is hysterical, it's like, you know, hysterical laughter after a bank robbery when everyone is freaking out.

Questions:

*

*How common is the usage of the term hysterical meaning "funny" in BrE and AmE?

*Does hysterical actually carry a negative connotation as suggested in the above extract, or does it only convey a neutral meaning?

*Is its usage currently on the downtrend?

A:
How common is the usage of the term hysterical meaning "funny" in BrE
  and AmE?

It's fairly common in American English, less common than it used to be.

Does hysterical actually carry a negative connotation as suggested in
  the above extract, or does it only convey a neutral meaning?

Hysterical has never contained a negative connotation from my familiarity of its usage.  It would seem logical that its usage comes from "Hysteria" -that is laughing so much like you were in a state of hysteria.

Is its usage currently on the downtrend?

In the US, this type of terminology is being replaced largely by Facebook and Twitter memes.

A: The Corpus for NOW
Data that may help in discovering the answer to your question were recently released at corpus.byu.edu. Among other corpora, the NOW Corpus (News on the Web), with data from 2010-2016, can be used to analyze use of 'hysterical' in the sense of "funny" in the overall middling-formal English commonly found in online newspapers and journals.
The newspapers supplying text for the NOW corpus come from a variety of countries.

*

*How common is the use of the term hysterical, meaning "funny", in BrE and AmE?

To narrow the scope of this question, I looked at the context of instances of 'hysterical' in the NOW corpus with an eye to the relative frequency of occurrence of 'hysterical' used in the sense of "funny" compared to instances of 'hysterical' used in other senses. Because 'hysterical' occurred 5419 times (compare that number to the 158 occurrences of 'hysterically funny') in the corpus, I was compelled to sample the occurrences, rather than treat them exhaustively.
The 5419 instances of 'hysterical' in "about three billion words of data from web-based newspapers from 2010 to the present time" were predominantly used with other senses than 'funny'. A semantic breakdown of the results is not (yet) automated, so I scanned and evaluated samples of the use in context. In the 130 instances (some of them duplicates) of 'hysterical' found May 1-19 of 2016, for example, I observed only 10 uses that I could positively identify as meaning "funny". Extrapolating from that to the total, approximately 400 out of 5419 occurrences of 'hysterical' in the corpus are used in the sense of "funny". I see no reason to suppose that exhaustive examination of the 5419 instances from 2010-2016 would find an overall greater or lesser proportion of 'hysterical' in the sense of "funny", but considering that I only examined a very small sample (130 out of 5419), it is certainly possible that 'hysterical' in the sense of "funny" is more or less common than my finding suggests.

*Does 'hysterical' actually carry a negative connotation as suggested in the above extract, or does it only convey a neutral meaning?

Connotations are, of course, completely context-dependent. My observations of the use of 'hysterical' in the sense of "funny" in context for the 130 instances I examined were that 'hysterical' was primarily used postively, that is, to laud whatever was called 'hysterical' in the sense of "funny". Other senses than "funny", however, were predominantly negative, but were sometimes neutral. I did not observe a use of 'hysterical', in a sense other than "funny", that was positive in context.

*Is its usage currently on the downtrend?

This is much more difficult to determine, and the determination more difficult to support authoritatively: the analysis requires comparisons of samples, in context, month-to-month, year-to-year.
A rapid scan of the last 100 occurrences in April turned up approximately the same proportion of use in the sense of "funny" as I found in the 130 instances May 1-19. In accordance with that rather scanty and unsure correspondence, I ran a frequency distribution analysis:

[Discrepancy in data: The total freqency for all periods in this chart is 5823, rather than the 5419 presented as the frequency for a simple list. Subtracting the suspect duplicate of 449 in periods 2012-B and 2013-A gives an overall frequency of 5374, which also does not match 5419. I have no ready explanation for the discrepancy.]
As can be seen from the "PER MIL" chart column, a downward trend for use of 'hysterical' in all senses is evident year-over-year in this corpus. If my conjecture based on small, recent sample sizes is accurate over the timespan of the data, that downward trend would be reflected in a corresponding proportional downward trend in the use of 'hysterical' in the sense of "funny".
Notes
However fond the men and women of the press are of seeing themselves as vox populi, that description is not true to what is now the intrinsic purpose of their endeavors, selling or at least circulating 'news'. They use what can only be called a dialect of English, and the topics entertained by their work are restricted by considerations not foremost in the minds of many, nay, most speakers: that is, the motivating force for commercial 'news' is commercial gain, along with satisfying the whims as well as the social, political, and other predilections of the owners of the mass media.
This being the case, however, leaves the question of what more accurate collection of the uses of language by ordinary people is available as data for our consideration. Some researchers have resorted to sending correspondents abroad to record and transcribe the speech of what it is hoped will be a representative sample of the speech of various populations, and the results of those collections have been made available. The extremely small sample size, however, leaves any question with respect to a particular word, such as 'hysterical', in doubt.
Other Corpora
Another useful corpus from the same source (corpus.byu.edu) may be the Corpus of Global Web-Based English (GloWbE) (pronounced 'globe'). This has drawbacks:

*

*It is a snapshot corpus compiled in 2012, so it doesn't include the four years of language and web development after that time.

*GloWbe has, of necessity, more 'noise' in the data. The 'noise' may consist, for example, of more duplicated text, or of simply random text. The researchers who compiled the corpus made a decent effort to remove duplicated text in the form of boilerplate material, for example, but the automated techniques necessary to find and remove such materials are...less than perfect.

*Expectably, GloWbe instances cannot be dated accurately.

Nonetheless, I made a brief sortie at the dataset, which "is composed of 1.9 billion words in 1.8 million web pages from 20 different English-speaking countries. The web pages were collected in December 2012". See the description of the method used to create the corpus for more information.

The occurrence of 'hysterical' 5649 times in two-thirds the number of words as comprise the NOW corpus may suggest that in a broader range of less formal English, 'hysterical' is used more often. As with the NOW corpus, I analyzed approximately two hundred occurrences in context (60 US, 60 GB, 40 CA, 40 IE) to see what proportion of the uses were in the sense of "funny".
Of the 60 US, 11 were used in the sense of "funny"; of the 60 GB, 11; of the 40 CA, 9; of the 40 IE, 5. US = US English; GB = British English; CA = Canadian English; IE = Irish English.
Proportionally, then, the frequency of use of 'hysterical' in the sense of "funny" is higher, 36 out of 200, in this corpus than in NOW. The predominant use, however, remains with other senses than "funny".

More or less just because it was there, I also checked in the Corpus of American Soap Operas (SOAP). This corpus "contains 100 million words of data from 22,000 transcripts from American soap operas from the early 2000s, and it serves as a great resource to look at very informal language."
'Hysterical' occurred in the SOAP corpus 474 times overall, 4.74 times per million words, a higher frequency than any section of the NOW corpus. Of the 100 occurrences in context that I checked, 19 of them were in the sense of "funny", and 5 of those were sarcastic uses in that sense.
These observations suggest that in "very informal" English, both the overall frequency of use of 'hysterical' and the proportional frequency of use in the sense of "funny" are higher. However, both the overall greater frequency and the greater frequency of particular use may be artifacts resulting from the different time periods documented: NOW is compiled from data gathered 2010-present; SOAP was compiled from data extant in "the early 2000s", 2001-2012 (see chart for frequency per million per year); GloWbe was a snapshot of data in 2012.

In addition to the frequency differences, sarcastic use of 'hysterical' in the sense of "funny" was conspicuous in this corpus, but rare to the point of vanishing in NOW and GloWbe.
Also of interest in the SOAP corpus is that 'funny' is one of the top ten collocates, the tenth most common:

A quick look at those collocations in snippets of context shows that all are uses of 'hysterical' in the sense of "funny", although whether or not the use is sarcastic remains opaque without seeing more context:

Nonetheless, personal experience (also known as anecdotal evidence) aside, the use of 'hysterical' in other senses than "funny" was predominant in this as well as in the other corpora examined.

A: Despite your tags, you asked how common the funny meaning in British English.
Hysterical would normally mean very funny in the more common uses in British English, although it does depend on the context. In common speech, I doubt most people would understand it to mean anything else, despite its history.

Affected by or deriving from wildly uncontrolled emotion
informal Extremely funny

That context is everything, however. If there's any hint of humour, then it's clearly one meaning; if there's the whiff of madness, it's another. Consider:

"I went to see the new Ben Stiller film - it was hysterical"

(with apologies, as this is clearly a ridiculous scenario, as anyone who's ever seen a Ben Stiller film would attest).
vs

"I saw Ben Stiller being restrained - he was hysterical"

vs

"I went to see Ben Stiller - he was hysterical"

The first of these would universally be understood to mean "it was very funny"; the second is clearly suggesting that he was emotionally out of control; the third is ambiguous, as it could mean either. You'd need to decide from the rest of the conversation.
There are historical, sexist connotations - the "women are hysterical" view (as per the womb comment and here) which may change understanding, dependent on the listener. Consider:

"My wife was hysterical"

vs

"My husband is hysterical"

Depending on their prejudices, people could be more likely to understand the former as "emotionally over the top" and the latter as "very funny".  Welcome to the modern world.

EDIT
You're still concerned about this topic, so I'll address your questions very specifically - at least, from a UK perspective.
> How common is the usage of the term hysterical meaning "funny" in BrE and AmE?
Very. Most British people would understand hysterical to mean funny as a primary definition, despite what dictionaries say. US preference is hilarious for that use, although that sounds slightly sarcastic to UK ears.
> Does hysterical actually carry a negative connotation as suggested in the above extract, or does it only convey a neutral meaning?
Nothing negative about it (again, BrE). As per the sarcasm comment, it's perhaps even less negative than some other options.
> Is its usage currently on the downtrend?
I see no downtrend in common usage in the UK. Ngram suggests a slight decline in overall use of the word (i.e. whatever the meaning) in both BrE and AmE, but not significantly. Specific to the "funny" use, though, that's certainly not something that's born out in everyday speech in my experience.
Ngram UK
Ngram US
... with a slightly higher incidence in all-English fiction usage.

A: The other answers are good, but I'll add some additional notes for American English.

How common is the usage of the term hysterical meaning "funny" in BrE and AmE?

In American English, very common, in fact it is likely to be considered the primary definition by most listeners.
This is really the only reasonable interpretation when you're describing a thing (a book, a show, a joke, a movie). A "hysterical" movie clearly means a hilarious comedy, the other possible definitions of the word don't even make sense.
A couple of the other answers discussed whether this is primarily used sarcastically: by itself, no, you'd have to rely on other cues (droll tone, obviously not-funny subject) to determine this.

Does hysterical actually carry a negative connotation as suggested in the above extract, or does it only convey a neutral meaning?

When truly describing, say, a hilarious film, no, it doesn't have a negative connotation.
The main reason to be careful with the term is when describing a person as "hysterical", or perhaps when describing laughter as hysterical, since those are much more ambiguous.
Hopefully the context should help clarify:

*

*I saw Jerry Seinfeld the other day, he was hysterical.

*The customer became hysterical when denied a refund.

*The audience was in hysterics by the end of the play.

*The audience was in hysterics after the fire broke out.

*Jane's hysterical laughter startled everyone at the movie.

*Jane's hysterical laughter startled everyone at the funeral.

A: Hysterical comes from the medical Latin word hystericus, which described a female neurotic condition, thought to be caused by a dysfunction of the uterus.
Hysterical is still used today by psychiatrists, though in a broader way, to describe someone suffering from a psychological stress condition. Hysterical can also mean "extremely funny," even more so than hilarious.
Now coming to your questions-

*

*To answer your first and third question, I am attaching a graph showing usage trend of this word over time-

*Does hysterical actually carry a negative connotation as suggested in the above extract, or does it only convey a neutral meaning?
Hysterical has synonyms like agitated, psychedelic, etc denoting some kind of physical or emotional trouble leading to the condition.
So yes, the tone of the word is inclined towards negative side.


text:
Q: Keeping local variables value after rendering page in Rails I'm trying to create a page using rails. In this page, the user can select items from a list that is available in the page and he needs to be able to see all the items he selected. To do this, i created the following controller and view:
class PropostasController < ApplicationController
  def new
    @id_item = params[:id_item]
  end

  def ofertar
    @itens = Item.where(dono_id: session[:id_usuario])
    render "new"
  end

  def adicionar_item
    if !@itens_ofertados
      @itens_ofertados = []
    end
    @itens_ofertados.push(Item.find(params[:id_item]))
    render "new"
  end
end

view

Nova Proposta

<%= @id_item %>

  Realizar proposta para:

  Itens do usuário que receberá a proposta

  Itens a serem ofertados:

  <%= form_tag("/ofertar_item_proposta") do %>

      <%= submit_tag "Ofertar Item" %>

  <% end %>

<%= render "teste"%>

Itens ofertados

  <%if @itens_ofertados %>
    <% @itens_ofertados.each do |item| %>

<%= item.nome %>

<%= item.descricao %>

<%= item.quantidade %>

<%= item.categoria.nome %>

        <% if item.img_link %>

<%= image_tag(item.img_link, :size => "260x180") %>

        <% end %>

    <% end %>
  <% end %>

Itens a serem selecionados

  <%if @itens %>
    <% @itens.each do |item| %>
      <%= form_tag("/adicionar_item_proposta") do %>

<%= item.nome %>

<%= item.descricao %>

<%= item.quantidade %>

<%= item.categoria.nome %>

          <% if item.img_link %>

<%= image_tag(item.img_link, :size => "260x180") %>

          <% end %>

          <%= hidden_field_tag 'id_item', item.id %>

<%= submit_tag 'Adicionar a Proposta' %>

      <% end %>
    <% end %>
  <% end %>

The problem I'm having is that when I click in the submit button of one of the forms of the view, I lose the values that were in @itens_ofertados and in @itens. I want to re render the page or refresh it without losing the previous values of these variables for them to keep appearing in the page.

A: @itens_ofertados is not a local variable. It's an instance variable of your controller.
For each HTTP request, Rails instantiates a new controller instance to handle the request. When the request handling is done, the controller instance dies. So the value of the previous controller's instance variable is inaccessible because that controller instance no longer exists.
The best solution is to store the history in the browser's local storage.


text:
Q: SwiftUI ProgressView in List can only be displayed once I am working on a feature which takes a few seconds. So I want to display a ProgressView when my logic is in progress.
Not sure if this is a bug in SwiftUI, but in the following code, when I click the button the second time, the progress view does not show up anymore (The first click is fine tho)
struct ContentView: View {
  @State var inProgress = false
  var body: some View {
    List {
      if inProgress {
        HStack {
          Text("Waiting...")
          ProgressView()
        }
      } else {
        Button("Click Me") {
          inProgress = true
          Task {
            try? await Task.sleep(nanoseconds: UInt64(2 * 1_000_000_000))
            inProgress = false
          }
        }
      }
    }
  }
}

Note that this problem only happens under a List. If I change it to a VStack, then the ProgressView is displayed every time I click the button.

A: To show the ProgressView every time you click, add a new .id() to the HStack (or the ProgressView), so that it gets re-drawn:
    HStack {
      Text("Waiting...")
      ProgressView()
    }.id(UUID())  // <--- here

Note, you can also use Task.sleep(for: .seconds(2))


text:
Q: Import Error: cannot import name 'tqdm' from 'tqdm' Trying to execute the following code to check how the progress bar works with the tqdm module but receiving an "ImportError: cannot import name 'tqdm' from 'tqdm' "
Code
from tqdm import tqdm
for i in tqdm(range(0,100)):
    print(i)

A: Step 1: pip install tqdm
Step 2: If your filename is tqdm.py then you needed to rename it to another name. hope it will work.

A: That is because python is trying to import tqdm from the wrong file, not from the actual tqdm pacakge, if you are sure you have installed tqdm correctly you need to change the code to this:
import tqdm
print(tqdm.__file__)

If you are on Linux you should get something like:

/usr/lib/python3.7/site-packages/tqdm/__init__.py

To find out where the tqdm file is located, if you realize this is one of your own files that was mistakenly named tqdm you can rename that file and your problem should be fixed in case you have installed tqdm correctly.
Also that Is not how you would use tqdm you use it for tasks that don't output anything themselves and their progress is not visible in any other way(like from what they are printing). If you want to use tqdm then you shouldn't print anything in your loop, try something like this:
import time
from tqdm import tqdm

for i in tqdm(range(0,100)):
    time.sleep(1)

P.S.
It's highly recommended that you never install python packages with pip into the root python directory, and instead you get used to always using a virtualenvironment, or if not at least use pip install --user to install them to your own home directory. Otherwise you might pick bad habits and ruin the lives of others whenever you use a system with multiple users.


text:
Q: iOS memory warning : how to "clean up as much memory as possible"? When receiving a memory warning, those delegate methods get called:
In UIViewController:
func didReceiveMemoryWarning()

Sent to the view controller when the app receives a memory warning.

In AppDelegate:
optional func applicationDidReceiveMemoryWarning(_ application: UIApplication)

Tells the delegate when the app receives a memory warning from the system. [...] Try to clean up as much memory as possible. next step is to terminate app

My question, as a newbie, is how can I "clean up as much memory as possible"? Especially if there are some leaks in my app.
Thank you for your help

A: If you've have material leaks, you should simply fix those. They'll be a persistent source of problems as you move forward. The "debug memory graph" tool is really useful when diagnosing those issues.
In answer to the question, when it says "clean up as much memory as possible" it means that you should release anything that can be readily re-retrieved or re-constructed. For example, maybe you downloaded images and have kept them in memory. You might remove those images from memory and re-retrieve them should you need them again.


text:
Q: How to pass action string for commandButton using f:attribute tag in Composite component I'm developing composite component in JSF. In that I can pass method names as arguments in following way.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions"
    xmlns:p="http://primefaces.org/ui"
    xmlns:composite="http://java.sun.com/jsf/composite">

    <!-- INTERFACE -->
    <composite:interface>
        <composite:attribute name="noOfButtons"  type="java.lang.Integer" required="true"/>
        <composite:attribute name="actionOnly"  type="java.lang.Boolean" required="true"/>
        <composite:attribute name="myBean" required="true" type="com.jsf.CRUDBean"/>
        <composite:attribute name="myIcons"  type="java.lang.String" required="true"/>
        <composite:attribute name="myAction" type="java.lang.String" required="true"/>
        <composite:attribute name="myDesc" type="java.lang.String" required="true"/>

    </composite:interface>

    <!-- IMPLEMENTATION -->
<composite:implementation>

            <c:forEach begin="0" end="#{cc.attrs.noOfmys - 1}" var="counter"
                varStatus="status">

                <h:commandButton id="myButton_${counter}"
                    action="#{cc.attrs.myBean[fn:split(cc.attrs.myAction, ',')[status.index]]}"
                    image="#{request.contextPath}/resources/images/#{fn:split(cc.attrs.myIcons, ',')[status.index]}"
                    title="#{fn:split(cc.attrs.myDesc, ',')[status.index]}"
                    style="padding:2px">
                <p:spacer width="5px;" />
            </c:forEach>

</composite:implementation>
</html>

This is working perfect.But in my case, I need to pass action in following way.
<c:forEach begin="0" end="#{cc.attrs.noOfmys - 1}" var="counter"
                varStatus="status">

                <h:commandButton id="myButton_${counter}"

                    image="#{request.contextPath}/resources/images/#{fn:split(cc.attrs.myIcons, ',')[status.index]}"
                    title="#{fn:split(cc.attrs.myDesc, ',')[status.index]}"
                    style="padding:2px">
                        <f:attribute name="action" value="#{cc.attrs.myBean[fn:split(cc.attrs.myAction, ',')[status.index]]}" />

            </h:commandButton>

                <p:spacer width="5px;" />
            </c:forEach>

But this is not working in my application. Whenever I click commandButton from the page nothing happening at user level. Any help would be thankful.


text:
Q: Inner joining on multiple tables but only selecting one I am joining two different tables to my original table, but I want to only inner join on one of the two (depending on if it is the one that contains a matching key). Basically, it will be impossible for both table that are being joined to have the same record as the original. I need at most one.
Something like...
SELECT
t.Id,
t.column1,
t.column2,
a.column3 as 'Column 3',
b.column4 as 'Column x',
s.column5,
t.column6
FROM "Table1" t
INNER JOIN "Table2" a on a.Id = t.Id
INNER JOIN "Table3" b on b.Id = t.Id

Only one of 2 or 3 should be joined on if the Id exists in that specific table.

A: You can use left join:
SELECT t.*,
       a.column3 as Column3,
       b.column4 as Columnx
FROM Table1 t LEFT JOIN
     Table2 a
     ON a.Id = t.Id LEFT JOIN
     Table3 b
     ON b.Id = t.Id;

This is often used with coalesce():
SELECT t.*, coalesce(a.col1, b.col1) as col1
FROM Table1 t LEFT JOIN
     Table2 a
     ON a.Id = t.Id LEFT JOIN
     Table3 b
     ON b.Id = t.Id;


text:
Q: connecting to host running ssh2 server using ssh client I am trying to connect to a linux host( target_host) running sshd2 using a ssh client( client_host) ;While doing so I converted the pub key of client_host as
ssh-keygen -e -f id_rsa.pub > client_host_ssh2_id_rsa.pub

and copied client_host_ssh2_id_rsa.pub to target_host. However when i try to connect I get "no hostkey alg"
ssh user@target_host -v
OpenSSH_5.1p1, OpenSSL 0.9.8a 11 Oct 2005
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to target [169.35.74.21] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/identity type -1
debug1: identity file /home/user/.ssh/id_rsa type 1
debug1: identity file /home/user/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version 6.0.12.81   SSH  Tectia Server
debug1: no match: 6.0.12.81 SSH Tectia Server
debug1: Enabling compatibility mode for protocol 2.0
 debug1: Local version string SSH-2.0-OpenSSH_5.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
no hostkey alg

Can someone please help me identify what am I missing here.

A: Most likely, what you are missing is, on the remote machine:
 cd $HOME/.ssh;  cat client_host_ssh2_id_rsa.pub >> authorized_keys

If this is not enough, then stop the sshd daemon, then restart it as follows:
 /usr/sbin/sshd -Dd

which prevents daemonization, and prints error message to standard output. As you try to log in, in this way you will be able to see the error messages on the server side, which are much more informative than those on the client side, for obvious security reasons. This will help you/us to debug the problem.


text:
Q: Que hace exactamente la funcion getopt () ? de la libreria ? Que hace exactamente esta función? y como podría aplicarla a mi código?

A: getopt es una función que facilita la interpretación de los parámetros de inicio de la aplicación.
Hay multitud de programas que no tienen interfaz gráfica y la configuración se les facilita mediante línea de comandos:
ls -l -a

En el ejemplo anterior, l es un parámetro de configuración. Este parámetro podrías leerlo fácilmente usando getopt:
char c;
while ((c = getopt (argc, argv, "la:")) != -1)
{
  switch (c)
  {
    case 'a':
      // Parametro "a" presente
      // ...
      break;
    case 'l':
      // Parametro "l" presente
      // ...
      break;
  }
}

O podrías programarlo a mano (teniendo en cuenta que los parámetros pueden estar desordenados:
for( int i=1; i<argv; i++ )
{
  if( strcmp(argc[i], "-a") == 0 )
  {
    // Parametro "a" presente
    // ...
  }
  if( strcmp(argc[i], "-l") == 0 )
  {
    // Parametro "l" presente
    // ...
  }
}

Fíjate que en este segundo caso los if son prácticamente iguales, lo que puede dar lugar a errores difíciles de detectar.
getopt tiene una extensa configuración para adaptarse a los diferentes tipos de entradas que se puedan necesitar.


text:
Q: Why are DNS lookups not respecting /etc/nsswitch.conf & /etc/host.conf? I have an issue where hostnames are being looked up from DNS even though they are present in /etc/hosts.
I have the following configured:
/etc/host.conf:
order hosts,bind

/etc/nsswitch.conf:
hosts:      files dns

/etc/resolv.conf:
nameserver <nameserver one>
nameserver <nameserver two>

The application running on the host makes some internal and external API requests.
From tcpdump, I'm seeing DNS queries to some of the internal service hostnames that are listed in /etc/hosts. The tcpdump command I'm using is:
tcpdump -tqAlU -s0 port 53 and host <nameserver one>

In the dump I'm seeing requests like the following:
IP 10.0.80.11.domain > app004-private.51308: UDP, length 102
E...I2..>...
.P.
.........I.1E...:...Q.. localhost............   ..@.a.root-servers.net..nstld.verisign-grs.com.w..
IP app004-private.33828 > 10.0.80.11.domain: UDP, length 39
E..Ca.@.@.B.
.2.
.P..$.5./..3e.......... localhost.site.com.....
IP 10.0.80.11.domain > app004-private.33828: UDP, length 96
E..|....>.T;
.P.
.2..5.$.hU.3e.......... localhost.site.com................-.ns10.dnshost.com...dns.8w.............u.....

Notice that localhost is being sent to DNS as well as localhost.site.com. The /etc/hosts entry for localhost is:
127.0.0.1 localhost.localdomain localhost

And
IP 10.0.80.11.domain > app004-private.51664: UDP, length 93
E..yx...>.m.
.P.
.2..5...e.<N2...........api.site.com................-.ns10.dnshost...dns.5w.............u.....
IP app004-private.51664 > 10.0.80.11.domain: UDP, length 48
E..L`.@.@.C.
.2.
.P....5.8..n............api.site.com.site.com.....
IP 10.0.80.11.domain > app004-private.48878: UDP, length 76
E..h&e..>..w
.P.
.2..5...TQ..............11.80.0.10.in-addr.arpa.............Q............p.... .        :...Q.
IP 10.0.80.11.domain > app004-private.51664: UDP, length 105
E...VX..>..g
.P.
.2..5...qJ.n............api.site.com.site.com................-.ns10.dnshost.'.dns.Aw.............u.....

Where api.site.com is in /etc/hosts. Running getent to query api.site.com returns:
$ getent hosts api.site.com
10.36.176.114   api001-private api001-private.site.com api001 api.site.com api

I'm stumped. Everything appears to be configured correctly (as far as I'm aware) to use /etc/hosts first then DNS. Any insight as to why /etc/nsswitch.conf and /etc/host.conf are not being respected?
The main application running on the system is http (apache 2.2.15 and PHP 5.3.8 with curl 7.30.0). The OS is Centos 5.6 running with kernel 2.6.18-238.9.1.el5 and glibc 2.5-58.el5_6.3.
Thanks in advance!

A: We were able to resolve this by disabling ipv6. We disabled ipv6 by adding the following to /etc/modprobe.conf and rebooting.
alias net-pf-10 off
alias ipv6 off
options ipv6 disable=1

After reboot, we no longer see DNS lookups for hosts listed in /etc/hosts.
It's not clear to me exactly why this resolves the issue.

A: There are many applications out there that do not use the OS-api to query names. Instead they do an explicit DNS-query.
If that happens - they will not go via the resolver library.
On Linux you can do the same on the command line:

*

*host YOURHOST will try to resolve DNS - no matter what.

*gethostip YOURHOST will use the defined resolver settings in the configured order.

A: It looks like your application uses the curl library, which has its own name resolving facility intricacies, see e.g.:
https://stackoverflow.com/questions/29570033/how-can-i-get-libcurl-to-return-me-dnsresolver-used-for-connect-call


text:
Q: Counselor for children at youth summer camp I am looking for a fine translation on a recent activity of mine. I worked in a youth summer camp with children aged 7-15.
Deepl.com suggests that I was a "counselor" for children. This does not sound quite exact for me. None of the other suggestions of Deepl.com, Linguee.com and other online dictionaries fit in my eyes.
Is there a better translation for my activity?
Thank you in advance!

A: The position is commonly referred to as a camp counselor.
Since you already used the words "camp" and "counselor" in your question, you probably know what they mean, and I think the only thing you didn't realize is that you can put them together.
English speakers understand that "camp counselor" is not the same as "counselor" and that you are not claiming to be a psychiatrist or medical professional.


text:
Q: i can't personally todos react native firestore I made a todo app using firebase. I store the todos in firestore and save the email address of the user who added the todo into the document. but when a user saves todo, all users see that todo. my codes:
const [dailys, setDailys] = useState([]);
const dailyRef = firebase.firestore().collection('daily');
const [addDaily, setAddDaily] = useState('');
const email = firebase.auth().currentUser.email;

useEffect(() => {
    async function check() {
        dailyRef.orderBy('createdAt', 'desc')
            .onSnapshot(
                querySnapShot => {
                    const dailys = []
                    querySnapShot.forEach((doc) => {
                        const { heading } = doc.data()
                        dailys.push({
                            id: doc.id,
                            heading,
                            email: email,
                        })
                    })
                    setDailys(dailys)
                }
            )
    }
    check()
}, [])
const addDailyPlan = () => {
    if (addDaily && addDaily.length > 0) {
        const timeStamp = firebase.firestore.FieldValue.serverTimestamp();
        const daily = {
            email:email,
            heading: addDaily,
            createdAt: timeStamp
        };
        dailyRef
            .add(daily)
            .then(() => {
                setAddDaily('');
                Keyboard.dismiss();
            })
            .catch((error) => {
                alert(error);
            })
    }
}
render(
 <FlatList data={dailys}/>

)

A: If everyone is pushing in the same collection, everyone will have the same result...
Either create a specific collection for each user (recommended), or add this to your query => where("email", "==", email)
Read the docs for reference

A: const email = firebase.auth().currentUser.email;
const dailyRef = firebase.firestore().collection('daily');

 setDoc(doc(dailyRef,email ), {
    name:"name",
    email:email });

const q = query(dailyRef, where("email", "==", email));

I followed your advice and used a code in the above structure. but I am getting an error like this:
[Unhandled promise rejection: TypeError: t._freezeSettings is not a function. (In 't._freezeSettings()', 't._freezeSettings' is undefined)]


text:
Q: Flutter Textfield's height I'd like to reduce the "default" height of my TextField widget so that it matches my model (the bottom one, the top one is my emulator).

If wrap my TextField with a Container to put it a height, the TextField's height won't expand as I wanted as the number of line increases.
So I don't know what to do to reduce the default height.
TextField(
   keyboardType: TextInputType.multiline,
   maxLines: 5,
   minLines: 1,
   decoration: InputDecoration(
      hintText: "Saisir le message",
      contentPadding: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 5.0),
      filled: true,
      fillColor: MC_lightGrey.withOpacity(0.5),
      border: new OutlineInputBorder(
         borderSide: BorderSide.none,
         borderRadius: const BorderRadius.all(
             const Radius.circular(10.0),
         ),
       ),
   ),
),

A: Try this code:
TextField(
   keyboardType: TextInputType.multiline,
   maxLines: 5,
   minLines: 1,
   decoration: InputDecoration(
      isDense: true,
      hintText: "Saisir le message",
      contentPadding: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 5.0),
      filled: true,
      fillColor: MC_lightGrey.withOpacity(0.5),
      border: new OutlineInputBorder(
      borderSide: BorderSide.none,
      borderRadius: const BorderRadius.all(
        const Radius.circular(10.0),
      ),
    ),
  ),
),

Add isDense:true in InputDecoration.


text:
Q: Unable to properly load external script without jquery I am trying to lazy load a directive within another directive based on a condition. I have a main directive and within it I have a <script> tag. The included directive loads properly only when jquery is present, the problem is that not all of my pages load jquery. There is also a second warning...

synchronous XMLHttpRequest on the main thread is deprecated.

Which I should be able to suppress if I find a pure angularJs way of loading the script.
Here is my setup
<my-directive>
    <script ng-if="expression" src="../path" type="application/javascript"></script>
</my-directive>

very simple, but it only works if jquery is there to load it. I tried to load it via $http.get() request and then eval() (which I know the dangers) but that did not work.

A: Here is a way which leverages the $http approach. You can create a directive which augments your <script> tag for this functionality, checking for a defined type attribute. You could of course modify this check however you'd like. Observe the following...
app.directive('script', function($http) {
    return {
        restrict: 'E',
        scope: false,
        link: function(scope, elem, attrs) {
            if (attrs.type === 'text/javascript-lazy') {
                $http.get(attrs.src).then(function(response) {
                    var code = response.data;
                    var f = new Function(code);
                    f();
                });
            }
        }
    };
});

<!-- retrieved -->
<script type="text/javascript-lazy" ng-if="true" src="script.js"></script>
<!-- not retrieved -->
<script type="text/javascript-lazy" ng-if="false" src="script.js"></script>

This will work inside an element wrapped directive as well.

Plunker - working demo


text:
Q: Tooling API execute anonymous results I am trying to run an execute anonymous statement using tooling API.
I am running a very simple
System.debug('test');

Now the issue is as this is a GET request, the response that I get is like this -
{"line":-1,"column":-1,"compiled":true,"success":true,"compileProblem":null,"exceptionStackTrace":null,"exceptionMessage":null}

How can I get the results of my code execution to be displayed in my called UI.?
Thanks,
Ray

A: if you want to see a debug output then you need to get it separately.
With Tooling API it involves:
1. Seting TraceFlag
https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_traceflag.htm
2. Downloading log file
https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_apexlog.htm
An example flow can be something like this:
1. Create TraceFlag (this is to tell SFDC to start logging)
2. executeanonymous
3. retrieve debug log
4. delete TraceFlag
step 4 is not strictly necessary but helps keeping things clean.
Also, I am not sure if your use case demands REST specifically and SOAP is a no go, but if you could use SOAP API then you might want to look into SOAP API Developer's Guide.
With Apex SOAP API you do not have to go through as many steps as with Tooling API to get a debug log.
Have a look at the DebuggingHeader documentation:  https://developer.salesforce.com/docs/atlas.en-us.196.0.apexcode.meta/apexcode/sforce_api_header_debuggingheader.htm
With Apex API (SOAP version) "executeAnonymous" process looks like so (pseudocode):
val apexCode: String = ...
val conn = getApexConnection
val debugHeader = new DebuggingHeader_element()
debugHeader.setDebugLevel("Debugonly")
conn.__setDebuggingHeader(debugHeader)
val res = conn.executeAnonymous(apexCode)
val log = conn.getDebuggingInfo.getDebugLog

A: The Apex SOAP API is a great choice if want to execute some anonymous Apex and then retrieve the resulting debug log in one API call. You don't need to first create a TraceFlag and then retrieve the resulting debug log in separate API calls.
It's the basis for my blog post Adding Eval() support to Apex.
Here is some sample code for the Apex API executeAnonymous method. The soapSforceCom200608Apex class was generated using the free FuseIT Wsdl2Apex (Disclosure, this is my current employer).
soapSforceCom200608Apex.Apex tooling = new soapSforceCom200608Apex.Apex();

soapSforceCom200608Apex.SessionHeader_element header=new soapSforceCom200608Apex.SessionHeader_element();
tooling.SessionHeader = header;

header.sessionId = UserInfo.getSessionId();
tooling.endpoint_x = URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/s/31.0';

tooling.DebuggingHeader = new soapSforceCom200608Apex.DebuggingHeader_element();
//ExecutionLogType - https://www.salesforce.com/us/developer/docs/apexcode/Content/sforce_api_header_debuggingheader.htm
tooling.DebuggingHeader.debugLevel = 'NONE';

tooling.DebuggingHeader.categories = new soapSforceCom200608Apex.LogInfo[0];
tooling.DebuggingHeader.categories.add(new soapSforceCom200608Apex.LogInfo());
tooling.DebuggingHeader.categories[0].category = 'Apex_code';
tooling.DebuggingHeader.categories[0].level = 'ERROR';

soapSforceCom200608Apex.ExecuteAnonymousResult result = tooling.executeAnonymous_http('Integer i = 314159; System.debug(LoggingLevel.Error, i);');
System.assert(result.success);
system.debug(result.DebuggingInfo.debugLog);

This outputs to the local debug log:

31.0 APEX_CODE,ERROR
  Execute Anonymous: Integer i = 314159; System.debug(LoggingLevel.Error, i);
  08:49:24.040 (40971768)|EXECUTION_STARTED
  08:49:24.040 (40984194)|CODE_UNIT_STARTED|  [EXTERNAL]|execute_anonymous_apex
  08:49:24.041 (41651505)|USER_DEBUG|1|ERROR|314159
  08:49:24.041 (41697265)|CODE_UNIT_FINISHED|execute_anonymous_apex
  08:49:24.042 (42806116)|EXECUTION_FINISHED


text:
Q: Vercel Production Branch is stripping Authorization header on POST to Serverless Function API Nothing special about the API but I have a serverless function POST API which expects an Authorization header to validate and then writes to a db.
For example:
     curl --location --request POST 'https://myserver.server.com/api/endpoint' \
        --header 'Authorization: Bearer blahblahblahblah'

In a Vercel Preview branch I'm able to get this to work and the Authorization header is passed to my API as expected.  When I test this out in production the Authorization header is stripped from the request (figured that out by logging the raw request headers).  What's are the difference between Preview and Production with respect to Authorization headers?  What do I need to do to forward the header in Production?
Any help would be greatly appreciated.  Thanks in advance!

A: This seems to be a bug in Vercel (Support is already notified) so let's wait for what they say. I'm assuming they consume the authorization header themselves and drop it afterward. It's a bit strange that this only happens in PROD but we shall see.
Workaround
Luckily, for us, this is quite easy to workaround. I've posted my updated function to illustrate the point. The main thing is to use any header other than authorization
I'm using x_authorization, but the name is entirely arbitrary.
export default async function handler(
  req: NextApiRequest,
  res: NextApiResponse
) {
  if (req.method === 'POST') {
    //using 'custom' x_authorization header because the regular 'authorization' header is stripped by Vercel in PROD environments.
    const { x_authorization } = req.headers

    if (x_authorization === `Bearer ${process.env.CRON_API_KEY}`) {

      //TODO: YOU DO YOUR THING HERE!!!

      res.status(200).json()
    } else {
      res.status(401).end()
    }
  } else {
    res.setHeader('Allow', 'POST')
    res.status(405).end('Method Not Allowed')
  }
}

A: I just had this issue and think I found the reason it was only affecting production for you and more or less the root cause. It seems to have to do with vercel's forwarding rules.
When I sent the request to mydomain.com the authentication header was stripped but when I sent to www.mydomain.com the header remained there. This makes sense because I have the "recommended" forwarding rules from vercel that forwards mydomain.com to www.mydomain.com


text:
Q: API / App having issues I'm getting connection issues in the app. Half the time I try to view a question or post something, it either times out, or gives me a "make sure you're connected to the internet" error.
It's highly unlikely this is a problem on my end. I have a full wifi connection, and everything else loads fine. I'm also having the same issues on LTE.


text:
Q: Regex expression to match a currency with spaces around The regex is matching the currency properly, for instance $42,000,000 . However, if I write aaaa$42,000,000 or $42,000,000aaa or aaa$42,000,000aaaa it's also matching it which shouldn't be the case, it should match only when there are spaces around.
The regex I have is  /\$(([1-9]\d{0,2}(,\d{3})*)|0)?(\,\d{1,2})?/g
I also tried with /\b\$(([1-9]\d{0,2}(,\d{3})*)|0)?(\,\d{1,2})?\b/g
but it's not working. Any suggestions?

A: You may use the following pattern:
(?<!\S)\$\d{1,3}(?:,\d{3})*(?:\.\d+)?(?!\S)

Demo
Explanation:
(?<!\S)      assert that what precedes is either whitespace or the start of the input
\$           match $
\d{1,3}      match 1-3 digits
(?:,\d{3})*  match zero or more thousands terms
(?:\.\d+)?   optional decimal component
(?!\S)       assert that what follows is either whitespace or the end of the input

A: I'd suggest this regex:
^\$\d{1,3}(?:(?:\.|\,)\d{3})*$

*

*^\$\d{1,3}: line must start with a dollar sign followed by 1 up to 3 digits

*(?:(?:\.|\,)\d{3})*$: line can end with an unlimited (or zero) repetition of 3 digits preceded by a comma or a dot

Demo: https://regex101.com/r/BBWlIF/2


text:
Q: What is wrong with the styling in these lists (HTML) I've been doing the web course on Codecademy and I'm stuck on the "Styling the font!" task.
Any ideas what I'm doing wrong?

This item is big Garamond.

This item is medium Bodoni.

This item is small Futura

Thank you for all your help!

A: Remember that most computers only have a limited amount of fonts installed: http://web.mit.edu/jmorzins/www/fonts.html
It's best practice to specify fall-back fonts too incase the users computer doesn't have the first font specified e.g.
font-family: arial, helvetica, georgia, verdana, sans-serif;

So if the computer doesn't have arial installed it will go down the list until it finds one it does have installed and it will display that.
Also you've declared size wrongly. It should be...
font-size: xxx;

A: "size" should be "font-size".

This item is big Garamond.

A:
This item is big Garamond.

This item is medium Bodoni.

This item is small Futura

A: Try this:

This item is big Garamond.

This item is medium Bodoni.

This item is small Futura.

A: Defining font-family properties?
you could use multiple fonts like this font-family: arial, verdana, "Cooper Black";
Defining font size?
define like this font-size: 16px;
Alternatively you could define these font properties simultaneously like this font: 16px arial, verdan, "Cooper Black"; or font: 16px arial; or font: 16px/20px arial; below is line-height.


text:
Q: iOS: Ambiguous property synthesis behavior. Inheritance related I'm using AppCode and it flagged an interesting situation in the code of a very large project. Pre-ARC.
A subclass defines and synthesizes a property called delegate. Actually the property declaration had been commented out! But the @synthesize delegate = delegate_; statement was left behind.
The code compiles, presumably because the base class defines and synthesizes a property also called delegate and synthesizes it with a backing variable with the same name: @synthesize delegate = delegate_;
My question is: What happens with a message is sent to the delegate in
a) the base class methods and
b) in the sub-class methods.

AppCode flags the synthesize statement in the sub-class as an error:

Accessors of property 'delegate' were already synthesized with
  instance variable 'delegate_'

A: The @synthesize directive is shorthand for creating accessor methods and an ivar according to the specifications (atomicity, memory management) of the property of the same name. Given that, re-synthesizing a property in a subclass (without re-declaring it) works exactly like overriding the accessor methods -- the subclass's implementations are used instead of the superclass's. Since the implementations are created by the compiler in both cases, there's no noticeable difference in behavior.
The one difference is that a synthesized ivar has the same visibility as a @private ivar, so subclasses can't access it, including to use it as the backing variable for a property. This means that the re-synthesis in the subclass must use a different ivar name. If the superclass has @synthesize wildHorses = wildHorses_;, then the compiler requires the subclass to do something like @synthesize wildHorses = equusFerus;.*

*If the superclass uses the default name for the created ivar, @synthesize wildHorses; then the subclass must still synthesize a new variable: @synthesize wildHorses = wildHorses_;


text:
Q: Office 365 OneDrive REST API - "invalid_client" I'm trying to make a call to the new Office 365 File REST APIs. (As explained here).
I'm using Postman rest client to send the request.
I have registered my application in Azure AD and given it full permissions to 'Office 365 SharePoint Online'.
I can successfully get an authorization token using the clientId generated in Azure AD.
However when I attempt to list files, using the access token I get an error.
------------------
RESOURCE HTTP GET:
------------------
URL: https://<OUR_DOMAIN>-my.sharepoint.com/personal/<user_domain>/_api/Files
HEADER: Authorization: Bearer <access token>

Response:

3001000;reason="There has been an error authenticating the request.";category="invalid_client"

What can cause this issue?

A: Not sure what steps you've tried to use to resolve this, so it's hard to help you out here. I've just finished writing up more detailed instructions on the steps to register an app to call OneDrive for Business. It's long and complicated right now, but we're working to make things better in the future.
You can check out the details of how to do auth here: https://dev.onedrive.com/auth/aad_oauth.htm
Make sure you aren't asking for too many permissions, since that will require your app to be authenticated by an admin instead of the end user. For most apps, you can just use the "My files" permission scopes which can be accepted by the user of your app directly.
If you post more information about what calls you're making, responses, and app configuration in AAD I might be able to help more.

A: You may have been using different resources.
Check whether the resource which you have used for getting access token is same as which you are requesting for getting files.

for example :

If the resource which you have mentioned while requesting access token be :: "https://tenant-my.sharepoint.com/"
Then you need to make request on the same resource for accessing files :: "https://tenant-my.sharepoint.com/_api/v2.0/drive/root/children"
The above request give list of root children.

*

*tenant --> domain name which was registered to your organisation.

Follow this documentation for further accessing the api


text:
Q: Is it possible single Box App to authenticate different iOS apps? The whole idea is to authenticate App, App Lite, App iPhone, App iPhone Lite with single Box.com App ID and return the user to the right app which redirected to the user to the authorization/authentication web site.
My Conclusion till now leads to using different App Id, because of lack of option to add different Redirect url's and respectively possibility for [box-api] to recognize the right caller application.
Will it work if I try to embed auth url in UIWebView and handle the response from that webView?

A: We currently don't support this use case, and you'll need separate App IDs


text:
Q: "taking address of temporary" warning
Possible Duplicate:
taking address of temporary while accessing address of a element in vector<bool>

I get 'taking address of temporary' warning at line 7 in following piece of code
vector<bool> boolVect;
bool x = true;
boolVect.push_back(true);
boolVect.push_back(false);
ofstream fMetaOut("tmp.txt", ios::out);
fMetaOut.write((char* )&x, sizeof(bool));
fMetaOut.write((char* )&boolVect[0], sizeof(bool));
fMetaOut.close();

Why do I get this warning at line 7 and not at 6 ??
Both use boolean address.
How can I get rid of this warning?

A: x is not an temporary, it is a l-value, an automatic variable which resides on stack.
While, &boolVect[0] is not an l-value.
l-value is an entity whose address can be taken, in short a variable whose lifetime is long enough to reside in the memory so that it can be addressed by an name.
What is problem with vector<bool>?? It works fine for vector<int>
The C++ standard library provides a specialization of vector for boolean types.
The goal is optimization, to use less size than a usual implementation of
vector for type bool. A usual implementation for bool would reserve at least 1 byte for each element. The vector<bool> specialization usually uses internally only 1 bit for an element, so it is typically eight times smaller. But this optimization comes with a price:
In C++, the smallest addressable value must have a size of at least 1 byte. Thus, such a specialization of a vector needs special handling for references and iterators.
As a result, a vector<bool> does not meet all requirements of other vectors. The behavior you see is one such example, elements of the vector<bool> are not a true l-values.

A: Unlike other specialisations of vector, vector<bool> does not manage an array of bool objects. Instead, it manages a packed bitfield.
Since the bits are not individually addressable, boolVect[0] is not a reference to a bool; it's a (temporary) object of a type that's convertible to bool. There is no way to get a reference or pointer to a vector element.
If you want a container of boolean flags that you can take references to, then vector<char> or deque<bool> might be suitable choices.
Taking the address of x is fine, since it is a (non-temporary) bool object.


text:
Q: How do I properly handle exceptions in constructors?
Possible Duplicate:
How to clean initialized resources if exception thrown from constructor in c++

How do I handle exception in constructors if I am creating 6 objects and those objects create 5 object and fails while creating the 6th one?
Thanks.

A: The usual behavior is just to let the exception propagate.  Destructors
for any completely constructed base classes and members will be called;
if the first five objects are members, they will be correctly
destructed.
The only case where a problem might occur is if the objects you are
talking about have been dynamically allocated (using new).  If that is
the case: the first thing to ask yourself is why?  Why are you
dynamically allocating, and not making the object a concrete member?  In
my experience, such a need is very, very rare, except in a few special
cases (e.g. the compilation firewall idiom), in which case, there will
normally be exactly one object in the class (e.g. a pointer to the
implementation object).  In such cases, there is no problem, because if
the new of that object fails, nothing else has been done which needs
undoing.
If you find yourself in the exceptionally rare case where you really
do have to use dynamic allocation and have more than one such object
(e.g. because you have two subobjects which are polymorphic), then
you'll have to ensure that each of the allocations is wrapped in some
sort of a sub-object (a smart pointer will do the trick); once the first
sub-object has been successfully constructed, its destructor will be
called if the constructor fails at some later point.

A: When an exception is thrown in the constructor all fully constructed subobjects are destroyed. Since it is good practice to have destructors of constructed objects look after their resoyrces, nothing needs to be done for these subobjects. What remains is cleaning up in the body of the constructor currently executing when the exception is thrown. However, this is no different to the clean-up in any other function.
Note that the destruction order is the reverse of the construction. That is, clean-up in the body starts first when all subobjects are not, yet, destroyed. Then the members are destroyed, then non-virtual base classes, and finally virtual base classes.

A: At the "core" of dealing with exceptions is that virtually everything should be cleaned up via destructors. For example, if you "new" an object you get a "raw" pointer; if an exception is thrown somewhere you must make sure that this raw pointer is properly "delete"d -- but make sure you don't delete a raw pointer that hasn't been initialized.
On the other hand, if you store that pointer into an std::unique_ptr you don't have to do anything; when the unique_ptr is destroyed the object is deleted, and object-destruction happens automatically: when the unique_ptr goes out of scope, the compiler invokes the cleanup, completely invisible (so no more code-cluttering with tons of cleanup calls) and automatically (so no more 'ouch, when it takes that rare path that nobody really tested it forgets to cleanup').
The same can be applied to just about every resource; there are "auto pointers" for COM-objects (as used in DirectX, for example), most frameworks should give you a "scoped lock"-type object to wrap around mutexes (so it locks the mutex when the object is created, and unlocks it when it's destructed), and you can write tiny wrappers to deal with various Windows-handles.
Basically, if you put all your cleanup into destructors, you'll never have to "try...catch...rethrow" just to clean up. And destructors of "larger" objects will often be very simple, as virtually all the "contained" objects are cleaned up automatically by their destructors.


text:
Q: Select on a Cross Join Returning Wrong Results ****EDIT****
Adding SQL Fiddle Link HERE
I created the scenario in SQL Fiddle to show what I am trying to accomplish.  I found it very odd that it produces accurate results in SQL Fiddle yet produces the results below using my DB.
However for the sake of proving that the seasons truly exist here is a select tvseasons join on tvseries:

Running this query:
SELECT TVSeriesHasTVSeason.tvSeriesID, TVSeason.tvSeasonID, TVSeason.title, Users.userID,
    CASE
        WHEN UserHasWatchedTVSeason.tvSeasonID IS NULL THEN 'No'
        ELSE 'Yes'
    END as watched
FROM TVSeason
CROSS JOIN Users
LEFT JOIN UserHasWatchedTVSeason
    ON  TVSeason.tvSeasonID = UserHasWatchedTVSeason.tvSeasonID
    AND Users.userID = UserHasWatchedTVSeason.userID
RIGHT JOIN TVSeriesHasTVSeason
    ON TVSeason.tvSeasonID = TVSeriesHasTVSeason.tvSeasonID

Returns:
515 1769    1000 Ways to Die Season 1   3   Yes
515 1770    1000 Ways to Die Season 2   3   Yes
515 1772    1000 Ways to Die Season 4   3   Yes
515 1773    1000 Ways to Die Season 5   3   Yes
516 1774    2 Stupid Dogs Season 1      3   No
516 1775    2 Stupid Dogs Season 2      3   No
517 1777    24 Season 2                 3   Yes
517 1779    24 Season 4                 3   Yes
517 1780    24 Season 5                 3   Yes
517 1781    24 Season 6                 3   Yes
517 1782    24 Season 7                 3   Yes

The season id are consecutive you can clearly see season 3 of 1000 ways to die is not being returned and there are also a couple seasons of 24 also not being returned.
I have no idea what is wrong with this query?
****EDIT** I believe I found a working solution to the issue:**
SELECT x.*,
    CASE
        WHEN UserHasWatchedTVSeason.tvSeasonID IS NULL THEN 'No'
        ELSE 'Yes'
    END as watched
FROM
(SELECT
    TVSeries.tvSeriesID, TVSeries.title,
    TVSeriesHasTVSeason.tvSeasonID,
    Users.userID
FROM TVSeries
LEFT JOIN TVSeriesHasTVSeason
    on tvseries.tvSeriesID = TVSeriesHasTVSeason.tvSeriesID
LEFT JOIN TVSeason
    on tvseason.tvSeasonID = TVSeriesHasTVSeason.tvSeriesID
CROSS JOIN Users)x
LEFT JOIN UserHasWatchedTVSeason
    on x.tvSeasonID = UserHasWatchedTVSeason.tvSeasonID
    AND x.userID = UserHasWatchedTVSeason.userID

A: Assuming that all seasons are in TVSeason, the most plausible explanation would be that the seasons you mention are missing from TVSeriesHasTVSeason. Note that the right join does nothing but eliminate rows missing from TVSeriesHasTVSeason, as no data from that table is used anywhere else. By the way, note that you don't need the cross join. Assuming your tables are sane you can take the user IDs from UserHasWatchedTVSeason.

An update, based on the comments and on the edits to the question. In the discussion below the line, you said:

I guess I am looking to do this in a View that shows the Series # and TV Season # and User ID # and watched = yes, no, or partially watched series

Below is a query that, given sane data, would match your requirement:
SELECT WatchCount.tvSeriesID, WatchCount.userID,
  CASE
    WHEN WatchCount.NWatched = 0 THEN 'No'
    WHEN WatchCount.NWatched = SeasonCount.NSeasons THEN 'Yes'
    ELSE 'Partial'
    END AS Watched
FROM (
  SELECT SR.tvSeriesID, U.userID,
    COUNT(UxSN.tvSeasonID) AS NWatched
  FROM TVSeries SR
  CROSS JOIN Users U
  LEFT JOIN TVSeriesHasTVSeason SRxSN
    ON SRxSN.tvSeriesID = SR.tvSeriesID
  LEFT JOIN UserHasWatchedTVSeason UxSN
    ON UxSN.userID = U.userID
    AND UxSN.tvSeasonID = SRxSN.tvSeasonID
  GROUP BY SR.tvSeriesID, U.userID
  ) WatchCount
INNER JOIN (
  SELECT SRxSN.tvSeriesID,
    COUNT(SRxSN.tvSeasonID) AS NSeasons
  FROM TVSeriesHasTVSeason SRxSN
  GROUP BY SRxSN.tvSeriesID
  ) SeasonCount
ON SeasonCount.tvSeriesID = WatchCount.tvSeriesID

A few important observations:

*

*Your comment mentioned returning both the series and the season IDs along with the Watched field. That, however, wouldn't work well: Watched is a property of the user-series combination; and so a query returning it should have the season data grouped away already (the alternative leads to returning a lot of duplicated data).

*The evidence you provided strongly suggests that the TVSeriesHasTVSeason table has missing or wonky rows for a few seasons. This query does not account for that; therefore, you will likely need an extra left join on TVSeasons (as in your answer) or, preferably, to check your data and figure out what is wrong with TVSeriesHasTVSeason.

*TVSeriesHasTVSeason seems unnecessary; if the schema is under your control I suggest you to merge it with TVSeason. Every season has exactly one series, and so the association would be more naturally done through an extra foreign key in TVSeason. Separate association tables are best used with many-to-many relations, or with optional fields.

*While there is a cross join in this query, it is between TVSeries and Users, which should result in far fewer result rows than one between TVSeason and Users. Looking from a higher-level point of view, the cross join between TVSeries and Users expresses your desired result (i.e. all combinations between series and seasons), while a cross join between TVSeason and Users generates a lot of extra data (the individual 'Yes' and No values) which will be thrown away (as you are only interested in the counts).

A: This is a working solution:
SELECT x.*,
    CASE
        WHEN UserHasWatchedTVSeason.tvSeasonID IS NULL THEN 'No'
        ELSE 'Yes'
    END as watched
FROM
    (SELECT
        TVSeries.tvSeriesID, TVSeries.title,
        TVSeriesHasTVSeason.tvSeasonID,
        Users.userID
    FROM TVSeries
    LEFT JOIN TVSeriesHasTVSeason
        on tvseries.tvSeriesID = TVSeriesHasTVSeason.tvSeriesID
    LEFT JOIN TVSeason
        on tvseason.tvSeasonID = TVSeriesHasTVSeason.tvSeriesID
    CROSS JOIN Users)x
LEFT JOIN UserHasWatchedTVSeason
    on x.tvSeasonID = UserHasWatchedTVSeason.tvSeasonID
    AND x.userID = UserHasWatchedTVSeason.userID

My thought is that in my original post that I was losing my connection in the CROSS JOIN when I referenced it in later JOINS.
I would hope someone might be able to tell me WHY this worked exactly as it is still a little unclear to me.
Also to expand my answer to return 'yes', 'no', 'partially watched':
SELECT *
FROM
    (SELECT userID, tvSeriesID,
        CASE
            WHEN COUNT(tvSeriesID) = ABS(SUM(watched))
                AND SUM(watched) > 0 THEN 'Yes'
            WHEN COUNT(tvSeriesID) = ABS(SUM(watched))
                AND SUM(watched) < 0 THEN 'No'
            ELSE 'Partial'
        END as watched
    FROM
        (SELECT x.*,
            CASE
                WHEN UserHasWatchedTVSeason.tvSeasonID IS NULL THEN -1
                ELSE 1
            END as watched
        FROM
            (SELECT
                TVSeries.tvSeriesID, TVSeries.title as tvSeriesTitle,
                TVSeriesHasTVSeason.tvSeasonID,
                Users.userID
            FROM TVSeries
            LEFT JOIN TVSeriesHasTVSeason
                on tvseries.tvSeriesID = TVSeriesHasTVSeason.tvSeriesID
            LEFT JOIN TVSeason
                on tvseason.tvSeasonID = TVSeriesHasTVSeason.tvSeriesID
            CROSS JOIN Users
            )x
        LEFT JOIN UserHasWatchedTVSeason
            on x.tvSeasonID = UserHasWatchedTVSeason.tvSeasonID
            AND x.userID = UserHasWatchedTVSeason.userID
        )y
    GROUP BY userID, tvSeriesID
    )z
ORDER BY userID, tvSeriesID


text:
Q: Windows 7 Embedded - Disable Disk Caching Programmatically: Preface:
We are using a Windows-7-Embedded image, for making client-ready copies of our software.
The flow is pretty standard:

*

*Take a blank hard-drive.

*Restore an in-house Windows-7-Embedded image on the hard-drive.

*Install additional software on-top.

*Hard-drive ready!
The Problem:
Sometimes, probably due to system crashes, some configurations that are already configured inside the image - reset.
My current problem is with a 'Disable Write Caching' option on the disk.
In the image, the option is off.
Sometimes, it just resets and turns on.
My Question:
How can I programmatically disable the disk write caching property?
Design Restrictions:

*

*Can run an .exe on startup. The system is mostly c++ so that is that would be the optimal language for a code based solution.

*Can run a .bat file.

*can run a .vbs file. Not sure which version our current infrastructure are compatible with.

Images (Inside Image -> After Crash):

Clarifications:

*

*Did my research. did not find anything related to windows write caching option in SO or SE as a whole. Did find a bunch of linux related questions.

*The system crashes are by-design, at the moment. This is the obvious root cause, but cannot be fixed due to design restrictions and budget issues.

A: There is a registry setting EnableCache you may try to experiment with. It applies to FAT file systems and setting it to 0 shall theoretically disable disk caching. Though I have not tested it.
Look into:
HKEY_LOCAL_MACHINE\SYSTEM\StorageManager\FATFS or HKEY_LOCAL_MACHINE\SYSTEM\StorageManager\EXFAT


text:
Q: Converting a percentage whole number in one field to a decimal in another field in Adobe Livecycle I'm creating a budget template in Livecycle Designer.
I have a field where users can enter a percentage as a number (for example if you want to enter 75%, just enter 75).
I'd like another numfield box to take this number and convert it to .75
Can I do this across num fields or do I have to do it one box (where a user enters 75 and it turns into .75 automatically).

A: If you just want to enter integer numbers in the numeric field then that can easily be done by just taking a numeric field and then simply entering this javascript in the "exit event" of the field as:
var value1=this.rawValue;
this.rawValue="."+value1;


text:
Q: How to access/split items in a column that contains a list Let's say I received a dataset with a structure similar to this (I understand that this structure is not typical.)
The following code is just to generate an example of a dataframe that looks like my data.
tmp = pd.DataFrame(
    [
        {'foo': 123, 'bar': [1, 2]},
        {'foo': 456, 'bar': [1, 2]}
    ]
)

   foo    item
0  123  [1, 2]
1  456  [1, 2]

Is there an easy way to:

*

*access items in bar.. like df.bar[1], resulting in 2 ?
(this clearly does not work)

*or split the bar column into something like bar.0, bar.1, etc..

Ideally, I would like to plot all items in bar[0] vs bar[1]
Note the list in bar is not limited to 2 items and the number can vary a bit.

A: Yes, there is. Use str.get
tmp.bar.str.get(0)

0    1
1    1
Name: bar, dtype: int64

tmp.bar.str.get(1)

0    2
1    2
Name: bar, dtype: int64

To split, use pandas DataFrame constructor
col_names = ['bar.0', 'bar.1'] # Notice you can dinamically create this if needed
pd.DataFrame(tmp.bar.values.tolist(), columns=col_names)

    bar.0   bar.1
0   1       2
1   1       2

A: For your second request, you could apply pd.Series, and concatenate with your original dataframe:
>>> pd.concat((tmp,tmp.bar.apply(pd.Series).add_prefix('bar_')), axis=1)
      bar  foo  bar_0  bar_1
0  [1, 2]  123      1      2
1  [1, 2]  456      1      2

This works even if there are a variable number of elements in bar:
>>> tmp
         bar  foo
0  [1, 2, 3]  123
1     [1, 2]  456

>>> pd.concat((tmp,tmp.bar.apply(pd.Series).add_prefix('bar_')), axis=1)
         bar  foo  bar_0  bar_1  bar_2
0  [1, 2, 3]  123    1.0    2.0    3.0
1     [1, 2]  456    1.0    2.0    NaN


text:
Q: How to resolve CORS issue in Angular website running on Apache server and hitting Salesforce APIs? I have created a website which is utilizing the Angular Framework that runs on Apache server and that website is hitting Salesforce APIs but I am getting Cross-Origin Resource Sharing (CORS) error at the time of hitting Salesforce APIs. I have found a solution in which we can add our website URL in Setup > CORS in each Salesforce org manually but in this solution we need to add our URL in each Salesforce org manually which not good for many salesforce orgs.
I have also tried to add some headers to Allow CORS in server .conf file but didn't work.
Is there any way to resolve this CORS issue?


text:
Q: grabbing the closest element i am working on a gallery where i need to add a class to image when the overlay div is hovered.
this is my html

And this is my javascript
        $('.overlayForCarDetails').mouseenter(function () {
            $(this).css('opacity', '0.7');
            $(this).closest('.mediumImg').addClass('zoomed');

        });

But somehow its not working.
Can you tell me where am i doing it wrong.
thanks.

A: Try to select the .next() sibling and .find() the relevant element from it.,
$(this).next('a').find('.mediumImg').addClass('zoomed');

Full code would be,
 $('.overlayForCarDetails').mouseenter(function () {
   $(this).css('opacity', '0.7');
   $(this).next('a').find('.mediumImg').addClass('zoomed');
 });

A: You have to use .next() and .find() instead of .closest() (as closest look up hierarchy), like below :
$('.overlayForCarDetails').mouseenter(function () {
            $(this).css('opacity', '0.7');
            $(this).next().find('.mediumImg').addClass('zoomed');

        });

A: You need nextAll(), or siblings() to get the a elements at same level in the hierarchical tree of DOM. Then you need to using find() to get the .mediumImg in the descendants of a   The closest() looks the ancestors of element on the DOM hierarchy.
$('.overlayForCarDetails').mouseenter(function () {
     $(this).css('opacity', '0.7');
     $(this).next('a').find('.mediumImg').addClass('zoomed');
});

next()
Description: Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.


text:
Q: ¿Cómo puedo agrupar el resultado de una búsqueda a una tabla base en Genexus? Tengo la tabla base ventas la cual contiene fecha de venta, marca, monto. La recorro de la siguiente manera:
for each ventas
 where FechaVenta=&fecha
  &montoTotal=&montoTotal+ monto
endfor

Con esto logro obtener el total del monto por día; pero necesito obtener el monto por marca y fecha, y el resultado sea mas o menos así:
Fecha     Marca  - Monto
01/12/21   VW       =900,000,000.00
01/12/21   Nissan   =200,000,000.00
01/12/21   Ford     =900,000,000.00

De antemano GRACIAS

A: Los podes hacer anidando For Each y haciendo cortes de control

For Each Ventas
    Order FechaVenta
    Where FechaVenta=&fecha

    For Each Ventas
        Order Marca

        &MontoPorMarca = 0

        For Each Ventas
            &MontoPorMarca = &MontoPorMarca + monto
            &montoTotal=&montoTotal+ monto
        EndFor

        PrintBlock Fecha Marca MontoPorMarca

    EndFor

    PrintBlock MontoTotal

EndFor

La navegacion debe mostrarte siempre recorridos sobre la tabla ventas, mostrando los anidados como "break"


text:
Q: R Boxpacker function not showing 3d visualization I'm running the boxpacker package and the last visualization isn't showing when I set plotSolution = True, wondering if there was any way to fix it or simply show the 3d model in a different line? The package is located here https://github.com/delta1epsilon/BoxPacking
# create containers
c1 <- Container(length = 2, height = 2, width = 2)
c2 <- Container(length = 2, height = 2, width = 2)

# create boxes
b1 <- Box(length = 0.5, height = 0.5, width = 0.5)
b2 <- Box(length = 1, height = 0.5, width = 0.5)
b3 <- Box(length = 0.5, height = 0.5, width = 0.5)
b4 <- Box(length = 0.5, height = 0.5, width = 0.5)
b5 <- Box(length = 0.5, height = 0.5, width = 0.5)
b6 <- Box(length = 2, height = 0.5, width = 0.5)
b7 <- Box(length = 1, height = 0.5, width = 0.5)
b8 <- Box(length = 1, height = 0.5, width = 0.5)
b9 <- Box(length = 0.5, height = 0.5, width = 0.5)
b10 <- Box(length = 0.5, height = 0.5, width = 0.5)
b11 <- Box(length = 1.5, height = 1.5, width = 1.5)
b12 <- Box(length = 1.5, height = 0.5, width = 0.5)
b13 <- Box(length = 1, height = 1, width = 1)
b14 <- Box(length = 1, height = 1, width = 1)

boxes <- list(b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14)
containers <- list(c1, c2)

# Box Packing
solution <-
  PerformBoxPacking(containers = containers,
                    boxes = boxes,
                    n_iter = 4,
                    population_size = 30,
                    elitism_size = 5,
                    crossover_prob = 0.5,
                    mutation_prob = 0.5,
                    verbose = TRUE,
                    plotSolution = TRUE
  )


text:
Q: Find the value of [K:$\mathbb{F}_{p}$] here? This question was asked in masters entrance and I was unable to solve it .

Let p be a prime number and F be a field of $p^{23}$ elements . Let $\phi$: F->F be the field automorphisms of F sending $a $ to $a^{p}$  .Let K={a belonging to F | $\phi(a) =a $}. What is the value of [K:$\mathbb{F}_{p}$]?

Attempt :  The problem arised because I am not sure which elements of F will go to a under $\phi$ and how to compute those elements .

A: The elements of $K$ are exactly the roots of the polynomial $x^p-x\in F[x]$ which belong to $F$. On the one hand we know that all the elements of $\mathbb{F_p}$ are such roots, this is Fermat's little theorem. On the other hand a polynomial of degree $p$ over a field can't have more than $p$ roots and hence these are all the roots, i.e $K=\mathbb{F_p}$. So the degree is $1$.

A: $K$ is simply $\Bbb F_p$. To prove this, you can argue as follows.
$\Bbb F_p \subseteq K$ because of Fermat's little theorem.
On the other hand $K$ is by definition the set of roots of the polynomial $x^p-x \in F[x]$. Since $F$ is a field, this polynomial has at most $p$ roots. This means that $K$ is a set with at most $p$ elements.
Thus $K= \Bbb F_p$.


text:
Q: Asp.net core mvc + kendo ui for jquery CRUD Hello i'm developing a project where i need to use asp.net core mvc with kendo ui for jquery grid, and i'm having problems with the edit method, any hints?
Also i want to the edited data gets updated in the database.
I debugged and for some reason i cant get the data from the edit to my controller.
Controller
public class EmployeeController : Controller
{
    private readonly ApplicationDbContext _db;

    public EmployeeController(ApplicationDbContext db)
    {
        _db = db;
    }

    // GET: EmployeeController
    public ActionResult Index()
    {
        return View();
    }
    // GET: EmployeeController/Create
    public IEnumerable<Employee> read()
    {
        return _db.Employees;
    }

    [HttpPost]
    public async Task<IActionResult> UpdatePost(int id, [Bind("Id,FristName,SecondName,Age,Salary,Status")] Employee employee)
    {
        _db.Update(employee);
        await _db.SaveChangesAsync();
        return Ok();
    }
}

Model
public class Employee
{
    [Key]
    public int Id { get; set; }
    public string FirstName { get; set; }
    public string SecondName { get; set; }
    public int Age { get; set; }
    public double Salary { get; set; }
    public bool Status { get; set; }
}

Html + kendoUI

A: *

*Try [FromBody] attribute.

*Clean up  comments and parameters

UpdatePost(int id <= you dont use this
'//GET: EmployeeController/Create' looks like routing but it's not

*Create some sort of viewModel. Do not send to entity to the view/frontend.


text:
Q: Kafka SMT ValueToKey - How use multiple values as key? I'm using the Confluent JDBCSourceConnector to read from an Oracle table. I am trying to use SMT to generate a key composed of 3 concatenated fields.
transforms=createKey
transforms.createKey.type=org.apache.kafka.connect.transforms.ValueToKey
transforms.createKey.fields=BUS_OFC_ID_CD,SO_TYPE,SO_NO

Using the above transformation, I get something like this:
{"BUS_OFC_ID_CD":"111","SO_TYPE":"I","SO_NO":"55555"}

I would like something like:
111I55555

Any idea on how I could concatenate the values only?

A: I could not resolve the issue above in the properties file.  So, the work around was:

*

*Create a view (we already had to do that to get mode=timestamp to
work with our Oracle DB)

*Add an extra field with the concatenated values for KEYNAME

*Extract the concatenated value to use as the key.

For example:
CREATE VIEW XX_TEST_V AS
SELECT BUS_OFC_ID_CD, SO_TYPE, SO_NO, BUS_OFC_ID_CD||SO_TYPE||SO_NO as KEYNAME
FROM XX_TEST;

This would then give you a JSON key message of
{"KEYNAME ":"111I55555"}

To strip off the JSON to have just the text is then done in the properties file
For example:
transforms=createKey,extractString
transforms.createKey.type=org.apache.kafka.connect.transforms.ValueToKey
transforms.createKey.fields=KEYNAME
transforms.extractString.type=org.apache.kafka.connect.transforms.ExtractField$Key
transforms.extractString.field=KEYNAME

This should then give you the following as the key
"111I55555"

Regards
Peter


text:
Q: How to make Xcode 3.2.3 build a specfic architecture? I'm getting the following error when including static libraries:

missing required architecture i386 in
  file

This worked 30 seconds previously, and only failed when I upgraded to Xcode 3.2.3. I've used "file" command to check - and, yes, XCode is building completely the wrong architecture (armv6 + armv7 instead of i386).
This seems to be a major bug in latest Xcode, where Apple has re-written the build / compile / link settings. There's a note in the release notes saying very vaguely that they've "Changed it" because it used to be "confusing". This is not helpful.
The build settings for the library VERY clearly say:

"Valid architectures: i386"

There's no confusion here - Xcode is building something other than what the target says it should.
The question is: how do you un-break this? How do you force Xcode to do what it's supposed to? I've re-installed Xcode from scratch, cleaned everything, and manually inspected the build files. There's nothing wrong (and, of course, it worked perfectly in xcode 3.2.2)

A: After considerable research, I believe the answer is:
"this is now impossible - Apple has deliberately hard-coded XCode to ignore build settings"
However, I've come up with a script that automatically builds ALL platforms of a project (which you HAVE to do with static libraries - you don't have much choice now, because Apple has disabled Targets), and the script could easily be modified to do all targets, instead of all platforms:
Build fat static library (device + simulator) using Xcode and SDK 4+

A: Right click on your Target app under Targets and make sure that the Base SDK is set to iOS.