Why do authors invent fictional countries on earth in their novels and how do you keep the lie up?

Question: Why do authors invent fictional countries on earth in their novels and how do you keep the lie up? For example, if you talk about neighboring countries, don't these neighboring countries also have to be fictional so that there's no logic gap? If you were to use real countries then the fictional countries or country would be out of place and you wouldn't be able to really locate them, or some conflicts would arise because it could be next to countries that cannot be neighboring it, so how do you deal with these issues?
Answer: BE DODGY:
If you want to have a setting, but reality comes with a lot of baggage, then you need to create a new place. This can be LIKE a real place, but just a bit off so you can justify things that simply don't exist. But the point here is to skip the baggage of the real place while capturing the spirit of a real place.
In most stories, I see this used either when the author has a specific country in mind that doesn't perfectly align with their needs, or the deliberately want to keep it vague. Often, the approximate identification of the country is given, like Sokovia (think Avengers: age of Ultron) is clearly some kind of small nation in Europe, but they never discuss neighbors. They never discuss neighbors, that is, unless the neighbors are also equally fictional. So two adjacent fictional countries can have all the detail you want, but any discussion of outside states immediately becomes fuzzy.
Alternatively, the place can be specific, but non-existent like an island where there is no island. This avoids the need to be quite as vague, but the lack of hard borders means these kind of subtle interactions are avoided, allowing people to focus on the point of the story and not the nitty-gritty of details.
The key is to avoid discussing exact position. You give just enough detail to evoke the kind of atmosphere you want, while never specifying the details. This is a pretty easy suspension of disbelief.
Comment: Actually, I'm not sure you *have* to avoid giving away the exact position. For example, in the DCU, the nation of Bialya is clearly a fictionalized version of Libya and/or one of its neighbors (and the TV adaptation of *Young Justice* even showed it on a map!)... but they get away with it because Bialya is openly ruled by a supervillain (who wears a costume, has superpowers, etc.) and is obviously not "a real country."
Answer: Why:
Kinda simple, to avoid offending people.  Take DWKraus his example of Sokovia, it is most likely inspired by Slovakia(or a other eastern European nation). The nation is depicted as pretty much a third world country and in several episodes/movies in the MCU it is also implied that it had a corrupt government that wasn't above killing people.
If they had actually taken a real life name it would have offended a lot of people from that country. The movie would then partially become a political statement what leads to discussions that you might want to avoid.
Even if the depiction is positive it can be seen as offensive due to it being historical of factually inaccurate... like a nation suddenly having a royal family or have weird traditions, or lack traditions that are important to them.
It also gives you a lot more options on how you will depict them, take Wakanda for example... in no way would anyone view a current African nation as a world power...but by making a new nation, and give it such a backstory it becomes possible in that reality.
How:
Stay away from maps/neighbors or invent new neighbors. Instead of a single country make a small country cluster that has a shared history together. This way you can have a history of conflict without dragging real life nations in to it. Easiest way would be to make a new (small) continent, somewhere in the ocean where they can do their own thing without involving the rest of the world.
Answer: Sometimes the author wanted to set the country in a location that is akin to a region but doesn't want to offend a potential market, so make the country fictional to allow free reign without offense (The fictional Caribbean nation Val Verde pops up in lots of works, most famously Commando, Predator, and Die Hard 2 mostly because the screen writer had Caribbean family and wanted more films set there but didn't want to offend nations in volatile political situations.).
Other nations feature the ruler or higher political office holder as a character, such as Wakanda or Latvaria, both Marvel nations whose rulers are quite active superheroes or villains respectively (Black Panther and Doctor Doom).  DC has a slew of nations in the middle east with a surprisingly complicated regional politics between them (especially in the 2000s onward when the U.S.-Middle East Relations was much more prominent in media and comics began to add some political stories.  The complicated political relations is mostly because writers will use them for all sorts of stories featuring the heroes in the middle East.).   It should be noted that Marvel lacks major fictional nations as most of their heroes work around NYC and the fictional nations they do have are by and large have dignitaries come to town (The U.N. was a new thing when Marvel's biggest lines were getting discussed.).
Other reasons are to set up a government system to experiment with new forms of governance (Utopia and Atlantis were originally used as social commentary societies, and the modern browser based game NationStates allows the user to create their own fictional country and decide on policy).
A final reason is that, well, since World War II, the map of nations has been confusing with new nations rising and breaking apart all the time from 1945 onwards, not helped by the Cold War Powers using them for proxy wars or power plays and continents we think have stable politics in the modern era were only recent developments (Eastern Europe was the subject of a lot of border changes in the early 90s following the collapse of the Soviet Union, Africa's decolonization left it with the largest amount of nations for a single continent, South and Central America were quite prone to military dictatorships because the U.S. did not like Communism on their side of the globe, and "Unrest in the Middle East" has been a thing since before Jesus.).
Other times nations are used as fictional counterparts on an alternate world map as a whole (happens a lot in table top RPG settings, where they need to fill in space on the world map and copying real world cultures is really easy). Or to explain wars we wouldn't see to day (the Ace Combat series uses a fictional war to get players into modern jet warfare because real world dog fighting and modern arms wars are not as commons since nukes were added.  Ace Combat lore is that Nukes were never invented and other superweapons take their place.).  And then others are used to get a general feel of a place in an open world setting but hold their own stories.  Rockstar video games are very good at mimicking real world places with a fictional spin on them, usually using fictional U.S. Cities and States modeled after real ones (Liberty City/State is NYC/NY, San Andreas is California with a bit of Vegas area Nevada, Vice City is Miami, although it's flat out stated that it's in Florida, likely because as over the top as Rockstar's stereotypes are, even they got to admit defeat in trying to go over the top on Florida Man's native home.).
Comment: Edited:  Corrected a mistake where I referred to Dr. Doom's nation as Latvia, when it is actually Latvaria.   Latvia is a real Eastern European Nation famous for being mistaken by Americans for being the country ruled by Doctor Doom.
Answer: I came up with a fictional continent that is off the coast of California. It is a small island, so all I had to do was look at a map and place it to where it is far enough away from California so you cannot see it from the coast and make sure it is also far away from the other real life countries. I choose to do it because I can do whatever I want on that island. I can invent my own laws, or customs and everything. It feels more personal to me to create a new continent rather then just change or replace an existing one. I can also write and see how people from other continents react to it, because the island remained hidden for years and it was only recently founded.


QGIS/ArcGIS Pro: WMTS-Services - different display quality

Question: Using ArcGIS Pro (1.4) and QGIS 2.18 I discovered that both programs have a different "display-quality" of the same WMTS-Service (in my case basemap.at - the map called basemap-grey). I was surprised and checked some properties, but with no success. ArcGIS Pro seems to render it "smoother" (Screenshots attached). In both programs I tested it with the same extent at the same scale (and EPSG 3857 as data-frame SRS). In QGIS I manipulated some resampling-parameters, but without getting the same quality.
Does someone know how to improve it ?
Answer: Looks like the problem is related to the pre-defined scale levels by QGIS (Settings - Options - Map Tools). Defining your own levels for basemap.at like described here works well. Alternatively the Tile Map Scale PlugIn does the same job.


What are the databases Installed by Sitecore Experience Commerce 9.0.2?

Question: My motive behind asking this is, trying to understand the roles and responsibilities of each databases and differentiate them from the other database(Sitecore Experience Platform).
Answer: Sitecore Commerce 9 has 2 databases:
The Global database – stores all the global configuration data (policies and environments) that govern how the engine roles function.
The Shared Environments database – the main data store for a commerce deployment. It stores all of the commerce data used on site, including catalog data, customer records, pricing information, and any promotions you have configured, along with the generic entities and lists that power the functionality created in the various installed plugins.
On bellow picture you can see all databases,roles and indexes which are used in Commerce 9.
Comment: That is used by the Commerce Server Migration plugin, the SXAStorefrontSite_profiles database you refer to is the old Profiles database from Commerce Server, this plugin reads the data from that database and moves them into the XC9 format, storing them in the SharedEnvironments Database
Comment: Thanks for the details. I do not see any database as "SXAStorefrontSite_profiles" but this database details can be found in many Json files as in "\CommerceAuthoring_Sc9\wwwroot\data\Environments\PlugIn.AdventureWorks.CommerceAuthoring-1.0.0.json"
Answer: There are two Databases which gets installed  on installing Sitecore commerce 9

Global DataBase : It Stores all the Global configuration data of Sitecore commerce Engine . Any Customization that needs to be done apart from generic commerce engine has to be done here.

Global configuration data can be Policies or environment
A policy is a group of settings that define and affect the functionality of the individual features or plugins in the commerce engine.
Policies are named, versionable, variable datasets that help make the engine flexible and configurable. They are stored in the policy store in the Global database and are heavily cached.
An environment in Sitecore XC is a collection of policies that affect how a call to the engine is handled. In other words, when a storefront calls the commerce engine for any functionality, it identifies the appropriate environment, which in turn effects the functionality provided by the engine.
2.Shared Environment :
 It stores all of the commerce data which you create in commerce like your catalog , inventory , price Card, Promotions , customer details , order Details


Your Web Site is not very helpful

Question: I asked you, what I thought was a valid question. "Why did the many miracles stop being administered by the Apostle after Jesus's ascendance"? Why did you have to come back with a statement about me having to have more faith? This infers that I don't have enough. I am learning to have my Christian walk encompass more knowledge about the times before and after Jesus's presence with us on Earth.
I believe that you do little to portray a friendly, helpful, web site. I will endeavour to pass on your judgemental views about helping new Christians, and hopefully you will not have to exercise your ignorance or, your arrogance to me or my friends in the future.
Mike
Comment: What question? Please add a link to it
Comment: Be aware that this website is run largely by the people who show up. And the comments are also made by the people who show up. Sometimes the comments are off-base. If you see one that you think is off-base, you can flag it and a moderator will look at it and delete it if it's inappropriate.
Answer: How odd.  I find this site immensely helpful.
At this site, I get to learn how diverse Christian experience is, how rich and yet different much Christian theology is, and I get to learn it from those who are experts in that immense subject that is Christianity.  I don't come here for "the truth" (because only Jesus is the way, the truth, and the life) but for understanding, and for discovering what we have in common as Christians, and for where we differ.  (The disputes are as old as Paul and Peter's disagreements, see Galatians).
This site is rich with the treasure of understanding.
Christianity.SE has a particular focus, and a purpose, being part of the family of SE sites.  It has grown to learn, as a community, what its strengths and what its limitations are.
It does not try to be all things to all people.  If you will not spend the time and effort to understand what we are about, and how we are different, then it may not be the best site for you just now.  Perhaps later in your journey of faith this Q&A site will be of more assistance/use to you, and your particular journey in faith.
Comment: Good answer.  I especially appreciate that you didn't just "send them off with a kiss goodbye" but informed them politely that now may not be the time, but some time the site may be useful to them, again.  Quick suggestion since I notice you are editing to be more grammatically correct: "those who are expert" should be pluralized as the word THOSE is plural--experts also should be.  I know it might be debatable since expert can be used as a level of proficiency, as in "I have become adept at my craft", but better to say experts. Also," grown to learn, as a community," is better as a clause. ;)
Comment: @user31124 Expert can go either way.  I intended to use it in the "level of proficiency" sense.  Will edit, good point.

Your Web Site is not very helpful


"Centered on" or "centered around"

Question: I have often heard presenters talking about something centered around another thing, but it seems a bit illogical and hence improper to talk like this. Am I right about this?
Answer: Quoting the Wiktionary usage notes for center:

Merriam-Webster's Collegiate Dictionary observes that center around is objected to by some people on the grounds that it is illogical, but states that it is an idiom, and thus that such objections are irrelevant. It offers revolve around as an alternative to center around for those who would avoid the idiom.

Here is Merriam-Webster's original wording:

Usage Discussion of center
The intransitive verb center is most commonly used with the prepositions in, on, at, and around. At appears to be favored in mathematical contexts; the others are found in a broad range of contexts. Center around, a standard idiom, has often been objected to as illogical. The logic on which the objections are based is irrelevant, since center around is an idiom and idioms have their own logic. Center on is currently more common in edited prose, and revolve around and similar verbs are available if you want to avoid center around.
Comment: I agree with Merriam-Webster: My first thoughts when seeing the question were "Centered on, since around doesn't make sense.  Oh, but language doesn't need to 'make sense' and often doesn't."
Answer: The phrase "X is centered around Y" makes sense if you consider Y to be a smaller, central object and X to be a set of related, but distinct, objects whose collective center coincides with Y.  In other words, individual members of the set X are not centered on Y, but the collection of all members of X are.
Some examples:
"The planets of our solar system are centered around the sun."
"My arguments are centered around the hypothesis that every dog has his day."
Comment: Well-put, though I would posit that "X is centered around Y" would be far less common than "X are centered around Y"; the latter is used in both your examples.  The former would only seem to make sense when X is a collective noun which uses a singular verb form even though it represents multiple distinct entities.
Answer: To centre X is to place X in the middle. However in Y is centred around Z, the first part Y is centred suggests that Y is in the middle while the second part around Z suggests that Z is in the middle. This explains the feeling of the absence of logic. Nonetheless,

The news centred around him

is correctly used to mean that he is in the centre of attention, not the news.
Answer: When you focus on an object, you make it the center of your attention—and in my experience, few writers are tempted to describe this action as "focusing around" the object. But in the case of "centering" rather than "focusing," many writers and speakers opt for "centering around" in preference to "centering on," even though a similar kind of specific attention is involved.
One obvious instance of focusing is a camera focused on a focal point; and one obvious instance of centering is a circle centered on its midpoint. In neither case, I think, does "around" describe the relationship of the action of the subject (camera or circle) with respect to its object (focal point or midpoint) as well as "on" does. In the case of a circle, the "around" action works far better with "orbiting," "revolving," or "circling"—though in that case what physically moves around the midpoint is a point on the circle (not the circle itself), as a satellite with a perfectly circular orbit would move around a star or planet.
Interestingly, although (as noted in RegDwigнt's answer) a usage note in Merriam-Webster's Eleventh Collegiate Dictionary (2003) argues that logic is irrelevant to the validity of an idiom (and therefore that "centers around" is perfectly valid), that dictionary employs "on," not "around," in the two examples that it includes to illustrate its definitions of the verb center:

center vt (1610) 1 : to place or fix at or around a center or central area or position [center the picture on the wall] 2 : to gather to a center : CONCENTRATE [centers her hopes on her son]

In the first example, the dictionary couldn't very well have said "center the picture around the wall" without suggesting that the picture somehow enveloped the wall; but in the second example, the dictionary could have used "around" in place of "on" and justified doing so by citing idiomatic usage. Nevertheless, it didn't. Merriam-Webster's favoring of "on" in its examples reflects the wider preference (as of 2007) in overall print usage, which, according to Google Books' Ngram Viewer, favors "centers on" over "centers around" by a margin of greater than 2 to 1:

I find two things especially interesting about this Ngram chart. First, it indicates that neither "centers on" nor "centers around" was at all common before about 1880. ("Focuses on" likewise appears to be something of a latecomer to everyday written English.) Second, the chart shows that "centers around" and "centers on" were equally popular in published works from about 1880 until about 1914, and that "centers around" was slightly more popular than "centers on" between 1915 and 1950. Only after 1955 did "centers on" emerge as the preferred form.
A similar pattern is evident in the Ngram chart for "centered on" (blue line) versus "centered around" (red line), except that "centered around" was never quite as frequent as "centered on":

Again, the trajectories for the two curves change around 1950.
The chart for "centering on" (blue line) versus "centering around" differs from the previous two charts in showing a clear preference for "centering around" from about 1910 until the early 1960s, followed by a fairly steep decline in (instead of a leveling off of) the frequency of that term, along with a sharp rise in the frequency of "centering on" from about 1910 until the middle 1970s:

I think that the rather late changes in favor of "centers on," "centered on," and "centering on" in these three charts are more plausibly explained as showing the effect of a style preference imposed on published writings from outside (that is, by editors and teachers wielding usage guides) than as reflecting an organic reversal of preference among English speakers who were suddenly struck en masse by the persuasiveness of the logical argument in favor of "centers on."
Answer: I agree with oosterwal.  Centered can be defined simply as "in the center", and would be the meaning of the word in the publishing sense, as in centered justification (as opposed to right or left).  In that case, if you place something in the middle of whatever is centered in the larger context (like a page), such as an O between two Xs... XOX, the Xs could certainly be said to be centered around the O; in the middle, not skewed to one side or the other.  The sun in the solar system is a good example.
Unfortunately, Microsoft Word puts a big green grammar underline under my use of the the phrase, so I always change it to "centered on" to be a conformist.  :P
Comment: anybody know how we get Mircosoft to change their grammar checker?

"Centered on" or "centered around"


How to verbose log dhcp messages with options values

Question: I am trying to configure dhcp PXE server, but client is not booting as expected. Is there a way how you can watch transferred requested and responded options between client and server?
I want to be able to see each individual option value.
Answer: Use dhcpdump -i eth0. This show nicely the content for the dhcp packets.
Answer: I did not found a way how to do it via system logs when using ISC DHCP. But I have found a super convenient and easy way to solve the task of debugging.
Just use Wireshark. Start it as Superuser, then start capturing packets of a needed network interface. Initiate DHCP request from a client. Then in Protocol column you will see packets marked as DHCP. Click at one you are interested in. Then you are able to see contents of that package.
Answer: If using isc dhcpd, you can use log function for debugging: https://docs.menandmice.com/display/MM/using+the+log+function+for+debugging


Applying a binder to chicken after wet marinating

Question: I usually marinate my chicken breasts/wings in a wet marinade overnight and apply a dry rub shortly before I throw them on the smoker. The main problem I'm facing is that I'm not able to get nice and consistent bark. I was wondering if applying a mustard binder as I would with something like ribs or brisket would help remedy this issue?
Answer: This is a good tutorial: http://www.wikihow.com/Apply-Dry-Rub-to-Chicken
2 things from the above link:

Properly dry the meat before applying the rub.
Let the meat rest a little while with the rub so that the rub re-hydrate a little bit and that will help it stick more to the meat.

So you will need to adjust your timing between getting the meat out of the wet marinade and putting it in the smoker.
Comment: I know that Cook's Illustrated recommends allowing a chicken to sit in the fridge, uncovered, after brining (if time/space allows) to allow the skin to dry off/out a bit. Their suggestion is more for crisper skin, but I'd imagine it might help with this, too.
Answer: From Wikipedia:

"A pellicle is a skin or coating of proteins on the surface of meat, fish or poultry, which allow smoke to better adhere to the surface of the meat during the smoking process. Useful in all smoking applications and with any kind of animal protein, it is best used with fish where the flesh of, say, salmon, forms a pellicle, the surface that will attract more smoke to adhere to it than would be the case if it had not been used. Without a pellicle the fish would be inedibly dry from enough smoking to produce a tasty finished product. It is the pellicle which permits the transformation creating delectable smoked salmon."

Basically, after applying your dry rub, allow to dry in the fridge.
Comment: Hello and welcome to Seasoned Advice. Your answer is copied. Please edit your post to include the source.


Would you go with SSD or Disk Hard Drive?

Question: I haven't really heard anything on how the Soild State Drives are doing out in the real world and I was wondering if they are better than traditional hard drives. Is a SSD more secure or less secure than the traditional hard drives.
Comment: Security in terms of confidentiality, availability, or integrity? What filesystem are you planning to use?
Comment: Can a hard drive even be more or less secure? Don't they just both hold which ever data you write to them? Perhaps SSDs can be more easily wiped, but I think that is about it.
Comment: @Kibbee - some drives implement ATA standards better than others.  See, for example, passwords or encryption etc.  Also, SSD are harder to wipe.
Comment: @DanBeale As I always understood it, using spinning platters, nobody can ever agree on how many times you're supposed to overwrite the data, before electron tunneling microscopes can't decipher what data used to be there.  But a properly implemented (proper implementation being key here) SSD only has to be overwritten once to ensure all old data is gone. Although this whole thing may be moot anyway because if you are that worried, you should have been using whole disk encryption and shredding (physically) the disk after you're done with it.  Please correct me if I'm wrong, with sources please.
Answer: Summary thoughts:

Bad: SSD model that has a lousy secure erase mechanism.
Good: Any standard HDD; SSD model that is known to be good.
Best: SSD or HDD with hardware encryption. Any medium when using full disk encryption.

Detail:
Some background answers from other questions that will help out:
SSD (Flash Memory) security when data is encrypted in place
How can files be deleted in a HIPAA-compliant way?
I think the only security difference between SSD and HDD technology comes when you discuss repurposing a drive. If you're in an environment where storage is repurposed, you need to make sure that the SSD drive you select can be reliably cleared. There are many models that don't do that properly. See SSDs prove difficult to securely erase for some info on it.
Answer: It doesn't make much difference to security.  Pick SSD vs hard drive based upon functionality, performance, and cost -- not based upon security.
If you care about the security of your data and ensuring it isn't breached if your computer (e.g., laptop) is lost, then use full-disk encryption.  Truecrypt has free full-disk encryption software, and there's plenty of enterprise-oriented commercial software for full-disk encryption as well.
Answer: I agree with the previous posters that for security it doesn't really matter because you should use full disk encryption anyway. All I can add is some real world situations...
Scenario 1
You didn't use encryption and your drive stops working: with a hard drive, you can physically destroy it to ensure that sneaky people can't pull your data off it. With a SSD, that is much much harder.
Scenario 2
You need to replace the drive, so you first decide to find the best encryption solution. There are ways into pretty much every software disk encryption solution. Eg. MS Bitlocker can currently be broken even if the PC is turned off and in hibernation. Truecrypt has similar vulnerabilities if the machine is on, or if the encryption is not on the whole system disk. However system disk encryption with Truecrypt is safe as far as I know, even for hibernation. You can go for hardware encryption, such as the Intel 320 Series SSD, but when you look at it closely, you find that the password you put in is not the password used to encrypt. Intel sets that at the factory, and the software they provide to let you change it doesn't work. So Intel has your keys.
That's a pity because the hardware encryption speed would have been really good. Luckily, you use a CPU that has hardware encryption on board, like Intel's AES-NI, or VIA's solution.
I'm sorry if I appear to have gone off topic. But my point is that physical storage medium is the LAST thing you should think about in a secure setup. And your decision on that should be based on your speed, size and cost requirements, not security.
Answer: There are some problems with SDD concerning the security of "erased" data.
The logical destruction of files isn't correctly done in some drives, even using the built-in commands. You can take a look at this site, from some group at USCD. They've published some papers about it.
The problem is somehow old: in SSD, you can't be sure you're overwriting the old information. So, manufacturers have implemented commands to do that. But not all them work as expected, especially if you can have access to the Flash chips.
So, if your question was about security (and not reliability), I would concern a bit more about SSDs.


What is the unit of work pattern in EF?

Question: I am learning EF and have seen many examples, and during my learning I came to know about using repository and unit of work patterns. I got why to use repository but I do not have understanding of unit of work really is.
Having no understanding is making DAL understanding difficult. Kindly guide me.
Thanks
Comment: You can also check this article for a nice implementation https://billyvlachos.medium.com/a-more-abstract-unit-of-work-in-c-e5cb385770b0
Answer: The DataContext or ObjectContext is the Unit of Work.
So, your DAL will save, delete and retrieve objects and your DataContext/ObjectContext will keep track of your objects, manage transactions and apply changes.
This is an example just to illustrate the idea of the solution.
using(var context = new ObjectContext()) { // Unit of Work
    var repo = new ProductRepository(context);
    var product = repo.GetXXXXXXX(...);
    ...

    // Do whatever tracking you want to do with the object context. For instance:
    // if( error == false) {
    //     context.DetectChanges();
    //     context.SaveChanges(SaveOptions.AcceptAllChangesAfterSave);
    // }
}

And your repository will look like:
public abstract class Repository {

    public Respository(ObjectContext context){
        CurrentContext = context;
    }

    protected ObjectContext CurrentContext { get; private set; }
}

public class ProductRespository : Repository {
    public ProductRespository(ObjectContext context) : base(context){
    }

    public Product GetXXXXXX(...){
        return CurrentContext... ; //Do something with the context
    }
}

Another way is to put the unit of work (Object context) globally:
You need to define what will be your unit of work scope. For this example, it will be a web request. In a real world implementation, I'd use dependency injection for that.
public static class ContextProvider {

    public static ObjectContext CurrentContext {
        get { return HttpContext.Items["CurrentObjectContext"];
    }

    public static void OpenNew(){
        var context = new ObjectContext();
        HttpContext.Items["CurrentObjectContext"] = context;
    }

    public static void CloseCurrent(){
        var context = CurrentContext;
        HttpContext.Items["CurrentObjectContext"] = null;
        // Do whatever tracking you want to do with the object context. For instance:
        // if( error == false) {
        //     context.DetectChanges();
        //     context.SaveChanges(SaveOptions.AcceptAllChangesAfterSave);
        // }
        context.Dispose();
    }
}

In this example, ObjectContext is the unit of work and it will live in the current request. In your global asax you could add:
protected void Application_BeginRequest(object sender, EventArgs e){
    ContextProvider.OpenNew();
}

protected void Application_EndRequest(object sender, EventArgs e){
    ContextProvider.CloseCurrent();
}

In your Repositories, you just call ContextProvider.CurrentContext
Comment: ivowiblo can you please give some code example ? or link ? thanks
Comment: I implement my Unit-of-Work exactly the same way, except that instead of `OpenNew`, I lazy load my Contexts. However, I still feel uneasy when I use `Application_EndRequest` to Dispose of the Contexts. Do you know how guaranteed it is that event will fire and complete?
Comment: It will always be called when the request ends. NHibernate implements it session management using it and always worked as a charm. The pattern is called open-session-in-view
Answer: One of the most common design patterns in enterprise software development is the Unit of Work. According to Martin Fowler, the Unit of Work pattern "maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency problems."
The Unit of Work pattern isn't necessarily something that you will explicitly build yourself, but the pattern shows up in almost every persistence tool that I'm aware of. The ITransaction interface in NHibernate, the DataContext class in LINQ to SQL, and the ObjectContext class in the Entity Framework are all examples of a Unit of Work. For that matter, the venerable DataSet can be used as a Unit of Work.
For more detail info Please click here to read this article, it's a good one.
For Tutorial on Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC (MVC 4 and EF 5) Application (9 of 10) please click here
For EF 6 and MVC 5 tutorial please click here
I hope this will help, it helped me!
Answer:
Unit of Work
Maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency problems.

When you're pulling data in and out of a database, it's important to
keep track of what you've changed; otherwise, that data won't be
written back into the database. Similarly you have to insert new
objects you create and remove any objects you delete.
You can change the database with each change to your object model, but
this can lead to lots of very small database calls, which ends up
being very slow. Furthermore it requires you to have a transaction
open for the whole interaction, which is impractical if you have a
business transaction that spans multiple requests. The situation is
even worse if you need to keep track of the objects you've read so you
can avoid inconsistent reads.
A Unit of Work keeps track of everything you do during a business
transaction that can affect the database. When you're done, it figures
out everything that needs to be done to alter the database as a result
of your work.

http://martinfowler.com/eaaCatalog/unitOfWork.html
Comment: This isn't really an answer. You've just copied-and-pasted a description from a resource.
Comment: @MartinBean: Part of the question was `I do not have understanding of unit of work really is.`. Since M.Fowler wrote about this pretty well, the cited excerpt is on-topic. A link wouldn't be enough, since link-only answers are quite hated due to their ability to get broken. Hence, providing a link and copying the description seems a minimalistic valid partial answer. Minimalistic, partial, but still an answer. It is of course my personal opinion.
Comment: Good answer, sir.

What is the unit of work pattern in EF?


Will 20 minutes of jump rope per day improve long distance running?

Question: I do intervals of 2 minutes of jump rope with a 1 minute break in between each interval, during which I walk around briskly. Will this improve my long distance running time?
Answer: It's possible that it will improve your time, but not because you are getting in better running shape. Rather, you are working on your calf strength and rebound ability. This in turn should result in a slightly more efficient running stride.
However, as brent points out, it's not a substitute for running, and any gains that you might make are at best going to be 1-2 seconds off of your current pace. The best advice I've ever seen for endurance running is "Run. Run lots. Mostly slow, sometimes fast".
The biggest mistake that amateur runners make is their easy runs are often at too hard a pace, and their hard runs are not hard enough. I would recommend using the Macmillan running calculator or similar, and figuring out what your goal paces and distances should be, based off of any events that you might be training for.
Answer: I'm not a trained professional who can back that up with proper biomechanics, but I run 10 km/week and currently jump rope daily, and I strongly believe that the answer is unequivocally yes:

Jumping rope will force you to work on posture (form) and coordination. The additional strength in your core will help with keeping good form while running.
Jumping rope boosts your cardio, and can be done in a way to boost it a lot (see boxing). However, I'm not advanced enough to say that it's the best way to do so, or to give you measured improvements.
Despite being a low-impact sport, jumping rope strengthens your lower/leg muscles, a lot. If you dose your cross-training properly, that must certainly help preventing a bunch of running-related injuries.

Jumping rope is a complete form of physical activity. I'm positive that it's helping a lot with my own running.
Answer: As a cross training activity jumping rope is a fantastic activity. It will give you some cardio benefit as well as calf and leg strengthening. However this alone will not get you to the end of a long run.
The best way to train for a long run is to run. You should schedule one long run each week at 60-90 slower than you anticipated race pace. The idea behind this is to build you aerobic stamina while also getting your legs used to the time and distance you will be running.


Stretching and relaxing exercises before playing piano

Question: Do you have any good exercises to relax before playing the piano.
I'm interested specifically in relaxing the arms, shoulders and back.
Comment: Tai Chi has a warmup exercise called *tor yu* that is excellent for this. See [this video](https://www.youtube.com/watch?v=xaCm1j74eAA).
Answer: I have found two ways of relaxing helpful.
One is to first tighten the muscles you want to relax, then relax the muscles. It helps to really be able to identify the feeling of tightness, so you can undo it as soon as you notice it.
Another is almost meditative in quality. Really let yourself feel gravity pulling on your muscles, almost like you are creating a "dead weight" feeling. A person's muscles are most relaxed when asleep. I don't know if you have ever picked up a sleeping child or cat, but if you have you know how they are kind of "limp" and a bit extra heavy. This is because their muscles are doing no work to help counteract gravity.  Try to get this feeling in your arms/shoulders/back. If you don't fully feel the "dead weight" it is because you are still using a muscle to hold yourself in place. You won't play like this, but it helps to know the "extreme" feeling of relaxed. Practicing getting to this extreme can help train your mind to "go to relaxed" as soon as you notice tension.
You may want to try this second method first while sitting in a chair with a back. I have gotten relaxed enough to almost fall off a piano bench before. Like I said, it is a bit like meditation, and one can really zone out.
When I am noticing that I am starting to develop a bad habit of tension in my arms again, I practice what I call "zen scales". When I play these, I play scales as slowly and softly as possible, moving each finger (using proper fingerings) with as much of that "dead weight" feeling as I can.
I know stretching helps, too, but I don't have specific stretches to recommend. I do stretch, but it's mostly what feels natural to me to do, as if I was stretching after getting out of bed in the morning. I find I need to stretch again after doing my relaxing, almost to reawaken and get down to business.
Hope this helps!
Answer: @Heather: great advice about relaxing! (I wanted to post this as a comment, but it is too long, by far). I found doing the "windmill"-stretch really good (and neccessary)

lie on your back, knees bent, feet on the ground, arms stretched along the floor over the head
drop knees to one side and breath out (e.g. to the left)
take one (in this example the left) arm and reach over to the opposite side of the knees, slowly.

This helps stretching your back diagonally, and also do the "reaching up, plucking apples". Basically the back is nowadays everbody's Achilles' heel, so also work on your core strength (abs and back) - and this goes for most people (and instrumentalists).
See this https://www.classicfm.com/discover-music/humour/yehudi-menuhin-yoga/ for a famous violinist, who said that "his yoga teacher was his best vioin instructor". He also wrote a book "The king, the cat and the fiddle" which includes stretches and exercises for violinists on the last pages.
Edit / added: I personally find the reply by Heather S. more "on topic" than this one - even if mine is marked as "the answer" (as of Oct.2018).


J-1 visa and two-years home residency requirement

Question: I was in the USA with a J-1 visa and I left the country after 4 months. How can I  check online to see I am subject to two-years home residency?
Answer: The US Department of State Bureau of Consular Affairs gives guidance on how to seek an advisory opinion, should you be unclear of your obligation.

If you do not know whether the two-year home-country physical presence requirement applies to you, after having reviewed the Eligibility Information webpage, you can request that the Department of State, Waiver Review Division conducts an Advisory Opinion. An Advisory Opinion is a review of your exchange visitor program documents to determine if you are subject to this requirement.


Does paypal provide offline token or master token?

Question: I have create an application in paypal sandbox account. I want to do when some of the user click 'transfer money' button, then paypal transfer money from my account to user's account (Note: we have user's email id).
So, it possible to transfer money without authentication to paypal account something like offline access method.
Thanks in advanced.
Answer: What you want is a billing agreement, where the user authorizes you to make payments against a PayPal account in the same way you would debit a bank account or credit card. Billing agreements are typically set up in the same way Express Checkout works, but you will be provided an ID to refer to when you need to make payments.

A Billing Agreement allows a seller to charge your PayPal account when you purchase goods from them or use their service.
An example of this would be an agreement to pay eBay seller fees for listing items on eBay.


Galaxy S5 Active home button - weird long press behavior

Question: I've got an S5 Active on AT&T. After the latest update, my home button started registering almost any press as a "long press." Does anyone have an idea of how to fix or mitigate this problem? Also, if anyone else has experienced the same thing, please let me know as I'd like to think I'm not crazy!
Answer: The good news: you're not losing your mind.  The even-better news: there seems to be a solution.
Head on over to ifixit and take a look at their thread.
Comment: Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.
Answer: The solution I've found while waiting for an update to fix the update is to turn off auto updates if it's on, and uninstall all updates to the Google application, restoring that app to factory. Hoping there's a better fix soon so I can turn auto updates back on.


Are networks using EAP-TLS affected by Heartbleed?

Question: Does the Heartbleed bug affect WiFi networks secured by WPA2-EAP in TLS mode? Since it's using TLS to secure connections between the server and clients, is it possible to attack the server using the Heartbleed attack and read the memory, stealing the private SSL key from the server?
Comment: This will depend on the server implementation, at a minimum to be affected the server will need to use OpenSSL. But there are many other layers/technologies in Wifi networks so that is probably not the only consideration.
Comment: Fairly certain that the implementation uses a vulnerable version of OpenSSL.
Answer: There are two main ways in which SSL/TLS and EAP may mix: EAP-TLS and EAP-TTLS. Basically, EAP is a generic protocol for exchanging "messages", and the "authentication method" defines the message contents. In the case of the TLS-based EAP methods, the messages contain the various handshake messages from SSL/TLS. In EAP-TLS, the normal case is that the client uses a certificate, and the certificate-based authentication from TLS is then leveraged; with EAP-TTLS, client authentication is not performed during the handshake, but an additional authentication protocol (which may itself use EAP) is played within the tunnel.
In any case, the normal SSL/TLS handshake messages are sent and received and processed, including the "heartbeat" extension of ClientHello and ServerHello. If a given implementation of EAP-TLS or EAP-TTLS uses a vulnerable version of OpenSSL to process the SSL/TLS handshake, then yes, the so-called "heartbleed" attack should apply, subject to the usual (and mostly unknown) vagaries of such kinds of attacks (namely, the buffer overrun will reveal what lies at that place in RAM, which depends a lot on the operating system and overall applicative layer).
Notably, the vulnerability occurs in the processing for the very first handshake message (the ClientHello), thus nothing in the rest of the protocol (e.g. cipher suite choice) has any impact on it.
However, we may say that most WiFi access points are never updated, so this specific vulnerability is just one more at the end of the long (and growing) list of vulnerabilities which apply to most deployed access points. In that sense, there is no reason to panic (the situation is bad, but it already was, and it is not made significantly worse).
Comment: A couple additions: PEAP, which is hugely popular, also uses TLS as the outer tunnel, must like TTLS does (it can also optionally use TLS as the inner auth as well). Also, the vast majority of APs don't implement EAP locally; they just pass it through to a RADIUS server. So most sysadmins need to check if their RADIUS server is using a vulnerable version of OpenSSL for their EAP-TLS, EAP-TTLS, or PEAP support. FreeRADIUS **DOES** use OpenSSL for its TLS implementation for TLS-based EAP types, so when built with vulnerable versions of SSL, it *IS* vulnerable: http://freeradius.org/security.html


Adding pole bone to IK ignores IK constraints

Question: I'm trying to rig my character's legs with IK. The way I set it up seems pretty standart, and I see it in many tutorials: I have a foot controller (IK) bone near the foot, which controlls the shin bone with the chain of 2. I have some constraints so that knee doesnt bend sideways, and for the hip joint as well to limit it's movement. When I test it just like that all constraints work like a charm.
However I need some way to control knee orientation, so I add a pole bone to my IK which works out nice, except that the hip constraints are ignored now. Knee constraints still work, but the hip can now bend at any angle imaginable - I can pose character's leg straingt up and so on.
Would really love to hear how I can avoid that problem. Also I'm a programmer, so maybe there's some script or something I should look into, I just dont know where to look because I'm new to blender and modelling in general.
Answer: Your problem is limiting Ik bones ranges with constraints. You need to use this panel for Ik:

A simple leg Ik rig is here: How to IK rig legs
How to handle pole bones and their angles precisely is here: How to Set/Calculate pole angle of IK constraint so the chain does not move?
Comment: No it's not, because that's the very menu I add constraints with, no? I didn't even know there were other ways. I add constraints here. They work if I just use IK bone. But if I add pole bone as well, then this constraints are ignored.
Comment: Well if you add pole bone then these IK limits are ignored, thats correct behavior and only logical.


What is the name of this category of visual artwork? Is this pop art?

Question: There is a style of artwork that I want to learn to create. It abstracts away most detail, but it is not really abstract art. It has a lot in common visually with vector illustrations, but some of the examples I see are created using markers, acrylics, and other physical approaches (as opposed to digital). Here are examples (all motorsports, but I also see this style with some vintage travel posters):
example 1
example 2
example 3
Comment: I don't think these are the same style. Nos. 1 and 2 are similar, you could call them pop art, but No. 3 looks like a 3D render of a car, and to me it stands out as totally different to the other two.
Answer: "Pop art" seems to fit the bill to me.
It really doesn't matter if an illustration is created in a traditional manner or digital manner. That doesn't necessary alter the name of a style, if there even is a name (not everything has a name).


How do I get outside cats to drink more water?

Question: I have a small cat sanctuary and have recently started doing my own wellness exams, including urinalysis strips. I'm already finding cats with very concentrated urine and some with infection that I'm trying to treat with an herbal remedy. Upon monitoring, I'm finding them drinking very little water. I can feed wet food when isolated but it's not as feasible to make it everybody's main source of food all the time. I keep clean, full water bowls outside and inside for them. I live in Texas so it is nice and hot (water bowls are in the shade). They aren't really exhibiting any symptoms, but I want my cats to be as healthy as possible. What can I do to get them to drink more water outside, where it's not really possible to set up a fountain?
Answer: I wouldn't try to treat your cats for infections yourself. You can get into trouble with that kind of thing. That's up to your discretion, though.
As for drinking. I was watching a cat show a while back and one of the things they mentioned is that cats don't like to eat and drink in the same place as their "kill". This even applies to kibbles, which they see as a "kill".
I had noticed in the past that my cat would walk outside and drink out of the dogs water bowls, when he had cleaner and fresher water inside. Inside, we had one of those side-by-side food and water dishes. Between seeing the show and observing his behavior, we determined he's rather drink water that was more stale than to drink beside his food bowl. We moved him a new water bowl about 10' away and he drinks much more frequently. So that's the first step I'd take if I were you. I'd make sure the water isn't near the food.
Secondly, cat's prefer fresh or even moving water. Granted, they'll do fine without that, but if you're interested in getting them to drink more water, it's something to consider. You can buy, reasonably priced, either a pet fountain or just  self contained fountain like the ones seen below.

You can even make your own, but buying a small pump or filter/pump and building a fountain. You can make it fancy or plain. Just make sure the all the materials are safe for you pets. Nothing that will break down and contaminate the water.
If I was going to build a cheap one and didn't care what it looked like, I'd do it like this. I'd buy an under the bed Rubbermaid (any Rubbermaid really, but these are longer and would allow more cats at once without crowding). I'd cut it down so it's 3-4" deep. I'd use a filter/pump to cycle the water. You can use a modified aquarium pump. I'd probably use one like this:

The bottom end can be shallow. I think it also have a filter, which would be useful.
Comment: I've been around cats long enough to know when they have something mild I can treat at home or more serious and need to go to the vet. I recently had a bad experience with my vet where two of my cats died that shouldn't have so now I've got to find someone I can trust. I believe I'm going to try the outdoor fountain, especially now that I know you can hook them up to solar panels.
Comment: That sounds like a great idea, with the solar panel. There are definitely people who can treat minor issues with their animals at home. I err on the side of caution, because I've personally seen people doing their animals harm, because they're cheap or think they know what they're doing. If you know what your doing, then by all means save the money. I'm sorry to hear about your two cats.


Have you used any of the C++ interpreters (not compilers)?

Question: I am curious if anyone have used UnderC, Cint, Cling, Ch, or any other C++ interpreter and could share their experience.
Comment: @GeorgFritzsche This question is about C++, not C.
Comment: Voting to close as too broad.
Answer: There is cling Cern's project of C++ interpreter based on clang - it's new approach based on 20 years of experience in ROOT cint and it's quite stable and recommended by Cern guys.
Here is nice Google Talk: Introducing cling, a C++ Interpreter Based on clang/LLVM.
Comment: Cling actually works by compiling interactively, it's more of a JIT compiler than an interpreter. Also, as a "CERN guy" I feel obliged to comment on "recommended by CERN guys": many of us would argue that the main lesson after 20 years of ROOT is that monolithic software (ROOT) based around a single language (C++) is a mistake. Cling is a good crutch for those who continue to warship C++ as the be-all-end-all of languages, but we aren't all hobbling away from CINT on another C++ interpreter: for interpenetrated code, you can do far better than C++, use Python or Ruby.
Answer: NOTE: what follows is rather CINT specific, but given that its probably the most widely used C++ interpreter it may be valid for them all.
As a graduate student in particle physics who's used CINT extensively, I should warn you away. While it does "work", it is in the process of being phased out, and those who spend more than a year in particle physics typically learn to avoid it for a few reasons:

Because of its roots as a C interpretor, it fails to interpret some of the most critical components of C++. Templates, for example, don't always work, so you'll be discouraged from using things which make C++ so flexible and usable.
It is slower (by at least a factor of 5) than minimally optimized C++.
Debugging messages are much more cryptic than those produced by g++.
Scoping is inconsistent with compiled C++: it's quite common to see code of the form
if (energy > 30) {
    float correction = 2.4;
}
else {
    float correction = 6.3;
}

somevalue += correction;

whereas any working C++ compiler would complain that correcton has gone out of scope, CINT allows this. The result is that CINT code isn't really C++, just something that looks like it.

In short, CINT has none of the advantages of C++, and all the disadvantages plus some.
The fact that CINT is still used at all is likely more of a historical accident owing to its inclusion in the ROOT framework. Back when it was written (20 years ago), there was a real need for an interpreted language for interactive plotting / fitting. Now there are many packages which fill that role, many which have hundreds of active developers.
None of these are written in C++. Why? Quite simply, C++ is not meant to be interpreted. Static typing, for example, buys you great gains in optimization during compilation, but mostly serves to clutter and over-constrain your code if the computer is only allowed to see it at runtime. If you have the luxury of being able to use an interpreted language, learn Python or Ruby, the time it takes you to learn will be less than that you loose stumbling over CINT, even if you already know C++.
In my experience, the older researchers who work with ROOT (the package you must install to run CINT) end up compiling the ROOT libraries into normal C++ executables to avoid CINT. Those in the younger generation either follow this lead or use Python for scripting.
Incidentally, ROOT (and thus CINT) takes roughly half an hour to compile on a fairly modern computer, and will occasionally fail with newer versions of gcc. It's a package that served an important purpose many years ago, but now it's clearly showing it's age. Looking into the source code, you'll find hundreds of deprecated c-style casts, huge holes in type-safety, and heavy use of global variables.
If you're going to write C++, write C++ as it's meant to be written. If you absolutely must have a C++ interpretor, CINT is probably a good bet.
Comment: While all your complaints about cint are perfectly valid (and you missed a few), you can take my word that the COMIS interpreter for PAW was much worse. Also that PAW provided a adequate environment of interactive plotting---it just had the scaling problems you would expect from a fortran 77 style of coding.
Comment: @Sergei I don't know if I understand you: interpreters are slower than compiled code
Comment: @dmckee Believe me, I'm glad we're not working with PAW. My point isn't that CINT is worse than _everything_, only that there are many things which would be better.
Comment: how can it be slower?
Comment: @Shep, isn't just a wrapper around compiler? You probably may set optimization you want (I guess -O0 is default for better interactivity and incremental linking). https://root.cern.ch/download/R2002/Cint2002.pdf - optimization mentioned.
Comment: @Sergei, no, cint is a full-blown interpreter. As another answer points out, it's been replaced by a wrapper over a compiler, but the question was about interpreters.
Answer: cint is the command processor for the particle physics analysis package ROOT. I use it regularly, and it works very well for me.
It is fairly complete and gets on well with compiled code (you can load compiled modules for use in the interpreter...)
late edit:: Copied from a later duplicate because the poster on that questions didn't seem to want to post here: igcc. Never tried it personally, but the web page looks promising.
Comment: @littlenag To say root "meets [our] needs" is a little generous. The framework is horribly flawed on several basic levels, and only continues to see widespread use because it's completely non-modular and thus nearly impossible to remove. CINT is a prime example of something you _have to_ install when all you want to do is read in a data file.
Comment: I know several graduate students in physics that do the majority of their coding in cint/root, and while they don't always have nice things to say it meets their needs for performance and flexibility.
Comment: Well, it is c++ with an add layer of complexity from needing to build the interperter<-->binary-code dictionaries. Plus the root class tree is a pain. But cint works. It works a lot better than COMIS did in the cernlib days.
Answer: I have (about a year ago) played around with Ch and found it to be pretty good.
Answer: Also long ago I used a product call Instant C but I don't know that it ever developed further
Comment: Will you provide some links? That would be really helpful.
Answer: Long ago, I used a C++ interpreter called CodeCenter.  It was pretty nice, although it couldn't handle things like bitfields or fancy pointer mangling.  The two cool things about it were that you could watch when variables changed, and that you could evaluate C/C++ code on the fly while debugging.  These days, I think a debugger like GDB is basically just as good.
Comment: What would the interpreter do when it encountered a template instance? (or other preprocessing business). Was there some level of precompilation/preprocessing to handle templates or the preprocessor?
Comment: Yes, all the CPP stuff and templates were all part of the language being interpreted.  Pretty nice.
Answer: I looked at using ch a while back to see if I could use it for black box testing DLLs for which I am responsible.  Unfortunately, I couldn't quite figure out how to get it to load and execute functions from DLLs.  Then again, I wasn't that motivated and there may well be a way.
Answer: There is a program called c-repl which works by repeatedly compiling your code into shared libraries using GCC, then loading the resulting objects.  It seems to be evolving rapidly, considering the version in Ubuntu's repository is written in Ruby (not counting GCC of course), while the latest git is in Haskell. :)


What is the benefit of Krivine's notation?

Question: I saw some people uses Krivine's notation for function application when presenting the syntax for the $\lambda$-calculus.  For example, the $\lambda$-term $\lambda f . \lambda x . \lambda y . f\ x\ y$ (with the normal convention that function application associates to the left, so it actually means $\lambda f . \lambda x . \lambda y . ((f\ x)\ y)$) is written $\lambda f . \lambda x . \lambda y . (f)\ x\ y$ (with a similar convention that it actually means $\lambda f . \lambda x . \lambda y . ((f)\ x)\ y$).  I do not see the point of having another pair of parentheses around the innermost $f$.  Why do people use Krivine's notation instead of the usual one?
Answer: I'm assuming you mean Krivine's notation from Lambda Calculus: Types and Models.
This notation, used as a data representation, makes many algorithms on lambda-terms simpler to implement and prove correct. That is, given a  lambda term $f\; e_1\; e_2\; \ldots\; e_n$, you want to view it as a head $f$, together with a list of arguments $[e_1,  e_2, \ldots, e_n]$.
For example, suppose you want to compare two terms $f\;e_1\;\ldots\; e_n$ with $g\;t_1\;\ldots\;t_n$. It is often most natural to compare the heads $f$ and $g$ first, and not even look at the $(e_i, t_i)$ pairs unless that comparison succeeds. (This often comes up in implementations of higher-order unification.)
See Cervesato and Pfenning's paper A Linear Spine Calculus for a formalization of this idea.
Answer: One interesting difference shows up in Section 2 "Representable functions" of Chapter 2 of Krivine's book.  Church-encoded three is written in standard notation as $\lambda\ x.\ \lambda\ y.\ x\ (x\ (x\ y))$.  With Krivine's notation (if I am finally understanding it correctly!), we would write instead $\lambda x\ \lambda y\ (x)(x)(x)y$.


Why is visible light easily blocked by pretty much anything but radio waves are not?

Question: Light (visible part of electromagnetic spectrum) is easily blocked by most materials. Radio waves are not but also X-rays are not. What is so special about this small part of the spectrum since both shorter and longer waves seem to behave differently?
Comment: A thin metal foil will block most radio waves just fine. You have to go to really low frequencies (on the order of 10kHz and less) to get trough more than a few mm of copper. You would need 50keV x-ray energy at the other end of the spectrum to do the same with high energy radiation. A thin sheet of copper can therefor block some 15 or 16 orders of electromagnetic frequencies. That's pretty good in my books.
Answer: Blocking means there are interactions with the light that manage to absorb it completely.
Most materials are opaque  to visible light due to the underlying quantum nature of matter. To emit light or absorb light there should be energy levels that will "trap" those frequencies

electromagnetic spectrum

Yes, x-rays and higher energy photons pass through thin layers of matter because they mostly scatter. Only very low frequency radio wave will go through anything. Most other frequencies will resonate with some electronic energy bands and particularly metals can trap them.
So it is not a "small part of the spectrum" that is blocked. What is true is that radio waves go through non metalic materials because there are no electronic energy levels to absorb them or reflect them. And the same is true for X rays and higher frequencies.
Comment: naively, do metallic grids absorb radio waves ?
Comment: @igael It depends on the grid dimensions and the wavelength of the radio wave. After all a metal antenna picks up the radio signal for the radio, so yes the electronic band structure of metal has energy bands that can absorb the radio frequency photons. Alternative picture classically, a dipole electric field can be built up on the antenna by the incoming em wave
Answer: Many frequencies of waves are blocked easily - for example, see this graph of atmospheric electromagnetic absorption --> https://en.wikipedia.org/wiki/File:Atmospheric_electromagnetic_opacity.svg
However, you also asked what is special about visible light - well, it's special to us because we can see it! We have evolved retinas that respond to this part of the spectrum, reacting to and interpreting the received light as visual information.
It is plausible this happened because the solar spectrum peaks in the region of visible light, making it the part of the spectrum which has the potential to provide the most information.
Is there something special in the visible part of electromagnetic spectrum?
Answer: Whilst your general statement about radio waves is true, X-rays do not in general pass through all materials better than visible light (eg consider the Earth's atmosphere or water).
I'll offer you a different take on the radio wave transparency issue.
The interaction of light with matter can be dealt with in terms of a macroscopic absorption coefficient that is related to microscopic radiation processes as
$$\kappa = \frac{h\nu_{ji}}{4\pi}(n_i B_{ij} - n_j B_{ji}),$$
where $n_i$ and $n_j$ are populations in levels $i$ and $j$ and $B_{ij}$ and $B_{ji}$ are the Einstein absorption and stimulated emission coefficients for transitions between these levels.
It is important to note that stimulated emission is equivalent to negative absorption.
Now the Einstein coefficients are related to each other (see https://en.m.wikipedia.org/wiki/Einstein_coefficients), such that
$$ g_i B_{ij} = g_j B_{ji},$$
where $g_i$ and $g_j$ are the statistical weights of the respective energy levels.
For a medium in thermal equilibrium, the populations of the levels are related by
$$\frac{n_j}{n_i} = \frac{g_j}{g_i}\exp(-h \nu_{ji}/kT),$$
where $h\nu_{ji}$ is the energy difference between the levels. Thus the absorption coefficient could then be written
$$\kappa =\frac{h\nu_{ji}}{4\pi}n_i B_{ij} \left(1 - \exp(-h\nu_{ji}/kT)\right)$$
Now radio wave transitions with wavelengths longer than say 1 m, have corresponding energies of $<1.2 \mu eV$. So even if temperatures are similar to the cosmic microwave background (and not much gets cooler than this), the term in brackets is very close to zero. Thus even where there are appropriate transitions at radio wave energies, any true absorption is almost exactly cancelled out by stimulated emission, resulting in no net absorption $\kappa \simeq 0$.
Note that this is only a partial explanation that deals with the lack of atomic or molecular absorption at discrete energies. However similar arguments pertain to continuum absorption processes.
A somewhat different argument can be employed for materials with free electrons and high conductivity. Here the classical skin depth is proportional to $\nu^{-1/2}$. So low frequencies penetrate further.


Why do vampires have to be invited in?

Question: In thousands of movies, books and TV shows, vampires have to be invited inside of the house in order to attack the inhabitants. My question is why do they have to be invited inside, is there an actual reason or is this going on ancient folklore? Is there an explanation?
Comment: Although one answer attempts to speak to multiple fictional continua, you need to quantify in what fictional universe you are asking -- not all vampires need invited in; it depends on the author.  I think what you may be trying to ask is more along the lines of "What is the origin of the tradition (seen in multiple fictional settings) that Vampires must be invited in to enter a dwelling?"  -- That being said, [that question has already been asked](http://scifi.stackexchange.com/questions/45052/where-did-the-idea-of-vampire-invitation-first-originate).
Comment: And answered by people who are fluent in Latin?
Comment: My bet: A plot device to give the villagers some safe ground. Given that the vampires are usually depicted as strong, fast, clever, with hypnotic-like powers, you need some rules (garlic, need of invitation) to provide some leveling ground to humans. Otherwise, every vampire nest would lie in the middle of a growing "dead zone" where all of the habitants would be already dead or vampires.
Comment: I think that people are trying to give you too literal of an answer where there isn't one. Vampires in general and most of their characteristics are largely symbolic. I'd say that the recurring idea that they have to be invited in represents concepts like (a) human beings invite the evil into their lives which threatens them and/or (b) God and/or the powers of good try to protect human beings from evil.
Answer: Where did the idea of vampire invitation first originate?
It depends on what vampire literature you're reading.
Much literature decides to use this trope, but some do not. The reasons vary though.
tvtropes.org

Going back in various mythologies is the idea that supernatural beings
  — such as vampires, ghosts, demons, witches, what have you — cannot
  enter into a home unless invited to do so. Often such beings will try
  to gain entrance by tricking a person into believing they are someone
  else.

Vampire Diaries

Invitation is a weakness of vampires and hybrids, including Original
  vampires/hybrids. In order to enter any house owned by humans,
  witches, werewolves, or doppelgängers, vampires or hybrids must be
  invited by the owners of the home. Once invited, the vampire cannot be
  uninvited unless the ownership of the house changes.
In The Vampire Diaries, vampires were not created by the planet
  compared to the other species. As a defense, nature attacks the
  vampires with sunlight, wood, vervain, and other elements (for
  example, water weakens vampires in the books). With the purpose to
  defend against the undead, the living kept the vampires away by
  banning them entry into their homes. Literally, it's like saying: I
  invite my own death to my home.

How was Rebekah able to enter the Salvatore home
- Trueblood

Entry to homes: Vampires cannot enter private human homes unless they
  are invited in by the owner of the house. Vampires do not need to be
  invited into public places (such as bars or restaurants). Humans can
  rescind their invitations from vampires, which causes the vampire to
  immediately leave the house. Vampires can get around this by
  glamouring a person into inviting them in. Ancient vampires might not
  be subjected to this weakness, suggested by Bill who drank Lillith's
  whole remaining blood and Warlow that has never been invited to
  Sookie's house.The death of the human owner of a residence allows any
  vampire to enter even without an invitation.

The mythology
Yahoo
Wikipedia

Some traditions also hold that a vampire cannot enter a house unless
  invited by the owner, although after the first invitation they can
  come and go as they please.[38] Though folkloric vampires were
  believed to be more active at night, they were not generally
  considered vulnerable to sunlight

And here.

The reasons being (from the sources):

Magic
Protection for humans (that was contingent on their creation)
It is sometimes not just for vampires, but for other supernatural creatures as well.

Then there are these other SFF.SE questions.
Could the Enterprise beam a vampire into a house she didn't have permission to enter? [closed]
If a vampire would stand inside a house when it was built would he be albe to leave? [closed]
Is there any down side to being a vampire in modern fiction? [closed]
How did Silas get inside Caroline's house?

Why do vampires have to be invited in?


Apache cannot start after fsck /dev/mmcblk0p2

Question: I had a problem with my RasPi and it couldn't boot to lxde. So I tried fsck /dev/mmcblk0p2 and it works again. However, my Apache cannot start anymore so I can't open localhost and phpmyadmin. The error is "cannot load /usr/lib/apache2/modules/mod_auth_basic.so".
Do you have any idea how to fix it?
Comment: It's not impossible for data to be lost after a `fsck`, even when done properly (with the fs unmounted) *if* the fs was in an inconsistent state to start with (which you imply it was).  What `fsck` does is fix the filesystem so that whatever can be recovered is, and so that there are no inconsistencies which might snowball into further corruption.  Usually this puts everything to rights, but if a file is truly mucked then it will remain that way. So don't get into a habit of thinking, eg, that you can yank the plug and if there is a problem fsck will fix it. Probably, but it is not guaranteed.
Answer: How did you do fsck? If you did it while system running (that means /dev/mmcblk0p2 mounted as /) you did it wrong. Linux filesystems should not be check/repair while mounted.
If you did check/repair filesystem while mounted maybe apache modules moved to /lost+found folder which is a linux special folder. You can search your file in /lost+found then move to original folder if you can find it. I suggest you backup your SD card, re-image with your system then restore your files.
From fsck manual :
Note that in general it is not safe to run e2fsck on mounted filesystems. The only exception is if the -n option is specified, and -c, -l, or -L options are not specified. However, even if it is safe to do so, the results printed by e2fsck are not valid if the filesystem is mounted. If e2fsck asks whether or not you should check a filesystem which is mounted, the only correct answer is ''no''. Only experts who really know what they are doing should consider answering this question in any other way.
http://linux.die.net/man/8/fsck.ext3
Comment: My RasPi couldn't log in LXDE and stay at prompt. The reason was the root account was locked. So I did fsck /dev/mmcblk0p2, rebooted and it started working again exept apache.
I tried to look at the lost+found folder but can't find any file there.


Could an annual plant be genetically modified to be a perennial?

Question: My chives, asparagus, oregano, and rhubarb come back every year like clockwork.  Suppose I want my bok choy to join the party - is there an "I'll be seeing you next year!" gene that can be modified to be turned on to be like my hardy chives, or is it more complicated than that?
Comment: It is definitely more complicated than that.
Comment: the plant's genes are all adapted in countless ways to optmize the out come for the annuals for their current lifestyle.  it would take a lot of effort, re-engineering many aspects of the plant's genome.  In the end you would have a very different plant if you could do it.  it sounds almost like a manhattan project of plant biology in scale.
Comment: @Chris But they just need a rhizome system to store nutrients for the winter right?
Answer: Researchers at Ghent University have made a discovery that downregulation of the proteins CONSTANS 1 (SOC1) and FRUITFULL (FUL) lead to the development of many perennial traits in annual plants (in the study Arabidopsis thaliana is used) (reference).
The CONSTANS gene controls flowering in Arabidopsis thaliana (reference).
FRUITFULL (FUL) is an MADS box gene that functions early in controlling flowering time, meristem identity and cauline leaf morphology and later in carpel and fruit development in Arabidopsis thaliana (reference).
The process is complicated and would need many genes to be manipulated but this research proves that it is possible. Another article of interest.


How could an iceberg be created quickly?

Question: For my middle-grade science-fiction novel, I need to come up with an invention or chemical that could rapidly create icebergs to refreeze the Arctic and slow climate change. Kurt Vonnegut's Ice-9 is tempting to use, but this possibility has been debunked too many times by critics. Would any other seed crystal work? Thanks!
Comment: Hmmm. In this venue, "science-based" usually means that we obey the laws of thermodynamics. You could make a super-crystal...but it would be a warm super-crystal.
Comment: No whatever you use will generate more heat being made than the iceberg can cool.
Comment: The latent head of solidification of water is *massive*. To freeze water you absolutely need to get rid of that heat, that is, extract it from the water and transport it elsewhere.
Comment: Lots and lots of [ammonium nitrate](https://en.wikipedia.org/wiki/Ice_pack)?
Comment: So you are trying to get random people in the internet to do parts of your school work? Genuinely the first time ever I envy the younger generations. Well done.
Comment: @Matthew losta _instant cool packs_ - otherwise the ammonium nitrate will lower the freezing point of water, so you'll get a cold massive pool of a slushy solution.
Answer: Well, the best way to get something to cool down is to not heat it up. The sea ice in the Arctic already melts and refreezes seasonally, so all you need to do is prevent the ice from melting in the spring and summer. There are two sources of energy for the Arctic: the sun, and warmer water from equatorial regions.
The Sun
This is simple. You just need a lot of white, reflective stuff on top of the water. I'd recommend something that will break down into something safe quickly (about six months, probably) in Arctic conditions. Claim it's some sort of paper, and make a lot of paper boats. These will substitute for ice until it's cold enough for more ice to freeze, if you deploy them in the spring.
The water

(From the Norwegian Polar Institute)
Well there's your problem. You've got warm water coming up in the form of the gulf stream. There's also some from the Bering Strait and from Canadian and Russian rivers, but it's mainly the  gulf stream. You've got to figure out where you're putting that, and where you can move it without screwing up things even worse.
The scale
Now, I haven't mentioned this before, but this is going to be a massive project. You're going to be covering a country-sized area with paper boats. That's a lot of boats. That's a lot of paper. I don't think we make enough paper to be able to do that.
As for deflecting the gulf stream, that will probably be the world's largest engineering project. That's a lot of water and energy you're trying to redirect. This makes every canal ever built, combined, look like a child digging a hole at the beach.
I'm gonna quote NOAA here:

The Gulf Stream transports nearly four billion cubic feet of water per second, an amount greater than that carried by all of the world's rivers combined.
Answer: Compressed air?
Have a structure on surface which compresses the air. Make the compressed air go thru an heat exchanger to get rid of the heating from compression. Then have a pipe that goes sufficiently deep underwater and preferably also some distance off your structure. Let the compressed air bubble up.
When the bubbles come up they will expand and absorb heat from the water which is then lost into the atmosphere when the bubbles reach the surface. This circumvents the protection water gets from ice and freezing water forming a protective cover and makes it cool much faster and more efficiently. Which should result in faster and more efficient freezing and icing over.
Your goals do not seem to require actual icebergs just covering the sea in ice, so I skipped the part where the ice would form icebergs. Although that should be a natural consequence if the sea ice gets thick enough and my suggestion makes the ice thicken much faster. Normally the ice insulates the water under it.
Comment: Nice idea!  Instead of compressing the air at the surface then sending it down, pump it down and let the depth compress it.  Plus then you can dump the heat in the sea floor.  Plus then the story gets sweet undersea compression bases.
Comment: @Willk You missed the part where we want to **cool** the water and not pump heat into the sea. Also compressing the air and pumping it down to any reasonable depth are pretty much the same thing, so combining them so that you do everything complex on surface and only need a dumb and pressurized pipe under water saves lots of trouble.
Comment: Yay! Get that air at about 300-500m depth and you'll start extracting the methane trapped as [methane clathrate](https://en.wikipedia.org/wiki/Methane_clathrate) - you can use it as fuel for those compressors! :grin:


Exact meaning of the term "clutch"

Question: When reading a Wikipedia article to do with chickens, I have come across the term "clutch", but I was not able to entirely figure out what this word means. I was wondering whether the term clutch can be used to refer to any set of eggs by birds, reptiles, and amphibians, or whether a clutch must consist of a set eggs all by the same bird, reptile, or amphibian. In general, if a typical clutch by a well fed chicken amounts to a dozen of eggs, that seems like a lot of eggs for a chicken to hold within its body prior to laying them, hence my question about clarification and about what number would actually fit (I have seen as high as fifteen). It is this simply the number of eggs expected to live concurrently in a typical nest where more than one chicken would breed?
Answer: A clutch usually refers to all the eggs for a single reproductive event or laying or location. It can mean either all those laid by one organisms in one event or all those laid in a population in a single time and place. Which is usually clear in context.
Even just for an individual it is a bit vague however and can refer to one laying or multiple layings if they happen close together in time.
There is also a usage difference by specialization, agricultural scientists tend to favor a boarder usage for instance.
Comment: Thank you for your answers. Could you please indicate what other areas of specialization that make use of such a term "clutch" exist besides agricultural science? Thanks.
Comment: Could you please also identify the typical and maximum number of eggs which may sit in a chicken's body? Thanks.
Comment: chickens lay around one egg a day, so there clutches are built incrementally, average clutch size is around 12 eggs. rarely does more than one fully developed egg sit in a chickens body, the key term is fully developed.
Comment: As for other usages, everything from paleontology to ethology. basically any branch of zoology could be dealing with eggs
Answer: Well, strictly speaking from an etymological viewpoint, a clutch is:

"a brood, the number of eggs incubated at any one time," in reference to chickens, 1721, a southern England dialectal variant of cletch (1690s), noun from cleck (v.), which is from Middle English clekken "to hatch, give birth to" (c. 1400), which is probably from a Scandinavian source (such as Old Norse klekja "to hatch"), perhaps of imitative origin (compare cluck (v.)). Compare batch/bake.

Exact meaning of the term "clutch"


HTML Canvas performance - import image or draw canvas

Question: For images of this complexity/simplicity, is it better to create pngs and import into canvas or draw the paths and fill on the canvas?
http://www.freeiconsdownload.com/site-images/Large/developer_icons_452x336.jpg
Answer: With Canvas, in general, it is almost always better to draw from a PNG/in-memory canvas than to construct and draw a path. (see footnote) Here's some simple data. We're talking a factor of 10 here. For simple stuff.
Especially if you are going to draw those objects over and over, 60 times a second.
And especially when text is involved.
With complex canvas-generated shapes, several performance-minded people have taken to pre-rendering them on in-memory canvases and then drawing from canvas to canvas (using drawImage) instead of recreating the path each time. It is worth it in an awful lot of cases, but of course nothing can beat profiling and timing your own specific situation.
Not to get off course, but I'd just like to remind that you probably shouldn't be worrying about this sort of thing until you are (nearly) finished with your Canvas app.

"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil" -Knuth

A big thing to note is that for a lot of applications, the performance of drawing these buttons might not even matter (or else have no tangible difference) and you probably do not want to even worry about which way is faster until you are already finished the first iteration of your Canvas app and are working on the "polish, polish, polish" update.

Some may wonder when rendering paths on the fly is better and it's probably obvious to most but in case it isn't I will give it a mention. There are certainly times path-rendering-on-the-fly is the case: Interactive paths such as in drawing programs and animations born out of paths, where the next frame is not another still image but an addition to a path. These and more - anywhere that you want to update the path itself with each frame - are the places that you'll want to keep paths and not try to pre-render anything.
Comment: Correct, drawing a png is often faster then creating paths and draw them on the canvas, especially when it comes to concave shapes. What could be even faster is to create a pattern of the image and use it as fillstyle on a rect:

var pattern = ctx.createPattern(img,"no-repeat"); //do this only once

ctx.translate(x,y); //to where to draw the button
ctx.fillStyel = pattern
ctx.fillRect(0,0,img.width,img.height);

[Edit: accidentally pressed enter to early, added the rest of the text]
Answer: I imagine that each browser would perform differently, it would probably be best to write a quick benchmark and time how long it takes to draw say 1000 of each type.
That being said, in terms of ease of programming, if you have the PNGs already why not use them as is.


Does living in university housing mean that they will own intellectual property you create there?

Question: So I was wondering. Most IP policies at Universities state that you must work on inventions, software, etc. on your own time in order to keep your rights to it. Most also say that you can't use University facilities in the process. But if you live in student housing, wouldn't this count as a "University facility." So wouldn't it technically be impossible to patent something while keeping your rights?
Comment: If there's a university in the world that has actually claimed ownership of a student's invention on the basis of them living in university housing, or even announced that it might do so, I'll eat my hat.
Comment: Not a lawyer, but you lease residential housing. The university still owns it, but so long as you follow the agreements in the contract, I don't see why they can have any bounding on work you do in the room, especially when you're doing it on your own computer.
Comment: The only real answer is to read the specific IP agreement you sign with your university, or have a lawyer read it for you.  That said, I agree with Nate Eldredge that it is extremely unlikely that any university would even attempt to create such an arrangement, let alone succeed in enforcing it.
Answer: University IP policies generally have a separate category for intellectual property created using resources "usually and customarily provided" by the university. In every policy I've ever seen, even if the university generally retains ownership of IP created using university facilities, this excludes the above category (which would certainly include standard university housing).
For example, at the University of Illinois:

Traditional academic copyrightable works created using university resources usually and customarily provided are owned by the creators. Such works need not be licensed to the University.
When determining ownership and license rights in copyrightable works, "University resources usually and customarily provided" includes office space, library facilities, ordinary access to computers and networks, or salary.

At the University of Arkansas:

Creator is entitled to copyright ownership and right to revenues subject to compliance with conflict of interest and commitment policies.
This category applies when the faculty or staff member constructs the materials using nothing more than university resources usually and customarily provided. These include but may not be limited to office space, library facilities, ordinary access to computers and networks, faculty development workshops, or salary.
The author owns the copyright and is entitled to receive all revenues for commercialization, subject to the conflict of interest and commitment policies.

An alternative terminology for the same concept is to distinguish between "substantial" and non-substantial use of resources. For example, at Minnesota State:

Substantial Use of Resources. Substantial use exists when resources are provided beyond the normal professional, technology, and technical support supplied by the college, university, and/or system office to an individual or individuals for development of a project or program.

Or at CMU:

Substantial use of university facilities means extensive unreimbursed use of major university laboratory, studio or computational facilities, or human resources. The use of these facilities must be important to the creation of the intellectual property; merely incidental use of a facility does not constitute substantial use, nor does extensive use of a facility commonly available to all faculty or professional staff (such as libraries and offices), nor does extensive use of a specialized facility for routine tasks.
Answer: First of all, how should be defined "University facility" in this context? I don't think that housing would make part of the definition. They must consider labs, machines and so on.
Therefore, I believe that it is possible to patent something and still hold the intellectual property.
Anyhow, you should read carefully the IP policies at your university and find out what they actually call "university facility"
Comment: I am not a lawyer, so I don't know the answer of this question. But, let me ask you this: does the broad band or wifi counted as "university facility"?
Comment: It's not a easy question to answer since every university may define "facility" in a different way. In my personal opinion: it shouldn't count as "university facility".