What's the difference between the word "al-bahra" and "al-yammi" in the Quran?

Question: Both of these words are translated as "sea." What's the semantic difference between them?
Comment: The article in Arabic is not "i" but "(a)l".
Answer: The usual Arabic word for "sea" is baḥrun, baḥrin, baḥran, al-baḥru etc. These are different inflections of the same word. The other word is yammun, yammin, yamman, al-yammu etc. (all with double mm). This word is quite rare. In the Qur'an it occurs only in the story of Moses and means both "sea" and "river" (specifically the Nile).
Answer: In the commentary of A-Safi (1) and the book Lisan Al-Arab (2) the word "الیمّ" is defined as "a very deep sea". Therefore, using this word when narrating the miracle of drowning Pharaoh's clan in a deep sea by the power of Al-Mighty Allah, is more eloquent.
The same word has been used in the story of Moses when he was born:

أَنِ اقْذِفيهِ فِي التَّابُوتِ فَاقْذِفيهِ فِي الْيَمِّ فَلْيُلْقِهِ الْيَمُّ بِالسَّاحِلِ يَأْخُذْهُ عَدُوٌّ لي وَ عَدُوٌّ لَهُ وَ
  أَلْقَيْتُ عَلَيْكَ مَحَبَّةً مِنِّي وَ لِتُصْنَعَ عَلى عَيْني
put him in the casket, and cast it into the river. Then the river will cast it on the bank, and he shall be picked up by an enemy of Mine and
  an enemy of his. I And I cast upon you a love from Me, and that you
  might be reared under My eyes.(20:39)

The word "الیمّ" put eloquently more stress on the great miracle of surviving a newly born baby from such a deep sea.
It is amazing that the word "الیمّ" has always been used in verses which narrate a miracle of Al-Mighty Allah except for one verse where Allah says:

قالَ فَاذْهَبْ فَإِنَّ لَكَ فِي الْحَياةِ أَنْ تَقُولَ لا مِساسَ وَ إِنَّ لَكَ مَوْعِداً لَنْ تُخْلَفَهُ وَ انْظُرْ إِلى إِلهِكَ الَّذي
  ظَلْتَ عَلَيْهِ عاكِفاً لَنُحَرِّقَنَّهُ ثُمَّ لَنَنْسِفَنَّهُ فِي
  الْيَمِّ نَسْفاً
He said," Begone! It shall be your [lot] throughout life to say," Do not touch me!" Indeed there is a tryst for you which you will not fail
  to keep! Now look at your god to whom you went on clinging. We will
  burn it down and then scatter it [s ashes] into the sea. (20:97)

This verse is about the story of Samiri when he produced for Bani Israel a calf [a lifeless] body and then they took it for God! The word "الیمّ" put an emphasis on humiliating their handmade God by burning it down, scattering its smashes into a deep see and annihilating it forever.
(1) Commentary of A-Safi Volume 2. Page 230
(2) Lisan Al-Arab Volume 12. Page 647
Answer: On the meaning of "Al-Bahr" البحر in Arabic
First of all it is necessary to understand that the Arabic term

Bahr بحر or al-Bahr البحر

Is not specifically a synonym of the English word "sea" as it is mostly used and understood or translated nowadays by Arabic speakers.
It rather means and includes the opposite of "land" so it includes, seas, oceans, rivers and lakes as well as anything that meets the stated meaning in the understanding of early Arabs.
On the meaning of "Al-Yamm" اليم in Arabic
As for the term yamm يم or al-Yamm اليم both linguists and especially exegetes (authors of tafsirs) have a dispute on whether it is Arabic or not and if not which is the original language from which it was Arabized!
Sheikh ibn 'Ashur sums up in his at-Tahrir wa at-Tanwir التحرير والتنوير saying while interpreting (7:136):

واليم : البحر والنهر العظيم ، قيل هو كلمة عربية . وهو صنيع الكشاف إذ جعله مشتقا من التيمم ؛ لأنه يقصد للمنتفعين به ، وقال بعض اللغويين : هو معرب عن السريانية وأصله فيها " يما " وقال شيدلة : هو من القبطية ، وقال ابن الجوزي : هو من العبرية ، ولعله موجود في هذه اللغات .
And al-Yamm: the sea and the great river. It was said that it is an Arabic word. This is what the author of Al-Kashshaaf created, as he made it a derivative of tayammum. Because it is intended for those who benefit from it, and some linguists said: It is expressed in Syriac and its origin is "yama." Shaidla (His name -as far as I've researched- is Mahmood ibn abi al-Hassan ibn al-Hussain an-Naysaburi محمود بن أبي الحسن بن الحسين النيسابوري a scholar who died around 550 or 553 a.H. among his book is the linguistic tafsir Bahir al-Bayan fi Ma'any Mushkilaat al-Qur'an  باهر البيان في معاني مشكلات القرآن) said: It is from Coptic, and Ibn al-Jawzi said: It is from Hebrew, and perhaps it is found in these languages.

ولعل أصله عربي وأخذته لغات أخرى سامية من العربية والمراد به هنا بحر القلزم ، المسمى في التوراة " بحر سوف " ، وهو البحر الأحمر .
Perhaps its origin is Arabic and other Semitic languages took it from Arabic, and what is meant here is the Sea of Qalzum, which is called in the Torah "the Sea of Suf," which is the Red Sea.

Since al-Yamm was also a reference of the Nile river in othe verses we may read further in at-Tahrir wa at-Tanwir:

وقد أطلق اليم على نهر النيل في قوله - تعالى - أن اقذفيه في التابوت فاقذفيه في اليم وقوله فإذا خفت عليه فألقيه في اليم ، فالتعريف في قوله ( اليم ) هنا تعريف العهد الذهني عند علماء المعاني المعروف بتعريف الجنس عند النحاة إذ ليس في العبرة اهتمام ببحر مخصوص ولكن بفرد من هذا النوع .(Source)
Al-Yamm was used to refer to the Nile River in the words of the Almighty  "[Saying], 'Cast him into the chest and cast it into the river" and His saying: "but when you fear for him, cast him into the river" The definition in his saying (Al-Yamm) here is the definition of the mental covenant according to the scholars of semantics, which is known as the definition of the genus among the grammarians since the emphasize is not concerned with a specific (kind of) sea, but to an individual of this type.

An attempt to point at the difference of usage in the qur'an
We can speculate why in the qur'an al-Yamm was used several times and al-Bahr was used instead elsewhere here are a few observations I'd like to share:

The qur'an generally uses the term "al-Bahr" when citing Alalh's gifts, creation (see for example 16:14) and in cases of survival or deliverance of the believers.
On the opposite, the qur'an uses the term "al-Yamm" to describe the fear and punishment

For example in the same situation Allah say once:

And [recall] when We parted the sea for you and saved you and drowned the people of Pharaoh while you were looking on. (2:50)

using the term "al-Bahr" while referring to the believers.

So We took him and his soldiers and threw them into the sea. So see how was the end of the wrongdoers. (28:40)

Speaking of their pursuers (Pharao and his army: the disbelievers) see also (51:40).
On the other hand seemingly:

Al-Bahr is used to refer to something large and deep
Al-Yamm is used to express that something is smaller

This needs an explanation one attempt to explain this is that Bani Israel have had already crossed a large amount of the Red Sea:

And We took the Children of Israel across the sea ... (7:138 and 10:90)

when Pharao and his soldiers were drowned

So Pharaoh pursued them with his soldiers, and there covered them from the sea that which covered them, (20:78)

so they were closer to the coast which means the place was less deep.
Another which mother would


Long-run equilibrium number of firms is indeterminate when all firms in the industry share the same constant technology and factor prices are same

Question: Why is the long-run equilibrium number of firms indeterminate when all firms in the industry
share the same constant returns-to-scale technology and face the same factor prices? How to show it mathematically?
Comment: You first need to specify an explicit mathematical model to show something mathematically.
Answer: Responding first to a comment under the original post, in this particular case, the mathematical model has been almost fully described verbally: constant-returns to scale, price-taking behavior in the factors' markets. What is missing is the assumption on the behavior in the product market, but I would say that it is clear that the question pertains to a well-known issue we have with perfect competition.
So I will provide an answer, but, applying reciprocity as an economist should, it will also be verbal.
Under constant returns to scale and price-taking behavior in the factors' markets, the cost function is linear in output, and so marginal cost is everywhere equal to average cost. This means that the optimal quantity to be produced is indeterminate (second-order conditions for profit maximization are not satisfied). So we cannot say how much each (identical per assumptions) firm will produce, and therefore market equilibrium (for some given total quantity demanded) cannot provide the number of firms.
So set up a constant returns to scale production function, solve the maximization problem, and show that s.o.c are not satisfied, show that cost can be written as a linear function of output, solve the profit maximization problem with respect to output, see what you get and remember what happens to profits and so to selling price and marginal cost in the long run.


How to tune PID parameters to track a family of reference signals?

Question: I have a system that is controlled by a PID controller. I tune the controller to track a reference signal that is a unit step function.
Is there a way to extend the obtained results to be able to track any step function with arbitrary start end end value that occurs at an arbitrary time instant?
Comment: Welcome to DSP.SE!  Provided your DC gain is correct and there are no nonlinearities to contend with, having a good response to a unit step should mean arbitrary step functions with arbitrary DC offsets should track well also.  Is there are a reason you believe otherwise?
Comment: OK. And what should you do in the case of a nonlinear system? Use gain scheduling (different PID constants for local linearizations around different equilibrium points)?
Answer: As already mentioned, a linear system that tracks a step reference, will track it for arbitrary values and time of application. Due to the internal model principle, in a feedback control system, if the denominator of the product
$$
C(s) P(s)
$$
contains a pole at $s = 0$, then it will robustly track a step function.
The control law
$$
C(s) = \frac{k_{d} s^{2} + k_{p} s + k_{i}}{s}
$$
has a pole at $s = 0$. If the plant  $P(s)$  does not have a zero at $s = 0$, then your system will track an arbitrary step function $R(s) = \frac{A}{s}$, if it is closed-loop stable.
Since the complementary transfer-function, from reference to output, is $Y(s)/R(s) = T(s)$, and
$$
T(s) = \frac{C(s) P(s)}{1 + C(s) P(s)} = \frac{\frac{1}{s} \bar{C}(s) P(s)}{1 + \frac{1}{s} \bar{C}(s) P(s)} = \frac{\bar{C}(s) P(s)}{s + \bar{C}(s) P(s)} ,
$$
this can be seen by using the final value theorem:
$$
\lim_{t \rightarrow \infty} y(t) = \lim_{s \rightarrow 0} s \frac{A}{s}\frac{\bar{C}(s) P(s)}{s + \bar{C}(s) P(s)} = A
$$


How to install Dc++ on Lubuntu?

Question: I have recently installed Lubuntu 18.10 (dual-boot with Windows 10) and I am unable to install Linuxdcpp on it. I have tried installing it using sudo apt-get install linuxdcpp command but it shows "Unable to locate package".
Please help me install it.
Comment: Most likely `universe` repository is not enabled.
Answer: You need to add universe repository.
Run
sudo add-apt-repository universe
sudo apt update
sudo apt install linuxdcpp

Ubuntu cosmic repositories don't contain linuxdcpp for some reason. You can try to search for a PPA if one exists.
Comment: shows " 'universe' distribution component is already enabled for all sources."
Comment: What is the Lubuntu version?
Comment: ubuntu 18.10 cosmic
Comment: There is no package for cosmic in Ubuntu repos. The latest is seen in bionic.
Answer: As of now linuxdcpp isn't imported in Cosmic's Universe repository. However you can install it by following ways.

You can download the .deb package from pkgs.org or Ubuntu Packages and install it using:
sudo dpkg -i linuxdcpp_1.1.0-4_amd64.deb

And finally install dependencies:
sudo apt install -f

Or open sources.list with sudo privileges (sudo nano /etc/apt/sources.list) and add this line:
deb http://archive.ubuntu.com/ubuntu bionic universe

Update and install linuxdcpp:
sudo apt update && sudo apt install linuxdcpp

Comment: Still showing this in terminal while installing it:
E: The repository 'http://ppa.launchpad.net/linuxdcpp-team/ppa/ubuntu cosmic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
Comment: @PriyaranjanMudliar It looks like you have added some 3rd party repository. Remove that using `sudo add-apt-repository --remove ppa:linuxdcpp-team/release`

How to install Dc++ on Lubuntu?


How to decompress a file in fortran77?

Question: I have a compressed file.
Let's ignore the tar command because I'm not sure it is compressed with that.
All I know is that it is compressed in fortran77 and that is what I should use to decompress it.
How can I do it?
Is decompression a one way road or do I need a certain header file that will lead (direct) the decompression?
It's not a .Z file. It ends at something else.
What do I need to decompress it? I know the format of the final decompressed archive.
Is it possible that the file is compressed thru a simple way but it appears with a different extension?
Comment: If you have the source of the f77 program, you can use f2c to convert it to C, build it with gcc.  You haven't really given enough information for anyone to help you much beyond what's here.
Answer: First, let's get the "fortran" part out of the equation. There is no standard (and by that, I mean the fortran standard) way to either compress or decompress files, since fortran doesn't have a compression utility as part of the language. Maybe someone written some of their own, but that's entirely up to him.
So, you're stuck with publicly available compression utilities, and such. On systems which have those available, and on compilers which support it (it varies), you can use the SYSTEM function, which executes the system command by passing a command string to the operating system's command interpreter (I know it exists in cvf, probably ivf ... you should probably look it up in help of your compiler).
Since you asked a similar question already I assume you're still having problem with this. You mentioned that "it was compressed with fortran77". What do you mean by that ? That someone builded a compression utility in f77 and used it ? So that would make it a custom solution ?
If it's some kind of a custom solution, then it can practically be anything, since a lot of algorithms can serve as "compression algorithms" (writing file as binary compared to plain text will save a few bytes; voila, "compression")
Or have I misunderstood something ? Please, elaborate this a little.
Answer: My guess is that you have a binary file, which is output by a Fortran program. These can look like compressed files because they are not readable in a text editor.
Fortran allows you to write the in-memory data out to a file without formatting it, so that you can reload it later without having to parse it. The problem, however, is that you need that original source code in order to see what types of variables are written in the file.
If you have no access to the fortran source code, but a lot of time to spare, you could write some simple fortran program and guess what types of variables are being used. I wouldn't advise it, though, as Fortran is not very forgiving.
If you want some simple source code to try, look at this page which details binary read and write in Fortran, and includes a code sample. Just start by replacing reclength=reclength*4 with reclength=reclength*2 for a double precision real.
Comment: This is my guess as well - it's probably an unformatted binary file.
Answer: There is no standard decompression method, there are tons. You will need to know the method used to compress it in order to decompress it.
Comment: Probably he means a file compressed with the shell tool "compress", i.e., a .Z file.
Comment: He specified it's not though =\
Comment: Hrm, I don't think that sentence was there when I wrote the above... :-)
Answer: You said that the file extension was not .Z, but something else.  What was that something else?
If it's .gz (which is very common on Unix systems), "gunzip" is the proper command.  If it's .tgz, you can gunzip and untar it.  (Or you can read the man page for tar(1), since it probably has the ability to gunzip and extract together.)
If it's on Windows, see if Windows can read it directly, as the file system itself appears to support the ZIP format.
If something else, please just list the file name (or, if there are security implications, the file name beginning with the first period), and we might be able to figure it out.
Answer: You can check to see if it's a known compressed file type with the file command.  Assuming file returns something like "binary file" then you're almost certainly looking at plain binary data.

How to decompress a file in fortran77?


How do I construct a 256-bit hash function from 128-bit AES?

Question: I would like to generate a 256-bit hash on a microcontroller that has a 128-bit (only) AES engine. How can I construct a 256-bit hash function from a 128-bit cipher?
Comment: Pad it with 0s? That way you at least don't pretend to have higher security than 128 bit.
Comment: I do not think this is easy.  I am not sure a "known" approach even exists.  See http://en.wikipedia.org/wiki/Cryptographic_hash_function#Hash_functions_based_on_block_ciphers
Comment: Do you need a MAC, or a hash function?  It makes a significant difference.
Comment: I had to do this years back for something inconsequential. I'm sure that what I came up with is crappy. Thankfully, what I though was inconsequential back then remains inconsequential today, but that is notoriously hard to predict in advance. Other times that has not been the case.
Comment: @D.W. I do actually need a MAC, but I'm interested in the answer to the stated question. I may ask another question about implementing MACs on constrained devices.
Answer: HMAC is a specific construction which aims at providing a message authentication code. HMAC is defined over a hash function, something which AES is not.
So if your question is really about having HMAC, not just any MAC, and using an AES primitive, then your question becomes: how can we build a hash function out of a block cipher ? This is not an easy question, especially if the block cipher uses blocks which are smaller than the intended hash function output size. You could investigate ECHO, a former SHA-3 candidate, which received a reasonably fair share of analysis by many cryptographers, who found no actual problem in it. ECHO is built upon some constitutive parts of AES, and can benefit from most hardware accelerators for AES.
On the other hand, if you just want a MAC (not specifically HMAC), and have an available AES primitive, then I recommend CBC-MAC (just don't use the exact same key to encrypt data !). This will yield a 128-bit MAC. A 256-bit MAC is a weird requirement, since 128 bits ought to be enough to provide adequate security (if 128 bits are not enough, then the attacker is way more powerful than the whole of Mankind, including all governments, agencies, private corporations and mafias -- and at that point you probably have more trouble than a possibly weak MAC: for all practical purposes, the attacker is God).
One could imagine defining a 256-bit block cipher with a Feistel network where the confusion function is an AES instance, with enough rounds and distinct round keys -- like what the DEAL block cipher did with DES, during the AES competition. Then CBC-MAC on that block cipher would yield a 256-bit MAC. But custom building of block ciphers or other cryptographic primitives is not recommended at all since it is hard to get right, and you cannot test for the security of the result.
Comment: @joeforker: For a hash function, yes. Your original question was about HMAC (i.e. a MAC), and the inclusion of a secret key there means you would need 2^64 choosen-plaintexts to get a good chance for a collision, which is quite less easy to do than running the hash function for yourself.
Comment: @joeforker - wait a minute.  A MAC is a different beast than a hash function.  Which do you need?  The question asks about for a hash function.  However, if you *actually* need a MAC, not a hash function, then that changes the answer considerably.
Comment: Doesn't the birthday paradox mean a 128-bit hash only provides 64 bits of security when looking for collisions?
Comment: @joeforker Do you really anticipate generating on the order of 2^64 messages anyway? That's a lot of messages. As in, if you generated 1 million messages a second, it would still take you half a million years.
Comment: Thanks for the useful advice on key lengths and the inapplicability of the birthday paradox. I probably will use CBC-MAC or CMAC (for variable-length messages according to Wikipedia) for my application.
Comment: (10 years pass!) Would CMAC be recommended nowadays instead of CBC-MAC?
Comment: + a half year, but yes; you'd use CMAC unless your protocol is guaranteed not to be vulnerable against length extension attacks. If you combine it with encryption then you could use EAX as a generic construction or the somewhat more efficient CCM mode of encryption. CCM has been designed for packet based encryption and uses CBC-MAC while EAX is build upon CMAC.
Answer: Are you sure you need an HMAC (Hash based MAC)? CBC-MAC is probably a better construction for a keyed message authentication code using a block cipher. To get 256-bits, use two separate keys and compute 2 different MACs and concatenate them together.
If your AES engine is really a Rijndael implementation (which means it would support larger block sizes), just use Rijndael with a 256 bit block size in a CBC-MAC construction.
Answer: If you need HMAC in order to be compatible with an existing use of it (to speak to SSL, for example) then you cannot do this with AES: HMAC for SSL will use a specific underlying hash function (like SHA1 or MD5, typically).
If you really want HMAC out of AES, you'll have to first make a crypto hash function out of AES, as Thomas said.
If you have Rijndael (which is the algorithm that AES was made from), you can get a block-size of 256 bits easily enough if it's available on your engine.  Then use a construction like Merkle-Damgaard to get a hash function.
If you only have 128-bit AES, you'll need to use a double-wide construction like MDC-2.  MDC-2 isn't so well-tested, but it has at least a collision proof in the ideal-cipher model.
Answer: This paper: Building Hash Functions from Block Ciphers, Their Security and Implementation Properties may be useful.  In particular, section 3.4 deals with "Double-Block-Length Compression Functions" which may be what you need.
Comment: Welcome to Cryptography Stack Exchange. Could you add a sketch of the scheme to the answer, to make it more complete?
Comment: The schemes mentioned in that paper all assumes the ideal cipher model, but I'm not sure the ideal cipher model is a great model of AES, given the existence of theoretical weaknesses (e.g., related-key attacks) on the AES key schedule.  Personally, I would feel more comfortable using something like SHA256, given the choice.
Answer: It looks like you've changed your question.  Anyway, as to the new question (about how to build a 256-bit hash function out of 128-bit AES), the simple answer is: you don't.  Don't do that.  There's no really good, well-vetted way to build a 256-bit cryptographic hash function out of AES.  Instead, if you need a 256-bit hash function, you should be using a dedicated hash construction, such as SHA256.
I would question whether you truly need a 256-bit cryptographic hash function.  Are you sure this is needed?  My suspicion is that it is not.
Comment: You feel that 'Hirose -
Some Plausible Constructions of Double-Block-Length Hash Functions' http://www.iacr.org/archive/fse2006/40470213/40470213.pdf is insufficiently vetted?
Comment: @Marsh, I would feel more comfortable with a standard hash function (e.g., SHA256), than that scheme.   For instance, that scheme assumes the ideal cipher model, but I'm not sure the ideal cipher model is a great model of AES, given the existence of theoretical weaknesses (e.g., related-key attacks) on the AES key schedule.


Easy data conversion tool

Question: I often have data in Excel or text that I need to get into SqlServer. I can use ODBC to query the Excel file and I can parse the text file.  What I want though is some tool that will just grab the data and put it into tables with little / no effort.  Does anyone know of such a tool?
Answer: If you are using Sql Server look at Integration Services (SSIS).
Answer: You can also take a look at parse-o-matic
Comment: Kewl, didn't even know this existed. Thanks for the link!
Answer: Have you tried the SQL Server Import/Export Wizard ?
In SQL Server Management Studio, right-click your Database Name, and select Tasks menu, Import Data.  For Data Source, select Microsoft Excel, browse to the .XLS...
Answer: Seems like it'd be pretty easy to write a script that reads the text file, and converts it to "INSERT * into TABLE" Sql statements. I suspect this has already been done, but a simple implementation would be less than 100 lines of code in your favorite scripting language.
Hey, Google says SQLServer comes with such a tool, BULK INSERT:
Answer: Use DTS or SSIS depending on which version of SQL Server you have. There is an import wizard which can get you started, but data imports are rarely simple and usually involve some sort of data cleanup so that your incoming data is acceptable to the table where you intend to store it. Excel data, in my experience, is usually particularly bad inthis respect becasue it often isn't stored properly in Excel to begin with.
Answer: I haven't seen commercial tools that do this. I create this kind of tools at work all the time, and the data validation is not trivial. This just makes sure that you don't have bad data making it into your database.
I found that for simple data conversion needs something like FileHelpers is pretty good. It still needs programming though. This framework is fairly easy to use, and somebody with a little bit of experience could bang something out for you.
On further thought, you can use the SQL Server bcp utility to upload the contents of a text file. This is a command-line utility and has a lot of switches. I would suggest you experiment on a test table before you use this in a production table.
It's been a while since I used it, so I can't remember if you can directly use an Excel spreadsheet. Text files are always the easiest to deal with in any case.

Easy data conversion tool


Max HR not reached

Question: I'm 5'6. 54kg. Do HIIT 4x week & spin/combat 2x week. My Max HR (220-45=175bpm) but I NEVER reach it. Ever! My RHR is 44-45bpm. VO2max is 48.9.
I push myself to absolute max but I just don't get into my MHR zone. What am I doing wrong?
Comment: What do you do wrong? You concentrate on whatever your gadget is showing you, instead of the exercise.
Comment: 220 - age is a very bad myth. The only way to *know* your max HR is to do a maximal test in a lab. Otherwise you need to use predictive models which have large variances.
Comment: Why do you want to reach your max heart rate zone? (This is a leading question. The optimal working zone is below your max heart rate, somewhere in the 70-85% area).
Comment: So I should be working in 70-85% of my max heart rate? Based on the formula of 220-45(age). 70%-85% would be 122bpm-148bpm. Is this what I should be aiming for?
Answer: The maximum heart rate formula is just a predictive model. It aims to give an approximation of the average maximum heart rate for people by age, and it certainly isn't guaranteed to be accurate for individuals.
Here is what actual individual max heart rate measurements look like. The dots and circle are individuals, and the lines are the predictive models. You can see that in this population, the max heart rates for people in their 40s vary from around 160 to 200.

Source for image: Tanaka, H., Monahan, K. D., & Seals, D. R. (2001). Age-predicted maximal heart rate revisited. Journal of the American College of Cardiology, 37(1), 153–156. https://doi.org/10.1016/s0735-1097(00)01054-8
If you really want to know what your max heart rate is, just use the maximum value you've ever measured when pushing yourself to your absolute max.

Max HR not reached


Are people inherently good or bad according to Judaism

Question: Question is pretty straightforward in the title
Comment: I personally think the most complex part of the question is defining what inherently, good, and bad mean.
Comment: @Avrah is not being pedantic. There is a strong chance you will receive answers that do not make any sense to what you mean by the question if you don't define these terms a little :) Please follow MY guidelines on this, especially the one that prefers questions to explain _where they are coming from_. p.s. despite that, I know this is a great question, amazingly not asked yet on MY. Thanks for bringing it
Comment: כִּי יֵצֶר לֵב הָאָדָם רַע מִנְּעֻרָיו
Comment: @RabbiKaii yes I too was shocked it hasn't been asked before! I will make sure to update later when I get time
Comment: What's the difference?
Comment: @DoubleAA I take that my comment was deleted means you are serious, in which case what do you mean what's the difference? Between what and what?
Comment: @RabbiKaii It's a polite way of saying "who cares" or I guess more precisely "why would anyone care" or "what difference does it make".
Answer: Let's begin with an definition of "good". G-d gave us the free will to chose for ourselves. The best thing to do is to chose G-d and His Torah, since Torah is called good. So "good people", according to this principle, are people that follow G-d ways, cling to Him and His Torah, and observe mitzvos.
A Jewish perspective can be found in the commentary of the Ramchal. In Derech Hashem, he writes:

As we have discussed, humanity is the creature created for the purpose of drawing close to G-d. They are placed between perfection and deficiency, and it is in their hands to earn perfection. Humanity must earn this perfection, however, through their own desire and choice because if they were forced to choose perfection then they would not actually be its master, and G-d's purpose would not be fulfilled. It as therefore necessary to create humanity with free will. One's inclinations are therefore balanced between good and evil and they are not compelled toward either. They have the power of choice, able to choose either side knowingly and willingly, as well as to possess whichever one they wish. Humanity was therefore created with both a good urge and an evil urge. They have the power to incline in whichever direction they choose.

According to this view by the Ramchal, G-d provided us with both inclinations; we are the one to chose what to go after, our good or evil instincs (G-d forbid). If man was natural bad or good, that would do-away our free will, right?
Since this is a Judaism-stackexchange, I would not add it into this answer, but I would recommend delving into the philosophical, theoratical debate between Thomas Hobbes and Jean-Jacques Rousseau, it is a (secular) theory that describe man as either: natural good (according to Rousseau) and not natural good (according to Hobbs).
Similary, the Hasagot HaRaavad writes:

and this very same is the power endowed to man to be either good or bad

Rambam writes similair:

Free will is granted to all men. If one desires to turn himself to the path of good and be righteous, the choice is his. Should he desire to turn to the path of evil and be wicked, the choice is his.

See also Avos 1:7:

Nittai the Arbelite used to say: keep a distance from an evil neighbor, do not become attached to the wicked, and do not abandon faith in [divine] retribution.

The Rambam, in Hilchos De'os writes:

Each and every human being has many dispositions, and each one is both very different and very distant from any other: One person may have a violent temper, always angry; but another's mind is at ease and he is never angry, or if he does feel anger it is a soft anger once in several years.

So yes, as you wrote in one of the comments, a person might lean towards a specific character trait. That does not mean that he is unable to grow out of that trait, in order to be a better person. See also the commentary of the Divrei Yirmiyahu on the Rambam.
We are meant to take on the middle disposition, as Rambam puts it.  We are to walk in G-ds ways, as the Torah teaches in Devarim 28:9.
So yes, a person has both good and bad inclinations, that is the way Hashem made us. We have good-will, we are meant to take care of ourselves and to attach ourselves to G-d, but we are free to do that, or not (G-d forbid). G-d does not force us into doing that.
How does one train oneself to obtain a good character for instance? The Rambam teaches:

By constant, repetitive practice of the actions [characteristic of] moderate dispositions and drilling over and over, constantly, until these actions are easy and are no longer a burden upon him. And [these] dispositions will [then] become fixed in his personality.

I would recommend reading Tanya by the Alter Rebbe, regarding the subject of a  "beinoni". The Gemara defines that as:

With regard to one's inclinations, it was taught in a baraita that Rabbi Yosei HaGelili says: The good inclination rules the righteous, as it is stated: "And my heart is dead within me" (Psalms 109:22); the evil inclination has been completely banished from his heart. The evil inclination rules the wicked, as it is stated: "Transgression speaks to the wicked, there is no fear of God before his eyes" (Psalms 36:2). Middling people are ruled by both the good and evil inclinations, as it is stated: "Because He stands at the right hand of the needy, to save him from them that rule his soul" (Psalms 109:31).
Comment: Great answer, thank you. And yeah my question is like exactly in reference of various enlightenment debates such as Hobbes and Rousseau as you cited, as in whether man is naturally good and is influenced to evil by his environment, or whether vice versa. I understand that we have potential for both good and bad, but is there one that we lean toward I guess? Also the good you're referring to is the Torah, but what about inherent kindness and morals outside of Torah commandments
Comment: The Rambam famously said that we tip the balance so to speak, when performing a mitzvah. If we did something bad, G-d forbid, a mitzvah can tip the scale. I like to see it as an gardener. We are meant to work in the garden, in order to grow (plants). Just like that, we are meant to work on ourselves in order to get better and to get closer to Hashem. In that process, we make of ourselves a good person, somebody who does not want to pursue bad things, but rather walk on G-ds ways.
Answer: I'm familiar with three different approaches,
Raschar Hirsch (Bereshith 2) says that the human nature is neither good nor bad in itself, but rather blind - a structure of various forces and drives, that, by doing "their thing", might lead to positive results, but may as well lead also to sin.
So whilst passion, emotion, intellect, aren't to be "fought" against, since they are not intristically evil, they are rather not trustworthy, and only HaShem's commandment can direct them to the virtue; also being "nice" by default, that is, without the active intention to obey HaShem's will, isn't considered particularly virtuous, because by sticking to a predisposed nature a man serves merely himself.
Rav Avraham Kook (Orot Hatora 11) talks about how a Jew should "believe in his life", believe in his feelings and senses that they lead him in a righteous path by nature, only that the Torah is there to help him to avoid some mistakes or delusions.
The Tanya (based on מהרח"ו so in that it's pretty much concensus amongst the Kabbalic schools) makes a distinction between the animalistic part and the divine part of the personality - the animalistic part is basically the entire personality, passions, emotions, intellect, drives, except the will to do HaShem's will which is the only thing that's divine,
And also talks about the idea that everything that is not divine is naturally bad by definition by not being actively and conciously inline with HaShem's will.
So that a person is both good and bad, bad by "default", good by divine consicence.
Thus we have three completely different styles:
Acc. to Tanya by actively fighting the animalistic nature a person could gain virtue (Tanya 27, 29), with the "default" personality (of the Benoni that is) as something that our sole purpose is to overcome, being insignificant, since not divine.
Acc. to Rav Kook, on the contrary, we should strive to develop our intristically good intentions, whilst being aware of possible mistakes.
Acc. to Rav Hirsch, we should approach our personality "skeptically", we should carefully try to "fit" it in the Torah, not destroy, not "consecrate".
Comment: Welcome to MY and thanks for this wonderful answer. Glad to have you learning with us
Answer: As pointed out, this is hard to answer without definitions.
I wanted to highlight two points that had not been made yet:
After Hashem created everything, culminating in the creation of Adam, the Torah says that the creation was "very good" (טוב מאד). The Ramban writes that some say that the "very good" actually refers to the evil inclination of man. He also cites Onkelos who translates very good as "very orderly" meaning that the order was very properly arranged since the evil is needed for the preservation of the good. He also cites Bereishit Rabba saying that on account of the superiority of man the Torah adds the phrase "very good".
From this we may conclude that we inherently have both good and evil within us, at least an inclination to both.
Another relevant source that wasn't mentioned in other responses is Bereshit 8:21 following when Cain killed Hevel:

וַיָּ֣רַח יְהֹוָה֮ אֶת־רֵ֣יחַ הַנִּיחֹ֒חַ֒ וַיֹּ֨אמֶר יְהֹוָ֜ה אֶל־לִבּ֗וֹ לֹֽא־אֹ֠סִ֠ף לְקַלֵּ֨ל ע֤וֹד אֶת־הָֽאֲדָמָה֙ בַּעֲב֣וּר הָֽאָדָ֔ם כִּ֠י יֵ֣צֶר לֵ֧ב הָאָדָ֛ם רַ֖ע מִנְּעֻרָ֑יו וְלֹֽא־אֹסִ֥ף ע֛וֹד לְהַכּ֥וֹת אֶת־כׇּל־חַ֖י כַּֽאֲשֶׁ֥ר עָשִֽׂיתִי׃
יהוה smelled the pleasing odor, and יהוה resolved: "Never again will I doom the earth because of humankind, since the devisings of the human mind are evil from youth; nor will I ever again destroy every living being, as I have done.

This implies that a person may be evil from the outset. However, Rashi merely says that from birth a person is given an evil inclination, possibly implying that the good inclination is already within him/her.
Comment: This answer is great, although you were right to start by saying it's hard to answer without clarification - you are bringing the sources that say that the Yeitzer Ha-*Ra* is _good_. So are we good or not?
Answer: There are many angles to this, but since it is the zman, here's a chassidic idea that is noge'ah to Purim. There is a theological concept that Hashem is beyond any form of definition (see for example Gevurot Hashem Hakdama 2 - Maharal).
This means even beyond good and evil, which Hashem created.
Hashem therefore perfectly Self Defines with true bechirat chofshit, free will, which is what a real Might One does, so to speak.1
He invites us to do the same. Just one problem, we are made in His image, and He defines Himself as good and everything He does is good and we are something He did!
So Hashem creates a situation whereby we are able to also go beyond definition (l'havdil). We have this uncanny ability to define ourselves any way we want - as well as a strong desire to do so, and a strong resistance to being externally defined.
So, are we inherently good? In truth, yes. In fact, no. The whole point is to earn our good, and that's where this mission of self definition comes in - we are meant to define ourselves as good. This is where we bring up discussion about the Yeitzer Hara and Yeitzer Hatov, the tzimtzum, the chet, and so on; the mechanics of how He achieved this, and the particulars.

Where does Purim fit in? Purim takes us to the highest. Defining ourselves as good isn't enough. This makes us into perfect Tahorim, but not Chassidim (see Mesilat Yisharim ch.16&18 respectively).
The highest is defining ourselves as His. This is something that He Himself can relate to, as this is what He created the world for (see Derech Hashem, 1:2 - to give Himself to another2).
Him defining Himself as ours, and us defining ourselves as His, goes beyond reason. This comes from the concept of "ad delo yada", 'until you don't know'. Don't know what? The difference between Baruch Mordechai, Arur Haman, meaning even if, chas veshalom, it had been the other way around and Haman was the blessed one and Mordechai was the cursed one, Hashem would still choose and want Mordechai. This is something we would get deeper if we were to understand the gravity of going against His will, and yet having done so terribly for so long, He is still ours... Or having a great Purim.
When we are in this kind of relationship of beyond-reason Oneness2, you are beyond good and evil.
So in essence, are we good or evil? No. We are Jews. We are His. There's nothing more "good" than that.

Here is a shiur that goes in depth with many of the aforementioned ideas if anyone wishes to go deeper. A great pre-Purim warm up!

1 - Trying not to condense too much here, but I think it makes basic sense that if Hashem, omniscient, is not under the power of anything outside Himself in any way at all, He is "free" of influence and therefore all His choices are 100% His, i.e. truly "free" will.
2 - Ramchal explains that the purpose of creation is for Him to give the perfect good to another, and then defines that perfect good as nothing but Him. See also Tanya which goes into more about this.
3 - sometimes referred to as the "50th gate of wisdom", which goes beyond wisdom, if you've ever seen that phrase. This is discussed in many Chassidic discourses - discussion of Hashem's Ratzon and the Baal HaRatzon will be relevant if one gets a chance to study this.


How to change the unit for product weight in Magento?

Question: What is the default product weight unit in Magento? How can I change it?
Answer: The default weight is nothing at all. To change it, edit the weight in the backend. To change the "default", edit the shipping methods that calculate weight to use a different default.
Answer: The weight unit is whatever is being used for shipping. You can sometimes control it in System > Configuration > Shipping Methods. For example UPS has a choice of Lbs or Kgs; For FedEx there doesn't seem to be a choice, I assume it is fixed as Lbs on purpose.
Answer: Just to post for those struggling with FedEx shipping weight (there is no choice in the admin panel).  If you want to use KG as your default weight setting (I'm based in Canada for instance and so this is preferable) you'll run into the issue that FedEx rates will be quoted using Lbs instead but with your KG value.    I found a work around by editing the FedEx.php file.  You can find the file in:
/app/code/core/Mage/Usa/Model/Shipping/Carrier/FedEx.php.
Find the following code around line 371:
<code> 'RequestedPackageLineItems' => array(
                '0' => array(
                    'Weight' => array(
                        'Value' => (float)$r->getWeight(),
                        'Units' => 'LBS'
                    ),
                    'GroupPackageCount' => 1,
                )
</code>
You can change the value for 'Units' from 'LBS' for pounds to 'KG' for kilos.  You'll want to edit this by making a copy of the file in (so that you don't edit core files):
app/code/local/Mage/Usa/Model/Shipping/Carrier/FedEx.php
Hope someone finds it useful!


Is there a way to do a checksum for a given Nuget package?

Question: I've been looking for a way to check that a file hasn't been tampered. Is there a checksum for Nuget packages?
Answer: Yes, NuGet packages do have a checksum. As per this link, <packageId>.<packageVersion>.nupkg.sha512 contains the hash of the .nupkg file itself. As the packages uploaded on nuget.org started being repo-signed a while ago, there's also a separate file named .nupkg.metadata that contains the hash of the file before the signature itself was applied.
The files containing the 2 hashes mentioned above however are generated after the .nupkg file is retrieved from nuget.org and installed by the NuGet client, which kinda makes it impossible to check that the downloaded .nupkg hasn't been tampered with in the first place.
How is the integrity of the files ensured then ? Through a signature file called .signature.p7s, itself stored within the .nupkg file. The way to use the information in this file is by issuing a nuget.exe verify -all <nupkg_file>, as per the latest link above (nuget.exe can be downloaded from here).
Here's how the result looks like on a file that has been tampered with (for the test I've used the CommandLineParser NuGet package and had its license.md file removed from within the .nupkg file):
Comment: Is there an example using just Curl?
Comment: This is awesome. Thank you for answering my question.
Comment: @GregoryM: I'm glad it answered your initial question. You can mark the answer as "Accepted" so it helps others that come across this in the future.


Slow electrical circuits

Question: I have a three way light circuit in my hallway that is connected to three ceiling lights. When I switch it on the third light will hesitate before lighting up. Why? Also, I have a different issue with my bathroom ceiling fan. It quit working for a few minutes ( the switch) then it started working again but the first couple of "switch ons" were slow or with a slight hesitation. Now it works fine or instantly again. Is this something that I should worry about? Thanks
Comment: Are your hallway ceiling light bulbs CFL, LED, or incandescent? CFL and LED bulbs can have or develop startup delays.
Comment: Just to eliminate the easy answer, is one a compact fluorescent bulb, and the other two regular incandescent bulbs?
Comment: Is the third light a fluorescent? Some do take a moment to start.
Comment: Yes, all three switches will turn off/on all three lights. (the one comes on a second later ) These are LED bulbs.
Answer: If the switches have lost their distinct snap into position feel or if you heard a sparking or sizzling sound when you turned the switch on or off it is highly likely that it is time to replace the switch with a new one.
Comment: If I understand the question correctly all three lights are on the same switches, that is, throw either of the 3-way switches, and two lights come one immediately, one comes on a bit later.
Answer: It sounds like a faulty LED bulb (perhaps a manufacturing defect if the bulb is new). Test the theory by swapping the bulbs in lights 2 and 3. If light 2 now hesitates, you just need to replace the bulb.

Slow electrical circuits


Feature Selection and Outlier Detection

Question: How does feature selection impact outlier detection and also, removing outliers impact feature selection?
It could be a basic question. However, just to know the boundaries, I asked. Thanks in advance.
I have gone through the following:Feature selection and outlier order
Comment: Is there any specific thing you want to ask because Feature selection and outlier order already answer the question?
Comment: Hi  @prashant0598 , thanks for answering. Like if  we are working with imbalanced data , and I need to do feature selection. but finding the minority which is behaving like outlier, feature selection wont be a good idea then. ?
Answer: Outlier detection is part of data preprocessing and used to remove some of the rare events but it could happen that rare events are important to us like fraud detection in that case it becomes important and so we can't do outlier detection beforehand.
In that case we do various approaches like undersampling of majority events or oversampling of minority class. For various approaches refer this
You could also look into KPCA. Having said that there is no particular solution it all depends upon your dataset.

Feature Selection and Outlier Detection


binary compare two files, failing only if first never matches any part of the second

Question: I have a file (call it A, for reference) that may be a fragment of some other extant file on my system. I can't use cmp because I don't know how many bytes may be missing from the start of A (or, at least, I can't use it without brute forcing through the -i flag). Is there a way for me to discover whether A is already existent on my system (using GNU tools, or any other linux program)? Or will I have to botch together a c++ program to do the job? Note: efficiency is desirable since the files that A has to be compared with may be numerous.
Answer: Not knowing how big the chunk (A) is ... have you considered grep'ing for its content using -a?
Comment: `echo -e "\x00\x11\x22\x33" > file; echo -e "\x00\x11" > snip; grep -a snip file` doesn't seem to work
Comment: No, I hadn't considered grep! That'll do.
Comment: @warl0ck: grep needs a pattern, so try `grep -a "$(cat snip)" file`. But, shouldn't there be a problem with `echo`'s newlines? Your example should fail regardless of this correction, shouldn't it? On my system it succeeds...
Comment: In fact, why use `grep -a` at all? Can't I just use `grep`? Taking warl0ck's example, `echo -e "\x00\x11\x22\x33" > file; echo -e "\x00\x11Surplus Gibberish" > snip; grep -a "$(cat snip)" file` succeeds. Is that expected behaviour? If I remove the -a flag, then the command fails, as I'd want it to.
Comment: I'd be surprised if that worked.  Neither of snip or file is wholly included in the other in your example; I wouldn't expect a match, no matter what method of invocation.


AC Bonus Class Feature

Question: Other than Monk, Swashbuckler, and Brawler, what are some classes that give you an AC bonus from having the class?
Answer: Base Classes
You have a few base classes, some of them have similar conditions for their AC bonus, such as being unarmored and not wearing a shield:

Monk (and Unchained Monk);
Gunslinger;
Brawler;
Swashbuckler;
Shifter;
Self Perfection Psychic;
Medium with a Guardian spirit;

These classes grant passive AC bonuses, that will increase your AC for no other reason than simply having the class and meeting the requirement (such as being unarmored). The Medium requires you to activate, at the start of a day, a specific spirit that lasts 24 hours, so I'm also counting that as a possible source of AC bonus.
Archetypes
You have many archetypes that grant certain AC bonuses, but considering the archetypes from a base class that does not already grant a bonus to AC, we got a shorter list:

Sacred Attendant Cleric;
Elemental Ascetic Kineticist;
Esoteric Magus;
Stonelord Paladin;
Sacred Fist Warpriest;

But this is no exhaustive list, many of the archetypes from the base classes keep their AC bonus from the non-archetyped version of the class, so you can assume that a good amount of archetypes from those classes also have a bonus to AC.
Comment: I dont think the purpose was to find out all possible ways to increase your AC (which is too broad and changes nearly monthly), so I only listed the bonuses that come straight from being a member of the class. Since the question was closed, I will wait for further clarification before editing the answer. But you are correct about the Kensai/Duelist. As for the mysteries, they don't add, they replace, so that seemed offtopic, and we might soon need an updated and easily accessible [guide to x to y](https://docs.google.com/document/d/1o91Z-s0R7Vf2Ujj1lFqGC5W--9JOyU0I6uC9XRIR5to/edit).

AC Bonus Class Feature


Names for models for saving

Question: Are there names for the different models for editing and saving data, specifically on a Web form?  What are they?  As examples, there's the model where the user has to explicitly save the data by clicking Save or cancel by clicking Cancel.  Then there's continuous saving like Google does.  The way JIRA handles editing and saving with an little editors for different elements is another option (though I don't like that you need to hover over them.)  There are probably others.
Answer: I can think of some way of classifying the different behaviours, but I don't know if there are 'standard' terminologies for them all. Briefly I think the key elements in the various saving models are:

Triggers

User driven: the user initiates the saving action (e.g. clicks on save or closes the document)
System driven: based on the system picking up changes to the document, or performed periodically (e.g. autosave)

Interactions

Inline/in-place: the trigger creates an interaction at where the change takes place
pop-up/modal: the trigger creates focused area for the user to action/acknowledge

Notifications

Pre: informs the user before saving
Post: informs the user after saving

Names for models for saving


How to get the URL of the frame in chrome browser

Question: I want to check my URL is correct redirected (parameter etc.) in Chrome. In the address bar only the main URL is listed. In IE all you need is right-click -> Properties. How to obtain the same in Chrome?
The URL in the source of the e.g. iframe tag doesn't solve the problem, because the page in frame makes redirects, postbacks etc without changing the source in the iframe. So you can't find the URL in the html source.
Answer: Right-clicking on the frame should show you the option "View frame source". By clicking on it, it will open the source code in a new tab. Its URL is on the address bar. Just have to ignore to remove the "view-source:" prefix, though.
Answer: Try using "Inspect Element" over desired frame. You will see original frameset HTML code and selected page code nested.
Comment: @Shurup In Chrome 20.x, once you're in *Developer Tools* (via *Inspect Element*) you can click the *Resources* tab, and it will display a *Frames* tree. If you open up the frames, you can right-click on the resource inside, which will allow you to *Open link in new tab* or *Copy link address*
Comment: Unfortunately you can see only the htmml code, but not the request url like in Internet Explorer.
Comment: **Beware**, the parent frame's html doesn't change to reflect navigation within the child frame.
Answer: go to the system menu (wrench/spanner) Tools -> Developer tools.
you should be able to see the frame url in there
Comment: no, it shows only the source code of the parent page, I see only the initial url of the frame. After redirect it doesn't shows the updated url.
Answer: Sometimes a "frame" is more a "popup" and has NO URL, because it is compiled together from different code parts from the main .html page. There is NO URL for the "frame"
Main: http://www.celine-cellier.com/fr/produits/boites-a-bijoux
If you click on one of the displayed cases, then there is a "frame" coming up, which explains the case in detail (French). The "frame" has no URL, because all the code (Joomla) is hidden in the main .html
In the main .html are the images downloaded, AND the content text is taken from the main .html also, and so on. The only difference is the # sign at the end of the original main URL
Frame: http://www.celine-cellier.com/fr/produits/boites-a-bijoux#
The frame itself does NOT have an own URL, so it can NOT be found!


Reverse coded items factor analysis: all load onto one factor

Question: I have 21 items that should load onto four factors. Several of these items had been reverse-coded.  However, in a factor analysis, all the reverse coded items load onto one factor (when they actually should load onto four separate ones). I had reverse coded those items prior to running the CFA, but a previous question did suggest I am correct to do this, so what might be the issue here?
Comment: Closely related question (duplicate?): http://stats.stackexchange.com/questions/45182/recoded-items-as-separate-factors-in-factor-analysis
Answer: This is quite common and I have seen this many times before. The reverse-coded items share commonalities because they all share a similar methodological detail. If you measured the same construct using a self-report questionnaire and a physiological measure, for example, you would find that the self-report and physiological indices load on different factors because they are different methods, despite measuring the same construct. I would simply explain the reverse-worded factor as it is, a factor comprised of the items that are reverse-worded because these items share a similar response pattern.
Edit: I will also mention that reverse-coding items should not matter. If the items are reverse-worded, while the rest of the items are worded straightforwardly, the items that are reverse-worded will likely correlate strongly simply due to their reverse-worded nature.
Comment: People sometimes talk about trait factors (which you want) and method factors (which are artifacts). In a confirmatory factor analysis framework you can add a method factor and then have the traits that you are interested in, but you can't do this in EFA.
Comment: In a CFA you could correlate the errors of the different "methods" and such, but indeed, in an EFA you can only explain the factor. I don't see this as a problem if it is explained clearly.
Comment: In EFA, you won't get a complex factor structure like that to emerge though, if you've a method artifact, because it tries to rotate to simple structure (and it ain't).


How do you solve a system of equations with e^x

Question: How do you solve a system of equations with e^x. For example
Comment: Seems unlikely that it can be solved exactly, probably must use numerical methods
Comment: A system that is not linear is usually bad news, you probably will only find a numerical approximation. That is, you could plot the two and see where they intersect.
Answer: As said in comments, only numerical methods would be able to give the solutions.
If the equations are $$(x-1)^2+(y+1)^2=36\tag 1$$ $$y=1+e^{-\frac{x^2}{10}}\tag 2$$ use $y$ as given by $(2)$ and plug it in $(1)$. You then need to search for the zeros of $$f(x)=(x-1)^2+\left(2+e^{-\frac{x^2}{10}}\right)^2-36$$ Using inspection or graphing, you will notice that there are two solutions : one between $-5$ and $-4$, the other between $6$ and $7$.
So, let us use Newton method which, starting from a guess $x_0$, will update it accodring to $$x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$$ For this case $$f'(x)=2 (x-1)-\frac{2}{5} e^{-\frac{x^2}{10}} \left(2+e^{-\frac{x^2}{10}}\right) x$$ Let us start with $x_0=-4.5$; then the successive iterates will be $$x_1=-4.61480$$ $$x_2=-4.61335$$ which is the solution for six significant figures. To this $x$ will correspond $y=1.11904$.
For the second root, starting with $x_0=6.5$,the successive iterates will be $$x_1=6.65483$$ $$x_2=6.65261$$ which is the solution for six significant figures. To this $x$ will correspond $y=1.01197$.
We could have started closer to the solution since, after graphing, we know that $|x|$ is quite large; this will make $y$ close to $1$; that this to say that the equation to solve is almost $(x-1)^2-32=0$ the roots of which being $1\pm 4 \sqrt{2}$ that is to say $\approx -4.65685$ and $\approx 6.65685$. Using these as starting points would make Newton method converging is almost one single iteration for six significant figures.


Moving ball with rotation

Question: In a numerical simulation, I have a round ball that has velocity of 1 $\frac{m}{s}$ in $x$-direction on a flat surface. Additionally, it also has a rotational velocity of 1000 RPM around the vertical axis ($y$-axis), i.e. if we are looking at the ball from above it is spinning clockwise.
Suppose there is no air then the ball curves to the right relatively to its straight path.
Why is it and is there a mathematical formula for it? I think it is not the magnus effect as there is no air surrounding the ball. How big of a role do the materials of ball and surface and the friction play? The surface is fixed. Thank you.
Comment: Is the ball sliding on the flat surface or does it have a rotational component about a horizontal axis also? Is this one Earth? Which hemisphere?
Comment: The ball is only sliding on the flat surface. Everything is happening with standard earth gravitation. The flat surface is fixed, I have added a picture with some more details (different colors represent different velocity). I don't know which hemisphere is the correct one but let's assume it is the north hemisphere. My question is based on a simulation and I would like to know how to correctly calculate the path of the ball, as the simulation fails towards the end (ball gets deformed unnaturally).
Answer: Is the surface rough or smooth?

If smooth, then friction is not present and plays no role - and I doubt you would see such skewing off from the initial direction. Such a situation would be akin to gravity-free motion through empty space; no rotation could alter the linear direction in such a scenario. (Unless we are dealing with e.g. the Coriolis effect - see discussion on comments.)

If rough, then a rotation about the z-axis will inevitably be introduced. This z-rotation as well as the y-rotation might be two components that merge into a resulting rotation about a tilted axis - and this new rotation would then, due to friction, introduce a linear velocity in the tilted direction that you see.

I don't think the path should be curved, though, but straight in the x-z plane in a direction slightly angled away from the x-axis.
So, to answer your question, I don't think we require any special math to describe what you observe - rather, the claim that the rotation is solely about the y-axis might be incorrect (it is not clear to see from this gif animation about which axis/axes we are rotating).
Comment: I agree that the OP states that the 'surface is fixed', but it is tempting to imagine, for instance, that the blue surface is flat with the *topmost* part located at the earth's south pole so that the initial velocity causes the rightward acceleration due to the Coriolis effect (force) $2 \cdot \text{mass} \cdot \vec{\omega}^{EI} \times \vec{v}$.
Comment: @kb314 I agree, that could very well be an explanation. This requires more details to what has been modelled. If this is so, then the surface must be assumed smooth as well, though, in order for rotation to be only about the y-axis.
Comment: Why would we not see pseudo force effects such as Coriolis?
Comment: @kb314 Hmm... The Coriolis effect is a result of Earth's rotation, which would mean gradual sideways motion of the flat surface (and would imply a very long piece of surface so that curvature has significant influence). In the shown simulation I'm not sure why I would assume that Earth's rotation has been included as a parameter. Particularly not considering the apparent relative size of ball and surface. Also, the OP states in a comment that the surface is fixed. So the Coriolis effect doesn't seem to be involved here.
Answer: Since the plane is horizontal and the rotation axis is vertical, the point of contact between ball and plane is on the axis of rotation. Supposing an ideal point contact (which is of course not realistic), there would not be a relative velocity between ball and plane in that point. Hence, there would not be any cause for the ball to move sideways.
$$\vec v=\vec \omega\times \vec r$$
where $\vec r$ is the distance vector from the axis to the point of contact.
Therefore, the assumption that the rotation axis is vertical must be wrong. There has to be a horizontal component of the angular velocity, which is presumably induced by the rolling of the ball on the plane due to friction.
PS: if we are talking about a numerical simulation, the cause of the observed effect can be almost anything, depending on how accurate or inaccurate the simulation is.
Comment: The picture might be confusing, but the surface is horizontal.
Comment: @sball19: if the plane is horizontal and the rotation axis is strictly vertical, then my first paragraph applies: no lateral motion whatsoever. Of course this is a theoretical example because even the slightest deviation of axis or plane might cause a relative contact velocity, and hence, a lateral motion. But this will not be predictable in the sense of the solution to some equations of motion.
Comment: So the lateral motion does not exist and is caused purely by numerical simulation as the ball is actually divided into tetrahedrons?
Comment: If it not also rolling in the horizontal direction (which means that the angular velocity vector would not be strictly vertical), then this might be an explanation. You could check the hypothesis by increasing the tesselation.
Comment: By the way, **if we are talking about a numerical simulation with contact and friction and all, it gets way more complicated to answer your question**, because the answer also depends on the time integrator, the force calculation, the way contacts are modelled and so on. I was initially thinking that we talk about analyitic solutions that are only visualized as shown.
Comment: Thank you for your great insights. I actually have no background in physics and just wanted to know why my simulation is showing what it is showing, and the answer "should not have lateral motion" fully explains everything.
Answer: Although the OP states that the 'surface is fixed', it is tempting to imagine, for instance, that the blue surface is a relatively small flat surface with the topmost part located at the earth's north pole (corrected from the related comment mentioning south pole) so that the initial velocity causes the rightward acceleration due to the Coriolis effect (force) $2\cdot \text{mass} \cdot \vec{\omega}^{EI} \times \vec{v}$.
* Thanks to @Steeven for the original answer and related discussion.

Moving ball with rotation


K3 surface criteria

Question: Suppose I have an affine equation $f(x, y) = 0$ which after homogenizing becomes $f(X, Y, Z) = 0$ in $\mathbb{P}^{3}$. Are there ways to check that $f$ represents a K3 surface?
Comment: Btw, if you're interested in K3 surfaces then there are good introductions available in Beauville's "Complex algebraic surfaces" (and his Astérisque K3 surface seminar notes, but they are hardcore) and in Huybrecht's notes (available for free on his website). Avoid Barth, Peters, Van de Ven on your first pass; it's a reference book and isn't actually meant to be read.
Answer: There sure are. Let's denote by $X$ the surface defined by $f$, and let's suppose that $X$ is smooth. For any compact complex surface, being K3 is equivalent to being simply connected and having trivial canonical bundle.
A hypersurface in $\mathbb P^n$ is connected and simply connected by the Lefschetz theorem, so we only need to find a condition ensuring that the canonical bundle is trivial.
This condition is given by the adjunction formula, which says that if the polynomial $f$ is of degree $d$, then
$$ K_X = ( K_{\mathbb P^3} \otimes \mathcal O(d) )_{|X} = \mathcal O_X(d-4). $$
This bundle is trivial if and only if $d = 4$, or in other words, if $f$ is a quartic.
A fun exercise involving the adjuction formula is to see that there are very few K3 surfaces given as complete intersections in $\mathbb P^n$. In fact, they only exist in dimension 4, 5 and 6 if I remember correctly.
Comment: K3-surfaces X being complete intersections in m-dimensional projective space exist only for m = 3,4,5; they have multidegree respectively 4, (2,3), (2,2,2): If the complete intersection X has multidegree (d_1,...,d_n) in n+2-dimensional projective space, than d_1 +...+ d_n = n+3 is required for the canonical bundle of X to be trivial; avoiding hyperplane sections one can assume d_j >= 2 for each j. One easily checks that such complete intersections have vanishing irregularity because the cohomology of projective space is well-known.
Answer: I am convinced that $f(X,Y,Z)$ represents a K3 surface iff it is a quartic (fourth-degree) polynomial, see page 16 of this review of K3 surfaces:

http://arxiv.org/abs/hep-th/9611137
Comment: We also need the quartic to be smooth

K3 surface criteria


Identifying symmetric key

Question: When investigating an application I found a cryptographic key. Based on the documentation related to how the key is used I know it's some form of symmetric key. However I don't know what cipher it is used in and I can't find out from the application as that would require reverse engineering compiled c++, A skill I don't possess. The key does not appear to be user chosen and is represented as 64 hexadecimal characters (256 bits). My question is, is there any program or test that could be easily preformed on the key to determine if it is valid for common ciphers? Such as a check to see if it's a valid aes-256 key or similar. Thanks
Comment: You mean, given a key, determine what cypher was used? To determine if it is valid, you would need to decrypt something ...
Comment: I don't think there is anything like "constraints on acceptable keys". A key for a computer encryption/decryption algorithm is simply a sequence of bits. Most ciphers require the key to be of a certain length, but apart from that, as @schroeder already pointed out, you need to use the key on a ciphertext to find out if it decrypts.
Comment: I think you're going to need to do some debugging - if you can make the app use it, you can see the context it does that in.  There's a BruCon presentation from some KPN folks that gives an example of this and the tools they use - https://www.youtube.com/watch?v=iTGvbi_wLE0 - the binary analysis starts at 32 minutes in.  They work through identifying the key and the cipher - not quite a tutorial, but pretty close.
Comment: Schroeder, you are correct, I am trying to determine the cipher, by valid I mean could the key be hypothetically used with the cipher, does it meet the ciphers constraints on acceptable keys
Answer: As mentioned, there are no constraints on valid keys. This would limit the keyspace, making the algorithm less secure.  You say you don't have reverse engineering skills to throw at this problem, and you don't mention the app used. This leaves us at a dead end because we can't help as far as i can see. You could however try detecting the magic constants with an IDA plugin like FindCrypt (http://www.hexblog.com/?p=27), that would require only basic use of RE tools.
Answer: Can you open it with a certificate tool like Cleopatra? If you are on Windows give it a crt or pem file extension and Windows will usually open it in their Certificate viewer.
Comment: I don't think it could be possible for the key to be a certificate. As far as I know all certificates are based on asymmetric crypto and this is definitely symmetric. Additionally the data is only 256 bits so there is no way a key and all certificate data could fit.

Identifying symmetric key


How to get the captcha when doing a webrequest?

Question: I'm letting my users register an email account, the users just fills in all information in my program and my program will fill the fields. Well not really it makes a POST request with the correct postdata to the correct form/post url.
However the website requires a captcha, I just simply want to show the captcha to my user, he enters the value and then it gets send along with the postdata.
The register page is here: http://register.rediff.com/register/register.php?FormName=user_details
I can just get all image urls from the html but when I copy the url of the captcha image and go to it, it's a different image then the image i copied the url from:
http://register.rediff.com/register/tb135/tb_getimage.php?uid=1312830635&start=JTNG
How do I do this using HttpWebRequest ?
I can just grab the html first:
string html = new WebClient().DownloadString("http://register.rediff.com/register/register.php?FormName=user_details ");
Then get the image url but I don't know how to show the same captcha to the user?
Btw it's not for a bot... it's not something automated.. it's just I don't want the user to show the webinterface...
Answer: Not really answer, some advice instead:
If you're writing an app client to work with the website, a better approach would be to write a WCF/WebService for the App to interact with directly - this can just refer directly to your BL layer.
If you want the whole app to work on screen scraping then that's a lot of work ahead, and your app will be dependent on the site not being changed.
Comment: Well any suggestions on screen scraping then>


Placing a circle as close as possible to a specific coordinate without overlapping another circle

Question: I am working on a 2D game in Java. My goal is to place a ball as close as possible to the center without overlapping the balls that are already there. How can this be done?
Comment: What exactly do you need to accomplish, placing the ball or finding the position that is nearest to the center without overlapping the balls already in place? What have you tried?
Comment: This can be done in many ways. Some ideas is to look up collision detection for balls/circles in 2D. One idea could maybe to store the positions of the other balls and then place then new ones on the edge of those. It all depends on what exact behaviour you want.
Answer: If you take each circle that's already been placed, and expand it by the radius of the one you want to place. Together, these circles form an "exclusion zone" - places where the center of your new circle cannot go without overlapping one of the circles already there. I've visualized the exclusion zone in pink created by the grey circles below. The big black dot is the center of the map we want to try to place our new circle close to.

If the target point we want to approach is inside this pink exclusion zone, then the closest our new circle's center can get is somewhere along the perimeter of the blob these exclusion circles form together. I've highlighted that perimeter in red. We'll check each arc on that perimeter to find our closest point.
To speed up out checks of what is or isn't in the exclusion zone, we can divide our map into a grid of buckets. Above, I've chosen the bucket size to be \$\sqrt 2 \cdot r_\text{min}\$ where \$r_\text{min}\$ is the smallest radius of any grey circle. This means that there can be at most one grey circle center in any bucket, and we only ever need to scan a fixed  set of buckets around our test point to find all the exclusion circles that could exclude it - no matter how many circles there are in total.
If all your circles have the same radius, then that's a 5x5 box centered on the point to test. If you have 25 or fewer circles, then just brute forcing through the full list would be just as good.
Alright, with that out of the way, let's get into the meat of the algorithm:

We check to see if the target point we want to approach is in our exclusion zone. If not, we're done - place your new circle at that point.
If it is, then we'll add all circles overlapping it to what we'll call "the open set". These are the circles we've found, but haven't investigated in detail yet.

While the open set is non-empty, take an exclusion circle out of it and add it to the "closed set". These are the circles we've checked thoroughly.
We'll call this our "parent circle".

Next we'll find the point along the parent circle's circumference that's closest to our target point, by projecting the line from the parent's center through the target out to the exclusion radius. (Note that this point might not be on the outer perimeter of the whole blob - we'll check that next)

<code>toTarget = target - parentCircleCenter;
closest = parentCircleCenter + toTarget.Scale(parentExclusionRadius / toTarget.Magnitude());
</code>

If this blue point is not the closest candidate we've found so far, we give up on this circle. No other point on its perimeter will be any closer. So we grab the next circle off the open set and repeat from 2. (Note that this can't happen for the first circle we check, since we have no better candidate so far)

If the blue point is the closest we've found so far, we check whether it's inside any other circle on the exclusion zone.
If not (like the example on the left), then we record it as our best candidate and continue to the next circle in the open set.

If the blue point is inside another exclusion circle (like the example on the right), then we walk through each other exclusion circle it's a part of. We'll call these "child circles" to distinguish them from the parent we started with.
We'll skip over any child circles that are already in the closed set, to ensure we don't end up going in a loop checking the same circles over and over.

As we check each child circle overlapping this blue point, we add it to the open set if it wasn't in it already.

We find the two points of intersection between the child circle and the parent circle - you can use the formulas here for that.

We check if either of these two intersection points is closer than our best candidate so far.
If so, we check whether this intersection point is excluded by any circles other than the parent-child pair we just looked at. If so, we add that neighbouring circle as another child to check. If not, then we log the point as our best candidate.
Once we've looked at both intersection points and either logged them as our best candidate or rejected them as worse / excluded, we continue to the next child circle in 6.

Once we run out of child circles to check, we examine the next circle in the open set in 2 - giving us a new parent circle.

Once we've emptied the open set, we're done. The best candidate point that we've found is the best possible.

Note that unlike a randomized approach, this route is guaranteed to find the closest point there is, and that it will do so in a bounded number of steps, linear in the number of circles we need to avoid (we do a bounded amount of work per circle added to the closed set, and we add each circle to the closed set only once).
Also, in the pathological case where there is no available place to put a new circle, this approach will determine that in its normal runtime instead of running forever.
Comment: yep that seems guaranteed, not randomized.. just tad a bit more complicated :)
Comment: but I give my upvote :)
Answer: While making games I face similar problems quite often. What I found is that often best (quickest,easiest) way is.. not to look for that perfect answer, instead use computer to work it out for me.
This dead simple solution will work:
So there is infinite number of points. Lets find that one.
a) write function which checks if given point is valid. It should check distance to each balls center and if there is enough space for your ball, return true.
b) write a while loop where different points are checked until valid is found.
In this loop first supply the center point, then Random point close to it, then another.. until fitting point is found.
That's it. Lazy dumb solution but it will work, and yes it might take few hundred cycles to find it, but in user time it will be just a moment. Also add some protection from forever-loop.
Comment: Let's say we're 500 loops in and we haven't yet found a suitable point. What protection would you recommend so we can avoid looping another 500 times while still returning a decent location if there is one?
Comment: ok, In fact no protection is strictly necessary (just don't make silly mistake causing forever loop). I answered OP's question: how to find such point. If such point exists my algorithm will find it. OP didn't ask (at least not yet) how to make sure such point exist. Maybe it is a given, that such point exist, - question was how to find it.
Comment: if there is such point eventualy computer will find it. Why not let it run another 500 cycles? What would be necesarry though - is to make sure such point exists in the first place before running. (by for example adding much less balls than space, etc)
Comment: So then what is your recommended way to "add some protection from forever-loop"?


Managed, Mobile account on Mac not giving me the option to change password when Admin is unlocked?

Question: I'm trying to change/access mobile and managed accounts on a Mac network system. System Preferences won't give me the option to change a password of a mobile account. How can I view or change this password?
Answer: A managed / mobile account is controlled from the directory so you can't change that password unless there's some sort of integration with a tool like Apple Enterprise Connect or Nomad (https://nomad.menu) where the tool calls to the Active Directory to make the password change.
All Mac accounts have their password encrypted and obfuscated, so you'd have a hard time cracking them.

How can I recover a standard user's password using the admin password?

Best bet is to get your admin staff to assist you in resetting the passwords or letting you be the administator of this Mac and set up local accounts.


Is this considered the Blue Ribbon Edit Bar?

Question: I would like to know I am correct. Is this the SharePoint's blue ribbon editing bar within the Task List Timeline?
Answer: Yes Designer ribbon is related to sub tabs,While the ribbon represents a new way of organizing and presenting the controls within SharePoint, in general, the controls themselves have changed very little from previous versions. All of the original functionality that you may be used to is still there, but presented in a different way.
At the top of the ribbon are a series of tabs which relate to the different kinds of functions that can be performed within a given page. For example, when you open the default page for a list or library, the page opens with the Browse tab selected. The Browse tab has no ribbon-based tools associated with it. Depending on your level of permissions and the type of page you are viewing, other tabs, such as Edit, Share & Track, Publishing, and List Tools or Library Tools may appear as well. To use the ribbon controls, click the tab that corresponds to the kind of task you want to perform.


Geometry question about lines

Question: If I have two points in euclidean space or the Cartesian plane whichever and both points lie on the same side of a straight line. Both above or both below- how can I show that the segment connecting the two points also lies above or below the line respectively . I.e every point on the segment is above or below the line respectively. This is so obviously true. Is one supposed to take it as axiomatically true? Or can it be proved?
Comment: Depending upon the set of axioms you're using, you may have an explicit "Plane Separation Postulate" that says exactly what you want. For instance, the [School Mathematics Study Group axioms have it](https://en.wikibooks.org/wiki/Geometry/The_SMSG_Postulates_for_Euclidean_Geometry). But some systems use [Pasch's Axiom](https://en.wikipedia.org/wiki/Pasch%27s_axiom), which (again, depending upon the other axioms in play) is logically equivalent to the Plane Separation Postulate. At the Foundations level, you have to be really careful about your assumptions.
Comment: Maybe you could use the fact that "the line segment between two points is the shortest path"?
Comment: @Blue Yeah I'm with you, it does depend on the assumptions and the OP is very close to basic assumptions. I used the assumption that every two non-parallel lines intersect at one point, but then I ended up needing continuity of a segment to complete the argument, which almost surely requires many more of the "simplest" assumptions.
Answer: It can be proved by contradiction.
Suppose that the target line going through the first point is not entirely on the same bank of the given line as those two points.
Case-1. (an impossible case) That line is entirely on the other bank. How can that line connect those points?
Case-2 Then it must have crossed the given line to reach the second point. Where could that second point be?
Answer: You could use the fact that two non-parallel lines intersect at one unique point, and so if the segment intersects the line, then one end point of the segment is "above" and the other is "below", otherwise you would have at least two intersections because a segment is continuous. Here "above" and "below" are taken in the weak sense, i.e. one of the points could be on the line.
Answer: Given an equation for the line $f(x) = ax+b$, you can define a function $g:[c,d]\rightarrow\mathbb{R}$ that connects the two lines. Write the distance between the lines as a function of $x$ and then check for local extrema, you will find that there are non, therefore the minimal distance has to be at the global points $c,d$ which are just the original points. Thus every point on the line segment has to be on the same side.
Answer: The original line partitions the plane into $2$ subspaces. Given $2$ points, consider the line passing through them both. The original line partitions this line, and so if the points lie in the same partition, they are on the same side of the original line, and clearly the segment between them doesn't cross the original line.

Geometry question about lines


Is it possible to bulk edit all my Facebook posts?

Question: I am in a situation, where I have to bulk-edit all URLs I have ever posted, preferably with a regular expression. Is that possible?
Comment: "Bulk update" in what way? There is a tool which will let you change all of your past "Public" posts to "Friends".
Comment: Facebook has an API or you could use something like iMacros to script a solution (after paging all the way down on your "activity" page)
Answer: Natively via Facebook desktop, no, there is no way to do this.
Using iMacros or any extension based on the number of posts in the bulk can lead you to a rate limit block on your account.
Using the API via a third party application will not work either as third party applications cannot edit posts that did not come from that application.
So, the safest bet is to use the API with a Facebook native application user access token (i.e. a whitelisted Facebook mobile app), using the Facebook native app will ensure

all posts are received
lower the risks of rate limit occuring
be able to edit any post

Within the scope of this site (since programming is off topic) all I can do is point you to references

https://developers.facebook.com/docs/graph-api/reference/
https://github.com/jgorset/facepy
Comment: 0

I'm confuse, do that means we need to use 1) some code that use the facebook API which need to be sent through 2) a "whitelisted Facebook mobile app"? If I don't get it, and we need to choose one or the other, what's the quickest/simpliest way to edit old post? (I just want to set all post to public).


Where can I get an Ubuntu Installation CD/DVD/USB?

Question: I need to upgrade my existing Ubuntu system, and I also want to install Ubuntu on a new laptop.  I would like to have an installation CD or DVD to do both of these.  Where exactly I can order or request an Ubuntu installation CD/DVD/USB?
Answer: It's no longer possible to request a CD with the "Ship-it" service. You now have to download it, or order it from a third party company or via the Canonical Store.
http://shop.canonical.com/
Answer: You can Buy Ubuntu Desktop DVD from OSDisc.com website. (The site closed in the meantime.)
You can also obtain the Full Ubuntu Software Repository (11 DVDs) from there site or You can directly go to the page by clicking here.
Please Remember that, You must pay for their products. If you do not need all of the software from the repository, It probably be costly for you.
Comment: Full repository, Nice! that would be great for no Internet.
Answer: An 8GB bootable USB stick of Ubuntu 16.04 LTS Desktop is available from the official Canonical Store for $7.29.

Update: Canonical is no longer producing bootable USB/CDs and neither is any other source that I regard as reliable (better than eBay).

Buying a blank 4GB 8GB USB flash drive is cheaper than buying an Ubuntu USB. It only costs about $5.00 USD. A USB flash drive is reusable, and you can download whatever version of Ubuntu you want, and then use the flash drive as an Ubuntu installation disk.
How to make bootable Ubuntu live USB
Windows
The instructions for preparing an Ubuntu live USB on Windows are found at the official Ubuntu How to create a bootable USB stick... webpage (see the step-by-step instructions below). The USB flash drive that you use to make an Ubuntu live USB must be 2GB or larger. For Ubuntu 18.04 and later the USB flash drive should be 4GB or larger.

Open Rufus and select your USB stick in the Device dropdown menu.

Click the CD-ROM icon next to the FreeDOS dropdown menu, then find your downloaded Ubuntu ISO and click Open and then Start.

Click Yes when it asks to download Syslinux software.

Click OK to write in ISO Image mode.

Confirm that your USB stick is selected and then click OK to continue. It is very important to verify that the device that you are installing the Ubuntu live USB to is indeed your flash drive, so that you don't overwrite any of your system or personal files which may make your operating system unbootable.

When it is finished, just restart your computer and start using Ubuntu, or you can install Ubuntu.

In order to enable your computer to boot from the USB flash drive, you must enter your BIOS/UEFI setup utility by pressing one of these keys: Delete, F2 or F10 as soon as the motherboard splash screen appears when the computer is booting. In the BIOS/UEFI menu, you need to change the boot order so that the USB flash drive, which is usually called USB-HDD in newer computers, is the first entry in the boot sequence, and then save your new settings and exit the setup utility.
Mac

You will need:

A 4GB or larger USB stick/flash drive
An Apple computer or laptop running macOS
An Ubuntu ISO file. See Get Ubuntu for download links

To ensure maximum compatibility with Apple hardware, first blank and reformat the USB stick using Apple's "Disk Utility", but this step can be skipped if you intend to use the USB stick with only generic PC hardware.

Launch Disk Utility from Applications -> Utilities or Spotlight search.

Insert your USB stick and observe the new device added to Disk Utility.

Select the USB stick device (you may need to enable the option View -> Show All Devices) and select Erase from the toolbar (or right-click menu).

Set the format to MS-DOS (FAT) and the scheme to GUID Partition Map.

Check you've chosen the correct device and click Erase.

Warning: Disk Utility needs to be used with caution as selecting the wrong device or partition can result in data loss.

Install and run Etcher
To write the ISO file to the USB stick, use a free and open source application called Etcher. After downloading this and clicking to mount the package, Etcher can either be run in place or dragged into your Applications folder.
By default, recent versions of macOS block the running of applications from unidentified developers. To side-step this issue, enable App Store and identified developers in the Security & Privacy pane of System Preferences. If you are still warned against running the application, click Open Anyway in the same pane.

Etcher configuration
Etcher will configure and write to your USB device in three stages, each of which needs to be selected in turn:

Select image will open a file requester from which should navigate to and select the ISO file downloaded previously. By default, the ISO file will be in your Downloads folder.

Select drive, replaced by the name of your USB device if one is already attached, lets you select your target device. You will be warned if the storage space is too small for your selected ISO.

Flash! will activate when both the image and the drive have been selected. As with Disk Utility, Etcher needs low-level access to your storage hardware and will ask for your password after selection.

Write to device
After entering your password, Etcher will start writing the ISO file to your USB device.
The Flash stage of the process will show progress, writing speed and an estimated duration until completion. This will be followed by a validation stage that will ensure the contents of the USB device are identical to the source image.
When everything has finished, Etcher will declare the process a success.
Congratulations! You now have Ubuntu on a USB stick, bootable and ready to go.

Warning: After the write process has completed, macOS may inform you that 'The disk you inserted was not readable by this computer'. Don't select Initialize. Instead, select Eject and remove the USB device.

Boot your Mac
If you want to use your USB stick with an Apple Mac, you will need to restart or power-on the Mac with the USB stick inserted while the Option/alt ⌥ key is pressed.
This will launch Apple's 'Startup Manager' which shows bootable devices connected to the machine. Your USB stick should appear as gold/yellow and labelled 'EFI Boot'. Selecting this will lead you to the standard Ubuntu boot menu.

Source: Create a bootable USB stick on macOS
Answer: You should try downloading an ISO image from http://www.ubuntu.com/download. This page describes how to burn the downloaded ISO to a disk after you obtained it.
Answer: OFFLINE SOLUTION
Install apt-offline pkg:
<code>$ sudo apt-get install apt-offline
</code>

Generate "apt signature" file:
<code> $ sudo apt-offline set ~/my.sig
</code>

Download the required packages:
Once you have the .sig file on a USB drive, connect it to an internet connected computer running on Ubuntu and use the following command in the terminal:
<code> $ apt-offline get -d /to_any_chosen_directroy /path_to/apt.sig
</code>

Install the downloaded packages:
<code> $ sudo apt-offline install /path_to_downloaded_package_folder
</code>

Enjoy the latest updates.
ONLINE SOLUTION:
You can use command-line to upgrade:
<code>$ sudo apt update
$ sudo apt upgrade
$ sudo apt dist-upgrade
</code>
then:
<code>$ sudo apt autoremove
</code>
Now follow below steps to upgrade:
<code>$ sudo apt install update-manager-core
$ sudo do-release-upgrade -d
</code>
After install you should change source list:
<code>/etc/apt/sources.list
$ sudo sed -i 's/xenial/bionic/g' /etc/apt/sources.list
</code>
Now you upgrade to 18.04
After all:
<code>$ sudo apt update && sudo apt -y dist-upgrade
</code>
Answer: You do not need to buy a disc.
Just download the ISO and burn it to a DVD.
Answer: You can buy Ubuntu on Ebay (cheapest) - a DVD with international shipping is about US$5, USB flash drives are around $10.
Answer: Search for the desired release from this link:
    http://releases.ubuntu.com/
The best place to find the LTS version of Ubuntu is this:
    http://www.ubuntu.com/download/desktop
If you want to download through alternative downloads:
    http://www.ubuntu.com/download/alternative-downloads
If you want to download older versions:
    http://old-releases.ubuntu.com/releases/
To create your live CD / DVD / USB:
    UNetbootin - https://unetbootin.github.io/
    universal-usb-installer - http://www.pendrivelinux.com/universal-usb-    installer-easy-as-1-2-3/
    linuxliveusb - http://www.linuxliveusb.com/
\o/


Why were there Muggles at the Quidditch World Cup?

Question: In Goblet of Fire, there is a Muggle named Roberts who is in charge of giving out campsites. Why did the organizers need him? They could just take any place and enlarge it by magic, without risking Muggles finding out about magic.
Comment: So the Death Eaters had somebody to terrorise afterwards.
Comment: If I had to take a guess, it'd probably be because that much magic would be exhausting and expensive to use.  Whereas having a real camp site chosen and tended to by muggles would be a great deal cheaper and easier.
Comment: It *was* the muggle's field IIRC, so perhaps he made a condition of use for the field being that he managed how it was used.
Answer: It seems pretty clear that the Roberts' campsite was simply located in a convenient location near to where the Quiddich World Cup was taking place.
Presumably the sizeable influx of guests from around the world would make it necessary to use all sorts of muggle services for the supply of food and water (neither of which can be magically created) and especially lodgings. It's notable that the Diggory family is assigned to the next field over, one owned by a Mr Payne.

He picked up the dusty kettle and peered inside it. 'We'll need water
  …' 'There's a tap marked on this map the Muggle gave us,' said Ron,
  who had followed Harry inside the tent, and seemed completely
  unimpressed by its extraordinary inner proportions. 'It's on the other
  side of the field.

Out of universe, obviously the Roberts' family serve as a proxy to show how badly the wizarding world (both goodies and baddies) treat muggles. The Ministry are enchanting his memory a dozen times a day and the Death-Eaters are so despicable that they choose to harm his family for the sheer fun of it.
Comment: This accounts for why the Muggle _structures_ were used; but apart from the out-of-universe bit, I don't see why the actual _Muggles_ couldn't just be gotten rid of. It would be so much easier to just enchant them once to believe they've won the lottery and have them go on a two-week holiday in Greece (leaving their field to be operated exactly as it is now, but by wizards instead of Muggles), than having to alter their memories dozens of times a day, which (as we know from Bertha Jorkins) is not a risk-free thing to do.
Comment: @JanusBahsJacquet - But then who'd do all the cleaning out of latrines, liaise with the utilities companies, etc? Having the muggles around to act as their slaves must be like having especially smart House Elves.
Comment: Surely wizards could clean out latrines much more efficiently than Muggles—just "vanish the evidence", as they say. Utilities companies is a better point, but I don't really think that would be very necessary either, would it? Wizards generally don't use electricity, the water we see comes from a well (which isn't likely to get shut down in less than two weeks—and even if it did, _Aguamenti_), Muggle-supplied central heating isn't likely to be an issue in tents, and food should also be obtainable without Muggle help.
Comment: @JanusBahsJacquet - Would you rather *tell someone* to go clean out several dozen latrines or do it yourself, no matter how easy it would be?
Comment: Obviously I'd rather tell someone else to do it. But considering the rather tremendous security risks entailed, having _Muggles_ in particular do it doesn't seem very prudent. They could even have got rid of the Muggles and just used actual House Elves to do their dirty work as per regular practice. A handful of Muggle-savvy wizards (which we know do exist) working as liaison officers would likely suffice.
Answer: I would guess it was just for ease of use - there was no reason to co-ordinate and employ a magical logistic system when a perfectly good muggle one existed.
Possibly it was an ethical issue.  If the field was hired out by the owner and the Wizards wanted to use it then it is only fair that they follow his rules ... although I am not so sure this is a big thing in the wizarding world!