text:
Q: Probability that max cos(φ)x + sin(φ)y according to uniform distribution = (8,5) max $x_2$ subject to
$x_1 - 2x_2 \le 0$
$2x_1 - 3x_2 \le 2$
$x_1 - x_2 \le 3$
$-x_1 + 2x_2 \le 2$
$-2x_1 + x_2 \le 0$
Optimal solution: (8, 5) --> $x_2 = 5$
Now assume that the objective is replaced with cos(φ)x + sin(φ)y, where φ is chosen at random, according to the uniform distribution on [0, 2π]. What is the probability to get, as an optimal solution, the same point as in the original problem?
Any help is greatly appreciated!

A: Since it is a two-variable linear programming and as OP said, I can try to answer this using the graphical technique mentioned. Here is the depicted feasible region (bounded by the red line) for the given constraints.

And we know that the optimal solution must be located at one of the five corners. and now the desired solution is on the top right hand corner $(5, 8)$. Note that now the objective $V$ is
$$ V = \cos(\varphi)x_1 + \sin(\varphi)x_2 $$
Rearranging this family of object lines to the slope-intercept form gives
$$ x_2 = -\cot(\varphi)x_1 + \csc(\varphi)V$$
(ignore the point where $\sin(\varphi) = 0$ as they are measure $0$ anyway). Note that the $x_2$-intercept is $\csc(\varphi)V$. So the objective is strictly increasing with the $x_2$-intercept if and only if
$$\sin(\varphi) > 0$$
And in such case, $V$ is maximized when the $x_2$-intercept is maximized, i.e. the objective line must be pushed upward to obtained the maximized $V$. The slope of the line $-\cot(\varphi)$. So now we can work with the 4 cases:

*

*$\sin(\varphi) > 0, \cos(\varphi) > 0$:

In this case we push upward and the slope is negative. And it will always leads to the optimal solution we wanted. Since
$$\varphi \in \left(0, \frac {\pi} {2}\right)$$
The probability in this case is $\displaystyle \frac {1} {4}$.

*$\sin(\varphi) > 0, \cos(\varphi) < 0$:

In this case we push upward and the slope is positive. Then we will need the slope lies on
$$ \left(0, \frac {1} {2}\right)$$
So we have
$$ 0 < -\cot(\varphi) < \frac {1} {2} \iff \tan(\varphi) < -2
\iff \varphi \in \left(\frac {\pi} {2}, \tan^{-1}(-2) + \pi\right)
= \left(\frac {\pi} {2},  \pi - \tan^{-1}(2) \right)$$
So the probability in this case is
$$\frac {1} {4}\left(\frac {\pi} {2} - \tan^{-1}(2) \right)$$

*$\sin(\varphi) < 0, \cos(\varphi) > 0$:
In this case we push downward and the slope is positive. Then we will need the slope to be larger than $1$. By similar solving, we have
$$ \varphi \in \left(\frac {7\pi} {4}, 2\pi\right)$$
and thus the probability in this case is $\displaystyle \frac {1} {8}$.

*$\sin(\varphi) < 0, \cos(\varphi) < 0$:
In the last case we push downward and the slope is negative. And the optimal solution will never located at our desired corner.
Summing the cases we have the probability
$$ \frac {1} {4} + \frac {1} {4}\left(\frac {\pi} {2} - \tan^{-1}(2) \right) +  \frac {1} {8} = \frac {1} {8}(3 + \pi - 2\tan^{-1}(2))$$


text:
Q: textfield with background image
It must be a common issue but I really can't find any solutions for it.  There is a textfield (texts will be written from right to left) and it has a curvy-side background image. The problem is the cursor must stay only in the red box area.
The following is the four solutions I've come up with.

1 - Create a div with the background image and put a textfield in it.
Unless the textfield is transparent, it will cover the background image. Setting it transparent using CSS?  I'm worried about some browsers not supporting it :(

2 - Chop the background image into 3 parts(left - mid - right) and connect them all together. The textfield is positioned in the mid div.
This is okay... but the code will look messy :S  ... :before :after selectors come in handy maybe?

3 - background image stays the same but the textfield size is decreased and positioned center.
This will be the best solution for it but clueless how to do.

4 - Hey, WHY NOT JUST USE CSS3 ??
The background image has a company logo and this cannot be done with CSS... :(
Would there be a better solution that supports all the browsers?  :(

Code ---

<?php echo anchor('.', 'HOME'); ?>

<?php echo anchor('company', 'COMPANY'); ?>

<?php echo anchor('#', 'PRODUCTS'); ?>

<?php echo anchor('#', 'SUPPORT'); ?>

<?php echo anchor('contact', 'CONTACT'); ?>

<input type="text"></input>

CSS ---
#navigation ul li{
display: inline;
}
#navigation ul li input
{
background:url(../images/common/search_bar.jpg) no-repeat left top;
width:113px;
height:18px;
border: 0px;
text-align: right;
outline: none;
}

A: Add some padding right and left so the background image will still appear but the text will never go on the side.

A:

<?php echo anchor('.', 'HOME'); ?>

<?php echo anchor('company', 'COMPANY'); ?>

<?php echo anchor('#', 'PRODUCTS'); ?>

<?php echo anchor('#', 'SUPPORT'); ?>

<?php echo anchor('contact', 'CONTACT'); ?>

<input type="text"></input>

#search-bar
{
    background:url(../images/common/search_bar.jpg) no-repeat top left;
    width:115px;
    height:18px;
    display: inline-block;
}
#search-bar input
{
    width:80px;
    height:18px;
    text-align: right;
    border: 0px;
    outline: none;
    background:url(../images/common/transparent.png) repeat-x;
}

I succeeded it in this way. Instead of using CSS3 transparent, i just created 1px width transparent png image file and used it as the input field background. I'm not sure if it's the best way... but it seems working.

redpajama_set_name: RedPajamaStackExchange


text:
Q: facebook registration plugin - zipcode field from facebook? is it possible to add zipcode and address field to the fields in facebook registration. If possible, how can i add them ? They are actually available in our facebook profile so there must be a way we can add them .
<iframe src="https://www.facebook.com/plugins/registration?
         client_id=appid&
         redirect_uri=https%3A%2F%2Fdevelopers.facebook.com%2Ftools%2Fecho%2F&
         fields=name,birthday,gender,location,email"
    scrolling="auto"
    frameborder="no"
    style="border:none"
    allowTransparency="true"
    width="100%"
    height="330">
</iframe>

A:
is it possible to add zipcode and address field to the fields in facebook registration.

No – at least not to get them pre-filled by Facebook.
FB does not give this information out to apps any more – so if you need it, you'll have to request it from the user via custom fields, for them to fill out manually.


text:
Q: Access site behind login.microsoftonline oatuth2 with python I'm learning webscraping and I need to access a website which is behind login.microsoftonline.com with python but I can't find how to go through it.
How should I go through it ?
Thank you in advance


text:
Q: How to make a matrix from scratch in java I'm trying to make a program that will make square matrices based on user input. I know that arrays exist, but I wanted to make a matrix from scratch so that I could better understand the basic concept of it and further extend my understanding of loops. So far I have been able to make a square matrix that will accept one number as an input into that matrix, for example I input a square 2x2 matrix and while I want it to look like this 1 2 3 4 with 1 and 2 being above 3 and 4. I have only gotten it to accept one user input that it places in all four slots. For example, if my user input is 1 then the matrix looks like this 1 1
                                                                          1 1
My code looks like this thus far:
    int number;
    System.out.println("What are the dimensions of the matrix?");
    number = in.nextInt();

    for (int k = 0; k < number; k = k +1)
    {
        System.out.println("What are the numbers in your matrix?");
        int matrix_number = in.nextInt();

        for (int i = 0; i < number; i = i + 1)
        {
            for (int j = 0; j < number; j = j + 1)
            {
                 System.out.print(matrix_number);
            }

            System.out.println();

        }

    }

I believe that my problem lies in my first for loop where I have the user input the matrix number. Any helpful suggestions on how I can better write this so that the user can input a different number for each slot in the matrix?

A: It looks like you are trying to create a matrix and then populate it with values read from the user.
To create an N x N matrix of integers
    int[][] matrix = new int[n][n]();

To assign a value to a matrix cell [i, j]:
    matrix[i][j] = someValue;

Obviously, if you want to read a different value for each cell, you need to call nextInt() multiple times; i.e. once for each value you want to read.
(Note to other readers: I'm not coding this for the OP, because he will learn more by coding it himself.)

A: You can create a matrix using 2 dimensional arrays:
int[][] matrix = new int[row][column]; //row is the number of matrix rows
                                       //column is the number of matrix columns

To access the elements of the matrix and define it after the declaration, you can use a nested for loop:
for (i = 0; i < row; i++ )
     for (j = 0; j < column; j++)
     {
        scores[i][j] = value; // value is your chosen integer for that index
     }
}

A: As you mention in your question, user has to input only onces and that it places in all four slots.
For example, if user input is 1 then the matrix looks like this 1 1 1 1.
Then no need for first for loop, just remove it.
    int number;
    System.out.println("What are the dimensions of the matrix?");
    number = in.nextInt();

    System.out.println("What are the numbers in your matrix?");
    int matrix_number = in.nextInt();

    for (int i = 0; i < number; i = i + 1)
    {
       for (int j = 0; j < number; j = j + 1)
       {
            System.out.print(matrix_number);
       }

       System.out.println();
   }

A: You want the user to say the size of the square matrix, then you want the user to tell you every number in the matrix. You only need two loops here:
int number;
System.out.println("What are the dimensions of the matrix?");
number = in.nextInt();

for (int i = 0; i < number; i = i + 1)
{
    for (int j = 0; j < number; j = j + 1)
    {
        System.out.println("What are the numbers in your matrix?");
        int matrix_number = in.nextInt();
        System.out.print(matrix_number);
    }
    System.out.println();
}

If you don't want your matrix polluted by "What are the numbers in your matrix?" questions, then you're going to need to learn how to store user input into some sort of data structure. As you said in your question, arrays are a great way to do this (as are 2d arrays).
If you were willing to learn file input or file output, then you could do what you seek without "storing" the numbers in an array. Either read the numbers in from a file and output them to the screen, or have the user type them as user input and output the matrix to a file.
Edit: You could try to erase the "What are the numbers in your matrix?" system out by printing backspace characters on linux systems. More here:
How to delete stuff printed to console by System.out.println()?


text:
Q: Using a value from Node function in Handlebarsjs helper My application passes some information from node/mongoose to a handlebars template. Part of this is a couple of functions, the results of which I use in the template and it shows up and works fine.
router.get("/output/:id", (req, res) => {
   Project.findOne({
      _id: req.params.id
   })
   .populate("user")
   .then(project => {
      if (req.user) {
         if (req.user.id == project.user._id) {
            res.render("projects/output", {
               project: project,
               inputTotal: function() {
                  // do some stuff
                  return inputSum;
               },
               outputTotal: function() {
                  // do some stuff
                  return outputCalcs.value;
               }
            });
         } else {
            res.redirect("/");
         }
      } else {
         res.redirect("/");
      }
   });
});

I then have a handlebars helper function that I want to pass in the two returns as arguments
calc: function(firstReturn, secondReturn){
   let value = firstReturn + secondReturn;
   return value;
}

then in handlebars
{{calc inputTotal outputTotal}}

When I do this, it returns NaN, so I console logged the typeof of the function parameters and they're both functions, not numbers, which I suppose makes sense. How do I access them as numbers so I can use the values in my helper?


text:
Q: How to sort images into folders, based on resolution? Background: I've got a folder full of saved desktop pictures.  I'd like to put them into folders, based on their resolution - 1024x768, etc.  Creating the folders on the fly is a bonus.  Currently, the images are all in a folder, but some of them are in sub-folders.  I can merge them by hand, if that makes things easier.
I'm using Mac OS X, but I'm not opposed to installing extra apps to accomplish this (MacPorts?), or even using another OS (I've got Windows XP, Windows Vista, and Ubuntu 9 setup right now within VMWare).
Any help would be appreciated!  Thank you!

A: If you speak Python, the Python Imaging Library should do the trick.
import Image, os
for filename in os.listdir("/path/to/images"):
    image = Image.open(filename)

and from there, you can sort your images based on the size member, which is a (width, height) tuple.


text:
Q: How to set alias path via webpack in CRA (create-react-app) and craco? I have a problem on set webpack alias path using create-react-app and craco, already googling it but can't solve the problem.
I got an error Module not found: Can't resolve '@app/App' in 'C:\ReactSandbox\my-project\src everytime i run application using command yarn start
Steps to reproduce:

*

*create-react-app my-project

*cd my-project

*yarn add @craco/craco

*cat > craco.config.js (see configuration below)

*replace react-scripts to craco on 'script' section on package.json (craco start, craco build, etc)

*edit file src/index.js (replace line 4, see code below)

*yarn start
craco.config.js
const path = require("path");

module.exports = {
  webpack: {
    resolve: {
      alias: {
        "@app": path.resolve(__dirname, "src/"),
      }
    }
  }
};

src/index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from '@app/App'; //replace './App' into '@app/App'
import * as serviceWorker from './serviceWorker';

ReactDOM.render(<App />, document.getElementById('root'));

serviceWorker.unregister();

Current result
Module not found: Can't resolve '@app/App' in 'C:\ReactSandbox\my-project\src
Expected
I'm avoiding call relative path hell, instead of import module like ../../../../FilterComment.js, it would be clean to write @app/FilterComment.js

A: resolve for carco:
u need install craco-alias, then will write in
craco.config.js
    const CracoAlias = require('craco-alias')

    module.exports = {
      plugins: [
        {
          plugin: CracoAlias,
          options: {
            source: 'tsconfig',
            baseUrl: '.',
            tsConfigPath: './tsconfig.path.json',
          },
        },
      ],
    }

tsconfig.path.json
    {
      "compilerOptions": {
        "baseUrl": ".",
        "paths": {
          "@/*": ["src/*"],
          "@svg/*": ["src/assets/svg/*"],
          "@img/*": ["src/assets/images/*"],
          "@icons/*": ["src/assets/icons/*"],
          "@shared/*": ["src/shared/*"],
          "@components/*": ["src/components/*"],
          "@hooks/*": ["src/hooks/*"],
          "@constants/*": ["src/constants/*"],
          "@layout/*": ["src/layout/*"],
          "@services/*": ["src/services/*"]
        }
      }
    }

tsconfig.json
    {
      "extends": "./tsconfig.path.json",
      "compilerOptions": {
        "target": "es5",
        "lib": [
          "dom",
          "dom.iterable",
          "esnext"
        ],
        "allowJs": true,
        "checkJs": false,
        "skipLibCheck": true,
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
        "declaration": false,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "strict": true,
        "forceConsistentCasingInFileNames": true,
        "module": "esnext",
        "moduleResolution": "node",
        "resolveJsonModule": true,
        "isolatedModules": true,
        "noEmit": true,
        "jsx": "react-jsx",
        "noFallthroughCasesInSwitch": true,
        "removeComments": true
      },
      "include": [
        "src",
        "src/configs",
        "react-app-env.d.ts"
      ]
    }

A: First - tell to IDE about aliases in tsconfig.json:
create separate file tsconfig.paths.json and add aliases:
{
   "compilerOptions": {
      "baseUrl": "./src",
      "paths": {
         "@utils/*": ["utils/*"]
      }
   }
}

Add created tsconfig.paths.json to main tsconfig.json
{
   "extends": "./tsconfig.paths.json",
   ... other staff ...
}

Second - tell to webpack about aliases:
Add aliases to config-overrides.js
const {
   override,
   addWebpackAlias
} = require('customize-cra');

const path = require("path");

module.exports = override(
   addWebpackAlias({
      "@utils": path.resolve(__dirname, "./src/utils"),
   }),
);

A: my craco.config.js look likes below, it works:
const path = require('path');

module.exports = {
    // ...
    webpack: {
        alias: {
            '@': path.join(path.resolve(__dirname, './src')),
        }
    }
}

A: Just keep your file craco.config.js just like this, and you need to add 1 more file with named jsconfig.json
it's content:
{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es2016",
    "jsx": "preserve",
    "checkJs": true,
    "baseUrl": "./src/",
    "paths": {
      "@app/*": ["./*"]
    }
  },
  "exclude": ["node_modules", "**/node_modules/*"]
}

then you can import from the absolute path like @app/FilterComment.js
It also worked for VSCode (editor now understand where @app point to).
But if you want VSCode to do the import automatically, then you should add more config for it to force it always do the import from absolute path.
file .vscode/settings.json
content:
{
  "javascript.preferences.importModuleSpecifier": "non-relative"
}

A: Use react-app-alias:

*

*Install craco and react-app-alias and create craco config:

// craco.config.js
const {CracoAliasPlugin} = require('react-app-alias')

module.exports = {
  plugins: [
    {
      plugin: CracoAliasPlugin,
      options: {}
    }
  ]
}

Replace react-scripts with craco in package.json.
Create typescript config and alias in separated config like this:
// tsconfig.paths.json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "example/*": ["example/src/*"],
      "@app/*": ["app/src/*"]
    }
  }
}

// tsconfig.json
{
  "extends": "./tsconfig.paths.json",
  // ...
}

Now you can do import like this:
   import App from '@app/App'

A: An example (which I'm using) without using dependency:
//craco.config.js
const path = require('path')

const tsconfig = require('./tsconfig.base.json')

const removeAsterisk = path => path.replace('/*', '')

const aliasProps = Object.entries(tsconfig.compilerOptions.paths).map(([key, value]) => {
  const newKey = removeAsterisk(key)
  let newValue = removeAsterisk(value[0])
  newValue = path.resolve(__dirname, newValue)
  return [newKey, newValue]
})

const alias = Object.fromEntries(aliasProps)

module.exports = {
  webpack: {
    alias,
  },
}

//tsconfig.base.json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "~/*": ["./src/*"],
      //...
    }
  }
}

// tsconfig.json
{
  "extends": "./tsconfig.base.json",
  "compilerOptions": {/*...*/}
}

A: Maybe the OP had a different version of React / Webpack (I'm using today's current versions), but putting the alias object directly inside the webpack object (without nesting it in the resolve object) did the trick for me:
const path = require("path");

module.exports = {
  webpack: {
    alias: {
      "@app": path.resolve(__dirname, "src"),
    }
  }
};

A: I am using craco-alias plugin for automatic aliases generation for Webpack and Jest.
(I am just an intern but that's how senior developers in my company are using absolute imports in react)
Install
yarn add @craco/craco
yarn add craco-alias

craco.config.js
const CracoAlias = require('craco-alias');

module.exports = {
  plugins: [
    {
      plugin: CracoAlias,
      options: {
        source: 'tsconfig',
        baseUrl: './src',
        tsConfigPath: './tsconfig.paths.json', // or wherever you have defined your paths
      },
    },
  ],
};

And make sure that you scripts in package.json look like the following
"scripts": {
    "start": "craco start",
    "build": "craco build",
    "test": "craco test",
    "eject": "craco eject",
    ...
  },

Then It'll work as specified in tsconfig.json.
FYI I have,
"react-scripts": "4.0.3"
"@craco/craco": "^6.3.0"
"craco-alias": "^3.0.1"


text:
Q: Why didn't people see each other for such a long time? Eddard Stark hadn't seen Robert Baratheon for nine years when Robert came to Winterfell. Catelyn hadn't seen her sister for five years when she met her at the Eyrie. I'm sure there are many other examples.
The main reason that I can think of is because traveling takes very long between these places. I recall that traveling from Winterfell to King's Landing took something like a month of traveling.
Even so, it bugs me for several reasons:

*

*I was under the impression that Robert and Eddard were very good friends. Surely you wouldn't let nine years go to past, especially missing the birth of some of their children. The same could be said about seeing family members.

*In the events in the books people travel all the time. Especially in the TV show, it seems that people are in one place in one scene and in another place leagues away in another scene, even for small errands or other less important things. Of course you can't know how much time has passed exactly between scenes or chapters in the book, but I have the feeling that people are much more willing to travel during the events of the books.

A: From the Online Etymology Dictionary (emphasis mine)

Travel: late 14c., "to journey," from travailen (1300) "to make a
  journey," originally "to toil, labor" (see travail). The semantic
  development may have been via the notion of "go on a difficult
  journey," but it also may reflect the difficulty of any journey in the
  Middle Ages. Replaced Old English faran. Related: Traveled; traveling.
  Traveled (adj.) "having made journeys, experienced in travel" is from
  early 15c. Traveling salesman is attested from 1885.

Our concept of travel is very modern, and recent. Even in the 19th century when travel by train was possible, still most of the population didn't travel without good reason. The main reason for this was travelling was really expensive. Firstly you'd have to pay to get where you were going, then you'd have to pay for accommodation when you got there.
Travel was only realistically possible for the rich.
Roll back to medieval times, adding to the expense you've danger. If you couldn't pay for armed guards you're at the mercy of everyone you meet on the road. You've to either pay for food and lodging or forage and camp as you go, which effectively halves your daily distance & doubles your travel time. In medieval times it was completely the norm for people to be born, live and die of old age without ever venturing more than 10 or so miles from their home.
Given, in the west, how quickly we can travel from one side of the country to the other, and even travelling to the other side of the world is possible, it does seem unreasonable that people didn't move or travel, but it's only because we're looking through our "affluent western reality filters". If you go to parts of the developing world, you'll find people who "don't travel" and would be slightly bemused at the idea.
Consider, 40 or 50 years ago, lots of people left my country (Ireland) to find work abroad. People who were leaving for America, Canada & Australia were often "Waked" (as in a funeral/celebration of their life). Yes it was a party, but the concept of "wake" was added because it was understood that those people would never return. While parents/siblings would receive letters, their wider family and acquaintances would never see or hear from them again, and it was like they'd "died".
We are incredibly lucky to live in this age of easy travel, it's only been around for 40 or so years. Roll back to the 18th century (introduction of rail travel) and before and try to imagine how difficult it was to get from Warsaw to London, through - for the time - heavily populated areas, over difficult, badly maintained roads, expensive coaches, dangerous sea crossings ... Contrast that with London to San Francisco, weeks long sea voyages, then wagon train across hostile country that could take months.
Also, the books give a better impression of distances travelled and the time spent on the roads and in the wilds. The travellers are knights or travel with guards, and are less worried than most about bandits. They are mostly landed gentry with money or have liege lords to give them travelling expenses.

A: I agree with Binary Worriers point that considering the time in which GOT is set is was incredibly expensive to travel across Westeros. Bearing in mind, wherever Robert went he had to take a large entourage with him. This would have included knights, regular soldiers, maids, servants, maesters, bannermen and their soldiers, along with the Kings Guard, freeriders etc. To quote the ASOFAI

Poured through the gate...three hundred strong

Therefore to equip, feed and supply such an entourage is exceedingly expensive. Also you put pressure on your host to accommodate for such a large party, as they must provide accommodation and food for everyone. This also enforces considerable expense upon them, which they may or may not be able to afford.
Other points to consider

*

*With Ned in the North as Warden, it ensures Robert has someone who he can depend on to keep the kings peace. Westeros is well know for spontaneous rebellions, especially from the Iron Born, whom are located closer to Winterfell than King's Landing. Knowing Ned is gone for at least two months (a month to travel forth and then another to travel back) could provide them with an opportunity to rebel.

*Robert has Jon Arryn as his Hand in King's Landing, so he doesn't really need Ned with him, again this feeds from point 1 that its safer to have him in the North in case rebellion breaks out.

*This is a theory that has been circulated previously, Jon Snow is actually the son of Robert, and fearing Cersei's wrath it was secretly agreed between Ned and Robert that Ned would care for him as his own. To extend on this point, the other scenario is that Jon could be the son of Rhaegar and Lyanna, thereby potentially putting him at risk of Robert. If these theories are true then it's logical having Ned and Jon out of the way prevents Jon from coming to harm at the hands of Cersei,Jaime or Robert. Jon Snow/Theories

A: From Ned's perspective we can also add given his reluctance to becoming the King's Hand. Ned has little to no interest in travelling to King's Landing if there was no real imperative or urgent matter. He was really invested in his duties as warden of the north. Him being so invested in the socio-political affairs of the north was a continuation of a Stark tradition and it paid off with loyalty of the north when Robb started his rebellion.


text:
Q: Angular material layout issue in IE11 for smaller screen resolution I'm working on angular material layout, it's working fine in all the browsers including IE11, but for smaller screen resolutions, I'm facing content overlapping issue.
Here's the code I've tried:
HTML:

        Title

 Description:

 Manage your account, username and password setting
 Manage your account, username and password setting

        Title

 Description:

 Manage your account, username and password setting

        Title

 Description:

 Manage your account, username and password setting
 Manage your account, username and password setting

        Title

 Description:

 Manage your account, username and password setting

CSS:
.innersection {
  background: #fff; padding:8px; border:1px solid;
}

Here's working fiddle example:
http://jsfiddle.net/xjb0soLn/17/
Appreciate your help.

A: I found the solution:
http://jsfiddle.net/xjb0soLn/22/
Here's the HTML:

        Title

 Description:

 Manage your account, username and password setting
 Manage your account, username and password setting

        Title

 Description:

 Manage your account, username and password setting

        Title

 Description:

 Manage your account, username and password setting
 Manage your account, username and password setting

        Title

 Description:

 Manage your account, username and password setting


text:
Q: What does "that's like for me" mean? In Memento (2000), Mrs Jankins asks Leonard about his husband short term memory loss condition:

Mrs Jankins: What do you think that's like for me...to suspect he might be
imagining this whole problem...and that if I just could
say the right thing...he'd snap out of it and go back to being normal?

What does "that's like for me" mean?

A: "What x is like for someone".

*

*to be like for someone (asking for a description).

*to be like [x], a simile.

In a question. It's used frequently to ask the person you are speaking to if they can imagine what that situation means/meant for you.
When you answer that, you don't usually use the word like. You say: It was awful, it was tiring, etc. It's usually negative.
It derives from the use of the word like in similes (figures of speech):
What was it like?
It was like a dream.
What was it like?
It was like a nightmare.

A: She asks 'What do you think that [is] like for me'? 'That' is living with her husband's short term memory loss condition.

that
pronoun

*referring to a specific thing previously mentioned, known, or understood.

That (Lexico)
When we talk about what something is like for us, we mean what it feels like for us to experience or live with that thing.
She is asking 'can you imagine what it feels like for me to live with my husband's condition?'


text:
Q: Moment.js: is there a way to return true from isBetween() method? I'm trying to find a way to return true from a check made with Moment.js isBetween method.
In my case: moment('2020-10-20').isBetween(a, b), a and b are set dynamically.
In some cases I want the isBetween method to return always true so I'm setting a and b to undefined, but it isn't working.
Is there a way to return true in every case? How should a and b be set?
edit: here is the use case
this.props.transactions.filter(transaction => moment(transaction.date).isBetween(this.state.filteredDates.startDate, this.state.filteredDates.endDate)).map((transaction, index, array) ....
How can i set this.state.filteredDates.endDate and this.state.filteredDates.startDate in order to make it return true if this.state.filteredDates.endDate and this.state.filteredDates.startDate are not setted

A: In case you want "always true" you don't need to perform any calculations.
So
let always_true = true; // or false depending on your needs;
return always_true || moment(x).isBetween(a, b);

A: I'm not exactly sure what you are asking but you can use a double bang operator to coerce values into true or false
if(!!moment('2020-10-20').isBetween(a, b)){
  //do this
} else {
  //do that
}

however if you always want it to return true, why even run the function at all, why not just return true?
function(){
  moment('2020-10-20').isBetween(a, b)
  return true
}

that being said I'm not entirely sure on why anyone would do that.


text:
Q: How to update the state value using setTimeout in React Hooks? Am trying to reset the state value after some time using setTimeout function.
const SetTimeout = props => {
  let [errorText, setError] = useState(
    props.errorMessage ? props.errorMessage : ""
  );
  useEffect(() => {
    if (errorText !== "") {
      setTimeout(() => {
        setError("");
      }, 4000);
    } else {
      // console.log("no error")
    }
  }, [errorText]);
  return
{errorText}
;
};

const MapStateToProps = state => {
  return {
    errorMessage: state.errorReducer.error
  };
};

Am getting the errorMessage from an api call, after some time i'm trying to make that message to empty using useState.
But the component is getting re-rendered with the same error message. could you please help me in fixing this?

A: You are mixing component state and redux state here which is pretty bad and why you are seeing this behaviour.
You are initially rendering the component with the error message from within Redux, and passing this into the component as a property value. The component displays this, set's it's own state value. After the timeout runs, it's updating it's own state, which causes a re-render, and the Redux value is again passed into the component via the properties.
I would suggest you forget about using useState and use a Redux action to clear the error message that it is storing.

A: you are using redux to not use state in react components and here you are using state in your component. so what you can do is to add the erromessage to your global state :
state ={
...,
errormessage:undefined
}

and then in your action you need to change your state.errormessage like this:
export const show_error = message => {
    return {
        type: "SHOW_ERROR",
        payload: message
    };
};
export const remove_error = () => {
    return {
        type:"REMOVE_ERROR"
    };
};

imagine calling post api to add post using redux thunk you  can do it like this:
export function add_post(data) {
    return function(dispatch) {
        return axios
            .post('/posts', data)
            .then(res => {
                dispatch(fetch_posts_data());})
            .catch(err =>  dispatch(
                    show_error(err)
                );
                setTimeout(function() {
                    dispatch(remove_error());
                }, 2000););
    };
}

in your reducer :
 case "SHOW_ERROR":
            return {
                ...state,
                posts: { ...state.posts, errormessage: action.message}
            };
        case "REMOVE_ERROR":
            return {
                ...state,
                posts: { ...state.posts, errormessage: undefined }
            };

now to retrieve the errormessage in your component you can use normal connect method but here i will use redux hooks useSelector():
const Error = ()=>{
 const errormessage = useSelector(state=>state.errormessage)
     return(
    <>
     {

    errormessage?

{errormessage}

    :""

    }
    </>
       )
        }

A: I've just found this out! So it may not be perfect.
Hooks have a useSelector and a useDispatch (from react-redux)
To stick with having your error in Redux, you component would look like this:
const SetTimeout = () => {
    const errorText = useSelector(state => state.errorReducer.error);
    const clearError = useDispatch();

    useEffect(() => {
        if (errorText !== "") {
            const timeout = setTimeout(() => {
                clearError({ type: "CLEAR_ERROR" });
            }, 5000);
        } else {
            // console.log("no error")
        }
        // this will clear Timeout when component unmounts like in willComponentUnmount
        return () => { clearTimeout(timeout); };
    }, []);

    return
{errorText}
;
};

export default SetTimeout;

Pretty cool functional component without the redux boiler plate code.
Hope that helps


text:
Q: What is the difference between open ball and neighborhood in real analysis? I'm learning real analysis.

Open ball: The collection of points $x \in X$ satisfying $|x - x_{0}| < r$ is called the open ball of radius $r$ centered at $x_{0}$
Neighborhood: A neighborhood of  $x_{0} \in X$ is an open ball of
  radius r > 0 in $X$ that is centered at $x_{0}$

I'm using Real and Complex Analysis written by Christopher Apelian and Steve Surace.
In my mind, open ball = a collection of points satisfy certain requirement = neighborhood. I do not find out any differences between open ball and neighborhood. Could any one explain it? Thanks!

A: An open ball about x is a ball about a point $x$. A neighborhood of $x$ is commonly defined as an  set containing $x$ in its interior.
A neighborhood need not be  a ball/other trivial shape just a set containing $x$.

A: Let's discuss the 1-dimensional case. An open ball in $\Bbb R$ is a set given by
$$
  B(x,r):=\{y\in \Bbb R:|y-x|<r\}.
$$
These sets are very important as they allow us to define the topology on $\Bbb R$, i.e. it allows us to say which sets are open and which are not. Topology is one of the key structures to work with uncountable spaces, $\Bbb R$ in particular.
The neighborhood of a point $x\in \Bbb R$ is any subset $N_x\subseteq \Bbb R$  which contains some ball $B(x,r)$ around the point $x$. Note that in general one does not ask neighborhood to be open sets, but it depends on the author of a textbook you have in hands.
For example, if $x = 1$ then $(0.5,1.5)$ is a ball (of a radius $0.5$) around $x$, and $(0.5,1.5)\cup [2,4]$ is a neighborhood of $x$ which is not a ball (neither around $x$, nor around any other point).
As Brian has mentioned, indeed in your case these definitions are equivalent - but this is an unusual way to define neighborhoods.


text:
Q: paginate List of dictionaries in datagrid I am having my list of data in
System.Collections.Generic.List<System.Collections.Generic.Dictionary<string,object>>

and i have assingned it to the ienumerable type
 public IEnumerable Result;
 Result = Datasource.DataSourceCreator.ToDataSource( System.Collections.Generic.List<System.Collections.Generic.Dictionary<string,object>>);

and i binded that ienumerable to an itemsource of a datagrid in my wpf application. How can i paginate my datagrid by traversing this List of dictionary??
Thanks in advance, if u can solve my problem.

A: WPF does not provide a control with built-in pagination support.You'll need to implement it by yourself.
This article can help you to achieve such thing:
http://www.codeproject.com/Articles/20463/DataView-Paging-in-WPF

A: The following link might help you to achieve your goal,
How can I paginate a WPF DataGrid?
MSDN Reference
One more link for your reference
http://www.codeproject.com/Articles/350447/WPF-Paging-in-DataGrid-ListBox


text:
Q: How to filter rows in a dataframe using in and notin I have the following problem
import pandas as pd
import numpy as np

data = {
  "ID": [420, 380, 390, 540,520],
  "duration": [50, 40, 45,33,19],
  "previous": [125  , 540 , 420 , 777 , 390  ],
  "next":[390,880  ,520  ,380   ,810   ]
}

#load data into a DataFrame object:
df = pd.DataFrame(data)

print(df)

#search for IDs where previous are not in IDs

#print(data[~data['previous'].isin(data['ID'])])

#print(data[~data.previous.isin(data.ID)])

print(data[~data.next.isin(data.ID)])

As you can see I have a dataframe
    ID  duration  previous  next
0  420        50       125   390
1  380        40       540   880
2  390        45       420   520
3  540        33       777   380
4  520        19       390   810

and I want to find the rows where the "next" (or the "previous") data is not in the IDs
for example the row 0 has a previous (125) which does not exist in IDs
or the row 4 has a next(810) which does not exist in IDs
I tried to apply this solution  but I get the error "AttributeError: 'dict' object has no attribute 'next'"


text:
Q: followers and following sytem I am working on a social network web application I have established a system of following followers with firebase and node js , so I created a collection users and in it two following followers array, I managed to add them
Now I want to issue a condition to check if the user has already made a follow up not to add it a second time to the table how can i access to the tables (following, followers)in order to verify if the user is in
exports.onFollow = (req, res) => {
    const followDocument = db.doc(`/users/${req.body.email}`);
    const followerDocument = db.doc(`/users/${req.user.email}`);
    let followData;
    let followerData;

    followDocument
      .get()
      .then((doc) => {
        if (doc.exists) {
          followData = doc.data();

          if ('req.user.email', 'in', followData.followers.docs) {
            return res.status(200).json({
              error: 'user already follow'
            });
          } else {
            followData.followers.push(req.user.email);
            return followDocument.update({
              followers: followData.followers
            });
          }
        }
      })
      .catch((err) => {
        console.error(err);
        res.status(500).json({
          error: err.code
        });
      });

A: It sounds like you want followers to be an array with unique values, so that each email address can only occurs once. Firestore has  special arrayUnion operation for adding values to such a field.
From the documentation on updating elements in an array:

If your document contains an array field, you can use arrayUnion() and arrayRemove() to add and remove elements. arrayUnion() adds elements to an array but only elements not already present. arrayRemove() removes all instances of each given element.
var washingtonRef = db.collection("cities").doc("DC");

// Atomically add a new region to the "regions" array field.
washingtonRef.update({
   regions: admin.firestore.FieldValue.arrayUnion("greater_virginia")
});

// Atomically remove a region from the "regions" array field.
washingtonRef.update({
   regions: admin.firestore.FieldValue.arrayRemove("east_coast")
});

I'd recommend switching to using arrayUnion() for your use-case, as it prevents having to do the query to detect if the email address is already in the array.


text:
Q: What is the difference between != and <>? Perhaps this is a rather newbie-ish question, but I'm curious. I have tried searching for it, but I suppose I lack the correct terminology to search properly.
Difference between != and <>.
On searching again, "inequality", I found one that discusses not == and !=, but nothing about <>.

A: They are interchangeable in Python 2, but <> is deprecated and has been removed in Python 3.
Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win32
>>> 1 <> 2
True
>>> 1 != 2
True

Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)] on win32
>>> 1 <> 2
  File "<stdin>", line 1
    1 <> 2
       ^
SyntaxError: invalid syntax
>>> 1 != 2
True

A: In Python 2.x, <> is equivalent to !=, as described in the documentation:

The forms <> and != are equivalent; for consistency with C, != is preferred; where != is mentioned below <> is also accepted. The <> spelling is considered obsolescent.

In Python 3.x, <> has been removed. Again, the documentation says:

Removed Syntax
....
Removed <> (use != instead).

A: Also if you want to use <> in Python 3.X, you can import this from future module.
Python 3.3.2
>>> from __future__ import barry_as_FLUFL
>>> 1<>1
False


text:
Q: Reduce a MongoDB id into a shorter hash I am looking for the best way to convert a MongoDB id 504aaedeff558cb507000004 into a shorter representation in PHP? Basically, users can reference id's in the app, and that long string is difficult.
The one caveat is, collisions should be 'rare'. Can we somehow get it down to 4, 5 or 6 characters?
Thanks.

A: While a hex digit can store 16 different states, a base64 encoded digit can store 64 different states, so you can store your whole MongoDB Id in 16 digits instead of 24 without losing any information:
print hexToBase64("50b3701de3de2a2416000000") . "\n"; # -> ULNwHePeKiQWAAAA
print base64ToHex("ULNwHePeKiQWAAAA") . "\n";         # -> 50b3701de3de2a2416000000

function base64ToHex($string) {
  return bin2hex(base64_decode($string));
}

function hexToBase64($string) {
  return base64_encode(hex2bin($string));
}

A: Your unique ID to start with can be mapped by [0-9a-f]. Shortening can be done in multiple ways - one easy way is to re-map character sets.
Our aim will be to cut the string size in two by replacing characters. A single character is one of 16, so two characters gives you 16^2 = 256 possibilities... I'm sure you know where I'm going with this. Take each couple of characters in your string, and calculate the mapping value. Generate the ASCII character corresponding, and use this instead. If you dislike having such an ugly ID at the end, base64-encode it - you'll get a string which is roughly 1/3 shorter than the one you started with.


text:
Q: what is $"type" in a json object and How to deserialize it to my model So i have made an api call and received this object back
[
    {
        "$type": "foo.Api.bar.Entities.foo, foo.Api.bar.Entities",
        "id": "a2",
        "displayName": "A2",
        "statusSeverity": "Good",
        "statusSeverityDescription": "No Exceptional Delays",
        "bounds": "[[-0.0857,51.44091],[0.17118,51.49438]]",
        "envelope": "[[-0.0857,51.44091],[-0.0857,51.49438],[0.17118,51.49438],[0.17118,51.44091],[-0.0857,51.44091]]",
        "url": "/Road/a2"
    }
]

I have no clue what
"$type": "foo.Api.bar.Entities.foo, foo.Api.bar.Entities",

is and i'm not sure how to design my model to take it in?
public class Road
{
    public string Id { get; set; }
    public string DisplayName { get; set; }
    public string StatusSeverity { get; set; }
    public string StatusSeverityDescription { get; set; }
    public string Bounds { get; set; }
    public string Envelope { get; set; }
    public string Url { get; set; }
}

what is $"type" and how should i go about trying to deserialize it into my model, which i will then map into my DTO?

A: The $ sign  related to the data source not to JSON itself, to deserialize it use the following :
[JsonProperty(PropertyName = "$type")]
public string PropertyName{ get; set; }


text:
Q: Button to whitelist my website that works on any adblocker I would like to make a button on my website which would prompt visitors to disable ad blockers.
Currently, I created a popup with two buttons, like generally seen in blogs to allow ads by disabling the ad blocker and one to not take any action i.e. to continue with the ad blocker enabled.
I am currently using Google Ads and the pop-up that I have made is this:

The problem that I'm facing is how to implement this. There are many ad blockers out there, and I want to make a button in such a way that whenever a user clicks on the Whitelist button, it should initiate a popup from their respective ad blocker to whitelist my website.

A: You probably won't be able to solve this problem because it would require the web browser to have access to details about the user like which add-ons (aka extensions etc) the user has installed into their browser. And for your pop up to work as you want, where the user gets a prompt from their adblocker add-on, that add-on (and perhaps the add-on system in general) would have to implement an API that would connect all of this together, like the Web APIs that browsers already provide for websites to interact with.
Until we see a Web API for interacting with adblocking add-ons, you probably won't be able to do this.
A good alternative is probably to make your pop-up just act as a reminder to users that they may want to disable their adblocking add-on on your website. You could include details in the popup to explain why you want the user to do this. There might be technical restrictions (you're using AJAX for core functionality and it's interfering, etc) or you may just rely on ad revenue and so you want your users to help you keep your site up by viewing ads. The users can make every decision beyond that. Will they allowlist your site? Will they disable their add-on altogether? Will they choose to use your site without turning it off? etc
Try to post questions like this on Stack Overflow in the future, instead of this Stack Exchange site. Stack Overflow is the best site in the network for web development questions that are mostly related to programming (instead of running servers for a website, where this is probably best).
Best of luck!


text:
Q: Setting time through GPS dongle There is this code that claims to set the time of your Linux environment,
http://blog.petrilopia.net/linux/raspberry-pi-set-time-gps-dongle/
date -s '01/01/2014 00:01'
sleep 1
pkill ntpd
pkill gpsd
gpsd -b -n -D 2 /dev/ttyUSB0
sleep 2
GPSDATE=`gpspipe -w | head -10 | grep TPV | sed -r 's/.*"time":"([^"]*)".*/\1/' | head -1`
echo $GPSDATE
date -s "$GPSDATE"
/usr/sbin/ntpd

But When I am running this code through puTTy it sets my time to,

Sun Aug  8 06:08:11 PKT 2010

I'd like to know why it is setting my GPS time to 2010 while its 2013.
Here is the Output of gpspipe -w command
{"class":"TPV","tag":"MID2","device":"/dev/ttyUSB0","mode":1,"time":"1990-12-22T23:59:53.020Z","ept":0.005}
{"class":"TPV","tag":"MID2","device":"/dev/ttyUSB0","mode":1,"time":"1990-12-22T23:59:54.020Z","ept":0.005}
{"class":"SKY","tag":"MID4","device":"/dev/ttyUSB0","time":"1990-12-22T23:59:55.010Z"}
{"class":"TPV","tag":"MID2","device":"/dev/ttyUSB0","mode":1,"time":"1990-12-22T23:59:55.010Z","ept":0.005}
{"class":"TPV","tag":"MID2","device":"/dev/ttyUSB0","mode":1,"time":"1990-12-22T23:59:56.020Z","ept":0.005}
{"class":"TPV","tag":"MID2","device":"/dev/ttyUSB0","mode":1,"time":"1990-12-22T23:59:57.020Z","ept":0.005}

The output is continuous, which means it is changing every second.

A: Since $GPSDATE is being reported as
Sun Aug 8 06:08:11 PKT 2010

the date -s command is doing exactly what you are telling it to do. Why is it reporting a wrong year (or nothing at all)? I have no idea.
Since you are already using ntpd why are you not content to let NTP do its thing? Is this an "I'd like gpsdate to work because it is there" issue?
The best way to help us help you debug this it by giving the full output of
gpsdate -w

in your question.
added in response to gpsdate output:
According to the gpsd documentation when the mode field of a TPV record is 1 it means "no fix". This means that the GPS receiver has not seen enough (or any) satellite data. This implies that the time value is junk which certainly makes sense if you are seeing a year of 1990 or 2014. In your script, the sleep 2 gives very little time for gpsd to get a proper GPS fix. Waiting longer might help, not having a proper antenna attached means you will wait forever for a fix.
The Network Time Protocol implemented by ntpd does not need GPS to work. It exchanges time synchronization information with other internet hosts, some of which do get their clock from a reference like GPS. Since your script stops and restarts your ntpd, you could just forget about a GPS fix and work with that. For example, the machine I am typing this on uses ntpd and is +4.7 milliseconds off of UTC which is more than accurate for many purposes. You can use ntpq -p to find out if and how well your clock is synchronized.

A: … "mode":1 …

That's why. You don't have a GPS fix and the GPS receiver likely has no idea what time it is. You want mode to be 3.
From the fact that SKY is being reported without any additional data, I'd further guess your receiver doesn't even have an almanac yet.
Leave the GPS running with a clear view of the sky for at least 15 minutes (yes, really). That should improve things.
See the documentation here for what those fields mean.


text:
Q: Intermediate Frequency in FM receiver I have question about specifically FM radio receiver that use the heterodyne principle:
How Intermediate Frequency, that's fixed in one frequency (10.7 Mhz), works in FM receivers if FM radios need frequency modulation to pass a useful signal?
Does the mixer with local oscillator in a FM receiver pass a bandwidth or just one frequency?

A: The incoming radio signal isn't mixed down to exactly 10.7 MHz, that would be pointless. Rather, the incoming signal (which varies in frequency) is mixed with a stable local oscillator; the result is a signal that has the same frequency variations but centered around 10.7 MHz.
This intermediate frequency is filtered through either tuned LC circuits or a ceramic resonator, but these circuits are not so narrow-banded that the frequency deviation is lost. The frequency swing of commercial FM stations is +- 75 kHz anyway, or 0.075 MHz, less than 1% of the IF frequency.

A: The whole bandwidth of the fm signal is mixed down to the intermediate frequency. Just simple multiplication of the radio signal and the local oscillator achieves this.


text:
Q: Android SDK Twitter client Can anyone direct me to an tutorials which will help me in reading the tweets using android sdk for a  a specific user.
All I want to accomplish is read the tweets and display it preferably using JSON output of tweeter api.
I don't need to post any tweets. I am newbie to sdk. Any help on this is greatly appreciated.
Thanks in advance ....

A: If you're new to the Android platform, this may help get your feet wet as well as accomplishing what you want to do.
link text


text:
Q: combining c++ and java projects I would like suggestions on how to combine two projects. They are both open source, and I want to implement some of the features from one to the other. Do I need to use some sort of "code converter".

A: *

*Same process, single application:

*

*Most canonical way - JNI

*JNA

*Misc code generators

*Separate processes written entirely in Java and C++ each:

*

*Protobuf

*Memory maps/sockets/pipes

*Web services.

*CORBA :)

*Etc.

So on. All depends on how adventurous you feel, on target platforms and your needs (e.g. if you need both C++ and Java to draw UI - multiprocess solution would be hard).

A: You most likely need to use JNI to call C++ code from Java. It's a very broad topic, so you'd be best to start by reading the documentation and any relevant tutorials you can find online.
This way you're not converting beetween languages - you're using a C++ compiler for C++ code and load the resulting library from Java code.


text:
Q: Full text indexing and contains I am trying to use CONTAINS on a full-text indexed view. This works great if I create a variable and pass the value in that way like this
    DECLARE @ThresholdString VARCHAR(50) = 'Ganja';

    SELECT *
    FROM vw_CMP_Invoice_Data_Indexed
    WHERE CONTAINS((ItemName,Description),@ThresholdString);

However, I am trying to cross apply a temp table to this view and use a field that comes from this temp table as the value I am searching for:
    SELECT  f.AlertId,ci.BankISN,ci.EntityISN,ci.AccountISN,ci.InvoiceID,f.ThresholdType,f.TimeFrame,f.ThresholdString,ci.ItemName,ci.Description
    FROM    dbo.vw_CMP_Invoice_Data_Indexed ci
    CROSS APPLY (SELECT *
                FROM #final f
                WHERE ci.BankISN = f.BankId
                AND ci.EntityISN = f.EntityId
                AND CONVERT(DATE,ci.InvoiceDate) = CONVERT(DATE,@RunDate)
                AND CONTAINS((ci.ItemName,ci.Description),ThresholdString)
                ) f --This is wrong, not sure if I can actually use a value that is cross applied here...
    GROUP BY f.AlertId,ci.BankISN,ci.EntityISN,ci.AccountISN,ci.InvoiceID,f.ThresholdType,f.TimeFrame,f.ThresholdString

Is it not possible to use a field as the search value using contains on a full-text indexed view, or do I just have the syntax wrong?
I've also tried:
    SELECT  f.AlertId,ci.BankISN,ci.EntityISN,ci.AccountISN,ci.InvoiceID,f.ThresholdType,f.TimeFrame,f.ThresholdString,ci.ItemName,ci.Description
    FROM    dbo.vw_CMP_Invoice_Data_Indexed ci
    CROSS APPLY (SELECT *
                FROM #final f
                WHERE ci.BankISN = f.BankId
                AND ci.EntityISN = f.EntityId
                AND CONVERT(DATE,ci.InvoiceDate) = CONVERT(DATE,@RunDate)
                AND CONTAINS((ci.ItemName,ci.Description),ThresholdString)
                ) f --This is wrong, not sure if I can actually use a value that is cross applied here...
    GROUP BY f.AlertId,ci.BankISN,ci.EntityISN,ci.AccountISN,ci.InvoiceID,f.ThresholdType,f.TimeFrame,f.ThresholdString

AND

    SELECT  f.AlertId,ci.BankISN,ci.EntityISN,ci.AccountISN,ci.InvoiceID,f.ThresholdType,f.TimeFrame,f.ThresholdString,ci.ItemName,ci.Description
    FROM    dbo.vw_CMP_Invoice_Data_Indexed ci
    CROSS APPLY (SELECT *
                FROM #final f
                WHERE ci.BankISN = f.BankId
                AND ci.EntityISN = f.EntityId
                AND CONVERT(DATE,ci.InvoiceDate) = CONVERT(DATE,@RunDate)
                ) f --This is wrong, not sure if I can actually use a value that is cross applied here...
    WHERE CONTAINS((ci.ItemName,ci.Description),f.ThresholdString)
    GROUP BY f.AlertId,ci.BankISN,ci.EntityISN,ci.AccountISN,ci.InvoiceID,f.ThresholdType,f.TimeFrame,f.ThresholdString

But they both show this error message
> Msg 102, Level 15, State 1, Procedure InvoiceProductKeyword, Line 101 [Batch Start Line 0]
    Incorrect syntax near 'ThresholdString'.

A: Looks like you are missing a right parenthesis... change
WHERE CONTAINS((ci.ItemName,ci.Description),f.ThresholdString)

To
WHERE CONTAINS((ci.ItemName,ci.Description),f.ThresholdString))


text:
Q: Template nullary metafunction in boost In the documentation related to the MPL library offered by Boost (here, for example) one can find the following construct:

typedef f<>::type x;

The only ways I can think the above is valid are if f is a template with variadic parameters or if f has default template parameters. In this context however, I think the former does not apply, as the MPL library appeared before variadic template parameters.
I have two questions:

*

*Does the documentation refer to the case when f has default template parameters (considering the state of the language when the documentation was written)?

*Considering the current state of the language (at the time of the post, I believe C++ 17 ) are there any other possibilities for the quoted construct to be valid?

A: the declaration typedef f<>::type x; is valid whenever f is a class template ( or a template alias as of >=c++11 ) accepting no arguments with corresponding specialization having a member type 'type'. Given that no primary template definition can have no arguments, this means that either f has default arguments or that ( as of >=c++11 ) it's a variadic template with an empty argument pack.

Does the documentation refer to the case when f has default template parameters (considering the state of the language when the documentation was written)?

yes, but keep in mind that MPL emulated variadics via default, placeholder types.

Considering the current state of the language (at the time of the post, I believe C++ 17 ) are there any other possibilities for the quoted construct to be valid?

as far as I know and given the expression exactly as shown, the only other possibility is the aforementioned variadic class/alias template with empty pack.


text:
Q: Table td, different div heights vertical align top I am currently working on a newsletter that has 2 columns but the first div height does not adjust when the other one has multiple lines. I want them to be vertically aligned top or auto adjust height depending on the content without changing the image and Read more button height. Everything has to be in line. (Both images aligned, Read more at the div's bottom, etc.)
Here's the code :

                      The Musical Circus Duo. Tuesday August 18 at 7 p.m.

                      Read more >

                      Special Meeting Of The Council On Tuesday, August 11, At 7:00 P.M.

                      Read more >

How it looks like right now


text:
Q: Faster way to make a zeroed array in Scala I create zeroed Arrays in Scala with
(0 until Nrows).map (_ => 0).toArray but is there anything faster ? map is slow.
I have the same question but with 1 instead of O, i.e. I also want to accelerate (0 until Nrows).map (_ => 1).toArray

A: For multidimensional arrays consider Array.ofDim, for instance,
scala> val a = Array.ofDim[Int](3,3)
a: Array[Array[Int]] = Array(Array(0, 0, 0), Array(0, 0, 0), Array(0, 0, 0))

Likewise,
scala> val a = Array.ofDim[Int](3)
a: Array[Int] = Array(0, 0, 0)

In the context here,
val a = Array.ofDim[Int](NRows)

For setting (possibly nonzero) initial values, consider Array.tabulate, for instance,
scala> Array.tabulate(3,3)( (x,y) => 1)
res5: Array[Array[Int]] = Array(Array(1, 1, 1), Array(1, 1, 1), Array(1, 1, 1))

scala> Array.tabulate(3)( x => 1)
res18: Array[Int] = Array(1, 1, 1)

A: Zero is the default value for an array of Ints, so just do this:
    val array = new Array[Int](NRows)

If you want all those values to be 1s then use .fill() (with thanks to @gourlaysama):
    val array = Array.fill(NRows)(1)

However, looking at how this works internally, it involves the creation of a few objects that you don't need. I suspect the following (uglier) approach may be quicker if speed is your main concern:
    val array = new Array[Int](NRows)
    for (i <- 0 until array.length) { array(i) = 1 }


text:
Q: How to set WPF application windowstartuplocation to top right corner using xaml? I just want to set windowstartuplocation to top right corner of desktop. I saw this thread with same question:
Changing the start up location of a WPF window
I want my application to start in top right corner,where right refers to MY RIGHT SIDE(not as if my desktop is a person looking at me and ITS RIGHT SIDE).So,
1.) Setting left and top to 0 only is not a solution(brings app to left side not right)
2.) I tried using SystemParameters.PrimaryScreenWidth, but I can't perform operation to subtract the width of my app from this value at binding time.
Is there a way I can do it without going into much complexity?

A:
Is there a way I can do it without going into much complexity?

The simplest way would be to setup your start location manually, and then set the Left property in code behind:
<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1"
    Height="500" Width="500"
    WindowStartupLocation="Manual"
    Top="0">
</Window>

In your code behind:
public Window1()
{
    InitializeComponent();
    this.Left = SystemParameters.PrimaryScreenWidth - this.Width;
}

This is one place where I feel the simplicity of doing it in code outweights any disadvantages of introducing code behind.

A: By using WorkArea.Width make sure the width of the taskbar is taken into account (when placed on a side, left or right). By using this.Width or this.MaxWidth make sure your window never slips outside the work area, but both require their value be set (in xaml or in code behind) to not produce the value NaN (Not a Number) for this.Left.
public MainWindow()
    {
        InitializeComponent();
        this.Left = SystemParameters.WorkArea.Width - this.MaxWidth;
    }

<Window
    ... more code here ...
    WindowStartupLocation="Manual" Top="0" MaxWidth="500" >


text:
Q: How can i refer an exist textbox via string variable which contains the textbox object name? public void findspecific(int winnerx, int winnery)
{
   string ineed = "tb" + winnerx + winnery;
   ineed.text = "Something"; // --> this line isn't work because "ineed" is a string.
}

all the textboxes name starts with "tb" and the winnerx and winnery
 numbers together locate that textbox where the winner is
 I cant use ineed.Text because its a string not a button reference. How can i refer to tb(x)(y) button with "ineed" string
 variable?

A: May be something like this.
public void findspecific(int winnerx, int winnery)
{
    string ineed = "tb" + winnerx + winnery;
    if ( anyButton.Name.Equals(indeed))   //
    {
         anyButton.Text = "Something";
    }
}

A: For WinForms:
    public void findspecific(int winnerx, int winnery)
    {
        string ineed = "tb" + winnerx.ToString() + winnery.ToString();
        Control[] matches = this.Controls.Find(ineed, true);
        if (matches.Length > 0 && matches[0] is TextBox)
        {
            TextBox tb = (TextBox)matches[0];
            tb.Text = "Something";
        }
        else
        {
            MessageBox.Show(ineed, "No Match Found!");
        }
    }

A: I'm fairly new to WPF, but something tells me you cannot do this. The TEXTBOX is a resource and it's assigned a resource ID, making it a CONST. In my project, I have had to encapsulate text assignments by parsing the string and using IF statements to update the appropriate TEXTBOX.


text:
Q: Parsing XML in Perl using SAX I need to parse an XML file into Perl using SAX - for performing the following email validation checks.

*

*If the 'Id' contains only alphanumeric characters and its length is between 5 and 10

*If the 'LastLoginDate' is not older than 'CreationDate'

*If 'SubscriptionMontlyFee' = 0 && 'SubscriptionType'!= free

*If 'PaymentMode' is undefined && 'SubscriptionType'!= free

*If Provision < 0

*Internal Mail exists or not

*External Mail exists or not

*If InternalMail = External Mail

Otherwise, return an alert (print a message to notify).
accounts.xml
<?xml version="1.0" encoding="utf-8"?>
<Accounts locale="en_US">
  <Account>
    <Id>abcd</Id>
    <OwnerLastName>asd</OwnerLastName>
    <OwnerFirstName>zxc</OwnerFirstName>
    <Locked>false</Locked>
    <Database>mail</Database>
    <Customer>mail</Customer>
    <CreationDate year="2011" month="8" month-name="fevrier" day-of-month="19" hour-of-day="15" minute="23" day-name="dimanche"/>
    <LastLoginDate year="2015" month="04" month-name="avril" day-of-month="22" hour-of-day="11" minute="13" day-name="macredi"/>
    <LoginsCount>10405</LoginsCount>
    <Locale>nl</Locale>
    <Country>NL</Country>
    <SubscriptionType>free</SubscriptionType>
    <ActiveSubscriptionType>free</ActiveSubscriptionType>
    <SubscriptionExpiration year="1980" month="1" month-name="janvier" day-of-month="1" hour-of-day="0" minute="0" day-name="jeudi"/>
    <SubscriptionMonthlyFee>0</SubscriptionMonthlyFee>
    <PaymentMode>Undefined</PaymentMode>
    <Provision>0</Provision>
    <InternalMail>asdf@asdf.com</InternalMail>
    <ExternalMail>fdsa@zxczxc.com</ExternalMail>
    <GroupMemberships>
      <Group>werkgroep X.Y.Z.</Group>
    </GroupMemberships>
    <SynchroCount>6</SynchroCount>
    <LastSynchroDate year="2003" month="12" month-name="decembre" day-of-month="5" hour-of-day="12" minute="48" day-name="mardi"/>
    <HasActiveSync>false</HasActiveSync>
    <Company/>
  </Account>
  <Account>
    <Id>mnbv</Id>
    <OwnerLastName>cvbb</OwnerLastName>
    <OwnerFirstName>bvcc</OwnerFirstName>
    <Locked>true</Locked>
    <Database>mail</Database>
    <Customer>mail</Customer>
    <CreationDate year="2012" month="10" month-name="octobre" day-of-month="10" hour-of-day="10" minute="18" day-name="jeudi"/>
    <LastLoginDate/>
    <LoginsCount>0</LoginsCount>
    <Locale>fr</Locale>
    <Country>BE</Country>
    <SubscriptionType>free</SubscriptionType>
    <ActiveSubscriptionType>free</ActiveSubscriptionType>
    <SubscriptionExpiration year="1970" month="1" month-name="janvier" day-of-month="1" hour-of-day="1" minute="0" day-name="jeudi"/>
    <SubscriptionMonthlyFee>0</SubscriptionMonthlyFee>
    <PaymentMode>Undefined</PaymentMode>
    <Provision>0</Provision>
    <InternalMail/>
    <ExternalMail>qweqwe@qwe.com</ExternalMail>
    <GroupMemberships/>
    <SynchroCount>0</SynchroCount>
    <LastSynchroDate year="1970" month="1" month-name="janvier" day-of-month="1" hour-of-day="1" minute="0" day-name="jeudi"/>
    <HasActiveSync>false</HasActiveSync>
    <Company/>
  </Account>
</Accounts>

I have tried several unsuccessful attempts (follows) - and will highly appreciate your help in this regard.
Attempt for doing the parsing (but unable to retrieve values from the inner-hash).
use warnings;
use strict;
use XML::SAX;
my $parser = XML::SAX::ParserFactory->parser(Handler => MySAXHandler->new);
$parser->parse_uri("accounts.xml");

package MySAXHandler;
use base qw(XML::SAX::Base);

  sub start_element {
    my ($self, $el) = @_;

    my $ElementName = $el->{Name};
    my $attr = %{$el->{Attributes}};
    my $attr_value = %{$el->{Attributes}->{'LocalName'}};

    print my $loginID, "\n";
    print $ElementName, "\n";
    print $attr_value, "\n";
  }

For performing the validation checks.
    print "Currently looking into ".(scalar @account)."elements";

    #Checking If Login only includes Alphanumeric characters and has acceptable length
    print "ALERT - ID contains invalid characters" unless ($login =~ m/[a-zA-Z@.]+$/);
    # Or print "ALERT - ID contains invalid characters" unless ($accountRef->{"Login"} =~ /^[a-zA-Z]$/);
    print "ALERT - ID length is greater than 8 characters" unless (length.$account[0] > 20);

    #print "Suspicious ALERT - Account Creation and Login time is same" unless ($account[4] != $account[5]);
    print "Suspicious ALERT - Last Login was before the account creation" unless ($account[5] > $account[4]);
    print "Suspicious ALERT - Incorrect Login Counts" unless ($account[6] > 0 && $account[5] > $account[4]);

    #Checking if Subscription Type & Active Subscription Type is same - DISCARDED
    #print "ALERT - Preferred Subscription & Current Subscription Type is not same" unless ($account[9] eq $account[10]);

    #Checking if Subscription Fee matches the Subscription Type
    if( $account[9] eq "free" && account[12] = 0) {
        #print "The user subscription is on free subscription and there are no charges"
        return 0;
    } elsif((account[9] eq "light" || account[9] eq "regular" || account[9] eq "advanced") && account[12] <= 0) {
        print "ALERT - The user subscription is" account[9] "and he/she is not getting charged";
    } else {
        #print "The user subscription is " $account[9] "and he/she is getting charged" account[12];
        return 0;
    }

    #Checking if the Payment Mode is undefined and the subscription type is not free
    if($account[9] ne "free" && account[13] eq 'undefined') {print "ALERT - Payment mode is not being defined and the subscription type is not free"};

    #Checking if Provision is less than 0
    print "ALERT - The user balance is in negative" unless ($account[14] >= 0 );

    #Checking if Internal Email Exists or not
    print "ALERT - The user doesn't have an internal email address" unless ($account[15] != "" );

    #Checking if External Email Exists or not
    print "ALERT - The user doesn't have an external email address" unless ($account[16] != "" );

    #Checking if External Email Exists or not
    print "ALERT - The user doesn't have an external and internal email addresses are same" unless ($account[15] ne $account[16]);

    }

A: XML::LibXML::Reader provides a SAX-like interface, but you can inflate the element into a full XML::LibXML object when needed. The first two conditions would be tested as follows:
#!/usr/bin/perl
use warnings;
use strict;

use XML::LibXML::Reader;

my $r = 'XML::LibXML::Reader'->new(location => 'file.xml') or die;
while ($r->nextElement('Account')) {
    my $xml = $r->copyCurrentNode(1);

    my $id = $xml->findvalue('Id');
    if ($id !~ /^[[:alnum:]]+$/ || 5 > length $id || 10 < length $id) {
        print "Invalid Id: $id.\n";
        next
    }

    my @dates = map $xml->findnodes($_), qw( CreationDate LastLoginDate );
    my @date_strings = map sprintf('%4d%02d%02d%02d%02d',
                                   @$_{qw{ year month day-of-month hour-of-day minute }}),
                           @dates;
    if ($date_strings[0] gt $date_strings[1]) {
        print "Invalid dates for $id: @date_strings.\n";
    }

    ...
}

Note that LastLoginDate for "robynsa" is empty, so it can't be compared to CreationDate.

A: Well, with XML::Twig I'd approach it something like this:
#!/usr/bin/env perl
use strict;
use warnings;

use XML::Twig;
use Time::Piece;

sub process_account {
    my ( $twig, $account ) = @_;
    print $account -> first_child_text('Id'),"\n";
    if ( $account -> first_child_text('Id') =~ m/^\w{5,10}$/ ) {
        print "Id OK\n";
    }

    my $logindate = join ( "-", map { $account -> first_child('LastLoginDate')->att($_) // 0 } qw ( year month day-of-month ) );

    my $createdate = join ( "-", map { $account -> first_child('CreationDate')->att($_) // 0 } qw ( year month day-of-month ) );
    if ( eval{ Time::Piece -> strptime ( $logindate, "%Y-%m-%d" )} > eval{Time::Piece -> strptime ( $createdate, "%Y-%m-%d" )} ) {
         print "Create Date OK\n";
    }

    if (    $account -> first_child_text('SubscriptionMonthlyFee') eq '0'
        and $account -> first_child_text('SubscriptionType') eq 'free' ) {
       print "Subscription Type fee OK\n";

    }
    $twig -> purge; #empty data processed so far.
}

my $twig = XML::Twig -> new ( twig_handlers => { 'Account' => \&process_account } );
   $twig -> parsefile ( 'your_xml_file');

We set a handler on Account elements, which gets passed each as we go. We extract fields from the record, and validate them (this just prints, you should perhaps invert the logic and abort/warn etc.).
We also use purge because one of the major reasons to use a SAX style parser is memory footprint.


text:
Q: What are the alternative ways to say "paying attention"? What could be a better way to express "reacting to something with immediate attention"? Like, assuming that you are a job seeker and you've overheard someone talking about a job opportunity, so at that moment, you suddenly become attentive and feel compelled to learn it among the other things you might have heard. I need a word for such a reaction.
By the way, it's not necessarily a dangerous or bad thing for you in this case. Just something that you feel important.

A: An idiom that can be used in this situation is prick up (one's) ears

To become more or particularly alert, intrigued, or enthusiastic.

In your example, you could say

I'm looking for a job, so when I overheard someone talking about a job opportunity, my ears pricked up.

A variation of this spelling is perk up (one's) ears which is the one I'm more familiar with.


text:
Q: Hardware IO Access from Interrupt Handler with Windows XP 32 bit I have a Windows XP application that is using a driver called TVicHW32 which allows me to create an interrupt handler for OS interrupts. Currently I am using a custom ISA card in an industrial chassis with IRQ 5
The interrupt handler code is working and I can see a variable being incremented so the code that sets up and handles the interrupt is working.
The issue I have is that an IO access call fails to generate any IO activity on the ISA bus. I have an address at 0x308 that is used to trigger a start pulse on the ISA bus interface board.
If I trigger this pulse from the main code, for example, from a timer, the pulse is detected on the ISA bus and the card responds.
If I call the exact same function call to access that IO address from within the interrupt handler, nothing appears on the ISA bus. A logic analyser confirms this.
I have emailed the supplier of the driver but that can't help so I was wondering if anyone here has come across this situation and can offer a solution. This is critical to getting this project working and the only solution I can think of is to develop a custom driver with the DDK but as this requires a steep learning curve, I would hope to find an alternative solution.
Thanks
Dave...


text:
Q: Tips on improving random forest predictive accuracy when # of features is really low? Working on a random forest predictive model with a continuous response variable and two continuous features. Normally when I do RF projects I use some sort of feature selection method to choose which features to use. Then I fit the RF model onto those features. Then to test accuracy / related metrics I use cross validation, confusion matrices, etc.
However in this case I only have two given features. I don't want to just literally run a RF model on those two features as my whole entire project. I'm thinking gradient boosting is what I should learn? Also I think I should play around with the number of estimators and depth of the RF. I'm using sklearn in Python if that helps.
Any other suggestions? Obviously this type of problem/challenge is an unexplored area for me, so looking for best practices on how to add to my data science toolkit. Thanks!


text:
Q: Physical meaning of the chiral condensate in QCD Considering the QCD Lagrangian in the chiral limit, where all the quarks masses are set to zero. Then the Lagrangian has the following chiral symmetry:
$$
SU(L)_{V} \times SU(L)_{A} \times U(1)_{V} \times U(1)_{A}
$$
As it is known, this symmetry group doesn't reflect in the actual existence of the eigenstates, that is we can classify eigenstates under multiplets of $U(L)_{V}$ generators, while instead $U(L)_{A}$ is spontaneously broken.
When a symmetry is not there anymore, it means we have to find something to characterize the new configuration of the system; this takes the name of "order parameter".
In the specific case of chiral symmetry in QCD, the order parameter is the chiral condensate, i.e. the following operator
$$
\langle\Omega \lvert \bar{\psi}\psi(\vec{0},0) \rvert \Omega \rangle
$$
In fact, it can be found that
$$
\langle \Omega \lvert \left[Q_{a}^{A} (0),\bar{\psi} \gamma_{5}T_{b} \psi(\vec{0},0)\right] \rvert\Omega \rangle=-\frac{1}{L} \delta_{ab} \langle\Omega \lvert \bar{\psi}\psi(\vec{0},0) \rvert \Omega \rangle
$$
where $Q_{a}^{A}$ is the conserved charge, as it follows from Noether's theorem.
This expression, when the chiral condensate is $\neq 0$, leads to $Q_{a}^{A} \rvert\Omega \rangle\neq0$, which identifies the spontaneous symmetry breaking. Then the chiral condensate is a good order parameter for SSB.
My question is: is there a reason why that commutator is what we need to compute in order to have a chiral condensate? In particular I am confused about the fact that the operators appearing in the commutator differ each other only for a $\gamma_{0}$, $Q_{a}^{A}$ being $Q_{a}^{A}(0)=\int d^3x \psi^{\dagger}\gamma_{5}T_{a}\psi(\vec{x},0)$.

A: It's actually the other way around. That axial rotation of the pions ensures that, given its non-vanishing v.e.v., given by the condensate (assumed to be produced by QCD: a fact!), they therefore must be the Goldstone modes of the SSB of the axial charges. But, first, the chiral condensate is required so as to unleash all this.
Take L=2, for simplicity, and let's be schematic (~) about normalizations, which you may adjust to your satisfaction, in comportance with the conventions of your text.
Let us consider the relevant fermion bilinears and their representation of the $SU(2)_L\times SU(2)_R$. (By the way, the 3 axial $\vec{Q}_A$ do not close to an SU(2), as you wrote, as their commutators close to $SU(2)_V$ instead. Don't ever write this again... Also, $U(1)_A$ is broken explicitly by the anomaly, not spontaneously.) So, the 4 bilinears,
$\bar{\psi} {\psi} $, $\bar{\psi}\gamma_{5} \vec{\tau} {\psi} $ form a quartet of this chiral group formally analogous of the $\sigma, \vec{\pi}$ quartet of the σ-model of the 60s; in fact, they are the QCD interpolating fields for this quartet.
(If you are insouciant about i s and the like, you may think of this scalar-pseudoscalars quartet as a 4-vector $t,\vec{x}$ of the Lorentz group,
as a familiar mnemonic of the combinatorics/groupery to follow: The vector isorotations are analogous to the 3 rotations, and the 3 axials are analogous to the 3 boosts, acting on 4-vectors.)
You then see that
$$
  \left[\vec{Q}_{V},\bar{\psi}\psi\right]=0,
$$
$$
\left[\vec{Q}_{A},\bar{\psi}\psi\right]\sim \bar{\psi} \gamma_{5} \vec{\tau} \psi ~,
$$
$$
  \left[Q_{a}^{V}  ,\bar{\psi} \gamma_{5}\tau_{b} \psi \right] \sim \epsilon _{abc}
\bar{\psi}\gamma_{5}\tau^c\psi ~,
$$
and, crucially, the relation of interest, where you note the $\gamma_{0}\gamma_{5}$ makes all the difference in the combinatorics, as in the σ -model link, above,
$$
  \left[Q_{a}^{A}  ,\bar{\psi} \gamma_{5}\tau_{b} \psi \right] \sim
  \delta_{ab}  \bar{\psi}\psi ~.
$$
So the σ is an isosinglet; the axials transform the σ by $\vec\pi$s; the vector transform of the  $\vec \pi$s is an isorotation thereof; and the suitable "diagonal" axial transforms of the  $\vec\pi$s takes them to the
σ, the QCD analog of the Higgs of the EW interactions, the guy with the v.e.v.
Now take the v.e.v. $
\langle \Omega \lvert ... ...  \rvert\Omega \rangle$ of each of the above.
The r.h.sides of the first 3 must vanish; the v.e.v.s of the Goldstone modes are null!
The v.e.v. of the last one does not, but $=v\approx (250MeV)^3$, your relation of interest. QCD just achieves that, by dint of strong dynamics.  So, over and above making it impossible for the axials to annihilate the vacuum, it identifies the 3 pions as the Goldstone modes of the 3 SSBroken $\vec{Q}_A$.
In point of fact, you actually see that $\vec{Q}_{A} \rvert\Omega \rangle \sim |\vec{\pi}\rangle$, that is the axial charges pump pions (chiral goldstons) out of the vacuum--- the precursor to PCAC.
A final loose end, lest you might still object that the third relation with vanishing r.h.side would then be moot, $\langle  \vec{\pi} \lvert  \bar{\psi}   \psi \rvert\Omega \rangle=0$; but, no, the pion is orthogonal to the σ, just as it is to the original vacuum "chosen", $\langle  \vec{\pi}  \vert\Omega \rangle=0$.
(Could insert  $\vert\Omega\rangle \langle\Omega\vert$ above and factor out the order parameter, $\langle  \vec{\pi}   \vert\Omega \rangle v=0$ )
Further related (formally identical) questions might be 281696, and, needless to say, Gell-Mann and Lévy's timeless 1960 σ -model classic.


text:
Q: How to create rotated text in Python's turtle graphics? I am using Python 3.9 with tkinter and tcl version 8.6, so according to an answer here on stackoverflow from the year 2010, I should be able to draw rotated texts. And actually I am able to draw rotated texts in tkinter so I tried to create a rotated text with the turtle module too writing:
import turtle
txt = '      '
tt = turtle.Turtle()
tt.write(txt, angle=-45)

but got an error message: TypeError: write() got an unexpected keyword argument 'angle' which means that the turtle module does not yet support the text rotating feature.
This rises the question: Do someone know about a patch/fix which enables the turtle module to make use of the text rotation feature available in Python 3 since version 3.7.2 ?

A: I have written code of a patch which if added as a header to the turtle Python script allows to use the keyword argument txt_angle for creating rotated texts, so that the code:
import turtle
txt = '      '
tt = turtle.Turtle()
tt.write(txt, txt_angle=-45)

doesn't raise  a TypeError and draws a 45 degree rotated text.
Below the code of the patch followed by a short turtle script code creating attached image out of the rotated text:

class Patch_txt_angle:
    def RawTurtleDOTwrite(self, arg, move=False, align="left", font=("Arial", 11, "normal"), txt_angle=0):
        if self.undobuffer:
            self.undobuffer.push(["seq"])
            self.undobuffer.cumulate = True
        end = self._write(str(arg), align.lower(), font, txt_angle)
        if move: x, y = self.pos() ; self.setpos(end, y)
        if self.undobuffer: self.undobuffer.cumulate = False
    def RawTurtleDOT_write(self, txt, align, font, txt_angle):
        item, end = self.screen._write(self._position, txt, align, font, self._pencolor, txt_angle)
        self.items.append(item)
        if self.undobuffer: self.undobuffer.push(("wri", item))
        return end
    def TurtleScreenBaseDOT_write(self, pos, txt, align, font, pencolor, txt_angle):
        x, y = pos ; x = x * self.xscale ; y = y * self.yscale
        anchor = {"left":"sw", "center":"s", "right":"se" }
        item = self.cv.create_text(x-1, -y, text = txt, anchor = anchor[align],
            fill = pencolor, font = font, angle = txt_angle)
        x0, y0, x1, y1 = self.cv.bbox(item)
        self.cv.update()
        return item, x1-1
import turtle
turtle.RawTurtle.write         = Patch_txt_angle.RawTurtleDOTwrite
turtle.RawTurtle._write        = Patch_txt_angle.RawTurtleDOT_write
turtle.TurtleScreenBase._write = Patch_txt_angle.TurtleScreenBaseDOT_write
# ======================================================================
txt = '      '
tt = turtle.Turtle()
sc = turtle.Screen() ; sc.bgcolor("black")
for enum_index, txt_angle in enumerate(range(0, 36000, 1125)):
    if (enum_index)%4 == 0: tt.color("green" ); fontsize=10
    if (enum_index)%4 == 1: tt.color("yellow"); fontsize=15
    if (enum_index)%4 == 2: tt.color("red"   ); fontsize=10
    if (enum_index)%4 == 3: tt.color("orange"); fontsize=13
    txt_angle /= 100
    tt.setheading(txt_angle); tt.forward(100)
    tt.write(txt, font=("Arial", fontsize, "bold"), align="right", txt_angle=txt_angle)
    tt.backward(100)
from time import sleep; sleep(30)


text:
Q: How to get database name, password from web.config and use in another page I have to hard-coded DB details(User ID,Data Source,password)in my code(vb.net) as i am using SQL loader concept to load the data into a temporary table. Now i want to avoid the hard-code part.
Below is the code.
processStartInfo.Arguments = "User ID@Data Source/password " & FilePath & ctlFileName "

Now i want to provide the DB details(User ID,Data Source,password) from web.config to the above line.
How can i achieve that?

A: Always store your connection data in the web.config inside the appropriate section (where you can also encrypt it)
For example
<connectionStrings>
     <add name="theConString"
     connectionString="server=yourserver;database=yourdb;uid=username;password=pass;" />
</connectionStrings>

Then you can retrieve this data using the
Dim cnstr = WebConfigurationManager.ConnectionStrings("theConString").ConnectionString

And finally you could pass the retrieved string to a SqlConnectionStringBuilder to get back the individual keys of the string
Dim builder = new SqlConnectionStringBuilder(cnstr)
Dim password = builder.Password
....etc...

(I don't know which database are you using, this example is for Sql Server, but other providers have the same class used to parse or build a connectionstring)
According to your comment below, you have stored the connectionstring information in the AppSetting section. This is not the place recommended, however you can retrieve it from the AppSettings as well with
Dim cnStr = WebConfigurationManager.AppSettings("youKeyName").ToString()


text:
Q: Export path in .profile on mac I can't believe there isn't any tutorials about this after googling.
Can someone point me a direction or explain what these lines and variables mean in .profile on mac? How can someone configure them?
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
#export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export PATH=$PATH:/usr/local/mysql/bin
#export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
#export PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5/bin:/Applications/MAMP/htdocs/cake/cake/console:/opt/local/bin:/opt/local/sbin:$PATH
export PATH=/android-sdks/platform-tools:~/android-sdks/tools:$PATH
export PATH=/Users/android-sdks/platform-tools:/Users/android-sdks/tools:$PATH

A: From the man page, export simply sets an environment variable.
The PATH environment variable tells your Mac where to look for commands that you type on the command line, in the order that it should look. It is a list of paths, delimited by a colon.
The value $PATH is the current value of the PATH environment variable.
Thus, a line like
export PATH=/foo:$PATH

prepends /foo to the PATH
and
export PATH=$PATH:/foo

appends /foo to the PATH

A: Any line starting with # is a comment. PATH= sets the value of the PATH variable, $PATH expands to the current value, and the export at the beginning makes the value available to programs that you run from the terminal.
Let's assume that the initial value of PATH is /usr/bin:/bin.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH

Replace $PATH with the previous value of $PATH. So the above sets PATH to
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin

Moving forward,
export PATH=$PATH:/usr/local/mysql/bin

Again, replace $PATH with the previous value:
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/local/mysql/bin

After
export PATH=/android-sdks/platform-tools:~/android-sdks/tools:$PATH

we have
/android-sdks/platform-tools:~/android-sdks/tools:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/local/mysql/bin

(The ~ is a special token that will be replaced with the path to your home directory, but you should get the picture.)
And finally, after
export PATH=/Users/android-sdks/platform-tools:/Users/android-sdks/tools:$PATH

we get
/Users/android-sdks/platform-tools:/Users/android-sdks/tools:/android-sdks/platform-tools:~/android-sdks/tools:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/local/mysql/bin

PATH is used to find commands that you enter on the command line. So if you type foo, the shell will look for the names below, in the order specified:
/Users/android-sdks/platform-tools/foo
/Users/android-sdks/tools/foo
/android-sdks/platform-tools/foo
~/android-sdks/tools/foo
/opt/local/bin/foo
/opt/local/sbin/foo
/usr/bin/foo
/bin/foo
/usr/local/mysql/bin/foo

To see the current value of PATH, run
echo $PATH

Should you add new directories to the beginning of PATH, or to the end? It doesn't always matter, but sometimes it does. It depends on which locations you want the system to check first.
You should add to the beginning if the goal is to search other directories before looking in the default ones. For example, git is a utility used to manage source code. If I wanted to install a newer version of git in ~/git and use that by default, I'd do:
export PATH=~/git/bin:$PATH

This means that ~/git/bin/git would override /opt/local/bin/git.
On the other hand I might prefer to have the administrator install git system-wide. If I want to use my local copy only until the administrator makes it available for everyone, then this makes more sense:
export PATH=$PATH:~/git/bin

In this case ~/git/bin/git would only be used if /opt/local/bin/git didn't already exist since /opt/local/bin is earlier in the path.
A lot of commands won't exist in more than one place. For example you might write my-backup-script and put it on an Apple Time Capsule at /Volumes/Capsule/scripts. It's not likely that there would be a command called my-backup-script in any other location to conflict. So either of the following commands would let you type my-backup-script and run the right script:
export PATH=/Volumes/Capsule/scripts:$PATH

or
export PATH=$PATH:/Volumes/Capsule/scripts

Is one better? My advice would be to do the latter. Remember that system will need to search the directories in $PATH, in order, for every command that it needs to find. Most commands will be on the local system, so it makes the most sense to put slower network storage at the end of the path.

A: Run man
And then answer the question as export
You can see the current PATH value and observe that there are more than one path present.
(mine was /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin)
Observe that : represents end of a single path.
You can retrieve this by using $PATH
Now when you want to add one more  path to this list then you need to append current path to new path like /newPath:$PATH or $PATH:/newPath.
And at last for saving it you need to use export PATH=$PATH:/newPath.

Note : This answer is for novice developers.


text:
Q: SQL FK and Pre-Checking for Existence I was wondering what everyone's opinion was with regard to pre-checking foreign key look ups before INSERTS and UPDATES versus letting the database handle it. As you know the server will throw an exception if the corresponding row does not exist.
Within .NET we always try to avoid Exception coding in the sense of not using raised exceptions to drive code flow. This means we attempt to detect potential errors before the run-time does.
With SQL I see two opposite points
1) Whether you check or not the database always will. This means that you could be wasting (how much is subjective) CPU cycles doing the same check twice. This makes one lean towards letting the database do it only.
2) Pre-checking allows the developer to raise more informative exceptions back to the calling application. Instead of receiving the generic "foreign key violation" one could return different error codes for each check that needs to be done.
What are your thoughts?

A: Data integrity maintanence is the Databases's job, so I would say you let the DB handle it. Raised exceptions in this case is a valid case, and even though it could be avoided, it is a correctly raised exception, because it means something in the code didn't work right, that it is sending an orphaned record for insert (or something failed in the first insert - however way you are inserting it). Besides, you should have try/catch anyway, so you can implement a meaningful way to handle this...

A: Don't test before:

*

*the DB engine will check anyway on INSERT (you have 2 reads of the index, not one)

*it won't scale without lock hints or semaphores which reduce concurrency and performance (an 2nd overlapping concurrent call can pass the EXISTS before the first call does an INSERT)

What you can do is to wrap the INSERT in it's own TRY/CATCH and ignore error xxxx (foreign key violation, sorry don't know it). I've mentioned this before (for unique keys, error 2627)

*

*Only inserting a row if it's not already there

*Select / Insert version of an Upsert: is there a design pattern for high concurrency?

*SQL Server 2008: INSERT if not exits, maintain unique column
This scales very well to high volumes.

A: I don't see the benefit of pre-checking for FK violations.
If you want more informative error statements, you can simply wrap your insert in a try-catch block and return custom error messages at that point. That way you're only running the extra queries on failure rather than every time.


text:
Q: using PVectors to make speed constant I'm working on a school project in Processing, and I'm running into a bit of a problem. I have a bulletList array to that's looped in my draw() class, with Bullet objects that are initialized when the spacebar is pressed.
if(key==' '){
float currentPlayerX=playerX;
float currentPlayerY=playerY;
float currentMouseX=mouseX;
float currentMouseY=mouseY;
bullets.add(new
Bullet(currentPlayerX,currentPlayerY,currentMouseX,currentMouseY));
}

//in the draw method()
for(Bullet b: bullets){
b.shoot();
}

class Bullet{
float bulletX;
float bulletY;
float rise;
float run;

Bullet(float pX, float pY,float mX,float mY){

//I get the slope from the mouse position when the bullet was instantiated
to the bullet position (which starts at the player position and is
incremented out by the slope as shoot() is called

rise=(mY-pY)/12;
run=(mX-pX)/12;
bulletX=pX;
bulletY=pY;
}

void shoot(){

fill(255,0,0);
rect(bulletX,bulletY,7,7);
bulletX+=run;
bulletY+=rise;
}
}

Essentially, the trajectory of the Bullet is determined when the bullet object is first created, the end goal being: move the mouse to the desired direction, press the space bar, and watch the bullet go. The problem is the velocity is never constant. When the mouse is far away from the Player object, the speed is fine, but as the rise and run gets smaller as the mouse moves closer, the Bullet speed becomes really small. I actually ended up messing around with the rise and run floats, and dividing them by 12, because at their initial value the Bullet wasn't visible.
I've heard the PVectors are a good way to have velocity in games, but we never covered them in my class and I don't really know where to start. I've also tried dividing & multiplying by a constant to try to get a constant speed, but I'm basically shooting in the dark here. Any help is much appreciated, and please ask if you have any questions about how my code works; I'm happy to clarify.

A: What you're looking for is some basic trigonometry. Basically I'd break your problem down into smaller steps:
Step one: Get the angle between the source of the bullet and the mouse. Google "get angle between two points" for a ton of resources.
Step two: Convert the angle to a unit vector which is an x/y pair that you can think of as a heading. Google "convert angle to unit vector" for a ton of resources.
Step three: Multiply those x and y values of that unit vector by some speed to get the amount you should move the bullet each frame.
The PVector class does offer some of this functionality. Check out the reference for a list of useful functions.
If you're still stuck, please narrow your problem down to a MCVE. This can be as simple as one circle that follows the mouse. Good luck!

A: In addition to Kevin's answer I'd like to point you to a few helpful online resources:

*

*Vector magnitude & normalization on Khan Academy

*Daniel Shiffman's Nature of Code chapter on Vectors
These should help you normalize then scale the vector to a set speed, wether you choose to use PVector or not.


text:
Q: Алгоритм последовательности 2an-2–2, где a1=3 и a2=2 Здравствуйте! Подскажите, как составить алгоритм по заданию с чего нужно начать?
Создайте программу, выводящую на экран 12 первых элементов последовательности
 2an+1 = 2an-2–2, где a1=3 и a2=2.
UPD
без использования массива
A: Взять три переменные: A1, A2, A3.

*

*A1 = 3

*A2 = 2

*A3 = f(A2, A1)

*Вывести A3

*A1 = A2, A2 = A3

*Повторить с шага 3, пока не достигнут нужный элемент

A: Начать нужно, очевидно, с цикла.

int a = 3;
for (int number = 1; number <= 12; number++) {
   a = (2*a-4);
   System.out.println(a);
}

Воть. Синтаксис javaВСКИЙ.
Прошу прощения, если выдаст ошибку: на яве не прогал вообще. =) Но, думаю, вам надо только принцип? ;)
UPD
выведет 12 элементов, но до тринадцатого (a2-a13) так как a1 уже задан.
for (int number = 1; number < 12; number++) {

Так - 12
A: Высылаю класс, решающий данную задачу с помощью рекурсивной формулы:
public class Test {

    private static int f(int x) {
        if (x == 1) {
            return 3;
        } else if (x == 2) {
            return 2;
        } else {
            return 2 * f(x - 2) - 2;
    }
}

public static void main(String[] args) {
    for (int i = 1; i <= 12; i++) {
        System.out.println(i + " : " + f(i));
        }
    }
}

Надеюсь, что решение Вам подойдет.
С уважением, Евгений.

A:     int a1=3, a2=2, a3=0;
    for (int i=1; i<=12; i++) {
        a3 = 2*a1-2;
        System.out.print(a3 + " ");
        a1=a2;
        a2=a3;
    }