What is the "Execute Around" idiom?

Question: What is this "Execute Around" idiom (or similar) I've been hearing about?
Why might I use it, and why might I not want to use it?
Comment: I hadn't noticed it was you, tack. Otherwise I might have been more sarcastic in my answer ;)
Comment: So this is basically an _aspect_ right?  If not, how does it differ?
Answer: Basically it's the pattern where you write a method to do things which are always required, e.g. resource allocation and clean-up, and make the caller pass in "what we want to do with the resource". For example:
public interface InputStreamAction
{
    void useStream(InputStream stream) throws IOException;
}

// Somewhere else

public void executeWithFile(String filename, InputStreamAction action)
    throws IOException
{
    InputStream stream = new FileInputStream(filename);
    try {
        action.useStream(stream);
    } finally {
        stream.close();
    }
}

// Calling it
executeWithFile("filename.txt", new InputStreamAction()
{
    public void useStream(InputStream stream) throws IOException
    {
        // Code to use the stream goes here
    }
});

// Calling it with Java 8 Lambda Expression:
executeWithFile("filename.txt", s -> System.out.println(s.read()));

// Or with Java 8 Method reference:
executeWithFile("filename.txt", ClassName::methodName);

The calling code doesn't need to worry about the open/clean-up side - it will be taken care of by executeWithFile.
This was frankly painful in Java because closures were so wordy, starting with Java 8 lambda expressions can be implemented like in many other languages (e.g. C# lambda expressions, or Groovy), and this special case is handled since Java 7 with try-with-resources and AutoClosable streams.
Although "allocate and clean-up" is the typical example given, there are plenty of other possible examples - transaction handling, logging, executing some code with more privileges etc. It's basically a bit like the template method pattern but without inheritance.
Comment: @Phil: I think it's a matter of degree. Java anonymous inner classes have access to their surrounding environment *in a limited sense* - so while they're not "full" closures they're "limited" closures I would say. I would certainly like to see proper closures in Java, although checked (continued)
Comment: Java 7 added try-with-resource, and Java 8 added lambdas. I know this is an old question/answer but I wanted to point this out for anyone looking at this question five and a half years later. Both of these language tools will help solve the problem this pattern was invented to fix.
Comment: It's deterministic. Finalizers in Java aren't called deterministically. Also as I say in the last paragraph, it's not *only* used for resource allocation and cleanup. It may not need to create a new object at all. It's generally "initialization and tear-down" but that may not be resource allocation.
Comment: So it's like in C where you have a function that you pass in a function pointer to do some work?
Comment: Also, Jon, you refer to closures in Java - which it still doesn't have (unless I missed it). What you describe are anonymous inner classes - which are not quite the same thing. True closures support (as have been proposed - see my blog) would simplify that syntax considerably.
Comment: @Burkhard: I don't think I'd have anything very specific to say there: use it when it makes the code simpler; don't use it when it doesn't.
Comment: How is this different from a constructor and descructor which handle initialization and tear-down?
Comment: I expanded on the concept of EA in Java, how painful it is, and proposed language changes that would make it easier, here: http://metatechnology.blogspot.com/2007/02/raii-and-closures-in-java.html

That was early 2007 - looks like closures still haven't made it into Java, though :-(
Comment: exceptions make that harder. I'm not entirely happy with any of the closures proposals I've seen. They're either clunky for flexibility or  simple but restricted :(
Comment: @JonSkeet: Great answer, but what about the "why might I not want to use it?" part?
Answer: The Execute Around idiom is used when you find yourself having to do something like this:
//... chunk of init/preparation code ...
task A
//... chunk of cleanup/finishing code ...

//... chunk of identical init/preparation code ...
task B
//... chunk of identical cleanup/finishing code ...

//... chunk of identical init/preparation code ...
task C
//... chunk of identical cleanup/finishing code ...

//... and so on.
In order to avoid repeating all of this redundant code that is always executed "around" your actual tasks, you would create a class that takes care of it automatically:
//pseudo-code:
class DoTask()
{
    do(task T)
    {
        // .. chunk of prep code
        // execute task T
        // .. chunk of cleanup code
    }
};

DoTask.do(task A)
DoTask.do(task B)
DoTask.do(task C)
This idiom moves all of the complicated redundant code into one place, and leaves your main program much more readable (and maintainable!)
Take a look at this post for a C# example, and this article for a C++ example.
Answer: An Execute Around Method is where you pass arbitrary code to a method, which may perform setup and/or teardown code and execute your code in between.
Java isn't the language I'd choose to do this in.  It's more stylish to pass a closure (or lambda expression) as the argument.  Though objects are arguably equivalent to closures.
It seems to me that the Execute Around Method is sort of like Inversion of Control (Dependency Injection) that you can vary ad hoc, every time you call the method.
But it could also be interpreted as an example of Control Coupling (telling a method what to do by its argument, literally in this case).
Answer: See also Code Sandwiches, which surveys this construct across many programming languages and offers some interesting research'y ideas.  Concerning the specific question of why one might use it, the above paper offers some concrete examples:

Such situations arise whenever a program manipulates shared resources.
  APIs for locks, sockets, files, or database connections may require a
  program to explicitly close or release a resource that it previously
  acquired. In a language without garbage collection, the programmer is
  responsible for allocating memory before its use and releasing it
  after its use. In general, a variety of programming tasks call for a
  program to make a change, operate in the context of that change, and
  then undo the change. We call such situations code sandwiches.

And later:

Code sandwiches appear in many programming situations. Several common
  examples relate to the acquisition and release of scarce resources,
  such as locks, file descriptors, or socket connections. In more
  general cases, any temporary change of program state may require a
  code sandwich. For example, a GUI-based program may temporarily ignore
  user inputs, or an OS kernel may temporarily disable hardware
  interrupts. Failure to restore earlier state in these cases will cause
  serious bugs.

The paper does not explore why not to use this idiom, but it does describe why the idiom is easy to get wrong without language-level help:

Defective code sandwiches arise most frequently in the presence of
  exceptions and their associated invisible control flow. Indeed,
  special language features to manage code sandwiches arise chiefly in
  languages that support exceptions.
However, exceptions are not the only cause of defective code
  sandwiches. Whenever changes are made to body code, new control paths
  may arise that bypass the after code. In the simplest case, a
  maintainer need only add a return statement to a sandwich's body to
  introduce a new defect, which may lead to silent errors. When the body
  code is large and before and after are widely separated, such mistakes
  can be hard to detect visually.
Comment: Good point, azurefrag. I have revised and expanded my answer so that it really is more of a self-contained answer in its own right. Thanks for suggesting this.
Answer: I see you have a Java tag here so I'll use Java as an example even though the pattern isn't platform-specific.
The idea is that sometimes you have code that always involves the same boilerplate before you run the code and after you run the code.  A good example is JDBC.  You always grab a connection and create a statement (or prepared statement) before running the actual query and processing the result set, and then you always do the same boilerplate cleanup at the end--closing the statement and connection.
The idea with execute-around is that it's better if you can factor out the boilerplate code. That saves you some typing, but the reason is deeper. It's the don't-repeat-yourself (DRY) principle here--you isolate the code to one location so if there's a bug or you need to change it, or you just want to understand it, it's all in one place.
The thing that's a little tricky with this kind of factoring-out though is that you have references that both the "before" and "after" parts need to see. In the JDBC example this would include the Connection and (Prepared)Statement.  So to handle that you essentially "wrap" your target code with the boilerplate code.
You may be familiar with some common cases in Java. One is servlet filters. Another is AOP around advice. A third is the various xxxTemplate classes in Spring.  In each case you have some wrapper object into which your "interesting" code (say the JDBC query and result set processing) is injected. The wrapper object does the "before" part, invokes the interesting code and then does the "after" part.
Answer: I'll try to explain, as I would to a four year old:
Example 1
Santa's coming to town. His elves code whatever they want behind his back, and unless they change things get a little repetitive:

Get wrapping paper
Get Super Nintendo.
Wrap it.

Or this:

Get wrapping paper
Get Barbie Doll.
Wrap it.

....ad nauseam a million times with a million different presents: notice that the only thing different is step 2. If step two is the only thing that is different, then why is Santa duplicating the code, i.e. why is he duplicating steps 1 and 3 one million times? A million presents means that he is needlessly repeating steps 1 and 3 a million times.
Execute around helps to solve that problem. and helps eliminate code. Steps 1 and 3 are basically constant, allowing for step 2 to be the only part that changes.
Example #2
If you still don't get it, here is another example: think of a sandwhich: the bread on the outside is always the same, but what's on the inside changes depending on the type of sandwhich you choose (.e.g ham, cheese, jam, peanut butter etc). Bread is always on the outside and you don't need to repeat that a billion times for every type of sandwhich you are creating.
Now if you read the above explanations, perhaps you will find it easier to understand. I hope this explanation helped you.
Comment: + for the imagination :D
Answer: This reminds me of the strategy design pattern.  Notice that the link I pointed to includes Java code for the pattern.
Obviously one could perform "Execute Around" by making initialization and cleanup code and just passing in a strategy, which will then always be wrapped in initialization and cleanup code.
As with any technique used to reduce code repetition, you should not use it until you have at least 2 cases where you need it, perhaps even 3 (a la the YAGNI principle).  Keep in mind that the removing code repetition reduces maintenance (fewer copies of code means less time spent copying fixes across each copy), but also increases maintenance (more total code).  Thus, the cost of this trick is that you are adding more code.
This type of technique is useful for more than just initialization and cleanup.  It's also good for when you want to make it easier to call your functions (e.g. you could use it in a wizard so that the "next" and "previous" buttons don't need giant case statements to decide what to do to go to the next/previous page.
Answer: If you want groovy idioms, here it is:
//-- the target class
class Resource {
    def open () { // sensitive operation }
    def close () { // sensitive operation }
    //-- target method
    def doWork() { println "working";} }

//-- the execute around code
def static use (closure) {
    def res = new Resource();
    try {
        res.open();
        closure(res)
    } finally {
        res.close();
    }
}

//-- using the code
Resource.use { res -> res.doWork(); }

Comment: If my open fails (say acquiring a reentrant lock) the close is called (say releasing a reentrant lock despite the matching open failing).

What is the "Execute Around" idiom?


Did Darth Bane have a plan for after the Republic was destroyed?

Question: Did Darth Bane have a plan for after his plan was finished? Would there be a rule of one? Or still a Rule of Two? Or even more than two Sith?
Comment: "*After conquering the Galaxy, I like to kick back and visit [Burger King"](http://www.hexapolis.com/wp-content/uploads/2014/09/The-Dark-Burger.jpg)* - Darth Bane.
Comment: @Valorum And then I would destroy whole worlds just for the fun of it (I mean why be the dark side if you are not going to use it?)
Comment: @Valorum - The "Dark Vador" burger looks badass with the black buns. I'd try it. Heck the Jedi Burger looks good too. Would've been great if they added guacamole to the Jedi Burger to match Yoda.
Comment: @iMerchant - The black burger had an unpleasant taste to it, akin to charcoal and seaweed.
Comment: @Valorum - Did you actually taste it? Or just being funny? Not sure what language it's in, nor do I recognize the place selling it. But I also know (I think) you're not from the USA and may have more opportunity to travel to other smaller countries.
Comment: @iMerchant - They had the same buns and Star Wars promotion at Burger King in the UK. They've got them at Halloween too (as well as an orange burger that looks like a pumpkin)
Answer: The Bane trilogy doesn't say much about Bane's plans after the Jedi were exterminated and the galaxy conquered. This goal was so far off (it took 1000 years before Palpatine destroyed the Republic) that Bane probably didn't have much of a plan himself. The closest example I can find says this (Bane's thoughts, my emphasis added):

Under his leadership the Sith had been reborn. Now they numbered only two—one Master and one apprentice; one to embody the power of the dark side, the other to crave it. Thus would the Sith line always flow from the strongest, the one most worthy. Bane's Rule of Two ensured that the power of both Master and apprentice would grow from generation to generation until the Sith were finally able to exterminate the Jedi and usher in a new galactic age.
Star Wars: Dynasty of Evil, p. 9

This indicates that Bane always intended to follow the Rule of Two. He didn't indicate much about what would happen after the Republic was destroyed, other than that it would be a "new galactic age". The Sith likely would have ruled the galaxy as Master and apprentice, with the Master holding the position of emperor as well. The apprentice would become the Master and emperor once he killed his own Master.
Another passage explains Bane's reasoning for creating the Rule of Two (again, Bane's thoughts):

By its very nature, the dark side invites rivalry and strife. This is the greatest strength of the Sith: it culls the weak from our order.
The constant battling of the Sith since the beginning of recorded history served a necessary purpose: it kept the power of the dark side concentrated in a few powerful individuals. The Brotherhood had changed all that. There were now a hundred or more Dark Lords following Kaan, but most were weak and inferior. The Sith numbers were greater than they had ever been, yet they were still losing the war against the Jedi.
The power of the dark side cannot be dispersed among the masses. It must be concentrated in the few who are worthy of the honor.
The strength of numbers was a trap … one that had snared all the great Sith Lords who had come before. Naga Sadow, Exar Kun, Darth Revan: each had been powerful. Each had drawn disciples in, teaching them the ways of the dark side. Each had assembled an army of followers and unleashed them against the Jedi. Yet in each and every case the servants of light had prevailed.
The Jedi would always remain united in their cause. The Sith would always be brought low by infighting and betrayals. The very traits that drove them to individual greatness and glory—the unrelenting ambition, the insatiable hunger for power—would ultimately doom them as a whole. This was the inescapable paradox of the Sith.
Kaan had tried to solve the problem by making everyone equal in the Brotherhood. But his solution was flawed. It showed no understanding of the real problem. No understanding of the true nature of the dark side. The Sith must be ruled by a single leader: the very embodiment of the strength and power of the dark side.
If all are equal, then none is strong. Yet whoever rose from the swollen and bloated ranks of the Sith to claim the mantle of Dark Lord would never be able to hold it. In time the apprentices will unite their strength and overthrow the Master. It is inevitable. Together the weak would overwhelm the strong in a gross perversion of the natural order.
But there was another solution. A way to break the endless cycle dragging the Sith down. Bane understood that now. At first he had thought the answer might be to replace the order of the Sith with a single, all-powerful Dark Lord. No other Masters. No apprentices. Just one vessel to contain all the knowledge and power of the dark side. But he had quickly dismissed the idea.
Eventually even a Dark Lord would wither and die; all the knowledge of the Sith would be lost. If the leader grows weak, another must rise to seize the mantle. One alone would never work. But if the Sith numbered exactly two …
Minions and servants could be drawn into the service of the dark side by the temptation of power. They could be given small tastes of what it offered, as an owner might share morsels from the table with his faithful curs. In the end, however, there could be only one true Sith Master. And to serve this Master, there could be only one true apprentice.
Two there should be; no more, no less. One to embody the power, the other to crave it.
Star Wars: Path of Destruction, p. 237

Bane considered it a fundamental issue of the dark side that it had to be concentrated in a few individuals. Its "very nature" invites rivalry, which culled the weak but weakened the Sith as a whole by causing them to fight amongst themselves instead of their Jedi enemies. Bane also thought that the existence of too many Sith was a recurring problem that had caused the downfall of all the previous Sith Lords (e.g. Revan). On the other hand, a single Sith Lord would eventually die so "one alone would never work". Thus two Sith was the ideal number, and this would always be true because of the "true nature" of the dark side. Conquering the galaxy and exterminating the Jedi wouldn't change the nature of the dark side, so the Rule of Two would always be in force.
Comment: Wouldn't the nature of the Rule of Two encourage a Rule of 3? The Dark Side doesn't fight fair, so the apprentice would use any advantage they can get, which should include having their own apprentice to help them.
Comment: @Xantec Bane explains to his apprentice Zannah that she must defeat him on her own in order to ensure she is stronger than him and has earned his position. In Bane's view, the apprentice is just shooting himself in the foot, so to speak, by ganging up on the master. There is indeed a temptation for the apprentice to gain help, but Bane's explanation that the apprentice wouldn't have truly earned the position is supposed to counteract that. Zannah's apprentice, Cognus, did stand aside while [Bane and Zannah dueled to the death](http://starwars.wikia.com/wiki/Second_Duel_on_Ambria).
Comment: Huh. My response to Bane's reasoning would be to gang up on him and then ask his dead corpse its opinion.
Comment: @Null The way I see it this it the **only** rule of the dark side......every thing else is negotiable.  (But even it is broken)
Comment: @Xantec It is not the Sith way. The Sith, if nothing else, are extremely prideful of their supposed superiority and strength. The first lesson of every single apprentice is to understand the Rule of Two and all of its intricacies. In general, Sith apprentices know they can get help in numbers, though they thoroughly understand and believe they shouldn't, and they are also prideful enough to prove they are powerful enough to best his former master alone.


Disallow wiping via Profile Manager

Question: Is it possible to prevent end users from remotely wiping their iPad in Apple Profile Manager?
I work at a school and I can foresee kids managing to steal each others passwords and remote wiping their iPad.
Comment: But you desire to avoid disabling Find my iPad?
Comment: The students seem to leak their school passwords more than their AppleID's. Also, the remote wiping in "Find My iPhone" is provided by Apple and installed by the user, so its their own fault if their iPad is wiped. On the other hand, the enrollment in Profile Manager is provided and required by our IT department.
Answer: Profile Manager has since been updated to allow the prevention of device wiping by users.

Disallow wiping via Profile Manager


problem with Random.nextGaussian()

Question: Random.nextGaussian() is supposed to give random no.s with mean 0 and std deviation 1.
Many no.s it generated are outside range of [-1,+1].
how can i set so that it gives normally distributed random no.s only in the range -1 to 1.
Answer: A Gaussian distribution with a mean 0 and standard deviation one means that the average of the distribution is 0 and about 70% of the population lies in the range [-1, 1]. Ignore the numbers that are outside your range -- they form the fringe 16% approx on either side.
Maybe a better solution is to generate a distribution with mean=0 and std.dev=0.5. This will give you a distribution with about 96% of the values in the range [-1, 1].
An even better solution is to work backward as above and use the idea that approx. 99.7% of the values lie in the 3-sigma range: use a std.dev = 1/3. That will almost nullify the amount of not-so-useful values that you are getting. When you do get one, omit it.
Of course, if you are working on a math intensive product, all of this bears no value.
Comment: Except, of course, ignoring those numbers means that your random values aren't really normal any more, are they?
Comment: @Jon Skeet: I understand the implications of my suggestion. I'm only saying that S. Lott's observations are right on spot and the OP's question is a paradoxical one. Mais,c'est la vie.
Comment: By that definition, any clamping you do on any random number generator is introducing a bias.
Comment: @dirkgently: Absolutely. It's not a normal distribution any more, just one which is "quite like" a normal distribution.
Answer: Doesn't the normal distribution include numbers arbitrarily far from the mean, but with increasingly small probabilities?  It might be that your desires (normal and limited to a specific range) are incompatible.
Answer: A normal distribution gives a non-zero (but "becoming extremely small") probability of seeing values outside [-1, +1] whatever variance you give - you're just squishing the curve, effectively.
You could use a small variance and then just run the results through a map which cropped anything less than -1 to -1, and anything greater than 1 to 1, but it wouldn't (strictly speaking) be a normal distribution any more.
What do you need this distribution for, out of interest?
Comment: BHARATH, If your statistical program requires a normal distribution, why do you not want to use a normal distribution, i.e. why don't you want to let it have its natural range?
Comment: It's not that small.  Close to 30% of the values have to be outside 1 standard deviation.  Something like 5% will lie outside 2 standard deviations.
Comment: The "becoming extremely small" was intended to imply that as you get further away from the mean, the probability of generating the value gets smaller, but still non-zero.
Comment: i am implementing a statistical analysis program. It uses normal distibution.
Answer: Gaussian distribution with your parameters. is has density e^(-x^2/2). In general it is of the form e^(linear(x)+linear(x^2)) which means whatever settings you give it, you have some probability of getting very large and very small numbers.
You are probably looking for some other distribution.
Answer: A standard deviation of 1.0 entails that many values will lie outside the [-1,1] range.
If you need to keep within this range, you should use another method, perhaps nextDouble().
Answer: This code will display count number of random Gaussian numbers to console (10 in a line) and shows you some statistics (lowest, highest and average) afterwards.
If you try it with small count number, random numbers will be probably in range [-1.0 ... +1.0] and average can be in range [-0.1 ... +0.1]. However, if count is above 10.000, random numbers will fall probably in range [-4.0 ... +4.0] (more improbable numbers can appear on both ends), although average can be in range [-0.001 ... +0.001] (way closer to 0).
public static void main(String[] args) {
    int count = 20_000; // Generated random numbers
    double lowest = 0;  // For statistics
    double highest = 0;
    double average = 0;
    Random random = new Random();

    for (int i = 0; i < count; ++i) {
        double gaussian = random.nextGaussian();
        average += gaussian;
        lowest = Math.min(gaussian, lowest);
        highest = Math.max(gaussian, highest);
        if (i%10 == 0) { // New line
            System.out.println();
        }
        System.out.printf("%10.4f", gaussian);
    }
    // Display statistics
    System.out.println("\n\nNumber of generated random values following Gaussian distribution: " + count);
    System.out.printf("\nLowest value:  %10.4f\nHighest value: %10.4f\nAverage:       %10.4f", lowest, highest, (average/count));
}

problem with Random.nextGaussian()


how to get balance for multiple addresses(batch request)?

Question: I need to check the balance for multiple addresses (i.e. 100) a eth_getbalance seems to accept only one address.
Answer: As far as I know, retrieving balances for multiple addresses is not supported yet by the RPC standard.
However, what I've came up with so far is this: I pack all balance calls into promises and do Promise.all by chunks of 50 requests for instance. It waits for the first 50 balances, then queries next 50 and so on. Code:
async function getAllAddressBalances (addresses, batch = 50) {
    const map = new Map();
    let processed = 0;
    process.stdout.write(`Processed: ${ processed }/${ addresses.length }`);
    for (const batch of splitArray(addresses, batch)) {
        let retry = true,
            pss = processed;
        while (retry) {
            try {
                await Promise.all(batch.map(address => (async function () {
                    let balance = 0;
                    balance = await web3.eth.getBalance(address);
                    process.stdout.write(`\rProcessed: ${ ++processed }/${ addresses.length }`);
                    if (balance === 0)
                        return;
                    map.set(address, balance);
                })()));
            } catch (e) { // Sometimes rate limit may apply, this tries over and over again
                console.log(`Exceptions caught (possibly node rate limit), retrying in 5 seconds...`);
                retry = true;
                await delay(5);
                processed = pss;
                continue;
            }
            retry = false;
        }
    }
    process.stdout.write(`\n`);
    return map;
};

function splitArray (array, len) {
    const arr = [];
    for (let i = 0; i < array.length; i += len) {
        arr.push(array.slice(i, Math.min(i + len, array.length)));
    }
    return arr;
}

Alternatively, you can rely on third-party APIs like Etherscan, there are a plenty of those. As for Etherscan, they have an endpoint that enables you to get Ether Balance for multiple Addresses in a single call.
Answer: You might write and deploy a smart contract that has a single method that will check the balance of multiple accounts and return you multiple balances concatenated. Then call this method and decode result.
Here the solution for a similar problem:
https://github.com/pooltogether/etherplex
A problem that etherplex solves is similar but not exactly the same:
You have a single address but multiple tokens, special smart contract + JS wrapper that uses ether.js returns you unpacked response from this dedicated balance checker contract
Answer: geth is using jsonrpc which is an open specification.


Bad sectors, S.M.A.R.T., SpinRite, firmware on platter and drive id questions

Question:
Is it possible for S.M.A.R.T. to give false readings (say I was fiddling with lots of recovery programs, transfers, so on and so forth) or is it absolutely a read-only direct correlation to the physical status of a drive?
Does SpinRite level 5 "recover bad sectors" operate on those marked at the factory? Are they on the same level as your generic bad sector, with SpinRite thus having full access?
The main firmware of (many?) drives, like a WD Passport is stored on the platter. How is it protected? Might SpinRite's sector recovery corrupt it?
Is the failure of a drive to report valid identity information (hdparm -I /dev/xx) consistent with corrupted firmware, or just general disk failure? I may be misunderstanding the role of firmware here. I feel I've read a drive's identity information is on the platter, just like the partition tables and so on. Is this true?
Comment: I can't definitively answer the others questions but the firmware, at least in the drives I've worked with, is not on the platter. It's in EEPROM on the board. That's why it takes so long to write so little when flashing the firmware.
Comment: tldr; could you edit this down some? Also, it belongs on superuser.com
Answer:
Smart records a large number of values on the disk. For each value there is a limit before errors are reported. If you are getting smart errors your disk is most likely in a bad shape, but smart is not guaranteed to give a warning. Some types of abuse (starting and shutting down the disk very often) can give early smart errors.
I don't know what interface SpinRite uses against the disk. There are on some disks a factory interface used when producing the disks, but I don't think the disks exposes this without special hardware. Otherwise it can only read/write the standard drive parameters, and not easily access blocks marked as bad by the firmware.
No disk (after IDE) stores the whole firmware on platter. Because it needs a firmware to read the platter. Disks before IDE/SCSI some times did not have firmware. I see no reason to store firmware on platter.
The information about the disk geometry and such is stored in firmware on chip. Failure to report it can be a sign of a dead disk, but also communication problems with the disk (for example a master/slave conflict).

If the disk can't report geometry you will usually not be able to read it anyway. In those cases I typically recommend restoring from backup... Because you do have backup, right?
Answer: http://www.linuxjournal.com/magazine/monitoring-hard-disks-smart
I have found similar conclusions.  We've had drives fail more frequently that give no indication on smartctld.  SMART detects read errors, drives can fail mechanically or have the controller board fail which is never/rarely predictable.


Is possible to make small HF microstrip or helical antenna by using high permittivity dielectric material?

Question: Is possible to make small HF microstrip or helical antenna by using high permittivity dielectric material like SrTiO3 ?
Answer: Yes.
The electrical dual of an antenna loaded with a high permittivity material is the loopstick antenna. Loopstick antennas are common in portable AM receivers.

The antenna consists of some turns around a high permeability core. This core effectively multiplies the magnetic field by aligning its own magnetic domains with the magnetic field due to the current in the coil.
Likewise, a material with a high dielectric constant, or permittivity, can be used similarly to multiply the electric field. This can be used to construct an antenna with an effective aperture much larger than would otherwise be attainable.
Because these antennas are electrical duals, what is true about the loopstick antenna will be analogously true of a dielectrically loaded antenna. Like the loopstick, an antenna loaded with a high permittivity material will have a reactive impedance, though it will be capacitive rather than inductive. Like the loopstick, or indeed any small antenna, as size goes down, so does operating bandwidth. And like the loopstick, the properties of your antenna will be limited by the dielectric material.
Comment: How to calculate the useful antenna dimensions ? e.g. if I make helical antenna with 1/2 wavelength , and if  I use SrTiO3 core wich have dielectric constant of 304 , is that mean the 1/2 wave antenna with this dielectric core will have  "1/square root of 304"  1/17.4 length of the 1/2 wavelength helical antenna without core and still have the same gain ?
Comment: @abduoman11 The solution is probably much more complex than that. In the general case you can use a 3d field solver, or you can just build the thing and measure it. I imagine for some specific antenna types there may be some rules of thumb, but I didn't run across any in my research, probably because this is not a common thing to do.
Comment: Note that, in contrast to patch antennas, you cannot use these loopstick antennas for transmission, except for *very* low powers. The ferrite materials saturate very easily, and even at low power exhibit non-linear behaviour, generating harmonics.
Answer: Yes, you can!
Most of us have two arrays of these as the rods and cones in the retinas of our eyes.

The permittivity of the dielectric even does not need to be that high.
I used high-density polystyrene $(\epsilon_r=2.55)$ to build a 10GHz dielectric rod antenna with a measured gain of 20.5dBi.

Dielectric rod antennas support the propagation of a surface wave along the rod. At the end of the rod, this surface wave will interfere with the space wave, also launched by the feeder. Together this creates the large directivity of this type of antenna.
Once you understand dielectric rod antennas, you will also understand long Yagi-Uda antennas because the space between the Yagi elements can be regarded as an artificial dielectric.
Comment: This answer is about adding dielectric structures to antennas that are already self resonant in order to increase directivity. This is not the same thing as making electrically *small* antennas as was asked in the question. In fact, the antenna you picture is many wavelengths long: it is *huge*.
Comment: you  talking about 10 GHz , but what about HF & MF ? is  using  high permittivity dielectric e.g. dist. water effective at these low frequencies ?
Answer: It certainly seems to be possible.
This recent paper mentions physically small inverted-F high dielectric-constant (e=10.2) HF antennas, although it covers another approach (it describes an HF antenna running at frequencies of the order of 20-30 MHz which is only 15cm x 15cm and weighs under 20 grams, but doesn't use high dielectric-constant material. Interesting in its own right, although I think it's rather narrow-band).
Note, though, that the paper says the high dielectric-constant HF antenna will have losses of around -33dBi "due to ohmic and dielectric losses", but claims slightly more cheerfully that its own design is 6dB better than that.
Almost all of the commercial interest in high dielectric-constant antennas is at UHF and above, because these days that's where the money is. Still fertile ground for the committed experimenter, though. If you find a way to run Top Band from a small apartment, I'll be in the queue...


Fantasy book with magical tattoos

Question: I'm looking for a book where two main characters have got magical tattoos. One guys name is Will and a girl by the name of Jess.
Comment: Not much to go on.  Can you add any other details?  Any of the plot or setting?  When did you read it?
Answer: Could this be Clockwork Angel?

This book is the first in The Infernal Devices, one of the various sub-trilogies set in the Shadowhunters universe.

Most of the main characters are Shadowhunters, or Nephilim. They have runes inscribed on their skin (which look very like tattoos, and are referred to thus by the unenlightened throughout the series).
Two of the main characters are Will Herondale and Jessamine Lovelace. The latter is certainly called Jessie at various points in the books, and probably Jess. It is also possible that you are thinking of Jem Carstairs, another character.
Comment: Nice. I actually read this, but I'd forgotten about the tats. Guess I didn't find it that memorable...

Fantasy book with magical tattoos


Bump map is not affected only my unwrapped faces

Question: I have unwrapped the faces where I wanna put my bump map (details of a pirelli's tire), the problem is that is affecting also the other faces even if I setted the image texture to clip. I scaled in UV editor the unwrap faces to let enough gap from the edge's border and the texture image.
Comment: Nobody can help me?
Answer: I fixed a little bit by duplicate the rubber's material, added only on the second one the bump map and assigned this to selected faces, but in this way if then I will change some settings of the rubber's material (the first one) I have to copy every single new setting to the bumped material.


Security for IV in AES-GCM mode

Question: I'd like to use AES-GCM instead of HMAC for authentication and privacy in a token used in a web application, but I'm unsure how to securely tag each token with an IV. Is it safe for me to prepend the IV in front of the AES-GCM data, or do I need to protect it somehow?
Answer: It is indeed safe to send it along with the ciphertext; the attacker can't learn anything from it (other than possibly how many packets has been generated so far, if you use a counter to generate the IVs), and if the attacker modifies the IV, the resulting message will fail to decrypt (with high probability).
Existing protocols that can use GCM (TLS, IPSec) do exactly that: prepend the IV in front of the AES-GCM data.
Comment: @william_fr: well, no, for GCM, you don't need to include the IV as a part of the AAD; any modification to the IV with modify the authentication tag anyways.  Of course, it doesn't hurt anything to include the IV in the AAD either.
Comment: Complementary comment following previous implementation of gcm-aes : iv has as indicated to be appended in clear form with the ciphertext but in addition it must be part of the clear AD data sequence included in mac computation so to prevent at 100% from iv modification. lastly gcm cannot really be compared with hmac which only performs mac based authentication and not encryption
Comment: you are right as iv is internally used by ghash function (gcm/gmac specifity). In my application the complete security header (key number, iv , anti replay counter ...) is de facto included in AD data but as you indicate it was not mandatory for the iv (redundant protection).thanks for the correction.

Security for IV in AES-GCM mode


GRANT privileges to table elements

Question: What happens if I GRANT priveleges (for example SELECT) ON a table TO some group role? What privileges will the table's elements have in this case: indexes, sequences, columns? Should I explicitly GRANT privileges to them if I REVOKE ALL ON SCHEMA public FROM GROUP role and FROM PUBLIC previously?
Answer: Sequences are separate objects with separate privileges.

Granting permission on a table does not automatically extend
  permissions to any sequences used by the table, including sequences
  tied to SERIAL columns. Permissions on sequences must be set
  separately.

Indexes belong to the table. To DROP or CREATE an index you must be the owner of the table (or superuser).
Columns go with table privileges. Granting privileges on the table grants applicable privileges to all columns automatically.
For DDL commands (ALTER TABLE ...) you must own the table again.
Since PostgreSQL 9.1 there are column level DML-grants additionally. But:

A user may perform SELECT, INSERT, etc. on a column if he holds that
  privilege for either the specific column or its whole table. Granting
  the privilege at the table level and then revoking it for one column
  will not do what you might wish: the table-level grant is unaffected
  by a column-level operation.

More details in the manual about GRANT, where the quotes are from.
Comment: So if I GRANT SELECT, INSERT or UPDATE to a table I'll be able to access its sequence values (at least select or read currval). Will it work like columns which goes with table privileges? Or need to explicitly assign smth like USAGE to use it?
Comment: @AlekseyK: Have you read the first sentence of my answer and the following quote from the manual? A sequence is just a special table with its own privileges, even when attached to a table column. GRANT privileges explicitly.
Comment: Thank You, I understand. Actually, I think, I do not need to work with sequences in my task as I only need to query column value with serial type after INSERT or UPDATE and I have such access if I have access to the table. So assigning a privilege to a table only will be enough for me.
Comment: @AlekseyK: On creation, the `serial` type implements an attached sequence with matching privileges. If you later change the privileges of the table, you may have to change privileges of the sequence, too, for `INSERT` commands. (Not for `UPDATE` or `DELETE`, which don't involve the sequence.)
Comment: Yes, You are right, need to change privileges for sequence too (SELECT, UPDATE), don't work without it. Thanks. :)

GRANT privileges to table elements


Which Avenir Next typefaces are most versatile?

Question: Having a limited budget, which 2-3 out of the 24 Avenir Next typefaces are most useful for web design?
Answer: This is a very personal choice, but in terms of having variability... I'd choose the ultralight for a title in big boxes (it would look great with a solid background a big font size). Demi or Bold italic are stronger and have more "character" (in my opinion!) so I'd use either of them for page titles (main title, perhaps. It looks good above 18px).
And I guess you could have a regular for smaller titles like h3 or h4 and for general use in the page. By the way, I'm sure you know this, but you can't distribute these fonts in the website using @facefont, so they would only be in images. If you use GLP (free open) fonts instead, you can have them in the website and redistribute them (depending on the license, but it's generally like that).


Small cactus from garden center identification

Question: I bought a small cactus from the garden center, but it doesn't say which species it is. Can anyone identify this cactus? For reference I put it next to a coin of about 3 cm (1.2 inch) in diameter. Thanks in advance.
Answer: It's almost certainly a species of Ferocactus.  Unlabeled garden center plants usually are more or less common species... though not always! Ferocactus haematacanthus is a very rare species... there is another species with almost the same name-- F. hamatacanthus (missing the "e") is much more common.  (The name with the "e", haematacanthus, means "blood(red) spines"; without, ie. hamatacanthus, means "clawlike or hooked spines".)  But then, juvenile species of the genus often look very much one like another.  I wonder if it is F. macrodiscus-- I've seen young plants of this species that look almost exactly like yours... but there are probably  a half-dozen or more others that also do. Blooms might decide it, but apart from F. fordii, Ferocactus plants usually won't bloom until they grow very large indeed. After some 4-6 years the adult spination will also aid in identification.  In any case-- it's a really nice plant!
Regards, John in Florida
Comment: Thanks, John. I hope it will bloom, maybe the flowers can tell us more!
Answer: Nice plant! I don't have an ID for you. I can tell you it's some sort of barrel cactus. They are hard to ID when they are young (for me, anyway). I recommend repotting it into something a little roomier.
Possibly Ferocactus haematacanthus.
Comment: Thanks again, they all look very similar indeed at this stage. So I'll have to wait a few years and post again when it has some flowers (if it will ever bloom here in Holland). I have put it in a little bit larger container already (this one was really small).


Confusion about Aerodynamic center

Question: suppose, i assume Aerodynamic Center lies at Center of gravity.  Then apparently moment by lift will be zero about CoG. But in reality Centre of Pressure may be behind aerodynamic center and still be producing a moment. So isn't using aerodynamic center absurd?
Comment: [Related](https://aviation.stackexchange.com/q/19388/62)
Answer: It's easy if we clarify your statement a bit.
When aerodynamicists say "moment by lift", this means the derivative of moment by lift. That is, the change of moment per change of lift, $\partial M/\partial L$, or shorthand $M_L$ (or their coefficients more commonly: $C_{M_{C_L}}$). Stability analysis (that's where the aerodynamic center is most useful) is all about derivatives rather than actual forces and moments: we are interested what changes when conditions change.
In this light, "moment by lift" will be zero, true, but "just moment" won't be.
Comment: This makes much more sense.
Comment: so can we say that neutral point is an aerodynamic center itself? because dM/dAlpha equals zero condition is satisfied here. isn't it ?
Comment: Yes, in normal usage, neutral point is the aerodynamic center _of the whole aircraft_. Sometimes the terms are used interchangeably when the contexts is clear.
Comment: thanks, can you also clarify one more thing for me.
do spoilers only decrease lift or , they increase drag also?
some say spoilers only decrease lift but on wiki it says it decreases lift and increases drag?
Comment: This is worth a separate question, but briefly, both, of course. It's just some people like to point out that the main _point_ of spoilers is to decrease lift, which may feel counter-intuitive.
Answer: First of all, I am going to comment on your statement

Then apparently moment by lift will be zero about CoG.

This is not apparent and not necessarily true, as your next comment also implies you know about.

But in reality Centre of Pressure may be behind aerodynamic center and
  still be producing a moment. So isn't using aerodynamic center absurd?

I cannot answer whether or not the aerodynamic center is absurd. I will instead give an explanation of why it is reasonable to define the aerodynamic center.
You are right in the fact that the center of pressure may be behind the aerodynamic center and hence produces a moment around the center of gravity which you assume equal to the aerodynamic center. In fact, a lifting force through the center of pressure produces a moment around any point not equal to itself, hence also the aerodynamic center.
Consider an airfoil at a given angle of attack and fix the airfoil in some arbitrary point p along the chord line. We can now (at least theoretically) determine the pressure distribution around the airfoil and use that to calculate the aerodynamic force from these pressure variations and the center of pressure. The force acting through the center of pressure gives rise to a moment around p proportional to the arm, i.e. the distance between the center of pressure and p.
If we change the angle of attack, the pressure distribution changes. Therefore, the aerodynamic force and the location of the center of pressure and the moment all change. If we had still fixed the wing at p, the size of the moment would most likely have changed by now.
We see that determining the aerodynamic behavior of an airfoil is very complicated if we use the center of pressure to analyze the forces because all variables (leverage, force and moment) change when we change the angle of attack.
We could have computed the moment about any point on the airfoil. Given a pressure distribution, the aerodynamic force will be the same, but the value of the moment depends on the point where that force is applied. It has been found both experimentally and theoretically that, if the aerodynamic force is applied at a location roughly 1/4 chord aft the leading edge on most low speed airfoils, the magnitude of the aerodynamic moment remains nearly constant with angle of attack. Engineers call the location where the aerodynamic moment remains constant the aerodynamic center of the airfoil. Using the aerodynamic center as the location where the aerodynamic force is applied eliminates the problem of the movement of the center of pressure with angle of attack in aerodynamic analysis. The aerodynamic center is important when determining the longitudinal stability of an aircraft.
You can think of the aerodynamic center as the point through which the part of lift, which is dependent on the angle of attack, acts.
A figure showing the constant aerodynamic center for angles of attack equal to 8, 4, 0 and -4 degrees. Notice the negative lift on the forward part of the wing at negative angles of attack compensating for the large leverage of the center of pressure (here denoted TC).
Comment: But if my CoG somehow coincides with Aerodynamic center, I multiply the lift produced by the distance to the center of gravity which is in this case is zero. So mathematically the answer is coming zero but in reality it is not. So isn't this a shortcoming?
Comment: The lift acts trough the center of pressure, not the aerodynamic center - see the illustration. Here TC is the center of pressure. There will be a moment UNLESS the center of pressure coincides with the center of gravity.

Confusion about Aerodynamic center


Are there any tools out there that measure Angular unit test coverage?

Question: I'm looking to see if there are any tools available to see how much of a code base is covered in unit tests.
Answer: There are a lot of frameworks/libraries nowadays for running/doing tests, but if you are using AngularJS you're probably testing with a combination of Mocha and Jasmine.
In any case you can achieve what you want by using coveralls. Just to get you an idea, this is something similar to what you would get:

NOTE: Just in case you are interested, I'm using this generator. It will give you a "nice" setup/skeleton from the beginning; as always, you can tune the project structure and everything else later.
Answer: If you started your Angular app from a generator that uses the Karma test runner, such as generator-angular, then install karma-coverage to generate code coverage reports.


Job offer was rescinded due to security clearance?

Question: My husband received a conditional offer for a job that required security clearance. After they investigated him the report has "No Determination Status. Therefore the job offer was rescinded. We are holding off applying to other goverment jobs, untill we figure out what's up on his records. Can anyone point us
where to or what to do on this situation
Comment: What country was this?
Comment: Could you elaborate on what the report said? After a brief Google search, "no determination status" does not seem to be a widely used expression. What else did the report say? Which organization did it come from?
Comment: Was this a job that required an existing security clearance or was it a job that required the ability to obtain and maintain a security clearance? Some positions require you to already have a certain level that can be checked and transferred in, while others will sponsor you for a new clearance. Unfortunately, individuals don't have much insight into the process unless they go through a company's security officer.
Answer: I'm no expert,  but from what I can see "No Determination Status" won't be about what's in the file,  but rather that they didn't find enough information to determine the clearance.   So likely they didn't get enough info from any references/employers to make a decision.
Answer: Page 8 of this report: http://fas.org/sgp/othergov/intel/clear-2013.pdf contains some reasons why people were denied/had their clearance revoked.
there is also this article:
http://news.clearancejobs.com/2009/11/14/rebutting-and-appealing-security-clearance-denials/
I think we need more details than you probably want to provide to offer better insight.


Higher level Spells

Question: I just want to know if anyone has found any higher level spells? For example is there a Bound Armor spell in Skyrim? If so who do I buy it from? I'm level 47 and I keep checking for a Bound armor spell or more advanced Restoration spells and I just can't seem to find any. I have Bound Sword, Bound Battle Axe, and Bound bow, but where are all the master spells?
Answer: There is no bound armor spell, unfortunately. You can check the list of spells on UESP Wiki.
Answer: Before higher-level spells are available to you, you need to become proficient in whichever field of magic they require. Also master level spells are only available once you finish the "final exam" quest for their particular field of magic. But if you learn every single spell in the game, you will find that there is no bound armor spell.
Answer: The closest thing to bound armor spells in Skyrim are Flesh spells in Alteration.
You will probably want to talk to Tolfdir at the College, as he is the master Alteration trainer. There may be one or two other mages in Skyrim that sell adept level Alteration tomes, but only Tolfdir sells expert spells and he is the one to start you on the quest for master Alteration spells(one of which is the strongest flesh spell in the game).

Higher level Spells


Splitting data into training and testing sets - keep ratios of binary response

Question: I have data with binary response (default of a client). I want to split the data into training and testing sets. I have 300 default clients and 700 non default clients. When splitting, should I make sure that the training set keeps the same ratio 3:7 of defaults? Or can I simply take a random sample?
Comment: If you take a randam sample, then the 3:7 ratio will approximately be kept, so in my opinion you do not have to correct, So I would take a random sample.
Answer: R's createDataPartition function from package caret does that for you. It would not necessarily keep the response in the same ratio, but would split your data with least bias.
Comment: My question was not how to do it (how to keep the ratio) but whether it is a correct way to analyse data.
Answer: Yes, you can take a random sample.
As the difference between the two types is significant, a random sample would obey(almost) the same distribution.
You might want to read up on random sampling, for appreciating the concept and executing it with confidence.
Answer: If you want to be sure to keep a perfect ratio without introducing a selection bias, you could select respectively all the 1 values, sample it and select the quantity you want and do the same with the 0 values.
The ultimate question would be, what do you plan to do with your data once you've done the split ?
Comment: The reason for splitting is to develop the model (what covariates to use) and fit it on the training subset. Then I want to use the testing subset to check if the model predicts well. Anyway, I've done a random sample and the ration has remained almost the same (29.5 % : 70.5 %). I guess I can work with it.
Comment: Yep, that's the simplest way and as your data set increase, the ratios are gonna be closer to the ideal one due to the Law of Large Numbers.
My answer was provided in case that your sample is small to do a perfect ratio selection.


Can I have two SBS 2008 servers both act as DC's in the same domain?

Question: I have a Customer that has two locations. They have an SBS 2008 server running in each location as a DC for diff domains (ie. Bobs1.local and Bobs2.local).
They now want to connect the two locations via VPN and use just the Bobs1.local domain. They want to remove active directory from the SBS 2008 server in the second location, join it to the Bobs1.local domain and then DCPromo it the make it a Domain Controller.
The Bobs2.local domain is small enough that it is doable and it would make management easier and add redundancy.
My question is can I have two SBS 2008 servers both running as Domain Controllers for the same Bobs1.local domain or are there some limitations in SBS 2008 that would prevent this?
Answer: You cannot have multiple Windows Small Business Server 2008 computers joined to the same Active Directory domain. This is a violation of the license agreement and will cause one (or both-- I haven't tried it to see) of the servers to shutdown regularly with license violation warnings.
If I were in your position I'd contact Microsoft re: transitioning the SBS licenses you have to full version licenses. In Windows SBS 2003 the offering was called a "Transition Pack". The Microsoft web site makes some references to such an offering for Windows SBS 2008 but I'm not finding good details about it... (a twisty maze of passages)
re: the "Premium Edition" entitlement
Windows Small Business Server 2008 Premium Edition comes with an entitlement to install a second Windows Server 2008 machine (which can be a domain controller in the SBS domain). That doesn't entitle you, however, to install Exchange or any of the other SBS Server components on that server computer (see http://technet.microsoft.com/en-us/library/dd469604(WS.10).aspx for details on the specific entitlement).
Answer: It looks like there's a specific procedure to follow when doing this with SBS, through the SBS-wizard interface. Hopefully this helps.
Also, if the second site is close enough to run the server over to the bobs1 DC, it's sometimes worth it to do the dcpromo that way, just to save time, depending on your setup.
Answer: Functions were added in SBS 2008 Premium to allow a multiple SBS servers in the domain. Prior versions of SBS do not allow a second SBS server in the domain, although additional member servers and (I believe) second DCs are allowable.
The Microsoft document linked in Kara's answer is part of the discussion on that feature.  I don't think Exchange can be loaded on both servers.  This document discusses in more detail what can and can't be done with SBS 2008 on multiple servers.
IMHO, since you have fewer than 75 users, having them split among two mail servers is overkill anyway.  I suggest migrating the users and shared files from one domain/server to the other, removing the second one, installing the second SBS server from scratch at the second location as a DC and file/print server only, and moving the necessary shared files back.
Comment: The "Premium" edition allows two servers-- one is the "SBS Server", and the other is just a Windows Server machine. You're not entitled to load Exchange on both. Having said that, I wouldn't necessarily say splitting users over two Exchange Server computers is "overkill". From a capacity standpoint that's probably true, but if the VPN is low-bandwidth, high latency, or the users are heavily using file attachments in their email, the users in each location will probably see a performance improvement by having an Exchange Server computer on their LAN serving their mailboxes.


Evenly spaced circle grid in Illustrator

Question: On an 8" x 8" artboard, how do I evenly place 8 1" circles to make a circular grid? They should be overlapping by 1 pt.
Comment: Taking two 1" circles, placing one on each end and creating a blend to span the distance. And then copying and pasting that row 8 times. Not exactly precise.
Answer: You realize that 16, 1" circles will not fill an 8x8" artboard, right? You need 16, 2" circles to fill 8x8" or 32, 1" circles.

draw a rectangle, 8" x 8" and center on the 8x8 artboard.
choose Object > Path > Split into Grid
enter 4 rows and 4 columns for 16, 2" circles (enter 8 rows 8 columns for 32, 1" circles). Make certain the Gutter values are set to zero and click Ok.

choose Effect > Convert to Shape > Ellipse
tick "Absolute" and enter either 1" or 2" into the width and height fields and click OK

Lastly, choose Object > Expand Appearance to get the circles as objects rather than squares with effects applied.

These are 2" circles, not 1" in order to fill the 8"x8" area.
Comment: Worth mentioning that, if anyone wanted to use this method with a shape that couldn't be made using the Convert To Shape menu, they could use the [Copy to multiple objects](http://www.wundes.com/JS4AI/) script.
Answer: Here's an alternative that works just as well on circles and also works on any other shape or group, not necessarily just the three in the 'Convert to Shape' menu. Also, this way, the number of items in the grid and their spacing remains completely editable until you choose to expand it.
Use Effect > Distort and Transform > Transform (note the 'Move' and 'Copies' settings):

...then, do the same again, Apply New Effect, and do it vertically instead of horizontally with the appropriate number of copies:

Until you expand it (Object > Expand), it remains completely editable:
1- You can change the number of copies, the spacing, and add things like rotation at any time by editing the effects which are stored in the Appearance window (window > appearance).

2- Double-clicking into isolation mode on the original then editing it immediately updates all the copies.

If you want to use the Grid method on any shape or object, check out the Copy to multiple objects script.


How to measure growth of algae with colorimeter

Question: I am doing an lab for IB Bio and don't know how to use a colorimeter to measure growth in algae. The experiment I am doing will measure the effect of pH on algae growth. The algae will be taken from a fish tank and will include cyanobacteria, diatoms, and algae bloom. I don't know how the transmittance/absorption will relate to growth. I also don't know which wavelength of light to use. Help would be appreciated, thanks!
Comment: There is/was no lab manual providing you with instructions/recipes/protocols to complete this assignment? You received no instruction or demonstration on how to use the equipment/instruments? There was no lecture material on the theory behind the experiment? That strikes me as rather unusual. What if you electrocute yourself trying to turn on the colorimeter? What if you accidentally ingest one of the solutions or the growing cells? That could potentially be dangerous.
Comment: What is the color of the algae? What is the complementary color of that?
Comment: You can measure the turbidity of water using turbidimeters, however, that would not say whether it is caused by algae or something else. Best way, IMO, is to take samples and calculate biomass but there is no straightforward way to do this optically.
Comment: The color of the algae is a brownish green.
Comment: No, I did not receive any lab manual. We must design it ourselves.
Answer: Let's be clear, you are using a colorimeter, not a spectrophotometer?
Can you provide the brand name and model number of this colorimeter?
Have you learned about the Beer-Lambert Law? It states that A = Ecl where
A is the Absorbance
E is the molar extinction coefficient
c is the concentration of the unknown
l is the length of the light path through the sample (the standard path length is 1 cm in spectrophotometers).
The first thing you need to do is measure lambda Max, the wavelength of light that is absorbed the most (or transmitted the least) by your sample. The Beer-Lambert law is linear when A is between approx. 0.1 and 1.0.
So take a dilute solution of the algae and starting at the smallest wave length of light that the device can emit (you can vary the wavelength?). Take readings of the Absorbance and then increase the wavelength by 10 nm. Starting at deep purple, and ending at far red, write down the A values. Plot this data with A on the Y-Axis and wavelength in nm on the X-axis. There should be a distinct maxima in the curve, that is the most sensitive wavelength, and is the one you should use for all your experiments. If the algae is green, then the maxima should be over in the red end of the spectrum (like chlorophyll).
Next you need to make a standard curve that correlates the Absorbance at lambda max with the number of algal cells in the cuvette (the test tube you put in the colorimeter). That means you need an independent method of counting the number of algal cells. If they were bacteria or yeast then you could plate them on agar-filled Petri dishes and count the number of cells per mL (for example). For some cells if you have a high powered microscope and a hemocytometer then you could visually count the number of cells per mL. If neither of these methods are available then you could measure the mass of algal cells by weighing them on a balance.
So by some method you will be able to plot the number of cells in the broth vs. the Absorbance (plot A on the Y-axis).
From this you can empirically determine the molar extinction coefficient of these algal cells.  Then you just need to measure the Absorbance at lambda max on  dilute aliquot of the cell culture and you will have an accurate measurement of the number of cells per mL.
With this assay working then you can inoculate a bunch of identical cultures, that vary by the pH of the growth medium. By removing small aliquots of the cultures at the same time points you will be able to plot the number of cells (on the Y-axis) versus the time they have been growing, and you will see if varying the pH alters the shape or magnitude of these growth curves.


Can someone sue their partner for having an abortion?

Question: If a woman has an abortion against the will of the father, can the father sue the mother?
Answer: The question didn't mention marital status, but since states formally recognize that relationship it's helpful to start there.
tl;dr: The Supreme Court decided state laws that required a woman to notify her spouse were unconstitutional.  Thus it's unlikely there'd be grounds for suit.
Background
The central mechanism of Roe v. Wade (U.S. 1973) was a balancing act between what it decided was a 14th amendment right to privacy and the state's interest in both the health of the woman and the potentiality of life.  Because Roe explicitly recognized a state interest, Pennsylvania passed a statute in 1982 that required informed consent and a 24-hour waiting period.  It also mandated parental consent for minors (with some exceptions) and spousal notification.  This reached the Supreme Court in Planned Parenthood of SE Penn. v. Casey (U.S. 1992).
There, the court upheld most of the Pennsylvania law (reinforcing its statement in Roe that a state does have an interest) but struck down the spousal notification portion.  To do that, it determined the appropriate test was whether a state was placing an undue burden---a significant obstacle---in the path of a woman seeking an abortion prior to fetal viability.  It reasoned that:

state regulation impacts a female's liberty more than male's during pregnancy (by way of biology)
if a man and woman disagree, only one can prevail
not all women are equally impacted by a notification mandate (for reasons of domestic violence, etc.)

Combining this with the notion that women do not lose any constitutionally protected liberty upon marriage, it decided spousal notification would be a significant obstacle and thus an undue burden.  In other words, unmarried women don't have spouses to notify, so placing a notification requirement on married women creates an additional burden that the court found undue.
To get back to the question, the father certainly has a right to file a suit against the female (...and it happens from time to time).  However, it likely wouldn't go far.  Since unmarried women were the baseline in Casey, it's unlikely there'd be grounds for either married or unmarried fathers to sue their female partners.  This comes up frequently under the moniker of "Father's Rights," which has gained less traction in the U.S. than in other countries.  That said, Wisconsin recently introduced a bill that would allow fathers to proceed against abortion providers.
Answer: For there to be a cause of action, the father must have suffered damage. It would be impossible to convince a court that he had.
Further, government (including the judiciary) post Roe v. Wade does not have the authority to interfere in the mother's decision so an injunction is not possible.
Comment: Father has no say under U.S. Law.
Comment: Wait, what about the reverse question -- surely one can prove damage for having to pay financial support for 18 years?!
Comment: @nomen, why do you keep editing out the hypothetical counter-questions in the answers?  "On what basis would they sue?" is a great start to an answer.
Comment: @cnst nope. Financial support can also be obtained even if father wanted there to be an abortion. The father can on the other hand sue for parental rights, if he thinks the mother is unfit to care for the child.
Comment: @cnst There's precedent in the US for wrongful birth claims, but only if the doctor breaches some duty of care owed to notify the parents that the child is likely to be born with some congenital defect.
Comment: Can the father sue for the trauma of finding out their child was aborted and the mental suffering?


How can I get a blotch free clear coat on raw unstained wood?

Question: I am working on a remodel job and we are having trouble getting a blotch free clear coat. We are using water based polyurethane on new cedar, no stain.
Comment: Welcome to Woodworking SE. To get a feel for how things work around here, make sure you take the [tour]. Make sure you search previous Q&A for possible answers to this question; techniques for blotch-free softwood finishing is a pretty common question, so you might find someone has already answered it.
Comment: Could you describe the blotchiness you're getting in greater detail please? A few pics of some of the problem areas would not hurt either.
Answer: It may take several coats unfortunately. Due to the nature of the wood, lightly sand between coats. Maybe a clear stain would work to provide protection of the wood.
What are you making more information may help
Answer: Blotching comes from the wood soaking up the clear coat unevenly. That can not only be an issue with staining wood, but also natural finish in some cases, possibly due to the presence of oils. One way to minimize it would be to seal off the wood with a dewaxed shellac first. Good news, it dries fast and you can put down your polyurethane after 1 hour.


Sales rankings for chess books?

Question: Are there any estimates sales rankings for chess books? How much do a bestselling chess book generally sell?
Answer: Obviously, how much money book selling is a business secret. Nobody will tell you, you will never get the information.
But I do work with book publishers, they can comfortably pay my invoices with good profit margin. Furthermore I sell few database apps on the app store (www.smallchess.com), while I'm not a publisher I make non-trivial returns.
Selling chess books won't be make another Jeff Bezos, however, it's still a profitable business. In fact, selling books give better returns than being a 2700+ grandmaster. Unless you're like in the top 20 of the world, selling a good book (or running a business) makes more money.
Why? While the chess marker is much smaller than say football, the chess market is dominated by high-income earners. Chess books buyers have good purchasing power, because if they don't they would have better things to do than chess.
Well known book writers rely on commissions from their books for living.
Answer: Amazon publishes best sellers lists by category, and here is the one for chess.
This is obviously not perfect since it's just for Amazon (although they do have what one might call a significant share of the market), and it doesn't tell you anything about how much does a bestselling book generally sells, but I hope it's better than nothing. Also if you look at the page for a specific book, it tells you its ranking among books in general. For example, for Bobby Fischer Teaches Chess it says "#3,480 in Books" as of this writing.
Answer: New or used?  Hardcover, softcover,  or ebook?
Most hardcovers are in the range of 28usd +/-
Most , not all, soft and ebooks are priced closer to 15 +/ and 10 +/-
Amazon has popularity rankings which only relate to current sales.
You should go by reviews not ratings or price.  Be sure the content is what you will find useful.

Sales rankings for chess books?


Should I edit a question or answer with offensive content?

Question: Occasionally, I will see a post that has PG (or even PG-13) rated content. The offensive flag can be applied to these posts. Should I wait for the community to declare it offensive and have the post removed, should I edit the post to remove the offensive content, or should I do both?
Comment: @animuson Out of curiosity, why did you de-[tag:faq]-ify this question?
Comment: @animuson Additionally, the answer to this is already stated in the official FAQ; see above.
Comment: @SonictheInclusiveHedgehog It doesn't really fit the standard of a FAQ. It barely gets viewed (727 in 10 years means no one is looking for this), and deleting all these answers to replace them with an official, canonical answer just isn't worth the effort for something no one is looking for.
Answer: Since the community has awarded you with enough reputation points to edit posts, the community trusts you to do the right thing when you see offensive posts:
You should trust your own judgment too, and do what you feel is necessary in the particular situation.
Comment: @Dalin: From the FAQ, written by The Jeff Himself: "Reputation is a (very) rough measurement of how much the Stack Overflow community trusts you"
Comment: If only there was a "view history"...
Comment: Reputation points doesn't equal Trust no matter how you slice it.  Reputation points just identifies you for how much you've contributed to the community.
Answer: The reason that it requires 5 offensive votes to remove an offensive post is so that a consensus of 5 is needed.
If you just remove content that you deem offensive, then you are making a judgment by yourself, on your own. I think there is something fundamentally wrong about this in a community-driven site like this.
I say you should use the 'flag this as offensive' option, as it's the fairest way.
If something is truly offensive, it won't be long before it's flagged sufficiently negatively around here.
Comment: The problem with this system is that there's no scale.  If 10 people view a question and 5 flag it as offensive then its clear the community wants it deleted.  If 10,000 view it and 5 flag it, then the community has OK'd it, but it will still be deleted.
Comment: @RoBorg, I think you're making a very important point.  It should probably have a "not offensive" button and list the number of offensiveness votes.  Just like rep votes.  We could also track user's offensiveness score like we do rep :)
Comment: This is something i hate about SO. people vote for everything, but never talk it out.
Answer: If the question is a valid question, just remove the offensive content.
Answer: Since many of us like to use this site for work related things, keeping it rated "G" would be nice...  Even things considered "PG" by most can get one fired at some places.
Comment: Apparently you're not from the USA...Employers can get sued for vast sums if an employee sees *anything* that offends them on another employee's screen...
Comment: It can be worse than that here in the USA. If a link should open to porn (what porn is varies on state to state, it does not have to be images) in the presence of minors, the user and the company can face criminal charges. http://technology.timesonline.co.uk/tol/news/tech_and_web/article1464355.ece
Comment: Tempted to change my screensaver to "Stop looking at my &$%£"@ screen!" :)
Comment: I find it very hard to believe that there is anywhere that would fire an employee for reading something work related that happened to include an "offensive" word.
Comment: Mark, the final word on whether something is "work related" is not always made by technical staff. As Brain points out, you AND your employer can be liable if a pattern incidents occur... even if that pattern is a few people accidently saw questionable material.
Answer: I would think it would be better to edit it out.  That way people can still learn from the post and respond to it.  There is no need for offensive language in spreading information about programming.
Answer: The FAQ doesn't say the site is PG or PG-13.
I would leave it until the community had voted, but I think the community is split on what is "offensive".
The FAQ says spam, hate speech, links to obscene images and abuse, but I've seen posts marked as offensive because they contained a "bad word" (which I disagree with).
Edit: SO is somewhat unbalanced in this regard - you can flag something as offensive but you can't see something that's flagged by someone else and say "actually, I don't think that is offensive".  The best you can do is leave a comment.
Comment: Perhaps the right answer is to change "offensive" to "abuse" or "TOS violation." Offensive is ambiguous; abuse or TOS violation is not -- the TOS has nothing about language, but a lot about spam, hate speech, links to obscene images, etc.
Comment: Agreed. Plus, I've got the "rules" for a dozen different websites floating around my head and sometimes, I forget that "offensive" includes TOSV at this site, but not others.
Comment: The whole voting up/down concept is ambiguous.  Lets the community as a whole decide.  I think the "offensive" should be left as is.  It lets the community decide.
Answer: I agree with Elie that if it's a valid question, just remove the offensive content.  However, I would probably also take a more proactive approach to ensuring that offensive content is kept to a minimum or eliminated in the future.  Obviously you don't want to have to go back and edit posts everytime someone posts something offensive, so why not place a filter on the post submit that obfuscates offensive language.  Furthermore, it would be a good idea to make it clear on your site that offensive language will not be tolerated.
The problem you run into when editing posts is that you start blurring the trust line with your users.  If users feel that after they make a post, there's a potential that it may be edited, you might find yourself in a situation where either users won't trust the site enough to post and others might lose faith in the content.  This is why it's so very important to make it clear to your users what is and isn't kosher.
Comment: except we already have editing of posts by other users to clarify questions, so users posting to the site are already aware of the possibility of another user editing their post.
Comment: In that case I wouldn't worry about it too much.  If it's a major problem, prevent offensive language from being posted in the first place.  Alternatively, let the users determine what is and isn't offensive and edit accordingly.
Comment: Considering that I have a propensity for talking like a sailor at moments, I'm offended by very little.  But I also realize that there are individuals who are more sensitive.
Answer: Anyone who thinks that pornspam needs to be preserved in case of disagreement is just confused.
However, if you are feeling timid, you can always flag for moderator attention and let the diamond make the hard call.
Answer: Assuming that the bit you're talking about is "offensive", then whether to edit the post (or only flag/delete it) depends on whether the post includes other useful/beneficial/on-topic content (that would remain sensible and worthwhile if the offensive bit were removed):

If "no" or "not really", then just delete the whole post
If "yes", then edit the post to remove the offensive bit and preserve the good bit


Send data to a SPECIFIC iPhone application through mobile network (No Internet)

Question: I am looking for a way to send data to a SPECIFIC iPhone application without going through Internet... thus using the mobile network.
Thanks.
Answer: No chance. There's only two things the phone is actually receiving: calls and text messages. Both cannot be used for what you like to do, since neither can be routed to any app.
You can't even really keep an open socket to allow connections through the internet, since the new multitasking is not really multitasking and allows listening for new data only for a few types of applications, voip clients for example. But you didn't want internet anyway...
Answer: Best you can do is text the phone a URL whose schema is registered to your app.


why does monte carlo simulation become less accurate as volatility increases?

Question: I simulated sample paths to approximate the price of a vanilla European call and then plotted a graph comparing this to the value achieved from the Black Scholes. Why do these values diverge as the option volatility increases?
Comment: How does MC work: it takes the average of a large number N of $(S_T-K)^{+}$ values, the more these values are spread out the more difficult it is to estimate their mean from  N observations.
Comment: In addition to what noob2 says, depending on the implementation of the montecarlo, you can also start to introduce biases when vol gets too high - for example if you're operating in spot space rather than log space, then numerically paths can round to zero, which is an absorbing barrier - this will drag down the forward and introduce a bias.
Comment: It could be the fact you're doing relatively fewer number of simulations, than what you should. Maybe trying increasing the number of simulations by a factor of 100 or maybe 1000. If the issue still persist, I would be interested to seeing some code to figure out what maybe the issue
Answer: Each path is evolved based on the vol and a random number. The higher the vol the more the paths will diverge.
Paths will diverge if you increase time as well.
The solution is to increase the number of paths as vol or time increases to get a standard deviation of terminal values that you are comfortable with.


How to set up for merged mining

Question: I plan to eventually add litecoin, Dogecoin, and possibly some other scrypt merged-minable coins to my pool. Are there any tutorials or other information available that would show me how to set my pool up for merged mining?
Comment: Are you asking how to turn on merged mining in the configuration of some mining pool software you are using? If so, which one? Or are you asking how to add merged mining to pool software that you are developing?
Comment: Currently, I'm using NOMP for my pool, and I understand that NOMP doesn't support merged mining. What I'm wanting to know is if there is any currently available software that supports merged mining or will I need a custom solution. Also, I've had trouble finding much information on the subject and am interested in learning how this is implemented on the pool's side.
Answer: You may want to take a look at this GitHub repo, which supports merged mining.

How to set up for merged mining


Failed to send SMS to Mobile Contact

Question: It works fine when I import the contact manually.
But I can not send SMS to my test mobile phone(HK) when I use the Automation Import Mobile Contacts to a list.
The Automation does two things:
  1. SQL query from Sync Data Extension(DE) to an ordinary DE.
  2. Import Mobile Contacts from the above DE to a contact list.
Can not send SMS using this list.
Can someone help me to troubleshoot it?
Thanks in advance.
Comment: How does it import? As in, what is the Status of the MobileConnect subscriber? Is the country code added? Is the number subscribed to a keyword?
Comment: I already said - 1. SQL query from Sync Data Extension(DE) to an ordinary DE. 2. Import Mobile Contacts from the above DE to a contact list.
The status of MobileConnect Contact is active, the country code is 'HK', the contact key is the PersonContactId.
Comment: And what about a keyword subscription?
Answer: Under Mobile Connect Administration, for your sending number, ensure Hong Kong is selected as an enabled country.
I assume you are formatting your mobile number in correct format.
Are you sending SMS using a From Name? Or Short Code or Long Code?
If sending as a From Name then also ensure your from name is registered with local aggregators. Your account executive will be able to assist you with this

Failed to send SMS to Mobile Contact


Need help trying to project shape onto cylinder...

Question: I'm trying to take this cylinder and circle combined shape and remove it from the pyramid so the pyramid has a hollowed out shape. Tried to do it with boolean difference, which didn't work and now I've tried knife project. Which also doesn't work. For some reason the cylinder shape doesnt seem to be registering as a usable object?
Comment: Not sure how to do this, but Knife Project didn't work because the object acting as the knife must have no faces, for an example, create a plane, select the plane in edit mode then press X and then remove only faces. That should allow the knife project to work.
Comment: Welcome to Blender.SE! I'm not sure to get exactly what you would like to do: project a shape or booleand difference between two solids?Are both object watertight meshes? Maybe you can upload your blendfile to http://blend-exchange.giantcowfilms.com/ so it can be inspected.
Comment: Possible duplicate of [Why doesn't the boolean modifier work for me?](http://blender.stackexchange.com/questions/7480/why-doesnt-the-boolean-modifier-work-for-me)
Comment: Hi guys - Thanks so much for your help. I'm obviously a complete noob here. What I'm trying to do is to remove the cone/sphere object (which is two objects joined together) from the pyramid. (So there will be a hole shaped like the joined object in the pyramid). I tried removing the faces, and the knife projection worked however what resulted was just a glitchy mess, with no actual indent in the pyramid.
Answer: I somewhat remade your scene, and was successful so I will contribute what I did. I think what may be causing you the biggest problem is the lack of geometry in your pyramid object. Try adding several loop cuts to support the boolean operation.
Here is what I did:

Default cube, enter edit mode select top face and scale to 0 and scale as needed to create the pyramid object. (I also scaled the bottom face slightly).

Add several loop cuts in each direction with
Ctrl+R

In object mode, add a uv sphere, then go back into edit mode and
enable proportional editing by pressing O and select only
the top vertex.
Move the vertex on the z axis until you have the desired shape, and then scale to size.

Go into object mode and align the sphere object with the pryamid
object, and add a Boolean> Difference to the pryamid object, setting it's target to the sphere and delete the sphere from the scene or move to another layer.

After following these steps, also an edge split and subsurf modifier added- this is the result:


What can I do as a graduate student to maximize my chances of obtaining a professorship?

Question: I've already completed my first grueling year of the PhD program, and graduation is still a yet to be seen light at the end of the tunnel.  I'm very sure that academia is for me, and I really want to obtain a tenure-track position in my field (computational science).  I know that universities often look very highly upon doing a post-doc and accumulating plenty of journal publications.  Of course, open faculty positions are extremely competitive and I'm sure that everyone applying for them have those qualifications already.  I'm curious if there is anything else I do as a graduate student to help maximize my chances of getting a Tenure-Track Faculty position in the future?
Answer: I don't think there's anything "special" that's unique to applying to academia that a graduate student can do to increase the odds of becoming a professor in the long run, particularly if one is going to do a postdoc later on.
The two areas that might help are:

Gain teaching experience that goes beyond the standard "recitation section" leader—that is, into actual lecturing and other forms of direct interaction with students, as well as formulation of assignments and examinations. This might make a difference at schools which are more teaching-oriented rather than research-oriented.
Formulate a well-defined scope for your future research activities, and also develop the tentative outlines for the first few projects that you'd start in that field. This is an essential part of any professorial application, and the sooner you start working on it, the more polished it will be when you're ready to apply for positions when the time comes.

Beyond that, what makes someone a good candidate for a postdoc are essentially the same qualities that will help in being a good candidate for a professorship later on.
Comment: If the student is planning to follow the postdoc route, a web presence as a grad student doesn't make much of a difference, in my opinion, on increasing the odds of getting a professorship. But having a good web site helps a grad student regardless of career destination; so obviously it wouldn't hurt for someone thinking of an academic career.
Comment: A good website should have your CV, links to publications, and a description of your current research (and perhaps planned research as well, if you're applying for positions). It should be well-designed to provide information, and easy to navigate. As for benefits: a good web presence will provide you with an independent platform to show off you and your work.
Comment: Interesting answer. Any comments on how a student could d his chances by better web presence? We have a question which talks about it but this context seems slightly different.
Comment: In what sense do you mean "having a good website"?  What qualities does this entail, and how might it help in the future?
Answer: I think the single thing that most helped me get a tenure-track job was that during my postdoc I gave lots of talks at conferences and in seminars at other schools (something like 30 talks in 2 years, including those I gave at my postdoc institution).  First, this helped a lot with networking.  Second, and perhaps more important, all this experience gave me a ton of confidence in my ability to give good talks.  That confidence spilled over into the rest of my interviews, which was generally a very good thing.
I didn't really start giving many talks until during my postdoc, but in retrospect, I wish I'd given many more in grad school.
All grad students know that if you want a job in academia you should publish lots of good papers.  But many of them don't grasp the value of learning to communicate clearly and to publicize their work.  During my postdoc, I set aside 2 or 3 weeks to learn how to draw good pictures to go into my talks, and I think that skill has really improved their subsequent quality.  Personally, I do everything using beamer and tikz (presentation packages for latex).  However, your specific tool is not so important.  Ask around and find a tool that is widely used and supported by folks in your research area, then invest the time to learn to use it well.
The second really important thing you can do is network.  When I was in grad school, I had no concept of how important networking is for a career in academia (in fact, almost any job).  Many of my papers have grown out of conversations that started at a conference.  Once people know you, they invite you to speak (at their school or at a conference session they're organizing).  As you get to know more of the key researchers in your area, you find it easier to keep up with important new developments (which better inform your research, etc.).
Answer:
Do awesome research.
Publish it.
Get famous people to rave about it.

Everything else is noise.
Comment: _Of course_ self-promotion (and parallel promotion and guidance by your advisor) is involved.  This is _why_ PhD students should give lots of talks, _why_ they should network at conferences, _why_ they should have a polished web site, _why_ they should develop fruitful research collaborations, _why_ (in my field) they should publish at least one paper without their advisors.
Comment: Assuming one has satisfactorily done 1 and 2, how does she go about doing 3 - doesn't it automatically follow from 1, or is there some "Self-promotion" involved?
Answer: I'm in your field, and I'm a bit later in the game than you are, as I completed my PhD in 2010. Here's some advice, in increasing order of importance.
A very good way to get a feel for what it takes to land faculty positions is to take a look at the departments you would like to work at in the future and scope out the Assistant Professors.  Many of them will have their CVs and Teaching and Research Statements updated to when they applied for the position.
You will need to cultivate several strong letters of reference, hopefully by working with some of the bigger names in your field.
Try to go to a few job talks, as this will also give you a sense of what a strong research agenda looks like, both in terms of accomplished work and future directions.
You will need some teaching experience, but being a great classroom teacher will not get you a job if your research portfolio is weak unless you are going to a school that focuses on undergraduate education.
Computational Science is a bit of a funny field, as we live at the intersection of several very different fields: physics, mathematics, computer science, and usually some scientific application.  These fields all have their own rules for hiring and promotion, and this is important to understand, because you will almost certainly land in a department that is not titled Computational Science.
You need to statistically look good, because the members of the hiring committee will have almost no other grounds for justification besides what is written in your hiring application.  This means you will absolutely need a good number of high-quality journal publications, preferably at least 5, when you apply for a faculty position.  Conference papers only count for a Computer Science department, and you may need twice as many to be considered in that direction.
Comment: I guess I would have to ultimately choose a target department in one of the intersecting disciplines, and publish well in that subfield.


Ajax Login Validation using native EE function

Question:
I'm rather new to EE, and I'm having a hard time finding some stuff in it.
I started working on a legacy site that is pure EE template and for every validation it goes to a new page.
I'm wanting to use jQuery/Ajax/EE for validation, but I can't find the function that would validate the data on submission. I also want to know what is EE using to hash the passwords so I can correctly hash before I send to the server.
If anyone can provide a link or an answer I would be very grateful.
Answer: If I understand you correctly then you don't really need to know what function EE is using but simply submit your login form via Ajax to the URL it would normally submit to.
You might also want to look at these add-ons. Some of them cost a few dollars but they will probably cost less than the time you will spend on trying to create the same functionality.
http://devot-ee.com/search/results?keywords=ajax+login&addon_version_support=ee2
Comment: I already did the second option (AJAX Login 1.5.5 - By Laisvunas), only to realize that it had no support for login. I thought of the first option too, but it's a big page (it's being sent to the landing page), and I would have to parse all of that content just for an error message or to maybe reload the page if success. I will have to go for something like that if I have no option, but I can bet my arm that there is a function out there that would make my life easier.
Comment: I'm afraid I don't understand. You said you wanted to log in via Ajax. Surely the only data being sent would be the login creds and being recieved, a status message? Depending on the status message you would then redirect or refresh the page in the normal way. You wouldn't need to load the entire landing page via Ajax, just determine whether or not login was successful then perform some action.