text:
Q: Error: Unable to resolve module react-redux/native I am trying my first react-native application with Redux and on running the application on device getting below error message,

"UnableToResolveError: Unable to resolve module react-redux/native from C:\project\Testing\index.android.js:
  Module does not exist in the module map or in these directories:  C:\project\Testing\node_modules\react-redux"

package.json:

{
    "name": "Testing",
    "version": "0.0.1",
    "private": true,
    "scripts": {
      "start": "node node_modules/react-native/local-cli/cli.js start",
      "test": "jest"
    },
    "dependencies": {
      "react": "15.4.1",
      "react-native": "0.40.0",
      "react-redux": "^5.0.2",
      "redux": "^3.6.0",
      "redux-thunk": "^2.2.0"
    },
    "devDependencies": {
      "babel-jest": "18.0.0",
      "babel-preset-react-native": "1.9.1",
      "jest": "18.1.0",
      "react-test-renderer": "15.4.1"
    },
    "jest": {
      "preset": "react-native"
    }
  }

index.android.js:
import React, { AppRegistry } from 'react-native';
import { Provider } from 'react-redux/native';
import App from './src/containers/App';
import configStore from './src/stores/configStore';
const store = configStore();
var TestingApp = React.createClass({
  render () {
    return (
      ...
    );
  }
});
AppRegistry.registerComponent('TestingApp', () => TestingApp);

Kindly assist to solve the issue.

A: From index.js of react-redux, you could get that Provider is exported by react-redux directly.
So you should use import { Provider } from 'react-redux' instead of import { Provider } from 'react-redux/native'.
You can also check the example from here.


text:
Q: aws s3api put-bucket-encryption cli command adds extra quotes when in cmd When I use the the following command in cmd to add bucket encryption to a certain bucket in my account there is additions quotes that show up and the command never really works. Other s3api command are working just fine.
Command I type:
aws s3api put-bucket-encryption --bucket MyBucket --server-side-encryption-configuration '{"Rules": [{"ApplyServerSideEncryptionByDefault": {"SSEAlgorithm": "AES256"}}]}'

What happens when I hit enter:
> aws s3api put-bucket-encryption --bucket MyBucket --server-side-encryption-configuration ''"'"'{Rules:' '[{ApplyServerSideEncryptionByDefault:' '{SSEAlgorithm:' 'AES256}}]}'"'"''

Any ideas what I am doing wrong in the AWScli?
Eventually once I have the command right I want to code it into my c# program but that will be another question.

A: For the record: Problem can be solved by escaping double quotes with backslash in JSON section:
aws s3api put-bucket-encryption --bucket MyBucket --server-side-encryption-configuration '{\"Rules\": [{\"ApplyServerSideEncryptionByDefault\": {\"SSEAlgorithm\": \"AES256\"}}]}'

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I correctly align this equation? I am currently trying to format the expression
\documentclass{report}
\usepackage{mathtools}
\usepackage{amsmath}

\DeclareRobustCommand*{\maxin}[0]{_{\boldsymbol{\raisebox{1.55pt}{$\scriptstyle\chi$}} \raisebox{0.565pt}{$\scriptstyle\in$} \Omega}}

\begin{document}

\begin{align}
    \max{\eta_D\left(\mathbf{J}_{\boldsymbol{\chia}_{k,l}}\right)} &\in (0,1]\\
    \text{subject to } &\left\{\begin{aligned}
        &\alpha_{12}^j &\le \dfrac{\pi}{6}\\
        &\alpha_{23}^j&\le \dfrac{\pi}{6}\\
        &\max\maxin\left|\beta_1^j\right| &\le \dfrac{\pi}{12} \\
        &\max\maxin\left|\beta_2^j\right| &\le \dfrac{\pi}{12} \\
        &\max\maxin\left|\beta_3^j\right| &\le \dfrac{\pi}{12}\\
        &\min\maxin\left(\mathcal{D}_{\omega^j}\right) &>0 \\
    \end{aligned} \right.\\
    \text{bounded by } &\left\{\begin{aligned}
        -\dfrac{1}{12}\pi &\le \varphi_1 &\le \dfrac{1}{12}\pi\\
        -\dfrac{1}{12}\pi &\le  \varphi_2&\le \dfrac{1}{12}\pi\\
        0 &\le \Theta_1     &\le \dfrac{8}{45}\pi\\
        0 &\le \Theta_2 &\le \dfrac{8}{45}\pi\\
        0 &\le \Theta_3 &\le \dfrac{23}{180}\pi\\
        (\varphi_1^j, \Theta_1^j) &\ne (\varphi_2^j,\Theta_2^j)& \ne (0,\Theta_3^j)\\
        \varphi_2^j &\ne 0&
    \end{aligned}\right.
\end{align}

\end{document}

However, the aligned environment doesn't produce a result that is actually aligned. How do I fix this?
Furthermore, it would be neat to horizontally align the pi terms, is that somehow possible to do?
Thanks in advance!

A: I'm not sure there's anything to align, except for the two big braces. Don't force alignment to objects that aren't related to one another.
\documentclass{article}
\usepackage{amsmath,bm}

\newcommand{\cchi}{\mathord{\mathop{\bm{\chi}}}}

\begin{document}

\begin{align}
\max\eta_D(\mathbf{J}_{\cchi_{k,l}}) &\in (0,1]
\\
\text{subject to }
  &\left\{\begin{aligned}
        &\alpha_{12}^j \le \dfrac{\pi}{6}\\
        &\alpha_{23}^j \le \dfrac{\pi}{6}\\
        &\!\max_{\cchi\in\Omega}|\beta_1^j| \le \dfrac{\pi}{12} \\
        &\!\max_{\cchi\in\Omega}|\beta_2^j| \le \dfrac{\pi}{12} \\
        &\!\max_{\cchi\in\Omega}|\beta_3^j| \le \dfrac{\pi}{12} \\
        &\!\min_{\cchi\in\Omega}(\mathcal{D}_{\omega^j}) >0
  \end{aligned} \right.
\\
\text{bounded by }
  &\left\{\begin{aligned}
        &{-}\dfrac{1}{12}\pi \le \varphi_1 \le \dfrac{1}{12}\pi\\
        &{-}\dfrac{1}{12}\pi \le \varphi_2 \le \dfrac{1}{12}\pi\\
        &0 \le \Theta_1 \le \dfrac{8}{45}\pi\\
        &0 \le \Theta_2 \le \dfrac{8}{45}\pi\\
        &0 \le \Theta_3 \le \dfrac{23}{180}\pi\\
        &(\varphi_1^j, \Theta_1^j) \ne (\varphi_2^j,\Theta_2^j) \ne (0,\Theta_3^j)\\
        &\varphi_2^j \ne 0
  \end{aligned}\right.
\end{align}

\end{document}

A: With dcases and nccmath for medium size fractions:
\documentclass{article}
\usepackage{nccmath, mathtools}
\usepackage{bm}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
\newcommand{\bchi}{\mathord{\mathop{\bm{\chi}}}}
\begin{document}
    \begin{align}
\max{\eta_D\left(\mathbf{J}_{\bchi_{k,l}}\right)}
    & \in (0,1] \\
\text{subject to}
        &   \begin{dcases}
            \alpha_{12}^j   \le \mfrac{\pi}{6}       \\
            \alpha_{23}^j   \le \mfrac{\pi}{6}       \\
            \max_{\bchi\in\Omega}\abs{\beta_1^j}   \le \mfrac{\pi}{12}   \\
            \max_{\bchi\in\Omega}{\abs{\beta_2^j}} \le \mfrac{\pi}{12}   \\
            \max_{\bchi\in\Omega}{\abs{\beta_3^j}} \le \mfrac{\pi}{12}   \\
\min_{\bchi\in\Omega}\bigl(\mathcal{D}_{\omega^j}\bigr) >0               \\
            \end{dcases}\\
\text{bounded by}
        & \begin{dcases}
            -\mfrac{1}{12}\pi \le \varphi_1 \le \mfrac{1}{12}\pi\\
            -\mfrac{1}{12}\pi \le \varphi_2 \le \mfrac{1}{12}\pi\\
            0 \le \Theta_1 \le \mfrac{8}{45}\pi                 \\
            0 \le \Theta_2 \le \mfrac{8}{45}\pi                 \\
            0 \le \Theta_3 \le \mfrac{23}{180}\pi               \\
(\varphi_1^j,\Theta_1^j) \ne (\varphi_2^j,\Theta_2^j) \ne (0,\Theta_3^j)\\
            \varphi_2^j \ne 0
        \end{dcases}
    \end{align}
\end{document}


text:
Q: Retrieve logger in log4rs I am a C++ developer and explore Rust. I am used to the log4cxx library and try to find my way around in its Rust counterpart log4rs.
I created a library that parses an xml into a struct. Logging is done with the log:: macros which provide the implementation agnostic interface.
Now how would I go about retrieving a log4rs logger and passing that to the object. It seems that all the log macros use the root logger which kind of breaks the advantage of using log4rs in the first place.
Solution:
Thanks to @Jmb for the answer. Here is an example of what I intended to do (crate name: test_crate):
in main.rs
  // configure log4cxx logger
  let stdout = ConsoleAppender::builder()
    .encoder(Box::new(PatternEncoder::new("{d} - {m}{n}")))
    .build();

  let config = Config::builder()
    .appender(Appender::builder().build("stdout", Box::new(stdout)))
    .logger(Logger::builder().build("test_crate::my_module", LevelFilter::Trace))
    .build(Root::builder().appender("stdout").build(LevelFilter::Warn))
    .unwrap();

  log4rs::init_config(config).unwrap();

and calling the log::... macros from the within the my_module module in the lib.rs
note: Ideally the logger should be configured in a separate logging config file to configure the logger at runtime.

A: By default the log macros use a different logger for each Rust module: A target is a string which defaults to the module path of the location of the log request, though that default may be overridden.. You can use e.g. info!(target: "foo", "message"); to target a different logger.


text:
Q: How to smooth out WPF line segment of path figure The below is Android code.
path.moveTo(xx, yy);
for (...) {
    path.lineTo(xx, yy);
}
canvas.drawPath(this.path, paint);

In order to remove the sharp corner, I am using
final CornerPathEffect cornerPathEffect = new CornerPathEffect(50);
paint.setPathEffect(cornerPathEffect);

When comes to WPF, I am using the following code.
PathFigure pathFigure = new PathFigure();
pathFigure.StartPoint = new Point(xx, yy);
for (...) {
    LineSegment lineSegment = new LineSegment(new Point(xx, yy), true);
    lineSegment.IsSmoothJoin = true;
    pathFigure.Segments.Add(lineSegment);
}
PathGeometry pathGeometry = new PathGeometry(new PathFigure[] { pathFigure });
drawingContext.DrawGeometry(null, new Pen(Brushes.White, 3), pathGeometry);

I am getting the following effect.

Note that, I avoid from using PolyQuadraticBezierSegment or PolyBezierSegment. It tend to become unstable. This means, whenever I add a new incoming point to the line graph, the newly added point will tend to change the old path, which is already drawn on the screen. As an end effect, you may observer the whole line graph is shaking
May I know in WPF, how I can smooth out the line segment? Although I have used lineSegment.IsSmoothJoin = true;, I still can see the sharp corner. Can I have something equivalent to Android's CornerPathEffect?

A: I know, zombie thread post.  You probably already solved this problem, but here are my thoughts years after the fact...

Since smoothing is dependent on multiple points in the line I think it will be quite difficult to find a smoothing algorithm that looks reasonable without producing some instability in the leading edge.  You can probably reduce the scope of the instability, but only at risk of producing a very odd looking trace.
First option would be to use a spline algorithm that limits the projection artifacts.  For instance the Catmull-Rom algorithm uses two known points on either side of the curve segment being interpolated.  You can synthesize two additional points at each end of the curve or simply draw the first curve segment as a straight line.  This will give a straight line as the last segment, plus a curve as the second to last segment which should change very little if at all when another point is added.
Alternatively you can run the actual data points through an initial spline calculation to multiply the points, then run those points through the spline algo a second time.  You'll still have to update the most recent 2m points (where m is the multiplier of the first pass) or the output will look distorted.
About the only other option I can think of is to try to predict a couple of points ahead based on your prior data, which can be difficult even with a fairly regular input.  I used this to synthesize Bezier control points for the ends of my curves - I was calculating CPs for all of the points and needed something to use for the end points - and had some interesting times trying to stop the final curve segments from looking horribly deformed.
Oh, one more... don't graph the final curve segment.  If you terminate your curve at Pn-1 the curve should stay stable.  Draw the final segment in a different style if you must show it at all.  Since C-R splines only need +/- 2 known points from the interpolation the segment Pn-2-Pn-1 should be stable enough.
If you don't have code for the C-R algorithm you can do basically the same thing with synthetic Bezier control points.  Rather than attempt to describe the process, check out this blog post which gives a fairly good breakdown of the process.  This article has code attached which may be useful.


text:
Q: What happens when a laser beam is stuck between two mirrors and the distance in-between is decreased gradually? Heisenberg Uncertainty Principle Assuming a laser beam going back and forth between two mirrors, what would happen if we keep bring the mirrors closer and closer to each other? Because after a certain width, we would be knowing both the momentum and the position of photons which would violate Heisenberg Uncertainty Principle?
So, how would the laser beam react in this scenario? What would happen?

A: Note: the following was intended as a response to a question posed in the comments of a previous answer ("why does the force increase as we move the mirrors together?"), not as a complete answer. In particular, I have ignored the ability of the photons to escape the mirror confinement.

The laser beam exerts a force on the mirrors, $F = P/c$ where P is power.
To push the mirrors together you must do work, which increases power, which increases force, which is a recursion, which probably needs a numerical solution with a computer.
There might be some trick to elegantly solve this but I don't know it, so I'll just carry it until the point where I'd let a computer do the rest for me.
Problem 1: Do Work on Photons, Ignore the Beam
Doing work on the beam is doing work on the photons.
The photon kinetic energy is $T = h \nu$ so when you do work on n photons $W = n\int_0^{x'} dT/dx$, you increase the frequency such that $\nu_f = \nu_0 + W/hn$
This accounts for the conservation of energy: when you do work on the beam (with perfectly reflective mirrors) you must increase the energy of the beam. Remember that we don't actually know what W is, because W is a function of F which is a function of P which changes with W.

Problem 2: Increase Energy Density, Ignore the Work
Furthermore, suppose the distance between the mirrors was initially D. Then the energy of the beam was:
$$E_0 = P D/c$$
Conserve energy and leave out the conservation of energy from doing work, we have already accounted for it by increasing photon energy. So treat E as a constant. When you push the beams together distance $x'$ at constant E, we must increase P:
$P = cE_0/(D-x')$

Put The Results Together
We know the power of the beam scales linearly with the energy of the photons so we can just multiply our result for problem 2 by the ratio of photon kinetic energies.
$T/T_0 = \nu_f/\nu_0 = 1 + W/nh\nu_0$
$P = \frac{cE_0}{D-x'} + \frac{cE_0W/nh\nu_0}{D-x'}$

A: Let me propose that from a mathematical point of view this question has nothing to do with quantum mechanics. You have got a standing wave between two fixed boundaries (a vibrating string is a perfectly valid image) and the "uncertainty principle" says there is a relation between the frequency (which in quantum mechanics is proportional to the uncertainty of photon momentum) and the distance between the boundaries (which give the uncertainty in the position). Concretely the frequency is inversely proportional to the wavelength (with the invariant wave propagation speed as conversion factor), and the latter cannot exceed twice the distance between the boundaries for a standing wave.
Now what happens when you bring the boundaries closer together, as in an upward glissando? Although the change of boundary position at finite speed will perturb the standing wave solution in a complicated manner, it would seem that in the limit of slow change what essentially happens is that the frequency of the vibration goes up inversely proportionally to the remaining distance. In the photon* image, the (theoretically infinitely hard) mirrors by moving together exert work on the photons, which thereby gain energy and frequency, and therefore uncertainty of momentum. The uncertainly principle remains valid.
*I might add that talking about photons is pointless here; photons only are a relevant notion when there is exchange of energy form, which can only happen in quanta. In the described situation the wave picture is entirely sufficient, no need for a particle view.

A: As everything the devil is in the details of how exactly you set up this experiment. But roughly speaking after a certain amount of time you will find that 1. The amount of force it takes to push the mirrors very close gets very high.  And 2. You will find that the photon doesn't always stay between the mirrors.

A: I would like to address something interesting the other answers do not mention, that is, that there are no perfect mirrors, and the interaction between the atoms in the mirror and the photons does matter:

*

*reflection (elastic scattering)

*absorption (heating up the mirror), the photon transfers its energy to the absorbing atom/electron system and the photon ceases to exist
Now in your case, both happen, it is just that the probability of reflection is much higher, but even then, some photons will be absorbed by the mirror and will heat up the mirror (please note it is possible in this case that the atom will re-emit the excess energy, but that could be in a random direction, and at a different energy level/ or cascades, thus not contributing to your example of laser beam).

In the real world the mirrors aren't perfectly reflecting so you need to supply energy to make up for the energy lost by absorption at the mirrors (this also ends up heating up the laser).

Why is it necessary to supply constant electricity to make a laser work?
As you move the mirrors closer and closer, the number of interactions rises per unit time (there will be more and more interaction in the same period of time), and in absolute sense, there will be more and more absorptions. Thus, way before you would have to consider the HUP, you will run out of photons in your laser beam, because they will all be absorbed by the mirrors' atoms, and their energy will heat up the mirror.
So the answer to your question is that eventually all the energy in your laser beam will be transferred to the mirror (heat it up) before the mirrors would be too close to consider the HUP.

A: Most of the answers tackle the classical problem described in the first part of the question involving a laser and mirrors.  I'm going to focus on the part of the question about the uncertainty principle.
infinite square well
There's a "toy" system that is studied by many introductory quantum mechanics students.  The system is a single quantum particle trapped in a rigid 1D box.  The potential energy of the particle is described as an infinite square well.
The position wavefunction of the particle is exactly zero outside of the box, so the particle remains trapped.  Photons are massless, but for the time being, lets imagine a massive particle in the box.  The energy eigenstates of the system are
$$ E_n = n^2 \frac{\pi^2\hbar^2}{2m L^2},$$
where $m$ is the mass of the particle and $L$ is the length of the box.  In the minimum energy (or ground) state $n=1$, and $E_1 \ne 0$.  The particle cannot stop moving.  It must have some energy.
In an energy eigenstate the particle's energy is exactly known, but its position is in a mixture state.  The position wavefunction is non-zero in many places inside of the box.  We could approximate the position uncertainty, the width of the wavefunction, as the size of the box:
$$\Delta x \approx L$$
(It's possible to exactly calculate $\Delta x$, and the Wikipedia article linked above works it out)
If the particle is in a definite energy state, then its energy is known exactly.  Since $E = \frac{p^2}{2m}$ it might seem that its momentum must be known exactly too.  But because momentum is squared in the equation, its momentum can be either positive or negative.  The particle could be moving to the left or right.  In the ground state
$$ p = \pm \sqrt{2m E_1} = \pm \frac{\pi\hbar}{L}. $$
We can approximate the momentum uncertainty as
$$\Delta p \approx \frac{\pi\hbar}{L}$$
(again, the Wikipedia article works it out exactly)
Using our approximations:
$$\Delta x\, \Delta p \approx \pi \hbar \ge \frac{\hbar}{2}$$
The size of the box $L$ cancelled out.  It doesn't matter how small the box is the uncertainty relation holds.
In the energy equation we can see that if we decrease $L$, the minimum energy increases.  This in turn increases the momentum uncertainty.  When we decrease the position uncertainty the momentum uncertainty grows to compensate.
As others point out, there is an energy cost to shrinking the box.  To decrease $L$, we must increase the energy of the particle.  As $L$ gets smaller and smaller, the energy cost blows up.  It would take an infinite amount of energy to decrease $L$ to zero.  We just can't do it.
a photon in a box
The same idea holds for a photon.
The infinite square well is a perfectly reflective box.
The photon wavefunction is a standing wave for the energy eigenstates, so $L = \frac{n}{2}\lambda_n$.
The energy eigenstates are
$$E_n = \hbar \omega_n = \frac{2\pi\hbar c}{\lambda_n} = n \frac{\pi \hbar c}{L}$$
We use the relativistic relation between the energy and momentum of a particle.  For a massless photon, we see
$$E^2 = p^2 c^2 + m^2 c^4 \quad\implies\quad E = \pm pc.$$
We have the same direction ambiguity in the momentum associated with an energy eigenstate of the photon.
In fact using our simple approximation, we get the same
$$\Delta x \approx L \quad\text{and}\quad \Delta p \approx \frac{\pi\hbar}{L}$$
in the ground state!

A: I will add yet another answer, which would be the most accurate to your description of a laser beam bouncing between 2 mirrors (if starting from "macro" distances), albeit my lack of time will make my answer non-exhaustive.
What you describe is none other than a fabry-perot interferometer, or a resonator. In this case, within the mirror walls, the only allowed wavelengths are those which are a multiple of $2L$ where $L$ is the distance between the mirrors. All other wavelengths are radiated out of the cavity due to destructive interference inside and constructive outside. Which means that with whichever photon frequency with which you start, if first in resonance, as you move the mirrors, it will immediately leak out of your cavity (in the case of really high-finesse resonator or reflectivity approaching 100%).
Also, in other words, the shortest you can confine a photon in a resonator, is a resonator that has half the wavelength's size. Smaller and it will always leak out.
The (complex) wave characteristic of electric fields wins in this scenario, so it is not possible to slowly spatially confine a laser of frequency $\nu$ inside a cavity.

A: A similar experiment is what I call quantum fly. The classical fly problem is well known:

From point A and point B two trains depart simultaneously towards each other along the same track with speeds $u_A,u_B$. A fly starts at the windschield of train A, flies towards the windschield of train B at speed $v$, turns back towards train A, and so on, till it is squashed by the two colliding trains. What is the distance covered by fly?

In quantum case we are talking about a potential well, the walls of which collapse, and an electron in this well. What will happen to it?
Of course, it depends on the details of the problem, but a few things can be conjectured immediately:

*

*As we know from the solution for the time-independent well, if it is too narrow, its levels will become separated by greater and greater energy. If the well is finite, it will end up with no bound state in it. i.e., electron will be ejected - the fly doesn't die!

*From time-dependent perturbation theory we may also conjecture that the trains will add energy to the electron, as it is excited to higher and higher energy states. If the well is infinite, it will eventually get excited to infinitely high energy.

And so on. Note that much of this reasoning can be adapted for a photon in a shrinking cavity.
Remark on Heisenberg uncertainty relations
Note that, if the walls are truly infinitely high, the uncertainty relation does not depend on the width of the well (see this answer for full derivation):
$$
\sigma_x\sigma_p=\frac{\hbar}{2}\sqrt{\frac{6\pi^2n^2-1}{3}}
$$
Indeed, while the collapsing walls localize the particle, making its momentum more certain, the uncertainty in the momentum actually grows as
$$
\sigma_p=\frac{\pi\hbar n}{L}
$$


text:
Q: how to convert pdfkit object into buffer using nodejs I am generating pdf document using pdfkit(nodejs module).i need to convert the pdfkit object to buffer and send response as attachment file without save a file in server.
i was using output function to achieve this:
pdfdocument.output(function(buffer){
    return buffer;
});

pdfkit deprecated the output function.
so right now i dont know how to do
any idea...

A: Working example for pdfkit v0.8.0:
let pdf = new pdfkit();

let buffers = [];
pdf.on('data', buffers.push.bind(buffers));
pdf.on('end', () => {

    let pdfData = Buffer.concat(buffers);

    // ... now send pdfData as attachment ...

});

pdf.text('Hello', 100, 100);
pdf.end();

Hope it helps :)


text:
Q: Displaying CSV with WKT in ArcMap? I have been given a CSV which has a mixture of point and polygon data.  I am trying to open this up in ArcMap 10.5.1
I have no idea what I should be doing!  I have tried to look for answers online but pretty much everything is a python script that is just dealing with points, and looks like it isn't much data, compared to my mix of types and large set.
Any suggestions on how I can view this data in my map??

A: You could try a Python script something like this one below.  It expects your CSV to have only one columnn (ie, only the WKT field) and no header row.  It also can only handle one geometry type (either points, lines or polygons, not a mixture).  So you will need to either split your CSV into multiple files (one for each feature type) or modify the script further to detect which type of geometry it is reading for each line, and write the resulting feature to the appropriate feature class.  For the sake of simplicity, I will assume the former (but the latter is not difficult to do).
If your CSV has more fields that just the WKT ('SpatialLocation') column then open it in Excel (or some other spreadsheet editor) and delete all other columns.  Then delete the header column.  Then save as a new file (text/CSV).  Then resave in three separate CSV files, each of which has only POINTS, LINES or POLYGONS respectively.
Then run create and run the following Python script on on each of these files (changing the first two lines each time to point to the respective Point/Line/Polygon CSV to be read in and the Point/Line/Polygon feature class to be created):
inFile = "path/to/CSV/file"
outFC = "path/to/new/feature_class"
srs = arcpy.SpatialReference(<YOUR_EPSG_CODE_ETC>)

arcpy.CreateFeatureclass_management(os.path.dirname(outFC), os.path.basename(outFC), geom.type, spatial_reference=srs)

with open(inFile, 'r') as f:
    inWKT = f.readline()
    while inWKT:
        geom = arcpy.FromWKT(inWKT, srs)
        with arcpy.da.InsertCursor(outFC, ["SHAPE@"]) as cur:
            cur.insertRow([geom])
        inWKT = f.readline()


text:
Q: How can I make a fast pixel-changing animation widget in Python 3? What I want:
I want an animation widget with fast display1 generation (meaning the generation time should be smaller than 20 seconds) and with a special function to run pixel-changing animations with a very small run time (meaning the run time should be smaller than 20 ms) in Python 3.
Wrong method:
The simplest method is a pixel panel. But it is generating very slowly2.
This is the code:
import tkinter as t

tk = t.Tk()
n = 1100
k = 900 # Display sizes
canvas = t.Canvas(tk, width =k, height = n)
canvas.grid(column = 0, row = 0)
ids = [] # Pixel identifiers

for i in range(n):
    id2 = []
    for j in range(k):
        id2.append(cv.create_rectangle(i,j,i+1,j+1,outline = "black"))
    ids.append(id2)

def animation(animation_list): # Animation function, animation_list - list of coordinates and colors tuples (as an example,[(1, 0, "red"), (2, 1, "green")].
    global canvas
    for x, y, color in animation_list:
        canvas.itemconfig(ids[x][y],outline = color)

1 Sizes are 1100x900 pixels (990k pixels)
2 Debug (not debugger) shows 22 seconds, but it took more than a minute, and the window is lagging.

A: I found it! Thanks to Mike-SMT for the idea!
This is my code:
import os
import pygame as pg
from random import *
# It is used as a library

main_dir = os.path.split(os.path.abspath(__file__))[0]
data_dir = os.path.join(main_dir, "data")

def show(image): # Shows surface
    screen = pg.display.get_surface()
    screen.fill((255, 255, 255))

    screen.blit(image, (0, 0))
    pg.display.flip()

def main(): # Reacts on window closing.
    pg.init()

    pg.display.set_mode((255, 255))
    surface = pg.Surface((255, 255))

    pg.display.flip()
    while 1:
        for ev in pg.event.get():
            if ev.type == pg.QUIT:
                brk = 0
                pg.display.quit()
def animate(pixels): # Animation function.pixels is array of arrays as [x, y, (r,g,b)]
    global surface
    ar = pg.PixelArray(surface)
    for x, y, color in pixels:
        ar[x, y] = color
    del ar
    show(surface)
main()

It solves the problem, because it is fast and has an animation function, as needed.


text:
Q: Swift: Segmentation fault 11 on importing files to bridging header I have this legacy code base written in objective C, I recently tried to incorporate swift, I made all the necessary changes for using swift like bridging headers and build settings. When I add new objective C files and import them to bridging header everything works fine, but when I try to import old objective c classes the code stops compiling stating Segmentation fault.
Can you please suggest some possible solution?
Thanks
Ankit

A: Try this, go to Build Settings -> Swift Compiler - Code generation, set Optimisation Level to None.

Hope this may help you.

A: In my case, this issue was due to CocoaPods. My version of CocoaPods was too high for a few of the pods I was using. Switched back to an older version of CocoaPods, pod update, clean + build.


text:
Q: How can I allow my webparts to share js variables in sharepoint 2007 I am working in MOSS 2007 and have a page which contains two page utilities(very similar to iframes but in corasworks webpart form)
The first is pointing to an aspx page which contains a custom display adaptor which allows me to use xslt and html, and a content editor pointing to a txt file with the majority my javascripts.
As for the second it points to a different aspx which also contains a different custom display adaptor and a content editor which points to the same txt file for the scripts.
On the file for the scripts I have a global variable, I am testing it's value by using an alert on both webparts and both alerts show the initial value at first, but when I change the value of that variable with the first webpart and try the alerts again on both, I get the changed value only on the first, but still the original value when it is shown on the second.
I ultimately would like to have the second and show the changed value as the first does, but apparently I am not accessing or storing this correctly
I believe this could be a parent/child issue but cannot seem to pass the variable back and forth between the two can anyone propose a suggestion as to how to go about doing this?
It would be greatly appreciated
Thanks,


text:
Q: Javascript array transferring, but values are not I have a function quickbuy_view.checkout()
which accepts a product object.
I call the function with
quickbuy_view.checkout(new Product(12530257))

This is part of the code where a bug arises
console.log('quickbuy_view')
console.log(quickbuy_view)
console.log('quickbuy_view.product')
console.log(quickbuy_view.product)
console.log('quickbuy_view.product.displays');
console.log(quickbuy_view.product.displays);

var display = quickbuy_view.product.displays[0];
//This is where the actual error occurs
$('#quickbuy .display .main img').attr('src',display.vw1Reg)

In chrome's console I can see that quickbuy_view.product returns an object with an displays array of length 3. However when I attempt to log quickbuy_view.product.displays, an empty array is returned.
The weird thing is, when I later enter quickbuy_view.product.displays, I get the array as expected.

A: It's because of the way Chrome Dev Tools console.log works. When you log an object it's still live, that is it's not a snapshop of it's present state. However, when you log a primitive it is the current state of the property.
So the displays array is being set after the code is being logged but when you inspect the product property it is "live" so it doesn't get updated until you expand it.


text:
Q: Booting Ubuntu causes LAN to stop working in Ubuntu and Windows until BIOS reset I've just installed Lubuntu 17.04 alongside Windows 7
When I run Lubuntu then the port does not work, the indicators are not lit, nothing at all, and I cannot connect.
When I restart the PC on Windows, the same situation happens; the network card does not work no signs of life (although in fact everything is fine-tuned, and was working before I installed Linux)
I found the solution to the problem was to pull out the PC and do a BIOS reset (clrcmos).
When I start Windows everything works, everything is as usual, and when I run Linux, everything will repeat.
This problem was observed in other Linux distributions (Ubuntu, Linux Mint).
What can the problem can be and how it can be solved?
Motherboard: Gigabyte GA-H81-D3 rev.2.0
CPU: Intel(R) Pentium(R) CPU G3220 @ 3.00GHz
GPU: NVIDIA GeForce GTX 750 Ti
RAM: 8,00 GB
LAN: Realtek PCIe GBE Family Controller (RTL8167)
BIOS: FB. date: 07/31/14 Ver: 04.06.05

A: Since you are experiencing this problem in two different operating systems, it could be a hardware issue with the network card.  Try performing a power reset or hard reset on the system.
The following steps are how to perform the reset:

*

*Shut down the computer.

*Remove all power from the computer.  (If it is a laptop, remove the battery)

*With all power removed, press the power button and hold it for 15 seconds, or press it a few times in a row.

*Connect power back to the computer and power it back on.

If this procedure does not work it could be an actual hardware failure and needs to be replaced.
This procedure can work with fixing computers that will not power on, network cards running slow, hard drives not being detected, etc.  Motherboards have capacitors on them that store power.   The slow power drain from capacitors can keep power going to other parts of the motherboard keeping memory in them when the computer is powered off.  Pulling the power and pressing the power button will cause the motherboard itself to try to power back on.  This causes all the capacitors to be drained thus clearing any memory stored.
Hope this helps!


text:
Q: Magento Version 1.9.2 Clicked System in Admin and Receive Error:Invalid config field backend model: backup/config_backend_cron I have everything running pretty well on my Magento site, but I keep running into this weird error when I click Configuration -> Advanced -> System
I have been searching for hours now trying to figure out the solution. I see a lot of people usually have a file missing or php class, but I have the app/code/core/Mage/Backup and associated files inside the folder along with the proper files in accordance. Per standards, you don't touch the Mage core files. So any ideas???
a:5:{i:0;s:62:"Invalid config field backend model: backup/config_backend_cron";i:1;s:1748:"#0 /var/www/html/dev/cpi-magento/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php(328): Mage::throwException('Invalid config ...')
#1 /var/www/html/dev/cpi-magento/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php(229): Mage_Adminhtml_Block_System_Config_Form->initFields(Object(Varien_Data_Form_Element_Fieldset), Object(Mage_Core_Model_Config_Element), Object(Mage_Core_Model_Config_Element))
#2 /var/www/html/dev/cpi-magento/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php(164): Mage_Adminhtml_Block_System_Config_Form->_initGroup(Object(Varien_Data_Form), Object(Mage_Core_Model_Config_Element), Object(Mage_Core_Model_Config_Element))
#3 /var/www/html/dev/cpi-magento/app/code/core/Mage/Adminhtml/Block/System/Config/Edit.php(92): Mage_Adminhtml_Block_System_Config_Form->initForm()
#4 /var/www/html/dev/cpi-magento/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php(107): Mage_Adminhtml_Block_System_Config_Edit->initForm()
#5 /var/www/html/dev/cpi-magento/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_System_ConfigController->editAction()
#6 /var/www/html/dev/cpi-magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('edit')
#7 /var/www/html/dev/cpi-magento/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#8 /var/www/html/dev/cpi-magento/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#9 /var/www/html/dev/cpi-magento/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#10 /var/www/html/dev/cpi-magento/index.php(84): Mage::run('', 'store')
#11 {main}";s:3:"url";s:104:"/dev/cpi-magento/index.php/admin/system_config/edit/section/system/key/d4cb4bbf89cbd80524f1e1527eaaf549/";s:11:"script_name";s:26:"/dev/cpi-magento/index.php";s:4:"skin";s:5:"admin";}

A: So, found that my server did not have write access to my exception.log and system.log. Found it was missing the app/code/core/Mage/Backup/Model/Config/Backend folder and associated files causing the error. For you new users, make sure your log files are read and writable! Holy helps so much for debugging things. It told me what was missing.


text:
Q: Want to Print a Particular Number in Spacy Feature Extraction In this Code, If I Want to Print a Particular Number What Should I do. Please Help Me With a Code,
Output I Needed
Numbers: ['1']
Code
import spacy
nlp = spacy.load("en_core_web_sm")
text = "Hello 1 2 3"
doc = nlp(text)
for token in doc:
    print(token, token.pos_)

print("Numbers:", [token.text for token in doc if token.pos_ == "NUM"])

Output
Hello INTJ
1 NUM
2 NUM
3 NUM
Numbers: ['1', '2', '3']

A: You may get the first item only using list slicing:
>>> print("Numbers:", [token.text for token in doc if token.pos_ == "NUM"][:1])
Numbers: ['1']


text:
Q: grid image is not going into place I am trying to get the image on section-1 to go to the right side, however it is not working. I have tried using flex-box but I want the picture to be stay on the right side of the screen and not move. I have also tried using floats, but that disrupts the whole section beneath it, so I decided to use grid. I have set it to display grid and set the columns but it is still not working.

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 100%;
  height: 50px;
  background-color: white;
  display: flex;
  line-height: 50px;
}

.navbar .container {
  align-items: center;
  display: flex;
}

.navbar-list {
  display: flex;
  margin: auto;
}

.navbar-list ul li {
  align-items: center;
  margin-left: 20px;
}

.navbar-list li a {
  margin-left: 20px;
  color: var(--pureblack);
}

/*section 1*/

.section-1 {
  display: grid;
  grid-template-columns: auto 400px;
}

.mockups {
  height: 400px;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  overflow-x: hidden;
}

body {
  font-family: "Source Sans Pro", sans-serif;
  font-weight: 400;
  font-size: 0.875rem;
  line-height: 1.6;
  letter-spacing: 0;
  color: var(--font-color-base);
  margin: 0;
  padding: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

        Home

        About

        Contact

        Blog

        Careers

    <button class="btn btn-green">Request invite</button>

Next generation digital banking

        Take your financial life online. Your Easybank account will be a one-stop-shop for spending, saving, budgeting, investing, and much more.

      <button class="btn btn-green">Request Invite</button>

A: The grid doesnt work with position. You should remove position in class navbar.

A: Set the parent of .left and .right as the grid container, like this:
.section-1 .container {
  display: grid;
  grid-template-columns: auto 400px;
}

It works for me this way.
Your code placed the whole .container div into the left column.


text:
Q: Self Hosting WCF service without name I'm trying to host the wcf service on the following IP:
"http://MyIP:MyPort/" without service name using ServiceHost.
Now the host succeeded, but when I send any request it doesn't fire the function in the WCF service.
Is there any way to host the service like this?

A: If by "without service name" you mean a URL with just an IP address and port (no URL "path", then the answer is yes you can host a service with a baseAddress as follows:
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:12080/"/>
      </baseAddresses>
    </host>

*

*where localhost would be your IP or DNS and 12080 is your port.

The WCF Service method is found within the service using either

*

*The OperationContract attribute "Action" property (SOAP):
[OperationContract(Action = "http://<your action here>",

*The WebGet/WebInvoke attribute "UriTemplate" property (REST):
[WebInvoke(UriTemplate = "


text:
Q: Illegal argument in isolate message: (object is a ReceivePort) I was trying to write my own worker to process big amount of numbers. And decided to make always working Isolate in which all my data would be processed.
class ProjectionWorker {

  ...

  Isolate? _isolate;

  ReceivePort? _workerPort;

  Stream? _workerResultStream;

  SendPort? _isolatePort;

  Future<ObjectModel> project(
    ObjectModel model,
    ProjectionData projectionData,
  ) async {
    _workerPort ??= ReceivePort();

    _isolate ??= await Isolate.spawn<SendPort>(
      _isolateScope,
      _workerPort!.sendPort,
      debugName: "flutter_object calculations",
    );

    _workerResultStream ??= _workerPort!.asBroadcastStream();

    _isolatePort ??= await _workerResultStream!.first;

    final Completer<ObjectModel> completer = Completer();

    _workerResultStream!.listen(
      (result) {
        if (result is ObjectModel) completer.complete(result);
      },
    );

    _isolatePort!.send(
      Tuple(
        model,
        projectionData,
      ),
    );

    return completer.future;
  }
}
...

void _isolateScope(SendPort port) async {
  final isolatePort = ReceivePort();

  port.send(isolatePort.sendPort);

  await for (final event in isolatePort) {
    ...

    port.send(result);
  }
}

But when I tried to use it in my custom RenderObject, in paint method:
  Future<void> _projectObject({
    ...
  }) async {
    _projectedObject = await _projectionWorker.project(
      ...
    );

I am receiving this:
Unhandled Exception: Invalid argument(s): Illegal argument in isolate message: (object is a ReceivePort)

And exception throws from this line of code:
...
_isolatePort!.send(
      Tuple(
        model,
        projectionData,
      ),
    );
...

Am I missing something here?

A: I just figured it out.
It seems stupid, but it worked out for me, so I hope, it would help somebody else.
In my isolateScope function ReceivePort gets tuple with ObjectModel and ProjectionData
ProjectionData was containing Size property in it, and ObjectModel had Color property.
I cut that both properties out and replaced it with just double or List.
And it just worked out.
It seems, that isolate somehow gets RecievePort by importing flutter/material.dart.


text:
Q: get url of page who contains my google app script i go trying to be clear in my request.
I want to get the url who contains my google app script, not the url of my GSA.
Example : i have a files code.gs who create a html page (html service). this page (html) is a simply form.
I deployed this script in my Google site. And i want to get url of the page who contains this script.
I hope to be clear.

A: I really don't think it is possible to do it programatically, but you can get it in Publish -> Deploy as web app, and save in the code as a Global Variable or script propertie.


text:
Q: Making line full line of text in paragraph When I write a long paragraph every other line is not a full line of text. How do I fix this? it just looks like crap when looking at the code.

A: This is a Visual Studio Code setting, you can access the vscode json file settings by pressing F1 and typing >Preferences: Open User Settings (JSON), select the first option and it will open the file.
Paste the line "html.format.wrapLineLength": 0, inside the json object.
For more info: https://code.visualstudio.com/docs/languages/html#_formatting

A: you can use

 to make sure your text \n (enter) to be readable into your browser, you can see the example below.

Contrary to popular belief, Lorem Ipsum is not simply random text.

It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur,

from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC.

This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.

The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested.

Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.

A:

Contrary to popular belief, Lorem Ipsum is not simply random text.

It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur,

from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC.

This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.

The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested.

Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.


text:
Q: Any reason to use "while 1, do something, break" in Python? In the Python library SymPy I try to understand the function partitions() in sympy.utilities.iterables:
It starts like this:
def partitions(n, m=None, k=None, size=False):
    """Generate all partitions of integer n (>= 0).

I am confused about the following while loop, because it looks pointless. If I remove the while 1: and the break it should make no difference. However, I expect that the people who develop SymPy know what they are doing, and don't make very simple mistakes. So does this make some sense that I fail to see?
while 1:
    # Let i be the smallest key larger than 1.  Reuse one instance of i.
    i = keys[-1]
    newcount = ms[i] = ms[i] - 1
    reuse += i
    if newcount == 0:
        del keys[-1], ms[i]
    room += 1

    # Break the remainder into pieces of size i-1.
    i -= 1
    q, r = divmod(reuse, i)
    need = q + bool(r)
    if need > room:
        if not keys:
            return
        continue

    ms[i] = q
    keys.append(i)
    if r:
        ms[r] = 1
        keys.append(r)
    break

For learning purposes I have simplified the whole function, and my_partitions(n) gives the same results as partitions(n).
def my_partitions(n):
    ms = {n: 1}
    keys = [n]
    yield ms

    while keys != [1]:
        # Reuse any 1's.
        if keys[-1] == 1:
            del keys[-1]
            reuse = ms.pop(1)
        else:
            reuse = 0

        # Let i be the smallest key larger than 1.  Reuse one instance of i.
        i = keys[-1]
        ms[i] -= 1
        reuse += i
        if ms[i] == 0:
            del keys[-1], ms[i]

        # Break the remainder into pieces of size i-1.
        i -= 1
        q, r = divmod(reuse, i)
        ms[i] = q
        keys.append(i)
        if r:
            ms[r] = 1
            keys.append(r)

        yield ms

A: This is a dirty hack to bring goto to Python.  The while 1: line is the label and the continue statement is the goto.
Please do not write code like that if you can avoid it.  If you must do this, at least make it while True: since the argument to while is ordinarily a boolean value.

A: In the case that need > room && keys == True you go to continue, which re-fires the while loop and does not break it. It seems pretty ugly, but it is necessary in this case (of course there should be alternatives).


text:
Q: r - query the census api and read in demographic variables for each zip code in Chicago The Problem
I am trying to get some data from the cencus API by demographic variables for each zip code in Chicago. I want to pull down several variables, like age, income, ect..
What I've Tried
There is little to no examples with the acs package which was built for this. This is the best I've got so far ...
install.packages("acs")
library(acs)
acs.fetch(endyear, span = 5, geography, table.name,
table.number, variable, keyword, dataset = "acs",
key, col.names = "auto", ...)
# I have not really even sure how to access the functions inside the acs package at this point either ...

From this source on page 6 of the pdf. I am not sure how exactly I would use this function to pull exactly what I want, and I've tried several combinations of table.name=c("sex","age","education") and others, along with key=c("chicago","zipcode"), ect...
Any suggestions of how to use this function or use the acs package in R?

A: You need to do a few things to get where you want to go.
First you need to register with ACS and get a key, install the key in your script and be sure to activate it or NOTHING will happen!
Then you need to create variables to drop into your requests:
zipCodes= c(00000,00000, 00000) #use as many as you have here
endYear<-2015

chicagoZipGeo <- geo.make(zip.code=zipCodes)

#Then you go fetch your data, and you need to use the appropriate codes to do so

pov.data <- acs.fetch(endyear = 2015, geography = chicagoZipGeo,
                    table.number="B06012_002")

Notice that I used a weird capital A in the variable state, I did so for two reasons,

*

*so that you could see where it ends up in the geo.make part

*so that it does not interfere with the functions parameter of state to  which you will feed your variable

You can look up the codes for things in this resource:
2015 5-Year ACS Code List
There are additional documents on the ACS site which tell you how to use the codes, the universe from which the  estimates are drawn and such.

A: Here is how to use package totalcensus to get data by zipcode. You can find this package from https://github.com/GL-Li/totalcensus.
library(totalcensus)
library(dplyr)
# http://www.city-data.com/zipmaps/Chicago-Illinois.html to find a list of zip
# code for Chicago
zips <- c(60007, 60018, 60068, 60106, 60131, 60176, 60601, 60602, 60603, 60604,
          60605, 60606, 60607, 60608, 60609, 60610, 60611, 60612, 60613, 60614,
          60615, 60616, 60617, 60618, 60619, 60620, 60621, 60622, 60623, 60624,
          60625, 60626, 60628, 60629, 60630, 60631, 60632, 60633, 60634, 60636,
          60637, 60638, 60639, 60640, 60641, 60642, 60643, 60644, 60645, 60646,
          60647, 60649, 60651, 60652, 60653, 60654, 60655, 60656, 60657, 60659,
          60660, 60661, 60706, 60707, 60714, 60804, 60827)

# read for all US zip codes from 2016 ACS 5-year survey
all_zip_acs5 <- read_acs5year(
    year = 2016,
    states = "US",
    table_contents = "below_poverty = B06012_006", # random example
    geo_headers = "ZCTA5",
    summary_level = "860"
)

# keep only Chicago zip codes
chicago_zip_acs5 <- filter(all_zip_acs5, ZCTA5 %in% zips)

    #           GEOID       lon      lat ZCTA5 state population below_poverty GEOCOMP SUMLEV        NAME
    # 1  86000US60007 -87.99736 42.00865 60007  <NA>      33733          1064     all    860 ZCTA5 60007
    # 2  86000US60018 -87.91176 41.97939 60018  <NA>      30519          2123     all    860 ZCTA5 60018
    # 3  86000US60068 -87.84343 42.01176 60068  <NA>      37567          1107     all    860 ZCTA5 60068
    # 4  86000US60106 -87.94183 41.95970 60106  <NA>      20215          1147     all    860 ZCTA5 60106
    # 5  86000US60131 -87.88426 41.93876 60131  <NA>      18072           943     all    860 ZCTA5 60131


text:
Q: cascaded dropdown in struts I have to design a web page using struts.
I have to show two dropdowns.
The data in the first dropdown will be populated dynamically from database. This part is completed.
I have to populate the data in second dropdown based on the selection in 1st dropdown.
I need help for this development since I am new to struts technology.
Thanks,
Sachin

A: You can use ajax to load data to the dropdown2 by invoking it in the onchange method for dropdown1

DropDown1:
----------

    <s:select key="label.name" list="list1" onchange="reloadView();" name="id" id="list">
    </s:select>

reloadView()
------------

try {
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    }
    catch (e)
    {
        // Internet Explorer Browsers
        try {
                ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        }
                    catch (e)
                {
                try {
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            }
                catch (e)
                {
                                alert("Your browser has no AJAX Support!");
                    return false;
                }
        }
        }
    var url = "yourUrl";
    ajaxRequest.open("POST", url, true);
    ajaxRequest.onreadystatechange = function()
    {
        try
        {
                if (ajaxRequest.readyState == 4 && ajaxRequest.status == 200) {
                        var res = ajaxRequest.responseText;
                        if (res)
                        {
                                document.getElementById("yourDiv").innerHTML = res;
                                adjustTable();
                        }
                }
        }
        catch (e)
        {

        }
    }
    ajaxRequest.send(null);

DropDown2
---------

    <div id="yourDiv">
    <s:select>
    </div>


text:
Q: Is there a Maupertuis principle for General Relativity? The motion of a point particle in classical mechanics is given by Newton's equation, $\mathbf{F}=m\mathbf{a}$. Suppose all forces considered are conservative and we have a constant total energy $h$. Let $M$ be the configuration space of our system, $T^*M$ its cotangent bundle, $(\mathbf{q},\mathbf{p})$ the natural coordinates on $T^*M$ and $\gamma$ a curve connecting the start- and end-points of our particle's motion. Then $\int_\gamma \mathbf{p}\,\mathrm{d}\mathbf{q}$ is a viable action integral. The Maupertuis theorem states that
$$\int_\gamma\mathbf{p}\,\mathrm{d}\mathbf{q}=\sqrt{2}\int_\gamma\mathrm{d}\rho,$$
where $\mathrm{d}\rho$ is the Riemannian metric given by
$$\mathrm{d}\rho=\sqrt{h-U(\mathbf{q})}\,\mathrm{d}s,$$
$\mathrm{d}s$ is the standard metric on $M$ and $U(\mathbf{q})$ the potential energy. This implies that
$$\text{Newtonian mechanics $\Longleftrightarrow$ geodesic problem of some pair $(M,\mathrm{d}\rho)$}$$
The motion of a point particle in general relativity is given by the equation
$$F=a\tag{1}$$
where $a:=\nabla_{\dot\gamma}\dot\gamma$, $\gamma$ is the path of the particle, $\nabla$ is the Levi-Civita connection of the spacetime $(\mathcal{M},g)$, and $F$ is some "force" 4-vector. $F$ can be seen as an obstruction to the geodesy of $\gamma$, since $a=0$ is just the geodesic equation. (In the same way, $\mathbf{F}$ is an obstruction to geodesy on $\mathbb{R}^n$ since $\mathbf{a}=0$ $\Leftrightarrow$ $\mathbf{x}$ is a straight line and $U(\mathbf{q})$ in the case of constrained Lagrangian mechanics.) (Proofs of the above statements of classical mechanics can be found in Arnold, V.I. Mathematical Methods of Classical Mechanics. Springer, 1989.)
Is there some pair $(\mathcal{M}',g')$ for which the geodesic problem is (1), i.e. a suitable generalization of the Maupertuis principle to relativistic mechanics in curved spacetime?

A: I) We assume OP's question concerns a massive point particle of rest mass
$m_0>0$ in a Lorentzian spacetime manifold $(M,g)$ [of signature
$(+,-,\ldots, -)$] between an initial and a final spacetime point $p_i,
p_f\in M$, which should be causally connected. Let us work in units where the speed of light $c=1$ and rest mass $m_0=1$ are both one.
II) Before discussing Maupertuis's
principle, we should
first have a stationary action
principle (SAP).
OP's question mentions an unspecified $4$-force. To have a variational principle, we must demand that that $4$-force comes from a potential $U$. The
action is then
$$ S[x;\lambda_i,\lambda_f]
~=~\int_{\lambda_i}^{\lambda_f}\! d\lambda~L, \qquad  L~=~T-U, $$
$$\tag{1} T~:=~-\sqrt{T_0},\qquad T_0~:=~ g_{\mu\nu}\dot{x}^{\mu}\dot{x}^{\nu},
$$
where $\lambda$ is a parameter, and dot means differentiation wrt. $\lambda$.
III) In the SAP, we impose Dirichlet boundary conditions (BC)
$$\tag{2} x^{\mu}(\lambda_i)~=~x_i^{\mu}\qquad\text{and}\qquad x^{\mu}(\lambda_f)~=~x_f^{\mu}, $$
and keep $\lambda_i,\lambda_f$ fixed.
IV) We'll assume that the action (1) is reparametrization invariant
$$\tag{3}\lambda\quad\longrightarrow\quad \tilde{\lambda}~=~f(\lambda), $$
since physics should be geometric.
V) The Lagrangian $4$-momentum and energy function become
$$\tag{4} p_{\mu}~:=~\frac{\partial L}{\partial\dot{x}^{\mu}}~=~ -\frac{g_{\mu\nu}\dot{x}^{\nu}}{\sqrt{T_0}}-\frac{\partial U}{\partial\dot{x}^{\mu}},$$
and
$$\tag{5} h~:=~ p_{\mu}\dot{x}^{\mu} - L~=~\left(1 - \dot{x}^{\mu}\frac{\partial }{\partial\dot{x}^{\mu}}\right)U, $$
respectively.
VI) Usually when discussing the abbreviated action principle, it is assumed that the Lagrangian (1) has no explicit $\lambda$-dependence, so that the energy (5) is conserved on-shell. No explicit $\lambda$-dependence may sound natural & innocent, but together with the reparametrization invariance (3), it severely restricts the possible potentials $U$. The Lorentz potential $U\propto A_{\mu}\dot{x}^{\mu}$ is still allowed, of course.
VII) In fact, no explicit $\lambda$-dependence & reparametrization invariance (3) basically imply that the energy function (5) vanishes identically.
VIII) The abbreviated action becomes
$$\tag{6} A[x;E,\lambda_i,\lambda_f]
~=~\int_{\lambda_i}^{\lambda_f}\! d\lambda~ p_{\mu}\dot{x}^{\mu}$$
for virtual paths of constant and the same energy
$$ \tag{7} h~=~E, $$
satisfying Dirichlet BC (2), but free $\lambda_i$ and $\lambda_f$. From Section VII, we know that the energy $E=0$ drops out of the abbreviated action (6).
IX) Returning to OP's question, there seems little hope to achieve a Jacobi square root form of the abbreviated action principle (6) without further assumptions.
The natural next step is to assume that the potential $U$ does not depend on the $4$-velocity $\dot{x}^{\mu}$. Then the energy function $h\equiv U$ becomes just the potential energy, and $p_{\mu}\dot{x}^{\mu}\equiv T\equiv -\sqrt{T_0}$.
However, with all the other above requirements, this basically implies that the potential $U=0$ is zero!
Of course, without a potential $U=0$, we unsurprisingly achieve a Jacobi square root form of the abbreviated action principle
$$\tag{8} A[x;E,\lambda_i,\lambda_f]
~=~-\int_{\lambda_i}^{\lambda_f}\! d\lambda~\sqrt{T_0} .$$
The abbreviated action (8) is identical to the SAP (1) that we started from, essentially due to reparametrization invariance.


text:
Q: Button in the view to save form as pdf with jquery-codeigniter-mpdf I'm trying to create a button in the view to save the form (empty) as a pdf, I've seen the mpdf library, but I can not get the form through the jquery to the driver to print it.
What I really want is to print an empty template of a form, maybe I do not need so much mess and maybe I create a pdf form by hand and put a button to download it, but my idea was to do it with different forms that are on the web and when you go to print, you can format it and be more elegant.
View(example1):

Save Pdf

<form action="" name="form1" id="form1" method="post" enctype="multipart/form-data">

          Name *

            <input tabindex="1" id="name" name="name" type="text" class="form-control" />

          Surname *

            <input tabindex="2" id="surname" name="surname" type="text" class="form-control" />

          Adress *

            <input tabindex="4" id="adress" name="adress" type="text" class="form-control" />

            <input tabindex="6" type="submit" name="submit" class="btn btn-sm botonesmodales" value="Añadir" id="enviar" />

    </form>

Controller(example)
public function printpdf()
{
    $data = [];
    //load the view and saved it into $html variable
    $html=$this->load->view('example1', $data, true);

    //this the the PDF filename that user will get to download
    $pdfFilePath = "output_pdf_name.pdf";

    //load mPDF library
    $this->load->library('m_pdf');

   //generate the PDF from the given html
    $this->m_pdf->pdf->WriteHTML($html);

    //download it.
    $this->m_pdf->pdf->Output($pdfFilePath, "D");
}

Jquery
$(document).on('click', '#printform', function(e){
 call controller...(How do I do it?)
});


text:
Q: Programatically add and youtube video to wall post How can i embeded an youtube video in the facebook wall? I tried to pass the video url using the "source" member, but didn't work. After checking the json of a feed posted manually i see that there is some handling by FB's server code to make it happen.
The feed shows me this:
"id": "100001460921297_170524112986785",
         "from": {
            "name": "Fw As",
            "id": "100001460921297"
         },
         "message": "In SBSR 16 July 2010 Portugal",
         "picture": "http://external.ak.fbcdn.net/safe_image.php?d=9f79134b5acff03a2d60adb0320dbc8b&w=130&h=130&url=http%3A%2F%2Fi.ytimg.com%2Fvi%2FTOypSnKFHrE%2F0.jpg",
         "link": "http://www.youtube.com/watch?v=TOypSnKFHrE",
         "source": "http://www.youtube.com/v/TOypSnKFHrE&autoplay=1",
         "name": "The Strokes - Last Nite",
         "caption": "www.youtube.com",
         "description": "Music video by The Strokes performing Last Nite. (C) 2001 BMG",
         "icon": "http://static.ak.fbcdn.net/rsrc.php/yj/r/v2OnaTyTQZE.gif",

Is there way to achieve this via the c# sdk? I couldn't find any info helpfull about it so far.
Any ideas?
Thanks and merry christmas!

A: If you use Facebook C# SDK, then after successful authentication and authorization you need to post a link.
I assume that _FacebookApp is instance of FacebookApp class and you are authorized, then the code will be:
        var parameters = new Dictionary<string, object>();

        parameters.Add("message", Commentary);
        parameters.Add("link", Link);
        if (!String.IsNullOrEmpty(ThumbnailImageUrl))
            parameters.Add("picture", ThumbnailImageUrl);

        try
        {
            _FacebookApp.Post("me/feed", parameters);
        }
        catch (Exception ex)
        {
            return ex.Message;
        }

where Commentary is an optional message from the user about this link, e.g.: "Guys, check it out",
Link is the URL that was shared, e.g.:"http://www.youtube.com/watch?v=_OBlgSz8sSM",
ThumbnailImageUrl is a URL to the thumbnail image used in the link post, e.g.:"http://i.ytimg.com/vi/_OBlgSz8sSM/0.jpg".
Hope it will help.
Cheers.


text:
Q: Disposing Controls on Winforms Why does Visual Studio add this code to the Class.Designer.cs partial class.
Can anyone tell me when this components variable is going to get some value? What's the pattern to follow here?
private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if(disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

A: It is code that is produced by the Form item template (common7\ide\itemtemplates\csharp\windows forms\1033\form.zip\form.designer.cs).  It actually has a bug, the InitializeComponent() method it contains initializes the "this.components" variable unnecessarily.  You can safely delete the statement from the code if your form doesn't have any components.  The designer will automatically put it back if you add a component later.
Another thing that is not so nice is that the Dispose() method is put in the Designer.cs file.  It really belongs in the form.cs file so you can add Dispose() calls for fields in your form that should be disposed.  Don't hesitate to move the code yourself, modifying the designer file this way doesn't have any unpleasant side-effects.  Just stay away from the code that's bracketed with the "generated code" region.
As mentioned in most other answers, this code is necessary to call the Dispose() method of any components that you've dropped on the form when the form is closed.  Controls on the form need to be disposed as well but that's automatic.  The Form class finds them back by iterating the Controls collection.

A: The private field components is used to track disposable components on your form. Try dragging in a Timer component, and you should see something like this in the designer generated code:
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);

The pattern displayed in the Dispose(bool) method is usually referred to as the disposable pattern. Basically, the pattern ensures that all of the tracked components will be disposed, even if you never call the Dispose method explicitly, in which case the base class of your form will call the Dispose method in its finalizer (during garbage collection).

A: components gets assigned when you add non-visual components, which also need to be disposed in a determinisitc way (for more information, refer to the IDisposable pattern).

A: Not all components use it though- eg a HelpProvider and EventLog. You can even comment it out in these cases. Sounds like a ms bodge to me.


text:
Q: merged DLLs, Intellisense not picking up separate XML doc files I use ILMerge to merge several of my C# project DLLs into a single DLL for the whole solution.  I have each project produce a .XML file of its documentation for Intellisense, and I'm having trouble getting those comments to show up when I try to use my merged DLL as a reference in another solution.  I have these files all in the same directory:

*

*MergedProjectDlls.dll

*Project1.XML

*Project2.XML

*Project3.XML

*Project4.XML

I tried renaming a single project XML file to be MergedProjectDlls.XML then removing and re-adding the reference in Visual Studio, but Intellisense still wasn't picking up on the comments that I know are there in the project XML file I renamed.
I was hoping to somehow merge all these project XML files into one titled MergedProjectDlls.XML anyway.  Is that possible?  Would Intellisense then pick up on it automatically when it's in the same directory as MergedProjectDlls.dll?
Edit: just found this on MSDN:

To use the generated .xml file for use with the IntelliSense feature, let the file name of the .xml file be the same as the assembly you want to support and then make sure the .xml file is in the same directory as the assembly. Thus, when the assembly is referenced in the Visual Studio project, the .xml file is found as well.

And also:

Unless you compile with /target:module, file will contain  tags specifying the name of the file containing the assembly manifest for the output file of the compilation."

A: Der, it turns out that's just a command-line option to ILMerge:

ILMerge.exe /out:MergedProjectDlls.dll
  Project1.dll Project2.dll Project3.dll
  Project4.dll /ndebug /xmldocs


text:
Q: struts-tags iterator is duplicating rows I am outputting data to an html table using a struts-tags iterator.  It works for the most part but for a few rows, it duplicates the previous row instead of putting in the correct data. Very strange inconsistency.
Here is the html:
<s:iterator value="result">

<s:property value="timestamp"/>
<s:property value="targetId"/>
<s:property value="sourceIp"/>
<s:property value="transactionType"/>
<s:property value="status"/>

</s:iterator>

"result" is defined in the java controller:
private List<AuditData> result

and is populated by a hibernate query like so:
    session = HibernateUtil.getSessionFactory().openSession();
    Criteria criteria = buildQuery2(session);
    result = criteria.list();

Here is an example output of the problem:
10/3/16 8:17:31 PM.000  hanogreg    10.10.10.10     Pwd Reset   Success
10/3/16 8:17:31 PM.000  hanogreg    10.10.10.10     Pwd Reset   Success

The second row is a duplicate of the first but the database shows the second entry should say "Pwd Change", not "Pwd Reset".
Does anyone have any ideas as to what could be causing this inconsistent behavior?
Edit: This is a hibernate issue, not a struts issue as I can see "result" already contains the duplicate row instead of the real row.  Here is buildQuery2() which creates the hibernate criteria:
private Criteria buildQuery2(Session session) throws ParseException {
    Criteria criteria = session.createCriteria(AuditData.class);
    SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy");

    if (!fromDate.equals("All")) {
        Date fDate = df.parse(fromDate);
        criteria.add(Restrictions.ge("timestamp", fDate));
    }
    if (!toDate.equals("All")) {
        Date tDate = df.parse(toDate);
        actionlogger.debug("toDate=" +toDate +", tDate="+tDate.toString());
        tDate = getEndOfDayDate(tDate); //set the time to the last millisecond of the day so all other times will be less
        criteria.add(Restrictions.le("timestamp", tDate));
    }
    if (!csgUsername.equals("All"))     criteria.add(Restrictions.eq("target_id",csgUsername));
    if (!sourceIp.equals("All"))        criteria.add(Restrictions.eq("source_ip",sourceIp));
    if (!transactionType.equals("All")) criteria.add(Restrictions.eq("transaction_type",transactionType));
    if (!status.equals("All"))          criteria.add(Restrictions.eq("status",status));
    criteria.addOrder(Order.asc("timestamp"));

    return criteria;
}

Since I was unable to figure out why this was happening, I was forced to re-write the code to do the same thing without hibernate and got it to work correctly.


text:
Q: Trying to query certain groups that satisfy a value_count condition I'm playing around with stock data, and I'm trying to filter the groups that have more buys than sells with respective to Transaction values
So the code I'm running to display the below  data is
df.groupby('Stock').Transaction.value_counts()

data
Stock  Transaction
ADC    Buy                 2
AKAM   Option Exercise    51
       Sale               34
       Buy                 9
AMNB   Buy                10
ARCC   Buy                15
ARL    Buy                12
ASA    Buy                 7
ASRV   Buy                12
       Option Exercise     1
AUBN   Buy                 4
       Sale               11
BAC    Option Exercise    23
       Buy                15
       Sale                7
BCBP   Buy                 3
       Sale               11
BKSC   Buy                55
BMRA   Buy                 5
       Option Exercise     3
       Sale                1

                      ..

I'm grouping the data by their stock tickers and then looking at their respective column Transaction values. I'm trying to filter out the groups whose Transaction value_counts have more Buy than Sale.
I can't figure out how to do this.
I tried something like this:
df.groupby('Stock').filter(lambda x: x.Transaction.value_counts().Buy > x.value_counts().Sale)
which oddly doesn't work despite this working:
 df.Transaction.value_counts().Buy

>>>2674

I also tried things along the lines of
df.groupby('Stock').Transaction.filter(lambda x: x if x.value_counts().Buy > x.value_counts().Sale)

But I can't think of which pandas tools are ideal in this case.
The output can be anything from just the name of the stocks which satisfy this condition to printing out the entire group (stock name and Transaction)
So the output would be something like this
ADC    Buy                 2
AMNB   Buy                10
ARCC   Buy                15
ARL    Buy                12
ASA    Buy                 7
ASRV   Buy                12
       Option Exercise     1

BAC    Option Exercise    23
       Buy                15
       Sale                7
BKSC   Buy                55
BMRA   Buy                 5
       Option Exercise     3
       Sale                1

Or just the stock names.
Thanks.

A: I'd unstack then query
d1 = df.groupby('Stock').Transaction.value_counts()
d1.unstack(fill_value=0).query('Buy > Sale')

We can get it back all nice a tidy with this
d1.unstack(fill_value=0).query('Buy > Sale') \
    .replace(0, np.nan).stack().astype(int)

Stock  Transaction
ADC    Buy                 2
AMNB   Buy                10
ARCC   Buy                15
ARL    Buy                12
ASA    Buy                 7
ASRV   Buy                12
       Option Exercise     1
BAC    Buy                15
       Option Exercise    23
       Sale                7
BKSC   Buy                55
BMRA   Buy                 5
       Option Exercise     3
       Sale                1
dtype: int64


text:
Q: JavaScript: Save .csv inside folder with todays date Everyday I run shell script to create New Folder with current date.
With Shell it is super easy to save anything within that folder, even if folders name often changes.
E.g.: currentDate=/path/$(date +%Y%m%d) I just put a date variable within the Path.
I thought, it would be similar with JavaScript?
So the question is, is there a way within JavaScript syntax, to access the folder whose name changes constantly?
The below doesn't seem to work:
// Create the log file with Today's Date
folderName = "~/Desktop/"

var now = new Date();
var logfile_name = now.getFullYear() + "-"+ now.getMonth() + "-" + now.getDate()

var fileOut = new File(folderName+logfile_name+"/"+'RT3.csv');
if (!fileOut.exists) {
  fileOut.open("w");
  fileOut.writeln(",", docRef.name);
} else {
  fileOut.open("a");
  fileOut.writeln(",", docRef.name);
}

fileOut.close();

Any advice would be much appreciated.

A: Try this it should create Current dated folder on desktop and should add your current document name on .csv
var folderName = "~/Desktop/";
var now = new Date();
var logfile_name = now.getFullYear() + "-"+ now.getMonth() + "-" + now.getDate();
var f = new Folder(folderName + logfile_name);
if ( ! f.exists ) {
    f.create();
}
var docRef=app.activeDocument;
var file = new File(f+"/"+'RT3.csv');
file.open('w');
file.writeln(",",docRef.name);
file.close();

The thing you missed is i think checking for folder if it exist or not :) anyway enjoy!
Edit : and well you don't even have to use shell to create folder since this photoshop script will automatic does it if it not exist :)


text:
Q: Space filling between random 2D lines Consider a region (2D) filled with lines randomly (following Figure). We are interested in filling the empty spaces between lines including four boundary edges in a way:
0- maximizing the size of parcels;
1- shape of filling parcels is square aligned horizontally or vertically;
2- shape of filling parcels is square, i.e., relaxed alignment;
3- shape of filling parcels is any quadrangle. our original question
So for now there are three different scenarios.
Note that the lines are of the form [x1,y1,x2,y2] point set, real numbers.
[* * *] Ideas of possible solutions/algorithms/code snippets/etc are more than welcome.

Update 1: We could manage a solution for the first case:

Steps are:
1- lines
2- rasterizing lines into a bitmap
3- searching nearby cells for each cell of desired color (i.e., the same color) with an objective function to maximize the area i.e., the number of cells.
It works well however it covers only the first scenario and it is also slow.

Update 2:
We assumed that the reader is familiar with the concept of space-filling-tiling. You may follow the link for inspiration. However note that our problem is different. As we do not fill the empty space randomly and we do not chose the size randomly. The solution should be iterative. For all the cases, there is no limit on the number of parcel being fitted. Indeed, it is up to user to limit the iteration number, by choosing a minimum area for parcels, for example. This is obvious in the example given above in which we discretized lines into pixels with specified size. That is, the procedure should run until entire empty area is filled respecting the criterion e.g., the maximum area of parcels.

Update 3:
summary:
One application is to find out the distribution of extractable intact 'rock' blocks in a heavily fractured 'mine'. This could be very helpful for many aspects including drilling design, financial evaluation etc.
description:
For a mine of decorative rock (stone) the products which are the blocks of intact rocks cut as rectangular cubes the price is closely dependent to the size of the block.  Extraction of a block from a suitable area i.e., with no major fracture will be desired if the amount of remaining parts is small as possible. Usually, the small pieces of rocks have no economic value relatively and are considered so as waste.
The question in this post investigates solutions for this kind of problem.
A mathematical view for the problem can be stated as follows:
2D: Find all rectangles that could be extracted from a given 2D region with some lines optimized for larger rectangle size as possible.
3D: Find all rectangular cubes that could be extracted from a given 3D region with some sub-planes (better: polygons) optimized for larger block size as possible.

Since this is part of an on-going research, some of the questions asked in the comments below do not have certain answers that we can provide. We believe that the provided information here so far is indeed enough to get the overall picture of the problem.  Nevertheless, we provide some details as we can for community benefits.
You may put some restrictions on the solution for the ultimate question, although, we believe it is always possible to add more later.  For example, follow these:
{2D case}
The best size of a block (economically optimum rectangle) to be extracted under the conditions mentioned above, is 1x1 m given 10x10 m for the region in the example. This is one constraint defined based on economical value. The minimum workable size for cutting etc, let be 0.15x0.15 m; so this the second size limit.

The figure above shows the economic value function depending to the block size. So for this particular case every rock piece smaller than 0.15x0.15 m is just waste. There will be no block size larger than 1.7x1.7 m due to operation limits.

A: I have an idea how you you iteratively work from large blocks down to smaller blocks using FME (by Safe Software.) For the record I don't work for them but seem to praise their tool enough...

*

*Use "BoundingBoxReplacer" on the area of interest.

*Reproject it to a local coordinate system (for later when you need to "tile" in feet/meters.)

*Buffer the lines with "Bufferer" transformer. You only need an arbitrary size, say .01 ft/meters. What we are looking for here is a polygon of the line for the next step.

*Add a "Tiler" Transformer. Specify a large (estimated or otherwise) Tile Size in Feet or Meters. What we are doing here is tiling the area of interest into square blocks. Depending on the dataset start large to really get the large outliers.

*Add a "Clipper" transformer. What we are doing here is essentially slicing up the dataset to see which tiles are good/bad. On the output, tiles that are "Inside" are too big. However, tiles that are "Outside" are large enough and ready for cutting...

*Here's where it get's complex, but not hard... We're going to loop the transformer so that we re-use the original BoundingBox, but clip out areas that are already ready for cutting. So, add a clipper and route the Clipper as the "Output" tiles on the earlier clipper output. Now we have a single polygon that is ready to work again.

*Use the tiler again, this time specifying a smaller tile. For example if you used 100 meter tiles earlier, try 90 meters.

*Add another clipper, with the input clipper being the buffered lines, and the input clippee being the smaller tiles as input.

Rinse and repeat as many times as necessary using smaller tiles each time. I've attached the start of a workbench I would use as one approach.
Based on your (nicely detailed) description, it will only work with your option 1 for now. Without devoting too much time just yet.
Anyways, this is just one approach I would start with to at least filter the wheat from the chaff.


text:
Q: recovering deleted IMAPed emails from Local Copy I mistakenly deleted ~4GB and 8 years of old emails using Thunderbird.
They were from 2 IMAPed email accounts (one Gmail and one a private server that I (and several others) control).
It's not a huge deal -- there was nothing important, but sometimes I do want to go and check something from years ago.
I had it IMAPed and locally downloading to three computers.
The one I did it too, they are gone on,
and it synced them up to the servers.
So when I opened the other, it synced the deletion down to that too.
But for the 3rd I have wised up, and not opened Thunderbird.
I have found in %AppData%\Thunderbird\Profiles\6io4tatw.default\ImapMail
what I believe to be the local copies of the emails. An MSF file and a folder for each of my accounts, each containing,
a pile of MSF files, matching each of my IMAPped folder names,
and a matching set of files without extensions.
So I want to use these, to recover my lost emails.
(I've now backed them up to two separate locations in case something goes wrong)
Since I deleted the emails, I have gotten several other emails on my accounts which I also need to keep.
So my idea is that I should some how to convert the backed-up local copies of the deleted emails into a local mail account,
and then copy them all back into the IMAPed accounts using Thunderbird.
Does this sound like a sensible plan?
I'm not sure how to start doing it

A: I would, first, make a copy of the mailbox folders that you found. Just make a copy on your desktop or some other folder so you don't lose them by mistake.
Next, you should be able to import those messages back in to Thunderbird. You can't import directly in to an IMAP account, but you can create a secondary junk POP account to import in to and then drag and drop the messages to your IMAP account.
So, you would open Thunderbird, add a generic mailbox - it doesn't have to actually work. Then select the inbox and right-click to import. Navigate to the mailbox folders you made a copy of and import the messages.
Here's instructions from Mozilla to do the import: http://kb.mozillazine.org/Importing_folders#Find_the_mail_folders
You might want to actually copy the mail folders to one of the already messed up computers for added protection. This way, if something does go wrong you still know you didn't open Thunderbird on the 'good' computer.


text:
Q: Selecting items from combined stored procedure I had two separate stored procedures each with their own column description and info. Now that i combined them both information of the stored procedures are displayed but with the column description of my first select statement (stored procedure). Is it possible in any way that i could distinguish between the two statements? The reason is because i am using a report page to display information but because i cannot have two datasets in one list, i thought i could combine all the information into one dataset and then distinguish between the information to show in different tables but within the same list/dataset.

A: Perhaps you should return one DataTable for the report, and just use the report grouping features. This is usually much, much easier than trying to manipulate multiple DataSets and/or multiple DataTables within a DataSet. I've rewritten ridiculously complex reports, using 5 or 6 DataSets, into one DataSet with report grouping and it was much, much simpler. I could live with the fact that data is repeated in rows, since creation and maintenance was easier.
That is, depending on your data of course. If you can logically query related data into one result set (e.g. Customers and their Orders), you can query customers and all of their orders in one result set. Naturally, the customer info will repeat for each record many times, but use the grouping feature of your reporting tool to display it once.


text:
Q: Can't access localhost website I have an owncloud server hosted on a virtual machine. I've been accessing it fine via My PC on the same network until randomly today this isn't working.
I just get the error "This site cannot be reached ERR_CONNECTION_TIMED_OUT"
I don't really know where to start looking, as i haven't changed any settings/files.
I can still access the URL from the web browser on the virtual server in which it is hosted, just not through any PC on the network.

A: Maybe some update broke network settings.
Check connectivity with a ping.
If ping fails and you are sure that any firewall isn't blocking ping's protocol (ICMP), then check your virtual network configuration.
Please dont use localhost as destination address. Use vm ip instead.


text:
Q: Time Series Anomaly Detection Across Multiple Dimensions I'm working on a project where I'm tasked to find anomalous data (count of people) across different dimensions (categorical i.e country, occupation and a few more) and different days.
Below is a sample of the data
count is count for people per day, country and occupation
How do I go about this? Any recommended Python libraries or models? I found lots of tutorials on multivariate time series analysis but my data isn't multivariate time series as the categorical variables in this dataset do not depend on time.

A: You can try with LSTM, BiRNN, GRU with multivariable time-series prediction.
You can use tensorflow or pytorch to build the model.

A: Sklearn has multiple possibilities. You could take a look at Isolation Forest.


text:
Q: Implicit Bearer flow for swagger asp..net core 3.1 Is there a way to automatically put bearer token to every request in Swagger?
I don't want to use oauth implicit flow where I should interact with identity.
I'd like to provide swagger an endpoint to my api where it could take access token and automatically put it to every request.

A: In your startup.s class:
// prevent from mapping "sub" claim to nameidentifier.
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Remove("sub");

var identityUrl = configuration.GetValue<string>("IdentityUrl");

services.AddAuthentication(options =>
{
    options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
    options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
    options.Authority = identityUrl;
    options.RequireHttpsMetadata = false;
    options.Audience = "demo_api";
});

SwaggerGen
    services.AddSwaggerGen(options =>
    {
      ...
        options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
       {
            Type = SecuritySchemeType.OAuth2,
            Flows = new OpenApiOAuthFlows
            {
                Implicit = new OpenApiOAuthFlow
                {
                    AuthorizationUrl = new Uri($"{configuration.GetValue<string>("IdentityUrl")}/connect/authorize"),
                    TokenUrl = new Uri($"{configuration.GetValue<string>("IdentityUrl")}/connect/token"),
                    Scopes = new Dictionary<string, string>()
                    {
                        { "api1", "Demo API - full access" }
                    }
                }
            }
        });

Operation filter
options.OperationFilter<AuthorizeCheckOperationFilter>();

The implementation
public class AuthorizeCheckOperationFilter : IOperationFilter
{
    public void Apply(OpenApiOperation operation, OperationFilterContext context)
    {
        var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any() ||
                           context.MethodInfo.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any();

        if (!hasAuthorize) return;

        var unauthorizedHashCode = HttpStatusCode.Unauthorized.GetHashCode().ToString();
        var unauthorizedDescription = HttpStatusCode.Unauthorized.ToString();

        var forbiddenHashCode = HttpStatusCode.Forbidden.GetHashCode().ToString();
        var forbiddenDescription = HttpStatusCode.Forbidden.ToString();

        operation.Responses.TryAdd(unauthorizedHashCode, new OpenApiResponse { Description = unauthorizedDescription });
        operation.Responses.TryAdd(forbiddenHashCode, new OpenApiResponse { Description = forbiddenDescription });

        var oAuthScheme = new OpenApiSecurityScheme
        {
            Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "oauth2" }
        };

        operation.Security = new List<OpenApiSecurityRequirement>
        {
            new OpenApiSecurityRequirement
            {
                [ oAuthScheme ] = new [] { "api1" }
            }
        };

    }
}

Use this
// Keep both UseAuthentication and UseAuthorization IN THIS ORDER
app.UseAuthentication();
app.UseAuthorization();

Use Swagger
app.UseSwagger(c =>
        {
            c.RouteTemplate = "swagger/{documentName}/swagger.json";
        });
        app.UseSwaggerUI(s =>
        {
            s.SwaggerEndpoint("/swagger/v1/swagger.json", "Your awesome project name");

            s.OAuthAppName("My API - Swagger");
            s.OAuthClientId("client");

            // Should match the client RedirectUrl in the IdentityServer
            s.OAuth2RedirectUrl("https://localhost:5001/swagger/oauth2-redirect.html");
        });

Your controller
[Authorize]
[ApiController]
[Route("api/[controller]")] // TODO: Take care of the versioning
public class IndentityController : ControllerBase
{
    ...

Now in the IdentityServer Project. The ApiResources:
public static IEnumerable<ApiResource> GetApiResources()
    {
        return new List<ApiResource>
        {
            new ApiResource("api1", "My API")
        };
    }

And finally, your Client should look like this:
new Client
{
    ClientId = "client",
    AllowedGrantTypes = GrantTypes.Implicit,
    RedirectUris = { "https://localhost:5001/swagger/oauth2-redirect.html" },
    AllowedScopes = { "api1" },
    AllowAccessTokensViaBrowser = true,
    RequireConsent = false
}

And for a complete source code, take a look at the eShopOnContainers repo
Good luck :)

A: the next code worked for me
services.AddSwaggerGen(c =>
        {
            c.SwaggerDoc("v2", new Microsoft.OpenApi.Models.OpenApiInfo
            {
                Version = "v2",
                Title = "PRJ API",
                Description = "PRJ Web API",
            });

            if (oktaIssuer != null)
            {
                c.AddSecurityDefinition("Okta", new OpenApiSecurityScheme
                {
                    Type = SecuritySchemeType.OAuth2,
                    Scheme = "Bearer",
                    In = ParameterLocation.Header,
                    Name = "Authorization",
                    Flows = new OpenApiOAuthFlows
                    {
                        Implicit = new OpenApiOAuthFlow
                        {
                            AuthorizationUrl = new Uri($"{oktaIssuer}/v1/authorize"),
                            Scopes = new Dictionary<string, string>
                            {
                                { "profile", "Access profile" },
                                { "email", "Email"},
                                { "openid", "OpenID"}
                            }
                        }
                    }
                });

                c.AddSecurityRequirement(new OpenApiSecurityRequirement
                {
                    {
                        new OpenApiSecurityScheme
                        {
                            Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "Okta" },
                            Scheme = "oauth2",
                            Name = "Bearer",
                            In = ParameterLocation.Header
                        },

                        new string[] {}
                    }
                });
                c.OperationFilter<AuthorizeCheckOperationFilter>();
            }

Also those strings must be the same!


text:
Q: When 1 column is null make other column equal to a certain number error I am getting an error with this line
case
   when [sm] is null
      then countofMk = 0
   else countofmake
end as max2

Error is :

Incorrect syntax near '='

Can anyone please advise what I am doing wrong here?
Here is the same data:
CREATE TABLE Table1
(
     sku varchar(50),
     [gtitle] varchar(50),
     [mk] varchar(50),
     [md] varchar(50),
     [sm] varchar(50)
);

INSERT INTO Table1 (sku, [gtitle], [mk],[md],[sm])
VALUES ('F92', 'Game1', 'b100', 'xbox', 'pilot'),
        ('F92', 'Game1', 'b100', 'xbox', 'ex'),
        ('F92', 'Game2', 'b100', 'xbox', 'null'),
        ('F92', 'Game2', 'b100', 'xbox', 'LLL');

------- query
WITH mixmax AS
(
    SELECT
        sku, [gtitle], [mk], [md], [sm],
        COUNT([mk]) AS countofMk
    FROM
        Table1
    GROUP BY
        sku, mk, md, sm, gtitle
)
SELECT
    *,
    CASE
       WHEN [sm] IS NULL
          THEN countofMk = 0
       ELSE countofmake
    END AS  max2,  --- getting error here
    ROW_NUMBER() OVER (PARTITION BY sku ORDER BY sku, countofMk DESC, COALESCE([md], ''), COALESCE([sm], '') ASC) AS RowNum
FROM
    mixmax;

Here is the intended result: when one column is null make the other 0
        sku gtitle  mk  md  sm  countofMk   max2    RowNum
        F92 Game1   b100    xbox    ex  1   1   1
        F92 Game2   b100    xbox    LLL 1   1   2
        F92 Game2   b100    xbox    null    1   0   3
        F92 Game1   b100    xbox    pilot   1   1   4

A: SQL Server doesn't support boolean types.  I'm not sure what you intend.  Perhaps:
(case when [sm] is null then 0 else countofmake end) as max2,  --- getting error here

A: You can't set the value of two columns on the same line. You need to do it twice, once for each column...
,max2 = case when [sm] is null then countofMk else countofmake end

or maybe
,max2 = case when [sm] is null then 0 else countofmake end

Or for setting two columns
,countofMk = case when [sm] is null then 0 end
,case when [sm] is null then 0 else countofmake end as max2

EDIT
countofMk = case when [sm] is null then 0 else countofmake end

A: You can include condition in the original query
WITH mixmax AS
(
    SELECT sku
        , [gtitle]
        , [mk]
        , [md]
        , [sm]
        , COUNT(CASE WHEN [sm] IS NULL THEN NULL ELSE [mk] END) as countofMk
    FROM Table1
    GROUP BY sku, mk ,md, sm, gtitle
)

countofMk will be 0 for group where [sm] is null


text:
Q: How colloquial is "I won't forgive me"? I heard it in an Adele song (He won't go), and I know she's using not-exactly-proper english sometimes (like "she ain't gon' be"), but I can't tell if I've just never heard it or if it's not correct.
Is it OK to say in an informal conversation?
Here is the verse from the song (full lyrics here):

So petrified, I'm so scared to step into this ride,
  What if I lose my heart and fail the climb
I won't forgive me if I gave up trying
  I heard his voice today
  I didn't know a single word he said
  Not one resemblance to the man I met
  Just a vague and broken boy instead

A: The right way to say this is I won't forgive myself.  However ...
"I won't forgive me" sounds technically like two separate entities are intended to exist, one doing the forgiving and one receiving the forgiving.
So this could be used as a literary or lyrical device to express a person who feels split amongst themselves and not in control of their own actions.  In the context of forgiving oneself, one is certainly trying to bring something of themselves under control of themselves, but has failed.
Though it is far more likely me was chosen because it's one syllable and flows with the rhythm of the song better than myself.  Intentional rule-breaking like this is not uncommon in songs and poems.


text:
Q: tomcat7 on Ubuntu 12.04 CATALINA_HOME and CATALINA_BASE not available on shell I just install tomcat7 on my Ubuntu 12.04 using:
sudo apt get-install tomcat7

Immediately afterwards I notice that although $CATALINA_HOME and $CATALINA_BASE are set in the script /etc/init.d/tomcat7, they are not exported on my shell. I.e. printenv | grep CATALINA yields nothing.
So the question is: should I bother or is it a good practice to also set $CATALINA_HOME and $CATALINA_BASE in my .bashrc and what would be the benefit?

A:
So the question is: should I bother or is it a good practice to also set $CATALINA_HOME and $CATALINA_BASE in my .bashrc and what would be the benefit?

No, you shouldn't. These variables are set just in case you install Tomcat manually, using deb packages is an unnecessary step since they are already set by the init script. The reason why you don't find the variables set in your bash shell, is because they are managed internally by the user that runs tomcat. The only reason to set such variables is to tell where tomcat files are while you install tomcat manually.