Need Advice about Object Relational Mapping

Question: i need your advice. I build backend rest api project for myself for learning purpose right now. I'm using Node JS with MongoDB. Already implement many features for my mini project.
So, do i have/need to implement ORM in my Node JS app for learning purpose? since i know that MongoDB is NoSQL and the MongoDB itself doesn't need a relational thing but still curious and wondering about ORM works (I used to implement ORM when learning Java).
And i want to learn deeply about containerizing, is the ORM-things impact so much on containerizing? or will it causing error too much in my Node JS app?
Looking the answer and explanation from you, thanks
Comment: You can connect to MongoDB using NodeJS Driver. There is no ORM for MongoDB NodeJS. But, there is an ODM (Object Data Mapping) software - is is called Mongoose.
Answer:
So, do i have/need to implement ORM in my Node JS app for learning purpose?

That's up to you, and the question does not provide enough context to form any educated advice.

is the ORM-things impact so much on containerizing?

I doubt the presence of an ORM will impact containerization much if at all. A well-implemented app would not have any sort of coupling between something internal to the implementation of its backend and its deployement environment and process. If anything, an ORM could potentially slow down data access operations (as it may prevent query and update optimization), which could impact backend response time. At a large scale this could become a factor in how you choose to deploy your backend, but again I doubt it will prevent containerization.

will it causing error too much in my Node JS app?

No, the presence of an ORM will not inherently increase the error rate. In fact it may decrease errors as ORMs typically provide automatic handling  of common failure paths, and reduce the amount of code needed to accomplish operations, which decreases opportunities for developer mistakes.


Part-time work and extra-curriculars on Master's application CV to explain an average GPA?

Question: When applying for a Master's, I know that extra-curriculars and part-time work barely count for anything in your application. However, say I have an average GPA but my CV shows that I was busy with several other non-academic activities during my degree, wouldn't that show that my GPA is not an indication of my full academic potential? I mean if I'm able to maintain an average GPA in a rigorous STEM course while working part-time, playing in a sports team and participating in many other things on and off campus, surely I will perform better if I just focus on my course?
Comment: Maybe you'd have performed better, maybe you wouldn't; you haven't given any indication either way (more time doesn't necessarily imply better grades). If your GPA is "good enough," then it doesn't matter. Otherwise, you need to justify why you should be admitted. I don't immediately see a way to do this. In the job market, your non-academic activities count for more, that is, candidates with non-academic achievements and lower GPAs are regularly picked over candidates without non-academic achievements and higher GPAs. But, I think that is less common for academic admissions.
Comment: _"If I'm able to maintain an average GPA in a rigorous STEM course while working part-time, playing in a sports team and participating in many other things on and off campus, surely I will perform better if I just focus on my course?"_ Yes, but what about the person who did all that and still aced their exams? Giving yourself too much to do isn't really a mitigating factor-it might even make the admissions people question how you'd handle work/life balance as a postgrad.
Comment: Of course some of this depends on the program, but the programs I applied to (physics) were concerned with GPA, research, GREs.  Extracurricular activities were not worth much and did not necessarily justify an average GPA.  If you have a few more semesters before applying, I'd suggest focusing on courses and improving your GPA.  You can then discuss in your SOP how you shifted your priorities.
Comment: @astronat What makes you think that these people are more than a handful? I don't know of anyone studying maths in France that is working on the weekends and is acing the exams.
Comment: @MarkoKarbevski you know every maths student in France?! (I'm joking of course, and you're right, perhaps these people are not as common as I suggest. It is certainly not unheard of, though. We should not be too quick to generalise either way.)
Comment: @astronat [anegdote] I know that a senior professor commented on a student saying that she was the only student that he knew of  working part time while doing the specific double major in math-cs. Since the university is large and particularly well ranked in math, the sample is significant.
Answer: Your GPA is already just one metric that may be considered in an admissions process. If you're asking whether your extracurricular activity (employment included) will be considered enough to counteract a lower-than-expected GPA, then the answer is likely No, as it's much easier to compare applicants using quantifiable values than in terms of time spent on non-academic pursuits.
Perhaps the more important consideration is how the outside activities and work influenced your development as a student. Some of these can already go on your CV, especially if your work has any relation to your studies at all. Sometimes it's enough just to prove you can accomplish self-defined goals or learn quickly. Any accomplishments you can note on your CV can be helpful. Noting that you've been part of a sports team won't directly account for a low GPA but it hopefully improved you as a person - if it has occupied such a large part of your time that you believe you would have had a higher GPA otherwise, then perhaps it's worth mentioning elsewhere in an application, such as the cover letter.
The extra-curriculars don't matter on their own, but if they're relevant to who you are, they may be selling points on a grad school application. Your accomplishments as a student will still be the primary focus.
See also this previous question: Do non-academic extra curricular activities matter for grad school applications?
Answer: What you're proposing is to write an application that says, "No, no, it's OK. I'm not an average student who got average grades: I'm an underperforming student who wasn't sufficiently committed to my course to get the grades I think I was capable of."
That isn't really an improvement over "I'm an average student who got average grades." Pretty much everybody who got average grades thinks they could have done better if only [insert some alternative history here].
The way to get somewhere that requires good grades is to get good grades. Find a master's course that will accept the grades you already have, fully commit to that course and get the grades you claim you're capable of. Then, apply for the next stage of your career (PhD, job, whatever) with the story of, "When I was an undergrad, I distracted myself with all kinds of things so I got average grades. But, look! Then I went to this decent university, fully committed to my course and got these awesome grades!"
Applications based on actual grades are strong; applications based on average grades and a promise to do better are, "Yeah, yeah, I bet s/he said that last time."


Learning the Chinese Language

Question: China is the thing at the moment. Everyone wants to learn Chinese language. Is it hard to be fluent in the Chinese language
Comment: What is the question?
Comment: looks like this question is going to be closed as "unclear what you're asking," to avoid this please clarify your specific problem or add additional details to highlight exactly what you need.
Answer: I am afraid there is no universal answer to your question. Generally speaking becoming fluent in Chinese depends on how much time and effort do you plan to put into it. Obviously the more the better. I would say it might be easier if your native tongue is related to Chinese (for example if you know Japanese, you have a smooth start with reading and writing). Personally I spent a huge amount of time on mastering Chinese pronounciation, since mistaking the tones may lead to various misunderstandings.
Some say it may help if you have ever played an instrument or generally had some musical education background (cause then you had ear training and can at least hear the tones properly). Chinese syntax is believed to be not so hard to master, since it is pretty fixed (comparing to my native language Polish it really does seem fixed). There is no inflection, but you end up with hundreds of characters to memorize instead.
So is it hard? I would say yes. But it's also a lot of fun and satifaction if you manage to learn it well. I hope this answer gives you somewhat of an impression of what it might be like to learn Chinese.
Comment: "I am afraid there is no universal answer to your question." I am afraid there is no question here.
Comment: "Is it hard to be fluent in the Chinese language" seems like a question to me
Comment: Oops. I thought he wrote "It is hard ..." because there's no question mark at the end.
Comment: Thanks for the response, i think i will take the first step in becoming an expert in these Chinese language
Answer: All it takes is effort. You can start by learning the phrases first without minding the characters that much. There's a video on Youtube explaining how sentence mining works. You can view it here. At first I was sceptical about it, but I realized how great this method is after doing some experiments.
What I did was I downloaded Anki and created my own deck there based on Duolingo inputs. I don't do reviews on Duolingo, I just mine sentences from there and review it on my Anki deck instead as its algorithm is much better. I created fields for Hanzi, Pin yin, English Translation, Audio, and Notes (Discussion taken from Duolingo regarding sentences taken from there)
And then I also create reversed version of the cards. I just started doing this a couple of months ago and you won't believe how much progress I made.

Learning the Chinese Language


Show that the language is regular without a DFA

Question: How can I show that the language {$w \epsilon$ {$0,1$}$^{*}:$ the word $w$ contains neither the (sub)string $000$ nor $11$} is regular without using a DFA?  (Using the closure properties)
Comment: Some possibilities: (1) Find a regular expression for $L$. (2) Find a regular grammar that generates $L$. (3) Show that the condition of the [Myhill-Nerode theorem](http://en.wikipedia.org/wiki/Myhill%E2%80%93Nerode_theorem) is satisfied.
Comment: You could do it that way. Regular grammars for $L_1$ and $L_2$ (and then their union) would also be easy to write.
Comment: A ok! To use the closure properties do I have to find a regular expression for L1={the word w contains the (sub)string 000} and L2={the word w contains the (sub)string 11}? So knowing that L1 and L2 are regular, the union is regular and the complement?
Comment: This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level.
Comment: @BrianM.Scott We could also find the regular expressions for L1={the word w does not contain the (sub)string 000} and L2={the word w does not contain the (sub)string 11} and then their union, right? Would the expression be for L1 be (0U10)* and for L2 (1U01U110)*
Answer: Let $L$ be the language in question. Here are four possibilities:

Come up with a regular expression that generates $L$.
Come up with a regular grammar that generates $L$.
Show that $L$ satisfies the condition of the Myhill-Nerode theorem.
Show that $L$ is the complement of a regular language over $\{0,1\}$.

The first two are self-explanatory, I think, though not necessarily easy. The third is actually fairly straightforward if you've seen the Myhill-Nerode theorem: words in that contain $000$ or $11$ are in one equivalence class, and the other classes can be identified by looking at the last one or two symbols of the word. The fourth is also straightforward, since it's not hard to write a regular expression or grammar for the complement of $L$.
Comment: @Mary: The first two approaches really are a bit messy. It wouldn't be hard to construct a DFA, and there are algorithms to transform a DFA into a regular expression or a regular grammar, but I think that you're better off using (4): it's much easier. Yes, you want to show that $$\{w\in\{0,1\}^*:w\text{ contains }000\text{ or }11\}$$ is regular. (Note that that's *or*, not *and*.) It's pretty easy to write a regular expression for that language.
Comment: Since I have to use the closure properties, I think I could use the first, the second or the forth way.. For the first and the second could you tell me how to find these regular expressions/grammars?
For the forth way, do I have to show that the language {$w \epsilon$ {0,1}$^{*}$:  the word w contains the (sub)string 000 and 11} is regular?
Comment: Because I am not familiar enough with the regular expressions yet,could you tell me if that what I think is right? Is the regular expression for that language {$(000)^{*},(11)^{*}$} ?
Comment: @Mary: No, that would just give you all strings of the forms $0^{3n}$ and $1^{2n}$, strings consisting of a multiple of $3$ zeroes or an even number of ones. A regular expression for the $L_1$ of your earlier comment is $(0\lor 1)^*000(0\lor 1)^*$. (There are various notations for regular expressions; in another common one that's $(0+1)^*000(0+1)^*$.) This gives any string, followed by $000$, followed by any string, and that exactly describes the words in $L_1$. $L_2$ has a very similar description.


Recommend a C# Task Scheduling Library

Question: I'm looking for a C# library, preferably open source, that will let me schedule tasks with a fair amount of flexibility.  Specifically, I should be able to schedule things to run every N units of time as well as "Every weekday at XXXX time" or "Every Monday at XXXX time".  More features than that would be nice, but not necessary.  This is something I want to use in an Azure WorkerRole, which immediately rules out Windows Scheduled Tasks, "at", "Cron", and any third party app that requires installation and/or a GUI to operate.  I'm looking for a library.
Comment: Check out the natively available Azure Scheduler, introduced in 2014 - http://azure.microsoft.com/en-us/services/scheduler/
Answer: http://quartznet.sourceforge.net/
"Quartz.NET is a port of very propular(sic!) open source Java job scheduling framework, Quartz."
PS: Word to the wise, don't try to just navigate to quartz.net when at work ;-)
Comment: If you are here in 2017, then use HangFire. http://hangfire.io/ HangFire's an easy way to perform scheduled tasks and background processing in .NET and .NET Core applications. No Windows Service or separate process required. Also comes with a beautiful dashboard UI out of the box. Backed by persistent storage. Open and free for commercial use. Related SO Q&A : http://stackoverflow.com/q/27875631/325521
Comment: but it doesn't support async/await out of the box.
Comment: It has serious bug, if you have 20 tasks and 5 threads in pool, it exequtes first few tasks more frequently and latst tsks are bein exequted only once per few minutes instead of once every 15 sec as I've asked.

And as @michael-sync mentioned, it don't support async/await.
Comment: is quartz.net uses windows scheduler or timers for scheduling?
Answer: I used Quartz back in my Java days and it worked great. I am now using it for some .Net work and it works even better (of course there are a number of years in there for it to have stabalized). So I certainly second the recommendations for it.
Another interesting thing you should look at, that I have just begun to play with is the new System.Threading.Tasks in .Net 4.0. I've just been using the tasks for parallelizing work and it takes great advantage of multi cores/processors. I noticed that there is a class in there named TaskScheduler, I haven't looked at it in detail, but it has methods like QueueTask, DeQueTask, etc. Might be worth some investigation at least.
Answer: See A New Task Scheduler Class Library for .NET on Codeproject.
Comment: Like this more then quartz, but need to know, if it's will be long supported lib. Enterprise reasons.
Answer: I read about Quartz in this question How might I schedule a C# Windows Service to perform a task daily?. It's a C# library and allows for flexible scheduling.
Answer: Quartz seems like a nice solution.
I've recently (this year) had to write a custom task scheduler on a major project I was working on.  They too could not use the Windows Task Scheduler, and also wanted the ability to execute custom functionality by virtue of uploading assemblies (via an ASP.net website) and have the service execute the appropriate task at the specified time.
The thing was honestly a bit of a nightmare (not so much to design and implement, but the scheduling logic was a bit of a drag).
I'd highly recommend exhausting all other avenues before deciding to "roll your own" (a.k.a reinvent the wheel!).
Answer: There is a new cloud based scheduler from Aditi Technologies called Scheduler.

Scheduler allows developers to schedule the execution of tasks through
  HTTP webhooks that run on simple or complex CRON schedules.

Recommend a C# Task Scheduling Library


Is this sentence grammaticaly correct? "Does the song "piano man" is gay?"

Question: Its very specific, it's the title of a video and I don't know if somehow the joke is that it's clearly grammatically incorrect, if it's a saying or something but it just sounds wrong and i'm going crazy. Is it grammatically correct? I don't know how else to look it up since i don't want to replace anything in it in case its just a joke or something.
Comment: It looks like a question asked by someone with a poor command of English. I have seen similarly worded questions on this site ('Does A is B?' instead of 'Is A B?').
Comment: "It's the title of a video"...  what video,  if you have read something on the internet please use a link to tell us where on the internet.
Comment: I guess that means it could be either someone with poor command of English, or a parody of someone with poor command of English
Answer: It's obviously grammatically incorrect.
Is it a joke? Perhaps. I looked at the video and the creator seems perfectly literate and a native English speaker. When he uses this phrase and other bad English in his slide presentation it is quite jarring and a contrast from everything else he is saying.
I did wonder if it was meant to be reminiscent of the deliberately bad grammar of 'lolspeak' memes popularised in the 2000s on 4Chan, such as "I Can Has Cheezburger?", but that is particularly dated now and I see that this is a brand new video.
I think it is more likely to be an 'in-joke', meaning a joke aimed at a very specific audience that will get it because the creator knows what they already know. Perhaps if you are familiar with his other content, you may recognise it as a running theme, or a callback to something previously said.
Update A helpful comment has connected it to this meme. I agree this is almost certainly the reference.
Comment: I believe it's a reference to a specific poorly translated article titled "Does Bruno Mars is Gay", which became a meme in the mid 2010s. [Here's the Know Your Meme page with more information.](https://knowyourmeme.com/memes/does-bruno-mars-is-gay)
Answer: Yes, it's grammatically incorrect.
The correct phrasing would be, "Is the song 'Piano Man' gay?"
"Does" as an interrogative verb indicates some action. It is always accompanied by another verb to indicate what action. Like, "Does George drive a bus?" "Does the building have large windows?" Etc.
If you are asking about an attribute of something, an adjective that might describe it, you use "is". "Is George tall?" "Is the building gray?" Etc.
As @astralbee says, there might be some kind of joke here. Personally I don't see anything about the song "Piano Man" that makes me think of homosexuality. Maybe I'm missing something. Possibly the speaker means the old definition of "gay", "happy and carefree". If so the answer is still no, as the song is rather melancholy.
Answer: It's not only grammatically incorrect, but it uses the word "gay" as a pejorative meaning "bad" in the general sense, which is not really done anymore. Unless the song "The Piano Man" is about the love affair between two men, for example - in that case the song refers to a gay relationship but whether the song is itself gay is another question to be determined… can a song be gay? It can in the old fashioned sense of 'cheery'.


Book / Course Teaching Basic Logic Circuits Via Minecraft Redstone To A Young Target Demographic

Question: Is there a book or online course teaching basic logic and simple logic circuits via the Redstone mechanic in the game Minecraft? Similar to Nand2Tetris, but simpler and with a younger target demographic (motivated 12-14 year olds). Think starting with binary number representation, continuing with logic gates, simple circuits like ripple carry adder etc.
Answer: Well, here is what i will do.
I won't start with a topic like logic gates,  as i believe that there are some prerequisites you need to be familiar with to grasp it, so:
Before starting with any course, or textbook, i'd sit down and talk to him. Straight like that, i'd explain what is a system, that not everything works using the system taught, and introduce him to binary numbers.
After that, i'd teach basic electric circuits, Ohm's law, KCL and KVL.
Then, when he is ready to attack logic gates, i'd explain what a logic gate is, you can use this if needed.
Now that he is ready, is there a book teaching it via minecraft? not that i know of, yet there  is the minecraft education edition, and it has some lessons regarding logic gates and applications in the game, see this
Hope i helped.
Comment: The site you pointed to teaches the concept of digital electronics just fine without any reference to electrical circuits, Ohm's law, KCL, or KLV. It's okay to choose a layer of abstraction to begin at and go from there - we do not need to understand the layer beneath that layer (or the layer beneath that, or the layer beneath that, etc) to get going. You need to start somewhere, and if the goal is to use digital electronics to gain an understanding of how it interacts with the abstract layers ABOVE it, I'd let digital electronics be the bare bottom for the moment.
Comment: Well, i respect your opinion, but i think that learning the fundamentals of every topic is necessary.
Comment: Why not learn the fundamentals behind Ohm's Law, then? Presumably we also need to understand the underlying quantum forces there before we can understand how to create an adder in digital logic? I don't mean to be overly challenging, but in truth, no matter where you enter, you will be in a layer of abstraction that is atop another layer of abstraction. Is your general rule to always enter into the abstraction that is two layers below the learning target, as you are advocating here?
Comment: If that were the rule, then I guess the natural place to begin a course on machine learning in Python would be with either assembly programming or with combinations and permutations, which are two layers removed from the target (albeit in different directions).


How SSH Deep Inspection works?

Question: I just saw an option in Fortinet NGFW regarding, SSH Deep Inspection. So my question is how Deep inspection or whatever can inspect or find any malicious activity on encrypted packets?
Answer: I'm not familiar exactly with what Fortinet offers and how they've implemented it. But in general SSH deep inspection is similar to SSL deep inspection: it does a man in the middle "attack"  where the endpoint trusts the certificate or key provided by the inspection appliance. Same as in SSL inspection the original server key can not be used with the client (since the matching private key is only known to the server) but a fixed or dynamically generated key will be used instead. With SSL it is usually enough to add trust for the proxy CA to all clients in order to accept all generated certificates. But since SSH is commonly used without certificates and without PKI one needs to trust each server key directly. This is true SSH with and without SSH inspection, but with SSH inspection you cannot any longer use the original servers fingerprint to check if you got the correct key.
As for what you can do with such deep inspection: Looking at Fortinet: SSL/SSH inspection it seems to be that they support allowing or blocking shell access, executing programs, using X11 and using port forwarding through SSH. Other firewalls can also restrict access to subsystems (i.e. block sftp) or provide a more granular policy for which commands can be executed over SSH and which not.
Comment: I know this is off-topic, but do you know what other firewalls implement this? https://softwarerecs.stackexchange.com/questions/50149/an-open-source-firewall-or-library-capable-of-doing-deep-ssh-inspection
Comment: @user27636: The question you refer to asks about open source firewalls and I'm not aware of any which support SSH interception. But there are commercial firewalls apart from Fortinet which support this.

How SSH Deep Inspection works?


It's enough to connect the screen of a transformer only at GND and not to earth?

Question: A have a transformer with a screen between the primary and secondary windings and I want to power an audio amplifier with it. My amplifier has no connection to earth, it is powered only by two wires. If I connect the screen only to GND of the power supply (between the filter capacitors) the garbage from the primary will pass to secondary ?
Answer: It could be dangerous to use a power transformer that has an unearthed earth screen because if a fault develops, live could become connected to screen and, if the screen is not properly earthed, you have a dangerous situation. What do you know about this transformer other than what you are saying in your question?
Most transformers these days are designed to be "fail-safe" in that they use double insulation techniques to "guarantee" that this sort of fault is virtually impossible. Also, the use of an RCD (UK terminology) or a GFCI (N American) will tend to make the situation less dangerous but why take this risk?
Regarding the noise reduction properties of a screen, this is well-known to be a useful addition and this technique is still used in a lot of designs however, if that transformer is somewhat elderly you cannot rely on it being safe without the screen connected to earth.
Comment: You may even damage equipment that you connect to the input. Just think about what the screen is when it isn't earthed - it's aplate of a capacitor and the primary winding is the other plate.
Comment: The transformer has just been made by a friend of mine who is really know what is doing. The insulation between primary and screen is very good. Anyway, I asked more theoretical if is some improvements if I connect the screen only to GND.
Comment: If the screen is connected to unearthed local ground as soon as you connect a remote signal source whose signal (more-or-less) is grounded, you will create a big common mode AC voltage that might be coped with or might not. The common mode voltage comes from the live and neutral via the screen (by capacitance) transferring a common mode voltage that is approximately 50% of the AC line voltage - in effect this is your amplifier's 0 volt signal ref. point. You should be able to touch local ground (unearthed) and feel a slight tingle as it pushes about a milli amp through you.
Comment: OK, I gues I better leave it unconnected... Thanks.
Comment: As long as you believe it to be safe - personally I'd double check my answer with the guy who wound it just to see what he says.


If a goalkeeper is substituted during kicks from the penalty mark, can they later be substituted on again?

Question: Suppose, for whatever reason, a goalkeeper is substituted off during kicks from the penalty mark.
Can they later be returned to the field by substituting back on?
Answer: No, the goalkeeper cannot be substituted back on.
A goalkeeper may only be replaced by a substitute (or an excluded player if one team had more players than the other at any stage of the kicks) if they are unable to continue. This is taken to mean injury, illness or some other emergency.
Once the goalkeeper has been replaced in this way, they take no further part in the match, regardless of whether the match is using regular or return substitutions.
This is outlined in Law 10 - Determining the Outcome of a Match, Section 3 - Kicks From the Penalty Mark (emphasis added):

A goalkeeper who is unable to continue before or during the kicks may be replaced by a player excluded to equalise the number of players or, if their team has not used its maximum permitted number of substitutes, a named substitute, but the replaced goalkeeper takes no further part and may not take a kick
Answer: If the league you are participating in allows return substitutions, as covered in Law 3.2 of the IFAB Laws of the Game, then the goalkeeper may return.

Return substitutions
The use of return substitutions is only permitted in youth, veterans,
  disability and grassroots football, subject to the agreement of the
  national football association, confederation or FIFA.

Otherwise, the goalkeeper may not return as addressed in Law 3.3

To replace a player with a substitute, the following must be observed:
• the player being replaced [...] takes no further part in the match,
  except where return substitutions are permitted


What was the size of the crowd outside the Praetorium when Jesus and Barabbas were offered to be released?

Question: What was the size of the crowd outside the Praetorium when Jesus and Barabbas were offered to be released at the Passover feast? Are there any historical accounts as to the size of the crowd?
Comment: Welcome to Christianity Stack Exchange.  Please take our Tour to learn about this site and what sort of questions are likely to attract Christian responses: https://christianity.stackexchange.com/tour
Comment: not possible. see NABRE bible footnotes on the chapter. Details of the cohort of soldiers means 600, but crowd number cannot be ascertained.
Answer: The Praetorium was located within the the enclosed grounds of Herod's Palace in the Upper City.  The biblical account in Luke 2:41-50 informs us that all adult Jewish males would attend the Passover Festival, normally accompanied by their families.  This was the most important festival in the Jewish religious calendar and thousands of people would have travelled into Jerusalem.
We have an account of Jesus and his family going up to Jerusalem for Passover when Jesus was 12 years of age.  Joseph, Mary and their other children headed home after the Passover then discovered (the following day) that Jesus was missing.  They enquired among all their relatives who were also on the road home.  Jerusalem would have been packed out with Jews celebrating this, the most important of all the festivals.
Acts chapter 2 also describes how, after the Holy Spirit came upon the disciples who were in Jerusalem for Pentecost, the city was packed with "God-fearing Jews" from as far afield as Rome, the Parthian empire, Crete, Egypt, and Arabia.  Hundreds of thousands of people would have flocked into Jerusalem and the surrounding countryside.
Going back to the events described in Luke, we learn that the Jewish religious leaders handed Jesus over to Pilate to be tried.  Herod's Palace was the residence of the Roman governors (Matthew 27:11-26).  The members of the Sanhedrin would not go into the enclosed area where the Praetorium was located because that would have made them ceremonially unclean.
The historical record (from the New Testament) does not indicate the size of the enclosure where Herod's Palace and the Praetorium were located.  Neither does it say how many people would have been standing outside the palace waiting for Pilate's verdict.  All we know is that there was a great crowd and Pilate was afraid of a riot breaking out.  He was sufficiently cowed to give in to their demands.
What was the size of the crowd baying for Jesus' blood?  The Bible does not tell us.  Are there any other historical records of this event that might give us a clue?
Josephus, the Roman historian, has suggested that over a million persons could have been in Jerusalem for this important festival (which was also a holiday).  However, the physical limits of the area surrounding Herod's Palace and the Praetorium would necessarily have restricted the number of people who might have been there.


How do we know that "observing" a wave function is really only observing?

Question: I know that a wave function "collapses" when it is observed. One of the interpretations invokes consciousness as the cause. However, how do we know that observing is really only observing? How do we know that we aren't forcing the wave function to collapse because the observation adds something to the system (energy, constraint,etc)?
Comment: A wavefunction is not, as far as know, an observable.  A particle's position is an observable as is a particle's momentum.  If an observable, such as position or momentum, is measured, the measurement process 'collapses' the state to an eigenstate of the observable, i.e., just after a position measurement, the wavefunction is a position 'eigenfunction'.  But the wavefunction has not been observed whatever that might mean.
Comment: Wavefunction collapses when it is 'measured' according to the copenhagen interpretation! Not observed, measured!. And by that we mean we dont know what the hell is going on. What constitutes a measurement is an unsolved problem in physics. All we know is that the act of measurement messes with the delicate quantum system causing it to collapse to one of its eigenstate.
Comment: Exactly. If it helps, it CANNOT be observed anyhow since it is a complex quantity and is just a mathematical construct.
Comment: An observation is, __by definition__, something that returns a number.
Answer: Collapse of a wave into an observed particle -
Suppose the entity moving through double slit is an electron (in wave form). Let us observe it by shining a laser on it. If we were to observe
the electron with the laser, then the laser has to be reflected off the electron. Right? But, in order to reflect the laser, the electron has to turn
into a particle. Why? Because a wave can not reflect off a wave. A wave (laser) can only reflect off a particle. Therefore, in order to reflect
the laser, the electron must turn into a particle; otherwise, the observation is just not possible using a laser. Therefore, if there is a
measurement via laser, the electron must behave like a particle, not a wave. This way, observation is not just observation, it has to force the wave to collapse first.
Why the Collapse of a wave becomes mandatory on detection?
Why the laser is reflected off the electron in the first place? The actual reason for this can be the fact that the specific laser frequency that
detects the electron can not coexist with electron wave at the same point of space time. So, when they meet, one has to collapse. Laser being
more fundamental wave, it is the electron wave (less fundamental wave) that gives way and collapses. When collapsed, it becomes a particle
and may reflect the laser depending upon where the particle is materialized per density distribution. This is why when we try to observe the electrons in either of the
slits, it causes interference pattern to disappear irrespective of whether the electron was seen or not.
Laser (EM) has the fundamental property of a wave - fixed speed. Electron can travel at various speeds. Therefore laser is more fundamental
wave as compared to electron wave. Electron wave has some wave properties, but not all of them. Fixed speed is one such example property.


Aloe vera sickness

Question: (https://i.stack.imgur.com/YzUrl.jpg)
My aloevera plant was having black and brown spots on it. So I asked on gardening stack exchange for the same. (Why is my aloe vera plant having plant spots?).
One answer suggested to cut the brown portion. So I did the same.
Now after 2-3 months the cutted plant is still having Brown spots.
Plz help me fix this iisue so that I can get an aloe vera without a spot.( Fully Green)
Weather Conditions: the winter here is retreating and it's getting warmer day by day.
Comment: what part of the world are you in?
Comment: India(South-Asia)
Answer: That looks like one of the many fungal leaf spot infections that affect Aloe vera. Unfortunately, the plant may not recover, but remove it from its pot and inspect the roots to see if any are rotting. Remove any rotted rots and repot into clean potting soil, and try spraying with a fungicide, as well as keeping the plant out of any rain and only watering when essential to prevent shrivelling of the leaves; make sure you only water the soil in the pot and not the leaves. Further information here https://homeguides.sfgate.com/care-aloe-plant-dark-spots-94444.html

Aloe vera sickness


Why do objects move when you apply a force that's equal in magnitude to the friction?

Question: If the friction on an object is 200 N and you apply 200 N, it seems, the forces should immediately cancel each other out since the friction and your applied force go in opposite directions, leaving you with an object that is motionless. Yet, from what I've read, that's not the case. I feel like I'm misunderstanding something. Could it be I'm wrong about needing to apply 200 N initially? Might the amount of force I actually need be greater, but instantaneously decrease to 200 N?
Comment: Note that when the forces are equal there is no **acceleration**. That means the velocity is constant. If the object is stationary it remains stationary while if it's moving it carries on moving. If you want an initially stationary object to accelerate then you do indeed have to apply a force greater than the friction i.e. greater than 200N in this case.
Comment: Possible duplicate of [With Newton's third law, why are things capable of moving?](http://physics.stackexchange.com/q/45653/)
Comment: Can you provide a reference and quote to somewhere where you've read this? It does sound like an odd claim, but the context may be important.
Answer: Forces are only affecting acceleration. Not any other parts of motion. Think of Newton's 2nd law:
$$\sum F=ma$$
If the sum of forces is zero as in your case, nothing accelerates. If it was standing still, then it continues standing still. If it was moving then it continues moving!
It only takes a force to change a motion. Not to keep it up.
Comment: I think your last sentence sums it up nicely.
Answer: Answering your Title question. NO, the objects do not change their state of motion if all the forces cancel each other. I will assume that the friction on the object is maximum. That means $200N$ is the maximum friction on the surface.
Now the force needed is $200N$ to overcome the static frictional force. So if initially you apply $200N$ force, there will not be any motion.
But the scene changes if you are applying the $200N$ force to the moving object whose maximum kinetic frictional force (suppose $190N$) will be smaller than than maximum static frictional force (i.e. $200N$). Yes, the body will experience smaller friction when in motion.  In that case the object will be supplied constant net Force of $10N$. So the velocity will also change due to the acceleration.
Answer: I think you're failing to distinguish between static friction and kinetic friction (the latter also called dynamic friction), e.g.,
http://ffden-2.phys.uaf.edu/211_fall2002.web.dir/ben_townsend/StaticandKineticFriction.htm
Briefly, once moving, it takes less force to keep an object moving against friction than it took to get that object moving in the first place.


Differences between lexical features and orthographic features in NLP?

Question: Features are used for model training and testing. What are the differences between lexical features and orthographic features in Natural Language Processing? Examples preferred.
Answer: I am not aware of such a distinction, and most of the time when people talk about lexical features they talk about using the word itself, in contrast to only using other features, ie its part-of-speech.
Here is an example of a paper that means "whole word orthograph" when they say lexical features
One could venture that orthographic could mean something more abstract than the sequence of characters themselves, for example whether the sequence is capitalized / titlecased / camelcased / etc. But we already have the useful and clearly understood shape feature denomination for that.
As such, I would recommend distinguishing features like this:
lexical features:
whole word, prefix/suffix (various lengths possible), stemmed word, lemmatized word
shape features:
uppercase, titlecase, camelcase, lowercase
grammatical and syntactic features:
POS, part of a noun-phrase, head of a verb phrase, complement of a prepositional phrase, etc...
This is not an exhaustive list of possible features and feature categories, but it might help you categorizing linguistic features in a clearer and more widely-accepted way.
Comment: orthographic feature is sort of shape feature, I think.
Comment: Any substantial proof? Could you point us to a paper/article that talks about orthographic feature. Prima facie google search didn't help
Comment: @ChaitanyaBapat: Are you asking me or @DehengYe?
Comment: To @DehengYe But found the answer orthographic features are basically the rules the written languages follow. For example, names are capitalized in english. https://en.wikipedia.org/wiki/Orthography


Given vectors OA and OB calculate vector AB

Question: So the teacher said it's like this OB - OA = AB and I don't understand it. Why aren't we doing this instead: OA - OB? aren't they the same thing?
Comment: Order matters, since vectors have a direction.  Convince yourself that $\vec {OA}+\vec {AB}=\vec {OB}$ which is equivalent to what the teacher said.
Answer: Draw a diagram, labeling three points O, A, and B, and draw the vectors between them. In particular, remember that the vector OA goes from O to A, and remember that -OA is from A to O. Then draw out OB - OA, and OA - OB and observe whether they're the same thing or not.
Answer: Ask Tom and Jerry to go from O to B. Tell them that the start point is the tail and the end point is the head of the vector or arrow.
Tom goes directly to B and Jerry detours via point A before heading to B. Whether OB or OA+AB their effective effective displacement has remained the same.


Random Menu Reordering

Question: Has anyone experienced Menus reordering themselves in Joomla 2.5 ?
I have had that happen several times and it seems unlikely it's a hack.
Answer: I believe this was a bug when migrating from Joomla 1.5 to 2.5. Whether this is the case for you or not, try the following:

Login to PhpMyAdmin
Select the database that is associated with your Joomla site
Click on the SQL tab
Copy the following database query (change xxx to your own database prefix)
<code>UPDATE XXX_menu SET ordering = 0
</code>

This should reset the ordering for you.
Note: Once done, make sure you have the latest version of the Joomla 2.5 series (2.5.28)
Hope this helps

Random Menu Reordering


Prove that $\ker P(A^\ast) $ is an invariant subspace of $A$.

Question: Let $A$ be a normal linear operator on a finite dimensional unitary space and $P(x)$ a polynomial. Prove that $\ker P(A^{*})$ is an invariant subspace of $A$ (where $A^{*}$ is its adjoint operator).
I tried using the identity
$$
\ker A = \ker A^{*}
$$
but I am stuck.
Comment: It suffices to note that if $A$ is normal, then $A^* = q(A)$ for some polynomial $q$.
Answer: Without loss of generality, we can assume $A$ is a normal matrix and that the inner product is the standard one on $\mathbb{C}^n$. Then $A$ is diagonalizable with a unitary matrix: $A=UDU^*$, so $A^*=UD^*U^*$.
Therefore $P(A^*)=UP(D^*)U^*$. A vector $v\in\ker P(A^*)$ if and only if $P(D^*)U^*v=0$. Saying that $\ker P(A^*)$ is $A$-invariant means that for such $v$, $Av\in\ker P(A^*)$, that is,
$$
0=P(D^*)Av=P(D^*)U^*UDU^*v=P(D^*)DU^*v
$$
Thus we are reduced to prove that $\ker P(D^*)$ is $D$-invariant. Can you finish?


Why do coil guns contain capacitors?

Question: I have been interested in coil guns lately, and see that they use coils. However, in every design I have seen, their have been capacitors connected to a charging circuit that is connected to a battery. My question is, why can't a higher voltage battery be directly connected to the coils to create that electromagnetic field that drives the projectile?
Comment: What voltages to these coil guns typically require? What peak currents? What currents and voltages are batteries capable of?
Comment: One way to summarize the various answers: batteries have high *energy density*, but relatively low *power density*. Capacitors are the opposite. Therefore, to get both the high total energy storage for long-term operation, and the high peak power required for each firing, you need both.
Answer: Each battery cell has an internal series resistance and when you stack up the batteries, these series resistances add up, too, limiting the current you can draw. You can load a capacitator with that limited current. The time it takes is not relevant for the function of your coil gun.
When you trigger the coil gun, the capacitator is discharged very quickly at a very high current. It can supply this current because its own series resistance is much lower than that of the battery stack. The height of the current peak is practically only limited by the inductance of the coil you use.
Comment: So are you saying that the reason that batteries are not used is that they simply can't provide high enough current by themselves, and you can't stack them because their internal resistance adds up?
Comment: @joshglen Yes, that is correct. The internal resistance of batteries severely limits the current, and also leads to internal heating and possible explosion of the batteries. Capacitors, having lower internal resistances, are able to dump a huge amount of current into the coil with few undesirable side effects (not as much heating, for example)
Comment: I would also add that some batteries *can* provide lots of current, e.g. multi-cell LiPo batteries, which can provide 100A or more. The problem is that repeated abuse of such batteries is usually a hazard (read: smoke, fire, explosion). At best they just won't last very long, and batteries are comparatively expensive. Dumping energy into a capacitor, which innately has much lower ESR than a battery, means you can expend that energy very quickly and reliably, since capacitors with sufficiently high capacitance and low ESR are still quite cheap, and designed to perform such tasks repeatedly.
Answer: You may find coil guns with caps, for high voltage energy storage, but who said it was better?
http://www.deltaveng.com/gauss-machine-gun/construction/
Comparing batteries and caps in terms of times relative to motion in a coilgun or solenoid, (>1ms)

LiPo batteries have far higher capacitance,

produce far more Amp-seconds.

For much shorter time constants <1ms to 1ns

caps can offer lower ESR*C =T values and from both lower C and ESR thus more peak current and dI/dt
but much lower energy (watt-seconds) , so in effect of little value except decoupling supply from transient dips in voltage, but not enough to sustain current > 1ms unless massive electrolytic or ultracap which if as many LoPo batteries were avail. for same size the batteries are far better.

In short  (pun intended) caps are good for millions  of charge dump cycles or more vs 500~10k+ for LiPo or lead acid batteries within reasonable discharge   cycle depths.
So batteries are better for this application as the DCR of the coils and power source determines the initial high current and electromotive force on the iron projectile.
But do not try this unless you know the risks of exploding batteries in your face.

Why do coil guns contain capacitors?


Publicizing your conversion to Judaism?

Question: There's a fairly well known journalist who is undergoing conversion and also writing a number of articles about it.  I can't point to a specific part of halacha, but somehow this just feels off.  Mostly because as someone who makes a living selling articles and getting her name well-known, it feels like she's essentially profiting off of her conversion.
Is there anything in Jewish law or custom that explicitly addresses this situation?
Comment: I think a competent beis din can quickly get a feel for when it's just a stunt, and when someone is going through a serious change in life, and documenting it along the way. "Profiting off conversion"? No, profiting from writing; they'd otherwise be writing about other stuff. Do we object to born-Jews who make a living writing about their religious experiences?
Answer: If this profit would be a reason to think that she is not sincere in her conversion, then the Beis Din doing the conversion should not accept her, like they are not supposed to accept a convert who they know (or suspect) is converting in order to marry a specific Jew. However, if the Beis Din is convinced that this is not an ulterior motive, they may accept the convert, even though she is planning to marry a rich man. There is an interesting story in the Gemmara (Menachos 44a) about this:

מעשה באדם אחד שהיה זהיר במצות ציצית שמע שיש זונה בכרכי הים שנוטלת ד' מאות זהובים בשכרה שיגר לה ארבע מאות זהובים וקבע לה זמן כשהגיע זמנו בא וישב על הפתח
There was an incident involving a certain man who was diligent about the mitzva of ritual fringes. This man heard that there was a prostitute in one of the cities overseas who took four hundred gold coins as her payment. He sent her four hundred gold coins and fixed a time to meet with her. When his time came, he came and sat at the entrance to her house.
...
אמרה לו איני מניחך עד שתאמר לי מה שמך ומה שם עירך ומה שם רבך ומה שם מדרשך שאתה למד בו תורה כתב ונתן בידה
She said to him: I will not allow you to go until you tell me: What is your name, and what is the name of your city, and what is the name of your teacher, and what is the name of the study hall in which you studied Torah? He wrote the information and placed it in her hand.
...
ובאת לבית מדרשו של ר' חייא אמרה לו רבי צוה עלי ויעשוני גיורת אמר לה בתי שמא עיניך נתת באחד מן התלמידים הוציאה כתב מידה ונתנה לו אמר לה לכי זכי במקחך
She came to the study hall of Rabbi Ḥiyya and said to him: My teacher, instruct your students concerning me and have them make me a convert. Rabbi Ḥiyya said to her: My daughter, perhaps you set your sights on one of the students and that is why you want to convert? She took the note the student had given her from her hand and gave it to Rabbi Ḥiyya. He said to her: Go take possession of your purchase.
Comment: I believe you should edit and explain more of what you mean here; especially since the Gemara you quoted is only being partially presented.
Comment: @DavidKenner, I don't see what's missing. Both parts of the rule that I said are used in the story. And trust me, the rest of the story is not relevant to this point. If you want to see it, I included a link.

Publicizing your conversion to Judaism?


PDF saved from Adobe Illustrator CS5 not displaying correctly in Apple Preview

Question:
Hi,
I have an issue with PDFs that have been saved out of Adobe Illustrator CS5 (yes, I know, old) not displaying correctly in Apple Preview. In the attached image, the left side shows how the artwork is supposed to look, and the right side shows how it looks in Preview. Those white lines are not supposed to be going across the product image, and the drop shadow is also interfering with the product image. I can open the PDF in Acrobat 9 Pro, and it looks fine, as in the image on the right. Others without Acrobat see the image on the right. I've checked my settings in Illustrator and see no issues there and cannot figure out for the life of me why this is happening. Does Preview simply not play nice with PDFs from other software? Is this perhaps a non-issue with Illustrator CC and Preview? I need to figure this out, because this particular ad went to press in a magazine as shown in the image on the right!!
Comment: Just out of curiosity: What does the main image have to do with your product?
Comment: The ad is in a magazine for Private Universities, so we were trying to speak to that environment.
Answer: Apple's Preview has PDF rendering issues and should never be used as a proofing tool for press-destined (CMYK) artwork. It it only acceptable for RGB files. Preview is designed to be used by everyone and their cousin to view a number of file formats. It's not now and has never been a profession-level PDF viewer. Once you start using things like CMYK color, you've surpassed what Apple feels it's user base needs, therefore it's not well supported.
There's nothing you can do about the rendering issues in Preview, short of creating RGB artwork without any CMYK or Spot colors. However, even then there may be issues if you use transparency a great deal in the file set up.
It's up to Apple to fix this.
Until Apple gets around to actually caring about this and fixing it, use an Adobe product (Reader or Acrobat) to proof PDFs.
Note the actual PDF may be fine, it is merely Preview which incorrectly displays it. The only way to verify the PDF looks correct is to use Reader or Acrobat to view it.
Comment: (Didn't know that I wasn't supposed to post my reply as a separate answer and it got deleted, so pasting under here.) Thanks, Scott. To be clear, I'm not using Preview for anything. People inside my company who do not have Reader or Acrobat are opening PDFs in Preview and seeing these issues. The only time I launch Preview is to see what they're seeing. I have no idea what PDF reader the magazine is using and never received a proof of the ad. I suppose my work-around for now will be to send EPS files only and let the magazine(s) create the PDFs.
Comment: If the magazine is a print publication.... they aren't using Preview. and most often even if it's a digital publication they aren't using Preview either. While you certainly *always* want a proof... I wouldn't be too concerned. As I posted, although Preview may have an issue rendering the PDF, chances are the PDF itself is fine.
Comment: It is a print publication. Whatever the magazine is using, the ad went to press displaying incorrectly. If only they'd sent a proof... Frustrating.
Comment: I'm sure it's fine then. Print production departments aren't using Preview for anything production related.
Comment: But it wasn't fine. It ended up going to print with the white stripes through the product, as in the image on the right. Nothing much to be done about it after the fact, though. I just want to avoid this issue in the future.


Column Level Encryption in Azure SQL Datawarehouse

Question: Is there an option to do Column level encryption in Azure SQL DW similar to the one in SQL DB(Symmetric, asymmetric or always encrypted). I can see there's transparent data encryption(TDE) but I need column level for PII
Answer: We have recently introduce column level security which allows you to hide columns from users. Often customers will create policies that grant access based on role eliminating the security risk.
Answer: Azure SQL Data Warehouse does not support column-level encryption at this time.  Azure SQL Database and SQL Server 2017 (eg on IaaS) do so if encryption is a requirement for you then consider these alternative options.  If your data is not too big, consider Azure SQL DB which also has columnstore.
Alternately, consider encrypting your data before inserting it into your data warehouse, eg write a custom encryption component and host it in Data Factory, or write a custom U-SQL outputter, which outputs encrypted columns in a flat file which could then be picked up by Polybase.


How can I specify EBS Volume when adding a EC2 Resource to AWS Data Pipeline?

Question: When I try to create an EC2 Resource with a AWS Data Pipeline, I don't see and option for defining EBS volume that will be associated with that compute engine. Is it possible to set the volume size? If yes, can someone give me an example.
Answer: No, currently you cannot specify EBS volumes in Data-Pipelines Ec2Resource object.
Often times ROOT volume is used as staging directory for most of the Data-Pipeline activities which is currently limited to 8GB for Data-Pipeline provided default AMI's.
So, you can make your own AMI out of an Ec2 instance with increased EBS root volume and include that AMI in the Resource object(Image-id field) of Data-Pipelines.
Tip: You can check the AMI-id of Data-pipelines launched ec2 instances in Ec2 console.Use that AMI to create an  ec2 instance with increased EBS ROOT volume and Make Image(AMI) from this instance with even more volume size.  This way you dont need to choose from a list of AMI's and you will preserve visualization type that is required for launching particular instance types.
Answer: Currently, datapipeline service does not support an option to specify ebs volumes to attach to a ec2 resource. But, you can write a shell command activity (http://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-object-shellcommandactivity.html) which can create ebs volume and attach it to the instance.
You can then run the shell command activity on the ec2 resource.
You can use aws cli for creating and attaching ebs volumes assuming that you have appropriate role on the launched ec2 instance.
you can also make use of ec2 metadata service: http://169.254.169.254/2009-04-04/meta-data/ to get instance info like availability zone etc... so that you can create ebs volume in the same availability zone
related post: https://serverfault.com/questions/126408/creating-ebs-volumn-from-and-attaching-to-the-same-instance
Comment: Adding another EBS volume with shellCommandActivity  may increase the overall volume size but this volume will not be used for staging directory for activities.  Only the Root volume will be used for Staging(which cannot be altered).


Completely delete a folder in Windows using command line

Question: I need to delete one folder containing other folders and files inside. I tried del and rmdir commands but sometimes they fail with some error lines: [PATH]: The directory isn't empty.
Is there any good alternative?
Comment: I've experienced inconsistency in whether rmdir with appropriate flags removes everything in a directory tree (and/or the tree itself), and the only possible explanation I have is what Harry Johnston says.
Answer: Try:
rmdir /S your_directory

or:
rmdir /S /Q your_directory

to skip confirmation messages.
Comment: `rmdir /s` will delete anything that's possible to delete. You may have files that are locked by a program, read-only files or files that you need administrative access to delete. There isn't a single command that would take care of all those situations for you
Comment: rmdir /S  Is deleting directory and subfolers and directories. It also asks Are you sure. On Windows 10. Thanks
Comment: I already tried these options but as I wrote `del` and `rmdir` doesn't ask anything, they just send out some lines like the one in the description.
Comment: @r_alex_hall RMDIR /s does indeed delete files in directories. But DEL /s will delete only the files and keep the directories, which is why RMDIR is the better option
Comment: If you still get error messages, try with PowerShell: the cmdlet Remove-Item it's a bit powerful than rmdir.
Comment: rmdir /s does *not* delete files; it removes directories that have no files in them.
Answer: This happens to me a lot with my automated build scripts.
I guess the reason might be some application that has a file open in that directory with "share delete". I.e. the application allows a deletion of the file (which is why I figure the DeleteFile call doesn't fail), but the file will only disappear after said application has closed it's handle.
That means the file might still be there when the rmdir command tries to delete the folder, hence the error message. Soon after that, said application will close it's handle, the file will disappear, and when you inspect the folder to see which file rmdir was talking about it will be empty.
At least that's my theory.
The workaround proposed by Harry Johnston looks good. Only I would insert a pause in between the rmdir commands. Of course Windows has no easily scriptable "pause" command (correction: ancient Windows versions don't, newer have - see comments). But if seconds granularity is enough one can use ping to create a pause:
ping -n {desired_delay_in_seconds + 1} 127.0.0.1 >nul

So in total:
rd /s /q foo
:: retry once
if exist foo (
    :: clear errorlevel
    cmd /c
    :: pause
    ping -n 2 127.0.0.1 >nul
    :: retry
    rd /s /q foo
)
:: retry yet again
if exist foo (
    cmd /c
    ping -n 2 127.0.0.1 >nul
    rd /s /q foo
)
:: give up
if exist foo {panic}

Comment: OT: This is why I hate windows. Everything is so hard. `rm -rf /directory/` should be global on all operating systems.
Comment: There is actually a "pause" command of sorts; to pause three seconds you can use this: `timeout /t 3`
Comment: In my experience, a pause is never necessary, but YMMV.  (Of course if there really is another application in play it is preferable to identify it and explicitly wait for it to exit if possible.)
Comment: Well... I implemented a 10x retry-loop with one second delay per retry. Works now. I'm not going to try to remove the pause, only to see it fail again :-)
Of course that doesn't mean it's necessary. Just being extra-cautious.
Comment: @r_alex_hall Indeed (but natively only from Vista onwards, XP and earlier don't have the `pause` command).
Comment: Yes, maybe I should have mentioned that. I often have to work with very old Windows versions which causes me to forget stuff that's only available on "newer" systems. And BTW: `pause` != `timeout` ;) `pause` (the "press any key" thing), is,  I think, available since since basically "forever".
Answer: You may have some readonly files, you can use the del /F option to get rid of them using
     del /S /F your_directory
     rmdir your_directory

You could also have some hidden files and if you are really sure you want to delete them, then you can do this using
     del /S /F /AH your_directory
     rmdir your_directory

If this still fails, then either you do not have permission to delete some files, or some of the files are still in use.
Comment: This should be the correct answer!
Answer: I believe there's a bug in Windows 7 (and perhaps other versions) which sometimes causes this symptom; or it might be a bug in third-party software.  (Do you have Symantec Endpoint Protection installed by any chance?)
Anyway, I've run across it fairly often.  In most cases, the problem can be worked around by running rd /s /q two or three times in a row.
If this is in a batch file, you can do something like this:
rd /s /q foo
if exist foo rd /s /q foo
if exist foo rd /s /q foo
if exist foo echo Help! & pause

Comment: Agreed. Using rd /s foo - that's without the /q silent option -  will delete all the sub folders for you, but you have to answer Y to the prompt, so requires batch files to be attended. Less than ideal I know.
Answer: Use del on the files inside, then rmdir to remove the folder.
To use the rmdir method to remove all the files as well, use the /S switch before the directory name, and /Q to suppress prompting for deleting. This is the best way to do it, as you don't miss any files whatsoever. Be careful using the /Q switch though, as it will not warn you of System or Hidden file attributes
Answer: If you use node you can use the rimraf dependency like this:
run install: npm install rimraf -g
delete folder: rimraf SourceFolder
This helped me when getting the error:

the source file names are larger than is supported by the file system
Comment: Your are using npm? common pc users don't know about node js and I don't think they usually install it, mostly developers do.
Good suggestion but simple "rmdir" command is good
https://developingdaily.com/article/technology/basic-cmd-commands-which-windows-user-must-know/129
Comment: @user3559462 yeah you're probably right. It's more of just a suggestion if none of the above work for someone.
Answer: I think you can use it like this:
msg*your file is going to delete
pause
del/s /q "C:\Users\Rd\Desktop\New folder (2)\"
rmdir /s /q "C:\Users\Rd\Desktop\New folder (2)\"
mkdir "C:\Users\Rd\Desktop\New folder (2)"

Comment: Welcome to SU! Why I downvoted? 1) Poor formatting 2) Provides the same essential solution as which was already posted several years ago (always read the posted solutions before posting a new one!) 3) Is not made fit for the question (your solution recreates the deleted folder, which was not asked for).
Comment: I don't think del/s /q was provided anybody else; infact this is the only solution worked for me on command prompt. Providing additional mkdir is not a fault, I suppose. Poor formatting is what one sees. Thanks @Subham
Answer: Folder older versions of Windows (DOS, Windows 95/98/ME), DELTREE is the equivalent to RM or RMDIR. I use DELTREE on my Windows 7 workstation in batch files just fine though.
Deletes a directory and all the subdirectories and files in it.

To delete one or more files and directories:
DELTREE [/Y] [drive:]path [[drive:]path[...]]

  /Y              Suppresses prompting to confirm you want to delete
                  the subdirectory.
  [drive:]path    Specifies the name of the directory you want to delete.

Note: Use DELTREE cautiously. Every file and subdirectory within the
specified directory will be deleted.


How to know if this thread is a UI Thread

Question: Is there any way on Android to know, if the thread running my code, is the UI Thread or not ? In swing there was  SwingUtilities.isEventDispatchThread() to tell me if i am on the UI Thread, or not. Is there any function in the Android SDK that lets me know this ?
Comment: Why do you need to know what thread your code is running on? If it is meant for the UI thread, simply dispatch it there.
Comment: you usually just know when a method is being executed on the ui thread. any case in particular where you're having a doubt ?
Comment: No case particular. Just a way to sure up my multi-threaded code.
Comment: Possible duplicate of [How to check if current thread is not main thread](http://stackoverflow.com/questions/11411022/how-to-check-if-current-thread-is-not-main-thread)
Answer:
Answer borrowed from here: How to check if current thread is not main thread
Looper.myLooper() == Looper.getMainLooper()
Any Android app has only one UI thread, so you could somewhere in the Activity callback like onCreate() check and store its ID and later just compare that thread's ID to the stored one.
mMainThreadId = Thread.currentThread().getId();
Anyway, you can omit checking if you want to do something on the UI thread and have any reference to Activity by using
mActivity.runOnUiThread( new Runnable() {
    @Override
    public void run() {
    ...
    }
});

which is guaranteed to run on current thread, if it's UI, or queued in UI thread.
Answer: Yes, there is a way.
Check the current thread object against main lopper's thread object. Main looper is always in the UI thread.
boolean isOnUiThread = Thread.currentThread() == Looper.getMainLooper().getThread();

Answer: Hum actually due to Android architecture, all Activities run in the main thread, ie the UI thread. So when you are coding an activity, everything that is in your Activity is in the UI thread.
That is why in Honeycomb an error have been added when you are making network calls in the main thread : it totally blocks the UI.
So by default you are in fact always working in the UI thread.
Another thing : unless you explicitely ask it to be in another thread, a Service will operate on the same thread as the activities of its application.
So, what to do ?

When you have to do heavy calculation in your activity; one solution is to use an AsyncTask (a class designed to allow you to easily use another thread). The code in onExecute() is run in another thread (but be cautious postExecute runs in your main thread). Another one is to manually start a new thread when AsyncTask is not really adapted.
If you create a service that does costly background tasks, make it run in another thread with the android:process=":my_process"  attribute of the manifest. You will need to create an AIDL to communicate with this separated service, but it is not a complicated task.
Many objects, like for example the MediaPlayer, have Async variations of their methods. Try to to always use them.
Answer: Put a breakpoint where you want to check and, when it gets hit, check if you can interact with your UI (ie, if the UI is not frozen). If you can't interact with the UI then you are in the UI Thread, otherwise you are in a background thread.


What is the difference between domain and implied domain of a function?

Question: I was solving exercises of pre calculus book when I  came up with a question which asked me to find the implied domain. Please can anyone tell me? What's the exact difference between the two? I think they are same.
Answer: The implied domain is the largest possible subset of the real numbers where each member of the subset yields a real number when the function is applied to it. The exact definition depends on how the function is defined, such as a formula, verbal description, or other.
The domain of a function is the set of the first values in the ordered pairs that make the function. This definition applies to the "univocal set of ordered pairs" concept of a function.
The difference usually occurs when some limitation is placed on a domain. Examples are saying time or length is positive, the number of people must be integral and less than the current population of the earth. Such a function with limitations on the domain is often called a restricted function.
If a formula is given without any limitation/restriction given in the problem or by common sense, we use the implied domain.
Answer: The implied domain of a function is the set of all real numbers which satisfy the expression. For example, $f(x) = \frac{x^2 - 4}{x-2}$ has an implied domain of all reals except 2. However, we can simplify $f(x)$ to just $x + 2$ by eliminating $x-2$ from the top and bottom. When we do this, we have to add the exclusion that x cannot equal 2. So the domain for $f(x)$ would be explicitly defined if it looked like this: $f(x) = x + 2, x \neq 2$.


Kentico10 Cultures not independent

Question: I have a kentico10 website set up but the different languages are linked somehow. So if i make changes on the spanish version of the site the others change as well. Any ideas as too what this could be?
Comment: Brendon, one of the key takeaways here is that - in Kentico - the *Design* tab does not really belong to the Page, it belongs to the page template.  In your example above, you're not changing the Spanish version, you're changing the shared template.  As a rule, I try to avoid making changes in the design tab to reinforce this and focus my editorial changes in the Page tab and the Form tab.
Answer: If you've hard coded your text/code in your template layout then you will need to use localization resource string to get the correct value OR update your template to be more dynamic by using different webparts and zones.  I'd suggest NOT using different templates for every language, it becomes a management nightmare.  Make your templates dynamic enough to allow for different content to be placed for different languages.
In your example it looks like the footer text is not in English and it should be.  This is a perfect example.  In that place on the template layout add a webpart layout and then on the design view, place a editable text webpart on it.  Then when you change between languages, you can edit the text based on each individual language.  The other alternative I mentioned was to use a localization resource string.  These
Answer: This is because Kentico provides a mechanism for translations of documents on multilingual sites, but not for translating entire page templates.
You can use the same template for every language, by using localized resource strings for any text you enter in the templates. (under Localization > Resource strings).
Kentico 10 Localized resource strings
You can then use the resource string's key in a macro to show the resource string for the current language. Based on the above screenshot
{$ObjectType.CompanyXYZ_Doctor$} would render as "Doctor" if the current language is English, and "Docteur" if the current language is French.
Comment: Kentico does provide methods to translate template code.  See the documentation https://docs.kentico.com/k10/multilingual-websites/setting-up-a-multilingual-user-interface/working-with-resource-strings  The problem is the OP has hard coded text in the template.  The OP needs to update his template to make it more dynamic and follow the standards for developing a localized site in Kentico.
Answer: You can set up it the way you want. Go to properties\template - and choose a different template for you language version. Read
Developing unique page templates for specific languages

Kentico10 Cultures not independent


Where can you get good quality chocolates in Malaysia?

Question: Please include names of any local varieties which taste great and list places where you can get cheap chocolates.
Comment: I'm voting to close this question as off-topic because "Housecleaning". The question was posed in 2012 asking for a list. These types of questions are no longer well-received and should be closed.
Answer: For cheap chocolate, I will usually go for Langkawi. Few chocolate merchant like Haji Ismail Group (HIG) can be found around Langkawi and HQ at Kuah, where they sell quite number of local and international brand at very cheap price. (e.g. cheapest Daim is around RM 17 - Jan 2014)
For local made chocolate, I will go for Beryl's.
The factory is in Serdang (around 25KM from KL) where I can buy all type of chocolate they produce at better price.
Answer: Beryl's tastes good to me, especially their Tiramisu line.
I bought it in Thailand, but it's made in Malaysia, so it should be widely available.
Answer: A search reveals two oft-mentioned Malaysian chocolate companies:

The Cocoa Boutique - "the largest chocolate paradise in Malaysia with over 8 outlets located all over the country. Having visited by over 4 million visitors worldwide, Cocoa Boutique continues to expand it's chocolate 'empire' across Malaysia with over 300 different types of delectable chocolates."
Beryl's Chocolate Kingdom - "offers more than 100 varieties of chocolate to suit your every mood and desire."

Both websites look absolutely amazing! :)


Whorled Leaves on a beveled curve

Question: I'm searching for a way to create whorled leaves/branches around parent branches that are beveled curves (curve to mesh with profile curve circle).  The approach shown generates strange results with the instances twisting.  I think I understand why but don't know a solution that allows a) the leaves to be radially arrayed without twisting and b) allows the angle from the branch to be adjustable by a factor of the spline length.
Comment: just a dumb question: do you want a solution or an explanation? if first: just do the instancing before curve to mesh
Comment: Chris. Instancing before curve to mesh produces only 1 instance per curve point which is not the 'point'.  This is part of a larger project to place branches as well as leaves on the surface of other branches via the 3 phyllo taxis types - single, opposite, whorled.  Instancing before the curve to mesh would place leaves and smaller branches inside parent branches.  A solution or an explanation would be very much appreciated.
Comment: Something along [these lines](https://blender.stackexchange.com/a/262058/35559)?
Comment: Robin - yes The opposite leaves solution works and was a big step forward for me - thank you. but there are issues with this.  1) it does not work work with multiple curve instances as the Sample Curve node turns all instances into a single field of points. 2) the leaves are not instanced on the stem but on the spline which will be a problem in some cases with small leaves on larger branches. 3) there doesn't seem to be a way to change the leaf angle from the stem as a factor of the parent spline length - leaves on the tips are typically at smaller angle from the stem than lower down.
Answer: I have the following suggestion for you:

However, I still want to leave some of your homework to you, so I'll only outline my suggestion very roughly:

First I create a simple curve, and save the factor with the node Capture Attribute. This should first influence the radius, and later the scaling and the rotation. I bent the value for the radius here additionally with the node Float Curve and the node Map Range in such a way that it corresponds to some extent to the needed form.

Then I instantiate a polygon at the points of the curve. Since you wanted to position the individual leaves with a certain distance to the stem, this seems to me to be a workable solution.

In the next step I instantiate the leaves and use the node Float Curve again, but this time to influence the rotation upwards depending on the curve factor on the one hand, and to change the scaling of the leaves on the other hand. As a basis for the rotation, I use the tangents that were previously supplied by Curve to Points.
Comment: Great - thank you for your time and excellent response.  I had tried something similar but got hung up on the fact that euler rotations were lost once 'realized instances' was used.  I will study this and try and implement into the larger algorithm with phyllotaxis rotation, noise applied to the stem etc.

Whorled Leaves on a beveled curve


amalgamation morphing effects

Question: Doesn't mean to ripped off. I know how to create morphing between images but does anyone know how to make the animated wavy effects showcase here?
Comment: More answers to same question here: http://graphicdesign.stackexchange.com/questions/15512/how-to-create-the-effect-in-this-animated-gif-of-morphing-faces
Answer: Some guesses
To me, it looks like they've prepared the photos so the eyes, mouth and head shapes overlay as closely as possible. The animation looks like two main aspects are changing.

Alpha channel animation
They're using 2D morphing

The alpha channel looks to have a soft diagonal pattern though it that's scrolling from top to bottom. This is what's giving it the "wavy" effect, because the different faces have different width features, like hair.
The morphing is a little harder to pin down. I'm not sure if there's anything special going on there.
And I also don't know how the triangles that you can see at some points relate. They seem to be strictly for the morphing. It's been a while since I've done any work with morphing, but there used to be some good software around for it. The name escapes me though.
Edit: The author says this in the comments.
Hi, this is a morphing + a set mask filters.
Doesn't give much away, but suggests I may have been on the right path?
Comment: Thanks Marc. I red the comments too. Can't figure out what "a set mask filters" means tho.
Comment: Mask = alpha channel. So I think they're talking about animating the mask.
Comment: 2 animation at the same time?

amalgamation morphing effects


Can Confidential Transaction in Liquid Network Blockchain be pruned

Question: From a bitcoin full node, we can prune the blockchain from 350GB to 7GB (as of 30thJune2021) by storing the latest UTXO set plus maybe 120 latest block (for possible orphaning or block reorganization).
Can pruning be done for blockchain that involves confidential transactions (Liquid network) since there are range-proof and pedersen commitment?
Answer: One way of looking at validation (in Bitcoin, and related systems) is to see the UTXO set as the primary data set a node operates on. Blocks are simply "patches" to the UTXO set, saying what entries can be deleted from it, and which new ones to create. Of course, blocks are more than that; they are also authenticated - they carry data with them to prove that said patches were legitimate.
Pruning is simply the practice of forgetting the patches after they've been applied. The patches can be forgotten, because they are not needed for future validation. Everything the node will need in the future is in the UTXO set.
In Bitcoin, the UTXO set contains entries of the form (txid, vout_index, amount, scriptPubKey). The txid and vout_index identity which transaction and which output of that transaction created the UTXO. The amount is the number of satoshis the UTXO is worth, and the scriptPubKey controls who has the ability to spend it. Transactions (and blocks) in addition also contain a version, a locktime, and transaction inputs (each with various fields, including signatures in scriptSig and witness). None of these things make it into the UTXO set precisely because they don't matter in the future; they're only relevant for determining whether the transaction/block (patch) is valid at the time it is applied.
What changes in Confidential Transactions? The amount is replaced with a Pedersen commitment, both in transactions themselves and in the UTXO set. So this is indeed kept for future validation (it's in the UTXO set, so it is not removed by pruning blocks). Transaction outputs in CT also have a range_proof. What about that? Its function is to guarantee that the sum of the (hidden) transaction output values does not exceed that of the UTXOs being spent. Similar to signatures, this data is only needed at validation time. Once applied, it can be forgotten. Thus, it is not included in the UTXO set, and unavailable after pruning.
Comment: You can see the amount going in and out, but you can't verify that against the UTXO set.
Comment: Is it correct that we assume/prove the crypto does it's job and the total amount bitcoin inside the sidechain is the same but at the same time we cannot calculate/view the total sum.
Comment: @pieter-wuille What do you mean by "you"? I thought the point of CTs is that an independent observer cannot see the in/out amounts
Comment: This comment was about the 2 way peg mechanism in combination with CT. You (third party full node validator) can see all amounts being transferred from/to the Bitcoin chain, but once on the sidechain under CT control, you cannot just sum up the values of the UTXOs there, or compare it with the amount that apparently entered and exited.
Answer: There's no limitation on CT outputs being pruned. Their value is ambiguous (stated as a range of values), the state of being spent or not is public the same as any output.
Comment: What is pruned is the blockchain data after verifying. The UTXO set is kept separate, with the data necessary for verification of future transactions/blocks. Pedersen commitments take the place of amounts, so those go in the UTXO set and are kept. Range proofs are only necessary to verifying the transaction they are in, and can be pruned after verification.
Comment: I am very confused, if all the range proof is pruned, when i got fund from someone! how do I verify it. how does the side chain operator verified that no extra coin is minted if all those proofs in the blockchain are pruned. ? How do I verified a chain of transactions if these Pedersen commitment and range proofs are removed?
Comment: ok tq! I will read a few times to understand it


'Use of app has been restricted'

Question: When users are routed to my Facebook application without being logged in first, they receive the error "'Use of app has been restricted.' I have tried the different URL trick (as has been suggested before) but it doesn't seem to work. HTTP and HTTPS are enabled, Sandbox mode is off. The app is restricted to individuals in the United States and 18+ but I don't think an issue with that would produce the same error. If anyone can provide any assistance, it would be greatly appreciated!
Answer: If user is not logged in, Facebook does not know whether the user is from US. One would expect this to work on IP addresses or something like that, but it does not.
I assume FB has some reasons for this. For example, if you're from USA and have an app working at home, you would expect it to keep working even if you travel to Canada and log in from there.

'Use of app has been restricted'


Turn spells into spell-like/supernatural abilities

Question: Is it possible to turn spells into spell-like/supernatural abilities?
A single spell or all of your spellcasting.
Comment: Is the question asking whether it is possible to turn *a spell* into an SLA or Su, or is the question asking whether it is possible to turn *all your spellcasting in total* to SLA or Su?
Comment: Good question, Both is nice ^^
Answer: Turning a single spell, or limited number of spells, into a spell-like ability or supernatural ability is definitely possible.
For spell-like ability, the most immediate example is the archmage, which has an option for its high arcana class feature simply called "Spell-like Ability." You choose a spell, permanently lose one 5th-level spell per day as well as one spell per day of the chosen spell's level, and you get to use that spell 2/day as a spell-like ability. This results in basically trading a 5th-level spell slot for a higher level spell slot, but you lose the flexibility of having possibly prepared something else in those slots.
There are other ways to get spell-like ability versions of selected spells; too many to list here.
Supernatural spells are rarer. The only example to come to mind is the dweomerkeeper prestige class from the web enhancement to Complete Divine. This is generally considered an overpowered class because of its ability to turn any spell into a supernatural ability, since supernatural abilities have significant advantages over spells. In particular, unlike the archmage, dweomerkeeper neglects to say you still have to pay material and XP components on the chosen spell, which means you can use, for example, wish as a supernatural ability that doesn't require XP.
There is no way to turn all of a chosen class's spellcasting to spell-like or supernatural. However, one particular class does this naturally: the shadowcaster from Tome of Magic. There are a lot of things going on with the shadowcaster, which I'll skip, but the long and short of it is that the shadowcaster uses "mysteries," which start out as arcane spells. When the shadowcaster gets 4th-level mysteries, his 3rd-level and lower mysteries start to count as spell-like abilities (his new 4th-level mysteries are still cast as arcane spells). Then when he gets 7th-level mysteries, his 3rd-level and lower mysteries start to be used as supernatural abilities (and his 4th through 6th-level mysteries start to be spell-like, and his new 7th-level mysteries are still arcane).
Comment: One minor nitpick: Phaerimm (*Lost Empires of Faerun*) have sorcerer casting as spell-like abilities with no components, with a level equal to their character level. Though this is a bit of a nuclear option, it is the one way of getting an entire class' casting as SLAs.
Comment: @DanB No, shadowcaster only gets effects up to 3rd-level as supernatural. The dweomerkeeper can get *wish* though.
Comment: Animate dead spell-like? There are many ways to get a version of a selected one
Answer: Innate Spell from Compete Arcane is a feat that allows a player to convert a spell into a spell like ability. It can be used once per turn, at will. The drawback is that the player also permanently loses one spell slot 8 levels higher.
So, for example, if you wanted Magic Missile as a spell like ability, you would have to spend the feat, and permanently lose one 9th level spell slot. Then you could cast Magic Missile once per round without needing to worry about verbal or somatic components.


Other idea to find range of $y=x+\frac{1}{x-4}$

Question: $$y=x+\frac{1}{x-4}$$ I tried to find range of this function as below
$$y(x-4)=x(x-4)+1\\yx-4y=x^2-4x+1\\x^2-x(4+y)+(4y+1)=0\\\Delta \geq 0 \\(4+y)^2-4(4y+1)\geq 0 \\(y-4)^2-4\geq 0\\|y-4|\geq 2\\y\geq 6 \cup y\leq2$$ this usuall way. but I am interested in finall answer... is the other idea to find function range ?
Answer: use this fact : $|a+\frac 1a|\geq 2$
$$\quad{y=x+\frac{1}{x-4}\\y-4=x+\frac{1}{x-4}-4\\y-4=(x-4)+\frac{1}{x-4}=a+\frac 1a\\|y-4|\geq 2}$$
Answer: Clearly for $|x|$ large, $y$ is large and has the same sign as $x$. For $x=4+h$ where $h$ is small, $y$ has the same sign as $h$ and is as large as we like in absolute value by making $h$ small. We can find the turning points by $$y'=1-\frac 1{(x-4)^2}=0, y''=\frac 2{(x-4)^3}$$ i.e. at $x-4=\pm 1$ with attention to the sign of $y''$.
When $x=3$ we have a local maximum $y=2$. For $x=5$ we have a local minimum $y=6$. These extreme points belong to their respective branches, and we therefore hit no values with $2\lt y\lt 6$ since one branch has $y \le 2$ and the other $y\ge 6$. Strictly we also need the simple observation that $y$ does take all other positive and negative real values (e.g. use the intermediate value theorem, or solve explicitly).
Answer: Let $z:= x-4,$ and $z \ne 0$.
$y = z + 1/z +4$.
1) $z \gt 0:$
AM -GM:
$z+1/z \ge 2.$
Hence: $y \in [6,\infty)$.
2) $ z\lt 0$.
Above reasoning for $-z$ (positive),i.e.
$-z + 1/(-z) \ge 2$,
leads to:
$y \in (-\infty, 2]$.
Altogether :
Range $(y) = (-\infty, 2]\cup[4,\infty)$.


Reboot into another OS

Question: I have a laptop with more than one OS.
Is there any command by which I can shut down current OS and boot into another OS?
windows->Ubuntu and vice versa
thank you
Comment: That depends on how to choose to boot into the different OSes, BIOS boot selection, LINUX bootloader or Windows bootmanager.
Comment: @PeterHahndorf Can you tell it for all of these (if you know)? its a good question.
Answer: Yes, it's possible if you use Grub for boot selection:-

Boot into Linux.
Enable root privileges by logging in, or by using su or sudo -s.
Copy /boot/grub.cfg to either /boot/grub.win or /boot/grub.lin, depending on your default.
Edit /etc/default/grub to change GRUB_DEFAULT= to the number of the alternative OS in the boot list (counting from zero).
Run update-grub, then copy /boot/grub.cfg to /boot/grub.lin or /boot/grub.win, as appropriate.
Restore GRUB_DEFAULT= to its previous value in /etc/default/grub.
Create bootlin and bootwin containing:cp /boot/grub.lin /boot.cfg or cp /boot/grub.win /boot.cfgshutdown -r now

Now you can can call bootlin or bootwin from Ubuntu.
In Windows you will need to do the same sort of thing:-

First install ext2fsd.
Assign a drive letter (eg U:) to the Ubuntu partition and make it writable.
Now you can create bootlin.cmd and bootwin.cmd containing the appropriate copy command to overwrite U:\boot\grub.cfg, followed by:shutdown -r

If you boot with ntldr you can use a similar technique with two copies of boot.ini (you may need to clear Read-only, System and Hidden attributes first). There may be a similar technique that you can use with other boot loaders, but I leave it to others to suggest what will work with these.
CAUTION: I find ext2fsd works well in read-only mode, but I have never used it in writable mode: be aware that it could corrupt your Ubuntu system, so make sure it is well backed up until you have tried it a few times and reassured yourself that it works correctly. It might be safer from Windows to edit grub.cfg in situ, which will not require directory changes, but you will need some sort of Windows in-line editor which does not use work files in the same file system, or knock up a few lines of C to do it.
Answer: These details might not exactly match how UEFI handles GPT systems, but it does describe MBR-based systems.
The official (old) standard is to use what is on the Master Boot Record.  The "fdisk" command can be used to change the details of the MBR.
The traditional MBR contains some bits that specify whether a partition is flagged.  The standard specifies that only one partition is flagged, although that isn't necessarily enforced by the boot code.  When a user specifies that a specific partition should be flagged, a traditional fdisk program will typically check for another flagged partition and, if one is found, unflag it.  There might be alternative words used to describe a "flagged" partition, like a "selected" partition.
Then, the traditional MBR contains some "code" (instructions).  When the system is booted, this code is run.  The code will check the MBR to see how big each partition is, and see which partition is flagged.  It will then continue to booting process by running some additional code which is located in the partition that is flagged.
So, that's the standard that is widely supported.  Unfortunately, this standard method involves going into fdisk and interacting with it manually.  So that's not just a single program that you can run.  It is, however, the most widely supported standard.
To quote OpenBSD FAQ: Multibooting:

Virtually every OS offers a program to do this; OpenBSD's is fdisk(8), similar named programs are in Windows 9x and DOS, and many other operating systems. This can be highly desirable for OSs or systems which take a long time to shut down and reboot -- you can set it and start the reboot process, then walk away, grab a cup of coffee, and come back to the system booted the way you want it -- no waiting for the Magic Moment to select the next OS.

It's funny how, with all of the fancy replacements people have made,  the advantages of the most widely supported official process can be overlooked so often.
I know this may not be quite as automated as what is desired, although the question that was asked did not specify non-interactivity.  So, the simple answer is that yes, there is such a command.  It is "fdisk".
Now, there are some other variations, and so automation is probably possible if you're seeking such a solution.  You may wish to check your operating systems for a command named "boot" or something like that; I know the old OS/2 operating system did contain a "BOOT" command that could modify which operating system was started.  The precise command(s) you would need to run depends on what boot code you actually use.  There's multiple "boot manager" programs available, and this functionality is now built into more operating systems.  That's the good news.  The bad news is that the process isn't quite as standardized, so I can't just provide you with one specific process that integrates well with everybody's different variations.  Basically, you need to pick a solution and use it.  The primary concern is likely to find a process that can be done from multiple operating systems, and which can be used to write to the sections of the disk that are handled while the system boots up.  Those sections are typically not part of a filesystem, and anti-virus features may try to limit a person's ability to write to those critical sections of the disk.
Basically, the process is going to involve changing the flag bits of a partition, or changing the boot code of the MBR, or changing the behavior of the code that is on the partition that the MBR uses to continue booting.  So that's three different approaches, and each of those approaches are actually used by some of the different options that are available.
A fourth approach may be to alter which disk the BIOS boots from.  However, this approach has traditionally been much less compatible between different systems, so that approach is more of a theoretical possibility than something that is actually used.  (Although, many users have used this approach interactively, often by pressing F12 or something to pull up a boot menu; sometimes they just enter BIOS setup and change the default disk that will be used on subsequent boots.)
The most common method is probably to create a 512-byte image of the entire MBR when the system boots in one operating system, and then save a 512-byte image of the entire MBR when the system boots with a different operating system.  Then, use whatever software you need to, to directly write those 512 bytes to the first 512 bytes of the disk.  (Something like "dd" would do the trick.)  The biggest challenge with that might just be having permission by the operating system.
AFH's answer seems to show how this can be done from Linux with grub.  The Windows Boot Manager from the XP/2003 days would use these sort of sector images (which would be referenced by a "Boot.ini" file), so getting out of Windows could be done by altering the Boot.ini text file.  (That process might have changed in Vista/2008, so check into the new boot manager before trying that on newer systems.)  A precise way to implement any of these solutions will depend on which operating system you're trying to stop using.  (For example: which version of Microsoft Windows.)
Answer: while when we call a hardware reboot , it is more or less identical to a power-off and a power-on subsequently . thus all ram memory are lost . and when we power-on , the boot process is handled by the motherboard firmware . if we want to tell motherboard firmware some message , we must not leave such message in the ram . but we can write something ( anything ) on the disk ( or some other permanent media , and i believe efi provides mechanism to set non-volatile variable ) .
besides the forementioned approches , linux kernels have kexec functionality to "surrender control" to another system without hardware going down . though a windows kernel may not be directly kexec'ed into , a workaround exist , by kexec'ing into a loader programme and let the loader programme initialise the windows system .

Reboot into another OS