Arduino Packet for Bluetooth

Question: I'm having trouble figuring out how to start my project. The objective is to control a robot with four servo motors and six DC motors through bluetooth. I have a bluetooth shield from Adafruit and I'm using the Arduino UNO. Ideally, I want to control this robot by sending it packets through Processing. The problem is I don't know how to create a packet with a header, payload, and checksum. I can't find any examples; can anyone help me find something to help me get started?
Comment: One layer of this should already be being invisibly added, verified, and removed in the bluetooth subsystem, but you can do your own as well on top.  One thing which would make your life a LOT easier is to use a printable format so you can use a serial monitor for debugging.  For example you could simply have a line of readable text, and a two-digit hex checksum at the end followed by a carriage return (a bit like a line from a .hex file).  You could put a byte count at the start of the line, but don't need to.
Comment: I don't understand. What I'm saying is: I don't know what a packet is, or a header, or a payload, or how to create a checksum. Is there an example out there that helps me grasp what these are?
Answer: First, depending on the degree of reliability you need, you may not actually have to do this yourself, as the bluetooth implementation will already invisibly-to-you add, verify, and remove a packet and checksum framing around your data.  But let's assume you want to add your own as well.
A packet is a batch of data to be transmitted as a contained unit.  It may or may not contain exactly one useful message, but it is quite convenient if it does, and since you will be doing your own packetization (at this level) you can make sure that it does.  So basically you will transmit something that has a structure, for example:

Hi, I'm a packet
attention HAL
"Open the pod bay doors"
The bytes in this message should add up to xx if you ignore the overflow
That was a packet

There are countless ways you could implement this, but your life will be a lot easier if you make both the messages and the packet structure human readable, so that you can watch on the serial monitor, and perhaps even type manually.  So let's say you did something like
<code>M1=200/BF\n
</code>
For simplicity sake, instead of having a "Hi I'm a packet" header, we just use the newline character '\n' to mark the end of a packet, and assume that whatever comes next is the start of a new packet.  Further, since bluetooth is already creating a one-to-one link, you don't need to address who you are talking to.
Now we have a message, for example "M1=200" meaning "drive motor 1 at PWM level 200" (out of 255).
I'm somewhat randomly choosing the '/' character to mark the division between the message body and it's checksum.
"BF" might be the low two hex digits of adding up all the previous bytes in this message (it's not, I just picked something random).
And finally you have your newline to mark the end of a message and the end of a packet, since in this scheme we've decided that 1 packet = 1 message.
For extra fun, if the robot itself is not dangerous, you can make a test mode where the receiver will accept messages with no '/' and checksum, and only check the checksum on those where it is present.  This would allow you to manually type messages into a terminal when you are experimenting.  Or you can make your own specialized terminal program which calculates and appends a checksum each time you press return
Answer: Start simple.

send serial data from PC. either use Arduino USB port or on real hardware serial port, needs USB to serial adaptor and a terminal software. (see diagram in below web)
for starting, no need for header. Just use simple text as defined yourself
on Arduino side, read serial input. For example, type letter 'a' on PC will blink LED, 'b' to move servo 30 degree
Replace serial communication (like RS-232 or a UART) with Bluetooth. Bluetooth supports many 'profiles', like headset, keyboard, etc. that are not suitable in your case.

See below video. You need to use the SPP profile. see https://learn.sparkfun.com/tutorials/bluetooth-basics/bluetooth-profiles
Make sure your purchased bluetooth device supports SPP. Some bluetooth device are permanently setup to do one fix action. However, many bluetooth need to be 'programmed' (told what to do) before doing the task via AT command. Set speed, pairing, etc.
https://learn.sparkfun.com/tutorials/using-the-bluesmirf/example-code-using-command-mode
http://www.instructables.com/id/Modify-The-HC-05-Bluetooth-Module-Defaults-Using-A/
Comment: Quoted from your link, "Bluefruit EZ-Link shield is a regular 'SPP' device" so you have brought the right unit. At FAQ, "There is no command mode for EZ-Link, it is designed to be used out of the box.", so, one less thing to worry. The tutorial look excellent and should have all info you need. There are may steps and 'fine points'. Make sure you follow them precisely and carefully.  Are you using one pair of "module plus Arduino"? That is, two same_brand and same_model BT modules communicating. Thinngs are more complex if different equipment is involved, like BT module communicate with phone.
Comment: If I am at your situation, I would forget my code for the time being. Just follow the Adafruit tutorial from start to end. This ensure wiring done ok and the unit is paired (need one time pairing and two modules can communicate in all future sessions)

Arduino Packet for Bluetooth


Need for refactoring?

Question: Why should companies invest in refactoring components, though it is not going to add any new feature to the product ?
I agree it is to clean the code, fix bugs and remove dead code - but what is the take ??
Answer: Maintenance.  It will reduce your maintenance costs significantly.  There is no comparison between fully factored code and the junk that sits in most companies repositories.  The latter is virtually worthless, while the former is gold.
Comment: But what is the value add for the customer ??
Comment: There is no single customer-The customer exists throughout the lifecycle of the code.  Every bugfix and update is easier and quicker, so the product at any given time has more features stability.  I'm working on your next cable box right now-want me to stop refactoring (trust me, the answer is no)?
Answer: It depends who you ask. A non-technical manager may say there is no need. A support developer would say that it would help keep the maintenance costs down.
Answer: Refactoring needs to be a part of your every-day job.  You constantly refactor your code to make it more readable/maintainable/robust/reusable, etc.
Your code is a living document.  If it doesn't change over time, it becomes stagnant.
Invest in testing.  Invest in refactoring.  Invest in writing good code.
Answer: maintenance. Sometimes, a project gets to big or with too many "fast" patches to be further expanded. You just have to sit down calmly and clean and refactor.
Answer: While the other answers are all true the power of Refactoring is that it allows you to change the design of your code with predictable results. The biggest problem of maintenance is that it is virtually impossible to anticipate all requirements for complex applications.
Most of these can be dealt with by adding a new feature like a new report or command. But other will require part of your application to be redesigned. This is where refactoring and it's sibling unit-testing comes into play. By using refactoring techniques you can make needed design changes safely.
It is not a cure all technique but another tool that improves the quality of your code. (stuructured programming, object-orientation, etc).
Answer: To start off with: Refactoring is a tax.  If the code works, then you are spending time fixing code that already works, I can see the business types looking quizzical now.  A saying I like is "Legacy is another word for code that works."
Now there are many problems with a growing code base that need to be addressed before you start to spend more time maintaining the code that developing features.
Personally I like the "No Broken Windows" philosopy.
Answer: If it ain't broke don't fix it.
But if you need to start fitting the components into new unpredictable requirements then it often makes sense to identify the bits you can extract and reuse. You need to be certain that your changes are introducing unexpected bugs - so you'll need good test coverage.

Need for refactoring?


Convert PS to PDF filed in C#

Question: I have to make utility that converts PS files to PDF files.
Is there any FREE .net API available or any other solution for this.
Answer: I am afraid there is not much free can be found except of Ghostscript.
Take a look at A Simple C# Wrapper for Ghostscript.
If you want something more convenient then drop the FREE requirement.

Convert PS to PDF filed in C#


Can Firefox's password manager sign in automatically to websites?

Question: Firefox's password manager can fill website login forms, but is it possible to sign in automatically?
I prefer clearing cookies on browser shutdown and don't want to install add-ons.
Comment: @MarkStewart:

I haven't disabled cookies
Comment: Sounds like you want a gun that does not have the ability to fire.  No cookies = browser unable to see what your login name is; and how would Firefox know to press "Enter" without an add-on?
Answer: No, Firefox cannot do what you are asking natively (without add ons)
You are essentially asking for a functionality that would copy the cookies elsewhere (encrypt them as you are worried about storing them in first place) and when firefox starts, decrypt and copy back...
Comment: I don't think I'm asking about cookies. Login credentials are saved, I want that Firefox sends the filled form automatically.
Comment: Right, for the first logon, after that cookies are used to keep you logged in, so there are two approaches, but still not possible with native Firefox
Answer: A: This problem is already solved. By exactly providing you with a cookie. Contrary to popular believe cookies aren't actually bad thing and have legitimate use and are save if applied correctly. Or at least saver than any home-cooked solution (Ok, cookies are not perfect, but who knew when they were invented).
B: Automatically signing in with password managers is a terrible idea! This is literally asking to get fished by bogus websites and you will not be any the wiser if it happens.
To only reasonable solution is to use a cookie manager plugin that allows you to save a list of cookies from being purged. Or use Privacy Badger + an Ad-blocker and disable third party cookies, to get rid of the worst kinds of cookies.
If your worried about tracking through cookies: there are way more sophisticated mechanisms than tracking cookies today. Cookies just gives a short cut to identify you. Look into browser fingerprinting techniques and enjoy the nightmares it induces for days ;-)
Comment: "Automatically signing in with password managers is a terrible idea! This is literally asking to get fished by bogus websites and you will not be any the wiser if it happens." - is this an issue when the password manager verifies that page URL matches?
Comment: That depends on two things: 1. the security of your network. If you have an attacker on your network preforming ARP/DNS spoofing. he can impersonate what ever domain he wants. This is very easy to do. 2. on how diligently the URL matching is done by the pw-manager AND the browser. Just some month ago there was a vuln fixed in lastpass where one could craft specially encoded URLs which where decoded to look like a URL you have saved.


Categorical Imperative vs. Utilitarianism

Question: I'm watching philosophy crash course, and the narrator claimed that Utilitarianism is the antithesis of the of Kant's categorical imperative. However, on the surface, I can't see a major difference. How do the two differ in their approaches?
Comment: Categorical imperative urges to judge actions based on their intrinsic character, "not simply as a means" to an end embodied in their consequences, which is the core tenet of utilitarianism.
Comment: My understanding is that Kantian philosophy focuses more on intent and moral "cleanliness". While Utilitarianism focuses more on the end result and how "breaking Kantian rules are okay if it helps more than it hurts."
Answer: Long post, sorry! As a person who has made a few LD debate cases framed around both philosophies, I have a lot to say and will do my best to answer this. However, since I'm not a philosophy student, you may take my words with a grain of salt if a more knowledgeable person corrects me (and I highly encourage anyone who wants to correct me to do so). Also, I'll assume you're referring to act utilitarianism (the standard version) for the purpose of this post.
As you probably know, act utilitarianism is based on the idea that given a decision, one should only take the action that results in the most amount of "utility". It's basically about maximizing the amount of happiness in the world / minimizing the amount of suffering, and how you get there is irrelevant. On the other hand, Immanuel Kant's philosophy is centered around the idea of the "categorical imperative." According to him, there are 3 formulations of the categorical imperative, and Kantianism is based on obeying those 3 formulations of the CI, regardless of the consequences. I will go through the first and second formulations and how those clash with utilitarianism, and leave out the rest of Kant's philosophy because it's simply too much to put in one post.
The first formulation is that one should "act only in accordance with that maxim through which you can at the same time will that it become a universal law." Basically, what this means is that you should only do an action if you would want every person in existence to follow that action as moral law. This is essentially a way of determining whether the action is moral, regardless of the consequences. For example, if you could kill one person to save five people, you should not do it because if everyone were to freely kill one another society would fall apart (and you don't want that). Utilitarianism, on the other hand, focuses only on the consequences and evaluates each action individually. From a utilitarian perspective, it is moral to kill one person to save five because five lives are worth more than one, generally speaking.
The theories also differ when you begin to look at Kant's second categorical imperative, which states that one should treat humanity always as an end and never as a means only. Basically, it means that one should never consider any other factors besides a person when determining how to treat that person. If you could falsely imprison someone to stop violent rioting in a town, you should not do so because you would be using that someone for another purpose (treating them as a means for the goal of peace). Rather, you should treat them as an end, and determine whether they, as a person, deserve to be imprisoned. Since that person is innocent, they do not deserve punishment, and to treat them as ends means you cannot imprison them. Obviously, utilitarianism takes the opposite view, as mass suffering could be prevented by falsely imprisoning only one person (and utilitarianism is based on minimizing suffering / maximizing happiness).
Both philosophies are a lot more complicated and have much more conflicts, but that requires a lot more in-depth analysis of both theories and hopefully the point is made by now. Kantianism focuses on the action and utilitarianism focuses on the consequences. At the very core of this is the debate between consequentialism and deontology, and of whether the ends do or do not justify the means. Hope this answers your question without too much confusion.
Resources on both philosophies if you want to read further:
https://www.iep.utm.edu/util-a-r/
https://plato.stanford.edu/entries/kant-moral/#CatHypImp


Amount of fresh rosemary

Question: I am making a hearty vegetable soup in a 5 quart slow cooker. I'm not familiar with using rosemary in dishes and don't want to ruin the soup. Can someone share with me the amount I should use to help with a hearty flavor?
Comment: Welcome to our site, Kathy! Hope you enjoy your soup!
Answer: Rosemary can be a pretty assertive flavor, too much can overpower a dish, so it's better to underdo than overdo it. How to approach that depends on whether you are using dried or fresh. I would highly recommend fresh herbs over dried in most cases, especially with rosemary as it loses almost all of its flavor and more importantly aroma.
Dried rosemary sprigs look attractive, but the leaves don't rehydrate that well and you can end up with hard pointy bits in your end dish. I've had them stick into my gums even after hours of cooking. If you are using dried whole leaves I recommend crushing them up a bit before adding to avoid that. If you do use dried then you should start with half a teaspoon of powdered or 1 teaspoon of dried leaves. Give it some time to blend in then test the flavor. I would add this early on as it gives the herb plenty of time to rehydrate and infuse the food, as well as add more if you aren't getting the flavor.
Fresh rosemary varies in quality, so how much to add partly depends on how fresh and aromatic it is. The best way to use it is to cut a length of sprig and add the sprig in leaves attached, then lift it out later. If some of the leaves fall off then they will be tender enough to eat, if they stay on the twig then you wouldn't want to eat them.
To test for quality rub some of the leaves between your fingers and smell them. If you get a really strong piney smell then it's good stuff, if you get it but it's not powerful then you'll want to add more. For strong rosemary in a large pot of vegetable stew I would add a single finger length sprig to start, with weaker rosemary I'd add double that. I prefer to add fresh rosemary closer to the end of cooking; the longer it cooks the more the dish loses some of the more aromatic qualities.
If you are finding fresh rosemary to be hard to find, it is one of the easiest things to grow. It's hardy and can tolerate a wide variety of conditions, and is fine in a pot.
Comment: fried or fresh? did you mean dried?
Comment: I agree, rosemary is strong and its taste lasts. I usually put half amount of it than thyme when I use both, to give an idea. Mine is fresh from the garden an rather strong so I would advise to start with a half spoon instead of a spoon. You can always add later.
Comment: @jackwise I think it was meant dried yes, only a fool would fry rosemary, poor child :P
Comment: I have had fried rosemary, it's actually pretty tasty @Kaddath, but I definitely meant dried. I didn't proofread my post and it shows!
Comment: @Kaddath apparently fried herbs are sometimes used as a topping/garnish or to add some crunch+flavor. But in the above answer, definitely was supposed to be "dried"
Comment: What do you think to the idea of putting a rosemary sprig into a muslin pouch or something in the soup? Like a rosemary teabag almost? That way, the leaves are kept from going in the soup, but the flavor can still ooh la la. I have never tried this.
Answer: The amount depends on how much of the other ingredients you are using, and also on your taste.
If you have no guidance from the recipe you are following, you could start with a pinch and check how it tastes like. In case it's too mild/weak for you, add more.
Adding more is usually easier than removing. Source: I have had twice a pizza ruined because of an excessive amount of oregano, which made the entire thing bitter and unpalatable.
Comment: I use home-grown, and starting with a pinch finely chopped works well.  Rosemary is easy to add later, like many herbs but unlike many spices
Answer: I don't think there's an quantifiable answer to this but there a couple of things you can use to get a starting point.
First, how strongly do you want the soup (or any dish) to taste of rosemary?  If you want a punchy rosemary and garlic soup, you'll want to add more rosemary than you would if you're just adding a background flavour.
Second, how strong is your rosemary?  You perhaps want to add less of the rosemary that you picked fresh from your garden than you do of the slightly sad looking bunch you found in the fridge.
A big thing to remember is "you can always add more but you can't take it out".  This applies to any seasoning really.  Start with less than you think you need and work upwards
Answer: A couple of points:
Aromatic herbs are "driven out" by simmering. That's why a good soup cannot be made by following a recipe: the herbal flavor depends on both the amount of herb and how long the pot has been simmering. In restaurant kitchens, the soup's herbs are constantly adjusted as the evening progresses. Rule: taste it. If it needs more, it needs more. Taste it.
Start slow and add more. Your taste buds get acclimatized by over-frequent tasting. If you find you have added too much, let the pot simmer to dissipate the flavor. Aromatic herbs are smelled, not tasted by the tongue. They evaporate from hot food and thereby become weaker with cooking time
Second, the flavor of herbs varies with the season and the origin. I worked in a craft gin distillery. Juniper is harvested in different parts of the world in different seasons, with different flavor profiles. The recipe needed to be adjusted continually.
Bottom line:
Taste it.
Answer: This may be the best but also worst answer.
Often, I notice a lot of home cooks tend to be scared of adding too much seasoning. Salt is a different beast, but here, we're not talking about salt, we're talking about herbs. And, the aversion to adding too much, in my humble opinion, actually is a weakness that leaves food bland and cooks unrewarded for their efforts by a tasty final product. But, in any case, yes, there is too much, but there is also too little.
Let's move on the solutions.
So one solution: Try dried herbs. Its hard to go overboard with dried herbs, such as dried rosemary flakes. So, one possible solution is to try dried rosemary flakes first.
Second solution: Dry or fresh, sprinkle enough to generously cover the surface but not blanket the surface, so that when you stir it in, it "looks right". Not so much that its "rosemary soup" but a little here and a little there. Its hard to explain but that should be a reasonable explanation as a rule of thumb. Then, simmer for a little while, and then you taste. If its not potent enough, add more sparingly, stir, simmer for a few minutes, and taste again.
Hope this helps!
Answer: Here is my way of finding the right seasoning...
Cook two pots. The big one, season it moderately . The small one, excede in the seasoning.
Try them both when they are done. If the moderate one lacks a bit of taste, then add little by little from the small one.
Once you know better your herbs and your taste, you will be able to season your food right from the start!
Comment: So what would the asker do with the leftovers from the over-seasoned batch? That sounds like a very wasteful way to adjust the seasoning?

Amount of fresh rosemary


Accidentaly deleted partition table for windows OS

Question: I accidentally deleted the partition table under Windows through Magic Parted, so I installed Ubuntu on the first 40GB of my hard drive (which I think consist only of windows system files). Is there a way I recover the data on the rest of the hard drive? The drive was formatted, but not thoroughly (no null bytes overwriting), so the data should still be there. Any help is greatly appreciated. Thanks!
Answer: You are likely to have lost a lot of files because you have overwritten much of the drive (40Gig is a lot).
First you'll need to create a partition on the rest of the device, but don't put a file system on it. This is easily done in the "Disks" utility.
Then do the following to see a list of files you can recover:
sudo ntfsundelete <device>

Then use things like the following to recover all jpgs:
sudo ntfsundelete <device> -u -m *.jpg

or the following to retrieve a file by inode (the first column in the output of the first command):
sudo ntfsundelete <device> -u -i 99999

Note I haven't tested this as I don't have such data to retrieve.
Answer: I've had to recover files from inaccessible partitions, or that have been deleted, on a number of occasions and have always found Testdisk and Photorec to be invaluable and reliable. This is the main website for them http://www.cgsecurity.org/wiki/TestDisk but I installed using the Software Centre. The interface is text-based and keyboard driven but the documentation is very good and gives a practical example you can follow through for your own disk. I'd be pretty hopeful of recovering files from the unused part of the disk with Testdisk and would also think it worth trying to recover files from the overwritten part of the disk with Photorec (despite its name it won't just recover photos, though it was developed for that). Good luck!


Is configuring FEC mandatory in designing 100G networks? What's the difference FEC makes with DACs vs optics?

Question: I have read a lot of information online but I am still not sure when do we exactly configure FEC and what are the advantages/disadvantages of configuring it. Does DAC transceivers always need FEC to be configured or optics always need them or both? How do you decide when to configure them when not to?
Comment: Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer.
Answer: FEC is mandatory for some -R PHYs and optional for others. IEEE 802.3 Clause 74.1 sums it up quite nicely - FEC is used to reduce the bit error rate (BER) below 10-12 where needed. FEC is optional for ten-lane 100GBASE-R PHYs.
Clause 91 defines an alternative, transcoding (reed-solomon) RS-FEC. RS-FEC is mandatory for four-lane and two-lane 100GBASE-R variants. The ~25 GBd symbol rate, especially in combination with PAM4 line code (for -R2), would raise the BER far above the usual limit. For 100GBASE-SR2 and -CR2, RS-FEC guarantees a BER below 9.2×10-13 with a PMA BER of just 2.4×10-4 or better.
Normally, a switch should know when FEC is mandatory or when it can be optionally configured.
Both FEC variants significantly decrease the BER but increase latency (~50-100 ns), depending on the exact hardware.


How to boot my PC to Windows 10 after installing Ubuntu to an External HD?

Question: I've installed Ubuntu 12.04 to an external Hard Drive, planning on having Dual Boot on my laptop - which runs Windows 10. I have successfully configured the Dual Boot to have Windows as default, ran boot repair and everything, but whenever I don't have my external HD plugged in, I get the GRUB "MINIMAL BASH LIKE LINE EDITING IS SUPPORTED"  black screen. I would like to be able to use my computer even without the external HD. One more detail: I selected the external HD as the device for boot loader installation, which might have caused the problem.
Answer: I agree with you as to the cause, it looks like you've installed the bootloader on your external HDD, so when you turn the PC on its looking for that GRUB install to work out what to do. Naturally, if it's not plugged in the PC doesn't know what boot options to give you.
Seeing as your installation is still working fine, I'd suggest plugging the external back in, booting into Ubuntu and using Boot-Repair to put the bootloader back on your internal drive. Have a read of the following for info on how to use it and what it's for:
https://help.ubuntu.com/community/Boot-Repair
Comment: Thank you for your answer. I didn't find a way to move the bootloader using boot-repair, so I installed grub to my original internal hd (`sudo grub-install /dev/sda`) , but I still get the same result. It seems my PC only boots (or mounts, I don't really know) from the external HD.


What are the applications of continued fractions?

Question: What is the most motivating way to introduce continued fractions? Are there any real life applications of continued fractions?
Comment: My junior high math teacher (R.I.P., Heikki, I owe you much) wanted to keep me occupied, and gave me the summer assignment to find the rational number $m/n$, $0<n<10000$ closest to $\pi$.
Comment: Convergents of simple continued fractions give you best rational approximations. You can use the simple continued fraction of $\sqrt{d}$ to solve Pell's equation $x^2 - dy^2 = \pm 1$. Also, you can prove that $\pi$ and $e$ are irrational. The RSA application Alexander Gruber is thinking about might be this one: http://en.wikipedia.org/wiki/Shor's_algorithm (step 5 in "Quantum part")
Comment: Closely connected to https://mathoverflow.net/questions/49866/applications-of-finite-continued-fractions and https://mathoverflow.net/questions/49930/applications-of-periodic-continued-fractions
Answer: One very nice elementary application is Gosper's batting average problem: if a baseball player's (3-digit rounded) batting average is $.334$, what's the smallest number of at-bats that player could have?  (Batting average is computed as (number of hits)/(at-bats).)
The solution proceeds by noting that a rounded average of $.334$ corresponds to an actual number in the range $[.3335, .3345)$; finding the continued fractions for these values yields $.3335 = 667/2000 = [0; 2, 1, 666]$ and $.3345 = 669/2000 = [0; 2, 1, 94, 1, 1, 3]$.  This implies that the 'simplest' number within the range is $[0; 2, 1, 95] = \frac{96}{287}\approx 0.334495$.
Comment: @AshwinPandey I believe there is, but to a certain extent it's folklore. The arguments I'm familiar with go through Farey sequences; you might have a look at https://www.youtube.com/watch?v=uFWJuZQLKJs (though I'm not sure whether that has a proper proof or not).
Comment: How do we know that continued fractions will give the simplest rational representation within a range as opposed to, say converting to equivalent fractions and then finding the fraction in between. Is there a generalised proof for this?
Comment: Amazing video. That 2d perspective of rational numbers really did work and I kinda get it now, how continued fractions give us a better "nearest rational" picture of an arbitrary decimal expansion. Thanks for sharing.
Answer: Since no one mention it, I think it's really pleasant knowing that every rational tangle correspond to some continued fraction(Conway showed that).
:

For further information see:

An Enumeration of Knots and Links, and Some of Their Algebraic Properties by Conway
Another proof  On the classification of rational tangles

Here is good expository article:

The Power of Mathematics by Conway
Conway's Rational Tangles, a good educational article

Note:Image source: http://rationaltangle.wordpress.com/what-are-tanglesrational-tangles/
Answer: Here are some properties/uses that might be used to motivate an investigation of Continued Fractions:

Surprisingly good rational approximations to real numbers
Finite for rational numbers and repeating for quadratic algebraic numbers
Used to solve linear Diophantine equations
Used to solve Pell-type equations

Continued fractions are extremely good rational approximations to real numbers. If $\frac pq$ is a continued fraction approximation for the real number $r$, we have
$$
\left|\,\frac pq-r\,\right|\le\frac1{q^2}\tag{1}
$$
Furthermore, if we have
$$
\left|\,\frac pq-r\,\right|\le\frac1{2q^2}\tag{2}
$$
then $\frac pq$ is a continued fraction approximation for $r$.
In this manner, continued fractions offer the best rational approximations to real numbers.

The continued fraction for a real number $r$ terminates if and only if $r$ is rational. Furthermore, the continued fraction for a real number $r$ is periodic if and only if $r$ is not rational and $ar^2+br+c=0$ where $a,b,c\in\mathbb{Z}$ are not all $0$.

Successive convergents, $\frac{p_j}{q_j}$ and $\frac{p_{j+1}}{q_{j+1}}$ of a continued fraction have the property
$$
p_jq_{j+1}-q_jp_{j+1}=(-1)^j\tag{3}
$$
Note that $(3)$ implies
$$
\frac{p_j}{q_j}-\frac{p_{j+1}}{q_{j+1}}=\frac{(-1)^j}{q_jq_{j+1}}\tag{4}
$$
Thus, successive convergents alternate above and below their limit. $(4)$ shows why $(1)$ is true.
Given $a,b\in\mathbb{Z}$ relatively prime, $(3)$ is very useful in solving the Diophantine equation
$$
ax+by=1\tag{5}
$$
For example, we can solve $23x+17y=1$ by computing the continued fraction for $\frac{23}{17}$:
$$
\frac{23}{17}=1+\cfrac1{2+\cfrac1{1+\cfrac1{5}}}\tag{6}
$$
The next to last convergent is $\frac43$:
$$
\frac43=1+\cfrac1{2+\cfrac1{1}}\tag{7}
$$
thus, $(3)$ says
$$
4\cdot17-3\cdot23=-1\tag{8}
$$
Therefore, we have the solution
$$
3\cdot23-4\cdot17=1\tag{9}
$$

The accuracy of Continued Fraction approximations allow the solution of Pell's equation. For example, consider the continued fraction for $\sqrt3$:
$$
\sqrt3=(1,1,2,1,2,\overbrace{1,2,}^{\text{repeats}}\dots)\tag{10}
$$
Since $\left|\frac pq-\sqrt3\right|\le\frac1{q^2}$, we have
$$
\begin{align}
\left|p^2-3q^2\right|
&=\left|p-q\sqrt3\right|(p+q\sqrt3)\\
&\lesssim\frac1q\cdot2q\sqrt3\\
&=2\sqrt3\tag{11}
\end{align}
$$
Thus, no matter how big $p$ and $q$ get, $p^2-3q^2$ is bounded; in fact, it is periodic. The sequence of convergents for $(10)$ is
$$
\frac11,\color{#C00000}{\frac21},\frac53,\color{#C00000}{\frac74},\frac{19}{11},\color{#C00000}{\frac{26}{15}},\frac{71}{41},\dots\tag{12}
$$
and the sequence of $p^2-3q^2$ is
$$
-2,\color{#C00000}{1},-2,\color{#C00000}{1},-2,\color{#C00000}{1},-2,\dots\tag{13}
$$
Thus, the convergents in red give solutions for the Pell equation $p^2-3q^2=1$.
Answer: There is this interesting article about the application of continued fractions in Phyllotaxis, the research on leaves, which I found pretty interesting. Maybe you can find more over google?
${}{}{}{}{}{}$
Comment: Why the downvote? I think I helped the OP?!
Comment: Oh hey, sorry, I think that was me.  I misclicked while trying to upvote. :)  It is fixed.
Comment: Haha, thanks for the clearing :-)
Answer: There are at least three integer factorization algorithms based (one way or other) on properties of continued fractions. The one by Lehman is a fairly elementary (but delightfully clever) deterministic method.

Shanks
Brillhart and Morrison
Lehman
Answer: These may not be the best ways to motivate continued fractions, but here are some applications.
There is a well-known method for "encoding" a geodesic on the modular surface via continued fractions by looking at the continued fraction expansions of the "endpoints" of the geodesic on the real line.  Studying the continued fraction associated to a geodesic is one way of understanding how the geodesic "winds around" the surface.  For example, if the continued fractions are periodic, then the geodesic will be periodic (a closed loop) as well.  If the sequences of integers appearing in the continued fraction expansion contain all finite sequences of integers, then the geodesic is dense.  To my knowledge the first time this is used is in an old paper of Emil Artin, Ein mechanisches System mit quadiergodischen Bahnen. This idea is expanded upon and clarified in a series of papers by Caroline Series.  See, for instance, Non-Euclidean geometry, continued fractions, and ergodic theory.
More recently, continued fractions have come up in studying the dynamics of flows on translation surfaces -- a special case of which is studying billiards in a rational polygon.  For example, continued fractions and Diophantine approximations make an appearance in studying billiards in the wind-tree.  That is, imagine taking the plane and placing identical rectangular obstacles centered at each integer lattice point.  Now consider an ideal point-mass which bounces between the obstacles, reflecting off the obstacles according to the rule from geometric optics that angle of incidence equals angle of reflection.  Studying the motion of that billiard (e.g., are there periodic orbits, dense orbits, escaping orbits, recurrent orbits, etc.) can, at least in some special cases, boil down to studying continued fractions.  See The Ehrenfest wind-tree model: periodic directions, recurrence, diffusion by Hubert, Leliévre, Troubetzkoy and Divergent directions in some periodic wind-tree models by Delecroix.
Again, those probably aren't the best ways to motivate continued fractions if you're seeing them for the first time, but they do have plenty of applications.
Answer: Application #1: The first proof that $e$ is irrational, due to Euler, was based on showing its continued fraction expansion is infinite: $e = [2,1,2,1,1,4,1,1,6,1,1,8,1,1,10,...]$ with the obvious repeating pattern of even numbers separated by two $1$'s.
Application #2: A year consists of $365.24219$ days. If we want to create a calendar with a block of $Y$ years containing $L$ leap years, then $Y$ years will contain $365Y+L$ days. The average number of days in a year of each block is $(365Y+L)/Y = 365 + L/Y$, so we want $L/Y$ to be a good rational approximation to $.24219$, whose continued fraction expansion is $[0,4,7,1,3,24,6,2,2]$. The first six continued fraction convergents are $0$, $1/4$, $7/29$, $8/33$, $31/128$, and $752/3105$. The convergent $1/4$ leads to the Julian calendar having $1$ leap year every $4$ years. The choice $L/Y = 8/33$ is used in Iran: $8$ leap years in a block of $33$ years is part of the Jalil calendar proposed by Omar Khayyam in the year $1079$. If we look at intermediate convergents between $31/128$ and $752/3105$, which by definition are fractions $(31a + 8)/(128a+33)$ for $a = 1,2,\dots,23$, then at $a = 6$ we get $194/801$, and $801$ is nearly $800$, a nice round $8$ centuries. So let's modify this a little to consider $194/800 = 97/400$: this is the Gregorian calendar, which has $97$ leap years every $400$ years, that is a leap year every $4$th year except for years divisible by $100$ but not by $400$ (a total of $100 - 3 = 97$ leap years).
Application #3: As spin wrote in a comment, being able to make a good guess for the value of a rational number when you know only some approximation to it (even if the approximation is itself rational!) is a key part of Shor's algorithm for factoring integers on a quantum computer. Guessing rational numbers from numerical approximations is also important in doing computations related to elliptic curves, as William Stein explained to me: if an elliptic curve $E$ is defined over $\mathbf Q$ and you use complex analysis to compute a coefficient of a Weierstrass equation for $E$, or to compute $L(E,1)/\Omega$, all you get is a decimal estimate for a number that is supposed to be rational and you want to decide what that rational number ought to be (which might then be rigorously proved by other methods). Typically the decimal approximation of the rational number may have far fewer digits than the full period length, so you can't guess the fraction as simply as you can if someone asks you what fraction $.333333333$ probably is (namely $1/3$).
Here is an example of how continued fractions let you guess rational numbers from decimal expansions, which I did as a trick at the end of a talk I gave today on continued fractions. I asked a student in the audience to compute a fraction as a decimal on a calculator and tell me what digits showed up on the calculator, but make sure there was no obviously periodic part shown by the calculator and not to tell me the original fraction and make sure to write down the original fraction for comparison with my guess later. The student gave me $.1391200951$. Using a computer algebra package, I converted $.1391200951$ into a continued fraction: it is $[0,7,5,3,6,1,56891,1,103,2]$. The $56891$ is so huge compared to what comes before that my educated guess for the student's original fraction is $[0,7,5,3,6,1]$, which is $117/841$. That indeed was the number the student  wrote down earlier. The audience was impressed. The actual decimal period of $117/841$ is $812$, so I was able to figure out a fraction having a repeating decimal period length over $800$ knowing only the first $10$ digits of its decimal expansion.
Answer: There are many beautiful theorems about continued fractions. For example, a real number is rational if and only if its continued fraction expansion is finite (however, this is not the case for decimal system, since $\frac{1}{3}=0.3\cdots$ is infinite and rational). Also, continued fraction is the best possible rational approximation to any given irrational number. Hence it can be used to approximate irrationals (for example, $\pi$).
For other applications, one can use continued fraction to solve the Pell's equation or to generate a chaotic process (by the Gaussian map: $x_{n+1}=\frac{1}{x_n}-\lfloor{\frac{1}{x_n}}\rfloor$).
You may want to read the chapter in continued fractions in Hardy & Wright's book An Introduction to the Theory of Numbers. Or you can also read a short article titled Chaos in Numberland: The secret life of continued fractions by John Barrow.
Answer: Two ideas which could be useful for you:

$1$. Proposal: Combine continued fractions with the concepts of golden ratio and fibonacci numbers

I think starting with the simplest continued fraction

$$\Phi=\frac{1}{1+\frac{1}{1+\frac{1}{1+\cdots}}}=[1,1,1,\dots]$$

offers charming possibilities. With this prototype you can bring together continued fractions with the golden ratio and with the fibonacci sequence as fundamental and beautiful concepts.

Fibonacci Sequence and continued fractions: Let $(F_n)_{n\geq0}$ the Fibonacci sequence, then

$$\Phi=\lim_{n\rightarrow\infty}\frac{F_n}{F_{n-1}}=[1,1,1,\dots]$$

Golden ratio and continued fractions:

$$\Phi=\frac{1+\sqrt{5}}{2}=[1,1,1,\dots]$$
You could talk about the mystic pentagram, detect the golden ratio between successive length and diagonals of inscribed pentagrams and reveal the representation of $\Phi$ as continued fraction. You could also talk about golden rectangles and their applications by artists and architects like Le Corbusier and Dali or the classic Parthenon with its many geometric relations resulting seemingly in golden ratios.
I do appreciate the  hint from BIS HD. Phyllotaxis as form of evolutionary development which has optimized the positions of the seeds of sunflowers, daisies or pine cones using spirals is a great example how simple and fundamental concepts $[1,1,1,\dots]$ iteratively applied are behind seemingly complex structures of nature. And, counting the number of seeds of successive spirals will give you successive Fibonacci numbers!

$2.$ Proposal: Use continued fractions and lattice paths as picturesque concept

I think, that lattice paths are a fine, picturesque example of an application of continued fractions.  Lattice paths are structures we can see and we can look what happens, when they are manipulated.
Here I would like to point to a wonderful presentation of continued fractions
summarizing the contribution to this subject of the great Flajolet and also providing some historical aspects. For me this is a superb (and funny!) example to familiarize the audience with continued fractions.
At least the first part of this presentation could also be useful for your needs. On  page $149$   you   will find a reference to  a (rather  complex) real life application in theoretical physics Planar maps and continued fractions from J. Bouttier and E. Guitter.
Here is an article Combinatorial aspects of continued fractions from Flajolet containing lattice pathes and maybe you could also find some motivating material in the survey Continued fractions from Euclid to the present day.
Comment: perhaps a typo: $\phi=\frac{1+\sqrt5}2$
Comment: @robjohn: Oh, yes. Many thanks for pointing at it. Typo corrected.
Answer: Musical notes follow a geometric sequence, for their frequency $f_n$ relative to a base frequency $f_0$ :
$$f_n = f_0 \times \left(\sqrt[12]{2}\right)^n$$
For example, an A note has defined frequency 440 Hz, so a note 5 chromatic steps above it (D note) is $$f_5 = 440 \sqrt[12]{2}^5 = 440 \times 1.3348...$$
But a musician will often want to play a notes that are small ratios of each other  because it sounds better.  So what are the best rational approximations for $2^{5/12}$ ?  Look at the continued fraction:
$$2^{5/12} = [1; 2, 1, 73, ...] \approx \left\{1, \frac 43, \frac 75 \frac{299}{244}, ...  \right\}$$
So we can see that the musician is probably playing a $\frac 43$ ratio.  It was obvious for this interval but you can try other intervals.
Answer: This article by Carlo Sanna, based on lectures by Michel Waldschmidt in the Proceedings of the Roman Number Theory Association contains common applications of continued fractions, some of which can be used as motivation.


Options flow? Is it worth it?

Question: How do you effectively use options flow to make better trading decisions?
Answer: I've never gleaned much of anything from option flow but that doesn't mean that there isn't something there.
What I would offer is that there are other things that have to be considered.  For example, if there's a very large buy at one strike, look for a same size sell at another strike.  That indicates a spread and is less likely to be a strategy in advance of some pending news.
Also, you have no idea what the directional bent is if a large purchase occurs.  For example, if someone buys 100 calls, are they bullish? Or could that 100 call purchase be a hedge for 10,000 short shares (bearish)?  Or could it be a delta neutral hedge for 50 calls with twice the delta (neutral)?
If there's clear and consistent volume and increase in Open Interest then it's more likely to be in advance of news. And not that I lend any credence to it but the put-call ratio indicator assumes that most investors are wrong. So who do you believe?
If you can effectively use options flow to make better trading decisions then it's worth the effort.  Otherwise, not so much.

Options flow? Is it worth it?


Importance of cohesive consistency of product, support and service experience

Question: When designing and developing a user experience, how much weight should be given to matching its qualities with those of existing products, support and service from the same organisation?
Answer: There are many aspects to this question, and the answer will depend on specific of your project. However, here are some things to consider:

Will the user ever interact with any of your other products? A company might have multiple products targeted to very different users and those users might never be aware of the existence of the other tools. In this case, I would argue that it's ok if the ux varies and is optimized to each of the user's needs. However, if you have multiple products used by the same user (e.g. Word, Powerpoint, Excel, etc) they should all follow a similar ux and behavior. Otherwise your user will get frustrated learning new skills for every product of yours. Think of the last frustration you had when a feature in Word did not behave the same in Excel, or a behavior in Photoshop vs Illustrator.
How important is branding? If both products are completely different, you want to at least keep some branding (logo) and color use resemblance between them. Just as a courtesy to your user for them to recognize your product and relate your brand values to the capabilities of this new product. It adds a layer of familiarity and comfort using a new product made by the company responsible for a product I used before.
Support and service are critical. Support and service exist at a company level, not at a product level. Support for Photoshop should not be different from Illustrator. The user expects the same level of care for both, since speaking to a Support agent is interpreted as speaking to the company. Therefore, Support and Service should be consistent because the company portrays a consistent mannerism.
Comment: Interesting that you mention Adobe and user support. Have you ever spoken to them? I have. It was illuminating. They called it a "support service". If pushed, I might suggest they have a different dictionary, one that I'm not familiar with.
Comment: I've just dealt with Autodesk. It's not worse. But not much better.
Comment: In which aspects?
Comment: All of them. Except Autodesk's software still contains some joy for the user. Adobe's never did. With the possible exception of some parts of After Effects. The less said about how they treated Fireworks, Freehand and Flash, the better.


Crypto puzzles on Crypto.SE

Question: I wrote a cryptanalysis puzzle.  It's pretty hard but pretty fun (in my opinion), and I'm wondering if people out there might be able to solve it.  But is such a thing appropriate for this Q&A site?  I'm worried it's not, so thought I'd ask here first.
Answer: No.
That is if your puzzle revolves around you coming up with some ciphertext and maybe some hints or something and want us to recover the key / the plaintext then this would be off-topic as

Requests for analyzing ciphertext or reviewing full cryptographic
  designs are off-topic, as the results are rarely useful to anyone else
  and/or would be too long for this site.

and would be closed pretty quickly.
Of course there is Puzzling.SE which seems to accept just about any kind of puzzle, but be sure to read a bit on their on-topic page and also have a read of their specific policy on crypto-puzzles.
Comment: No, it doesn't involve a ciphertext-only attack of some obscure homebrew cipher.  But still it's probably not within the bounds of what we do here... I'll refrain. Cheers.
Comment: Maybe also link to the related https://crypto.meta.stackexchange.com/questions/788/how-to-get-eyes-on-a-specific-cryptanalysis-puzzle ? ;)

Crypto puzzles on Crypto.SE


How to get $\vec{B}$ from $\vec{H}$ in hyperspatial ($n>3$) electromagnetism?

Question: So I'm currently trying to formulate Maxwell's equations in dimensions in other than 3 in order to improve my understanding of electromagnetism. In 3D, Maxwell's equations can be described by
$$\begin{matrix}\nabla\cdot\vec{D}=\rho&\nabla\times\vec{E}=-\left(\frac{\partial\vec{B}}{\partial t}\right)\\\nabla\cdot\vec{B}=0&\nabla\times\vec{H}=\left(\frac{\partial\vec{D}}{\partial t}\right)+\vec{J}\\\end{matrix}$$
According to my calculations, in other dimensions Maxwell's equations are
$$\begin{matrix}\begin{matrix}\nabla\cdot\vec{D}=\rho&\nabla\vec{E}-\left(\nabla\vec{E}\right)^T=-\left(\frac{\partial\widetilde{B}}{\partial t}\right)\\\end{matrix}\\\nabla\cdot\widetilde{H}=\left(\frac{\partial\vec{D}}{\partial t}\right)+\vec{J}\\\end{matrix}$$
Where the magnetic fields $\widetilde{B}$ and $\widetilde{H}$ are both tensor fields which are skew symmetric and are related to their typical representations in 3D by
$$\begin{matrix}\widetilde{B}=\left[\begin{matrix}0&-B_z&B_y\\B_z&0&-B_x\\-B_y&B_x&0\\\end{matrix}\right]&\widetilde{H}=\left[\begin{matrix}0&-H_z&H_y\\H_z&0&-H_x\\-H_y&H_x&0\\\end{matrix}\right]\\\end{matrix}$$
$$Tensor\ Divergence:\ \nabla\cdot\widetilde{A}=\left[\begin{matrix}\left(\frac{\partial A_{11}}{\partial x}\right)+\left(\frac{\partial A_{21}}{\partial y}\right)+\left(\frac{\partial A_{31}}{\partial z}\right)\\\left(\frac{\partial A_{12}}{\partial x}\right)+\left(\frac{\partial A_{22}}{\partial y}\right)+\left(\frac{\partial A_{32}}{\partial z}\right)\\\left(\frac{\partial A_{13}}{\partial x}\right)+\left(\frac{\partial A_{23}}{\partial y}\right)+\left(\frac{\partial A_{33}}{\partial z}\right)\\\end{matrix}\right]$$
$$Vector\ Gradient:\ \nabla\vec{A}=\left[\begin{matrix}\left(\frac{\partial A_x}{\partial x}\right)&\left(\frac{\partial A_x}{\partial y}\right)&\left(\frac{\partial A_x}{\partial z}\right)\\\left(\frac{\partial A_y}{\partial x}\right)&\left(\frac{\partial A_y}{\partial y}\right)&\left(\frac{\partial A_y}{\partial z}\right)\\\left(\frac{\partial A_z}{\partial x}\right)&\left(\frac{\partial A_z}{\partial y}\right)&\left(\frac{\partial A_z}{\partial z}\right)\\\end{matrix}\right]$$
So in n-dimensions, the magnetic field has $\frac{n^2-n}{2}$ components. In 3D, the Lorentz force density is
$$\vec{F}=\rho\vec{E}-\vec{B}\times\vec{J}$$
Whereas the multidimensional variant is
$$\vec{F}=\rho\vec{E}-\widetilde{B}\vec{J}=\rho\vec{E}-\left[\begin{matrix}0&-B_z&B_y\\B_z&0&-B_x\\-B_y&B_x&0\\\end{matrix}\right]\left[\begin{matrix}J_x\\J_y\\J_z\\\end{matrix}\right]$$
$\vec{D}=\widetilde{\varepsilon}\vec{E}$ still holds but the same isn't true for $\vec{B}=\widetilde{\mu}\vec{H}$. As you can see,
$$\widetilde{B}=\left[\begin{matrix}0&-B_z&B_y\\B_z&0&-B_x\\-B_y&B_x&0\\\end{matrix}\right]=\left[\begin{matrix}0&-\left(\mu_{xz}H_x+\mu_{yz}H_y+\mu_{zz}H_z\right)&\mu_{xy}H_x+\mu_{yy}H_y+\mu_{yz}H_z\\\mu_{xz}H_x+\mu_{yz}H_y+\mu_{zz}H_z&0&-\left(\mu_{xx}H_x+\mu_{xy}H_y+\mu_{xz}H_z\right)\\-\left(\mu_{xy}H_x+\mu_{yy}H_y+\mu_{yz}H_z\right)&\mu_{xx}H_x+\mu_{xy}H_y+\mu_{xz}H_z&0\\\end{matrix}\right]=\widetilde{?}\left[\begin{matrix}0&-H_z&H_y\\H_z&0&-H_x\\-H_y&H_x&0\\\end{matrix}\right]$$
we can't get the 3D results from mere matrix multiplication. Some other relation is required. I haven't been able to figure it out yet and resources on this are exceedingly scarce. Since the magnetic field in 2D is a scalar, I think the magnetic permeability in 2D may also be a scalar. In 3D, the magnetic permeability has 6 components. I can't really see a pattern here and I somewhat doubt the magnetic permeability may actually be a tensor. Any help finding a general formula for getting $\vec{B}$ from $\vec{H}$ is appreciated.
Comment: Possible duplicates: https://physics.stackexchange.com/q/21678/2451 , https://physics.stackexchange.com/q/196153/2451 and links therein.
Comment: @Qmechanic None of those touch on the conversion of $\vec{H}$ to $\vec{B}$ though. They are similar in spirit though. I just want to have the proper equations for anisotropic cases.
Answer: You already have $\tilde B_{ij} = \epsilon_{ijk}B^k \iff B^k = \frac{1}{2}\epsilon^{ijk}\tilde B_{ij}$ and similarly for $H$ and $\tilde H$.  If the pseudovector components are related via $B^i = \mu^i_{\ \ j} H^j$,  then the tensor components are related via
$$\tilde B_{ij} = \epsilon_{ijk} B^k = \epsilon_{ijk} \mu^k_{\ \ \ell} H^\ell = \frac{1}{2}\epsilon_{ijk} \mu^k_{\ \ \ell} \epsilon^{\ell m n} \tilde H_{mn}$$
$$\implies B_{ij} = \tilde \mu_{ij}^{\ \ mn} H_{mn}$$
where
$$\tilde \mu_{ij}^{\ \ mn}\equiv \frac{1}{2}\epsilon_{ijk} \mu^k_{\ \ \ell} \epsilon^{\ell m n}$$
Note that $\tilde \mu$ is antisymmetric in each pair of indices, and therefore has nine independent components - just as one would expect, since $\mu$ is a generic $3\times 3$ matrix.  Generalizing to $n$-dimensions, $\tilde \mu$ would have $d^2(d-1)^2/4$ independent components, and would express a general proportional relationship between two $(0,2)$-tensor fields.
It's also important to note that the $B\leftrightarrow \tilde B$ correspondence only holds in $3$ dimensions; in higher (resp. lower) dimensions, the magnetic field $\tilde B$ has too many (resp. too few) components to be represented as a (pseudo)vector.  In the same way, the correspondence between the $(2,2)$-tensor $\tilde \mu$ and a $(1,1)$-tensor $\mu$ is also a feature of $3$ dimensions only.  The magnetic field is really a $(0,2)$-tensor $\tilde B$ which can be associated to a pseudovector $B$ in the special case that $d=3$; similarly the magnetic susceptibility is really a $(2,2)$-tensor $\tilde \mu$ which can be associated to a $(1,1)$-tensor $\mu$ only when $d=3$.

To further clarify the summation convention, consider the following example.  The component $\tilde \mu_{12}^{\ \ \ 12}$ is
$$\tilde \mu_{12}^{\ \ \ 12} = \sum_{\ell=1}^3 \sum_{k=1}^3\frac{1}{2}\epsilon_{12k} \mu^k_{\ \ \ell} \epsilon^{\ell 12}$$
Since $\epsilon$ is completely antisymmetric, there is only one nonzero term, namely $k=3$ (otherwise $\epsilon_{12k}=0$) and $\ell=3$ (otherwise $\epsilon^{\ell 12}=0$).  Therefore,
$$\tilde \mu_{12}^{\ \ \ 12} = \frac{1}{2}\underbrace{\epsilon_{123}}_{=1} \ \mu^3_{\ \ 3}\  \underbrace{\epsilon^{312}}_{=1} = \frac{1}{2} \mu^3_{\ \ 3}$$
Comment: @Laff70 Knock yourself out.  I suspect you'll find, however, that Einstein summation is in universal use for good reason.  In its most general form, a linear relationship between two matrices **cannot** be expressed via multplication by a third matrix, in the following sense: If $B=\mu H$ (all matrices), then the elements of the first column of $B$ are linear combinations of the elements of the first column of $H$. In other words, if $\mu$ is merely a matrix, then the first column of $B$ can't "see" the third column of $H$.  If you want **each** element of $B$ to be a linear combination [...]
Comment: Is it possible you could rewrite your answer or add some clarification? I'm not well versed with the index raising and lowering notation. If you could rewrite it in a matrix multiplication form, explain how it works in more detail, or link to a sufficiently thorough explanation of it then that'd be great.Also, usually μ and H are multiplied together to get B but you seem to have done the opposite. If it works that's fine, I mainly needed the relation between them.From what I know about raising and lowering indices, it involves the Minkowski metric.Since the B tensor is 3x3, how does that work?
Comment: @Laff70 Whoops - you're right, it should be $B=\mu H$, so I've corrected that.  There is no index raising or lowering to be done in my answer- you can consider $\epsilon^{ijk}$ and $\epsilon_{ijk}$ to be exactly the same thing, or you could imagine that indices are raised/lowered with the kronecker delta $\delta_{ij}$.  The **summation** convention is that repeated indices are summed over.  I cannot write it in matrix form because $\tilde \mu$ and $\epsilon$ have four and three indices, respectively, and therefore cannot be represented as $2$-dimensional arrays of numbers.
Comment: @Laff70 I've updated my answer with an explicit example of how to compute the components of $\tilde \mu$.
Comment: It's worth noting that the "natural" analog of the Levi-Civita symbol in $n$-dimensional space has $n$ indices, not 3.  So while the statement that we should have $B_{ij} = \tilde \mu_{ij}^{\ \ mn} H_{mn}$ in all dimensions is true, your definition of it in terms of $\epsilon_{ijk}$ and a 2-tensor $\mu_{ij}$ and  really only works in 3 spatial dimensions.
Comment: @MichaelSeifert Yes, perhaps I did not make that sufficiently clear.  I have edited my answer to emphasize that point.
Comment: @J.Murray I'm going to keep experimenting with the notation to see if I can format things better. As you can tell by the formulas I used in my post, I prefer that particular compact notation as I feel it tells you how things work on a more fundamental level. I'm not a fan of Einstein summation. Also, given that everything else simplified so much, I'd be surprised if this part couldn't be described even simpler. I'll update you on my progress.
Comment: @Laff70 of **all** of the elements of $H$ - which is more general - then matrix multiplication doesn't work, and you need to contract $H$ with a rank-4 tensor $\tilde \mu_{ij}^{\ \ \ mn}$, which is a $3\times3\times3\times 3$ array of numbers.  There are various notations in use for such an operation, but picking a basis and employing Einstein summation over the relevant indices is by far the simplest, most compact, and most widely used.
Comment: @Laff70:  I agree for the most part with J. Murray's idea that it's better to make your peace with index notation.  But if you're dead-set on using a matrix-based representation, you may want to look into [linear elasticity theory](https://en.wikipedia.org/wiki/Hooke%27s_law#Linear_elasticity_theory_for_continuous_media).  There are some [well-established (if somewhat arbitrary) tricks](https://en.wikipedia.org/wiki/Voigt_notation) to write the stress and strain tensors as vectors and the elasticity tensor as a matrix connecting them.


Are webhooks needed in Gitlab for triggering a build on tags push

Question: I would like to trigger a Build on Gitlab when a Git Tag is pushed to the repository. At the same time I would like to increment the version number on a file located on the repository before building it on a runner.
My question is . Is it a webhook needed for the purpose ?
Answer: You don't need a webhook.
You can use the tags keyword with the only/except condition syntax for running jobs in a pipeline.
You then need to implement the job of course, which will do what you need:

take the new tag
update a file with it
commit the new file and push it back to the repo
... other builds steps ...


What do I do when OS X freezes?

Question: It happened to me twice recently. I was just using my iMac normally, like browsing the web, and it suddenly freezes. I can move the mouse, but I can't click on anything. Keyboard not functioning at all. I couldn't figure out what to do except for pressing the power button and reboot. What else can I do? Is there a way to diagnose and find out what is causing it?
Answer: A strategy to try when the freeze is actually happening is holding ⌘ Cmd and ⌥ Opt, then hitting ⎋ Escape.
If your keyboard input is still working, this should bring up the force-quit dialog (which can be navigated using the arrow keys and Enter).  This may allow you to close problematic applications without a hard shutdown using the ⌽ Power button.
Answer: Usual troubleshooting steps for similar cases are:

Clean system and user cache (slightly dangerous procedure if you don't know what you're doing) there is a program called CleanGenius that might help, but it's been severely limited due to the new sandboxing policies introduced with OS 10.7
repair Disk Permissions (easy, you can do it with Apple's Disk Utility, which is installed by default in the Utilities folder)
Reset PRAM (easy, you need to start up your computer keeping four keys pressed: command, option, P, R and release them AFTER you heard the startup chime TWICE)

Those steps should solve the problem.
Differential diagnosis would be checking the RAM for a defective bank and checking internet plugins (but in that case, I suppose not all the system would lock up, just the browser) and processes running in the background. But for this kind of diagnosis, I would suggest entrusting your Mac to a specialist.
Answer: Try cleaning the dust bunnies out of the video card. After months of making me crazy I think I tracked it down to dust blocking the heat sink channels on my video card. I was blaming my freezed on Flash, but I realize that was working my video card just hard enough it got hot and quit. Haven't had a freeze in days.

What do I do when OS X freezes?


How do I wire this 3 way switch?

Question:
I have this switch it goes 3 ways, I am a noob and just started learning about electronics. I have a small oled Display connected to my nodemcu which is displaying information. The middle switch is off right? So I want the middle switch to turn the display off, the left switch to show specific information and the right switch to make the display show other information. How exactly do I wire it?
Answer: I would call that a single pole, double throw (SPDT) center-off toggle switch.  Electrically, it looks like:

simulate this circuit – Schematic created using CircuitLab
To confuse newcomers, when the handle is to the left, the center terminal is connected to the right terminal, and when the handle is to the right, the center terminal is connected to the left terminal.
With the handle in the center position, there is no connection between any terminals.
suggested connection:

simulate this circuit
Comment: Ok thank you but which of the nodemcu's pins do I have to connect where on the switch?
Comment: I would connect the center terminal to Ground, and a 5 - 10K pull-up resistor from the left and right terminals to the positive supply.  The left and right terminals would also be connected to whatever digital input pins on the nodemcu you want to use as inputs.
Comment: So connecting the left to a data pin with a resistor and connecting the right to 3,3V with a resistor and connecting middle to gnd would work?
Comment: @Tanonic - see schematic in edited answer...
Answer: Your device has two switches inside, connected to three external terminals.
The center terminal is common to both switches, and the two ends are at the other ends of each of the switches.  When the toggle is in the center, both switches are open.  That means all three terminals are disconnected from each other.  When the toggle is to one side, the center will be connected to one of the two outer terminals.  When toggle is to the other side, the center will be connected to the other terminal.
The rest is up to you.  This device has three states it can be in.  You can certainly detect with of the three states.  What you do with that information is up to you, and it's not clear what exactly that is anyway.
Answer: Since the paddle is in the middle, I think that it is a 3 position switch (SP3T)(single pole tripple throw).
Here is a very rough diagram of the switch
The red slider moves when you tilt the paddle to either side and shorts out two of the blue contacts.
In center position, the slider does not touch either of the side contacts.
Comment: I'd still calll it an "SPDT center off".  "three position" means to me that there are three active positions - three possible paths through it.  This switch only has two active positions, plus "Off".

How do I wire this 3 way switch?


Can anybody please explain why is the probabilty of finding a desired message for random chaining values equal $2^{-224}$?

Question: Can someone explain why does probability is equal $2^{-224}$ in the following piece of paper?
The length of messages blocks in Hamsi is equal 32 and the length of chaining values is equal 256.
Answer: The second paragraph of section 2 of the quoted paper tells the domain of the function $\mathcal F:\{0,1\}^{32}\times\{0,1\}^{256}\to\{0,1\}^{256}$.
Under the reasonable assumption that for fixed second input ($h_{i-1}$ in the question's statement), $\mathcal F$ behaves as a random function of the first input ($M_i$ in the question's statement), then for each value of the first input the probability that the output matches a fixed target value ($h^*_i$ in the question's statement) is $p=2^{-256}$. That will be repeated for the $n=2^{32}$ possible first inputs.
One way to conclude is to know that if an event has probability $p$ of occurring at each (independent) experiment, then the expected number of events for $n$ experiments is $n\,p$, and the probability of at least one event is barely below that value $n\,p$ as long as it remains small. Here $p=2^{-256}$, $n=2^{32}$, $n\,p=2^{32-256}=2^{-224}$ (as asserted in the question's statement). That's very small, thus the approximation made is valid.
The more mathematical way: the probability of no match for one first input is $1-p$. The probability of no match after $n$ inputs is $(1-p)^n$. The probability of at least one match after $n$ inputs (as discussed in the question's statement) is $1-(1-p)^n$. Using that $1-(1-p)^n=1-e^{n\log(1-p)}$, that $\log(1-p)=-p+o(p)$ (using little-O notation), that $e^x=1+x+o(x)$, it comes that $1-(1-p)^n=n\,p+o(n\,p)$. Hence $1-(1-p)^n$ is about $n\,p$. The error made with this approximation is always by excess. When $n\,p<0.3$, the relative error is less than $16\%$. For lower values of $n\,p$, that upper bound of the relative error becomes barely above $n\,p/2$.
Other useful data points are that if $n$ is large, then $n\,p=1\implies1-(1-p)^n\gtrapprox1-e^{-1}\gtrapprox63\%$; and $n\,p=2\implies1-(1-p)^n\gtrapprox1-e^{-2}\gtrapprox86\%$ This explains the "high probability" after about $2^{224}$ random values of $h_{i-1}$ in the question's statement.
Comment: I didnt completely understood the last paragraph, but basically what you meant that the probability that the for one fixed input try you get a match is $2^{-256}$, and you have $2^{32}$ tries, so its $(2^{32})/(2^{256})$. Did i understand correctly?
Comment: @kirill. $(2^{32})/(2^{256})$ is an excellent approximation with the numbers at hand. I've now separated the approximation, and its rigorous derivation.


Can Force be measured directly?

Question: Most of the Force sensors I am aware off really measure deformation, not Force. Is Force merely a concept but not something we can really measure directly? Since Gravity is a consequence of spacetime and not a Force - could the same be true of all the other "Forces" we came to accept as "real"? Could electromagnetic forces be simply another tweak in spacetime? Or maybe spacetimecharge - or something more complex than spacetime?
Comment: You can always play this game. Technically, the sensor isn't even measuring deformation either; it contains a circuit that measures a resistance. But you can't "really" measure a resistance, you measure the current at a given voltage. But you can't "really" measure current, you measure the magnetic deflection of a current-carrying wire. And so on and so on.
Comment: It's an endless word game. If you keep playing it, you have to either conclude that nothing is real or that the game is meaningless.
Comment: Forces are simply our way of explaining and calculating interactions. They aren't even necessarily "real" things.
Comment: Thank you, makes sense. I am not a physicist so I was wondering whether there is more to it than simply being a concept that "works" well with the theories we use to explain and predict phenomena around us.
Answer: The 'deformation' you are talking about that the force sensors measure is actually due to the electromagnetic interactions between the action-reaction pairs which indeed is a force and at the microscopic level it involves exchange of photons in between the participating particles.
According to the standard model of particle physics all forces occur due to exchange of the force carrier particles called 'bosons'.Four fundamental forces of nature have been found yet and each was expected to occur via exchange of bosons.The electromagnetic force occurs due to exchange of photons.The weak force acts via gluons.The strong interactions are mediated by W and Z bosons and the gravitational force is expected to be caused by the elusive graviton.Macroscopically all the forces propagate in space-time via the "field" which is defined mathematically as mostly a vector field.It is the quanta(the smallest unit that carries the force) of these fields that are called bosons which leads to the occurrence of these forces hence the concept of forces is not merely hypothetical,it has a physical significance.The "force sensors" in general are the particle accelerators(such as the L.H.C.) which measure the forces implicitly from the energy changes in their interactions.The catch here is that all the force carriers for all the forces have been found in the L.H.C. except for the gravitational force hence the elusive graviton.This is because the gravitational force in those scales is the weakest of all forces which is causing a difficulty in detecting it. You'll be amazed to know that infact all the forces except gravity have been unified into a single field force via the "Unified Field Theory" and you can intuitively see why gravity hasn't been Incorporated in it yet.The physical significance of unification is that not long after the big bang only one force was dominant in nature and as the universe cooled down,symmetry broke and gave rise to the other forces that we see today.Unification is one of the most interesting and painstaking task that has been going on for decades now but hasn't been completely done yet and the biggest challenge is incorporating gravity in the theory.Alternatives such as loop quantum gravity,string theory and others have been suggested but known has been proved yet.String theory seems to be the most probable candidate for a "theory of everything" but for it to be true the universe has to have more dimensions than what meets our eyes.It's a really exciting time to be in the world right now more so for the physicists as anything can happen in the next few decades.
Comment: Kira, thank you - this is a lot of information to process, I will do some reading on the topics you mentioned.

Can Force be measured directly?


How to share/transfer an Atom installation (packages and settings) from one Mac to another?

Question: Is it possible to copy Atom from one Mac to another, including all installed packages, settings etc?
Comment: Possible duplicate of [How to save atom editor config and list of packages installed](http://stackoverflow.com/questions/30006827/how-to-save-atom-editor-config-and-list-of-packages-installed)
Answer: There are several ways to synchronize your settings and packages between Atom installations:

Git: Create a public or private Git repo and store the contents of your local ~/.atom folder in there. Ignore the following files/directories in a .gitignore file:
storage
compile-cache
dev
.npm
.node-gyp

Use a package like sync-settings. This will store your configuration in a GitHub Gist.
Dropbox (or similar): Move your ~/.atom folder to your Dropbox folder and then symlink it from there to its original location. This has the downside of syncing everything in ~/.atom, even the things you could ignore.
Use stars to select your favorite packages. On the Atom web site, create an account and mark your favorite packages with stars. Then use apm stars --install to install all starred packages on any machine. Downside: This only works for packages, not for settings.

More details:

https://discuss.atom.io/t/syncing-settings-packages-between-machines/1385
Comment: The third option - using stars - works fine. Would however be great if it was build into the Atom editor: Login and be able to sync both installed and stared packages.
Comment: I just installed Atom `1.11.2` and it generated `~/.atom/.gitignore` containing all of the above plus a bit more. :)
Comment: How safe is it to commit the config.cson file in a public git repository considering the fact that the ID of the user `uderId` is in there ?
Comment: With the first option, you would sync the contents of the `packages` subfolder which holds all the source code of all the packages! Better use something like [package-sync](https://atom.io/packages/package-sync) in combination with that approach, and add "packages" to your `.gitignore`
Comment: There's some discussion on that here: https://github.com/atom/metrics/issues/18 Having said that, if you're concerned about privacy, you probably should be careful with storing anything in a public Git repo.
Comment: `.atom-socket-secret-*` needs to be added to .gitignore
--> https://github.com/atom/atom/issues/19334
Answer: As a user who uses a dotfile management system such as RCM, I prefer independent config files.
For now, Atom doesn't officially provide a packages.cson file to manage plugins, but as the post Syncing settings & packages between machines mentioned, there is a plugin called package-sync that will generate a packages.cson file for us.
So with the help of package-sync, now I can just sync those mininal config files to have my Atom settings and packages consistent across multiple machines.
This is how to do it (Use ubuntu as an example):

Install Atom, and install package-sync through Edit-->Preferences-->Install as the screen shot shows:

Open your command pallete and type: Create Package List and there will be a packages.cson file under your ~/.atom folder.

Edit the gitignore file:
$ gedit ~/.atom/.gitignore
Make sure the content is:

blob-store
compile-cache
dev
storage
.node-gyp
.npm
.apm
packages/
atom-shell/

This is a screenshot of the .gitignore file:

This makes sure the content downloaded by Atom from the Internet will not get synced to your dotfiles repo.
Move the .atom folder to the dotfile repo:
$ mv ~/.atom ~/dotfiles/tag-atom/atom
Relink the folder:
$ ln -s ~/dotfiles/tag-atom/atom ~/.atom
Or if you have rcm installed:
$ rcup
Now go to another machine, and install Atom and package sync. Update your dotfiles repo, and then Open your Atom command pallete and type: sync

Now your Atom settings will get synced and integrated with the RCM dotilfe management system.
This is the files in my ~/.atom folder that get synced:
Comment: Why do you still edit your files with gedit when you have Atom? ;)
Comment: Thanks for sharing, the package-sync solution is pretty good.
Comment: Thanks for this answer!
Answer: I recently built a package that syncs automatically your Atom settings and packages across multiple computers. A little bit like the bookmark synchronization mechanism in Google Chrome. It's called atom-package-sync. Maybe it could fit your needs.
Comment: Oh yeah and the server side is open source if you want to host it on your own server.
Answer: You can sync your packages via package-list.txt file and a simple shell script.
Create the package-list.txt file
apm list --installed --bare > package-list.txt

Install missing packages on another host
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
INSTALLEd_PKGS=$(apm list --installed --bare)
for PKG in $(cut -f1 -d@ $BASEDIR/package-list.txt); do
    grep -q $PKG <<< $INSTALLEd_PKGS || apm install $PKG
done

Answer: The .atom folder contains the packages folder, which can be rather huge. Unfortunately OneDrive doesn't allow you to exclude folders, so I went with a git option.
I excluded the packages from git and instead I committed a text file containing my packages (my-packages.txt).
To re-install packages I need to run: apm install --packages-file my-packages.txt.
To generate the my-packages.txt, I need something like this on a Bash shell: ls packages | xargs -n 1 echo | cut -d/ -f1 > my-packages.txt
Comment: While this is a clever minimal solution to keep your packages in sync, it does not cover the config, keymap and styles. Especially the config is crucial to have the same behavior of your packages on all machines.
Comment: The [package-sync](https://atom.io/packages/package-sync) plugin basically does the same but has Atom UI integration to save yourself from remembering bash commands or wrapping them in a custom script.
Answer: I sync my Atom settings between Windows, macOS, and Linux machines using Resilio Sync Home. It is free and the files are not saved on the "cloud" (like Dropbox or Gists), but it requires that, at least, two machines are online in order to sync the current settings.
I do not want to sync caches, installation specific settings, et al., I update the .sync/IgnoreList file that is created in the synced directory (i.e., the ~/.atom directory). Unfortunately, you will have to update this on each machine that you sync (ironically, the IgnoreList file is not synced). By default, the file specifies various temporary files to be omitted from syncing, so you'll need to add the following:
## Atom-specific
/packages/node-debugger/debugger.log
\packages\node-debugger\debugger.log
/.apm
\.apm
/.node-gyp
\.node-gyp
/.npm
\.npm
/blob-store
\blob-store
/compile-cache
\compile-cache
/dev
\dev
/recovery
\recovery
/split-diff
\split-diff
/storage
\storage

Some of the omitted directories are package-specific (e.g., split-diff). Because Windows has different path delimiters than other platforms, I need to specify both(!!)

Install Resilio Sync Home on your first machine
Add the .atom directory to Resilio to be synced.
Update its IgnoreList file, as shown above. Save this file for the other machines you want to sync with.
Send a Resilio "Read & Write" link of that folder to the other machines you want to sync with or copy the "Read & Write" key to be used on the other machines. To do this, in Resilio's folder view, click on the .atom folder's menu (vertical dots on the right edge) and select "Copy Read & Write key". Save it for later.

Then on your other machines,

Install Resilio Sync Home
Create .atom/.sync
Copy the IgnoreList from your first machine to that directory
Add the .atom directory to be synced with the other machine. You should add the folder using "Enter key or link," then enter the key you copyed, above.
Wait until syncing is done before opening Atom. The first time will may take a few minutes.

Now I don't need to go around installing/removing packages on every machine, separately!
FYI: Changes to files and directories are saved in .sync/Archive, for some period of time, if you should need to recover them.


How to copy metadata of Partial Sandbox into a new Developer sandbox?

Question: I Have only one license of Partial sandbox. I want to refresh it with Production. Before that I want to copy all the metadata present in the Partial sandbox into New/Existing Developer sandbox. How can do that?
Is it supported by salesforce? or are there any tools available for this requirement.
Thanks.
Answer: I have never tried it but as mentioned in documentation, you can only clone sandboxes of similar license types.
As a best practice, I would recommend you store all the metadata and customization logic to a Version control system and treat it as source of truth.

A cloned sandbox uses the same license type as its source org. For
  example, to clone a Full sandbox you must have a Full sandbox license
  available.
Answer: There are a few options and some pros/ cons. This is not an exhaustive list so ask away to discuss more.
Disclaimer: I work for Snapshot, one of the tools that I discuss below.
Here goes:

Unmanaged packages: Just go to create package through Setup. Setup > Build > Create > Packages in Classic, Setup > Platforms Tools > Apps > Packaging > Package Manager in Lightning. This will help you add pretty much anything to this Private Package to be uploaded and then installed in the other Org. Pro: Easy to do and can be done across Org boundaries. Con: Metadata can only be installed once, you cannot update this package and install again in the same destination Org. So, if you want to do this just once, this is very easy and useful. If you want to do this over and over, choose something else. Great for admins and free option from Salesforce.
Change Sets: Much like the previous unmanaged packages with similar options. This will work only between related Orgs (production Org and their related sandboxes). This removes the update restriction that I talked about in the previous option. Great for admins and free feature from Salesforce.
ANT or Workbench: You can create a package.xml (manifest of metadata that you want to download/ upload) and use that to retrieve the metadata from one Org and deploy that into another Org. No Org boundaries using this method. Uses the metadata API directly so it actually can let you move more metadata options than Change Sets or Packages. There are tools like Package Builder (https://packagebuilder.herokuapp.com/) that can help with building your manifest. You do not need to be a developer but you need to be comfortable with manipulating XML. Free toolkits from Salesforce!
DevOps tools: There are various paid tools, like Gearset (the one that @cropredy talked about), Autorabit, Flosum, Copado etc. that can help you do this on a regular basis. They make life easy if you want to do this regularly but if you are looking for a one-off, not a good idea. Mostly meant for developers and career release managers. Paid with free trials from ISVs listed on AppExchange!
Org management tools: I work for Metazoa, the maker of Snapshot. This is a visual tool to backup/ retrieve, deploy and manage metadata. This is intended for admins and release managers who want to do this regularly. Paid with free trial from Metazoa!

Here is how I would approach this need: If you need to do this regularly, you will want to invest in a paid tool to do this. A lot of pros relate to managing customizations related to managed package customizations that are usually difficult to manage, secure using the free tools - not impossible, just difficult.   If this is a one-off and this is a related sandbox (you did say developer sandbox but it could be related or not), just use Change sets. If it is a one-off and unrelated sandbox (Org merge/ split scenario), use unmanaged packages.
Glad to discuss more if you need it. Good luck.
Sridhar
Answer: I would recommend using a vendor DevOps tool such as Gearset. You can copy metadata from any org to any org, regardless of sandbox type (and even copy data)
These vendor tools have visual user interfaces (no command line) and easy for admins and developers to quickly grasp. Source control is supported as a source and target as well.
Disclaimer: I'm not an employee of Gearset but we do use it in our org
Answer: This is a great reason to use a tool such as Copado.  It can take the metadata (and actual data) and migrate it between sandboxes or scratch orgs.  It solves the problem of promoting changes from Developer to Integration testing and then to production and much more.


Ubuntu crashed while updating

Question: I am using Ubuntu for 4 years. Now I have loaded 64 bit version on my Home. while upgrading to 12.4 it was interrupted for some reasons and not full upgrade down loaded. I started Ubuntu on some next 2 days after it was working fine then when connected to internet I saw that 1120 updates are waiting. I started updating when all updates downloaded and it started processing the updates it stopped in between and Ubuntu in now not opening. what should I do? I have Windows as well as Ubuntu on same hard-disk on my computer. Whether any remedy or I have to fresh load Ubuntu?
Comment: Close voters: This question has a good answer. **There is no need to close this**.
Answer: I would personally opt for a clean install.
Boot to a LiveCD, backup your home files (which should all be accessible still) and any others that you want to keep to another drive and reinstall. The whole process takes about half an hour (depending on how much stuff you have) and you get a shiny clean install.
You might want to try recovering the upgrade process first - just in case it's that simple. From the LiveCD, open a terminal and run:
<code>sudo mount /dev/sdXY /mnt # swap sdXY for your drive/partition
sudo chroot /mnt
apt-get update
apt-get -f dist-upgrade
</code>
Comment: Are you sure `apt-get` is going to work, without `/proc` or `/dev` mounted and without setting any environment variables?

Ubuntu crashed while updating


Autocorrelation and frequency of occurence

Question: Recently, I started reading Zuckerman's biography of Jim Simons - "The Man Who Solved the Market". There is an interesting para on page 110 - "When you flip a coin, you have a 25% chance of getting heads twice in a row, but there in correlation b/w one flip to the next. By contrast,Straus, Laufer and Berlekamp determine that the correlation of price moves in deutche marks b/w any two consecutive time periods was as much as 20%, meaning that the sequence repeated more than half the time"  -
This last line is throwing me off....I've always used autocorrelation, or correlation as is done in traditional statistics courses; just the degree of association b/w two data series at a point in time, or over time etc. I've never associated either of the two metrics to a frequency of an event occurring. I've no idea how the author connects the 20% autocorrelation to the event occurring more than half the time....could anyone elaborate and point me in the right direction? Thanks!
Answer: I recently had trouble with a similar concept and I managed to develop a proof that related probability of successive occurrence with autocorrelation. Interpreting Autocorrelation as probability. Let me know if it helps.
Comment: Thanks! I'll check and get back :)


Retrieve my social security number from a long time ago

Question: I don't have or remember my social security number, which I got in 1979. I want to find my number, since I am in the country with no visa. What can I do?
Comment: Which country?  Which country are you a citizen of? Did you enter the country legally?
Comment: Are you hoping that having a social security number will somehow mitigate problems related to your immigration status?  It will not.
Answer: I'd recommend you start at this website. You can learn about the process for recovering your SSN. You should also consider visiting your nearest SS office. I don't believe they ask to see a visa before rendering assistance.
Good luck.


Editable spreadsheet control in a webpage

Question: I am trying to place an editable spreadsheet control in a webpage without the menus and toolbars.  I saw the postings about this and the last one said to use Google Docs spreadsheet and then choose Publish.  If you use "?widget=true&headers=false" then the menus and toolbars will be removed.
This works great.  The only problem is the data is not editable!  It's a static spreadsheet.  Is there a way to get the google spreadsheet control in a web page without menus and toolbars but make it editable?
Answer: I simply put the spreadsheet control inside a div and used the div to cover up the tool bars and scroll bars, etc.  Worked great.
Here is the html:


Member Temporary Password

Question: Is it possible in EE 2.6.1 to have a super-admin create a member of another group, and have the system send a temporary password, and then have the user login to the front-end with that temporary password. These members will never have access to the control panel. Are there any good 3rd party modules that would accomplish this?
Answer: You should try MX Auto Password and MX Notify Control

Member Temporary Password


Why would a football punter turn and run the ball into his own end zone?

Question: In the Jets vs. Chargers NFL game on 2020-11-22, LA were about to punt from their 28 yard line with 8 seconds left. However, the punter turned and ran into his own end zone, giving NY two points. What was that strategy for?
Answer: Well, in that game the strategy was to take time off of the clock so that The Jets would have only a small amount of time to play in their case 1 play instead of 2 or 3 downs and possible Hail Mary and win the game. Giving NY only 2 points did no real damage and it ran off time off the clock.  If NY hadn't forced the safety LA would have stayed in bounds and let the time expire and game would have ended then.
Comment: Generally, taking an intentional safety means you are more worried about a blocked or shanked punt than the two points. So if you're up by 6 or 5 late in the game, your punter is standing in the endzone and your punt team is terrible, you might give up the safety, do the free kick and give your defense a chance to prevent a touchdown.
Answer: In addition to the reason of taking time off the clock, the "safety punt" approach is beneficial when the score difference is right (6 to 8 points - so a field goal is not going to tie the game after a safety).  A punt from the 8 yard line, even when not blocked, is already expected to be worth something close to a safety - look at the play by play, the EPB (expected points before) was -1.5 for that play.
The safety obviously gave 2 points, which is slightly more, but it's like insurance - you give up 0.5 points that don't affect the actual outcome, and you avoid having to punt from the end zone and possibly giving up a touchdown that could tie the game.


Suppress server message in rsync

Question: When I rsync or scp from a particular server I get a rather long message telling me the rules of the server. However when I setup regular pulls, I'd like to be able to suppress those messages in my logs. Looking through the man page suggest that -q should work, but that only quiets messages from scp itself.  How can I do this?
Answer: In case you don't want to mess with your local ~/.ssh/config file and the --no-motd option is not working for you either, I had success setting the RSYNC_RSH env variable.
RSYNC_RSH="ssh -q" rsync

You may also try to use the rsync option -e
rsync -e 'ssh -q'

Comment: That worked for me when `--no-motd` failed.
Answer: For rsync, it has a --no-motd you can use to suppress the motd for your script and only see the output of what rsync is transferring. It looks like it was added in rsync 3.x since I don't see that option in 2.x.
The man page lists a caveat about not using it when trying to get a listing of modules you can rsync:

--no-motd
This  option affects the information that is output by the client at
  the start of a daemon transfer.  This suppresses the
  message-of-the-day (MOTD) text, but it also affects the list of
  modules that the daemon sends in response to the "rsync host::"
  request (due to a limitation in the rsync protocol), so omit this
  option if you want to request the list of modules from the daemon.

For scp, trying touching the file ~/.hushlogin. When I scp files, I don't see the motd though but your set up might be different. The man page for login has more info:

If the  file .hushlogin exists, then a "quiet" login is performed
  (this disables the checking of mail and the printing of the last login
  time and message of the day).  Otherwise, if /var/log/lastlog exists,
  the last login time is printed (and the current login is recorded).
Comment: `rsync --no-motd` does not work for me. The SSH MOTD is still being shown.
Answer: If your version of rsync doesn't support the --no-motd option,
puting LogLevel quiet in ~/.ssh/config will do the trick.
Comment: The `LogLevel quiet` option worked for me. _Note_: I did have to _create_ the file (`~/.ssh/config`), but I put in the one line, and voila! no more `/etc/issue.net` showing up!
Answer: You can probably suppress the motd by redirecting STDERR to /dev/null, but that way you will miss all other error messages too.
scp src dst 2> /dev/null

Comment: This is not an option, all output is being directed to a log file that needs review later - errors are important!
Comment: Well stop being too biased. I think his solution is better than someone who suggested `LogLevel quiet` option which by the way suppressed all warnings and errors.
Answer: On my SuSE 11 system, I found the banner message in /etc/issue.net and then remarked out the banner line in my /etc/ssh/sshd_config file.
#banner /etc/issue.net

Then restarted the ssh daemon
service sshd restart

This suppressed the banner when using scp inside scripts and cleaned up the log files.
Comment: If the contents of `issue.net` must be shown, put them in a static `/etc/motd` or add it to whatever generates that file, and enable `PrintMotd` in `sshd`'s config (default is enabled). That way it will be visible for interactive logins.

Suppress server message in rsync


Code/package developed by others - citation or co-authorship?

Question: Say in one of my projects, I am using someone elses code in a published paper. The method is novel and therefore I also have some general discussion on how to apply the developed code in GitHub. Am I expected to include the developer of the code as co-author? Or would a citation be sufficient?
Comment: As a non computer scientist, this sounds to me exactly like something to cite, it isn't coauthor worthy. You are using published data and citing the source of it. It's like using anything else that's published. However, again, I'm not a computer scientist, so if the answer is any different, that will be interesting for me to see!
Comment: "apply the developed code in GitHub" What do you mean? Apply the code that you got from GitHub?
Comment: I came across a paper describing a method with a code posted in GitHub. The method is exactly what I need, and I download them to apply to my dataset
Answer: If you're just using their code, citation suffices.
It would be polite and probably appreciated for you to let them know.
If they modify or augment or configure their code in response to your needs then coauthorship might be appropriate.
Answer: It boils down to the question if the code and/or the implemented method was published before or not. If it was published, you can make use of the code like of any other published information (unless the license under which it is published does not allow it). Then, citing is sufficient. If you somehow got unpublished code, for example by private communication, you have to agree on the terms with whoever wrote the code.