Is it possible to go from code to circuit?

Question: I am wondering if it is possible to have a program that interprets programming code and is capable of turning that code into an optimized circuit. Is this possible, and if so, does it exist?
Comment: I was looking for a way to make specialized hardware for simple programs that do heavy calculations.

A good example would be a raytracer or hash algorithm.
Comment: The [Wikipedia article "C to HDL"](http://en.wikipedia.org/wiki/C_to_HDL) might be of interest.
Comment: At present I think the question is too broad and thus not likely to yield an answer that is useful to you.  Can you narrow down your question?  Why do you ask?  What problem do you face that has prompted this question?  Is there a specific program you want to compile in this way?  A specific programming language?  Why do you want a circuit, and what do you plan to do with the circuit?
Comment: Ahhh.  Yes, Paul Clayton's suggestion is a good one.  You can also find work on compiling systems code (e.g., C code) into a form that can be executed on a FGPA, which is in a very similar vein.  However, you might find that you get better performance by implementing the algorithm by hand in AHDL/VHDL, than by compiling from C code -- you'd have to experiment to be sure, but that's my guess.
Comment: A ray tracer is by no means a simple program ! I doubt that specialized, programmable hardware (FPGAs) would be a good solution. Better use a GPGPU.
Answer: Yes, it is certainly possible.
There are compilers that will compile from code to circuits.  Classic examples would be VHDL or AHDL compilers, but you can certainly do this for any other language, to the extent that you have an upper bound on the running time of the program or that you have an upper bound on the memory use of the program and are willing to have a circuit that contains stateful elements.
In fact, you can walk down to Fry's and buy something that basically has the form you asked for: it's called a computer.  That's more or less what a computer does: it takes code written in a programming language and executes it efficiently, using an optimized circuit.  The circuit is fixed (it is the gates in the processor) and part of its input is data that depends upon the program you are executing (which is stored in the RAM of the computer).  However, you could consider this a larger circuit where part of it is hardcoded (i.e., the program part of the input is hardcoded); then you can view a computer running a program as a big circuit with part that is universal and identical for all programs (the gates of the processor) and part that depends on the program (the hardcoded input), and this immediately gives a mapping from programs to circuits.  The mapping is implemented by a compiler.
Comment: @ShashankVM, you're right, that wording was poor.  I tried an edit; see if you think it is any better or not.  Maybe you can help me express this more clearly.
Comment: Part of the circuit is data? Sorry but this answer does not make any sense to me. A circuit's inputs are certainly not a part of it.
Answer: there are different ways to interpret your question but based on comments (incl yours) some of this may be helpful. there is a lot of research in converting higher level programming constructs into FPGAs, field programmable gate arrays, basically hardware where circuits are dynamically reconfigurable. (aka reconfigurable computing).
there is also a special language eg "C for FPGAs", a subset of full C, that is customized for this purpose.

C for FPGAs Williams/ Dr Dobbs
FpgaC / Wikipedia

as for getting efficient circuits for particular programs, that is another area of research/ optimization eg circuit optimization/ minimization/ compression. there are also optimization heuristics built as input preprocessors into most SAT solvers. more generally this is known as logic optimization and there are various techniques/ tools for that. also the general theory/ application of optimizing compilers has some overlap with circuit optimization. one simple, near "toy" example or model of a compiler optimization in some cases is short circuit evaluation. the general area you refer to is also an active area of research both theoretical/ applied & there are many related papers on the subject.
Answer: FPGA code is just another kind of code, and it's convertible.
I guess if you're making a real machine, it could be written in C, but I'm doing one now and I'm just using sub-procedures in place of the electric modules, and it seems to be like it could work, and you can even do it on the GPU to get that awesome speed out of it.
The variables are the same between gates and code.
The variables just mark where the gates are linking and it perfectly converts (you just do them as normal), FPGA code is probably the same and does this I bet!
Just using the C code directly to make a circuit I'm not doing but its close if it works or not,  but I'm talking about handcrafting the code to make it easily convertible works, and makes the conversion process less of a headache.
If you use a virtual machine to run it, it goes slower,  it's best if it's direct code what you're running 'cause then you can get more out of your computer, when you're debugging what's going to be the final circuit.


Conduction band and free electron confusion

Question: When an electron is said to be in conduction band is it completely detached from the atom to act as free electron  and conduct electricity as per free electron sea model?Do a jump from valence to conduction actually imply ionisation of atoms?Please clarify me about conduction band.
Comment: From a solid state physics perspective (including semiconductor physics), both the valence band(s) and the conduction band(s) are bands of the crystal structure - the wave functions extend through the crystal and are not associated with any single atom, only the crystal.  This applies to semiconductors, insulators, and metals equally.
Comment: Why don't you add answers? I always see you writing comments.
Comment: It is not a **free** electron because it is still confined to the material. It's a free electron in the sense that it can move around within the material (Crystal). So it is not ionised. If it were ionised then the material would have net positive charge.
Comment: @user3518839 What do you mean by positive charge on material?How can there be a positive charge on the material as whole when there is no loss of electrons involved.
Answer: In crystals the bands are formed from the atomic orbitals mixing with each other so as to make (by level splitting) new energy states that, instead of being localized around atoms, are spread over the whole crystal. In individual atoms there's an infinite number of energy levels between which an electron can transition when its atom is excited.
Ionization of atoms involves getting at least one electron of an atom to an energy corresponding to unbounded motion. The smallest energy level which an electron must get into to make the atom ionized is known is the vacuum level. If an electron is excited from e.g. $2s$ to $4p$ level, it still remains bound, so it's not ionization.
When you bring many atoms closer together, so that their discrete levels start splitting, one of the former energy levels splits into the valence band, and another into the conduction band. And there are still lots of (formerly discrete) levels above these bands, each of which is also split into some band. The energy state corresponding to the vacuum level also splits into a band, top of which is now the vacuum level of the crystal.
Now, excitation from the valence band into conduction band is analogous to excitation from one bound state to another, like the above mentioned example of $2s\to 4p$. And ionization is getting an electron to the vacuum level of the crystal. This means that such an electron can leave the bulk of the crystal and never return back, unlike the electrons in conduction or valence bands.
Answer: The electrons at the bands are not free. What happens is that their wave functions  can't be adequately described considering only the Coulomb potential of one nucleus. But they can't also be adequately described as a free particle. In a way their wave function combine both situations. According to Bloch's theorem:
\begin{equation}
\psi(\boldsymbol r) = u(\boldsymbol r)e^{-i\boldsymbol{k.r}}
\end{equation}
The first part is a periodic function with the periodicity of the lattice. The electrons are more probably found around each nucleus due to it. The exponential represents a free particle.
So the atoms are not ionized because the electrons are there around.
Instead of thinking of atomic orbitals as 5s for example for each atom, think of all electrons from such orbitals belonging to a crystal orbital, called band.
Answer: First of all you have to take into account that the quantum description of electrons in a solid is at a great extent quite far from everyday life physical intuition.
Moreover, the one-particle description of electronic states is just an approximation of the many-body electronic wavefunction which puts all the electrons on the same foot (accordingly to their indistinguishability).
With these warnings, the Bloch's description of the one-electron states corresponds to delocalized wavefunctions for all the states (even for core states).  However, one has to take into account that Bloch's description of the energy bands is not unique. An alternative description in term of the so called Wannier's orbitals
is available and allows a more meaningful description of the localized character of electronic states.
Even without goingg to Wannier's picture, more physical insight can be gained by observing  that only partly filled bands contribute to electric conduction. Therefore in a  metal only the conduction band allows a non zero electronic current. In this sense electrons in conduction band can be considered free to move as soon an external field is applied. Notice that this does not imply that their wavefunction is the free particle wavefunction. Presence of nuclei and of other electrons in lower lying filled bands does contribute to modify the wavefunctions from the simple plane wave form. So, success of free electron model to describe electronic properties of a few simple metals (usually, s- or p- bonded metals) does not imply that in these cases electrons really behave like plane waves. For a complete agreement with experiments it is necessary to take into account the exact form of the electronic orbitals.
About considering a jump from valence to conduction band as an ionization process, it is attempting to use the analogy and sometimes it is possible to find descriptions along this line, although, strictly speaking, it is plainly wrong: it is as if in molecular physics one would speak about ionization to describe any electronic transition to excited states.


Is it possible to live as a skeleton?

Question: I'm designing a world that takes place in life after death. This place is like a parallel to our world, a worse version of it. Everybody here is a skeleton, their consciousness are loaded in their heads and if their heads (eyes and mouths) crumble, they will fall into an infinite space. So I'm wondering is it possible to live as a skeleton normally? If it isn't, what would be the closest scientific explanation?
Comment: I'm not sure how you expect skeletons to *live* given that they are literally just support for life but really have no connect to living.
Comment: You mention eyes but if they are a skeleton do they have any organs at all? Do they even have a brain and if not where is their consciousness being loaded?
Comment: You might want to consider giving some more details about your world, such as magic or superscience. Since you want for there to be living skeletons, you must be thinking of some ways they can exist. It would help others in answering your question if they know more about the world.
Comment: @VLAZ: Bones are living organs while their possessor is alive. The skeleton only dies when the rest of organism dies. Bones are not inert non-living structures.
Comment: If life after death is possible, why do you need a scientific explanation for why skeletons can live without organs? Some context about why there's life after death may help provide a framework that gets more specific about the magic - or science - of your world.
Comment: Related (but not necessarily a duplicate): [Is there really no realistic way for a skeleton monster to move around without magic?](https://worldbuilding.stackexchange.com/q/143420/62341)
Comment: Please note connective tissue is called connective tissue for a reason. Your skeletons need some way to keep themselves together. But I'm sure you know that.
Answer:
So I'm wondering is it possible to live as a skeleton normally?

No, for a lot of reasons:

bones alone won't hold together and the skeleton would crumble to pieces in the blink of an eye. Which based on your description is leads to the infinity.
bones alone can't perform any metabolism: they can't exchange gases, they can't allow the flow of blood, they can't digest food...
bones alone can't move
bones alone can't process any information (kudos @Philipp)

You can only explain it with magic.
Comment: Also, bones don't have muscles, so they can not move on their own. And skulls don't have neurons, so they can't think. Yeah, you do gonna need a lot of magic for this to happen.
Comment: @notworkingonit the closest scientific explanation is to build some artificial body that somehow houses the consciousness of the deceased. Let's say we have some tech to scan a brain and re-create it, so it continues thinking. You put that replica (be it flesh or metal) in some automaton that can move around (be it flesh or metal, again). Now take some duct tape and attach the bones of the deceased to the contraption.
Comment: Bones do have some metabolism, they regulate blood pH by releasing or fixing calcium ions. They are also living tissues and regenerate if damaged. Finally AFAIK white blood cells are made in the marrows. Otherwise the answer is pretty solid.
Comment: So there also aren't any way, like an action for it to happen? or like a machine to make it work? Then what could be the closest scientific explanation?
Comment: The biggest one is "no source of energy". No digestive system, no food, no energy, no motion, just death.
Answer:
If it isn't, what would be the closest scientific explanation?

The skeletons are artificial, and actually are complex robots which have a human conscious (somehow) transferred into it / are piloting it remotely. That's the closest plausible explanation you can really get.
Comment: Terminator T-100 skeleton smoking cigarette and saying "Man, this living, this living is not living".
Answer: Yeah, skeletons, unless you mean something else by that word, are not going to be alive on their own.
Some alternatives (aside from magic and synthetic life):

They are some humanoid animal with no or little fat tissue, pale skin, no hair, and very fragile. They are no skeletons by any account (they have all their vital organs like any other animal), yet, they could give that impression to an ignorant observer. Fully black eyes and some teeth sticking out could help sell the impression. Without hair or fat, these animals are going to suffer a lot from temperature changes. Perhaps they have an exoskeleton?
The world is a simulation, and everybody appears as a skeleton because that is how the world is programmed, motivations unknown. There could be no way for these people to get out of the simulation, in fact they may not know they are in a simulation (which, I guess, would mean physiological understanding is a nonstarter in that universe). If you are going to use this argument, then it got to have some plot relevance, or it will come out as laziness (because you could just call it magic instead inventing a simulation plot that goes nowhere).
Answer: No it wouldn't be possible live normally as a skeleton. Not in the quotidian reality we inhabit.
The closest scientific explanation is this is the afterlife and supernatural forces are at work here. A fact confirmed by observation: a posthumous life as skeletons and all the falling through infinite space.
Much science is based on observation and the formulation of tentative hypotheses to explain those observations. A lack of academic and professional research institutions in the afterlife will not enable much in the way of further advancement of the scientific explanation proposed above.
I am assuming enough of the conscious skeletons will remember they have died.

Is it possible to live as a skeleton?


Reverse shell using XSS

Question: If a certain web application is vastly vulnerable to XSS attacks, is it possible for the attacker to gain a reverse shell using an certain XSS payload without uploading any mallicous files to the web server? or should the owner of the web server only worry about the vulnerability impacting the end users of the web application?
Comment: Try to understand that XSS happens entirely on the client. An XSS payload has an effect on the user (in their browser) but it in no way implies that the server itself is vulnerable.
Comment: There is no way that I know of to get a shell with only an XSS vulnerability. Typically the XSS vuln is the first step in the kill-chain, but you'd need to have another vector to attack to get RCE.
Answer: The answer is no... at least not how you're thinking of it working.  XSS attacks actually happen on the client's browser.  You could use an XSS to attack the site administrator.
I mean, theoretically, the answer is yes, but not as you likely envision it happening.  There are a lot of IFs involved, but only if you could store a XSS attack on that web application; if victim has disabled their client's default security controls and allows the browser to make calls back to a server you control. However, the default controls in place in modern browsers that would likely prevent this from being successful.
That said, this is basically one of the methods drive-by malware is delivered.  Target users with administrative privileges and you gain access to their machines.
You don't need a full reverse shell to compromise the application.  If you know the application well, your XSS attack, could in fact be a CSRF attack that targets admin user rights to perform administrative actions on the server on your behalf.
Answer: You can not gain reverse shell only by performing XSS attack. But that same attack can be done on the owner/admin of that website or server.
Here is an example OWASP XENOTIX XSS EXPLOIT FRAMEWORK V3: XSS Reverse Shell.

Reverse shell using XSS


Combining the Human Bonus At-Will Power option with Essentials classes

Question: As a Human Hunter with the Bonus At-Will Power option, can I take Twin Strike as an at-will power?
Answer: Yes.
A Hunter is a type of Ranger, and the Twin Strike power is a Ranger at-will power. Hunters do not normally have any choose-able at-wills they can take Twin Strike with, but a human with the extra at-will can acquire Twin Strike that way.
You are correct that you are allowed to choose the extra at-will rather than take Heroic Effort, even if your character is an Essentials class. From PHB1 errata (warning, PDF!) p46:

When playing a human you can now choose between taking a bonus at-will attack power from your class or gaining the Heroic Effort racial power.
Answer: Maybe.
After some research, it appears that using the rules-as-written, you technically probably could.
A New System
However, even if the designers of Essentials were required to make it technically backwards compatible with the Player's Handbook (PH) character creation rules, they didn't make much of an effort and it's clear that the Essentials rules are intended to be a new character creation system with new mechanics.
Those new mechanics involve asymmetrical classes which gain different numbers and types of features and powers at each level. As part of this, not all classes have a long list of At-Wills to choose from at level 1, and therefore the PH's Human Bonus of an extra 1st-Level At-Will no longer makes sense. The designers recognized this, and introduced a new version of the Human with a racial ability called Heroic Effort to replace the At-Will.
Therefore, since you don't get an extra at-will, you can't take Twin Strike.
But Still the Same Game
That being said, Oblivious Sage has referenced errata published for the PH which is intended to take the Essentials rules into account, and could be interpreted as allowing you to stick with the extra at-will, even if you're creating a Human using an Essentials class. In which case, yes you can take Twin Strike.
Just Ask the DM
Different DMs might approach the interaction between the original PH character creation rules and the Essentials character creation rules differently. Just ask your DM and do whatever he says.


How did water get on Earth

Question: I recently read that water more than likely got here by comets (carrying water) hitting the Earth. However it also it says the impact of a comet hitting the Earth is much greater than an atomic bomb. So if comets brought water to Earth how was it not vaporized when the comet hit the atmosphere or in the massive explosion when it hit the Earth itself?
Comment: In order for Earth's gravitational field to keep most of the vaporized gas, the rms velocity of the water molecules shouldn't exeed [roughly 1/6 of Earth's escape velocity](http://astronomy.stackexchange.com/questions/10256/gravitational-pull-needed-to-keep-a-gas-in-atmosphere/10258#10258). This corresponds to a temperature of ~2500 K. A quick [Google search](https://www.google.dk/#q=temperature+of+meteor+impact&start=10) gives me a couple of popular sources saying that the temperature of a meteor impact is ~2000 K, so it seems that the water vapor would stay in Earth's atmosphere.
Comment: This number of 1/6 you're citing is only valid if the whole atmosphere has the temperature. In case of a hot plume of this temperature launched in the troposphere, this will be easily trapped in the lower atmosphere, and can maybe wirl up dust higher up, like we know it from volcanic eruptions. However like @Rob-Jeffries said, it's important how fast the plume cools.
Comment: Well, of course the water would have been vaporized on impact. The result is water vapor, which eventually becomes rain.
Comment: @pela: I think we can leave it be, as a little discussion is sometimes illuminating, as in this case too.
Comment: Seems a perfectly sensible question to me. If you have a very hot gas it would escape the Earth's gravity nonetheless. The question is how hot or can it cool quickly enough as it expands.
Comment: Ah, thanks @AtmosphericPrisonEscape. Good point. Should I delete my comment, so as not to confuse readers, or should I let it be?
Answer: The key finding why we think Earth's water came from Asteroids (big rocks) and not Comets (small rocks) is the Deuterium/Hydrogen ratio that we can measure in several sources.
When a star forms, it has an initial value of D/H that came from the nucleosynthesis in its progenitor nebular / star.
In a protoplanetary disc, as dust grows to rocks grow to planets your nebular gas will be trapped with initial D/H ratios in gas giant atmospheres. But the way to get Water onto Asteroids and Comets (those don't have substantial mass to retain atmospheres themselves!) is sublimation and maybe adsorption.
The latter two processes are strongly sensitive to the gas-mass and therefore different D/H ratios from the protosolar ones are expected.
And in fact we find them to be different:

This was in the news lately, as ESA managed to touch down and measure 67P's D/H ratio which gave another hint on the asteroidic origin of water on earth.
This finding, however does not resolve the question:

There maybe other isotopical tracers like D/H that give a hint on the history of water.
There could have been a decrease in D/H and subsequential increase again, or the other way round.
We know that the protosolar nebula must have had massive amounts of water (Oxygen is the third-most abundand element in normal stellar fusion!), so again the question is, why did Earth retain so much water, while the lighter planets Venus and Mars retained the heavier element $CO_2$
...

I could continue this for quite some time, but the bottom line is: We only have hints, not definitive answers.
To refer to the rest of your question: A hot plume in a colder atmosphere will not necesarily leave the whole gravitational potential well.
Answer: I don't believe there is factual answer just yet, though many solid theories. Here are some sources I've found to be helpful. I don't necessarily have an opinion myself and while certainly everyone is entitled to one, I wouldn't put too much stock in any one source of information.
It was "always" here:
http://news.nationalgeographic.com/news/2014/10/141030-starstruck-earth-water-origin-vesta-science/
Comets:
http://space.com/27969-earth-water-from-asteroids-not-comets.html
Meteors:
http://youtube .com/watch?v=_LpgBvEPozk
ps: had to break the links due to reputation. :/
Comment: To note: Stack Exchange prefers answers to be self-contained. It's ok to post links to your sources, but a good answer also includes a summary of the content so that if the links die, the answer is still useful as an answer.

How did water get on Earth


Is there a global setting to enable/disable all devices from waking the computer?

Question: I have discovered a newly installed device preventing a power transition (namely, sleep) from taking place on my computer. I would not like to have to manually disallow all devices from causing my computer to wake. Is there a way to globally disable all devices and their drivers from preventing sleep in Windows 10?
Answer: It might be helpful to use the command prompt to find what devices have the ability to wake the computer.
Run the command prompt as an administrator and type in powercfg devicequery wake_armed.  This will report back a list of the devices with the ability to wake your computer.
You can disable the devices by typing in powercfg devicedisablewake "deviceNameFromList".  Use the up and down arrow keys to cycle through the commands to make this faster.
Comment: This does not answer the question. Moreover, the wake-requesting device is not visible under `wake_armed` (it is actually visible only  under `wake_from_any`
Answer: I don't know of one, no.
However, this program makes it very easy to enable/disable the waking for individual devices: https://superuser.com/a/1147093/231129


Can XSLT render MVC ASP.NET Controls/Code?

Question: Is there any way to render ASP.net MVC controls or code directly within a XSLT/XSL transform file under the .NET Framework? If so can you provide me with a sample or link?
Answer: I'm reading a great ASP.NET MVC book by Apress:
http://www.amazon.com/Pro-ASP-NET-Framework-Steven-Sanderson/dp/1430210079
In Chapter 10, there is a section called "Implementing a Custom View Engine", which shows you step by step how to implement an XSLT view engine.  Its actually pretty simple (wish I could post it, but don't want to violate copyright).
I highly recommend this book to anyone (I bought and downloaded the e-book on their web site), the author really explains things well.  ... OTOH, I recommend you avoid those red books with the authors' mug shots on them... unless you like books that consist mainly of screen shots and code dumps, with little effort on explaining concepts clearly.
Comment: Thank you sir, my co-worker has this book and I shall give this chapter a read :).
Answer: Although this is possible (use the same strategy as you would with html, but harass VS frequently to make it work, and use raw text outputs for anything that XSLT is too stubborn to touch), this is almost definitely not what you actually want to do.  Even if you already have XSLT for generating html documents, this strikes me as a bad idea.  Instead, you should try searching for "Asp.Net Data Binding XML."  You'll find results like this, which will probably give you considerably better and more maintainable results.
Comment: Yeah, I would avoid it too in a real project anyway... I am just interested in seeing in how this is implemented. Currently I am just passing in param's via asp.net and it works fine. thanks though


How to change the campaign completion point?

Question: I had to rebuild my game machine a month or two ago.  When I reloaded Steam and reinstalled Supreme Commander 2, my campaign status was reset back to the first mission.  I don't want to replay all of the missions.  How do I fix the status to be back to mission 12 or whatever one I had completed?
Answer: The current status of the campaign is stored in the Game.prefs file.
It is located in $USERPROFILE\AppData\Local\Gas Powered Games\Supreme Commander 2\
Before doing this, make a copy of that Game.prefs file and save it somewhere. Just in case you screw it up, you can replace the screw up with the old copy.
If have played any of the campaign missions and either completed one or failed at it, not if you quit playing it, your Game.prefs file will have a 'campaign = { }' section in the profiles block.  Just search for it.
It'll likely look like:
        campaign = {
            UEF = {
                SC2_CA_U01 = {...
                }
            }
        }

To complete all of the UEF campaign missions:

Just copy the entire SC2_CA_U01={ } block.
Then paste it right after that }, putting a comma between them.
Remove the completedObjectives list from that copied block, but leave that completedObjectives block itself there.
Change the SC2_CA_U01 to SC2_CA_U02. (or a number from 1 to 6)
Repeat for each of the 6 UEF missions.

To complete all of the Illuminate missions (starting with a completed UEF missions block):

Find the end of the UEF={ block.
Put a comma after it.
Paste a copy of the entire UEF block after the comma.
Change UEF to Illuminate.
Change all SC2_CA_U0x to SC2_CA_I0x where x is the mission number.
Make sure all completedObjectives lists are empty.

I haven't tried to do the Cybran missions yet, but I suspect following the Illuminate instructions but replacing SC2_CA_I0x with SC2_CA_C0x and replacing Illuminate with Cybran might work.  To know for sure, just play the first Cybran mission.  Once you complete it, the Game.prefs file will contain the keys you need.
You can do this in baby steps.  After making a small change, reload the game and see if the campaign menu allows you to select newer missions.  If it didn't work, either the game will make a copy of the Game.prefs file and name it Game.prefs.bad and make a new blank one or it will just ignore the change.
Answer: If you no have old files of the game is impossible to recover your game.
The only thing I can think of is that you download a file using the game 100% and continue from where you were going.
http://grandtheftauto.filefront.com/file/100_Complete_Save_Game;43034
Comment: I have save games but the problem is that at least one of the last patches makes the save games unreadable.
Comment: oh, sorry.  I didn't realize you were suggesting that I load a completed game from someone else.
Comment: Your link is for a completely unrelated game.


What is the standard(or correct) way to use UIManagedDocument in core data

Question: I am learning iOS via Standford CS193P, I met a problem in core data part.
I am trying to build an app using core data, I create a category for the AppDelegate(I will create a UIManagedDocument in didFinishLaunchingWithOptions), this category implement one method to create a UIManagedDocument and return it to the AppDelegate, so that I can call self.managedDocument = [self createUIManagedDocument] to get one:
<code>- (UIManagedDocument *)createUIManagedDocument
{

    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSURL *documentsDirectory = [[fileManager URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] firstObject];
    NSURL *url = [documentsDirectory URLByAppendingPathComponent:APP_NAME];
    UIManagedDocument *managedDocument = [[UIManagedDocument alloc] initWithFileURL:url];

    if ([[NSFileManager defaultManager] fileExistsAtPath:[url path]]) {
        // If the file exists, open it
        NSLog(@"File exists, not opening...");
        [managedDocument openWithCompletionHandler:^(BOOL success) {
            NSLog(@"File opened.");
        }];
    } else {
        // If the file not exists, create it
        NSLog(@"File not exists, now creating...");
        [managedDocument saveToURL:url forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success) {
            // If the file create succesfully, open it
            [managedDocument openWithCompletionHandler:^(BOOL success) {
                NSLog(@"File opened.");
            }];
        }];
    }
    return managedDocument;
}
</code>
After the UIManagedDocument creation, I am trying to pass this UIManagedDocument to my view controllers using:
<code>RootViewController *rootViewController = (RootViewController *)self.window.rootViewController;
rootViewController.managedDocument = self.managedDocument;
</code>
And the problem occurs, I am unable to open the UIManagedDocument in my view controllers. I searched it for a whole day and got the answer: I was trying to open it twice at the same time while it is asynchronous, it takes time to process the IO request. There are some approaches, and most of them using Singleton.
Here is my question:

Can I do this by using the approach above?
If no, what is the standard(or correct) way to create and pass this UIManagedDocument around my app?
Should I pass NSManagedObjectContext in this UIManagedDocument to my view controllers instead of passing UIManagedDocument?

Thank you for reviewing my question.
Answer: In the course, we are told to do this using notifications, he explains this in a demo in lecture 13 at 51:20.
Comment: Thanks Lorenzo! I am using MagicalRecord now https://github.com/magicalpanda/magicalrecord.
Comment: This is an answer - the question refers to a very specific online course (which both asker and replier are apparently taking), and pointing out that the explanation is provided in the course materials is quite useful.


Download file directly to a remote machine

Question: Is there any possibility to download a file to some remote machine which has ftp, ssh, nfs access. What I mean is that it doesn't have to go through the machine from which the download is issued.
Comment: This question does not make sense as-is.  Where is the file that you want to download?  How would you normally download that file?
Comment: Sorry, I kinda found the answer, but I don't know how to automate it. THe file is on the web, e.g., I saw that one could ssh into remote machine and then wget it. Of course, automate it from the browser.
Answer: if it has ssh, you can always ssh the remote machine, and execute the following command to download a file directly to that machine
wget <link_of_file_to_download>

for example, to download a tux picture whose link i know into a server of mine, i would do the following commands
ssh user@myserver
wget http://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/170px-Tux.svg.png

Comment: True, Sam, that is exactly the procedure. It would be great if that could be done ONLY from firefox!
Comment: there *might* be a plugin for firefox, tho i havent searched for one
Answer: In order to do what you're asking - download a file in a browser on machine A, but save it to a disk on machine B - you will need a network connection between machines A and B (which means a VPN, if they're not on the same local network) and then you'll need to mount a disk from machine B on machine A.
This last bit can be done with nfs, samba, sshfs, or any number of other ways.  We need more info before we can specify something more directly.
Comment: by doing that, even if the file is  not saved on computer A, the file still goes through computers A and B and if i understand correctly, the op wants to download it directly to computer B without passing through A
Answer: You could always use secure copy,
Uploading local file to remote server via ssh;
scp /source/of/file username@remoteserver:/destination/file

Downloading from a remote server to a local directory
scp username@remoteserver:/destination/file /source/of/file

Download from a remote server and upload to another remote server
scp username@remoteserver:/destination/file username2@remoteserver2:/destinatio/file2

Remembering you can also pass options if you would like to recursively upload/download a directory!
Hope this helped.


Finite T-uples and the axiom of Regularity

Question: Let V be the universe of sets (the class of all sets). Let U(0)=V, U(1)=V*V, the class that is cartesian product of the class V=U(0) with V, and for n>=1, let U(n+1)=U(n)*U(0);
For every natural integer n, let T(n)=U(n+1)/U(n) be the class that is the difference of the class U(n+1) and of the class U(n).
We are interested with the proposition (T): "For every member set x of V, there exists an unique natural number n such that x is a member element of U(n)."
Question 1: Let ZFC be our set theory; does ZFC prove (T)?
Question 2: Suppose that the answer to question 1 is YES, and let now our set theory be ZF-
(I mean, ZF with omission of the axiom of regularity/foundation); does ZF- prove (T)?
Question 3: suppose the answer to question 3 is NO; does ZF- prove the equivalence of (T) with the axiom of Regularity ?
Gérard Lang
Comment: Do you mean $T(n)=U(n)-U(n+1)$? Also, you haven't specified which encoding of ordered pairs you are using, but it would seem the answer might depend on it.
Comment: YES, I mean T(n)=U(n)-U(n+1); thank you very much !
I suspected the answers could depend of how to define ordered pairs, but was not able to clearly see that. So let's say we choose the classical Kuratowski (1921) definition; but the choice of the wiener definition (1914) should also be interesting.
GL
Comment: I think the way I was brought up, $V*V$ would come out to be $V$ again...
Comment: I thought that V*V would be the subclass of V containing all sets that are considered as ordered pairs, so that the singleton of x that can be considered as a pair, but not as an ordered pair (or couple) is a member of V, but not of V*V.
Gérard Lang
Comment: Gerard, I think you have a typo in the statement of (T), since you want x to be in a unique $T(n)$ rather than $U(n)$. (Also, the tag should be "set-theory", not "set" plus "theory".
Comment: Also, typo in question (3), since you mean to suppose there that the answer to question (2) is No.
Answer: Question 3 also has a negative answer (Joel Hamkins has already answered the first two questions).
The model $V(a,b,c)$ described in detail in my answer to an analogous question works here as well since $V(a,b,c)$ satisfies $ZF+T$, but not Foundation.
The reason that $T$ holds in $V(a,b,c)$ is similar to the reason that $S$ holds in the other question: any infinite descending epsilon sequence must eventually hit one of the elements $a$, $b$, or $c$, none of which is a Kuratowski-ordered pair (indeed, they are not ordered pairs in the sense of Wiener either).
Answer: One can show inductively that $U(n+1)\subseteq U(n)$, and so the $T(n)$ are the differences in the descending hierarchy; thus, the question (T) amounts to whether the intersection of the $U(n)$ is empty. As you indicated in the comments, let's suppose that you use the usual Kuratowski encoding of ordered pair. In this case, both $x$ and $y$ are elements-of-elements of $\langle x,y,\rangle$. (And for most of the encodings of ordered pair, $x$ and $y$ are both in the transitive closure of $\langle x,y,\rangle$, which is the critical point.)
The answer to question 1 is Yes. If a set $a$ is in every $U(n)$, then we may unwrap $a$, since it is pair $a=\langle a_0,b_0\rangle$, and $a_0=\langle a_1,b_1\rangle$, and so on, with $a_n=\langle a_{n+1},b_{n+1}\rangle$, and $a_{n+1}\in\in a_n$, meaning that it is an element of an element, and this violates the well-foundedness of the $\in$ relation, contrary to the foundation axiom.
Similarly to your other recent question, the answer to question 2 is No. This is because it is relatively consistent with ZF- that there is a set $x$ such that $x=\{x\}$; such sets exist under the anti-foundation axiom. Note that $x=\{\{x\}\}=\{\{x\},\{x,x\}\}$, which is the same as $\langle x,x\rangle$. So $x$ is in every $U(n)$, violating (T).
I don't know the answer to question 3, but I expect that a solution will similarly as in your other question, which seems more fundamental to me.
Comment: Oups! I made a small correction, but I now think you meant what you originally wrote...
Comment: Yes, I had meant what I wrote originally, since that is how I had conceived it, but your correction is also true, since x={x} anyway. So it doesn't matter! Indeed, we can nest in a few more layers of braces and it would be the same set!


Deciding between Umbraco and Orchard ASP.NET CMS

Question: Now that both system's are built on ASP.NET MVC, does anyone have any experience dealing with both? Looking to set up a small business site for a friend, that will eventually have an online store. I've read a lot of posts, but nothing recent ( since Umbraco 5 was released ). If you've had experience, just looking for pros and cons. Anything related to commerce functionality would be helpful as well. Thank you.
Answer: Orchard has been built from ground-up around ASP.NET MVC 3. I personally prefer that one, as it's well designed, very active and backed by Microsoft. And, of course, totally free.
If you are looking for e-commerce solution - there is a new, very promising module called WebShop, along with a full tutorial.
Comment: link is broken, is this the one we're looking for?
http://www.ideliverable.com/blog/writing-an-orchard-webshop-module-from-scratch-part-1
Comment: I totally forgot about that tutorial, indeed
Comment: I guess so, yes. I'll let Sipke know his old links are down - thanks for finding this out.
Answer: Orchard is very dynamic and u can build your site out of parts, a e-commerce module would be able to provide parts that can be rendered as partial views. Another custom module could inject other views in there. It's just very extensible and i like it. U can allow some access to the admin panel just for store administrators etc.
I don't know about Umbraco with ASP.NET MVC as base, but i know Orchard is from Outercurve Foundation which i like alot.
As far as i know there is just one real commerce module, but i don't know if it is any good
Orchard gallery - Mageliawebstore
Mageliawebstore directly
Comment: Another link http://www.magelia.org/
Answer: Hi Don't know about Orchard but Umbraco V5 is ideal for a small business. The reason that you don't read a lot of post recently is that the Architecture is completely new. Expect a lot of documentation in the coming month. But you can already start with the site you get a lot of info if you are using the create template dialog in the backend which renders some default code for you.
Regarding Ecommerce I know the Package vendors of UWebshop and UCommerce are already building next versions of their products on top of Umbraco V5 so expect a fully integrated Ecommerce solution soon.
Comment: Version 6 is a bit of a mess
Comment: Umbraco v5 has been cancelled since.
Comment: Version 7 just a re-skin
Comment: http://umbraco.com/follow-us/blog-archive/2012/6/13/v5-rip.aspx
Answer: This is a time-relative answer, but if you want an MVC based .NET CMS then your only real choice between the two is Orchard at this time. Umbraco 5 saw an early retirement so it's back to webforms, although as of 4.10 MVC support was bolted on and I believe there are some modules out there that give 4.x some MVC support as well. Orchard, on the other hand, is built on ASP.NET MVC 3 from the ground up and incorporates a handful of other cool technologies that make writing clean code that adheres to industry standard best practices easier.


How can we convert a captured IP address to a country location when importing lead info from an external form, like on Unbounce?

Question: We are capturing leads from our Unbounce landing pages, that have a Salesforce integration. Unfortunately they only provide the IP and we want to record the lead's country. How can we convert IP to country within SF?
Answer: You can download a country to IP database, such as one from iplegence, and use that to get the country for each record, or you could call a web service that provides that translation. There is nothing special in the IP address itself that tells you which country an IP belongs to.


Resolution - Why does an LCD TV look ugly as a monitor?

Question: I extended my desktop to my 32" Emmerson LCD TV and set my resolution to the native 1366x760 which is 720P but things still look "ugly".  The text is by far not as crisp as a monitor, however a 720p TV channel or movie looks fine.  Why is this?  Is it because the screen is physically too big?  What is the relationship between resolution and screen size.  720p looks good on a 32" TV, but what about a 60", 100", 1000000"?  Is there an upper limit to the physical size compared to resolution and that is why my monitor looks ugly?
Answer: TVs, unlike computer monitors, historically enable overscan by default – they cut off a few pixels from each border of the input, and zoom in the rest. For compatibility, they do this even for digital inputs like HDMI, though most of them have an option to turn this off.
Since the image is zoomed a little, input pixels no longer correspond to screen pixels, and text ends up being blurry.
Look for a setting called "overscan", "display area: full pixel", "dot by dot", "screen fit", or similar.

engadget: HD 101: Overscan and why all TVs do it
Answer:
What is the relationship between resolution and screen size?

Horizontal or vertical Resolution / DPI = Physical screen horizontal or vertical size in inches
Computer monitors used to have 96 DPI, but that's not true anymore. Monitors with greater DPI are made.
For a 96 DPI display, the size of a square pixel is 0.01 inches or 0.26 mm.
A 32 inches 16:9 TV has a screen size of 27.9 by 15.7 inches so its DPI is 1366 / 27.9 = 49 DPI. So a square pixel's size is 0.02 inches or 0.5 mm.
Comment: Both. A screen with a greater DPI will need a higher resolution picture at the same screen size.
Comment: Why does a movie look good on the TV then?
Comment: Your dimensions are for a 56-inch TV: a 32-inch TV is 27.9 by 15.7 - it would be a very strange world indeed where one of the sides of a rectangle was 50% longer than the diagonal.


Magento 2: after get qty its show zero always

Question: After get qty its show zero always Magento2
Comment: could you explain it more briefly ?
Comment: i need a qty of products i am using echo $_product->getQty(); to get but on all products its show 0 qty after getting
Comment: in some products i have more then 0 qty but its shows 0 on product page
Comment: i want to get stock of products
Comment: have you tried my below code?
Answer: Try below way,
echo $_product->getExtensionAttributes()->getStockItem()->getQty();

To get product qty in list page, for testing you can use objectmanager after finished testing create this method in helper/block and call that helper/block file from phtml(recommended).
$product_Id = $_product->getId();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$stockInfo = $objectManager->get('Magento\CatalogInventory\Api\StockRegistryInterface')->getStockItem($product_Id);
$stockqty = (int)$stockInfo->getQty();
echo $stockqty;

Comment: its working on just product detail page not on product listing page
Comment: Fatal error: Uncaught Error: Call to a member function getQty() on null in /var/www/html/roykon23/app/design/frontend/Magento/roykon/Magento_Catalog/templates/product/list.phtml:172 Stack trace: #0 /var/www/html/roykon23/vendor/magento/framework/View/TemplateEngine/Php.php(59):
Comment: try my updated answer..Instead of using object manager try calling it from custom block
Comment: yes its working thanks :)
Answer: Try below code - in your phtml file
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$StockState = $objectManager->get('\Magento\CatalogInventory\Api\StockStateInterface');
echo $StockState->getStockQty($product->getId(), $product->getStore()->getWebsiteId());
?>

** For coding standard keep objectManager in helper class.
Comment: this is shows 0  qty stock on all products on listing page
Comment: Avoid using ObjectManager instead get it through DI


The $r$-dimensional volume of the Minkowski sum of $n$ ($n\geq r$) line sets

Question: Let $n$ line sets be $\mathcal{S}_i=\{a\mathbf{h}_i:0 \le a \le 1\}$, for $1 \le i \le n$, where $\{\mathbf{h}_1,\cdots,\mathbf{h}_n\}$ is a vector group of rank $r$ in the $r$-dimensional Euclidean space. Define the Minkowski sum of two sets as $\mathcal{S}_1+\mathcal{S}_2=\{\mathbf{s}_1+\mathbf{s}_2:\mathbf{s}_1\in\mathcal{S}_1,~\mathbf{s}_2\in\mathcal{S}_2\}$. How to compute the $r$-dimensional volume of $\mathcal{S}_1+\cdots+\mathcal{S}_n$?
Answer: Let $M$ be the matrix whose rows are the vectors $\boldsymbol{h_i}$. Then the $r$-dimensional volume of $\mathcal{S}=\mathcal{S}_1+\cdots+\mathcal{S}_n$ is equal to the sum of the absolute values of the $r\times r$ minors of $M$. I don't know who originally showed this, but one can show that $\mathcal{S}$ can be tiled with $r$-dimensional parallelotopes whose volumes are the $r\times r$ minors. This follows for instance from the proof of Lemma 2.1 here.
Comment: Thanks for your explanation. This problem can be further extended as a new problem I asked several minutes ago.
Answer: The keyword you are looking for is "zonotope", which is defined to be the Minkowski sum of line segments. An early reference for zonotope is:  P. McMullen, "On zonotopes", Transactions of the American Mathematical Society, Vol. 159, 1971.
Following your notation, the $r$-dimensional volume of the zonotope $\mathcal{S}_{1} + ... + \mathcal{S}_{n}$ is equal to
$$\displaystyle\sum_{1\leq i_{1} < i_{2} ... < i_{r}\leq n} \big\vert{\rm{det}}\left(\mathbf{h}_{i_{1}},\mathbf{h}_{i_{2}},...,\mathbf{h}_{i_{r}}\right)\big\vert.$$
For reference, see eqn. (57) in "Combinatorial Properties of Associated Zonotopes" by G.C. Shephard, Canadian Journal of Mathematics, 1974. In that paper, there is an extra factor $2^{r}$ in front of the above expression since the line segments there are defined by $\{a\mathbf{h}_{i} : -1\leq a \leq 1\}$ instead of the OP's convention: $0\leq a \leq 1$. In the very end of this paper, Shephard credits McMullen for drawing attention to this formula. The same formula also appears as Exercise 7.19 in G.M. Ziegler, Lectures on Polytopes, Vol. 152, Springer, 2012; screenshot below:
Comment: I don't have access at the moment to the paper of Shephard, but presumably he is looking at line segments from $-\boldsymbol{v_i}$ to $\boldsymbol{v_i}$, not $0$ to $\boldsymbol{v_i}$. That is why there is an extra factor of $2^d$. If you take $\boldsymbol{h_i}$ to be the $i$th unit coordinate vector in Ryan Chen's question, then the zonotope is a unit cube of volume 1, not $2^r$. The matrix $M$ is the $r\times r$ identity matrix.
Comment: Sorry for essentially repeating Richard's answer, his answer came before I finished typing.
Comment: @RichardStanley: You are right, edited.


Can I use my iMac OS X Yosemite as a phone and phone system

Question: I am not happy with the capabilities of my cable service providers phone and answering system. Can my iMac take over with all the bells and whistles of a business phone system?
Comment: I dont't think so. You would need a SIM card and the iMac doesn't have a port for that. I am not sure if you can use another phone and it's SIM on the iMac with for example. remote connection.
Comment: Which specific bells and whistles of a business phone system are you looking for?
Comment: Skype sounds promising, but I am also looking for a way around buying a business phone system. we have two phone numbers and another one for the old fashioned fax machine. So The numbers need to Roll over - if I'm on the main number, someone call that number, it should roll over and ring on the second line. then it would have answering machine with separate accounts (i.e.: press 1 for steve, 2 for...) Hold, transfer, and conference. thats standard for business systems. I've heard and would love to call up notes from a clients last call. - I'm not asking for too much am I - ha ha
Comment: No you are not asking for too much. This is exactly the kind of scenario SIP PBX are here to solve. For a business phone system one or multiple SIP lines with a PBX even a very simple one will do the trick. You can also find phone standards which already have most of the features you want built-in. But for a proper installation with voicemail management and all I would recommend having a look at asterisk.
Answer: Yes you can do just that. You could use an SIP line. There are hundreds of phone companies which offer SIP phone services (also called VoIP). Some internet provider also give you the access to the SIP configuration so you can handle your calls the way you like.
Check with your provider if they use SIP for your phone line and if so they could actually let you manage your phone calls with your own software.
Then you would have to install one of the SIP apps to handle your calls and even configure the way your calls are redirected or answered depending on the time of day and other parameters.
A list of SIP server software is available on wikipedia. Asterisk is the most common one is free and quite full-featured. There is a host of visual interfaces to help you with the administration and operations of SIP lines through asterisk, you can also find entire distributions dedicated to asterisk.

If installing and configuring your own SIP setup sounds like too much trouble some providers will have many features like:

multiple phone numbers
multiple phone calls per number (incoming and/or outgoing)
auto forward
redirection after x tones
call transfer
conferencing
call monitoring
welcome menu: "Welcome to My Global Company. For department press 1..."
auto attendant: "If you know the extension of the person you would like to speak to, you can enter it now"
announcements: "Welcome to MGC. Please wait while we connect your call"

The level of service depends on the provider you chose. But the advantage of using a standard VoIP service is that you can move your setup to a new company, add lines from multiple companies and do whatever you like if you setup your PBX yourself.

If you want to use a normal phone there are SIP converters which can be installed between your internet provider's router and your phone. There are also full featured SIP phones.
Some phones let you use both, your normal land line and multiple SIP accounts, for example I use one similar to this one:

Other phones have a phone standard integrated which let you setup call redirections and other features.

There is also skype as already answered here.
They offer a very simple package but it is severely limited in comparison to an SIP installation.
There are multiple phones available to use skype like a normal land line (note: these are not compatible with the standard SIP protocol)
You can subscribe to a skype number to receive standard phone calls directly to your skype account. So people will be able to call that number without having to use skype on their end.
But when it comes to managing multiple lines or setups with multiple extensions skype is not made fo that.
Answer: Skype is one of the most mature VOIP systems, and very much OS X version independent.
The Telephone service it offers is superb at very reasonable pricing.
You do not need extra hardware, as it can be installed on your existing laptop and smart phones.

If you prefer old fashion phones you can heave that.
No special setups, or dealing with OS X. Just install Skype.
And if you feel like, you can have Video calling/conferencing calls as well.

No programing required as with other systems (SIP)

 What Do I Need To Know To Use Asterisk?
The Asterisk framework itself is built by developers for
developers. If you want to create applications and solutions with
Asterisk you will need a working knowledge of Linux, script
programming, networking and telephony.

Not that it is important or matter but Skype is owned and supported by Microsoft, so you can be rest assured it will be always updated.
For more specific features like call forwarding, voice messages, ect.. see Skype support
You might be also interested in "Skype for Business" version.
I found this 3 Years old article what it takes to set up SIP.


Oracle SQL Developer 4: how to tell under which user I connected

Question: I'm using Oracle SQL Developer 4 to connect to multiple databases at the same time, sometimes using different credentials that those saved in connection properties. So I have multiple tabs in main window labeled with DB names, but I'd like also have indication of under which account I'm connected (seems natural to have it in tab label/name).
Any option setting to achieve this? Probable I'm looking in wrong place or can do some query to check currently using credentials?
Answer: You could save multiple connections to the same db but with different credentials. Give them useful names like user@thisdb and you'll be able to view that in SQL Developer at a glance in the top right corner of the worksheet.
And my favorite part: if you need to run the same SQL as multiple users or in different environments or both, you'll find that the connection name in the top right corner of the worksheet is actually a dropdown list, so it can be changed on the fly.
Comment: +1 I don't have any experience with sql developer but naming the connections is the method that I use with other tools
Answer: Both the USER  SQL function and the  SYSCONTEXT SQL funtion return the name of the session user (example).
select USER,SYS_CONTEXT ('USERENV', 'SESSION_USER') from dual

The SYSCONTEXT, the UID and the USERENV SQL function can give you further information to your session.
Answer: You can check your environment with a statement like
SELECT username,
  osuser,
  machine,
  schemaname
FROM gv$session
WHERE sid=
  ( SELECT sys_context('userenv','sid') FROM dual
  );
Without issueing a SQL command the only way would be to set the color highlighting for the connection manually.
Comment: a user must have special privileges to query gv$session. Better one uses the sys_context function directly to get the information
Answer: You can do a few things:

Create different Tab Groups (Right-Click on any Worksheet) to group your Tabs
Change default Worksheet name (only using SQLDev command in Worksheet):
set worksheet name MyWorksheet2


Do fault codes get recorded and stored with a time stamp and date into a master log with a history of DTCs?

Question: I am shocked that I have not been able to find a "master list" of all DTC fault codes that have ever been pulled or pinged on my vehicle. Code P17F0 came up a year ago at a dealership where the previous owner declined to fix the issue. The code was not cleared from the car. The owner traded in the car and I ended up buying it not knowing or being told this code had ever come up. The dealership the car was traded in at was different than the one who pulled the code to begin with. The selling dealership claims that they scanned my the car and nothing came back as "faulty". But, they do not have anything to prove this. Not a printout or anything showing this specific code came up or was okay. Is there device or some way to scan my car and see a list of anytime this code was pinged? Even if it just showed the dates this code was pinged would be great. I know it came up in July 2022 (first time it showed up), then again 6/2/2023 when I got an oil change and when I found all of this out, then again on 6/7/2023 when I took it into the dealership I bought it from and made them scan the car in front of me. I need to see if this code was pulled in January or February of 2023. I have a 2017 Infiniti QX60 and because it's newer and more tech savvy if you will, I would assume there would be a way that the car stored every time it was scanned and the outcome of that scan. My other thought is that the dealership would have a record of when they scanned the car and the results, but getting them to be honest is another fight. Would I be able to call a corporate number and request all service/scan documents for my car? Please help people. I could be paying close to $9k for a new transmission that should have been dealt with long before I bought the car.
Answer: No. Most codes are volatile. There aren't any date stamps on anything, so if one pops up, you won't know when exactly it happens. Codes are meant as an indicator. Once the issue is no longer present, the code goes away. If the ECM is reset, the code goes away until the condition is met again and then it will pop up as a new code. There is nothing kept long term.


Any apps/sites to vectorize images for free?

Question: I drew some diagrams in a mobile Android sketch app and submitted them to a publisher, but he says the image resolution is poor and he wants vector versions. Freelancers charge hefty prices. I found some online sites that vectorize images for a monthly subscription. Are there any apps/sites that can do this for free?
Answer: In the apps category (Windows, Mac, Linux), one can use Inkscape to perform a trace bitmap operation. The results are usually of reasonable quality and may require some manipulation of the parameters incorporated into the feature.
It also may be more practical, if you have a computer with the above operating system, to create the diagram directly within Inkscape, to ensure maximum quality with minimum effort.
Comment: I have spent many many hours of my life tracing bitmapped images in Inkscape. It is rare that an image is simple enough for the trace bitmap operation to work the way you'd like, and most of the time I end up either touching up a lot or just redoing the whole thing. I just tried Vectorizer, Vector Magic, and autotracer. Vectorizer and Vector Magic looked pretty good, but they're not free.
Comment: I agree that Inkscape can be challenging for more complex images. The OP did not provide a sample. In the second paragraph, I suggested creation directly within Inkscape to perhaps make the task easier.
Comment: @bfris And what about autotracer and the other 4 free ones?
Comment: @convert autotracer is not nearly as good as the two paid options. It's probably closer to Inkscape. Inkscape does do OK for some images.
Comment: @bfris And the other 4 links?
Answer: Have not tried it from mobile device, but Free Online Converter should be exactly what you asking. You can try PNG to SVG as well. And there are even more sites like autotracer and Vectorization for example or TextCompare.
Comment: Potrace (through Sourceforge) is another free option. Been ages since I last used it though. YMMV.
Comment: Vectormagic isn't free, though.
Comment: @Joey Sorry my fault, the same problem with Vectorizer, both can convert images, but downloading is then a problem. Will edit my answer and replace that recomendations by more suitable ones.
Comment: @Stax But Potrace not working oN Android, as far I saw.


Is Seventh Day Adventistism considered an orthodox denomination?

Question: Because of their Sabbath day standards, and unique lifestyle, my question is:
Is 7th Day Adventistism considered an orthodox Christian faith?
Comment: According to whose perspective are you asking? The reasons you've listed would not be used as reasons for being orthodox, since being orthodox is about conforming to tradition, not being unique.
Comment: @4castle Let's flip this on it's head. Can you find a single non-SDA souce that would call SDA orthodox? I bet not.
Comment: You would have to qualify what you mean by "unique lifestyle." And as 4castle mentioned, are you asking for the Protestant perspective? Generally, the [doctrine](https://en.wikipedia.org/wiki/Seventh-day_Adventist_Church#Criticism) in question that may be considered "heterodox" would be more along the lines of questions about hell (annihilationism) and the atonement, "investigative judgment," etc. Not so much a "unique lifestyle." I think a number of protestants would say the "lifestyle" is "legalistic," but that would not be grounds for heterodoxy.
Comment: I am referring to Saturday as their primary day of worship, as opposed to Sunday, and strict diatary lifestyle. Their teachings with regard to diet are a blend of Kosher and mainstream Christian.
Comment: "Seventh-day Adventists" refers to two parts of their theology: they observe the seventh day (Saturday) as a Sabbath, and they expect the Lord to return at any time. They are Adventists who observe the seventh day.  More information here: https://www.gotquestions.org/Seventh-Day-Adventism.html
Comment: The inherent difficulty for me in answering this question is twofold - firstly, defining orthodoxy, and secondly, which branch of SDA are you talking about? I'm friends with a girl from a very moderate SDA church that allows the consumption of meat, for instance.
Answer: I'll first direct you to a decent summary of SDA differences from typical (i.e. common) protestants: What are the main differences between 7th Day Adventists and Catholic/Protestant churches?
Now let's examine a few definitions of orthodox.

orthodox adjective
    or·tho·dox | \ˈȯr-thə-ˌdäks  \
    Definition of orthodox (Entry 1 of 2)
      1a : conforming to established doctrine especially in religion
          // orthodox principles
          // the orthodox interpretation
        1b : CONVENTIONAL
          // took an orthodox approach to the problem
          // orthodox medicine
      2 capitalized : of, relating to, or constituting any
        of various conservative religious or political groups: such as
          a : EASTERN ORTHODOX
            // Greek Orthodox rituals
          b : of or relating to Orthodox Judaism
            // Orthodox Jews in their black suits and hats and modest dresses
  - Merriam-Webster

In a religious academic setting, Orthodox is almost always used as in the second definition. That is, it is a specific thing, a proper noun. In this case, Seventh Day Adventist is trivially not Orthodox.
Outside of the academic setting, but still within highly religious settings (i.e. casual Bible studies, sermons, religious books for popular consumption) orthodox takes more of the first definition. The scope of it's use tends to coincide with many preferring to call their own beliefs "orthodox", which is to say they believe what they think is right and all biblically significant characters believed it as well. In a phrase, they think what they believe is historically correct. Many protestant denominations believe this about themselves.
However, the fact is most of them do not fit this definition. They have little to no evidence that their particular beliefs were common or even existed before the founding of their denomination. What is clear is that Catholics have quite a broad leg to stand on in this regard, and they are not shy to mention it as a point of validity for themselves. And in a broad sense, "Catholic" refers also to those ancient denominations that take the name "Orthodox". These are the first denominations and they have the history to prove it. Therefore, even in these settings, "orthodox" should be reserved for only these old denominations because they have the traditions of the first Christians.
As Protestants are outsiders to Orthodoxy, Seventh Day Adventists are outsiders to Protestants. It is clear that they have quite a few beliefs that most Protestants roundly reject and would even call heresy. And SDAs gladly accept this image. They understand they have some starkly different beliefs on some really big topics, and it is on exactly those topics that they proselytize. They preach consistently on keeping the Sabbath and the mercy of Annihilationism, neither of which are tenets of common protestant denominations.
The answer is clear: No, Seventh Day Adventists are not orthodox. They do not use the label for themselves and no other denomination calls them such. The word simply doesn't fit with any definition.

I came across my own answer here a year later and notice one missing point that is probably related. Adventists consider themselves a "remnant church". They believe strongly that their beliefs are the original beliefs of Christianity and that remnants of their orthodoxy has survived through the ages (claims of African churches mostly), though they do recognize that their prophet, Ellen White, is responsible for their creation as an American denomination. Contrast this with LDS (mormons) who believe that they are a restoration of a once lost orthodoxy.

A caveat: As you tighten scope of any labeling effort, you will often find the word "orthodox" used in conjunction with other specific terms. This is usually to denote that within a denomination there are disagreements and even schisms. For example, see the Anglican Orthodox Church and the Orthodox Presbyterian Church. Both already protestant and distinctly not Orthodox Anglican and Presbyterian Churches split into one or more denominations, with one keeping closer to their respective traditional beliefs. The SDA is no stranger to this usage of the word, as this article references an "Adventist Orthodoxy". Given some time and a significant disagreement, we may see the birth of The Adventist Orthodox Church, but that name would only imply that it holds to the traditional beliefs of Adventists.
Answer: The answer is, yes. Seventh-day Adventism embodies the true, original, historic, ancient, Eastern Orthodox Church. Their views line up with the eastern churches of Syria from the 2nd, 3rd, 4th and 5th centuries. That's right. Yes they do.
Comment: Welcome to Christianity.SE! and thank you for your contribution. When you get a chance, please take the [tour] to understand how the site works and [how it is different than others](https://christianity.meta.stackexchange.com/a/1809/50259). I would also recommend reading the [Help Center](https://christianity.stackexchange.com/help)'s sections on asking and answering questions.
Comment: It would be helpful if you would outline specific examples of doctrines mutually held by the Seventh-day Adventists and those eastern churches of Syria you have mentioned, and provide some supporting references to this information.  This would greatly improve the quality of your answer.


How do I delete duplicate data in SQL Server?

Question: I have sql table but, some value added more than once, I need to delete one of them. Can you give me a simple query?
Comment: This _must_ be a multiple duplicate.
Answer: From here. If you don't already have an "ID" field that uniquely identifies each row, you'll need to create one for this to work (you can always just drop the column after you are done):
DELETE
FROM MyTable
WHERE ID NOT IN
(
SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicateColumn1, DuplicateColumn2, DuplicateColumn2)

Also, do a search on this site for "delete duplicate rows sql server" and you'll see that this question has already been answered many times here.
Comment: One such link in SO: http://stackoverflow.com/questions/18932/sql-how-can-i-remove-duplicate-rows
Comment: +1 for being a correct answer, commenting on the referential integrity problem and teaching me something new all in one go.
Answer: DECLARE @Duplicates TABLE (AValue VARCHAR(32))

INSERT INTO @Duplicates VALUES ('No Duplicate')
INSERT INTO @Duplicates VALUES ('Duplicate')
INSERT INTO @Duplicates VALUES ('Duplicate')

SELECT ID = IDENTITY(INT, 1, 1), *
INTO #Duplicates
FROM @Duplicates

DELETE FROM #Duplicates
FROM #Duplicates d
     INNER JOIN (
       SELECT ID = MIN(ID)
       FROM #Duplicates
       GROUP BY AValue
       HAVING COUNT(*) > 1
      ) id ON id.ID = d.ID

DELETE FROM @Duplicates

INSERT INTO @Duplicates
SELECT AValue FROM #Duplicates

DROP TABLE #Duplicates

SELECT * FROM @Duplicates

Answer: ;WITH tempTable AS
    (
            SELECT ROW_NUMBER() OVER (PARTITION BY Column1 ORDER BY Column2 ) AS rownumber,*
            FROM @Table
    )
    DELETE FROM tempTable WHERE rownumber > 1

This is taken from the article link mentioned in one of the answers but just to save someone sometime in the future..
Answer: Use:
Set RowCount 1
Then run your delete sql
This will delete 1 row, regardless if there are multiple rows matching.
Then either close the query window, or use
Set RowCount 0 to reset it.
Answer:
Create temporary table with the same schema
INSERT INTO temptable SELECT DISTINCT * FROM oldtable
DELETE FROM oldtable
INSERT INTO oldtable SELECT * FROM temptable
DROP temptable

And don't forget:

Refactor your tables to not allow this to happen again


Why does Regsvr32 work on one machine but not the other

Question: When I go to register a dll as an admin on my machine it works fine:
Regsvr32 C:\nameofdll.dll
However when I run it on another machine it fails.
Why is that?
Comment: The error can be caused due to the architecture of the machine, probably one of them is running in x86 and the other one in x64. I would recommend you this post to try to solve your problem: https://stackoverflow.com/questions/4897685/how-do-i-register-a-dll-file-on-windows-7-64-bit
Answer:
Error codes: Error codes can be looked up using one of these methods.

Regsvr32.exe - Admin Rights Required: As far as I know self-registration requires admin rights since it registers the DLL per-machine - or in other words in the HKLM / HKCR sections of the registry (HKCR is a view into a part of HKLM and a merge from sections of HKCU - in other words it is an "emergent view" from both HKCU and HKLM). Now I see this answer which seems to indicate that there are ways to register COM servers per user? It doesn't work for my test OCX files using this method. I did not try the custom registration EXE from codeproject.
MSI - Per-User COM Registration: Windows Installer - on the other hand - is able to install COM servers per-user for setups that install per-user. Per-user setups are bad for a number of reasons (serviceability, upgrading, patching, various limitations), but that is another story. If you enable Installshield's COM Extract On Build as I showed in another answer, the COM data is added to your MSI in a way that ensures that the COM server can be registered per-user - if the setup is installed per-user, or per-machine if the setup is installed per-machine. This is the standard way to register COM files using Windows Installer.
Bitness: Other problem causes are possible, such as the mentioned "bitness" of the COM server. I have encountered very few x64 COM servers, but they are problematic to deal with using WiX for example. As far as I know the WiX 3.11 release does not support x64 COM servers for extraction. Similar problems could exist in Installshield - I don't know.
Support Page: On a 64-bit version of Windows operating system, there are two versions of the Regsv32.exe file:

The 64-bit version is %systemroot%\System32\regsvr32.exe
The 32-bit version is %systemroot%\SysWoW64\regsvr32.exe

Lacking Dependencies: Self-registration can also fail if there are lacking dependencies for the file in question. You can use a tool such as dependency walker to check, or you can monitor with procmon or any number of scanner tools (have a quick skim). Note that it is also possible that you lack a "language dll" for the COM server. For example: MyApp-English.dll. Such a file should be located next to your main COM server file MyApp.dll or MyApp.ocx to allow registration to work correctly.
Oddities: Numerous other problems can be seen. Ranging from licensing issues, COM interoperability with .NET (regasm.exe), interference from weird security policies, security software interference - anti virus etc... To any number of other specific and rare factors.

Warning: I have seen self-registration perform illegal actions and change core system values during the self-registration process - without any warning or explanation. Hence the recommendation to avoid
  self-registration during deployment whenever possible.


Emacs macos keyboard handling problem

Question: I'm looking for "unity-win7" like solution, where I can run cmd+num for activating browser, console, editor etc...
I found Activator and Services in osx, however, I can't use cmd+num because many app like chrome and iterm2 use them to activate tabs.
So I set up Launch Services via Activator on chd+shift+num, and it works everywhere, except Emacs)
It looks like Emacs handle keyboard before Services, so, for example, after cmd+shift+1, it expects "Shell command".
What I need is to make this hotkeys (cmd+shift+num) somehow transparent for emacs.
Answer: Add the following line to your .emacs
<code>(global-set-key "\M-!" nil)
</code>
and similarly for the rest of the shifted numbers.
(If you don't have a .emacs, make a text file called that in your home directory.)
This will unbind whatever functions are attached to those key combinations, so they'll get passed out of Emacs and off to the rest of the system.
However, if there's any command there that you use, you'll need to bind it to a different key combination. Even if you activate things with Escape then the key, that's just an alias for Meta.
You can see what command is bound to a key with C-h k, then you can bind that function to another key in your .emacs
For instance, if I wanted to move query-replace-regexp, which I have on M-%, I might add these lines:
<code>(global-set-key "\M-%" nil)
(global-set-key "\C-%" 'query-replace-regexp)
</code>
Your other option would be to change what key to use as Meta, but that would probably be a lot more trouble.

Emacs macos keyboard handling problem


Where's this wall painting in Warsaw?

Question: Can anyone tell me where I can find this painting?

Thanks so much
Comment: Users are encouraged to show some research effort. I found the answer in the very first google hit for "Warsaw street art".
Answer: According to this page, the piece was created in 2015 by Irish artist Conor Harrington, and is located at Ul. Środkowa 17 in the Praga district of Warsaw. Google street view confirms that.
Answer: Don't forget to try Google Image Search and Google Lens first. E.g. in the results searching with your image with Google Lens, you will see many results showing the same art from Conor Harrington indicating its location:
Comment: I didnt know about Google Lens, thank you!

Where's this wall painting in Warsaw?


Can you prevent a module from being disabled?

Question: Is there any way to prevent Admins from disabling a module. Is there anything that can be done via code?
Answer: If you're looking for a per-module solution, add the required property to its .info file.

As of version 7.x, modules and themes may specify that they are absolutely required and should never be disabled by adding required = TRUE. These modules will be enabled automatically during install. In most cases it should only be used with the Drupal core required modules (e.g. Node, User, etc.).
Answer: No code is necessary to do this. You can setup appropriate permissions for your "admins". Create a new role for these individuals that gives them all the rights they need minus the "Administer modules" under "System".


Share futex between unrelated processes

Question: How can unrelated processes cooperate using a futex?
Let's say I have unrelated processes, one being, say, an apache subprocess with my module, another being e.g. a background script.
I'd like to establish a condition variable with a mutex between the two using a futex, to benefit for user-space fast code path.
It seems to me that memory at which mutex is stored could be in a mmap'd file, if that memory is mapped, e.g. mlock'd the two processes could theoretically issue futex calls against same address.
Alternatively, perhaps a futex can be passed from one process to another using FUTEX_FD.
Code submissions low-, high-level and dynamic languages are accepted (C, C++, Python, etc.). "robust futex" API must be supported too.
References:

https://www.kernel.org/doc/Documentation/robust-futexes.txt
http://locklessinc.com/articles/mutex_cv_futex/
Comment: The [manpage says](http://man7.org/linux/man-pages/man7/pthreads.7.html) that pthreads uses futexes internally. Did you consider to simply use the high level API (as the [futex manpage recommends](http://man7.org/linux/man-pages/man7/futex.7.html)), and use a pthread condition with `PTHREAD_PROCESS_SHARED`?
Comment: P.S. If this cannot be done, please explain in detail why.
Comment: have you checked this http://locklessinc.com/articles/mutex_cv_futex/
Comment: @Ghayel yes I did, it's listed in the question.
Comment: @Phillip looks like http://linux.die.net/man/3/pthread_mutexattr_init has an example code that in fact sets up a futex in a `mmap`ed without common `fork` parent. Good hint!
Comment: From http://man7.org/linux/man-pages/man2/futex.2.html
In order to share a futex
       between processes, the futex is placed in a region of shared memory,
       created using (for example) mmap(2) or shmat(2). Should not be difficult to implement.
Answer: mutex are defined to lock access to shared resources.
This does not seem what you want to do .
if you want both process to cooperate, you may either use shared mmap area, or semaphore
Comment: note `futex` in the OP. Also note comments by Felix and Phillip
Answer: Thanks Phillip and Felix M. for pointers.
Python user code (file with data structures already exists, initialised with PTHREAD_PROCESS_SHARED)
with open("/tmp/semaphore", "rb+") as f:
    m = mmap.mmap(f.fileno(), 0)  # default: all file, share, read-write

data = ffi.cast("unsigned long[3]", id(m))[2]  # pointer to mapped area, 64-bit CPython
lock = ffi.cast("pthread_mutex_t *", data)
cond = ffi.cast("pthread_cond_t *", data + 40)

@contextlib.contextmanager
def locked(alock):
    assert not C.pthread_mutex_lock(alock)
    try:
        yield
    finally:
        assert not C.pthread_mutex_unlock(alock)

Wait and get awoken:
if "wait" in sys.argv:
    with locked(lock):
        assert not C.pthread_cond_wait(cond, lock)

elif "signal" in sys.argv:
    with locked(lock):
        assert not C.pthread_cond_signal(cond)

Basics of setting PTHREAD_PROCESS_SHARED:
l = ffi.new("pthread_mutexattr_t *")
assert not C.pthread_mutexattr_init(l)
assert not C.pthread_mutexattr_setpshared(l, 1)  # PTHREAD_PROCESS_SHARED
assert not C.pthread_mutex_init(lock, l)
# same for condition variable

Full code for nitpicks :-) https://github.com/dimaqq/pthread_mutexattr_init/blob/master/xsem.py based on http://linux.die.net/man/3/pthread_mutexattr_init

Share futex between unrelated processes


Fluorescent Lights and CFLs Take Longer to Startup in Cold

Question: When it is colder outside, I noticed that the CFLs in my house and the fluorescent lights in my garage take longer to come on and get bright. Sometimes they flicker more. I am in Florida so coldest is probably 30-40 degrees in the Winter. Why does this occur? CFLs are in a standard outlet. Fluorescents are in an older ballast.
Comment: Add "Why do...?" to your title to make your question a ... uhh ... question.
Comment: Sure, but your title is a statement of fact. I can't tell if you're just curious why, or whether there's a way to make them start up faster, or whether there are some models that don't have that problem. I like your question, and I am interested in the answer; this is just a minor improvement.
Comment: @Jay: I've been on the SE network for some time now and the titles do not have to have the question in them.. Browse SO right now and I'm sure you will see the same thing.
Comment: @Jay: I know but the way your statement is worded, it comes off as pedantic and as a know-it-all. It puts people on the defensive.
Answer: When turned off, the mercury in the fluorescent tube condenses on the inside surface of the tube.  In order to emit light, the mercury must evaporate and form a vapor as the conductive path between the ends of the tube.  The colder the bulb is to begin with, the longer it takes for all the mercury to evaporate, and for the light to reach full brightness.
This also explains why fluorescent lights get dimmer as they age: there is a small leakage of mercury from the tube during its lifetime, so there is less mercury vapor in the tube, so less light produced.


What would be the cotangent bundle of a Banach manifold?

Question: Reference: Lang - Differential manifolds p.123
Quick question: Lang defines the cotangent bundle as the dual vector bundle of the tangent bundle, but shouldn't there be additionally a somewhat canonical differentiable structure on the cotangent bundle? (Or does the dual vector bundle naturally determine the differentiable structure?) How do I define such canonical differentiable structure?
Let me illustrate my approach in detail below:
Let $X$ be a Banach $C^k$-manifold.
Define $C_p(X)$ as the class of $(c,v)$ where $c=(U,\phi,E)$ is a chart at $p$ and $v\in E$. (Note that $U$ denotes a coordinate domain and $\phi$ denotes a coordinate map and $E$ denotes a Banach space where $\phi$ is mapping to)
Now, define an equivalence relation on $C_p(X)$ as follows:
$((U,\phi,E),v)\sim((V,\psi,F),w)$ iff $D(\psi\circ \phi^{-1})(\phi(p))(v)=(w)$
Define a map $\mathscr{O}_c^p:E \rightarrow C_p(X)/\sim: v\mapsto [(c,v)]$.
Then, it can be shown that $\mathscr{O}_c^p$ is a bijection. Using this map, we can isomorphically give a vector space structure on $C_p(X)/\sim$, and this structure can be shown independent of choice of charts $c$. Let $T_p(x)$ denote this set equipped with the natural vector space structure.
Moreover, we can homeomorphically give a Banachable topology on $T_p(X)$ using those maps $\mathscr{O}_c^p$.
Now, define $T_p^*(X)$ as the collection of continuous linear functionals on $T_p(X)$. So that $T_p^*(X)$ is a Banachable space too.
With these terminologies (which are standard as far as I know), let's define the cotangent bundle.
Define $T^*X:=\bigcup_{p\in X} (\{p\}\times T_p^*(X))$, and let $\pi^*:T^*X\rightarrow X$ be the map such that $\pi^*(p,y)=p$.
Let $c=(U,\phi,E)$ be a chart of $X$.
Define $\mathscr{D}_c ^p:T_p^*(X)\rightarrow E^*: A\mapsto A\circ \mathscr{O}_c^p$. Note that this map is linear homeomorphism.
Define $U^*:=(\pi^*)^{-1}(U)$, and $\phi^*(p,A)=(\phi(p),\mathscr{D}_c^p(A))$ for each $(p,A)\in U^*$.
Now define $c^*:=(U^*,\phi^*,E\times E^*)$. Then, $\phi^*:U^*\rightarrow E\times E^*$ is an injection and $\phi^*(U^*)=\phi(U)\times E^*$ is open and $E\times E^*$ is Banachable. Hence, $c^*$ is a chart on the set $T^*X$.
Take the unique differentiable structure generated by those $c^*$'s, and call the set $T^*X$ together with this differentiable structure the cotangent bundle of $X$. Would it be the correct one?
Answer: Yes. That unique differentiable structure is given by Lang in Proposition 2, p. 43 which applies by Theorem 1, p. 54. (A later edition has these and the cotangent bundle example on pp. 45, 59 and 61.)


What does 'directs' mean?

Question: In a work setting, as in "They had to present their project to his directs."
Does it mean people who work directly under him, above him, or someone else?
Comment: Presumably they mean "direct reports" -- his immediate underlings.  Business jargon.
Answer: While you have not provided adequate context to know for certain here, in business jargon, direct is short for direct report, which refers to

an employee whose position at work is directly below that of another person, and who is managed by that person

as per the Cambridge Business English Dictionary. To report to someone is to be under their supervision; to directly report to someone is to do so without any intervening layers or convoluted arrangements. A worker might be a direct report to a manager, who is a direct report to a director, who is a direct report to a vice president. Even though the worker, like everyone else in the department, ultimately reports to the vice president, she is a direct report only to the manager.
It is not common to refer to subordinate employees as reports in general, and this sense is not given in the OED, for example.  I suspect it is a relatively recent coinage that allows one to distinguish between the relationship between two adjacent rungs on the corporate ladder and those more distantly removed. It also avoids terms like subordinate or underling which may have unpleasant connotations of hierarchy.
The earliest Google Books example I could turn up is from a 1992 court case, and direct report is set off in quotation marks, suggesting its use was not yet widespread.

What does 'directs' mean?


Do I Need To Show My Character's Meeting in my Novel?

Question: This is more of an opinion or preference question but I was wondering, is it better to show the main characters of my novel first meeting and becoming friends or is it perfectly fine to start off when they have already become friends? What would readers prefer?
Answer: Generally it's a bad idea to do anything that does not serve a purpose for the story.  Your readers will wonder why you spent their time on it.
If how these characters meet and become friends matters for the story you're trying to tell, show it.  If not, don't.
The writers of Avatar: The Last Airbender had to show Aang becoming friends with Korra, Sokka, and eventually Zuko because they help Aang and he helps them grow as characters.  The story is heavily about their personalities and how they change.
Tolkien never explains in Lord of the Rings how exactly Merry, Pippin, Sam, and Frodo all met.  Unless I'm mistaken, all we get is that Sam works for Frodo.  How that arrangement started is left to the imagination.  It didn't matter for the story he was telling.  How exactly they all became friends had no effect on their trip to throw the Ring into the fires of Mount Doom.
The big difference I think between these stories is that A:TLA is heavily character-driven, while Lord of the Rings is plot-driven.  The characters in A:TLA change, the characters in LotR mostly don't.
One question you should ask yourself that may help you decide is: "Is my story about who my characters are, or what they do?"  I hope you can see that these are not necessarily the same thing.
Comment: I agree with the first part of your answer, but I don't think your last two paragraphs are relevant.  Whether or not a story is plot-driven or character-driven isn't going to determine whether or not the characters' first meetings are important to the story; either could easily be true for either.
Comment: @AmaiKotori Agreed. Even with highly character-driven stories, the story has to start *somewhere*. Also, even if it's relevant, you can reference how they met without showing the scene. For example, in Game of Thrones, we learn that Ned Stark and Robert Baratheon grew up together, but this is backstory revealed through dialogue and memories. When we first see the two interact, it's clear they're friends, but the reader doesn't know how they became friends.
Comment: I don't mean to imply that that question is the ONLY question one should ask themselves.  But I think it could help inform his decision.


Why is sigmoid or tanh better than linear slope for an activation function?

Question: I usually see sigmoid or tanh being used as activation in neural networks. Why not linear slope given that linearity is simpler mathematically?
Comment: Linear functions are closed under composition, so the result would just be another linear model. Using nonlinear activation functions admits nonlinear models.
Answer: As @Sycorax mentioned, linear activation functions cannot solve non-linear problems. The TANH and Sigmoid function introduce this needed non-linearity.

Neural networks have to implement complex mapping functions hence they need activation functions that are non-linear in order to bring in the much needed non-linearity property that enables them to approximate any function. A neuron without an activation function is equivalent to a neuron with a linear activation function given by.
Φ(x)=xΦ(x)=x
Such an activation function adds no non-linearity hence the whole network would just be equivalent to a single linear neuron. That is to say, having a multi-layer linear network is equivalent to one linear node.
Thus it makes no sense building a multi-layer network with linear activation functions, it is better to just have a single node do the job. To make matters worse a single linear node is not capable of dealing with non separable data, that means no matter how large a multi-layer linear network can be it can never solve the classic XOR problem or any other non-linear problem.
Activation functions are also important for squashing the unbounded linearly weighted sum from neurons. This is important to avoid large values accumulating high up the processing hierarchy.
Then lastly, activation functions are decision functions, the ideal decision function is the heaviside step function. But this is not differentiable hence more smoother versions such as the sigmoid function have been used merely because of the fact that they are differentiable which makes them ideal for gradient based optimization algorithms.

Source
Answer: There are piecewise activation functions used where each piece is a linear function and together they form a nonlinear function, such as leaky ReLUs, which turn out to show better performance than sigmoid or tanh in many types of networks.
Answer: Neural network doesn't use linear activation  by definition. It's not if it's not possible, linear activation would just give you a new linear transformation from your input variables. So ... why not just fit a linear model?


If I give in my notice, am I still entitled to reimbursement on expenses owed?

Question: If I give in my notice of leave, am I still entitled to reimbursement on expenses owed? The arrangement is typically a month gap so expenses incurred in this month are paid at the end of the next month, and I am worried that if I did wish to leave, any significant expenses may not be reimbursed by my employer, such as travel costs for fuel, parking and tickets for off-site (not at office) work.
Answer: Generally they should still reimburse you for those expenses with a few conditions:

They will want you to submit them as quickly as possible, that way they can contact you for questions while you are still an employee. Turn in as many before giving notice to reduce the backlog
They will only cover things through your last day. Which means that they may only pay for part of the monthly parking pass, or part of the train ticket. Understand how much you are putting at risk before giving notice. It might be cheaper to skip the monthly pass if you will only be parking for a few days of the next month.
If your leaving will invalidate some pre-paid items (tickets, registration fees) they may want compensation. You need to discuss this with HR.
Be aware that they may require you to payback any money paid for moving or tuition if you signed paperwork that obligated you to pay them back if you didn't remain an employee for X months after they paid the expense.
Comment: Thank you, fortunately for me all expenses are relevant to the days worked. What I worry about is if they refused to pay and if they are entitled to do that.
Comment: @Cnut you should be ok as they owe you that money speaking to Mhorans point its unlikely that any tuition/training would be enforceable in the UK
Comment: @Pepone thank you. There is also nothing written in my contract that would suggest paying for any training I have received, so I am glad to hear it.


Why is it hard to find a Eevee in the Trophy Garden in Diamond and Pearl?

Question: It's just hard to find one Eevee in Pearl and Diamond. Why is it?
Comment: While I admit this question may be poorly phrased, I think it entirely likely that the "Why?" is less "Why did the developers make this difficult?" and more **"Why am I having such a hard time finding an Eevee in the Trophy Garden?"** Considering some of the mechanics involved in determining which Pokemon are even *available* in this location at any given time (explained in the answer), I find it entirely plausible that the question asker is unaware of one or more of these mechanics and is thus confused by the lack of Eevee encountered.
Comment: It is just like that. One can speculate that some Pokémon species are rarer in some areas than others, but that's about it.
Answer: Eevee is a special Pokemon in the Trophy Garden, which means it has to be one of the last two Pokemon mentioned by the owner, Mr. Backlot. He mentions a new Pokemon every 24 hours and you can soft reset which Pokemon he mentions, but you have to do it in the first place, otherwise Eevee won't be there at all.
This also requires the National Pokedex, otherwise only the "normal" Pokemon appear in the Trophy Garden.
Finally, when Eevee does appear, it's still only a 5% chance, so you'll have to search for a while.
Comment: @TrentHawkins Thanks, I didn't consider it that way :)