What's with the pink carnations?

Question: Several songs mention pink carnations.
"A White Sport Coat (and a Pink Carnation)" by Marty Robbins

A white sport coat and a pink carnation
I'm all dressed up for the dance
A white sport coat and a pink carnation
I'm all alone in romance
(...)
A white sport coat and a pink carnation
I'm in a blue blue mood

"American Pie" by Don McLean

I was a lonely teenage broncin' buck
With a pink carnation and a pickup truck
But I knew I was out of luck
The day the music died

"Machine Gun Blues" by Social Distortion

I just left your town, took all your loot,
bought a pink carnation and a pinstripe suit,
a hopped-up V8 Ford and some two-tone shoes

Language of Flowers
Of course, flowers, and plants in general, are known to have symbolic meaning.
According to Wikipedia, carnations in general mean "fascination; distinction; love" while pink carnations mean "a woman's love, a mother's love".
Other sources on the Internet have pink carnations meaning gratitude.
What do the pink carnations mean in these songs?
Do they have the same meaning? Are any of the later songs inspired by an earlier song? Is there another reason for the pink carnations besides their possible symbolism?
Answer: The flower in all cases seem to be a stand in for the desire for the love of a woman's, that for all intents and purposes that these men are strapping bachelors seeking love.  Usually when a man dresses himself up in anything specifically fancy and symbolic, he is expressing a desire for that symbol to help him get what he wants, not that he believes he already has that symbol's value.
Marty Robbins: he's at a dance and he gets to dance with a prospective lover and the lovely woman turns him down and he is crestfallen.
Don Maclean: here, the implication is that the narrator was once young, naïve and looking for love but that was before the tragedy and he might not have been the same man after.
Social Distortion: he has left town and dressed himself up to be fine a suitor ready to dance.
Answer: The simplest explanation is that the pink carnation was commonly used as a boutonniere during those gentlemen's youth.  An inexpensive, durable flower, it continues to be used for this purpose at special events like proms.  It makes for a vivid, visual evocation of a young person getting dressed up for a fancy, hopefully romantic occasion.
Answer: Although I agree with other answers in that this may be an iconic image of youth at a dance in America the mid 20th century, especially in the 1950's, and in the context of pursuing young love or sex, geraniums themselves are also Biblically symbolic flowers...

With a history that dates back more than 2,000 years, it's not
  surprising that carnations are rich with symbolism, mythology and even
  debate. While some scholars suggest that their name comes from the
  word "corone" (flower garlands) or "coronation" because of its use in
  Greek ceremonial crowns, others propose that it's derived from from
  the Latin "carnis" (flesh) referring to the flower's original
  pinkish-hued color or "incarnacyon" (incarnation), referring to the
  incarnation of God-made flesh.
Today, carnations can be found in a wide range of colors, and while in
  general they express love, fascination and distinction, virtually
  every color carries a unique and rich association. White carnations
  suggest pure love and good luck, light red symbolizes admiration,
  while dark red represents deep love and affection. Purple carnations
  imply capriciousness, and pink carnations carry the greatest
  significance, beginning with the belief that they first appeared on
  earth from the Virgin Mary's tears – making them the symbol of a
  mother's undying love.
Worn on Mother's Day, Teacher's Day, St. Patrick's Day (in green, of
  course) and at weddings, this hardy, sweetly fragrant flower is also
  the state flower of Ohio, the January birth month flower and the 1st
  wedding anniversary flower.

In addition, it may be possible that the "echo" of the pink carnation lyrics mentioned in these songs are referencing each other and/or the original song A White Sport Coat and all in relation to producing the feeling of a 1950's America, but I have no proof yet to back this idea up.

What's with the pink carnations?


Grinding malted rye and rye flakes for all-grain

Question: Do you need to grind flaked rye and malted rye before mashing? Didn't on my first all-grain and I'm not terribly pleased with the lack of extraction. Used the appropriate rests and extra amylase. Ran across a post that Denny did on another site that mentioned grinding malted rye. Is this always necessary?
Answer: You have to grind the malted rye to expose the endosperm for gelatinization and
conversion. Flaked rye has already been gelatinized and can be added to the mash without any pre-processing.
The rye kernel is smaller than barley. I've found that it's best to tighten up your mill a bit to give a good crush.
Comment: If I don't need to precook them, I throw my flakes into the mill along with the malt. Crushing them does no harm and increases the surface area even more which may speed up or improve conversion efficiency.
Comment: I've tried using flaked grains both ways and found absolutely no benefit to crushing them, so I no longer bother.
Comment: For me, the main benefit is that all the grist is weighed out and put in the same bucket for milling. I find it's more of a pain to have to single out an item in the grist as not being milled. But of course, each to their own.
Answer: I've brewing for close to 40 years and have never ran flaked rye through the grinder, I just add a 15-20% flaked rye to my mash grain bill.
Since this is the first time I've heard of grinding it, I will try it out on my next brew and determine whether it makes a difference on gravity/taste.
It might extract a bit more of the peppery taste from it, which would be a plus for sure.
This is probably a common mistake.  Getting overconfident will help you make these mistakes!!
Comment: If you try it out, please come back and Edit your anwer to include what you found out.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


What uses does Wireshark have?

Question: Currently I'm using  wireshark. I am sending some HTTP and HTTPS requests and checking some captured data, finding some valid data and passing that data to make a hacking. I am a begineer in the testing field. I'm working a small company here, and I'm the only tester. I want to know what other tests Wireshark can be used for.
Comment: Hi toastmaster - I have edited your question to be less broad and opinion based, while keeping what I hope is the core question.
Answer: Wireshark is a tool that capture traffic that passes through the computer that runs it, and display to the user exactly what is being sent over the network.
Like most tools, it can be used in many ways for many purposes. It is common to use it for white hat as well as black hat activities. It is good for everything from troubleshooting network problems to pentesting and actual attacks. The tool itself does not have an inherit purpose except letting the user look at the network traffic.
It should be noted that Wireshark can only let you view traffic that is already reashing you. It can not be used to break into a network where you do not already have access.
Answer: Wireshark is a tool that can be used to sniff data over Wifi. It isn't necessarily a hacking tool, but it can be used to find out information about someone or something.
For instance, if someone logs in to a HTTP website over wifi in your area, you will be able to see their login data. You can use that to login as them.
Another use I've seen for it is seeing what kind of AP's Phones are looking for when trying to connect to wifi. This way you can fake an AP that the user knows so they might connect to your fake AP and you will be able to see all kinds of data.
If you want to know more I suggest you go to the Wireshark website.
Comment: It's not specifically a WiFi monitoring tool - works for any network connection.
Comment: I suggest looking up some information on Google before asking. This is what can be found using a single Google query. Goodluck, http://www.howtogeek.com/104278/how-to-use-wireshark-to-capture-filter-and-inspect-packets/
Comment: yes you said that sniff data over wifi.  Thats I want to test. please tell what should I do for testing this sniff data over wifi ?

What uses does Wireshark have?


Load Balancing in mysql InnoDB cluster

Question: I have set up an InnoDB cluster with one primary(R/W) and two secondaries (R/O) and bootstrapped a MySQL Router. The router has 2 port 6646(R/W port) and 6647(R/O) port. My application is currently connected to the cluster through the R/W port. Now I am looking for a way to implement load balancing in the cluster. Suppose there are 2 reading requests, how can I route the traffic to a different available database?
Comment: Look in the documentation for "round robin".  (It is the only practical method for this situation.)
Comment: you mean edit the config file of mysql router for the r/w section?
Answer: By default, the Router will load-balance the R/O request in a round-robin fashion.
You can configure the routing strategy to meet your needs, see [basic routing] and [routing_strategy].
Comment: so let say my app is only connecting to the r/w port, there will be no load balancing? suppose there is one node for r/w, two nodes for r/o
Comment: If your app is only connecting to the R/W port then all traffic will be forwarded to the primary member of the Cluster, always. You won't have any load balancing for R/O traffic.

Load Balancing in mysql InnoDB cluster


Can't format external hard drive ("in use")

Question: I'm running (via Boot Camp) Windows 7 SP1 on my 32-bit MacBook, and I'm trying to format a new Western Digital My Passport external hard drive to use NTFS. It came formatted of course but I wiped it clean. Disk Management says the drive is RAW, healthy, and primary partition on that hard drive. I just want one NTFS partition, but I can't get Disk Management to do it -- I just keep getting messages saying that the disk is in use. I tried booting into safe mode and formatting the disk there, but that didn't help. Does anyone have any idea how I can get this to work??
Comment: Have you deleted and recreated the partition and then tried formatting it?
Comment: Yes I have, and it deletes the volume and lets me go through the wizard to create a new NTFS partition. But after working on it for about 10 minutes, I get a message saying "The volume is currently in use. To force the format of this volume, click yes. Warning: Forcing a format might cause unexpected errors in the application that is using this volume. Do you want to continue?" I click yes to continue and about ten minutes later I get an error "The format did not complete successfully". Now I just see the RAW partition again.
Comment: It sounds like the external drive may be DOA. Run a "long test" with [SeaTools](http://www.seagate.com/support/downloads/seatools/); dispte being made by Seagate, it works perfectly fine for diagnosing drives of other brands. I believe Western Digital has their own testing utility that you may want to use instead, I do not have a link to it saved though.
Comment: Thank you, I will try SeaTools. I don't think the drive was DOA, though -- before I wiped it, I did successfully use it with WD's own software/utilities. But their software basically took over my computer's resources and in my annoyance at that I decided not only to uninstall the utilities but also to wipe the drive. I'm afraid I messed something up then...
Comment: @Rain I ran the SeaTools long test and it failed...
Comment: The drive is DOA then. Read Western Digital's website for RMA instructions. If they have a tool similar to SeaTools, you will probably have to run it in the RMA process.
Answer: Well, I don't know exactly what was wrong, but I fixed the problem:

Booted into OS X
Used Disk Utility to format the hard drive using ExFAT (it worked on the first try; took about 3 seconds)
Booted into Windows
Used Disk Management to reformat the hard drive using NTFS (it worked on the first try; also took about 3 seconds)

That's it. Presto.


Structural Induction vs Normal (Mathematical) Induction

Question: In computer science and semantics I have come across structural induction many times. In that context, it is often presented as something different from but similar to mathematical induction, sometimes being described as a generalization of it, and often proofs or discussions of foundations are omitted, replaced with an appeal to plausibility. Wikipedia's Structural Induction page states that "Just as standard mathematical induction is equivalent to the well-ordering principle, structural induction is also equivalent to a well-ordering principle." While that doesn't quite say it and I don't have a reference that says it, I suspect that structural induction is mathematical induction on a well founded structure that may not be the natural numbers, and who can tell about Zorn's Lemma? I also suspect that it can be reduced to mathematical induction over the natural numbers if one is clever enough. Do I have that right, and can you point me to any references that get into these types of details of the mathematical/foundational aspects of this computer science-y topic?
Comment: No, structural induction cannot always be reduced to mathematical induction. (For example, transfinite induction over the ordinals.) However, mathematical induction is a special case of structural induction.
Comment: Sect. 4.7 of Makinson's "Sets, Logic and Maths for Computing" provides a very accessible introduction to recursion and induction over well-founded sets (a.k.a. Noetherian induction). While mathematicians are happy with defining a structure as the _least_ set closed under a certain set of constructing rules, a computer scientist is often happier to have data structures defined [_bottom up_](http://stackoverflow.com/a/4940045) by the same set of rules, as this will allow her more naturally to implement operations by (structural) recursion and to perform verifications by (structural) induction.
Comment: Structural induction is a special case of Noetherian induction, however it doesn't seem to be clear when something is Structural induction. Vaguely the relation on the well founded set needs to be defined by some kind of recursion.
Comment: Thanks for the pointer to Makinson's book, @JMarcos.
Answer: Structural induction is a special case of Noetherian induction, however it doesn't seem to be clear when something is Structural induction. Vaguely the relation on the well founded set needs to be defined by some kind of recursion. Also notice that as Zhen Lin points out Noetherian induction cannot always be reduced to normal induction on the natural numbers. His example is particularly clear since the ordinals are uncountable while the natural numbers are countable.
The point of structural induction is to prove a property $P$ holds for all elements of a well founded set $S$. To do this you can assume it is not true, then there is a non-empty set $Q$ consisting of the objects that don't satisfy $P$. Since $S$ is well founded $Q$ contains a minimal element $m$. When we refer to structural induction the relation on $S$ is usually defined recursively (That is if $m<n$ if and only if $n$ can be obtained using the recursion on $m$ a finite number of times. Since $S$ is defined recursively the trick is usually to take an element $c$ smaller than $m$ and prove $m$ satisfies $P$ by using the fact $c$ satisfies $P$ and $m$ can be obtained from $c$ using the recursion. but if $c$ is in $P$ $m$ cannot be minimal, a contradiction.
Structural induction is useful when the recursion branches out into many levels and it is not very clear. For example consider the proof of the Sprague Grundy theorem, where one position $a$ is smaller than position $b$ if position $b$ is an option of position $a$
Comment: Thank you Modded Bear, and also @ZhenLin, for your responses. Although I appreciate the above explanation, it seems like my answer is actually in the comments. If one of you add it to an answer, I'd accept it. As I understand it now, Noetherian induction (a.k.a. well-founded induction?) is the most general of the concepts, mathematical induction is Noetherian induction restricted to natural numbers, and structural induction is a "flavor" of Noetherian induction, the name being used when things are defined by recursion.
Comment: I passed the comments into the answer. I hope what I did was ok.


How do I unpack a file protected by MPRESS?

Question: I have a file that is protected by MPRESS packer and I want to know how to unpack it on Windows. Is there a specific program for that or something else? I am new to this so every help is appreciated.
Answer: You can easily unpack MPRESS packed binary manually, this process can be applied to many more packers such as UPX etc. with minimal changes.
I assume you are familiar with debugger and breakpoints(bp). Since you have not provided any instruction snippets or disassembly, I will try to wrap up process in few points in abstract way, though it will be cumbersome but bear with me:

Reach the entry point of your PE by setting a breakpoint, you may need to change some settings in debugging options if you initially reach system library breakpoint.
Now, by this time you have reached bp on entry point, Press F8(step over) one or two time. On CPU register window set hardware breakpoint on esp register value.
Now with hardware bp set in step 2, Press F9(run) and you will reach hardware breakpoint and will be shown in disassembly.
Now you only have to use F8 as will have to reach the OEP(Original Entry Point), therefore using F8 execute instructions step by step, you will notice a jmp instruction which will take you to OEP of your PE.
Use Scylla or similar program to dump the current process(your packed program) and fix the import table of the dumped process. Now you have a unpacked MPRESS Portable executable. (Please don't forget to delete invalid imports in Scylla else unpacked file will refuse to run.)

I know we haven't discussed working of MPRESS and few other details but that would make answer very long and unnecessary given the fact you have not provided disassembly.
Comment: @LCO, Sorry to say no, we don't have any other option as far as MPRESS is concerned we have to do it manually, though you can get unpackers programs for upx and some other packer. Initially I also faced same challenge but now it's not a big deal :-)
Comment: Is there any other way without doing it manually?


Will my behavior towards my son affect his future married life?

Question: My son (M20) is still studying in college and scores well in his subjects. I noticed he started befriending girls his age and driving with them on bikes, so I confronted him about this matter. He argued with me but eventually agreed to stop being friends with girls. One day, I caught him watching adult videos behind my back, so I severely reprimanded him. Nowadays, he is still scoring well in his subjects but seems dull and withdrawn from his friend circles. Will my behavior make him impotent in his married life?
Comment: Can you give some indication about your cultural background? Your question triggered some red flags for me, but it might be due to cultural differences.
Comment: @BartvanIngenSchenau - [*Some* red flags???](https://parenting.meta.stackexchange.com/q/1432/9327)? How many categories does this one tick off?
Comment: @K_Caitlyn: How exactly do you expect "Married Life" to happen if you prevent your son interacting with girls ?
Comment: Hello @K_Caitlyn. Well done for coming forward and asking your question. If we only allow questions from people who are already very educated, make no mistakes and have no doubts with their children, it's going to become unhealthy in here. And boring.
Comment: @Hilmar I am really confused about my decision.
Answer: One might note that in many countries, cultures, and religions around the World a 20yo man wishing to and actually spending time with women of his own age is considered normal, natural, and a good thing.
One reason this would be considered a positive interaction for two young adults is  because this is a very well established path for them to get to know each other and explore the possibly of making a commitment to a life-long loving, kind, and respectful relationship.
Regarding porn, it's porn, and that's not really a parenting issue, that's a society issue, except when it becomes a parenting issue because it's the only way for a young man to express his interest in women.
Rewarding your ability to make your son impotant, I admit I'm not an expert, but what I know about biology and hormones suggests that parenting does not have this effect.
Your son is 20yo.  He's your child, but he's no longer a child, which suggests that it's possible that treating him like a child is no longer reasonable parenting.
You can continue to exert control over your 20yo son, and forbid him from spending time with women of his own age.  I can't recommend this option, having raised my own  son through his early 20's, knowing how important those years were in his life where he was forming the foundation of his future, which included finding the person he married.
I might recommend that you choose to view your son's interest in spending time with women of his own age as a positive step towards him establishing his own family, which, generally speaking, parents tend to view in a very positive light.
Answer: Your title question ("will it affect his future married life?") and text question ("will it make him impotent?"), deserve two different answers; in that order, yes, and no.
It will not affect him biologically to such a large extent (so, no impotence). But it is likely that meeting fewer women in his 20s, and fewer women before forming a family, he is more awkward with them, less able to form friendships, more sensitive to sexual attraction. All this would affect his future married life negatively.
You seem determined to develop moral qualities in your son. Moral qualities develop as we encounter situations that require judgement, not as we study them in the abstract. Where do you want your son to learn about basic interpersonal skill with the opposite sex? By reading Little Women? (he should, but he shouldn't stop there) Or by actually interacting with his female peers?
Regarding adult videos. I have bad news: he will see more of them, you cannot make it impossible. What he needs, to grow as a kind, loving young man, is to develop an ability to distance himself from it: escape the exploitation of his sexual responses, develop a clear understanding that these images are designed to hack the fascination of men for the female form, and that in doing so they stop at nothing, causing moral and physical traumas for the actors, humiliating everyone.
If he learns this, and has opportunities to grow emotionally by meeting peers of the opposite sex, he will find much more positive ways to develop his sexuality, extending far beyond genital stimulation and helping him on the way to becoming a fine young man, one that is attentive to others, able to make good decisions in relationship matters, and to show his love when and how it matters.
It is natural, as you are first becoming aware that your son has grown, and now has sexual longings, to feel he is too young, to unprepared, and that he may make mistakes. But that is precisely why you want to support him in preparing for adult life: what if, having met few women, he falls head over heels in love for the first that he has a real opportunity to meet - without paying attention to her interest or any traits that make people match? Young adult peer groups are preparation for much more serious times.
If you are unsure how to support him in this, work with professionals. Get counselling or psychologists' support, for yourself to think about all this, or encourage your son to do so. An intelligent, sensitive counsellor would help him reflect on what surely he already knows: that adult videos are certainly not healthy, yet he struggles with sexual desire and doesn't know how to live better with his sexuality.
Comment: I admire your optimism, truly, but I doubt the OP will ever read this answer (or your encouragement.) It appears the OP came here once to post and hasn't been back.
Comment: Maybe so, but these answers are there for the record. I'm assuming this isn't the last time a confused mum comes to stackexchange.
Comment: But I would wager a lot of money that it *is* the first time a "mom" posts about prohibiting her 20 year old son from bike riding with girls, while forbidding watching pornography, and wondering if that will make him impotent. The line between possible and highly unlikely is pretty clear.
Comment: @anongoodnurse I am busy with household chores.
Comment: Which is why I'm guessing this is someone with an unusual life, who needs support. But also, in Q&As like this, readers pick and choose. You don't have to need an answer to this precise combination of three points to find support.


Refer to COM object in the worker thread in C#

Question: I have a COM object SerInterface objCANinterface; which is created in VC++ 6.0 ATL
which i was able to successfully call the methods from my C# GUI.(ThreadingModel is Both when checked in registry)
But i have created a thread which has to use this object opened inside this thread to continues the process.
so i have added the following statements in my constructor class as
<code>public MyClass()
        {
 // Start the thread with a ParameterizedThreadStart.
            ParameterizedThreadStart start = new ParameterizedThreadStart(callBackLoad);
            threadFlash = new Thread(start);
            threadFlash.SetApartmentState(ApartmentState.STA);
...
}

void myFun()
{
    threadFlash.Start(objCANinterface);
   threadFlash.Join(); //Wai
}

[STAThread]
public void callBackLoad(object refinterface)
{
//I am not able to access objCANinterface inside my thread so i have passed the object as a parameter and trying to cast
 SerInterface objSrinterface = (SerInterface)refinterface;
}
</code>
This is not successful Could you please let us know how do i solve this issue. I am getting the following error
An unhandled exception of type 'System.InvalidCastException' occurred in MyClass.exe
Additional information: Unable to cast COM object of type 'System.__ComObject' to interface type 'MYINTERFACELib.SerInterface'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{37C34F3C-0082-46F5-9974-37CEB2E1C2EE}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).
Please let me know how to solve this issue. Thanks in advance.
@ oberfreak.........
have you tried it by using "as" as well? Wen you step down with a debugger, which type is it, is it the expected type? Are your interops included in the assembly or in a seperate file?
@ oberfreak, how do i use "As", could you please let me know how to use that. My interops are included along with my exe. I was able to perfectly work out of the thread.
@ Hans Passant:
You forgot to register the type library in your .rgs script and you also didn't create the proxy/stub project. A threading model of Both still requires an object to be marshaled when it was created on an STA thread and used on another STA thread. Which tends to make it pointless to create a new thread. Get ahead by creating the object on the worker thread instead.
@ Hans Passant : I have registered my type library and interop also created in the C# which is making me to use inside my C# code.I cannot create a new object as I need to use the same object to continue the CAN sequence commands. Could you please provide any sample for better marshalling inside a thread.
Comment: have you tried it by using "as" as well?
Wen you step down with a debugger, which type is it, is it the expected type?
Are your interops included in the assembly or in a seperate file?
Comment: You forgot to register the type library in your .rgs script and you also didn't create the proxy/stub project.  A threading model of Both still requires an object to be marshaled when it was created on an STA thread and used on another STA thread.  Which tends to make it pointless to create a new thread.  Get ahead by creating the object on the worker thread instead.
Answer: I have unregistered/removed the reference from the Exe and have registered and added the reference back to the tool. Then it worked with the parameter thread passing which made as STA thread. Thanks for the answers proposed.


Electromagnetic induction by a coil

Question: Moving magnet produces current in a coil and the galvanometer shows deflection because of the change in magnetic flux. What if the coil is moved why won't it produce an induced current?
Comment: Are you sure it won't?
Comment: "moving magnet": moving relative to what? Answer: moving relative to the coil.
Answer: Moving a coil towards (or away from) a magnet will produce an emf in the coil, as will moving the magnet towards (or away from) the coil.
After all, whether it is the magnet that moves, or the coil, depends only on our frame of reference, and that can't alter the phenomenon of induction of an emf.
Oddly, or so it seemed to Einstein, the classical laws of electromagnetism account for the phenomenon differently according to whether you are in the reference frame in which the magnet is stationary, or the frame in which the coil is stationary. In both cases the emf arises from the so-called Lorentz force on the electrons in the coil:$$\mathbf {F}=(-e)(\mathbf{E}+\mathbf{v} \times \mathbf{B}).$$
In the frame in which the coil is stationary and the magnet moving (the frame you seem to be comfortable with) the electrons experience a force due to the electric field, E set up by the moving magnet, that is due to the first term on the right in the Lorentz force equation. [The electric field is linked to the changing magnetic field by the Maxwell-Faraday equation,$\text{curl}\ \mathbf{E}=-\frac{\partial \mathbf{B}}{dt}$].
In the frame in which the coil is moving and the magnet stationary, the coil is cutting lines of flux due to the magnet, and the electrons in the coil experience a force due to the second term on the right in the Lorentz force equation.
In practical cases, we needn't worry too much about frame of reference, because there's a mathematical description of e-m induction that fits both frames of reference, namely$$\mathscr{E}=-(n)\frac{d \Phi}{dt}.$$
$\Phi$ is the magnetic flux linked with the coil, and it changes by the same amount whether we move the magnet towards the coil or the coil towards the magnet (so $\frac{d \Phi}{dt}$ will be the same as long as we're not dealing with speeds of movement comparable with the speed of light!).
You will find that this topic is explored fairly fully on the Physics Stack Exchange.

Electromagnetic induction by a coil


SMTP with STARTTLS on iPad

Question: I tried to configure the Mail App for my Mail Server using STARTTLS on Port 587 but it does not seem to work. The app complains that there is no connection possible whether I check to use encryption or not. In the server logs I see that the iPad connects but does not issue a STARTTLS command.
I found these questions 1, 2 that suggest that iOS does not support STARTTLS but this sounds quite unreasonable. So I would like to confirm that iOS does not support STARTTLS or that the error has to be found somewhere else. Other devices can connect without problems.
Answer: The problem was not STARTTLS, I was able to verify that the mail app supports STARTTLS. My problem is that the iOS 9 mail app does only support old and insecure SSL/TLS protocol versions. Usage of these versions (TLSv1.0, TLSv1.1, SSLv2 and SSLv3) is forbidden by my mail server for security reasons. Since the iOS 9 mail app only supports these insecure protocol versions no connection is possible.
See also 1 and 2.
Comment: @Phong It does not seem so, but I am not able to verify it since my device does not support iOS10
Comment: Is that also the case with iOS 10? It's rather surprising.
Comment: People seem to be saying it was fixed in the iOS 10 betas, then pulled for 10.0 release… before being fixed for good in 10.1

SMTP with STARTTLS on iPad


Is there any platform where we scan a QR-code and receive the Bitcoin payment?

Question: Like if I want to send 1 BTC to someone I give him a QR-code. He scans it and receives the money. You load your QR code with Bitcoin as payment voucher.
Comment: Sounds like you are thinking of a paper wallet. The private key as a QR code on a piece of paper. Note that there are many dangers to this method.
Comment: can you provide more details on your use case, most mobile wallet applications include QR code functionality
Comment: Please use proper punctuation in your question. If you want people to take the time to answer your questions, the least you can do is to ask them properly!
Answer: A QR Code is just a short-cut for a string of text.
As you probably know, a Bitcoin address is also a string of text. So too, are the keys to your Bitcoin wallet.
So many different things can be stored in a QR code. Is it a wallet address? Or is it a back up of a wallet with its keys? Or is it a web address? Or an email address? It can be anything.
So you can use it to send bitcoin, but you must understand what it is that you are doing and the many ways to do it.
Does the person you want to give the Bitcoin to have a smart phone? Then all you need to do is to install a Bitcoin wallet application and ask the wallet to display its address as a QR code - which you can scan with your own wallet on your own phone which contains the Bitcoin you want to send.
If the person you want to send it to does not have a smart phone, or you can't do the transaction in person, but you have a computer, then you can export or save your wallet as a paper wallet and print it on paper. It depends on the program, but most wallet software have a variation of it and your friend will likely need to use the same software on his computer to import the wallet. Here is a short introduction to this: https://blockchain.info/wallet/paper-tutorial
A third option is to use one of the web based wallet services such as the one above.


Syncing with and without Sql Server 2008 changes tracking

Question: I've stuck with syncing a Sql server 2008 having changes tracking enabled with a 2005 one that doesn't have this mechanism.
Would you please point me a right track, how can I handle this.
Thank you,
Answer: I would look at sql server replication first.
If that is not an option, you can use the sample in this msdn article as an example of syncing a store with a custom metadata tracking technique (the sql compact db in the article) with a sql 2008 db with change tracking.
If you replace the SqlCeClientSyncProvider with the SqlExpressClientSyncProvider as explained in this SO article, but still continue to use the custom metadata tracking technique as with the compact db, you should be able to get there.


A software package to get the list of all frequencies from the sound file

Question: I have a file that contains a recorded sound of an engine.
I need the list of all the frequencies that the sound has.
Answer: Generally speaking, you're seeking software that performs the task of an audio spectrum analyzer. There are RF spectrum analyzers for radio frequencies, and I suspect there may be optical versions.
A quick search using "audio spectrum analyzer software" presents a number of returns. The first one I selected at US$41 is TrueRTA. The information listed indicates that it supports recorded audio as well as live sound analysis.

Observe the frequency characteristics of recorded music or other
recorded audio.

It's important to note that your results will be limited by the device used to record the audio as well as the device used to play back the audio. Bandwidth of a microphone, also known as microphone frequency response, is a critical aspect of selecting a product for a specific task.
If the frequency response of the microphone is cut off at either end of the spectrum, your analysis will show this. It also applies to the playback device, of course.
Answer: There are a number of Python libraries available to perform spectral analysis of signals but it is important to keep in mind that for a given sample it may have been produced from more than one combination of base frequencies & harmonics and then distorted by the production, capture, recording & sampling methods, equipment, etc. especially if lossy compressed file formats such as MP3 have been used.
Note that python and all of the libraries mentioned are Free, Open Source and available for most platforms.
Spectrum
One example is spectrum which provides various methods of analysing then displaying the signal spectrum.
Yule-Walker Example:
PBURG Example:
All spectrum methods: .
Of course as well as being able to plot graphs you have access to the numeric data.
Other Libraries
There are several lists of resources for Audio Processing (including Spectral Analysis):
Python In Music specifically mentions:

Friture - Friture is a graphical program designed to do time-frequency analysis on audio input in real-time. It provides a set of visualization widgets to display audio data, such as a scope, a spectrum analyser, a rolling 2D spectrogram.
LibXtract - LibXtract is a simple, portable, lightweight library of audio feature extraction functions. The purpose of the library is to provide a relatively exhaustive set of feature extraction primatives that are designed to be 'cascaded' to create a extraction hierarchies.
Yaafe - Yet Another Audio Feature Extractor is a toolbox for audio analysis. Easy to use and efficient at extracting a large number of audio features simultaneously. WAV and MP3 files supported, or embedding in C++, Python or Matlab applications.
Aubio - Aubio is a tool designed for the extraction of annotations from audio signals. Its features include segmenting a sound file before each of its attacks, performing pitch detection, tapping the beat and producing midi streams from live audio.
LibROSA - A python module for audio and music analysis. It is easy to use, and implements many commonly used features for music analysis.

It is probably worth reading this paper on FFTs.


Find all cycles in graph, redux

Question: I know there are a quite some answers existing on this question. However, I found none of them really bringing it to the point.
Some argue that a cycle is (almost) the same as a strongly connected components (s. Finding all cycles in a directed graph) , so one could use algorithms designed for that goal.
Some argue that finding a cycle can be done via DFS and checking for back-edges (s. boost graph documentation on file dependencies).

I now would like to have some suggestions on whether all cycles in a graph can be detected via DFS and checking for back-edges?
http://www.me.utexas.edu/~bard/IP/Handouts/cycles.pdf (found here on S.O.) states one methode based on cycle bases. Me personally, I don't find it very intuitive so I'm looking for a different solution.

EDIT: My initial opinion was apparently wrong. S. next answer by "Moron".

Initial opinion:
My opinion is that it indeed could work that way as DFS-VISIT (s. pseudocode of DFS) freshly enters each node that was not yet visited. In that sense, each vertex exhibits a potential start of a cycle. Additionally, as DFS visits each edge once, each edge leading to the starting point of a cycle is also covered. Thus, by using DFS and back-edge checking it should indeed be possible to detect all cycles in a graph. Note that, if cycles with different numbers of participant nodes exist (e.g. triangles, rectangles etc.), additional work has to be done to discriminate the acutal "shape" of each cycle.
Answer: I have already answered this thoroughly, so check this:
Will a source-removal sort always return a maximal cycle?
The relevant part of the answer:

Perform a Depth-First Search on your
  graph.
You are interested in recognizing back
  edges, i.e., in the traversal, an edge
  which points back to an ancestor (in
  the DFS tree, which is induced by
  edges of visiting nodes for the first
  time) of the visited node. For
  example, if the DFS stack has nodes
  [A->B->C->D] and while you explore D
  you find an edge D->B, that's a back
  edge. Each back edge defines a cycle.
More importantly, the cycles induced
  by back-edges are a basic set of
  cycles of the graph. "A basic set of
  cycles": you can construct all cycles
  of the graph just by UNIONing and
  XORing cycles of the basic set. For
  example, consider the cycles
  [A1->A2->A3->A1] and
  [A2->B1->B2->B3->A2]. You can union
  them to the cycle:
  [A1->A2->B1->B2->B3->A2->A3->A1].
Answer: Maybe this can help you somehow, I found this site where a colored dfs for directed graph is described. So you can consider correct the dfs translation to php I present here.
What I added is a part to create a forest and an other part to find all cycles. So please consider that it is not safe to take these two parts of my code as correct for sure.
One with knowledge on graph theory might be able to test for sure. There are no comments in the dfs part because it is described already in the reference site. I suggest that you take an example with more than one tree and draw the forest (need 4 colors) in a paper to better understand.
This is the code:
 <?php

    //define the graph
    $g = Array(
    1 => Array(1,2,3,4,5),
    2 => Array(1,2,3,4,5),
    3 => Array(1,2,3,4,5),
    4 => Array(1,2,3,4,5),
    5 => Array(1,2,3,4,5)
    );

    //add needed attributes on the graph
    $G = Array();
    foreach($g as $name => $children)
    {
        $child = Array();
        foreach($children as $child_name)//attaching a v letter is not needed, just a preference
            $child['v'.$child_name] = null;

        $G['v'.$name] =
        Array('child'=>$child,
            'color'=>'WHITE',//is used in dfs to make visit
            'discover_time'=>null,//is used in dfs to classify edges
            'finish_time'=>null,//is used in dfs to classify edges
            'father'=>null,//is used to walk backward to the start of a cycle
            'back_edge'=>null//can be omited, this information can be found with in_array(info, child_array)
        );
    }

new test($G);
class test
{
    private $G = Array();//graph
    private $C = Array();//cycles
    private $F = Array();//forest
    private $L = Array();//loops
    private $time_counter = 0;

    public function __construct($G)
    {
        $this->G = $G;

        foreach($this->G as $node_name => $foo)
        {
            if($this->G[$node_name]['color'] === 'WHITE')
                $this->DFS_Visit($node_name);
        }

        $tree =array();
        foreach($this->G as $node_name => $data)
        {
            if($data['father'] === null)//new tree found
            {
                $this->F[] = $tree;//at first an empty array is inserted
                $tree = Array();
                $tree[$node_name] = $data;
            }
            else
                $tree[$node_name] = $data;
        }
        array_shift($this->F);//remove the empty array
        $this->F[] = $tree;//add the last tree

        $this->find_all_elementary_cycles();

        file_put_contents('dump.log', count($this->L)." Loops found: \n", FILE_APPEND);
        file_put_contents('dump.log', print_r($this->L,true)."\n", FILE_APPEND);

        file_put_contents('dump.log', count($this->C)." Cycles found: \n", FILE_APPEND);
        file_put_contents('dump.log', print_r($this->C,true)."\n", FILE_APPEND);

        file_put_contents('dump.log', count($this->F)." trees found in the Forest: \n", FILE_APPEND);
        file_put_contents('dump.log', print_r($this->F,true)."\n", FILE_APPEND);
    }

    public function find_all_elementary_cycles()
    {
        /*** For each tree of the forest ***/
        foreach($this->F as $tree)
        {
            /*** Foreach node in the tree ***/
            foreach($tree as $node_name => $node)
            {
                /*** If this tree node connects to some child with backedge
                (we hope to avoid some loops with this if) ***/
                if ( $node['back_edge'] === true )
                    /*** Then for every child ***/
                    foreach ( $node['child'] as $child_name => $edge_classification)
                        if($edge_classification === 'BACK_EDGE')
                            $this->back_edge_exploit($node_name, $child_name, $tree);
            }
        }
    }

    private function back_edge_exploit ($back_edge_sender, $back_edge_receiver, $tree)
    {
        /*** The input of this function is a back edge, a back edge is defined as follows
        -a sender node: which stands lower in the tree and a reciever node which of course stands higher
        ***/

        /*** We want to get rid of loops, so check for a loop ***/
        if($back_edge_sender == $back_edge_receiver)
            return $this->L[] = $back_edge_sender;//we need to return cause no there is no cycle in a loop

        /*** For this backedge sender node the backedge reciever might send a direct edge to the sender ***/
        if( isset($this->G[$back_edge_receiver]['child'][$back_edge_sender]) > 0 )
            /*** This edge that the reciever sends could be a tree edge, this will happen
            -in the case that: the backedge reciever is a father, but it can be a forward edge
            -in this case: for the forward edge to exist the backedge reciever does not have to be
            -a father onlly: it can also be an ancestore. Whatever of both cases, we have a cycle
            ***/
            if( $this->G[$back_edge_receiver]['child'][$back_edge_sender] === 'TREE_EDGE' or
                $this->G[$back_edge_receiver]['child'][$back_edge_sender] === 'FORWARD_EDGE')
                    $this->C[md5(serialize(Array($back_edge_receiver,$back_edge_sender)))]
                    = Array($back_edge_receiver,$back_edge_sender);

        /*** Until now we have covered, loops, cycles of the kind father->child which occur from one tree edge
        - and one: back edge combination, and also we have covered cycles of the kind ancestore->descendant
        -which: occur from the combination of one forward edge and one backedge (of course might happen that
        -a father: can send to the child both forward and tree edge, all these are covered already).
        -what are left: are the cycles of the combination of more than one tree edges and one backedge ***/
        $cycle = Array();
        attach_node://loops must be handled before this, otherwise goto will loop continously
        $cycle[] =  $back_edge_sender; //enter the backedge sender
        $back_edge_sender = $tree[$back_edge_sender]['father']; //backedge sender becomes his father
        if($back_edge_sender !== $back_edge_receiver) //if backedge sender has not become backedge reciever yet
            goto attach_node;//the loop again

        $cycle[] = $back_edge_receiver;
        $cycle = array_reverse($cycle);
        $this->C[md5(serialize($cycle))] = $cycle;
    }

    private function DFS_Visit($node_name)
    {
        $this->G[$node_name]['color'] = 'GRAY';
        $this->G[$node_name]['discover_time'] = $this->time_counter++;

        foreach($this->G[$node_name]['child'] as $child_name => $foo)
        {
                if($this->G[$child_name]['color'] === 'BLACK') {#child black

                    if( $this->G[$node_name]['discover_time'] <
                    $this->G[$child_name]['discover_time'] ){#time of father smaller
                        $this->G[$node_name]['child'][$child_name] = 'FORWARD_EDGE';
                    }
                    else{#time of child smaller
                        $this->G[$node_name]['child'][$child_name] = 'CROSS_EDGE';
                    }
                }
                elseif($this->G[$child_name]['color'] === 'WHITE'){#child white
                    $this->G[$node_name]['child'][$child_name] = 'TREE_EDGE';
                    $this->G[$child_name]['father'] = $node_name;#father in the tree
                    $this->DFS_Visit($child_name);
                }#child discovered but not explored (and father discovered)
                elseif($this->G[$child_name]['color'] === 'GRAY'){#child gray
                    $this->G[$node_name]['child'][$child_name] = 'BACK_EDGE';
                    $this->G[$node_name]['back_edge'] = true;
                }
        }//for
        $this->G[$node_name]['color'] = 'BLACK';//fully explored
        $this->G[$node_name]['finish_time'] = $this->time_counter++;
    }

}

?>

And this is the output:
5 Loops found:  Array (
    [0] => v1
    [1] => v2
    [2] => v3
    [3] => v4
    [4] => v5 )

16 Cycles found:  Array (
    [336adbca89b3389a6f9640047d07f24a] => Array
        (
            [0] => v1
            [1] => v2
        )

    [d68df8cdbc98d846a591937e9dd9cd70] => Array
        (
            [0] => v1
            [1] => v3
        )

    [cad6b68c862d3a00a35670db31b76b67] => Array
        (
            [0] => v1
            [1] => v2
            [2] => v3
        )

    [1478f02ce1faa31e122a61a88af498e4] => Array
        (
            [0] => v2
            [1] => v3
        )

    [0fba8cccc8dceda9fe84c3c93c20d057] => Array
        (
            [0] => v1
            [1] => v4
        )

    [c995c93b92f8fe8003ea77617760a0c9] => Array
        (
            [0] => v1
            [1] => v2
            [2] => v3
            [3] => v4
        )

    [8eae017bc12f0990ab42196af0a1f6a8] => Array
        (
            [0] => v2
            [1] => v4
        )

    [57c0cc445b506ba6d51dc3c2f06fd926] => Array
        (
            [0] => v2
            [1] => v3
            [2] => v4
        )

    [18cef1bbe850dca5d2d7b6bfea795a23] => Array
        (
            [0] => v3
            [1] => v4
        )

    [e0bd0c51bfa4df20e4ad922f57f6fe0d] => Array
        (
            [0] => v1
            [1] => v5
        )

    [6a8b7681b160e28dd86f3f8316bfa16e] => Array
        (
            [0] => v1
            [1] => v2
            [2] => v3
            [3] => v4
            [4] => v5
        )

    [85e95d3e4dc97e066ec89752946ccf0c] => Array
        (
            [0] => v2
            [1] => v5
        )

    [633c7cf8df43df75a24c104d9de09ece] => Array
        (
            [0] => v2
            [1] => v3
            [2] => v4
            [3] => v5
        )

    [769f8ebc0695f46b5cc3cd444be2938a] => Array
        (
            [0] => v3
            [1] => v5
        )

    [87028339e63fd6c2687dc5488ba0818c] => Array
        (
            [0] => v3
            [1] => v4
            [2] => v5
        )

    [c2b28cdcef48362ceb0d8fb36a142254] => Array
        (
            [0] => v4
            [1] => v5
        )

)

1 trees found in the Forest:  Array (
    [0] => Array
        (
            [v1] => Array
                (
                    [child] => Array
                        (
                            [v1] => BACK_EDGE
                            [v2] => TREE_EDGE
                            [v3] => FORWARD_EDGE
                            [v4] => FORWARD_EDGE
                            [v5] => FORWARD_EDGE
                        )

                    [color] => BLACK
                    [discover_time] => 0
                    [finish_time] => 9
                    [father] =>
                    [back_edge] => 1
                )

            [v2] => Array
                (
                    [child] => Array
                        (
                            [v1] => BACK_EDGE
                            [v2] => BACK_EDGE
                            [v3] => TREE_EDGE
                            [v4] => FORWARD_EDGE
                            [v5] => FORWARD_EDGE
                        )

                    [color] => BLACK
                    [discover_time] => 1
                    [finish_time] => 8
                    [father] => v1
                    [back_edge] => 1
                )

            [v3] => Array
                (
                    [child] => Array
                        (
                            [v1] => BACK_EDGE
                            [v2] => BACK_EDGE
                            [v3] => BACK_EDGE
                            [v4] => TREE_EDGE
                            [v5] => FORWARD_EDGE
                        )

                    [color] => BLACK
                    [discover_time] => 2
                    [finish_time] => 7
                    [father] => v2
                    [back_edge] => 1
                )

            [v4] => Array
                (
                    [child] => Array
                        (
                            [v1] => BACK_EDGE
                            [v2] => BACK_EDGE
                            [v3] => BACK_EDGE
                            [v4] => BACK_EDGE
                            [v5] => TREE_EDGE
                        )

                    [color] => BLACK
                    [discover_time] => 3
                    [finish_time] => 6
                    [father] => v3
                    [back_edge] => 1
                )

            [v5] => Array
                (
                    [child] => Array
                        (
                            [v1] => BACK_EDGE
                            [v2] => BACK_EDGE
                            [v3] => BACK_EDGE
                            [v4] => BACK_EDGE
                            [v5] => BACK_EDGE
                        )

                    [color] => BLACK
                    [discover_time] => 4
                    [finish_time] => 5
                    [father] => v4
                    [back_edge] => 1
                )

        )

)

EDIT 1 :
The back_edge_exploit method could be erplaced by this version:
![private function back_edge_exploit ($back_edge_sender, $back_edge_receiver, $tree)
{
    /*** The input of this function is a back edge, a back edge is defined as follows
    -a sender node: which stands lower in the tree and a reciever node which of course stands higher
    ***/

    /*** We want to get rid of loops, so check for a loop ***/
    if($back_edge_sender == $back_edge_receiver)
        return $this->L\[\] = $back_edge_sender;//we need to return cause no there is no cycle in a loop

    $cycle = Array();//There is always a cycle which is a combination of tree edges and on backedge
    $edges_count = 0; //If the cycle has more than 2 nodes we need to check for forward edge
    $backward_runner = $back_edge_sender;//this walks backward up to the start of cycle

    attach_node://loops must be handled before this, otherwise goto will loop continously
    $edges_count++;
    $cycle\[\] =    $backward_runner; //enter the backedge sender
    $backward_runner = $tree\[$backward_runner\]\['father'\]; //backedge sender becomes his father
    if($backward_runner !== $back_edge_receiver) //if backedge sender has not become backedge reciever yet
        goto attach_node;//the loop again
    else
        $cycle\[\] = $backward_runner;

    if($edges_count>1 and $this->G\[$back_edge_receiver\]\['child'\]\[$back_edge_sender\] === 'FORWARD_EDGE' )
        $this->C\[\] = Array($back_edge_receiver,$back_edge_sender);

    $this->C\[\] = array_reverse($cycle); //store the tree edge->back_edge cycle
}][2]

EDIT 2:
I have to say that I have found that back_edge_exploit is insufficient it will only find cycles that are made with tree edges and one back edge.
**** Edit 3: ****
Although this solutions is found to be incomplete, it has some useful information, even the insufficiency it self is a piece of information, so I think it might be useful to keep it. But the main reason I have edited my answer is that I have found an other solution which I am going to present below.
But before that an other notice could be made about the dfs aproach, there are cycles that could occur by walking any valid combination all cross,forward,tree,back edge.  So finding the actual cycles relying on the dfs information is not trivial (requires extra code), consider
this example:

As long as the new solution is concerned it is described in an old paper of 1970, by James C. Tiernan (Check this link) as an efficient algorithm for finding all elementary cycles in a directed graph.  Also there is a modern implementation of this without goto See it here
My implementation of Elementary Cycle Algorithm (that's the name) is in php and is as close to the original as possible . I have already checked it and it works. It is about directed graphs, if you declare you graph so that there is a directed cycle v1->v2->v3 and an other one v2->v3->v1 then both cycles will be found which is logical since it works on directed graphs.
As for undirected graphs the author suggests other algorithms which make a better solution than modifying the algorithms, however it can be done by modifying the graph definition and by adding an extra check for cycles of length 2 which are considered as undirected edges. In particular an undirected cycle of three nodes would be defined twice in the definition, once per orientation, like this: v1->v2->v3 and v3->v2->v1. Then the algorithm will find it twice, once per orientation, then a modification of a single line on EC3_Circuit_Confirmation can cut the extra one.
The nodes are defined sequentially, one can change the constant first and the adjacency list to make the first node count from zero or one.
This is the php code for the EC Algorithm of Tiernan :
<?php

    define(first,1);    //Define how to start counting, from 0 or 1
    //nodes are considered to be sequential
    $G[first] = Array(2); $G[] = Array(1,3); $G[] = Array(4); $G[] = Array(1);

    $N=key(array_slice($G, -1, 1, TRUE));//last key of g
    $H=Array(Array());
    $P = Array();
    $P[first] = first;
    $k = first;
    $C = Array();//cycles
    $L = Array();//loops

########################## ALGORITHM START #############################

    #[Path Extension]
    EC2_Path_Extension:
    //scan adjacency list
        foreach($G[$P[$k]] as $j => $adj_node)
            //if there is an adjacent node bigger than P[1] and this nodes does not belong in P
            if( ($adj_node > $P[first]) and (in_array($adj_node, $P))===false and
            (count($H[$P[$k]])>0 and in_array($adj_node, $H[$P[$k]]))===false)
            {
                $k++;
                $P[$k] = $G[$P[$k-1]][$j];
                goto EC2_Path_Extension;
            }

    #[EC3 Circuit Confirmation]
    EC3_Circuit_Confirmation:
    if(!in_array($P[first], $G[$P[$k]]))
        goto EC4_Vertex_Closure;
    //otherwise
    if (count($P)===1)
        $L[] = current($P);
    else
        $C[] = implode($P);

    #[EC4 Vertex Closure]
    EC4_Vertex_Closure:
    if($k===first)
        goto EC5_Advance_Initial_Vertex;

    $H[$P[$k]] = Array();
    $H[$P[$k-1]][] = $P[$k];
    unset($P[$k]);
    $k--;
    goto EC2_Path_Extension;

    #[EC5 Advance Initial Vertex]
    EC5_Advance_Initial_Vertex:
    if($P[first] === $N)
        goto EC6_Terminate;

    $P[first]++;
    $k=first;
    //Reset H
    $H=Array(Array());
    goto EC2_Path_Extension;

    EC6_Terminate:
########################### ALGORITHM END ##################################

    echo "\n\n".count($L)."$count loops found: ".implode(", ",$L)."\n\n";
    echo count($C)." cycles found!\n".implode("\n",$C)."\n";

    /*** Original graph found in the paper ***/
    //$G[first] = Array(2); $G[] = Array(2,3,4);
    //$G[] = Array(5); $G[] = Array(3); $G[] = Array(1);

    ?>

Answer: My suggestion is to use Tarjan's algorithm to find set of strongly connected components, and Hierholzer's algorithm to find all cycles in the strongly connected component.
Here is the link for the Java implementation with a test case:
http://stones333.blogspot.com/2013/12/find-cycles-in-directed-graph-dag.html
Answer: If a traversal algorithm visits each edge only once, then it cannot find all cycles. An edge could be part of multiple cycles.
btw, what is a back-edge?
Also, perhaps you should rephrase/format your question. It is very hard to read.
Comment: A back-edge is an edge that goes from a node to one of its ancestors in a search tree. E.g. the edges (A,B), (B,C) and (C,A) of an undirected graph, then either (A,B) or (C,A) will be a back-edge (if root = A). It's not a tree edge of the search tree, and it is created when, during DFS-VISIT, an edge leads from a new node to an already visited (gray), but not yet finished, node.
To your first answer: If an edge is part of multiple cycles, then each cycle will be traversed once => all back-edges will be detected => all cycles should be detected AFAIK.
Please correct me if I'm wrong!
Comment: Sorry, I have to correct myself and agree with you "Moron". I was limiting my "cycles" to triangles when exploring examples and focussing strongly on detecting those triangles. This means that the "algorithm" always followed the edges that directly lead to triangles, although this needs not to be the case. E.g. 2 triangles, sharing an edge (bigger cycle = rectangle), the rectangle might be discovered first as a cycle and the 2 triangles might be missed. And vice versa.

Find all cycles in graph, redux


How can I get permission to use an illustration from an old book where the author is dead and the publisher closed?

Question: I am translating a book published in 1961. The author has been dead for more than 50 years. I would like to use the same illustrations, but do not know who to ask. The painter is dead, and he did not have a family. The publisher has been closed for a long time.
Comment: Hi Eva, welcome to writing.se! Take the [tour] and visit the [help] for more information.  This is a tricky situation, hopefully someone from our community will be able to give you the answer you need. Good luck and happy writing!
Answer: Never mind the illustrations. Making a translation of a work protected by copyright is an infringement unless one has permission. This is true in pretty much every country. Specifically it is true in every country that has signed the Berne Copyright Convention.
Many (but not all) works published in 1961 are still under copyright. The author may be dead and have no family, but someone will have inherited the copyright — the government, if no one else. The owner could sue for infringement if a translation is created, and particularly if it is published, without permission. Permission to use the illustrations might well go  with permission to make the translation at all, but in any case they also would require permission.
Some of the resources mentioned in the answer by Leon Conrad may help in finding the owner and obtaining permission, or in checking if a work is still protected by copyright.
You might get additional useful answers to this on the Law.SE site, where copyright issues come up often.
Answer: Copyright law is complex and differs across different countries.
A starting point, if you haven't used it, is the Copyright Watch centre:
https://norman.hrc.utexas.edu/watch/
https://www.reading.ac.uk/library/about-us/projects/lib-watch.aspx
The Copyright Alliance have some helpful links:
https://copyrightalliance.org/resources/find-a-copyright-ownercreator/
I've seen disclaimers in forewords in books which contain wording along the lines of

'every attempt has been made to contact copyright holders of works
included. Ommissions unintentional. Please contact the author or
publisher if you feel a copyright breach has occurred and we will do
our best to rectify it.'

If you are a member of an organisation such as the Society of Authors, UK (https://www2.societyofauthors.org/) you may be able to seek advice through them or have a friendly copyright solicitor recommended who is used to dealing with these kinds of queries.
Answer: I think you can use the same illustrations, but you should point to the source for them. I would do it in such a way if I was in the same situation.
Comment: Legally, this is simply incorrect, The owner might not sue, but acknowledging the source is no defense if  a suit is brought.


How do I know where I need to be to work on my Heart's Desire?

Question: I am working on my Heart's Desire, and I keep having to change locations, but I don't really get much information always about where I need to be. Is there a way to know where I need to be to work on my Heart's Desire, or is it just something I have to figure out by systematically visiting locations?
Comment: If you look at your character (the "Myself" tab) and open up the *Ambition* section in the *Qualities* area, you'll get a summary of where you've been and what you've learned, in the form of several different Qualities. Does one of those help? (I can't confirm it with my character, because I'm halfway through a location with my Ambition.)
Answer: Alas, there's no good way to figure out where your Ambition is going to take you next. Even the text of the last completed storylet isn't necessarily useful: sometimes it will give you a location (such as the Shuttered Palace), and sometimes it will give you an incredibly vague hint (such as a name), that won't guide your next action at all.
You have three options:

Look at the Ambition qualities you have picked up (on the "Myself" tab). If you're lucky, the last one's description will give you a hint on where to go next.
Spoil yourself silly by reading the wiki
Randomly wander around until you find the next location for your ambition. If you can't see it, then it must be somewhere you haven't unlocked yet.


Match BIND's view to certain users

Question: It's easy to make a BIND's view to match certain IPs with the aid of match-clients directive. But is it possible at all for a view to match not IPs, but users? For example service a is run under user b and when it query BIND, it should get to some predefined view. Something like match-users, if it was existed.
Comment: There is not authentication information sent from a typical client to the server
Answer: No. There is no concept of associating identities with DNS packets.
Answer: You could, assuming that you're using dhcpd, and with some scripting, associate users with either static IPs or DHCP entries.  However, depending on what you're trying to achieve, you would likely need to create a separate view for every user. If you're using MS DHCP, I've no idea how those leases are stored, so parsing them for info may become truly prohibitive.
EDIT:
Actually, with a little more subconscious gnawing on this idea, it occurred to me that you could actually spin up additional BIND instances attached to different IPs which are then handed to clients via DHCP. This type of thing intrigues me, so if it's a project you wanted to pursue, message me as I might be talked into helping with it.
Comment: Idea is to redirect queries from some processes, which are typically run as a distinct users, to some views.
Comment: I was thinking more along the lines of spinning up bind instances tied to virtual IPs based off DHCP leases. That way you could reuse some of the same zone files.
Comment: The idea was to use a single BIND instance and its `view` feature. Anyway, since the target services work on 127.0.0.1, there will be no chance to distribute them among these specific BIND instances.

Match BIND's view to certain users


DSLR buying guide

Question: I am going to buy a DSLR Nikon D5300, please suggest with which kit lens should I go, with D-ZOOM KIT: AF-P DX NIKKOR 18-55mm f/3.5-5.6G VR + AF-P DX NIKKOR 70-300mm f/4.5-6.3G ED VR or with AF-S 18-140mm VR Kit Lens. I am a beginner.
Comment: Although it's Canon instead of Nikon, the principle is the same and holds true here. http://photo.stackexchange.com/questions/38741/why-prefer-the-18-55mm-and-55-250mm-lenses-vs-18-200mm/38744#38744
Comment: Welcome to Photo.SE. Purchase recommendation questions are off topic here, mainly because they're too specific to the individual asking, and they quickly become outdated. But we can help you with questions that would help you make a decision for yourself. For example, if you need help understanding the difference between two similar items, that'd be a fine question.
Comment: Or which choice would be a better fit for the way you want to use your camera.
Comment: Kit lenses are basically disposable. Skip them and get a body so that you can get a set of good lenses (no need to buy them all up front, buy one then add as you need and budget becomes available. Also, if you are already buying a D5300, then you don't need a DSLR Buying Guide, you need a [Lens Buying Guide](http://www.neocamera.com/guide_lens_basics.php).
Answer: Nikon D5300 is a great choice as an entry level camera, you may also want to consider a canon T5/T3 which are both cheaper to get familiar with photography.
Enough of the Canon talk haha.
I would recommend the 18-140 (http://www.nikonusa.com/en/nikon-products/product/camera-lenses/af-s-dx-nikkor-18-140mm-f%252f3.5-5.6g-ed-vr.html) simply because it is a much better investment than having those other two lens. I personally never use my 18-55 and my 70-300 canon lens. instead I use a 18-200 canon lens for all of my shots.
Comment: Please don't link to your instagram account on every answer here - you can put that on your user profile if you want, but it will be deleted from answers.

DSLR buying guide


Upgrading macbook pro to mavericks - performance question

Question: My MacBook Pro:
MacBook Pro (15-inch, 2.53 GHz, Mid 2009)
Memory: 8 GB
Currently run Snow Leopard 10.6.8 and also in a partition I have 10.8.x installed.
The most of my work is being done in 10.6.8, which I feel, it performs faster overall.I feel 10.8 to be a bit heavier in a bunch of operations..., so I haven't make the full switch to it.
But time has come and I started considering to fully migrate my working environment to a newer OS X version.
The question is, will Mavericks operate faster than Mountain Lion on my MacBook ? Will my hardware be able to run 10.9 efficiently ?
Comment: Mavericks' memory management trumps all previous OS X versions, period.
Answer:
The question is, will Mavericks operate faster than Mountain Lion on my MacBook ? Will my hardware be able to run 10.9 efficiently ?

Yes. Mavericks has the same system requirements as Mountain Lion, but offers huge gains in energy efficiency, memory management, graphics performance, etc. And it's free!
If you're already in the process of moving over to Mountain Lion, I can't think of any reason not to jump directly to Mavericks instead.
Answer: I am coming back to post my personal experiences, after having upgrade a bunch of macs (many 2008-2011 models) to mavericks and Yosemite.
It's true that both Mavericks and Yosemite are performing way better than the previous lions OS's.
Although I have heard people complain that after upgrading their mac became slow, I believe that this is not because the OS is not working well, but mostly on factors like lack of adequate Ram, Hard Disk slow performance or very heavy system caused by too many applications, files etc.
A few notes/tips:
1. Clean Install against Upgrade over old system.
In all the upgrades I did, I got better results when I installed Yosemite or Mavericks as a clean install on the hard disk. Whenever I was just upgrading over the previous OS, the installation itself was taking longer time to complete. Also the computer wasn't performing that fast with the whole old system/configuration been upgraded.
Generally I saw a lot better results when I was formatting the hard disk, re-installing only the applications needed, and only restored personal files/settings of the user - not the complete user library.
2. Ram
Also, in most cases 4GB of Ram seems to be sufficient, but wherever there is more, the computer can perform better with more apps/processes run at the same time.
I have noticed also that many people ignore the fact that their computer has specific memory installed and that when the computer uses it at full, then every process becomes slower. I have connect with teamviewer to so many macs that their owners said that they are slow and I was always seeing that they had many open apps, browsers with too many tabs etc and just a few MB of available ram in their system.
Although Yosemite and Mavericks are doing very good job in managing RAM and CPU, speed performance issues can still arise if what we are trying to do is more than what the computer is capable to offer. So using it wisely is important.
There are some apps in Appstore, that can automatically clear and free memory when there is none left available, so this may come in handy for many.
SSD
Last but not least, the BIGGEST PERFORMANCE GAME-CHANGER is to use a SSD drive. An SSD drive will boost your macs speed performance up to 10-15 times.
I can say that my macbook pro, is running faster than ever before.
MacBook Pro 15-inch, 2.53 GHz, Mid 2009.
Memory: 8 GB
500GB SSD
Yosemite


Data.gov: Is the API Version 3 down completely?

Question: We've been getting errors from data.gov that multiple API calls are down, anyone know what the ETA is for getting it back up?
Comment: Can you give an example of what's not working for you? http://catalog.data.gov/api/3/action/package_search works for me.
Answer: Rebecca, from the Data.gov team here. Following up on this, to our knowledge the Data.gov CKAN API hasn't been down. Can you provide more details on the issues you were having?
If helpful in constructing your query parameters, here is documentation on the CKAN API: http://docs.ckan.org/en/latest/api/index.html#making-an-api-request
Also, we are working to provide additional documentation specific to the Data.gov CKAN API, you can follow that progress or weigh in here: https://github.com/GSA/data.gov/issues/180
I hope that helps!


Best Way to implement an Attendance Tracker using sharepoint

Question: Please let me know what is the best Way to implement an Attendance Tracker using SharePoint, using SharePoint Designer/InfoPath tools.
Comment: do you mean automatically, such as when a user 'logs in' into the system he is tracked as 'present'? or manual where the user himself or another person confirms the attendance?
Comment: not automatically. i meant using custom lists such as employee details, tracker etc.
Answer: You should first create a new content type with name Attendance. The content type should have minimum following site columns

Employee Number (This will be the unique id which can identify the employee
Date (This will be the date value which indicate the employee has worked on that date or not)

You can add more relevant fields like department or total hours worked for the date etc.
Next create a custom list and using advanced property set the content type you created above.
You can done with the setup. Now users or manager can start filling in the list.
References
Creating new content type
Creating custom list
Adding content type to the list
Answer: by custom list you mean something that you create from scratch? because i have seen 'contacts' and "issue tracking" but never employee details or other tracker. The easiest thing would be a calendar where everybody voluntarily fills in if they are in office or not. If other people are writing the attendance just add  a people field where the inputters can select the person.


2-in-1 with matte screen

Question: I am on market for a new laptop, but all of my online search, as well as communications with sales people didn't yield any 2-in-1 with matte screen, which is surprising. I know it is possible to make matte touchscreens - so I am hoping someone has made a matte 2-in-1.
additional desired specs include:

portable: light-weight, 13" to 14" in screen size.
durable (I am willing to invest, if there is a good chance the laptop will last for 10 years).
an OS that can be over-written. This may be a stupid spec, but I have heard that macOS and Chromebook OS are hard to get rid of. I intend to install Linux, and I want to make sure that would be possible.

thanks!
Answer: the solution was Lenovo Thinkpad X1 series, in case anyone else is wondering.
Comment: Which exact laptop am I wondering?

2-in-1 with matte screen


Are the damage numbers above heroes the real damage?

Question: Is the number, which is shown above a hero's head when he receives damage, calculated with armor and magic resistance, or is it the damage before any calculations?
Answer: There are three types of damage numbers shown: Strong physical attacks, strong spells and damage ticks. Both physical and magical attacks displays the "after calculation" values, but the damage ticks displays "before calculation" values. If I have missed any kind of damage, please post in comments so I can test it and add to this answer.
Strong physical attacks
When strong physical attacks are applied on a target, normally because of a Critical Strike happening, a damage is shown on the target of the damage. The number is the post calculation value, as proved by the following screenshot.
image link
Strong spells
When strong magical damage is applied on a target, specially Lion's and Lina's ult, a damage is shown on the target of the spell. The number is the post calculation value, as proved by the following screenshot.
image link
No donkeys were harmed in the making of this answer.
Damage ticks
Damage ticks are a whole different matter. There are spells like Venomancer's Poison Sting which deal damage per second or over time. For each damage tick, a damage number is shown on the affected hero. However, this number is before any calculation. If a hero is affected with a level 4 Poison Sting, "20" will be shown on the hero's head every damage tick. We can see that this is true by the next screenshot. Skeleton King has a 25% magic resistance. "20" is shown above his head. In the combat log, he received 15 damage.

DamageReceived = 20 * 0.75 = 15

image link
Comment: you were right. magic immunity blocks pure damage. http://www.dota2wiki.com/wiki/Damage_Types#Pure .
Comment: perfect answer. thanks for your effort! this proves me that pure damage is really implemented already because pudge's hook always shows the 360 full damage. (so you forgot puredamage). regards
Comment: Pure damage always deals exact except to magic immune targets, to which it deals 0 damage.


What is the problem about Reverse Regression and how does the IV approach help to solve it?

Question: I really need some help with reverse regressions. I'm trying to solve the following exercise:
a) Consider the following Conditional Expectation Function model:
$Y = \alpha + \beta X + \epsilon ,  E[Y|X] = \alpha + \beta X$
Suppose that we have transformed the above equation in the following way:
$X = -(\alpha /\beta) + (1/\beta)Y - (1/\beta)\epsilon $
Show that this equation does not satisfy the definition of the CEF model.
b) Consider now the best linear predictor equation:
$Y = \alpha_L + \beta_L X + \epsilon_L$
Consider as well the reverse best linear predictor equation:
$X = \alpha^*_L + \beta^*_L Y + \epsilon^*_L$.
Show that in the Best Linear Predictor Setting $\beta_L \ne 1/\beta^*_L$
c) Assume there is an Instrument Z. Show that $\beta^*_L = 1/\beta^*_L$ in the IV setting.
I would be really thankful if someone could explain me the idea behind the problem about reverse Regression and how it is related to the IV approach.
Answer: I'm sorry: I don't understand what you mean by point c. I'll reply to points a and b.
a) $X = -(\alpha /\beta) + (1/\beta)Y - (1/\beta)\epsilon \rightarrow E[X_i|Y_i]=-(\alpha /\beta) + (1/\beta)Y_i$, because $X \perp \epsilon$. To satisfy the CEF model, we need: $E[- (1/\beta)\epsilon_i | Y_i]= 0 \rightarrow - (1/\beta)E[\epsilon_i | Y_i] = 0 \rightarrow (\beta!=0, E[\epsilon_i | Y_i] = 0)$.
Let's focus on the second condition: $E[\epsilon_i | Y_i]=0$, and define $W_i=\epsilon_i*Y_i$. By the Law of Total Expectation, we have: $E[\epsilon_i | Y_i]=0 \rightarrow E[W_i]=E_{Y_i}[E[W_i|Y_i]]=E[Y_i*E[\epsilon_i|Y_i]]=E[Y_i*0]=0\rightarrow Cov(\epsilon,Y)=E[\epsilon*Y]-E[\epsilon]E[Y]=0-0=0.$
But, given $Y = \alpha + \beta X + \epsilon$, then: $Cov(\epsilon,Y)=\beta*Cov(X,\epsilon)+Cov(\epsilon,\epsilon)=\beta*0+Var(\epsilon)=\sigma^2>0$. Thus, the condition $E[\epsilon_i | Y_i]=0$ does not hold, so the CEF model is not satisfied. To be precise, the condition would only be satisfied in the degenerate case, i.e.: $\sigma^2=0\rightarrow \epsilon_i=0 \forall i$, i.e. in the deterministic setting.
b) Let's suppose $\beta_L=1/\beta^*_L$. Then, we get: $Cov(X,Y)/Var(Y)=Var(X)/Cov(X,Y)\rightarrow Cov(X,Y)^2=Var(X)*Var(Y)\rightarrow [Corr(X,Y)*SD(
X)*SD(Y)]^2=Corr(X,Y)^2*Var(X)*Var(Y)=Var(X)*Var(Y)\rightarrow Corr(X,Y)=+1 \bigvee Corr(X,Y)=-1.$ Again, the condition only holds in case the relationship between $X$ and $Y$ is deterministic.
In fact, Galton (1886) showed that, if you normalize $X$ and $Y$ to have the same variance, then the coefficient in regressing $Y$ on $X$ or viceversa are the same, and equal to the coefficient of correlation (thus, between $-1$ and $1$). In case of perfect association and same variance of $X$ and $Y$, the coefficient would be $+1 \bigvee -1$ indeed. This link may help: http://davegiles.blogspot.it/2014/11/reverse-regression-follow-up.html
Also, you may be interested in these Qs&As:
What is the difference between linear regression on y with x and x with y?
Effect of switching response and explanatory variable in simple linear regression
Galton, Francis (1886): "Regression Towards Mediocrity in Hereditary Stature," The Journal
of the Anthropological Institute of Great Britain and Ireland, 15, 246-263.


How do set theory, and formal logic fit in together?

Question: Im at that stage in my mathematical understanding where I kinda understand what set theory is and  what first order logic is but dont really understand how they fit together to create Mathematics. I assume that the ZF system uses first order logic to create the foundations of mathematics and in the grand scheme of things, set theory is dependent on logic for its existence whereas logic or any formal system can exist on its own. Is this the correct view?
Comment: Neither mathematical logic nor set theory "create Mathematics" ... Math "was there" centuries before math log and set theory. The "foundational" point of view was linked to the historical "foundational schools" : Logicism, Formalism, Intuitionism and must be understood in that setting. A "simple" point of view is that math log and set theory provide the language and the "tools" to represent the existsing math theories in a "uniform" way: but this does not means that math "dependent on logic [and set th] for its existence".
Answer: The received wisdom is that pretty well any mathematical statement can in principle be formulated and hence formalised in ZF. I think this is rather an overstatement, but let's bear with it. So in some sense, logic can be viewed as providing a formal foundation for mathematics. However, to do logic rigorously, you need to be able to define and reason about syntax, so a certain amount of mathematics is required to underpin logic. Many people take the view that the finitistic mathematics you need to reason about syntax is sufficiently certain that the apparent circularity is harmless. (Personally, I am agnostic on nearly all such issues.)
Comment: I too had doubts about the circularity you point out.  So it is a still unsettled area is it??
Comment: I don't think philosophical debate about mathematics will ever be settled (but fortunately I'm not a philosopher).
Answer: Not the best answer, but I'll try with a short answer. Some of the set theory books, you will find it says for example $A\subseteq A\cup B$, where $A$ and $B$ are both sets. If we want to check if it's true, we have to prove that the statement $(x\in A)\implies (x\in A\cup B)$ is true. Note that this is equivalent to $(x\in A)\implies [(x\in A)\vee (x\in B)]$, and it's actually true. The reason why it's true is because the statement $p\implies (p\vee q)$ is a tautology which can be read more in Mathematical logic. There is a nice table that shows different tautologies in Rules of Inference. The rule we used here is called "Addition".
Answer: From my understanding, you can use set theory to model the objects studied in mathematics. Then major mathematical theorems can be proven from these models. Take for example, ZFC. If you accept the axioms, then you can use the language of first-order logic to deduce theorems. In Enderton's book on set theory (Elements of Set Theory), he gives a very easy to understand construction of the real numbers from these basic axioms. He first constructs the natural numbers, then defines ordered pairs and equivalence classes using sets. This allows him to construct integers, then rationals, and finally real numbers. Now we can prove theorems about real numbers and eventually theorems in calculus. So in this sense, first-order logic describes the rules of the language in which the axioms of set theory are written, and how rules of inference can be applied to these axioms to create theorems. And since we can use sets to model a lot of things in mathematics, we can say that they can be used as a foundation for mathematics.


Radioactivity features

Question: What happens if someone would make a wire coil around nuclear reactor core?
What are the possibility to capture radioactivity directly?
Answer: An electrical potential is generated in a wire coil if there is a changing magnetic field through the coil. However a nuclear core doesn't generate magnetic fields at all, let along of the type required to generate electricity. So all the wire would do is get hot, and eventually become radioactive.
You might be interested in my answer to Can we make usable energy from subnuclear particles? as it is somewhat related. Basically the only useful energy we get out of a nuclear reactor, or any radioactive source, is heat.
Answer: It seems like there is confusion regarding radioactivity and radio waves. This is a coincidence in naming, not a physical connection. My brief searching shows that the radio in both cases is from the same Latin that gets us "radius," and it comes about because in both cases stuff is emanating away from the source (radially in fact).
Radioactivity amounts to either particles (alpha, beta, or neutrons) or high-energy photons (gamma rays). Gamma rays comprise the highest energy classification of photons. In general, high-energy anything, whether particle or light, only "sees" small structure. Whether an incident gamma ray or alpha particle is absorbed by a piece of material has nothing to do with how that piece of material fits into some larger structure (e.g. a small part of a coil or wire doesn't care that it's part of said coil when it comes to interacting with these things).
Radio waves, while also photons, are at the complete opposite end of the electromagnetic spectrum. They are extremely low energy. Large conductors (antennas) are good at picking up radio waves because they are approximately the same size and thus resonate at radio frequencies. Actually, the coiled wire found in primitive radios is used for tuning to particular frequencies, not generally for picking up the signals to begin with.
Comment: Interesting. You may be right in guessing that the OP misunderstands "radio" activity...

Radioactivity features


What exactly is the mass of a body? What determines it?

Question: The term "mass" is very common. But what does it depend on? How is it known?
Answer: In classical physics mass has two definitions:

It measures the amount of inertia that you have. In order to accelerate something you have to apply a force to it. The heavier your thing is, the less it will accelerate,
$$ a = \frac{F}{m} \, .$$
If you know the force and can measure the acceleration, you have access to the mass.
In the physics of gravity, the mass is the gravitational charge. Just like charged particles exert a force on each other that is proportional to the product of their charges, two massive particles attract each other with a force that is proportional to the product of their masses,

$$ F = m_1 m_2 G /r^2 \, .$$
What is fascinating about this (and lead to the discovery of general relativity) is the fact that these two definitions coincide. Inertial mass and gravitational masses are the same!
Answer:
What exactly is mass?

My answer will encompass four very different regimes each separated by a factor of 1027. I'll first look at things on the order of 10-27 kg, then 100 kg (1 kg), then 1027 kg, and finally 1054 kg.
Mass at the scale of 10-27 kg
This is the domain of atoms and elementary particles. A proton has a mass of 1.672621777×10-27 kg, to within a relative uncertainty of 4.4×10-8.
Physicists and chemists rarely use kilograms when looking at masses at this tiny scale. They instead use energy or atomic mass units. In terms of energy, the proton mass has a mass-energy equivalent of 938.272046 MeV (million electron volts), with a relative uncertainty of 2.2×10-8. In terms of atomic mass units, the proton mass is 1.007276466812 u, with a relative uncertainty of 8.9×10-11. Note the two to three order of magnitude improvement in precision when looking at mass as a ratio versus mass as energy versus mass at the ordinary human scale.
Another ratio of interest at this scale is the ratio of the mass the alpha particle to that of a proton. This is 3.97259968933 (unitless), with a relative uncertainty of 9.0×10-11. Note that this is less than four. A neutron is slightly more massive than is a proton, and an alpha particle comprises two protons and two neutrons. So how can the mass of an alpha particle be less than the mass of four protons?
This mass deficit gives a big clue with regard to what mass is: Mass is bound energy. In the core of our Sun, four protons combine via a chain of reactions to eventually create alpha particles. In the process, the mass deficit of about 0.03 proton masses per alpha particle is converted into photons and neutrinos. It's the photons released by that p-p fusion process that keeps our world warm.
Mass at the scale of one kilogram
This is the domain of cells (about 10-12 kg) to the total mass of humanity (about 1011 kg). We use three approaches to measure mass in our everyday, ordinary:

By weight (e.g., a spring scale),
By comparison with an object of a known mass (e.g., a balance scale),
By Newton's second law ($F=ma$).

The first two approaches work only because all objects fall at the same rate. This means that the mass in Newton's second law ($F=ma$) and the masses in Newton's universal law of gravitation ($F=(Gm_1 m_2)/r^2$) are one and the same. Galileo was the first to carefully observe this fact.  This equivalence of gravitational and inertial mass has long been a mystery. It is an observed fact. It's an implicit assumption in Newtonian gravitation, and an explicit assumption in Einstein's general relativity. The universality of free fall is one of the key tenets of Einstein's equivalence principle.
Mass at the scale of 1027 kg
This is the domain of medium-sized asteroids to supermassive black holes. At this scale, gravitation is by far the dominant force. Astronomers observe how things interact gravitationally. They don't observe mass. They instead observe an object's gravitational parameter, the product of Newton's gravitational constant $G$ and mass $m$. Astronomers know the Sun's gravitational parameter to greater precision than physicists know the mass of a proton in atomic mass units.
What about mass?
There's a problem here. Newton's gravitational constant $G$ is one of the least well-known physical constants. It is known to a paltry four decimal places of precision. Expressing large masses in terms of our everyday, ordinary International System of Units is not a good idea. Since the gravitational parameter of the Sun is known to such a high degree of precision, astronomers use the solar mass instead of the kilogram as their gold standard.
Mass at the scale of 1054 kg
This is the scale of galaxies to the observable universe. Here there even bigger problems than relating mass on the atomic or stellar scale to mass on a human scale. On the galactic scale, the mass inferred from observed light (and hence stellar masses) doesn't match with the mass inferred from observed velocities. The way galaxies rotate doesn't make sense if one only considers mass inferred by light coming from galaxies. This is the galactic rotation problem. There are very few ways out of this problem:

The model of gravitation is fundamentally broken at these large scales, or
There's a lot more ordinary matter that astronomers can't see than is expected, or
There's some unknown kind of matter that is far from ordinary.

The second option has pretty much been ruled out, at least a complete explanation. The first option is fringe science. Most physicists and astronomers think that the third option is the right answer. That unknown matter is called dark matter, for two reasons. One is that it is dark; it doesn't interact electromagnetically (it doesn't absorb or emit light). The other is that whatever it is, it is beyond the standard model of physics. "Dark" in this context means "it's a mystery, at least for now."
On an even larger scale, galaxies that are far removed from one another are moving apart from one another (this is the Hubble expansion) and the rate at which they are doing so is increasing. This latter fact is a fairly recent discovery, and its origin is even more mysterious than dark matter. This is dark energy. What it is, no one knows.
Summary
A number of challenges remain for future scientists to solve regarding mass-energy.

Doing a better job of relating the atomic scale to our everyday, ordinary world.
This is an ongoing effort. The ultimate goal of this program is a complete revamping of the International System of Units, with the elimination of the International Kilogram Prototype ranking as one of the highest priorities.
Doing a better job of relating the solar system scale to our everyday, ordinary world.
This too is an ongoing effort, but improvements have been very slow. There has only been a two order of magnitude improvement in the precision of $G$ in the 218 years that have transpired between the Cavendish experiment and now.
Explaining the equivalence of inertial and gravitational mass.
This is one of the goals of multiple programs that are attempting to merge general relativity and quantum physics. There have been some partial successes in this regard, but also a lot of non-successes.
Explaining dark matter and dark energy.
The standard model of physics doesn't explain either of these. A number of hypotheses that go beyond the standard model have been proposed, but these have either been falsified or are unobservable at any humanly-conceivable energy level.
Answer: What is physics? Physics is the modeling with mathematics of observations in the world around us. It is a way of creating a logical sequence that can be predictive  and not only explanatory. It reduces the innumerable constants one would need to describe, for example , the trajectory of a ball with just space coordinates, to a simple parabolic function that can be used to give any one of those space coordinates.
To do this, find mathematical functions, it needs some basic assumptions, postulates, gleaned from the observations of falling apples and shooting arrows. These functions are described in the other answers. It was found that a unique mass assigned for each object allows a mathematical description of gravity with what is known as Newtonian mechanics.
We describe our observations within a system of units. Take the International system of units. It is  the MKS, Meter, Kilogram Second . It defines the basic numbers for three independent postulates, that distance exists, mass exists and time exists. These are postulated in order to be able to model nature with mathematical functions.

But what does it depend on? How is it known?

Mass is a number unique for every physical body so that the mathematical model of Newtonian mechanics can describe and predict its position and reactions with the appropriate formulas . This number is measured by use of the formulas as explained in the other answers.
When physics started studying the microcosm of molecules atoms nuclei and particles the postulates were carried over , the mathematical descriptions of observations became much more complex, and still, each particle is assigned a mass measured and tabulated so that the mathematical models in use are descriptive and predictive of future behavior.
Answer: Since your tags are "newtonian-gravity" and "mass" I will attempt to answer this question in  a classical framework. In classical mechanics, mass is essentially defined as a measure of an object's inertia.
Let me explain further. We have Newton's second law
$$F_\text{net}=ma$$
which is assumed to hold for all objects in classical mechanics. Suppose we apply a force of $1000\,\mathrm{N}$ to two objects. One is light, $m_1=10\,\mathrm{kg}$ and the other is heavy, $m_2=1000\,\mathrm{kg}$. Then the two objects have different accelerations ($a=F_\text{net}/m$)
$$a_1=100\,\mathrm{m}/\mathrm{s}^2,\quad a_2=1\,\mathrm{m}/\mathrm{s}^2$$
So the object that has more mass is harder to accelerate, i.e. has more inertia.