text:
Q: How do you properly subclass MvxCollectionViewSource? What's the trick to implementing a custom MvxCollectionViewSource?
I've subclassed it and have provided an implementation for GetCell(), but the resulting cells are not data bound. When I use an out of the box MvxCollectionViewSource, it works.
This is a 101 use case, so I must be doing something wrong. I am using MvvmCross 5.7. Any help would be appreciated?

A: GetCell in MvxCollectionViewSource, MvxTableViewSource and other variants do the binding there. Hence, if you override that method, you are taking the responsibility of doing the binding.
If you simply want to provide your own Cell, you should override GetOrCreateCellFor instead. This method is used in GetCell to get the actual cell and bind it to the item found by calling GetItemAt.
So instead override GetOrCreateCellFor:
protected override UICollectionViewCell GetOrCreateCellFor(
    UICollectionView collectionView, NSIndexPath indexPath, object item)
{
    var cell = collectionView.DequeueReusableCell(MyCustomCell.Identifier, indexPath) as MyCustomCell;
    if (cell == null)
        cell = new MyCustomCell();

    return cell;
}


text:
Q: Checking if a point is inside or outside a polygon for an ArrayList I want to be able to check if a user inputted point is inside or outside a bounded set of points.I am aware of the .contains function for the Polygon class in java, but I was wondering how I would go about doing something like that for an ArrayList of < Point > .
Here is an example of what I'm trying for:
The points of the polygon are:
(-10, 0)
(-1, -10)
(0, 10)
(1, -10)
(10,0)
Test point:
5 0

Inside

Test point: 8 8

Outside

Any hints in the right direction would be appreciated!

A: This seems a little homeworky, so I am not going to go into great detail, but assuming that the polygon points listed are always in order, you could connect lines between all the points in the polygon to close its border, then cast rays from your sample points outward. If the ray passes through an odd number of lines before going outside the area the polygon is in, that means the sample point is inside the polygon. If it passes through an even number of lines, it is outside the polygon. (If it never goes through a line, it is also outside the polygon, assuming the ray is long enough to hit the edge of the polygon from where the sample point is located.) Best of luck.
More Information

redpajama_set_name: RedPajamaStackExchange


text:
Q: Finding the variance of $0.2(0.8)^x$, where $x = 0, 1, 2, 3 .......$ the question asks for the expected value as well as variance of the above question.
I've attached a picture of my answer for the mean, but i can't use similar reasoning for the variance.

A: $P(X=n) = (1-p)^{n-1}p$, if $X$ is a geometric random variable.
$\mathbb{E}[X] = \sum_{n=1}^\infty nP(X=n)$
$ = \sum_{n=1}^\infty n(1-p)^{n-1}p$
Let $S = \sum_{n=1}^\infty nq^{n-1}$ for some $q \in (0,1)$.
$S = 1 + 2q + 3 q^2 + \;...$
$qS = \;\;\;\;\;q + 2q^2+ \;...$
$(1-q)S = 1 + q + q^2 + \;... = \frac{1}{1-q}$
implying $S = \frac{1}{(1-q)^2}$.
Using this result, we get:
$\mathbb{E}[X] = \frac{p}{(1-(1-p))^2} = \frac{1}{p}$.
$\mathbb{E}[X^2] = \sum_{n=1}^\infty n^2P(X=n) $
$= \sum_{n=1}^\infty n^2(1-p)^{n-1}p $
Let $S = \sum_{n=1}^\infty n^2 q^{n-1}$ for some $q \in (0,1)$.
$S = 1 + 4q + 9q^2 + \; ... $
$qS = \;\;\;\;\; q+4q^2+\;... $
$(1-q)S = 1 + 3q + 5q^2 + \;...$
$q(1-q)S = \;\;\;\; q +3q^2 + \;...$
$(1-q)^2S = 1 + 2q + 2q^2 + \; ...  = 1 + 2q(1+q+q^2+ \; ...)$
$(1-q)^2S = 1 + \frac{2q}{1-q} = \frac{1+q}{1-q} $
implying $S = \frac{1+q}{(1-q)^3}$.
Using this result, we get:
$\mathbb{E}[X^2] = \frac{p(1+1-p)}{(1-(1-p))^3} = \frac{2-p}{p^2} $.
Finally, $Var(X) = \mathbb{E}[X^2] - \mathbb{E}[X]^2 = \frac{2-p}{p^2} - \frac{1}{p^2} = \frac{1-p}{p^2}$.


text:
Q: Need content to grow to same height I'm using AngularJS Material and am running into an issue trying to get md-cards to be the same height.  On the screen, the cards are the same height, but I really only want the content portion to grow to fill in the free space.  Below you can see that my cards are the same height, but I want my image and image title to stay put, while everything below grows to fit the greatest height:

My code for the cards look something like this:
  <md-card>

      {{c.title}}

    <md-card-actions layout="row" layout-align="start center">
      <md-button>Action 1</md-button>
      <md-button>Action 2</md-button>
    </md-card-actions>
    <md-card-content>

STUFF

STUFF

      <md-divider style="padding-bottom:10px;"></md-divider>

STUFF

    </md-card-content>
  </md-card>

My CSS for the row and the cards within looks like this:
.parent {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
}

.parent .col-md-4, .parent .col-md-4 div, .parent .col-md-4 div > md-card {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: column;
  -webkit-flex-direction: column;
  flex-direction: column;
    //need these three lines in order to work in IE
  flex-grow: 1;
  flex-shrink: 0;
  flex-basis: auto;
}

The row has the class "parent" and each of the three cards are contained in a col-md-4 class.
I've tried a bunch of different CSS related changes, but nothing seems to work.  Can someone provide some guidance on how to make the cards same height, but have the card images and card titles stay in place?

A: Give a fixed height to .md-card-image-and-title add apply object-fit:contain rule to .md-card-image.
.md-card-image-and-title{
  height:150px;/* fixed height */
}
.md-card-image{
  height:100%;
  width:100%;
  object-fit:contain;
}

A: i have create a codepen codepen examplefor you, hope it helps !. Here are the code example :
HTML

Ibrahim Aziz

        Administrator

I'm a technical lead at infoconnect

Ibrahim Aziz

        Administrator

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

Ibrahim Aziz

        Administrator

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

CSS
section
{
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
}

section article
{
  margin: 20px;
  width: 240px;
  height: auto;
  flex-grow: 1;
  background-color: red;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  flex-direction: column;
}

section article figure
{
  margin: 0px;
  height: 120px;
  width: 100%;
  flex-grow: 0;
  background-color: blue;
}

section article div
{
  align-self: flex-start;
  flex-grow: 1;
}

Please ask if you need further explanation, thank you !.

A: I know there's an accepted answer on here, but I'd like to put forth a potentially simpler fix.

<md-card layout="column">

  <md-card-actions>
    //Buttons here
  </md-card-actions>
  <md-card-content flex>
    //expanding content here
  </md-card-content>
</md-card>

In this case, I'm using flex to tell the img tag to take up a certain percentage of the card's height with flex="50", letting the card actions take up their own auto height, and telling the card's content to fill whatever is left with flex


text:
Q: Section title and the first paragraph on the same line This question is about ConTeXt not LaTeX.
I'd like to have a special section such that A) there is no line break after a section title, and B) paragraphs in the section is narrower and indented like so:
Title   Paragraph 1, Paragraph 2,
        Paragraph 3, Paragraph 4,
        and Paragraph 5

So far I have this:
\setupnarrower[left=4cm]
\definehead[special][section]
\setuphead[special]
    [number=no,
     textstyle=\tfd,
     beforesection={\startnarrower[left]},
     aftersection=\stopnarrower]

\starttext

\startspecial[title=Knuth]
\input knuth
\stopspecial

\startsection[title=Lorem]
\input lorem
\stopsection

\stoptext

This achieves the second goal but not the first:
Ideally, top/cap height of the title (Knuth) and top/cap height of the first paragraph ("Thus, I came ...") are (roughly) vertically aligned, not their baselines.
Could anyone suggest a way to achieve this effect?

A: Use after={\blank[overlay]}.
\setupnarrower[left=4cm]

\definehead
  [special][section]

\setuphead
  [special]
  [
    number=no,
    after={\blank[overlay]},
    textstyle=\tfd,
    beforesection={\startnarrower[left]},
    aftersection=\stopnarrower,
  ]

\starttext

\startspecial[title=Knuth]
\input knuth
\stopspecial

\startsection[title=Lorem]
\input lorem
\stopsection

\stoptext

To align the top of the line with the top of the title you can use this (dodgy) construction.  I tested it with a few different fontsizes and it seems to work but I don't give any guarantee.  Also it breaks gridsnapping.
\setupnarrower[left=4cm]

\definehead
  [special][section]

\setuphead
  [special]
  [
    number=no,
    after={\blank[overlay,halfline]},
    textcommand=\tbox,
    textstyle=\tfd,
    beforesection={\startnarrower[left]},
    aftersection=\stopnarrower,
  ]

\starttext

\startspecial[title=Knuth]
\input knuth
\stopspecial

\stoptext

A: Another option is to use description environment:
\definedescription
    [special]
    [
      alternative=left,
      width=4cm,
      headstyle=\tfd,
      headcommand=\tbox,
    ]

\starttext

\startspecial[title=Knuth]
\input knuth
\stopspecial

\startsection[title=Lorem]
\input lorem
\stopsection

\stoptext

which gives


text:
Q: Which structure is better? - PHP HTTP library Which structure will be useful/better?
(PHP)
Structure A
+ httpLib/
|   . Index.php / Factory
|   . API.php
|   . _Exception.php
|   + Response/
|   |   . Interface.php
|   |   . ...
|   + Request/
|   |   . Interface.php
|   |   . ...

Structure B
+ httpLib/
|   . Response.php
|   . Request.php
|   . API.php
|   . _Exception.php
|   + Client/
|   |   . Interface.php
|   |   . Socket.php
|   |   . Stream.php
|   |   . cURL.php
...

(I did not find a better title)
Thanks.

A: The first structure is the best.
With it you can better separate the requests and responses.
The structures of the requests and responses are well defined and not in a single class


text:
Q: how can I check if Leiningen is successfully installed and working at full capacity? Java JDK is installed, everything works great, also maven works great.
I followed the instructions from the site, downloaded the bat file, set the path and at the command prompt started the installation with the command lein self-install.
what i got in response is downloading leiningen now ....
after a while, C: \ windows \ system32> appeared below that line and it stays that way for several hours.
What more should I do?

A: The command line normally uses a prompt like > or similar to indicate it is waiting for a command.  Then you type something followed by the <return> key:
> lein --version
Leiningen 2.9.8 on Java 1.8.0_322 OpenJDK 64-Bit Server VM
>

Here I typed lein --version, then <ret>, and the computer responded with a 1-liner about the version of Leiningen and Java that are installed. Then it displayed the prompt again, waiting for the next command.
You can use the cd (change directory) command to move around. With no prompt it will send you back to your "home" directory.  See docs for the BASH or ZSH shell.
For Windows, I highly recommend installing the BASH Shell and git from this site:
https://gitforwindows.org/
IMHO the bash shell is greatly superior to the built-in Windows shell from CMD.EXE


text:
Q: If $Z_1, Z_2$ are iid $N(0,1)$, how can we show that $E(e^{tZ_1Z_2}|Z_1) = e^{\frac{1}{2}Z_1^2t^2}$? Let $Z_1, Z_2$ be iid $N(0,1)$, I would like to show that for $t$ a dummy variable:
$$
E(e^{tZ_1Z_2}|Z_1) = e^{\frac{1}{2}Z_1^2t^2}
$$
In other words, I'd like to find the conditional moment generating function of $Z_1Z_2$. My approach is very long, which is by writing out the exponential function power series expansion:
\begin{align}
E(e^{tZ_1Z_2}|Z_1) &= 1+ tZ_1E(Z_2|Z_1) + \frac{t^2Z_1^2E(Z_2^2|Z_1)}{2!}+ \ldots \\
&= 1 + \frac{t^2Z_1^2}{2!} + \frac{3t^4Z_1^4}{4!} + \frac{15t^6Z_1^6}{6!}+ \ldots \\
&= 1 + \frac{t^2Z_1^2}{2} + \frac{\left(\frac{t^2Z_1^2}{2}\right)^2}{2!} + \ldots \\
&= e^{\frac{1}{2}Z_1^2t^2}
\end{align}
Is there an easier way to do this without resorting to pesky power series expansions?

A: If $M_{Z_2}(t)$ is the MGF of $Z_1$, then you immediately have $$E[e^{tZ_1 Z_2} \mid Z_1] = M_{Z_2}(Z_1 t) = e^{Z_1^2 t^2/2}.$$
Conditioning on $Z_1$ allows you to "treat it as a constant."


text:
Q: Why getting same output from fir filter even after changing the cutoff frequency for acceleration time series data? I have question about filtering.
Currently I am working on pedestrian step detection using an inertial measuring unit (accelerometer/acceleration data). I need to filter my signal at preprocessing level. Could anyone suggest which one will be the best filtration algorithm to get good accuracy?
For now I used digital lowpass fir filter with order=2, window size=1.2sec,sampling frequecy=200hz but seems not working. I want to use a lower cutoff frequency. I used 0.03hz and 3hz of cutoff frequecny but I am getting the same result for both cutoff frequencies. I need your guidance or help that how can I proceed. Below, I am attaching the images of filtration result as link at 3hz and 0.03hz respectively and also code that I tried.
Could some one suggest me or provide any good filter in matlab and/or how can I work on that?
fir result at 3hz cutoff fir result at 0.03hz cutoff
Fs = 200;
Hd = designfilt('lowpassfir','FilterOrder',2,'CutoffFrequency',0.03, ...
   'DesignMethod','window','Window',{@kaiser,1.2},'SampleRate',Fs);
y1 = filter(Hd,norm);

plot(Time,norm,'b', Time, y1,'red')

xlabel('Time (s)')
ylabel('Amplitude')
legend('norm','Filtered Data')

A: I am adding another answer in reply to your followup questions. A rectangular window (or boxcar window) of width T, when used as moving average filter, is a lowpass filter with transfer function magnitude
|H(f)|=(sin(pifT))/(pifT) (1)
as you can verify by doing the Fourier transform. Therefore H(f)=0.707 when fco=0.44/T, and H(f)=0 when f=1/T.  So a lowpass filter with cutoff fco can be implemented with a rectangular window with width on the order of 1/fco (specifically .44/fco). When fco=0.03 Hz, width is on the order of 30 s (specifically 15 s). See plot of transfer function of a 30 s-wide window.

How to find the necessary order:
>> Fs=200; Fc=.03;
>> Hd003=designfilt('lowpassfir','CutoffFrequency',Fc,'SampleRate',Fs);
Hd003 = designfilt('lowpassfir', 'PassbandFrequency', .03, 'StopbandFrequency', .1, 'PassbandRipple', 3, 'StopbandAttenuation', 20, 'SampleRate', 200, 'DesignMethod', 'kaiserwin');
>> disp(length(Hd003.Coefficients));
        2400

The command Hd003=designfilt(...) above causes the Filter Design Assistant to launch, because designfilt() does not have enough info.  In the FDA, specify Order mode = Minimum, Passband freq=0.03, Stopband freq=0.1, passband ripple=3 dB, stopband atten.=20 db, design method=Kaiser window. I chose those frequencies and dB values because a 2nd order Butterworth does equally well. (See figure.)  Then click "OK", and control returns to the Matlab command window, which runs 'designfilt' with the specified parameters.  Then check the length of the coefficient vector: it is 2400!  I.e. the FIR filter order=2399, and the filter is 12 seconds long.  This is not practical, and it is totally un-usable on signals as short as your 1.6 second long example.

*

*This equation for |H(f)| is for continuous time. It is accurate for discrete time also, as long as the sampling rate Fs>=10/T.

A: You tried to make a 2nd order FIR filter.  That order is far to low for your sampling rate (200 Hz) and desired cutoff frequency (3 or 0.03 Hz).  The required order in a FIR filter is very different from the order of an IIR filter. An Nth order FIR filter does a moving average of N+1 data points.  Hd=designfilt(...) computes the coefficients, or weights, for the moving average.  I made the 3 Hz and 0.03 Hz cutoff filters, using your code fragment, and called them Hd300 and Hd003.  Then I viewed the coefficients for the two filters:
>> disp(Hd003.Coefficients);
    0.2947    0.4107    0.2947
>> disp(Hd300.Coefficients);
    0.2945    0.4110    0.2945

As you can see, they are practically identical - which is why the output filtered signals look the same.  The coefficients are very similar because order=2 is far, far too low to make an effective FIR filter of 3 or 0.03 Hz cutoff, when the sampling rate is 200 Hz.
The 0.03 cutoff frequency which you tried corresponds to a time constant of about 30 (=1/.03) seconds. It does not make sense to use such a low cutoff on data which is only 1.6 seconds long.  Even if you had hundreds of seconds of data, it would not make sense, because you would be smoothing the data with about a 30 second wide window, which would make it very hard to detect each step.
A better approach: a simple 2nd order Butterworth lowpass, cutoff frequency=1 to 10 Hz.  See code below and see figure. I used filtfilt() in my code rather than filter(), because filtfilt() handles the startup transient better. Replace filtfilt() with filter() and you will see what I mean.
%pedometerAccelFilter.m  WCR 20210117
% Question on stack exchange
% The code provided on stack exchange assumes vector "norm"
% contains 1.6 seconds of acceleration data sampled at 200 Hz.
% I digitized the data from the figure on stack exchange and
% saved it in file pedometerInterpData.txt (2 columns, 329 rows).

%Load the data
data=load('pedometerInterpData.txt');
Time=data(:,1); norm=data(:,2);

%Compute the filter coefficients
Fs=200;                     %sampling frequency (Hz)
order=2;
Fc1=5;                      %filter 1 cutoff frequency (Hz)
Wn1=Fc1*2/Fs;               %filter 1 normalized cutoff frequency
[b1,a1]=butter(order,Wn1);  %filter 1 coefficients
Fc2=2;                      %filter 2 cutoff frequency (Hz)
Wn2=Fc2*2/Fs;               %filter 2 normalized cutoff frequency
[b2,a2]=butter(order,Wn2);  %filter 2 coefficients

%Filter the data
y1=filtfilt(b1,a1,norm);    %filtfilt() could be replaced with filter()
y2=filtfilt(b2,a2,norm);

%Plot the data
plot(Time,norm,'r.-',Time,y1,'gx-',Time,y2,'bo-');
xlabel('Time (s)'); ylabel('Amplitude');
legend('Raw Data','Filter 1','Filter 2');

Figure created by code above.


text:
Q: Insert white space at the end of each line in file in C# I have created a text file from an OCR application. Each line ends without any space. But, as the text is read into the textbox in Windows form. The word from the preceding line and the new line gets connected.
I want to avoid this by having a small c# code that will insert a single white space at the end of each line in the file.
Help is needed for this effect.
The code is doing multiple functions on button click. However, I am sharing a relevant portion of it.
    ft = q + ".txt";                // q is the string of path.
   tb5.AppendText(r + t + Environment.NewLine);
   tb5.AppendText(File.ReadAllText(ft) + Environment.NewLine + Environment.NewLine);
    File.Delete(ft);
    File.Delete(k);

the file ft has the text and it needs adding of space before it gets read into the textbox. After that this file is deleted.
Thanks.

A: Change File.ReadAllText(ft) to:
string.Join(" " + Environment.NewLine, File.ReadAllLines(ft))

File.ReadAllLines() reads the file into an array of lines, which can be joined into a single string, separated by a space followed by newline.
There are more efficient ways, but this is probably the most simple to code.
For reference:
String.Join
File.ReadAllLines


text:
Q: how to showing time elapsed in a media element in silverlight? how can i showing time elapsed of a video file who is playing in a MediaElement control in silverlight?

A: There is a Position property on the MediaElement.  This video and source code should help you out http://www.silverlight.net/learn/quickstarts/audioandvideo/

A: Finally i resolve my problem with this way:
i use a Textblock control and bind text property to Position property of MediaElement control, then i use a IvalueConverter to show appropriate Time in TextBlock:
<TextBlock MinWidth="40" Text="{Binding ElementName=myMediaElement, Path=Position, Converter={StaticResource TimeConverterFormatter}}"/>

TimeConverterFormatter is a class for convert TimeSpan value to short time format. because position property in MediaElement show a Timespan value like to "0:00:00:00.0000000" and i want elapsed time value like to this: "00:00"
public class TimeConverterFormatter : IValueConverter
{
    #region IValueConverter Members
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        if (value.ToString().Length == 16)
            return value.ToString().Substring(3, 2) + ":" + value.ToString().Substring(6, 2);

        return value.ToString();
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }

    #endregion
}

A: I realise that this is an old question now, but in WPF you can just use a normal StringFormat to do what you want:
<TextBlock Text="{Binding Position, ElementName=myMediaElement,
    StringFormat={}{0:hh}:{0:mm}, FallbackValue=00:00, Mode=OneWay}" />

I couldn't work out whether you wanted hours and minutes or minutes and seconds, so here is the latter:
<TextBlock Text="{Binding Position, ElementName=myMediaElement,
    StringFormat={}{0:mm}:{0:ss}, FallbackValue=00:00, Mode=OneWay}" />

I can't guarantee that it will work in Silverlight though.

A: Not sure about Silverlight but this should work to show mm:ss.
lblLength.Content = String.Format("{0:mm}:{0:ss}", mediaElement.Position);


text:
Q: How helpful is non-standard analysis? So, I can understand how non-standard analysis is better than standard analysis in that some proofs become simplified, and infinitesimals are somehow more intuitive to grasp than epsilon-delta arguments (both these points are debatable).
However, although many theorems have been proven by non-standard analysis and transferred via the transfer principle, as far as I know all of these results were already known to be true.  So, my question is:
Is there an example of a result that was first proved using non-standard analysis?  To wit, is non-standard analysis actually useful for proving new theorems?
Edit: Due to overwhelming support of François' comment, I've changed the title of the question accordingly.

A: In mathematical economics, one often faces the following problem: One wants to formalize the idea of a large, relatively anonymous group of people (an atomless measure space of agents) that all face some risk that is iid of these people. Since there are lots of people, this risk should cancel out in the aggregate by some law of large numbers. The expost empirical distribution should be the ex ante distribution of the risk. If one uses something like the unit interval endowed with Lebesgue measure, this does not work. Most sample realizations are not measurable in that case.
Yeneng Sun has shown that there are exact laws of large numbers with a continuum of random variables for certain types of measure spaces. The only known examples were obtained using the Loeb measure construction that relies heavily on NSA. Later, Konrad Podczeck has shown how to construct appropriate measure spaces using conventional methods.

A: I think the only known solution to the local version of the Hilbert's fifth problem heavily uses nonstandard analysis. To be more precise the result is: every locally euclidean local group is locally isomorphic to a Lie group. You can find details in Isaac Goldbring's paper Hilbert's Fifth Problem for Local Groups.

A: Gromov was writing in one of his books (among other things) about some new mathematics coming from nonstandard analysis. Another example is proving that some statistical field theories (and lattice QFTs) are well-defined by Sergio Albeverio et al. (look at their book about that kind of applications to physics). Kiesler has been emphasising that some functional spaces are much richer in nonstandard analysis and that this power is one of the main arguments for the theory. Analysts say that one should look for applications where one has several degrees of infinitesimals or asymptotics, to somewhat reduce fitting complicated estimates to satisfy all.
There are some other approaches to infinitesimals which are not nonstandard analysis (no general transfer principle), but are similar in spirit, namely the synthetic differential geometry.

A: I just came across a 2013 book by F. Herzberg entitled "Stochastic Calculus with Infinitesimals" where probability and stochastic analysis are done without having to develop the complexities of measure and integration theory first.  Ever since E. Nelson, such an approach is called "radically elementary" and it really is.  What this proves is the new result that stochastic calculus can be done without measure theory.
To give a historical parallel, recall that Leibniz's mentor in mathematics was Huygens.  When Huygens first learned of Leibniz's invention of infinitesimal calculus, Huygens was sceptical, and wrote to Leibniz that he is merely doing what Fermat and others have done before him in a different language.  What Huygens failed to recognize immediately (but did recognize later) was the generality of the methods and the lucidity of the presentation of Leibniz's new approach.  The Nelson–Herzberg approach to stochastic calculus is in a way more significant than merely a new "result", since it provides a new methodology.

A: The other answers are excellent, but let me add a few
points.
First, with a historical perspective, all the early
fundamental theorems of calculus were first proved via
methods using infinitesimals, rather than by methods using
epsilon-delta arguments, since those methods did not appear
until the nineteenth century. Calculus proceeded for
centuries on the infinitesimal foundation, and the early
arguments---whatever their level of rigor---are closer to
their modern analogues in nonstandard analysis than to
their modern analogues in epsilon-delta methods. In this
sense, one could reasonably answer your question by
pointing to any of these early fundamental theorems.
To be sure, the epsilon-delta methods arose in part because
mathematicians became unsure of the foundational validity
of infinitesimals. But since nonstandard analysis exactly
provides the missing legitimacy, the original motivation
for adopting epsilon-delta arguments appears to fall away.
Second, while it is true that almost any application of
nonstandard analysis in analysis can be carried out using
standard methods, the converse is also true. That is,
epsilon-delta arguments can often also be translated into
nonstandard analysis. Furthermore, someone raised with
nonstandard analysis in their mathematical childhood would
likely prefer things this way. In this sense, the
preference between the two methods may be a cultural matter
of upbringing.
For example, H. Jerome Keisler wrote an introductory calculus
textbook called Elementary Calculus: an infinitesimal
approach, and
this text was used for many years as the main calculus
textbook at the University of Wisconsin, Madison. I
encourage you to take a look at this interesting text,
which looks at first like an ordinary calculus textbook,
except that in the inside cover, next to the various
formulas for derivatives and integrals, there are also
listed the various rules for manipulating infinitesimals,
which fill the text. Kiesler writes:

This is a calculus textbook at the college Freshman
level based on Abraham Robinson's infinitesimals, which
date from 1960. Robinson's modern infinitesimal approach
puts the intuitive ideas of the founders of the calculus
on a mathematically sound footing, and is easier for
beginners to understand than the more common approach via
limits.

Finally, third, some may take your question to presume that
a central purpose of nonstandard analysis is to provide
applications in analysis. But this is not correct. The
concept of nonstandard models of arithmetic, of analysis
and of set theory arose in mathematical logic and has grown
into an entire field, with hundreds of articles and many
books, with its own problems and questions and methods,
quite divorced from any application of the methods in other
parts of mathematics. For example, the subject of Models
of
Arithmetic
is focused on understanding the nonstandard models of the
first order Peano Axioms, and it makes little sense to
analyze these models using only standard methods.
To mention just a few fascinating classical theorems: every
countable nonstandard model of arithmetic is isomorphic to
a proper initial segment of itself (H. Friedman). Under the
Continuum Hypothesis, every Scott set (a family of sets of
natural numbers closed under Boolean operations, Turing
reducibility and satisfying Konig's lemma) is the
collection of definable sets of natural numbers of some
nonstandard model of arithmetic (D. Scott and others).
There is no nonstandard model of arithmetic for which
either addition or multiplication is computable (S.
Tennenbaum). Nonstandard models of arithmetic were also
used to prove several fascinating independence results over
PA, such as the results on
Goodstein sequences,
as well as the
Paris-Harrington theorem on the
independence over PA of a strong Ramsey theorem. Another
interesting
result
shows that various forms of the pigeon hole principle are
not equivalent over weak base theories; for example, the
weak pigeon-hole principle that there is no bijection of n
to 2n is not provable over the base theory from the weaker
principle that there is no bijection of n with
n2. These proofs all make fundamental use of
nonstandard methods, which it would seem difficult or
impossible to omit or to translate to standard methods.

A: Here is one paper with some results I have only seen being done in non-standard analysis so far, perhaps it is helpful to you:
A mathematical proof of the existence of trends in financial time series by Michel Fliess & Cédric Join
From the abstract: "We are settling a longstanding quarrel in quantitative finance by proving the existence of trends in financial time series thanks to a theorem due to P. Cartier and Y. Perrin, which is expressed in the language of nonstandard analysis […]. Those trends, which might coexist with some altered random walk paradigm and efficient market hypothesis, seem nevertheless difficult to reconcile with the celebrated Black–Scholes model. They are estimated via recent techniques stemming from control and signal theory. Several quite convincing computer simulations on the forecast of various financial quantities are depicted. We conclude by discussing the role of probability theory."
See also Rigorous definition, detection and test for trending vs. mean-reverting behaviour of stochastic processes and its answers.

A: In 1986 C. Ward Henson and H. J. Keisler published "On the Strength of Nonstandard Analysis" (The Journal of Symbolic Logic, Vol. 51, No. 2 (Jun., 1986), pp. 377-386), which is a seminal contribution to the meta-mathematics of nonstandard analysis. Since their result bears directly on the issue in this thread which has been reopened after laying dormant for some time now, and since no reference to their work is referred to in the original thread, I am taking the liberty of quoting the introduction to Henson and Keisler's important paper (which I believe is as current today as when it was published).

It is often asserted in the literature that any theorem which can be proved using nonstandard analysis can also be proved without it. The purpose of this paper is to show that this assertion is wrong, and in fact there are theorems which can be proved with nonstandard analysis but cannot be proved without it. There is currently a great deal of confusion among mathematicians because the above assertion can be interpreted in two different ways. First, there is the following correct statement: any theorem which can be proved using nonstandard analysis can be proved in Zermelo-Fraenkel set theory with choice, ZFC, and thus is acceptable by contemporary standards as a theorem in mathematics. Second, there is the erroneous conclusion drawn by skeptics: any theorem which can be proved using nonstandard analysis can be proved without it, and thus there is no need for nonstandard analysis. The reason for this confusion is that the set of principles which are accepted by current mathematics, namely ZFC, is much stronger than the set of principles which are actually used in mathematical practice. It has been observed (see [F] and [S]) that almost all results in classical mathematics use methods available in second order arithmetic with appropriate comprehension and choice axiom schemes. This suggests that mathematical practice usually takes place in a conservative extension of some system of second order arithmetic, and that it is difficult to use the higher levels of sets. In this paper we shall consider systems of nonstandard analysis consisting of second order nonstandard arithmetic with saturation principles (which are frequently used in practice in nonstandard arguments). We shall prove that nonstandard analysis (i.e. second order nonstandard arithmetic) with the $\omega_{1}$-saturation axiom scheme has the same strength as third order arithmetic. This shows that in principle there are theorems which can be proved with nonstandard analysis but cannot be proved by the usual standard methods. The problem of finding a specific and mathematically natural example of such a theorem remains open. However, there are several results, particularly in probability theory, whose only known proofs are nonstandard arguments which depend on saturation principles; see, for example, the monograph [Ke]. Experience suggests that it is easier to work with nonstandard objects at a lower level than with sets at a higher level. This underlies the success of nonstandard methods in discovering new results. To sum up, nonstandard analysis still takes place within ZFC, but in practice it uses a larger portion of full ZFC than is used in standard mathematical proofs.

[F] S. FEFERMAN. Theories of finite type related to mathematical practice, Handbook of mathematical logic (J. Barwise, editor), North-Holland, Amsterdam, .1977, pp. 913-971.
[Ke] H. J. KEISLER, An infinitesimal approach to stochastic analysis, Memoirs of the American Mathematical Society, No. 297 (1984).
[S] S. SIMPSON, Which set existence axioms are needed to prove the Cauchy/Peano theorem for ordinary differential equations? JSL, vol. 49 (1984), pp. 783-802.
It is perhaps worth adding that Keisler (making use of work of Avigad) subsequently published a sequel to his paper with Henson in which he introduces what might be regarded as a system of Reverse Mathematics for nonstandard analysis with the hope of being able to establish the strength of particular theorems proved using nonstandard analysis.  (See "The Strength of Nonstandard Analysis" by H.J. Keisler in The Strength of Nonstandard Analysis ed. By Imme van den Berg and Vitor Neves, Springer, 2007).

A: From the Wikipedia article:

the list of new applications in
mathematics is still very small. One
of these results is the theorem proven
by Abraham Robinson and Allen
Bernstein that every polynomially
compact linear operator on a Hilbert
space has an invariant subspace. Upon
reading a preprint of the
Bernstein-Robinson paper, Paul Halmos
reinterpreted their proof using
standard techniques. Both papers
appeared back-to-back in the same
issue of the Pacific Journal of
Mathematics. Some of the ideas used in
Halmos' proof reappeared many years
later in Halmos' own work on
quasi-triangular operators.

A: Nonstandard hulls of spaces are used all the time in Banach space theory, so much so that books devote sections to the construction of ultraproducts of Banach spaces (e.g. Absolutely summing operators by Diestel, Jarchow, and Tonge).  There are cases where NSA is used to prove the existence of an estimate, yet no one knows how directly to compute an estimate.  For example, the unconditional constant of any basis for the span of the first n unit basis vectors in the James' space of sequences of bounded quadratic variation must go to infinity, but the only known proof involves NSA.

A: I first understood what the Thurston-type-compactification of the space of properly strictly convex real projective structures on a closed surface was using non-standard methods. What had been murky and confusing was suddenly clear. I have struggled with the question of whether or not to use NSA in the written proof. It is so much easier to use NSA I think we will.

A: Steve Huntsman's claim attributed to wikipedia that "the list of new applications in mathematics is still very small" is patently false. In fact, I was unable to find such a claim there. To mention just the most famous results, there is the recent work by T. Tao et al, by I. Goldbring on the local version of Hilbert's 5, Albeverio (several applications in math physics), Arkeryd (see his piece Nonstandard analysis in the American Mathematical Monthly) in hydrodynamics, the works on "canards" in perturbation theory, Jin's work in additive number theory, as well as numerous applications in statistics and economics. Robinson's work also occasioned a critical re-evaluation of whig history dominated by a reductive epsilontist agenda.

A: Freiman conjectured a classification of finite sets $A$ of integers that have
$$\lvert A+A\rvert = 3\lvert A\rvert-3+b$$
for some $0\leq b \leq \lvert A\rvert/3-2$. Renling Jin recently resolved this in Freiman's $3k - 3 + b$ conjecture for almost bi-arithmetic progression using nonstandard analysis. He has quite a few other nice results that appeared first with nonstandard analysis; with regard to this, see also:

Renling Jin, Nonstandard methods for additive and combinatorial number theory, pp. 117–129 in: van den Berg, Imme (ed.); Neves, Vítor (ed.) The strength of nonstandard analysis. Based on the meeting on nonstandard mathematics, Aveiro, Portugal, July 2004, Springer 2007.

Therein, on page 130, Renling Jin announces his solution as follows:

Theorem 8.6.2 Suppose $f\colon\mathbb{N}\to\mathbb{N}$ is a function with $\lim_{k\to\infty}\frac{f(k)}{k}=0$. There exists a natural number $K$ such that for any finite set of integers $A$ with $\lvert A\rvert=k$, if $k>K$ and $\lvert A+A\rvert=3k-3+b$ for some $0\leq b\leq f(k)$, then $A$ is either a subset of an arithmetic progression of length at most $2k-1+2b$ or a subset of a bi-arithmetic progression of length at most $k+b$.

Here, a bi-arithmetic progression means any union of two arithmetic progressions $A$ and $B$, both of the same increment, and with the additional property that $A+A$, $A+B$, $B+B$ are pairwise disjoint.
Renling Jin's result is also cited (in what seems slightly stronger form: $\varepsilon k$ instead of $f(k) = o(k)$) as a theorem in Theorem 2.2 on page 65 of

Ram Krishna Pandey, On the lonely runner conjecture, Mathematica Bohemia, No. 1, 2010, pp. 63–68.

Neither the above preprint, nor the title mentioned in the conference proceedings seems to have published, but the relevant refereed publication seems to be

Renling Jin, Freiman's inverse problem with small doubling property, Advances in Mathematics 216 (2007) 711–752

wherein Theorem 1.4 is the slightly stronger version (replace $\exists f\in o(k)$ with $\exists \varepsilon > 0$ and $\varepsilon k$ instead of $f(k)$) of the above Theorem 8.6.2.

A: The asymptotic cone of a metric space (and hence of a finitely generated group endowed with the word metric) is constructed using non-standard analysis, and has been used to prove many nice theorems.  To take just one example, asymptotic cones are an important tool in the proof that mapping class groups are quasi-isometrically rigid (Jason Behrstock. Bruce Kleiner. Yair Minsky. Lee Mosher. "Geometry and rigidity of mapping class groups." Geom. Topol. 16 (2) 781 - 888, 2012.
projecteuclid, DOI: 10.2140/gt.2012.16.781).

A: This reminded me of a talk by Mircea Mustata in which he mentioned that non-standard analysis type arguments were used to prove some things related to algebraic geometry. I can't remember what the talk was about, but I found the paper that it was based on:
de Fernex and Mustata - Limits of log canonical thresholds.
The paper mentions that later Kollár found proofs avoiding these techniques (but they are similar in spirit).

A: Let $k$ be an algebraically closed field of characteristic $0$. Let $T_n$ be the set of all possible log canonical threshold of a pair $(X,Y)$ where $X/k$ is a smooth variety and $Y \subseteq X$ is a nonzero closed subschemes. The following two facts are first proved (Tommaso de Fernex, Mircea Mustata, Limits of log canonical thresholds) via non-standard methods:

*

*$T_n$ is closed in $\mathbb R$ for all $n$.

*The set of points of accumulations from above of $T_n$ is $T_{n-1}$.
I think proofs that avoid non-standard analysis emerged later (J. Kollár, Which powers of holomorphic functions are integrable?), but the first one used non-standard technique.

A: Edward Nelson was working on a book on NSA mentioned here:
https://web.math.princeton.edu/~nelson/books.html
His existing book "Radically elementary probability theory" (linked from that page) uses some NSA.  I've been wanting to read it but don't understand much of it.


text:
Q: how to update image in a different form c# Beginner here, I'm trying to update the image and the image's name from a different form and it's not updating. Also it doesn't give any errors. Is there something wrong in the code?
Form 2. this is where i update
  private void btnStockEdit_Click_1(object sender, EventArgs e)
    {
        try
        {
            sqlCon.Open();
            string qry = "Update SMStocksTb Set SmStockImgName=@SmStockImgName,SmStockImage=@SmStockImage where SmStockId=@SmStockId";
            SqlCommand cmd = new SqlCommand(qry, sqlCon);
            cmd.Parameters.AddWithValue("@SmStockId", SmStockId);

            cmd.Parameters.AddWithValue("@SmStockImgName", txtUPImgName.Text);
            cmd.Parameters.AddWithValue("@SmStockImage", Savephoto());

            cmd.ExecuteNonQuery();
            sqlCon.Close();
            MessageBox.Show("Update  Successfully","Updated",MessageBoxButtons.OK,MessageBoxIcon.Information);

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }

    }
    private byte[] Savephoto()
    {
        MemoryStream ms = new MemoryStream();
        pbxUpdateImg.Image.Save(ms, pbxUpdateImg.Image.RawFormat);
        return ms.GetBuffer();
    }

**Form1 ** this is where i open form 2 after selecting a row in datagrid
        private void btnStockEdit_Click(object sender, EventArgs e)
    {

        SMStockUpdateForm cfrmStockUpdateForm = new SMStockUpdateForm();
        try
        {
            if (StockListDG.CurrentRow.Index != -1)
            {
             SmStockId = Convert.ToInt32(StockListDG.CurrentRow.Cells[0].Value.ToString());

                 cfrmStockUpdateForm.txtUPImgName.Text = StockListDG.CurrentRow.Cells[11].Value.ToString();
                byte[] ImageArray = (byte[])StockListDG.CurrentRow.Cells[12].Value;

                if (ImageArray.Length == 0)
                    cfrmStockUpdateForm.pbxUpdateImg.Image = DefaultImage;

                else
                {
                    ImageByteArray = ImageArray;
                    cfrmStockUpdateForm.pbxUpdateImg.Image = Image.FromStream(new MemoryStream(ImageArray));
                }

            }
        }
        catch (Exception ex)
        {

        }

        cfrmStockUpdateForm.ShowDialog(this);

        if (isWindowOpen == false)
        {
            this.ParentForm.Opacity = 100;
        }

    }

A: You should learn how to send data between two forms. From form1 you should only send the name of image and in form two should bind it according to its name you received from form1


text:
Q: Can I pass reactor Context into grpc clientInterceptor implicitly? Here's what I want to do at a high-level

*

*Capture some http headers in a WebFilter

*In the Controller method, I make a grpc call

*I'd like to propagate the http headers as grpc Metadata headers

Currently, my working implementation is

*

*WebFilter captures http headers and writes to reactor Context

*Controller method extracts reactor Context and passes it into a Grpc ClientInterceptor

*Grpc ClientInterceptor extracts http headers from Context and injects into Grpc Metadata headers

But I'd like to avoid having the Controller method doing any work (step 2 above).
Here's an implementation but looking for a way to get the http headers to Grpc Metadata without explicitly passing them in from Controller method.
WebFilter
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
  return chain.filter(exchange)
    .contextWrite(Context.of("my-header", "header-value"));
}

Controller method
@GetMapping
public Mono<String> testHeaderPropagation() throws Exception {
  return Mono.deferContextual(reactorContext -> {
    Response response = grpcStub
      .withInterceptors(new GrpcClientInterceptor(reactorContext))
      .call(request);
    return Mono.just(response.getMessage());
  });
}

GrpcClientInterceptor
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) {
  final ClientCall<ReqT, RespT> call = next.newCall(method, callOptions);
  return new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(call) {
    @Override
    public void start(Listener<RespT> responseListener, Metadata headers) {
      Metadata.Key < String > key =
          Metadata.Key.of("filter-context", Metadata.ASCII_STRING_MARSHALLER);
      headers.put(key, context.get("filter-context"));

      delegate().start(responseListener, headers);
    }
  };
}

I'd like simplify my Controller method  (remove the explicit passing in of the reactor Context into a clientInterceptor)
grpcStub.call(request)

I believe Spring Sleuth has a way of doing this but not sure how to adapt its approach.
What clever thing am I missing?
Edit
The reason I'm pushing for a version that involves minimal controller method code is because other developers will be writing the controller and methods. I want to establish a pattern that doesn't require extra wiring if possible, otherwise there's a chance someone forgets to do it or does it wrong.
Edit
Follow-up question. Instead of having the controller method pass in the Context to the clientInterceptor, I tried to get the Context inside the Grpc ClientInterceptor but that doesn't seem to work.
Here's is what I tried to do
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) {
  final ClientCall<ReqT, RespT> call = next.newCall(method, callOptions);

  return new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(call) {
    @Override
    public void start(Listener<RespT> responseListener, Metadata headers) {

      Mono.deferContextual(context -> {
        Metadata.Key < String > key =
            Metadata.Key.of("CONTEXT-HEADER", Metadata.ASCII_STRING_MARSHALLER);
        headers.put(key, context.get("CONTEXT-HEADER"));

        delegate().start(responseListener, headers);

        return Mono.empty();
      }).subscribe();

    }
  };
}

But I get an error

reactor.core.Exceptions$ErrorCallbackNotImplemented: java.util.NoSuchElementException: Context does not contain key CONTEXT-HEADER

Trying to understand why the reactor pipeline breaks here

A: I came up with another solution that doesn't require a WebFilter or reactor Context. But I'd still prefer some way to do "across-the-board automatic propagation".
In this solution I simply pass the ServerWebExchange injected into the controller method into a client interceptor, which will read the headers.
@GetMapping
public Mono<String> testHeaderPropagation(ServerWebExchange exchange) throws Exception {
  MyGrpcStub grpcStubWithInterceptor = attachMetadata(grpcStub, exchange);
  Response response = grpcStub
    .call(request);
  return Mono.just(response.getMessage());
}

public static <S extends AbstractStub<S>> S attachMetadata(S stub, ServerWebExchange exchange) {
  return stub.withInterceptors(new GrpcClientInterceptor(exchange));
}

Then my new GrpcClientInterceptor
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) {
  HttpHeaders httpHeaders = exchange.getRequest().getHeaders();

  final ClientCall<ReqT, RespT> call = next.newCall(method, callOptions);
  return new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(call) {
    @Override
    public void start(Listener<RespT> responseListener, Metadata headers) {
      Metadata.Key < String > key =
          Metadata.Key.of("my-header", Metadata.ASCII_STRING_MARSHALLER);
      headers.put(key, httpHeaders.getFirst("my-header"));

      delegate().start(responseListener, headers);
    }
  };
}

A: grpc and Reactor don't know about each other, so someone has to translate the contextual information between the two. Your current approach is the recommended one, even considering Sleuth (because across-the-board automatic propagation of Context is a mixed bag with big performance impact). This is pinpointing to your exact need, foolproof, so I'd keep it.


text:
Q: Trying to write data from apache spark to snowflake table I am trying to write data from Apache spark to snowflake table, I removed all datetime fields to reduce the complexity. Still i am getting below error when writing a "String" field in Apache Spark to "varchar" field in snowflake.
I verified length of the column and that is not a problem. Any suggestion on how to debug this? Below is the error i am getting. Thanks in advance
Error: net.snowflake.client.jdbc.SnowflakeSQLException: SQL compilation error: error line 1 at position 150


text:
Q: Find frequent occuring letter in log(n) time? If given a string such as , "aaabbccc", how would you output 'a' since it occurs just as frequently as 'c' but occurs first.
I did it using O(n) time, but I can't figure out how you would do this using log(n) time, whether in java or c++.
EDIT:
This was an interview question.
#include <iostream>
#include <string>
using std::string;
using std::cout;
using std::cin;
using std::endl;

char findFreqChar(string str) {
    int count;
    int maxOccur = 0;
    char maxChar;
    for (char i = 'A'; i < 'z'; i++) {
        count = 0;

        for (int j = 0; j < str.length(); j++) {
            if (i == str[j])
                count++;
        }
        if (count > maxOccur) {
            maxOccur = count;
            maxChar = i;
        }
    }
    return maxChar;
}
int main() {
    std::cout << "Enter String: ";
    std::string str;
    std::getline(std::cin, str);
    cout << findFreqChar(str);
    cin.get();
}

A: There is no way to find the most frequent letter in less than O(n) time because you can't determine that information without checking every character in the string!

A: If you can guarantee that the letters are sorted, as in your example, then you can use binary-searches to identify the ends of each continuous letter range.
Each binary search will be log(n); worst case you'll need to do 25 of them to find all of the boundaries but "25 x constant x log(n)" is still O(log(n)) I suppose.
If you take the binary search approach then there is scope for doing this smartly - spotting when successive tests in the same binary search return the same letter and so assuming that as a minimum range size, then aborting any possible range that's shorter than that - but chances are you'd do better to code this up using the separate searches. Or probably better to just take the O(n) scan solution: do you really need to do this O(log(n))?

A: If you need to accomplish this in O(log(n)) time, then that suggests that you need to develop some type of divide-and-conquer algorithm.  I am assuming (based on the example you gave us), that all occurrences of one letter are contiguous.  Therefore, we can do the following:
1) Split the array in half and recursively call the algorithm.  The sub-algorithm must return 4 values:
    - The most frequent value occurring in the array and its frequency
    - Number of contiguous characters ending at the rightmost character
    - Number of contiguous characters ending at the leftmost character
So the recursive call when called against "aabbbbcc" would return:
        (b, 4, 2, 2)
2) Combine the two sub-arrays and return the result for the (now-larger array).  First, we need to calculate the most frequent character in the combined array.  This is easily calculated as either the longest sequence in the right, the longest sequence in the left, or a sequence that spans the split point (which is why we needed the last 2 values from the recursive call).  This can all be done in constant time.  We also return the appropriate values from the two recursive calls for the length of contiguous characters ending at the rightmost and leftmost characters.
This recursion ends up with T(n) = T(n/2) + O(1), or O(lg n)
There are quite a few boundary cases to handle and you need to figure out how to handle when the recursion "bottoms-out", but this should be enough to get you writing the code.


text:
Q: my media query in CSS is not working properly I'm using a simple code and the media query at 991 is not working properly, it's like 991px is not inclusive which is not supposed to be the case, here's my code , any help?

/* On screens that are 992px wide or more, the background color is blue */
    @media screen and (min-width: 992px) {
      body {
        background-color: blue;
        color: white;
      }
    }
    @media screen and (max-width: 991px) {
      body {
        background-color: olive;
        color: white;
      }
    }

Resize the browser window to see the effect!

By default, the background color of the document is "tan". If the screen size is 992px or more, the color will change to "blue". If it is 991px or less, it will change to "olive".

A: The width of screen or any HTML elements can have floating values for their width, like width: 991.2px;. When you define rules for screen with less width than 991px and more width than 992px, you let a no-rule zone exist between 991px and 992px. I think we can't have a solution without this no-rule zone, but we can reduce his size.
Working example :

/* On screens that are 992px wide or more, the background color is blue */
@media (min-width: 992px) {
  body {
    background-color: blue;
    color: white;
  }
}/* On screens that are 991.999px wide or less, the background color is olive */
@media (max-width: 991.999px) {
  body {
    background-color: olive;
    color: white;
  }
}
/* On screens that are between 991.999px and 992px wide, no background color is assign */

Resize the browser window to see the effect!

By default, the background color of the document is "tan". If the screen size is 992px or more, the color will change to "blue". If it is 991.999px or less, it will change to "olive".

A: You don't need to use the max-width media query at all, set the body color to olive by default and then add the min-width for anything over 992px.

/* On screens that are 992px wide or more, the background color is blue */

    body {
        background-color: olive;
        color: white;
      }

    @media screen and (min-width: 992px) {
      body {
        background-color: blue;
        color: white;
      }
    }

Resize the browser window to see the effect!

By default, the background color of the document is "tan". If the screen size is 992px or more, the color will change to "blue". If it is 991px or less, it will change to "olive".

A: All you should do is to a small change to your @media  make the min-width to works from 992px and above and your max-width to work from 992px and below the min-width media will kick off at the 991px. And the blue background now works from 992px and above.
@media screen and (min-width: 992px) {
  body {
    background-color: blue;
    color: white;
  }
}

@media screen and (max-width: 992px) {
  body {
    background-color: olive;
    color: white;
  }
}


text:
Q: Fold a list but alternate used functions Is there a clean way to fold a list but alternate functions used?
Say we call such function FoldAlternating. Then for example,
The FoldAlternating[{Plus,Times}, {1, 5, 2, 3, 3, 2, 5}]] would produce 235,
Because it is equivalent to Times[Plus[Times[Plus[Times[Plus[1, 5], 2], 3], 3], 2], 5].

Edit: For $2$ functions f,g and starting value v_: 1, I can do it recursively:
fa[f_, g_, list_, v_: 1, i_: 1] :=
 If[i + 1 == Length[list], f[g[v, list[[i]]], list[[i + 1]]],
  If[i == Length[list], g[v, list[[i]]],
   fa[f, g, list, f[g[v, list[[i]]], list[[i + 1]]], i + 2]]]

where fa[Times, Plus, {5, 2, 3, 3, 2, 5}] gives the expected example from above.

A: ClearAll[foldRotate]
foldRotate = Module[{fl = #}, Fold[Last[fl = RotateLeft[fl]]@## &, ##2]] &;

Examples:
foldRotate[{Plus, Times}, {1, 5, 2, 3, 3, 2, 5}]

 235

foldRotate[{Plus, Times}, 1, {5, 2, 3, 3, 2, 5}]

 235

foldRotate[{foo, bar, fum}, {a, b, c, d, e}]

foo[fum[bar[foo[a, b], c], d], e]

A: Maybe something like this:
ClearAll[foldAlternating];
foldAlternating[{f1_, f2_}, lst_] := Fold[
    {First@#1 + 1, Replace[First@#1, {_?OddQ :> f1, _ :> f2}]@@{Last@#1, #2}} &,
    {1, First@lst}, Rest@lst
] // Last;

foldAlternating[{Plus, Times}, {1, 5, 2, 3, 3, 2, 5}]
(* 235 *)

It would be easy enough to generalise such a function.
EDIT
In fact, here is a generalisation:
ClearAll[foldAlternating];
foldAlternating[fnsLst_, lst_] := Fold[
    {Mod[First@#1 + 1, Length[fnsLst]], (fnsLst[[First@#1 + 1]])@@{Last@#1, #2}} &,
    {0, First@lst}, Rest@lst
] // Last;

foldAlternating[{Plus, Times}, {1, 5, 2, 3, 3, 2, 5}]
(* 235 *)

foldAlternating[{Plus, Times, Mod}, {1, 5, 2, 4}]
(* 0 *)

foldAlternating[{Plus, Times, Mod}, {1, 5, 2, 3, 3, 2, 5, 7, 10, 9}]
(* 8 *)

A: How about a simple loop? (I know  we are not supposed to use loops in Mathematica, but unless it is very inefficient, I do not see problem myself using loops)
foldAlternating[f_, g_, lst_] := Module[{z, n},
   z = f[lst[[1]], lst[[2]]];
   op = g;
   Do[
    z = op[z, lst[[n]]];
    op = If[op === f, g, f]
    , {n, 3, Length@lst}
    ];
   z
   ];

To use it
lst = {1, 5, 2, 3, 3, 2, 5};
foldAlternating[Plus, Times, lst]
(*235*)

Note, this assumes lst is at least 3 elements long. Easy to add error checking if needed.
ps. do not name your own functions starting with UpperCaseLetter so not to confuse them with Mathematica's own functions, unless they are inside your own package.


text:
Q: Boost: How to print/convert posix_time::ptime in milliseconds from Epoch? I am having trouble converting posix_time::ptime to a timestamp represented by time_t or posix_time::milliseconds, or any other appropriate type which can be easily printed (from Epoch).
I actually need just to print the timestamp represented by the posix_time::ptime in milliseconds, so if there is an easy way to print in that format, I don't actually need the conversion.

A: This code will print the number of milliseconds since 1941-12-07T00:00:00. Obviously, you can choose whatever epoch suits your need.
void print_ptime_in_ms_from_epoch(const boost::posix_time::ptime& pt)
  {
    using boost::posix_time::ptime;
    using namespace boost::gregorian;
    std::cout << (pt-ptime(date(1941, Dec, 7))).total_milliseconds() << "\n";
  }


text:
Q: How to overwrite file on server I made a game and now I want to add a global Highscore. I can reach the file with an url "http://example.com/apps/score". I have no problem reading the file. But I cant overwrite it and add new scores. The file and the folder has rwxrwxrwx. I have no idea what I am doing wrong.
This is what I tried:
public void updateScore() {
    try {

        URLConnection connection = url.openConnection();
        connection.setDoOutput(true);
        Writer wr = new OutputStreamWriter(connection.getOutputStream());

        String text="";
        for (int i = 0; i < alScores.size(); i++) {
            text+=alScores.get(i).getName()+"¨"+alScores.get(i).getScore()+"\n";
        }

        wr.write(text);
        wr.flush();
        connection.getInputStream().close();
    } catch (IOException e) {
        e.printStackTrace();
    }

}

A: You would need some kind of a web service that would accept a new score and update the file accordingly. This would happen on the serverside though.
Right now you are just sending some data to the server that it is probably not even listening to.


text:
Q: PHP Include performance I have several php-functions in external .php-files (about 50) and I'm including them every time you visit a page - no matter if this function is used or not. I read that this doesn't have any bad consequences on performance.
foreach (glob("php_scripts/*.php") as $filename) {
    include $filename;
}

foreach (glob("php_scripts/*/*.php") as $filename) {
    include $filename;
}

Now I made some testings regarding performance and found out that including all those files takes approximately 0.0388ms, which is actually about 30 % of whole site execution time.
Then I tried putting all those functions in one php-file and now it takes about 0.01ms, so nearly 4-times faster.
I don't really like this solution because of bad organisation this way. I liked how every function has its own php file and was included automatically. Especially when I use different directories for different types of functions.
Is there any other way I can speed up those includings? Or would it be best to put them all in one file?
Thanks in advance.


text:
Q: Why does Hawking radiation outside the Schwarzschild radius decrease a black hole's mass? When a pair of virtual particles is created outside the event horizon of black hole, there is a chance for one of the particles to escape. Zero chance on the surface of the event horizon and my question is why doesn't this Hawking radiation make a black hole gain mass but the opposite? Just what is the edge of black hole?

A: Pair production  can only proceed when an interaction with a field happens,

Energy and momentum conservation have to hold at the horizon of the black hole, (and in measures describing it, see this answer here. )
For Hawking radiation, one must adapt the diagrams to the existence of a graviton, even though this is an effective model, as gravity has not been definitively quantized. The graviton will provide the energy for the interaction to happen, and thus diminish the four vector of the black hole by the amount of the four vector of the leaving electron.
Adaptation of the left diagram.
The Z is the black hole, emitting a virtual graviton which goes in an e+e- loop which interacts with one of the photons in the photon sphere and generates a pair. If the momentum directions allow one of the pair can leave taking part of the original graviton energy,  and the other caught falls  back in the black hole.
The second diagram could be used with an infalling charged particle which allows the creation of a particle pair. In this case the black hole will get less energy added to its four vector than it would have if there were no hawking radiation.
In all cases at the horizon energy and momentum are conserved, and the black holes energy momentum vector is reduced and thus its mass is smaller.

A: Here is a brief, approximate answer which may be easier for you to grasp.
If a virtual particle-antiparticle pair happens to pop into brief existence right outside the event horizon, it's possible for one of the pair to get promoted into real existence by the gravitational field while the other one falls into the black hole. Seen from afar, it then appears that the black hole is radiating particles. Since those particles are leaving the black hole and since they have real mass, the remaining mass of the black hole must decrease in the same amount- which means the black hole appears to lose mass and shrink as time goes on.

A: The short answer is : the black hole's mass diminishes because energy escapes.


text:
Q: set cursor position in textarea at end once user clicked on textarea
Possible Duplicate:
Javascript: Move caret to last character

I am working on text area using jquery, to provide good UI validation.
Currently I stuck at -
Once user click in text area I want to set cursor position forcefully at end.
Please provide me some jquery solutions so resolve this ?
Thanks in advance
-Pravin


text:
Q: How do you consume a scala.collection.mutable.ArrayBuffer over py4j I'm attempintg to consume a SparkListenerJobStart object in Python, but the py4j bindings do not understand ArrayBuffers (or, I guess, scala.collection.Seqs in general). What do?

A: Convert the object like so:
list = [arrayBuffer.apply(i)
        for i in range(arrayBuffer.length())]


text:
Q: Flutter positioning hyperlink on appbar Is possible to position an hyperlink created with url_launcher on the appbar? Here a screen of what i mean https://ibb.co/X28TzNN "Sito Web" is the hyperlink i want to change position, need move it in the red cirle. Here my AppBar
class BackgroundImage extends StatelessWidget{
  final Widget body;
  BackgroundImage({this.body});
    @override
    Widget build(BuildContext context){
      return Scaffold(
        appBar: AppBar(
          elevation: 0,
          title: Text('Blumax', style: TextStyle(
            fontWeight: FontWeight.w500,
            fontFamily: 'DancingScript',
            fontSize: 40
          ),),
          centerTitle: false,
        ),
        body: Stack(
          children: <Widget>[Container(
          decoration: BoxDecoration(
            image: DecorationImage(image: AssetImage("assets/whiteimage.jpg"), fit: BoxFit.cover),
          ),
        ),
          body
        ]
      )
    );
  }
}

And that's is what i did for position the text in the top right
  Widget build(BuildContext context) {
    return InkWell(
      child: Container(
        alignment: Alignment(0.9, -1.0),
      child: Text(
        _text,
        textAlign: TextAlign.right,
        style: TextStyle(
          fontFamily: 'RobotoMono',
          fontSize: 20,
          color: Colors.white,
          decoration: TextDecoration.underline),
      )),
      onTap: _launchURL,
    );
  }
}

A: @andrea, you don't need to use InkWell/Container. You can use actions in appBar with simple button and try something like this,
class MyAppState extends State<MyApp> {
  String _text = 'Link';
  String _url = 'https://www.test.com';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
            appBar: AppBar(
              title: Text('Test'),
                actions: <Widget>[
                  FlatButton(
                    child: Text(_text, style: TextStyle(fontSize: 18.0, color: Colors.white)),
                    onPressed: _launchURL,
                  ),
                  IconButton(icon: Icon(Icons.more_vert, color: Colors.white), onPressed: (){})
                ]
            ),
            body: Padding(
                  padding: EdgeInsets.all(20.0),
                  child: Center(
                    child: Text('')
                  )
                  )
            )
            );
  }

  _launchURL() async {
    if (await canLaunch(_url)) {
      await launch(_url);
    } else {
      throw 'Could not launch $_url';
    }
  }
}

A: try actions in AppBar, You can have FlatButton or Inkwell or any Widget that gives you a touch event inside.
appBar: AppBar(
        title: Text(Lang.treeView),
        actions: <Widget>[
      InkWell(
      child: Container(
          alignment: Alignment(0.9, -1.0),
        child: Text(
          "ABC",
          textAlign: TextAlign.right,
          style: TextStyle(
              fontFamily: 'RobotoMono',
              fontSize: 20,
              color: Colors.white,
              decoration: TextDecoration.underline),
        ))),
        ],
      )


text:
Q: How to perform this update query? I am trying to migrade Drupal into WordPress, and I have a problem with users migration and post ownership.
More specific.
In my WordPress installation I have move my posts from Drupal. Among the transfered fields is the node ID too. So, now my posts in WordPress having the same IDs like in Drupal nodes table.
Also I have migrate my users, but my current problem is, how to assign the appropriate user to the corresponding post in WordPress.
For the migration I have follow this tutorial that in some place has this code:
# Reassign post authorship.
UPDATE
    wordpress.wp_posts
SET
    post_author = NULL
WHERE
    post_author
NOT IN
    (
        SELECT
            DISTINCT ID
        FROM
            wordpress.wp_users
    );

Unfortunatelly this does not work for me, because I am getting this Warning:
64 warning(s): 1048 Column 'post_author' cannot be null

So, what I did, is to write the following Query to retrieve any required information:
SELECT
    DISTINCT(n.nid) AS  `PostID`,
    n.uid           AS  `AuthorID`,
    wu.ID           AS  `WPUserID`
FROM
    drupal.node n
LEFT JOIN
    drupal.users u
ON
    n.uid = u.uid
LEFT JOIN
    wp_users wu
ON
    wu.user_login = u.name
WHERE
    wu.ID   > 1

The above Query can return to me the post ID (that it is relevant to Drupal one), and the WordPress User ID, as the user in WordPress has a new ID.
So the question is, how can I mix this Query with the UPDATE query above, in order to set the appropriate user to the appropriate post ?
Just for help
This is the Drupal Users Table Signature:
CREATE TABLE `users` (
    `uid` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(60) NOT NULL DEFAULT '''',
    `pass` varchar(32) NOT NULL DEFAULT '''',
    `mail` varchar(64) DEFAULT '''',
    `mode` tinyint(4) NOT NULL DEFAULT ''0'',
    `sort` tinyint(4) DEFAULT ''0'',
    `threshold` tinyint(4) DEFAULT ''0'',
    `theme` varchar(255) NOT NULL DEFAULT '''',
    `signature` varchar(255) NOT NULL DEFAULT '''',
    `signature_format` smallint(6) NOT NULL DEFAULT ''0'',
    `created` int(11) NOT NULL DEFAULT ''0'',
    `access` int(11) NOT NULL DEFAULT ''0'',
    `login` int(11) NOT NULL DEFAULT ''0'',
    `status` tinyint(4) NOT NULL DEFAULT ''0'',
    `timezone` varchar(8) DEFAULT NULL,
    `language` varchar(12) NOT NULL DEFAULT '''',
    `picture` varchar(255) NOT NULL DEFAULT '''',
    `init` varchar(64) DEFAULT '''',
    `data` longtext,
    `timezone_name` varchar(50) NOT NULL DEFAULT '''',
    PRIMARY KEY (`uid`),
    UNIQUE KEY `name` (`name`),
    KEY `access` (`access`),
    KEY `created` (`created`),
    KEY `mail` (`mail`)
) ENGINE=MyISAM AUTO_INCREMENT=397 DEFAULT CHARSET=utf8

This is the Drupal nodes table signature:
CREATE TABLE `node` (
    `nid` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `vid` int(10) unsigned NOT NULL DEFAULT ''0'',
    `type` varchar(32) NOT NULL DEFAULT '''',
    `language` varchar(12) NOT NULL DEFAULT '''',
    `title` varchar(255) NOT NULL DEFAULT '''',
    `uid` int(11) NOT NULL DEFAULT ''0'',
    `status` int(11) NOT NULL DEFAULT ''1'',
    `created` int(11) NOT NULL DEFAULT ''0'',
    `changed` int(11) NOT NULL DEFAULT ''0'',
    `comment` int(11) NOT NULL DEFAULT ''0'',
    `promote` int(11) NOT NULL DEFAULT ''0'',
    `moderate` int(11) NOT NULL DEFAULT ''0'',
    `sticky` int(11) NOT NULL DEFAULT ''0'',
    `tnid` int(10) unsigned NOT NULL DEFAULT ''0'',
    `translate` int(11) NOT NULL DEFAULT ''0'',
    PRIMARY KEY (`nid`),
    UNIQUE KEY `vid` (`vid`),
    KEY `node_changed` (`changed`),
    KEY `node_created` (`created`),
    KEY `node_moderate` (`moderate`),
    KEY `node_promote_status` (`promote`,`status`),
    KEY `node_status_type` (`status`,`type`,`nid`),
    KEY `node_title_type` (`title`,`type`(4)),
    KEY `node_type` (`type`(4)),
    KEY `uid` (`uid`),
    KEY `tnid` (`tnid`),
    KEY `translate` (`translate`)
) ENGINE=MyISAM AUTO_INCREMENT=247 DEFAULT CHARSET=utf8

This is the WordPress wp_posts table signature:
CREATE TABLE `wp_posts` (
    `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    `post_author` bigint(20) unsigned NOT NULL DEFAULT ''0'',
    `post_date` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',
    `post_date_gmt` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',
    `post_content` longtext NOT NULL,
    `post_title` text NOT NULL,
    `post_excerpt` text NOT NULL,
    `post_status` varchar(20) NOT NULL DEFAULT ''publish'',
    `comment_status` varchar(20) NOT NULL DEFAULT ''open'',
    `ping_status` varchar(20) NOT NULL DEFAULT ''open'',
    `post_password` varchar(20) NOT NULL DEFAULT '''',
    `post_name` varchar(200) NOT NULL DEFAULT '''',
    `to_ping` text NOT NULL,
    `pinged` text NOT NULL,
    `post_modified` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',
    `post_modified_gmt` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',
    `post_content_filtered` longtext NOT NULL,
    `post_parent` bigint(20) unsigned NOT NULL DEFAULT ''0'',
    `guid` varchar(255) NOT NULL DEFAULT '''',
    `menu_order` int(11) NOT NULL DEFAULT ''0'',
    `post_type` varchar(20) NOT NULL DEFAULT ''post'',
    `post_mime_type` varchar(100) NOT NULL DEFAULT '''',
    `comment_count` bigint(20) NOT NULL DEFAULT ''0'',
    PRIMARY KEY (`ID`),
    KEY `post_name` (`post_name`),
    KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`),
    KEY `post_parent` (`post_parent`),
    KEY `post_author` (`post_author`)
) ENGINE=InnoDB AUTO_INCREMENT=247 DEFAULT CHARSET=utf8

And finally this is the WordPress Users table signature:
CREATE TABLE `wp_users` (
    `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    `user_login` varchar(60) NOT NULL DEFAULT '''',
    `user_pass` varchar(64) NOT NULL DEFAULT '''',
    `user_nicename` varchar(50) NOT NULL DEFAULT '''',
    `user_email` varchar(100) NOT NULL DEFAULT '''',
    `user_url` varchar(100) NOT NULL DEFAULT '''',
    `user_registered` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',
    `user_activation_key` varchar(60) NOT NULL DEFAULT '''',
    `user_status` int(11) NOT NULL DEFAULT ''0'',
    `display_name` varchar(250) NOT NULL DEFAULT '''',
    PRIMARY KEY (`ID`),
    KEY `user_login_key` (`user_login`),
    KEY `user_nicename` (`user_nicename`)
) ENGINE=InnoDB AUTO_INCREMENT=652 DEFAULT CHARSET=utf8

A: In  your update query join wp_posts and node table and set the post_author field as the uid in the node table
UPDATE `wp_posts`  p
INNER JOIN `node` n  (ON n.nid=p.ID)
SET p.post_author = n.uid

I guess n.uid you have maintained these ids same as in the wp_users ids


text:
Q: Not loading flash crossdomain.xml, bad request Hi I have a Windows Server 2003, with a domain: "mydomain.com" and everything goes right until the Flash application tries to load de crossdomain.xml, because it tries to load it from "servername" and obviously the request fails.
Currently I have read all about crossdomain.xml , what it is, where it goes although I can not find what I have to do so my flash application requests the crossdomain.xml from my domain "mydomain.com" and not from my server "servername".
Thanks a lot and any help would be very appreciated.
Notes:
- The domain is up and can be accessed from the internet
- The crossdomain is on the root folder and also can be accessed from the internet

A: Crossdomain.xml is used when a flash movie requests resources from a host different from the one the swf file is hosted on.
So if you swf is on mydomain.com it will not need a crossdomain file for any files on that server.
But if your swf on mydomain.com loads an image or file from otherDomain.com, it will ask the otherdomain.com server for the crossdomain file.
The crossdomain.xml file should usually be places in the root of otherDomain.com
In advanced configurations you can place the crossdomain.xml file in a specific folder, but this is not the typical case.
In cases when you cannot load the files from a domain because do you not contain it, such as when using Facebook Profile Images, you will have to use serverside scripts to proxy the files.

A: The only reason a SWF would try to load a crossdomain.xml file from "servername" is because the SWF is requesting data from "servername".  The only way this would happen if the SWF was loaded from "mydomain.com" would be if 'servername' was hardcoded somewhere.
I would look for that "hard coded" reference.  Keep in mind it is not explicitly stored as code in the SWF.  IT could be part of a services-config file or part of dynamic data loaded from a server or config file that defines remote servers which must be accessed.


text:
Q: ReactNative check if we are on focus mode on iOS On iOS 15 we have possibility to be on focus mode
https://support.apple.com/en-us/HT212608
I know it's impossible de set focus mode programmatically what i need is just check if we are on focus mode or not programmatically
How can i check if we are on focus mode on an application reactnative, the client want to block user to access to a specific screen if the user hasn't enable focus mode on parameters
How can i do that on reactnative for ios device
any help would be greatly appreciated

Edit
i use this part of code :
/// Retrieve the current authorization status: INFocusStatusAuthorizationStatus
let authorizationStatus = INFocusStatusCenter.default.authorizationStatus

/// Request authorization to check Focus Status
//
INFocusStatusCenter.default.requestAuthorization { status in
    /// Provides a INFocusStatusAuthorizationStatus
}

/// Check if Focus is enabled. INFocusStatusAuthorizationStatus must be .authorized
let focused = INFocusStatusCenter.default.focusStatus.isFocused

return ["focused": focused!, "authorizationStatus": authorizationStatus];

but the focused variable is always false, even if i active the focus mode on parameters and i don't receive any notification when the application is active, why INFocusStatusCenter.default.focusStatus.isFocused is never true ? INFocusStatusAuthorizationStatus is authorized


text:
Q: How to allow same day booking in t-datepicker
Hi everyone!
I'm trying to allow same day booking for my calendar using the
t-datepicker. I'm trying to use different methods from the
documentation to allow same day booking. For example to allow users to
book from 6th of june till 6th of June. However it's not allowing that
and always adds an extra day when booking.  The code is below.

          <form action="" method="POST">

Quick Booking

                <button type="button" class="close" data-dismiss="modal">×</button>

                  {{ csrf_field() }}
                  @isset($error_msg)
                    @foreach ($error_msg as $error)

{{ $error }}

                    @endforeach
                  @endisset

                      {{ __('Place ID') }}:

                          <input type="text" class="form-control" name="place_id" required>

                      {{ __('Arrival day') }}:

                            @isset($maparray['err_msg'])
                               {{ __('You can book maximum') }} {{ $maparray["set_admin"]->max_no_days }} {{ __('days') }}.

                            @endisset
                             {{ __('Arrival day is not selected') }}.

                      {{ __('Full Name') }}:

                          <input type="text" class="form-control" name="user_fullname" required>

                      {{ __('Email address') }}:

                          <input type="email" class="form-control" name="user_email" required>

                      {{ __('Phone') }}:

                          <input type="tel" class="form-control" name="user_phone" required>

                      {{ __('Number of adults') }}[1-4]:

                        <select class="form-control booking_inp_textbox_style" id="numberofguest" name="numberofguest" onchange="addFieldsadmin(this.value);">
                          <option value="0" active>1</option>
                          <option value="1">2</option>
                          <option value="2">3</option>
                          <option value="3">4</option>
                        </select>

                      {{ __('Number of babies') }}[1-4]:

                        <select class="form-control booking_inp_textbox_style" id="numberofbabies" name="numberofbabies" onchange="addFieldsadmin2(this.value);">
                          <option value="0" active>0</option>
                          <option id="hidden_op_style1" value="1">1</option>
                          <option id="hidden_op_style2" value="2">2</option>
                          <option id="hidden_op_style3" value="3">3</option>
                          <option id="hidden_op_style4" value="4">4</option>
                        </select>

                    {{-- dynamic input surname using javascript --}}

                    {{-- dynamic input surname using javascript --}}

                      {{ __('Promo Code') }}:

                          <input type="text" class="form-control" name="user_promo">

                    {{ __('Booked By') }}:

                      {{ Auth::user()->name }}

                  @if (Auth::user()->role == 'admin')

                      {{ __('Payment Type') }}:

                        <input type="radio" name="user_payment_type" value="Entrance">
                        {{ __('Entrance (Cash)') }}
                        <input type="radio" name="user_payment_type" value="Admin" checked>
                        {{ __('Admin (Free)') }}

                  @else

                      {{ __('Payment Type') }}:

                        <input type="radio" name="user_payment_type" value="Entrance" checked>
                        {{ __('Entrance (Cash)') }}

                  @endif

                <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                <button type="submit" class="btn btn-success">{{ __('Save') }}</button>

        </form>


text:
Q: Cannot understand this line of javascript code     let tempProducts = [];
storeProducts.forEach((item) => {
  const singleItem = { ...item };
  tempProducts = [...tempProducts, singleItem]; <----- This Line
});

What does the above indicated line mean? It looks like new ES6 syntax, but unlike anything I have seen before. Can anyone explain this to me please?

A: It creates a new array which consists of the items from tempProducts and the singleItem.
It has the same result as
tempProducts.concat(singleItem);

The (quite modern) syntax with the three dots is called 'spreading', the ... is the spread operator.


text:
Q: Regression where a subset of observations are missing data on an independent variable Consider the regression equations below:
\begin{align}
Y_i &= \beta_0 + \beta_1 X_{i1} + \varepsilon_i  \\
Y_j &= \beta_0 + \beta_1 X_{j1} + \beta_2 X_{j2} + \varepsilon_j
\end{align}
where $Y_i,\ X_{i1},\ \varepsilon_i,\ Y_j,\ X_{j1},\ \& \ X_{j2},\ \varepsilon_j$  are vectors, and $_i$ and $_j$ index distinct sets of observations. The $_i$ respondents did not meet a qualification criterion and hence were not asked the question that corresponds to $X_2$.
The dependent variable and the first independent variable is the same in both regression equations but the second regression equation has an independent variable that is not present in the first. Obviously, I can estimate the two regressions separately but that will not be efficient. Therefore, I was considering re-writing the first one as:
$$
Y_i = \beta_0 + \beta_1 X_{i1} + \beta_2 X_{i2} + \varepsilon_j
$$
where $X_{i2}$ is a vector of $0$s.
Then I can estimate the parameter estimates by using OLS with the equation below:
$\left[ \begin{array}{ccc}
Y_i\\
Y_j\end{array} \right] = \left[ \begin{array}{ccc}
{\bf 1} & X_{i1} & X_{i2} \\
{\bf 1} & X_{j1} & X_{j2}\end{array} \right] \left[ \begin{array}{ccc}
\beta_0\\
\beta_1\\
\beta_2\end{array} \right] + \left[ \begin{array}{ccc}
\epsilon_i\\
\epsilon_j\end{array} \right]$
In the above equation, ${\bf 1}$ stands for a vector of $1$s of the appropriate dimension.
Is the above a standard approach to obtaining efficient estimates? Is there a name to this way of estimation?


text:
Q: pushing a feature did not finished yet with gitflow I need to save on the cloud the source code, but i have not finish my feature, i am using gitflow, but I have did local commit.
git commit .

git push ?

is that possible?

A: Yup, that's the reason why git is made. You can save your source code even if you have not finished the feature. Assuming you are on a feature branch. First add all the file using:
git add .

Then write an appropriate msg like for your own convenience :
git commit -m "Feature xxx part 1 completed, part 2 remaining"

Then just push:
git push


text:
Q: How can I create an infinite loop for entering names in a string list? static void Main(string[] args)
        {
            Console.WriteLine("Add a new Name:");
            List<string> namensLists = new List<string>();

            *Code ?

// I tried with the do-while loop, got an infinite loop on the one hand, but couldn't jump out of it to output it in the Foreach loop afterwards.*
            foreach (var name in namensLists)
            {
                Console.WriteLine($"{name}");
            }

            Console.ReadKey();
        }

A: When entering names in an inifinte loop, you should have some escape; let's stop entering names on empty input:
List<string> namensLists = new List<string>();

// infinite loop ...
while (true) {
  Console.Write("Add a new Name (empty one to stop): ");

  string input = Console.ReadLine();

  // ... which we break on escape input (here on empty input)
  if (string.IsNullOrEmpty(input))
    break;

  namensLists.Add(input);
}


text:
Q: create a single form using multiple inputs through xml file here is my problem. I have an xml file that acts like a small database. My php code goes through the xml file and retrieves the info creating a form. For example, the xml file holds info about a menu, the user chooses salad, then the code will print out all types of salads and the user then chooses his favourite salad. The actual problem is that there are different portions; small and large and different prices for each!
I am not able to keep track of the selected item... X(
Any help??
Thanks in advance
here is my code:
<?php
foreach ($xml-> CATEGORY as $category)
{
  if($_GET['category']==$category["id"])
  {
    echo "
".$category ["id"]."
";
    echo "
";
    echo "<form method=\"post\" action=\"add.php\">";
    foreach ($category -> FOOD as $food)       {
      echo "
";
      echo "".$food["name"]."";
      echo "
";
      echo "
";
      echo "<select name=\"variations[]\">";
      foreach($food -> PRICE as $price)
      {
        echo "<option value=\"$price\">";
        echo "
";
        echo $price["size"]. " ";
        echo $price;
        echo "
";
        echo "</option>";
      }
      echo "</select>";
      echo "<input type=\"submit\" value=\"Buy this\">";
    }
    echo "
";
    echo "
";
  }
  echo "</form>";
}

?>

the cart looks something like this
<?php
  echo "
";
  $values = $_POST['variations'];
  foreach($values as $value)
  {
    echo $value;
    echo "
";
  }
?>

the code above only shows prices about small items. Large items are somehow ignored!! This code is not actually what I meant to do but it's an start. It should say:
You have chosen a large portion of greek salad for £10.50.
So, I should be able to pass three variables that I don't know how: $price[size], food and $price...
Thanks for your time

A: if i understand you correctly, you are just recieving the selected size (price) but not the actual meal?
well two possible solutions:
version one:
create a second form field that holds the selected meal.
i think its elegant and logical if you have checkboxes for the meals and then radio buttons or  lists for the size... so you can check/uncheck meals but if its check you need to select a size...
you can also just let the user select the price and dynamlically select the the meal field too with javascript but i wouldnt suggest that, if you want this kind of user experience, i'd opt for vesion two
version two:
include the meal in the value of the input field that for the price. maby seperated by a comma or as a json encoded string.
then when you retrieve the post variable you can split/decode...
if you give me a working example which i can just paste into a file and hit it (including the xml object) i can quickly do that for you...


text:
Q: Working with DLL in a C++ application I'm planning to use id3lib in my application. I'm looking for a way to use the library as a DLL. I've noticed that they released the library in various form: one of which is windows binary. My target platform in Windows, and I'll use Qt 4.8. After I extract the files in windows binary, I found the following files in Release folder:

*

*id3lib.dll

*id3lib.exp

*id3lib.lib

I know how to use a DLL in Qt given the DLL, one or more header files where function prototypes resides, and with or without the *.lib file. This package doesn't come with a header file.
How am I supposed to use this package without any header file? What's the purpose of the *.lib and *.exp files here? As far as I know *.lib files are used for static linking with functions which I don't want in my program.

A: You've just missed the header. It is available under the include subfolder (see here), also the .lib file is still needed for linking, even if you'll be using the DLL.

A: The usual course is to use a header file #included in the C++ file, the .lib file to link to and the .dll is required at run time.
The header file should/may be in another package as the same header is probably used for different kinds of linking strategies.
At worst you should be able to use a tool such as depends.exe to view the exported symbols and create your own h file to match - but it would be better to find a .h file issued with the release.


text:
Q: Fuzzy logic simulation software I am trying to find the best fuzzy logic simulator for Ubuntu 16.04 LTS. In Windows, I have fuzzy logic working in MATLAB, but in Ubuntu, Octave doesn't seem to compile fuzzy logic code.
Is there something I have to install to run fuzzy logic code in Octave? Also, what alternatives are there to Octave on Ubuntu 16.04?

A: I have not tested it, but it seems that FuzzyLite Libraries for Fuzzy Logic Control is great.
It may be installed from official repository with sudo apt-get install fuzzylite.
Octave is good alternative to MATLAB.
You can install Octave from repository with
sudo apt-get install octave liboctave-dev
and then install fuzzy-logic-toolkit in it with
pkg install -forge fuzzy-logic-toolkit -verbose.
Also do not forget Scilab. You can install it with sudo apt-get install scilab.
Then install Scilab Fuzzy Logic Toolbox (sciFLT) from GitHub.


text:
Q: Danger of Scavenging Stale Resource Records In _msdcs Zone? I just realized that a previous admin turned DNS scavenging on for all zones on one of the DCs, including the _msdcs zone. It's been this way for a while and things are fine, but I can't imagine that this is best practice.
Is there any danger to scavenging the _msdcs zone?
Should I make it so that zone is not scavenged?
Could scavenging have broken anything in that zone that I'm unaware of at this time?

A: Scavenge it, I say!
Everything in there is automatically populated by the DCs, as long as they're allowed to - as long as you're not scavenging it ridiculously frequently then there should be no problem.

A: OK, so, a quick rundown:

*

*_msdcs is essentially where all those AD-critical SRV records are kept.

*All your servers which need SRV records should be registering and refreshing them via dynamic DNS. You're (hopefully) not building your SRV records by hand.

*The netlogon service performs DDNS refresh, with a according to this a default refresh frequency of 1 hour. But according to this, it refreshes every 24 hours - it's what I observe in the timestamps of my own SRV records as well.

*

*Also be aware, DDNS updates have a dependency on the DHCP Client service, so don't disable the DHCP Client service even if your servers are statically addressed.

*The default scavenging interval is 7 days. Scavenging removes any dynamic record whose timestamp is older than (todaysdate - scavengeinterval); those records would remain until deleted (either manually or by some other process like a DC demotion) if there were no scavenging. Scavenging does not touch static records (those you created by hand) unless you explicitly allow scavenging for the record.

So, keeping all this in mind, you should be fine with scavenging, as long as you are not scavenging more often than your records can refresh themselves. You can verify that your records really are refreshing themselves by taking a short look through the timestamps in whatever zone you are considering scavenging.
IMHO, scavenging is always a good idea, and yes this includes the _msdcs zone. If a DC stops refreshing its DNS records, scavenging will automatically remove those records and that's a good thing - you wouldn't want people resolving to broken DCs.
I consider the article Don't be afraid of DNS Scavenging. Just be patient. to be the canonical best practice for Windows DNS scavenging.


text:
Q: C++ websocket client without receive callback We've a WebSocket server and clients in C#. The server is designed to slow down depending on how fast/slow the client reads and processes the messages. The C# clients reads one message at a time.
I'm looking to write a client in c++ and all the libraries I looked so far have a message handler or callback mechanism for receiving message from server.
This would mean that the client is receiving messages continuously, queue it and the client reads from the queue. This is not the behavior we're looking for. We require the client to read a message and process it and once the processing is complete, read the next message. Is there any library available we could use to achieve this?
I've so far checked cpprestsdk, websocketpp, libwebsocket

A: you can use Boost.ASIO Library.
I made a server that works with Websocket and multiple connections. Each connection uses an asynchronous way to receive data which will be handled before receiving the next message:
/**
* This method is used to read the incoming message on the WebSocket
* and handled it before reading the other message.
*/
void wscnx::read()
{
    if (!is_ssl && !m_ws->is_open())
        return;
    else if (is_ssl  && !m_wss->is_open())
        return;

    auto f_read = [self{shared_from_this()}](const boost::system::error_code &ec, std::size_t bytes_transferred)
                 {
                    boost::ignore_unused(bytes_transferred);

                    // This indicates that the session was closed
                    if (ec == websocket::error::closed)
                    {
                        self->close(beast::websocket::close_code::normal, ec);
                        return;
                    }

                    if (ec)
                    {
                        self->close(beast::websocket::close_code::abnormal, ec);
                        return;
                    }

                    std::string data = beast::buffers_to_string(self->m_rx_buffer.data());
                    self->m_rx_buffer.consume(bytes_transferred);

                    if (!self->m_server.expired())
                    {
                        std::string_view vdata(data.c_str());

                        /*************************************
                          Here is where the datas are handled
                        **************************************/
                        self->m_server.lock()->on_data_rx(self->m_cnx_info.id, vdata, self->cnx_info());
                    }

                    /*************************************
                    Read the next message in the buffer.
                    **************************************/
                    self->read();
                };//lambda

    if (!is_ssl)
        m_ws->async_read(m_rx_buffer, f_read);
    else
        m_wss->async_read(m_rx_buffer, f_read);
}

In this sample the connection could be plain or secure, using SSL, both of them are using a lambda function to receive the data.
I tested this service with a JS application, on the browser and there is no problem with the sequence to attend each message.


text:
Q: Error: [firestore/unknown] java.lang.String cannot be cast to java.lang.Double I am adding this minimal code for which I am receiving this error
firestore()
  .collection('someCollection')
  .doc('someDocument')
  .set({
    test: 5,
  })
  .catch(e => {
    alert(e);
  });

Version of firestore:
"@react-native-firebase/firestore": "^14.7.0",
I am not getting any error when I use {test : 'something'} for the document.
Why is this happening ? I want to store integer value in the test

A: look at breaking changes for v14
You need check your 'where/in' clauses.
Probably, previously you may had like this
.where('time' > user.registerTime.toDate().getTime())
but now it throws exception.
To make it tmp working you can write like this
.where('time' > ${user.registerTime.toDate().getTime()})
It will not throw exception but idk is this correct way or not
(probably, the best solution is performing migration on firestore server side, as they mentioned to get rid of this ugly tmp fix)


text:
Q: Filter_SelectionChanged using a web service When the search capability of a Windows8 app essentially delegates to a web service, one might expect to use code like this
var jsonresult = await HttpClient.GetStringAsync(REQ);

then parsing the string to populate the result collection prior to assigning it to this.DefaultViewModel["Results"], but the await operator can only be used within an async method.
How is one expected to handle the scenario of searching by querying a web service?
I've tried moving the above code out into an async method
async void QueryWebservice(string queryText) { ... }

A: The problem was merely the way the results are marshaled into the display elements. The viewmodel is an Observable. You have to populate the result collection before you assign it to this.DefaultViewModel["Results"]
The odd and erratic errors I was getting when I assigned the collection object and then populated it were a consequence of the fact that the framework was trying to populate the UI while I was modifying the collection from which it was obtaining values. When you do it the other way round, no problems occur.
Using an async method to query a web service works very well.