text:
Q: For a given point, determine if it is on an arc segment Looked a few times for this and couldn't find it, so hopefully someone can help me out.
I have an arc segment, defined by startPoint, endPoint, and center.
I have a point, p, that I want to know if it resides on the arc segment.
I've seen a few solutions for if it's within the arc pie, but not on the segment itself.
public static bool PointIsOnArcSegment(PointF p, PointF startPoint, PointF endPoint, PointF center)
{
   ???
}

Thanks in advance.
Edit: Sweep angle is also known. (clockwise or counter-clockwise)

A: Rather than representing your arc as three points you should represent it as a single point (the center), a starting angle (e.g. 30 degrees), an ending angle (e.g. 45 degrees), and a radius.
Then to test if a point is on your arc you can just figure out the distance and angle of your point from the center and compare it with the radius and starting/ending angles (using a threshold).

A: Convert the points to polar coordinates around the center of the circle.
First check if the test point is on the whole circle by comparing the radii. Chances are high that you need a tolerance on equality (the absolute difference of the radii gives you the distance of the point to the circle).
If the first test passes, check the angles. Here the discussion is a little complicated because you need to determine which angle interval defines your arc, and deal with the "phase wrapping", i.e. the period of 2π radians.
Extra hint: to determine the angles, use the atan2 function, which works on a full turn.


text:
Q: How to query 'history' field in Team Foundation Server (TFS)? I am trying to capture the history of changes when a user story is moved from one iteration to another.
I am trying to query in TFS and using the history field, but don't know what values to put in the value field to capture when a user story is moved to a new iteration.  See image below.

A:
I am trying to capture the history of changes when a user story is
  moved from one iteration to another.

Unfortunately you cannot capture the information as the History filed is not the real change history for all actions. It just records the Discussion History.
And the work item query is to return work items which matched the given conditions from TFS but not the specific history information.
If you just want to get the real history (iteration change information in your scenario) for a specific work item, then you can call the REST API - Get Work item revisions
If you want to filter the work items which have the specific discussion words, then you can specify the words as the value of the History field. Reference below screenshot:

redpajama_set_name: RedPajamaStackExchange


text:
Q: Update React state correctly How to update react state correctly ? I have a drop down with countries and a table with country and it's cities. Based on the selected country from dropdownlist, table should show only that country and cities.
Below code filters the table data correctly for the first time. When country is changed, table doesn't show data for the selected country from second time.
import React, { Component } from "react";
import logo from "./logo.svg";
import "./App.css";

import { makeStyles } from "@material-ui/core/styles";
import Button from "@material-ui/core/Button";

import MenuItem from "@material-ui/core/MenuItem";
import Select from "@material-ui/core/Select";

import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";

const useStyles = makeStyles(theme => ({
  button: {
    margin: theme.spacing(1)
  },
  input: {
    display: "none"
  }
}));

class App extends Component {
  state = {
    selectedCountry: "",
    countries: []
  };

  constructor() {
    super();

    this.state.countries = [
      this.createData("US", "DC"),
      this.createData("UK", "London"),
      this.createData("Aus", "Canberra"),
      this.createData("US", "Newyork"),
      this.createData("UK", "Birmingham"),
      this.createData("Aus", "Sidney")
    ];
  }

  createData(country, capital) {
    return { country, capital };
  }

  handleChange(value) {
    this.setState({ selected: value });
    this.setState({
      countries: this.state.countries.filter(c => c.country === value)
    });
  }

  render() {
    return (

        Select Country:
        <Select
          style={{ width: "10%" }}
          value={this.state.selected}
          onChange={event => this.handleChange(event.target.value)}
          name="country"
          displayEmpty
        >
          <MenuItem value="" disabled>
            Select a country
          </MenuItem>
          <MenuItem value="US">US</MenuItem>
          <MenuItem value="UK">UK</MenuItem>
          <MenuItem value="AUS">Aus</MenuItem>
        </Select>

          <TableHead>
            <TableRow>
              <TableCell align="center">Country</TableCell>
              <TableCell align="center">Capital city</TableCell>
            </TableRow>
          </TableHead>
          <TableBody>
            {this.state.countries.map(row => (
              <TableRow key={row.name}>
                <TableCell align="center">{row.country}</TableCell>
                <TableCell align="center">{row.capital}</TableCell>
              </TableRow>
            ))}
          </TableBody>

    );
  }
}

export default App;

A: The problem is here,
this.setState({
   countries: this.state.countries.filter(c => c.country === value)
});

Here you are filtering the countries array and storing it to the same. So when first time you filter your original countries array is gets changed and you only have filtered data. On next filter you are filtering data from previous result and not from original array.
You need to keep a copy of original data in a constructor,
constructor() {
    super();
    //This is initial state
    this.state.countries = [
      this.createData("US", "DC"),
      this.createData("UK", "London"),
      this.createData("Aus", "Canberra"),
      this.createData("US", "Newyork"),
      this.createData("UK", "Birmingham"),
      this.createData("Aus", "Sidney")
    ];

    //this is the copy of original data
    this.countries = [
      this.createData("US", "DC"),
      this.createData("UK", "London"),
      this.createData("Aus", "Canberra"),
      this.createData("US", "Newyork"),
      this.createData("UK", "Birmingham"),
      this.createData("Aus", "Sidney")
    ];
  }

Now you can filter over original data every time,
this.setState({
   countries: this.countries.filter(c => c.country === value)
});

Demo
Note: You should use .toLowerCase() at the time of comparing in your filter. Because you have Aus as country in your state and AUS as value in your select. It is better if you compare lowerCase value,
this.setState({
   countries: this.countries.filter(c => c.country.toLowerCase() === value.toLowerCase())
});

A: use const value inside the render method. The const value will every time update when there is a change in the selected country.
remove line this.setState({
      countries: this.state.countries.filter(c => c.country === value)
    });
and add below code
render() {
    const filteredCountries = this.state.countries.filter(c=> c.countries === this.state.selected);
    return (

        Select Country:
        <Select
          style={{ width: "10%" }}
          value={this.state.selected}
          onChange={event => this.handleChange(event.target.value)}
          name="country"
          displayEmpty
        >
          <MenuItem value="" disabled>
            Select a country
          </MenuItem>
          <MenuItem value="US">US</MenuItem>
          <MenuItem value="UK">UK</MenuItem>
          <MenuItem value="AUS">Aus</MenuItem>
        </Select>

          <TableHead>
            <TableRow>
              <TableCell align="center">Country</TableCell>
              <TableCell align="center">Capital city</TableCell>
            </TableRow>
          </TableHead>
          <TableBody>
            {this.state.filteredCountries.map(row => (
              <TableRow key={row.name}>
                <TableCell align="center">{row.country}</TableCell>
                <TableCell align="center">{row.capital}</TableCell>
              </TableRow>
            ))}
          </TableBody>

    );
  }

Instead of using another state for "filteredCountries", this is more efficient way to solve this problem.


text:
Q: python: annotation for ellipsis to be a possible argument of a function For "certain reasons" I want to allow python's Ellipsis "..." to (also) be an argument to some function (let's say) f, e.g. as follows:
def f(arg: ?) -> None:
    print(arg)

f(...)

what annotation should I use for arg?

A: ... is an instance of the Ellipsis class, so you could do something like:
def f(arg:Ellipsis) -> None:
    # your code

Since there is only one instance of that class, you probably want to combine it with some other types.  Otherwise why have a parameter at all (could it be a way to detect all calls to function f by temporarily setting an unusable type)

A: It appears (see python doc: https://docs.python.org/3/library/constants.html#Ellipsis) that
from types import EllipsisType

def f(arg: EllipsisType):
    print(arg)

f(...)  # or alternatively f(Ellipsis)

is the right solution here (i.e. to annotate the Ellipsis itself)


text:
Q: system sound on iphone not playing I want to play a system sound but I don't hear anything:
- (void) play_system_sound
{
    NSLog(@"Play system sound");

    SystemSoundID soundID;
    NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.UIKit"] pathForResource:@"Tock" ofType:@"aiff"];
    NSLog(@"path = %@", path );
    AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path], &soundID);
    AudioServicesPlaySystemSound(soundID);
    AudioServicesDisposeSystemSoundID(soundID);
    NSLog(@"Play system sound DONE");
}

I don't hear anything. What am I doing wrong?

A: After AudioServicesPlaySystemSound(soundID) ,don't call AudioServicesDisposeSystemSoundID(soundID) immediately.
Try this :
- (void)viewDidLoad
{
    [super viewDidLoad];
    NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.UIKit"] pathForResource:@"Tock" ofType:@"aiff"];
    AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path], &soundID);
}

-(void)dealloc
{
    AudioServicesDisposeSystemSoundID(soundID);
}

- (void)play_system_sound
{
    AudioServicesPlaySystemSound(soundID);
}

A: I don't know if you have solved the problem, but for me, on iOS 7, sometimes the (__bridge CFURLRef) casting won't work, in which case, if you print out the result of (__bridge CFURLRef)[NSURL fileURLWithPath:path], it will be 0x0. This leads to failure of AudioServicesCreateSystemSoundID(). The return value of the function is type of OSStatus. If it fails,  the function will return -50, which means one or more parameters are invalid. (If it executes successfully, it returns 0.)
I solved this by using the C style function getting the path of the file:
    CFBundleRef mainBundle = CFBundleGetMainBundle ();
    CFURLRef soundFileUrl;

    soundFileUrl = CFBundleCopyResourceURL(mainBundle, CFSTR("fileName"), CFSTR("wav"), NULL);
    AudioServicesCreateSystemSoundID(soundFileUrl, &soundID);


text:
Q: Python Tkinter: How do I apply a new background image when opening a new tk window? I used the code below (with different variable names for each section) to create a background image for each tkinter window. Each of these is initiated in a function and both work fine independently.
When loading one function from another however, the second fails to display an image. (I have tried importing all relevant in each function aswell). It works in the case that use tk.destruct(), however if If I want to keep it open, or hide it with . withdraw(), the image fails to display, rendering the second window useless.
background_image=tk.PhotoImage(...)
background_label = tk.Label(parent, image=background_image)
background_label.place(x=0, y=0, relwidth=1, relheight=1)

A: Ok I've made up a solution for you. Basically all you need is to use tk.Toplevel() for the second tkinter window and make sure that the 'parent' is root2 so the image will appear in the second window.
I have used buttons for the images, you had labels so you may wish to change this, but buttons gave me a way to open a new tk window easily, I have also used .pack(), not .place(), as it was faster for me. May also be helpful for you to know that I used python 3.3 with windows so you might need a capital T for tkinter.
import tkinter as tk

root1 = tk.Tk()

def new_window():
    root2 = tk.Toplevel()
    # click the last button and all tk windows close
    def shutdown():
        root1.destroy()
        root2.destroy()
    background_image2 = tk.PhotoImage(file = '...')
    background_button2 = tk.Button(root2, image = background_image2, command = shutdown)
    background_button2.pack()
    root2.mainloop()

background_image1 = tk.PhotoImage(file = '...')
# have used a button not a label for me to make another tk window
background_button1 = tk.Button(root1, image = background_image1, command = new_window)
background_button1.pack()

root1.mainloop()

@user2589273 Next time you should add more code so answers can be easily given, and tailored to you, just a suggestion. Hope this helps.


text:
Q: Different margin on first page To meet the conditions of our corporate design I need other margins on the first page of each document. The normal page layout is given by
\usepackage[left=3cm,right=2cm,bottom=3cm,top=2cm]{geometry}

But on the first page I need
\usepackage[left=3cm,right=4.5cm,bottom=3cm,top=2cm]{geometry}

I am aware of commands like \newgeometry, but for such things I need to insert pagebreaks by hand.
How can I achieve different margins only on the first page without doing pagebreaks by hand? Any trick (like using wrapfig or something like this) is allowed.
Here is a MWE where I want to use it:
\documentclass[parskip=half,fontsize=11pt,ngerman]{scrlttr2}
\usepackage{babel,lipsum,txfonts}
\usepackage[left=3cm,right=2cm,bottom=3cm,top=2cm]{geometry}

\setkomavar{fromaddress}{Street}
\setkomavar{yourmail}{2013-01-10}
\setkomavar{subject}{Subject}

\begin{document}

\begin{letter}{Insert a name here}
\opening{Hi,}
\lipsum
\end{letter}

\end{document}

A: If you are okay with manual fiddling you can use a combination of \rightskip and \parshape.  The problem with \rightskip is that it will always act on the entire paragraph, so that the first lines on the second page would still obey the wrong margin, if they belong to a paragraph that started on the first page.  \parshape can handle line by line, but you need to specify the number of lines by hand (or automatize it somehow.
\documentclass[parskip=half,fontsize=11pt,ngerman]{scrlttr2}
\usepackage{babel,lipsum}
\usepackage[left=3cm,right=2cm,bottom=3cm,top=2cm]{geometry}
\setkomavar{fromaddress}{Street}
\setkomavar{yourmail}{2013-01-10}
\setkomavar{subject}{Subject}

\setlength{\rightskip}{2.5cm}

\begin{document}

\begin{letter}{Insert a name here}
\opening{Hi,}
\lipsum[1]
\lipsum[2]
\setlength{\rightskip}{0pt}
\parshape 8
0cm \dimexpr\textwidth-2.5cm\relax
0cm \dimexpr\textwidth-2.5cm\relax
0cm \dimexpr\textwidth-2.5cm\relax
0cm \dimexpr\textwidth-2.5cm\relax
0cm \dimexpr\textwidth-2.5cm\relax
0cm \dimexpr\textwidth-2.5cm\relax
0cm \dimexpr\textwidth-2.5cm\relax
0cm \textwidth
\lipsum[3]

\lipsum[4]
\end{letter}

\end{document}

I do not claim that this is a perfect solution, but maybe it gives someone else here an idea to build on.

Edit to point out the problems with using only \rightskip
It would be much more elegant to just reset the right margin after the first page is done. However, you then run into problems, if the second page continues a paragraph that started on the first one:
\documentclass[parskip=half,fontsize=11pt,ngerman]{scrlttr2}
\usepackage{babel,lipsum}
\usepackage[left=3cm,right=2cm,bottom=3cm,top=2cm]{geometry}
\setkomavar{fromaddress}{Street}
\setkomavar{yourmail}{2013-01-10}
\setkomavar{subject}{Subject}

% reset \rightskip to zero when first page is done
\usepackage{everyshi}
\setlength{\rightskip}{2.5cm}
\AtNextShipout{\global\rightskip=0pt}

\begin{document}

\begin{letter}{Insert a name here}
\opening{Hi,}
\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]
\end{letter}

\end{document}

The above will result in a wrong indentation of the first lines on the second page.

A: I don't have a solution for the scrlttr2 class, although I think if you beat this answer with the letter class, you should be able to get it to work ...
Something like
\usepackage{everyshi}
\AtNextShipout{\global\rightskip=-2.5cm\relax}

can handle the simple cases of single page letters and letters where the first page break occur at a paragraph. As I see it the crux of the problem is to handle the case when the first page break occurs in the middle of a paragraph. David's answer handles simple cases by defining a parshape and keeping track of where you are. This solution works great if you start the parshape at the top of a page. The problem with letters is that there is variable amounts of "stuff" at the top of the page. This is especially true for the scrlttr2 class, which is why I cannot get it to work. Butchering David's code to handle a pages with variable numbers of lines (the first page of the letter class with your margins has 54 lines) and a variable width gives
\newlength{\textwidth@wide}
\setlength{\textwidth@wide}{\textwidth}
\addtolength{\textwidth@wide}{2.5cm}
\newcounter{nlines@first}
\setcounter{nlines@first}{54}

\def\shp#1{%
\@tempcnta\z@
\loop
\advance\@tempcnta\@ne
\edef\pshape{\pshape 0pt #1 }
\ifnum\@tempcnta<\value{nlines@first}
\repeat
\advance\@tempcntb\value{nlines@first}
}

\def\reshape{%
  \begingroup%
    \@tempcntb\z@%
    \def\pshape{}%
    \shp{\textwidth}\shp{\textwidth@wide}%
    \def\par{\ifhmode\\\fi\hspace*{\parindent}\ignorespaces}%
    \parshape\@tempcntb\pshape%
}

If you never used \opening then the solution is very easy
\usepackage{etoolbox}
\apptocmd{\letter}{\reshape}{}{}
\pretocmd{\endletter}{\endgraf\endgroup}{}{}

\opening does a whole lot more than just add the opening (e.g., it adds to and from addresses and a date). To handle this, we need to undo the change to the letter environment and modify \opening.
\pretocmd{\opening}{\endgraf\endgroup}{}{}
\apptocmd{\opening}{
  \ifx\toaddress\@empty
  \else
    \expandafter\count@lines\expandafter{\toaddress}%
    \addtocounter{nlines@first}{-2}%
  \fi
  \addtocounter{nlines@first}{-4}%
  \reshape%
}{}{}
\patchcmd{\opening}{{\raggedleft\@date\par}}{\addtocounter{nlines@first}{-2}{\raggedleft\@date\par}}{}{}
\patchcmd{\opening}{\thispagestyle{empty}}{\thispagestyle{empty}\addtocounter{nlines@first}{-4}\expandafter\count@lines\expandafter{\fromaddress}}{}{}

where we define the helper function
\newcommand{\count@lines}[1]{\@count@lines@#1\\@@@}
\long\def\@count@lines@ #1\\#2@@@{%
  \ifstrequal{#2}{}{}{%
    \addtocounter{nlines@first}{-1}%
    \@count@lines@#2@@@%
  }%
}

for counting the number of lines in the "to" and "from" addresses.
Putting it all together into a MWE
\documentclass{letter}
\usepackage[left=3cm,right=4.5cm,bottom=3cm,top=2cm]{geometry}
\usepackage[nopar]{lipsum}

\setlength{\parindent}{1cm}
\usepackage{everyshi}
\AtNextShipout{\global\rightskip=-2.5cm\relax}

\usepackage{etoolbox}
\makeatletter

\newlength{\textwidth@wide}
\setlength{\textwidth@wide}{\textwidth}
\addtolength{\textwidth@wide}{2.5cm}

\newcounter{nlines@first}
\setcounter{nlines@first}{54}

\def\shp#1{%
\@tempcnta\z@
\loop
\advance\@tempcnta\@ne
\edef\pshape{\pshape 0pt #1 }
\ifnum\@tempcnta<\value{nlines@first}
\repeat
\advance\@tempcntb\value{nlines@first}
}

\def\reshape{%
  \begingroup%
    \@tempcntb\z@%
    \def\pshape{}%
    \shp{\textwidth}\shp{\textwidth@wide}%
    \def\par{\ifhmode\\\fi\hspace*{\parindent}\ignorespaces}%
    \parshape\@tempcntb\pshape%
}

\pretocmd{\opening}{\endgraf\endgroup}{}{}
\apptocmd{\opening}{
  \ifx\toaddress\@empty
  \else
    \expandafter\count@lines\expandafter{\toaddress}%
    \addtocounter{nlines@first}{-2}%
  \fi
  \addtocounter{nlines@first}{-4}%
  \reshape%
}{}{}
\patchcmd{\opening}{{\raggedleft\@date\par}}{\addtocounter{nlines@first}{-2}{\raggedleft\@date\par}}{}{}
\patchcmd{\opening}{\thispagestyle{empty}}{\thispagestyle{empty}\addtocounter{nlines@first}{-4}\expandafter\count@lines\expandafter{\fromaddress}}{}{}

\newcommand{\count@lines}[1]{\@count@lines@#1\\@@@}
\long\def\@count@lines@ #1\\#2@@@{%
  \ifstrequal{#2}{}{}{%
    \addtocounter{nlines@first}{-1}%
    \@count@lines@#2@@@%
  }%
}
\makeatother

\apptocmd{\letter}{\reshape}{}{}
\pretocmd{\endletter}{\endgraf\endgroup}{}{}

\address{W\\X\\Y\\Z}
\begin{document}
\begin{letter}{A\\B\\C\\D\\E\\F}
\opening{Hi,}
\lipsum[1-3]\par\lipsum[1-3]\par\lipsum[1-3]\par\lipsum[1-3]
\end{letter}
\end{document}

The problem with the scrlttr2 class is that \opening is more complicated, but I think if you find the height of everything that is shipped out before the letter begins, you could make this approach work. If not, you should be able to create a less general company letter head class around this approach.

A: For the simple case of a one page letter or a page break between paragraphs all we need is
\usepackage{everyshi}
\AtNextShipout{\global\rightskip=-2.5cm\relax}

Using a modified version of David's magic can handle the case where the page breaks in the middle of a paragraph.
\makeatletter
\newlength{\textwidth@wide}
\setlength{\textwidth@wide}{\textwidth}
\addtolength{\textwidth@wide}{2.5cm}

\def\shp#1{%
\@tempcnta\z@
\loop
\advance\@tempcnta\@ne
\edef\pshape{\pshape 0pt #1 }
\ifnum\@tempcnta<\value{nlines@first}
\repeat
\advance\@tempcntb\value{nlines@first}
}

\def\reshape{%
    \@tempcntb\z@%
    \def\pshape{}
    \shp{\textwidth}\shp{\textwidth@wide}%
    \def\par{\ifhmode\\\fi\hspace*{\parindent}\ignorespaces}%
    \parshape\@tempcntb\pshape%
}
\makeatother

David was careful to put this magic into a group, however, I cannot get it to work in a group inside the scrlttr2 letter environment. This means that there might be lots of unexpected side effects. It will only be used inside the letter environment group so it might not be so bad. In order for the reshaping to work requires knowing how many lines are on the first page. We can use the lineno package to do that.
\usepackage[pagewise]{lineno}
\makeatletter
\newcounter{nlines@first}
\renewcommand{\@LN}[2]{\ifstrequal{#2}{0}{\stepcounter{nlines@first}}{}}
\def\LineNumber{}
\makeatother

We then just need to patch \opening to setup line numbering and reshaping.
\usepackage{etoolbox}
\apptocmd{\opening}{\linenumbers\reshape}{}{}

Putting it all together
\documentclass[ngerman]{scrlttr2}
\usepackage{babel}
\usepackage[left=3cm,right=4.5cm,bottom=3cm,top=2cm]{geometry}
\usepackage[nopar]{lipsum}
\setlength{\parindent}{1cm}

\usepackage{everyshi}
\AtNextShipout{\global\rightskip=-2.5cm\relax}

\usepackage[pagewise]{lineno}
\makeatletter
\newcounter{nlines@first}
\renewcommand{\@LN}[2]{\ifstrequal{#2}{0}{\stepcounter{nlines@first}}{}}
\def\LineNumber{}
\makeatother

\makeatletter
\newlength{\textwidth@wide}
\setlength{\textwidth@wide}{\textwidth}
\addtolength{\textwidth@wide}{2.5cm}

\def\shp#1{%
\@tempcnta\z@
\loop
\advance\@tempcnta\@ne
\edef\pshape{\pshape 0pt #1 }
\ifnum\@tempcnta<\value{nlines@first}
\repeat
\advance\@tempcntb\value{nlines@first}
}

\def\reshape{%
    \@tempcntb\z@%
    \def\pshape{}
    \shp{\textwidth}\shp{\textwidth@wide}%
    \def\par{\ifhmode\\\fi\hspace*{\parindent}\ignorespaces}%
    \parshape\@tempcntb\pshape%
}
\makeatother

\usepackage{etoolbox}
\apptocmd{\opening}{\linenumbers\reshape}{}{}

\setkomavar{fromaddress}{Street}
\setkomavar{yourmail}{2013-01-10}
\setkomavar{subject}{Subject}

\begin{document}
\begin{letter}{My Name}
\opening{Hi,}
\lipsum[1-2]\par\lipsum[1-3]\par\lipsum[1-3]\par\lipsum[1-3]
\end{letter}
\end{document}

A: It is depreciated, but it will work for you (since you don't use memoir), the changepage package.
Simply enclose the content of the first page with \begin{adjustwidth}{<leftmargin>}{<rightmargin>} and \end{adjustwidth}, and complete with the additional margin you want on left and on right.For your specific problem:
\begin{adjustwidth}{}{+2.5cm}
    \lipsum
\end{adjustwidth}

Update: If you don't know where the page ends (which seems to be the case), you can use \changepage{<text height>}{<text width>}{<even-side margin>}{<odd-side margin>}{<column sep.>}{<topmargin>}{<headheight>}{<headsep>}{<footskip>} and add margin or change text limits on the page the command appear; the margins and limits will be reset to document values on the next page.For your specific problem it is simply:
\changepage{}{-2.5cm}{}{}{}{}{}{}{}

A: You can use the afterpage package which allows you to execute a command when a page break occurs.For you specific problem use it as follows:
\begin{document}

\rightskip=2.5cm
\afterpage{\global\rightskip=0.0cm}

\begin{letter}{Insert a name here}
\opening{Hi,}
\lipsum
\end{letter}

\end{document}


text:
Q: Running time of the probabilistic primality test Can you calculate the running time of the algorithm given below ?
Let us define polynomials $P_n^{(b)}(x)$ as follows :
$P_n^{(b)}(x)=\left(\frac{1}{2}\right)\cdot\left(\left(x-\sqrt{x^2+b}\right)^n+\left(x+\sqrt{x^2+b}\right)^n\right)$
Test in pseudocode :

Inputs: $n$ : a value to test for primality , $n>3$ ; $k$: a parameter that determines the number of times to test for primality
Output: composite if $n$ is composite, otherwise probably prime
Repeat $k$ times :
$\phantom{5}$ Pick $b$ randomly in the range $[-100,100]$
$\phantom{5}$ Pick $a$ randomly in the range $[2 , n − 2]$
$\phantom{5}$ If $P_n^{(b)}(a) \not\equiv a \pmod n$ , then return composite
If composite is never returned: return probably prime

You can run this test here .
GUI application that implements this algorithm can be found here .
My thoughts . Since this algorithm is similar to the Fermat primality test its running time should be somewhere around $O(k \times \log^3 n)$ where $k$ is the number of times we test a random values of $a$ and $b$ , and $n$ is the value we want to test for primality .

A: I can get an algorithm with running time $O\left(k\cdot\ln(n)\cdot M(n)\right)$.
Here $M(n)$ is the complexity of multiplication. If multiplication is left as the regular "school" multiplication, then $M(n) = \ln(n)^2$, and we attain a complexity of $O\left(k\cdot\ln(n)^3\right)$ as you remarked in your post. However, note that for $n$ large enough you may want to implement multiplication via some other method, for example by using the Schönhage and Strassen algorithm to attain a nultiplication complexity of $M(n) = \ln(n)\ln\left(\ln(n)\right)\ln(\ln(\ln(n)))$, thus the total running time becomes only $O\left(k\cdot\ln(n)^2\ln(\ln(n))\ln(\ln(\ln(n)))\right)$
The algorithm is (as you already remark) essentially the same as the Fermat primality test. In the Fermat test, one must compute $a^{n-1}\mod n$, this can be efficiently done using $O(ln(n))$ multiplication operations by using exponentiation via squaring. Since each multiplication operation deal with numbers up to the size of $n$ (since we are working modulo $n$), then each multiplication will take about $O(M(n))$ operations, so it takes $O\left(\ln(n)\cdot M(n)\right)$ operation to compute $a^{n-1}\mod n$ for a single $a$. Since we have to compute $k$ different values of $a$, then the total complexity rises to $O(k\cdot\ln(n)\cdot M(n))$.
This translates almost directly to your proposed algorithm with one caveat - we have to modify the modular exponentiation algorithm to efficiently compute $P_n^{(b)}(a)$ in $O(\ln(n))$ steps. The problem comes from the fact that exponentiating $x-\sqrt{x^2+b}$ is tricky, since it might not be a whole number (and using floating point arithmetic will lead to precision issues for large $n$).
S instead we will represent the numbers of the form $A+B\sqrt{x^2+b}$, where $A,B$ are whole numbers, by the pair $(A, B)$. Notice that we may define addition on the pairs as $(A,B)+(C,D)=(A+C, B+D)$, since $A+B\sqrt{x^2+b}+C+D\sqrt{x^2+b} = (A+C)+(B+D)\sqrt{x^2+b}$.
Similarly, we can define multiplication as $(A,B)\cdot(C,D) = (AC+BD\cdot(x^2+b), AD+BC)$ (you can verify this as an exercise).
Now we can calculate $\left(x\pm \sqrt{x^2+b}\right)^n$ by applying binary exponentiation techniques to the pair $(x,\pm 1)$ in $O(\ln(n))$ multiplications, since each $(A,B)$ pair multiplication requires a constant amount of regular integer multiplications. Afterwards, to gain $P_n^{(b)}(a) \mod n$ all we have to do is sum the two resulting pairs, divide them by $2$ (just divide each component) and we are done.
To speed this up (by a constant factor) one may notice that if $(x, -1)^n  = (A,B)$, then $(x, 1)^n = (A, -B)$ (it can be verified by using the binomial expansion, for example), so actually $P_n^{(b)}(a) = \frac{1}{2}\left((A,B)+(A,-B)\right) = (A, 0) = A$, so we only need to carry out the binary exponentiation for $(x, 1)^n$ and take the first component.
Notice also, that $(A, B) \mod n = (A\mod n, B\mod n)$ (well, this is a vit of a stretch, since $\sqrt{x^2+b}$ is kind of ambiguous when we are talking modulo some integer, but one can inductively prove, that the algorithm will return the same result no matter if we take only one modulo at the very end, or compute modulos every step). So in essence this means that we will never have to multiply numbers greater than $n$, so we have multiplication complexity of $M(n)$ as required.
So putting this all together we gain a complexity bound of $O\left(k\cdot\ln(n)\cdot M(n)\right)$ as claimed.
Note: A lot of work presented here is in a very rough state and in no means constiutes a formal proof of complexity, however I tried to outline many of the key concepts one might need to use when looking at this problem and trying to establish complexity.


text:
Q: Get Media player to get MP3 path adress from MySQL My uni project website can now play a music file from a url but what I need it to do now is to get the url address
from the mysql database. The url references the mp3 file's location on the server.
I am not sure where to insert the PHP within the media player plugin code (or whether it is possible at all).
Any advice would be appreciated.

<?php
$conn = mysql_connect("localhost", "ooze", "phu7eStu");
mysql_select_db ("ooze");
$query = ("select * from music where music_ID=1");
$result = mysql_query($query) or die(mysql_error()." ".$query);
while($row = mysql_fetch_array($result))
{
echo '<embed type="application/x-shockwave-flash" src="http://www.google.com/reader/ui/3523697345-audio-player.swf" flashvars="audiourl='$row[content]'" width="400" height="27" quality="best"></embed>';
}
mysql_close($conn);
?>

A: There's a lot of syntax errors in your code. You should take a look at debugging. This should work however:
<?php
$conn = mysql_connect("...", "...", "...");
mysql_select_db("...");
$query = "select content from music where music_ID = 1";
$result = mysql_query($query) or die(mysql_error() . " " . $query);
while($row = mysql_fetch_array($result))
{
    echo '<embed type="application/x-shockwave-flash" src="http://www.google.com/reader/ui/3523697345-audio-player.swf" flashvars="audiourl=' . $row['content'] . '" width="400" height="27" quality="best"></embed>';
}


text:
Q: Understanding JS compiling issues Im working through a quick blackjack game to learn some basics in javascript and I don't understand why my code isn't working correctly. Clearly something I don't understand about the fundamentals of JavaScript
const types = [
  "1",
  "2",
  "3",
  "4",
  "5",
  "6",
  "7",
  "8",
  "9",
  "10",
  "J",
  "Q",
  "K",
  "A"
];
const suite = ["Hearts", "Spades", "Clubs", "Diamonds"];
const draw = () => Math.floor(Math.random() * 52);
let cards = makeDeck(suite, types);
let score = 0;

//creates the card object
function Card(type, rank) {
  this.type = type;
  this.rank = rank;
}

//creates an array with every card
function makeDeck(suite, types) {
  let cards = [];
  let value = 0;
  for (let i = 0; i < suite.length; i++) {
    for (let j = 0; j < types.length; j++) {
      cards.push(new Card(types[j], suite[i]));
    }
  }

  return cards;
}

function determine(Card, score) {
  let test = 11;
  if (/^\d+$/.test(Card.type)) {
    test = parseInt(Card.type);
    console.log(test);
    return test;
  } else {
    if (Card.type === "J" || "Q" || "K") {
      test = 10;
      return test;
    } else {
      if (score > 11) {
        test = 2;
        return test;
      }
    }

    return test;
  }
}

function game() {
  let gameDeck = cards;
  let card1 = gameDeck[draw()];
  let card2 = gameDeck[draw()];
  let card3 = gameDeck[draw()];
  let card4 = gameDeck[draw()];
  let scorePlayer = determine(card1, score) + determine(card2, score);
  let scoreDealer = determine(card3, score) + determine(card4, score);

  console.log(scoreDealer);
  console.log(scorePlayer);
  console.log(card1, card2, card3, card4);
}

game();

So my concern is the determine function which seems to not work the way I intend it to. I have yet to implement a real scoring function but that shouldn't make a major difference at this point. Is there something incorrect with my usage of let and const?

A: if (Card.type === "J" || "Q" || "K") {
      test = 10;
      return test;
    }

This block is true always, irrespective of the value of "Card.type". Because when the Card.type is not equal to "J", javascript checks for if("Q")  which is always true. Similarly if("K") is also true. All these are truthy values in Javascript.
Javascript has 7 falsy conditions, except which all other conditions are true.
Try this code snippet in your browser console.
    if("Q") {
        console.log("This statement is true always")
    }

*

*Refer these two links for better understanding All falsey values in JavaScript
and https://developer.mozilla.org/en-US/docs/Glossary/Falsy


text:
Q: How can I fix the collapse navbar using reactjs I'm creating a static website using reactjs so I downloaded a template and I divide it on components using reactjs but the responsive collapse navdar doesn't work anymore and I'm trying to fix it so I tried many solutions but I got nothing.
There are no errors but the code still doesn't work.
can you help me please!
this is the navbar component.
import React, {useState,useEffect} from 'react';
import '../assets/css/style.css';
import '../assets/css/slick.css';
import '../assets/css/magnific-popup.css';
import '../assets/css/animate.css';
import '../assets/css/bootstrap.min.css';
import '../assets/css/home7fonts.css';
import Logo from '../assets/images/logos/logo-black.png'
function Header()
{
    const [toggleMenu, setToggleMenu] = useState(false)
    const [screenWidth, setScreenWidth] = useState(window.innerWidth)
    const toggleNav = () => {
        setToggleMenu(!toggleMenu)
    }
    useEffect(() => {
        const changeWidth = () => {
            setScreenWidth(window.innerWidth);
        }
        window.addEventListener('resize', changeWidth)
        return () => {
            window.removeEventListener('resize', changeWidth)
        }
    }, [])
    return (

                                <button onClick={toggleNav} type="button" className="navbar-toggle" data-toggle="collapse"
                                        data-target=".navbar-collapse">

                                </button>

                                {(toggleMenu || screenWidth > 500) && (

Home

about

services

FAQs

pricing

testimonial

blog

                                )}

                                Tell Us
                                +12 ) 235 - 586 - 56

                            Start Free Tral

            );
}
export default Header;

A: Go to https://getbootstrap.com/docs/5.1/components/navbar/ and Copy one collapse navbar you like. Past the code in your function components and change class to className, etc.
open your public folder at root directory. Find index.html. Add bootstrap Css between .
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">

Add Bootstrap JS after
,

then, reload your react project. See it work.


text:
Q: Solvable group inclusion to affine group Let $G$ be a solvable group and $X$ is a $G$-set which is transitive and faithful, with $|X|=p$ is prime. The aim is to prove

There is an injective homomorphism $i:G\to Aff(\mathbb{F}_p)$ and bijective $j:X\to\mathbb{F}_p$ such that $j(g\cdot x)=i(g)\cdot j(x)$.

(Intuitively, we want to give the set $X$ a group structure -- which then must be isomorphic to $\mathbb{F}_p$ -- such that the $G$-action is just an affine map, i.e., of the form $x\mapsto ax+b$.)
Let $G=G_n\triangleright\cdots\triangleright G_0=\{1\}$ be the composition series of $G$ (so $G_{i+1}/G_i$ is cyclic of prime order). I've proved that each $G_k$ action on $X$ is transitive and faithful. So we can proceed by induction on $n$, assuming the analogous result is true for $G_0,\ldots,G_{n-1}$.
For $n=1$, in fact the injection $i_1:G_1\to Aff(\mathbb{F}_p)$ can be chosen so that $i_1(g)$ is an affine map of the form $x\mapsto x+b$. Then I also proved $G_1\triangleleft G_n$. Let $x_0=j^{-1}(0)$. Consider the subgroup $H=Stab(x_0)$ of $G_n$. This is where I get stucked:

Prove that there is an injective homomorphism $\tilde{i}:H\to Aff(\mathbb{F}_p)$ such that $j(g\cdot x)=\tilde{i}(g)\cdot j(x)$ for all $g\in H,x\in X$, and, furthermore, $\tilde{i}(g)$ is an affine map of the form $x\mapsto ax$ for all $g\in H$.

If this is proved, I think I can finish the rest of the proof.

A: Up to now your results are (I leave out a lot of $j$ by actually identifying):
$N\lhd G$ with $N\cong\mathbb F_p$ operates on $\mathbb F_p$, where $N=\langle n\rangle$ operates by addition, i.e. $n\cdot x=x+1$.
We need to show that $g\in G$ with $g\cdot 0 =0$ operates as multiplication with $r$ where  $gng^{-1}=n^r$.
For $x\in \mathbb F_p$ we have $x=n^k\cdot 0$ for some $k$ and then
$$g\cdot x=gn^k\cdot 0 = (gng^{-1})^kg\cdot 0 = (gng^{-1})^k\cdot 0=n^{rk}\cdot0=\underbrace{x+\cdots +x}_r=rx.$$


text:
Q: Irregular jump of code while returning datatable Hi I have a c# code for an MDI Form such as this -
private void tlstrpmenuAppointments_Click(object sender, EventArgs e)
{
    Appointments AppointmentsObject = new Appointments(Controller.Ulink1);
    AppointmentsObject.MdiParent = FrmMainConsole.ActiveForm;
    AppointmentsObject.Show();
}

This MDI has a child form named Appointments which includes the following code -
private void Appointments_Load(object sender, EventArgs e)
    {
        cmbSearchColoumn.SelectedIndex = 0;

        lblDoctorName.Text =lblDoctorName.Text+" "+ dt.Rows[0].ItemArray[1].ToString() + " " + dt.Rows[0].ItemArray[2].ToString() + " " + dt.Rows[0].ItemArray[3].ToString();

        //Load todays Time Slots-
        DataTable temp = new DataTable();

        // **THE PROBLEM LIES IN THE FOLLOWING STATEMENT**
        temp = appointmentsCLObject.GetTimeSlots(docid);
       // THIS CALLS THE BAL STATED BELOW THIS CODE.

        cmbTimeSlotsAvailable.DisplayMember = temp.Columns[1].ToString();
        cmbTimeSlotsAvailable.ValueMember = temp.Columns[0].ToString();
        cmbTimeSlotsAvailable.DataSource = temp;
        cmbTimeSlotsAvailable.SelectedIndex = 0;

        //Loading Patient Lists for Consulting.
        dt1 = appointmentsCLObject.GetAppointments(DateTime.Now, Convert.ToInt16(cmbTimeSlotsAvailable.SelectedValue), docid);
        dtgridAppointments.DataSource = dt1;
    }

The BAL is AS Follows -
public DataTable GetTimeSlots(int Docid)
    {
        DateTime dt=new DateTime();
        dt = DateTime.Now;
        DataTable dtable= appointmentMLObject.GetTimeSlots(Docid,(int)dt.DayOfWeek);
        DataTable ReturnTable = new DataTable();
        foreach (DataRow rw in dtable.Rows)
        {
            ReturnTable.Rows.Add(rw[0].ToString(),rw[1].ToString()+" "+rw[2].ToString());
        }

        // **PROBLEM START**
        return ReturnTable;
    }

**When the return statement is called the code does not return to its calling method! (??)
Instead it returns to the MDI which has created the object of this child form.
It returns to the statement
AppointmentsObject.Show();

And shows me the form with no data in it.


text:
Q: MySQL InnoDB compression of INTEGER and DATETIME Reading the article How Compression Works for InnoDB Tables article I only find examples with data types like BLOB, VARCHAR and TEXT. Of course compression works best for these since you often have repeating patterns (at least for the character based types).
But how does it look for number or date columns (in my case INT and DATETIME)?
Can these types be compressed as well and what would be the best KEY_BLOCK_SIZE?
I have a table which looks like the following:
pk (INT) | account_id (INT) | time (DATETIME)
---------+------------------+--------------------
       1 |                1 | 2015/09/29 12:00:01
       2 |                1 | 2015/09/29 12:00:05
       3 |                2 | 2015/09/29 12:03:12
       4 |                2 | 2015/09/29 13:49:34
       5 |                4 | 2015/09/29 13:37:42

A: No, these are fields that you probably want to use to narrow down query results and should not be compressed. The fields that you want to compress are blobs, varchars, text... fields that are rather large and something you are not filtering on.


text:
Q: Referring with some 'Many images, including some of the attack on social workers, have been shot up close, making you feel involved in what they show.'
With 'some'  I mean some images. Is this clear or would you read it as some of the attack?

A: I think the problem is that 'some of the attack' stands too well on it's own and that makes it confusing.
I would say it's correct, but, I would rework the sentence so that it has the 'some' closer to 'images' e.g. 'some of the images of A were B, making you C.


text:
Q: Installing requests library to a target folder I'm trying to install the requests library to a target folder but I get this error:
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe:
No module named install.__main__; 'install' is a package and cannot be directly executed

What does this mean and how do I resolve it?

A: my issue was caused by the syntax I was using.  The syntax that worked for me is:
pip install requests -t C:\Users\YourUserName\Documents\AWS\LambdaSourceCode


text:
Q: Let $f: D_4 \rightarrow C_{24}$ be a homomorphism. Show that for all $a \in D_4$, the following is true $f(a)^2 = e$.
Let $f: D_4 \rightarrow C_{24}$ be a homomorphism. Show that for all $a \in D_4$, the following is true $f(a)^2 = e$.

What I thought we could do, was write out $D_4$, as it has just 8 elements.
$D_4 = \{1,\rho,\rho^2,\rho^3,\sigma,\sigma\rho,\sigma\rho^2,\sigma\rho^3 \}$ with $\sigma$ being the reflection, having order 2 and $\rho$ being the rotation, having order 4. Then we could just show for every element here the condition $f(a)^2 = e$ holds. As we know that $f(a)^2 = f(a^2)$, we know that the elements with an order that divides 2 out of $D_4$, work. That are $1$, $\rho^2$, $\sigma$ and $\sigma\rho^2$. We still need to show that the condition holds for the other elements of $D_4$.
That is where I don't know what to do anymore. Is what I have done correct? If so, how should I continue? Are there better ways of tackling such problems?
Thanks for reading,
K.

A: Let $\varphi:D_4\to C_{24}$ be an arbitrary homomorphism. Let $a,b\in C_{24}$ be such that $\rho\mapsto a$ and $\sigma\mapsto b$. Then we have two relations: $bab=a^{-1}$ and $b^2=0$. Since $C_{24}$ is commutative, these relations implies that $a=a^{-1}$, or that $a^2=0$. Hence, we have that $a^2=b^2=0$, so $\varphi(x)^2=0$ for any possible $x\in D_4$.
My original, incorrect answer. Thanks to Zoe H for pointing out where I went wrong.

I don't believe this is correct. Define a homomorphism $\phi: D_4\to\mathbb{Z}/24\mathbb{Z}$ given by $\rho\mapsto 6$ and $\sigma\mapsto 0$. Then $\phi(\rho)^2 = 12\ne 0$.

A:
Then we could just show for every element here the condition $f(a)^2 = e$ holds. As we know that $f(a)^2 = f(a^2)$, we know that the elements with an order that divides 2 out of $D_4$, work. That are $1$, $\rho^2$, $\sigma$ and $\sigma\rho^2$.

That's true, and a nice idea! But, it turns out that the only elements whose orders don't divide $2$ are $\rho$ and $\rho^3$: products of a single rotation and a single reflection (like  $\sigma \rho$) are reflections, and have order $2$.
Thus, to continue with this approach, you can focus on showing that $a^2 \in \ker f$ for $a \in \{\rho, \rho^3\}$ and any homomorphism $f\colon D_4 \to C_{24}$. You can see that $(\rho)^2 = \rho^2 = (\rho^3)^2$, so you just need to figure out why $\rho^2 \in \ker f$ for any $f$.
One approach to do that: It turns out that the commutator subgroup of $D_4$ is $\langle \rho^2 \rangle$ (although it suffices here to know only that $\rho^2$ is in the commutator subgroup). Assuming you've learned the theorem that "$G/\ker f$ is abelian if and only if the commutator subgroup of $G$ is contained in $\ker f$", look at the possibilities for $G/\ker f$. The only possible sizes for $G/\ker f$ here are $1, 2$, and $4$ (why not $8$?), and all groups of these orders are abelian.

An alternative approach is simply to look at the possible sizes for normal subgroups of $D_4$ (i.e., possibilities for $\ker f$) and use the first isomorphism theorem to think about $f(D_4) \cong D_4 / \ker f$.
As above, the only possibilities for $|f(D_4)| = |D_4 / \ker f|$ are $1, 2,$ or $4$.
Certainly there's nothing to worry about if $|f(D_4)| \in \{1,2\}$.
The only normal subgroup of $D_4$ having order $2$ is $\langle \rho^2 \rangle$ (the only other subgroups of order $2$ are those generated by a single reflection, and these are never normal), which happens to be the center $\Bbb Z(D_4)$ of $D_4$. Probably you've learned that $G / \Bbb Z(G)$ can never be cyclic, implying that $D_4 / \langle \rho^2 \rangle$, having order $4$ and not being cyclic, must be isomorphic to $C_2 \times C_2$, where every element has order dividing $2$.


text:
Q: Playing audio on Smartface IO I have been trying to play a sound on a click of a button and ive read everywhere and none of the solutions posted solved the problem.
I use the method stated on the docs website my file is an mp3 and its located in my resources/Sounds folder.
I have also read that there is a known issue in SMF. The only part that gets called in my playSound method below is the finished part
SMF.Multimedia.playSound("woop.wav",
        true, true,
        function() {
            alert("started to play...");
        },
        function() {alert("finished")});
I have the audio file located in resources/sounds folder I have also tried moving it around and I have tried different file formats but without any luck.
Does anyone know a working method to play audio or any concrete info regarding this bug in SMF

A: Upload "woop.wav" into assets folder.Then use this code to play it.
SMF.Multimedia.playSound("woop.wav",true, false);

I tried both .mp3 and .wav files on Android,it works.Here is the official gudie for Multimedia.


text:
Q: Cannot deserialize xml string with Newtonsoft.Json.JsonConvert.DeserializeObject Hi I am passing an xml as string
<AbcDto xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Abc">
  <Id>2</Id>
  <Description>sample string 4</Description>
  <Name>sample string 3</Name>
  <PolicyId>c17f5b9f-c9bf-4a3a-b09b-f44ec84b0d00</PolicyId>
  <Status>Active</Status>
  <TimeZoneId>USCentral</TimeZoneId>
</AbcDto>

When I am trying creating Custom Model Binder for Web Api
   public bool BindModel(System.Web.Http.Controllers.HttpActionContext actionContext, ModelBindingContext bindingContext)
        {
            var json = actionContext.Request.Content.ReadAsStringAsync().Result;
            if (!string.IsNullOrEmpty(json))
            {
                var jsonObject = (JObject) Newtonsoft.Json.JsonConvert.DeserializeObject(json);
                var jsonPropertyNames = jsonObject.Properties().Select(p => p.Name).ToList();

The json string passing as an parameter to the below method is an xml as string
I am facing exception at Newtonsoft.Json.JsonConvert.DeserializeObject(json);
Exception Details:
Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

A: You are getting an error because JsonConvert.DeserializeObject() expects JSON input, not XML.  If you want to handle XML with a JObject, you'll need to convert the XML to JSON first.  The JsonConvert class has a SerializeXmlNode() method for this purpose.
Demo:
class Program
{
    static void Main(string[] args)
    {
        string json = @"
        <AbcDto xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns=""http://schemas.datacontract.org/2004/07/Abc"">
          <Id>2</Id>
          <Description>sample string 4</Description>
          <Name>sample string 3</Name>
          <PolicyId>c17f5b9f-c9bf-4a3a-b09b-f44ec84b0d00</PolicyId>
          <Status>Active</Status>
          <TimeZoneId>USCentral</TimeZoneId>
        </AbcDto>";

        // If the json string contains XML, convert it to JSON
        if (json.TrimStart().StartsWith("<"))
        {
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(json);
            json = JsonConvert.SerializeXmlNode(doc, Formatting.None, true);
        }

        // Now you can load the JSON into a JObject
        var jsonObject = JObject.Parse(json);
        var jsonPropertyNames = jsonObject.Properties().Select(p => p.Name).ToList();
        foreach (string name in jsonPropertyNames)
        {
            Console.WriteLine(name);
        }
    }
}

Output:
@xmlns:i
@xmlns
Id
Description
Name
PolicyId
Status
TimeZoneId


text:
Q: VB.NET create (MS ACCESS like) "linked forms" NET (basic) I have on form1 a DGV1 displaying customer names (Dataset from SQL Database). I want to double-click on "a" customer name in DGV1, form1 and then see "Customer Details" in DGV2, form2.
I can make that on one form, easy DGV1 and DGV2 when select customer name in top DGV then bottom DGV updates accordingly. I want this on two forms as above explain.
Thanks,
Michelle

A: Try this one I think this the one that your looking for,
'This code below will hold the Value from your table
Dim CustomerName as String
'This code below will hold the value of the selected row in DGV1
Dim SelectedName As Integer
SelectedName = DataGridView1.CurrentRow.Index

Now here is what you do lets say the customers name is in Column1 now we will get that value like this.
CustomerName = DataGridView.Item(1, i).Value

So what happens everytime you select a data in column1 the value of that selected row goes to the CustomerName.
What is next you will do is create a Form2 add the Datagridview and in your code run this one.
Form2.Show
'Create your own way of display data in datagridview but this time your where clause is like this (where ColumName = '" & CustomerName  & "')

Regards


text:
Q: android image button tooltip I'm trying to build an app with image buttons that work like the action bar but i can't get them to show a tooltip on long press.
   <ImageButton
        android:id="@+id/editUrgent"
        style="?android:attr/borderlessButtonStyle"
        android:layout_width="48dp"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_toLeftOf="@+id/editImportant"
        android:hint="@string/hint_urgent"
        android:contentDescription="@string/hint_urgent"
        android:text="@string/hint_urgent"
        android:src="@drawable/clock_light" />

android:contentDescription works for hovering(s-pen) but long press still does nothing.

A: Solution that works in xml and supports minSdk less than 26
@BindingAdapter("tooltipTextCompat")
fun bindTooltipText(view: View, tooltipText: String) {
    TooltipCompat.setTooltipText(view, tooltipText)
}

and usage in layout.xml
app:tooltipTextCompat="@{@string/add_for_all_tooltip}"

A: With api level 26 you can use the built-in TooltipText:
Via XML:
android:toolTipText="yourText"

ViewCompatDocs
If your minSdk is below 26, use ToolTipCompat, for example:
TooltipCompat.setTooltipText(yourView, "your String");

Unfortunately, there's is no way to do this in your XML-File.

A: Not exactly what you are looking for but it does something very similar.
1) Insure your view is android:longClickable="true" (should be by default) and has a defined content description android:contentDescription="@string/myText":
<ImageButton android:id="@+id/button_edit"
     android:contentDescription="@string/myText"
     android:src="@drawable/ic_action_edit"
     android:onClick="onEdit"
     android:longClickable="true"/>

2) Register a callback to be invoked when the view is long pressed. Handler will display the content description as a toast message.
findViewById(R.id.button_edit).setOnLongClickListener(new View.OnLongClickListener() {

            @Override
            public boolean onLongClick(View view) {
                Toast.makeText(context,view.getContentDescription(), Toast.LENGTH_SHORT).show();
                return true;
            }
        });

A: This is the code that Support Library v7 uses to show "cheat sheet"s for action menu items:
public boolean onLongClick(View v) {
    if (hasText()) {
        // Don't show the cheat sheet for items that already show text.
        return false;
    }

    final int[] screenPos = new int[2];
    final Rect displayFrame = new Rect();
    getLocationOnScreen(screenPos);
    getWindowVisibleDisplayFrame(displayFrame);

    final Context context = getContext();
    final int width = getWidth();
    final int height = getHeight();
    final int midy = screenPos[1] + height / 2;
    int referenceX = screenPos[0] + width / 2;
    if (ViewCompat.getLayoutDirection(v) == ViewCompat.LAYOUT_DIRECTION_LTR) {
        final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
        referenceX = screenWidth - referenceX; // mirror
    }
    Toast cheatSheet = Toast.makeText(context, mItemData.getTitle(), Toast.LENGTH_SHORT);
    if (midy < displayFrame.height()) {
        // Show along the top; follow action buttons
        cheatSheet.setGravity(Gravity.TOP | GravityCompat.END, referenceX, height);
    } else {
        // Show along the bottom center
        cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height);
    }
    cheatSheet.show();
    return true;
}


text:
Q: Why won't ChartLabel print the right country under the right bar chart? I'm working on an assignment and I can't seem to print out the right country name under the right bar chart. What is the problem? Why does the second country only print out?

Ignore some of the words (they are in Swedish).
Thanks in advance!

A: Got some GDP data to work with from WA.
gdpList = {{"world",
   Quantity[8.77985258592209`*^13, ("USDollars")/(
    "Years")]}, {"Qatar",
   Quantity[1.75837550996185`*^11, ("USDollars")/(
    "Years")]}, {"Kuwait",
   Quantity[1.3462854274697`*^11, ("USDollars")/("Years")]}, {"UAE",
   Quantity[4.2114226793765`*^11, ("USDollars")/(
    "Years")]}, {"Bahrain",
   Quantity[3.85740691489362`*^10, ("USDollars")/(
    "Years")]}, {"Brunei Dar es Salam",
   Quantity[1.34694229585105`*^10, ("USDollars")/("Years")]}}

Extracted labels (i.e., First column of All rows)
gdpLabels = gdpList[[All, 1]]

{"world", "Qatar", "Kuwait", "UAE", "Bahrain", "Brunei Dar es Salam"}

Similarly the second column of All rows has data to be plotted.
(Note: World data is orders of magnitude larger so we plot Rest@gdpdata otherwise not much else is visible.
 BarChart[Sort@Rest@gdpList[[All, 2]],
 BarOrigin -> Left,
 ChartLabels -> Placed[Sort@Rest@gdpLabels, Before],
 AxesLabel -> {"ylabel", "xlabel"},
 ImageSize -> Large,
 PlotLabel -> "The Plot Label"
 ]


text:
Q: Finding the index of an entry in a linked list in better than O(n) time I have a scenario where I'm pushing change-lists to another system.  Each list contains zero or more inserted, updated or deleted notifications.
Inserting is easy; the notification contains the target index and a pointer to the item.  Updating is easy; I pass a pointer to the item.
Deleting seems straight-forward; I need to pass the index of the item to delete, but how do I know the index?  Indexes start at zero and must be contiguous, but I make them up at insertion time.  So I need to keep track of the index I make up for each item.
I can do this with, for example, a map: std::map<item*, int>, but then when I remove an item, I have to go re-number everything past it, which is O(N).
These lists of items are going to be large to the point where O(N) iteration is not acceptable.  I'm sure this problem has been solved, I just don't know what the solution would be called.  Searching for anything related to "linked list" creates a ton of noise.
One possible solution is a skip-list, where each node in the sublists knows how many nodes in the main list it skips, and since searching a skip list is O(log N) we can keep track as we go and find the index in O(log N) and also delete items in O(log N).
However implementing a skip-list seems like overkill here... is there a simpler solution?
EDIT:
Thanks all for your suggestions, but I think I've convinced myself the skip list is the right way to solve this problem here.

A: See Finger Trees: A Simple General-purpose Data Structure by Hinze and Paterson.
See also the nice illustrations in MarkCC's blog post on finger trees.

A: edit: My previous solution was flawed std::vector::erase() is linear when moving elements. My new suggestion extends my previous comment to your question.
If you just work with pointers in the list, you can set the pointer to 0 after calling delete on the pointer, keeping the indices/keys valid. Then you should be able to use increasingly larger indices until the next index goes beyond std::numeric_limits<int>::max().
Then, when a larger portion of your list contains unused pointer elements set to zero, perform a synchronized cleanup of zero-pointers on both sides of the communication channel, followed by a recalculation of the indices. I don't know a good heuristic for this off the cuff, but you could keep track of the number of zero pointers, and compare it to the overall list size.
In fewer words, since calculation of the indices is O(n), delay it until you absolutely have to.

A: Couldn't you keep the deletion history and compensate for this when you do the lookup in the std::map<item*, int>?
What I mean is that the index in the std::map represents the original index of the item and then you have an auxillary map std::map<int, int> which stores how many times a given index has been deleted?
item* todelete; //from somewhere
std::map<int, int> history; //stored somewhere
std::map<item*, int> itemIndices; //stored somewhere
const int originalIndex = itemIndices[todelete]; //index of item at insert time
int index = originalIndex;
for (std::map<int, int>::const_iterator it = history.begin(); it != history.end() && it->first < originalIndex; ++it) {
    index -= it->second;
}
// index has now been compensated for previous deletes
// ... send the delete request with 'index'
// update the history with this delete request
std::map<int, int>::iterator it = history.find(index);
if (history.end() == it) {
    history[index] = 1;
} else {
    ++it->second;
}

The speed of this will of course depend on the size of the history.
/A.B.

A: How often will deletion occur? I'm thinking of keeping your solution using std::map<item*, int>, but instead of updating the map upon deletion replacing the item in the linked list with a "NULL"-item to ensure that the indices in your lookupmap remains valid. This may not be a good solution if you will see frequent deletions and there's a chance you will run out of memory. Also, you could do this and have a reindex()-method that removes any NULL item from the linked list and assigns new indices to all items.
Sidenote 1:
Can't you pass the pointer to item being deleted as you do in update? If the you do this and use a double-linked list the deletion operation could be performed easily in O(1).
Sidenote 2:
Consider using boost::unordered_map over std::map.

A: Skip List is the correct solution.


text:
Q: Is there a way to mark specific lines in BBEdit and then iterate through them? I often find myself jumping between several parts of a lengthy document, and I've found no streamlined way of handling this. I've previously used TextPad for PC, and it had a great feature called Bookmarks:

*

*Press a keystroke, and the current line is marked. The bookmark shows as an arrow in the gutter.

*The same key toggles the marker off again.

*Another keystroke sends the caret down to the next bookmark.

*Yet another keystroke sends the caret up to the previous bookmark.

Is there anything like this in BBEdit? I loved that feature of Textpad, but I haven't found another editor that has something similar. Currently I use the awkward substitute of typing three slashes /// at a place I want to jump back to, then using Ctrl+F to re-find them, but that's a lot of keystrokes to set/remove markers and to iterate through them.
Thanks!

A: I think what you are after is BBEdit Markers.
This article is a good place to start: macdrifter.com/2012/01/bbedit-markers.html


text:
Q: Error creating bean with name 'dataSourceScriptDatabaseInitializer' I have developed a Spring Boot application with PostgreSQL.
I am trying to run my Spring Boot application, but I don't know why I am getting these two errors:

*

*

Error creating bean with name 'dataSourceScriptDatabaseInitializer': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)

*

j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

And also the application is get shutdown as soon as it started.
HikariPool-1 - Shutdown initiated...
 o.s.s.s.TaskUtils$LoggingErrorHandler    : Unexpected error occurred in scheduled task
com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.nextuple</groupId>
    <artifactId>oms</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>oms</name>
    <description>Project for OMS</description>
    <properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.modelmapper</groupId>
            <artifactId>modelmapper</artifactId>
            <version>3.1.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

application.properties
server.port:9090
spring.datasource.url=jdbc:postgresql://localhost:5432/orderdetails
spring.datasource.username=postgres
spring.datasource.password=root
spring.jpa.hibernate.ddl-auto=create
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.datasource.hikari.auto-commit=false

//main
@SpringBootApplication
@EnableScheduling
public class OmsApplication {

    public static void main(String[] args) {
        SpringApplication.run(OmsApplication.class, args);
    }

    @Bean
    public ModelMapper modelMapper(){
        return new ModelMapper();
    }
}


text:
Q: Provide an individual user with access to a specific web-site for windows-base IT At work, I need access to youtube to watch some training material. My request to IT was denied on the grounds that it is not suitable for business use, however when I questioned them about this I got the reply:

Access to Youtube is blocked by policy for bandwidth reasons.  It is
  not physically possible to open up access to specific videos within
  YouTube or enable access for specific individuals.  To enable access
  we would need to open up the whole of YouTube to the whole business.
  The knock on effect would mean that the internet would grind to a halt
  on our network as video streaming utilises a lot of bandwidth.

Is it just me, but in my opinion this must be possible or there must be some other options available to solve this? - (i.e. provide me access but no-one else) - put me in DMZ for instance?
Unfortunately I can't give details of what firewall or other IT "things" they have in place (because I don't know), so my question is necessarily vague.
In my mind this is a failing of IT. Can anyone who works in IT (or anyone who knows about this stuff) provide any insite/answers to this?
If it helps, I am running windows 7 64-bit.

A: If your IT run an authenticated proxy then it is entirely achievable. If not then, as they say, it's all or nothing.
It would also be down to whether their equipment allows such granular access. Authenticated proxies allow  access as each valid user requests a connection. Access lists can be created with various rules to block/allow as necessary to the people/devices in the list. Business proxy servers are usually highly configurable...


text:
Q: Is it better to use .delegate() performance wise? One of the developers I work with began to write all his code this way:
$('.toggles').delegate('input', 'click', function() {
   // do something
});

vs:
$('.toggles').click(function() {
   // do something
});

Are there any performance benefits to doing this?

A: delegate() is superseded as of jQuery 1.7.
Use .on() instead.

.on() has excellent performance benchmarks. And covers your .click() needs as well as needed

A: As frenchie stated, in the latest version of jQuery, both functions end up mapping to jQuery.on.
In the jQuery code, you can see that delegate is really just a wrapper for on:
delegate: function( selector, types, data, fn ) {
    return this.on( types, selector, data, fn );
},

Then, when jQuery binds click (as well as other events) it calls into on as well:
jQuery.each( ("... click ... ").split(" "), function( i, name ) {

// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
    if ( fn == null ) {
        fn = data;
        data = null;
    }

    return arguments.length > 0 ?
        this.on( name, null, data, fn ) :
        this.trigger( name );
};
...
});

A: Yes, and in fact, there's an even better way to do it, with .on(): take a look at this

A: As suggested you can use .on(). As far as your question is concerned, .on() and also .delegate() for that matter has better performance than binding events to the target directly. That is because these binders listens to an element which is higher in the DOM tree and then checks the target, as the pool of your targets increases .on() and .delegate() will surely give you performance benefit.
And in general, they will always be more efficient.

A: I'm pretty sure that if all the items of class "toggles" are present when that binding is made, that delegate() would be less efficient.  It binds to everything of class "toggles", and then, when one of those elements is clicked, checks to see if the actual DOM object being clicked is an input.
click(), on the other hand, is a shortcut for bind(), which binds directly to everything of class "toggle" and always triggers when that DOM item is clicked.
The only reason to use delegate() would be if inputs are added inside items of class "toggle" after the binding is made.
This also applies to using different overloads of on(), which replaces delegate() and bind() (and by replacing bind, also replaces click()).

A: Yes it is. Using .delegate will reduce the number of event handlers.
Suppose you have a table in your page and you want to attach click handler to each .
Instead of attaching event handler to individual s attach it to the table:
$("#myTable").delegate("click", "td", function() {
    //do some thing on click of td
});

When you click on the  the event will bubble up to the table. Here by using delegate we can reduced the number of event handlers, which improves the performance.
delegate is deprecated in latest version of jQuery use .on instead it works like delegate.

A: There's another addition that you should be aware of concerning the use of on (delegate in older versions) vs click:
if you do this :
 $("a").click(function() {
  alert("Click on link detected");
  $(this).after("New link");
});

your new link will not be attached to the "a" click handler even though it should because it is a link.
however if you use on :
$("a").on("click", function(event){
   $(this).after("Nouveau lien");
});

with this the new link responds to the click event with the click handler.


text:
Q: How to set okta configuration dynamically? Suppose Two different customer having their respective client-id,client-secretkey,okta-domain. Based on my research on okta, I found that these parameters are to be set in application.properties file. How to set these parameter dynamically so that customer should redirect to their respective domain login page?
Edit :-
customer 1:-
a)DOMAIN :- dev-1234.okta.com
b)CLIENT_ID :- abcd
c)CLIENT_SECRET_KEY :- efgh

customer 2 :-
a)DOMAIN :- dev-5678.okta.com
b)CLIENT_ID :- hijk
c)CLIENT_SECRET_KEY :- lmno

Suppose I select customer 2 , so customer 2's data should be set as environment variables(values in application.properties or application.yaml) ,but in spring boot there isn't any way to set environment variable dynamically.

A: You can use environment variables to set the properties for your respective apps. For example:
OKTA_OAUTH2_ISSUER=https://{yourOktaDomain}/oauth2/default \
OKTA_OAUTH2_CLIENT_ID={yourClientId} \
OKTA_OAUTH2_CLIENT_SECRET={yourClientSecret} ./mvn spring-boot:run

A: Dhanraj, I'm not fully understanding your question, but Spring Boot has many options to configure variables. This is briefly covered here and more in-depth here.
I'd recommend looking at Spring Cloud Config too.
I've also seen folks write a custom Java Agent to configure System Properties before Spring loads (but this is sort of what cloud config does anyway.)


text:
Q: TableRow is giving reverse TextViews I am developing app in which I am showing attendance of students in a monthly manner with help of table. I have array of attendance values as'p' and 'a' and applied logic to show colors accordingly. I am creating a tableRow and TextView elements from java file. like the image here:
I want to show the days of month as 1,2,3,... upto last day. But the image is showing the numbers in reverse order. Here is the java code I am using to get that views.
int daysCounter = 0;
for(int j=0; j<5; j++) {
    TableLayout tableLayout = (TableLayout)findViewById(R.id.tl);
    TableRow tableRow = new TableRow(AttendanceActivity.this);
    TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT);
    tableRow.setLayoutParams(layoutParams);
    //days variable contains the no. of days in that month
    for (int i=0; i<7 && daysCounter<days; i++) {
        TextView textView1 = new TextView(AttendanceActivity.this);
        textView1.setText("" + (daysCounter+1));
        tableRow.addView(textView1, 0);
        //setColor() method sets color according to values
        //arr is an array of attendance values
        switch (setColor(arr[daysCounter])) {
            case "red":
                textView1.setBackgroundColor(getResources().getColor(R.color.red));
                break;
            case "green":
                textView1.setBackgroundColor(getResources().getColor(R.color.green));
                break;
            default:
                textView1.setBackgroundColor(getResources().getColor(R.color.white));
                break;
        }
        daysCounter++;
    }
    tableLayout.addView(tableRow);
}

As seen in the code, the loop is quite straightforward. I am not getting why the numbers are printing as reverse and How to fix them. Please help. Working from long time on this.

A: you need to change the index of item while adding into tableRow.
Replace the code
tableRow.addView(textView1, 0);

to
tableRow.addView(textView1, i);

I have checked this in the sample app, it is working. let me know it working or not.
Thanks


text:
Q: Spotfire: calculating difference between two rows in same column based on attributes in different columns I am new to Spotfire and need help in getting the right expression for a calculated column.
My Data contains different subjects grouped in column ID. For every ID, Bodyweight was measured on different days. Days are given in column Day and stated as 1,2,3...
The last day is denoted by Last and Bodyweight measurements given in another column. Another column is present which is called Baseline. The Body weight measured is considered as baseline if the column contains a Y for that row.
I need to insert a calculated column, which will contain the difference between Body measurement measured on Day denoted Last and  Body measurement  marked by Y in column Baseline.
This should be done for every new ID. I am not able to figure this out. Could someone advise me on how to go about it?
Here is an example attached

So, the calculated column for Rita will give -4 (body weight at Last=56 and BodyWeight at baseline=56, so 52-56 =-4)

A: the sample data you provided is a little weird, particularly the [Day] column. if it's within your control, I suggest to use actual dates rather than a number/string here.
barring that, I was able to get your desired results, but it required two calculated columns: the first one will consolidate the [Day] and [Baseline] columns into a single column, and the second one contains your desired info.
column 1, which I called Day (int):
CASE
  WHEN [Day]="Last" THEN 1000000
  WHEN [Baseline]="Y" THEN -1000000
  WHEN [Day]!="Last" THEN Integer([Day])
END

I picked a random high and low max to establish a chronological order. this will put 1000000 in place of "Last" (if you have any programs that are longer than one million days, you'll need to increase this number). the same for the [Baseline] column, but that value will be -1000000, which is presumably the lowest value you will ever see in this column. both of these are assumptions and may not work for your implementation. finally, in all other cases, the day number will be used.
column 2, which I called Diff:
Last([Weight]) OVER (Intersect([Name],LastNode([Day (int)]))) -
First([Weight]) OVER (Intersect([Name],FirstNode([Day (int)])))

the first line uses what's called an OVER expression to retrieve the first value for [Weight], ordered by [Day (int)], per [Name]. the second line gives the reverse of that, and so the difference is calculated as -4 (or whatever is appropriate).


text:
Q: Are cascading replicas still a thing for RDS MySQL? I can find traces on the internet that this was an option a while back, at least for MySQL 5.7 (for example: https://aws.amazon.com/rds/faqs/ still says: Amazon Aurora, Amazon RDS for MySQL and MariaDB: You can create a second-tier read replica from an existing first-tier read replica.)
Despite all the effort I can't figure out how to add a second tier read replica to an "first tier" replica of a MySQL 5.8 master. The option "Create read replica" is simply disabled if I have selected a read replica. The option to "Create Aurora read replica" is however prominently available.
So... Can anyone tell, Is it just me or has this option been dropped to drive more people towards Aurora?

A: Well, I figured it out.
It's necessary to enable backups for the first tier replica. That is, set the "Backup retention period" higher than 0.
Makes sense in retrospect.


text:
Q: Which should I use? SQL Triggers or Cron Jobs? I am working on a scheduling system that allows for content managers to add content that will go live at a later set date. My SQL/PHP knowledge is not the greatest and after some extensive research I am finding it difficult to figure the best option to use when building this system. Should I use Cron Jobs? or SQL Triggers?
I am looking to make it so I can also execute some PHP along with the SQL commands that will set the content to live.

A: I would use neither. I'd have a 'goLive' datetime and a 'retire' datetime for each piece of content. Then when you select which content to show, you'd have a where clause like this
where current timestamp between goLive and retire

Then your content appears at the 'goLive' time and disappears at the 'retire' time.

A: Thanks for all of the responses, all of it has been super useful in helping me come to a conclusion. I will be using Cron Jobs to get this specific job done.


text:
Q: Laravel update pivot timestamps to specific date instead of attach date I have a one to many relationship which is using a pivot table to attach related models.
The standard timestamps are working correctly and the created_at / updated_at are getting populated with the dates when the relationshi gets created or modified.
However, I have a case where I would like to override the timestamps values.
I would like to do something like this :
$user->tickets()->attach($ticket->id)
->withTimestamps(['created_at' => '2021-01-01 00:00:01','updated_at' => '2021-01-01 00:00:01']);

Can anyone please help ?

A: As confirmed by @N69S, the correct syntax to include or override column values during attach is to pass an associative array of nested columns:
$user->tickets()->attach([
  $ticket->id => [
    'created_at' => '2021-01-01 00:00:01',
    'updated_at' => '2021-01-01 00:00:01'
  ]
]);

This should add a record to your pivot table with the correct User ID, Ticket ID and overridden timestamps.


text:
Q: How to Access WLAN TSF Values How do I access WLAN TSF timer? I have investgated Windows SDK WLANapi, but cout not find any fuction to access TSF values.
Thanks

A: The value of the Timing Synchronization Function is not available on OS level. You can read it from transmitted Wi-Fi frames, though, by looking at the radiotap.mactime in the radiotap header of Wireshark.


text:
Q: cannot upgrade Kubuntu 14.10 I have Kubuntu 14.10 with Linux desktop001 3.16.0-30-generic #40-Ubuntu SMP Mon Jan 12 22:06:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux kernel and when I issue command for system upgrade: clear && sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove, the updare stops at: 100% [Waiting for headers] and after some time I get warnings and error:
W: Failed to fetch http://cz.archive.ubuntu.com/ubuntu/dists/saucy/main/binary-i386/Packages  0  Requested Range Not Satisfiable [IP: 217.31.202.63 80]

W: Failed to fetch http://cz.archive.ubuntu.com/ubuntu/dists/saucy/universe/binary-i386/Packages  0  Requested Range Not Satisfiable [IP: 217.31.202.63 80]

W: Failed to fetch http://ppa.launchpad.net/inameiname/stable/ubuntu/dists/utopic/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/inameiname/stable/ubuntu/dists/utopic/main/binary-i386/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.

This is first time I cannot upgrade system, why?!

A: It might have something to do with your internet, you might also try making a new sources.list using the website http://repogen.simplylinux.ch/

A: Edit your sources.list file as the superuser.
sudo kate /etc/apt/sources.list

Comment out the following line:
deb-src http://ca.archive.ubuntu.com/ubuntu/ saucy-security universe restricted multiverse main #Added by software-properties

It worked for me.
URL : https://www.kubuntuforums.net/showthread.php?58645-Error-when-updating.


text:
Q: Sequence existing for a set of conditions
Let function $f$ is continous and limited on the interval $(x_0, +\infty)$.
Prove $\forall \ number \ T \ \exists \ sequence \ \{x_n\},\  \lim_{n \to\infty}{\{x_n\}} = +\infty $:
$$lim_{n \to\infty} (f(x_n+T) - f(x_n)) = 0$$

If $f$ is sinus,for example, it doesn't seem to be true...
I have no thoughts to prove it.

A: Hint: Take any $T \ge 0$. Let $g(x) = f(x+T) - f(x)$ for each $x \in [x_0,\infty)$. Then $g$ is continuous on $[x_0,\infty)$. Also, for every $x \ge x_0$ such that $g(x) > 0$, and any $ε > 0$, there is some $y > x$ such that $g(y) \le ε$, otherwise $f(x+kT) - f(x) > kε$ for every $k \in \mathbb{N}$, which contradicts the boundedness of $f$. By intermediate value theorem we can strengthen this to $0 \le g(y) \le ε$. Similarly for every $x \ge x_0$ such that $g(x) < 0$, and any $ε > 0$, there is some $y > x$ such that $-ε \le g(y) \le 0$. Using this we can now construct each $x_n$ by induction, and then use the axiom of dependent choice to obtain the desired sequence.


text:
Q: Attribute to apply to non-OK responses If I have controller GET methods, such as:
    [HttpGet]
    [Route("accountrecv({accountid})/promisepay", Name = "GetPromisePay")]
    public HttpResponseMessage GetPromisePay(int accountid)
    {
        var query = Request.RequestUri.Query;
        var uri = new Uri(Client.Instance.BaseAddress.ToString() + accountid + "/promisepay" + query);
        var request = new HttpRequestMessage { RequestUri = uri, Method = HttpMethod.Get };
        var response = Client.Instance.SendAsync(request);
        return response.Result;
    }

How can I impose behavior on all responses where the HttpStatusCode is NOT ok?
I imagine I would create an attribute at the method level, such as:
[NonOKResponse]
[HttpGet]
[Route.......]
public HttpResponseeMessage GetPromisePay(int accountid)
{
//my code
return response.Result //but force it here to return 404 for EVERY response other than 200
}

How can I define an attribute that I can use on all GETs to force a specific response based on some criteria?

A: I believe this article answers your question.  You can use the ExceptionFilterAttribute to handle and manage exceptions.  For example:
public class GeneralExceptionFilterAttribute : ExceptionFilterAttribute
{
    public override void OnException(HttpActionExecutedContext context)
    {
        context.Response = new HttpResponseMessage(HttpStatusCode.NotFound);
    }
}

A: It sounds like you want a Result Filter.
https://learn.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/controllers-and-routing/understanding-action-filters-cs


text:
Q: Exchange 2010 Impersonation trouble when requesting a User's Calendar Availability Details I'm working on project where an external application is trying to get the availability info (Free/busy) along with the details (Location/Subject/etc) for group of users in Exchange 2010.
I've read enough that I think that the best way to do this is through a service account run by the application that impersonates the user in question and pulls back their calendar information.
I've set up impersonation for the service account and run the basic test that I found on technet: http://msdn.microsoft.com/en-us/library/bb204088(v=exchg.140).aspx
This works for pulling back the mailbox folder (as the example) and if try to pull back the calendar folder.
I also found how to get availability via technet:
http://msdn.microsoft.com/en-us/library/aa563800(v=exchg.140).aspx
which will also work if I login as the user that I'm trying to find the calendar info for.
The problem comes when I try to combine both the impersonation XML with the get availability. Here is what I have for the two combine:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
           xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Header>
<t:ExchangeImpersonation>
  <t:ConnectingSID>
    <t:PrincipalName>[usersname@myorg.org]</t:PrincipalName>
  </t:ConnectingSID>
</t:ExchangeImpersonation>
</soap:Header>
  <soap:Body>
   <GetUserAvailabilityRequest xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
  <t:TimeZone xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
      <Bias>300</Bias>
      <StandardTime>
        <Bias>0</Bias>
        <Time>02:00:00</Time>
        <DayOrder>1</DayOrder>
        <Month>11</Month>
        <DayOfWeek>Sunday</DayOfWeek>
      </StandardTime>
       <DaylightTime>
         <Bias>-60</Bias>
         <Time>02:00:00</Time>
         <DayOrder>2</DayOrder>
         <Month>3</Month>
         <DayOfWeek>Sunday</DayOfWeek>
       </DaylightTime>
     </t:TimeZone>
     <MailboxDataArray>
        <t:MailboxData>
          <t:Email>
            <t:Address>[usersname@myorg.org]</t:Address>
          </t:Email>
          <t:AttendeeType>Required</t:AttendeeType>
          <t:ExcludeConflicts>false</t:ExcludeConflicts>
        </t:MailboxData>
      </MailboxDataArray>
      <t:FreeBusyViewOptions>
        <t:TimeWindow>
          <t:StartTime>2011-07-28T00:00:00</t:StartTime>
          <t:EndTime>2011-07-28T23:59:59</t:EndTime>
        </t:TimeWindow>
        <t:MergedFreeBusyIntervalInMinutes>5</t:MergedFreeBusyIntervalInMinutes>
        <t:RequestedView>DetailedMerged</t:RequestedView>
      </t:FreeBusyViewOptions>
    </GetUserAvailabilityRequest>
  </soap:Body>
</soap:Envelope>

What I get back is this:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <s:Fault>
      <faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorProxyRequestNotAllowed</faultcode>
      <faultstring xml:lang="en-US">Client context header found but no request type found in SOAP header.</faultstring>
      <detail>
        <m:ErrorCode xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">5015</m:ErrorCode>
      </detail>
    </s:Fault>
  </s:Body>
</s:Envelope>

Digging around a little more in technet, the ErrorProxyRequestNotAllowed info:
"This error indicates that the request that Exchange Web Services sent to another Client Access server when trying to fulfill a GetUserAvailability request was invalid. This response code typically indicates that a configuration or rights error has occurred, or that someone tried unsuccessfully to mimic an availability proxy request."
What I'm having trouble with, is how impersonation seems to be working in the cases where I'm pulling back the user's mail and calendar folders, but not working for the case where I want to check their availability.
Right now, I'm just sending the straight XML via curl (wrapped in a little python script).
Anyone have any pointers? Thanks in advance!

A: I finally found a few (old) references that this is known feature/bug with GetUser[blank]Request style calls and Impersonation.
The two just do not work together. I hope this save someone a little time.


text:
Q: Should I remove "$user" from the PostgreSQL search_path? The default setting for search_path is "$user",public. According to the manual:

The first element specifies that a schema with the same name as the
  current user is to be searched. If no such schema exists, the entry is
  ignored.

At what point will the existence of a $user schema be checked? At the start of the session? Or maybe every time an unqualified object needs to be resolved? If I know that I will only ever be using the "public" schema in a database, would it make sense to remove the "$user" entry?
I realize that this won't make a noticable difference in performance either way, but it might make the setup more explicit... why have something in the search_path that's never going to be used?

A: If you

know that I will only ever be using the "public"

.. it makes perfect sense to remove $user from the search_path. You have nothing to gain from it.
I do that in all my clusters anyway.


text:
Q: Difference between "There is to be" "there has to be" "There is to be an urgent ministerial review of language learning."
Does this mean that the review is going to take place, or does this mean that there should be a review? I am a little clueless.

A: "There is to be" seems to imply that some event is going to take place but tends towards speculation, it should happen, it's scheduled.
"There has to be" strongly references an idea of something that MUST happen, it is an imperative statement but can also be interpreted as an expression to declare hope.


text:
Q: Why am i getting authorization errors while using a personal access token? I'm using the Visual Studio Team Services .NET libraries to perform source control through a class library of mine. I'm also using a personal access token for authentication, previously set through the VSTS web client.
I'm trying to perform basic actions like check in, out, adding pending changes, create folder mappings etc, and i'm getting an "attempted to perform an unauthorized operation" error when i previously add no problem doing these tasks. I was running my .dll on the server it's supposed to be running when it's done and because i was getting this error i tweaked a few lines of code and then just tested the whole thing on my machine again. It doesn't work anymore at all.
What's weird, though, is that when i try to change the working folder mapping for example, i get this error but the new local path gets assigned just fine.
Any reason why an authenticated VSTS user would have these problems?

A: Using PAT (personal access token) to authorize your .NET libraries, you should VssBasicCredential, such as below example:
string personalAccessToken = "bnsz6p2efh3vljhjoay4rnaznliygu9vngoqgcwel7gwlati8cxq";
VssBasicCredential credentials = new VssBasicCredential("", personalAccessToken);

More details, you can refer .NET client libraries.
Besides, you can also use Alternate authentication credentials. VSTS account -> security -> Alternate authentication credentials (https://account.visualstudio.com/_details/security/altcreds) -> Enable alternate authentication credentials -> set secondary username and password -> save.

Then you can authorize your .NET libraries by:
NetworkCredential credentials = new NetworkCredential("secondary username", "password for secondary username");
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("https://account.visualstudio.com"), credentials);