text:
Q: Control which css media queries are applied via javascript Is a there way to control which css media query a browser obeys using javascript?
For example, if have the following css:
p { color : red; }
@media (max-width: 320px) {
    p { color: blue; }
}
@media (max-width: 480px) {
    p { color: green; }
}

Assuming I open the page in a desktop browser with width > 480px, I'll see red paragraphs.  I would like to call a javascript function to have the browser obey the 320px media query.  For example, call a function below that would turn paragraphs blue:
setMediaQuery('320px')

The use case for this is a CMS that allows users to keep a full-width desktop and test different media queries without having to resize their browser window.
Any ideas for solving this problem without an iframe? I've thought about loading all css into js and manipulating the styles there, but option seems prohibitively complex.

A: You can access the list of style sheets in the document via document.styleSheets. Each sheet is a CSSStyleSheet object, which has a list of rules. There's a kind of rule called a CSSMediaRule that contains the information for a media query, including the rules for that query and the media that it applies to. In theory, you could then change the media that it applies to.
MDN has some documentation on this, here's a starting point.
Here's a complete example that looks for a media rules matching (max-width: 320px) and changes them to (max-width: 2000px): Live Copy | Source
<!doctype html>

<meta charset="UTF-8">
<title>Change Media Query</title>

<meta charset="UTF-8">

This is text turns red after two seconds

Obviously that's very rough code, and I've only checked that it works on Chrome and Firefox. I know there are some differences in these objects in IE vs. others (see the rules = sheet.cssRules || sheet.rules; above, that's one of them). But it could be a starting point.

A: I think users should have to resize a browser to see the different media queries.  Especially if your media query is for devices below say 480px, then the people testing it should have to resize their browser to 480px to see what it will look like.
That's like saying I want to see what a site will look like on an Android phone but test it on an iPhone.  It's just worth it to test the exact test case as closely as possible to the real scenario.

A: You can't restrict media query from JavaScript, but this is not a problem; you solve this with more classes:
p { color : red; }
@media (max-width: 320px) {
    p { color: blue; }
    .force_red {
        color: red;
    }
}
@media (max-width: 480px) {
    p { color: green; }
    .force_blue p {
        color: green;
    }
}
.force_blue p {
    color: blue;
}

Minor disclaimer: don't name your class force_blue, that's a terrible name.
Script:
document.body.className = "force_blue";

Ideally, the only way your JavaScript affects your template is by adding or removing classes. This allows you make a template of each potential state and keeps it all nice and maintainable.

JSFiddle to demonstrate: http://jsfiddle.net/tafCC/1/
Text will go from green or red (depending on your viewport size), to blue. Once it's blue, it stays blue. Note: the max-width: 320px rule gets overriden by max-width: 480px, add a min-width too (fixed in my JSFiddle).


text:
Q: Solutions Manual Calculus Simmons I can't find a book that I need desperately. It is "Student Solutions Manual to accompany Calculus With Analytic Geometry" by G. Simmons 2nd edition. I tried to buy it through 2 different respectable online stores, including the publisher himself, McGraw-Hill, but they both failed on delivery despite full prepayment. I also tried to find a PDF or perhaps an ebook but no success there.
I'm a self learner and I'm using "Calculus With Analytic Geometry" 2nd edition by G.Simmons. So this solutions manual is a real necessity for me.
As many of you have a good knowledge of the math field perhaps some of you knows where I could find/purchase/download this book?
Thanks.

A: I am also a self learner using the exact same book.
At first I was the same, thought I desperately needed the student solutions but couldn't find a reliable source anywhere except the literal $1000 amazon hardcover (ha no thanks).
So I then tried switching to another textbook for which I could find answers to, but couldn't find even a single one at all anywhere!
And then I realized even if I was to find a student solutions manual for Calc I, what about Calc II? What about Real Analysis? What about Formal Logic? Galois Theory? The more difficult the subject, it's even difficult to find textbooks that give problem sets, let alone answers to them.
So I realized if I was going to self-learn I would not be able to rely on answers so conveniently. I had to learn to check my answers. For example, if you have solved an indefinite integral, check it by differentiating the original function. Not sure if the locus you evaluated really is right? Try subbing valued for it see if they make sense. Sometimes you have to get creative.
But in the end, I think learning how to check your answers is actually the right way to do math. When you start creating your own mathematics (which is where all the real fun is), you'll be stumbling in the dark a lot, not knowing where you are etc. Getting used to that is very important.

A: Someone just wrote an excellent answer to the question so I'll just add in something from my end. I happened to use that same book you're talking about when I was learning single-variable calculus a long while back and I can understand the frustration at not having the answers available.
This is especially troublesome since that book is on the higher end of the difficulty spectrum when it comes to the so-called "Intuitive, Calculus I-III" textbooks that are typically written for students who just want an introduction to the computational techniques in Calculus. Simmons's book is rather different in that, whenever possible, it does try to be rigorous and tries to provide "proofs" whenever possible.
On the other hand, the lack of solutions in Simmons's text should provide some motivation for you to use this site as a place to improve your knowledge. In particular, it should motivate you to:

*

*Learn how to write good and coherent arguments

*Learn how to use Latex

*Learn how to ask better questions to maximize your gain from your own learning.

All of these three things are extremely important and are certainly more important than having access to a solutions manual. Sure, having access to that is great in that it allows you to check your answers.
Does it allow you to check your reasoning, though? Does it allow you to necessarily gain insight on solving problems? Perhaps someone here might answer the question in a better/cleaner way and that might provide an impetus for you to learn other bits of mathematics simultaneously.
I think the main point here is that Mathematics, just like many other things, is a social activity and you should definitely treat it like one. The best way to learn is to interact with others and throw ideas off of each other until the code is cracked on a given problem.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Binary integer division in C? I was looking at the binary integer division with remainder section in Wikipedia and was wondering how would I translate this into another language like C for example?
if D == 0 then error(DivisionByZeroException) end
Q := 0                 -- initialize quotient and remainder to zero
R := 0
for i = n-1...0 do     -- where n is number of bits in N
  R := R << 1          -- left-shift R by 1 bit
  R(0) := N(i)         -- set the least-significant bit of R equal to bit i of the numerator
  if R >= D then
    R := R - D
    Q(i) := 1
  end
end

I know how to translate the majority of it and do the bit shifting, but how would I do something like R(0) = N(i) or Q(i) = 1 when they are integers and not a function or a function pointer? Sorry for the basic question, the little section just got me interested.

A: Here is how you do it.
// R(0) := N(i)
R = (R & ~0x01) | ((N >> i) & 0x01);

The first part clears the 0 bit of r, then you OR it with the i'th bit of N, which you've shifted down into the 0 bit place.  You have to clear the bit first in case N(i) == 0.
// Q(i) = 1
Q |= 0x01 << i;

In this case, 0x01 is a single bit, then you shift it into place.  Since you are setting the bit regardless of what it was before, the OR operation will work.
To give some general binary operations:
If you want a single bit of information X(n):
(X >> n) & 0x01;

If you want to set a bit to 1 is above.
If you want to clear a bit to 0, X(n) = 0:
X &= ~(0x01 << n);

If you want to toggle a bit, X(n) = !X(n):
X ^= (0x01 << n);

If you want to assign a binary value to a bit, X(n) = y:
X = (X & ~(0x01 << n)) | (y << n);  // Assumes y = 0 or 1.


text:
Q: Update contents of MTLBuffer in Metal I need help to replace the contents of a MTLBuffer without creating a new one. Content in both cases are Float Arrays.
let vector:[Float] = [0,1,2,3,4,5,6,7,8,9]
let byteLength = arr1.count*MemoryLayout<Float>.size
let buffer = metalDevice.makeBuffer(bytes: &vector, length: byteLength, options: MTLResourceOptions())

let vector2:[Float] = [10,20,30,40,50,60,70,80,90]

I understand buffer.contents() gives us a UnsafeMutableRawPointer. I would like to create a new UnsafeMutableRawPointer from vector2 and replace the contents of buffer.
Thanks in advance!

A: You can do this with memcpy, but the slightly Swiftier way is:
buffer.contents().copyMemory(from: vector2, byteCount: vector2.count * MemoryLayout<Float>.stride)

In general, prefer stride over size when calculating the length of an array in bytes. If the type is not primitive and has any padding, size will not account for this, and you'll copy fewer bytes than you intended.


text:
Q: Why 2 pole induction motors don't use auxiliary windings while running (while others do)? Most motors with more than 2 poles I see (4 poles, 6 poles etc) use a run capacitor and a use the auxiliary winding all the time. Some even employ starting capacitors but they always have a run capacitor.
But why does 2 pole motors only use the auxiliary winding for starting? I haven't seen any single phase 2 pole motor that use a run capacitor.

A: The choice of starting scheme for a single-phase motor is primarily based on the desired torque vs speed curve. More specifically the scheme and capacitor value determine the available starting torque (zero speed, locked rotor), accelerating torque (0 to 80%+ speed) and peak torque. The torque required depends on the load characteristics. The torque vs. speed diagrams shown below illustrate the differences among the schemes.
The number of poles does not have a direct bearing on the scheme used. The number of poles determines the motor's synchronous operating speed and thus the normal operating RPM.

Figures adapted from Fitzgerald, Kingsley, Umans, Electric Machinery 4th ed


text:
Q: Knockout JS How to Data-Bind to Static Form Element I am trying to data bind a form element in knockout.js. However I don't want the element to be editable in the form, or even display the element to the user.
I'm able to correctly data-bind the value to an input element. But I would prefer if I could just pull the value from the HTML or a labels text, or a span. So the below works, but I'm not able to change it so it's not an input that the user can change.
<input id="txtProvider" name="txtProvider" type="text" data-bind="value: $root.session().Resource().provider" />

I tried just using a hidden element with a placeholder, but this didn't work.
<input id="txtProvider" name="txtProvider" type="hidden" placeholder="WebEx" data-bind="value: $root.session().Resource().provider" />

Any suggestions?
Thanks in advance for the help.

A: What you're doing works, or should work, fine:
<form>
  <input type="hidden" data-bind="value: myHiddenVal" />
</form>

function ViewModel() {
  self.myHiddenVal = ko.observable('Foo');
}

ko.applyBindings(new ViewModel());

This will yield:
<input type="hidden" data-bind="value: myHiddenVal" value="Foo">

Example: https://jsfiddle.net/thebluenile/myves32x/
Though I have to say, I of course don't know your exact use case, but "pulling values from HTML elements" is sort of antithetical to how Knockout, or any other data binding framework, works. If the user doesn't have to edit the field you can just keep it out of the UI altogether. The only valid use case for hidden elements I can think of would be if you were submitting the form to a server side script for processing, instead of sending its contents via AJAX.


text:
Q: How to remove leading zeroes from float value in php HelloI am trying to remove leading zeroes from my float value but cannot do it.I have a number 012.36 which I need to convert as 12.36. I have used ltrim to remove leading zeroes but when I use ltrim the variable is changed to string and I cannot use it as a number.
When I again try to convert it to float value using (float) or floatval it again adds a leading zero to the value like 012.36
I know it is a simple problem but can't get to solve it. Please help..
Here is the code.
I have a function which returns me the value and I have used it in a variable.
Here is my Function
public function getCartPercentShippingRate(){
        $shippingRateCollection = $this->getShippingMethodForShippingCountry();
        $shippingRate = 0;
        foreach ($shippingRateCollection as $shipping){
            $shippingRate = $shipping->getShippingRate();
        }
        $quote=Mage::getSingleton('checkout/session')->getQuote();
        $totals = $quote->getSubtotal();
        $shippingPercent = $totals * $shippingRate/100;
        return $shippingPercent;
    }
$price = $shippingRateModel->getCartPercentShippingRate();

When I echo the variable using echo $price it displays 012.36.
When I use echo $price = (float)($price); It still displays 012.36.
I have tried this. $newprice = ltrim($price, '0'); It displays the $newprice as 12.36. But when I use it in my another function to set price like this, $method->setPrice($newprice); It displays me 0 as the new price.If I use static value like $method->setPrice(12.36); Is displays the new price as 12.36.

A: Try this may it'll help you... First convert value into string and do this.
$str = ltrim($str, '0');

Example
$val = 012.36;
$val = ltrim($val, '0');
echo (float) $val;

A: I am not sure how you have tried it. Following code gives me what want
$num = 012.36;
echo (float)$num; // outputs 12.36

A: use (float)

Here is the demo
DEMO


text:
Q: Problem with hosting two websites on one IIS server On my Windows Home Server (Windows Server 2003 really) there is a default web site (enabling remote access etc.) and I'm trying to setup a second site (both on port 80). The default site is using xxx.homeserver.com as its address and the new one is using blog.xxx.no. What happens is that the default site works as expected (and as before), but when I try to access the new one without specifying the document (ie. index.htm) it access the default site. But if I add the document (index.htm) it access it correctly... I have setup the default document to be index.htm and it's on top of the list. I have also set the correct host header for both of them.
Any idea on why this is happening?

A: You need to configure host headers on the second web site (I would recommend setting them on both web sites).
http://support.microsoft.com/kb/324287

A: You might check to ensure your "default document" is indeed index.htm as you expect.


text:
Q: can't connect Cloud Data Fusion with Cloud SQL for MySQL with Private IP I know that there is many similar questions but I'm not able to find an answer to solve my issue.
I trying to connect Data Fusion to replicate a Cloud SQL for MySQL table. When trying to connect to the MySQL table I have the following error:
Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

From what I have gathered I need to:

*

*Create the Data Fusion Private Instance by following this guide

*Create the instance for Cloud SQL for MySQL with Private IP using the default network

*Connecting the Cloud SQL instance from a VM instance following the Connect from a VM instance tutorial I found directly from the Connect to this instance section.

Everything is under the same project.
I'm trying my best here but I'm a bit lost. If someone can guide me through this.
Is there anything more I need to do here? What IP should I use when setting up the connection to MySQL in Data Fusion?

A: If you want to connect Cloud Data Fusion with Cloud SQL for MySQL on Private IP you will need to deploy Cloud SQL Proxy. There is a lot of documentation around it. It seems to be the way to go.

A: Assuming you are using Cloud Data Fusion to just get data from CloudSQL MySQL to GCP
There are a few existing questions/docs that have been discussed in the past

*

*https://stackoverflow.com/a/56159101/661768

*Can't connect Cloud Data Fusion with Google Cloud SQL for PostgreSQL

*https://cloud.google.com/data-fusion/docs/how-to/reading-from-postgresql
If you are indeed trying to use Cloud Data Fusion's Replication feature to replicate your db tables then connecting to a private CloudSQL MySQL instance is not supported yet. Here is the corresponding OSS JIRA to follow up if you are looking for this - https://cdap.atlassian.net/browse/CDAP-17938


text:
Q: TikZ intersections and opacity I am trying to recreate this image right here to practice myself in TikZ (I am new):

What I have right now is this:

The problems I have is that I want the bottom arc to extend just until it hits the horizontal arc (xy-plane) (see red circle). A second problem I have is that I want to change the opacity of the intersection of the bottom two arcs (see red arrow and blue lines). Is there anyone who can give me some help? I'm new to TikZ. Thank you!
\documentclass{article}
\usepackage{tikz}  %TikZ is required for this to work.  Make sure this exists before the next line
\usepackage{tikz-3dplot}
\usepackage[active,tightpage]{preview}  %generates a tightly fitting border around the work
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{2mm}

\def\radius{6}
\def\Alpha{20}
\def\Beta{20}
\def\Gamma{20}

\begin{document}

\tdplotsetmaincoords{70}{150}

\begin{tikzpicture}[tdplot_main_coords]
% Axis: x, y, z
\tdplotsetrotatedcoords{0}{0}{0}
\draw[very thick,tdplot_rotated_coords,-o,shorten >=-3pt] (0,0,0) -- (\radius,0,0) node[anchor=north east]{$x$};
\draw[very thick,tdplot_rotated_coords,-o,shorten >=-3pt] (0,0,0) -- (0,\radius,0) node[anchor=north west]{$y$};
\draw[very thick,tdplot_rotated_coords,-o,shorten >=-3pt] (0,0,0) -- (0,0,\radius) node[anchor=south]{$z=z'$};

% Axis: x', y', z'
\tdplotsetrotatedcoords{\Alpha}{0}{0}
\draw[thick,tdplot_rotated_coords,-] (0,0,0) -- (\radius,0,0) node[anchor=north east]{$x'$};

% Axis: x'', y'', z''
\tdplotsetrotatedcoords{\Alpha}{\Beta}{0}
\draw[thick,tdplot_rotated_coords] (0,0,0) -- (\radius,0,0) node[anchor=north east]{$x''$};
\draw[thick,tdplot_rotated_coords] (0,0,0) -- (0,\radius,0) node[anchor=west]{$y'=y''$};
\draw[tdplot_rotated_coords] (0,-\radius,0) -- (0,\radius,0);

% Axis: X, Y, Z
\tdplotsetrotatedcoords{\Alpha}{\Beta}{\Gamma}
\draw[very thick,tdplot_rotated_coords,-*,shorten >=-3pt] (0,0,0) -- (\radius,0,0) node[anchor=north east]{$X$};
\draw[very thick,tdplot_rotated_coords,-*,shorten >=-3pt] (0,0,0) -- (0,\radius,0) node[anchor=west]{$Y$};
\draw[very thick,tdplot_rotated_coords,-*,shorten >=-3pt] (0,0,0) -- (0,0,\radius) node[anchor=east]{$z''=Z$};

% Circles
\tdplotsetrotatedcoords{\Alpha}{0}{0}
\draw [tdplot_rotated_coords,domain=-90:90] plot ({\radius*cos(\x)}, {\radius*sin(\x)});
\tdplotsetrotatedcoords{\Alpha}{90}{0}
\draw [tdplot_rotated_coords,domain=90:270] plot ({\radius*cos(\x)}, {\radius*sin(\x)});
\tdplotsetrotatedcoords{\Alpha+90}{90}{0}
\draw [tdplot_rotated_coords,domain=90+\Beta:270+\Beta] plot ({\radius*cos(\x)}, {\radius*sin(\x)});
\tdplotsetrotatedcoords{\Alpha}{\Beta}{0}
\draw [tdplot_rotated_coords,fill=black,fill opacity=0.1,domain=0:90] plot ({\radius*cos(\x)}, {\radius*sin(\x)});

\tdplotsetrotatedcoords{\Alpha}{\Beta}{0}
\draw [tdplot_rotated_coords,domain=-50:0] plot ({\radius*cos(\x)}, {\radius*sin(\x)});

% Arrows for alpha, beta, gamma
\tdplotsetrotatedcoords{0}{0}{0}
\tdplotdrawarc[tdplot_rotated_coords,-latex]{(0,0,0)}{0.8*\radius}{0}{\Alpha}{anchor=east}{$\alpha$}
\tdplotsetrotatedcoords{\Alpha+90}{90}{0}
\tdplotdrawarc[tdplot_rotated_coords,-latex]{(0,0,0)}{0.8*\radius}{-90}{-90+\Beta}{anchor=east}{$\beta$}
\tdplotsetrotatedcoords{\Alpha}{\Beta}{\Gamma}
\tdplotdrawarc[tdplot_rotated_coords,-latex]{(0,0,0)}{0.8*\radius}{-\Gamma}{0}{anchor=east}{$\gamma$}

\tdplotsetrotatedcoords{0}{0}{0}
\tdplotdrawarc[tdplot_rotated_coords,-latex]{(0,0,0)}{0.8*\radius}{90}{90+\Alpha}{anchor=east}{$\alpha$}
\tdplotsetrotatedcoords{\Alpha+90}{90}{0}
\tdplotdrawarc[tdplot_rotated_coords,-latex]{(0,0,0)}{0.8*\radius}{-180}{-180+\Beta}{anchor=east}{$\beta$}
\tdplotsetrotatedcoords{\Alpha}{\Beta}{\Gamma}
\tdplotdrawarc[tdplot_rotated_coords,-latex]{(0,0,0)}{0.8*\radius}{90-\Gamma}{90}{anchor=east}{$\gamma$}

\end{tikzpicture}
\end{document}

A: Et voilà. Not sure I really understand how tikz-3dplot works (would no doubt help if I read the documentation) and have proceeded (mostly) along the same lines of the original code.
I just changed the order that things are drawn, and used clipping to draw the dashes for lines are behind other surfaces. This results in some rather disorganized code, as (for example) the axes are not grouped together (which would be ideal).
Things will no doubt fall apart if the \Alpha, \Beta and \Gamma parameters are changed significantly.
\documentclass[border=0.125cm]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}

\def\radius{6}
\def\Alpha{20}
\def\Beta{20}
\def\Gamma{20}

\begin{document}

\tdplotsetmaincoords{70}{150}

\tikzset{% Some styles. More could be done.
    axis/.style={very thick, fill=white, -*, shorten >=-3pt},
    axis'/.style={thick, -},
    axis''/.style={thick, -},
    Axis/.style={very thick, fill=black, -*, shorten >=-3pt},
    behind lines/.style={loosely dashed}
}

\begin{tikzpicture}[tdplot_main_coords]

\begin{scope}[scale=\radius, every path/.style={tdplot_rotated_coords}]

% Back half of the white circle.
\tdplotsetrotatedcoords{\Alpha}{0}{0}
\draw  [fill=white]
    plot    [domain=90:270, samples=100] (cos \x, sin \x) -- cycle;

% The light gray circle
\tdplotsetrotatedcoords{\Alpha}{\Beta}{\Gamma}
\draw  [fill=gray!20]
    plot    [domain=0:360, samples=100] (cos \x, sin \x);

% The dashed edge of the back half of the white circle
\begin{scope}
\tdplotsetrotatedcoords{\Alpha}{\Beta}{\Gamma}
\path  [clip]
    plot    [domain=0:360, samples=100] (cos \x, sin \x);

\tdplotsetrotatedcoords{\Alpha}{0}{0}
\draw  [behind lines]
    plot    [domain=90:270, samples=100] (cos \x, sin \x);
\end{scope}

% The upper (unfilled) semi circles
\tdplotsetrotatedcoords{\Alpha}{90}{0}
\draw [domain=90:270, samples=100] plot (cos \x, sin \x);
\tdplotsetrotatedcoords{\Alpha+90}{90}{0}
\draw [domain=90+\Beta:270+\Beta, samples=100] plot (cos \x, sin \x);

% The dark gray sector
\tdplotsetrotatedcoords{\Alpha-90}{-90}{90}
\draw [fill=gray, thick, domain=0:\Beta]
    (0,0) -- plot (cos \x, sin \x) -- cycle;

% The X axis
\tdplotsetrotatedcoords{\Alpha}{\Beta}{\Gamma}
\draw[Axis] (0,0,0) -- (1,0,0) node [below left] {$X$};

% The x'' axis
\tdplotsetrotatedcoords{\Alpha}{\Beta}{0}
\draw[axis'] (0,0,0) -- (1,0,0) node [below left] {$x''$};

% The front half of the white circle
\tdplotsetrotatedcoords{\Alpha}{0}{0}
\draw  [fill=white]
    plot [domain=-90:0, samples=100] (cos \x, sin \x)
    .. controls (0.125*cos 22.5, 0.125*sin 22.5) ..
    (cos 45, sin 45) -- plot    [domain=45:90, samples=100] (cos \x, sin \x)
    -- cycle;

% The dashed lines in the front half of the white circle
\begin{scope}
\tdplotsetrotatedcoords{\Alpha}{0}{0}
\path  [clip]
    plot [domain=-90:0, samples=100] (cos \x, sin \x)
    .. controls (0.125*cos 22.5, 0.125*sin 22.5) ..
    (cos 45, sin 45) -- plot    [domain=45:90, samples=100] (cos \x, sin \x)
    -- cycle;

\tdplotsetrotatedcoords{\Alpha-90}{-90}{90}
\draw [behind lines] (0,0) -- (cos \Beta, sin \Beta);

\tdplotsetrotatedcoords{\Alpha}{\Beta}{\Gamma}
\draw [behind lines] (0,0,0) -- (1,0,0);

\end{scope}

% Axes x, y, z
\tdplotsetrotatedcoords{0}{0}{0}
\draw[axis] (0,0,0) -- (1,0,0) node [below left]  {$x$};
\draw[axis] (0,0,0) -- (0,1,0) node [below right] {$y$};
\draw[axis] (0,0,0) -- (0,0,1) node [above=0.1cm] {$z=z'$};

% Axis x'
\tdplotsetrotatedcoords{\Alpha}{0}{0}
\draw[axis] (0,0,0) -- (1,0,0) node [below left] {$x'$};

% Axes Y
\tdplotsetrotatedcoords{\Alpha}{\Beta}{\Gamma}
\draw[Axis] (0,0,0) -- (0,1,0) node [right] {$Y$};
% Axes z' and Z
\draw[Axis] (0,0,0) -- (0,0,1) node [left=0.1cm] {$z''=Z$};

% Axes y' and y''
\tdplotsetrotatedcoords{\Alpha}{\Beta}{0}
\draw[axis'] (0,0,0) -- (0,1,0) node [below right] {$y'=y''$};

% Arrows
\tdplotsetrotatedcoords{0}{0}{0}
\tdplotdrawarc[-latex]{(0,0,0)}{0.8}{0}{\Alpha}{below left=0cm}{$\alpha$}
\tdplotsetrotatedcoords{\Alpha+90}{90}{0}
\tdplotdrawarc[-latex]{(0,0,0)}{0.8}{-90}{-90+\Beta}{left}{$\beta$}
\tdplotsetrotatedcoords{\Alpha}{\Beta}{\Gamma}
\tdplotdrawarc[-latex]{(0,0,0)}{0.8}{-\Gamma}{0}{below}{$\gamma$}

\tdplotsetrotatedcoords{0}{0}{0}
\tdplotdrawarc[-latex]{(0,0,0)}{0.8}{90}{90+\Alpha}{above left=0cm}{$\alpha$}
\tdplotsetrotatedcoords{\Alpha+90}{90}{0}
\tdplotdrawarc[-latex]{(0,0,0)}{0.8}{-180}{-180+\Beta}{above}{$\beta$}
\tdplotsetrotatedcoords{\Alpha}{\Beta}{\Gamma}
\tdplotdrawarc[-latex]{(0,0,0)}{0.8}{90-\Gamma}{90}{left}{$\gamma$}

\end{scope}

\end{tikzpicture}

\end{document}


text:
Q: unable to click button with unique button data-order-group-id 's information python+selenium javascript code (repeat order 1):
<div class="col-ea-1 repeat-order repeatable-order">  #common row in other snippets
 <button data-order-group-id="a9755447-04ff-4d00-59bf-06ff87f8ead6" #different row
 data-restaurant-seo-url="/abc-pizza-bayburt-kirazli-mah"
 class="ys-btn ys-btn-primary ys-btn-aa middle repeat-order-button"> REPEAT ORDER </button> ==$0
</div>

In the above snippet javascript code, there is more than one for each order (button data-order-group-id is different for each order) I also want to reach and click the REPEAT ORDER button for each order How can I do this in this piece of code?

A: You can try with the below xpath :
//button[contains(text(), 'REPEAT ORDER') and contains(@class, 'repeat-order-button')]

using find_element for single row, and find_elements for multiple row.
sample code :
for ele in driver.find_elements(By.XPATH, "//button[contains(text(), 'REPEAT ORDER') and contains(@class, 'repeat-order-button')]"):
    ele.click()
    # do some other stuff
    # re-initiate elements here otherwise you will get stale element reference
    #break if requires

A: @cruisepandey your code is working well but due to
the website's specific conditions which are help center fixed box and ORDER REPEAT buttons can overlap somehow That's why I used "window.scrollTo" before in addition to your code
i=int(input("choose:"))

if i==0:
                  driver.execute_script("window.scrollTo(0, 300)") #move the area
                  driver.find_elements(By.XPATH, "//button[contains(text(), 'REPEAT ORDER') and contains(@class, 'repeat-order-button')]")[0].click()
                  sleep(7)
elif i==1:
                  driver.execute_script("window.scrollTo(0, 300)") #move the area
                  driver.find_elements(By.XPATH, "//button[contains(text(), 'REPEAT ORDER') and contains(@class, 'repeat-order-button')]")[1].click()
                  sleep(7)
elif i==2:
                  driver.execute_script("window.scrollTo(0, 600)") #move the area
                  driver.find_elements(By.XPATH, "//button[contains(text(), 'REPEAT ORDER') and contains(@class, 'repeat-order-button')]")[2].click()
                  sleep(7)


text:
Q: Django - Error when changing from GET to POST I have a react/django application that works fine when the request is a GET request. For example, in the React part I have the following
sendRequestParameters(url) {
        axios({
            url: url,
            method: 'get',
            headers: {
                'X-CSRFToken': 'csrf_token',
                'Accept': 'application/json',
                'Content-Type': 'application/json;charset=UTF-8',
            },
            params:{
                'TECHNOLOGY': JSON.stringify(this.state.technologySelectedValue),
                // more parameters here, all in the same format
            },
            paramsSerializer: function(params) {
                return qs.stringify(params, {arrayFormat: 'repeat'})
            }
        }).then((response ) => {
           console.log(response.data);
        }).catch((error) => {
            console.log(error)
        })
    }

Then, in the backend, I get the parameters and return them (this function is called in another function where the returned parameters are used, that's why there is a return statement).
def extractParameters(request):
    TECHNOLOGY = json.loads(request.GET.get('TECHNOLOGY'))
    # more parameters extracted here, same format

    return TECHNOLOGY etc.

That all works fine. However, I need to change to POST requests, and when I make two small modifications to do this, I get an error. In the front end request with axios, I change the method: 'get' to method: 'post'. Then, in the backend, I change TECHNOLOGY = json.loads(request.GET.get('TECHNOLOGY')) to TECHNOLOGY = json.loads(request.POST.get('TECHNOLOGY'))
This gives me the following error in the terminal
TECHNOLOGY = json.loads(request.POST.get('TECHNOLOGY'))
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType

All I'm doing is a simple change from GET to POST and it's causing this error. I've been reading through the Django documentation but am stuck. Any assistance would be appreciated.

A: I assume you are using DRF (Django REST Framework). You can get it using data:
TECHNOLOGY = request.data.get('TECHNOLOGY')

 Also sorry, but UPPERCASE request params and variables are used never.


text:
Q: Can tilemill display line as arrow I am making a map in Tilemill map using OSM Bright as base map. I have added two shp files. One has markers on it and other lines. Shape file with lines represents rivers and I would like to display them as arrows (lines are divided into several sections). Can this be done in TileMill like it can be done in Manifold? (and how?)
Thanks for the info.


text:
Q: Difference between using document and element for on event trigger Given these two jquery on event triggers
$(document).on("click", "a[data-trigger='colorbox']",function(e){

$("a[data-trigger='colorbox']").on("click",function(e){

I had to click on the anchor tag twice before the colorbox is triggered when I used the first one. For subsequent clicks, it doesnt require a second click to trigger. But for the second one, the colorbox is triggered on the very first click. Is there any difference between the two?
my content for the function is as below
e.preventDefault();
var currentTarget = $(e.currentTarget);
currentTarget.colorbox({inline : true, href : currentTarget.data("href")});

A: $(document).on("click", "a[data-trigger='colorbox']",function(e){

This binds a click event to the document and all child elements within it. This click event then checks if the clicked element matches the filter a[data-trigger='colorbox']
the later:
$("a[data-trigger='colorbox']").on("click",function(e){

binds the click event to the a[data-trigger='colorbox'] directly.
Now if your element is dynamic you would want to use the first one. As this means you don't have to keep rebinding your click event. If your element is static then you want to use the later as it's more efficient.
A third way (or a more efficientway to do the first option) is to bind this to a parent element that is static as opposed to the document and then filter on the element being clicked, i.e.
$(parent).on("click", "a[data-trigger='colorbox']",function(e){

this is more efficent because it does not need to capture click events on the entire document

A: The 1st method captures an event that has bubbled up from the element through its parents until the document. This method is referred to as delegated event handling
The second one: captures the event directly on the element.
What is going on in the background:
Document structure:

*

*document

*

*grand parent

*

*parent

*

*element

*parent2

*...

Event: The user clicks on element
Outcome:

*

*All click listeners of element are executed * (Your 2nd case)

*The event starts to bubble

*All click listeners of parent are executed *

*All click listeners of grand parent are executed *

*All click listeners of document are executed * (Your 1st case)

*The listeners get the event object, and have the possibility to cancel the bubbling by calling:

*

*event.stopPropagation(): Doesn't let the event propagate to parents, but executes all listeners on current level.

*event.stopImmediatePropagation(): Doesn't let the event propagate to parents and no other listeners will be invoked on the same level either

JQuery can handle click events of element in a listener that is bound to the document because on every layer you can check the click event object for information:

*

*The currently handling event event.currentTarget

*The element that was originally clicked event.target
More at jQuery docs
Back to your situation
Case 2
Is pretty straightforward:

*

*the element is clicked

*its handler is executed

If the element is dynamically added / removed etc. You have to take care of its handlers (assign / deassign etc.)
Case 1
The element is clicked:

*

*The event bubbles up until the document

*The handler on document is called

*The handler verifies that the event is from a click that was made on your element

You should opt for this solution if your element is dynamically added/removed and you don't want to manage click handlers on it. Nevertheless you shouldn't assign it on document, since then the basic listener will be called for every click on the page, jQuery will check if the target was the element you are interested in and call the handler specified by you if it is the case. All in all, this can decrease performance if overused.
Knowing all this should help you find out what is the behavioral difference in your situation.


text:
Q: abstract classes which implements an incomplete interface For example, I have an interface with 4 methods.
If I implement this interface incomplete in a class, the class must be abstract. Right?
For example, I leave one method out. So now I am writing a subclass which extends this class. Now I implement the last method of the interface.
What happens, if I call this method in the abstract superclass? Nothing! It works. But why?
What will happen, if I write several classes, extending this abstract class and implement the fourth method of the interface? Which one will be called?

A: A interface is a contract you define the signature of your methods, only behaviour and constants, all methods are public and abstract.
In an Abstract Class you define behaviour and state, you can have some implementation and abstract methods.
For example for your question:

If I implement this interface incomplete in a class, the class must be
  abstract. Right?

Right

For example, I leave one method out. So now I am writing a subclass
  which extends this class. Now I implement the last method of the
  interface.
What happens, if I call this method in the abstract superclass?
  Nothing! It works. But why?

Will run cause in runtime execution knows what class is. this is polymorphism.

What will happen, if I write several classes, extending this abstract
  class and implement the fourth method of the interface. Which one will
  be called?

The one you instanciate in your client code :D
public interface Operation{
 void operation1();
 void operation2();

}

I don't implement operation2
public abstract class ClaseBase implements Operation{
//with final im saying childs wont override
 public final void operation1{
   // do something
   operation2();
   // do something
 }

}

//have to implements operation2 cause it's a concrete class
public class Child extends ClaseBase{
 void operation2(){
   System.out.println("Something");
 }

}

You can't instanciate an AbstractClass.
In your client code
ClaseBase base = new Child();
base.operation1(); // and it's gonna to call operation2 in childClass

Abstract class is useful with Template Method pattern.

A: Keep in mind that when you instantiate a subclass and refer it as super/abstract class or interface, it's still the instance of the subclass. Any method called on the object bubbles up from subclass to super class if its not available in the sub class.
Thus if you have:
  interface GemeInterface
        getStartScreen()
        getCloseScreen()

  abstract class AndroidGame implement GemeInterface
        getCloseScreen()

  class MrNomGame extends AndroidGame
        getStartScreen()

  class MrPetNomGame  extends AndroidGame
        getStartScreen()

and using as
//You can't instantiate AndroidGame hence the it has to be instance of a subclass
AndroidGame androidGame1 = new MrNomGame ();
androidGame1.getStartScreen();

//You can't instantiate AndroidGame hence the it has to be instance of a subclass
AndroidGame androidGame2 = new MrPetNomGame ();
androidGame2.getStartScreen();

Then also it works as androidGame1.getStartScreen() --> calls the method from MrNomGame, while androidGame2.getStartScreen() --> calls the method from MrPetNomGame.
Both the calls i.e. androidGame1.getCloseScreen() and androidGame2.getCloseScreen() will end up calling the method from AndroidGame as it's not available in the sub classes.

A: It depends on the object that you created. Super class can refer to subclass objects. So the actual object's method would be called.
interface A{

public void test1();

public void test2();

}

public abstract class B implements A{

public void test1(){

}

public abstract public void test2();

}

public class C extends B{

public void test2(){

}
}

B b = new C();
b.test2();//This works because the object that is refered by B is actually an object of C

Infact you can also do:
A a = new C();
a.test1();
a.test2();

Again though A is an interface(super type), but it is actually referring to a concrete implementation C(subtype) object and hence this works.
So at the compile time, compiler checks if A/B has a method called test2(), if yes compile is happy and it compiles successfully. But at the runtime, you invoke test2() method on the object and object actually is of class C which has the complete implementation.

A:
What happens, if I call this method in the abstract superclass? Nothing! It works. But why?

You cannot invoke this method on the abstract superclass because it can't be instantiated. You would only be invoking it on a sub-class of this abstract super-class which would be forced to provide an implementation (or be declared abstract itself).
So, when you invoke this method, its the implementation provided by the non-abstract sub-class that gets executed.

The funny thing is that a method of the class 'AndroidGame' calls 'getStartScreen()'. But there could be several classes like 'MrNomGame' which extending 'AndroidGame'. Then which method would be executed?

The method code executed would depend on the runtime type of the actual object that you invoke this method on. So, you could have a code like this
AndroidGame game1 = new MrNomGame();
AndroidGame game2 = new SomeOtherGame();

game1.getStartScreen(); // invokes MrNomGame's version
game2.getStartScreen(); // invokes SomeOtherGame's version

and due to dynamic binding the JVM would invoke the getStartScreen() as implemented by the class type of the actual object that the reference points to.


text:
Q: Error while mapping an array: Value of type '[X]' has no member "a" I am trying to get an array of string from a specific property in an array of custom objects
    let contracts : [Contract]? = Contract.all()
    let contractCategoryNames = contracts.map {$0.categoryName}

I get a compiler error:
Value of type '[Contract]' has no member 'categoryName'

What am I doing wrong here? My understanding is that $0 there is actually the element of the [Contract] array.


text:
Q: Increasing Multiplier I have a data frame (df) with two variables shown below:
   pricePerBusiness num_businesses
1           4228.966         3755
2           4966.552         3243
3           4678.073         3109
4           4752.259         2990
5           4545.194         2949

I want to make a new data frame which is a product of this dataframe and a scalar  (15 in this example) that increases in value (1,2,3,...) for each row, example:
df2[1,] <- 1*df[1,]$pricePerBusiness + 0.15*df[1,]$num_businesses - 15*1
df2[2,] <- 1*df[2,]$pricePerBusiness + 0.15*df[2,]$num_businesses - 15*2
df2[3,] <- 1*df[3,]$pricePerBusiness + 0.15*df[3,]$num_businesses - 15*3

And so on. My dataframe (df) however has many rows, is there a quicker way to do this?

A: modify your scalar with
as.numeric(rownames(df))*0.15

A: Below is a possible dplyr solution. Please make sure that your questions are reproducible.
# importing dplyr
library(dplyr)

# reproducing your original data frame
df <- data_frame(
  pricePerBusiness = c(4228.966, 4966.552, 4678.073, 4752.259, 4545.194),
  num_businesses = c(3755, 3243, 3109, 2990, 2949)
)

# creating the final data frame you want
df2 <- df %>%
  mutate(
    # constructing the term to substract
    penalty = 15 * 1:nrow(df),
    # computing the value needed
    value = pricePerBusiness + (0.15 * num_businesses) - penalty
  )

A: Also, using with() in base:
with(df,
  df2 <<- data.frame(result = pricePerBusiness + 0.15 * num_businesses - 15 *
                              (1:length(num_businesses)))
)

A: I do not have a lot of know about df but i search and find this links i hope it will help you

*

*https://www.datacamp.com/community/tutorials/15-easy-solutions-data-frame-problems-r

*http://www.r-tutor.com/r-introduction/data-frame


text:
Q: Matching Values with the keys Here is my custom Object made for comparsion.. from the response i get the value and now i have to match the value with the keys in this object and return the key.

A: That could work for you:
for(key in heartRateRegular)
   if (key == value)
       return key;

The for..in clause iterates through all of the keys of the object. That's if you want to check the value you get against the Keys of your object. If you want to check the value against the Values of your object, do the following:
for(key in heartRateRegular)
   if (heartRateRegular[key] == value)
       return key;

A: Would this work for you?
function getValueFromKey(key) {
    for (key in heartRateRegular) {
        if (heartRateRegular[key] == response) return key;
    }
}

var heartRateRegular = {
    I: 'Irregular',
    Ii: 'Irregularly Irregular',
    Ir: 'Irregularly Regular',
    R: 'Regular',
    Ri: 'Regularly Irregular'
}

response = 'Irregularly Irregular';
alert(getValueFromKey(response));
//alerts 'Ii'

Demo - http://jsfiddle.net/WydQh/


text:
Q: COPY INTO  in snowflake throws table does not exist I am trying to copy data to snowflake from local and I am getting

snowflake.connector.errors.ProgrammingError: 001757 (42601): SQL compilation error:
Table 'RAW_DATA' does not exist

the same code is working in Jupiter notebook but it doesn't work in vs code. My role is accountadmin so no issue with the permissions.
Code I am trying to run is this
COPY INTO RAW_DATA file_format=(FIELD_OPTIONALLY_ENCLOSED_BY ='"' skip_header=1)

A: I suspect you are using a different Database/schema than the Jupiter notebook
select current_warehouse(), current_database(), current_schema();

for me gives:

CURRENT_WAREHOUSE()
CURRENT_DATABASE()
CURRENT_SCHEMA()

COMPUTE_WH
TEST
TMP

and your local will be somewhere different.
The simple way to fix this is to always use fully qualifed names. Thus for me:
COPY INTO test.tmp.raw_data file_format=(FIELD_OPTIONALLY_ENCLOSED_BY ='"' skip_header=1)

A: Try replacing 'TABLE' with your table name.
Example:
COPY INTO mytable FROM 's3://mybucket/./../a.csv';

A: There is a syntax error. You cannot name use TABLE as a table name. TABLE is a reserved keyword
https://docs.snowflake.com/en/sql-reference/reserved-keywords.html
From the docs:
https://docs.snowflake.com/en/sql-reference/sql/copy-into-table.html
COPY INTO [<namespace>.]<table_name>
     FROM { internalStage | externalStage | externalLocation }
[ FILES = ( '<file_name>' [ , '<file_name>' ] [ , ... ] ) ]
[ PATTERN = '<regex_pattern>' ]
[ FILE_FORMAT = ( { FORMAT_NAME = '[<namespace>.]<file_format_name>' |
                    TYPE = { CSV | JSON | AVRO | ORC | PARQUET | XML } [ formatTypeOptions ] } ) ]
[ copyOptions ]
[ VALIDATION_MODE = RETURN_<n>_ROWS | RETURN_ERRORS | RETURN_ALL_ERRORS ]

So instead of
COPY INTO TABLE FILE_FORMAT = (FIELD_OPTIONALLY_ENCLOSED_BY ='"' skip_header=1)

try
 COPY INTO MYTABLE FILE_FORMAT = (FIELD_OPTIONALLY_ENCLOSED_BY ='"' skip_header=1)

Of course you will need to create MYTABLE first.

A: It was not working with
COPY INTO RAW_DATA file_format=(FIELD_OPTIONALLY_ENCLOSED_BY ='"' skip_header=1)

But Then I tried
table_name = "RAW_DATA"
f"COPY INTO {table_name} file_format=(FIELD_OPTIONALLY_ENCLOSED_BY ='"' skip_header=1)"

it started working.
Not sure why but this seems working for now


text:
Q: WinDBG doesn't display source lines despite loading private pdb files I am trying to debug a problem in a native DLL using WinDBG.  I believe that I have the private symbols loaded, but WinDBG is not displaying the source lines or parameter information.  Here is what I am observing; any help would be greatly appreciated!
I have the PDB which I believe corresponds to the DLL in the symbol search path.  Running lm I see:
01050000 01058000   3NMSMTHR C (private pdb symbols)  e:\ads_symbols\3NMSMTHR.pdb

As this states "private pdb symbols" I expect that this is the private pdb.
I also ran symchk and see the following output:
C:\utils\inetmgr\patch01>"c:\Program Files\Debugging Tools for Windows (x86)\symchk.exe" /v 3nmsmthr.dll /s c:\utils\inetmgr\patch01
[SYMCHK] Searching for symbols to C:\utils\inetmgr\patch01\3nmsmthr.dll in path c:\utils\inetmgr\patch01
DBGHELP: Symbol Search Path: c:\utils\inetmgr\patch01
[SYMCHK] Using search path "c:\utils\inetmgr\patch01"
DBGHELP: No header for C:\utils\inetmgr\patch01\3NMSMTHR.DLL.  Searching for image on disk
DBGHELP: C:\utils\inetmgr\patch01\3NMSMTHR.DLL - OK
DBGHELP: 3NMSMTHR - private symbols & lines
     c:\utils\inetmgr\patch01\3NMSMTHR.pdb
[SYMCHK] MODULE64 Info ----------------------
[SYMCHK] Struct size: 1680 bytes
[SYMCHK] Base: 0x10000000
[SYMCHK] Image size: 32768 bytes
[SYMCHK] Date: 0x4cc1b0f8
[SYMCHK] Checksum: 0x00000000
[SYMCHK] NumSyms: 0
[SYMCHK] SymType: SymPDB
[SYMCHK] ModName: 3NMSMTHR
[SYMCHK] ImageName: C:\utils\inetmgr\patch01\3NMSMTHR.DLL
[SYMCHK] LoadedImage: C:\utils\inetmgr\patch01\3NMSMTHR.DLL
[SYMCHK] PDB: "c:\utils\inetmgr\patch01\3NMSMTHR.pdb"
[SYMCHK] CV: RSDS
[SYMCHK] CV DWORD: 0x53445352
[SYMCHK] CV Data:  I:\usr\bpi\adrutl\3NMSMTHR.pdb
[SYMCHK] PDB Sig:  0
[SYMCHK] PDB7 Sig: {A865C40A-5070-4752-AD1F-CD3087843807}
[SYMCHK] Age: 4
[SYMCHK] PDB Matched:  TRUE
[SYMCHK] DBG Matched:  TRUE
[SYMCHK] Line nubmers: TRUE
[SYMCHK] Global syms:  TRUE
[SYMCHK] Type Info:    TRUE
[SYMCHK] ------------------------------------
SymbolCheckVersion  0x00000002
Result              0x001f0001
DbgFilename
DbgTimeDateStamp    0x4cc1b0f8
DbgSizeOfImage      0x00008000
DbgChecksum         0x00000000
PdbFilename         c:\utils\inetmgr\patch01\3NMSMTHR.pdb
PdbSignature        {A865C40A-5070-4752-AD1F-CD3087843807}
PdbDbiAge           0x00000004
[SYMCHK] [ 0x00000000 - 0x001f0001 ] Checked "C:\utils\inetmgr\patch01\3NMSMTHR.DLL"

SYMCHK: FAILED files = 0
SYMCHK: PASSED + IGNORED files = 1

This finds the PDB in the right path I've given it (note that I copied this exact PDB file to e:\ads_symbols which is the path seen in the lm output).  This symchk output states Line Numbers: true and thus I expect to see private style information.  However, if I run ~kv then for my functions in the stack trace I see:
00bef2ac 01052a8a 00000000 00000000 00020aa4 3NMSMTHR!BPMThrProcTerm+0x2c0
00bef2cc 100073eb 00bef4d8 00000000 00000000 3NMSMTHR!BPMThrThreadInitName+0x2a

And this doesn't seem like its reading the private information-- I don't get the source listing like I do for the MS CRT functions which have private symbols on the MSFT symbol server.  Also if I do x /t /d 3NMSMTHR!ThreadInitName then I get
01052a60 <NoType> 3NMSMTHR!BPMThrThreadInitName = <no type information>

And lastly if I try to use .frame3 (to go to that frame) and then execute dv to display the locals, I receive the:
0:001> .frame
03 00bef2cc 100073eb 3NMSMTHR!BPMThrThreadInitName+0x2a
0:001> dv
Unable to enumerate locals, HRESULT 0x80004005
Private symbols (symbols.pri) are required for locals.
Type ".hh dbgerr005" for details.

This doesn't make sense to me.  Any help would be much appreciated.  My overall goal is to get the parameter and source information.  OR to confirm that the PDB file I have is in fact NOT the private symbols.  I didn't build this DLL or PDB nor do I know any specifics about the linker options passed to it.
Thanks!
EDIT:
I failed to mention that I am getting the checksum error:
*** WARNING: Unable to verify checksum for C:\utils\inetmgr\3NMSMTHR.dll

Sorry!  I was trying to run the .lines command as suggested below and I see:
*** WARNING: Unable to verify checksum for C:\utils\inetmgr\3NMSMTHR.dll
DBGHELP: 3NMSMTHR - private symbols & lines
    e:\ads_symbols\3NMSMTHR.pdb
Line number information will not be loaded

So I guess that's my problem.  Which leads to my next question:  is there a way to fix the checksum (which is listed as 0, see above symchk output)?  This PDB is the correct one given the symchk output.  Can I have it bypass the checksum check?
EDIT2:
For anyone else that comes across this: I was able to fix the checksum warning by:
editbin /release 3NMSMTHR.DLL

This set the checksum in the PE header.  Then I had to run the
.symopt+0x40

In WinDbg in order to force it to load the PDB even though the timestamp on the DLL was different.  I'm sure that alternatively I could've used some utility to update the modified timestamp as well.
That fixed the warning about the checksum...but STILL no parameter info (running dv on the right frame), no source line info, etc.
So now I'm lost. Is it possible that these PDBs don't contain that info?  How could I confirm that?  How would I build them to contain it?  We use NMAKE to build these.
EDIT3:
I rebuilt the DLL and PDB as DEBUG and then got all of the stack trace information that I expected.  So now my question is: (1) is it possible to build in release and get the static functions, parameter info, etc. (private symbol info)?  and (2) the stack trace I was getting with the release dlls+pdbs was incorrect-- the first function entrypoint was correct, but then the next stack frame showed a func that wasn't called.  My assumption is that the release DLL inlined some functions and somehow the PDB was just "guessing" at the function in that frame? Very strange.

A: Did you try the .lines command?

A: If you want to be able to make sense of dumps or stack traces even in Release mode, you should ensure the following:

*

*You compile with /Zi or /ZI (Debug Information Format is one of the two Program Database options).

*You do not compile with /Oy (Omit Frame Pointers).

*You link with /DEBUG (Generate Debug Info).

*You keep (but don't distribute) the resulting .pdb file.

The main thing is to avoid omitting frame pointers; omitting them saves a little bit of time/space in a function call but makes it very hard to stack walk.  Note that you may still get odd stack traces from release builds due to other optimisation settings (particularly inlining) but they should still have the majority of interesting functions.

A: You will not have type information if the function is written in assembly language.  Also it is possible that a static library was linked to the DLL and the static library did not have full debug information.

A: I know this is old, but for anyone coming across this issue, what worked for me was to run ".lines -e". This is probably what Naveen was suggesting.


text:
Q: How are treated disallowed windows® characters on a fat32 formated usb stick? I don't own a mac so I can't tell about things like?or:in filenames…
I'm especially interested in the Dos/Windows® path separator :\. I know in Linux it is a legal character which can be used inside fat32 filenames (Windows® will complain the volume is corrupt).
Does the same is true for osx ? Or does runningmkdir ..\\direntwill createdirentin the parent directory (still in the case of fat32 as I already know the behaviour on hfs) ?
Of  Course I'm talking about the case where the volume is mounted through the Finder.
Depending on the answer, it might confirm the existence of a vulnerability in a popular source code management software…

A: This is an interesting question, and I had to find it out myself on my MacBook with operating system "OS X El Capitan". You have to differentiate between unallowed characters in the finder / applications using the finder (e. g. text editor) versus the command line.
First of all, the backslash "\" is like any normal character both in finder and the command line. So you can create a file or directory like A\B. Same is true for the question mark.
When it comes to the colon ":", then it becomes complicated. When you create a file named A:B at the command line, then it's created and displayed properly at the command line, but it gets displayed as A/B in the finder. And if you try to create a file containing a colon in finder, like C:D, then you get the error "The name C:D can't be used. Try using a name with fewer characters, or with no punctuation marks."
Creating a file or directory that begins with the dot "." can be done at the command line, no problem. But since these kind of files and directories are used for hidden files and directories, you cannot create them in finder. Instead you will get an error window telling "You can't use a name that begins with a dot ".", because these names are reserved for the system. Please choose another name."
If you execute the command
mkdir ..\\dirent

at the command line then this creates the hidden directory with the name
..\\dirent

in the current directory, so not a directory called dirent in the parent directory.
By the way: I tested this with a fat32 formatted usb stick, but even if I used an NTFS formatted external hard drive or the internal HFS+ formatted internal SSD drive it behaves the same.
If I look at all these files and directories (that I wrote on my MacBook to the USB stick) in Windows Explorer (with Windows 10) then both the backslash, the colon and the question mark are displayed differently than on the MacBook, each of them with the same special character which I cannot create on my keyboard nor can I copy and paste properly - pasting in this window here creates "" which doesn't look like the character displayed in Windows Explorer. In Windows Explorer it looks similar to the dot ".", but this dot is located somewhat above the regular dot, so vertically in the middle.
I hope I could help you somehow.


text:
Q: Change json-server response type for custom route. NotAcceptableError: Not Acceptable I am using json-server custom output to read md file. I want to return the contend on specific rout as text/plain, so I wrote this code:
server.get('/static/*', (req, res) => {

  const filePath = path.join(__dirname, `myfile.md`);
  fs.readFile(filePath, 'utf8', (err, data) => {
    if (err) {
      res.send(err);
      return;
    }
    res.format({
     'content-type: text/plain': () => res.send(data),
    });
  });
});

When I am accessing that route I am getting an error NotAcceptableError: Not Acceptable Any ideas how to fix?

A: res.format is not what you want to use. You use res.set to set a response header - like so:
server.get('/static/*', (req, res) => {
    const filePath = path.join(__dirname, `myfile.md`);
    fs.readFile(filePath, 'utf8', (err, data) => {
        if (err) {
            res.send(err);
            return;
        }
        res.set('Content-Type', 'text/plain');
        res.send(data);
    });
});


text:
Q: A seperate table for the posts which each user has liked - practical or not? In a social networking site I'm making, I need some way to store which posts a user has 'liked', to ensure they can only 'like' each post one time. I have several ideas.

*

*A seperate table for each user, to store all of the different posts' IDs which they've liked as rows in said table.

*A space-seperated string of post IDs as a field in the table users.

*A seperate table for each post, storing all of the different users' IDs which have liked said post as rows in the table.
note, users is a table containing all of the site's users, with their ID, username, etc.
-
Initially I liked the idea of a seperate table for each user, but I realised this might be more trouble than it's worth.
So I thought a space-seperated string for each row in users might be a good idea, since I wouldn't have to start working with many more tables (which could complicate things,) but I have a feeling using space-seperated strings would lower performance significantly more than using additional tables, especially with a greater amount of users.
Essentially my question is this: Which, out of the aforementioned methods of making sure a user can only like a post once, is the most practical?

A: None of these sound like particularly good ideas.
Generally, having to create tables on the fly, be it for users or posts, is a bad idea. It will complicate not only your SQL generation, but also clutter up the data dictionary with loads of objects and make maintaining the database much more complicated than it should be.
A comma-delimited string also isn't a good idea. It breaks 1NF will complicate your queries (or worse - make you right code!) to maintain it.
The sane approach is to use a single table to correlate between users and posts. Each row will hold a user ID and the ID of a post he liked, and creating a composite primary key over the two will ensure that a user can't like a post twice:
CREATE TABLE user_post_likes (
    user_id INT, -- Or whatever you're using in the users tables
    post_id INT, -- Or whatever you're using in the posts tables
    PRIMARY KEY (user_id, post_id),
    FOREIGN KEY (user_id) REFERENCES user(id),
    FOREIGN KEY (post_id) REFERENCES post(id)
);


text:
Q: Cannot test Android app on Android Studio AVD as Google Play Services out of date Seen several S/O links which failed to fix this for me.
Have been developing an Anrdoid App with some use of Google Maps API.
Cannot test said code because it claims:
"Google Play services out of date.  Requires 7895000 but found 6774470"
Instead of showing the map, you get a message plus an "Update" button, which crashes the APP if you click on it. (I believe it's dependent upon Google Play Store being installed)
There is no Google Play store installed on the emulator - this appears to be by design from Google, neither does there appear a way to install it.
The Google Play Services cannot be updated through the settings panel
I have tried downloading the appropriate APK and using adb install, but despite choosing the correct download (current version 6.7.74 1723905-470, downloaded apk 7.8.99 2134222-470) it says: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]
I have tried creating a new x86 emulator with a different Android version, same problems persist. Current preference is Google APIs v22 on x86.
How can you test Google Maps on an emulator without paying Google money?


text:
Q: How to deal with many jQuery 'on' click events in native JavaScript? As I move more an more into web apps and into using asynchronous content loading. I end up with many many $(document).on('click') event listeners.
I would like to write this in plain JavaScript and am unsure the best way to do this. The following is what I want to get away from as it feels icky.
var doc = $(document);

doc.on('click', 'someElement1', function(){});
doc.on('click', 'someElement2', function(){});
doc.on('click', 'someElement3', function(){});
doc.on('click', 'someElement4', function(){});
doc.on('click', 'someElement5', function(){});

Every click has something different to do and because of the way I componentise everything and write functions that could be used in many places, it feels like using document all the time as opposed to a parent element is a safer approach.
Any help would be greatly appreciated, thanks.

A: @shivgre I mean i can take a guess at that, perhaps something like:
$(document).on('click', function(e) {

    if (e.target === $('someElement1')[0]) {
        /* do some stuff */
    }

    if (e.target === $('someElement2')[0]) {
        /* do some stuff */
    }

    if (e.target === $('someElement3')[0]) {
        /* do some stuff */
    }

    if (e.target === $('someElement4')[0]) {
        /* do some stuff */
    }

    if (e.target === $('someElement5')[0]) {
        /* do some stuff */
    }

});

I mean maybe im overthinking it as the jQuery free solution wouldn't be much different. The key reason im doing $(document).on('click'); is because theres heavy use of ajax to load content. Is there any way around this?
It just feels overkill to trigger all document click events every time theres a click on the page. Any thoughts on tackling this?


text:
Q: Node MCU failed to connect with firebase but does not return any error code I need to send my data to firebase via NODE MCU. I've created an application that is used to turn on and off led in node mcu. My node mcu connects with the wifi network but does not send data to firebase. The if(firebase.failed()) executes, but does not return an error code. In the serial monitor it just prints setting/number failed:. How can I fix this?
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
#include <ArduinoJson.h>

#define FIREBASE_HOST "http://temphu*****.firebaseio.com/"
#define FIREBASE_AUTH "VblTNS************OmWTW6n"
#define WIFI_SSID "A****"
#define WIFI_PASSWORD "9*****"
#define LED 2

void setup() {
    pinMode(LED,OUTPUT);
    digitalWrite(LED,0);
    Serial.begin(9600);
    WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
    Serial.print("connecting");
    while (WiFi.status() != WL_CONNECTED) {
        Serial.print(".");
        delay(500);
    }
    Serial.println();
    Serial.print("connected: ");
    Serial.println(WiFi.localIP());
    Firebase.begin(FIREBASE_HOST,FIREBASE_AUTH);
    Firebase.setInt("LEDStatus",0);
}

void loop() {
    if(Firebase.getInt("LEDStatus")) {
        digitalWrite(LED,HIGH);
    }
    else {
        digitalWrite(LED,LOW);
    }
    if (Firebase.failed()) { // Check for errors
        Serial.print("setting /number failed:");
        Serial.println(Firebase.error());
        return;
    }
    delay(1000);
}

A: In the source code it clearly says that (https://raw.githubusercontent.com/FirebaseExtended/firebase-arduino/master/src/FirebaseError.h) two error codes are used in addition to regular HTTP error codes. Therefore Firebase rejection might not raise an error even though it fails.
So check the firebase rules and change read/write to true.


text:
Q: WPF - Shut-off autogen of Main in App.g.cs I'm learning WPF.
I want to provide my own Main method in my App.xaml.cs rather than getting one generated for me in App.g.cs. However I keep getting conflicts because I haven't found out how to stop an additional Main from being generated.
Is there a setting in my project file or elsewhere that controls this?

A: You can also just create a separate class (for example, Entry) which is responsible for bootstrapping your application. Then go to project settings and set your startup object to Entry. That way you don't even have to disable the autogenerated method.

A: I found the answer here. http://learnwpf.com/post/2007/12/13/How-can-I-provide-my-own-Main%28%29-method-in-my-WPF-application.aspx
It is:

The way WPF knows to create the Main() method for a particular xaml file is through the build action property set for App.xaml - it has a build action of ApplicationDefinition. By changing this to Page WPF won't create the Main method and you can provide your own in a regular class file you add to the project.

However in the comments to the above blog, a comment notes there may be issues with blend and it references: http://blogs.msdn.com/expression/archive/2008/04/09/creating-a-wpf-blend-project-that-loads-resources-in-code.aspx .  I don't fully understand the issues yet.

A: The easiest way is to set the Build Action in the Properties window from ApplicationDefinition to Page for App.Xaml.
Then you can define your own entry point.

A: I found a solution:

*

*Copy the data from your app.xaml file

*Delete app.xaml file and re-create with the same name

*Create `main` method in .cs file, and paste your old copied code into it

A: One way is to forgo defining an Application-derived class in XAML, so you can manually define the Main method with your custom requirement

A: The Easy way just create a class like Startup.cs with build action to compile
and remove ApplicationDefinition from App.xaml convert that to page
and remove it from any other file in the application


text:
Q: Are the contents of the capacitors of a mobile charger toxic or not? Do the capacitors use mercury? I cut open some electrolytic capacitors, and it smelled. It is poisonous?

A: There's no mercury inside – but also, mercury doesn't smell, so that's in any case not what you experienced.
Inside capacitors (if you can cut them open) is electrolyte; an aqueous  solution of salts; these certainly aren't chosen to be healthy...
So, not healthy, but also not poisonous in the sense that you need to see a doctor. Throw them away, and you'll be fine.


text:
Q: Xamarin.forms androidx.core.content.FileProvider         <provider
                android:name="androidx.core.content.FileProvider"
                android:authorities="appp.fileprovider"
                android:grantUriPermissions="true"
                android:exported="false">
            <meta-data
                    android:name="android.support.FILE_PROVIDER_PATHS"
                    android:resource="@xml/file_paths" />
        </provider>

Unresolved class FileProvider. What is problem?


text:
Q: Excel VBA - Saving A Series of Charts into one GIF picture for the animation effect I want to use VBA programming to save a a series of charts in Excel into one GIF picture for the animation effect. Is there any solution?
The below is a related question which address the issue of saving a chart into a GIF file one by one without any animation effect.
Excel VBA - Saving Charts as GIF files

A: Looks like VBA cannot export animated gifs itself, which makes for an interesting programming challenge. You have two options:
Make the GIF file yourself
The GIF specification doesn't look hard. In fact, here's a guy who says it's easy to implement it in VBA. If you have time and are coding for learning or for fun, I'd attempt this. If you're hard pressed, try the next suggestion.
Call a third-party tool from your code
Have a free tool like Gifsicle do the job for you (download the Windows port). In your code, when it's time to create the resulting GIF, instead of something like
call CreateGif("result.gif", "input1.gif", "input2.gif", "input3.gif")

You will externally call the .exe tool, like:
call Shell("C:\path\to\gifsicle.exe input1.gif input2.gif input3.gif > result.gif")

Note that you'll probably need to fiddle with quoting paths and generally building the command line correctly (you'll use a loop if the number of input GIFs is variable). Read Gifsicle's man page for usage details.


text:
Q: Is it possible to get Visual Studio's Git interface to recognize a global ingnore? I know that the IDE allows you to edit a local .gitignore file in the project. It also recognizes my email and name from the global config.
Is there a way to manually edit something so that it recognizes the settings that is already in the global config?
As a workaround I copied the global configuration file into .gitignore. After deleting ms-persist.xml and starting Visual Studio the desired values were there as part of the project.


text:
Q: MATLAB Plotting Contour Map from Different Plots I am trying to write a MATLAB script to give me a contour map. The contour map must be created from inputs that I generated from 100 images.
The story is like this:
I have 100 images on which I ran an image processing algorithm for optimization. Now, I got their energy curves. So, I have 100 energy curves. I want to create a contour map that will show me where the points are denser on the plot. (the energy curves are plotted as energy vs. iteration with fixed number of iterations)
The following is my variable:
energy(iteration,numImages)

Hope I explained it well.
Thanks in advance.

A: From what i see of you graph (and using the comments also), one possible way is to use plot3 to plot a line in 3D for every plot.
For doing so, you can use something like this code:
x=(0:0.01:1)';

aexp=zeros(100,numel(x));
hold on
for ii=1:100;
%      aexp(ii,:)=exp((-x+ii/10)); %exponential
     aexp(ii,:)=exp(-(x-ii/100).^2); %~gaussian
%     aexp(ii,:)= x*ii; %linear increase
    plot3(x,aexp(ii,:),ii*ones(1,numel(x)));
end
 % set(gca,'yscale','log'); % uncomment if you need logscale.

giving

I have a few options of plot. It always plot from the XY view. I changed by hand, but you can use the view command. Notice that i used a simple counter to make the spacing in the z direction.
In a similar manner, you can plot using the contour. For my code, after the data have been generated in the for loop, remove/comment the plot3  and add:
contour(aexp) %outside the for loop,

giving

Notice that i have not really take care what i'm plotting. You can find more info on contour in the Matlab page .
You commented that the x-axis should be number of iterations, y-axis should be energy and z-axis should be the information containing how many lines are passing through from some areas.  For this, make a qq variable, being it qq=number_of_lines(number of iterations,energy) . Make a discrete grid for the energy if you don't have one. Number of iterations is probably discrete anyway. The function is you who need to devise, but i would go for something which checks the number of lines for every energy and every iteration. In this case you will have the z-function that depends on y and x, that is the case to use contour or surface.
My function above make a line for every ii point, to have a 3d function. An edition for another extra loop is not hard. Just remember to have the same regular grid for every point, otherwise you will have trouble.

A: I interpret your question to boil down to how can I create a surface plot with colors according to the energy found in energy.  I would solve this by using the contour function with a grid generated using meshgrid.  If each image is described in 1000 data points with 100 files the plot can be generated as follows:
% using stuff as random junk instead of energy
numPoints = 1000;
numFiles = 100;
stuff = rand(1000,100); % replace with actual information
[X, Y] = meshgrid(1:numFiles, 1:numPoints);
contour(X,Y,stuff);

You can also create a 3D surface plot using surf and the same logic.


text:
Q: Why slf4j Logger has no log method? I am wondering why there is no
logger.log(level, ...)

in slf4j. Is there a precise reason? When migrating from log4j to slf4j and using logback, this is causing me headache !

A: slj4j is just a Wrapper around the actual Logger implementation, in order to provide flexibility to change the underlying implementation.
Having said that , instead .log(,) notation, slf4j uses logger.level() like - logger.debug() logger.info() etc
and that too based on the supported LEVEL defined in your underlying logger configuration for example logger.properties.

A: This is just speculation, but I think log(Level... type method is not in the interface for some combination of these reasons:

*

*Keep number of methods in interface down

*Avoid needing to define numeric log levels in the interface

*Without numeric levels, just enum values, advantage of such method is not clear

*Being as independent as possible from underlying log system's log levels by not having log level class at all

*When dynamic log level would be desired by application, alternative might be Marker concept.


text:
Q: TypeORM: Generate migrations without dedicated ormconfig file Of the several ways of connecting to a database offered by TypeORM (json, env, yml...) I choose to set my Connection Options programatically within my project's code using a regular TypeScript file as follows:
// src/database/createConnection.ts

import { createConnection } from 'typeorm';

    const connectionOptions = {
        type: 'postgres',
        host: POSTGRES_HOST_PROD,
        port: Number(POSTGRES_PORT),
        username: POSTGRES_USER,
        password: POSTGRES_PASSWORD,
        database: POSTGRES_DB,
        entities: ['build/entities/**/typeDef.js'],
        migrations: ['build/database/migrations/*.js'],
        cli: {
            migrationsDir: 'src/database/migrations/'
        }
    };

await createConnection(connectionOptions);

With the values fed by a regular .env file.
My problem is that when trying to create migration files through npx typeorm migration:generate -n initial I get an error as the command expects a specific orm configuration file to be present (ormconfig.env, ormconfig.json, etc).
As I already have my connection options set, this is not only redundant, it would also be processed instead of the configuration I have already set in the .ts file, and the only solution I see would be to rename the variables in my (non-typeorm-specific) .env file to match the specific TypeORM variable names, which I'd prefer not to do.

TL:DR Is there a way of generating TypeORM migrations without creating a dedicated orm config file?

A: Oh, turns out TypeORM already has a built-in option for this which does not require an extra ormconfig file, one can just add the property migrationsRun: true to the Connection Options (making sure synchronize is set to false).
For instance:
import { createConnection } from 'typeorm';
const connectionOptions = {
    type: 'postgres',
    host: POSTGRES_HOST_PROD,
    port: Number(POSTGRES_PORT),
    username: POSTGRES_USER,
    password: POSTGRES_PASSWORD,
    database: POSTGRES_DB,
    migrationsRun: true,
    entities: ['build/entities/**/typeDef.js'],
    migrations: ['build/database/migrations/*.js'],
    cli: {
        migrationsDir: 'src/database/migrations/'
    }
};

await createConnection(connectionOptions);


text:
Q: PL/SQL dynamic query based on multiple rows I am trying to write a PL/SQL Script that reads tables and generates a dynamic query based on rule_id and parameter_id.
My script should read from parameter_value based on rule id and parameter id and use parameter value in dynamic query.
So my table called rules looks like this:

Here is my script - what am I doing wrong? I am getting an error

ORA-01747 invalid user.table.column,table.column or column  specification

declare
v_rule_id number(10);
v_parameter_id number(10);
v_parameter_value varchar2(100);
v_source_table varchar2(100);
v_lookup_table varhcar2(100);
v_source_column varchar2(100);
v_lookup_column varchar2(100);
v_date varhchar2(100);
v_query varchar2(1000);

BEGIN
FOR RL IN (SELECT RULE_ID FROM RULE)
LOOP
FOR PRM IN (SELECT PARAMETER_ID,PARAMETER_VALUE FROM RULE)
LOOP
IF PRM.PARAM_ID = 1 THEN
v_source_table:= PRM.PARAMETER_VALUE;
ELSIF PRM.PARAM_ID = 2 THEN
V_lookup_table := PRM.PARAMETER_VALUE;
ELSIF PRM.PARAM_ID = 3 THEN
V_source_column := PRM.PARAMETER_VALUE;
ELSIF PRM.PARAM_ID = 4 THEN
V_lookup_column := PRM.PARAMETER_VALUE;
ELSIF PRM.PARAM_ID = 5 THEN
V_date := PRM.PARAMETER_VALUE;
END IF;
v_query := 'SELECT * FROM (SELECT DISTINCT A.' || v_source_column || ', count(*) as count from'|| v_source_table || ' A LEFT JOIN' || V_lookup_table || ' ON A.'||V_source_column ||' = B.'|| V_lookup_column || 'WHERE B.'||V_lookup_table||' IS NULL GROUP BY A.'||V_source_column  ||'ORDER BY 2 DESC' );
EXECUTE IMMEDIATE v_query;
END LOOP;
END LOOP;
END;

A: Well... debug and you should find what is wrong.

*

*Tip for all future stack overlow posts: check AND RUN your code before you paste it.

*2nd Tip: write a couple of lines, then test, fix if needed, then continue with some lines. Else you'll end up with an large number of errors and you'll lose overview.

*3rd Tip: use dbms_output.put_line (or a logging framework like logger) to instrument your code.

Enjoy the debugging process below !
Manually create sample data since poster provided a screenshot. Please provide this code yourself next time - this is be your job not ours.
CREATE TABLE rule (RULE_ID,PARAMETER_ID,PARAMETER_EXPLANATION,PARAMETER_VALUE) AS
SELECT 1,1,'TABLE_1','A' FROM DUAL UNION ALL
SELECT 1,2,'TABLE_2','B' FROM DUAL UNION ALL
SELECT 1,3,'COLUMN_1','X' FROM DUAL UNION ALL
SELECT 1,4,'COLUMN_2','Y' FROM DUAL UNION ALL
SELECT 1,5,'DATE','20221231' FROM DUAL UNION ALL
SELECT 2,1,'TABLE_1','C' FROM DUAL UNION ALL
SELECT 2,2,'TABLE_2','D' FROM DUAL UNION ALL
SELECT 2,3,'COLUMN_1','Z' FROM DUAL UNION ALL
SELECT 2,4,'COLUMN_2','Q' FROM DUAL UNION ALL
SELECT 2,5,'DATE','20221231' FROM DUAL;

Table RULE created.

Run the code above:
run anonymous pl/sql block

ORA-06550: line 28, column 299:
PLS-00103: Encountered the symbol ")" when expecting one of the following:

   * & = - + ; < / > at in is mod remainder not rem
   <an exponent (**)> <> or != or ~= >= <= <> and or like like2
   like4 likec between || member submultiset
ORA-06550: line 31, column 5:
PLS-00103: Encountered the symbol "LOOP" when expecting one of the following:

   ;
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.

fix error on line 28, run block
Error report -
ORA-06550: line 6, column 16:
PLS-00201: identifier 'VARHCAR2' must be declared
ORA-06550: line 0, column 1:
PL/SQL: Compilation unit analysis terminated
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

fix error on line 6, run block
ORA-06550: line 9, column 8:
PLS-00201: identifier 'VARHCHAR2' must be declared
ORA-06550: line 0, column 1:
PL/SQL: Compilation unit analysis terminated
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

fix error on line 8, run block
Error report -
ORA-06550: line 17, column 8:
PLS-00302: component 'PARAM_ID' must be declared
ORA-06550: line 17, column 1:
PL/SQL: Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

replace occurrences of PARAM_ID with PARAMETER_ID, run block
Error report -
ORA-01747: invalid user.table.column, table.column, or column specification
ORA-06512: at line 29
ORA-06512: at line 29
01747. 00000 -  "invalid user.table.column, table.column, or column specification"
*Cause:
*Action:

ah... we got the error !
This is the code that gives the original error:
declare
v_rule_id number(10);
v_parameter_id number(10);
v_parameter_value varchar2(100);
v_source_table varchar2(100);
v_lookup_table varchar2(100);
v_source_column varchar2(100);
v_lookup_column varchar2(100);
v_date varchar2(100);
v_query varchar2(1000);

BEGIN
FOR RL IN (SELECT RULE_ID FROM RULE)
LOOP
FOR PRM IN (SELECT PARAMETER_ID,PARAMETER_VALUE FROM RULE)
LOOP
IF PRM.PARAMETER_ID = 1 THEN
v_source_table:= PRM.PARAMETER_VALUE;
ELSIF PRM.PARAMETER_ID = 2 THEN
V_lookup_table := PRM.PARAMETER_VALUE;
ELSIF PRM.PARAMETER_ID = 3 THEN
V_source_column := PRM.PARAMETER_VALUE;
ELSIF PRM.PARAMETER_ID = 4 THEN
V_lookup_column := PRM.PARAMETER_VALUE;
ELSIF PRM.PARAMETER_ID = 5 THEN
V_date := PRM.PARAMETER_VALUE;
END IF;
v_query := 'SELECT * FROM (SELECT DISTINCT A.' || v_source_column || ', count(*) as count from'|| v_source_table || ' A LEFT JOIN' || V_lookup_table || ' ON A.'||V_source_column ||' = B.'|| V_lookup_column || 'WHERE B.'||V_lookup_table||' IS NULL GROUP BY A.'||V_source_column  ||'ORDER BY 2 DESC';
EXECUTE IMMEDIATE v_query;
END LOOP;
END LOOP;
END;
/

Now it's time to do the proper debugging. Comment out the EXECUTE IMMEDIATE v_query; and replace add dbms_output.put_line(v_query); to see what you're trying to execute. Result: lots of rows like:
SELECT * FROM (SELECT DISTINCT A., count(*) as count fromA A LEFT JOIN ON A. = B.WHERE B. IS NULL GROUP BY A.ORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A., count(*) as count fromA A LEFT JOINB ON A. = B.WHERE B.B IS NULL GROUP BY A.ORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A.X, count(*) as count fromA A LEFT JOINB ON A.X = B.WHERE B.B IS NULL GROUP BY A.XORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A.X, count(*) as count fromA A LEFT JOINB ON A.X = B.YWHERE B.B IS NULL GROUP BY A.XORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A.X, count(*) as count fromA A LEFT JOINB ON A.X = B.YWHERE B.B IS NULL GROUP BY A.XORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A.X, count(*) as count fromC A LEFT JOINB ON A.X = B.YWHERE B.B IS NULL GROUP BY A.XORDER BY 2 DESC

etc...

The sql statements are (1) incomplete , (2) keywords are concatenated and there are way too many rows. Both inner loop and outer loop do a full select.
...some work...
Final solution:
set serveroutput on size 999999
clear screen
declare
v_rule_id number(10);
v_parameter_id number(10);
v_parameter_value varchar2(100);
v_source_table varchar2(100);
v_lookup_table varchar2(100);
v_source_column varchar2(100);
v_lookup_column varchar2(100);
v_date varchar2(100);
v_query varchar2(1000);

BEGIN
FOR RL IN (SELECT RULE_ID FROM RULE)
LOOP
FOR PRM IN (SELECT PARAMETER_ID,PARAMETER_VALUE FROM RULE WHERE rule_id = rl.rule_id)
LOOP
IF PRM.PARAMETER_ID = 1 THEN
v_source_table:= PRM.PARAMETER_VALUE;
ELSIF PRM.PARAMETER_ID = 2 THEN
V_lookup_table := PRM.PARAMETER_VALUE;
ELSIF PRM.PARAMETER_ID = 3 THEN
V_source_column := PRM.PARAMETER_VALUE;
ELSIF PRM.PARAMETER_ID = 4 THEN
V_lookup_column := PRM.PARAMETER_VALUE;
ELSIF PRM.PARAMETER_ID = 5 THEN
V_date := PRM.PARAMETER_VALUE;
END IF;
END LOOP;
v_query := 'SELECT * FROM (SELECT DISTINCT A.' || v_source_column || ', count(*) as count from '|| v_source_table || ' A LEFT JOIN ' || V_lookup_table || ' ON A.'||V_source_column ||' = B.'|| V_lookup_column || ' WHERE B.'||V_lookup_table||' IS NULL GROUP BY A.'||V_source_column  ||' ORDER BY 2 DESC' ;
dbms_output.put_line(v_query);
--EXECUTE IMMEDIATE v_query; --uncomment if all tables exist.
END LOOP;
END;
/

SELECT * FROM (SELECT DISTINCT A.X, count(*) as count from A A LEFT JOIN B ON A.X = B.Y WHERE B.B IS NULL GROUP BY A.X ORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A.X, count(*) as count from A A LEFT JOIN B ON A.X = B.Y WHERE B.B IS NULL GROUP BY A.X ORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A.X, count(*) as count from A A LEFT JOIN B ON A.X = B.Y WHERE B.B IS NULL GROUP BY A.X ORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A.X, count(*) as count from A A LEFT JOIN B ON A.X = B.Y WHERE B.B IS NULL GROUP BY A.X ORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A.X, count(*) as count from A A LEFT JOIN B ON A.X = B.Y WHERE B.B IS NULL GROUP BY A.X ORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A.Z, count(*) as count from C A LEFT JOIN D ON A.Z = B.Q WHERE B.D IS NULL GROUP BY A.Z ORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A.Z, count(*) as count from C A LEFT JOIN D ON A.Z = B.Q WHERE B.D IS NULL GROUP BY A.Z ORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A.Z, count(*) as count from C A LEFT JOIN D ON A.Z = B.Q WHERE B.D IS NULL GROUP BY A.Z ORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A.Z, count(*) as count from C A LEFT JOIN D ON A.Z = B.Q WHERE B.D IS NULL GROUP BY A.Z ORDER BY 2 DESC
SELECT * FROM (SELECT DISTINCT A.Z, count(*) as count from C A LEFT JOIN D ON A.Z = B.Q WHERE B.D IS NULL GROUP BY A.Z ORDER BY 2 DESC

This will execute successfully if all tables in each select statement actually exist in the database.

A: What if you could get your queries without PL/SQL - just plain SQL?
Lets say that your two tables look like below:
CREATE TABLE
  A_TBL_1 (ID, TXT, SOME_COL, COL_1_T1, DATE_T1) AS
      (
          SELECT 1,   'TEXT for ID 1', 'Something else 1 in tbl_1', 'X',  To_Date('20221231', 'yyyymmdd') From Dual Union All
          SELECT 2,   'TEXT for ID 2', 'Something else 2 in tbl_1', 'Y',  To_Date('20221231', 'yyyymmdd') From Dual Union All
          SELECT 3,   'TEXT for ID 3', 'Something else 3 in tbl_1', 'Z',  To_Date('20221231', 'yyyymmdd') From Dual
      );
CREATE TABLE
  A_TBL_2 (ID, TXT, SOME_COL, COL_1_T2) AS
      (
          SELECT 11,   'TEXT for ID 11', 'Something else 11 in tbl_2', 'X' From Dual Union All
          SELECT 12,   'TEXT for ID 12', 'Something else 12 in tbl_2', 'Y' From Dual Union All
          SELECT 13,   'TEXT for ID 13', 'Something else 13 in tbl_2', 'X' From Dual
      );

... and that your rules are set up like here
CREATE TABLE
    A_RULE_TBL (RULE_ID, PAR_ID, PAR_EXPL, PAR_VAL) AS
      (
        SELECT 1, 1, 'A_TBL_1',     'a'     FROM DUAL UNION ALL
        SELECT 1, 2, 'A_TBL2',      'b'     FROM DUAL UNION ALL
        SELECT 1, 3, 'COL_1_T1',    'X'     FROM DUAL UNION ALL
        SELECT 1, 4, 'COL_1_T2',    'X'     FROM DUAL UNION ALL
        SELECT 1, 5, 'DATE_T1',     '20221231' FROM DUAL UNION ALL
        SELECT 2, 1, 'A_TBL_1',     'a'     FROM DUAL UNION ALL
        SELECT 2, 2, 'A_TBL_2',     'b'     FROM DUAL UNION ALL
        SELECT 2, 3, 'COL_1_T1',    'Y'     FROM DUAL UNION ALL
        SELECT 2, 4, 'COL_1_T2',    'Y'     FROM DUAL UNION ALL
        SELECT 2, 5, 'DATE_T1',      '20221231' FROM DUAL
      );

If we Pivot And Unpivot the rules using a CTE (named params)_
WITH
    params AS
        (   Select    *
            From      A_RULE_TBL
            PIVOT (
                    Max(CASE WHEN PAR_ID = 1 THEN PAR_EXPL END) "SRC_TBL",
                    Max(CASE WHEN PAR_ID = 2 THEN PAR_EXPL END) "LKP_TBL",
                    Max(CASE WHEN PAR_ID = 3 THEN PAR_EXPL END) "SRC_COL",
                    Max(CASE WHEN PAR_ID = 4 THEN PAR_EXPL END) "LKP_COL",
                    Max(CASE WHEN PAR_ID = 5 THEN PAR_EXPL END) "DATE",
                    --
                    Max(CASE WHEN PAR_ID = 1 THEN PAR_VAL END) "SRC_TBL_VAL",
                    Max(CASE WHEN PAR_ID = 2 THEN PAR_VAL END) "LKP_TBL_VAL",
                    Max(CASE WHEN PAR_ID = 3 THEN PAR_VAL END) "SRC_COL_VAL",
                    Max(CASE WHEN PAR_ID = 4 THEN PAR_VAL END) "LKP_COL_VAL",
                    Max(CASE WHEN PAR_ID = 5 THEN PAR_VAL END) "DATE_VAL"
                    FOR RULE_ID IN(1 "ID1", 2 "ID2")    )

            UNPIVOT(  (SRC_TBL, SRC_COL, LKP_TBL, LKP_COL, A_DATE, SRC_TBL_VAL, SRC_COL_VAL, LKP_TBL_VAL, LKP_COL_VAL, DATE_VAL)
                        FOR RULE_ID
                        IN  (
                            (ID1_SRC_TBL, ID1_SRC_COL, ID1_LKP_TBL, ID1_LKP_COL, ID1_DATE, ID1_SRC_TBL_VAL, ID1_SRC_COL_VAL, ID1_LKP_TBL_VAL, ID1_LKP_COL_VAL, ID1_DATE_VAL ) as 1,
                            (ID2_SRC_TBL, ID2_SRC_COL, ID2_LKP_TBL, ID2_LKP_COL, ID2_DATE, ID2_SRC_TBL_VAL, ID2_SRC_COL_VAL, ID2_LKP_TBL_VAL, ID2_LKP_COL_VAL, ID2_DATE_VAL ) as 2   )
                  )
            ORDER BY RULE_ID
      )
--
--  R e s u l t
--     RULE_ID SRC_TBL  SRC_COL  LKP_TBL  LKP_COL  A_DATE   SRC_TBL_VAL SRC_COL_VAL LKP_TBL_VAL LKP_COL_VAL DATE_VAL
--  ---------- -------- -------- -------- -------- -------- ----------- ----------- ----------- ----------- --------
--           1 A_TBL_1  COL_1_T1 A_TBL_2  COL_1_T2 DATE_T1  a           X           b           X           20221231
--           2 A_TBL_1  COL_1_T1 A_TBL_2  COL_1_T2 DATE_T1  a           Y           b           Y           20221231

Resulting dataset has everything you need to construct different sql commands. Here for RULE_ID = 1 there will be SQL for left joining tables and selecting rows that doesn't match. For RULE_ID = 2 rows that does match.
SELECT
    'Select ' || SRC_TBL_VAL || '.' || SRC_COL || ', Count(*) "CNT" ' || Chr(10) ||
    'From ' || SRC_TBL || ' ' || SRC_TBL_VAL || ' ' ||  Chr(10) ||
    'Left Join ' || LKP_TBL || ' ' || LKP_TBL_VAL || ' ON(' || LKP_TBL_VAL || '.' || LKP_COL || ' = ' || SRC_TBL_VAL || '.' || SRC_COL || ')' ||  Chr(10) ||
    'Where ' || LKP_TBL_VAL || '.' || LKP_COL || ' Is ' || CASE RULE_ID WHEN 2 THEN 'Not' ELSE '' END   || ' Null ' ||  Chr(10) ||
    'Group By ' || SRC_TBL_VAL  || '.' || SRC_COL || ' ' ||  Chr(10) ||
    'Order By Count(*) DESC' "SQL_COMMANDS"
FROM      params
ORDER BY  RULE_ID
/*  R e s u l t :
SQL_COMMANDS
--------------------------------------------------
Select a.COL_1_T1, Count(*) "CNT"
From A_TBL_1 a
Left Join A_TBL_2 b ON(b.COL_1_T2 = a.COL_1_T1)
Where b.COL_1_T2 Is  Null
Group By a.COL_1_T1
Order By Count(*) DESC

Select a.COL_1_T1, Count(*) "CNT"
From A_TBL_1 a
Left Join A_TBL_2 b ON(b.COL_1_T2 = a.COL_1_T1)
Where b.COL_1_T2 Is Not Null
Group By a.COL_1_T1
Order By Count(*) DESC
*/

The first query, if run against above sample data, results as:
--  COL_1_T1        CNT
--  -------- ----------
--  Z                 1

... while second results as:
--  COL_1_T1        CNT
--  -------- ----------
--  X                 2
--  Y                 1

You can select some or all of other columns and you can construct the sql commands with different joins and where conditions, groupings, orderings etc...


text:
Q: How to call a method in a .NET Core assembly from .NET Framework I have two assemblies:

*

*The parent assembly is compiled against .NET Framework.

*The child assembly is compiled against .NET Core.

I want to call a method in the child assembly, and retrieve its return object.  The constructor doesn't take any parameters. The method does not take any parameters, and returns a Microsoft.OData.Edm.IEdmModel
Things I've tried so far:

*

*Creating a separate appdomain, and calling domain.CreateInstanceAndUnwrap:

AppDomainSetup setup = new AppDomainSetup()
{
   ApplicationBase = path
   PrivateBinPath = path
};
AppDomain domain = AppDomain.CreateDomain("Child", null, setup);
AssemblyName assemblyName = AssemblyName.GetAssemblyName(assemblyPath);
object instance = domain.CreateInstanceAndUnwrap(assemblyName.FullName, className);

*Creating a class that extends MarshalByRefObject, and using that to load the assembly, call the function, and marshal the return type:

AppDomain domain = AppDomain.CreateDomain("Child");
BinaryMarshal marshal = (BinaryMarshal) domain.CreateInstanceAndUnwrap(typeof(BinaryMarshal).Assembly.FullName, typeof(BinaryMarshal).FullName);
IEdmModel model = marshal.LoadEdmModel(path, className, functionName);

//BinaryMarshal.cs:
internal class BinaryMarshal : MarshalByRefObject
{
    public IEdmModel LoadEdmModel(string binary, string className, string functionName)
    {
        Assembly assembly = Assembly.LoadFrom(binary);
        Type type = assembly.GetType(className);  //returns null because of exception listed below
     }
}

In both cases, the code doesn't work because of the following exception (obtained from Fuslogvw.exe):
*** Assembly Binder Log Entry  (4/29/2019 @ 10:34:48 AM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  C:\develop\parent\out\debug-amd64\Parent.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: DisplayName = System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///C:/develop/parent/out/debug-amd64/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = Parent.exe
Calling assembly : Child, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\develop\parent\out\debug-amd64\Parent.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/develop/parent/out/debug-amd64//System.Runtime.DLL.
LOG: Attempting download of new URL file:///C:/develop/parent/out/debug-amd64//System.Runtime/System.Runtime.DLL.
LOG: Attempting download of new URL file:///C:/develop/parent/out/debug-amd64//System.Runtime.EXE.
LOG: Attempting download of new URL file:///C:/develop/parent/out/debug-amd64//System.Runtime/System.Runtime.EXE.
LOG: Attempting download of new URL file:///C:/develop/child/out/debug-amd64/netcoreapp2.0/System.Runtime.DLL.
LOG: Attempting download of new URL file:///C:/develop/child/out/debug-amd64/netcoreapp2.0/System.Runtime/System.Runtime.DLL.
LOG: Attempting download of new URL file:///C:/develop/child/out/debug-amd64/netcoreapp2.0/System.Runtime.EXE.
LOG: Attempting download of new URL file:///C:/develop/child/out/debug-amd64/netcoreapp2.0/System.Runtime/System.Runtime.EXE.
LOG: All probing URLs attempted and failed.

From what I can tell, it's trying to load System.Runtime, which fails because parent app already has a different version of System.Runtime loaded.
Is this even possible?

A: .NET Core and .NET Framework are different runtimes. Try to use .NET Standard for common library and you will be able to use it from both .NET Core and .NET Framework.

A: The answer is simple: you can't call directly the .NET Core assembly from .NET Framework and vice versa. The .NET Core is not compatible with .NET Framework.
You can call the compatible assembly of .NET Core from .NET Framework assembly, as long as the assembly is targeted to use .NET Standard, preferably at least NET Standard 2.0 to provide compatibility with .NET Core 2.1 and 2.2 runtime.
See also the official doc of .NET Standard: https://learn.microsoft.com/en-us/dotnet/standard/net-standard


text:
Q: "Due to lack of common sense" vs. "For lack of common sense"

*

*Due to lack of common sense, he cannot succeed in life.

*For lack of common sense, he cannot succeed in life.

How do both differ from each other? I believe I can use both of them in this sentence. Suggestions please.

A: As @Khan says, yes they are both used in this sense as synonyms of because of and both sentences work.
In common speech, Because of would more likely be used. Due to would be appropriate for formal speech, while For is slightly more poetic.
But they certainly all mean exactly the same thing.


text:
Q: Find the Workflow Status page for a running workflows I am trying to clean up a workflow prior to removing it from my site collection.

*

*The workflow was written by a user who didn't use good practices on Stages, so the "workflow status" column just displays "Running" as the hyperlink to the status page, regardless of whether the workflow is completed or not.

*According to the Workflow Status page, I have 3 instances of the workflow still running The workflow writes a piece of important information to it's status history log, but is not set to write those same lines to the history list.

*I need to record that information before terminating the workflows and pulling it from the site.

so here's my question: Is there a way to find the instance IDs for those running workflows? Is there some way to do it besides clicking the workflow status link on every single item in the library, and checking all of the status pages to find the 3 I care about? Is there some way to display the "Internal Status" workflow field as a metadata column?
Thanks!

A: There was a very similar article written here that you can get this information using PowerShell.
How to get running workflow instances on listitems in powershell?
# Main
###########################
cls
$spSite = Get-SPSite  "https://portal.myCompany.net/teams/siterequests/" # SiteCollection
$spWeb = $spSite.OpenWeb()
for($i = 0; $i -le $spWeb.Lists.Count;$i++)
{
    foreach ($item in $spWeb.Lists[$i].Items)
    {
        $runningWorkflows = $item.Workflows | Where-Object {($_.InternalState -eq "Running")}
        foreach ($workflow in $runningWorkflows)
        {
            ###Do Stuff###
        }
    }
}


text:
Q: With CoreData is it OK to have multiple contexts on the same thread? With CoreData, is it OK to have multiple contexts on the same thread?  At work we are debating whether having multiple contexts on the main thread can cause deadlock.  I can't find any reason not to do it, but I am concerned that when one of the main thread contexts saves and merges into the other main thread context it may cause deadlock.
Note there appears to be a related ticket that is actually NOT related at all: Multiple contexts in the main thread: why and when use them?  This ticket ONLY discusses using multiple contexts in general, and what a context is, and does not actually ever discuss any issues with using multiple contexts on the same thread.

A: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreData/Articles/cdConcurrency.html
and look here too
http://www.cocoanetics.com/2012/07/multi-context-coredata/
If you choose not to use the thread containment pattern—that is, if you try to pass managed objects or contexts between threads, and so on—you must be extremely careful about locking, and as a consequence you are likely to negate any benefit you may otherwise derive from multi-threading. You also need to consider that:
Any time you manipulate or access managed objects, you use the associated managed object context.
Core Data does not present a situation where reads are "safe" but changes are "dangerous"—every operation is "dangerous" because every operation has cache coherency effects and can trigger faulting.
Managed objects themselves are not thread safe.
If you want to work with a managed object across different threads, you must lock its context.