Applying Bayes: Estimating a bimodal distribution

Question: I'm trying to estimate a bunch of bimodal distributions, i.e. two means and two standard deviations, based on a variable number of inputs. If no input is present, a constant value should be returned. From my anecdotal knowledge of what Bayes is about, this should be exactly it, no? Adapt a prior based on incoming evidence. My question is, though, how would I go about that in detail? Maybe I'm just missing a good tutorial somehow.
Answer: EM algorithm
In response to @Daniel Johnson, I want to quickly show you how you can fit the EM algorithm in R. Use the package mixtools (click for a link). Then, you can use the normalmixEM function with the option k=2 to estimate the parameters of a two-component gaussian mixture distribution. Let's make an example:
# Let's look at the old faithful data

library(mixtools)

data(faithful)
plot(density(faithful$waiting), las=1, col="steelblue", lwd=2, main="")

The distribution is clearly bimodal, so we're gonna calculate a mixture model with 2 components (k=2):
out <- normalmixEM(faithful$waiting, k=2, epsilon = 1e-03, fast=TRUE)

summary(out)

summary of normalmixEM object:
          comp 1    comp 2
lambda  0.361283  0.638717
mu     54.628096 80.099412
sigma   5.882584  5.859425
loglik at estimate:  -1034.002

The first normal distribution has an estimated mean of $54.6$ with a standard deviation of $5.88$, the second a mean of $80.1$ with a standard deviation of $5.86$. This corresponds nicely to the peaks in the graph above.

Bayesian methods
To estimate the mixture models with Bayesian methodology, use the bayesmix package for R (click here for link). You'll need to install JAGS on your computer first, though (just download the exectuble file and install it). To illustrate its use, I re-run the above example of old faithful data. I choose independent (option independence) and uninformative priors (option priorsUncertain). Further, we run 10000 MCMC samples (option n.iter=10000) and discard the first 1000 as burn-in samples (option burn.in=1000):
library(bayesmix)

data(faithful)

bayesmod <- BMMmodel(faithful$waiting, k=2, priors=list(kind = "independence", parameter = "priorsUncertain", hierarchical = NULL)) # k=2 for two components

jcontrol <- JAGScontrol(variables = c("mu", "tau", "eta", "S"), burn.in = 1000, n.iter = 10000, seed = 10)

z <- JAGSrun(faithful$waiting, model = bayesmod, control = jcontrol, tmp = FALSE, cleanup = TRUE)

zSort <- Sort(z, by = "mu")

zSort

The model output is ("mu" denotes the estimates of the means and "sigma2" the estimates of the variances):
Markov Chain Monte Carlo (MCMC) output:
Start = 1001
End = 11000
Thinning interval = 1

 Empirical mean, standard deviation and 95% CI for eta
         Mean     SD   2.5%  97.5%
eta[1] 0.3622 0.0318 0.3013 0.4251
eta[2] 0.6378 0.0318 0.5749 0.6987

 Empirical mean, standard deviation and 95% CI for mu
       Mean     SD  2.5% 97.5%
mu[1] 54.63 0.7365 53.25 56.12
mu[2] 80.08 0.5128 79.02 81.05

 Empirical mean, standard deviation and 95% CI for sigma2
           Mean    SD  2.5% 97.5%
sigma2[1] 36.11 7.209 24.61 52.76
sigma2[2] 35.38 5.066 26.90 46.34

The estimated means are $54.63$ and $80.08$ with standard deviations (square roots of the variances "sigma2") of $\sqrt(36.11)\approx 6.01$ and $\sqrt(35.38)\approx 5.95$. This is very close to the estimates we've calculated with normalmixEM.
Answer: I think "A Gentle Tutorial of the EM Algorithm
and its Application to Parameter
Estimation for Gaussian Mixture and
Hidden Markov Models" is exactly what you're looking for. Particularly the third section: Finding Maximum Likelihood Mixture Densities Parameters via EM.
Comment: thanks. not sure I want to see the non-gentle introduction though :)


What place is around me

Question: Hi i wish to develop an app that will notify me important place( say restaurants, shopping mall etc) name.
Lets say i have latitude, longitude( get from GPS ) and radius. With this value i shall pick desired place ( mentioned earlier )from Google maps and shall show this data in a list view .

In the image...

green circle denotes my location( latitude, longitude )
pink rectangle denotes desired place to be pick from Google map
and a big circle  limit the area around which my desired place will rest on.

Now my question is how to collect this data( places name ) that rest inside the big circle.
Below is the image that shows the collected data in a list view.

[Sorry for my bad writing]
Answer:
Develop an app that will notify me important place

Have a look at the Google Places api.

Now my question is how to collect this data( places name ) that rest inside the big circle.

Now this depends on the places you find relevant. Here is the complete list of supported places

big circle limit the area around which my desired place will rest on

You can specify the search radius as a parameter.

What place is around me


Where are the sources for LaTeX3 development in TeX Live?

Question: I'd like to take a look at the sources for some of the LaTeX3 development to model after, but I'm having trouble finding them.  Where might I find the sources for texdoc interface3, texdoc xparse, and the like?
Comment: ultimate source is  http://www.latex-project.org/svnroot/experimental/trunk/
Answer: As with any other material in TeX Live, the sources are available inside the source tree. You can find them by using kpsewhich with the appropriate .dtx file name, thus for example kpsewhich xparse.dtx will give
<TL-install-root>/texmf-dist/source/latex/l3packages/xparse/xparse.dtx

In the case of interface3/source3, life is a bit more complex as this is constructed from all of the .dtx files for l3kernel. There are a few .tex files which do this, and these are currently uploaded in the doc subtree, so inside
<TL-install-root>/texmf-dist/doc/latex/l3kernel

As David mentions in a comment, you can access the SVN repository via the team website, or the (perhaps nicer) GitHub mirror if you are willing to risk being a few commits behind the burning edge (synch is currently once-per-hour with the SVN on a script running on the latter server).
Comment: Dang, I was so close too! I had tried `kpsewhich`, but I wasn't adding the extension (doing just `kpsewhich xparse`) which was giving me nothing.  :-)
Comment: @AntonKochkov There better not be! We've got a two-way mirror and to my knowledge it works fine. There are a couple of commits that ended up not showing in `trunk` (the Git side did a branch and I missed it before syncing), but they are all there at the top level.
Comment: Looks like GitHub one is not a mirror anymore - see actual commits in git missing in the subversion repository.
Comment: Just to be clear, to see all of the SVN go to http://www.latex-project.org/svnroot/experimental/ (missing off the `trunk`), though good luck working back through the interface there. I'd suggest instead using the Git version, and getting the SVN revision numbers using the data added by SubGit (basically add `fetch = fetch = +refs/svn/map:refs/notes/commits` to your `.git/config` in the `[remote "origin"]` part)


Migrate contents from Ning forum to Drupal forum?

Question: Does anybody know an effective way to transfer forum conversations from Ning to Drupal?
I have the .json obtained through Ning Network Archiver tool, I searched around but didn't find anything.
I am using Drupal version 7.
Answer: You can create a module in drupal 7 that will take the json data and create nodes programmatically.
Example:
<code>// Instantiate new node
$node = new stdClass();
node_object_prepare($node);
$node->uid = 1;
$node->name = 'my author';
$node->language = LANGUAGE_NONE;

// Set fields
$node->title = 'my title';

// Set custom fields
$node->field_custom[$node->language][0]['value'] = 'my custom value';

// save
node_save($node);
</code>
Answer: Take a look at the Migrate module (http://drupal.org/project/migrate/).
I'd say that's better than rolling your own module since you get a lot of stuff for free, for example automatic rollback support and such. You just need to define a mapping and a datasource (json, xml, database, etc).
The migrate module takes care of the actual node creation and keeps track of what has been imported so that you can undo it later, re-import new posts, etc.
A good example of the migrate module can be found at http://xdeb.org/node/1539. It does however deal with regular pages and the datasource is a drupal 6 database.


Asymptotic approximation of the expression $\sum^{N}_{i=0}\log\Bigg[\binom{\binom{N+1}{i}}{t_i}\Bigg]$

Question: I am wondering about the asymptotic approximation of the following expression:
$$S=\sum^{N}_{i=0}\log\Bigg[\binom{\binom{N+1}{i}}{t_i}\Bigg]$$
where
$$t_i=\binom{N}{i}-\binom{N-k}{i-k}+\binom{N-k}{i-1}$$
where $k$ is a positive integer. Also we have that $k\ll N$. Also for those binomials that have $i<k$ (namely negative) we count them as zero. I am trying to work out the approximation for $N \rightarrow \infty$.
Comment: You've posted variants of this over the last few weeks, and no one's biting.  I like asymptotics, but I won't attempt it because there are three variables.  Even 2 can be very difficult and often one parameter has to take on a 'small,' 'mid' and 'large' case analysis.  If you are summing over one of the three variables, it would be better to show the full problem and there's a ghost of a chance someone might be interested.
Comment: Why are you wondering about this sum? In what context does the sum of a logarithm of a binomial coefficient of binomial coefficients arise?
Comment: @skbmoore I know that this looks like a horrendous sum to be solved, hence I posted variations of it. The sum is over $i$ which appears in many terms unfortunately. The only constant is $k$ which can be fixed to a +ve integer bigger than 1 if it is of any help. I think the real issue is how to simplify the $t_i$ first, I tried various ways, to write of as leading Stirling approximation / in terms of factorials yet those are not so helpful. The expression $S$ is indeed the original problems, previous posts were my attempt to simplify it.
Comment: @AntonioVargas It is a counting problem, this problem came up when I want to calculate some information content.
Comment: An approximation for $k=2$ is the following: let $\eps=1/4(\sqrt{(1+4/n)}-1)$ and $w(u)=u(2u+1)-1/(2n).$  Call your sum, but with $n=N+1, S(n).$ Then $$ S(n)\sim -2^n \sqrt{\frac{2n}{\pi}} \int_\eps^1/2 \exp{(-2nu^2)}(w(u)\log(w(u)+(1-w(u))\log(1-w(u))\,du $$  Can't make it rigorous and I shudder to think what happens for variable $k.$  The integral rep is about 1% accurate for $n=100.$
Comment: Thank you @skbmoore. Just as an opinion do you think it would be sound if one does such approximation for various values of k, for instance 2,3,4... and then try to see if the approximations make a recursive pattern?
Comment: also how did you come up with the $\eps$ and $w(u)$? it looks neat
Comment: I botched the comment.  I tried to type in the result before leaving for work.  It may be next week before I can get a quasi-proof ready.
Comment: That still be appreciated @skbmoore
Answer: Here are the asymptotics and a method for $k=1$ through $k=4.$  Unfortunately there does not appear to be a simple pattern developing. Also, I'm using $n=N-1.$
$\textbf{k=1} $
$$S_1:=\sum_{m=0}^n \log{ \Big[ \binom{\binom{n}{m}}{ \binom{n-1}{m}} }\Big] = \sum_{m=1}^{n-1} \log{\Big[ \binom{\binom{n}{m}}{ \binom{n}{m}(1-m/n)    } }\Big] $$
The sum starting and ending value has been shifted by 1 towards the center because those end values within the square bracket are 1, and $\log(1)=0.$  Use the 'central value' estimate for the binomials,
$$ \binom{n}{m} \sim \binom{n}{n/2} e^{-\tfrac{2}{n}\big(\tfrac{n}{2}-m\big)^2 } .$$
Note: I haven't justified that this is sufficient other than numerically.  Use the asymptotic expansion for $\log{\Gamma(1+x)},$
$$ \log{\Gamma(1+x)} \sim x\log{(x/e)} + \log{(\sqrt{2\pi x})} + ...$$
Only the first term of the previous will be used when estimating $S_1.$  In thefollowing let $a=\binom{n}{m}$ and $y=m/n.$ Then
$$ S_1 \sim\binom{n}{n/2} \sum_{m=1}^{n-1} e^{-\tfrac{2}{n}\big(\tfrac{n}{2}-m\big)^2 } \big\{
\log{(a/e)}-(1-y)\log{(a\,(1-y)/e)}-y\log{(a \,y /e)} \big\}$$
The $\{\cdot\}$ simplifies so that it is independent of $a,$
$$ \{\cdot\} = H(y):=-\big(y\,\log{y} + (1-y)\log{(1-y)} \big) $$
Therefore
$$ S_1 \sim\binom{n}{n/2} \sum_{m=1}^{n-1} e^{-2n\big(\tfrac{m}{n}-\tfrac{1}{2}\big)^2 } H(m/n)$$
In the limit that $n$ is large, interpret the previous expression as a Riemann integral:
$$ S_1\sim\binom{n}{n/2} \, n\, \int_0^1 e^{-2n\big(u-\tfrac{1}{2}\big)^2 }
H(u) \,du = \binom{n}{n/2} \, n\, \int_{-1/2}^{1/2}
 e^{-2n\, u^2} H(w_1(u)) \,du$$
where $w_1(u) = 1/2 + u.$  One may expand  $H(w_1(u))$ in a power series about $u=0,$ extend the limits on the integral to $ \pm \infty $ so to use Gaussian integrals to get a close form, and expand the leading binomial and $n$ factor to finally get
$$S_1 \sim 2^n\big(\log{2} - \frac{\log{2}+2}{4n} + o(1/n) \big) $$
For the other results, a polynomial associated with the index $k$ has been determined.  That is, the results will be expressed as
$$\quad (A) \quad S_k\sim\binom{n}{n/2} \, n\, \int_{-1/2}^{1/2} e^{-2n\, u^2} H(w_k(u)) \,du$$
$\textbf{k=2:} \quad w_2=\frac{1}{2}+\frac{3}{2}u - 2 u^3 $
$\textbf{k=3:} \quad w_2=\frac{1}{2}+\frac{3}{2}u - 2 u^3 $
$\textbf{k=4:} \quad w_2=\frac{1}{2}+\frac{11}{8}u - u^3 - 2u^5 $
That the $k=2$ is the same as the $k=3$ case is not a typo.
There are three sources of error so far unquantified: the central binomial approximation, the dropping of subsequent terms in the $\log{\Gamma}$ expansion, and the error in going from a sum to the integral.  Another error will appear when $k$ gets appreciably large with respect to $n:$ One continues to 'pinch' the ends of the integral and the simple Riemann integrals presented will need corrections.  This approach may completely fall apart if $k = \alpha n$, with, say, $\alpha \ge 1/10.$
The following is a comparison of values as calculated by the original definition, and by eq. (A).  Multiply the entry by the scientific notation designator indicated in the table.
$$
\begin{array}{c|lcr}
k & S_{16} & S_{16}^{A} & S_{100}  & S_{100}^{A} \\
{} & \quad \cdot 10^4    & & & \cdot 10^{29}  \\
\hline
1 & 4.325 & 4.263 & 8.723 & 8.701 \\
2 & 4.040 & 4.045 & 8.642 & 8.624 \\
3 & 4.038 & 4.045 & 8.642 & 8.624 \\
4 & 4.088 & 4.098 & 8.666 & 8.645
\end{array}
$$
To me it appears that the values depend weakly on $k$ and an insistence that the asymptotic formula is accurate for these distinctions means that those errors mentioned previously need to be dealt with.


Scale a game object to Bounds

Question: I'm trying to scale a lot of dynamically created game objects in Unity3D to the bounds of a sphere collider, based on the size of their current mesh. Each object has a different scale and mesh size. Some are bigger than the AABB of the collider, and some are smaller. Here's the script I've written so far:
private void ScaleToCollider(GameObject objectToScale, SphereCollider sphere) {
    var currentScale = objectToScale.transform.localScale;
    var currentSize = objectToScale.GetMeshHierarchyBounds().size;

    var targetSize = (sphere.radius * 2);

    var newScale = new Vector3 {
        x = targetSize * currentScale.x / currentSize.x,
        y = targetSize * currentScale.y / currentSize.y,
        z = targetSize * currentScale.z / currentSize.z
    };

    Debug.Log("{0} Current scale: {1}, targetSize: {2}, currentSize: {3}, newScale: {4}, currentScale.x: {5}, currentSize.x: {6}",
        objectToScale.name, currentScale, targetSize, currentSize, newScale, currentScale.x, currentSize.x);

    //DoorDevice_meshBase                   Current scale: (0.1, 4.0, 3.0), targetSize: 5, currentSize: (2.9, 4.0, 1.1), newScale: (0.2, 5.0, 13.4), currentScale.x: 0.125, currentSize.x: 2.869114
    //RedControlPanelForAirlock_meshBase    Current scale: (1.0, 1.0, 1.0), targetSize: 5, currentSize: (0.0, 0.3, 0.2), newScale: (147.1, 16.7, 25.0), currentScale.x: 1, currentSize.x: 0.03400017

    objectToScale.transform.localScale = newScale;
}

And the supporting extension method:
public static Bounds GetMeshHierarchyBounds(this GameObject go) {
    var bounds = new Bounds(); // Not used, but a struct needs to be instantiated

    if (go.renderer != null) {
        bounds = go.renderer.bounds;
        // Make sure the parent is included
        Debug.Log("Found parent bounds: " + bounds);
        //bounds.Encapsulate(go.renderer.bounds);
    }
    foreach (var c in go.GetComponentsInChildren<MeshRenderer>()) {
        Debug.Log("Found {0} bounds are {1}", c.name, c.bounds);
        if (bounds.size == Vector3.zero) {
            bounds = c.bounds;
        } else {
            bounds.Encapsulate(c.bounds);
        }
    }
    return bounds;
}

After the re-scale, there doesn't seem to be any consistency to the results - some objects with completely uniform scales (x,y,z) seem to resize correctly, but others don't :|
Its one of those things I've been trying to fix for so long I've lost all grasp on any of the logic :| Any help would be appreciated!
Answer: First idea:
Rescale each object to (1.0, 1.0, 1.0) before applying your algorithm. But then I thought that maybe the objects look good when they are non-uniformly scaled to begin with.
Second idea:
I think that the problem is that the algorithm is mixing scale and size values. If your var newScale = new Vector3(...) code only works for uniform scales of 1.0, then the currentScale.<x/y/z> parts in it could be replaced by 1.0 which means that they are effectively doing nothing.
Suggestion (which I haven't tried):
Calculating the targetSize / currentSize (for each of x,y,z) will give you the newSizeRatio for each dimension. Take the minimum of them and multiply the scale vector by it:
float newSizeRatioX = targetSize.x / currentSize.x;
float newSizeRatioY = targetSize.y / currentSize.y;
float newSizeRatioZ = targetSize.z / currentSize.z;

float minimumNewSizeRatio = Math.Min(newSizeRatioX, Math.Min(newSizeRatioY, newSizeRatioZ));

Vector3 newScale = currentScale * minimumNewSizeRatio;

I believe this will work because:

Multiplying all dimensions with the same ratio will probably produce a uniformly scaled object.
Multiplying with the minimum ratio will guaranty that the object will fit inside the circle.

I hope this works :-)
Comment: Hey vrinek! Thanks for your reply.

I actually sorted this about 2 hours after I posted this (and forgot to come back and update it!). I will post my solution, but it's similar to your last example - everything now resizes correctly, and in addition I've applied a reduction factor too - so I can resize to 50% (opr whatever) of the sphere radius.
Answer: use a mesh collider instead !
i just had the same problem.
but then i just used a mesh collider instead of a sphere collider and the problem almost solved itself
just be sure to update the mesh collider shared mesh as well:
var meshInstance = Instantiate(meshes[type]);
gameObject.GetComponent<MeshFilter> ().mesh = meshInstance;
gameObject.GetComponent<MeshCollider> ().sharedMesh = meshInstance;

Scale a game object to Bounds


Big and large: why is it not correct to say 'big cappuccino'?

Question: Big and large have similar meanings but in some cases, they are not interchangeable. Is it right that one of such contexts is when speaking about drinks and containers for liquids? For example, a latte or a mug can be large but not big. Why?
Comment: In other words, there is nothing grammatically incorrect in saying **a big cup of coffee**; it's just that the standard expression used for portion sizes in cafe price lists happens to be **large**.
Comment: Cups - Mugs

IKEA https://www.ikea.com › ... › Coffee & tea - cups - mugs - No matter what hot beverage you fancy, whether it's a small espresso, **a big latte** or just a nice cup of tea, we'll have the perfect one for you.
Comment: Big Bottles of Champagne, Prosecco & Vodka | Big Bottles

bigbottles.co.uk  https://www.bigbottles.co.uk In most cases many of the bottles are available with free delivery. Celebrate your next occasion with **a big bottle**, perfect for you or a loved one!
Comment: T Bone Steak

Strachan Craft Butchers  https://www.strachancraftbutchers.co.uk › shop › t-bo...
The T-Bone Steak offers you the Fillet Steak on one side of the 'T', and Sirloin Steak on the other. This is **a BIG steak for BIG appetites**.
Comment: https://www.greige.co.uk › products › Nordic Sea Large Cup and Saucer - These gorgeous squat cup and saucer sets are perfect for **a big cappuccino** or large cup of tea. Each piece is totally unique in tones of blue-grey-green.
Answer: Formally, 'large' only ever refers to physical size, whereas 'big' can refer to both physical and non-physical things (eg "big ideas"). So, there may perhaps be a belief that 'big' can be subjective.
In answer to your question though, there is no particular 'rule' about which to use for food and drink. You can have a large drink with your Big Mac, for example.
There is perhaps a desire for standardisation in retail - if one food chain does a 'large' size then perhaps the others feel they should offer the same? There is a trend for coffee chains in the UK to market drink sizes with Italian words - for example, Starbucks has used 'grande' and 'venti'; some complain that this is unclear. One burger chain, Wendys, used to call their upsized fries 'Biggie' and 'Great Biggie' until they changed to 'large' and 'extra large' sometime around 2006 (in my territory at least).
Comment: I would argue that "Big Mac" isn't a very convincing example of usage of the word 'big' (versus 'large'), though.
Comment: @Aer as I said, both are fine... 'big' sounds more subjective and less formal - but that might be how you want to say. Saying "I had a big cappuccino earlier" might be a better way of expressing that it was larger than you expected or larger than you might normally drink. Saying "I had a large cappuccino" is just a repeat of your order.
Comment: I had a big hamburger, not one of those rinky-dink sliders.
Comment: Thanks! Trends influencing word choice obviously exist. However, what about your intuition about saying 'a big cappuccino'? Does it sound okay or you can't help but suggest changing the adjective to _large_?
Answer: Langeek explains the differences and similarities between big and large.

Both of these words can be used to refer to an object's size.  However, 'large' is more formal, and 'big' is more common in everyday conversations.

When we want to talk about the size of clothing, we use 'large', not 'big'.

When we want to refer to an important issue or problem we must use 'big', not 'large'.

When we want to talk about the amount of something, we must use 'large', not 'big'.

This applies to the OP's example.  We say large latte.
As for mug size, both big and large are used.
Comment: All true, but the OP is asking "why?" and as a native UK English speaker I have no idea whatsoever!
Comment: I think formality is the answer for coffees. "Large" sounds classier.
Comment: " However, whenever we are referring to some other things like the importance of issues, clothes, etc." (Langeek) - this is [demonstrably](https://dictionary.cambridge.org/example/english/big-problem) wrong.
Answer: Essentially, big is for things you can measure. For example, I have a big shirt.
This gift is quite a big one.
However, large is for non-measurable items, just like much is instead of many.
For Example:
I am having a large amount of milk.
You are eating a large portion of food.
However,
Sometimes they are interchanged like:
That is a large essay (you can count how many words are in an essay)
Overall, English is a complicated language and is all the languages combined.
You need to speak English with other people to slowly understand the ins and outs of the language.
Comment: If somebody told me they were writing a big essay, I would think they meant it was important (worth a lot of marks), rather than anything to do with its length.


What's the difference between Partial and Slot in Symfony?

Question: The two concepts Partial and Slot seem the same for me. Both of these two features replace placeholders in template with actual markup.
When should I use Partial and when should I use Slot?
Answer: The major difference between slots and partials is that the rendering for a given slot resides within a certain template. In opposite, the partial is merely an include of a template into another template.
"Basically, a slot is a placeholder that you can put in any of the view elements (in the layout, a template, or a partial). Filling this placeholder is just like setting a variable. The filling code is stored globally in the response, so you can define it anywhere (in the layout, a template, or a partial). Just make sure to define a slot before including it, and remember that the layout is executed after the template (this is the decoration process), and the partials are executed when they are called in a template."
Examples of ways of using each are:

Title for your page  - would probably be placed in a slot (or in the title helper), and you would then in your layout check whether the slot was defined and then show it.
Sidebar items - say you have 3 sidebar "slots", you would then have three slots, for example 'sidebar-1', 'sidebar-2' and 'sidebar-3'. In your template you would then define the slot, which could be rendered using a partial (or even a component) if you wanted.

I hope that clarified it a bit.
Answer: A partial comes from a file:
include_partial('thing', $params) will include _thing.php with $params in it's scope.
Slots are not files, but set somewhere else in the template/controller:
slot('title', 'Home Page');
echo '<title>'.slot('title').'</title>'
Answer: All you need to know is the Symfony cheat sheet View. Partials, components, slots and component slots (PDF, 45 KB).
Answer: You could think of a slot as an OO method definition. Your layout defines slots. The template extends the layout and fills those slots (by overwriting the methods). You can also have a default content for a slot, which is displayed when it's not overwritten.
Partials on the other hand would be like composition. They are a reusable component that templates can access. Roughly they are the equivalent of a simple include statement, but you pass in the variables it uses.
This page does a pretty good job at explaining the concepts: http://www.symfony-project.org/book/1_2/07-Inside-the-View-Layer


Why children's lives matter more?

Question: In a life threatening situation where you can save only a limited number of people the ones saved first are always children and women. Why is that the case that children and women lives are worth more ? Is there a reasoning behind this ?
Comment: Welcome to SE Philosophy! Please be aware that questions are subject to editing and closure, and that reflects the site's policies on acceptable questions and NOT a personal attack. [What to avoid in questions](http://philosophy.stackexchange.com/help/dont-ask). Questions, including those that are closed, can be edited to bring them within guidelines. [Keeping questions on-topic](https://philosophy.stackexchange.com/help/on-topic). Additional clarification at [the meta site](https://philosophy.meta.stackexchange.com/).
Comment: Evolution predisposes us to biological and psychological altruism. I'd start with Edward O. WIlson's _On Human Nature_ and look into [sociobiology](https://en.wikipedia.org/wiki/Sociobiology) as well as [evolutionary psychology](https://en.wikipedia.org/wiki/Evolutionary_psychology), and ignore pretentious and sweeping metaphysical speculation on the topic.
Answer: Higher level reasoning is not needed here.
You treated people as 3 categories viz., men, women and children. But for a moment you forgot that children include boys and girls.
Among these 3, men are comparatively stronger and so capable to save themselves. When we save children we are saving the next generation. So we give first importance to children's lives in such situations.
Another reason is related to their innocence.  When we compare these three categories children are more innocent than the other two. So less chance for a threat. These last two reasons, though you may find it negligible/nonsense, also affect as a motive force.
Answer: A practical example
You have a ship and not enough life boats to save everybody, your only hope is finding an island to colonize with the survivors...
A: What would be more effective to reproduce? 1: 10 men and 50 women or 2: 50 men and 10 women?
Simply said 1, because 50 women can be pregnant at the same time by 1 man for every 5 women, but 10 woman can't be pregnant at the same time by 10 men each. So to get a larger population in a shorter time the ratio between men and woman is best in favor of women.
B: Able to survive without aid is something that can happen. An adult man would be more likely to be able to survive swimming to shore then let's say a 9 year old girl so by saving the girl you might end up having both while saving the man will at best only give you him. Also the people doing the saving usually survive as well allowing them to teach the young lings while older people will be more stagnant and unable to learn new skills (compared to children seeing they are able to adapt faster/better)
C: (Cultural) Honor, some cultures like the Germanic one for example believe that honor is their entry in to a good afterlife and also that it's a man's duty to protect their women so there is no "downside" in this scenario. While other men just feel like it's their duty out of personal reasons.

Why children's lives matter more?


My automatic transmission has a strange vibration/bumping in all gears when cold

Question: When I crank my truck for the first time in the morning, the rpm's bounce like something inside the transmission is randomly putting a load on the engine.  It does this in all gears including neutral until the engine warms up and then disappears entirely and drives normally.  I don't think it's engine related (I could be wrong), vehicle isn't throwing any codes, services are all up to date, and it runs great except for this weird behavior.
Vehicle is a 2001 Toyota Tundra w/ V8 and automatic.
Answer: Sounds like you either need to clean your throttle body, or there is an issue with the Idle Air Control Valve (IACV).  When the IACV is responsible for maintaining idle RPM.  When the engine is cold, the idle is higher, so the IACV needs to open more.  It is not uncommon for the port to become partially clogged.


How to hide a block for specific users using Views?

Question: I have a bunch of blocks that I would like to have hidden by default and only shown to specific users that will be determined by a view.
Is this possible? If so, how?
Answer: Under the block settings in views, there is an option called "access," which you can use to allow access based off of role (anonymous user, registered user, etc). If your users have specific user roles that you can filter off of, you can use this to do what your looking for.
Answer: Probably not the best way to go about this, as you really don't want to put logic in the theme... but if you are using some other way to single out users other than roles, you could always use a check in the theme to make sure the user should have the block displayed, if so, print the contents in views-view--myview.tpl.php.
Answer: Part 1:
Enable the Rules block visibility module. Here is a quote from its project page:

The Rules block visibility module allows Rules components to be used to control block visibility. This provides Drupal administrators and developers extreme flexibility in controlling when blocks should be displayed on their websites, in addition to the default visibility options provided by Drupal.
The general idea is that if you can do it with Rules, you can use it to control block visibility, so the possibilities are limitless:

Need to show a block only for users registered more than a month ago?

Perhaps you have a block that must be shown only between 8am-5pm on weekdays?

What about displaying or hiding a block based on current weather conditions?

All of this can be done by using Rules block visibility.

With that, and as per the "if you can do it with Rules, you can use it to control block visibility" above, you've reduced your question to making Rules intercept the actual user who's using the site, i.e. if it is YES or NO (a boolean, right?) a user with a uid that matches one of the users you're looking for.
Part 2:
Here is a Rules Component which you can use as an example (you should be able to import this rule in your own environment if you have the Rules UI enabled):
{ "rules_block_visibility_show_block_for_some_uid" : {
    "LABEL" : "Show block for some uid",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : {
      "module" : { "label" : "Module", "type" : "text" },
      "delta" : { "label" : "Delta", "type" : "text" },
      "result" : { "label" : "Result", "type" : "boolean", "parameter" : false }
    },
    "IF" : [
      { "data_is" : { "data" : [ "site:current-user:uid" ], "value" : "1" } }
    ],
    "DO" : [ { "data_set" : { "data" : [ "result" ], "value" : "1" } } ],
    "PROVIDES VARIABLES" : [ "result" ]
  }
}

What this Rules Component does is "only" return a boolean (1 or 0), based on the condition if the user's uid is YES or NO equal to 1. Adapt the value of the uid to fit your needs, and/or add other uids you'd need via an additional (OR) Rules Condition.
With that, we're coming close to an actual answer to your question.
Part 3:
Head over to the "Block" settings for the block you want to show only for the user with (eg) uid = 1. At the bottom of it's settings, within the typical "Visibility settings", there is now (after you enabled the Rules block visibility module as in Part 1) an extra tab labeled "Rules". Using that tab will allow you to select a "Rules Component" that will do what's documented below that selection list field, ie: "Show this block only if the selected rule returns a positive value. Important: to be listed here, a block visibility rule must have specific parameters and return values.".
All you have to do is to select the Rules Component from Part 2.
Note: it doesn't matter what type of block it is (created by a view, or something else), it works in all cases.


Can rocks be used to propel rockets?

Question: Can rocks and soil, or simply any other common form of matter with a mass, be vaporized in a nuclear thermal rocket at high temperatures to provide thrust for the rocket? Wouldn't that be convenient for interplanetary travel? What is so specific about liquid hydrogen that makes it commonly be used as the working liquid?
Comment: On Physics SE, we like to focus on only the physics and not the engineering of a specific question. Your last sentence "what is special about hydrogen [as rocket fuel]?" Would be an excellent stand-alone physics question. I recommend reposting and asking more generally about the physical choices that go into rocket fuel selection.
Answer: Any material at all can be theoretically used for thrust.  If you throw material out the back, your rocket gets pushed forward.  The big reason liquid hydrogen is used is because the specific impulse, which can be thought of as a proxy of fuel efficiency, is higher the faster your exhaust gas is moving as it's ejected.  Because hydrogen is the lightest element, the average atom of hydrogen in a volume at a certain temperature will be traveling faster than an atom of any other element at that temperature.  So this means hydrogen provides the best specific impulse, and thus is the most fuel efficient reaction mass.  Due to the tyranny of the rocket equation, fuel efficiency is extremely important, so other reaction mass options are usually ignored.  For a thermal rocket anyway; all bets are off if you're willing to include ion or photon drives.
Comment: By the law of conservation of momentum, does it really matter if the gas is heavier or lighter?
Comment: It's not the momentum of the exhaust gas that matters, it's the velocity that matters.  I don't think I can explain it any better than this wikipedia article: https://en.wikipedia.org/wiki/Specific_impulse#Specific_impulse_as_effective_exhaust_velocity
Maybe someone else has a more intuitive way to explain it.
Comment: @ChongLipPhang the thrust is the same, but the fuel you haven't burned is heavier and therefore is harder to get going.

Can rocks be used to propel rockets?


Can I used a Yongnuo YN-E3-RT to trigger a Shanny SN600EX-RF?

Question: I bought these ages ago for different reasons and am hoping they will work together, but I think the Shanny is a bit "Dumber" I've searched and searched, so now I'll show my ignorance and just ask. Anyone know?
Answer: The YN-E3-RT clones the Canon RT system and should be compatible with other devices that use the Canon RT protocol. There are a lot of reports from users that when trying to use two third party devices from different makers that both clone the RT system there can be issues with the two third party devices working together. The only real way to know for sure in that situation is to try it and see what happens.
The Shanny SN600EX-RF is not a Canon RT clone, though. It uses Shanny's own proprietary RF (radio frequency) protocol.
The only way to trigger the Shanny SN600EX-RF with Canon RT components is to use the Shanny in "dumb" optical slave mode and trigger it with the light from another flash. S1 slave mode is for use when the triggering flash is in manual mode and only fires once when the image is being exposed. S2 mode if for use when the triggering flash is in TTL mode and fires a fast series of pre-flashes before the exposure. The "dumb" slave flash set to S2 will hopefully ignore the pre-flash and fire when it detects the main flash pulse.I use "hopefully" because S2 mode can be a bit hit or miss, particularly if one is also using red-eye reduction and TTL which each have their own series of pre-flashes.
To use the YN-E3-RT on your camera to trigger the Shanny SN600EX-RF, you'd need another remote flash that is Canon RT compatible. You would control the RT flash with the YN-E3-RT and the flash burst from the RT flash would trigger the SHanny in "dumb" slave mode.
Or you could use any flash directly on the camera's hot shoe if the camera can trigger a non-Canon manual flash with a standard ISO compliant hot foot. Please be aware that a few of Canon's cheapest cameras, such as the Rebel T7/2000D and Rebel SL3/250D among a handful of others, no longer have ISO compliant hot shoes with a standard manual flash pin in the center of the hot shoe. For those cameras one would need to use a Canon TTL capable flash, even when desiring to use it in manual mode.
Another option would be to attach a Canon RT compatible receiver to the hot foot of the Shanny flash and set the flash like it is attached to a camera's hot shoe. The receiver attached to the flash will act like it is the camera as far as the flash is concerned. Your YN-E3-RT would communicate to the Rt receiver attached to the Shanny flash.


Split pea stew HELP!

Question: I am attempting to make split pea stew. It has cooked for a long time. The bag of split peas is new and it is organic. I did put lemon juice on the beef to tenderize it before the water boiled. Is this the culprit? It taste wonderful. They are a bit crunchy and edible but not as tender as I would like. Any way to make them more tender? Thank you in advance!
Comment: What's "a long time"?  Normal split pea soup takes 60-100 minutes for the peas to soften completely.
Answer: I suspect what's happened here is that the acid in the lemon juice has slowed the rate at which the split peas softened; you should be able to just continue simmering the stew (add more liquid if it's getting too thick) until the peas are properly softened.
For future reference, tenderising meat with an acid, like your lemon juice on your beef, is a practice that mostly makes sense for fast-cooking preaparations like steaks or chops done on the grill or in a frying pan; a slowly stewed piece of meat will get tender just by being stewed for long enough; any acid you want to add, e.g. just for flavour, you can add at the end after everything's already fully cooked and softened to your liking.
Answer: Salt and acids make it virtually impossible to cook the legumes soft. Any citrus or seasonings with salt in them have to be added only at the very end or the peas will not soften.
Comment: salt makes the skin of legumes stay intact and stretch rather than bursting and doesn't necessarily keep them from getting soft otherwise, but acid definitely does keep legumes from softening.

Split pea stew HELP!


How to keep a global db4o throughout the lifecycle of an android application

Question: We are developing an Android application that uses db4o for storing various objects throughout multiple activities and services. We are looking for the best approach on working with db4o and specifically when to open and close the db. We don't want to close the db after each single store operation and reopen it on every single retrieve operation because that could impact the speed of the application as opening and closing is hard on the processor. We prefer to keep a global state of the db4o that can be used throughout the app's lifecycle.
I was reading here
global db4o database for multiple activities
that is a good idea to keep the database on a Custom Application Object and get an instance when we need it:
<code>public class MyApplication extends Application {
    private volatile ObjectContainer container;
    @Override
    public void onCreate() {
        super.onCreate();
        // the application object is a regular Android context,
        // So you can get the required info`
        this.container = Db4oEmbedded.openFile(...)
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        // if something was not finished, better rollback
        container.rollback();
        container.close();
    }

    public ObjectContainer database(){
        return container;
    }
}
</code>
However, I realised that the onTerminate() method of the Application exists only for emulation purposes and is never executed on an actual phone. And my question is, if the onTerminate() is never called where should we close the db object, and was is the best strategy on opening and closing?
Answer: You can create Lazy load singleton instance in your application class and initialize(Open) it  in Launching Activity's OnCreate method and Close it inside onDestroy.


Safety when installing plugins on domains I don't own

Question: I developed a wordpress plugin entirely on localhost and tested it on a live server (CPanel) that I have full access to. What I'd like to know is what information I would need from a website owner if I were to install the plugin on their website? The assumption is that the website owner wants to give me as little information as possible, and I too don't want to expose myself to any liability beyond what I absolutely need to view to install the plugin for them.
Thanks
Answer: If thei hosting supports WordPress autoupgrade feature I don't see any reason of manually installing plugins. It can be done from admin cp there. If your plugin requires manual installation, then, probably, it is a bad plugin ;)
If you want to generate income from support, I am afraid, you will end up with requiring full access to hosting. And also you should know better than us what access will you need in order to support your plugin.
Answer: release your plugin under gpl, put your name as author make a small readme ant thats it.
Comment: I've already done that, streetparade. But I want to make income from paid install/support. That's what the question is about as you can see if you read it again.
Answer: Assuming the plugin is not released publicly, you will need a user account for their WordPress install and FTP acccess.
A better option might be step-by-step instructions, or releasing the plugin on codex.wordpress.org -- if it's available there, you can install it with only a WordPress administrator account, which they can then delete or disable once it's installed.


Event Horizon without black hole?

Question: I'm curious if a black hole is a necessary precondition for an event horizon.
Could you have an active star that's massive enough that it would create an event horizon even before it collapses?
Comment: how do you define "black hole"? it usually means "an object with an event horizon"...
Comment: @AccidentalFourierTransform so accelerating particles and the universe are also black holes?
Comment: @DilithiumMatrix sure, why not? it's astrophysics, no need to be precise ;-)
Answer: It isn't possible to have stable massive object with an event horizon around it.
The acceleration required to stay at a fixed distance $r$ from a spherically symmetric object can be calculated from the Schwarzschild metric. This is done in What is the weight equation through general relativity? but I'll just quote the result here:
$$ a=\frac{GM}{r^2}\frac{1}{\sqrt{1-\frac{r_s}{r}}} $$
Where $M$ is the mass of the object and $r_s$ is the event horizon radius. So it is just the Newtonian gravitational acceleration multiplied by the extra term of $1/\sqrt{1-r_s/r}$.
The problem is that as $r \to r_s$ the acceleration $a \to \infty$, that is to hover at the event horizon requires an infinite acceleration. As soon as you go inside the horizon you simply can't hover at all. Inside the horizon it is impossible to resist being dragged inwards towards the singularity.
And that's why there can't be a stable massive star inside the horizon. The forces between the atoms/ions/whatever that make up the star are not strong enough to resist it being crushed inwards to form a singularity.
The fate of a collapsing star can be approximately modelled by the Oppenheimer-Snyder metric. This is only approximate because it assumes a constant density inside the star, but it gives us a rough idea of what happens. The event horizon actually starts at the centre of the collapsing object and grows outwards until it is greater than the radius of the collapsing star. The star then goes on to form the singularity at the centre of the black hole.
Answer:
I'm curious if a black hole is a necessary precondition for an event horizon.

A black hole is a name for what an event horizon contains (in my limited understanding).

Could you have an active star that's massive enough that it would create an event horizon even before it collapses?

The problem would seem to be that fusion takes place in the core.  If mass was so great that an event horizon formed, the rest of the star would instantly be cut-off from the fusion generating core and it would immediately collapse anyway.  No fusion (outside the event horizon) means no energy to resist gravity.
I'm dubious that fusion could be said to happen in such a dense core anyway, as you're past the density at which fusion would have any meaning and into territory we don't fully understand (quark-gluon plasma and beyond I guess ?).
Answer: A black hole is defined by event horizon. What is inside EH, is black, and so black hole.
Terminology aside, to answer your question simply, and with an analogy - Possibly, yes, but momentarily even if it is possible.
Collapsing analogy - Suppose an object falls into a pre-existing event horizon. Now, there is an EH, but theoretically, the falling matter is still collapsing once it is past the EH. How long that collapse takes, I do not think any one can say for sure. That is why, I said momentarily.
As John Renee wrote, if the EH starts at the center, then, there is an EH while the star still looks like a star (not a BH) from outside for at least a moment. Can we say, there was no black hole when the EH started - NO! because, that is the terminology - Only EH defines the black hole. As EH was expanding, so was the BH.

Event Horizon without black hole?


Raspberry Pi image with a flash filesystem

Question: I search for a RPi-distribution, that uses a flash frienly filesystem (maybe f2fs) as filesystem.
Is there anything like this? I want to use the RPi as home-server, and I don't want to change my SD-Card every year,.....
Answer: Yes, the Nard SDK use f2fs for user data such as /home. However, the OS run completely from RAM and doesn't use the SD-card at all (other than during boot)... So there is no wear what so ever unless your custom application creates it.
Answer: This topic on the Raspberry Pi forum says that you have to wait for Raspbian to use kernel 3.6 for it to be F2FS. It does mention that the media OS OpenELEC is F2FS.


(ms4w) oracle spatilal problem of drawing compound polygon for Oracle 10g

Question: When i draw a compound polygon
SDO_GEOMETRY(
    2003,  -- two-dimensional polygon
    NULL,
    NULL,
    SDO_ELEM_INFO_ARRAY(1,1005,2, 1,2,1, 5,2,2), -- compound polygon
    SDO_ORDINATE_ARRAY(6,10, 10,1, 14,10, 10,14, 6,10)
  )
by using msw4 accompanied with mapserver 5.4 or the previous version, they are successful to create an image.
But when i change to msw4 3.0.6 with mapserver 6.0.3 (libmap.dll of Oracle 11g), i always get the problem :
msDrawShape(): General error message. Only polygon shapes can be drawn using a POLYGON layer definition.
I think it comes from the file libmap.dll, maybe libmap.dll for Orl 11g doesn't work welll with Orc 10g
Can you suggest me what to do ?
Iam using Oracle client 10.2.0.3, and the underlying database is Oracle db 10g (10.2.0.4)
Answer: My experience is as yours: Mapserver used to support Oracle compound polygons in previous versions, but they withdrew the support in present versions. So as far as I know, it is not an Oracle version issue. So far we have resorted to an older version of Mapserver to be able to render compound polygons. I have no idea when Mapserver will support these more complex geometries again.


Change of email address in peer-review system

Question: My goal is to serve as journal reviewers as much as possible, and I have recently changed affiliation. I have published several papers using my old affiliation's email address which is now closed since leaving, but I have set up an automatic reply message informing senders of my new email in the Office365 system which is good for 1 year after account closing. I wonder what will happen if an editor finds me as a potential reviewer based on my publications and reach out to me using my old institute's email address. Do most submission systems (eg. Manuscript Central) handle automatic replies well? Do journals or editors typically take effort to research on reviewers' recent contact info before reaching out? Also I do have an ORCID account and a personal webpage, but as my name is very common I don't think it helps much in this situation.
Comment: The various journals I have reviewed for allow you to change your contact address and email online.
Comment: General advice: Use a non-university email for those things.
Answer: It depends on how much time the editor is spending on the journal. When an invitation email bounces, the editor will receive an email. It's good practice then to cancel the invitation, because otherwise one could easily mislead oneself that the reviewer might still accept. If the bounce email includes a redirect, then it's a simple matter of changing the reviewer's email and inviting again. But doing this for reviewer after reviewer (an editor can conceivably have a couple of papers a day to handle, each of which needs 5+ invitations) gets tedious quickly. The editor might get tired, in which case a sufficiently motivated publisher can still pick up the ball ... but no guarantees. In your case the redirect will only work for a year, which might not suffice since the editor might be inviting based on your papers published over a year ago.
The easiest way to update your email is to log on to the system yourself and update your information. If you can't do this, emailing the publisher (the journal's full-time staff) is the next-best way.
Comment: Editors need to look up referee emails all the time. And finding good referees is hard enough. If they were to remove anyone whose email changed from their database, they would soon run out of referees.
Answer: In Manuscript Central, the return address is configurable by the journal. We then send the email "on behalf of" that address, using SPF records when appropriate. Assuming the journal monitors the email address it used to send the invitation, they should see the automatic reply. However, you should always keep your details up to date if you want to participate in the journals peer review activities.
I am an employee of ScholarOne, but this post represents my personal opinion only!


Are these spiders or mites?

Question: I was letting my anthurium soak in a bowl of water and when I took it out noticed these two black tiny spiders in the water.
Are they spider mites or actual spiders? The top of the soil has webbing all over it.!
Answer: That's an actual spider! Spider mites live under the leaves and would have webs on the leaves.

Are these spiders or mites?


Is it safe to do other stuff on a system while a macro runs?

Question: If I'm running a complex macro on a large file that I expect to take a few minutes, is it OK to do other stuff on the system (e.g. opening another application, typing in a different text editor, etc?) or could my mouse movements and keyboard inputs cause the macro to go nuts?
Comment: Why do you believe this to be the case ... ?
Comment: Using another system where a "macro" intimidated key strokes and mouse movements. Based on your comment, it sounds like my question might be absurd.
Answer: Indeed it is pretty safe to manipulate other programs while a macro is executed.
A macro simulates keystrokes within Vim which has no interaction with external GUI applications.
As macros don't depend on the movement of the mouse, no conflicts can appear (Or at least I've never experienced them or heard of someone who has).
EDIT As Sato observed in the comments, one element is shared between Vim and other applications: the clipboard. That means that if your Vim macro uses the system clipboard and you copy something new while it is executed, you might have unexpected results.
The best solution to this problem is to put the content of your system clipboard into a Vim register before recording the macro and to use this register in the macro.
Comment: All true, but beware that cut & [wp]aste operations with the mouse outside Vim _can_ interfere with the contents of Vim's clipboard if done at the wrong moment.
Comment: @SatoKatsura: You're totally right, I'll add this observation to my answer.


How does this oscillator circuit work?

Question: I have a Snap Circuits kit which has this oscillator circuit which I am fascinated with. I know how a relay buzzer oscillator works and it is pretty cool. This circuit uses a potentiometer, polarized capacitors, and bipolar transistors. I am familiar with these components. I am just trying to figure out how this circuit works and why the light flashes/the speaker pulses when I turn the circuit on and where the circuit flows. Can someone please help me figure this circuit out? Thank you very much.
Comment: https://electronics.stackexchange.com/questions/338128/is-this-an-astable-multivibrator/338163#338163
Comment: This post talks about the same oscillator topology. The answers there might help you out: https://electronics.stackexchange.com/questions/162460/npn-pnp-oscillator-questions
Comment: If you want to get into this stuff, you'll also want to learn to redraw the schematics from your book in the conventional way so they can make sense to you visually.  The makers of your kit had to cram things together in not particularly easy to understand fashion in order to make an easy to use kit with as many options as possible with as few parts as possible.  The most general rules are inputs on the left, outputs on the right, higher voltage to top, lower to bottom of diagram.
Answer: Yup, this is an interesting little circuit. Pulse circuits can be a little tricky to try to figure out at first, but don't get discouraged. It's a good idea to draw a diagram of the circuit and write the voltages you think will be at each location on the circuit. You could also but some arrows for current flow and write how much current would flow through that point on the circuit.
If you start with all capacitors discharged (let's call this T0, when the switch closes), you can think of them as a short circuit for the very first instant that the circuit turns on. After a microsecond or so (let's call this T1), they start to charge and some voltage builds across their leads. This changes the balance of voltages and currents in the circuit and you can make some calculations about how fast the capacitors will charge and write the new numbers around the circuit for voltages and currents.
Then look at the active components (transistors & ICs) and the voltages applied to them. As you work your way around the circuit at different times, you'll start to see how the circuit works.
I threw together this schematic so you can see how it would look to transfer a snap circuit into a real schematic diagram. I included a resistor that the Snap Circuits folks hide from you inside the plastic cover so you don't get any crazy ideas about how diodes work.
I highly recommend the book Getting Started in Electronics by Forrest Mims, III for people just getting into electronics. I used it back in the 80s when I was learning on my first 300 in 1 electronics kit (the old school version of Snap Circuits). If you're already past that level, jump to something a bit more complicated like The Art of Electronics by Horowitz and Hill.
Have fun learning electronics.
Additional Edit: As an aside, replace the 10 uF C3 with the 0.02 uF C1. This gives you a rudimentary PWM brightness controller. C1 is not polarized so you can flip it either way in the circuit.

simulate this circuit – Schematic created using CircuitLab
Comment: Thank you very much. I have the 300 in 1 kit with the extreme/SC-750 upgrade kit. Now a days the 300 in 1 kit is called Snap Circuits classic or SC-300.
Comment: One mistake you made that I forgot to mention is that the capacitors are polarized. I know that the plus side always get the high voltage side so the plus side for the bottom capacitor is up and the plus side for the upper capacitor is the left side.
Comment: It's nice that you are paying attention to the fine details. Polarized capacitors are not required for this circuit to work, it just so happens that the construction of some capacitors makes them polarized and the electrolytics in that kit are polarized. This means that you have to pay attention to this in your circuit as they will have excessive leakage current when used backwards and eventually fail. Sometimes spectacularly.
Comment: @ScienceGeyser The feedback capacitor may have both polarities during operation, depending somewhat on the setting of the potentiometer. Though with this circuit (3 V), it may not be too much of a worry.
Comment: @jonk Indeed. C3 is reverse polarity during the on-time of Q1 and then slowly charges to the proper polarity to trigger the next pulse. The reverse applied voltage is about 600 mV at the lowest flash rate. There is one more little misconception that they give you with this circuit and it's that the flashing gets so fast that the LED looks like it's on solid because it is getting to 30 Hz. Well, I built this circuit as shown in the book and was only able to achieve 12.5 Hz before the circuit stopped pulsing and Q1 stayed on solid.

How does this oscillator circuit work?


Can I use one set of images to represent multiple sprites in Java?

Question: I've got a game that has 3 basic sprites, at the moment I'm loading 8 images into each sprite for animating.
Each character class has a sprite object.
if I've got 10 characters on screen at once then that's 80 images loaded in to memory.
Can I make a central sprite class that only holds 8 images for each of the 3 sprites, then get the character objects to request the relevant images from the central sprite class, thereby massively reducing the memory required for the images?
Comment: Yes, you can, and should.
Answer: You can and you probably should. I believe that in Java (as in C#) objects are going to be passed by reference, so you should get this behavior by default without doing any extra work.
Code like this:
Sprite spr = Sprite.LoadFromFile("c:\sprite.s");

Character c1 = new Character(spr, x1, y1);
Character c2 = new Character(spr, x2, y2);
Character c3 = new Character(spr, x3, y3);

Should give you three Character objects all referencing the same Sprite object.
A quick search shows that I stand corrected. Java is in fact pass-by-value; however, since java has "pointers" the result in the code above should remain the same. Java passes the pointer to the sprite by value; but they will all still "reference" the same sprite.
Comment: Cool, so I have an image, I pass that image to the character object as a parameter, java passes the value of the pointer (essentially a reference) to the object, which then draws the original image on screen. This means if I have 10 characters all using  the same image I simply say "draw this image, ten times in these specific locations" thereby reducing the memory I use significantly. Correct?
Comment: That is my understanding, yes.


Early lease cancelation in New Jersey

Question: I rented an apartment in New Jersey before starting my job, right after I had my H1-B interview and I was told my visa was approved. Now I just found out that my visa was sent for administrative processing and it might take few days to few months to get my passport back and hence be able to travel to the US. Given that I will not be able to come to my new apartment (and won't have a job until I come), is this a reason to cancel the lease without paying any early cancelation fees (I mean is there any law for this, without having to negotiate with my landlord)?
Answer: You must negotiate with the landlord. There is no guarantee that you can cancel the lease early at all, unless that is written into the lease agreement. Some landlords will tell you that having signed, it's your problem to line up another tenant to take over the lease and/or whom you could sublet the unit to (if the lease allows sublets).
If you already have the job lined up, your new employer's HR department may be able to help you resolve this. If they often hire nonresidents they have probably experienced this before, and may be in a better position to conduct the negotiations with the landlord.
Comment: Many if not most landlords do not permit tenants to sublet. They do typically have a legal obligation to minimize harm (list the unit for rent and actively try to find a replacement).
Comment: I strongly suspect that legal obligation varies from city to city, never mind state to state. Ask the authorities in the city in question. Or, as I say, ask the company if they can deal with this for you; among other things they have better lawyers than you can afford. In any case (A) always read the contract before signing, and (B) if at all possible talk to someone who can tell you which clauses are unenforcable (there often are some) and what local common practice is.
Comment: And there's a bunch of relevant stuff mentioned in the "Related" section of this page.

Early lease cancelation in New Jersey


Compensation for custody awaiting trial resulting in acquittal?

Question: I was accused of a crime and held in custody for 8 months then acquitted at court,  I missed the first 8 months of my only child's life, and lost both my job and my partner.  Could I be entitled to compensation?
Comment: I don't think so but this seems serious enough to consult a solicitor about. At the very least contact your local Citizens Advice Scotland for free advice. https://www.cas.org.uk/.
Comment: What jurisdiction are you in.  Also, did you have a bail hearing?  If we can ask, what crime were you accused of and what legal entity acuitted you (Prosecution dropped chages?  Jury?  Judge?)
Comment: In Scotland it would matter if the verdict was "Not Proven" or "Not Guilty" both of which are available to juries in Scotland. See also http://www.parliament.scot/S4_JusticeCommittee/Reports/JS042016R03.pdf
Comment: I'm in Scotland,  was at edinbrough high court,  had a jury,  was found not guilty of murder
Answer: In all but a few U.S. states the answer is that you are not entitled to any compensation. This is grossly unfair, but is the dominant rule by far in most jurisdictions in the U.S.
As a matter of legal doctrine this is justified on the grounds that a criminal prosecution requires proof beyond a reasonable doubt, and many people who are actually guilty may be acquitted anyway because the standard of proof in a criminal case is so high. The classic example of that distinction is the O.J. Simpson murder case, in which O.J. Simpson was acquitted of murdering his wife in a criminal prosecution, but was found liable for murdering her by the lower civil action preponderance of the evidence standard in a wrongful death lawsuit brought by her family.
(In reality, most acquittals involve juries who think that the defendant was innocent, but that isn't reflected in the choice before them to convict or acquit a defendant.)
The only compensation to which you are entitled as a matter of law if you are acquitted of a crime, per the U.S. Supreme Court, is a refund of any fines or costs payable only upon conviction of a crime, which you paid or had taken from your assets, prior to your acquittal. See Nelson v. Colorado, 581 U.S. ___ (2017).
There would an exception if you can show that a law enforcement officer intentionally brought charges without probable cause in a civil lawsuit you bring against the law enforcement officer, which is realistically impossible in almost all cases. (Prosecutors and judges and jurors (see, e.g. here)) have absolute immunity from liability for their official acts related to the court process.)
There are a few jurisdictions where you could bring a civil lawsuit for compensation based upon "actual innocence", rather than law enforcement misconduct. In those places, you could receive compensation if you could prove by a preponderance of the evidence (or with a prosecutor's affirmation) that you were actually factually innocent, so you could get some compensation even in the absence of an intentional violation of your civil rights. Texas is one state that has such a scheme, with important limitations, as explained in this linked case.
You would probably have to hire a lawyer with your own funds to bring either kind of lawsuit, and realistically, you wouldn't have been incarcerated for eight months pending trial if you had enough money to do that, because you would have posted bond and been released pending trial.
There may be one or two states (I can't recall any from memory) where there might be a right to compensation merely because you are acquitted, but this would be an extreme outlier in terms of U.S. law.
Outside the United States, outcomes could vary dramatically from one country to another. They relevant law in England and Wales is discussed in an answer to this question at Law.SE. International human rights law does not recognize a right to compensation in these circumstances.
Answer: france
Losses suffered through pre-trial detention (détention provisoire) are supposed to be compensated: code de procédure pénale, article 149:

(...) la personne qui a fait l'objet d'une détention provisoire au cours d'une procédure terminée à son égard par une décision de non-lieu, de relaxe ou d'acquittement devenue définitive a droit, à sa demande, à réparation intégrale du préjudice moral et matériel que lui a causé cette détention. Toutefois, aucune réparation n'est due lorsque cette décision a pour seul fondement la reconnaissance de son irresponsabilité au sens de l'article 122-1 du code pénal, une amnistie postérieure à la mise en détention provisoire, ou la prescription de l'action publique intervenue après la libération de la personne, lorsque la personne était dans le même temps détenue pour une autre cause, ou lorsque la personne a fait l'objet d'une détention provisoire pour s'être librement et volontairement accusée ou laissé accuser à tort en vue de faire échapper l'auteur des faits aux poursuites (...)

Whoever was put into pre-trial detention within a procedure that ended with a final dismissal of charges or acquittal is entitled to full compensation for the moral and material prejudice suffered through the detention. However, no compensation is due when:

acquittal is due to penal irresponsibility [i.e. "insanity defense"];
the subject was granted amnesty after the pre-trial detention;
the statute of limitations runs out after the subject, detained for another reason, is freed;
the subject freely and voluntarily accused themselves, or wrongly let themselves be accused, in order to allow the real culprit to escape prosecution.

Court cases relating to such compensation are heard by the appeals court, and can be appealed to the Commission nationale de réparation des détentions, a subcommittee of the Cour de Cassation (highest appeal court in criminal matters). The Cour de Cassation website has a helpful analysis of the CNRD jurisprudence if you are interested.


MySQL import from stdin

Question: I am generating a csv in stdout using awk.
Is there a way to directly import that contents in mysql without putting it to file?
Answer: As the answer from @xdazz says, just use LOAD DATA LOCAL INFILE. I assume it was downvoted out of ignorance or lazyness. A quick perusal of the MySQL manuals would have shown that to be a perfectly viable answer.
In 2016 and for MariaDB, which will be most relevant to most users, you do this:
bash
awk '{ /* My script that spits out a CSV */ }' | mysql --local-infile=1 -u user -ppassword mydatabase -e "LOAD DATA LOCAL INFILE '/dev/stdin' INTO TABLE mytable FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"';"

Obviously, do bother to read the manual and change the options to LOAD DATA INFILE as required to suit your specific case.
Comment: how to do this in Windows system?
Answer: MySQL supports getting data in via extended inserts that look like this:
insert into table (col1, col2, col3) values
(a,b,c),
(d,e,f),
(g,h,i);

So you can modify your CSV to include a left paren and a right paren and a comma, and prepend it with insert into table... and append it with a semicolon, then you can pipe that directly to a MySQL commandline.
You can also use named pipes, a Unix construct, to pipe a TSV (tab-separated, not comma-separated) to a load data infile like this:
mkfifo /tmp/mysqltsv
cat file.csv | sed -e 's/,/\t/g' > /tmp/mysqltsv
mysql -e "load data infile '/tmp/mysqltsv' into table tblname"

That is pseudocode. You need to run the cat in one process and the mysql command in another. Easiest is to use two different terminals. More advanced is to background the cat|sed.
Answer: It does not seem that you can import CSV from stdin directly.
You have to save it to a file so that mysql uses its name as the name of the table (without the extension), you can use mysqlimport as in:

  mysqlimport -uUSER -pPASS DB FILE

Comment: Here we have the closest thing to a proper answer, with zero upvotes.
Answer: @xdazz was quicker than me, but I would consider putting the result to a file. Why? Because that way, if something went wrong, you can check and track the issue back. This would be very helpful, if you face intermittent problems, that don't always occur. Of course, to preserve disk space, after the import is done, I'd ZIP them up not to consume too much.
Answer: Yes, just use pipe.
$ your_command | mysql -u user -p
Sorry, this answer is not enough. You can't pipe the csv out direct to mysql.
You have to do extra work to make the result be valid sql.
Or, you may consider using mysql native load data infile syntax which is supporting loading a csv file to database.
Comment: Why was this answer given? It doesn't work. Why is it being upvoted? IT DOESN'T WORK. Try it. You'll get a syntax error. This only works if the output of "your_command" is valid SQL, which a CSV most certainly is not.
Comment: @xdazz I'm stunned that someone who posts an answer like this was able to amass 101k reputation, unless they made a honest mistake by not reading the question properly. Maybe it's time to edit this answer?

MySQL import from stdin


Getting the work, best way to cold call/approach production companies?

Question: All of my paid work has been obtained via word of mouth from people I have done work for in the past.  For awhile that worked, I edited out of my bedroom and did production sound and concert sound gigs to pay the bills.  I had never actively pursued clients or cold called people to get sound design/editing jobs.  The major factor being that I could not offer a professional editing/mixing environment for clients.  I have recently completed my small studio build, two rooms.  One is my edit mix room and the other is a recording room designed specifically for VO and then foley, sfx recording etc.  It is a very dry room.    What I want to actively seek out is commercial work and VO recording.  What tactics have you all found to be most productive in approaching a company that you are trying to cultivate a working relationship with, but do not have a connection to?  I have thought about the idea of also doing some craigslists posts, but in all honesty I am trying to get clientele that would generally not search CL for sound editors.
Answer: I agree with George - an online identity is important (even if only a simple "interactive business card" style website), but also CONSISTENCY in your online presence across all media platforms.
I also agree with Andrew that mixers and conventions and any other opportunities to be around people physically can help.  If anything, it helps everyone put a name to a face for the future.  Patience is key, and you may very well have to begin at the ground level with Mandy.com and Craiglist and the like.
What I believe should be the long term chief focus/investment is in developing meaningful relationships.  Do that, and the referrals/clients will follow.  Personally, I feel emailing and advertising appears desperate and is not an approach I recommend.  And I can personally attest that I have been on the receiving end advertising/cold-call emails before form people and entities I don't know of trying to tell me about their services and get me to work with them etc (I don't mean potential clients because that's different)... they all go direct to my trash can without consideration.  Harsh?  Maybe it may seem that way, but it's not at all.  The people I'm going to go to to work with or hire are people I know personally again, based upon a meaningful relationship we have developed because this line of work is about calculated risk and reliable relationships.  I would rather you try to, as Andrew mentioned, take time to meet up for coffee or something of that nature to develop a relationship so that you have a foundation to build off of.  If I get two emails, one from somebody I've had lunch with or talked shop with at a mixer, even if many years ago, versus someone's cold-call email of equivalent content, I'm going to be naturally driven to talk to/work with the one who I know and have developed a relationship with.
This is just my 2 cents.
Comment: @Stavrosound I also agree that emailing and advertising gives the impression of being desperate.  Do you think cold calling and emailing people not in advertisement but to setup some kind of meeting/coffee to instead of talking about the services I offer but inquire about the services they need or look for would be a better approach?
Answer: Honest emails...much in the tone that you've written this question...can work.  Sometimes you luck out.  I also suggest industry functions like meet ups, conventions, hardware/software demonstrations, development councils etc.  Also, A lot of time people over look connections they already have.  Ping everyone you think has a shot at either using your service...BUT more importantly may be able to refer you to someone.  Then Always Always Always try to meet them in person...if for only a 5 minute coffee.
Comment: Yeah that is what I really want to do, currently in the process of getting together some kind of presentation/info/listing of services so that I have something tangible to have them leave with other than a business card.
Comment: I will start keeping an eye out for meetups here, most that I have seen are just actors.
Answer: I would add to what Andrew already said: get a cool looking website and a profile on Linkedin. Even if the ideal is to meet your clients offline, you still want to have a strong online identity.
Otherwise, congrats on building your new studio!


SharePoint 2010 WebPart - Prevent jQuery code from running multiple times when Editing WebPart

Question: I am using a tab panel WebPart that was given to me complete. The jQuery is repeating every-time the WebPart is edited so, the tabs repeat or get multiplied. I am using static information to populate the tabs. This does not happen when I am working in a publishing page unless I specifically click on the edit web part.
Comment: Without the code of the webpart it will be almost impossible to help you
Answer: SharePoint adds a hidden control with a value which tells the client side code if the page or WebParts on that page are in Edit Mode.
In case of Wiki Pages, the id of the control is _wikiPageMode and in case of Publishing pages, it is MSOLayout_InDesignMode.
You can put your code inside an if statement like below to know if your page is in design mode and stop execution of code.
if($("#_wikiPageMode").val() "Edit" or "" ||
      $("#MSOLayout_InDesignMode").val() "1" or "") {

      //Your existing code here
}


Minidlna doesn't refresh files

Question: I have Minidlna installed, configured and it's working almost perfectly. Whenever I download a video file from a website using IceWeasel and video is saved to my minidlna share folder that file isn't indexed. Manual refreshing doesn't work, Minidlna stop, force-reload, restart, minidlna -R doesn't work - the file is not being indexed. The only solution is to stop minidlna, put hash (#) the path to my minidlna share path in minidlna config, restart minidlna, stop it, remove # to my minidlna share path in minidlna config file, restart and it works. It's a lot to do to make it work. I have inotify set to yes, and it's properly configured in /etc/sysctl.conf. Don't know what else I could do.
Comment: dirty workaround: add a crontab that does the force-reload and file edit, a structural fix could be to see if you run the latest stable release or just the latest git pull. This could explain unexpected behaviour.
Comment: Good idea but if someone was watching something or listening to the music of minidlna resources than that would interrupt it. I just thought a script like below could be a way round it but I don't know how to create such script:
1. Stop minidlna, 2. Put # to the path to minidlna share in minidlna config, 3. Start minidlna, 4. Remove # to the path to minidlna share in minidlna config, 6. Start minidlna.  It might look little bit over complicated but I hope someone could help to create script for that purpose :)
Answer: This is something I wrote from the top of my head at work, so it might contain syntax errors etc, but this can be a dirty workaround like I have mentioned in my comment.
Use at your own risk, it is advised to find a structural solution first
note:this script assumes the # is not in the config when you first start to use it, it's something rough as a proof of concept
<code>#!/bin/bash
MY_PATH="media_dir=V,/mnt/ext/Media"

service minidlna stop
sed -i s^$MY_PATH^"#$MY_PATH"^ /etc/minidlna.conf

service minidlna start
sed -i s^"#$MY_PATH"^$MY_PATH^ /etc/minidlna.conf
</code>
Comment: Thanks for your help - I will try to adapt it to my needs.

Minidlna doesn't refresh files


Special Theory of Relativity

Question: I was reading Einstein's book on Relativity.
What is the contradiction between the principle of relativity(in the restricted sense) and the law of the transmission of light in vacuum that Einstein is talking about?
I am unable to understand it.
Any help is appreciated.
Answer: I'm not sure I get your question right, but from what I understand, I think it is about the speed of light. You see, if I stay on a train and I launch a ball in the direction the train is moving, the ball speed will be the sum of it's speed relative to me + the speed that the train is traveling. If I point a laser from the train, (suppose we are in vacuum and I die trying to do this) the "speed" of the light coming from laser is not the sum of the light + the speed of the train. Light, wherever you stay has the same speed. You can even "ride" stay on a beam of light and all light will pass you with the speed of light, or you can stay still and you will measure same speed for light. It sounds like sci.fi. but this is how world works.
Comment: How does this contradiction explain his conclusions?(that time is relative)
Comment: Well you have to asume something. It becomes easy with a lil bit of maths. https://en.wikipedia.org/wiki/Time_dilation
Comment: This is because if you're moving relative to something, every process that makes you You starts accuring more slowly. This is why light always moves at the same speed, no matter the speed of objects.
Comment: @Xsnac See if I understand it right. If I am travelling in a train and light beam is travelling parallel to me, then I will say that the velocity of light relative to me is c-(my velocity).But this is wrong.Light will travel with a speed 'c' relative to me despite of my speed.And this is the contradiction between Galilean Relativity and Law of Propagation of light in vacuum.Am I right?

Special Theory of Relativity


Why in the academic fields of art and design, the philosophy taught or mentioned is often Continental philosophy?

Question: Is there any rationale to prefer, in academic  fields of art, Continental philosophy over Analytic philosophy? I guess there might be a historical reason why philosophy evolved into two approaches but why I do not hear in my art studies anything about analytic philosophy of art as if it never existed, and only hear about Barthes, Foucault, and their like?
Comment: Because continental philosophy traditionally focuses more on humanities, and analytic philosophy more on sciences, and people in art studies probably find the analytic approach less congenial to art. But if you are interested, [Beardsley](https://plato.stanford.edu/entries/beardsley-aesthetics/) is a classic of analytic aesthetics, and there is a recent volume [Analytic Approaches to Aesthetics](https://www.oxfordbibliographies.com/view/document/obo-9780195396577/obo-9780195396577-0004.xml).
Comment: @Conifold, thank you! Great source! Over time perhaps the attitude of art historians and art academics will change. I do not see contradiction between being analytic and an artist. And it is frustrating for me to be around people that still hold to romanticism or otherwise talk about postmodernism while falling into relativism. I really wish the intellectual atmosphere of my studies would have been more analytic without of course dismissing the engagement with art. Anyway.
Answer: There's probably no way to summarize this without drawing hate from both sides, but here you go:
Analytic philosophy tends to approach meaning as something to be discovered, whereas Continental philosophy approaches it as something to be created (or co-created) by human beings and/or human society. From the Continental perspective, therefore, artistic expression is vital. From the analytic perspective, art is one of the things to look at and/or dissect.
Answer: Because the Continental Tradition continued to be concerned with what art is and cultural issues, and the Analytic tradition largely switched to modelling philosophy after science and focusing on logic, sidelining culture and aesthetics. This is linked to a difference in perspective about what philosophy is for, and what constitutes an authoritative public intellectual, I'd say at root.
Thinkers who actually read widely in both traditions, like Rorty, often reject it's continuing relevance. I would describe the distinction as a tool for talking about the history of philosophy more than anything.
Key thinkers who are considered 'Continentals' come at their work through the Critical Theory approach, which:

"focuses on reflective assessment and critique of society and culture
in order to reveal and challenge power structures. With roots in
sociology and literary criticism, it argues that social problems stem
more from social structures and cultural assumptions than from
individuals." from Wikipedia

Embracing the postmodern condition, and accepting the end of universal objective truth, is pretty much limited to the Continental Tradition. And

I would relate postmodernism to art criticism as the shift from what
art IS (implicitly a metanarrative, making a claim to be the dominant
interpretation in cultural discourse), to what art DOES, for it's
different audiences, for it's maker, considered in different contexts,
in layers of abstraction and reference.
From Does postmodernism in art criticism collapse into relativism? What's its merit?

Naturally postmodern thinkers also apply this to what philosophy is, and is for.
Answer: See SEP's article on Rationalism vs. Empiricism. This is a centuries old dispute over whether philosophy should focus on evidence of the senses or on introspection and rational analysis. Empiricism was primarily carried by the anglophone world (the UK and its colonies and offshoots); rationalism held sway in European universities.
Empiricism isn't well-suited to the philosophy of art, since art is (by its nature) introspective and expressive. Most artists are concerned with issues like aesthetics, cultural significance, the nature of metaphor, allegory, and symbolism, and other matters that aren't directly attributable to sensory evidence. While I'm sure that empericical analysis could be used within a comprehensive analysis of art, it doesn't surprise me that philosophers of art and the professors who use them give it short shrift.


Installing a Windows O.S from another Windows System

Question: I'm looking for a way to install a Windows O.S from a live running copy of Windows 7 (without rebotting, etc in a different drive) it's even possible? As far I searched there's only entrances to do as always. (booting and install to the drive).
Comment: I would not say that it is not possible, but there is much to consider. (Driver/new Hardware, Files which are in access during copy, ...)
Comment: @Ramhound: Maybe i misunderstood the question. I thought it's about copying a live system to another pc (not about **new installation**).
Comment: @Ramhound there you go. I've just proven you wrong :D
Answer: Yes, there is.
Using this utility NT 6.X Fast Installer and Get WAIK Tools you are able to create a preinstalled Windows drive.
Disclaimer: I am not the author of these tools, and any damage that could happen is not my responsibility.
In case you don't know what you need to do, I have prepared two zip files.
If you want to install Windows 7 32 bit You will need These Files
If you want to install Windows 7 64 bit You will need These Files
All you need to do  is download the files relating to the edition of Windows you want to install, extract the ZIP, and run installer.bat
The installer will then guide you through the stages to create the drive.
For anyone wanting to see the forum post, it's here
The description of the NT 6.X Fast Installer Follows:

As you know, stupid setup.exe for nt 6.x (vista/win7/2008/2008 r2) has
  many limitations:

You can't start install vista/win7 under xp based pe (winpe 1.x) and can't install win7 under win2000
You can't install win7 directly to USB hard disk
The stupid setup.exe may put the boot files to a wrong drive when you boot winpe with USB device and there is even no way to choose the
  boot partition Posted Image
When you install win7 from winpe, the drive letter of the OS partition will always be C:, no matter which partition you choose.

On the other hand, the fastest way to install nt 6.x is
  imagex+bcdboot, e.g
<code>imagex f:\sources\install.wim 5 c:
bcdboot c:\windows /s c:
bootsect /nt60 c:
</code>
And no setup.exe is needed.
Based on this, I wrote an "nt 6.x fast installer" which has the
  following advatages compare to the original M$ setup.exe:

You can install nt 6.x directly from iso file mounted by any kind of virtual drive. And you needn't extract or burn the iso.
You can directly install nt 6.x from any version winpe and win2000 above windows
You can install the OS directly onto a USB external hard drive. And no virtual machine, copy tool or complicated "tutorial" is needed.
You can manually choose which partition is the boot partition.
You can decide which letter the OS partition will occupy in Win7/2008 R2.
The install speed is very fast. With this installer, you can install win7 in 11-12 min for 5400rpm notebook hdd, and in less than
  10min for desktop 7200 hdd (vista needs about 2 min more because of
  the score evaluation)
Comment: Just to confirm.  This allows somebody to install a Windows installation to a disk, while Windows is running, without restarting the computer?  I can't find any information on the NT 6.x Fast Installer.  I am aware of the other class of tool ( its since been renamed to something else )  I am hesitant to award the reputation for that reason.  Once the question is eligible for a bounty I will award it though.
Comment: yup, I used to use it all the time, until I built a distrib server. This is the link: http://reboot.pro/topic/10126-nt-6x-fast-installer-install-win7-directly-to-usb-external-drive/
Comment: from the authors description: `Based on this, I wrote an "nt 6.x fast installer" which has the following advatages compare to the original M$ setup.exe:
1. You can install nt 6.x directly from iso file mounted by any kind of virtual drive.`
Comment: On restart, Windows will do the first time setup, completely ignoring the fact that it wasn't installed the "official" way.
Comment: I am an idiot for not thinking to simply apply a .wim file to a partition.  Since I was an idiot you get an additional bonus for teaching me something new.  Once this question is eligible I will offer the bounty then issue the award.  I suggest you integrate the description of the program into your answer and also provide the forum topic ( as a way for other people to read about it ).
Comment: xD, we all have days like this. that script is however the easiest way to install windows, including changing the default C: drive letter. I change mine to Z:.
Comment: Most definite +1 for this - will have to read up on it. Kudos to @Ramhound too, for being a true 'scientist' in the face of new evidence. √
Answer: Another option is to use WinNTSetup which is basically a GUI for this type of thing.
https://www.softpedia.com/get/System/OS-Enhancements/WinNTSetup.shtml


Where can I find information on Rabbi Yaacov Wazana

Question: In a lecture I attended some years ago mention was made of a Rabbi Yaacov Wazana, who practiced some sort of Jewish healing in Morocco. I would like to know where I can find biographical information on this person and/or any of his writings.
Comment: https://books.google.com/books?id=V4H6DPLwFC0C&dq=Life+and+Death+of+Rabbi+Yaakov+Wazana&source=gbs_navlinks_s
Answer: I know this is very old post but
what kind of info are you looking for?
any chance you speak Hebrew?
that rabbi died in my grandfathers house back in morocco around 60-70 years ago (if I'm not miscounting..),
I've heard many stories from my older uncles who met him when they were kids, my father and uncles told me about magical stuff he used to do healing,transforming water (i kid you not) he once changed a sack of water into "Arak",he had the ability to communicate with souls and demons,
before passing away he removed a curse from my grandparents that made their baby's die (more than 6 died before reaching 1 year old) and sacrificed his soul so that my father, some of my uncles, and aunts may live. my grandfather took on himself to do a the Jewish memorial of ya'acov wazana every year, after my grandfather passed away my uncle took it on himself and keeping it going every year. (my grandfather moved to Israel after marrying and i know that some of ya'acov wazana's family did too. but ya'acov and my great grandfather are buried in the same graveyard in Agouim in the Atlas Mountains, morocco.
Comment: thank you for sharing, very fascinating
Answer: A simple google search yielded:

This
This
and this book
This in Hebrew
and this in Hebrew
Comment: When I click the first link I get the following error message: "You don't have permission to access /juda373/outlines/documents/Daryn.pdf on this server."
Comment: @Eliyahu https://www.jstor.org/stable/3773787
Answer: I read about your family in Yoram's Bilu book about Yaakov Vazana who is a family member of me. I search about his life and would love to speake with you about it
you can contact me at firstname.lastname@example.com
Blessings,
Elad


Virtualbox - Can't install guest additions (Big Sur)

Question: I'm trying to install guest additions on my macOS Big Sur VM, but the installation never has been successful. I always get a triggering "The installation failed" screen. Since Command+R can't be used to enter recovery mode on Virtualbox for some reason, I used the installation disk and I disabled Csrutil from there. I restarted to the "Normal mode" and guess what? It failed again! I double-checked using csrutil status and SIP is off, but why can't the guest additions be installed?
Comment: Virtualbox being an open source project sometimes takes longer for things to update. You might better be served looking for this issue on the VBox forums.
Answer: You can not install guest additions when using Big Sur. I have seen some hacks posted that are suppose to work, but I have never found one that works with a Big Sur guest.
Here are some ideas of how to substitute the functionality that guest additions may have offered.

Screen Size: The command given below can be used to change the video resolution of the Big Sur guest. For more information, see section 3.14.1. Video Modes in EFI of the online Oracle® VM VirtualBox® User Manual. You can also download a PDF version from here.
 VBoxManage setextradata "VM name" VBoxInternal2/EfiGraphicsResolution HxV

You should enter this command with the guest is powered off.

Transfer Files by Network: You can use SMB to connect to the guest by the host or any other computer on the LAN. You should make sure the Attached to: for the network is set to Bridged Adaptor.

Transfer Files by USB: You can attach a physical USB flash drive to the guest. To do so, you must first eject the flash drive on the host. When the guest powers off or ejects the flash drive, the host will automatically attempt to mount any volumes on the flash drive. If the host has USB 3 ports, then USB 3.0 (xHCI) Controller should be selected under setting for ports.

Note: VirtualBox defaults to SATA HDD for the guest. You can change this to to SATA SSD or NVMe SDD. Only NVMe SSD has trim capabilities, which I have found to increase boot times. (Booting is when trim operations are performed.)

Perhaps, a better solution would be to avoid VirtualBox all together. VMware now offers the use of Fusion Player for free. You do need to create an account to get a license key. VMware Fusion Player is both Big Sur host and guest compatible with Intel based Macs. Also, installing is simplified. You only need to drag and drop the Install macOS Big Sur application into a Fusion Player window and the installer drive is automatically created. In other words, you do not need an ISO or flash drive to install.

Note: You can have both VirtualBox and Fusion Player installed at the same time. Although, I am not sure if using both to run virtual machines at the same time is wise.

IMO, the fact that I can not install Big Sur on my 2013 iMac, but can install Big Sur in a virtual machine on the same Mac, just seems wrong (or unfair).
Comment: is there any indication as to why this isnt possible besides "You can not install guest additions when using Big Sur."? havr the virtualbox developers said anything or announced plans to fix it?
Comment: I believe the guest additions requires 32 bit support and Big Sur only has support for 64 bit.


batch convert htm files to pdf

Question: What applications allow the user to batch convert HTM files into PDF?
Answer: Try chaining up html2ps (http://user.it.uu.se/~jan/html2ps.html) and ps2pdf. Both are included in all major Linux distribution and are console utilites that you can use in shell scripts.
Answer: Personally, I use HTMLDOC for this. (Apart from the commandline, it also has a GUI and the option to have it run as a web service via CGI.) There are Windows, Linux, Mac OS X and Unix versions available. You can build your own executable, because the source is available via GPL.

batch convert htm files to pdf