Is RVM production ready?

Question: RVM is great for developing on your local machine. But is it safe on a production machine?
Comment: If you haven't faced any bugs on your dev machine, I would assume its safe. [RVM is used for deployments too](http://beginrescueend.com/deployment/best-practices/).
Comment: RVM is plenty solid. A better question is, will it do what you want? Perhaps if you describe your goals we could make more useful suggestions. As is this is kind of nebulous.
Comment: For those reading the responses: RVM in mid 2012 is a markedly different beast from RVM in mid 2011. I'm eating my words below and have started using RVM in our staging environment, with a view to moving it to our production environment.
Comment: The comment by the Tin Man is most excellent. The original question is to general to be answerable.
Answer: I built RVM for production and added the developer 'niceties' later on.
If you would like more information read the documentation on the website and come talk to me in #rvm on irc.freenode.net sometime during the day EDT most days.
Comment: I'm curious, why would you consider it production ready when it overrides so many shell built-ins like 'cd'? If it were designed for production wouldn't you have confined rvm to your own wrapper or bash-like shell vs tainting the one that everybody/everything else depends on? You've effectively added ruby, tcl, etc into the mix of anything else that might have a !#/bin/bash at the top of it. Before RVM, all that was required was a functional libc6 install, just like the kernel. Every package policy I know of specifically prohibit what RVM is doing mostly in the name of production.
Comment: I'd have to agree here; rvm uses deeply ugly and unnecessary hooks into the shell when virtualenv solved the problem years before. Meanwhile, they break every few months and are prohibitive to debug. I recommend if you do use rvm, do not use any of the hooks it attempts to add without your consent.
Answer: Since RVM is just a fancy way of downloading, isolating and switching between existing Ruby implementations, I'd say that it's as production ready as whatever ruby implementation you're currently running it with.
Essentially, all RVM does is point your path at a specific Ruby implementation. This is exactly what happens when you use your *nix distribution's Ruby implementation. The only real difference is that your path will be re-written so that when you run ruby -v it will run a ruby from your current user's .rvm directory instead of a global system directory like /usr/local/bin.
I'd go even further and say that using RVM is a better solution than using what generally gets installed in a *nix distro because it makes it easy to sandbox the specific ruby implementation on a per-user basis. RVM also makes it possible to attempt switching rubies (ie; from 1.8.7 to 1.9.2) on your production app while keeping a solid rollback strategy in place if something doesn't work quite right. It also makes it easier to keep old applications running on one version of Ruby, while switching new apps to more current versions.
Comment: Well thought out post, you summarized exactly what RVM does/is when used on production correctly. Environment files are the key to consistency there.
Comment: Thanks Wayne, it's good to know that I "get it". RVM is perhaps one of the most useful development tools I've ever used. I'm currently building an app that runs on JRuby, so RVM makes it easy to run my app on MRI in development (because MRI runs my tests much faster) and then switch to JRuby to test it out before I deploy. Kudos!
Answer: I disagree, especially if you're using any kind of automated production process (puppet, chef, fog, etc) and you have more than one or two machines.
We've had issues where version X of RVM worked in a completely different way to version Y of RVM (different default Rubygems versions, different default gemset configs, complete changeup of how system wide install works), breaking our automated provisioning process.
Not an issue if you're developing and on hand to tune things, a killer if you have an unattended scripted / puppet install. We worked around these issues by locking to a particular RVM version, but I remember having a conversation with Wayne where he discouraged this. If we kept using RVM in prod, we were going to actually package it into a series of .debs (one for the install, one for each Ruby).
The way that .rvmrc prompts by default and can only be overriden in the homedir ~/.rvmrc (and not the system-wide one) was also unhelpful.
I actually like the way that RVM will change up and do things this way in development - nothing sucks more than being held back by backward compatibility.  This approach, however, cost us some time (and pulled hairs) in production/staging/uat/test.
Comment: For those reading this in 2012, things have changed and I'm now seriously considering RVM's use in production. From what I can tell, the releng has improved considerably.
Comment: .. but committing .rvmrc to your repo is still verboten.
Answer: RVM is apparently a reasonable production tool
You know, I once made a similar rvm is a development tool comment and was informed that rvm was originally a production tool.
So, RVM will make your production environment more complex, which is bad, but it makes it more isolated and compartmentalized, what the language people would call modular, and that's good.
In the end, as long as you test your deployments, I don't see how a static configuration of any kind could be, all by itself, "unsafe".
Comment: I propose that it makes production environment *simpler* due to containment and specification :)
Comment: Heh, Wayne is the rvm author.  I can certainly believe that rvm simplifies the case where multiple environments are required.
Answer: It all depends on how you are installing RVM , single-user or multi-user . installing RVM system wide can cause lots of mess whole switching between different rubies. Better you opt for single user , minus that RVM does a good job for what it's meant to do .
Answer: I guess there's two parts to this question:

Is RVM intended to be for production machines, as opposed to development machines?
Is RVM reliable enough software to be used on production machines?

For (1), Wayne E. Seguin has stated that it's intended to be used on production machines. There's no point in disputing his intent.
For (2), I'm not so sure. Is it appropriate to use software that has a new version number every couple of days on a production machine? Also, RVM once deleted my entire ~/ruby directory. To Wayne's credit, when I told him about it, he fixed it that night, but that doesn't exactly say "production ready" to me.
Edit: I've just read about bumblebee's deletion of /usr, and I'll just say - it could have been worse! LOL.
Comment: @Wayne: Last December was still post 1.0.
Comment: And how long ago was that? The project moves quickly and other than the installer recently things have no longer been changing much.
Additionally, what does having new version numbers frequently have to do with *anything*? Most of the time these are new features disjoint from what is already there.
Comment: If used CORRECTLY in 'production' there should be no issue.
Comment: Things have come a LONG way since then :)
Answer: I've been using RVM on a production webserver for over a year now with zero problems.  I've kept it pretty up-to-date, running rvm get head frequently.  Zero issues, ever. :)
Comment: @Wayne: That kind of humor by itself makes it unsuitable for production! (I'm joking about it being a reason against using it, even though I roll my eyes every time I come across it).
Comment: There's much less of this "getting head" humor now than there used to be.
Comment: If it's supposed to be suitable for production, should you be constantly running `rvm get head`?
Answer: Yes, I've used rvm on production machines and also set up puppet modules to install rvm as the default system ruby along with gemsets, etc.
If you run multiple apps on a single server, rvm can help you keep all your apps gemsets (and ruby versions) totally separate. However, if you are running only a single app on a server, there may not be as much benefit to having rvm installed.
Comment: I disagree with the second part as that is the normal use case for most of the people I have worked with :)
Comment: RVM brings a little less awesome to a server running a single app than it does to a server running multiple apps. But in either case its awesomeness cannot be denied. :)
Answer: I've pretty much used RVM on all my production servers running rails apps!. RVM has not let me down.

Is RVM production ready?


Creating an archive page or simple template to list all values of a custom field of specific post type listing

Question: I have a custom post type named 'lawyer' and it contains various custom fields. two of the custom fields are 'state' and 'city'. i want to create a archive page or simple page(anyone will do) which can list all the values of city for specific state. for example i have 10 listings. 5 of which have custom field 'state' value as "albama" now i want list of the values 'city' of all those five listings which has state as "albama" but i also want that reduntant city doesnt not showup. i.e. if 3 of cities are "florence" then they only showup once.
Answer: The first thing I would do, if I were you, would be to change the data structure so that the location would a hierarchical custom taxonomy where states were parent terms and cities their child terms.
Then you could create a custom taxonomy template for your location taxonomy. In this template you'd display list of child terms when the queried object is a parent term.

EDIT 3.9.2019
Here is a very basic example how to get the child terms in archive-{post_type}.php template
// WP_Term object
$current_term = get_queried_object();
// maybe array of WP_Term objects
$children = get_terms( array(
  'taxonomy' => $current_term->taxonomy,
  'parent'   => $current_term->term_id
) );
// If any child terms exists
if ( $children && ! is_wp_error( $children ) ) : ?>

    <?php foreach ( $children as $child_term ) : ?>

<?php echo esc_html( $child_term->name ); ?>

    <?php endforeach; ?>

<?php endif;

A good place to learn more about custom post types is the Plugin Handbook, https://developer.wordpress.org/plugins/post-types/working-with-custom-post-types/
And if you're not very familiar with PHP yet, have a look at the PHP documentation Getting Started guide, https://www.php.net/manual/en/getting-started.php, or use your preferred search engine to find tutorials and beginner level courses.
Comment: hey thanks for reply but can you send code forr template as i dont have much experience with php
Comment: @ChinmayRamraika, I added a simple example to my answer, which you can use as a starting point for learning. And if you need help with customizing your site, please consider hiring a professional developer.


An efficient way of removing objects from an indexedDB object store that are missing a property

Question: I am thinking about how to make a certain operation in a project of mine more efficient. The operation in its current implementation loads all objects from an object store, iterates through the array and testing whether an object is missing a property or if the property is undefined, collecting the set of such objects in a second array, and then removing all of these objects.
I am already using getAll for its obvious performance benefit over cursor iteration.
I am concurrently calling individual delete requests, so there is no speed up there but for the the indexedDB api evolving to support batch deletes on non-indexed non-keypath props that are missing values.
The issue is that I have no way of checking against the property when the property is not in the keypath of the object store without fully loading each object into memory. The objects are rather large in some cases. Sometimes one of the properties of each object is extremely large (essentially a string of an html document).
I cannot use an index, because properties not present in objects, or that do not have a value, do not appear in an index.
Is there a way to avoid loading such objects into memory?
I have thought about partitioning, and using two object stores, one for queryable props and one for full data. But then this devolves into having to do extra requests every read. My app does a lot more reading then this occasional batch delete operation.
I have thought about storing an extra property per object that always has a value like myObject.doesOtherPropertyHaveValue that contains 0/1 and therefore is indexable, but this doesn't seem great either. Sure I could query by just this index and use getAllKeys and that solves the problem. However, now every add/put has to maintain this functional dependency.
Any advice is appreciated.
Answer: If the records have the form {key, prop} where prop is the one that may not be present, you can create an index on [key, prop]. This will only have index records when prop is present. Then open two key-only cursors: one on the store (C1) and one on the index (C2). Check to see if the C1.primaryKey equals C2.primaryKey[0]. If so, the prop is present, advance both. If the keys are not equal then C1 points at a record that doesn't have the prop; delete it and advance C1. Repeat. (Watch out for edge cases when you hit the end of the range.)
Two problems with this: (1) you're still using cursors, so still paying the cost of round trips (unlike getAll()), and (2) if prop is large (i.e. the body of an HTML document as you mention) then even just using key cursors you're still shuffling the large amount of data around.
(In the future we'd like to tackle this by adding either a more general query mechanism or custom indexing possibly combined with delete-on-index - either of which would make this much easier and more efficient)

...collecting the set of such objects in a second array, and then removing all of these objects...

If you stick with this approach, remember that you can issue delete() calls as you find them; no need to collect all the objects, and you don't need to wait for the deletes to finish; you can use IDB in a "fire and forget" fashion for write operations.
Comment: Thanks Josh. I would like the delete on index stuff, because I essentially want `DELETE FROM objectStore WHERE prop not in obj or obj.prop = null or obj.prop = undefined;` where data is not even loaded into js. The one issue I have with the fire and forget aspect is that I very much prefer the syntax `await Promise.all(deleteRequestPromises);` over `Promise.all(deletes).catch()`. Of course, I wouldn't need this if I had delete on index, but I just wanted to add that point regarding the way it currently works.
Answer: You're on the right path that denormalization may be necessary to improve performance. From the indexedDB docs, there's no way to query the way you need to unfortunately.
If the true bottleneck is I/O or marshalling data into JS-land, then maybe try compressing the data before writing and uncompressing when you actually need to do something with it? GZIP can compress text very well, sometimes up to 70% less. There are a few GZIP libraries for JS that could work:
https://github.com/nodeca/pako
But, as always, benchmark!


Are there any Earth-Meteorites on Earth?

Question: A follow-on from this question, if meteorites can come from Mars, it seems they could have come from Earth and ended up back here (though I'm guessing that to be less likely). Do we have any evidence of this having happened? Would there be a way of verifying that they left and came back, other than direct observation of them falling from space?
Comment: One hypothetical way this could happen might be for the meteorite to slingshot around the sun (think Apollo 13 slingshotting around the moon) to get heading back in the right direction.  Does anyone know if this could happen?
Answer: This somewhat depends on your definition.
It is reasonably likely that a huge impact on Earth could knock rocks into a loose orbit around us, or at least around the sun but coming close to us. It seems likely that some of these would eventually fall back to the Earth, being Earth-origin meteorites.
The second possibility, that they landed on another world and made their way back, is extremely unlikely. Earth has a very large gravity well, and it is thus much harder to escape than Mars. We are relatively certain that there are significant amounts of Earth on the moon and Mars, in the amount of approximately 2kg/square km (See this Science@NASA article). That's not very much at all. As we've only had a very few confirmed Mars rocks found on Earth, or even Moon Rocks, it's even less likely.
The last thing to consider is how would we know that such rocks came from the Earth? Here's some common methods of identifying meteorites, in the context of this discovery.

Meteorites tend to have more Iron than most Earth material, and thus tend to be magnetic. This wouldn't work for an earth based rock, as it came from Earth.
Meteorites show signs of very high temperatures and pressures from their reentry into Earth. This is a possible way to identify meteorites, but it could easily be either volcanic in nature, or else produced from cosmic collisions, ie, Earth  knocked loose by an impact from a small asteroid would have similar effects.
If a rock is found on top of a glacier, it could not have formed there. It could have come from volcanic activity, been moved there, or it could be a meteorite. This is how an Earth meteorite would have to be found, but it would be difficult to tell among the other possibilities. (See the Antarctic Meteorite Program)
Spectral analysis is used to look at the ratios of isotopes, to identify the location from which a rock came from. The answer for such a rock would be Earth, but it would be difficult to tell from other rocks.

So, if you are walking in Antarctica, and see a rock on a huge glacier that shows signs of reentry, and has the spectral analysis of Earth, it might be an Earth based meteorite. As far as I know, no one has identified a rock as such, but it very well could happen.
Answer: There are a class of small objects known as tektites
http://en.wikipedia.org/wiki/Tektites
which are thought to be melted rock that was thrown up by impact events. These objects are thought to have been liquid rock in suborbital trajectories that fell back to earth. Unless you want the term meteorite to imply that the object must have once been not gravitaionally bound to the earth, these should qualify for your O.P.
Answer: There is only a relative handful of meteorites on Earth known to come from Mars. The odds of any chunk of rock making two trips and being discovered/recovered by humans are incredibly long.
If that somehow did happen nevertheless, it would be pretty unambiguous to verify. Earth rocks have distinctive chemical and geological (and even more distinctive biological) characteristics, and so finding an Earth rock on Earth with evidence of Martian dust, reentry and impact on/in it would be conclusive.


Visualization of matrix transformations

Question: I define the "matrix transformation" here as follows:
$\left[ \begin{matrix}
 x_1' \\
 x_2' \\
        \end{matrix}  \right]=\left[ \begin{matrix}
  a & b \\
  c & d \\
 \end{matrix} \right]\left[ \begin{matrix} x_1\\ x_2\\ \end{matrix} \right]$, therefore this is a transformation between point and point. it moves $(x_1,x_2)$ to $(x_1',x_2')$ So is there any way to visualize it when you're trying to deform a grid by this?
Comment: another way to visualise/characterise linear transformations is to see how they transform the unit circle. The answers to [this question](https://mathematica.stackexchange.com/q/185644/27539) provide code to do just that
Answer: One classic way to depict the effect of a plane linear transformation is to see what it does to a stylized drawing of a cat's face.
First, a utility to transform points and a function to reflect across the vertical axis:
pointQ[p_] := VectorQ[p, NumberQ] && Length[p] == 2
image[T_, object_] := object /. pt_?pointQ :> T[pt]

reflect[p_] := {-p[[1]], p[[2]]}

Next, design the original cat's face (this cat winks its left eye so as to destroy left-right symmetry of its face):
facexy[j_] := 0.75 { Cos[2 \[Pi] j/60], 0.88 Sin[2 \[Pi] j/60]}
outline = Line[Transpose@facexy@Range[0, 60]];
mouth = Line[{{0, -0.25}, {-0.153, -0.44}, {0.153, -0.44}, {0, -0.25}}];
rightEar = Line[{facexy[6], {0.657, 1.0}, facexy[12]}];
leftEar = reflect~image~ rightEar;
ears = {rightEar, leftEar};
rightEye =
   Line[{{0.123, 0.25-0.125}, {0.464, 0.205}, {0.464, 0.045}, {0.123, 0.25-0.125}}];
leftEye = reflect~image~(Polygon @@ rightEye);
eyes = {rightEye, leftEye};
spray[source_, targets_] :=
   MapThread[Line, Outer[List, {source}, targets, 1], 1]
rightWhiskers =
   spray[{0.125, -0.2}, {{0.88, 0.07}, {0.932, -0.151}, {0.88, -0.34}}];
leftWhiskers = reflect~image~rightWhiskers;
whiskers = Join[rightWhiskers, leftWhiskers];
urCat = Join[{outline, mouth}, ears, eyes, whiskers];

Next, a couple more graphics utilities:
makeFigure[objects_, low_: - 1, high_: 1] :=
   Graphics[objects, PlotRange -> {{low, high}, {low, high}},
  AspectRatio -> Automatic, Axes -> True, ImageSize -> Scaled[0.3]]

makeFigureAndImage[objects_, T_, low_ : -1, high_ : 1] :=
  Row[{makeFigure[objects, low, high], Spacer[10],
      makeFigure[image[T, objects], low, high]}]

Finally, a sample linear transformation and the picture of how it distorts the cat's face:
T[p_] := {{0.8, 0.35}, {-0.75, 1.5}}.p
makeFigureAndImage[urCat, T, -2, 2]

The code above "gets back to basics" in that the transformation operates directly upon points and in effect transforms a line segment of a graphical object by forming the corresponding line segment joining the images of the endpoints.
The can be simplified by using the built-in function GeometricTransformation. In particular, the outline of the cat's face can then be prescribed as an ellipse, and the second argument to GeometricTransformation allows direct use of the matrix, without any need to define the linear transformation T. Thus:
newOutline = Circle[{0, 0}, {0.88, 0.75}];
newUrCat = Join[{outline, mouth}, ears, eyes, whiskers];
newMakeFigureAndImage[objects_, mat_, low_ : -1, high_ : 1] :=
  Row[{makeFigure[objects, low, high], Spacer[10],
       makeFigure[GeometricTransformation[objects, mat], low, high]}]
newMakeFigureAndImage[newUrCat, {{0.8, 0.35}, {-0.75, 1.5}}, -2, 2]

The output will appear identical to that above.
If you want to animate the transformation, showing over time how the cat's face changes from its original shape to the distorted shape, create a table of snapshots and export it, like this:
With[{mat = {{0.8, 0.35}, {-0.75, 1.5}}},
   twistingCat =
      Table[Row[{makeFigure[newUrCat, -2, 2], Spacer[10],
                 makeFigure[
                    GeometricTransformation[
                       newUrCat, (1 - t) IdentityMatrix[2] + t mat], -2, 2]}],
          {t, 0, 1, 0.05}]
];

ListAnimate[twistingCat]

In order to show the effect in this post, I created the list of "frames" for the animation above (which you would directly see inside Mathematica by evaluating the ListAnimate expression; by exporting that as a .gif, then placing that .gif here, you see the animation.
Export["TwistingCat.gif", twistingCat]

With similar techniques you may use one or more parameters in the transformation matrix and dynamically show the effect of varying them.
Note that ordinarily to display a dynamically changing graphic in a Mathematica notebook, I would use `Manipulate, as in:
With[{mat = {{0.8, 0.35}, {-0.75, 1.5}}},
   Manipulate[
      Row[{makeFigure[newUrCat, -2, 2], Spacer[10],
           makeFigure[
              GeometricTransformation[newUrCat, (1 - t) IdentityMatrix[2] + t mat], -2, 2]}],
   {t, 0, 1, 0.05}]
]

Comment: Very nice. But aren't there laws against doing that sort of thing to a cat?
Comment: Thanks. And what about some animations? In other words, what if I vary the parameters in my matrix and I want to see how the deformed picture vary with them?
Comment: @pxc3110: See the added material at the end showing animation.
Comment: @DanielLichtblau: Perhaps. But I follow the lead of a classic book on differential equations & dynamical systems (was it by Arnold & Aziz) that used a cat's face to illustrate the "baker's transformation".
Answer: Here's a Manipulate that applies any affine transformation to an image. The 2-by-2 matrix transformation is in the upper 2-by-2 block of the affine function and the {b1,b2} parameters shift the image left-right and up-down.
img = Import["https://i.stack.imgur.com/pp27n.png"];
Manipulate[
 GraphicsRow[{AffineTransform[{{{a11, a12}, {a21, a22}}, {b1, b2}}],
   ImageTransformation[img,
    AffineTransform[{{{a11, a12}, {a21, a22}}, {b1, b2}}]]}, ImageSize -> {600}],
 Row[{Control[{{a11, 1}, -1, 1}], Spacer[20], Control[{{a12, 0.015}, -1, 1}]}],
 Row[{Control[{{a21, 0.595}, -1, 1}], Spacer[20], Control[{{a22, 0.415}, -1, 1}]}],
 Row[{Control[{{b1, 0.225}, -1, 1}], Spacer[20], Control[{{b2, -0.03}, -1, 1}]}]]

Comment: Would be nice to include controls for plot range, so that so much of image wouldn't disappear when the default parameters of the linear transformation part are changed.
Answer: Something like this?
g = FiniteGroupData[{"DihedralGroup", 4}, "CayleyGraph"];
g1 = SetProperty[g, VertexLabels -> "Name"];
l = PropertyValue[{g1, #}, VertexCoordinates] & /@ VertexList[g1];
m = {{2, 1}, {-1, 2}};
Framed@Row[{g1, SetProperty[g1, VertexCoordinates -> (m.# & /@ l)]}]

Comment: @pxc3110 Try `ImagePerspectiveTransformation[ExampleData[{"TestImage", "Lena"}], {{1/2, 1/10}, {1/10, 1/4}}]`
Comment: Thanks for your answer. Actually I want to deform a picture. If I get a picture, and multiply the representation vetor of every point by an invertible 2 by 2 matrix, then I want to see how this picture looks like after this transformation.

Visualization of matrix transformations


What is the difference between VIF and stepwise regression?

Question: What is the difference between the variance inflation factor (VIF) and stepwise regression as both help in detecting multicollinearity? What variables are different while running both techniques?
Answer: VIF and stepwise regression are two different beasts.  Stepwise regression is an exercise in model-building, whereas computing VIF is a diagnostic tool done post-estimation to check for multicollinearity. Therefore, there is no answer to the second part of your question ("What variables are different while running both techniques?"), because VIF is not a model-building technique.
With stepwise regression, you are either adding (forward) or deleting (backward) variables from the model and seeing how estimates change.  Typically, variables are "kicked out" of the model if the p-values do not cross a certain threshold pre-set by the researcher (e.g. if $p>0.10$).
VIF is done when you already have a model to work with. Calculation of VIF is fairly straightforward.  Given the model:

$Y = \beta_0 + \beta_1X_1 + \beta_2X_2 +\beta_3X_3 +\beta_4X_4 +\epsilon$

You can calculate the VIF of each parameter estimate $i$ (e.g. $\hat\beta_1$,$\hat\beta_2$, $...$ ,$\hat\beta_i$) using the formula $VIF_i = 1/(1-R_i^2)$ where $R_i^2$ is the $R^2$ from a model predicting $X_i$ using all other covariates as predictors, e.g.,

$X_1 = \delta_0 + \delta_2X_2 +\delta_3X_3 +\delta_4X_4 +\nu$
Comment: I don't think VIF if necessarily done post-estimation. Do you have a source for this? I see a lot of papers and blog posts where VIF is used to screen highly correlated variables.
Answer: They aren't really that similar.  Stepwise regression is a technique for finding a subset of variables that are useful in predicting a response.  It is a very old and intuitive strategy.  Unfortunately, it is not as good as it seems (see here).  In addition, it is not for detecting multicollinearity.
The variance inflation factor can be used to assess multicollinearity.  Multicollinearity refers to the fact that your predictor variables are correlated.  When just two variables are collinear, it is easy to see.  But collinearity can exist amongst several variables (hence 'multi-'), which is harder to detect.  If you were to run a multiple regression in which one of your X variables were the response and your other X variables were taken as predictors, you would hope to find a multiple $R^2=0$.  That would mean that they are perfectly uncorrelated.  With observational data that is very uncommon, though.  As the $R^2_j$ for each of your variables goes up, the degree of multicollinearity increases.  This will cause your standard errors to be larger than they would otherwise have been (if your X variables had been perfectly uncorrelated).  To find out how much larger the variance of the sampling distribution for the $j^{\rm th}$ variable is, you can check the VIF.  You calculate the VIF as so:
$$
{\rm VIF} = \frac{1}{1-R^2_j}
$$


How to color fill clipping masks on a template?

Question: I am trying to create a sail sign by using the template provided here: https://www.creativebanner.com/Product/Select?Sku=191384&productId=4740&returnUrl=%2FProduct%3FIndex%3D0%26Available%3D14%26Returned%3D8%26Records%3D8%26SortColumn%3Ddefault%26SortAscending%3DFalse%26DisplayControls%3DTrue%26CategoryId%3D1092%26CategoryName%3DMini%2520Sail%2520Sign%2520Flags%2520%2520
When I downloaded the full size template under the Graphic Info tab, I opened it in Illustrator. It is easy enough to place the logo I want on the "Place Art Here" layer, however, I cannot figure out how to color fill the background of the template. There are clipping path layers above the "Place Art Here" layers, but I don't know how to color fill the mask. How can I achieve this? Thank you.
Edit for clarification:
Here is a screenshot. I want to fill the clipping path to color the flag- for example, you can see in the example of the product above, it is colored yellow. However, I cannot select the path to color it
Comment: I'm not understanding your question.  Are you trying to set up a file to actually submit to that website?  If so, they can only print the artwork for the *sign* onto the sign.  They can't print the background of your file onto the background of wherever you will install your sign.  ;)
Comment: I've edited the post to clarify further, including a screen shot. Yes, I'd like to submit a file for printing. I was trying to change the color of the flag, for example, the product example has a yellow background.
Answer: It's a bit difficult without seeing exactly what you would like to do, but have you tried using the white+ arrow to select what you would like to color?
You will find it in the white arrow icon, just hold the button deal to reveal the one with the +. This cursor allows to select individual items in a group without messing with the file setup.
There are lots of ways to do this but this seems like one of the most simple to me. In this case I have a gradient colored square that is clipped by a circle.
Also, do make sure that the printer allows you to change the background color to whatever you would like.
Answer: You can't select the clipping path to color it because the layer is locked.
You can unlock the layer by clicking the lock icon just to the left of the layer in your layers panel list.
However, that's a bad idea as the printing company locked that layer for a reason.  You don't want to accidentally modify that layer or reshape it; then they won't be able to print your order correctly and will have to reject your file.
Instead, you should create a NEW object (on the "place art here" layer) that is the color you want.  Don't worry about it being the right shape.  Just make a gigantic square the color you want, and, if the file is set up the way it should be (I haven't checked) and your object is on the "place art here" layer, it will be automatically clipped by the clipping path layer already present.

A tip I wish I'd known when I started working in Illustrator: pay attention to the "layers" panel.  New objects you draw will go onto the layer currently selected.  But the currently selected layer changes when you select a different object, so if you don't pay attention to it, you can wind up with hundreds of objects scattered across a bizarre chaos of layer hierarchy.  Cleaning that up and organizing it is painful.  It's MUCH easier to keep your layers organized from the start by paying some attention to the layers panel.
(Note that this is VERY different from InDesign, which I was more familiar with when starting in Illustrator.  In InDesign, all your work is on ONE layer unless you explicitly create another.  In Illustrator, each object can be on its own new layer if you don't pay attention.)

It appears the file is not set up quite right.

Unlock the CLIPPING PATH layer.
Lock both its sublayers.
Drag the "place art here" layer into the "CLIPPING PATH" layer as its bottom layer.
Click the CLIPPING PATH layer, which now contains everything but the "delete" layer.
In the layers panel menu, click "Make clipping mask."
Select the "place art here" layer and draw your artwork.

You'll get something like so:
Comment: @Nyctea If you make sure the shape covers the bleed area and you still see the top layers with various colored strokes delimiting areas, you're most likely fine.
Comment: +1 for "Instead, you should create a NEW object (on the "place art here" layer) that is the color you want.". However, layer systems in InDesign and Illustrator are not as different as explained in your answer that I am aware of (and just double-checked to be sure)
Comment: @Emilie, they're different enough that I worked successfully in InDesign for months without knowing about layers, and when I learned about them I found my existing objects were neatly arranged in a single layer, whereas working in Illustrator for a week before looking at the layers panel I found my objects were in chaotic hierarchical disarray.
Comment: But then, that was InDesign CS4 and it didn't have sublayers like Illustrator.  Today I expect there's a lot less difference (so you have to pay attention to your layers in *either* application).  :)
Comment: Thank you for the tips! I created a huge square on the "Place Art Here" layer, and it didn't clip. The square seemed unaffected by the mask. Is there a fix for this? Is it perhaps a setup issue with the file? Photoshop is my program of choice, so I find myself pretty confused by Illustrator's layering/masking setup.
Comment: @Wildcard Yes Illustrator introduced sublayers before InDesign. Actually I had never even noticed InDesign had sublayers until just now. I rarely ever work with the sublayers panel and I haven't really found a good use for it yet but my students use them all the time (and get confused!)
Comment: @Nyctea, how about this?  Then you might also want to drag the DELETE layer (with the guides and bleeds) to the very top so it stays visible as you draw.


access specific server behind reverse proxy

Question: I have multiple devices that are all behind a private network. I have a WAN facing server that I can call into. Is there any way for me to be able to send an HTTP request through the WAN server to a specific device behind the network? I have been looking at a reverse proxy and I think I am on the right track but as I have many devices that will be changing in and out I am not sure what the best way of doing that would be. Thanks for any help in advance.
Comment: Why aren't you using IPv6?
Comment: The devices aren't connected to the WAN. I should have clarified that.
Comment: If they aren't connected to the network, how to you propose to reach them at all?
Comment: I was hoping to have some sort of redirect from the server that is connected to the network in order to delegate where each http request goes.
Comment: I think one of us has missed something. You simply cannot reach airgapped machines at all. A reverse proxy cannot help you with this. You will have to connect them to the network somehow before you can reach them by any method.
Comment: They are all on a private network but also on that private network is a server that is connected to the WAN. I was hoping to hit that server that is connected to the WAN and through it talk to the servers on it's private network.
Answer: You can use a reverse proxy to receive connections on a pre-defined port on the WAN interface and it will open new connections to the machines in the internal network (provided the WAN-connected server is dual-homed, that is, also has a connection to the internal network).
You could specify that TCP port 10000 will be forwarded to internal machine A, TCP port 10001 to machine B and so on.
For example, using a tool like socat:
<code>socat TCP4-LISTEN:10000,fork TCP4:machineA,10000
socat TCP4-LISTEN:10001,fork TCP4:machineB,10000
socat TCP4-LISTEN:10002,fork TCP4:machineC,10000
...
</code>
You could also use HAProxy, nginx and any other reverse proxy server to do this. The internal machines will get TCP connections that terminate on the reverse proxy.


Which screen PPI / scaling is recommended for a computer display?

Question: Assuming a font size of 9 pt (pretty widespread minimum font size), what PPI / scaling is recommended for reading it from a typical computer display? Is the 96 PPI standard close to optimal, or is it just a legacy of old days when higher display PPI were not possible?
Windows dialogs certainly suggest it's the optimum:
Answer: This is a tricky one to answer!
Firstly, DPI and PPI aren't the same thing conceptually. One is a measure of the dots per inch on a printed output and one the pixels per inch of a digital display.
I believe as a result you're kinda talking cross purposes. The windows DPI setting of 96 is the default https://support.corel.com/hc/en-us/articles/115001485408-Display-Options-How-to-change-DPI-Scaling-Level-for-displays-in-Windows-10-#:~:text=DPI%20setting%20controls%20the%20size,has%20setting%20of%2096%20DPI.
And by changing this what you're effectively doing is scaling a ratio (as I understand it) the number of "dots" (which doesn't make much sense in digital displays) which would make up an inch (I assume, given the windows dialog) of screen.  What this results in, (by reducing DPI) is more pixels representing the same inch that 96 would have, thereby given a fixed hardware resolution display making the screen elements appear smaller.
As a side point, Windows 10 has done away with this dialog and shows interface scaling as a percentage.
So, context aside, your original question asks what the optimum PPI / scaling is recommended for reading a typical computer display. What you're asking is at least two questions.
The reason it's at least questions is that the output "size" of text on screen is a function of both PPI and scaling. For example, a 24" 4k monitor with a high DPI and scaling of 200% will look identical (in size) to a 24" 1080p monitor with a scaling of 100%. The 4k monitor will look sharper at this setting because there are 2x the pixels per inch and techniques like pixel rounding and smoothing are less pronounced.
This is especially true of mobile devices which may have a very high hardware PPI, but internal scaling (on android its just "smallest to largest" which they control. I'm not aware of the technical scaling factors used here, I cite it to illustrate that different devices handling scaling differently in their terminology.
Finally, we come to "optimum" there are many ways to look at this:

Minimum text size to meet WCAG accessibility guidelines, but beyond this, recommended best practice for "base" font sizes. 9pt/12px has been given as the literal minimum before you starting failing A11y checks and should certainly not be used for body text for example where something close to 16px as a minimum would be recommended.
Optimum font spacing, line lengths and justifications, for readability (https://www.w3.org/TR/WCAG21/#visual-presentation)
Optimum for your content, userbase and use cases -For example if you're expecting users to read in specific environmental conditions, you should consider this

Those three points alone could warrant and answer each, all longer that this answer!
DPI as a number in that context is largely meaningless, because it's a measure from a single OS 20 years ago.
In summary, there is no optimum, scaling is a user controlled preference and should be treated as such, if a user chooses to change it, you should accommodate it (https://www.w3.org/TR/WCAG21/#resize-text).
Comment: Tow questions remain: (1) does this minimum of 9pt/12px apply to a standard 96 DPI display, the 160 DPI "baseline" display for mobile device, or something else? and (2) what happens below this limit: eye damage or inability to read the text?
Comment: 1. The 12px minimum will be scaled on devices with high DPI, by the software or OS to meet viewing standards required. Do a bit of research on retina displays for example to understand. 2. The standards are the very minimum for the very minimum of readability. Try reading any long form text as that side and you will experience eye strain at a minimum. For anyone with less than perfect eyesight, even the minimum may by unreadable. Even for someone with perfect eyesight, in the wrong conditions, high motion, high ambient light and low colour contrast, it may still be unreadable.
Comment: (1), so e.g. for a Retina display with 226 PPI, which scaling factor should be applied by the OS? (2) So I suppose those standards have nothing to do with health & safety requirements, which really was the core of the question (it was migrated from med SE).
Comment: 1. That's a user preference as I mentioned in the answer, if people find the size of elements on screen too small, they will increase the scaling to say 125% (of whatever the OS default is) which in turn will make the same element take up more pixels (as the number of pixels per cm of physical screen space is a constant) there is a decent table on Wikipedia https://en.wikipedia.org/wiki/Retina_display
Comment: 2. Yeah those minimum requirements are around readability as a facet of accessibility. Health and safety would be a whole area of its own, you could, for example, think holistically, if the screen can't be read, does that put the user in danger? or in a medical context, potentially a patient? Another way to think about it is longer term user eye strain and therefore damage. Larger is nearly always better until you get to the point where readability is effected negatively due to short line length and broken words, affecting the amount of Saccades https://en.wikipedia.org/wiki/Saccade


How to define a many to many (teacher - student) mapping visually?

Question: Let's say we have a teacher student relation. On one side, we have a list of teachers and on the other, we have a list of students.
What is the best way (visually appealing as well) to inform the user about the students taught by a particular teacher and the teachers that a particular student has signed up for.
Hover is not an option, as this information has to be presented as soon as a user lands on this page.
The assumption that can be made is there will be a maximum of 30 teachers and about 40 students. The subjects don't matter in this scenario. I only want the many to many relationship between a student and teachers mapped.
Comment: Would two different screens be an option? This would be a lot of information to communicate on immediate opening.
Comment: What is the use case? Choosing a visualization always depends on the intention what you want to make visible (to the mind, not to the eye).
Comment: The use case is that the user understands the relationship between different students and teachers on page landing. Subjects aren't important here.
Answer: Using a tabular format you could have the students down one side and teachers across the top (or vice versa, a view switcher option?)
Students can find their name down the left, scan across to see their subjects and scan up from these to see their teacher. Also the cells could be split into multiple subjects if a teacher teaches more than one subject. (see teacher A, Student 3, relationship below).
The table could be filtered to show specific student rows or teacher columns, e.g. if a teacher only wants to see the students they teach they could filter the rows to that criteria.

Addition:
Following on from André Kleinschmidt's improved more minimal version of my matrix, you could rotate it 45 degrees so both axis' labels ca be read horizontally. Could be another user option to change the view of it if desired.
Example:
Comment: I really want to build this now!
Comment: I also like this approach. Given, the question did not specify the need to show the subjects that describe the teacher-student association, perhaps we can abstract it way and use a number to show how many subjects? This way, if you rotate the teacher labels 90 degree, you can fit a lot more content on the page...
Comment: I liked the approach, but the OP has mentioned around 40 Students and 30 Teachers - with this approach it be difficult to relate the association.
Comment: @SerenS good suggestion, only downside I can think of is having to read teacher names at 90 degree angles.
Comment: Checkout @AndréKleinschmidt reply below! This is almost exactly what I had in mind!!!
Answer: How about this?

Will filters help? Is it expected to show student details or just the name is fine while mapping with the teacher?
Share your thoughts.
Comment: Your answer sounds like a question :) If you believe in it, SELL IT!
Comment: There are a few things which i think could "improve" this. Like a badge with a count for each row to ease scanning the data. Whats your thoughts for the user icons? Maybe use actual student profile images to identify them (a hover could reveal more details)... Then again, maybe I am nitpicking, but this feels unnatural and i dont think it scales nicely to a 40 x 30 sample... What I DO LIKE is that it feels very Subject-Centric :) i mean that the subjects are the primary/root nodes for this information.
Answer: suggestion
You could try a co-occurrence matrix with the teachers and the students as dimensions. If the subjects doesn't matter a cross/dot will decently show the connection and saves display space.
example
There is a nice example visualization of a co-occurence matrix, that shows the character co-occurrences in Victor Hugo's Les Misérables. (See image below if the page became unavailable)

The example was produced with the JavaScript-Library 3D.js that could be a valuable tool for you if you have to place it on a website.
In opposite to the example you would not match persons with themselves and obviously end up with a rectangular matrix.
additional options
Additionally you could provide a sort by teacher or student relying on the number of connections (filled cells per row/column). With numbering the cols/rows one could easily count how many students a teacher is in charge or vice versa with how many different teachers a single student has to deal.
Instead of a simple marker (dot, cross, etc.) you could fill the cells with the number of classes one teacher conducts to a corresponding student. Summing up this counters makes visible the teaching load per row/column.
Comment: This is what I envisioned after your suggestion @SerenS Very pretty and to the point with regards to purely showing the relationship mapping. This could even have a key with the subjects listed so you could if you want to see what subjects are taught between teacher > student.
Comment: This is almost exactly what I envisioned in my comment above! Its like you read my mind lol! ...A co-occurrence matrix - I learned something new :) Great answer !!!
Comment: This is a great idea. We already found something that fits my requirements, but will keep this in mind the next time. TIL about Co-occurrence. Thank you!
Comment: You could have an option to switch the view to have the teachers down the left, in case someone is scanning for a particular teacher name. and vice versa with the student names.
Comment: isn't this type of visual just called a matrix diagram? rather than a co-occurrence matrix?
Comment: I caught up that term during study time. It was introduced there as a kind of subtype or variation of adjacency matrices (the Les Miserable example is one). The use case of the question does not match edges with themselves. I don't know if rectangular matrices count as adjacency matrices anyway. The term co-occurrence has it's source in linguistics where word neighborhoods in sentences, paragraphs or even broader spectra are measured.matrix diagram is also right, calling it co-occurrence matrix defines just the mathematical base model closer.
Answer: You can use Tabs for Teacher and Students and then display Subject/Teachers in a list view along with the students enrolled to that subject - something like this:
Comment: @parjun would be good to see what you've come up with
Comment: The problem with this approach is that the Subject takes a majority of the visual space. I just want to show the relationship between teachers and students. Subject is irrelevant.
Comment: @parjun The Subject is a placeholder - you can replace that with Teacher and show more students - maybe in two lines
Comment: Thank you :) I used this idea to come up with something that fits my use case.


How did Dumbledore's drinking of the poison help to get a horcrux?

Question: Why did Dumbledore drink the potion? How did that help to find the horcrux?
Comment: http://harrypotter.wikia.com/wiki/Drink_of_Despair
Answer: It was part of a protective scheme for the horcrux, designed by Voldemort.
Harry and Dumbledore went to the cave in the cliffs, and found a lake with a central island. When they crossed to the island, they found a stone basin. Dumbledore worked out that the horcrux was at the bottom of the basin, but it was impenetrable by any means except drinking:

"You think the Horcrux is in there, sir?"
"Oh yes." Dumbledore peered more closely into the basin. Harry saw his face reflected, upside down, in the smooth surface of the green potion. "But how to reach it? This potion cannot be pen-etrated by hand, Vanished, parted, scooped up, or siphoned away, nor can it be Transfigured, Charmed, or otherwise made to change its nature." Almost absentmindedly, Dumbledore raised his wand again, twirled it once in midair, and thencaught the crystal goblet that he had conjured out of nowhere. "I can only conclude that this potion is supposed to be drunk."
— Half-Blood Prince, chapter 26, The Cave

This was a deliberate defensive measure by Voldemort. The boat to the island was enchanted so that only a single person could reach it:

Dumbledore chuckled. "Voldemort will not have cared about the weight, but about the amount of magical power that crossed his lake. I rather think an enchantment will have been placed upon this boat so that only one wizard at a time will be able to sail in it."
"But then—?"
"I do not think you will count, Harry: You are underage and un-qualified. Voldemort would never have expected a sixteen-year-old to reach this place: I think it unlikely that your powers will register compared to mine."
— Half-Blood Prince, chapter 26, The Cave

So only one person can get to the island, and when they get there, they have to drink the poison. Assuming that doesn't kill them, the Inferi in the water almost certainly will. This is a pretty good defensive strategy, as long as only one person actually does get to the island.
As usual, Voldemort was undone by his arrogance: believing that a young person would never reach the cave, or that a Squib/Muggle wouldn't accompany them (perhaps carrying bottled water, which might be immune to his enchantments to evaporate all other water).


Which one do you prefer for Searching/Reporting DataTable or DTO or Domain Class?

Question: The project currently I am working in requires a lot of searhing/filtering pages. For example I have a comlex search page to get Issues by data,category,unit,...
Issue Domain Class is complex and contains lots of value objects and child objects.
.I am wondering how people deal with Searching/Filtering/Reporting for UI. As far As I know I have 3 options but none of them make me happier.
1.) Send parameters to Repository/DAO to Get DataTable and Bind DataTable to UI Controls.For Example to ASP.NET GridView
DataTable dataTable =issueReportRepository.FindBy(specs);
.....
grid.DataSource=dataTable;
grid.DataBind();

In this option I can simply by pass the Domain Layer and query database for given specs. And I dont have to get fully constructed complex Domain Object. No need for value objects,child objects,.. Get data to displayed in UI in DataTable directly from database and show in the UI.
But If have have to show a calculated field in UI like method return value I have to do this in the DataBase because I don't have fully domain object. I have to duplicate logic and DataTable problems like no intellisense etc...
2.)Send parameters to Repository/DAO to Get DTO and Bind DTO to UI Controls.
IList<IssueDTO> issueDTOs =issueReportRepository.FindBy(specs);
....
grid.DataSource=issueDTOs;
grid.DataBind();

In this option is same as like above but I have to create anemic DTO objects for every search page. Also For different Issue search pages I have to show different parts of the Issue Objects.IssueSearchDTO, CompanyIssueTO,MyIssueDTO....
3.) Send parameters to Real Repository class to get fully constructed Domain Objects.
IList<Issue> issues =issueRepository.FindBy(specs);
//Bind to grid...

I like Domain Driven Design and Patterns. There is no DTO or duplication logic in this option.but in this option I have to create lot's of child and value object that will not shown in the UI.Also it requires lot's ob join to get full domain object and performance cost for needles child objects and value objects.
I don't use any ORM tool Maybe I can implement Lazy Loading by hand for this version but It seems a bit overkill.
Which one do you prefer?Or Am I doing it wrong? Are there any suggestions or better way to do this?
Answer: I have a few suggestions, but of course the overall answer is "it depends".
First, you should be using an ORM tool or you should have a very good reason not to be doing so.
Second, implementing Lazy Loading by hand is relatively simple so in the event that you're not going to use an ORM tool, you can simply create properties on your objects that say something like:
private Foo _foo;
public Foo Foo
{
  get {
         if(_foo == null)
         {
            _foo = _repository.Get(id);
         }
         return _foo;
       }
}

Third, performance is something that should be considered initially but should not drive you away from an elegant design.  I would argue that you should use (3) initially and only deviate from it if its performance is insufficient.  This results in writing the least amount of code and having the least duplication in your design.
If performance suffers you can address it easily in the UI layer using Caching and/or in your Domain layer using Lazy Loading.  If these both fail to provide acceptable performance, then you can fall back to a DTO approach where you only pass back a lightweight collection of value objects needed.
Answer: This is a great question and I wanted to provide my answer as well. I think the technically best answer is to go with option #3. It provides the ability to best describe and organize the data along with scalability for future enhancements to reporting/searching requests.
However while this might be the overall best option, there is a huge cost IMO vs. the other (2) options which are the additional design time for all the classes and relationships needed to support the reporting needs (again under the premise that there is no ORM tool being used).
I struggle with this in a lot of my applications as well and the reality is that #2 is the best compromise between time and design. Now if you were asking about your busniess objects and all their needs there is no question that a fully laid out and properly designed model is important and there is no substitute. However when it comes to reporting and searching this to me is a different animal. #2 provides strongly typed data in the anemic classes and is not as primitive as hardcoded values in DataSets like #1, and still reduces greatly the amount of time needed to complete the design compared to #3.
Ideally I would love to extend my object model to encompass all reporting needs, but sometimes the effort required to do this is so extensive, that creating a separate set of classes just for reporting needs is an easier but still viable option. I actually asked almost this identical question a few years back and was also told that creating another set of classes (essentially DTOs) for reporting needs was not a bad option.
So to wrap it up, #3 is technically the best option, but #2 is probably the most realistic and viable option when considering time and quality together for complex reporting and searching needs.


Is Ohm's Law always exactly true even at the microscopic level?

Question: My probability textbook introduction just mentioned that Ohm's Law is not always precisely true at the microscopic level.
How is this possible? What is causing this to happen?
Comment: Can you provide more context for the quote? Out of context like this, it's very difficult to guess what they might have in mind. I'll bet that there's a section within the book itself that addresses the issue that the introductory comment raises.
Comment: Ohms law is, as any law, a generalization (and simplification) of (a class of) observations. Even at macro level ut does not hold for non-linear components, and it does not hold for noisy components. I would be surprised if it would hold in the small level in any other than a statistical (averaged) way.
Comment: @WoutervanOoijen with noisy components are you referring to noisy resistors? I'd expect the white (voltage) noise to produce a current in the resistor that obeys Ohm's law indeed.
Comment: @Valdimir: only when averaged over time.
Answer: Consider the rule that the volume of liquid in a vessel is equal to the height of the liquid times its horizontal cross sectional area.  For vessels whose horizontal cross section is uniform from top to bottom, halving the height of the liquid will halve its volume.  Doubling the amount of liquid, if there's room, will double the volume.
Suppose, however, one removes nearly all of the liquid from the vessel, leaving only two nanoliters.  and then cuts the height of the liquid in half.  Should one expect that exactly one nanoliter would remain?
The relationship between cross-sectional area, height, and volume remains true by definition at any scale, large or small, provided that those quantities are concretely defined numbers.  At very small scales, however, concepts like "volume" become rather nebulous.  If there are only a few hundred molecules bouncing around, it's unclear how much of the space outside each should count as part of the "volume" of liquid, and how much should be considered "empty space".  In such cases, the relationship between height, volume, and cross sectional area doesn't "break down" so much as it becomes less and less meaningful, especially in cases where the cross-sectional area varies widely with height.
To put it another way, when quantities get very small, measurement uncertainties get very big.  When quantities get so small that measurement uncertainties get to be as big as the measurements, Ohm's Law will still hold, but will cease to have much predictive value.
Answer: On a microscopic level everything changes. You can't measure precisely anything! Also the known form of Ohm's Law is used with good results only in circuit theory. This form is also an approximation. Ohm's Law is derived (like all electromagnetism equations) from Maxwell equations so its general form is:
$$J=\sigma \cdot E$$
Every theory that tries to describe a microscopic phenomenon uses probabilities and statistics (as you can see yourself by reading this in such a book) and as a result every quantity can only be an approximation. Exactly the same goes for Ohm's Law.
Also if someone tried to find precisely one of the quantities that appear in the equation he should take an infinite number of samples for the rest of the quantities so to have zero error. This is not only impossible given that no one can live forever but also impossible based on that in order to take infinite samples of J you have to be able to count all electrons which obviously is also impossible. All in all it is just an approximation.
Answer: I think Ohm's law works because the electrons do a lot of scattering.
For distances that are on the order of the scattering length, you might see non-ohmic behavior.
Answer: Ohm's Law is a simple equation that can be derived from the equations that describe the microscopic behaviour of electrons by averaging those equations over long time and spatial scales.
Although it is not often stated, the voltage, current and resistant that appear in Ohm's Law are average values.
On a microscopic level, the current flowing through some surface is not nice and smooth, rather it looks quite random as electrons move across that surface. If your surface is too small, you will have to wait a long time before you see any electrons (and hence any current). Similarly if you don't wait long enough, you may not see any electrons at all, or you may even see electrons moving in the opposite direction to what the average current actually is. Remember that electrons jiggle around in a conductor in a mostly random way - only on average do they move together in one direction.
So you have to wait a long time and look at big areas so you can build up the statistics to get a nice average theory. That theory is Ohm's Law.


After importing a csv into python as a list object, how do i refer to one of the columns?

Question: I imported a csv into python3 as a List object. Assuming that the headers of the original csv were "FirstName", "LastName", "EmailAddress", "MailAddress", "PhoneNumber", how would I list only the rows that have no string in the "EmailAddress" column? Or how would I list only the rows that have no entry under the "PhoneNumber" column. Im not sure how to refer to specific rows in the List.
If the name of the List was called "ContactInfo", is there a way to specify just the PhoneNumber column? In powershell it would look like....
ContactInfo[1].PhoneNumber

Answer: A good way to figure this out would just be to print the list that you have.
Typically, csv to list returns a list of lists, where each inner element list is one row.  You can refer individual elements of this inner list element (specific columns) using indices
So you can do :
For row in list_from_csv :

    If row[2] = ...... (condition)
    If row[4] = ...... (condition)

Here we are checking the 3rd and 5th column in each row.
Comment: @druffin Did this help?


Meaning of the phrase "survived the Constitution"

Question: What's the meaning of "survived the Constitution" in the following phrase?

Moreover, of this list only "the never-ending appeals to the people by competing public officials" survived the Constitution.
Answer: The quotation comes from chapter 8 of Adam Przeworski, Democracy and the Limits of Self-Government (2010). Here is the section of text where it appears:

Let me reiterate that the issue of intentions [of the founders] cannot be resolved. [Gordon] Wood (1969): 383), for example, makes this claim:

The Americans were not simply making the people a nebulous and unsubstantial source of all political authority. The new conception of a constitution, the development of extralegal conventions, the reliance on instructions, the participation of the people in politics out-of-doors, the clarification of the nature of representation, the never ending appeals to the people by competing public officials—all gave coherence and reality, even a legal reality, to the hackneyed phrase, the sovereignty of the people.

Yet this is a conclusion of a section that describes the ambiguities and the polemics concerning the relation between the people and their representatives, the role of the people between elections, the locus of sovereignty. Moreover, of this list only "the never-ending appeals to the people by competing public officials" survived the Constitution. Hence, it is easy to side with [Edmund] Morgan (1988:82): "The problem of reconciling the wishes and needs and rights of actual people with the overriding will of a fictional sovereign people was not temporary. It was, indeed, inherent to the new fiction."

The embedded quotation from Wood in the middle of this excerpt identifies several ways in which American citizens during the period of the Articles of Confederation were made to feel that they exercised sovereignty over their government by various forms of direct participation in the process.
Przeworski argues, however, that once the Constitution came into effect, the only activity from those earlier days that remained an active force capable of giving citizens a sense of their own sovereign power over the state was the continuing effort of public officials to gain popular support for their political positions. Thus "survived the Constitution" means simply "continued to exist in American life after the Constitution was ratified."
Answer: Context would be nice...
But it seems the author refers to a list of things that America was striving for when becoming independent.
Of that list, only the "never-ending appeals" actually became a reality after the Constitution was implemented.
The others, notwithstanding the good intentions, did not work out.
I think the list might be this one.
It seems that the sentence is criticizing the implementation of the democratic ideals in the United States, implying for instance that public involvement in the democratic process is not what it ideally should be.


A combinatorial identity: $\sum_{k=0}^j (-1)^k \frac{n-2k}{n-j-k} \binom{n}{k} \binom{n-j-k}{j-k} = 0$

Question: I would like to prove the following identity: For
$0< j\leq \left\lfloor{n \over 2}\right\rfloor$, $$\sum_{k=0}^j (-1)^k \frac{n-2k}{n-j-k} \binom{n}{k} \binom{n-j-k}{j-k} = 0.$$ I have checked for several small $j$, but no clue on how to prove it for all $0<j\leq \lfloor \frac{n}{2} \rfloor$. I have thought about whether one can have a combinatorial proof, like using inclusion-exclusion, but it seems not possible becuase some terms would not be integers. Would be glad if there is any proof or hint. Thanks.
Comment: Have you tried Zeilberger's algorithm?
Comment: @PeterTaylor Thanks for the suggestion. First time hear this algorithm and have just googled it. It seems not fit our case as the summation is not over all $k$ but just $0\leq k \leq j$. Or could you explain more?
Comment: Your summation is over the entire *support* of $k$, which is what matters.
Answer: We have that for $0< j<n/2$,
$$\begin{align}
\sum_{k=0}^j (-1)^k \frac{n-2k}{n-j-k} \binom{n}{k} \binom{n-j-k}{j-k}&=
\frac{1}{n-2j} \sum_{k=0}^j (-1)^k (n-2k) \binom{n}{k} \binom{n-j-k-1}{j-k}\\
&=
\frac{n}{n-2j} \sum_{k=0}^j (-1)^k \binom{n}{k} \binom{n-j-k-1}{j-k}
\\&\qquad-\frac{2n}{n-2j} \sum_{k=1}^j (-1)^k \binom{n-1}{k-1} \binom{n-j-k-1}{j-k}.
\end{align}$$
Hence it suffices to show that
$$\sum_{k=0}^j (-1)^k \binom{n}{k} \binom{n-j-k-1}{j-k}
=2\sum_{k=1}^j (-1)^k \binom{n-1}{k-1} \binom{n-j-k-1}{j-k}\tag{$\star$}.$$
Now use the fact that
$$(-1)^k\binom{n-j-k-1}{j-k}=(-1)^j\binom{2j-n}{j-k}.$$
Then, by Vandermonde's identity, the LHS of $(\star)$  is
$$\sum_{k=0}^j (-1)^k \binom{n}{k} \binom{n-j-k-1}{j-k}=
(-1)^j\sum_{k=0}^j \binom{n}{k} \binom{2j-n}{j-k}=(-1)^j\binom{2j}{j}$$
and the RHS of $(\star)$ is
$$2\sum_{k=1}^j (-1)^k \binom{n-1}{k-1} \binom{n-j-k-1}{j-k}=
2(-1)^j\sum_{k=1}^j \binom{n-1}{k-1} \binom{2j-n}{j-k}
\\=2(-1)^j\binom{2j-1}{j-1}=(-1)^j\binom{2j}{j}$$
and we are done.


Windows hangs during defragmentation

Question: So I was defragmenting my disk and let the computer sort it out. I was going to look for something when I noticed that windows didnt react. No matter the input from mouse or keyboard, my monitor light was blinking (indicates sleep mode). The disk was also not making any operations and since a BSOD didnt seem like something that would happen, I forcefully rebooted my PC. Event log logged only a critical power loss and nothing else meaningful to me. My question is whether I can trust that my data kept its integrity. I know NTFS uses journaling but am not exactly sure about the full capabilities of it. Does NTFS use some sort of data verification or something similar or is a reinstall in order (I am quite paranoid about my data)? I also have a recent pre-crash restore point. Does that help in any way?
Answer: Restore points are stored in the filesystem, so if filesystem is corrupted, so can be restore points.
Run a filesystem check: right-click the system disk, choose Properties → Tools tab and choose to check the filesystem. Windows will tell you that it can't check a disk while it's running off of it, so you have to reboot. Agree. The check can take some time, even up to a few hours on large and slow drives.
If any corruption is found, this tool will try to sort it out. It sometimes involves deleting files that cannot be salvaged. If you don't have backups, let this be a lesson. If you do, that's great! You may need them.
You can run a system integrity check afterwards: run Command line as administrator (search for it in the Start menu, right click &rarr _Run as administrator) and type sfc /scannow Enter. This will also take some time and internet connection will be required to repair detected issues.

Windows hangs during defragmentation


Two independent groups and three dependent variables

Question: How do I test for differences between two groups on three dependent variables? Is that an ANOVA or multiple t-tests with an adjusted alpha level?
Answer: You need to look into the Multivariate-ANOVA (called MANOVA).  I'm not sure about good internet-based resources; the Wikipedia page is here, and the entry in StatSoft's online textbook is here, but neither seem great.  For a 'real' textbook that is more or less math-free, Tabachnick & Fidell is the most popular.  If you use SPSS, SAS, or Stata, the excellent UCLA statistics help site has some quick tutorials; they can be found here.


How much would cost to mine a block with Google Compute Engine?

Question: Google has opened its Compute Engine and it has a price list. How much would cost to mine a bitcoin block with Google Compute Engine?
Comment: I'm not going to crunch the numbers right now, but it wouldn't be worth it.  It would most likely take more than a year.
Comment: It's CPU only - I doubt it would be profitable.
Comment: They tell it's good to render videos. I wonder if a GPU farm wouldn't be much more cost efficient for that purpose too.
Answer: Even if it was a GPGPU cluster, you will not make a profit from the prices they are charging. Mining at this point is only profitable with FPGA, ASICs and certain GPUs pending power consumption.
Comment: That's not what he asked.
Comment: @StevenRoose because the question suffered from the xy problem. He likely should have asked "is it profitable to mine with Google Compute Engine?".
Comment: @StevenRoose He asked a question that has a vacuous answer. I suspect his concern is what Lohoris pointed out. Is it profitable. I can pass the Turing test and infer meaning :)


Spaced-bounded Probabilistic Turing Machine Always Halts

Question: For example, in the definition of BPL, we require that the probabilistic Turing machine has to halt for every input and every randomness. What is the reason for us to define them this way? What would happen if they don't halt? On the other hand, we don't require space-bounded non-deterministic Turing machines to halt.
Answer: This is a very old question, but is a good question and deserves an answer.
The basic issue is that if we let the probabilistic algorithm run for an unbounded amount of time (and randomness), it can solve NL in a trivial way. In fact, it can solve NL in RL, and even ZPL. But it does so by running in an exponential amount of time, which doesn't feel fair.
The idea of the algorithm is simple: store the current state, ask for the next state transition. If the transition is invalid, restart. Otherwise, transition to that state. If we ever transition from the start state to an accept state, accept. Since we know that NL = coNL, each time we restart, switch between the NL and coNL statement. Clearly this algorithm only uses logarithmic space, never outputs the wrong answer, and every time it runs has a 1/exp(n) chance of outputting the right answer. So after an expected exponential amount of time, we output the right answer with high probability.
And if we give two way access to the randomness and unbounded time/randomness, it gets even worse, allowing us to run the same idea but with polynomial length states, giving us BPSPACE is in ZPL.
In contrast, we don't require NL algorithms to halt because a non halting nondeterministic algorithm can be turned into one. If a path to the accepting vertex exists, it is reachable in polynomial time. Thus we can just reject if we didn't find this shortest route to the accept vertex. This only requires holding a counter, which only takes logarithmic space and polynomial time. Unfortunately, our BP algorithm for NL does not accept within polynomial time with high probability.
For reference, see Nisan's "On read-once vs. multiple access to randomness in logspace".


手を貸す and 'lend a hand' - coincidence?

Question: At some point I found that 手を貸す both literally and figuratively means 'to lend a hand' - is the resemblance a coincidence?
Answer: There are a lot of metaphors in common around the world. This is a good example of one such metaphor - the extension is quite logical (give help > give a hand (to help) > lend a hand), and it wouldn't surprise me to find many more examples of similar metaphors around the world.
There are others that are less common, such as Japanese's 猫をかぶる - the idea of 'cat' isn't cross-culturally connected with 'niceness', so the metaphor is relatively unique. (Compare English 'a wolf in sheep's clothing' for the same idea.)
A good place to start reading about these, if you're interested, is Lakoff and Johnson's famous Metaphors We Live By, a good introduction to the roles and mechanics of metaphors in language and culture.
Comment: Sounds plausible. But if I remember correctly, the idiom 一石二鳥 turns out to be a calque from English, so stronger evidence that 手を貸す is not a calque might involve showing it was attested in earlier stages of the language.
Comment: Note that there is also the idiom 手{て}を借{か}りる, "to borrow a hand".
Comment: This may sound nit-picking, but "a wolf in sheep's clothing" is not English but Koine Greek (or Aramean if that is really what Jesus remarked, as it is from 7:15 of the Gospel  according to Matthew.)  And I think 猫をかぶる is somewhat less "serious" than "a wolf in sheep's clothing."

手を貸す and 'lend a hand' - coincidence?


about loading arrangement on DC motor

Question: I want to calculate the weights that can be added to the dc motor for loading arrangement. So, how can I calculate this? I am using the motor with 24 volts DC, 6000 rpm No-Load current= 600 mA, Stall current= 30A max. What is the maximum weight that can be added?
Comment: If you are asking, how much weight can this motor lift, there is no answer. You have not specified the mechanical linkage to the weights. In general, a motor can lift almost any weight with a sufficient gear ratio, but the tradeoff is speed.
Comment: Is 6000rpm the no-load speed?
Comment: If you mean the mechanical load then this is a mechanical design question not an electronic one (though I'm sure some here will have a go at answering it :-) )
Comment: The information you've given isn't sufficient without making assumptions as to what sort of motor it is, what the gearing is (if any), or what distance the load is attached from the centre of the shaft.
Comment: Mechanical Power = Torque x Rotation rate. Electric power = Mechanical power/efficiency.  [Approx formula (2% wrong) which is VERY useful. Watts = (Newton.metre torque) x RPM.
Answer: Unless specifically identified as a brushless DC motor, a DC motor is usually assumed to be a a classical DC motor with a commutator. A DC motor of the size described is assumed to be a permanent-magnet DC (PMDC) motor unless information about a wound field is provided. The steady-state performance of a PMDC motor can be analyzed using the equivalent circuit shown below.

Va = Supply Voltage (24 volts)
Ra = Armature resistance including brushes
E - Back emf = N / Ks; N = Speed (RPM); Ks = Speed constant (RPM/Volt)
Ia = Armature current (Amps)
V  = Ia x Ra + E
At Stall: RPM = 0, E = 0, Va = Ia x Ra therefore Ra = 0.8 ohms
At No-Load: Va = Ia x Ra + E therefore E = 23.52 volts
N = 6000 RPM = Ea/Ks; Ks = 6000 / 23.52 = 255.1 RPM/volt
Power
Electrical Input Power = Mechanical Output Power + Losses
Electrical Input Power (Watts) = V x Ia
Mechanical Output Power = Load Torque (Newton Meters) X Speed (RPM) x 0.1047
At No-Load: Torque = 0 so Output Power = 0 Input power = 0.6 x 24 = 14.4 watts Total losses = 14.4 watts. Losses in Ra = 0.6^2 x 0.8 = 0.288 watts. Total losses minus losses in Ra = mechanical losses = 14.112 watts. Assume the mechanical losses are due to bearing and brush friction and do not change with speed. Total friction losses = 14.112 W = Loss friction torque x 6000 x 0.1047. Total friction loss torque Mf = 0.0225 N-M.
Armature Power and Torque: Mechanical power developed in the armature before mechanical losses is P = Ia x E = Ia x N / Ks. The mechanical power developed is also the armature torque Ma x N x 0.1047 therefore 0.1047 x Ma x N = Ia x N / Ks.
Ma = Ia / (0.1047 x Ks) or
Ma = Ia x Km where Km = 1 / (0.1047 x 255.1) = 0.0374 N-m/amp
Stall torque is Km x stall current = 30 x 0.0374 = 1.12 N-m
The shaft torque, Ms, available to drive a load is the armature torque Ma, minus friction torque Mf. Ms = Ma - Mf.
In order to "calculate the weights that can be added to the dc motor for loading arrangement," it is necessary to determine the torque required from the motor shaft to move the weight in the required manner at the required speed. The torque available from the motor at any speed can be calculated from the motor analysis shown above. The continuous torque that the motor can provide without overheating can only be determined by testing the motor with the knowledge of the maximum allowable motor temperature. That information is normally provided by the motor manufacturer.

about loading arrangement on DC motor


Weird level shifting issue only when connected to IC chip

Question: I'm connected to a 5v heat-pump to control it via serial. I'm using a level shifter to shift between the two as the heatpump is 5v and the D1 is 3.3v shown in the scope images below. My issue is I can't read data off the RX line as its voltage is wrong but only when connected to the D1. If I remove the D1 RX pin the voltages are shifted correctly.
Wires coming in from the heat-pump, top, left to right are:  RX, GND, 5V, TX.  5V goes to power the D1 mini which uses a regulator to convert it down to 3.3.

Here is the circuit with the D1 sending data to the HP. Goes out blue at 3.3v and is shifted correctly to 5v. Perfect.

Here is the RX line though coming back into the D1. Yellow is the 5v coming in which is wrong, it doesn't have a low. It's then shifted to an unreadable level for the D1.

The strange part is if I remove the green wire coming from the shifter to the D1 and scope again I get what I would expect. Levels coming in at 5v shifted down to 3.3v.

So the weird voltage issue only happens when it's connected to the D1. I've three different D1 chips (given they all came in the same batch) with the same results. I don't think it's the shifter because of what I see in the last scope. Any idea what's going on here?
Answer: Obviously there is a USB to UART chip (CH340C) on the D1 which is probably driving your RX signal as well. Did you take that into account?
Comment: There is nothing connected to the usb so I figured it wouldn't affect anything. Is this assumption wrong?
Comment: The chip is supplied all the time so it's probably driving that line
Comment: Interesting, I wonder if that's why this works fine with a different clone chip? Maybe the clone (can't verify right now) is using a different USB to UART chip that doesn't drive it the same way? Assuming that's it is there anything I can do to get around this?
Comment: Actually that's the usual behavior if you supply the chip like this. It's only different if the chip is supplied through the usb 5V. You'll have to remove that IC or lift one pin.


In iOS, how can I distinguish a Haptic Touch from a long press?

Question: Apple's recent iPhone XR announcement replaces 3D Touch with Haptic Touch, letting you access 3D Touch features by just long-pressing a view.
I'm curious how that will interact with existing UILongPressGestureRecognizer interfaces. There are items in my app that currently have different 3D Touch and long-press functionality.
Since the iPhone XR hardware isn't yet available, I was wondering if anything had been published about how the two features will work together.
Answer: Based on testing in the simulator using the Hardware | Touch Pressure | Use Trackpad Force option, Haptic Touch is just a long press.
Answer: "In 2015, when the iPhone 6S and 6S Plus were announced, Apple also introduced 3D Touch. 3D Touch uses a Taptic Engine with haptic feedback, which allows the device to sense the pressure of a touch, thereby triggering specific actions. For example, pressing hard on an icon will enable us to quickly open an action menu." - Clayton, C. (January 2018). Learn iOS 11 Programming with Swift 4 - Second Edition.
"3D Touch is basically a technology that adds another dimension (hence the name) to the tapping mechanism that you find in every iOS device. Traditionally, a user could perform the following actions on an iOS device's screen using her fingers:

Tap;
Long tap;
Swipe;
Double tap.

With the availability of 3D Touch on a device, a new vector that registers the strength of a touch on the screen is added to the formula, allowing the user to keep her finger on the screen and apply more pressure until an action (application specified) is performed. 3D Touch simply allows the iOS device to have access to how hard the user is pressing her finger on the screen, and this opens the door for a whole new set of applications." - Nahavandipoor, V. (2017). iOS 11 Swift Programming Cookbook.
"3D Touch works because the iPhone's screen is pressure sensitive. You can press on the display, and the harder you press the more "happens." Haptic Touch screens, like on the iPhone XR, don't have this pressure sensitivity. Instead, Haptic Touch appears to be just a new name for our old friend, the long press.
(...)
seems like Haptic Touch can do most of what 3D Touch does already. In iOS 12, a new trackpad mode was added, one that works with every iPhone and iPad. Trackpad mode lets you press hard to turn the iPhone's keyboard into a trackpad, which in turn lets you control the cursor in the text above. The new mode lets you do the same by long-pressing the keyboard's space bar. I'm almost certain that this feature will get a Haptic Touch vibration in the iPhone XR." - Sorrel,C. (September 2018). What's the difference between 3-D Touch and Haptic Touch?
"It's important to remember that not all devices have a Taptic Engine; in the devices that don't, the feedback simply won't be played. This means that you mustn't rely on tactile feedback (...) it should be used to underline effects that are already visually or aurally present." - Buttfield-Addison, P., Manning, J. (October 2018). iOS Swift Game Development Cookbook, 3rd Edition.
"Considering they removed 3D Touch from the device to cut manufacturing costs and to give us the new "Liquid Retina" display, we don't expect any real pressure sensitivity to be associated with Haptic Touch." - Peterson, J. (September 2018). All the 3D Touch Actions You'll Lose by Switching to the iPhone XR with 'Haptic Touch'.
At this stage it's somewhat unclear how many of the functions supported by Apple and 3rd party apps on 3D Touch can and/or will be supported on Haptic Touch.
With this, what's happening now with 3D touch seems similar to what happened with Force touch back in 2015. The Haptic touch meaning is more specific describing the set of possible actions (as 3D touch has broader meaning). As mentioned by Buttfield-Addison, P., Manning, J., i wouldn't depend on this type of feedback. Since you have it in your app already and basing myself on the meaning of haptic (relating to the sense of touch, in particular relating to the perception and manipulation of objects using the senses of touch and proprioception), I reckon the long-press will remain as it's one of the possible touch interactions in the set of a normal / mainstream person's actions.
There's a good answer in apple.stackexchange I suggest you to read.


Does it make any sense to have individual stocks, bonds, preferred shares

Question: I have a self-directed trading / investment account that has only ETFs in it. Each trade is $10.
Does it make any sense to have individual stocks, bonds, preferred shares and if yes, what is the minimum portfolio balance to avoid paying too much for transaction fees?
Answer: Sure, with some general rules of thumb:

Don't put any more that 10% of your entire portfolio (or whatever amount you're willing to lose completely) in any single stock, bond, or preferred share
Don't buy stock in a company unless you have solid, fundamental reasons for buying it.
Have a strategy - are you investing in a particular company or a sector? How do you determine if one stock is a better buy than another?
Have an exit plan - how much are you willing to lose before getting out?
Don't use "dollar-cost averaging" as an excuse to throw good money after bad - only buy more of a stock that's fallen if you have good evidence that it will rebound.

what is the minimum portfolio balance to avoid paying too much for transaction fees?

Well, the fee doesn't change with portfolio balance or order size, so I don't know what you're trying to do here.  The way to have less transaction fees is to have less transactions.  That means no day-trading, no option rolling, etc.  A Buy-and-hold strategy (with free dividend reinvestment if available) will minimize transaction fees.


Can I use Open Office on my new MacBook Air?

Question: I just downloaded Open Office to my Mac Book Air and installed it. When I tried to open it a message came up saying it's developed by an unidentified source and my computer settings only allow installation of programs from Mac App Store or identified developers. I don't know anything about code. What can I do?
Comment: Is the OS Mountain Lion?
Answer: You have just seen GateKeeper in action.
If you are confident you downloaded a safe copy of the program, you can tell your Mac to "trust" that program and let it past the gate.

Right click on the icon
Select Open
Read the dialog and agree or disagree to let that program run

The linked article above goes into much detail on GateKeeper and I would scan it and review the steps above. If you find a lot of software you need triggers the warning, you could relax the settings, but I prefer to keep them at the defaults as I like to know when new code runs on my Mac.
Comment: Thank you for answering! I downloaded it from http://www.openoffice.org/sv/get/ How can I be sure it's safe?
Comment: As with any other piece of software you have to trust the developers. What you can do is to validate your download against a checksum. I suppose that you've downloaded `OOo_3.3.0_MacOS_x86_install_sv.dmg`. Its MD5 checksum is `869e4b23022a7d318e3668003ea33a5c` (from http://www.openoffice.org/download/legacy/md5sums/3.3.0_md5sums.txt). Open Terminal and type either `md5 ~/Downloads/OOo_3.3.0_MacOS_x86_install_sv.dmg` or `md5sum ~/Downloads/OOo_3.3.0_MacOS_x86_install_sv.dmg` (not sure of the top off my head). If the number you get coincides with the MD5 checksum above your download is OK.


Why is there no predicate in "we the people"?

Question: I can't get the idea why. Haven't found anything on the internet
Comment: can you give some context? is this referring to the [Preamble to the US Constitution](https://en.wikipedia.org/wiki/Preamble_to_the_United_States_Constitution)?
Comment: @Catija the predicate(s) would be *ordain* and *establish*
Comment: Assuming you **are** talking about the preamble, the actual sentence (if you exclude all of the flowery phrasing) is "We the people ordain and establish this Constitution." Looks like "Constitution" is the predicate to me...
Comment: @costrom Sure. It still includes the object, though (if there is one)... so technically we're both half right.
Answer: The reason why there is no predicate is "we" and "the people" are two elements apposed. The linked Wikipedia article defines apposition as:

a grammatical construction in which two elements, normally noun
  phrases, are placed side by side, with one element serving to identify
  the other in a different way. The two elements are said to be in
  apposition. One of the elements is called the appositive, although its
  identification requires consideration of how the elements are used in
  a sentence.

You can visit the link and read it to understand further how it works.


How to calculate luminosity in g-band from absolute AB magnitude and luminosity distance?

Question: How can I calculate the (non-bolometric) luminosity $L$ of a galaxy (or a star for that matter) over a given band from its AB apparent magnitude $m_{AB}$ over that band and its luminosity distance $d_L$?
For instance, consider the g-band which typically has a $\lambda_{eff} = 467 \text{ nm}$ and a $\Delta \lambda = 100 \text{ nm}$. Given this galaxy has an apparent AB magnitude of $m_g = 22.5$ and luminosity distance of $1991 \text{ Mpc}$ (i.e. $z = 0.355$ if you are curious), what is its luminosity? I know I shold use the following equation, but I don't know what value to pick for $M_\odot$.
$$L/L_\odot = 10^{0.4(M_\odot - M)}$$
I tried 5.12 from a website which is the value of $M_\odot$ in g-band but it gives me a different answer compared to when I calculate luminosity using flux:
$$L = 4 \pi d_{L}^2 f_\nu \Delta \nu$$
where $f_\nu$ is flux density and $\Delta \nu$ is the frequency width of the band (this is an approximation to the integration over frequency, assuming bands are step functions). So, how can I find luminosity using absolute magnitude?
Please provide your references.
Comment: How different were your two answers?  In addition, 100nm is a pretty wide band to assume uniform flux density.
Comment: You are confused. $L$ is usually reserved for a luminosity integrated over all wavelengths. This *cannot* be calculated simply from the g-band magnitude and distance without knowing more about the galaxy.
Comment: @CarlWitthoft, I get magnitude wrong by 1.
Comment: @RobJeffries, In the above question L is the luminosity over the g-band. And it doesn't matter if the flux is not constant because a telescope measures the average flux over a band. So, in this question, L is the luminosity over the g-band and it is not equal to total luminosity and I have made my notation clear by stating "non-bolometric luminosity". Feel free to edit it to $L_{g-band}$.
Comment: Then what are $L_{\odot}$ and $M_{\odot}$ supposed to be? These have very clear defined meanings, and they are bolometric quantities. You also need to tell us what flux (density) and $\Delta \nu$ you used if we are meant to be looking for errors.
Comment: @RobJeffries, $L_\odot$ is a constant equal to $3.848 \times 10^{26}$ W. $M_\odot$ on the other hand, should be band dependent. What's its value then? That's my question! I have stated $\Delta \nu$ and $f$ can be calculated from $m_g$.
Answer: Here is my attempt to reconcile your calculations.
If the AB g-band apparent magnitude is 22.5, then the flux density in the g-band is given by
$$f_{\nu} = 10^{(-48.6-22.5)/2.5} =  3.63 \times 10^{-29}\ {\rm erg\ cm}^{-2} {\rm s}^{-1} {\rm Hz}^{-1}$$
If the distance is 1991 Mpc, then the absolute g magnitude is
$$ M_g = m_g - 5\log d + 5 = -19.0$$
The absolute AB magnitude of the Sun in the g-band (from your source) is 5.12.
The latter tells us that the ratio of the "g-band luminosites" of the galaxy and the Sun are given by
$$\frac{L_g}{L_{\odot,g}} = 10^{0.4(M_{{\odot},g} - M_g)} = 4.45\times 10^{9}$$
One cannot say more than this, in particular one cannot calculate the luminosity of the galaxy, without knowing more about its spectrum.
Also note that the equation above cannot be used to find the ratio of flux in one band to bolometric flux, as I think you are trying to do. To see this, consider that the absolute V-band magnitude and bolometric magnitude of the Sun are almost the same. This does not mean that all the flux from the Sun emerges in the V band!
Your second method requires a figure for $\Delta \nu$, but you haven't said what you have used. The g-filter has a width of around $\Delta \lambda =100$ nm. Using $\lambda \nu = c$ we can say
$$ \Delta \nu  = |c\Delta \lambda/\lambda^2| = 1.28\times 10^{14}\ {\rm Hz}$$
$$ L_g = 4\pi d^2 f_{\nu} \Delta \nu = 2.2 \times 10^{42} {\rm erg/s}$$
The two figures would agree precisely if the "g-band luminosity" of the Sun were $4.9 \times 10^{32}$ erg/s, or in other words if 13% of the solar luminosity emerged in the g-band as defined above. This does not sound unreasonable, but requires a detailed integration of the solar spectrum over the actual g-band filter profile.
Additional: Just to check the numbers above, we can estimate the flux density of the Sun (in wavelength units, above the atmosphere) to be about 1.7 W m$^{-2}$ nm$^{-1}$ at 467 nm (just search on 'solar spectrum' for many examples) at a distance of $1.5 \times 10^{11}$ m. Putting these numbers together, I calculate a "g-band luminosity" for the Sun of
$$ L_{\odot,g}=4\pi d^2 f_{\lambda}\Delta \lambda = 4.8\times 10^{32}\ {\rm erg/s} \ ,$$
which is indeed 13% of the solar bolometric luminosity, and thus
$$\frac{L_g}{L_{\odot}} = 0.13\times 4.45\times 10^{9} = 5.79\times 10^8\ .$$
Comment: 13% is too much. This is supposed to be exact since it's almost doing the same calculation with two different methods. I suspect that $L_g$ via flux is correct given we use luminosity distance (distance adjusted for redshift), but further adjustments are needed to use magnitude and we might not be fine using $d_L$ for both methods. I guess what I'm saying is the problem might be due to redshift, but I have to think about it more.
Comment: Also, people don't do $L_g/L_{\odot,g}$, they just do $L_g/L_{\odot}$ which is just an assumed constant of $3.848 \times 10^26$ W. The point is unit having simple units not comparison necessarily.
Comment: @Miladiouss on what basis do say that 13% is too much? The "flux" method is not exact, since you apparently don't know the galaxy spectrum and assuming a top hat filter function is incorrect.


Type of analysis for water

Question: What other analysis suitable for water as general? Right now, I have turbidity, pH, Total Soluble Solid and color.
Answer:
Hardness
TC Total Carbon

TIC Total Inorganic Carbon
TOC Total Organic Carbon
VOC Volatile Organic Carbon

COD Chemical Oxygen Demand
BOD Biochemical Oxygen Demand
Comment: Also trace metal concentrations, disinfectant byproducts, fluoride, nitrite, nitrate.  I'm kind of presuming drinking water with these though.
Comment: @anonymous My pleasure. If the anwer was really helpful, please consider to [accept](http://chemistry.stackexchange.com/help/someone-answers) it.
Comment: @airhuff Absolutely! I only listed  some parameters for which wikipedia pages with further explanation exist.

Type of analysis for water


Problem rendering multiple smoke textures

Question: I have figured out what was wrong with the smoke, I could render it but I could not see it but it was there just the same, thank you. Now when I try and render two different smoke colors they both come out the same. I have gone into the compositor and created two different settings but I cannot apply them, also when creating two separate domain boxes and two emitters they only take one setting. I have tried to put them on separate layers but this does not work either, I do not want to go into the video sequence editor as this is long. Is there a solution for this?
Comment: Well, not very clear... Did you create 2 distinct materials for your 2 distinct smokes ? I recommend you to be more specific in your question... Send some screenshots, etc.
Comment: I still suspect that you are using shared datablocks. Make sure that materials are all single-user. All textures are single-user, and all smoke systems are single-user.
Comment: Yes I did create 2 distinct materials and 2 different smokes, I thought I'd make that clear when I wrote "and created 2 different settings in the composition node editor". Even with 2 different settings and 2 different colours, both smoke generators take on one colour.  I cannot get Blender to treat the 2 differently ie asign the composition node editors to the 2 seperate smoke generators.  Screen shots to follow........thanks
Answer: It sounds like your materials or your textures or your caches are linked. You can check this by changing one setting for Smoke A and see if it applies for Smoke B. If so, then your issue is linking.
To get rid of the link, click the button with the number on it next to the material and texture. That should fix it.


Can Windows 10 notifications be forwarded to another computer?

Question: I have a home server running Windows 10 Pro. Since there isn't an active monitor attached to it most of the time, I don't tend to find out about any notifications until I remote desktop to it for another reason (e.g. I didn't see the Anniversary Edition upgrade notification for a few months after it was available - well after I'd forgotten it had already been applied to my other computers).
Is there a way to forward any notifications generated (such as updates ready to install) to another computer?
Answer: I think this will work Growl for Windows
Comment: I *very* much doubt this would forward Windows 10 notifications.