Planetary Rule: How possible?

Question: It is an established science-fiction trope, especially in something like Star Wars, that entire planets will be run by a single government. When trying to worldbuild, I began to think about how one government ruling at least 1 entire planet could be realistic. With a government with highly advanced technology, even if it were either weak or just a puppet government, could a single government actually rule an entire planet, despite the problems like rebellions and religious and ethnic violence?
Comment: Why the heck not?
Comment: This seems like more of an open ended discussion prompt than a specific ask about resolving a worldbuilding problem you are having. As per our help center we are not a discussion site, and open ended questions are not a good fit and should be closed.
Comment: I'm sorry this is soliciting discussion. Please scope your problem into a single question (and possible a couple related tags). If you want to form a planetary government a-la Sci Fi tropes, you will need several (or many) questions.
Comment: Could you be missing the point, there?

Do you really see no difference between a united government of a solo planet with no knowledge of others - which seems to me unlikely - and a single plant within any kind of group?

Do you insist they're the same, or can you explain any differences?
Answer: It's all about travel time
And it's very possible
In the past, we have been limited in the size of nations primarily due to the speed of travel (or, more accurately, the speed of communication).  It was very difficult to keep the early United States together because it took months to get information from the eastern states to the western territories.  The Battle of New Orleans was fought 2 weeks after the Treaty of Ghent was signed, because the armies didn't know the war was over.  As infrastructure and transportation improved in the 19th century, the feasible scale of governance rapidly grew, hence the boom in westward expansion.  With 21st century technology, major world powers already maintain military presence around the globe.
Given how accessible spacecraft appear to be in the Star Wars universe, it is more than reasonable to think that a single strong government could rule a planet, star system, or even galaxy with enough wealth.  An 18-wheeler can cross North America in a week, and a civilian class x3 hyperdrive ship can cross the Star Wars galaxy in 3 days.
Comment: @NoustheSpaceAlien We govern more people per state than ever before. China and India are each single-handedly more populous than the entire planet was in 1800.  The United States has 100x more citizens than when it was founded.
Comment: And all of those are examples of disproportionately dysfunctional governments. Compare the organization of China to the organization of Singapore, a very similar government that only concerns itself with a single city. Compare the organization of India's federal government to that of any of it's federates. Compare the benefit the US federal government provides to what the state of California provides on its own. Smaller states are better at governing. Federalism is just the best patch to that issue we have yet to invent.
Comment: I think, if we should learn anything from the Imperial era, it's that we shouldn't try to govern too many humans at once. We get better at organizing ourselves the less our largest relevant organizational body actually governs. Going all the way down, you are the best judge of what you need. We broke ourselves down into the small nation-states of today specifically because they are better at governing than the empires were, and a Terran planetary government would effectively be the largest empire in human history at the point which it forms.
Comment: I'm not saying it cannot happen, I'm saying its a bad idea irl.
Comment: @NoustheSpaceAlien smaller states are faster and easier to govern but much worse at funding large projects and dealing with outside powers. larger states can aggregate more resources to mobilize for things like research, disaster mitigation, resource management, diversification of income, trade, and resources, This is is why the EU exists.  California for instance would crash and burn without water form other states, imagine if it had to buy that water from a foreign power, and it might never recover from the next serious earthquake without a federal wealth pool to draw from.
Comment: @John  Yes, but California also has things like seaports, which its neighbors to the east do not.  So even without an official cooperative alliance between the states in the form of a federal government, there would likely be cooperation on some level.
Comment: @Perkins Or the larger state will just try to conquer it through various means aka Russia and Ukraine, or China and Hong kong or the US and California the first time. And California's ports would be far less effective if the US suddenly had an incentive to build ports in Washington on their own soil instead of sending goods through california.
Comment: @John Conquest is expensive though and rarely ends well in the long run.  And there already are ports in Washington, and on the East Coast.  But you're going to need an awful lot of animosity for it to be cheaper to ship to Washington and truck to Nevada than to just go through California.  It's just easier to cooperate nine times out of ten.  Just like Europe prior to the EU did a lot of trading and working together between wars.
Comment: @Perkins except when they do end well, ALL of North America is conquered soil, most of China is conquered territory, most of your larger nations are made mostly of conquered territory. conquest is high risk but also very high reward. Multiple small nations usually become one big one through conquest.
Comment: @John Virtually all the world has been conquered at some point in history. But unless the conquered people decide they like the new situation and start cooperating, maintaining hegemony is expensive, and nearly always far more expensive than the conquered territory is worth. Just look at the fate of Rome, the powers of colonial Europe, and pretty much every significantly expansionist empire in history.  They all fall apart within a few hundred years.  Even the USA has nearly bankrupted itself attempting to pacify a handful of third-world countries.
Comment: @Perkins or they wipe out the conquered people and replace them with their own people. like most of the examples I gave and a slew of others.
Answer: You can give some or many planets unified governments, and keep a few divided into more subdivisions.

How many worlds have been colonized by other species?
You have to decide how common habitable worlds are. Pearls beyond price or a dime a dozen? If they are common, colonists who want to found their own colonly look for their own planet, not one where other people already live on a different continent.
A matter of perspective.
At times one gets the impression that many US citizens forget that they are one nation. Yet seen from outside, they clearly are. So there are administrative divisions on most planets, with district, city, and county levels, yet an outsider notices mostly the planetary government.
One ecosphere, one government.
On the real world, mankind is slowly realizing that they can ruin the ecosphere if they are not careful. Imagine what they could do with more advanced technology and no need raise kids and retire where they do their pollution. With easy interstellar travel, some people might see a planet as a resource to be strip-mined, others see as a home. There will be conflicts unless there is a central government per planet.

The occasional adventure could center on worlds which do not have unified governments. "Why did you land here if you want to deliver your goods across the border? You'll have to go back into space, even leave the system for a quick jaunt if you don't want to be taxed as intercontinental trade."
Answer: Many countries in the current day are implausibly large by ancient standards, and exert an implausibly large degree of control.  This turns on advancing technology.  Communications, travel, and collation of data are crucial technology.
Remember that the government will break down the world into reasonable sized chunks of ease of administration.  Even towns and villages will have their local authorities that deal with many problems within the scope of the village/town.
Quite small regions have been riven by rebellion and violence.  The government may in fact deploy forces from other regions specifically because they don't have any skin in the game except their paychecks.
Answer: It depends - how did it start
Situation 1 - origin planet with multiple civilisations developing separately (eg Earth).  As many previous questions have covered, until modern(ish) technology was available, there was no possibility of a "world government" simply because regular, timely communication between the various parts of the planet was impossible.  Hence there will always be lots of different nations to begin with in such a situation and it is a matter of whether they are willing to eventually find more common ground than points of difference whether they unite, once the technology exists to make such an option possible.  Without a crystal ball we don't know whether our single known example will unite or remain fragmented, either is a future possibility.
Situation 2 - colonised planet from single source.  If a single government / corporation / settlers' cooperative founds a colony on a planet and settlement spreads out, I suggest it is likely to start as one government and remain as one government.  It makes far more sense to retain one government in order to keep common standards of interoperability, consistent legal code, recognition of training qualifications, maintenance of spaceport and orbital traffic, maintenance of commsats / weather sats...  There will definitely be different levels of government for once it spreads out enough (eg federal, state, local or equivalent) but the only reason a region would want to secede would be if it was being so badly mistreated that the hassle of replacing all top-level government functions would be easier than staying in the union.  (Yes, this does include the possibility of some self-centred idiot politician/s convincing the local population this is the situation when it actually isn't and downplaying the inevitable consequences.)
Situation 3 - colonised planet from multiple sources.  If multiple sources settle a planet simultaneously then the outcome is uncertain.  It could be that the colonists find they have more in common with their local neighbours than the group that sent them and unify, or it could be that they remain separate nations on the same newly colonised world.  A great deal will depend on the differences in culture (including language) between the different colonies, how "successful" each colony is at various times and how the colonies are treated by the government or other entity that sent them.  For example, if the various settlers all speak the same language, they are insufficiently supported by the group that sent them and one colony provides vitally needed aid to the other/s then unification is highly likely.  If they all speak different languages, have significantly different values for personal freedom and are all strongly supported from "home" then they are likely to remain separate.
In summary, how a planet's civilisation/s started will determine how likely they are to unify or remain unified.
Answer: Simplicity Itself:
I would say that it is entirely plausible for one government to rule one planet. I would even argue that it is the most likely logical progression for governance.
Outside factors frequently play a critical if not indispensable role in the destabilization of empires. Wild ideas and tech, abused neighbors hungry for revenge, aggressive neighbors anxious to steal what the empire has, and desperate migrations caused by catastrophes have contributed to many societies changing or collapsing.
Removing external threats simplifies the process of ruling a world government. You can oppress people with little concern that someone will support their revolt, or that the tale will be told and the truth will come out. You can control all supplies, all weapons, all freedoms, all technological progression and most importantly you can erase the past and write all the history books to your liking. The only voice people hear is yours. Of course, innovation will suffer in such a system, but if you control the whole world, you logically should restrict innovation so as to prevent any destabilizing elements from disrupting your control on society. After all, once you are in control, the status quo naturally involves you STAYING in control.
Of course, in a world with spaceships flying in from other worlds, this starts to be a problem. But fear not, you restrict access to the planet to trade stations and orbital bases and all that messy stuff gets kept out. A logical world government would likely need to maintain strict separation between the outside and the surface.  Failing to do so opens you up to the same kind of pressures societies experienced when colonized by foreign powers. Much like Japan, restrict trade and cultural exchange with the outside and maintain tight control on the advancements you need to stay competitive with other civilizations
Answer: On Earth, every recognized sovereign state except for the Vatican City has one or more levels of administrative subdivisions.  Larger states have from one to six levels of subordinate administration, or two to seven levels of government in all.
Leaders of subdivisions within a country can be elected by the residents, appointed from above, hereditary, randomly selected, usurp power, or gain thier positons in o ther ways.  There are many examples of states with several differnt types of subordinate governments.
In most of the USA there are four levels of governments.  The federal government conducts diplomacy, makes war, and has many other functions for the general welfare. State governments issue driver's licenses and have many functions for the general welfare.  County governments maintain recordsof births, marriages, and real estate deals and have many functions for the general welfare.  Municipal governments clean streets, collect trash, often own utility companies, and have many functions for the general welfare.
All levels of government have courts to try violations of their laws and rules.  Many projects are jointly managed by two or more levelsof government.
And there are other government institutions such as school districts, various authorities, and tribal governments.
Most of the Roman Empire's land was divided into city states which had elected councils and magistrtes. A subdivision within a city state was called a pagus. Governors of provinces commanded the military in the provinces and supervised the city governments.  And above them were the emperor, the senate, and the popular assembly at Rome.  So there were four levels of government in the early Roman Empire.
In the later Roman Empire the miltary and civilian functions of governors were separated and given to diffferent officials.  The number of provinces was multiplied, and provinces were grouped into dioceses ruled by appointed vicarsd which were part of prefectures ruledd by the four praetorian prefects under the emperor(s).  Thus the later Roman Empire had six levels of government.
So I can imagine that a hypothetical united world government might might take the diplomatic and military powers of the national governments while leaving them other powers.
And that world government might be directly above the formerly independent national governments, or it might have one or more levels of government between it and the national governments.
For example there could be continental governments over each of the four, five, six, or seven continents recognized by various governments.  And there could ocean governments ruling all the lands whose waters flow into each ocean of the world.  The lands ruled by the continental and oceanic governments would overlap, so that subordinate governments could communicate with the world government though either, or both, and vice versa.
And maybe the world government would revive some of the great empires of the past as an intermediate level of government between the natioal governments at itself.  And of course almost every present day national government has been part of one or more emperies in the past.
And the advantage of overlapping areas of rule by governments above the former national governments is for lawsuits.  If people take a case to higher and higher leavels of courts until they reach the supreme court equivalent of their nation, they then have a choice of two or more even higher courts to take the case to, if th two parties can agree on which one. So adding another level of courts will increase the probability that one side will give up trying and not take the case to the Supreme World Court, thus lowering its caseload.
And a world government should be able to last more or less forever, so long as it has a monoloply military force.  For example, all the military and civilian bodyguards of all the subordinate rulers should be world bodyguard service, working for the world goernment and assigned by it to be the bodyguards of the subordinate rulers.
Answer: I would definitely say its possible.
There are already big world organizations like NATO and UN that are already successful. And in its peak the British Empire controlled almost a quarter of the worlds land area, and housed 23% of the world's population. A United World government is certainly possible, but a government like that would probably be more complex than any government today in order to sort out all the problems of the entire population. And  this world-country would probably be split into many sub-countries and sub-governments, kind of like how the US is split into states with their own sub-governments, except these states could be regions of the world, like maybe the Middle East as one or Europe as another. it would probably not be one identity, you probably wouldn't identify as a citizen of United Earth, more like a citizen of you sub-division. These mega-states would probably also have further sub-divisions, maybe with their own sub-sub-governments.
So yes, a united world government is certainly possible, although it is definitely something for the future, and probably not possible today, as you would probably need to sort out the differences in things like ideology, culture, laws, customs, etc. And things like a global currency would need to be worked out. You would also need to make a system for voting the leaders of the world government that at least most people agree on. It may not be a democracy but rather something else, but of course nothing is stopping democracy from working. Maybe they have elections but instead of republican, democrat, that sorta thing, you would have like a communist party and democratic party, etc. Maybe each of these world-states would have radically different cultures. there are endless possibilities, and it certainly would not be easy to make a united world government, you would need to unite very different parts of the world, and it would probably take a long time, maybe decades or centuries.
Answer: Ruling = protection racket?
"Ruling" is an imprecise term.  Does that mean careful granular governance, discussing school day hours, tax rates for various business, the number of pennies to mint, etc?  Or does it mean a glorified protection racket, extorting money with the threat of violence.  Either one could constitute ruling.  If I must pay tax to the imperial overlord or get some Rods from God in my yard, the imps are my rulers.  This kind of generally uninvolved government would be easiest to do planet wide because all you do is collect tax and sometimes mete out punishment.
There may be other more local rulers who are less scary and more involved in the day to day affairs of your area.  The planetary government might actually be that for their local area.  And your Planetary Empire protection racket might be protecting the planet! If the tax collected from the provinces is used for defense of the planet as conducted by the Emperor that may be a good thing for all inhabitants of the planet, whether they appreciate it or not.
Answer: Common enemy
Aliens invading a planet would immediately unify a civilization.
Nowadays, many dream of a planetary government, because of a common enemy called CO2.
Comment: Someone will sell out. Always room for Quislings, after all. Others will see it as divine judgement and not to be opposed, I don't doubt. Probably also scope for sacrificing your neighbours in the hopes of appeasement, which the neighbours probably wouldn't be so keen on. Even in the face of ecological and viral catastrophe, present day civilization can't even agree on the basics, let alone unify.
Comment: @StarfishPrime you haven't seen my aliens yet (sunglasses smiley)
Comment: Is a new virus is valid test of this hypothesis?
Comment: @L.Dutch It takes more than Covid to reach this point.. but I think some coordination would be happening, when lethality of a new virus would be tenfold? When you'd like to close air traffic world wide, within 48 hours, some central *authority* for air traffic control would come in handy. Same with vaccine development. When H5N7 arrives and what it can do is unknown. Some more *authority* for WHO will be installed, I guess.. or  tasks delegated..
Answer: In a sense, there are two facets to this question: the scale of the setting and can one government rule a world.
Global Domination
TL;DR:  Can one government rule a planet?  Sure.
The longer answer involve logistics and delegation and a thoroughly unhealthy amount of politics (or weapons).
To rule an area, one needs to be able to aggregate information to a central location, process it, and respond with a course of action.  The faster this can be done, the larger the area one could plausibly rule over.  It's a gross simplification and does not take the people one is ruling over into account, but it is a start.
With advanced enough communications technology, information can cross a planet in minutes -- we already do this with the internet here.  The key for your world government would be a robust communications network that could reliably do this.
Processing is already feasible here.  Between people using their intuition and computer algorithms processing the large amounts of data received, the data coming in from all over the world can be processed and checked over.  I might say that for a world government, a bit more raw processing power might be needed, but that is potentially solved with a bigger computer for now.
Also, if the world government is delegating regional authority to a regional group (like a state/province/territory), then that may reduce the information that needs to be gone through as the regional offices will handle the regional affairs and only kick up what needs to be.
Responding is a people thing.  As long as there are enough people authorized to make the decisions and the time to do so, then things should work.  The issue will be dealing with things in a timely manner to have at least the appearance of a functional government.  For this, it's about transportation and logistics technologies -- the ability to move resources around the planet efficiently.  We can do it somewhat now, but it could probably be better.
I've avoided trying to outline specific governments to limit the length of the reply.    Some governments will delegate some power to local governments to better serve their people while others will centralize everything into a global capital for more selfish reasons.  But regardless of how
The Galactic Stage
The thing about a galactic scale setting is that a planet is just not as significant as it would be if your setting was the planet itself, or its solar system.  There is likely not a ton of thought on the government of each individual planet unless it is significant in the setting.
Realistically it is a matter of scale and conservation of detail.

Planetary Rule: How possible?


Backup Salesforce data to a third party

Question: I have a requirement to backup salesforce data to any third party on daily basis and it should be dynamically.I do't want to use any backup service provider.
To achieve this I integrated salesforce with google drive to create and upload csv file to drive but I think it's not a good solution for long term since my org has more then 5 million record that should be backed-up daily on drive.
Can you please suggest any better solution for this?
Comment: Your back-up will be still google drive?
Comment: I'm a bit confused by the question. You want to backup Salesforce data to any third party...but you don't want to use any backup service provider? That's a contradictory question, no? As mentioned, there are a number of automated daily services for this from the AppExchange. Check out: https://appexchange.salesforce.com/results?keywords=data%20back
Answer: There are a lot of dataloader tools that can be scheduled to export data. If you want to export daily and without manual intervention this may be a good solution.
For example Dataloader.IO can be used: https://dataloader.io/scheduling
Or Jitterbit (= more enterprise level): https://success.jitterbit.com/display/DOC/Creating+a+Schedule
Update after comment of @David Gillen: You can also use the older data loader program on the command line with config files rather than through it's UI; and then set up a scheduled task/cron job, to run it on whatever schedule you prefer.
Comment: Both good options, with dataloader.io being cheaper, Jitterbit is more enterprise level. You can also use the older data loader program on the command line with config files rather than through it's UI; and then set up a scheduled task/cron job, to run it on whatever schedule you prefer.
Comment: Thanks David, I am using data loader program on the command line and scheduled it using windows scheduler .
Answer: If the third party can make the callouts to salesforce api then its simple thing to do:
1. Create a rest webservice in salesforce which will export the data based on the query parameters received.
2. Query the records based on the parameter received and serilize the list and return the serilized string to the third party.
3. After getting this response from sf deserilize the response and save to your database.
visit the link:
Rest webservices
Hope this helps you!
Let me know if you need more information.

Backup Salesforce data to a third party


Cancel changes in last 24 hours in magento adminpanel

Question: At my work somebody that is not familiar with Magento did strange changes that affect my site badly,
is there any way to reset last changes.? As example: cancel the changes in last 24 hours
Comment: No there isn't a rollback facility in Magento until and  unless a backup is taken
Comment: Did you manage to find a solution for your issue?
Answer: This is not possible as a feature. You can however request a database backup from your hosting provider and overwrite your database.
Please note that all orders are lost as well in that case. A partial backup might also be possible where you leave the old sales_* and customer_* tables and replace the rest.
Also, make sure to always keep the eav_entity_store intact. The order increment ID is stored there and resetting that to a previous one will most likely cause fatal issues with your Payment Service Provider
Answer: If you run backup everyday then it is possible.
Check your var/backup folder if you have any backup or else you can ask your server provider to see if they do everyday backup.
In dedicated server, server provider set image creation everyday, so that you can re-install server with that particular day's files.


When were the RCA CDP1804, CDP1805, and CDP1806 introduced?

Question: RCA produced follow ups to its 1802 CPU, the CDP1804, CDP1805, and CDP1806. What years did they become available to purchase in?
Comment: Hmmmm.... Seems like we should find an EE Times archive and a student intern to comb through them noting all microprocessor announcements?
Comment: @JonCuster: Or else find someone who would have been involved with projects that used them, and might have information about the evolution from "product that is being considered" to "product that is being manufactured in production quantities" which could not be found in press releases.
Comment: @supercat - well, this is the third similar question asking about different families of microprocessors in a week...
Comment: @JonCuster Did chatGPT read the EE Times archive? If so, we can ask it. :)
Answer: Well, we can at least establish a latest date for them. The RCA Solid State Databook for CMOS Microprocessors, Memories and Peripherals has a copyright date of 1984 and the text "Printed in USA-10/84" on the information page at the start of the book. It lists various versions of all three extended CPUs (1804/5/6).
Given the production dates later in this answer, that's about as useful as saying they were all available in 2022 :-)
The 1804 and 1805 were both described in the Microprocessor/Memory Application Briefs document, dated July 2nd, 1981. That book lists the latest datasheet for the 1804 as 8/79 so it would probably have been available at that point.

In terms of a bit more detail, the AntiqueTech website has the following information on these chips. How reliable it is I'll leave up to others but they appear to have a great deal of useful information so are likely reasonably accurate:

1802 production started early 1975 (source).
1804 production started 1976 (source).
1805 production started Q3 1981 (source).
1806 production started Q3 1981 (source).

Regarding the reliability, there's some contention as to the dates. For example, Wikipedia has the 1802 sampling in 1975 but not entering production until 1976. In addition, AntiqueTech has some inconsistencies, such as listing a production date of the 1801/1802 as the same year but stating in the text that the were introduced early 1975 and early 1976 respectively. Hence I suspect it would be wise to treat these dates with an adequate margin of error.
Comment: Thanks. The 1801 and 1802 are both listed as 1975, which can't be right. Surely they didn't introduce the 2 chip and 1 chip versions the same year. Wikipedia gives 74 for the 1801 which makes more sense.
Comment: @user, not sure. It could be the case they were both production-started in the same year, jan/dec would be 11 months. There wasn't a lot of extra work on the 1802, it was mostly getting the 1801u/r on to the same die.  We may also have to allow for announce vs produce. I tried to find better info from rca sources but it's scarce after the ge buyout.
Comment: Having said that, though the production dates are identical, the text for the 1802 says they were introduced early 75 and early 76. So perhaps not as accurate as I  originally thought?
Comment: I think the only way to really know is to find products that had those parts in them.
Comment: @user, I'm all for that but it's likely to be difficult. The nature of the 1804+ chips is that they would most likely be found in specific embedded systems, not in machines available to the general public. I'm thinking as an example  of the Dallas Semi 68302 (not the Motorola one). I know for a fact this was used in several embedded scenarios (since I worked on them) but I suspect you'd be hard pressed finding that out now :-)


Creating a raised card effect in Illustrator

Question: How can this be done? It looks like the invitations are raised. Is it with drop shadow or another tool? I'd like to be able to do this in Illustrator.
Comment: Looks like drop shadows.
Comment: Why would you use Illustrator for real looking photos like this??
Answer: Illustrator has a (raster) drop shadow effect:
Choose Effect > Stylize > Drop Shadow

You'll also want to ensure the Document Raster Effects Setting is correct:

This is a raster effect and will create embedded raster images upon output or flattening.


Import a class of different project into my project

Question: I have a demo project-named A having a class Class AA. and I have another demo project-named B having a class Class BB.
My question is how can I import ClassBB  in class AA??????
Comment: check this thread if you are working with eclipse:
http://stackoverflow.com/questions/3487585/import-from-another-java-project-in-eclipse
Answer: What you have to do is to add project A to project B's build path. Check this thread if you are working with eclipse:
import from another java project in eclipse
right click on project b's folder in eclipse --> properties --> build path --> projects --> add.
Comment: actually the question was about importing class, not whole project. In my case I have two projects with same class names, and I want to import only one of the classes. I'm worried about the name conflicts if I import whole project... is it possible to do it with only one helper class?
Answer: Add Project B in A's build Path. If you are using Eclipse. Right Click on Project->Java Build Paht->Projects->Add
Answer: You have to define a dependency from you project A to project B.
In eclipse, make a right-click on project A and select "Propeties". Then, in "Java build Path", choose the "Project" tab. Click on the "Add" button and select project B. Validate, and you'll be able to import class BB in class AA


Difference between java.lang.RuntimeException and java.lang.Exception

Question: Someone please explain the difference between java.lang.RuntimeException and java.lang.Exception?  How do I decide which one to extend if I create my own exception?
Answer: Generally RuntimeExceptions are exceptions that can be prevented programmatically. E.g  NullPointerException, ArrayIndexOutOfBoundException. If you check for null before calling any method, NullPointerException would never occur. Similarly ArrayIndexOutOfBoundException would never occur if you check the index first. RuntimeException are not checked by the compiler, so it is clean code.
EDIT : These days people favor RuntimeException because the clean code it produces. It is totally a personal choice.
Comment: I like this angle of "runtime exceptions could have been avoided by the caller". That means you (as the caller of a method) are supposed to make sure they don't even happen. Whereas checked exceptions are something that you cannot avoid and are instead required to deal with them after the fact. (And yes, since not everyone agrees with the concept of checked exceptions and many people use RuntimeException for everything, this distinction has become a bit muddled).
Comment: Nowadays people favor unchecked RuntimeException also, because it is compatible to Java 8 Lambda processing, whereas checked exceptions of type Exception are not.
Comment: I suspect the real reason people catch `RuntimeException` is because it's simple, and obviates the need to think about the differences between checked and unchecked exceptions. I think catching runtime exceptions is a terrible idea because you'll catch unrecoverable exceptions such as `NullPointerException`.
Answer: In Java, there are two types of exceptions:  checked exceptions and un-checked exceptions.  A checked exception must be handled explicitly by the code, whereas, an un-checked exception does not need to be explicitly handled.
For checked exceptions, you either have to put a try/catch block around the code that could potentially throw the exception, or add a "throws" clause to the method, to indicate that the method might throw this type of exception (which must be handled in the calling class or above).
Any exception that derives from "Exception" is a checked exception, whereas a class that derives from RuntimeException is un-checked.  RuntimeExceptions do not need to be explicitly handled by the calling code.
Comment: But the joke is RunTimeException itself extends Exception :D (I know this doesn't make any troubles and JVM takes care of the whole context)
Comment: An Error is not meant to be caught (though it could be) generally you use errors for catching your own mistakes as youre working on new code. For instance if you have a tree if if/elseif statement, the final else might just do throw Error("wasnt expecting this condition to happen");. Generally speaking, exceptions have use cases where theyre SUPPOSED to happen, whereas errors do not have a use case and they are a bug.
Comment: Practically its true that "there are two types of exceptions", but why does Oracle documentations says there are three types. It consider the Error as 3rd type. I think, Error is not an Exception at all, its just Throwable (object), yea, it mimic the behaviour of runtime exceptions. What you would say about it? Oracle doc. ref. http://docs.oracle.com/javase/tutorial/essential/exceptions/catchOrDeclare.html
Answer: Before looking at the difference between java.lang.RuntimeException and java.lang.Exception classes, you must know the Exception hierarchy. Both Exception and Error classes are derived from class Throwable (which derives from the class Object). And the class RuntimeException is derived from class Exception.
All the exceptions are derived either from Exception or RuntimeException.
All the exceptions which derive from RuntimeException are referred to as unchecked exceptions. And all the other exceptions are checked exceptions. A checked exception must be caught somewhere in your code, otherwise, it will not compile. That is why they are called checked exceptions. On the other hand, with unchecked exceptions, the calling method is under no obligation to handle or declare it.
Therefore all the exceptions which compiler forces you to handle are directly derived from java.lang.Exception and all the other which compiler does not force you to handle are derived from java.lang.RuntimeException.
Following are some of the direct known subclasses of RuntimeException.
AnnotationTypeMismatchException,
ArithmeticException,
ArrayStoreException,
BufferOverflowException,
BufferUnderflowException,
CannotRedoException,
CannotUndoException,
ClassCastException,
CMMException,
ConcurrentModificationException,
DataBindingException,
DOMException,
EmptyStackException,
EnumConstantNotPresentException,
EventException,
IllegalArgumentException,
IllegalMonitorStateException,
IllegalPathStateException,
IllegalStateException,
ImagingOpException,
IncompleteAnnotationException,
IndexOutOfBoundsException,
JMRuntimeException,
LSException,
MalformedParameterizedTypeException,
MirroredTypeException,
MirroredTypesException,
MissingResourceException,
NegativeArraySizeException,
NoSuchElementException,
NoSuchMechanismException,
NullPointerException,
ProfileDataException,
ProviderException,
RasterFormatException,
RejectedExecutionException,
SecurityException,
SystemException,
TypeConstraintException,
TypeNotPresentException,
UndeclaredThrowableException,
UnknownAnnotationValueException,
UnknownElementException,
UnknownTypeException,
UnmodifiableSetException,
UnsupportedOperationException,
WebServiceException

Comment: That explanation was worth an upvote man
Answer: An Exception is checked, and a RuntimeException is unchecked.
Checked means that the compiler requires that you handle the exception in a catch, or declare your method as throwing it (or one of its superclasses).
Generally, throw a checked exception if the caller of the API is expected to handle the exception, and an unchecked exception if it is something the caller would not normally be able to handle, such as an error with one of the parameters, i.e. a programming mistake.
Answer: The runtime exception classes (RuntimeException and its subclasses) are exempted from compile-time checking, since the compiler cannot establish that run-time exceptions cannot occur. (from JLS).
In the classes that you design you should subclass Exception and throw instances of
it to signal any exceptional scenarios. Doing so you will be explicitly signaling the
clients of your class that usage of your class might throw exception and they have to
take steps to handle those exceptional scenarios.
Below code snippets explain this point:
//Create your own exception class subclassing from Exception
class MyException extends Exception {
    public MyException(final String message) {
        super(message);
    }
}

public class Process {
    public void execute() {
        throw new RuntimeException("Runtime");
    }
    public void process() throws MyException {
        throw new MyException("Checked");
    }
}

In the above class definition of class Process, the method execute can
throw a RuntimeException but the method declaration need not specify that
it throws RuntimeException.
The method process throws a checked exception and it should declare that it
will throw a checked exception of kind MyException and not doing so will be
a compile error.
The above class definition will affect the code that uses Process class as well.
The call new Process().execute() is a valid invocation where as the call of form
new Process().process() gives a compile error. This is because the client code should
take steps to handle MyException (say call to process() can be enclosed in
a try/catch block).
Answer: Proper use of RuntimeException?
From Unchecked Exceptions -- The Controversy:

If a client can reasonably be expected
  to recover from an exception, make it
  a checked exception. If a client
  cannot do anything to recover from the
  exception, make it an unchecked
  exception.

Note that an unchecked exception is one derived from RuntimeException and a checked exception is one derived from Exception.
Why throw a RuntimeException if a client cannot do anything to recover from the exception?  The article explains:

Runtime exceptions represent problems
  that are the result of a programming
  problem, and as such, the API client
  code cannot reasonably be expected to
  recover from them or to handle them in
  any way. Such problems include
  arithmetic exceptions, such as
  dividing by zero; pointer exceptions,
  such as trying to access an object
  through a null reference; and indexing
  exceptions, such as attempting to
  access an array element through an
  index that is too large or too small.
Answer: From oracle documentation:

Here's the bottom line guideline: If a client can reasonably be
  expected to recover from an exception, make it a checked exception. If
  a client cannot do anything to recover from the exception, make it an
  unchecked exception.

Runtime exceptions represent problems that are the result of a programming problem and as such, the API client code cannot reasonably be expected to recover from them or to handle them in any way.
RuntimeExceptions are like "exceptions by invalid use of an api" examples of runtimeexceptions: IllegalStateException,  NegativeArraySizeException, NullpointerException
With the Exceptions you must catch it explicitly because you can still do something to recover. Examples of Exceptions are: IOException, TimeoutException, PrintException...
Answer: In simple words, if your client/user can recover from the Exception then make it a Checked Exception, if your client can't do anything to recover from the Exception then make it Unchecked RuntimeException. E.g, a RuntimeException would be a programmatic error, like division by zero, no user can do anything about it but the programmer himself, then it is a RuntimeException.
Answer: RuntimeException is a child class of Exception class
This is one of the many child classes of Exception class. RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine. A method is not required to declare in its throws clause any subclasses of RuntimeException that might be thrown during the execution of the method but not caught.
The hierchy is
java.lang.Object
---java.lang.Throwable
-------java.lang.Exception
-------------java.lang.RuntimeException
Answer: Exceptions are a good way to handle unexpected events in your application flow. RuntimeException are unchecked by the Compiler but you may prefer to use Exceptions that extend Exception Class to control the behaviour of your api clients as they are required to catch errors for them to compile. Also forms good documentation.
If want to achieve clean interface use inheritance to subclass the different types of exception your application has and then expose the parent exception.
Answer: There are two types of exception, You can recover from checked exception if you get such kind of exception. Runtime exception are irrecoverable, runtime exceptions are programming errors, and programmer should take care of it while writing the code, and continue execution of this might give you incorrect result. Runtime exceptions are about violating precondition ex. you have an array of size 10, and you are trying to access 11 th element, it will throw ArrayIndexOutOfBoundException
Answer:
User-defined Exception can be Checked Exception or Unchecked Exception, It depends on the class it is extending to.
User-defined Exception can be Custom Checked Exception, if it is extending to Exception class
User-defined Exception can be Custom Unchecked Exception , if it is extending to Run time Exception class.
Define a class and make it a child to Exception or Run time Exception


What can cause RewriteRule to work only for certain pages?

Question: Are there any external factors (that is, not in the .htaccess file) that can cause the RewriteRule not to work for specific URLs (of existing pages)?
I have the following code in the .htaccess file (it performs redirection but not for all URLs):
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php

RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$
RewriteRule (.*) http://example.com/$1 [R=301,L,QSA]
</IfModule>

[Edit]
I've already made some changes since I first posted the question, changes that didn't bring any improvement with regards to the way redirections are made - so the problem still needs a solution.
The whole .htaccess file content is:
Options +FollowSymLinks -MultiViews

RewriteEngine on

AddHandler x-httpd-php .html .htm

<ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

<ifModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 seconds"
  ExpiresByType text/html "access plus 1 seconds"
  ExpiresByType image/gif "access plus 2592000 seconds"
  ExpiresByType image/jpeg "access plus 2592000 seconds"
  ExpiresByType image/png "access plus 2592000 seconds"
  ExpiresByType text/css "access plus 2592000 seconds"
  ExpiresByType text/javascript "access plus 216000 seconds"
  ExpiresByType application/x-javascript "access plus 216000 seconds"
</ifModule>

<ifModule mod_headers.c>
  <filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
    Header set Cache-Control "max-age=2592000, public"
  </filesMatch>

  <filesMatch "\\.(css)$">
    Header set Cache-Control "max-age=2592000, public"
  </filesMatch>

  <filesMatch "\\.(js)$">
    Header set Cache-Control "max-age=216000, private"
  </filesMatch>

  <filesMatch "\\.(xml|txt)$">
    Header set Cache-Control "max-age=216000, public, must-revalidate"
  </filesMatch>

  <filesMatch "\\.(html|htm|php)$">
    Header set Cache-Control "max-age=1, private, must-revalidate"
  </filesMatch>
</ifModule>

<ifModule mod_headers.c>
  Header unset ETag
</ifModule>

FileETag None

<ifModule mod_headers.c>
  Header unset Last-Modified
</ifModule>

RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$
RewriteRule .? http://example.com%{REQUEST_URI} [R=301,L]

#BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>
# END WordPress

Answer: Old Answer
.htaccess rewrites work from the top down. Once a re-write match has been found then apache stops there. So you need to put your re-direction first like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} !^(www\.)?domain\.com$
RewriteRule (.*) http://domain.com/$1 [R=301,L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php

</IfModule>

New Answer
instead of:
RewriteCond %{HTTP_HOST} !^(www\.)?domain\.com$
RewriteRule .? http://domain.com%{REQUEST_URI} [R=301,L]

try:
    RewriteCond %{HTTP_REFERER} !^http://(.+\.)?domain\.com/ [NC]
    RewriteRule (.*) http://domain.com/$1 [R=301,L]

Or if that doesn't work try:
    RewriteCond %{HTTP_REFERER} !^http://(.+\.)?domain\.com(.+)? [NC]
    RewriteRule (.*) http://domain.com/$1 [R=301,L]

Comment: Thank you for answering, @Emmanuel . As strange as this may sound, doing what you suggested doesn't help me see all the pages on other domains being redirected. [Here](http://webmasters.stackexchange.com/questions/12005/rewriterule-not-working-for-certain-urls) you can see more about the URLs that are'n directed and other ways I've tried to make this work. After days and days of trying to solve this I tend to believe the error hides somewhere else.
Comment: @keikki - Mm... okay, how about trying this for the redirect: `RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]` and `RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]`
Comment: @Emmanuel , I've tried `RewriteCond %{HTTP_HOST} ^www\.example\.com [NC] and RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]` and the result was: "The page isn't redirecting properly" - on the one hand; on the other hand, correct me if I'm wrong, but how would additional domains be redirected towards the main one if the `^www\.example\.com ` isn't negated with "!" ? Yes, it is a good idea to make the URLs not to be case sensitive, but this doesn't address the problem I confront now: domain forwarding with the strange behavior of working only on certain URLs. Thanks again for trying, though!
Comment: @keiki - Mmm... okay I think the `!^(www\.)?` in your rewrite is a conditional for matching a url with or without the `www`. Could you post some of the urls that aren't being redirected? And is the code you've got above all of your .htaccess file?
Comment: @Emmanuel , URLs with or without www are matched by (www\.)?, while the "bang" (!) negates the whole URL, because I wanted every URL with the %{HTTP_HOST} different of "domain", to be redirected. An URL that isn't redirected is www.anotherDomain.com/existentDirectory/. I'll gladly edit my post to add all the .htaccess file.
Comment: @keiki - Okay I've totally edited my above answer, so try it now and see if it works


Does lender care what I use the money for?

Question: In terms of a private loan between two private individuals, are there any limitations to what credit receiver (lender) can use the borrowed money for ? Extreme examples might be buying food, paying rent, investing  / trading borrowed funds on the stock exchange, buy a car or even gamble ? - this is obviously given that the lender fully complies fully to the terms of the formal loan agreement, in terms of interest, payment period and value, etc ?
Answer: When you borrow from a bank, there are secured loans, as with a mortgage, or unsecured lines of credit, usually a more reasonable amount of money, but also based on income.
You just asked about a private loan. It depends on the person and your relationship. If you need money to pay the rent, you might not be the best person to lend money to. If you ask a friend or relative, they may lend you money without asking its purpose.
Answer: Some banks do and some don't.
If it's a personal loan, the word "personal" is in play here. You do not have to divulge your reason for a personal loan. If the bank insists on a reason, you can be honest and state what the purpose of the loan is as long as it's for a legal thing.
Tell the truth.
It's as simple as that.
Comment: Sadly this question isn't about bank loans, but about a loan from one person to another :(
Comment: oh okay! I thought it was related to a personal loan. My bad


Pregnant woman with male fetus in a minyan?

Question: There is a Halachic option that says if there are otherwise 9 adult (above bar mitzvah age) Jewish males, an underage (pre bar mitzvah) Jewish male can be counted to make a minyan (which normally requires 10 adult males). My question is, if a Jewish woman is pregnant with a male baby/fetus, and there are 9 adult Jewish men present, can her child be counted as a minyan with her present?
Comment: Will the child respond to Kaddish and Kedushah???
Comment: The only time we seem to care the fetus is male is kapparos.
Comment: It worked for saiyains in DBZ beerus movie :)
Comment: True, but a minyan on 10 people is needed to respond to Kaddish and Kedushah, which Torah knowledge alone can't suffice for.
Comment: @user also kohein in cemetery
Comment: @אילפא a completely trivial assumption
Answer: The Shulchan Aruch (Orach Chayim 55:4) talks about adding a Katan to a minyan:

יש מתירים לומר דבר שבקדושה בתשעה וצירוף קטן שהוא יותר מבן שש ויודע למי מתפללין ולא נראין דבריהם לגדולי הפוסקים וה"ה דעבד ואשה אין מצטרפים. הג"ה: ואפילו על ידי חומש שבידו אין לצרפו מיהו יש נוהגים להקל בשעת הדחק [הרא"ש ומרדכי והגהות מיימוני פ"ט מהלכות תפילה]
There are those who allow the saying of holy prayers (i.e., ones that need a minyan) with nine men and a Katan who is over six years old and knows to Whom we pray, but this opinion is not that of the great Poskim*. And the same is true that a slave and a woman can't be counted towards a minyan. Rema: and even with the Chumash in his hands we don't count him, however there are those who are lenient and count him (even without the Chumash, according to the Mishna Berura) in a time of need [Ru"sh Mordechai and Hagahos Maimonios, chapter 9 of Hilchos tfila]

*This is a reference to the Rambam and Tur, per the Gr"a on this seif.
The translation and emphasis is mine, as is anything in parentheses ().
So, not only would a fetus not count, but no kid under the age of six counts, and even then only according to the second opinion in the Rema, in times of need.

Although this is mostly unrelated, the Chidush the Rema adds by saying 'even if he's holding a Chumash we don't count him' is that in some (very specific) cases**, we count a Sefer Torah as a person to make a minyan, that will not help and 'be mitz'taref' with the Katan to make the tenth man.
**Specifically, being the last man needed when making a leap year, per the Gr"a on this Seif.
Comment: Not that they don't have understanding of the prayers, but that they don't know to Whom they are praying (as in, they don't understand of  what God is). But either way, we would need to both understand that gemara as pshat and not 'trying to teach us something' *and* pasken like that gemara L'Halacha (which I've seen no evidence of- it's agadetta so we generally don't accept that as halacha). So seemingly this shulchan aruch would include a fetus
Comment: Also, presumably '6 years old' is final. Even if there's a smart 5 year old who understands whom he is davening to, he wouldn't be counted in the minyan (because chachamim said 6 years old, and that's across the board). So even if the gemara in niddah is accepted, we would seemingly say it's Assur because לא פלוג רבנן: chachamim don't make exceptions in their gezeiros


Can I say "this water" or "that furniture"?

Question: Can I say "this water" or "that furniture" ? If I can, what does it mean?
Answer: I'm not an English teacher but I speak English better than my native language so here goes. Using "this water" would simply be you referring to the water you are talking about, usually I think "this water" would be followed by some sort of adjective describing the water, for example:("is clear", "is murky", "is tasty").
The same goes for that furniture, of course pieces of furniture have names so you would be specifically pointing out a piece of furniture here. You would also be describing it and using an adjective on it based on what you see/think about it, for example: ("is old", "is broken", "is big").
And yes you can say "this water" and "this furniture", however I think it should be followed up with an adjective, otherwise it would not make sense to simply say "this water" or "this furniture" on it's own.
Comment: I believe you would be referring to it all, you would be making a generalisation. Unless you don't specifically indicate one in some way. So yes, I believe so.
Comment: Íf you mean a piece of furniture, you say either "that piece of furniture" or "that sofa", "table", etc.
Comment: Suppose you want to rent an apartment. When you enter an apartment, you see the furniture, for example, two sofas, a table, some chairs, and a bookcase. You said, "this furniture is old". Do you mean all the furniture or only a piece of furniture?


Do United States police officers answer to the president before the mayor?

Question: Many mayors of major US cities are claiming that they were not implement some of President-elect Trump's orders regarding deportation.  Would the police be obligated to listen to the mayor and ignore the president or would they be obligated to listen to the president and ignore the mayor?
Comment: https://en.wikipedia.org/wiki/Arizona_v._United_States is the closest to case law we have here, but, in this case, Arizona wanted to enforce immigration laws MORE strictly than the federal government.
Comment: To sum up the answers: there are no US Police Officers like there are US Marshals.
Answer:
Do United States Police Officers Answer to the President Before the Mayor?

No.  In some cities, e.g. New York City, they don't answer to either.  Although the mayor can fire and replace the police commissioner there, individual officers are not obliged to obey the mayor.  In other cities, the head of the police may be elected separately from the mayor.  And the president isn't connected to local police at all.
That said, they do have to comply with the law.  And if the law requires them to do certain things in certain situations, then they have to follow that.  Even in those places where the police are directly under mayoral control, the mayor can't force them to break the law.  E.g. the mayor can't demand an extra-judicial hanging.  Or force them to ignore immigration law.
The current battle seems to be being fought mostly in terms of funding.  The federal government is sending certain monies to the city.  It may stop sending some funds to cities that don't do certain things.  Cities are defiantly saying that they'll continue even in the face of loss of funds.  Note how this hits two Republican issues:  immigration and cutting spending.  And a very small number of Republicans live in those cities.  As such, don't be surprised if the funding is in fact cut.
Comment: I disagree. The chain of command is well-established and that's how police force works. Mayors are in charge of city government in the same way President is of the federal government. President orders his generals for military operation and city mayors order his police commissioner (or whatever he is called) for police operation. I think you misunderstood how it works.
Comment: In DC, the President actually *does* have some authority over police. Under the Home Rule Act, the President can order the mayor to provide (for a limited time) such services of the Metropolitan Police as the President deems necessary or appropriate if the President feels it's needed to deal with an emergency.
Comment: "the mayor can't force them ... to ignore immigration law": the mayor can fire them, however, for disobeying an order to ignore immigration law.
Comment: @Rathony I can't speak for the US / every US jurisdiction, but the principle of police autonomy / arm's-length control is not unheard of. The police are not a military force (except in certain countries, where they are).
Comment: At the county level, the sheriff is usually independently  elected and reports to no one but the voters and the courts, except that the county commission indirectly influences the sheriff through funding decisions. The proportion of law enforcement officers in the U.S. who report to local government rather than to state government or to the federal government is higher than in almost any other country in the world.
Answer: Municipalities are creations of the states. Depending on the state, municipalities may have different levels of independence (and in some states, different municipalities may have different levels of independence within a single state, depending on the municipal charter). Well, except for Washington, DC, where I believe that the city mostly reports to Congress - but that's a onesie special case
States are considered sovereign entities to some extent. Yes, Congress can pass laws that override state laws, but the concept of state sovereignty dates back to the founding of the country (though it was paired back a bit when the Articles of Confederation were supplanted by the constitution. An example of this is how the President has absolute pardon power for federal convictions and zero pardon power for state crimes.
The President has absolutely no constitutional powers over cities. That said, many/most of the programs that Congress passes and funds leaves it to the executive branch to administer. What the President can say he/she's going to do is withhold Congress-passed funds from a city if it doesn't follow his/her dictates.
The Trump administration has tried this with some California cities. I believe that so far, the cities are winning the ensuing court cases.
It's also worth noting that in some US municipalities, the city will have a weak mayor form of government (as opposed to having a strong mayor. Dallas is an example. The police in Dallas report not to the mayor, but to the city council as a whole, through the city manager. Most executive responsibilities are invested in the city manager and not the mayor.
Comment: "What the President can say he/she's going to do is withhold Congress-passed funds from a city if it doesn't follow his/her dictates": the president does not have full discretion over the disbursement of federal funds.
Answer: You should note that police force has a different chain of command from military force whose top commander is the Commander-in-Chief, President of the US.
Police officers are to follow orders from Mayors who appoint the top police officer called chief of police/police commissioner/superintendent/sheriff.  In other words, the commander-in-chief of police officers in each city and county are mayors. (Depending on the size and relevant laws of each city and county, it might work differently.)
Mayors don't follow orders from the President. They follow the law. If they are found not to follow any law, they can be recalled and sued by city council members or citizens depending on the law.
Theoretically, mayors don't have to follow the President's initiatives and policies. However, the federal government has some power to force their initiatives and policies through incentives and disincentives (stick and carrot). Cities and counties rely on support from state and federal government and mayors need to receive as much support from the federal government as possible, one good example of which is infrastructure projects which cost a lot of money. The federal government has ways and means to control mayors. It's always give and take and that's politics.
We will see how many mayors can defy Trump's policies when they become reality. There will be some reasonable middle ground that each side could agree on. That's what I expect to happen.
Comment: @user4012 Yes, there is. But their roles are not same as city police, for example, in terms of enforcing such laws related with illegal immigrants.
Comment: Not very relevant, but there's State police too, they don't take orders from Mayors. There are also elected Sheriffs who I don't think do.
Comment: There are many parts of the US where there is no local police force and basic policing is provided by state police.  There are many more parts of the US where the local police force is the county sheriff's office.  State, county, and local police all wield the power of state law, however, not federal, so the president is not in the chain of command for any of them.
Answer: There are 2 facets of this - are they required, and can they be compelled even if they are not:

Strictly speaking, there is currently no law which requires state police to participate in immigration enforcement per se.

As another answer noted, municipal law enforcement officers (LEOs) are basically employees of municipal government, and as such (unless they hold an elected office like the Sheriff of Nottingham) they report to the Mayor, NOT to federal executive branch/President.

However, there are ways that they can be persuaded to follow the law:

Direct financial dependency on federal government.

Between FY2009 and FY2014, the federal government provided nearly $18 billion dollars in funds and resources to support programs that provide equipment and tactical resources to state and local LEAs (Source: White House).

Additionally, local LEOs receive much more indirect support (intelligence, training, liaison, federal info) as well.

Threat of federal prosecution
Purely theoretically, illegal immigration is a crime. I'm not sure if it's legally feasible (I'll ask on law.se) but there may be a possibility that a LEO who "harbors" an illegal alien may be prosecuted for aiding and abetting or (if it's organized) conspiracy. IANALADPOOI†, so this is just a random guess that may not be feasible legally or practically.

As another answer noted, financial pressure can be put on the city rulers and the Mayor directly.
The Federal government typically has a lot of money they can threaten to cut off to the city, if the city is defiant.
There are also secondary considerations (awarding contracts, etc...).

Last but not least, with sufficient votes, Congress can theoretically even pass a law making it an explicit crime for local LEOs not to enforce immigration law. Not sure how feasible that is in practice as far as getting enough votes, and of course it would have to survive constitutional challenge that is inevitable to arise.

† I Am Not A Lawyer And Don't Play One On Internet
Comment: There's another angle to this, which is that unless they are specifically deputized to do so, state and local police are not even *authorized* to enforce federal law.
Comment: @phoog That's not generally true. Unless the feds leave no role for state authorities, state police can arrest for federal crimes if allowed by state law. For instance, state police can arrest for federal immigration crimes like unlawful entry, but not non-crimes like unlawful presence.
Comment: @phoog Except in places like Arizona that allow probable cause arrest for misdemeanors.
Comment: @ohwilleke See Gonzales v. City of Peoria, 722 F. 2d 468. This literally has come up, for Arizona specifically, and the ruling was that state officers had the authority to arrest for federal crimes as long as state law permitted it. See also US v. Di Re, 332 U. S. 581.
Comment: @cpast okay, but *if allowed by state law.*
Comment: @phoog State law generally does. If a cop can "arrest for felonies on probable cause or misdemeanors in their presence," that's assumed to include federal offenses.
Comment: @cpast and bringing this back to the question, illegal entry is a misdemeanor on first offence, so an officer would not be authorized to arrest someone for illegal entry without having probable cause to believe that the person had done it at least twice.
Comment: Generally speaking, it is illegal for local law enforcement to enforce immigration law without immigration agency permission and state and local permission to do so. Usually, they lack jurisdiction to do so. The federal government, as a practical matter, can't require local law enforcement agencies to enforce federal laws. There are immunities from suit for local law enforcement and the threshold to aid and abet violations of federal immigration law are very high.
Comment: @cpast Incorrect. Generally only with both state permission and federal deputization. As a general rule, a state and local police officer can't arrest someone for a federal crime. Most common federal crimes have parallel state crimes, however. Murder of a postal official, or bank robbery, for example.
Answer: First, except in DC there is no direct connection between local or state government or law enforcement and any branch of the Federal government.  Federal officials have more power because the Federal government is larger and has more people, money, lawyers and guns, not because they directly report to someone that is in the Federal government.
Some local law enforcement officers, Sherrifs for instance, may not have a superior that they report to — there is no one that can give them orders and fire them for disobedience.
But everyone is subject to the same laws (basically, there are temporary and time limited exceptions for members of Congress and the President), so if a police officer commits a crime he could be arrested, tried and convicted.
But....the courts (see castle rock and warren vs District of Columbia) have ruled that the police do not have a positive duty to perform their job.
Which makes sense.  Take the simple example of a hostage situation, if they have a positive duty to do something, then any time spent trying to negotiate a peaceful ending would be considered criminal. Police have discretion as to when and how to enforce the law, and it is their managers and supervisors (and to a lesser extent the people) who determine if they are doing an adequate job, not the courts.
So, depending upon the exact type of law enforcement officer they are, they may legally be able to tell both the President and the mayor to go away and stop bothering them.
Answer: It varies. In some cities the mayor does control city workers including police officers. In other cities there will be an elected board that has that control and the mayor is only one member of that board or there may not even be a mayor. This control is often indirect with the mayor or board having to work through a chief of police.
However there are also sheriffs deputies. In most places the Sheriff is an elected official at the county level. They do not answer to the mayor or board of a city. Then there are state police or highway patrols that answer to the State's Governor. In some cases like South Carolina where I currently live, there is also a State Law Enforcement Division called SLED that assists local law enforcement with investigations.
Commonly if there is a crime within city limits, the city police will handle it, if it is outside of the city limits the Sheriff's office will take it. and if it is on an interstate highway or other major highway the state police will usually respond. However there is overlap. A city police officer can give you a traffic ticket on an interstate that pass though city limits. Out in more rural areas a state trooper might respond instead of a sheriff it they are closer.
Most likely this question is due to the public stance that many sheriffs have take against some of the new gun control measures that are being discussed. They see these new regulations as being ineffective, most likely unconstitutional, and actually harmful. There are many part of the USA where it will take considerable time for an officer to respond. People in rural areas tend to be self sufficient, including being able to defend themselves. Any Sheriff that enforces such unpopular laws will find themselves out of a job after the next election.
Police have always had discretion on enforcing laws. For example someone pulled over for speeding and they have a small amount of marijuana, the officer may just dispose of the drug and only give them a speeding ticket instead of charging them with drug possession or they may decide to charge them.
Comment: While this is interesting information none of it addresses the question of answering to the president or mayor first.


Mouse pointer not captured in virtual box

Question: I've installed android x86 into my windows 7 OS via virtual box. Though I can see a small window saying "The Virtual Machine reports that the guest OS supports mouse pointer integration. This means that you do not need to capture the mouse pointer . . .", I can't see the mouse pointer within the virtual box window whenever I move the mouse over it. What has went wrong? Is the mouse pointer playing an invisible game with me? Or, Is it not captured at all? Help me see the mouse pointer. Thanks in advance.
Answer: Try to Just disable "Mouse integration" in Machine tab: http://code.google.com/p/android-x86/issues/detail?id=341
Or by right-clicking the mouse icon in the bottom right corner of your VM window and picking Disable Mouse Integration
Comment: @Dims you can always do it by right-clicking the mouse icon in the bottom right corner of your VM window and picking `Disable Mouse Integration`
Comment: There is no "Mouse integration" option in Machine tab in latest versions of VB.
Answer: I am running a Windows 7 box with VB running an insider view of Windows 10 and I was getting the same message, what I needed to do was go into settings>system and under pointing device change it from ps2 mouse to usb tablet and I was able to work in and out of the VM without holding down the home key. took a bit of digging, but it works.
Answer: Answer as of 2017 and Virtual Box 5.x. And assuming that magic HostKey ist still the RightCtrl key (otherwise change accordingly)
In case your status bar is hidden:
1. If in full-screen-mode: RightCtrl-F to leave.
2. If no bottom status bar: RightCtrl-Pos1 to show.

3. You can check the mouse status at the bottom right:
Blue Mouse with green arrow is, what you will usually want. (One consistent pointer across host&guest, which in most cases requires virtual guest additions installed). (Btw: I could only check, not change mouse status there...)


Liferay CSRF protection with @ResourceMapping

Question: I need to add CSRF token (p_auth) to my Liferay (ver.6.1.1) portal project.
Liferay provides this ability out of the box with auth.token.check.enabled=true
But it does this only for requests marked with @ActionMapping annotation [source]. At that time, as I need CSRF protection for @ResourceMapping because I have a lot of ajax requests for form submitting.
Thank you for the advice.
Answer: You can find the way for implementation of protection in http://www.liferay.com/community/forums/-/message_boards/message/26782849


Why has "Samstag" been used more and more often than "Sonnabend" since 1950 (according to dwds.de frequency figure)?

Question: I've consulted dwds.de on the day name of Saturday. It is obvious that "Samstag" prevails nowadays like "Sonnabend" prevailed 70 years before.
The reason for this shift remains unknown to me.
Comment: [German Wikipedia](https://de.wikipedia.org/wiki/Samstag#Etymologie) has sections on the etymology of both words; apparently both have always been in use in different regions. (See [this map](http://www.atlas-alltagssprache.de/samstag/) for the distribution as of 2012.) *Sonnabend* was prevalent in the DDR, so I'm going to guess that any shift in popularity has something to do with reunification.
Answer: Saying that either version prevailed in German is a broad claim, as the different usage splits German landscape for more than a millennium in a south-westen region using Samstag and a more north-eastern with Sonnabend. Not to mention that it as well goes along the split between Catholic and Protestant regions. Confession has done a lot to solidify the split since the 15th century.
A 'Why' for a change is never a hard fact, but what can be noted is that expansion or contraction of usage in recent history goes somewhat in line with political changes.

Between 1870 and 1945 Protestant Berlin with native Sonnabend had a major role in setting nation wide wording - of course with exception for Austria and Switzerland.

After 1945 and until 1990

In Western Germany traditional western/southern influences of Samstag was not only more widely used, but moving capital and government to Catholic Bonn gave it an additional push, while
Eastern Germany not only kept Berlin as center of power, but was almost entirely made up of areas where Sonnabend was native.

After 1990 West German norms were almost instant assumed to be the way for reunified Germany, wich included the now 'official' Samstag.

Was it in the past often a matter of congregation so took modern media that role in recent centuries. A great anecdotal evidence for the shift after 1945 in Western Germany can be found in the history of Tagesschau, Germany's most watched (and influential) news program. Being located in Hamburg, they originally used Sonnabend when referring to Saturday in weather forecast and alike - and received stiff opposition from southern Länder like Hesse, which resulted in a switch to Samstag in the late 1950s. Eventually the time when people started to care again for more than just rebuilding:)
Being the programming watched by almost everyone owning a TV, way into the 80s, their language formed national habit (*1). A bit like US Broadcast English or British RP.
Now what's a bit funny in that context is that not only the producing station (NDR) still uses Sonnabend in most of their other programming, but Tagesschau as well uses Sonnabend every now and then, most notably on their web pages.
Considering this, I'm pretty sure there will no over all 'win' in German speaking regions within the next centuries. It's quite solidified, much like Krapfen vs. Berliner vs. Pfannkuchen.

*1 - Their power in language forming has been shown just recently with the introduction of Belarus in all programming. Until then many Germans didn't even know that Weißrussland called itself Belarus - now, a bit more than a year later Belarus is thought to be the default naming.
Comment: Last time I checked, bus time tables in Berlin still used Sonnabend.
Answer: Accepted wisdom is that in train timetables the abbreviations had to be distinct, so shortening Sonnabend to Son is not helping anyone, since Sonntag is shortened to Son too. Samstag shortens to Sam, so the railways used it in timetables and it caught on.


What can happen as a result of using (nolock) on every SELECT in SQL Server?

Question: I get that the (nolock) optimizer hint allows for "dirty reads", but under what very specific scenarios is this a bad idea? I've never seen such widespread use of (nolock) in an organization, and it makes me nervous. I'd like an explanation in terms of user stories. "Paul does A, Peter does B, X happens instead of Y".
Answer: Reposting this answer:

NOLOCK means placing no locks at all.
Your query may returns portions of data as of before UPDATE and portions as of after UPDATE in a single query.
Like, a debit without a credit and these kinds of stuff.
For instance, I just ran this query on a large table:
SELECT  SUM(LEN(name))
FROM    master WITH (NOLOCK)
OPTION (MAXDOP 1)

---
18874367

All name's have length of 1.
Then I reran it and in the middle of the query updated the table:
UPDATE  master
SET     name = 'tt'
WHERE   id <= 10000

SELECT  SUM(LEN(name))
FROM    master WITH (NOLOCK)
OPTION (MAXDOP 1)

---
18874944

As we can see, this query noticed 577 rows as updated (length 2), all other rows as not updated (length 1).
SELECT  SUM(LEN(name))
FROM    master WITH (NOLOCK)
OPTION (MAXDOP 1)

---
18884367

And this query, run right after the previous one finished, sees all updates.
Comment: Doesn't re-posting an answer imply the question as duplicate?
Comment: "NOLOCK means placing no locks at all." This is not correct. NOLOCK = igNOre LOCK (not official). Aaron Bertrand points out that NOLOCK hint queries will take out locks in this article: https://www.sentryone.com/blog/aaronbertrand/bad-habits-nolock-everywhere
Answer: I recently spent a great deal of time figuring out some time and blocking issues for a data warehouse build process.  As it turns out, due to the read-only nature of the data for loading the warehouse, I added nolock hints to the source data queries for the etl to reduce the requirement for lock escalation on the sql server and kept the etl load from failing.  For this one I had very little control over the sql server and the application.  Again, this was a targeted solution and I don't recommend widespread use of any query hints as a general rule.  Like all performance testing and review, there are key areas to look at to determine where the problem lies and what might be the best way to attack it.
Comment: If your source data was read-only, why did it matter if a shared read lock was placed on it? Maybe I misunderstood what you wrote?
Comment: This is not an answer to my question, it's advocacy for NOLOCK as a strategy. Opposite of what I'm looking for. -1.


How can I upgrade specific packages using pip and a requirements file?

Question: I'm using pip with a requirements file, in a virtualenv, for my Django projects.  I'm trying to upgrade some packages, notably Django itself, and I'm getting an error about source code conflicts:

Source in <virtualenv>/build/Django has version 1.2.3 that conflicts with Django==1.2.4 (from -r requirements/apps.txt (line 3))

That's after updating the version number of Django from 1.2.3 to 1.2.4 in my requirements file.  I'm using this command to actually do the upgrade:
pip --install --upgrade -E `<virtualenv dir`> --requirement `<requirements file`>

I can't find any flag that triggers a total package re-download.  I even tried running an uninstall command first, and then the install, but no dice. Am I missing something?
Comment: Please check @dr-jimbob 's answer because recent versions of pip will actually upgrade all other dependencies that the package you are upgrading depends on.
Comment: @gcaprio I'd rather advice you to choose marcin swierczynski answer now
Comment: In an app that has a `Django` backend and `Angular` frontend, should the `requirements.txt` file be in the root directory (and run there with `py -m pip install -r requirements.txt`) or should it be in the backend folder where files such as `manage.py` are located?
Comment: Every so often you get a message from pip itself, asking you to upgrade it and it gives you the command to do so. So just use the same command but for another package.
Answer: I ran the following command and it upgraded from 1.2.3 to 1.4.0
pip install Django --upgrade

Shortcut for upgrade:
pip install Django -U

Note: if the package you are upgrading has any requirements this command will additionally upgrade all the requirements to the latest versions available.  In recent versions of pip, you can prevent this behavior by specifying --upgrade-strategy only-if-needed.  With that flag, dependencies will not be upgraded unless the installed versions of the dependent packages no longer satisfy the requirements of the upgraded package.
Comment: ATTENTION, it also **updates all dependencies** and can mess up with everything. the best option is to uninstall and reinstall the package.
Comment: to upgrade specific package use `pip install --upgrade django==1.4.0`
Comment: This for me updated all my packaged and totally messed up everything!!!! Documents states: --upgrade all packages to the newest available version. Is this correct or did I do something wrong?
Comment: @OrbiterFleet I needed to update "requests" so I did `pip install Requests --upgrade` and *only* "requests" was upgraded.  The description says "upgrade all *specified* packages" when I view the docs.
Comment: this should be the right answer according to question or the question itself is wrong.
Comment: Is that the proper syntax highlight for the command lines (*not* a rhetorical question)?
Comment: `pip install -U ` and `pip install --upgrade ` are also valid syntax
Comment: If you are using `pipenv` you run the command `pipenv update PackageName`
Answer: First make sure you have checked the most voted answer.

I'm not sure if it's exactly your problem, but in my case, I wasn't able to upgrade Django to 1.2.4 - I was always finishing with 1.2.3 version, so I uninstalled Django with:
<virtualenv>/bin/pip uninstall Django

Then I removed <virtualenv>/build/Django directory and finally I installed the proper version with:
<virtualenv>/bin/pip install Django

Comment: This is not the best practice. Use `pip install Django -U` or `pip install Django --upgrade` as described in @JoeyG 's answer.
Comment: @Ahmad agree. There should be a smooth update process in pip and virtual env.
Answer: According to pip documentation example 3:
pip install --upgrade django

But based on my experience, using this method will also upgrade any package related to it. Example:
Assume you want to upgrade somepackage that require Django >= 1.2.4 using this kind of method it will also upgrade somepackage and django to the newest update. Just to be safe, do:
# Assume you want to keep Django 1.2.4
pip install --upgrade somepackage django==1.2.4

Doing this will upgrade somepackage and keeping Django to the 1.2.4 version.
Comment: Good catch but your explanation is confusing since you started with `django` as a main package then in the example you use `somepackage` and then use `django` as a dependency.
Comment: Yes it should be `pip install --upgrade django==1.2.4` without the "somepackage"
Answer: The shortcut command for --upgrade:
pip install Django --upgrade

Is:
pip install Django -U

Comment: How about editing the existing answer to add this bit of information instead of an (incomplete) answer?
Comment: I mean you could edit the answer given by JoeyG, adding the shortcut option you provided in context there.
Comment: @a1an please suggest what extra info that you think should be added in a "suggested edit". Thanks
Answer: If you only want to upgrade one specific package called somepackage, the command you should use in recent versions of pip is
pip install --upgrade --upgrade-strategy only-if-needed somepackage

This is very useful when you develop an application in Django that currently will only work with a specific version of Django (say Django=1.9.x) and want to upgrade some dependent package with a bug-fix/new feature and the upgraded package depends on Django (but it works with, say, any version of Django after 1.5).
The default behavior of pip install --upgrade django-some-package would be to upgrade Django to the latest version available which could otherwise break your application, though with the --upgrade-strategy only-if-needed dependent packages will now only be upgraded as necessary.
Answer: If you upgrade a package, the old one will be uninstalled.
A convenient way to do this is to use this pip-upgrader which also updates the versions in your requirements.txt file for the chosen packages (or all packages).
Installation
pip install pip-upgrader

Usage
Activate your virtualenv (important, because it will also install the new versions of upgraded packages in current virtualenv).
cd into your project directory, and then run:
pip-upgrade

Advanced usage
If the requirements are placed in a non-standard location, send them as arguments:
pip-upgrade path/to/requirements.txt

If you already know what package you want to upgrade, simply send them as arguments:
pip-upgrade -p django -p celery -p dateutil

If you need to upgrade to  pre-release / post-release version, add --prerelease argument to your command.
Full disclosure: I wrote this package.
Comment: is there an option to upgrade all packages at once (ie, without listing them) with this approach?
Comment: @MikePalmice yes: `pip-upgrade -p all` will upgrade all your packages and update requirements file without needing any input from you.
Comment: Doesn't fork for me. Helped finally: pip install -r requirements.txt --upgrade
Answer: This solved the issue for me:
pip install -I --upgrade psutil --force

Afterwards just uninstall psutil with the new version and hop you can suddenly install the older version (:
Answer: Defining a specific version to upgrade helped me instead of only the upgrade command.
pip3 install larapy-installer==0.4.01 -U

Comment: this works for me Python 3.8.1
Answer: Normally, pip will clean up after itself and remove the contents of the build directory. The only time it doesn't do this is if:

You used the --no-install option
You are using editable packages
The installation was cancelled or was otherwise interrupted.

In all other cases, you shouldn't have build directory that's clogging your environment.
Answer: to upgrade your package
pip install --upgrade YOUR_PACKAGE_NAME==VERSION

from requirement file
pip install --upgrade -r requiremnet.txt

Answer: I use this:
pip3 install -r  requirements.txt


How do I use minecraft when using a new account?

Question: I forgot my password and lost access to my email, so I made a new minecraft account. Now all I can play is the demo, how do I play the full game without paying for it again?
Comment: Possible duplicate [How can I recover my account?](https://gaming.stackexchange.com/questions/278757/how-can-i-recover-my-account)
Comment: For account issues, you should address mojang's customer service. They should be able to help you out if you have the activation code at hand.
Comment: How did you make a new account without the email/password?  Or did you purchase a second account?
Comment: This is a classic [XY problem](http://xyproblem.info)
Answer: Contact Customer support
To play the full version of Minecraft, a paid account is necessary. Since November 2012, a Mojang account is the type of account used to play Minecraft.
Here is an overview of the different account types and what is used to log into Minecraft:

Mojang Account
Currently, all Minecraft: Java Edition purchases are attached to a Mojang account.
  You have registered a Mojang account and log into account.mojang.com with your email address.
  After you make your purchase, you can select a Minecraft username and log into the game.
If you created a Minecraft account prior to November 2012, the following may apply to you:
Mojang Account (migrated from Minecraft account)
You have migrated your paid Minecraft account to a Mojang account.
  You use your email address to log into Minecraft and Mojang services.
  You no longer log into Minecraft and minecraft.net with a username.
Minecraft account - paid (formerly known as premium)
You have purchased a copy of Minecraft from Minecraft.net.
  You use your Minecraft username to log into Minecraft services, and can access the full game.
  You can reset the password and migrate the account to a Mojang account by visiting account.mojang.com/migrate.
Minecraft account - unpaid
You have previously registered a Minecraft username but did not purchase the game.
  You use your Minecraft username to log into Minecraft services, but are unable to use services other than demo mode.
  These accounts were deleted in February 2015, and the usernames were made available to all, except those accounts that had purchased a gift code.

If your old, paid account is a Mojang account, then access to the E-Mail address will be necessary to recover your password.
If you have any documents that show that you bought the game (receipt with the transaction ID, or the gift code, if the game was gifted to you), you could try contacting Mojang Customer Support to try and retrieve the Mojang account and change the associated E-Mail address.


String DataColunm in DataTable :Limiting the length of the string

Question: I have a requirement whihc I have to set a limit on the length of a string.
If the length excedes the limit then i want to truncate the string. I doing it DataTable and adding string DataColumns.
Comment: What is the consumer of the DataTable?  How is it being presented?
Answer: I think something like this would work...

myStr = myStr.Length > maxLen ? myStr.Substring(0, maxLen) : myStr;

Depending on what your code looks like; you might need to make sure myStr isn't null before you evaluate this line.  But, if myStr is longer than the max Length, it gets truncated; otherwise you my myStr.
MyStr.Length will fail if myStr is null.
This would be done as strings are added to the DataTable.
If you want to truncate strings that are already in the dataTable, I might be misunderstanding the question.  You can set the .MaxLength property on the dataColumn, but I believe that will not truncate data.
Comment: I am inserting from to another, while inserting to another table i want to truncate the sting to the max length.
Answer: Doesn't DataColumn have a MaxLengh property?  I've not tried it out but shouldn't it work?
Comment: It does; but I believe it only throws an exception.  It won't truncate.


Change Relative Size of Multiple Monitors

Question: When configuring multiple monitors for Windows 10, how can I change the relative size of one monitor to the other in the Display Settings? To be more clear, if I have a 27-inch 1440p monitor and a 4k 27-inch monitor, the 4k monitor shows up as a bigger monitor in the display settings. This causes the pictures to look identical, but in real life, there is an offset as if the monitors were not of identical size. The 1440p shows as a smaller monitor and acts as a smaller monitor. Is there anything I can do, or would I have to deal with it?
Comment: When you say there is an offset, what do you mean exactly? How does the 1440p show and act as a smaller monitor?
Answer: I know this is an old post but since it has always been the top results of a Google search, I'd like to post my finding here. Please try this free and open source software: LittleBigMouse.
Here's a screenshot:

As you can see, this program has detected that the two HSD2469 monitors at the top are physically larger, even though their resolution is smaller. Press the play button to enable its functionality.
Comment: Maybe not for the OP but this was exactly what I needed. Thanks. And I donated.
Comment: Thanks, I really was looking for something like this :-)
Comment: AWESOME! Solved my problem perfectly, much better than the other solutions. I love how the program even new the physical sizes of my monitors, why doesn't Windows do this? Direct link to exe download is https://github.com/mgth/LittleBigMouse/releases
Comment: This solved my problem, thank you !
Comment: This probably avoids the annoying mouse jumpings and is helpful for the OP, but I don't think it is an answer to OP's question.
Comment: amazing, thank you
Comment: Thank you so much, this was the exact solution I needed for my own problem!
Answer: If you have an Nvidia card you can set up custom resolutions and have an artificial higher resolution for the larger screen.
The problem is that the text gets blurry. I believe this is a type of supersampling.
In the Nvidia control panel open the custom resolution window.

Then create a custom resolution. The first part (blue) is what windows thinks the resolution is, the second part is what is really sent to the monitor (red).

Here Windows renders a 2304 x 1269 screen, while it is sent as a 1920 x 1080.
A second alternative is to use Nvidia's DSR. It has the same effect but the text is less blurry, instead it has some artifacts like if it was compressed.
For that, in the Nvidia control Panel, go to 3D-Settings > Manage-3D-Settings.
Then for DSR-Factor chose a scaling coefficient. If you choose 2.00x, you'll have access to resolutions twice as big in Windows, while the disgnal will still be corresponding to your monitor's characteristics. You can play with the option DSR-Smoothness to see if you can improve readability.
Answer: To get you right: You have Monitors with the same physical dimensions, but different resolutions and want to avoid windows jumping in height when moving them to the other screen?
Your PC does not know anything about the Physical Size of your Screens (27"), so he thinks that your Monitors have a different Size, as they have different resolutions. That's the reason, why Windows shows the 4k monitor as a bigger rectangle in the display settings.
This leads to the situation, that application windows have a different size on monitor A than on monitor B.
There is simply no way to align two monitors with different resolution without an offset.
But Windows has built in the Feature of Display Scaling, which basically renders a Monitor to a different resolution. You maybe already use this feature on your 4k monitor. It is very common on today's Laptops, which have a small but high resolution display, otherwise everything would be way to small to read.
(This works similar to Apple's retina technology).
To align both monitors without offset, you would have to scale down the monitors, so that their (vertical) resolution fits:

4k Monitor: 3840 × 2160 Pixel

2nd Monitor: XY x 1440 Pixel
=> Scale down the 4k Monitor by factor 0.66 (in other words enlarge elements by 1.33) and it should fit.

If scaling is not supported by this factor in Windows, you could lower the resolution on the 4k screen to XY x 1440 px.
This however has two disadvantages:

You loose effective Space on your display
The scaling Factor of 0.66 is not a power of 2, so elements like text look probably very fuzzy on the Monitor.
Comment: Thank you. This is what I assumed, but I thought windows/some 3rd party software had a way to override the intuition behind the different resolutions.