how does the rotary motion in a turbine convert into electric energy?

Question: from what I understand ( please correct me if I'm wrong) the turbine is connected to a magnetic thats being surrounded by copper wire and when the tge wire go from being affected by the magnet to being free, it creates electricity
Answer: Once you have the mechanical energy from the turbine it must be converted into electrical energy.
The basis for this conversion is Faraday's Law of Induction which simple states that a moving magnetic field will induce a current in a conductor.
This diagram shows the process:

From: Faraday's Law
This is done in a electrical generator that has a shaft with either permanent magnets or electro-magnets mounted on it surrounded by coils of wire.  As the shaft turns the magnetic fields pass through the wire coils and you have electricity.
The above diagram shows linear motion but rotary motion works too and looks like this:

From: Rotary Generator
Comment: Of course real generators are more complicated than this simple demonstration.
Comment: More complicate but same principle.
Answer: This is an interesting subject, and there are a lot of things that can be said. Like other said the principle is based on the Faraday's work. Essentially the movement of a conductor in a magnetic field  develops an electromotive force (EMF) in it (Faraday's Law). This EMF induces current.
There are several electric generators.

DC electrical generators: Although the Faraday early alternator generated DC, initially there was a lot of interest for the dynamo development because early machines required DC current. Those early incarnations, used mainly permanent magnets and produced AC current, which through the use of a commutator was (partially) rectified.

Alternators (Synchronous generators): These substituted the dynamos, and they are connected directly to the grid of a system. Typically, the rotor (usually a rotating magnet) turns within stator (usually a stationary set of conductors wound in coils on an iron core). The field cuts across the conductors, generating an induced EMF (electromotive force), as the mechanical input causes the rotor to turn.

Self excitation: Increasing the size of AC generators with permanent magnets hits a ceiling because of the maximum magnetic field that can be achieved. That is the reason, that self-excitation machines are used for very large installations. Essentially, the permanent magnets are replaced by coils, which are powered by a small portion of the energy which is generated (in some very large installations a smaller generator supplies energy to the coils).
Comment: Gas turbines turn a speed reducer that turns the generator. Steam turbines , generally  used by power plants, turn slower and are connected directly to the generator.


Star Wars book involving lost fleet of Clone Troopers

Question: I'm trying to remember the name of a book I read back in the 90's about the discovery and recovery of a fleet of ships full of clone troopers that went missing during the clone wars.  The tension was around who would find the ships first.
Comment: Are you thinking of the Katana fleet? If so it would be Dark forces rising I believe. But I suspect that is not it. The Katana fleet was a fleet of dreadnaughts slaved together to save on crewsize but malfunctioned and disapeared into hyperspeed never to be found. Dont think it was crewed by clones though. Although clones are involved in the fight to size control of it for the Empire.
Answer:
Could this be The Thrawn Trilogy, by Timothy Zahn? Composed of Heir to the Empire, Dark Force Rising, and The Last Command, a central plot point to the novel Dark Force Rising, and to the entire trilogy to some degree, is the search for the Katana fleet.
It actually launched a few years before the clone wars, and the fleet was at one point full of troops, but they died before it was found, however they did carry experimental walkers:

Highly advanced for its time and equipped with state of the art automation systems, it was lost in its first hyperspace voyage. The fleet consisted of 200 modified Dreadnaught-class heavy cruisers, all carrying experimental AT-PT walkers. The ships' controls could be slaved to the controls of Katana [the name of the flagship]

Additionally, Grand Admiral Thrawn had a plan to use clones he made new as crew:

Initially, the New Republic believed Thrawn would not be able to take advantage of his new vessels, since he would require over three hundred thousand crewers for the Katana fleet—2,000 for each of the 178 ships. However, Thrawn proved to be more resourceful, using clones produced in days (instead of the years) from Spaarti cloning cylinders in the Emperor's storehouse on Wayland to crew his ships.

There was large tension about who would find it first, as it would shift power in the galaxy:

By 6 ABY, the balance of power between the New Republic, Imperial Remnant, and warlord forces was so precarious that, despite their age, it was believed that any faction that recovered the fleet would immediately become the dominant force in the galaxy.

The three novels were released in 1991, 1992, and 1993.
All quotes from the linked Katana article above
Comment: How I wished this trilogy would have been the new Star Wars trilogy... :(
Comment: That's it! Thank you!
Comment: @enderland - oh me too
Comment: @enderland it's truly amazing how Disney was handed a money-printing machine on a silver platter, and said "nah".


HP DL360p with Intel E5-2630 NUMA Capable?

Question: I couldn't find any information via search to determine this via the Intel or HP website. Can you enable NUMA nodes on this? How can you tell the side of each node if so? Is it always best practice to enable and size VMs based on this if it's available or does that depend if you're running an application like SQL that makes use of this?
Answer: Since Intel launched their Nehalem (55xx-series) all =>2 socket Xeons are NUMA by default, including the E5-2630's. Some BIOS/UEFI's allow this to be disabled but the option is usually hidden away to discourage it.
You don't mention which hypervisor you're using but certainly any recent server-class products from VMWare, MS and Xen/KVM are NUMA-aware and will automatically attempt to keep any VMs vCPU on a single NUMA node - this becomes less easy the more congested your hosts become obviously but basically don't worry about it, leave it to the hypervisor.
Answer: Yes, the DL360p is NUMA-capable. It's the system default.
Assuming VMWare, the handling of VMs on NUMA architecture has changed slightly as the product evolved. See this excellent site for a good breakdown.
With the current edition of VMWare (5.x), you will end up with NUMA nodes inside the guest if you configure more vCPUs than exist on on physical NUMA node. So >8 in your particular server's case. From: http://vxpertise.net/?p=124
Assigning more than 8 vCPUs to a VM spread across multiple sockets create virtual NUMA nodes inside the guest allowing for better scheduling decisions in the guest.
Also:
HP's NUMA Whitepaper.
Answer: You can not "disable" or "enable" NUMA. It is how hardware was designed to overcome physical limitations and costs.
When you "disable" it, you actually activate node interleaving on a NUMA architecture. This is just a memory allocator which will hide NUMA topology to OS. All modern hypervisors, OSes, .Net/Java platforms and big applications have support for NUMA and they will schedule and balance the load to utilize the architecture in an efficient way. Bug are still squashed as we are speaking :D
Best is to leave NUMA enabled and install recent versions of software that have proper support for NUMA. By software, include also UEFI firmware updates which can contain microcode updates. Microcode updates can be loaded into CPU by OS during each boot (similar to what firmware is doing).


How to say "I like watching birds"

Question: The title explains it all. I think that one would say (mind you I'm just starting out, so I will write everything in hiragana) わたしはとりがながめるのすきです。Would that be correct? Or am I totally wrong, and if so, how do you actually say it?
Answer: ながめる has more of a sense of "gaze at" than "watch".  You might want to use 観察{かんさつ}.  I think the rather technical term for bird watching is [野鳥]{やちょう}[観察]{かんさつ}.  So you could write 野鳥観察が[好]{す}きです.
Comment: 「バードウォッチングが好きです」でもいいかも?
Answer:
私は鳥を見るのが好きです (watashi wa tori wo miru no ga suki desu) - I like to watch birds/watching birds

You had a couple things wrong in your sentence, for instance, after 鳥(bird) you need the particle を because this particle is the one required when an action is happening towards something.
The action of seeing is happening towards the bird, if you use が it feels like the birds that are doing the "watching" and not yourself.
also it lacked the が particle before 好き(suki), this particle marks the subject of watching, since it marks a verb, you correctly nominalized it with の.

見るのが好きです(miru no ga suki desu) - I like to watch.

Often in common speech we often have no need to say 私は if it is implicit by the context, that is you who likes to watch birds.
So the sentence could be like that:

鳥を見るのが好きです (tori wo miru no ga suki desu) - I like to watch birds.

or in a more casual way:

鳥を見るの好きです (tori wo miru no suki desu) - I like to watch birds. (dropping ga particle in casual speech often happens as well)
Comment: 鳥を見る好き doesn't make sense. It should be 鳥を見るの好き.
Comment: I will leave my answer as it is, if the main reason for you making this question was understanding some grammar points. If you were looking for the right "technical" terms,  @A.Ellett answer is the way to go, I think
Comment: @user4092 will correct it!
Answer: I believe [野鳥]{やちょう}[観察]{かんさつ}, as mentioned above, is correct and used in proper writing. But I feel it is used less and less. I think バード・ウォッチング ("bird watching"), pulled from the English, would be widely understood to mean the hobby of bird watching.
Two spellings are common, バードウォッチング and バードウオッチング, but I believe the first one, with the small オ, is more popular.

How to say "I like watching birds"


How to split mailbox into single file per message?

Question: I'd like to split my inbox into separate files (one file per one message) by bash command, or may be simple program in Java. How can I do it?
WBR, Thanx.
Comment: if you're using mbox, [this](http://www.qmail.org/man/man5/mbox.html) can help. and also [this](http://linuxcommand.org/man_pages/formail1.html)
Answer: Just use formail. formail is a program that can process mailbox, run some actions for each message in the mailbox, separate messages and so on.
More info: http://www.manpagez.com/man/1/formail/
If you want just split a mailbox to separate files,
I would suggest such solution:
$ cat $MAIL | formail -ds sh -c 'cat > msg.$FILENO'

From man:
   FILENO
        While splitting, formail  assigns  the  message  number  currently
        being  output  to  this  variable.   By presetting FILENO, you can
        change the initial message number being used and the width of  the
        zero-padded  output.   If  FILENO is unset it will default to 000.
        If FILENO is non-empty and does not contain a number, FILENO  gen-
        eration is disabled.

Note: formail is also included in procmail - https://github.com/BuGlessRB/procmail .
Comment: For me, this didn't work; it just built a single `msg.000` file that was identical to the mbox.
Comment: `formail` is part of procmail on my machine (`apt-get install procmail`).
Comment: how would you do this using bash and formail when you want to split not per mail but rather per filesize so that a maximum of n mb is generated per split?
Comment: `formail` seems to be very primitive.  It appears to split the file simply based on lines that start with `From: `.   I have emails that contain that phrase at the beginning of a line in the email body, and `formail` breaks those emails in two rather than treat it as a single message.  The `git` solution in Andrey's answer works much better for me.
Answer: The old mailbox files I have seen have messages separated by a line starting with "From ", followed by:

either "???@??? " and a date for old Eudora files:From ???@??? Fri Oct 16 10:49:27 1998
or just "- " and a date for Thunderbird files:From - Tue Jul 31 13:23:45 2007

So you can use this Perl oneliner
perl -pe 'open STDOUT, ">out".++$n if /^From (-|\?{3}\@\?{3}) /' < $IN

or, to have 6 digit 0-padded numbers (if your mailbox is less than 1m messages.)  and an ".eml" extension:
perl -pe 'open STDOUT, sprintf(">m%06d.eml", ++$n) if /^From (-|\?{3}\@\?{3}) /' < $IN

Answer: there is also a specialized git command for this:
mkdir messages
git mailsplit -omessages mbox

Comment: On a perfectly valid Thunderbird INBOX file, it says "corrupt mailbox"


Best practice for image compression

Question: Which is the best format or best technique to compress images without loss of quality for iPhone/iPad games?
Comment: Depends on if you're compressing for run-time memory usage or on-disk memory usage.
Comment: You might also want to use "imageWithContentsOfFile:" instead of "imageNamed:" when you load images if you are concerned with memory issues. But imageNamed: is faster when you REUSE an image.
Answer: The commonly used formats are PNG and PVR.
The PNG (Portable Network Graphics) format is compressed but lossless. It's a commonly used format (basically any image-editing software can write to PNG).
The PVR (PowerVR) format is a format that is much closer to the native memory structure of images on the GPU of the iPhone. Therefore it also allows for some byte-orderings that are available on the GPU but not usually used in image-processing, such as RGBA4444 (4 bits instead of 8 bits per channel). Of course a reduction in bits per channel also means a quality-loss... it's highly dependent on your type of image if this quality loss will be noticeable or not.
The PVR format is faster to read to the GPU and it gives you more control over how much memory your texture will consume. PNG is ubiquitous and much easier to work with. Almost any image editing software can read/write it and there are tools like ImageOptim that allow even further compression/optimization of PNGs.
Update Just to clarify if that wasn't clear from what I have written above: Further optimizing and compressing a PNG will only result in smaller file-size, eg. less disk-space that's being used. That can be important if you aim for a small app-package size (eg. to stay below the 50mb limit to download over cellular networks). Usage of graphics-memory is also important and if you want to optimize graphics-memory consumption, then your only option is to use PVR (unless you load PNGs and convert them to other formats/byte-orderings dynamically... but that's another story).
As long as you aren't facing any texture memory issues, PNG is far easier to work with.
Comment: @Raj You can use it for any size, but it makes more sense for large images (backdrops or sprite-atlas). You should first check if your images still look good if you reduce from 32 to 16 bits or similar. You should also consider PVR when you have several large images that have to be kept in the GPU memory as you can cut down GPU memory usage quite significantly by choosing the right PVR format. If you need true-color and full alpha I would personally stick with PNG as it's much easier to work with.
Comment: PNG is only going to reduce the size on-disk (or equivalent), it needs to be expanded to full RGBA8 in texture memory so there isn't going to be any memory saving had from using it.  If you want to save texture memory then all formats which are compressed in texture memory are going to be lossy.
Comment: Thank you sir, ideally when to use PVR images in game? for large size image or small size?
Answer: You need to have a good eye so that you can get the most out of your textures.

I always compare RGBA4444 with RGBA8888. If the difference is not that noticeable, I use RGBA4444 instead. It saves a LOT of memory.
If quality seems to degrade RGBA4444, apply Dithering. See if it's workable.
If I need to compress the project's total filesize. I'm looking for any texture that can be in JPEG. JPEG's filesize is very small compared to PNG but tradeoff is you're gonna lose a lot of processing. It'll be slower. I'm using this for textures that do not have any alpha channel. Also, only use this for something that is seldom used or textures that are loaded once and it'll stay long on the screen (like splashscreen, background). Never use JPEG if you need to draw it frequently on the screen.

Anyway, only do this if you have problem with memory/filesize. In my case, we have tight schedule so we optimize beforehand as long as quality will not degrade.
Comment: Yeah, there are more advanced techniques available (like in your example, occlusion culling) but you'll work that on your code and not on your assets. The game we've shipped contains different techniques just to get it running smoothly (most of them were very tricky that our codebase broke lol)
Comment: thanks alot for ur response...But sometimes not only eyes r useful..even we can't see all single image..Game lik miniNinja..contains GB's of texture memory..So some time we need to go for brainy method that is good.

Best practice for image compression


There has/have been a lot of advertisements – singular or plural with "a lot of"

Question:

There has been a lot of advertisements.
There have been a lot of advertisements.
Comment: Related question: https://english.stackexchange.com/questions/35265/a-lot-of-ideas-is-or-are
Answer: I think the second is right. Because advertisements are plural, so the copula (has been/have been) should be plural. In this case, only the second sentence's copula is plural.
Answer: Normally we determine has/have the pronoun they follow:

He has one
We have one

In your example the word in question is not following a pronoun, but consider:

There is an advertisement
There are advertisements

In your example, therefore, it should be there have been a lot, because you are referring to many advertisements and "have" is plural whereas "has" is singular.
Answer: Which is right?
1) There has been a lot of advertisements.
2) There have been a lot of advertisements.
Let's substitute many for a lot of:
There have been many advertisements.
Since many is semantically the same as a lot of. It shows how the sentence requires a plural. Many people are misled by "a lot of". That is just an adjective and has no bearing on whether the noun is plural or singular. If the noun is plural, the verb of the impersonal expression (there is, here, in the present perfect form: there have been) has to be plural also.
Now, let's substitute a lot of for many.
There have been a lot of advertisements.
The correct form here is plural.
Answer: People can probably argue themselves around in circles as to which is 'right', based on a simple question: is the object (main noun denoted by emphasis) "a lot of advertisements" or "a lot of advertisements". One would be singular, the other plural.
Here's the simple answer, though: native speakers say both versions as given in the question, all the time. Which one is more common probably depends on dialect, but no-one except a pedantic grammarian will pick them up on it, and different pedantic grammarians will probably insist on a different 'right' answer.
There are certainly cases where it is more usually treated as a singular - where you are, say, comparing this lot of advertisements with that lot of advertisements.
As a final note, however, it is worth saying that if you are taking a class where you are learning or demonstrating English, you should try to conform to your teacher's expectations. At least, you should do that if you don't want to make a point and argue with your teacher. Most likely, they expect you to consider advertisements as the main noun of the phrase, and treat it as plural.
Comment: @lambie yes. With different emphasis.
Comment: Natives say both of the examples in the OP. I'll edit to clarify.
Comment: And a lot can be a noun. The most well-known example would be in auctions, but it also leads to set phrases like "job lot".
Comment: "lot" is sometimes a noun, which is IMO why some people conjugate this as a singular. The fact that the way people actually speak doesn't fit with the formalities of how some people try to formalist the English language should hardly be surprising.


What words (in Black Speech) was Sauron saying when he allegedly asked Pippin of who he was?

Question: What phonemes (or even words in Black Speech) could one distinguish in the below video from 1:26 to 1:29, where Sauron allegedly asked Pippin of who he was?
Comment: **INT. EDORAS, SLEEPING QUARTERS - NIGHT.**
*PIPPIN suddenly starts to HYPERVENTILATE . . . He STAGGERS BACKWARDS, PALANTIR held rigidly before him . . .THE GREAT EYE OF SAURON seems to LEAP from the FIRE . . . PIPPIN is bathed in the FIERY RED LIGHT.*

*PIPPIN sinks to his KNEES, his mouth open in a soundless SCREAM ... He FALLS BACKWARDS, powerless to release the FIERY GLOBE.*

**MERRY:** *Help! Someone help him!*

*GANDALF wakes with a start! Just as ARAGORN enters, and
wrenches the PALANTIR from PIPPIN'S HANDS . . . PIPPIN FALLS to
the FLOOR!* - Nothing in the script of use.
Comment: Related (from the book): [What did Sauron mean when he "talked" to Pippin?](https://scifi.stackexchange.com/q/89894/31394)
Answer: It sounds like it could be ash nazg thrakatum, which (being similar the third line of the Ring inscription) is perhaps intended to mean something like "Bring me the One Ring".
Comment: I never said my translation was a literal translation, and it's standard practice to include articles in the target language as appropriate if the source language lacks articles. I only included "One" because Sauron would certainly have that particular ring in mind.


Shell script example to stop execution of all processes with a certain UID?

Question: I can't seem to find any examples on the internet for this particular task.
Comment: Try `for i in $(pgrep -U $UID); do kill -9 $i; done` or `pkill -U $UID` whichever seems suitable, replace $UID with the required UID or just assign it a value beforehand.
Comment: All solutions will require CAP_KILL (permission to kill any process), or to be root (root has this permission).
Answer: You can do this either via:
for i in $(pgrep -U $UID_OF_ANOTHER_USER); do kill -9 $i; done

OR
pkill -U $UID_OF_ANOTHER_USER

You can use the first one to do something more other than just killing those processes, like listing all of them while killing.
Comment: As $UID is the user id of the current user. This will kill your own processes. In addition, it may kill itself before finishing.
Answer: Here is a simple solution, that will work if you are root.
su $uid -c kill SIGSTOP -1
Explanation: become that user, and kill everything that you can.

All solutions will require CAP_KILL (permission to kill any process), or to be traditional root (root has this permission), and permission (capability to change its own uid), as used by this solution.
Note I sent sigstop, this will pause the process (as asked for ☺). Chose the signal that you want. Use sigkill as last resort.
Answer: killall -u $user -STOP

This is safe if run as another user and (for other signals) if no parent process belongs to the affected user.
ctrl-alt-delor's solution is probably better (safer). This one has the advantage of giving you a real exit code, though. The other one probably does not as both su and kill get killed themselves.


Write a C program to measure time spent in context switch in Linux OS

Question: Can we write a c program to find out time spent in context switch in Linux? Could you please share code if you have one?
Thanks
Comment: Do you wish to measure the context switch itself or the time that you application stays suspended while the kernel is doing something else?
Comment: To measure the context switch itself.
Comment: http://www.mjmwired.net/kernel/Documentation/filesystems/proc.txt
Comment: Related question: [linux - What is the overhead of a context-switch? - Stack Overflow](https://stackoverflow.com/questions/21887797/what-is-the-overhead-of-a-context-switch?noredirect=1&lq=1)
Answer: Profiling the switching time is very difficult, but the in-kernel latency profiling tools, as well as oprofile (which can profile the kernel itself) will help you there.
For benchmarking the interactive application performance, I have written a small tool called latencybench that measures unexpected latency spikes:
// Compile with g++ latencybench.cc -o latencybench -lboost_thread-mt
// Should also work on MSVC and other platforms supported by Boost.

#include <boost/format.hpp>
#include <boost/thread/thread.hpp>
#include <boost/date_time.hpp>
#include <algorithm>
#include <cstdlib>
#include <csignal>

volatile bool m_quit = false;

extern "C" void sighandler(int) {
    m_quit = true;
}

std::string num(unsigned val) {
    if (val == 1) return "one occurrence";
    return boost::lexical_cast<std::string>(val) + " occurrences";
}

int main(int argc, char** argv) {
    using namespace boost::posix_time;
    std::signal(SIGINT, sighandler);
    std::signal(SIGTERM, sighandler);
    time_duration duration = milliseconds(10);
    if (argc > 1) {
        try {
            if (argc != 2) throw 1;
            unsigned ms = boost::lexical_cast<unsigned>(argv[1]);
            if (ms > 1000) throw 2;
            duration = milliseconds(ms);
        } catch (...) {
            std::cerr << "Usage: " << argv[0] << " milliseconds" << std::endl;
            return EXIT_FAILURE;
        }
    }
    typedef std::map<long, unsigned> Durations;
    Durations durations;
    unsigned samples = 0, wrongsamples = 0;
    unsigned max = 0;
    long last = -1;
    std::cout << "Measuring actual sleep delays when requesting " << duration.total_milliseconds() << " ms: (Ctrl+C when done)" << std::endl;
    ptime begin = boost::get_system_time();
    while (!m_quit) {
        ptime start = boost::get_system_time();
        boost::this_thread::sleep(start + duration);
        long actual = (boost::get_system_time() - start).total_milliseconds();
        ++samples;
        unsigned num = ++durations[actual];
        if (actual != last) {
            std::cout << "\r  " << actual << " ms " << std::flush;
            last = actual;
        }
        if (actual != duration.total_milliseconds()) {
            ++wrongsamples;
            if (num > max) max = num;
            std::cout << "spike at " << start - begin << std::endl;
            last = -1;
        }
    }
    if (samples == 0) return 0;
    std::cout << "\rTotal measurement duration:  " << boost::get_system_time() - begin << "\n";
    std::cout << "Number of samples collected: " << samples << "\n";
    std::cout << "Incorrect delay count:       " << wrongsamples << boost::format(" (%.2f %%)") % (100.0 * wrongsamples / samples) << "\n\n";
    std::cout << "Histogram of actual delays:\n\n";
    unsigned correctsamples = samples - wrongsamples;
    const unsigned line = 60;
    double scale = 1.0;
    char ch = '+';
    if (max > line) {
        scale = double(line) / max;
        ch = '*';
    }
    double correctscale = 1.0;
    if (correctsamples > line) correctscale = double(line) / correctsamples;
    for (Durations::const_iterator it = durations.begin(); it != durations.end(); ++it) {
        std::string bar;
        if (it->first == duration.total_milliseconds()) bar = std::string(correctscale * it->second, '>');
        else bar = std::string(scale * it->second, ch);
        std::cout << boost::format("%5d ms | %s %d") % it->first % bar % it->second << std::endl;
    }
    std::cout << "\n";
    std::string indent(30, ' ');
    std::cout << indent << "+-- Legend ----------------------------------\n";
    std::cout << indent << "|  >  " << num(1.0 / correctscale) << " (of " << duration.total_milliseconds() << " ms delay)\n";
    if (wrongsamples > 0) std::cout << indent << "|  " << ch << "  " << num(1.0 / scale) << " (of any other delay)\n";
}

Results on Ubuntu 2.6.32-14-generic kernel. While measuring, I was compiling C++ code with four cores and playing a game with OpenGL graphics at the same time (to make it more interesting):
Total measurement duration:  00:01:45.191465
Number of samples collected: 10383
Incorrect delay count:       196 (1.89 %)

Histogram of actual delays:

   10 ms | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 10187
   11 ms | *************************************************** 70
   12 ms | ************************************************************ 82
   13 ms | ********* 13
   14 ms | ********* 13
   15 ms | ** 4
   17 ms | *** 5
   18 ms | * 2
   19 ms | **** 6
   20 ms |  1

                              +-- Legend ----------------------------------
                              |  >  169 occurrences (of 10 ms delay)
                              |  *  one occurrence (of any other delay)

With rt-patched kernels I get much better results, pretty much 10-12 ms only.
The legend in the printout appears to be suffering of a rounding error or something (and the source code pasted is not the exact same version). I never really polished this application for a release...
Comment: This answer is BS.  It's not context switching time.
Comment: Do you have any example test results?
Comment: Added results of a quick test :)
Answer: If you have superuser privileges, you can run a SystemTap program with probe points for context switches and print the current time at each one:
probe scheduler.ctxswitch {
    printf("Switch from %d to %d at %d\n", prev_pid, next_pid, gettimeofday_us())
}

I'm not sure how reliable the output data is, but it's a quick and easy way to get some numbers.
Answer: Short answer - no. Long answer bellow.
Context switch roughly happens when either:

User process enters the kernel via system call or a trap (e.g. page fault) and requested data (e.g. file contents) is not yet available, so the kernel puts said user process into sleep state and switches to another runnable process.
Kernel detects that given user process consumed its full time quanta (this happens in code invoked from timer interrupt.)
Data becomes available for higher current priority process that is presently sleeping (this happens from code invoked from/around IO interrupts.)

The switch itself is one-way, so the best we can do in userland (I assume that's what you are asking) is to measure sort of an RTT, from our process to another and back. The other process also takes time to do its work. We can of course make two or more processes cooperate on this, but the thing is that the kernel doesn't guarantee that one of our processes is going to be picked next. It's probably possible to predictably switch to a given process with RT scheduler, but I have no advise here, suggestions welcome.
Answer: What do you think , measuring the context switching with seconds or milliseconds or even microseconds . All happening less than nano-sec  . If your want to spend that huge of time for context switching which could be measured ,then ...
Try some real-mode kernel type code written on Assembly , you might see something.
Comment: So - somebody downvoted the only answer pointing out, that the "accepted answer" is complete rubbish. Expect times ~<3microseconds, and/or check the dependence on working set / and what causes the switch. http://blog.tsunanet.net/2010/11/how-long-does-it-take-to-make-context.html
Answer: Measuring the cost of a context switch is a little trickier. We can compute time spent in context switch by running two processes on a single CPU, and setting up three Linux pipes between them;

two pipes for sharing string between the process and
3rd one will be used to share a time spent at child process.

The first process then issues a write to the first pipe, and waits for a read on the second; upon seeing the first process waiting for something to read from the second pipe, the OS puts the first process in the blocked state, and switches to the other process, which reads from the first pipe and then writes to the second. When the second process tries to read from the first pipe again, it blocks, and thus the back-and-forth cycle of communication continues. By measuring the cost of communicating like this repeatedly, you can make a good estimate of the cost of a context switch.
One difficulty in measuring context-switch cost arises in systems with more than one CPU; what you need to do on such a system is ensure that your context-switching processes are located on the same processor
. Fortunately, most operating systems have calls to bind a process to a particular processor; on Linux, for example, the sched_setaffinity()call is what you're looking for. By ensuring both processes are on the same processor, you are making sure to measure the cost of the OS stopping one process and restoring another on the same CPU.
Here I'm posting my solution for computing context-switch between processes.
    #define _GNU_SOURCE
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <sched.h>
#include <stdlib.h>
#include <string.h>
#include <linux/unistd.h>
#include <sys/time.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <errno.h>

pid_t getpid( void )
{
    return syscall( __NR_getpid );
}

int main()
{
    /*********************************************************************************************
        To make sure context-switching processes are located on the same processor :
        1. Bind a process to a particular processor using sched_setaffinity.
        2. To get the maximum priority value (sched_get_priority_max) that can be used with
           the scheduling algorithm identified by policy (SCHED_FIFO).**
        **********************************************************************************************/

    cpu_set_t set;
    struct sched_param prio_param;
    int prio_max;

    CPU_ZERO( &set );
    CPU_SET( 0, &set );
        memset(&prio_param,0,sizeof(struct sched_param));

    if (sched_setaffinity( getpid(), sizeof( cpu_set_t ), &set ))
    {
        perror( "sched_setaffinity" );
                exit(EXIT_FAILURE);
    }

    if( (prio_max = sched_get_priority_max(SCHED_FIFO)) < 0 )
    {
                perror("sched_get_priority_max");
        }

    prio_param.sched_priority = prio_max;
    if( sched_setscheduler(getpid(),SCHED_FIFO,&prio_param) < 0 )
    {
                perror("sched_setscheduler");
                exit(EXIT_FAILURE);
        }

    /*****************************************************************************************************
        1. To create a pipe for a fork, the parent and child processes use pipe to read and write,
           read and write string, using this for context switch.
        2. The parent process first to get the current timestamp (gettimeofday), then write to the pipe,.
           Then the child should be read in from the back,
           then the child process to write string, the parent process reads.
           After the child process to get the current timestamp.
           This is roughly the difference between two timestamps n * 2 times the context switch time.
    *******************************************************************************************************/

    int     ret=-1;
    int     firstpipe[2];
    int     secondpipe[2];
    int     timepipe[2];
        int     nbytes;
        char    string[] = "Hello, world!\n";
        char    temp[] = "Sumit Gemini!\n";
        char    readbuffer[80];
        char    tempbuffer[80];
    int     i=0;
    struct  timeval start,end;

    // Create an unnamed first pipe
        if (pipe(firstpipe) == -1)
    {
            fprintf(stderr, "parent: Failed to create pipe\n");
            return -1;
        }

    // create an unnamed Second pipe
        if (pipe(secondpipe) == -1)
    {
            fprintf(stderr, "parent: Failed to create second pipe\n");
            return -1;
        }

    // Create an unnamed time pipe which will share in order to show time spend between processes
        if (pipe(timepipe) == -1)
    {
            fprintf(stderr, "parent: Failed to create time pipe\n");
            return -1;
        }

    if((ret=fork())==-1)
        perror("fork");
    else if(ret==0)
    {
                int n=-1;
        printf("Child  ----> %d\n",getpid());

        for(n=0;n<5;n++)
        {
                    nbytes = read(firstpipe[0], readbuffer, sizeof(readbuffer));
                    printf("Received string: %s", readbuffer);
            write(secondpipe[1], temp, strlen(temp)+1);
        }

        gettimeofday(&end,0);
                n = sizeof(struct timeval);

                if( write(timepipe[1],&end,sizeof(struct timeval)) != n )
        {
                fprintf(stderr, "child: Failed to write in time pipe\n");
                        exit(EXIT_FAILURE);
                }

    }
    else
    {
        double switch_time;
                int n=-1;
        printf("Parent  ----> %d\n",getpid());
        gettimeofday(&start,0);
                /* Read in a string from the pipe */

        for(n=0;n<5;n++)
        {
            write(firstpipe[1], string, strlen(string)+1);
            read(secondpipe[0], tempbuffer, sizeof(tempbuffer));
                    printf("Received temp: %s", tempbuffer);
        }

        n = sizeof(struct timeval);
                if( read(timepipe[0],&end,sizeof(struct timeval)) != n )
        {
                fprintf(stderr, "Parent: Failed to read from time pipe\n");
                        exit(EXIT_FAILURE);
                }

        wait(NULL);
        switch_time = ((end.tv_sec-start.tv_sec)*1000000+(end.tv_usec-start.tv_usec))/1000.0;
                printf("context switch between two processes: %0.6lfms\n",switch_time/(5*2));

    }

    return 0;
}

Comment: Maybe you should denote it is from http://pages.cs.wisc.edu/~remzi/OSTEP/cpu-mechanisms.pdf thanks for solution anyway.
Answer: Why not just this one as rough estimation?
#include <ctime>
#include <cstdio>
#include <sys/time.h>
#include <unistd.h>

int main(int argc, char **argv) {
        struct timeval tv, tvt;
        int diff;
        gettimeofday(&tv, 0);
        diff = tvt.tv_usec - tv.tv_usec;
        if (fork() != 0) {
                gettimeofday(&tvt, 0);
                diff = tvt.tv_usec - tv.tv_usec;
                printf("%d\n", diff);
        }
        return 0;
}

Note: Actually we shouldn't put null as the second argument, check man gettimeofday. Also, we should check if tvt.tv_usec > tv.tv_usec! Just a draft.
Comment: Guess it will estimate more of the fork() time than the switching :)


How do you express attraction to someone (like a crush)

Question: How do you say I have a crush on you/her/him/them (you in its tú / Usted forms) ?
Comment: Wordreference thanslates _to have a crush on sb_ to _estar encaprichado de alguien_. In Spanish, _capricho_ is frivolous when talking about love, as it is a temporal and fickle feeling.
Answer: If informal you could go with estar por

Estoy por ti / Estoy por él o por ella.

You could also use estar loco por (or chiflado) and me gusta the same way you use crazy for or like somebody in English. Other informal forms would be estar colado por alguien

Estoy colado por ti.

You could also say that somebody te pone if he or she makes you feel aroused

Esa chica me pone. Es guapísima.

Or that you are prendido de

Estoy prendido de esa chica desde que la vi por primera vez.

The way of saying it formally would be saying that you like somebody or you are in love with them or attracted to them.

Me gustas.
Estoy enamorado de ti.
Me siento atraído por ti.
Comment: si es curioso las diferencias culturales, las cuatro primeras nunca se me hubieran ocurrido. `estoy loco por ti` seria lo normal y coloquial para mi en esos casos sin entrar ya en la forma en que se dice en Cuba. `estoy muerto contigo` lol
Comment: No es "prendido"  sino "prendado".
Comment: Sí, tendrías que aclarar dónde se usan esas expresiones, porque no son nada universales.
Comment: En España son de lo más comunes. Si ustedes tienen sus propias expresiones podrían editar la respuesta para mejorarla, o publicar una respuesta con las suyas.
Comment: Son expresiones muy _españolas_ en México es raro escucharlas, la menos eso de _estoy pro ti_ o _estoy colado_, se entiende la segunda, pero nadie lo diría. Si alguien _te pone_ se entiende que te excita sexualmente y creo que es otra cosa lo que quieres expresar. Estar _prendido_ de alguien suena bien, pero creo que tampoco es la traducción más precisa.  De las ultimas tres, la última podría ser lo más parecido al _crush_. Estar enamorado es más fuerte, eso sería _to be in love with someone_. El _crush_ es fuerte pero de menor intensidad.
Answer: In México we say:
For I have a crush on him/her:

Me llama la atención [name here]

this is kinda vague, the beginning, your fellings are not much clear, or you don have enough courage to accept it. Like the first thoughts. You can also say:

Me atrae

but it can be understood as sexual atraccion.
This one, depending on what you're saying means that you like him/her or you just have a crush but again is I have a crush on him/her:

Me gusta [name here]

I have a crush on them, this is  unclear for me but it would be:

Me gustan
Me llaman la atención
Me agradan

And the formal and informal thing, I don't thing there's any. If you are saying that to someone you are not going to be formal I mean, there are more informal forms of saying that but I think that It's better not to use them. They're not bad but I think that being informal on this has to be very special, an especific context, especific person, specific mutual history, you can realx and say what you want but, again, it is a special way of doing it.
An example, you know a girl, you have been like, "I like you..." "Me too" but only in thoughts. And then you finally have the courage and ou are very close, so you can say [This is an example, it can be very different depending the people]:

Ya pa que nos andamos con rodeos, te gusto y me gustas, ¡andemos chingao!

Tanslation:

Let's stop going around, you like me and I like you, ¡Let´s be a couple god damn it!

Ok, kinda hard to translate. I want to add that "Andar" is being girlfriend and boyfriend.

Mira, Juan y María.
¿Andan?
Sí, hace dos días él se le declaró y ahora son novios.

And, declararse is the Would you like to be my girlfriend?.
Comment: Nobody here would understand "andan" as "son novios". Here (in spain) the word is " salen" . This is so much an everyday thing that probably will vary a lot between countries. I would love to see more comments with local expressions, as not to miss this kind of things when traveling.
Comment: I would love to say, andemos chingao, to a woman. Shame I am happily married.
Answer: Se traduce como Me gustas.
Ejemplo:

Tal vez te sientas incómodo cuando invites a salir a la persona que te gusta.
  (You might feel awkward asking your crush for a first date.)
Me gusta una compañera de escuela.
  (I have a crush on my classmate.)
Answer: I'd go for

Me gustas mucho (informal you)
Me gusta mucho (him / her / formal you)

Here, the mucho added at the end actually decreases the intensity of the feeling, making it weaker than Me gustas, which you could translate into I like you.
Answer: To have a crush on someone is way, way different than me atrae, me gusta, me agrada, etc. Estar prendido de comes much closer to it. It's a form of enamoramiento to be sure, but it's more and it's different; it's at once more intense and less reliable than being in love. Being in love is more likely to last than having a crush; and you can be in love without losing your head, whereas having a crush can be quite unrealistic. For example, kids have a crush on their teacher, eleven-year-old girls have a crush on Justin Bieber, I had a crush on Ingrid Bergman a few years ago, never mind that if she were still alive she would have beeen like 100 years old, etc.

Although I'm not a native Spanish speaker, I think it's possible that nothing closer than estar enamorado exists, unless estar prendido qualifies, though I suspect that the latter is closer to "being taken with". In a sufficiently clarifying context, it should be easy to discern whether an enamorado has a crush on someone or is in love with them. If the object of their affection is unavailable to them, then there's no two ways about it, it's a crush. Un corazonazo irracional, ilógico y poco razonable might be a good definition, but a real translation would of course have to be much more concise.

[minutes later]

The whole time I was writing the above, I was racking my brain, isn't there some Spanish word for this?  And, you guessed it, almost as soon as I hit the post button it came to me (and it even has an English cognate!). The word is infatuación.

From Wikipedia:

Infatuación en algunos textos sobre Psicología alude específicamente a cierto estado emocional caracterizado por el dejarse llevar por una pasión irracional, especialmente por el amor adictivo. La infatuación ocurre normalmente al inicio de una relación amorosa. La misma está caracterizada por: urgencia, intensidad, deseo sexual y/o ansiedad, donde hay una extrema absorción del uno con el otro. Se le asocia comúnmente con la juventud y denota infantilismo. Este uso no es muy común y no figura en la edición de 2001 del diccionario de la Real Academia ni en el Diccionario del español actual de Seco, Andrés y Ramos (1999).
Answer: The best answer is from Diego.
And actually I could say "colado" it's probably the best for "crush", becouse you don't love actually, you only have this "like" feelings.
Nobody say it before,its another way to say it too in Spain.
like crush is somewhat..informal, isn´t it? This can be mean "crush" too:

Estoy colgado de él.

The littleraly translation could be I'm hanging with him/her.
You like that person, but you don't really know him/her so much.
But these words look so informal.(colgado/colado)
I'd say if you  want to actually  say that to your actually crush, say

"Me siento atraído por ti"

While:

"Estoy colgado por él/ Estoy colado por él"

would be like more saying to your mates or friends that you like someone you don't know so much.
Answer: It depends on the kind of situation you want to make.
For example if you want to tell this person you want to have a serious relationship you should use Quiero ser tu novio in this case you are saying I want to be your boyfriend.
But if you want to keep the thing easy and keep dating you should use Quisiera que siguiéramos saliendo, para conocernos más in that case you are saying I want to date you to keep knowing each other
Hope it helps you!


Density on 5inch 1080p Android mobile phones

Question: New smartphones like the Sony Xperia Z have a insane high ppi like 443 ppi. Has anyone got his/her hands on such a device and can tell if this is still xhdpi or xxhdpi?
Answer: The Sony Xperia Z is an xxhdpi device. In the Sony add-on SDK the AVD device definition of the Xperia Z has the xxhdpi pixel-density set.
Answer: Sony also just confirmed xxhdpi on their developer blog: http://developer.sonymobile.com/2013/03/07/make-sure-your-app-does-not-exclude-xxhdpi-screens/


Larger aperture for objective lens in a compound microscope

Question: A telescope has a large aperture to collect more light and hence improve the visibility (brightness) of the image. It also helps in improving the resolution as $\theta_{\text{min}}=\frac{1.22\lambda}{a}$ where $a$ is the radius of the aperture (assuming it to be circular). This led me to wonder why microscopes have small aperture. Yes, under laboratory conditions, the lighting is good; hence a large aperture is not needed to improve the brightness of the image, but from the perspective of resolution of microscope $d_{\text{min}}=\frac{1.22\lambda}{2\tan\beta}$, why don't we design  a larger aperture? Is it just for the sake of compactness or is there any theory behind?
Comment: [This](https://chat.stackexchange.com/rooms/54160/conversation/reason-for-size-of-aperture-in-compound-microscope) more or less answers this question; essentially, larger the aperture, more the spherical aberrations, hence it's beneficial to keep a smaller aperture.
Answer: Even under laboratory conditions, the light intensity collected by a microscope can be low, so a larger aperture is in general desirable. However, as you correctly point out, what matters is not the physical aperture (i.e. the radius of the objective lens) but the angle $\beta$. The quantity
$$ NA = n\sin \beta$$
is called numerical aperture and $n$ is the refractive index of the medium in front of the objective lens and
$$ \tan\beta = \frac{R}{f_{OL}} $$
where $R$ and $f_{OL}$ are, respectively, the radius and focal length of the objective lens.
The numerical aperture is related to the resolution of the imaging system via Rayleigh's law
$$ d_{min} = 0.61 \frac{\lambda}{NA}$$
Therefore, the resolution and the amount of collected light can be improved by using larger numerical apertures. This can be obtained by enlarging the lens or by reducing the focal length. Microscope objectives are typically designed to work with a tube lens, therefore the magnification will be the ratio of the focal lengths
$$M = \frac{f_{TL}}{f_{OL}}$$
Since the detector is typically a pixel-based camera it is pointless to increase the optical resolution more than the size of the pixel. Therefore, $Md_{min}> d_{pixel}$ or the optical resolution will be lost by the lack of digital resolution. From this last equation, it should be clear that it is more convenient to reduce the focal length instead of enlarging the size of the objective lens. Moreover, compactness is not a bad thing!
Comment: =0.61/ is the Rayleigh limit. The Abbe limit is =0.5/
Comment: You are right. I will correct the answer.


Oil specification for my gasoline powered generator

Question: Does an oil with an API Rating of SN (the most current) meet the standards of all proceeding ratings (SL/SJ in particular). The generator specifies "SL/SJ" but I'm having trouble finding it. Can I use "SN"?
Answer: You are fine to use the API SN rated oils. Here is an excerpt from the API website:

Introduced in October 2010 for 2011 and older vehicles, designed to provide improved high temperature deposit protection for pistons, more stringent sludge control, and seal compatibility. API SN with Resource Conserving matches ILSAC GF-5 by combining API SN performance with improved fuel economy, turbocharger protection, emission control system compatibility, and protection of engines operating on ethanol-containing fuels up to E85.


EmguCV DLL Not Found Exception -Unable to find cvextern?

Question: To start,this is not another blind Emgu CV DLL Issue among the ones asked in SO and around the web.I have researched this issue and cannot find a solution.
I have updated the EmguCV version which i use in one of my projects to the latest version(3.4.3).Eveything works fine on the Dev Machine and on a Windows 10 machine.But when it comes to Windows 7 X64 Spack1 EmguCv throws up the never ending DLL not found Exception.
I have had this issue when using the older version,which went away by installing the Visual Studio Redistributable .The current version seems to use Visual C++ 2017 Redistributable as there is a DLL file (14.0) in the EmguDir.I have tried installing the x86 version of 2015 and both x86 and x64 version of the 2017 VC Redistributable package.(My app is x86).I have also copied the x86 and x64 folders to the application directory(The older version seems to work fine without these folders, i just copied the contents of the x86 folder to the app dir).

The same error occurs again.I'm stuck here.Kindly help me out
 ************** Exception Text **************
    System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'cvextern': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

The other DLLs (Emgu's are packed to main exe using a packer).
Answer: Install using Nuget Package Manager in Visual Studio 2019 Tools> NuGet Package Manager > Package Manager Console
and Install this

Install-Package Emgu.CV
Install-Package Emgu.CV.runtime.windows

And everything worked fine for me.
Comment: Thanks.  I had not installed the runtime, and that was the problem for me.  EMGU CV has the worst documentation.
Comment: is it for windows? How to fix it for mac m1?
Answer: I also have the same issues. On this forum emgucv, I don't know why cvextern.dll from emgucv 3.4.3 that cannot load cvextern ('cause unable to find cvextern), and you allowed to use file cvextern.dll from emgucv 3.4.2 (make sure you choose x64 / x86), copy at /bin/Debug and this file automatically found in /bin/Debug/x86 or /bin/Debug/x64when you finished build the program at Visual Studio.
Hope this help.
Comment: from where did you copy the dlls. after the nuget-install they are only in c:\users\username\.nuget\packages\emgu...., so not in the project
Answer: Firstly, please be sure to add nuget package to PROJECT not the SOLUTION. If not, you can have 'file not found' problems.


Snapshot website over time

Question: I'm a developer for a marketing team and one of the features that often gets requested is: Can we go back to see what our site (or what X page) looked like back in X.
Are there any good solutions for solving for this request?
Answer: Source Control should be able to solve your request in house. Label things appropriately and have an internal server to deploy that label to, and you should have no issue. If you have an automated deployment tool and choose your labels wisely, it should be relatively simple to write an app that will check out your source at label X and deploy it, by only having a user enter the label. Now if your labels we something like the date, they would just have to enter the date in the correct format and wait 5 minutes for the deploy.
Answer: have a look at the way back machine  it's not perfect, but there are some embarrasing old sites still in there that I worked on :)
Answer: Have you looked at the wayback machine at archive.org?
http://www.archive.org/web/web.php
If that doesn't meet your needs, maybe you could automate something with your source control repository that could pull a version for a specific date.
Answer: Similar to what others have suggested, (assuming a dynamic website) I would use output caching to generate the web page's code, and then use Subversion to track the changes.
Using the WayBack machine is probably only a last resort, such as if an individual asks to see a webpage from before you set this system up. One cannot rely on the WayBack Machine to contain everything that one needs.
Answer: My suggestion would be to simply run wget over the site every night and store that on archive.yourdomain.com. Add a control to each page for those with the appropriate permissions that passes the URL of the current page to a date picker. Once a date is chosen load archive.yourdomain.com/YYYYMMDD/original_url.
Letting users browse the entire site without broken links on archive.yourdomain.com might require some URL re-writing or copying the archived copy of the site from some respository to the root of archive.yourdomain.com. To save disk space, that might be the best option. Store the wget copies zipped, then extract the date the user requests. There are some issues with this, such as how do you deal with multiple users wanting to view multiple archived pages from different dates at the same time, etc.
I'd suggest that running wget over your site each night is superior to retrieving it from source control since you would obtain the page as it was shown to WWW visitors, complete with any dynamically served content, errors, omissions, random rotated ads, etc.
EDIT: You could store the wget output in source control, I'm not sure what that would buy you over zipping it up on a file system somewhere outside source control. Also note this plan would use up large amounts of disk space over time assuming a website of any size.
Answer: As Grant says, you could combine wget with revision control for space-savings. I am actually trying to write a script to do this for my usual browsing since I don't trust the Internet Archive or WebCite to be around indefinitely (and they are not very searchable).
The script would go something like this: cd to directory; invoke the correct wget --mirror command or whatever; run darcs add $(find .) to check into the repository any new files; then darcs record --all.
Wget ought to overwrite any changed files with the updated version; darcs add will record any new files/directories; darcs record will save the changes.
To get the view as of date X, you simply pull from your repo all patches up to date X.
You don't store indefinitely many duplicate copies because DVCSs don't save history unless there's actual changes to file content. You will get 'garbage' in the sense of pages changing to no longer require CSS or JS or images you previously downloaded, but you could just periodically delete everything and record that as a patch, and the next wget invocation will only pull in what is needed for the latest version of a webpage. (And you can still do full-text search, just now you search the history rather than the files on-disk.)
(If there are big media files being downloaded, you can toss in something like rm $(find . -size +2M) to delete them before they get darcs added.)
EDIT: I wound up not bothering with explicit version control, but letting wget create duplicates and occasionally weeding them with fdupes. See http://www.gwern.net/Archiving%20URLs
Answer: The WayBackMachine might be able to help.
Answer: Depending on your pages and exactly what you are asking for you might consider putting copies of the pages in source control.
This probably won't work if your content is in a database but if they are just HTML pages that you are changing over time then SCM would be the normal way to do this. The WayBackMachine that everyone mentions is great but this solution is more company specific allowing you to capture ever nuance of changes over time. You have no control over the WayBackMachine (to my knowledge).
In Subversion, you can set up hooks and automate this. In fact, this might even work if you are using content from a database...

Snapshot website over time


Installing Muse Plugins Fx On Audacity

Question: I want to install the Muse Hub plugin suite specifically for noise filtering and other real time effects, but as a beginner I can't really figure it out and I didn't find any useful tutorials that show how.
I also installed Muse Hub but it only had sounds not the plugins for Audacity.
Comment: I'm voting to close this question because  it's a basic customer support question, better addressed to the manufacturer/developer.
Comment: I'm not sure about that hub, anyway - just looks like a waste of background computer resources to me. But anyway, Tetsujin is right, if it's not working properly, you need to ask _them_.
Answer: On the page Muse Hub plugin suite from your question there is a link to another free plugin suite, IEM Plugin Suite.
I will explain how to install particularly version 1.13.0 for Windows, because with the current version (1.14.0) I had problems.
The downloaded IEMPluginSuite_v1.13.0_x64.zip file contains 2 folders:

VST2, which containing all VST2 plugins, and
VST3, containing all VST3 plugins.

In both that folders, there is only one folder – its name is IEM.
Copy one or both of these IEM folders as a whole to their appropriate directories:

For VST2 plugins there is no required special directory.

If you already have some VST2 plugins, copy the IEM folder to the same place,
otherwise create a new folder for them, e.g. C:\Program Files\Common Files\VST2\

VST3 plugins must be placed into their required directory, which is
C:\Program Files\Common Files\VST3\

There is no need to install (i.e. to copy) both VST2 and VST3 plugins if you will use them only in Audacity (or other DAW which supports both standards).
Audacity (and most DAWs) is able to find such "installed" plugins automatically, but in the case of need you may manually scan for them:

Tools ⇾ Plugin Manager, and then click on the "Rescan" button.

Installing Muse Plugins Fx On Audacity


Is there a logical fallacy that describes insulting an argument rather than addressing it?

Question: I'm having a net debate and the person is raving about how pathetic my argument is rather than explaining why it is a pathetic argument. I believe its a logical fallacy but I'm not sure.
Answer: This looks like an appeal to ridicule because it does not involve attacking you personally (so its not ad hominem). Begging the question is another possibly-relevant type of circular argument.


iOS - SKReverseGeocoderService reverseGeocoding gives generalised result not detailed

Question: I am using SKMap sdk from skobbler, everything works great, but while developing further, I found that the SDK doesn't provide much detailed information when I do offline geocoding, that is my requirement.
I am using following code
SKSearchResult *searchObject =  [[SKReverseGeocoderService sharedInstance] reverseGeocodeLocation:coordinate];

Below I have demonstrate how the reverse geolocation giving generalised result mostly it gives you Street Names, rather than building, or location details, see the demo below I am pointing pin on a building it gives me adjacent street name always.

The problem I am facing is, I need to save the location as bookmark, so if I have couple of location nearby, I always get the street name which doesn't allow me to distinguish the saved bookmarks.
Please help, if I am missing anything, I am using the map completely offline.
Thank You.
Answer: Our reverse geocoder only returns address information (no house number), it does not return POI information.


Breakpoint in console App visual studio

Question: I work on a project, where a process starts a console app on another thread and then it continues to its previous flow. I have attached the original process to the debugger, but I can't do that with the console app process, as that process doesn't get listed in the 'Attach to process' list. How can I debug the console app?
Answer: Not sure why it's not showing in the processes (have you made sure that All processes are showing?).
Anyway, try this:
using System.Diagnostics;

and in your code:
System.Diagnostics.Debugger.Break();

You should then get a dialog when the code hits that line, allowing you to attach Visual Studio to the process.
Answer: Make sure you check Show processes from all users and Show processes in all sessions
Comment: It doesn't get showed in the list, because it gets created at run time
Comment: Is there any idea of what my new console app process name would be?
Comment: @Krishnan, Once your console app launches, it should show up on this list with the name you see in TaskManager.  It does not matter if the secondary process is launched at run time.  Once the process starts, it should be visible within this window.

Breakpoint in console App visual studio


Total Curvature Defined with Respect to Some Arbitrary Geodesic Curvature

Question: If $\gamma$ is a smooth curve in $R^2$, length parametrized with respect to Euclidean metric, then the integral of $|\ddot{\gamma}|$ over the curve gives the amount the tangent vector rotates (if it is a closed immersed curve you get $2\pi k$ for some itneger $k$). Now instead of the Euclidean curvature, if you use the geodesic curvature of the curve with respect to some metric $g$ (assuming now the curve is length parametrized with respect to this metric) you get that the geodesic curvature is $\dot{\phi} + \omega(\dot{\gamma})$, where $\omega$ is the connection 1-form with respect to some orthogonal basis $E_1,E_2$ and $\dot{\gamma}=cos(\phi)E_1 + sin(\phi)E_2$. Now if you integrate this quantity over the curve, you get something which equals to amount of rotaion of the tangent vector + integral of the connection 1-form evaluated on $\dot{\gamma}$. So what does this second part of the integral geometrically mean?
Answer: It is telling you the rate at which the moving frame $E_1,E_2$ is twisting from being parallel ("fixed") along the curve. In particular, it vanishes when $E_1$ is parallel along the curve.
Comment: So I am assuming here $E_1(t),E_2(t)$ are two vector-fields defined along the curve such that one corresponds with the tangent direction and the other one corresponds to the normal direction. We also have $F_1(t),F_2(t)$ which are parallel transports of $E_1(0), E_2(0)$ along the curve. So you are saying this integral measures how much the first frame rotates with respect to the second one?
Comment: No, any orthonormal frame along the curve. I guess you were thinking of a constant frame, in which case the connection form vanishes.
Comment: Okay sorry so it is the frame that I wrote, i.e the one with respect to which the connection coefficients are defined. I get it now.


Why we are using delegatecall?

Question: As far as I understand is, Delegate is called to pass ETH from another contract.
In my perspective, it seems like a transaction goes through twice. Why we are using delegate call?
Answer: Delegatecall doesnt send any ETH or anything to the called contract. It just allows you to execute code from a contract in the context of another contract. Like so :
Contract Logic {
 uint a;

 function updateA() external {
   a =1;
 }
}

Contract Proxy{
 uint a = 0;
 address logic;

 function delegate() {
  (bool s,) = logic.delegateCall(abi.encodeWithSignature("updateA()");
  require(s);
  //After that, Proxy's a will be 1, Logic's a will stay untouched
 }
}

It's typically used for proxies (e.g: if you want to be able to update the logic later, or if you need to deploy multiple instances of the same contract and want to save on deployment costs by deploying the logic only once)
Answer: delegatecall is not exactly used for passing ETH or sending transactions between contracts. Instead, it is used for code reuse and interaction between smart contracts, particularly in the context of contract upgrades and proxy patterns.

Code Reuse and Libraries: delegatecall allows a contract to call functions from another contract or library and execute their code in the context of the calling contract.
This feature enables code reuse, where a contract can access and execute functions from external libraries to perform specific tasks without duplicating the code.

Contract Upgrades and Proxy Patterns: By using delegatecall along with a proxy contract, you can separate the storage and logic of a contract.
The proxy contract holds the state (storage), while the logic contract contains the implementation code.
Upgrading the contract involves deploying a new logic contract with updated code and updating the proxy contract to use the new implementation.
The proxy contract uses delegatecall to execute the logic from the new implementation while maintaining its own storage.

Context Preservation: When using delegatecall, the calling contract's context (storage, msg.sender, msg.value, etc.) is preserved.
This means that even if the logic contract is upgraded, the proxy contract retains its state and external interfaces, making it transparent to the users.
Comment: ChatGPT answer?

Why we are using delegatecall?


Why didn't site design change after the launch?

Question: According to Area 51, Islam.SE is launched. Given that, why is the site design the same as beta design?
Comment: A relevant post (on this meta) by one of our Community Managers from last week: [Custom Islam Stack Exchange design and logo - Information gathering](https://islam.meta.stackexchange.com/q/3576/46770) :)
Comment: Update: [Your new site design is live!](https://islam.meta.stackexchange.com/q/3649/46770)
Answer: It used to be that a new design was a part of the graduation process. Unfortunately, as the Stack Exchange network expanded, this led to more and more sites having their graduation delayed while waiting on the new design to be developed. Eventually, the number of sites that needed a new design far outpaced the resources available for developing those designs.
Some time ago, it was decided instead that graduation going forward would be design-independent:

Phase 1

The Community Team announces that a site is cleared for graduation. Without delay...

the beta label is removed
elections are held
migration paths are set up
community ads are run

Phase 2
Then, as it becomes available:

the site gets their custom design.
privilege thresholds are increased to graduated site levels

As for how long until it "becomes available", your guess is as good as mine. All I know is that the community team has been stretched rather thin over the last year or so, so it might still take a while.
Comment: I see, thank you. I really like to ask my question in here once a while, but I guess there are not too many people who're actively replying. I am hoping a fancier design will attract more users :)


Staying a night at Ercan international airport

Question: I will be arriving at Ercan international airport at night and need to wait till morning for another friend to arrive. Is there any facility there I can book for a night?
Answer: Ok I can answer my question, as I did travel to North Cyprus via Ercan this weekend and came back last night :-).
In the whole airport there are couple of benches, however they are not sleeping material, because of the following reasons:

They are made of metals, and sleeping on them is obviously uncomfortable.
These benches are in the arrival section of the airport, and because there are flights from very early morning (4:30 am to Istanbul) people come and go and therefore there are lots of noise involved.
These benches are next to the shops, so for example last night on the way back to Istanbul I tried to sleep for couple of minutes as I arrived after midnight, and the shop keeper was blasting music at 2 am!

Best Solution
Best solution is to change your Istanbul to Ercan flight (~50 British Pound for economy class), as there are around 4 flights a day to Ercan, and you can spend the night in the Istanbul international airtport; and get the early flight (~ 7 am) to Ercan.
Comment: Good. Seems that the reviews on [Sleepinginairports](http://www.sleepinginairports.net/list.asp?region=1&country=Cyprus&city=Nicosia&terminal=International#.VLeZPIf7DRY) were relative to Ercan, and correct, after all.
Comment: @JoErNanO yes indeed :-)
Comment: @JoErNanO Ok, didn't know I could do that! :-)
Answer: The official page of the airport does not mention any hotel/sleeping facility. Moreover, the Sleepinginairports page for Ercan contains two reviews, one, dating 2003, mentioning uncomfortable metal, albeit armrest-free, seats on which it is indeed possible to sleep without lying down due to a small number of them:

even though all seats were metal ones, they had no armrest and sleep was fairly attainable. A slight lack of seats, specially if trying to get more than one to lie down

The second review, dating 2006, however points out that since the page name is wrong (Nicosia Airport points to an abandoned airfield), the afore-mentioned review could refer to either Larnaca, Paphos, or Ercan:

Nicosia Airport lies in the buffer zone between the Turkish and Greek Cypriot areas of Cyprus. It is not operational and has not been in use since 1974. Any reviw referring to an operating airport in Cyprus probably refers to Larnaca, but might also be about Paphos or Ercan. Beware!

Bottom line is I could not find any information regarding sleeping at Ercan Airport specifically. So either you try it out, and come back to tell us the story, or you might want to consider a bus into Nicosia and a hotel there. To this purpose, the Ercan airport website has links to hotels in Nicosia.
Comment: Some smaller airports close at night for a few hours. It might be wise to have a backup plan in case you get kicked out.
Comment: @DaveRose Once you do, make sure you come back here and post an answer detailing your adventure. :)
Comment: Answered my own question, as I did travel to Ercan and spent a night over there ;-).
Answer: According to Booking.com, the closest hotel to Ercan airport is 8.5 km away, but that's in Nicosia across the border, which is probably quite inconvenient.
The closest hotels in Northern Cyprus are located in Kyrenia, which is 40 km by car. A one-way transfer by taxi would cost $40 and it doesn't appear that there is any public transportation available.
Comment: [The Ercan airport webpage](http://www.flyercan.com/#!airport-info/ced2) mentions buses to Kyrenia, amongst others.


How to motivate team for knowledge sharing sessions

Question: I work in a team with wide range of expertise and experience. I have been trying to introduce weekly knowledge sharing sessions. Sessions of 30-60 min length where everybody gets a chance to present something and talk about it. This will contribute in improving presentational and language skills.
However, the team is not motivated towards this, either the attendance is too low or none. How to get a team work towards such an idea?
Comment: The team needs to see value in attending the sessions.  Others have suggested bribes(food etc).  If the team sees no immediate return from investing their time they will not participate.  Don't the stronger members of your team already share knowledge in the normal course of the day?
Comment: How are they reinforced for attending?  Any benefit other than hanging around?
Answer: Here's a question:

Are your project and feature deadlines
  reasonable?

Just playing devil's advocate - If I were on your team, and I was worried about meeting deadlines for my current project load, then I too would be inclined to skip such superfluous knowledge sharing sessions.
In sum, I'm have no use for knowledge sharing sessions if it compromises my ability to meet project deadlines within the context of a reasonable 40-hour workweek. My time away from work is simply too valuable.
Comment: The problem is, there will never be time unless you and your colleagues *make* it. 30-60 minutes out of the week doesn't sound like a huge deal to me.
Comment: @MikeWeller: 1. 30-60 minutes does not equate to 30-60 minutes of lost time programming. It's greater than that because of the context switching. I'd say, multiply by 3. // 2. It is if there's a greater than 50% chance that time spent on a knowledge sharing session will impact my ability to eat dinner with my family, then I'm not going to be thrilled about it.
Answer: Have you tried these yet:

Bribe with free food.  This can sometimes work for getting people to show up which is a start.
Prizes based on tests after the presentation.  For example, have a 10 question multiple choice test from the presenter at the end to see who remembered what from the presentation.
Try to make the sessions useful for those watching.  Think about this from the side of why should someone on the team watch this.  Is it just to support the team, like Puddy's face painting on Seinfeld?  Is it a fun presentation with some interactive moments?

Just a few ideas of things to contemplate.
Comment: Good points. Only that I do not have funds for food/other items. But this gives some ideas -thanks
Comment: Personally, we use the spare change that no one really use (e.g all those useless 5 or 10 cents coins) for the "free food": good for morale and team building, give it a try.
Comment: Not sure it can be done for free.  Around here if you want anyone to show up for anything, it's going to require pizza.  :-)
Answer: How are they reinforced for attending?
This is central to answering the question.

Management demands that their tasks be done on time, and under budget with no "extra" time for knowledge sharing.  What's the reward?
Management demands that any time spent in knowledge sharing be made up.  What's the reward?  Getting to stay late?
Management makes it impossible to attend because there's always something more important going on.  What's the reward for attempting to attend?

It's very easy to subvert knowledge sharing by the implicit (or even explicit) claim that the knowledge sharing is of no value.
If the knowledge sharing is going to have a reward to people, it has to have value to the organization.  It is has to make people happier or more productive.  It has to reduce cost or risk.
What potential problem areas does the organization have right now?
Hint.  Compute the "lottery factor" -- how many people can win the lottery and leave without causing problems?  When the lottery factor is low (i.e., 1 person leaves and you're all in trouble) then management will see the value in sharing that one person's knowledge.  So will other people, since they might find some job advancement.
For each technical skill (or knowledge sharing area) compute the lottery factor.  How many people know this?  How many of them can we afford to have leave?  Find the subjects with the smallest lottery factors.  Make it a total cost-saving, risk-reducing victory for everyone concerned.
Answer: In order to run these kind of sessions successfully, you need a team culture where people learn from and teach teammembers when the need arrises. You might need to work on team culture first, organise joint training sessions for new knowledge areas, pair veterans with less experienced collegues in a coaching role, etc.
Find people feeling strongly about an ambiguous or new subject (coding standards, future frameworks, enhancements to current toolsets, lessons learned from past experience) - you should be able to spot these during the (bi)weekly project meetings - and invite them to research those issues in small internal projects (sometimes 1 person alone, sometimes with a few people) where the end goal of the project is to present the results in your learning sessions. Give them a time budget in which they can do this.
Make it clear that the presentations in these sessions are voluntairy, that there is ampel room for discussion and that the outcome of the session will shape the way projects are run in the future. Commit to the outcomes of those sessions if there is enough consensus - this can be scary at first but it shows you take your team members serious while inviting them to participate in structuring their own future work.
Answer: what you can do is don't make it weekly session instead share knowledge on the go!
Encourage team members to ask questions and seek help from others when ever they face problem.
Identify people and interact with them frequently, seek their advcie, help and inputs.
This way you can achieve your goal.


Should I refer someone to a job that I am technically leaving only after a couple of weeks?

Question: So I was a co-op for a company that I was working for more than a year and they offered me a full time job. Now I am leaving only after 2 weeks (I know this is not very good thing). There is someone I would like to refer as a replacement. I know this person from college and I think he would be a good fit. Now I am not entirely sold to the idea of referring someone versus him directly forwarding his resume. I think it might have a negative impression on him if I do refer him. I say this because everyone was pretty upset with me leaving( Which they should be :().
Comment: This is a "listen to your gut" situation. It all depends on your reputation at and relationship with the management.
Answer: This one is a tough call here, on the one hand it could make the transition smoother since they have someone coming in to replace you. On the other hand, as you have mentioned they can reject your friend outright since they are associated with you. See if you can test the waters first and float the idea of giving them a list of prospective replacements, at this point don't mention who it will be, just that they will have a list. See their reaction to it, if their fine with the list just refer your friend and tell them you feel they are the most qualified.
Answer: I am currently leaving my job. I have a short period of notice and I've put my employer in a uncomfortable spot. When I did this, he quickly asked me if I had a reference for him. Refering someone for an interview, especially if it's a good fit, is something generally apreciated by employers and ease the tensions.
It is possible your employer is so angry that he may react irrationally (you have to figure this out) but most likely he will end up respecting your decision and accept that you help him to find a replacement.
Answer: You have one foot out the door, focus on where you are going, not on where you have been.
Your referral might go down well, or it might go down badly for your friend, there's no way of knowing.
But you leaving quietly definitely will not hurt his chances and is less effort. I'd go for that plan.


Will this structure emit EM waves when excited by out-of-plane time varying magnetic field?

Question: Say I create a structure from copper that looks like the figure shown below. It's an open circle whose ends terminate in protruding wires of length x. If I excite this with an out-of plane time varying magnetic field B (say B0*cosft), will the protruding wires emit EM waves? If yes, will the emitted radiation have a frequency of f? And will x affect the power of the emitted radiation? Any brief explanation will be helpful..
Answer:
will the protruding wires emit EM waves?

Yes. But then, there will be EM waves all over such a setup anyway.

If yes, will the emitted radiation have a frequency of f?

Yes, of course. This is a linear, time-invariant (LTI) system, so it couldn't have any other frequency.

And will x affect the power of the emitted radiation?

Yes. Look up dipole antenna. The radiation varies in a complex way, depending on how x relates to the frequency (wavelength) and how the inductance and capacitance of the coil resonate with the antenna.
Answer: Biot-Savart solved this a long time ago. In short the only the magnetic field inside the coil will drive a current. This is reversible, a current will also drive a magnetic field. This is due to the way the fields integrate around the coil. See this. The field already in place opposes changes to it slides


How do Pillager Patrols Spawn?

Question: I find raids really fun, and I want to be able to start one. I think that the easiest way to do it is by finding a pillager patrol. How exactly can they spawn? I have only found them twice and only when I have been playing in single player. (My friend sometimes plays on the world with me). I am on a decent-sized island, next to a mushroom biome. What are the spawn conditions of a pillager patrol?
Comment: "I think that the easiest way to do it is by finding a pillager patrol." No, the easiest way is to find a Pillager outpost, and hunting down a patrol captain in a patrol around it. They spawn around these abundantly. Random spawns elsewhere are *rare*.
Comment: I mean the easiest way to start a raid without having to explore too much.
Answer: You can find all the conditions in the official Wiki. For Bedrock edition:

Patrols spawn naturally after the world age reaches 100 minutes (5 in-game days), then after a delay between 10–11 minutes an attempt is made to spawn a patrol with 20% chance of success. After an attempt is made, the delay is reset.
Patrols spawn around 24-48 blocks away from the player (or more than 48 blocks away if the player is in a village) in any biomes except mushroom fields, mushroom field shore, nether and end.
Additionally, patrols can spawn in biomes where common monsters cannot spawn such as in: river, frozen river, snowy tundra, snowy mountains, legacy frozen ocean.
Patrols spawn on solid blocks at light level 0–7 at the surface, like monsters.

If you never see any, maybe it's the mushroom biome, or your area is too well lit even during the night. Or, if you play with a lot of other people, they may be choosing to spawn near them instead.
I play in a single player world, and I see those guys all the time. I live near a dark forest, so they always spawn under the trees. Dangerous place to wander off!
Answer: Ok, for my solution, it really depends if you have cheats on or not. For me, if I wanted to find something that I wouldn't normally be able to find, I would go into the chat box and type in /locate and you just type in want you want to find. For your case, you would type in /locate pillageoutpost it would say like "The nearest Pillager Outpost is at x?, y?, z?. The you just follow the coordinates and voila, you found yourself a Pillager Outpost.
Comment: This would be a good solution if you are okay with using cheats, although this will take away the exploring part of Minecraft that some people enjoy.
Comment: Yeah, I understand your point. When I play Minecraft, I usually build my house in creative, then turn of cheats, but I get everything else in survival.

How do Pillager Patrols Spawn?


How can I determine which wire is which when putting a new plug on an extension cord?

Question: My question has to do with identifying the hot (black) and neutral (white) wires on the plug, when both wires are unmarked twisted copper? The other end of the cord (outlet) is well marked with white and black wires.
Comment: Just curious how one end of a cord is marked but the other is not?
Answer: They make a tool called a continuity tester. These also come in the form of a meter product that can also measure voltage and current. You can pick these up at most auto parts stores or hardware stores for a relatively low price.

To use the continuity tester, you would connect the clip to one of the known wires, and then touch the end of the probe to each of the unknown wires in turn. Which ever wire lets the bulb light up is the same wire as the known wire. Obviously make sure everything is unplugged from mains power before doing this.

To use a multimeter for continuity testing you make sure that the cord/wiring that you are testing is not connected to any mains outlets. Then make sure the two test leads are plugged into the black COM jack and the red VOLT/OHM jack. Rotate the range selector to the lowest OHMs setting. Momentarily tough the two test lead ends together to verify the meter is working correctly. The meter should show a reading of near zero ohms. In the case of a meter like shown above a zero ohm reading will deflect the needle all the way to the right. Next step is to touch one of the test leads to one of the known wires. Then at the same time touch the other test lead to the unknown wire ends in turn. The one that causes the meter to show a reading near zero ohms (deflects the needle to the right) will be the same wire as the known wire.
Comment: To make this a better answer, you should explain *how* to utilize the multi-meter for the OP. It seems to me if they don't know what a multi-meter is, they'd also have no clue how to utilize one ... just a thought.
Comment: OK I edited in the answer to show a description of how to use a multi-meter for continuity checking. Thanks to @sww1235 for adding the description of how to use the continuity tester.


What kind of wood was the standard decking for aircraft carriers in World War 2?

Question: I know that both Japan and the United States used wooden decks on their WWII Aircraft Carriers. Was there a specific, "ideal" standard type of wood that was utilized by either country? If so, what kind of wood was deemed the best for the job?
Answer: Turns out it was teak wood.

Teak was the preferred would and the red brown color wouldn't be a mahogony stain, but the natural color. As teak is sourced from the Thai/Burma area, Dec. 7th ended the supply chain. Douglas-Fir was substituted on the newer carriers in WWII, and that would have to have been stained and subsequently painted. finescale.com
Comment: Using Douglas fir, which is less dense than teak, would also have a positive effect on ship stability (CG would be lowered slightly lower due to less weight high on the ship).
Answer: Douglas fir with Oregon pine borders.
Teak was only used on battleships and cruisers
As even with the supply chain active there wasn't enough Teak.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


Calculating next due date

Question: in SharePoint 2010 I have the following columns Date Scheduled and Frequency. I have a work order currently scheduled for 9/1/2015 and a Frequency of 1. The frequency column is based on weeks. So with a freq of 1 the next work order would be due 9/8/2015. Frequencies go from 1-52. What formula in SharePoint 2010 can I use to get me that next due date?
Answer: Create a calculated column and use <code>=[DateScheduled]+(Frequency*7)</code>. Return as Date and time.

Calculating next due date


Site.CreateExternalUser vs directly inserting user object in apex

Question: What is the best practice of creating community users?
Is it by using Site.createExternalUser api or directly inserting user object?
Comment: `Site.createExternalUser` has a myriad of issues, it's only good in very few happy path scenarios.
Answer: Creating a user and a contact in the same transaction is not allowed. You end up with a MIXED_DML exception. Workarounds exist, but are not ideal. If you use Site.createExternalUser, it will create the user and contact (if necessary) all in one step. In addition, you can also set their default password (or any supplied password) at once, which can also be used with Site.validatePassword to make sure the passwords match and match the org's password policies. In other words, you should not be using a standard DML operation to create external community users. The Site method is the recommended approach.
Comment: So what if I want to relate the community user to an existing contact. And the matching contact is identified using a custom text field . In that scenario whether i can use Site.CreateExternalUser?
Comment: @LoneWolf777 The createExternalUser method matches strictly by email, not a custom field. If you already have the custom data you're looking for, it should be easy to get the email for the contact from there.


Image planes greyed out when opening blender file

Question: Im working on an animation and ive imported the background and props as plane pngs with transperancy but when i reopened my file everything was greyed out. I keyed the movement of everything and I really don't want to have to reimport and re-key everything. How do I fix this?
Answer: This looks like the Viewport Shading Mode in the top right corner is set to solid:

When you reopen a blend file the Viewport Shading Mode is always set to solid and nearly everything is displayed as grey mesh.
Change it to Material Preview or Rendered Mode (the both right buttons of the screenshot). Then you should see the textures again.


How do I make a custom uniform?

Question: How do I make a custom uniform in Dwarf Fortress (0.31.10)?
I want a uniform that allows leather armor, shields, and axes.
Comment: 0.31.10 is out and maintains save compatibility as well as including military fixes. You should update.
Answer: Go to military and uniforms (n). Choose to create a New uniform. Use Weapon, Shield, Helmet, Gloves, Boots and Leggings to select what your dwarves will wear. It's also possible to choose the material using M and the color using C. There are also settings to switch whether clothing will be worn over civilian clothes (r) or not.
Finally there is a setting to switch if the matches must be exact or not (m). If matches are set to be exact and items are not available, the dwarf will train without those items. If the matches are set to be not exact and  items are not available, a dwarf will grab the nearest item possible and train with that.
To apply a uniform, go to the 'Assign Uniforms' tab. Select a dwarf in a squad you want to wear a uniform and press enter. To make the uniform count for the entire squad, press shift+enter.
Lastly, marksdwarf squads need ammunition to train and fight. Set that up in the 'Ammunition' tab (f). Then choose the squad you want to have ammo and add it to their squad and select how much you want. You can change the Material again, and choose wether they are allowed to use their selected material bolts for Combat or Training.
Note that the ammunition tab is also the location for your Hunters to select their ammo. If you find that your hunters are using up all your bolts, whilst your marksdwarves are twiddling their fingers in the barracks, unassign the ammo from your hunters

How do I make a custom uniform?


Possible to upgrade from Windows Server 2008 32bit (Web Server) to 64 bit?

Question: Is it possible to upgrade Windows Server 2008 32bit (Web Server) to 64 bit, or would it require a clean install?
Answer: It would require a fresh install.
Windows has never supported a x86/32-bit to a x64/64-bit upgrade in any operating system.
Answer: Ask yourself, would you WANT to play the upgrade game with a MS product like the OS?
I can't recall anytime that an upgrade was perfect.
In the old days, of 95-98 upgrades, it would leave bulk behind, or old files, data / garbage.
With a server, I wouldn't play games, reformat, start fresh with a clean slate.


Find duplicate files on Mac OS X

Question: Is there an application that would search duplicate files in my Mac with an easy way to delete the duplicates?
Comment: As mentioned by @Cawas, http://superuser.com/questions/111390/show-duplicate-files is a duplicate of this (and has a couple different answers to try).
Answer: I'll just copy part of my other answer on a similar subject and also link to a possible duplicate as another reference.
There are many commercial options, some may be better than the listed below, I haven't tried them all. Anyway, I'm listing my choice of apps considering which ones I was able to try. Coincidentally, this was not where I first heard about DupeCheck droplet, but thanks so much Systech for building it up! :)

TidyUp is a very well known app in this subject. You can specify where to scan for what kind of duplicates. It offers basic and advanced modes, several different strategies and criterias.
MrClean is a free tool that just scans for folders for duplicates and trash them. Very simplistic but efficient if you're sure on what you're doing.
Chipmunk scans duplicates and let you choose which ones you want to trash. It offers a node-view of folders and you can select to "delete all files in a folder that have duplicates elsewhere, or vice versa" as well as hand-picking. It may take very long to scan all files, but it does a very decent job after that.
DupeCheck "drop a file on it and it will use your Spotlight index to see if you have a potential duplicate somewhere." That's about this nice open source app. Not a great tool for space cleaning at once, but over time it helps you keep your space clean.
DuplicateFileSearcher from the website: "is a free powerful software utility that will help you to find and delete duplicate files on your computer. It can also be used to calculate MD5 and SHA hashes. The software runs in Windows, Linux, Solaris and MacOS.". Enough said.
Answer: I've written a simple python script FileDupeFinder.py that will find file duplicate files on OSX (and probably Linux/*nix) systems. Right now, you pass it a directory root path and a minimum file size and it will walk the directory tree and output a list of files that it believes to be duplicates. It will ignore files that are hard links of each other. You can tell it to exclude directories (right now it just excludes Backups.backupdb, as this script isn't ready to handle Time Machine wackiness) and tell it not to span filesystems (though these aren't currently paramaterized, they are easy enough to set in the script itself.
This script is only minimally tested, but it has worked reasonably enough for me.
Comment: Thanks seems to work well. Just took me a few secs to realize you don't pass the root directory in (it accepted it without an error), but you need to pass it as a '-d' param. Otherwise it seems very efficient and tidy.
Comment: How would I delete duplicates after finding them? The output file includes both the original and the dupe. Say I modify the script to only include the dupe--how would I go from a line-return separated list of dupe files to a `rm` on each of them?
Answer: I've converted a bash script into a droplet. Drop a file on it, and it will use your Spotlight index to see if you have a potential duplicate somewhere on your system. Download the free DupeCheck droplet, unzip it, and find a good spot to put it. Drag and drop any file onto it, and it will use Spotlight to identify possible duplicates.
Comment: And after finding duplicates: remember that using Get Info you might find where the file came from (like from what website, email or which other computer), just in case you wonder how you got the duplicates.
Answer: There is Araxis Find Duplicate Files which is pretty convenient.
Answer: i recommended dupeGuru by Hardcoded Software, it's Open Source Fairware and free to use
Comment: Well that was true 4 years ago but isn't anymore. It is open source and its master needs developers to keep maintaining it actively. It's a great free soft!... that needs our contribution I guess...
Comment: It's actually not free to use (anymore at least), its limited to ten deletes/moves until you pay...
Comment: DupeGuru works well and is free.
Answer: Decloner is another one.
You can choose the minimum file size you want to have checked, and it can eliminate all but one. Doesn't seem to be able to create hard links or symlinks, though, which I'd want.
Answer: The most convenient GUI that I have found for this task is Gemini, but a script might be enough for your needs. I personally scan for duplicates just to assess how much of my data is redundant (currently 3/50 GB, or 6% of the data), but I rarely delete anything in case it breaks the internal magic of my file chaos.
Answer: I've been using TidyUp a lot on MacOS X to find duplicate files and sort them out.
The GUI is not necessarily 100% intuitive, but the application is very powerful, offers a lot of options and choices for defining what a duplicate is (same name?, same size, same content, ...) and it also has a powerful interface for displaying duplicate groups and deciding what to do with the duplicates (or some of them).
I never regretted buying it and it was very helpful for me.

Find duplicate files on Mac OS X