html5 websockets and long strings

Question: I have a websocket HTML5 page that receives data from the server, but curiously the onmessage event seems to fire multiple times for long strings.
w.onmessage = function(e) {
  console.log ("\n\n message received... "+e.data);
}

If I have a string 3000 characters long, the above code will print out the first 2048 characters and then whatever is left over on the second time around.
Is there anyway for me to check for something like (pseudo-code) (e.state == FINISHED) or (e.state != UPDATING) or something so I don't execute my code until I have all of the data? Right now, the onmessage function is getting called multiple times when it receives a message and this is messing up the code.
Answer: Can you split the string in the server side? Add some thing at the end to indicate that there are more characters behind.

html5 websockets and long strings


Why cold water results in cough

Question: I have a pretty simple question which always kept me intriguing since childhood and I couldn't find its precise answer yet. Why do we cough by cold water. Recently I had flu and found very strange correlation between cold water and coughing. Even seconds after drinking cold[er] water, I started coughing as you all would have experienced as well. So why does it happen?
Comment: @rg255 I think the answer below addresses the question and I don't find any reasons why its opinion based if there is a clear linkage with tract called "Respiratory Mucosa". Rest, you better know than me
Answer: I am no expert in this but I had asked my doctor the same question the last time I fell sick and I'll try to paraphrase his explanation.
"There is this protective lining on our respiratory tract called "Respiratory Mucosa" that acts as the first line of defense against pathogens. But when you consume cold food and beverages , this membrane gets congested or shrinks such that it exposes the respiratory tract to pathogens . This is more prevalent if your body has an elevated temperature such as after spending a lot time outdoors during summer or after a workout. Cold food as such doesn't make you sick but they make it easier for the pathogens."
A quick Google search turned up this
http://www.thehealthsite.com/diseases-conditions/why-does-drinking-chilled-beverages-cause-sore-throat/#
Your cough could be a symptom of having a sore throat from infection.
Comment: any source to add?
Comment: Reference added.
Comment: Can you add any authoritative reference, like a journal or a well cited expert's blog/website? As for thehealthsite.com it is absolutely uncited and there's no mentioning who the [author](http://www.thehealthsite.com/author/editorial-team/) is.

Why cold water results in cough


How do I change my login method from GitHub to Stack Overflow for stackoverflow.com?

Question: I created my Stack Overflow account via GitHub, so every time I log in via GitHub. Folks at work recently blocked GitHub, and now I'm locked out of Stack Overflow at work too.
Comment: _Folks at work recently blocked Github_ Are you a programmer? Might be time to look for something new...
Comment: You can manage your logins [here](https://stackoverflow.com/users/mylogins/current).
Comment: Lol yes @Clive IKR
Comment: @TheThonnu The answer to that question is pretty outdated.
Comment: That is an appalling company ethos to block an open source site that whole a whole lot of BSD or other licenses or unlicensed code that means you are allowed to use it for commercial use cases. fair enough if it was a GNU-only hosting platform but it's not, absolutely ludicrous, to try to leave the company ASA{ because clearly there is an imbecile who does not know how code licensing works but is enforcing changes they don't understand and if they are getting away with it whats next they block SO, SourceForge, Bit Bucket?
Answer: AI Generated (meta the meta!):
To manage your logins for your Stack Overflow account, follow these steps:

Go to the Stack Overflow website and log in to your account.
Click on your profile picture in the top right corner of the page and select "Settings" from the drop-down menu.
On the settings page, select the "Account" tab.
Under the "Account" tab, you will see a section called "Logins" where you can manage the logins associated with your Stack Overflow account.
To add a new login, click on the "Add Login Method" button and follow the on-screen instructions to link a new account, such as your Google or Facebook account.
To remove a login, click on the "Remove" button next to the login you want to remove. Please note that if you remove your only login method, you will not be able to log in to your Stack Overflow account.

If you have any trouble with these steps, you can contact the Stack Overflow support team for assistance.

[Non-AI generated]
But this looks to be out of date. Instead,

Once you're in Settings, under "Access", click "Your Logins"
Then click "Add More Logins"
Comment: Maybe this AI can be used as the new frontend for Stack Overflow instead of the severely broken search engine results (a typical result is a low-scored question from 2015 with one or two low-quality answers. And it doesn't have ***any*** indication of where the canonical question is).
Comment: @PeterMortensen how to search stack overflow: https://www.google.com/search?q=site:stackoverflow.com+query+here


How should I cook a ham bone for chili?

Question: I want to make chili using a ham bone (with a little meat on it). How should I cook it to make good use of both the meat and the bone?
Answer: If you're going to simmer your chili for a long time, just throw it in there.  If you made stock with it, you'd still be just simmering the bone for a long time to extract the same flavors.  (I'm not advocating not using stock here, just that I wouldn't make stock for the sole purpose of getting flavor out of the bone.  Use the stock you would otherwise.).
Simmer four plus hours and then pull the bone out, tap the meat off, and enjoy the chili (although I like to cool chili down, put it in the fridge, and eat it the next day better).
If you're going to make the stock with it though, @Cos definitely has the right idea with the pressure cooker.
Comment: +1: You'll get plenty of flavor out of the bone without making stock separately, and save plenty of time!
Answer: I would make a stock with it and use that for a portion of your liquid in the chili.   toss it in a big pot of water with some chunks of aromatic vegetable (onion, celery, carrot, garlic) and whole herbs (thyme & rosemary) and spices (i'd do cracked black pepper and 4 or 5 whole allspice pods) and cook for 2-4 hours.   strain all the chunks out and use the liquid.
if you don't want to go through all that, you could probably also just drop the bone into the chili pot and let it all cook together.  just remember to take the bone out of the pot before serving.  unless you're into that kind of thing.
Comment: To clarify, what do I do with the meat that's on the bone?
Comment: if you cook it that long, there's not going to be much meat attached to the bone.
Answer: I am guessing that you are thinking of a "Green Pork Chili" along the lines of this recipe.
IF so, the best use for your ham bone is to make a pork stock to substitute for the chicken stock. I would put the bone, with about 6-7 cups of water into a pressure cooker and use the pressure to extract all of the flavor that the marrow has to offer. 15-20 minutes under pressure should leave you with a clean bone and pot full of juices. Strain out the bits using a cheese cloth and boil the broth till you have the required volume (5 cups in the case of the recipe I linked to) and go forth from there.
Comment: a hack saw (clean, preferably new...at least the blade, they are cheap) is a good choice.
Comment: That sounds pretty good, but the bone is too long for my pressure cooker. I don't think I have a good way to cut the bone into smaller pieces.

How should I cook a ham bone for chili?


How can I write data from a C# app into GE Proficy Historian

Question: I would like to use GE Proficy Historian to archive data from instruments that are not connected to a PLC.  Can this be done using c#?
Answer: You can use the Historian c# User API wrapper to access and update Historian from c#. There is information available on it in the Historian documentation that installs with the client tools. Updating Historian with data from non-PLC connected devices is counterintuitive though, as you have the data elsewhere (I assume) and Historian is designed to log activity from PLCs and similar devices.
It will probably be more difficult to read data from non-PLC connected devices into c# than to write data to Historian.
Answer: Using Historian File collector (historian File Collector is the service available on the machine where Histoiran Server has been installed), we can write data into Proficy Historian.
Step 1. Verify Histoarian File Collector Service is started.
Step 2. Locate the folder :\Proficy Historian Data\ImportFiles\Incoming.(On server)
Step 3. Write a program to crate csv file. Write date in following syntax in that file.
Syntax : Tagname,TimeStamp,Value,DataQuality
Example TIGER.IMPORT_TAG1.F_CV,7/20/01 11:07,1,Good
Step 4. create this csv file on lication mentioned above.
Historian file collector will automatically process this csv file and file will be moved to Processed folder available on same lication. If csv file has some error it will be available move to error folder. csv file moved to Processed folder indicates the data is written to historian tag.
Answer: You have 4 options:

Use the User API interface via ihuapi.dll. This is a bit easier now that GE provides DLL import and struct definitions, but it can still be a bit daunting. It will work though. Actually, it works quite well.
Use the SDK interface via ihsdk.dll. This is actually a bit easier to work with as compared to the User API. The SDK is a COM library so it has to be registered on the machine.
If the instrument is OPC compliant you can use the OPC collector to forward the data directly to the server; no coding necessary.
Starting with 5.0 the Collector Toolkit is provided free of charge with the install. I cannot comment to much on this yet since I have not worked with custom collectors very much.


Add issuing CA to online root CA windows 2008 r2

Question: we have an existing internal root CA standalone that issue certificate for our domain mycompany.com. We have multiple certificate installed all over the company from this CA. The problem we're facing is that we have a cisco VPN that need to trust this CA for mobile device VPN but return an error as the expiration date of the root CA goes beyond year 2038 and doesn't accept it. Now question is how to go around this? If I renew the root CA with the same private/public key and expiration date before year 2038, will I need to renew the certificate already issued by this CA ?
Second option we are looking at is to install a subordinate issuing CA, in this case the question is will this CA be able to issue cert for the domain name mycompany.com ?
Any suggestion on how to get out of this mess from PKI expert would be appreciated.
Answer: Regarding your first answer I am always wondering this myself. I would test this very specific scenrio in your lab!
I think it should be possible to renew the certificate with the same keys but another expiration date.
Regarding the issuing (online) CA. Your cisco VPN should verify the trust chain up to the root CA and then again complain about the validity period of the root CA.
Thus you either need to renew the root CA with the same keys and a shorter validity period OR you need to setup a second CA.
Comment: I guess I will have to setup VMs in lab and and test it out. Didn't think about the chain trust going to top so ruling out option 2.
Comment: It very much depends on the implementation on the cisco vpn. If it simply trusts an intermediate CA (which it should not in theory), then this could be a solution. But it is a bad idea in relying with your design in a hopefully faulty implemented pki enabled application.


In a democracy, who takes care of the interests of the losing side?

Question: There are two sides or more to an election - the winning side will get what it wants (hopefully) the losing side will not. What are some of the ways both sides can benefit or do they have to wait 4 years or 8 years for a swing in their fortunes?
Comment: Are you asking about a specific country or democracy in general?
Comment: Democracy in general but the most recent US election is very much in mind.
Answer: First, there is no absolute protection for the losing side (nor for the voters on the winning side) because any system of government ultimately depends on the behavior of the people, particularly the people with guns.
Having said that, in America there are a number of protections for the losing side such as:

The fact that in a few years there will be another election. The winning side may not get all of the same voters again and will not want to make the voters who didn't vote for them this time continue to be unwilling to vote for them next time.
"Separation of Powers" between three branches of government - the Executive, Judicial, and Legislative
A system of "Checks and Balances" that allow members of a branch to restrain the behavior of other branches. Well-known examples include the veto and Impeachment
A list of enumerated powers that give the national government a limited set of powers that it can exercise while leaving other decisions to the states or the people. America has a federal system of government in which power is divided between the national and state governments.
A bill of rights that lists actions that the government specifically may not take, most of which are designed to prevent abuses by the government.
When not talking about rights but simply rather the winning side will "get what it wants", the American Senate has a filibuster that requires a supermajority to overrule. Major laws in America have to be approved by the Senate and the filibuster allows a minority to stop a law from being passed (I say "major" because there are many federal regulations enacted that have the same effect as laws but do not require specific Congressional approval because at some time in the past Congress empowered the executive branch to create them unilaterally).  In the recent 2016 American election the Republicans gained a majority in the Senate, but not enough of a majority to end a filibuster. They will therefore need at least a few Democratic votes to pass a law. They could get rid of the filibuster with a simple majority vote but neither party wants that because they know that they will be in the minority again someday.

Of course all of this ultimately depends on the willingness of people both in and out of government to respect the process and follow the laws.
Answer: Constitutional rights and rule of law
In a democracy, a group that has a sufficient majority will be able to pass the laws that they wish. These laws will apply to everyone. The main factor that protects the interests of the losing side and differentiates it from a pure tyranny of the majority is a solid set of constitutional rights that limits the laws that can be passed.
For example, in a well-functioning democracy the winning party would not be able to pass a law revoking voting rights of the minority group. They would not be able to pass laws that clearly discriminate against the minority group, or make employment or financing conditional on voting for the ruling party. They would not be able to pass laws to put the undesirable minorities in concentration camps and exterminate them. They would not be able to pass laws allowing extrajudicial lynching by the majority. If they tried to pass such laws, they would be revoked by an independent judiciary branch.
There are many "democracies" where the aforementioned factors don't apply. I wouldn't call them democracies - performing a 'ritual of voting' is not sufficient for that.
Comment: Peteris, thank you for a very very good answer, and a comforting one at that. Now all that remains is to read the  books and see what actually hapenned in which country. Maybe voters should be more sophisticated and have a plan B if they lose? For example, politely and civlilly petition the winning side to consider their views because they are based on the constitution and existing laws.
Comment: This answer is technically wrong. If the party has enough big majority, she can change constitution or issue new one.
Comment: how does one determine if a law is discriminatory or not
Comment: @IndianLawDropout depends on the country, usually there is some part of the court system (e.g. supreme court or constitutional court) whose duties and rights include blocking and overturning legislation that violates the constitution.
Answer: In the United States, there are multiple levels of government and overlapping terms.  From the 2016 election, the President and both legislative chambers will be the same party (also the Supreme Court after the next justice is appointed, presumably in January).  But in two years, that balance could change in the House and conceivably the Senate (although the Senate doesn't have much room to move in 2018).  This happened in 2010 (House) and 2014 (Senate).  The party that lost the presidential election gained in the legislative branch.
The states also have executives and legislatures that may be up in 2017, 2018, or 2019.  They may already differ from the federal result (e.g. West Virginia just elected a Democrat as governor).  They may enact their own policies, some of which contradict the national policies.  For example, California had tougher environmental laws even under Republican presidents.
And municipalities have their own governments.  Most cities elect Democrats, even in Republican years.
Other countries may have similar systems.  Also, in parliamentary countries, it's usually coalitions of parties that form a government and control the executive.  The coalition can dissolve and force a new government to form even if there is no election.  The existing legislators just realign into different divisions.
Comment: I understand how it could anwer the question, but the answer is not explicit enough ie " The answer to your question is..."  Sorry to be so picky.
Answer: In the United States, the people (whether in a majority or a minority) have the ability to defend their own rights.  If sufficiently pressed, by force of arms.
During the American Revolution, the colonists defended their rights by force of arms.  The Bill of Rights codified some of these rights, but did not limit them.  For example:

Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the Government for a redress of grievances.
A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.
No Soldier shall, in time of peace be quartered in any house, without the consent of the Owner, nor in time of war, but in a manner to be prescribed by law.
The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no Warrants shall issue, but upon probable cause, supported by Oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.
No person shall be held to answer for a capital, or otherwise infamous crime, unless on a presentment or indictment of a Grand Jury, except in cases arising in the land or naval forces, or in the Militia, when in actual service in time of War or public danger; nor shall any person be subject for the same offense to be twice put in jeopardy of life or limb; nor shall be compelled in any criminal case to be a witness against himself, nor be deprived of life, liberty, or property, without due process of law; nor shall private property be taken for public use, without just compensation.
In all criminal prosecutions, the accused shall enjoy the right to a speedy and public trial, by an impartial jury of the State and district wherein the crime shall have been committed, which district shall have been previously ascertained by law, and to be informed of the nature and cause of the accusation; to be confronted with the witnesses against him; to have compulsory process for obtaining witnesses in his favor, and to have the Assistance of Counsel for his defence.
Excessive bail shall not be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted.

These rights mitigate the risk of tyranny.  As long as these provisions are followed, the public will know whom the government wishes to punish, and why.  People (whether in the majority or the minority) will be able to be armed, trained, and organized.  They will know that they are not alone.
Answer: In a perfect democracy the elected leaders care for the whole nation and as such further the wellbeing of everyone whether they voted for him/her or not.
In reality it differs very much because not every democracy is alike. Many do have several institutions in place that share some of the power of the elected leader. House of commons, house of lords in UK; congress in the US. Not always do those institutions have the same agenda as the leader and care about other parts of the population.
And as is often the elected leaders don't even care about those who voted for them. Sometimes those who have least to gain according to a party's program/manifesto are those who vote for that party. An example is the right wing AfD in Germany who want to make life better for the rich and get their votes from the poor because their populism and racist propaganda attracts people who don't take the time to read the program/manifesto.
Comment: This is just plain wrong. AfD has no racist propaganda, that is forbidden in Germany. Elected leaders care mostly for their electorate, because "whole nation" is composed of different people with different goals, views and so on.
Comment: @Sejanus What is forbidden is "Volksverhetzung" and they often come close. The parts of the AfD are clearly anti Muslim and racist. But there are always some who don't want to see it.
Comment: I do find it interesting that because the UK House of Lords are life time peers, and do not need to be voted in to have a seat, they are far more likely to care about both sides of the argument than the government who only really care about being re-elected.
Comment: Thanks for bringing up the House of Lords comprising in part the "lords Spiritual"- according to Wikipedia "The Lords Spiritual are 26 bishops in the established Church of England" . That would never work in the USA


The new GE blower motor is missing an orange wire, how to connect it properly?

Question: My old GE blower motor had an orange wire. Unfortunately, the new replacement motor has no orange wire.
The new motor will not start up with just the black, blue, yellow, red, and the 2 browns going to the capacitor.
However there are 4 factory-connected wires coming out and then returning inside the motor: they are yellow to purple, and orange to brown.
Any ideas on how to solve this?
Comment: We will need the model number of the old AND new motors to assist.
Comment: Can you post photos of the nameplates on the old and new motors?
Answer: The 4 wires coming out of and returning to to motor are for reversing the rotation of the motor. If you unplug them and switch them the rotation will switch. The yellow wire is most likely the common wire. The others are speed taps. Red is low, blue is medium and black is high (usually). The two browns go to the capacitor. I would need to see the wiring diagram to be sure but that is the usual wiring setup on furnaces. The orange wire was most likely medium high.


Kindle highlights not syncing between devices

Question: I have the Kindle app on my iPhone and iPad. When I go into a book on the iPad and add a highlight I never see it appear on the same book on my iPhone, even if I press the sync item from the side menu on the iPhone.
Comment: Having the same problem with syncing highlights between Kindle iPhone app and Kindle Mac app. It's quite pathetic that Amazon can build the most advanced cloud infrastructure and speech recognition, but fails implementing a reliable sync mechanism for their own ebook ecosystem :(
Answer: I was able to fix this by removing the book from my iPhone and redownloading it.
Now if I want to see highlights sync immediately between the devices I have to go to the Library after adding a highlight and then go to Library on the other device, press sync and go back into the book. Then a few seconds later the highlight appears.
Not ideal but it works.
Answer: I had highlights on an iPhone which were refusing to sync. Manually triggering a sync from within the Settings area and killing/restarting the app failed to fix it.
I restarted the iPhone (hold power and home until you see the silver, Apple logo appear) and then opened the Kindle app again.
I could see a lot of network activity (the icon was cycling next to the 4G symbol at the top) and then all of a sudden the highlights all synched and were visible on https://read.amazon.co.uk/notebook (also https://read.amazon.com/notebook ).
Answer: Removing and adding (redownloading) the book on my Macbook fixed it also.
Answer: Kindle might be the worst app I've ever seen. The great Amazon knows how to ruin their reputation with this little software. The best way to sync accross all devices is sync the device you did a lot of works on, delete the book on the target device to sync with, and then download the book again. This is the only solution working 100% I've found so far. I cannot believe how few the number of additional options other than highlights and notes are implemented on Kindle. There are billion users out there in the world and Amazon seems to ignore how much they are frustrated about this app.


process vs processes?

Question: A process is a series of actions, so I think ... mental works require iterative process ..., but I see a sentence ... mental works require iterative processes .... Which is right, or better?
Comment: It depends on whether you are referring to one overall process (all actions taken together) or a series of individual process steps. Not knowing what "mental works" are, it could be read "an iterative process" or "iterative processes". Also it would be more likely to use "mental work".
Comment: "Works" isn't used much in AmE, and I believe in BrE it refers to a place where work is being done, not to the work itself.
Comment: Depends on the scientific area. If you are referring to the "process" in computer enginering. In computer science, "a process is an instance of a computer program that is being executed." So you can actually use it plural w/o it sounding weird.
Answer: It depends on the nature of the iteration. If mental works require a single process that iterates, you could say:

... mental works require an iterative process ...

On the other hand, if mental works require separate distinct processes which are iterative, you would use:

... mental works require iterative processes ...

Honestly, the distinction seems a bit like splitting hairs to me without more context. The distinction between these two, to me, is so small as to likely not be terribly important -- but that's because we don't have more information on these mental works.

process vs processes?


How do I collect rocks in Dwarf Fortress?

Question: How do I collect rocks etc that are laying about in tunnels I've dug in Dwarf Fortress?
Comment: could you make the title in the form of a question?
Comment: @Juan the title field is generally accepted to be a phrase. There's a field called 'question' for the actual question. regardless, done; it earns more votes.
Comment: C. Ross makes a good point: are you collecting them for useful purposes or just trying to make your fortress neat and tidy?
Answer: Turn them into rock blocks (since a lot of blocks will go into a single bin in a storage room and that's much neater). Clearing every stone takes a long time, but you can clear certain areas using burrows:

Designating a burrow over the area
you want to clear.
Select a lowly mason who will be your exclusive stone block maker and
assign him to the burrow.
Build a mason's workshop inside the burrow.
Use the profiles screen on the workshop to restrict the dwarves
that can work there to your chosen
mason. (You'll need to have a
manager for this.)
Set make rock blocks to repeat!

Your lowly mason will dutifully go about their business selecting only stone from the burrow and will automatically take breaks to sleep and eat, so this is a pretty low-maintenance method.
Comment: while not as effcient as a quantum stockpile, it is a non-trick/bug/cheat way.
Comment: Rock blocks can not be used as ore. They do, however, make for much nicer constructions when used to make walls, stairs, workshops, roads, bridges, etc.
Comment: Can a rock block be used for anything a rock ore can? plus, that's a lot of work as opposed to just a quantum stockpile.
Answer: another method is using the quantum storage trick/bug/cheat
first, create a 1x1 refuse zone(i, move to were you want it, Enter, Enter) and designate it as garbage zone.
Now, you can select the area (any size) to dump in that zone (d, b, d)
All items selected in the area will be hauled into that zone.
now, if you want to reclaim all the items in this zone, you can do it by using d, b, c, Enter, Enter right on that zone
Comment: @Javadoc: after you made the zone, did you use I to hover over it and designate it a garbage dump with g? otherwise it won't work.
Comment: My mistake: this apparently does work in v0.31.08. Must've done something wrong when I tried it before.
Comment: Works well for me in 31.10 as well
Comment: this doesn't work for me. d->b->i does nothing; i isn't a menu option.
Comment: i->size->r doesn't work either; r isn't a menu option.
Comment: Dumping is done via d -> b -> d if my muscle memory doesn't betray me.
Comment: wait... how did that sneak in? i and d are not even next to eachother... fixed!
Answer: Yet another option is to just hide the stones via d -> b-> h. This only doesn't display the stones anymore, but they're still there! Best used if you want your fortress to look nice quickly, without generating any jobs.
Comment: Jobs are good! Gotta keep the economy running! ... Well, once Toady gets around to reimplementing the economy, that is.
Comment: ..interesting..
Comment: @Shadur In the meantime, it keeps them from throwing parties, I think. But then, I never bother with defining meeting rooms; thus preventing the whole problem in the first place.
Answer: Designate a stone stockpile (p,s).  Your dwarves will automatically move any available stone to those.
Comment: I like to make a stone stockpile outside when I'm working on my outer walls. Let the haulers fill it up first, then build with the stones and let it be refilled in the meantime.
Comment: Which isn't too handy if you use a legendary miner to dig out the room where you're going to put your stone stockpile! :) The other options are sandy rooms or outside, but outside is a source of Fun.
Comment: I agree, it doesn't handle all your rocks, but it's the basic method for *collecting rocks*.
Comment: Though this is old: I think this is The Right Answer: dwarves will apparently hop to it (clearing stones) if there is a very nearby stockpile, even if they've been ignoring the stones for a while already.
Answer: Usually I use the quantum storage method, with an atom smasher to clean up the mess, but there are some other tricks:

To clean out a storage room, build a catapult and have it hurl rocks at the wall. That way you're also training your siege operator. They can be a bit silly about where they get the rocks, but usually they'll take the closest one.
Build floors where your rocks are, out of the same kind of rocks. Unfortunately this needs a little bit of micromanagement, as dwarves will suspend a job as blocked if the spot has a stone on top of it which is earmarked for a different floor square. But they'll still do most of them, and you can go back and clean up the suspended jobs later.
If you're willing to waste some Z-space, build your rooms or tunnels by channeling, then build floors, The rocks will fall to the level below, and you'll have a nice clean area. (You've now got a space below with 2 rocks in it, but it's out of the way.)

Remember that if you have stones marked for dumping, they won't be moved by dwarves trying to construct on the site.
Comment: "They can be a bit silly" should be the unofficial motto of DF, come to think of it.

"They can be a bit silly" about running into a goblin siege to retrieve refuse... "They can be a bit silly" about carrying babies into combat... "They can be a bit silly" about running to the booze stockpile while !!on fire!!...
Answer: Similar to the quantum stock pile, I placed a refuse zone over a pond and it seams the items dumped there fall to the bottom.


How to recommend items after finding similar users in recommendation system

Question: As the title explains my problem, I'm done with creating a recommendation system that can give me similar users for any given new user. The problem I face is, If I extract the list of products that these similar users liked the most, how do I weight these items and recommend, say only 3 of these items.
Comment: https://en.wikipedia.org/wiki/Collaborative_filtering
Comment: This is irrelevant @DaFanat
Answer: You can use some kind of distance metrics.
For example, you identify three users that have the lowest distance from your target user and propose one item from each, or three items from the closest user, whatever works best for your usecase
I guess you've used clustering to cluster the users together. Maybe that using product clustering in conjunction with user clustering can give you good results?
Answer: Without knowing a bit more about the background of your model and data it seems to me like you solved the wrong question.
Your current recommender solves "Which customer is similar to this customer?", so it recommends a customer to you.
What you want is "Which product will this customer like?" so it recommends products.
E.g. using association rules, etc. you should predict liked products based on customer attributes instead of clustering customers. This will always create better and stronger recommendations because you identify the true link between customer attributes and preferred products.
However
Given all the work already done, you can still make something work. If you would agree to the following hypothesis "All similar customers like similar products" for your domain I would proceed with the following path:

Your current recommender basically creates clusters of customers --> Output is Cluster A, a set of customers that customer A fits best in
Create a model that outputs the most liked / most purchased products for Cluster A --> Output is product list A, a set of products ranked by a metric
Check which products from product list A customer A did not already buy --> Output is product List B, a set of products to recommend to customer A ranked by a metric
Answer: One option is association rule learning which seeks to find related users based on the co-occurrence of items.


I have a lot of plastic anchor bolts in the sheetrock walls. What is the best way to patch them?

Question: I am moving & after taking down many pictures, mirrors, etc., I have many plastic anchors left in the sheetrock.  What is the best way to patch them?
Answer: Depending on the design of them, if they're the type that can be removed ( pulled straight out with needle nose pliers) I would yank them then patch them.
If they are the type that don't want to come out easily, sometimes you can take a small ball peen hammer ( using the rounded end )and lightly tap them below surface level... This way, patching can be accomplished.
And finally, if you can't do anything with them  ( in rare cases ) you can drill them out gently, then of course patch.
Answer: Vinyl spackle would be my choice. It's easy to work with and dries fast. It doesn't need a second coat like joint compound does.


How to develop people count of office?

Question: I would like to count how many persons are in 1) conference room and 2) Office for 100 persons. I would like to have bar graph for room or office occupancy.
I learned from vendor like Viametrics that camera like thermal camera must be installed to roof outside of conference room to count in and out of traffic. It seem regular camera can be used or some kind of mats as well.
I tried Azure Cognitive Emotion API for people counting, but it is reliable only if camera sees whole face. Result of experiment was that we cannot use Emotion API.
I would like to know that if I had camera and RaspBerry(or Arduino) plus Azure or Bluemix or VM, how to build people counting solution. Do you know any library or API?
Answer: I am not aware of a cognitive service like that. I think you'll have to develop your own service.
This is the way I would go about this:

Train or fine-tune Fast-RCNN or Yolo model to identify a person on a photo. See examples here and here.
Then put a simple script on top that will count number of identified objects.
Create a docker container that will contain simple server. That server would listen to particular camera / or set of cameras and score your model.
Use Azure Container Service / Kubernetes to put your containers in Azure, and also to create scaleable service.

How to develop people count of office?


How does PCA represent all data with just a few principal components?

Question: How does principal component analysis (PCA) model data of admittedly higher dimensionality with just a few principal components?
Comment: The question is not clear.
Comment: @MichaelChernick Mostly a fixable grammar and sentence structure problem.
Comment: I think the answer is that PCA finds the more contributory independent variables.
Comment: I'm still not sure exactly what you mean. Are you referring to a situation where you have fewer observations than dimensions (n>p? Or how it is that the first few principle components can represent a higher dimensional dataset 'well enough'? Or something else?
Comment: @gung how that the first few principle component can represent a higher dimensional dataset well enough? that more likely my question.
Comment: I am not certain that I understand your question. You have a dataset with many observations but when you use PCA you end up with less components then that there are observations? If that is the case, please see this question and answer:
http://stats.stackexchange.com/questions/99351/if-number-of-samples-is-smaller-than-number-of-features-how-can-all-the-varianc?rq=1
Answer: I believe your question is something like:
<code>"I have 10000 features and thus very high dimension, why PCA with only 3 principal components work"?</code>
There is a misunderstanding here. We don't represent the original data set with just a few PC, we approximate and thus PCA is a data reduction technique. You will almost likely lose some information, but if you can minimize the information you lose, you should be fine.
PCA works by forming a new set of variables from the original features. It does that by maximising the variance the new variables can account for. You can think of it like an approximation technique. You approximate what you have, but the new approximation is not perfect. In practice, you can decide how many principal components you want. The more you want, the better approximation you have.
Answer: I will try to answer this question using an example. Suppose you have to points which are (1,1) and (2,2). These points lie on a straight line $y=x$. Another representation of these two points can be $\sqrt(2)$ and $\sqrt(8)$, which are distances of these two points from origin, or we can say projections of these two points on the vector $\frac{1}{\sqrt(2)}(1,1)$. Which means that these two points represent a vector. Actually, any two points represent just a vector. To make the idea of PCA more intuitive, suppose instead of two points we have more points such as $(1,1); (2,2); (3,3),....,(10,10)$. All these ten points represent the same unit vector.
Similarly, suppose if we have points such as $(1,1,2), (2,2,2),.....,(10,10,2)$. Our data is three dimensional now; however, the number in third dimension is always equal to 2. Again, the data varies in the direction of unit vector,$\frac{1}{\sqrt(2)}(1,1)$, mentioned above.
So to answer your question, high dimensional data can not be represented by a lower dimensional space. Only the variation in high dimensional data can be represented by lower dimensional data, as in the example given.
The link provided by Frank Drost above is also useful. Also, this is a helpful link to understand PCA:
http://mengnote.blogspot.com/2013/05/an-intuitive-explanation-of-pca.html


My professor has left the university and his official email ID is no longer active

Question: I will be applying for MS in Computer Science in the United States and I want to ask for a letter of recommendation from one of my professors, with whom I share a strong relationship. He has left the university and won't be able to write the letter with the university's letterhead. He will have to send it from his personal email ID, since his official email ID has been deactivated. Will this put a dent on the authenticity of the letter? Are the admission committee members willing to contact my professor in case of any doubt or discrepancy?
Comment: He may actually have access to university letterhead for this. In particular, he might be able to get a staff member to type it, assuming he left on good terms, or retired. But the answer of Solar Mike is fine.
Comment: I'm afraid he won't have access to his previous university's letterhead.
Answer: If he is still prepared to write you a reference then he will.
He can state that you were a student when he was teaching at X institution and that will be accepted.
If the admission committee feels it is necessary to contact him then they will do so.
I have sent reference letters to the Academic secretary and she printed them on letter headed paper - this was while I was on holiday in a different country and the student needed the reference quickly (comes down to planning ie 5 p's: proper planning prevents poor performance...)
Comment: Do I need to mention this in my SOP as well, that my professor had left the university and was unable to write it on the letterhead and had to send it through his personal email ID?


How early can you go through airport security for an International flight?

Question: I'm not sure if this is airline or airport-specific? (assuming airport)
I know that if I have an early morning flight and show up the night before, I'm denied because the date on my ticket is for the next day. However, I just took a flight from Lima to Easter Island that left at 1:20 AM, and while I was denied through security at 11AM (yeah, I tried, I was already at the airport) I was allowed to enter around 4 PM, just over 8 hours prior to the flight. (Security was fine, but Immigration balked at my earliness, and eventually let me through when they got tired of waiting from an answer from above.)
I've had 12 hour layovers like this before, but only on international connections through an airport.
I'm interested in the general answer to the question, but I do have a localized situation that has prompted it:

I have an upcoming 9:45AM flight (international) into Santiago, Chile, and my
  connection (domestic) will get me to the airport around 9PM the night
  before. I'd prefer to stay at the airport and sleep, but it would be
  much nicer airside, especially if I get into a lounge. Do I have a
  chance of waiting until 1AM or so (so the date matches my boarding
  pass) and being allowed through security?
Comment: Very much airport (rather, I'd say country) specific. Please add that detail to your question.
Comment: Sorry, I'll make it more clear, but that detail is included in the blockquote at the end.
Comment: Connection into Santiago? You mean out of? Otherwise you still haven't said the airport you are wondering about. I would also consider changing the title to reflect the airport to avoid answers about, say, US airports...
Comment: Shouldn't you be able to go through security once you get the boarding pass?
Comment: @Grzenio, through experience I've learned that you are denied for trying to go through too early, even if you have a boarding pass.
Comment: This also depends on the airline - many will not let you through more than 4 hours before, and some won't let you through more than 2 hours before! Check with your airline!
Comment: http://www.sleepinginairports.net/ might have relevant info.
Answer: The specific rules depend on the airport and country. Usually the check-in starts 3 hours before the departure. So if you travel with luggage to check-in, the answer to your question is 3 hours in advance. If you don't have luggage to check-in, you can go through security 3 hours in advance and sometimes more than 3 hours in advance . That being said, keep in mind that security and immigration is closed during the night in some airports. So if your flight is at 6am and security opens at 4:30am, you can go through security at 4:30am or later.
In most US airports the rule is

if you depart after 4:30am, you can go through security any time after 4:30am on the date of departure,
if your flight departs between 12:00am (midnight) and 1:30am, you can go through security on the previous date (after 4:30 am) or on the date of departure (before 1:30am).
In order to check in for some international flights, you need your documents to be checked by an airline agent (that depends on the destination, the airline, and your citizenship). Then you can go through security only 3 hours before the flight.

(This is only a general rule and you should double check what specific rules are at the airport of departure.)
Comment: check-in may start 3 hours before departure, but it's often possible to check in much earlier using another desk operated by the same airline. I've done this many times with KLM at AMS (though not recently, they may have changed their rules), walking up to an empty checkin desk and asking if it's ok usually tends to get you a smile and a boarding pass.
Comment: Even in US airports, some security lines will state that they're only accepting travelers with flights departing in the next X hours. MCO in particular frequently has signs saying no more than 2 hours. That being said, my boarding pass has never been checked by airport staff prior to entering the queue. (Might be more along the lines of reserving the right to temporarily refuse you if it gets too crowded.)


Installing fresh copy of Monterey and using Icloud to recover

Question: I have 2015 Macbook Pro which was always regularly updated (currently has Big Sur). I would like to upgrade to Monterey, but not like it'a usually done. I want to erase whole drive and install fresh copy of Monterey. I have Monterey installer on a USB drive. I have found instructions which suggest I should backup with Time Machine but I don't have drive big enough for that. So my question would be, in case I erase whole drive, and install Monterey, can I just connect Mac back to my Icloud and it would pull all the data back to my Mac, or erasing whole drive will also erase all the stuff stored on my Icloud? Anyone has suggestion how to do it in order to make fresh install and pull Icloud data later on?
Comment: How do you currently have your data in iCloud? Do you just have iCloud Drive enabled and sync Desktop & Documents, or do you manually sync more data?
Comment: I don't sync manually. I am logged in with my Apple ID, and I have enabled Icloud drive, Contacts, Photos, Keychain etc. There is one folder on my Desktop where I keep all the important stuff and when I change something in that folder, it's automatically updated to cloud. Deleting whole drive would delete that folder as well, so I'm thinking it would be removed from cloud as well.
Comment: To be on the save side, you can (and should) log out of iCloud before erasing the whole drive. You will loose all your settings, mail accounts etc though.
Comment: As I log out, I assume data will stay on Icloud but will be deleted from local drive?
Comment: You probably will be asked whether you want to delete it locally. But honestly, even just having data in the cloud is risky (a cloud storage is not a backup), so getting a small external drive for a local copy is highly recommended.
Answer: Repeat after me:

iCloud Drive is not a backup.

Files without a backup are waiting to be lost.

iCloud Drive does not make copies of your applications; system settings; user settings; or anything else like Fonts, audio and video files (not bought from Apple), etc, etc.
iCloud Drive synchronises whatever is on your computer. If you delete a file, iCD deletes that file, too.
It's likely that if you boot to Recovery, or an installer disk, then you could erase the internal drive without sync-ing that erasure to the cloud, because you're not logged in.
But, you should never perform any operation where there is a risk of losing your files (and by 'perform any operation', I mean 'use your computer') without one or more copies of your data on one or more separate physical devices.
Also: restoring large amounts of data from the cloud will be SLOW...... like, hours.
Also: the benefits of a 'fresh' OS install are over-rated. It's usually possible to tidy up an existing installation by deleting a few files in a few places, rather than deleting everything and putting most of it back.
Comment: I understand what you're saying. Even if I do a backup, I won't be using that backup if installation goes well. But I would still need to log into my Icloud and pull all the data down. And it boils down to what is on Icloud drive (about 4gb) and in my Photos app. So, what would be the best way to do it in your opinion, if I was to install a fresh copy?
Comment: Basically just upgrade why make a fresh copy, unless you have a good reason then don't. Either way install from a complete **local**backup in Time Machine, Carbon Copy Cloner or SuperDuper etc.
Answer: As @nohillside answered above, I logged out from my Apple ID. Booted from USB, formatted whole drive and then ran a fresh Monterey installation from the USB. Now I'm logged back with my Apple ID and Icloud is still being synced. Thanks for all the suggestions.


Vanishing of photon one-point function in QED

Question: I would like to know why the photon one-point function vanishes in QED. I am aware that any $n$-point functions vanishes for odd $n$ because of 'charge-conjugate" argument, this does not apply to $n=1$ case. Here I want to know how to see the quantity
$$
\int \frac{d^4x}{(2\pi)^4}tr\left[ \gamma^a(\frac{1}{-k+m})\right]
$$
vanishes.
Answer: What you are asking for is $\langle A_\mu(x) \rangle$. Now what could it be? It can't depend on $x$ by translation invariance, so it would have to be a constant four-vector, but as long as the theory is Lorentz invariant there are no constant four-vectors except for $0$.
More concretely, the integral diverges (cubically!) so it must be regularised. Any regularisation which respects Lorentz invariance must give a zero result by the above argument. You might want to try out dimensional regularisation or Pauli-Villars to see this.

EDIT: Expanding a bit. First, you can simplify the propagator by multiplying top and bottom by $\not{k} + m$. The term proportional to $m$ vanishes because of the trace. The trace is then proportional to $k_a$. The integral is (up to a constant factor)
$$\int\frac{\mathrm{d}^{4}k}{\left(2\pi\right)^{4}}\frac{k_{a}}{k^{2}-m^{2}+i\epsilon}$$
This needs to be regularised. Consider Pauli-Villars regularisation. It is easy to show that (since the divergence is cubic) you need two regulator scales to define the integral. We take $\Lambda_1,\Lambda_2\gg m,k$ (and eventually the limit $\Lambda_1,\Lambda_2\rightarrow\infty$), and regulate the integral as
$$\int\frac{\mathrm{d}^{4}k}{\left(2\pi\right)^{4}} k_a\frac{\left(m^2-\Lambda_1^2\right) \left(m^2-\Lambda_2^2\right)}{\left(k^2-\Lambda_1^2+i \epsilon \right) \left(k^2-\Lambda_2^2+i \epsilon \right) \left(k^2-m^2+i \epsilon \right)}$$
Note that the limit $\Lambda_1,\Lambda_2\rightarrow\infty$ formally gives you back the expression you want and that the whole thing is Lorentz invariant and convergent.
Now it is trivial to show rigourously that the integral vanishes: due to the $k_a$ in the integrand, which is an odd function of $k_a$, while the rest of the integral is even.
This type of argument is often applied without regulating the integral, but the resulting argument would be heuristic, whereas with the regulator it is rigourously correct. You eventually get the hang of when these short-cuts work and when they don't.
Comment: It must be regulated for the integral to be *defined*. Then, once that is done, assuming the regulator is Lorentz invariant, the integral *evaluates* to zero. It's not as simple as just setting it to zero.
Comment: I thought the integration of an odd function over a symmetric range is always zero. I mean, the argument would be valid even for a divergent integral.
Comment: So it does diverge but we must set it to be zero because of the Lorenz invariance.
Comment: (Another argument is...  )

"...so it would have to be a constant four-vector" And the only four-vector available in the problem is the photon's momentum, which must be zero by conservation of momentum for $\langle A^\mu\rangle$.


What factors determine enemy level scaling relative to the player character?

Question: In Borderlands 2, when I finished Normal Mode at around Level 30 and went back to the Southern Shelf (still at Normal mode), I found that all enemies there are now very easy to kill, meaning they didn't level up (or hit a level cap).
When I went to Oasis (Captain Scarlett DLC location) as a Level 36 character in True Vault Hunter Mode, I noticed that the enemies are the same level as me.
What factors determine enemy level scaling relative to the player character?
Specifically, I would like to know:

Are enemies affected by what level a character accepted a mission?
Or is it what level a character is when they first entered an area?
How do Normal Mode, True Vault Hunter mode, and the Ultimate Vault Hunter Mode affect enemy levels?
Are there enemies that will scale to the player level, as the player levels up?
Any enemy leveling differences specific to the DLC locations?

Updates:

There is now an answer that explains how this works generally: "In playthrough 1, outside of the DLC, there's no such thing as scaling. Enemy levels are determined solely by the area they're in and your mission." Can anyone expound on what are the specific enemy levels in specific locations or missions?

This answer states that "enemies do not actually "scale", or at least from what we know of..." and lists specifics for enemy levels in certain locations (sans DLC locations). Can anyone expound on that and add specifics for enemy levels in the DLC locations in TVHM and UVHM?
Comment: In Borderlands 1, the DLC always scaled to your character level when you first visited it. The Borderlands 2 DLC seems to behave the same way.
Comment: What do you *need* to know the general ranges of specific missions for? The current missions specifically state what level they are and future missions aren't  significantly above either: your current level or the level of the preceding story mission.
Comment: @Philipp: I'm not sure. I played today in Playthrough 1 as a 37 and enemies were 30. There might be limits or ranges?
Comment: @Philipp At Oasis, will the enemies there be stuck to the character level when you first visited the area, or will they level up as you do?
Comment: @BenBrocka It would be nice to know the relative difficulty (level of enemies and their equipment) of specific missions or areas, compared to the player's level. If a player currently has a lot of missions, this could allow him or her to better select which mission they're gonna go for.
Comment: @BenBrocka In my case, my wife has done a good bit of playing in the game without upgrading her gear most of the way. I can't remember which areas have gear available for purchase that is level-appropriate for her. A list would be handy.
Comment: @galacticninja I think that only works if they've been in the room recently, for some interpretation of "recently" that's hidden in the SE secret sauce recipe. Otherwise, you have to be a mod to "super-ping" a user.
Comment: @Iszi perhaps a specific question for the scenario you propose would be more answer-able.  Something like "I'm level 25 using level 15 weapons, where should I get better gear?"  You wouldn't need a list to solve that problem.
Comment: @DavidB I'd say that's really close to being too localized though - definitely would be, for me. I'm pretty sure that, by the time I'd get a decent answer, I would have progressed enough levels to make any answers fairly irrelevant to me anymore.
Comment: @Iszi It's no more localized than a question about a particular boss.
Comment: Related: [Does the level of DLC missions adjust to my current level?](http://gaming.stackexchange.com/q/102929/4797)
Answer: In playthrough 1, outside of the DLC, there's no such thing as scaling. Enemy levels are determined solely by the area they're in and your mission (certain missions effectively "level up" areas, notably Sanctuary and The Dust). You can easily check the level of an area by checking out the vending machines in the area, they sell items scaled to the level.
DLC in playthrough 1 scales to your level...ish. It maxes out at level 30. I played the DLC as a level 34 character and was disappointed to see everything was at level 30 in playthrough 1. Not sure if it has a minimum level it scales to.
Playthrough 2 works the same way until you beat the Final Boss; then everything in that playthrough scales to your level (except mission rewards for missions picked up before the final boss).
Playthrough 3 works the same was as Playthrough 2 after the final boss: Everything scales to your level, period. In team play, it will always be scaled to the highest level player's level. And you have to be at least level 50 to unlock it, so enemies are effectively level 50-61 at all times. Though if you take a mission before leveling up, the mission will still stay at that lower level, as always.
Basically the game works like a standard RPG without level scaling until you A) beat the game twice (because you should be maxed out anyway) or B) enter a DLC (because you can do that at any time so a preset level would be a really bad idea)
Comment: No; it seems that the enemies scale, until you're over level 30, which is where they stick.
Comment: I'm almost positive that every area (not just the DLC) scales to your level but has a hard level cap. My friend who we boosted to level 40 said that enemies in the first area were around level 10 during his first playthrough.
Comment: Does that mean, that in my True Vault Hunter mode playthrough of the Captain Scarlett DLC, all enemy levels will be stuck at the level my character entered Oasis (level 36)? (That is, until I finish the game twice.)
Comment: @KBKarma The enemies I encounter in True Vault Hunter Mode at Oasis are the same level as me (level 36) - Does that mean that they'll scale with me until level 50 (current maximum level cap)?
Comment: @galacticninja I'm unsure. I was working off Ben Brocka's answer there. I've not got to Oasis yet, and the Borderlands wiki doesn't seem to mention True Vault Hunter mode at all. From what I've read [on this Neoseeker post](http://borderlands.neoseeker.com/wiki/True_Vault_Hunter_Mode), it seems they should scale when you enter, but that should be all. As I said, I've no idea.
Comment: @galacticninja that I'm not as sure about, but I assume so. TVH only scales to level 50 after beating the main story, *but* the DLC scales by default. Since TVH starts around level 35 it seems silly to cap it below level 50. Scaling doesn't appear fixed to one level but to your current level; as you level up in the DLC (up to the max, if any, in your playthrough) new missions/enemies should scale up too. Not 100% sure on that but I definitely noticed levels increasing as mine did.
Comment: @Kotsu If they do, it's so low as to barely matter...like, a variance of less than 4 levels in most cases. Leveling up is universally helpful in the first play through, best I could tell, where if there were areas scaling (more than a single level) you'd easily notice that leveling up isn't increasing your level relative to the others
Comment: @Kotsu If you can elaborate more on that or give examples, could you post another answer? I'm interested in knowing more about that.
Comment: @galacticninja I'll see if I can make time to collect more concrete examples and post an answer, but as far as I know, each area's monsters are scaled to your character's level or your game host's level, but there is a cap to how high enemies' level can raise. For example, when we were fighting Flesh Stick in playthrough 2, restarting the game after we all gained a few levels resulted in the area scaling, and Fleshstick also noticeably increased a few levels as well. However, he stopped scaling with our characters at level 41.
Comment: @Kotsu This question has just been given a bounty. Now might be a perfect time to write that answer. =)
Comment: DLC3 and DLC4 will not scale well to your level, they will always be at least Level 30.
Comment: I can confirm that some scaling is going on at the lower levels. In the last couple of days I've played Bad Hair Day twice, once with a level 4 character and once with a level 9, and the enemies were at level 4 and level 9 respectively.

I would *really* like to see this post updated, since this caused me a lot of confusion because I'd read the post but not the comments. (I didn't think a top-voted post could be this wrong.)
Answer: To address OP's edited question, enemies do not actually "scale", or at least from what we know of. In PT 1.0, enemies do not scale, and are based in the areas where you can find them (in terms of storyline progression), and so is PT 2.0, where enemy levels are based on area.  Only in Playthrough 2.5 will enemies "scale", to level 49 (bosses 52).
On average, most players finish PT1.0 around level 30-32, so when you start TVHM (PT2.0), the enemy will "scale" with you, starting at level 33.  Ironically though, they do not actually scale in PT 2.0, instead, increasing in level until a cap of 52 in order of storyline missions. Here's an example:
This is the basic route they expect you to follow for most of the main storyline:

Windshear Waste (Claptrap's Place)  - Starts with enemies level 33
Southern Shelf - Liar's Berg
Three Horns - Divide
Sanctuary
Frostburn Canyon
Three Horns - Valley
The Dust
Bloodshot Stronghold - Enemies here are around level 36
Bloodshot Ramparts
Tundra Express
End of the Line
The Fridge
The Highlands - Extraction Plant - Enemies here are around level 42
The Highlands Overlook
Thousand Cuts
Opportunity
Wildlife Exploitation Preserve
Control Core Angel
Eridium Blight - Enemies here are around level 46
Sawtooth Cauldron
Arid Badlands - Boneyard
Arid Badlands - Badlands
Hero's Pass
Vault of the Warrior - Ends with enemies level 52

Basically, based on the areas that Gearbox expects you progress through the storyline, the enemies will increase in level up to the warrior.  This creates the basic assumption that to actually kill the Warrior at the end of PT2.0, you'll be around the range of level 49-50.
Once finished with the storyline twice through, you unlock Playthrough 2.5, where enemies now scale with your level. Since your expected level is around level 50, enemies will also spawn at level 49-50.
In terms of equipment, equipment generally spawns at the same level you will find enemies in that area.  If you have finished the storyline twice and unlocked PT2.5, the level of weapons will scale to your level.
In UVHM, enemies will always spawn 2 levels higher than you, and in multiplayer sessions, will scale based on the HIGHEST LEVELED PLAYER.  Meaning, if you have a party of level 50s, and a level 61 decides to join in on the fun, and you're in UVHM, all enemies will instantly become level 63 (highest lvl = 61 + 2 = 63).
Comment: @Iszi I've added an answer.
Comment: Do you have any info for enemy levels in the DLC missions or areas in TVHM (PT 2.0) and/or UTVHM?
Answer: Ben Brocka's answer above is incorrect: enemies do scale, at least in some circumstances. Where they scale, and between what levels, seems to vary however.
Some examples:

I started the Symbiosis mission when I was level 4. Both the Bullymongs near the entrance of Southern Shelf - Bay and the four or five enemies I killed in the town when starting the mission itself were level 3 or 4.
Just after I'd reached Sanctuary (but before I did any missions or other activities there) I returned to Southern Shelf - Bay as a level 9 character. Both the Bullymongs and the enemies in the town were now level 7 or 8. The loot (excepting cash) and gear sold by the vendors was consistent with this.
Returning to Southern Shelf - Bay again as a level 12 character, both the Bullymongs and the enemies in the town remained around level 8.

As a level 12 character, returning to the Soaring Dragon (Captain Flynt's ship in the Southern Shelf), the upgrade seemed uneven; the enemies were mostly levels 7-9, but there were still a few level 2 shotgun midgets and the like kicking around.

The enemies in the initial part of the Southern Shelf don't level at all, excepting the Bullymongs just outside the passage to Southern Shelf - Bay, which level the same way that the enemies in Southern Shelf - Bay do.
Answer: Playthrough 1: Normal as you would expect. Enemies scale in area from 1-32.
Playthrough 2: This is where it gets interesting. Enemies start in the first area as 33 and scale up to the Warrior fight at 52. However, when you beat the game, all enemies would be 49~. Enemies don't scale to your level in any part of Borderlands 2. However, they go to 50 after you have finished the main quest-line on TVHM.
DLC enemies have a specified level range. They do not scale depending on your level but on the quest and area you are in.
Comment: The DLC quests *do* scale to your level, within a range
: see [this answer](http://gaming.stackexchange.com/questions/102929/does-the-level-of-dlc-missions-adjust-to-my-current-level/102931#102931)
Comment: This is a bit too general to address the OP's edit and bounty request. We're looking for a per-area accounting of expected enemy levels, not a summary of the playthrough levels.


How can I bend a LaTeX equation as a SVG in Inkscape so that it follows a curve?

Question: I am trying to design an image where I take equations that I type in LaTeX and export as SVG images and bend them along curves. All the methods that I find leave me doing thsi for individual characters. The equation aren't text so I can't use text to path. Any suggestions before I abandon this idea. Alternatively, is there a way to type LaTeX equations in inkscape?
Answer: I have used the LaTeX Previewer for something similar to this. It's an online service so there's nothing to install. It allows you to type in an equation and download an SVG which can then be opened and edited in Inkscape.
For this example shown below, the code I typed into the previewer was as follows:
<code>$$x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$$</code>
Then I downloaded the SVG and opened it in Inkscape
To get it to bend as one graphic however, you will need to jump through some hoops.

Ungroup everything.
For some reason the LaTex Previewer adds symbols as clones, so you would have to unlink all the clones for each symbol by selecting them one at a time and then do Alt+Shift+D (unlink clone). There may be an Inkscape extension somewhere to do this automatically, but I couldn't find one.
If there are any strokes in the equation you would have select those and do Path > Stroke to path.  The purpose of this is to ensure that everything is a filled path.  In my example, I had to do this step with the divisor line and the line extending from the square root symbol, since they were only a paths with a stroke applied.
Then select everything and do Path > Combine
Select and copy the combined graphic
select the Bézier tool, and in the tool options along the top set the Shape to "Bend from Clipboard"
Finally draw a curve, and then graphic will be applied with a Bend Path Effect

Example below: shows everything converted to a combined path, then shows the final steps 5 to 7.

Just a note, there's an extension to type LaTeX directly into Inkscape, but unfortunately I've never been able to get to work. That's why I use the LaTeX Previewer.
Comment: Thanks for the reply. I have been using CodeCogs latex editor which can export SVG, it's mostly just for math - https://www.codecogs.com/latex/eqneditor.php. After a lot of research and installing side packages, I got an extension called TexText to work.
Comment: That's great, then you would really just need to ungroup everything, and convert to paths, then follow steps 4 to 7.
Comment: The ungrouping and combining isn't necessary for the Bend path effect. Just apply the effect to the group and edit the bend path.


What is the difference between A/B Testing and Randomized Control Trials?

Question: The question is as the title says: what is the difference between A/B Testing and Randomized Control Trials?
Answer: A/B testing seems to be computer geeks terminology, but the idea is of course same. You have an control version of web-page and changed one and you test if difference between some user action rate is statistically significant between versions of pages.
A/B testing tests single feature combination differences when multivariate testing tests different combinations of their interactions.
Comment: To emphasize: there is no actual difference. They're different terms for the same thing.
Answer: As @Analyst  (+1) says the basic idea is the same; A/B tests and RCT refer to the same notion.
What is interesting to note is that while in the past the methodological advancements/notions have been primarily a one-way street from RCTs to A/B tests, i.e. from "medical statistics" to "online marketing", lately there have been works in the opposite direction. Obviously, this is partially fuelled by the extensive investing online retailers have on the field; nevertheless a lot of healthcare nowadays has a clear electronic footprint too (wearable sensors being the most obvious example).
To that extent, I think that some issues like violations of SUTVA were more aggressively explored by online retailers than healthcare practitioners, as network effects have such a prominent influence in online behaviour. Similarly, some of the most involved and high-value inferential tasks like that of Heterogeneous Treatment Effects (HTE) estimation directly translate to industry goals of personalised marketing and precision medicine respectively. Thus allowing a lot of learnings being transferred from "online marketing" to "medical statistics".
Two prominent papers on this matter are Kohavi et al. (2020) Online randomized controlled experiments at scale: lessons and extensions to medicine and Austrian et al. (2021) Applying A/B Testing to Clinical Decision Support: Rapid Randomized Controlled Trials. Both papers are very insightful, easy to read and help make this functional equivalence between the two terms more clear and well-defined.


Portable AC unit and furnace fan

Question: I have a portable AC unit connected to a window. Will running my furnace fan help circulate the cold air? Or is it pulling in hot air outside?
Comment: I use to do that all the time. You may have to close the outside air make up for the AC months. Not knowing your system closing the make up is just a guess.
Comment: Most portable A/C are terribly undersized for doing the whole house, so that part may disappoint. If there is makeup air being pulled in, then it will be. If there is not, it won't be.
Comment: A 1-hose portable A/C is definitely going to pull in outside air!  Hot humid outside air.   It will  draw in the same amount of air that it ejects out the one hose.  If it has 2 hoses it won't have that problem.
Comment: Did not know about the single hose issue! The machine i bought was $699 and has a single hose. Every other one I've ever bought was under $300 and had two. Insane heat wave happening here in Alberta, so I'll have to deal! Also sold out everywhere in Alberta.
Comment: I think a regular fan will be more effective for moving air.
Answer: Some furnaces only circulate air and do not draw in fresh air.  If you have one of those (only circulating) it may feel like it is pulling in hot air simply because the A/C is not capable of cooling your whole house in addition to the HVAC ducts themselves and through them the attic/basement/walls or wherever else they go.  In fact, if the ductwork runs through the attic who knows, it may pull more heat in that way than is removed by the A/C!  To improve your chances slightly you can make sure doors are open, or closed, to the rooms you want cooled or not cooled respectively, and don't forget to keep cleaning or replacing your furnace filters while you are running the fan even if you are not heating.    You may find that just leaving interior doors open circulates the air well enough, and conserves more of the coolness for your living spaces.
Comment: It depends if the home has makeup air. if just running the fan will draw in outside air if the home has a make up air intake. With increased sealing over the last 30 years it is quite common to have an outside air intake or makeup air. I put dampers on the systems I install as the air is drawn from the attic space more often because that air is not musky compared to crawl space air.
Comment: Thanks for the comment and new answer.  I've clarified my answer pertains only to systems without makeup air.
Answer: I have used the furnace to circulate even swamp cooler air not really cold but cooler and it made the home a bit more comfortable.
If you have a make up air intake damper close it almost all the way down you only need a tiny amount of make up air when the fan is on full time.
Yes your single hose is pushing really hot air out but some air will be drawn in to the home one short term suggestion I make to homeowners is to slightly open the access to your crawl space.
Opening the crawl space pulls cooler air in from under the home as long as the air going out is hotter than the air coming in the home will be cooled.
Even air movement alone helps us to be cooler so the air handler running distributes the air evenly through the home and moving air also helps.
Comment: There may be some psychology to consider also.   Rather than use your furnace to circulate a very limited amount of cold air, perhaps if you sealed the air conditioned room as best you can, and cooled only that room, and combined that with creating air flow as suggested in this Answer in all the *other* rooms, you would end up with a situation where all the other rooms FEEL a little cooler, and one room feels nice and chilly, and the net effect will be better comfort everywhere.

Portable AC unit and furnace fan


Updating a custom Workflow field

Question: I have inherited a list. It's on sharepoint 2016 with designer 2013. It's updated via a Workflow. I have a column called 'Outcome' which I need to change the status of on a few of the items. However, I can't find a) the workflow b)the actual column! Any idea how I could find the column and how I could update the status on a few of the items? Any help appreciated!
Answer: A) to fnd the workflow, go to the list.  In the ribbon under List, there should be a workflow button.  Click it and it should show you if there are any workflows.
B) to find the column, modify any of the views on the list and see if the column is listed in there.  If so, check the box to show it in the view.
Comment: Thanks, but...
a) yes, done that, no workflows showing
b) yes the column is showing in the view, that's not a problem, I need to edit what's in the item fields for that item. So for item 1,2,3 I need to change what's in the Outcome column

Updating a custom Workflow field


The axiom of union, combined with the axiom of pair set, implies the axiom of pair pairwise union.

Question:
Axiom 3.1: (Sets are objects). If $A$ is a set, then $A$ is also an object. In particular, given two sets $A$ and $B$, it is meaningful to ask whether $A$ is also an element of $B$.
Axiom 3.3 (Singleton sets and pair sets). If $a$ is an object, then there exists a set $\{a\}$ whose only element is $a$, i.e., for every object $y$, we have $y \in \{a\}$ if and only if $y=a$; we refer to $\{a\}$ as the singleton set whose element is $a$. Furthermore, if $a$ and $b$ are objects, then there exists a set $\{a , b\}$ whose only elements are $a$ and $b$; i.e., for every object $y$, we have $y \in \{a, b\}$ if and only if $y=a$ or $y=b$; we refer to this set as the pair set formed by $a$ and $b$.
Axiom 3.4 (Pairwise union). Given any two sets $A$, $B$, there exists a set $A \cup B$, called the union $A \cup B$ of $A$ and $B$, whose elements consists of all the elements which belong to $A$ or $B$ or both. In other words, for any object $x$,
  $$x \in A \cup B \iff (x \in A \text{or} x \in B).$$
Axiom 3.11 (Union). Let $A$ be a set, all of whose elements are themselves sets. Then there exists a set $\bigcup A$ whose elements are precisely those objects which are elements of the elements of $A$, thus for all objects $x$
$$ x \in \bigcup A \iff (x \in S \text{for some} S \in A).$$
Exercise 3.4.8. Show that Axiom 3.4 can be deduced from Axiom 3.1, Axiom 3.3 and Axiom 3.11.

I am struggling with this exercise in Analysis 1 by Tao. My attempt is as follows: Let $C = \{A , B\}$. Then, $x \in \bigcup C \iff x \in A \text{or} B$ by the axiom of the union, and $\bigcup C$ is a set. I think that $\bigcup C$ is equal to $A \cup B$, but I don't know how to complete the proof. I appreciate if you give some help.
Answer: Yes, $\bigcup C=A\cup B$, because
$$x\in\bigcup C\iff (x\in A) \text{ or } (x\in B) \iff x\in A\cup B \,. $$
Comment: @shk910 to guarantee that $\{A,B\}$ is a set
Comment: Thanks, but I haven't used the first two axioms. Why do we need them for this exercise?


Highlighting cities with google maps

Question: I've recently discovered geolocation, it is a wonderful and fun little feature.
I've figured out how to show somebody's location on a map with a little pin and how to fetch the different parts of their address from the delivered data.
One thing I want to do with all this though is given somebodys location to then highlight their city.
I know that now with google maps if you type in UK postcodes or Japanese cities this can be done, however it gives a very difficult to see outline around the location. It doesn't fully shade it.
My ultimate goal is to shade somebodys city a different colour depending on certain variables, the actual google maps content beyond the basic 'this is where the city is' is unimportant (working out these variables and colours is of course a different area and not the purpose of this question).
So...sorry for my poor English here. But I woder. Is there anyway, given a certain input which on default google maps would give the outlined administrative division, will shade the city a given colour?
Bonus points if you can do more than one city at once (ultimate goal- show their surrounding cities as well as their current city)
Answer: I'm doubt you can do it for google map as there seem no way to retrieve google map boundary data. The alternative that I can think of is the use of OpenStreetMap with Kartograph library. This possibly could give you a solution, but you need to manually generate the border out from the OpenStreetMap and color it using the Kartograph library.

Highlighting cities with google maps


Should the dataset be divided into train, test, and validation?

Question: I am implementing the CNN classification model. I've seen several instances where a dataset is split into test, train, and validation. I've also seen instances where a dataset is split into train and test, with the test data being used again for validation. What is the best approach to take here?
Answer: You generally need all 3. How you implement that will depend on your goals and how much compute / time you have. For a large CNN on a large dataset, it would be reasonable to hold back one test set, one validation set, and one larger training set. You need the val set to validate the CNN model while training. You will likely adjust hyperparameters within the CNN such as number of layers, strides, kernels, optimization algorithms, batch sizes, etc.. and you will use your validation set to validate your adjustments on 'unseen' data. You will probably also use it to know when to stop training your model so it doesn't overfit (early-stopping).
In the end though, all of that tuning means that your validation set is not purely unseen. You tuned your model using it in one way or another. So, you also need a completely naive test set to assess the final performance of your classifier model.
An alternative is to do some kind of nested-cross validation where you create repeated test sets and for each of those repeated validation and training sets. In that way you can get some bounds on the performance of your model (average and std. deviation of the accuracy). Of course, this means training your model over and over again and can get quite computationally expensive in deep-learning applications, so you will often just see 1 held out set for each of the 3.


Are the child-friendly trails in the Tatras?

Question: Before having kids, we were avid hikers. Our kids are now at an age that we would like to introduce them to this great hobby. Only we don't know where to start, but would like to do so in the Tatras. Are the Tatras at large child unfriendly and if not how do you find a nice starters trail for young children?
Answer: Depends on how old the kids are and where exactly you want to go.
I went to the Lower Tatra (somewhere near Liptovský Mikuláš) with my parents when i was around 10, and we used to go hiking up the mountains or for a half day long walks around the many trails. The trails on to of the mountains at this time where more or less just flat stones placed next to each other, so i had to watch my step, but nothing to hard or to complain about.
Hiking up and down the mountains was a bit an ambitious mission for me even if i was fit and used to long walks, but doable if you take your time, take rest stops or even take the lift up the mountain and walk down. Part of the problem was possible the high altitude which i had to get used to.
Only went to the High Tatra a few days, but from what i remember this is a much more difficult terrain with steeper climbs and more difficult trails.
Remember to take enough food, water and sun blocker with you when you head of. Restaurants, Cafes or Kiosks are pretty rare and the last chance to buy food and drinks is at the bottom or top of the lift stations going up and down the mountains.
So I would answer your question with yes, at least the trails in the Lower Tatra are suitable for children.
Answer: I don't how old are your kids, but in polish mountains there are few trails for children:

Chochołowska Valley (green trail)
Kościeliska Valley (also green trail)
Ścieżka pod reglami/Ścieżka nad reglami (I don't how to translate its name to english)
the path from Palenica glade (Polana Palenica) to Morskie Oko - there are a lot of tourists every year, but you can see many beautiful peaks.
from Kuźnice (part of Zakopane) to Gąsienicowa Valley (you can choose yeallow trail or blue one)


mechanical disc brake replacement for Schwinn Protocol 1.0

Question: I am fixing up an older Schwinn  Protocol 1.0 for a friend and I need to replace the mechanical, post mount disc brake caliper.  (I took apart the old one and it is missing a magnet and in spite of cleaning, sticks in parts of the travel.)  What can I replace it with? There is no ID on the caliper.  Is any post mount mechanical disc brake caliper OK? Are front and rear disc calipers different?
Answer: That is a Post Mount caliper, which is bolted to an International Standard (IS) mount adapter.
Upshot - you need to keep the adapter, mounting bolts, and spherical washer sets when you fit your new brake caliper.

I went through something similar with an Avid BB5 mechanical caliper that I simply couldn't tune.  Even new pads didn't help.   In the end I bought the lowest-spec Shimano hydraulic brake kit and it bolted up perfectly.   Shimano BL-MT401 + BR-MT410 came pre-bled too with enough hose to fit perfectly.
Caliper alignment was simple.  The hardest part was stripping the bars to get the brake lever to slide up where it was needed.
Do note that pre-bled hydraulics mean you need to pass the caliper or the lever through any holes needed.   For most bikes its no big deal, but if you have internal cable routing, well you won't be able to do that and will have to strap the hose to the outside of the frame.
In short - you can use any Postmount mechanical caliper, or take the opportunity to upgrade to hydraulic for not a lot more cost, if any.
Comment: Some (all?) Shimano now come with a pre-bleed system that allows internal routing. The caliper and hose are attached, and hose end is sealed up. The lever is also sealed. You thread the hose though and attach it to the lever.  If you do  this right (and it is easy), no air gets into the system.
Answer: Whether the front and rear are interchangeable depends on the brand and model. If they don't list a front and a rear it will work in either position. Mechanical disc are now available on even entry level bike so the price of replacements are reasonable. The caliper in your image looks like an Avid BB3 or an off brand knock-off. Something to consider is while the calipers may look the same there is a difference between Road and MTB calipers. This has to do with the pull ratio of the levers. Cheap calipers tend to come with cheap pads. Cheap pads are more likely to squeal and experience fade. While you may not need the best you want something dependable.


In Google Photos, when I try to delete a photo or video on SD card it tells me to go to gallery

Question: I have 2 Mi note 4g's and both of them have the same problem. I have also given access to all permissions in settings(though there is no permission for SD card). All the photos outside the SD card can be deleted all right.
Answer:
Your issue is you haven't allow SD card access from the app itself:

Hamburger menu (Three dots) in the upper right.
Settings
SD Card Access

Regards.
Comment: The problem is as is in Google help it is said this method works for Android 5 up only. My phone is Android 4.4.


integrate chrome tab bar with ubuntu

Question: I need your help with a customization issue please.
I'm a sucker for small details and my OCD starts acting up if things aren't my way.
so, I've installed the latest google chrome on ubuntu, now how do I go about getting the green (+) sign on the tab bar (the one you hit to open a new tab) and how to get the (x) sign (the one you hit to close the tab) to look like the one from the native firefox that comes with ubuntu.
Thanks a bunch
Answer: You can have the + for a new tab added: Chrome Theme 1
You could also edit Google Chrome's icons, saved in <code>/usr/share/icons/</code>.

integrate chrome tab bar with ubuntu


Different answers using different methods

Question: I stumbled upon this integral $$\int_0^{2\pi} \frac{4ie^{i\theta}}{4e^{i\theta}} d\theta$$.
Now if if do it using the formula$$\int\frac{f'(x)}{f(x)} dx=ln|f(x)|+C$$ then i have $$=ln|4e^{2\pi i}|-ln|4e^{(0) i}|$$ $$=ln|4|-ln|4|$$ $$=0$$
But if i cancel out  $4e^{i\theta}$ then i am left with $\theta$. And the integration results in $$=[\theta]_0^{2\pi}$$ $$=2\pi i$$. I know that there is something wrong . Please help...
Comment: The issue is that logs with complex arguments are very... complex. You should read up on logs in the complex case. Unfortunately, any proper answer to this question will repeat a lecture or two of material in an introductory course on complex analysis.
Comment: @CameronWilliams Can you point out which the correct answer to this is?
Comment: $\ln$ is not defined on $\mathbb{C}$
Comment: If you intend to use logarithms, I suggest using $$\lim_{a\to0^+,b\to2\pi^-}\int_a^b\dots~\mathrm d\theta$$(also, you are missing the $d\theta$)
Answer: You do actually need the complex logarithm for your first approach. Taking the modulus of $f(x)$ in $\ln|f(x)|$ produces the mistake - for complex numbers $z$, we have $\ln(z)' = \frac 1z$, this is what you want to use - no modulus there! However, one has to be careful: The $\ln$ here is the complex logarithm, which is quite tricky on its own.
In order to understand the issues with the complex logarithm correctly, let's take a closer look: Consider the complex number $z = e^{i\theta}$. You might say that $\ln(z) = i\theta$. But now we also have $z = e^{i\theta +2i\pi}$. Now $\ln(z) = i\theta +2i\pi$! You get countably many possibilities for the logarithm. That's why you usually specify which 'option' you pick for the logarithm, that's called a 'branch'. Once you pick a branch, you have to be careful since the branch will have a discontinuity along a line starting from the origin - this is where you 'cut out' you particular branch of the logarithm. See Wikipedia for a detailed discussion of this property.
In order to remedy the first approach in your question, let us specify that $\ln$ is the branch mapping such that for $z\in\mathbb C\setminus\{0\}$ we have $\ln z = \ln|z| + i\arg(z)$, and $\arg(z)\in[0,2\pi)$ (which is a specification we make), and the logarithm of the modulus is just the classical, real logarithm. (Something like that should always be specified before working with a complex logarithm, in order to avoid confusion!)
Then
$$\int_0^{2\pi}\frac{ie^{ix}}{e^{ix}} d x = \int_0^{2\pi} (\ln e^{ix})' d x = \int_0^{2\pi} (ix)' d x  = i\int_0^{2\pi} 1 d x =2i\pi.$$
In the first step we have used that on $\mathbb C\setminus \mathbb R_0^+$ we have $\ln(z)' = \frac 1z$. Note that in the second step we have used our specification of the logarithm-branch. You could also use another branch, but you have to be careful to choose it in a way that the integration path does not cross the branch cut (i.e. the discontinuity).
Comment: Which i guess is $2\pi i$
Comment: So pretty much adding $2\pi i$ will go on giving me different answers. Interesting.
Comment: You mentioned "branch" , can you be more specific what that means? Also the question i was working on was precisely to evaluate $\int_c\frac{dz}{z-2}$ around the circle |z-2|=4. Does this convey some message on 'branch'?
Comment: I would say this is a slightly different situation: On the one hand, this integral can be evaluated using the residual theorem, on the other hand you may use that the multivalued logarithm is an antiderivative. The height of the jump between two neighboring branches of the logarithm is then the result of integration.
Comment: In this case, different branches will still give you the same result - the logarithms just differ by a constant, and since it is inside of the derivative, the constant gets lost.
Answer: Appearantly you are integrating the following function
$$\int_{\gamma}\frac{1}{z}dz$$
where we have $\gamma$ is a circle with radius equals to 4 and center at the origin . Now this function has no anti derivative in a nbhd of zero because of the branch point.
Another mistake is to assume that the integral equals to zero because the function is analytic on a closed contour which is not the case here. We have a pole at zero. By the residue theorem we have
$$\int_{\gamma}\frac{1}{z}dz = 2\pi i \, \mathrm{Res}(f,0) = 2\pi i $$
Now using parametrization $z = 4e^{i\theta}$
$$\int_{0}^{2\pi}\frac{4ie^{i\theta}}{4e^{i\theta}}dz = 2\pi i $$


Why is my Nikon lens suddenly extremely dark?

Question: I was going to take pictures of my daughter at the race track, and when I put my lens on my camera (as I have done several times before) this time it was very dark and didn't seem to work properly.
I thought it was something wrong with my camera, and so to check it, I put another lens on it — and it was crystal clear. Is there something I can do to fix it, or is it broken?
Comment: Is the lens cap attached?
Comment: Hi TKF and welcome to the site!  Is it 'very dark' or absolutely black?  Is your aperture lever stuck or sticky?  See this link  -http://photo.blogoverflow.com/files/2011/07/RR_aplever.jpg for a picture - try to slide it a little.
Comment: Hi TKF! What lens was dark, and which one worked? There are some slight differences between Nikon lenses of different vintages.
Comment: @ dpollitt I wish it was only the lens cap being left on.
Comment: Hi and thanks for all the responses @ rfusca it is very dark.  I was able to slide the aperture lever.@ gerikson the lens that is dark is of coarse the one I use the most and is AF-S NIKKOR 18-55mm 1:3.5-5.6G. I have used it on numerous occasions and this last time it was really dark.
Comment: When you slide the aperture lever, do you see the aperture opening and closing inside? Should look something like this: http://cinemagr.am/show/156444595
Answer: If its G lens, and the lever isn't stuck - sounds like a busted lens of some kind to me.
Send it in for repair (or for that lens, buy a replacement or upgrade.  No time like the present for that 17-55 f/2.8 ;) )
(The only thing I'd try first is to clean the electrical contacts on the lens. If they're not acting right, then it could be telling your camera to stop the aperture down through some odd error.)
Comment: Thank you very much. I will try that first if it dont work then I will have to buy one..
Comment: There's a new 18-55 f/2.8?
Comment: @Evan - Ekk, 17-55! Fixed
Answer: I'd guess that the aperture lever in the lens has been either broken off, or knocked out of alignment. This would mean that if the lens is a G-type lens, it will always be at minimum aperture and the lack of aperture lever will mean it won't be opened up when it's mounted on the camera.
Answer: One thing to check is the aperture ring (if your lens is not a "G" lens).  It should be set to the smallest aperture, say f/22, and then there is a switch (see image, switch with small white dot aligned to orange marking) which will lock it down.  If this switch has been bumped, the aperture ring may have moved and the aperture will close down and make the viewfinder dark.  Edit: see comments, apparently this is not true!
A dark viewfinder can also be due to a drained battery, but this doesn't seem to be the case with you since another lens worked fine.
Comment: Whether you have the aperture at its highest setting or not, the aperture should be fully open in between shots.
Comment: Definitely a thought if it wasnt a G lens, but turns out its the standard G kit lens.
Comment: Hmmm, I think you're right.  Off camera, the aperture would close, but when mounted on the camera, it would be at max aperture.  Anyway, it's a G lens, so nevermind anyway!


Sauna has regular plug but pops the breaker

Question: My Sauna draws 17 amps and blows the breaker after about 10  minutes,would I be ok to install a 20 amp breaker on this circuit.I realize that it is only 14 gauge wire but the sauna is only on for 45 minutes at a time and only 2 amps over.The sauna was plugged into a basement plug(closer to panel)and had no issuses.Should also note the bedroom plug that the sauna is now plugged into is an arc fault breaker
Comment: An appliance (in the USA) with a "regular plug" would be for use on a 115VAC receptacle, which may be protected by either 15- or 20-A breakers, according to the gauge of wire used in the branch circuit being protected.  A device that NORMALLY uses more than 12 amps should have a "regular" plug that requires a 20-A receptacle (i.e., NEMA 1-20). So, it's not clear how "regular" (or legal) your sauna's plug is, if it is NEMA 1-15. The appliance's own instructions or nameplate may specifically prohibit use on anything other than a branch with 20-A protection.
Comment: Consult the factory, or the documentation for the sauna, and see if there's a way to configure it to draw less than 12A continuous or 15A total. There must be!   Up-breakering is out of the question.
Comment: ...who put the wrong plug on the sauna? Where are you on this planet even?  Also, what does the nameplate on the sauna say?
Answer: Do not upsize the breaker without increasing the wire size, 20 minutes at this overloaded value is about right for most inverse time breakers. I would put the sauna on a dedicated GFCI circuit since water is usually dumped on the rocks / heating element. Is the name plate value is 17a or is this the measured circuit draw? Since the circuit may have lighting included that could be what is pushing you over the limit, with a 16a draw the sauna could be safely powered with a dedicated 20 a breaker and 12 awg wire.
Answer: No you can't change the breaker.
The circuit breaker is protecting the wiring between the breaker and the plug from becoming hot due to over-current draw.  It does not directly protecting the appliance (sauna).
The wiring protection is needed 24/7 regardless of whether the sauna is on or off.  Perhaps the sauna, while off, becomes shorted, perhaps there is a short elsewhere on the circuit--without the breaker being properly sized for the wire it is protecting-- the wiring will overheat, catch fire, and burn your house down.
Again, the circuit breaker is NOT there to protect the sauna, it protects the house wiring, energized 24 hours a day, from catching fire.
Answer: A 17-Amp load should not be installed on a circuit protected by a 15-Amp breaker.
And it surely should not be installed on a circuit of 14-gauge wire.
A 17-Amp load should not be installed on a circuit protected by a 20-Amp breaker.
And it should not be installed on a circuit of 12-gauge wire.
The minimum size should be #10 and should be protected by a 30-Amp breaker.
The Arc Fault business in this situation is irrelevant.
A significant margin of safety should be built into all electrical circuitry.  This type of circuit should have at least its 125%.  Overloaded circuits get hot and hot starts fires.