Click Once Deployment Error

Question: I am new to Click Once Application deployment so I think I may have a simple problem.  I have a window app that I created and deployed successfully as a ClickOnce App using Vis. Studio 2010 and deploying to a web service.  I made some changes to the app and changed the deployment location so I started the click Once Process over.  Now when I deploy I get an error.  The app builds fine, runs fine in VS 2010, when I deploy files are created.  Double clicking the App.application file will start the install of the app with a .Net framework error.
"Unhandled exception has occurred in your application.  If you click Continue, the application will ignore this error and attempt to continue.  If you click Quit, the application will close immediately.
System.UriFormatException: Invalid URI: The URI is empty..."
I have double checked and triple checked the Publish Foldre Location and INstallation Folder URL to make sure they are pointing in the correct places and using the correct format.  I double and triple checked the Updates dialog box when you click the Updates button.  The combobox for the Application Updates matches the Installation Folder URL.  "\MyServer\Users\Administrator\Desktop\Transfer\Deploy\"  I double checked to make sure the required files are correct.  Security settings did not change.
What could I be missing?
Answer: It seems you missed one backslash in your installation folder URL:
<code>\\MyServer\Users\Administrator\Desktop\Transfer\Deploy\
</code>
Answer: Please make sure that if you are using some image/sound or log files then its Build Action must be "Content" type.

Click Once Deployment Error


How deep is a ocean wave (the extent of tranverse motion of the water below surface)?

Question: While water moves up and down on the surface, does it move the same way below surface also? Or does it fade into a compression wave somewhere below the surface?
Answer: Water wave is combination of traverse and longitudinal waves with a dispersion relation:
$$c=\sqrt{\left( \frac{g\lambda}{2\pi}+\frac{2\pi \gamma}{\rho \lambda} \right) \tanh \frac{2\pi h}{\lambda}}$$
and displacement profile $$\xi+\eta i=\frac{ga}{kc^{2}} \frac{\cosh[k(y+h)+i(kx-\omega t)]}{\cosh kh}$$

In deep water, the particles move in more circular way, and the amplitude decays with depth.  No perceptible motion deeper than $\dfrac{\lambda}{2}$.
In shallow water, the particles move in more elliptical manner, and they're pure longitudinal at the bottom.

See also another answer here
Answer: Individual points in the water move in circles, up, forward, down, back.  Collectively, this forms wave motion.
The magnitude of the motion is greatest at points on the surface, and the magnitude of the motion decreases with depth.  Beyond about a half wavelength below the surface, there is no motion.


Origin of momentum. Noether's theorem

Question: My professor talked about Noether's theorem and how translation is the origin of momentum conservation. But  why is it not velocity that is conserved but mass times velocity. And on the same note why isn't it mass squared times velocity.
Comment: Speed of *what*?
Comment: @Danu - Since momentum conservation implies the vector sum of momentum vectors of each part of an isolated composite system will be constant (at least that's what it means in classical physics), maybe Melle Sterk is asking why it's not the vector sum of the velocity vectors of each part of a system that's constant. I doubt there is any simple conceptual explanation though, if there was I would think this important result would have been discovered before Emmy Noether published it in 1918.
Comment: Important remark : translation is not origin - origin is _INVARIANCE_ to _something_. And this something can be - translation, rotation, shifting in time, something else.
Answer: The laws of physics are discovered through a mixture of heuristics, modelling and inference. In case of momentum, the story goes like this:
It is possible to 'transfer motion' from one body to another. However, experiment shows that it is not velocity that is conserved during such transfers, but another 'quantity of motion'. We give that quantity the name 'momentum'.
It turns out that velocity and momentum are (approximately) proportional, and mass is just the name of the constant of proportionality. By 'coincidence', this constant appears to be the same quantity we can measure using scales.
Once we have a model, we can then come up with stories why the world should behave the way it does.
One story that gets told is that momentum should be conserved because physics is translation invariant. Or is it the other way around? Is physics translation invariant because momentum is conserved?
Eg in Hamiltonian mechanics, symmetries and conservation laws pretty much stand on equal footing as
$$
\mathcal L_{X_H} p = 0 \Leftrightarrow \mathcal L_{X_p} H = 0
$$
ie momentum is conserved under time evolution generated by the Hamiltonian iff the Hamiltonian is conserved under translations generated by momentum.
Comment: I was confused because working with free particles this proportionality constant shows up. Will it become clearer the moment you add interaction terms to a Hamiltonian.

Origin of momentum. Noether's theorem


Full Text Searching with Rails

Question: I've been looking into searching plugins/gems for Rails.  Most of the articles compare Ferret (Lucene) to Ultrasphinx or possibly Thinking Sphinx, but none that talk about SearchLogic.  Does anyone have any clues as to how that one compares?  What do you use, and how does it perform?
Answer:
thinking_sphinx and sphinx work beautifully, no indexing, query, install problems ever (5 or 6 install, including production slicehost )
why doesn't everybody use sphinx, like, say craigslist?  read here about its limitations (year and a half old articles.  The sphinx developer, Aksyonoff, is working on these and he's putting in features and reliability and stamping out bugs at an amazing pace)

http://codemonkey.ravelry.com/2008/01/09/sphinx-for-search/
http://www.ibm.com/developerworks/opensource/library/os-php-apachesolr/
Comparison of full text search engine - Lucene, Sphinx, Postgresql, MySQL?

ferret: easy install, doesn't stem properly, very slow indexing (one mysql db: sphinx: 3 seconds, ferret: 50 minutes).  Well documented problems (index corruption) in drb servers in production under load.  Having said that, i have use it in develometn since acts-as_ferret came out 3 years ago, and it has served me well.  Not adhering to porter stemming is an advantage in some contexts.
Lucene and Solr is the gorilla/mack truck / heavyweight champ of open source search.  The teams have been doing an impressive number of new features in solr 14 release:
acts-as-solr: works well, once the tomcat or jetty is in place, but those sometimes are a pain.  The A-A-S fork by mattmatt is the main fork, but the project is relatively unmaintained.
re the tomcat install: SOLR/lucene has unquestionably the best knowledge base/ support search engine of any software package i've seen ( i guess i'm not that surprised), the search box here:

http://www.lucidimagination.com/

Sunspot the new ruby wrapper, build on solr-ruby.  Looks promising, but I couldn't get it to install on OSX.  Indexes all ruby objects, not just databases through AR
one thing that's really instructive is to install 2 search plugins, e.g. sphinx and SOLR, sphinx and ferret, and see what different results they return.  It's as easy as @sphinx_results - @ferret_results

just saw this post and responses
http://zooie.wordpress.com/2009/07/06/a-comparison-of-open-source-search-engines-and-indexing-twitter/
http://www.jroller.com/otis/entry/open_source_search_engine_benchmark
http://www.flax.co.uk/blog/2009/07/07/xapian-compared/
Answer: First off, my obvious bias: I created and maintain Thinking Sphinx.
As it so happens, I actually saw Ben Johnson (creator of SearchLogic) present at the NYC ruby meet about it last night. SearchLogic is SQL-only - so if you're not dealing with massive tables, and relevance rankings aren't needed, then it could be exactly what you're looking for. The syntax is pretty clean, too.
However, if you want all the query intelligence handled by code that is not your own, then Sphinx or Solr (which is Lucene under the hood, I think) is probably going to work out better.
Answer: SearchLogic is a good plugin, but is really meant to make your search code more readable, it doesn't provide the automatic indexing that Sphinx does.   I haven't used Ferret, but Sphinx is incredibly powerful.
http://railscasts.com/episodes/120-thinking-sphinx
Great introduction to see how flexible it is.
Answer: I have not used SearchLogic but I can tell you that Lucene is a very mature project, that has implementation in many languages. It is fast and flexible and the API is fun to work with. It's a good bet.
Answer: Given this question is still highly ranked at google for full text search, I'd really like to say that Sunspot is even stronger today if you're interested in adding full text search capabilities to your Rails application (and would like to have Solr behind you for that). You can check a full tutorial on this here.
And while we're at it, another contender that has arrived in the field is ElasticSearch, that aims to be a real time full text search engine built on top of Lucene (but doing things differently when compared to Solr). ElasticSearch includes out-of-the-box sharding and replication to multiple nodes, faster real time search, "percolators" to allow you to receive notifications when something that matches your criteria becomes available and it's moving really fast with many more other features. It's easy to build something on top of it, since the API is dead simple and completely based on REST using JSON as a format. One could say you don't even need a plugin to use it.
Answer: Personally, I don't bother with database agnostics for web applications and am quite happy using the full text search in pg83. The benefit is, if and when you change your framework/language, that you will still have full text search.
Answer: Full Text Indexing and MATCH() AGAINST().
If you're just looking to do a fast search against a few text columns in your table, you can simply use a full text index of those columns and use MATCH() AGAINST() in your queries.

Create the full text index in a migration file:
add_index :table, :column, type: :fulltext

Query using that index:
where( "MATCH( column ) AGAINST( ? )", term )

ElasticSearch and Searchkick
If you're looking for a full blown search indexing solution that allows you to search for any column in any of your records while still being lightning quick, take a look at ElasticSearch and Searchkick.
ElasticSearch is the indexing and search engine.
Searchkick is the integration library with Rails that makes it very easy to index your records and search them.
Searchkick's README does a fantastic job at explaining how to get up and running and to fine tune your setup, but here is a little snippet:

Install and start ElasticSearch.
brew install elasticsearch
brew services start elasticsearch

Add searchkick gem to your bundle:
bundle add searchkick --strict

The --strict option just tells Bundler to use an exact version in your Gemfile, which I highly recommend.
Add searchkick to a model you want to index:
class MyModel < ApplicationRecord
  searchkick
end

Index your records.
MyModel.reindex

Search your index.
matching_records = MyModel.search( "term" )

Comment: Good solution. However, if you look to search into several columns you should add both column name into your migration.
> add_index :table, [:column1, :column2], type: :fulltext
> where( "MATCH( column1, column2 ) AGAINST( ? )", term )
Answer: For anyone looking for a simple search gem without any dependencies, check out acts_as_indexed

Full Text Searching with Rails


Why do we use neural networks in computers?

Question: Why do we use neural networks? It's biologic. Aren't there any more solutions that're more "suitable" for computers?
In other words: Why do we use the human brain as a model for inspiration for artifical intelligence?
Comment: @Joshua I spilled all the coffee ahaha
Answer:
Neural networks aren't really very biological. They resemble, at a very general level, the architecture of neurons, but it's a great exaggeration to say that they work "just like the brain" (an exaggeration that's encouraged by some neural-net advocates, alas).
Neural nets are mostly used for fuzzy, difficult problems that don't yield to traditional algorithmic approaches. IOWs, there are more "suitable" solutions for computers, but sometimes those solutions don't work, and in those cases one approach is a neural network.
Answer:
Why do we use neural networks?

Because they're simple to construct, and often appear to be a good approach to certain classes of problems, such as pattern recognition.

Aren't there any more solutions that're more "suitable" for computers?

Yes, implementations that more closely match a computer's architecture can be more suitable for the computer, but then can be less suitable for an effective solution.

Why do we use the human brain as a model for inspiration for artifical intelligence?

Because our brain is the superior example we have of something intelligent.
Answer: Neural Networks are still used for two reasons.

They are easy to understand for people who don't want to delve into the math of a more complicated algorithm.
They have a really good name. I mean when you role into a CEO's office to sell him your model which would you rather say, Neural Network or Support Vector Machine. When he asks how it works you can just say "just like the neurons in your brain", which is something most people understand. If you try and explain a support vector machine Mr. CEO is going to be lost (Not because he is dumb but because SVMs are harder to understand).

Sometimes they are still useful however I think that the training time is often just too long.
Answer: I don't understand the question.  Neural nets are suitable for certain functions, and not others.  The same is true for various other sorts of classes of algorithms, regardless of what they might have been inspired by.
If we have a good many inputs to something, and we want some outputs, and we have a set of example inputs with known desired outputs, and we don't want to calculate a function ourselves, neural nets are excellent.  We feed in the example inputs, compare the output to the example outputs, and adjust the inner workings of the NN in an automatic fashion, to make the NN output closer to the desired output.
This sort of function derivation is very useful in various forms of pattern recognition and general classification.  It isn't a panacea, of course.  It has no explanatory power (in that you can't look at the innards to see why it classifies something in a particular way), it doesn't offer guarantees of correctness within certain limits, validating how well it works is difficult, and gathering enough examples for training and validation can be expensive or even impossible.  The trick is to know when to use a NN and what sort to use.
There are, of course, people who oversell the things as some sort of super solution or even an explanation of human thought, and you might be reacting to them.
Answer: Neural network are only "inspired" by the neural structure of our brain, but they are not even close to the complexity of the behaviour of a real neuron (to date there is no neuron model that captures the complexity of a SINGLE neuron, don't even think about a neuronal population...)
Although "neural", machine "learning" and other "pseudo-bio" (like "genetic algorithms") terms are very "cool", that does not mean that they are actually based on real biological processes.
Just that they may very approximatively remind of a biological situation.
NB: of course this does not make them useless! They're very very important in many fields!
Answer: Neural networks have been around for a while, and originally were developed to model as close an understanding as we had at the time to the way neurons work in the brain. They represent a network of neurons, hence "neural network." Since computers and brains are very different hardware-wise, implementing anything like a brain with a computer is going to be rather clunky. However, as others have stated so far, neural networks can be useful for some things that are vague such as pattern recognition, facial recognition, and other similar uses. They are also still useful as a basic model of how neurons connect and are often used in Cognitive Science and other fields of artificial intelligence to try to understand how small parts of the complex human brain might make simple decisions. Unfortunately, once a neural network "learns" something, it is very difficult to understand how it actually makes its decisions.
There are, of course, many misuses of neural networks and in most non-research applications, other algorithms have been developed that are much more accurate. If a piece of business software proudly proclaims it uses a neural network, chances are it probably doesn't need it, and might be using it to inefficiently perform a task that could be performed in a much easier way. Unless the software is actually "learning" on the fly, which is very rare, neural networks are pretty much useless. And even when the software is "learning", sometimes neural networks aren't the best way to go.
Answer: While I admit, I tinker with Neural Networks because of my hopes in creating high level AI, however, you can look at a Neural Network as being more than just just an artificial representation of a human brain, but as a Mathematical construct.
For example Let's say you have a function y = f(x) or more abstractly y = f(x1, x2, ..., xn-1, xn), Neural networks themselves act as functions, or even a set of functions, taking in a large input and producing some output [y1, y2, ..., yn-1, yn] = f(x1, x2, ..., xn-1, xn)
Furthermore, they are not static, but instead can continue adapting and learning and eventually extrapolate(predict) interesting things. Their abstractness can even result in them coming up with unique solutions to problems that haven't haven't been thought up yet. For example the TDGammon program learned to play backgammon and beat the world champion. The world champion stated that the program play a unique end game that he had never seen. (that's pretty awesome if you ask me considering the complexity of NNs)
And then when you look at recurrent neural networks (i.e. can have internal feedback loops, or pipe their output back into their input, while consuming new input) they can solve even more interesting problems, and map even more complex functions.
In a nutshell Neural Networks are like a very very abstract high dimensional function and capable of mapping/learning very interesting things that would be otherwise impossible to program programmatically. For example, the energy needed to calculate the total net Forces of Gravity on a large number of objects is intense (you have to calculate it for each object, and against each object), but once a neural network learns how to map it they can do these complex calculations that would run in exponential or combinatoric? time in polynomial time. Just look at how fast your brain processes physics data, spatial data/ images / sound when you dream. That's the potential computation power of Neural Networks. And to also mention the way they store data is very clever as well (in synaptics patterns, i.e. memories)
Answer: Artificial intelligence is a branch of computer science devoted to making computers more 'biologic.' This is useful when you want a computer to do human(biologic) things like play chess, or imitate casual conversation.
Human brains are much more efficient and powerful in some ways than the most powerful computers, so it makes sense to try to imitate a biological way of processing information.
Comment: Too bad we still don't have a clue on how the human brain works. Maybe that's why it's so difficult to imitate it!!! :P
Answer: Most neural networks I'm aware of are nothing more than flexible interpolators. Backpropagating of errors is easy and fast, here are some possible uses :

Classification of data
Some games (modern backgammon AIs beat the best players in the world, the evaluation function is a neural net)
Pattern recognition (OCR ?)

There is nothing particularly related to human intelligence. There are other uses of neural nets, I have seen an implementation of associative memory which allowed for degradation without (much) data loss, pretty much like the brain which sees some neurons die with time.


Tracking history of a model and all the associated models to it in Rails

Question: Recently in one of my projects I was required to add functionality to track all actions(create, update, delete), redo and undo to some models.
In the project I am using Mongoid as a ODM. I can add most of these functionalities with mongoid-history. But mongoid-history can not track referenced relations. In my case I have Building model which has_many locations. When I update a location from building form(as nested attribute) then mongoid-history adds appropriate track(document) to history tracker collection but this document is not get related with the building object. Therefore when I call @building.history_tracks I can not get this history track. What would you suggest? Or am I doing something wrong?
Answer: Here is the solution I came up:
http://www.elvinefendi.com/2012/06/23/added-new-features-to-the-mongoid-history-gem.html
Comment: I am unable to open the link you have provided. please check once.


Angels came and ministered to Him. Matthew 4:11 NKJV

Question: What does it mean when the Bible said that Angels came and ministered to Jesus after He was tempted by the devil?
Comment: Are you suggesting that a simple reading of the text is not appropriate here?
Comment: Give us a hint where you are trying to take this or the context of the broader discussion this question was derived from. Angels are modern day couriers, the fact that they served Him might speak to the previous temption that refers to angels being sent to protect.
Comment: According to this verse, Angels did come to minister to Him. In our modern sense, Angels are more or less spirits. So I just want to find out were these Angels physically present, where they spirit and Jesus was in the Spirit? Was the devil physically present or did this temptation happen in the spirit realm? The bible doesn't quite state if this was a physical event or spirit @Autodidact
Comment: According to this verse, Angels did come to minister to Him. In our modern sense, Angels are more or less spirits. So I just want to find out were these Angels physically present, where they spirit and Jesus was in the Spirit? Was the devil physically present or did this temptation happen in the spirit realm? The bible doesn't quite state if this was a physical event or spirit @Autodidact
Answer: Jesus was in the desert regions. Jesus had eaten nothing for forty days and forty nights. After such a time of deprivation, he would not - humanly - have had the strength to get back to civilisation to find food. Close to death from starvation, and now no longer capable - independently - of obtaining food, Jesus was in dire need of help.
Malak in Hebrew is not specific and can mean either 'messenger' or 'angel'. It is translated both ways, mostly 'messenger' and Malachi bears the word as his name.
But I think that the Greek aggelos is more specific than the Hebrew. And the abundant use of the word in the book of the Revelation indicates just how much angelic activity there is on earth - and, particularly, in association with the Gospel of God and with the people of God.
Also, the wording of the text in question, Matthew 4:11 :

Then the devil leaveth him, and, behold, angels came and ministered unto him [KJV]

indicates a juxtaposition of Diabolos and the 'messengers/angels' who ministered to him and I would see that there is almost a certainty that these were angelic beings sent on this specific occasion to protect and to succour Jesus in his extreme condition.
Comment: So pretty much the same way the devil was able to appear and tempt Jesus, howbeit physically or spiritually, it's the same way angels appeared and fed him!
Answer: Here the simple meaning is correct. After Jesus was tempted by Satan Angels came to him to encourage him in a sense.
Jesus spends 40 days and 40 nights in the wilderness. During that time, he eats nothing. Then, when Jesus is very hungry, Satan the Devil approaches to tempt him, saying: "If you are a son of God, tell these stones to become loaves of bread." This must have been hard for him and he would need encouragement.
Comment: +1 for the insight about hunger. Do you think the angels brought him food? cf. [1 Kings 19:5](https://www.blueletterbible.org/kjv/1ki/19/5/t_conc_310005)
Answer: A spirit led life outside the realm of the world, will most definitely reveal things that we never see in the "actual real world". A world full of corruption, sometimes giving us a glimpse, even able to look inside the hearts and minds of people! Being led by the spirit will reveal things that someday will shock the world. The gift of Prophecy is one of those attributes we receive according to our faith. Surly Christ may have had a sense  of these things but without the  experience. Must we be at our weakest in the flesh to know the power of God? This is why we need to abide in Him, for we are not able to resist the wiles of Satan. This is what we see as Christ abides in His Fathers will, resisting the evil one.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


4 wire hot tub circuit installed but I only need a 3 wire

Question: I have a 240v/60amp four wire hot tub circuit.  Two black wires, one white and one green.  The hot tub we are installing only needs three wires black, red and green.  I assume the two black wires are hot.  Do I just hook the two back wires to the red and black connections, the green to the ground connection and then just cap off the white/neutral wire?
Comment: You got a good install, it allows you to connect almost anything you want.
Comment: Even better is to use all 4 wires and instead of a simple disconnect, put in an actual subpanel (cost maybe $100 extra - very little compared to the entire project). Then you can wire up separate circuits for lighting, convenience receptacles (check for minimum distance from the hot tub), etc.
Answer: That is correct. The hot tub requires only 240 volts but not 120 volts so there is no need to connect the neutral.


Suspect unfair die

Question: If I claim to have a fair die that rolls 1-6 uniformly but my die actually only rolls 1-5 uniformly (and never produces a 6) how many rolls would you need to see before you had over 50% confidence that I was messing with you?
Comment: [related question](http://math.stackexchange.com/questions/1346528/if-i-flip-a-coin-1000-times-in-a-row-and-it-lands-on-heads-all-1000-times-what)
Comment: @Omnomnomnom: Twelfth-cousin thrice removed?
Answer: You just need to compute the number of rolls that gives a $50\%$ chance of getting at least one $6$ on the assumption that it is a standard die.  That corresponds to less than $50\%$ chance of having no $6$s.  Can you do that?
Comment: Educational to see how badly the chi-sq GOF test performs against such an unusual alternative!
Answer: Power Computation for a Chi-squared Goodness-of-Fit Test: Detecting an Unfair Die
Perhaps you are using the chi-squared goodness-of-fit (GOF) test, with
test statistic $$Q = \sum_{i=1}^6 \frac{(X_i - E_i)^2}{E_i},$$
where $X_i$ is the number of occurrences of face $i$ in $n$ tosses
of the die and $E_i = n/6$ is the expected number of occurrences of each
face for a fair die. Notice that $Q = 0$ in the (unlikely) event that
each face appears exactly 1/6 th of the time. The worse the agreement,
the larger $Q$ becomes. (Although it is called a 'goodness-of-fit statistic',
it is large for 'bad' fits.)
Then for a fair die, $Q \stackrel{aprx}{\sim} Chisq(df = \nu)$ provided
$n$ is large enough that the expected counts exceed 5 (so you need
$n/6 > 5$ and $n > 30).$ You have $k = 6$ categories and $\nu - k-1 = 6-1 = 5$
degrees of freedom.
It is typical to test at the 5% level of significance. You will reject the
null hypothesis that the die is fair at the 5% level if $Q > q^*,$ where
the 'critical value'
$q^*$ is chosen to cut 5% from the upper tail of $Chisq(5).$ From tables
or from R statistical software, you have $q^* = 11.07.$
<code> q.crit = qchisq(.95, 5);  q.crit
 ## 11.0705
</code>
However, for the dishonest die you describe, values of $Q$ are inflated
and do not have the distribution $Chisq(5)$. The result is that you will
reject the null hypothesis more often than 5% of the time, if you judge
your dishonest die using the test described above.
In particular, you have asked to have a rejection rate of 50% instead of 5%
when your dishonest die is used. To find the $n$ that will accomplish that,
you need to know the distribution of $Q$ for your dishonest die.
Then $Q$ has a noncentral chi-squared distribution $Chisq(\nu = 5, \lambda)$, with noncentrality
parameter $\lambda.$ Here is how to
find $\lambda$ for your dishonest die. The null hypothesis assumes probabilities
$p_0 = (1/6, 1/6, 1/6, 1/6, 1/6, 1/6)$ for the six faces. Under the alternative
hypothesis that the die is unfair the probabilities are
$p_1 = (1/5, 1/5, 1/5, 1/5, 1/5, 0).$ Then
$$\lambda = nS = n\sum_{i=1}^6 \frac{(p_{1i} - p_{0i})^2}{p_{0i}}.$$
For your unfair die, $S = 0.2,$ so you have $\lambda = ns = 0.2n.$
<code> p.0 = rep(1/6, 6)
 p.1 = c(rep(1/5,5),0)
 s = sum((p.1 - p.0)^2/p.0);  s
 ## 0.2
</code>
Now you want to know $n$ such that
$$P(Q > 11.07 | \nu = 5, \lambda = 0.2n) = .5.$$
This probability is called the power of the test at the 5% level,
against the alternative face probabilities $p_1.$
We can find $n$ by computing the power for many values of $n$, and
picking the smallest one that makes the power exceed 0.5. The answer is
$n = 41$ (when $\lambda = ns = 8.2$)  If you were fussier and wanted a 95% chance of detecting
your die is dishonest, then you would want $n = 106.$
<code> n = 30:1000
 pwr = 1 - pchisq(11.0705, 4, .2*n)
 min(n[pwr > .5])
 ## 41
 min(n[pwr > .95])
 ## 106
</code>
The figure below shows the PDF of the central chi-squared distribution $Chisq(\nu = 5)$ for a fair die (green), and the noncentral chi-squared distribution $Chisq(\nu =5, \lambda=8.2)$ for your dishonest die (blue).
You can see that about half the area under the latter curve is to the
right of the critical value $q^* = 11.07.$

Reference: The power of the GOF test is not routinely explained in
basic statistics courses because it takes specialized software such as R
to find probabilities for the noncentral chi-squared distribution. However,
you can find an formal explanation in a paper by Guenther (1977) in The
American Statistician. (The preview page you can get in Google has the
formula for $\lambda.$ He uses detecting an unfair die as one of his
examples. If interested, you can probably find a university
library with access to the article.)
Note: In your specific case where one of the faces on your unfair die
is impossible, you could use the method proposed by @RossMillikan, and
get a smaller answer. For $X \sim Binom(4, 1/6),$ one has $P(X = 0) \approx .48.$ [Even quicker, you could likely just look at the die.
A typical unfair die might have faces 1, 2, 3 (with a common corner) slightly less likely than 1/6, and
faces 4, 5, 6 slightly more likely. This might be done by embedding a lead
weight in the plastic just beneath the 123-corner.]
Comment: Also see [this Q & A](https://math.stackexchange.com/questions/3262160/need-help-on-chi2-test/3262418#3262418) for P-value and power and references.

Suspect unfair die


What does Intercept and Ref mean in Logistic Regression Model?

Question: I am looking at a results chart from a binomial logistic regression model, and I see the following results. I am not sure what "intercept" means here. I thought "coefficient" is referring to the variable in question - so it makes no sense to have no coefficient in the first line ,

Also, is "Downtown" location being used as a reference to check the results between the two locations?
Answer: "Ref" is shorthand for reference category.  Whenever an independent variable consists of categories, logistic regression procedures (if using this particular sort of contrast -- an indicator contrast) will choose one category by default as the reference to which each other category is compared.  Here, the odds of the outcome being "1" are estimated as being lower (0.57 as high) for North cases as for Downtown cases, all else being equal.
The intercept (also known as the regression constant) tells you nothing about the role of any independent variable, but it does serve a function in a predictive equation that can be derived from output like this.  You can use the constant and the two other coefficients to assign to each observation a predicted probability of the outcome being "1", depending on that case's values for the independent variables.
Comment: I wish I could vote for your answer but the site doesn't allow me given I don't have enough reputation. Thank you, this really helped!
Comment: what do you mean by "estimated as being lower (0.57 as high) for North cases as for Downtown cases". So is it that the odds of being in North is 0.57? I've been looking into odds ratio, and for some reason, ALL examples I see starts with 1.xx, 1.57, etc. What does it mean by it's 0.xx?


Use Bluetooth access point and Wi-Fi at the same time

Question: My Samsung phone has a setting that allows it to use 4g + Wi-Fi to increase speed in some cases. Can the same be done on a MacBook with Bluetooth network + Wi-Fi?
Answer: If I understand your question correctly, the example you're using about your Samsung phone having a setting that allows it to use 4g + Wi-Fi to increase speed in certain circumstance is the same option iPhone users have (Settings > Mobile > Wi-Fi Assist). It's primarily to allow the use of mobile data when Wi-Fi connectivity is poor.
The key thing about this option is that in both cases (Samsung / iPhone) we're talking about a data connection to the internet (i.e. 4g and WiFi). What I mean is that both 4g and Wi-Fi can connect independently to the internet.
With regard to your question though, you're talking about Bluetooth and Wi-Fi. The thing is that Bluetooth in and of itself does not have a data connection to the internet - so it's not like it can assist to increase speed because it isn't connected in the first place.
Devices (Macs and iPhones included) can share their already connected internet connection via Bluetooth to other devices, but no you can't use both Wi-Fi and Bluetooth to increase an existing internet connection.
If I've misunderstood your question, please let me know.
Comment: The part where you said that it's not possible nailed it, I was indeed referring to connecting to a Bluetooth hotspot that provided internet. Thanks for the help!


Isur m'lacha starting at night on yom tov

Question: How do we know that the prohibition against doing m'lacha on chagim begins at sunset and not dawn?
Comment: @WAF, aside from my answer below, I have to take issue with your null hypothesis, because there is indeed a place where the Torah does explicitly state that the mitzvos of the Yom Tov start at night. This is in connection with Pesach: בערב תאכלו מצות עד יום האחד ועשרים לחדש בערב (Ex. 12:18).
Comment: I will be the first to admit I don't understand what the "drush" tag is intended for, or why there are no "midrash", "drasha" or "darshanut-torah-explication" tags. Can someone explain what "drush" is or how this state of affairs came about historically?
Comment: Same question exists for _Shabas_, no? OTOH, why would one think the prohibition starts with daybreak?
Comment: @msh210 - Re _shabas_ - More simple to connect it with primordial _shabas_, which began the previous night. Re the _hava amina_ - Intuition says that morning is the beginning of the day, the Torah, in commanding us to do the _mitzvos_ of the _chagim_ doesn't mention that they should start at night (null hypothesis), and those _mitzvos_ include bringing _karbanos_, whose cycles generally begin in the morning and end at the end of the night (weak support).
Comment: @Alex - _In. Hachi nami._
Comment: Your whole hava amina only starts from the fact of karbonos?
Answer: The Torah spells out (Lev. 23:32) that Yom Kippur begins בתשעה לחדש בערב, in the evening of 9 Tishrei, and that it runs מערב עד ערב, from evening to evening.
As explained by the Gemara, Rosh Hashanah 9a, the words בתשעה לחדש בערב teach us that מוסיפין מחול על הקדש - we have to start Yom Kippur a little earlier than sunset and end it a little after nightfall. The final words of the verse, תשבתו שבתכם, tell us that the same applies to Shabbos and all of the other Yamim Tovim (all of which are collectively called Shabbos, as in ממחרת השבת in connection with Sefiras Haomer). So we see that all of them begin and end at the same time.
Comment: Are you suggesting that the _isur m'lacha_ is learned out of _tosefes_ or that the _g'mara_ there says that the times are learned by means of the same _d'rasha_? In other words is the inference in your answer your own (perfectly sensible but strange to not appear in the _g'mara_) or the _g'mara_'s?
Comment: It's my own inference. The Gemara says that tosefes applies to all of them, and it seems logical to say that this means the same tosefes timewise. (The alternative would be to say, for example, that other Yamim Tovim start at daybreak, and tosefes tells us to start them earlier, say at dawn; but that would be hard to accept considering that we're deriving tosefes from the term בערב.)


Is there a way to stop Facebook videos from automatically playing without changing my entire browser settings?

Question: I've heard about Facebook introducing autoplay videos last year, but I'am only now starting to see them in my news feed. While they initially play without sound unless you click the volume icon, it's still a major annoyance to see things moving around in my news feed. I'd like to put a stop to this if at all possible.
Answer: Yes, you can. Go to https://www.facebook.com/settings?tab=videos.
The page should say Video settings, and an option on the right to disable auto-playing. I just tried it and videos do not start automatically anymore while scrolling.
Answer: You can turn Facebook's video auto-play settings on or off. To stop videos from playing automatically on your computer:

From the top right of Facebook, click  and select Settings
Click Videos in the left menu
Click the dropdown menu next to Auto-play Videos and select Off

Source.
On mobile:
You can adjust the Facebook app's auto-play settings to On, Wi-Fi only or Off.
To adjust the auto-play settings on your Android phone or tablet:

Open the Facebook app
Tap
Scroll down and tap App Settings
Tap Video Auto-play
Choose an option

Note: If you don't see the Video Auto-play settings on your Android phone, log out of the Facebook app. When you log back into Facebook, Video Auto-play should be visible in App Settings.
To adjust the auto-play settings on your iPhone or iPad:

Open the Facebook app
Tap
Scroll down and tap Settings
Tap Videos > Autoplay
Choose an option

Note: If you don't see Videos in your iPhone or iPad's Facebook app settings, try updating the Facebook app.
Source.
Answer: Update: this answer is obsolete.

Facebook unfortunately has no option to disable autoplay. The best you can do is using a browser extension such as F.B. Purity Cleans Up Facebook for Google Chrome.
Comment: This is now possible.


Influence of WordPress functions on site speed

Question: We know, that wordpress has custom functions that create in wp-includes and etc... and its system has more includes and functions(without calling)...
My question is: Is abound of wordpress functions and includes, reducing site speed or no?
Answer: Functions and includes (itself) don't affect the site performance much. But...
The code inside a function can affect site speed. It all depends what exactly that function does.
For example function esc_attr won't affect site speed, because its code is simple and will run fast.
On the other hand, functions like get_posts can take a lot of time to execute, because it has to parse your arguments, query the DB, obtain results and create objects for every row. So if you query for a lot of posts, it can consume a lot of time.
Another example of time-consuming function will be wp_remote_get. It retrieve the raw response from the HTTP request using the GET method. So you'll have to wait for the requested server to generate answer and so on.
Also, some functions run filters/actions inside. So themes/plugins may affect speed of their execution.
Comment: I think even get_posts function while didn't call, can't has any effect on site speed. Is it right?
Comment: Yes, if the function doesn't get called, then it doesn't affect site speed.
Answer: It depends on the use of functions usually the functions which are called in the frontend may effect site speed but the functions effecting in backend will not. However in most of the case the functions which are used to call another 3rd party URL may effect performace of the website


Useradd and su strange terminal behavior

Question: I used useradd to create a user called oracle
After that I used su oracle i get in terminal just a $
Do you know why the terminal is not something like oracle@laptophp:~$  and is just a $ ?
Comment: Curious. What distribution are you running on?
Comment: i use ubuntu 11.04
Answer: You probably did not create your new user with useradd -m. The -m copies the default ("skeleton") shell profile files from /etc to new users home dir.
To resolve the issue, recreate the account or just copy the .bashrc, .bash_profile and .profile files from some other user account or from /etc/profile/.
Answer: You might also take a look at PS1 environment variable. If you type export PS1="$ ", your prompt will be just a dollar sign.
Answer: I have been having the exact same problem. Turns out there is an alternative to "useradd" called "adduser". This automatically copies the skeleton and everything needed.
adduser <username>

This code prompts you to fill in information about the user, and copies everything needed (as well as setting up a user directory).
Answer: After running the env command under my new user I noticed that:
SHELL=/bin/sh

If you run the useradd command with useradd -ms /bin/bash [USERNAME] then it should work as expected.
-s allows you to modify the default shell.


Use 5v Linear Regulator and LDO 3.3V

Question: I am designing a PCB with a STM32 microcontroller, a GPS, DataLogger and X-Bee module. The power supply is a 12V Battery.
So in my project I need 5V and 3.3V, at the same time.
I don't know if it is a bad ideia to have a 5v linear regulator(input 12V) and using the 5v as input in a 3.3v LDO regulator.
I am aware of the Low Dropout properties of the LDO and the
power dissipation of the voltage regulator.
I came to this idea because the circuit used to shut down due to the temperature. I don't want to use a buck converter because I don't want to put an inductor in the same PCB with the X-bee(Radio Module).
Finally, my project is included in a car, so temperature is a thing(the engine or even sun)
Comment: It's not clear what your actual question is.
Comment: Welcome to EE.SE! Please show your schematic or block diagram.
Comment: It's generally a bad idea to use a linear regulator to drop 12V down to 5V; you'll be stuck with an efficiency of 5/12 = 42%, which is terrible.
Comment: @PauloKatsuyuki Please update your question to include your actual question, and more information (such as the current consumption, heatsinking, and possibly a circuit or block diagram). Don't put these updates in the comments, edit them into the question.
Comment: The current is about 500mA. My doubt is if it's a good idea to use an 5v Linear regulator and a 3.3v LDO
Answer: Use a non-linear power supply (i.e. a buck converter (like LM2596) in your case) for conversion from 12V to 5V. Then use a linear regulator (like AMS1117) to convert from 5V to 3.3V.

The reason why I have suggested using a non-linear power supply (for 12V to 5V) is because the heat generated by the linear one increases quite a lot with a high voltage difference and the current being consumed. This also means quite a lot of power loss.
It is safe to use a linear power supply for 5V to 3.3V as the voltage differnece is less and the consumption of high current is not expected at logic levels. But if the 3.3V devices consume upwards of about 500ma than it is better to use a non-linear one  or a linear one with better efficiency.
You can design the pcb such that the inductor and xbee radio are far away from each other or you can mount the inductor externally also. I don't think that a inductor of the size found on buck converters will cause a issue.
Use the existing schematics of development boards like Arduino, ESP, xbee shields, STM etc. to get a better idea on how to deal with this issue.
Comment: Your assumption to use a buck converter for more than 500mA is correct. But in case he would chose not to, he can always put two converters in parallel or find converters with higher capacity, That's what I would if the current required was exactly 500mA, or exactly at the maximum for the regulator.  There is also the question of power consumption and efficiency, of course.
Answer: When using linear regulators, the ordering of the regulators has little effect on overall efficiency and thus on overall heat dissipation. What it does affect is WHERE the heat is generated. Feeding the 3.3v reg from the 5v reg will ensure that the 5v reg dissipates most of the heat, while feeding the 3.3v reg directly from 12v will cause it to get a lot hotter.
For example: Say you need 0.25 A @ 3.3V and 0.25 A @ 5V. Running both from the 12V supply will cause the 3.3V reg to produce (12-3.3)*0.25 = 2.2W of heat. The 5V reg will produce (12-5)*0.25 = 1.8W of heat. The total heat produced by both regulators is 4W.
Feeding the 3.3V reg from the 5V reg will drop its heat to (5-3.3)*0.25 = 0.4 W or about 20% of before. The 5V reg now will have to source 0.5A of current so it will dissipate (12-5)*0.5= 3.5W of heat, double what it did before. The total heat produced is still 4W.
The decision as to which is better will come down to which reg IC has a bigger package with lower thermal resistance, and which is easier to attach a heatsink to. You will need a heatsink at these wattages. Shown below is an example of thermal resistance specs for an IC in a fairly large TO package. Note that without a heatsink, the "Junction to Ambient" is the spec that applies. 40 degrees per watt means 2W dissipated into an enclosure at room temperature will have the device running at over 100 degrees. Remember that the inside of your enclosure may heat up far above room temperature. A good heatsink on the same device might have a conduction to ambient of only 0.5 degrees per watt, bringing the junction temperature down to just a few degrees above the enclosure temperature.

Nice heatsinks are available from various catalog suppliers online, for nearly any package you might have. Careful design of your PCB can increase the amount of heat removed from the device, and ensure that heat is directed away from other sensitive components. Ensure you have as much copper as possible on the traces connecting to your regulators, think about getting your board made with 2oz copper, and look to see if your regulator is available in various packages. If you are using surface mount regulators, liberal solder application to the large tab and possibly a surface mount heatsink are helpful.
Finally, if you still find the heat produced to be a problem, or you are running off the battery for long periods of time without the vehicle running, a switching supply may be the only option. Noise concerns can be tricky, but if you have room, a simple solution is to separate your supply completely from the rest of your circuit. Having an external PCB to do the step-down even just to five volts will really reduce the heat your board has to endure, and vastly improve your efficiency. Enclosing the external supply in a conductive case and paying some attention to filtering its output should give you a very workable solution.
Comment: @Fredled  Series linear regulator are *that* inefficient when Vi is much greater than Vo.  Low efficiency is the price we pay for their relative simplicity and absence of switching noise.  (If you feel that an experiment is called for, I encourage you to perform one.  It will be illuminating for you.  All you need is a benchtop power supply, a multimeter, and the series linear regulator.)
Comment: That is exactly how they work. "The regulating device is made to act like a variable resistor" [link](https://en.wikipedia.org/wiki/Linear_regulator) Thus burning up all excess voltage as heat. Their efficiency is directly equal to Vo/Vi. [link](https://www.analog.com/media/en/technical-documentation/application-notes/an140fb.pdf) In fact you can use a simple resistor in cases where you have a constant input voltage and a constant load and the efficiency will be exactly the same.
Comment: I doubt voltage regulator ic's produce as much power dissipation as you calculated. They have internal circuits to make the convertion more efficient. Otherwise you could as well use a simple resistor. Your formula applies to resistors dissipation. I don't think they apply to voltage regulators. That being said, it doesn't mean that heating shouldn't be taken into consideration.
Comment: I'm not going to saying you are wrong, just that I doubt it's as inneficient as a resistor. The block diagram of the MC7800 or UA78M is more complex than the wikipedia or the application note you provided which doesn't mean anything. Regulation is based on a transistor not a resistor, that's why I think it may be more efficient. It still needs a heatsink at full capacity. But you will never have 500mA from 35V to 5V (15W dissipation) with a simple resistor but you can achieve that with this ic. So it's not exactly "as if it was" a resistor even if it "acts like" one.
Comment: To be sure one should run an experiment.
Comment: @Nick Alexeev Yes I'll definetly run an experiment one of these days. The datasheet of the model I have (MC78M00) is not clear about how to calculate power dissipation. They show a graph with  the DPAK version on a large copper pad (?).
Answer: The professional/pedantic way to design such a board with RF requirements:

Step-down switch regulator from 12 volt to 5V, to supply general 5V plane.
Step-down switch regulator from 5V to 3.3V, to supply general 3.3V plane.
LDO from 5V to 3.3V to supply radio parts only.

The switch regulator's inductor is of little concern if the PCB layout is proper. There's quite a bit to be said about that topic and I'm not the right person to do it. Read all app notes by the manufacturer of the regulator.
But in a project with the above level of noise/immunity concern, you wouldn't be using a hobbyist radio module in the first place. I'd be far more concerned about what that module spits back onto my PCB, than the other way around.
Comment: If one were going to be transmitting at 600 mhz or so, wouldn't one want to use a RF module? or should it be done from more basic components? If one were doing a small run of about 5000 parts?

Use 5v Linear Regulator and LDO 3.3V


confidence intervals 95% we do z = qnorm( 0.95) or z = qnorm( 0.975)

Question: I want to know for sure when we compute the 95% confidence interval for mean/prop, we get z = qnorm(0.95) or z = qnorm(0.975)?
Answer: As I understand it, you want to know when to use a certain quantile (qnorm). This will depend on the level of significance set for your test. For example, consider a hypothesis test on which you want to test, $H_0: \mu = \mu_0 \: \times \: \mu \neq \mu_0$. It is known that
$$Z_{test} = \frac {X- \mu_0}{\sigma} \sim N(0,1)$$
As it is a bilateral test (see the hypotheses), the level of significance set is associated with the quantile of your test statistic ($ Z_ {test} $). For, $\alpha = 1- \lambda/2$, because the test is bilateral ($\alpha$ being the level of significance and $\lambda$ being the associated trust).
If you set a significance level of say $ \alpha = 0.05 $ you will have the equivalent quantile will be the $\lambda = 1-\alpha/2 = 0.975$ quantile of an $N(0.1)$, that is, $qnorm(.975) \approx 1.959964$, if $\alpha = 0.1$ the quantile will be $qnorm(.95) \approx 1.644854$.
Hope this helps!
Comment: despite having interpreted hypothesis tests, the connection is direct to confidence intervals.


Is the Quot-scheme over non-singular curve reduced

Question: Let $k$ be an algebraically closed field, $C$ a non-singular projective curve over $k$ of genus at least $2$ and $\mathcal{F}$ a locally free sheaf on $C$. Let $r,d$ be two integers satisfying $\mathrm{gcd}(r,d)=1$ and $r>0$. Denote by $Q$ the Quot-scheme parametrizing quotients of $\mathcal{F}$ of rank $r$ and degree $d$. Is every irreducible component of $Q$ (generically) reduced i.e., for a general point $x$ of the irreducible component of $Q$, the local ring $\mathcal{O}_{Q,x}$ is reduced?
Comment: The Quot schemes can be disconnected.  For $g$ equals $4$, for $C$ general, for $\mathcal{F}$ equals $\mathcal{O}_C^{\oplus 2}$, for $r$ equals $1$, and for $d$ equals $3$, the Quot scheme has two connected components.  This corresponds to the fact that there are two $g^1_3$s on $C$.
Comment: Sorry, I misread the question.  If you specialize the curve $C$ from my previous comment to one whose canonical image lies on a singular quadric cone, then I believe that the Quot scheme is nonreduced.  Certainly the corresponding scheme $G^1_3$ is nonreduced.
Answer: This is false, at least for special $C$ (perhaps it is true for $C$ that are sufficiently general in moduli).  The simplest counterexample I know of is a genus $4$ curve $C$ that is non-hyperelliptic and whose canonical image is contained in a singular quadric hypersurface in $\mathbb{P}^3$.  In this case, the scheme $G^1_3$ equals $W^1_3$ inside $\text{Pic}^3_C$, and this is one nonreduced point.  For the invertible sheaf $\mathcal{L}$ on $C$ parameterized by this point, $\mathcal{L}$ is globally generated.  Thus for $\mathcal{F}$ defined to be $H^0(C,\mathcal{L})\otimes_k \mathcal{O}_C$, the natural homomorphism, $$\phi:\mathcal{F} \to \mathcal{L},$$ is surjective.
Since being invertible is an open condition on flat families of coherent $\mathcal{O}_C$-modules, every small deformation of the quotient $\mathcal{L}$ is an invertible $\mathcal{O}_C$-module of degree $3$ that has a $2$-dimensional vector space of global sections, and conversely.  Thus, there is a smooth morphism from a Zariski open neighborhood $U$ of $[\phi]$ in the Quot scheme to $W^1_3$.  Since $W^1_3$ is nonreduced with nilradical a rank $1$ vector space over the residue field, also $U$ is nonreduced with nilradical an invertible sheaf on the reduced scheme of $U$ (which is smooth).


Which databases are recommended to be used as embedded databases?

Question: Which databases are recommended to be used as embedded databases to store data within an application?  The embedded database may or may not synchronize back to a larger system database.
Comment: This question is not automatically bad, but in that form it is. See: http://blog.stackoverflow.com/2010/09/good-subjective-bad-subjective/
Answer: A list can be found on Wikipedia. I think the overwhelming leader in embedded sql databases is sqlite. Found everywhere!
Comment: I'm gonna go with this is an excellent example of why this question isn't right for the site. Because all we have to do is turn to WP and get the answer. I don't like it.
Answer: SQLite is probably the most commonly used one.  It is light weight and has an open license.  SQLite is being used by many embedded systems including Apple's iPod/iPhone/iTouch line of mobile devices, Google's Android phones, and Airbus aircraft.
Given this I would probably recommend its use, but I will say that I myself have not used it for an embedded system.
Answer: At my previous employer, we sold applications with SQL Server Compact as the embedded database. It has some quirks, but it works reasonably well.
Comment: SQL Server Compact edition is probably the most used embedded database platform out there.  Every Windows installation from Vista up (and probably XP) has at least one program using it, Windows Media Player.  Anyone using the Zune software is also using it.
Comment: This however, makes me think that the question is acceptable, but not with the current wording.


Meaning of 他希望自己的知識面能更加寬闊

Question: 他希望自己的知識面能更加寬闊
What does 面 mean here? It seems unnecessary because 他希望自己的知識能更加寬闊 is much more clearer. Thanks.
Answer: 知识面: range or scope of knowledge
他一向主张大学生的知识面要宽一些。
He has always been of the opinion that university students ought to have a wider range of knowledge.
Answer: Here, 面 shall be interpreted as "dimension".
More formally, the sentence should be "他希望自己的知識層面能更加寬闊". "層面" is a word for "范围" or "领域" in Chinese, and "aspect" or "level" in English, so the person is wishing to diverse/broaden his knowledge base.
Answer: 知识面 means 智力成果的范围 scope of knowledge, use wide or narrow to describe it.
But I didn't find one answer for sure, so I show all my thought in the following.

面 is 方面 (aspect), 宽阔 means wide. 知识面宽阔 means someone knows many different aspects/kinds of knowledge, such as biology, geography, literature, art and so on.

面 is 平面 (plane) can also help you understand that. Imagine knowledge as a plane, so the more knowledge you have, the wider this "plane" will be in terms of area. I feel this description just like "broaden your horizon"…

Without 面, your sentence is not about width in the area, but quantity.
You can use 他希望自己的知識能更加丰富.
丰富 means rich, to emphasis on the quantity of knowledge. "enrich one's knowledge"
Hope this can help :)

Meaning of 他希望自己的知識面能更加寬闊


Managed hosting for Java websites?

Question: What is a good managed hosting service for server side Java code which uses Tomcat servers? I want something that is like Heroku (for Ruby), Gondor (for Python), no.de (for node.js). I know there is Google App Engine out there but I am not a fan of the GAE - I want my plain-old tomcat server side code hosted in a clean, cheap, managed way like the aforementioned websites.
Comment: You meant Google App Engine, instead of GWT right?
Answer: I've had good experiences with my current host: Java Web Hosting.  Good service when things go wrong (generally because of something I did) & reliable servers.
Disclaimer:  Java Web Hosting hosts 4 sites for me, free of charge.  They put no conditions on the hosting, but I figured they deserved a link from pages of my sites.
Comment: Thanks for the info! A Google search for "managed tomcat java hosting" yields of tons of results like these but none of them seemed as polished (not just pretty landing page but modern features like git-based workflow, dependency management, easy to use console, tiered pricing) etc. These websites (atleast on the first page of Google) all seemed circa-2000ish.
Answer: To answer my own question - I found the exact thing I was looking for. The Play framework is a clean, concise and easy to use Java web framework and they have a drop-and-forget (but slightly pricey) managed hosting available at PlayApps.

Managed hosting for Java websites?


ESTA re entry into USA

Question: We travelled for 90 days  between July and Oct 2018.
Then Hawaii Dec 2018.
Can we come back to the States June to Sep 2019?
Comment: The question needs more specifics. Where were you traveling between July and Oct 2018? Why mention Hawaii, it is part of the US, a U.S. State the same as Florida, etc.
Comment: @L Walker Where are you actually resident? What are your ties to that country? What is the purpose of such lengthy repeated visits?
Answer: The Visa Waiver Program allows ESTA holders to enter the US for tourism for up to 90 days per visit. There is no specific time period that you must stay out of the country, or any specific ratio of time spent inside vs outside.
Having said that, the immigration officer will make a determination when you present yourself at the border, whether to admit you under the VWP. They are not under any obligation to admit you just because you hold an ESTA, and they may refuse entry for any reason.
With your travel history, it doesn't seem like you would be trying to live within the US through frequent visits, so I don't see any reason why you would be refused entry. There are never any guarantees, of course.

ESTA re entry into USA


Can I create a custom property for the modifier stack?

Question: I'm adding expression drivers to my modifiers structure. One of the variables I constantly use in different modifiers is the number of frames. Is there any way to attach the driver to a custom property that will be located in my modifiers stack so I see it while working with other parameters in my modifiers? The modifiers that I am using don't have a custom properties panel. But perhaps there is a trick?...
Comment: Hii, let´s see. So you want add a driver to one of your modifiers, but the modifier itself doesn,t have a custom properties panel? Which modifiers are you using? Can you also post a screenshot of what you're trying to do? :).
Answer: Why not just use a custom property of an object? You can see it and modify it in Numbers Panel while working on modifiers:

(after creating the property simply right-click on the field and choose "copy as a new driver", then paste that driver in your modifiers)
Also remember you can setup a layout where you can see the contents of multiple instances of the Properties Editor:


Who succeeded Tessio after his execution?

Question: After Tessio was executed for setting Michael up, who took over his territory?
Answer: Although Tessio (and Clemenza) indeed wanted to go independent when Vito retired, they would only be allowed so upon Corleone's move to Nevada.
So, when Tessio refers to his "territory" in Brooklyn when talking to Michael about the proposed "meeting" with Barzini, that was merely his land property (as opposed to a crime domain under his control). He was still Corleone's caporegime, not an independent crime boss.
Presumably, upon Tessio's execution, his Brooklyn property became his heirs' (if he actually owned it and had heirs). Otherwise, it remained Corleone's, and was given to Clemenza (and then to Frank Pentangeli) after the move to Nevada.
Comment: @OldPadawan If we're talking about his legal successors (estate heirs), the movie says nothing about them as far as I remember (not sure about the novel though). Indeed, why bother the audience with such an immaterial detail? But if we're talking about his criminal domain, the movie is clear in that he had nothing on his own, and all the New York family business went to Clemenza/Pentangeli.
Comment: Have you anything to back this up? I think it would be interesting. I've always asked myself who was Tessio's successor but found nothing.
Comment: Yes, I was talking about the criminal part: if it is said/written somewhere that Michael Corleone named someone. Just wondering :)


Expected number of connected components in a random graph

Question: For a random graph G(n,p) what is the expected number of connected components? What is the probability distribution of this value?
I'm specially interested in what happens for small values of p, before the giant component emerges.
Comment: Your questions might be answered [here](http://projecteuclid.org/download/pdf_1/euclid.aoms/1177706204) or [here](http://projecteuclid.org/download/pdf_1/euclid.aop/1176996856).
Comment: IIRC, there is an answer in N.Alon & J.Spenser "The Probabilistic Method".
Answer: Have a look at Chapter 11 of Alon and Spencer's The Probabilistic Method. They focus entirely on the case $p = \Theta(1/n)$, and the smallest p they consider is of the form $c/n$, which perhaps counts as "small p" as in your question. In 11.6, they study the smallest case $c < 1$ in detail (they refer to this case as Very Subcritical). The results are always asymptotic as $n\to \infty$. They prove that the size of a component is modeled well by a Poisson Branching Process, so 11.4.2 gives you the probability distribution of sizes of components. Now it's a simple exercise to find the expected number of components: do a branching process to fill up the first component, then do one for the second, etc. until you run out of vertices. Write down how many components you ended up with.
Answer: See Mathew Kahle and Elizabeth Meckes "Limit theorems for Betti numbers of random simplicial complexes"
They say that the distribution is Gaussian in $G(n,p)$ with $n \to \infty$, but only state the theorem for first homology or higher i.e. not for connected components. Nevertheless, the number of components converges via a central limit theorem to the normal distribution.
In fact, asymptotically almost all nodes are isolated when $np \to 0$ as $n \to \infty$.
With $np \to c$ with $0 < c < 1$, we have normal isolated nodes, normal 2-cliques, and so on. Though they intersect, this is vanishingly small as $n \to \infty$, so the branching processes are asymptotically independent. How many branching processes survive until exactly displaying cardinality 2 (i.e. one child)? Then count three, four etc. All normal, but expectation and variance need to be calculated. See the comments to the OP.
When critical, also normal. When there is a giant component, as long as $n$ is large, then the expected number of e.g. isolated vertices is large, so asymptotically normal. All we need is an asymptotically infinite number of connected components I think. See the proof in that paper.
If, for example, $np = c \log(n)$ with $c>1$, then the number of components is the number of isolated nodes plus one for the giant component itself. This is because each node has binomial degree with expectation $np$, and in the limit is isolated with probability $e^{-np}$. So coin toss for each node i.e. take $n$ chances of being isolated with this probability, giving $\mathbb{E}I_{0} = n e^{-np}$.
When the graph is a.a.s. connected, there is only one component. But this is just normal, with zero variance and unit mean. In fact, all the Betti numbers of the corresponding random clique complex are normal. The main theorems in that paper give the normality, and formulas for the expectation.
Answer: In case this isn't obvious, a simple insight used in many papers is that for small p, the network is (whp) simply a random tree, which allows for simple estimates of these and many other properties.
Added in response to comments:
oops, I should have said "tree-like" and one can use "tree counting" techniques to analyze the structure of the connected components.  This is discussed in the classic paper by Newman, Strogatz and Watts -- http://arxiv.org/pdf/cond-mat/0007235v2.pdf
Comment: It's a good *start* to an answer, but please consider fleshing it out more.
Comment: s/tree/forest.  Also, for $p<\frac{1}{n}$ before the giant component appears, you are likely to see a small number of cyclic components.
Comment: A very small number of cycles if p=a/n for a<1.  For example, the expected number of 3-cycles is approximately $a^3/6$ as n-->\infty.  The expected number of all cycles is a function of a independent of n in this limit, so irrelevant for counting arguments.
Answer: For $p= \frac c N$, the mean number of components per node is $(1-s_0) (1- \frac c 2 (1-s_0))$, where $s_0$ is the fraction of nodes in the largest component. (So, trivially, in the non-percolating phase for $c<1$, where $s_0=0$, one obtains $1- \frac c 2$, which corresponds to the simple argument to having $N$ nodes and $M=\frac {N(N-1)} 2 \frac c N= \frac {c(N-1)} 2$ about $\frac {cN} 2$ edges, i.e. in the loop-less case, about $N-M=N(1- \frac c 2)$ components).
The result, including the full distribution, also in the percolating phase, can be found (obtained by statistical mechanics methods and simulations) in J. Stat. Phys. 117, 387 (2004), see also https://arxiv.org/abs/cond-mat/0311535.


What sample rate should I use on my ADC?

Question: I have an ADC that will have a guitar track as an input. I want to find which notes are hitting via the frequency domain. Given that guitar frequency range is from 82Hz to 1046Hz which sample rate (window) should I choose? I had read on an article about some kind of rule but I can't find it..
Answer: Depends on your specific application. First of all the guitar has a lot bigger frequency range than you indicate. While the fundamentals are in this range, the guitar has a lot of harmonics and in fact the bulk of the energy is in the harmonics, not the fundamental. So when you plug the low E string at 80 Hz, there is actually not that much energy at 80 Hz but way more at 160Hz, 240Hz, 320 Hz, etc. Same for the higher strings.
In the case it may be simplest to take an off the shelf audio ADC that operates at some standard rate (8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000). The exact choice  depends on the requirements for your application. For ,say, a tuner, I'd do at least 16k.
Answer: Strictly speaking, according to the sampling theorem, you would need to sample at a rate that is at least twice the bandwidth of your signal (which is around 960 Hz in your example). The low end of your band is close to zero, so you'd probably want to sample at 2092 Hz at least. In practice, you'll want to give some additional headroom to allow rolloff of your analog antialiasing filter, so that might put you in the 2500-3000 Hz range. Depending upon what hardware you're using for analog-to-digital conversion, there may be some restrictions as to what rates it supports; you'll need to take this into account as well.
Answer: A guitar's actual spectral frequency range is not what you stated.  Guitar strings often put out sounds consisting of a lot of higher harmonics of the note pitch that are sometimes more useful in determining the pitch than trying to estimate pitch from a weak or even missing fundamental in the spectrum.  Thus a sample rate significantly higher than 2X the highest pitch may prove to greatly increase the reliability of your pitch detection/estimation algorithm.  You will also need to sample at above 2X the cutoff frequency of the required anti-aliasing low pass filter.
For guitar sound, using just the magnitude peak from a windowed FFT (for any window length) is unlikely to be a reliable estimator.


How do I measure a single qubit in a two-qubit state?

Question: Let us suppose that I have the state
\begin{equation}
\frac{1}{\sqrt2}(\alpha|0\rangle|+\rangle+\beta|1\rangle|-\rangle)
\end{equation}
and I choose to measure the first qubit in the basis $\{(1/\sqrt{2})(|0\rangle\pm e^{i\phi}|1\rangle)\}$.
How can I perform this measurement and how can I find the related outcomes (i.e. the eigenvalues) provided only the basis in which I have to measure the system? Being kinda new to quantum mechanics I am really confused about the algebraic aspects of this problem, but I have an intuitive idea of what performing a measurement is.
Answer: Let $P_{\pm}$ be the projectors onto the two orthonormal basis states of the measurement. So,
$$
P_+=\frac{1}{2}(|0\rangle\langle 0|+|1\rangle\langle 1|+e^{-i\phi}|0\rangle\langle 1|+e^{i\phi}|1\rangle\langle 0|).
$$
Also, let $|\psi\rangle$ be the state that you're measuring (note that this must be normalised. Yours might be depending on your constraints on $\alpha$ and $\beta$, but we wouldn't usually have a factor of $1/\sqrt{2}$ present).
Since you are measuring the first qubit of two, the actual projectors should be written as $P_\pm\otimes I$. Now, we get the + result with probability
$$
p_+=\langle\psi |P_+\otimes I|\psi\rangle,
$$
and if the result is $+$, the state after measurement is
$$
(P_+\otimes I)|\psi\rangle/\sqrt{p_+}.
$$
In this case, $p_+=p_-=\frac12$.
Comment: Thank you, but I have one more question: how can I know that the eigenvalue is +1, in the case of $P_{+}$ (or -1 for the other projector)? I mean, which matrix do I have to diagonalize?
Comment: It's not about diagonalising matrices (unless your measurement is specified as a Hermitian operator, which it isn't here). Instead, you're given a state $|\phi\rangle$ to project onto, so you construct the projector $P=|\phi\rangle\langle\phi|$. By construction this has one eigenvalue 1 and the rest 0.
Comment: So it's just a convention the fact that in many textbooks state $|+\rangle$ has eigenvalue +1 and $|-\rangle$ -1? I thought that it was related to the fact that they are eigenstates of the $\sigma_x$ matrix with eigenvalues respectively $\pm 1$ and that there was a way to generalize that for states with $e^{i\phi}$ phase factor.
Comment: It is exactly related to that, but it only makes sense if you specify the operator rather than the states. Similarly, you can take $\cos\phi\sigma_x+\sin\phi\sigma_y$. But it is just arbitrary. There's no reason I couldn't use $-\sigma_x$ instead of $\sigma_x$. I'd just end up with different labels, but they are just labels for the underlying measurements.


How to assign a specific group to a Sharepoint page within a site?

Question: I have a lot of people that use a Sharepoint website and we only want specific groups to have edit rights to specific pages. We have our groups created, but when we add them to the site, it adds them to the whole site to be able to edit everything and not just a specific page, per group. Basically, specific groups will have edit permissions on specific pages. Whereas the Owners have full control over all pages.
Answer: Pages are stored in libraries, and like any other regular libraries read-only permission can be granted to the entire library as well to individual pages.
Steps:

Site Settings -> Site Content
Site Pages Library if the page is in this library or Pages library
Gear Icon -> Library Settings
Permission for this document library
Stop inheriting permission
Grant specific group read permission to the library
Grant read only permission to specific page by selecting the page and then Manage Access

Here is an article showing details how to accomplish this.
MS Document showing how to customize permissions for a SharePoint list or library


performSelector in NSOperation subclass

Question: I couldn't find an answer anywhere else on the net so any help would be appreciated.
I am tying to create a system whereby I can retrieve the results of an NSOperation task, which I understand cannot be done by concrete subclasses such as NSInvocation.
I have an NSOperation subclass (TheEngine) which is abstract by convention and must be extended to implement the function -main, to include the body of code to execute.
TheEngine contains the following initialisation function whose job is simply to note theSelector and theObject the selector belongs to. It also registers a KV observer for the property isFinished :
-(id)initWithCallbackSelector:(SEL)theSelector inObject:(id)theObject

In my observeValueForKeyPath:ofObject:change:context: function I would like to call the callback function like so:
NSLog(@"Some debug text to ensure this function is being called", nil);
[theObject performSelector:theSelector withObject:someData afterDelay:0];

The  whole process goes like this:
aViewController fires up an extension of  TheEngine - lets say TheTask by calling the following and adding it to an operations queue.
TheTask* TT = [[TheTask alloc] initWithCallbackSelector:
    @selector(resultHandler:) inObject:theObject];

Everything seems to run as expected without any errors or exceptions at all. But when execution reaches the observeValueForKeyPath:ofObject:change:context: the callback is not actually called. I'm new to Obj-C, so I'm not entirely sure if my understanding of this type of threading is correct.
Here is the entire code:
-(id)initWithCallbackSelector:(SEL)theSelector inObject:(id)theObject{

    if([self init]){

        self.selectorsParentObject      =   theObject;
        self.selectorToCallWhenFinished =   theSelector;

        [self addObserver:self forKeyPath:@"isFinished" options:NSKeyValueObservingOptionNew context:NULL];

        return self;
    }

    return nil;
}

-(void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)theObject change:(NSDictionary*)theChange context:(void*)theContext{

    if([keyPath isEqualToString:@"isFinished"]){

        NSLog(@"activity is finished with change: %@", theChange);

        NSLog(@"target object: %@", self.selectorsParentObject);
        NSLog(@"target selector: %@", NSStringFromSelector(self.selectorToCallWhenFinished));

        //[self performSelectorOnMainThread:self.selectorToCallWhenFinished withObject:self.resultData waitUntilDone:NO];
        [self.selectorsParentObject performSelector:@selector(selectorToCallWhenFinished) withObject:self.resultData afterDelay:0];
    }
}

Any help appreciated!
Answer: Your NSOperation is likely running on a background thread. If that thread goes away, or if that thread fails to pump its run loop, then your call to performSelector:withObject:afterDelay: will not fire. You commented out a call to performSelectorOnMainThread:.... Did this work?
You probably should be running this on the main thread or running this with performSelector:withObject: (without the afterDelay:). performSelector:withObject: does not require a run loop.
Comment: thanks for the tip, your hunch turned out correct - I will post the changes I made :)
Answer: As Rob suggested, the code was running in a background thread, as was the call observeValueForKeyPath:ofObject:change:context:
I had initially changed the code so that the selector was fired on the main thread with [self performSelectorOnMainThread:@selector(runCallback) withObject:nil waitUntilDone:NO];.
But in this case the main thread turns out to be the TheTask and an exception was thrown as TheTask does not own theSelector. To correct this, I created an extra function -runCallback and fired it from
-(void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)theObject change:(NSDictionary*)theChange context:(void*)theContext{

    if([keyPath isEqualToString:@"isFinished"]){

        NSLog(@"activity is finished with change: %@", theChange);

        NSLog(@"target object: %@", self.selectorsParentObject);
        NSLog(@"target selector: %@", NSStringFromSelector(self.selectorToCallWhenFinished));

        [self performSelectorOnMainThread:@selector(runCallback) withObject:nil waitUntilDone:NO];

        //[self performSelectorOnMainThread:self.selectorToCallWhenFinished withObject:self.resultData waitUntilDone:NO];
        //[self.selectorsParentObject performSelector:@selector(selectorToCallWhenFinished) withObject:self.resultData afterDelay:0];
    }
}

and in the -runCallback:
-(void)runCallback{

    [self.selectorsParentObject performSelector:self.selectorToCallWhenFinished withObject:self.resultData afterDelay:0];

}

This called theSelector in TheTask with the correct data.
Thanks for participating :)

performSelector in NSOperation subclass


What are the advantages of buying a Mac at an Apple Store?

Question: I'm trying to determine if it's better to purchase a Mac from an Apple Store or from a separate retailer. Beyond the hands on and focused purchase experience are there long term advantages derived from an Apple store purchase (ongoing support etc.) as opposed to purchasing from an independent retailer?
Answer: Aside from the service and other qualitative aspects of dealing directly with Apple, the only "advantage" of purchasing direct from the company is the up to date warranty registration. If you purchase your Apple product through a 3rd party, Apple will have on file an "estimated" purchase date based on the model's manufacturing date.
If you want to claim all of the 365 days on your warranty, you will have to send them the receipt (a scan or picture suffices) in addition to other purchase information so they can update their database to reflect the exact date of purchase.
Other than that, it makes little difference at the end of the day.
Answer:
Apple One to One is only available at the time of purchase and only from Apple online or retail.
Apple retail store return policy is excellent.  I did not know which of three USB hubs would satisfy the taste of an interior-decorator client, so I bought them all, let her decide, and returned the rejects.  I did not know which portable wireless speakers would perform better, so I bought two and returned one after in-home trial.  I did not know whether my home network would see any improvement from the 5th generation Airport Extreme, so I bought three, experimented, and returned one (performance improved about eightfold).
Answer: There isn't a meaningful difference between buying at an Apple Store or another retailer beyond your experience in-store. Personally, I prefer Apple stores to most of the other computer retailers just in terms of shopping experience, but a new Mac is a new Mac.
Answer: You get a lovely drawstring handled bag with the Apple logo for one.
Also, if you have an Apple ID they will email a copy of your receipt to the associated email address.
Comment: The bag depends on the location and the item purchased. I actually haven't seen them here in Canada. Additionally, they will email a copy of your receipt to any email address, not just the one you used to create your Apple ID.
Answer: You cannot take the year of Apple classes for $99 if you don't purchase there. I called because I wanted them to price match a deal from Best Buy for MacBook Air . They discounted but would not match( almost $80 difference).I asked about the classes and they said you can only buy them if you get it at their store. So I would be paying $80 more and tax on that, plus the $99 for classes. Sad because I was really looking forward to them.
Answer: If you buy something from the Apple Store, for example a Macbook, and a newer model comes out within two weeks, they will swap it no questions asked for a new one. You have to have all original packaging. Also, I tried to do this after throwing away the packaging, and they couldn't swap the computer, but gave me back around $200 to compensate (after some of cajoling).
Answer: I had other experiences. In my AppleStore in Zurich the "purchase adviser" would not know the difference between  a i5 and i7 processor. Well, he didn't even know that these processors exist.
I strongly doubt that people in the AppleStore have any clue what they are selling.
That's my reason to go 3rd party.


Writing a GUI in squeak

Question: How can I write a GIU in Squeak?  I'm a Smalltalk newbie and I'm using Cincom's VisualWorks at the moment but I'd like to give Squeak a try. I see that Squeak has Morphic for graphics but for the life of me I can't seem to find a package to write an MVC based GUI.
Answer: Squeak includes all the classic MVC classes, but you can also create GUIs using Morphic, indeed much more interesting ones than you can (easily) with MVC - that is after all why Squeak was created!
Note that you may get a better response posting somewhere more specific - there don't seem to be many Smalltalk people on SO. Try http://news.gmane.org/gmane.comp.lang.smalltalk.squeak.beginners to start with.
Comment: Thanks Neil, hopefully more Smalltalkers will gravitate to SO - it's not a bad site...
Answer: GUIs and Squeak are first and foremost very confusing. It is fairly easy to create a GUI using Squeak. Basically, you just draw a few rectangles, copy some text boxes, the haloes of very much every morph allow for cloning and then you can drop these morphs into your new UI. It is more difficult to add YOUR behaviour to the UI you just created since you somehow have to find your widget in the code browser.
This is the part where I would like to point out that I find the Morphic implementation in Squeak very annoying. So, maybe I've mistaken all of this, but this is how I see it. Morphic was DESIGNED to allow you to graphically construct your own UI with just a few clicks. And it was designed so in the Self programming environment, where there is no Browser-objects gap. Registering your clone into the ordinary code tree is a triviality in Self. (It is of course not trivial to export your program, but then again, in Smalltalk that is never easy anyway).
So, the real world morphic code that I come across usually treats morphs like any other UI framework objects: creating the UI from code, ignoring the graphical building. I have not seen a convenient way to "shock freeze" a morphic UI into a file the way Interface Builder does on Mac OS X. Or, more generally, if you click together a morphic UI, it is difficult to access it from the Code Browser.
The hint from Neil to leave the whole Morphic thing aside and turn to MVC might be understandable. Yet, the few times I have had to deal with user interfaces in Squeak, I examined UI generation code from around the image and tried to mimmick their style.
Answer: Try the Morphic Designer:
https://www.hpi.uni-potsdam.de/hirschfeld/trac/SqueakCommunityProjects/wiki/designer
Bye,
Marcel Taeumel
Answer: Depends on what you want to do, who your audience is. The original MVC is fast but is not really maintained anymore, and it looks very 1980ish. The original Morphic in Self might have been nice, but in Squeak it has evolved into a spaghetti mess. Have a look at a few classes at the top of Morph's inheritance hierarchy...
There is some effort in Pharo to bring a nicer look to the Morphic widgets, so it doesn't frighten newcomers away the second they open an image. Also there are promising GTK and Objective-C bindings under work that I'd love to see gain more use. Finally, we see more and more web apps... Seaside can be a nice alternative to native UIs, since it excels at web applications with complex flows.
Answer: We have an off-the-shelf, Windows, application written in Squeak. Most of it is done with Morphic. Morphic provides alot of value for the main user experience. Software configuration though was 'weird' when you used dialog boxes, file selection, etc.
I was really happy to discover WxSqueak recently which gives a native experience from Windows. I'm using it in conjunction with Morphic.

Writing a GUI in squeak


Can I change my Schengen Itinerary after refusal for the re-application?

Question: Last week, my Schengen application via France was refused. Can I reapply immediately to a different embassy (Greece) with a shorter itinerary? I originally applied for 24 days and I want to shorten in to 14 days. Should I also change the submitted letter of approved dates of leave? I will also be submitting additional documents I failed to attach on my last application like properties I owned.
Answer: Yes. But keep in mind that a steady, well-documented income is more important than the assets you own.

You can reapply immediately, at the same or a different embassy. Where you make your application depends on your itinerary. The Greek officials will see your visa history, of course.
It might make sense to write a short paragraph in a cover letter to explain that you have been refused before because you did not submit enough documents, and that your itinerary changed accordingly.
Getting a visa for 14 days will not be easier than getting a visa for 24 days.


Complement DCFGs and handles

Question: If I have a DCFG G for some language over {0,1}* and a DCFG H for its complement, with disjoint non-terminals, and a (perhaps partially reduced) string, can they both have a handle for the string? So the right hand sides of these rules would consist of only terminals and one would be a (maybe proper) prefix of the other. I think it's possible but I'm not certain and can't quite show it.
Answer: What you want is not necessarily possible. So you have to build grammars
that will make it possible.
Try prefixing both languages by $\{0,1\}^3$ (for example).  That is,
if $L_G$ and $L_H$ are the languages corresponding to your grammars,
consider the languages $\{0,1\}^3$.$L_G$ and $\{0,1\}^3$.$L_H$.
You should be able to build grammars for them, and also prove that
they are complement of each other. You should also be able to show
that since, there are DPDAs recognizing the two languages $L_G$ and
$L_H$, you can build from them DPDAs that recognize your augmented
languages.
If you build the grammars as you should (it is very easy), you will
get your double handle.
The only problem is that, since both handles are on the same side, you
cannot use them for a bicycle, or for a heavy pot.
Comment: Thanks for the reply, good to see it is at least possible. I should have mentioned, I'm specifically looking at permutation-invariant languages (ex. "more 1's than 0's"), if that makes a difference for showing it's (im)possible using the unmodified languages.
Comment: @sjmc That seems a strange problem you are working on. Clearly, my
suggestion does not preserve the permutation invariant property.
Permutation closure will add many other strings to each language in
general, and they will not remain complements of each other.
Comment: Yeah,but I think I've determined it's possible, at least on the very first step of the derivation. Any long enough string should have a forced handle in both G and its complement (this handle will either be variable -> epsilon or variable -> terminals, since the string is not even partially reduced). The string just has to be long enough that it's not immediately obvious which language it belongs to. Suppose it's 10101010101010101. Obviously this has a forced handle in "more 1s than 0s".Add another 0 and it's in the complement, but this 0 doesn't figure in the first reduction anyway.

Complement DCFGs and handles


Active Directory Kerberos over VPN

Question: I'm setting up an AD domain to authenticate my endpoints and users. The thing is my company frowns upon physical servers, so I've set up the domain on AWS. I am connecting to it via a VPN tunnel. Authentication, password sync etc works just fine, but I would also like to issue kerberos tickets for my users. We have all the relevant ports opened, between our local network and the amazon instance, so I would assume I'm missing some DNS entries (we're using linux dns servers on site, so I need to add them manually)
Has anyone ever tackled any similar issues and knows what DNS entries I need to add for kerberos or if there are any additional steps needed?
EDIT: I am able to get a ticket if I specify principle server by hand, running "kinit -S "servername"
Answer: You need to ensure that SRV DNS records are created for the domain.
Microsoft link

Active Directory Kerberos over VPN


remix could not detect the metamask's account

Question:

I find that unlike the other tutorial, there is no injected web3 option, but injected provider - metamask. And when I click it, the metamask shows that it is connected, however, the remix could not detect the account. I have only remix connected to my metamask. What should I do?
Comment: do you have  multiple wallets installed. maybe coinbase and metamask
Comment: @Yilmaz no. Only metamask
Answer: Rinkeby and Ropsten networks are deprecated since October 5th, 2022. And, no more supported by many RPC. Also, explorers are now read only. You should switch to Goerli or Sepolia.
Answer: Surprisingly the issue is with Rinkeby and Ropsten. If you choose ethereum main network (or any other ) on metamask, refresh the remix, and choose Injected Provider-Metamask, your main net account will be populated.
Comment: so you mean Rinkeby now is not compatible with remix?
Comment: I do not know what causing the issue. I just realized. did u try
Comment: @Eric I just checked the docs but could not see any warning or anything. it might be a bug
Comment: When I switch to ethereum mainnet and switch back, the account appears in the remix, but the balance is the same as the one of my mainnet account. When I want to deploy the contract, no confirmation request pops up. It seems there is still some bug.
Answer: If you are seeing this problem on Goerli, try switching to the Mainnet, connecting to Metamask, and then switching back to Goerli. In the final step, give Remix 5-10 seconds to update the account. This worked for me as of August 2023.
Answer: One more way to try, which worked for me -

Take the backup of your code & remove all the files from your Remix workspace.
Completely clear the workspace & reload the remix page.
Create new file/s & paste the code in them.
Compile the code & now try to switch the Environment to Metamask.


Is there a word for a style of art that is a great example of its own style? And a word that can be applied to its artist?

Question: I was mainly thinking about musical artists whose songs have style that is very recognizable as an "artists name" song or as a specific genres song. Not a super pressing question but just something that I am curious about.
Comment: I think the answers you have a better, but there is also _paradigm_.
Answer: Perhaps you're looking for quintessential (adj).
Defined by Collins:

Quintessential means representing a perfect or typical example of something.
[formal]
Everybody thinks of him as the quintessential New Yorker.

There is also archetypal:
Defined by Collins

Someone or something that is archetypal has all the most important characteristics of a particular kind of person or thing and is a perfect example of it.
Comment: @user405662 - That's true. "That's trademark Hendrix right there."
Comment: _trademark_ is another word, right?
Answer: I think you may be looking for iconic.

iconic adj

Symbolic, emblematic, or representative: a classroom scene that is iconic of what is wrong with the education system.
TFD Online

For example,

Picasso is the iconic example of the Cubist movement in 20th century art.
Comment: Too funny.  I was going to use Picasso and Cubist as an example too, but I got sidetracked.
Answer: Exemplary

When something is the best it can be or reaches the highest point, it
is exemplary and thus worth imitating. Exemplary comes from the Latin
exemplum, meaning "sample" or "example." While some people and things
are held as examples of what not to do, an exemplary person or thing
is always a positive example

For example,

Banksy represents the greatest global artist of the new millennium, an
exemplary case of popularity for a living author
Comment: And the form "he is an exemplar of this style" is also used.


Combinatorial proof for the identity $\frac{1}{(1-x)^n}=1+\binom{1+n-1}{1}x+\binom{2+n-1}{2}x^2+\cdots+\binom{r+n-1}{r}x^r+\cdots$

Question: I have been given a question that asks me to prove that $$\frac{1}{(1-x)^n}=1+\binom{1+n-1}{1}x+\binom{2+n-1}{2}x^2+\cdots+\binom{r+n-1}{r}x^r+\cdots$$
using a combinatorial proof. I know the equation can also be written as $$\biggr(\sum_{k=0}^\infty x^k\biggr)^n=\sum_{k=0}^\infty \binom{k+n-1}{k}x^k.$$ I really have troubles understanding problems that have infinite sums as combinatorial problems. We have been given the suggestion to write an integer solution problem and use it to solve the counting problem, but I have been staring at this problem and nothing is clicking. Any hints or tips would be amazing and greatly appreciated.
Answer: Just like how
$$(1+x)^n=\sum_{k=0}^{\infty}\binom{n}{k}x^k$$
is the generating function for the number of sets of size $k$ drawn from $n$ symbols,
$$(1-x)^n=\sum_{k=0}^{\infty}\Big(\binom{n}{k}\Big)x^k$$
is the generating function for the number of multisets of size $k$ drawn from $n$ symbols.
The equality
$$\Big(\binom{n}{k}\Big)=\binom{n+k-1}{k}$$
is proven by thinking of a multiset of size $k$ as $k$ "stars" in a row that have been separated by $n-1$ "bars"—"stars and bars".
Answer: Stars and bars. Since $\frac{1}{1-x}=1+x+x^2+x^3+\ldots$, the coefficient of $x^m$ in the Maclaurin series of $\frac{1}{(1-x)^n}$ equals the number of solutions of $a_1+a_2+\ldots+a_n=m$ with $a_j\in\mathbb{N}$, which is also the number of solutions of $b_1+b_2+\ldots+b_n=m+n$ with $b_k\in\mathbb{N}^+$. This is the number of ways for putting $n-1$ bars in the spaces between $m+n$ consecutive stars, i.e. $\binom{m+n-1}{n-1}=\binom{m+n-1}{m}$.
Summarizing:
$$ \frac{1}{(1-x)^n} = \sum_{m\geq 0}\binom{m+n-1}{m} x^m.$$