How does the change in the center of mass affect the time period of Bob?

Question: We know that the change in mass does not affect the time period of a pendulum. Will a change in the location of the center of mass of the bob affect the time period?
Comment: Position of the centre of mass changes means lenght of the pendulum changes which does impact the time period
Comment: Related:  http://physics.stackexchange.com/q/80287/25301
Answer: The length of pendulum is the distance from the point of suspension to the centre of mass of Bob. So if you change the centre of mass the length of pendulum would be affected affecting the time period
Answer: Let us take a general case where an object $O$ is oscillating from a fixed point $P$.

$C$ is the center of mass of the object $O$.
$P$ is the pivot point about which the object rotates (axis-of-rotation).
$N$ is the normal force exerted on the object $O$ by the pivot $P$.
$$$$
Let the moment of inertia of the object $O$ be $I$.
Let the distance between the point $P$ and point $C$ be $l$ (distance between the center of mass $C$ and the pivot $P$).

$$$$
We can write the torque equation for the object $O$ about the point $P$. The only forces which are acting on the object are the normal force ($N$) and the gravitational force ($mg$). Since the normal force $N$ is acting on the pivot, the torque due it is zero. Therefore, only gravitational force provides the torque.
$$\vec{\tau} = \vec{l} \times m\vec{g} \tag{1}$$
$$\tau = I\alpha = -mgl \sin\theta \tag{2}$$
The negative sign appears as the torque always tries to reduce the angle $\theta$.
Simplifying equation $(2)$ further, you get:
$$\frac{d^2 \theta}{dt^2} = -\frac{mgl}{I} \sin\theta \tag{3}$$
For small angles of $\theta$, the following approximation holds:
$$\sin \theta \approx \theta \tag{4}$$

Using $(4)$, you can rewrite $(3)$ as
$$\frac{d^2 \theta}{dt^2} = -\frac{mgl}{I} \theta \tag{5}$$
The general equation for a quantity $\phi$ varying harmonically without damping is given by:
$$\frac{d^2\phi}{dt^2} = - \omega^2\phi \tag{6}$$
If you observe carefully, the equation $(5)$ is similar to equation $(6)$. Comparing the two equations, you get:
$$\omega^2 = \frac{mgl}{I}$$
$$\omega = \sqrt{\frac{mgl}{I}} \tag{7}$$
As you already know, the time period is related to $\omega$ as:
$$T = \frac{2\pi}{\omega} \tag{8}$$
Substituting $\omega$ from $(7)$ in equation $(8)$, you get
$$T = 2\pi \sqrt{\frac{I}{mgl}} \tag{9}$$
The above equation gives the time period for any object oscillating harmonically without damping with small amplitudes.
A pendulum is just a special case of the above generalization.

Substiuting the values for the variables in equation $(9)$, you get:
$$T = 2\pi \sqrt{\frac{ml^2}{mgl}}$$
$$T = 2\pi \sqrt{\frac{l}{g}}$$
As you have seen in the derivation, $l$ is the distance between the pivot $P$ and the center of mass of the rotating object $O$. Therefore, moving the center of mass effectively changes the distance between the center of mass and the pivot. This causes a change in time period.


Automatically format sourcecode in Netbeans on save?

Question: One Feature I miss from Eclipse are Save Actions for autoformatting. Any way to have the same in Netbeans?
Answer: Starting with NB 7.3, go to Tools -> Options -> Editor -> On Save
You can select reformat and remove trailing spaces for any language.
You will need to specify the reformat option to "all lines" if you want it to format all of your code
Comment: unfortunately this only removes trailing spaces, it does not apply the code format you'd have defined for the project
Comment: Waaaw, it really worked for me too, I didn't know that 7.3 made this important feature, we called for this for yeaaaars!
Comment: @OSdave may have encountered the issue of separate global and project settings. Changes to global options will not affect a project unless the project is configured to use global options. To check a projects formatting (and toggle global/project specific options):
Highlight the project in the Projects dialog and Choose: File > Project Properties (or Right click the project and choose Properties) and in the Categories section of the launched dialog, Choose Formatting.
Comment: This option is still at the same place (current NetBeans version: 11.2).
Answer: For Netbeans 8.2 running on Mac. Here are the steps.
1.Click Netbeans --> Preferences
2.Click on the "Editor" tab
3.In the Editor tab click on the "On Save" tab.
4.Click on the Reformat Combo Box and select the option "all lines"
Thats it, you are done.


Can Lord Vishnu be a Kuldevta?

Question: Today my grandfather told me that our Kuldevta is Lord Vishnu and I had a hard time believing it. Is it possible to have Vishnu as a Kuldevta? If yes then which Rishi was originated from Lord Vishnu?
Comment: why not? most vaishnavas have vishnu (in archa-murti form at some temple or holy site) as kula devata.
Comment: @ram I've read this in another answer that if you trace back your ancestors, you'll find that they were oroginated from a Rishi who himself was originated through your Kuldevta. Does that mean they are originated from Lord Vishnu himself? It's hard to believe because he's one of the biggest Gods hindus pray to.
Answer: Yes, this is absolutely possible.
A famous example: The kuladevata of the Travancore royal family was Padmanābha, Lord Vishnu. The kings from this house even carried the title "Padmanābhadāsa", servant of Vishnu. They considered Lord Vishnu to be the true ruler of the country and themselves to be mere custodians.
The kuladevata of most Iyengar brahmins (who belong to the Sri Vaishnava tradition) is Vishnu.

Can Lord Vishnu be a Kuldevta?


resetting my Nexus 7

Question: recently, I downloaded Android 5.0 on my nexus 7. I hate it, and want to reset my tablet. If I do, will that take me back to the original factory setting (4.1), and if so, can I upgrade to 4.4 kit kat?
Answer: No resetting will not put you back on any previous versions of Android. In order to do that you will need to flash whatever version that you want.
I suggest using Wugfresh Nexus Root Toolkit for downgrading. If you decide that you want to go back to stock, unrooted, and locked bootloader you have that option as well. This toolkit will be able to unbrick your device, if needed. It has all the necessary tools to do all the steps to flash another Android version. Plus it'll do the recovery, kernel, and bootloader as well.
Answer: "Resetting" your tablet would only perform a factory reset, which only wipes /data. In order to downgrade, the /system directory. In order for you to downgrade Android versions, you will need to install a custom recovery and flash the stock image.
To install a custom recovery on the Nexus 7, please see the Cyanogenmod Wiki page for the Nexus 7 and follow the instructions there.
Once you have a custom recovery, you can download the 4.4.2 OTA for the Nexus 7 from your recovery.
Note: The links provided are only for the Nexus 7, WiFi edition, codename grouper. Attempting to use this method on the Nexus 7 2013, codename flo, may result in adverse effects.

resetting my Nexus 7


What's the useful magnification for a scope with 70mm objective lens?

Question: Some of the spotting scopes which are e.g. 70mm claim to magnify terrestrial objects at 75x. But yet they cannot produce sharp and clear images at even 30x-35x.
While 90mm scopes can do a better job than them but still they stop  producing clear view at higher magnification.
So, I want to know is there a formula from which I can estimate (if not accurately tell) their useful magnification at which they are able to focus objects?
I came across this:
Magnification = Focal length / Eye piece focal length

But not sure if that works for what I am asking.
Answer: I make telescopes and telescope optics (mirrors). The question is actually pretty complex. I get it a lot, because most people believe magnification is the end-all-be-all of telescopes, but reality is a little different. Here's what I mean by that:
You are correct that the actual magnification of the instrument (how much bigger the image is, compared to the object) is given by the formula:
M = F / f

M = magnification
F = focal length of the objective
f = focal length of the ocular (eyepiece)

The formula seems to suggest that you could get near-infinite magnification from any telescope by just reducing f, the focal length of the ocular. And it's technically true.
But the question is - how much can I increase magnification before it's too much to be useful?
When you zoom into an image with Photoshop, at some point you start seeing the pixels; any zooming past that point does not reveal more details. Telescopes do not have pixels, but the image the objective provides does not have an arbitrary amount of details - just like with Photoshop, arbitrarily increasing magnification with a telescope past some point will only give you a messy blur (not pixelated, just blurry).
So how much is too much? It depends.
If you had perfect optics, used in perfect conditions, then the maximum useful magnification would be:
Mu = 2 * D

Mu = maximum useful magnification
D = diameter of the objective in mm (a.k.a. aperture)

So for an instrument with a 75 mm aperture, the maximum useful magnification is around 150x. If you increase magnification past this point, the image is bigger, but it also gets progressively more blurry, so no additional details are revealed. But those are ideal numbers.
In practice, optical elements (lenses, mirrors) are not perfect. Only the most expensive instruments have optics that are anywhere near perfection. Imperfections add to the blur.
Even with perfect optics, if the telescope is not perfectly collimated (the lenses and mirrors are not perfectly aligned), that reduces performance too. Most refractors are collimated from factory and need no adjustment, but some cheap refractors may not be perfectly collimated. Other instruments such as dobsonian reflectors need periodic tuning to redo their collimation. When the instrument is miscollimated, the maximum useful magnification is reduced.
The atmosphere is turbulent. This is called "seeing" in astronomy. When seeing is bad, extra blur is added to the image, and you have to dial down the magnification.
Finally, magnification is not the ultimate parameter of a telescope. When you buy a car you don't ask the dealer "what's the fastest car you have?" You adjust the speed of the car to the conditions: drive at one speed on the freeway, at a different speed in a residential neighborhood, and at yet another speed in the parking lot at the local grocery store. Same with telescopes.
Some objects require a lot of magnification - things like Mars at opposition, or certain double stars, or small craters on the Moon, these all benefit from the highest magnification you could get. But objects such as Jupiter are better seen at more like a medium or medium-high magnification (Jupiter is low contrast so too much magnification washes out detail in most cases - but not always). And then there are nebulae and clusters which are better seen at low magnification. Horses for courses.

So what's the actual answer?
Well, you have the upper limit set in stone: 2 * D, or 150x for a 75 mm scope. But that's more like a theoretical bound. In practice the actual value will rarely be equal to that, usually will be a little below it, and sometimes much below it.
And then you have to choose your magnification based on the actual object you're observing: high, medium, or low.
This is why for experienced astronomers magnification is just a number. They've learned to adjust the instrument to the local conditions, to the object being observed, and even to the characteristics of the observer (younger folks tolerate very high magnification better than older ones - something to do with the narrow size of the beam of light exiting the scope at high magnification, then hitting floaters and other defects that accumulate with age).
This is why most people end up with a handful of eyepieces, and choose the best one depending on each case.
Comment: This is a great answer and explanation of the real-world issues around magnification and telescope use. I think future magnification questions can be linked back here rather than re-answered over and over.
Comment: Great answer Florin. Just my practical experience here: I use a 200mm reflector which (according to the formula) should be good up to 400x. The best I've been able to do in the last couple of years is a 5mm eyepiece which, on a 1000mm focal length, comes to 200x. This works well in good seeing conditions.
Answer: You are correct that magnification is the Telescope Focal length / Eye piece focal length.
For an F/10 70 mm refractor, the focal length is 700 mm.  A common 20 mm eyepiece will get 35x.
With excellent optics, a good rule of thumb is the maximum useful magnification is about 1.5x the telescope's aperture in mm.  So an excellent 70mm F/10 refractor might be useful up to 105x, which corresponds to a 7mm eyepiece.  If you have a fast, F/5 spotting scope, the maximum magnification would come with a 3.5mm eyepiece; eyepieces with such short focal lengths tend to be hard to use.
Very cheap telescopes may have misaligned or badly figured optics, however, and the maximum useful magnification may be much lower.  To get maximum performance, the eyepieces have to be high-quality as well.  Spotting scopes tend to have lower focal ratios so they can be more compact; this requires more strongly curved surfaces on the lenses and makes them harder to figure correctly.  All telescopes, regardless of price, need to be correctly aligned to get good performance.
Comment: Thanks for the reply. I am trying to figure out the magnification for [this particular scope](https://static.bhphotovideo.com/lit_files/85024.pdf). It claims to have 75x magnification but from the formula can I calculate till how much magnification it will be to focus at objects?
Comment: @user12313: with the standard zoom eyepiece it should focus at any magnification in the range 25 - 75 times. There is the option to replace the zoom eyepiece with a standard 1 1/4 " eyepiece, and then you can apply the formula directly, but noting antlersoft's comment (albeit a really good 70mm scope should be capable of 150 times in excellent seeing conditions).


How do I know what version of Salesforce for Outlook my users are using?

Question: I need to know without having to send all my users an email, what version of Salesforce for Outlook they are all using. I've downloaded a login history report but I'm not sure there's anything in there pointing out to the version they currently have.
Answer: This is an interesting question and the short, and painful, answer is that there isn't a fully accurate way of getting this data without assistance from your IT department, who should have/should be able to create a list of PC names which have Salesforce for Outlook apps installed on them and the corresponding versions. And if they don't have a fully up to date list of which PC name belongs to which colleague, then you're essentially back to square one. Second best option is to query the LoginHistory sObject via Query Editor or Workbench.
The Salesforce for Outlook .msi version is generally deployed by the internal IT team and in order to achieve this, the IT team need to know the PC names (on Windows, it is My Computer | System Properities | 'Computer Name') for the users who will get this app installed.
The blind spot here, in my experience, is that although the IT team will be able to get a list of all the PC names which have a SfO app installed and the corresponding version(s) (a machine may have more than 1 different version of SfO installed on it), they may not know to which that PC name belongs to. Obviously, people move around desks a lot etc.
So, if this were the case, you would be back to square one.
So what else can you do? This link is quite helpful and the least tedious way of achieving this would be to login to workbench or the Query Editor in the Developer Console and run this SOQL:
<code>*SELECT count(id), userid ui, ClientVersion cv FROM LoginHistory GROUP BY ClientVersion, UserId*
</code>
Unfortunately, one cannot filter on 'Application', so you can't say 'WHERE Application = 'Salesforce for Outlook'. This is because the sObject LoginHistory is very special (aka 'annoying') and there are a number of limitations on this object.
You will need to do a vlookup against the UserId to return the usernames but you will then see a grouped list of users by their login usage (count)id and their ClientVersion. Any user which has a ClientVersion value populated against it has that version of Salesforce for Outlook. For example '34.0' or '281.0' refer to 3.4 and 2.8.1 SfO versions respectively.
The blind spot here though, is that you assume that all users who have SfO, would be using it. But you probably can get most of the users.
What I have done in the past, when managing SfO for about 350 users, was to be religious with my own personal spreadsheet which logged every SfO version a user was on and their PC name at the time. I also used Outlook Configurations and put users on configuration A which had free text refering to the fact those users were on a certain version, and configuration B which had free text (i.e. 'Description' field) refering to those users as being on a different version.
Depending on the size of the company, users will move around from different versions, so keeping on top of which version users are on is important. Since functionality is different, it is best to standardise the version which users are on. In my experience, it wasn't ever worth updating users to a new version unless that new version had excellent functionality (the jump from 2.3.3 to 3 was a big enough of a 'pull').


Text Message showing up with wrong name on iPhone

Question: For some reason when my son sends my mother a text message it shows up with my name.  Texts from me show up in a different thread, but when I click on the "contact" from his it takes it to my contact.  I do not use Apple any more (my son does), but he does use the Apple ID I set up when I had my old iPod.  The only thing I can think is that is what's causing the problem, but I can't figure out how to resolve it.  Any suggestions?
Comment: Your son needs his own Apple ID. https://appleid.apple.com/account
Answer: Open settings, tap iMessage, then go to send and receive. From here, you may edit which messages are sent and received by her. See below for screenshots of the process.

Best of luck.
Answer: On your mother's phone, delete your Apple ID (it's linked to the email – that's the info you need to remove) from your contact info (the page you are brought to when you click the contact). Add this same piece of info to your son's contact card.
Your son should have his own Apple ID, but if you're not using it anymore I don't think it's necessary for him to create his own. He can change the email address to his own at appleid.apple.com
Alternatively, he could just make a new Apple ID, and you can keep your old one in case you ever get another Apple device. This is honestly probably the easiest solution, unless there is some reason you want him to use the other account.
Comment: The last paragraph seems very reasonable, but I don't get the "delete your Apple ID from your mother's phone" part. His Apple ID is not there. His son may be using iMessage and sending as his (OP's) email. The problem will reproduce on any receiver that has iMessage active, not only his mother's.
Answer: This was occurring on my iPhone 7 except that it was with non-family members or people outside my same Apple ID or phone plan. It started after a restore from a backup.
I was able to fix it by going into Contacts and clicking "Import SIM Contacts". Then import to iCloud. This lined my contacts, and conversations back up to the correct sender.


Delaying a Jquery function until Ajax is completely loaded

Question: I am using a plugin that uses jquery to pull an rss feed, and displays it after the content loads. I wanted to use jScrollPane so I can have custom scrollbars.
WithjScrollPane, it loads the scrollbars on pageload, but because  the rssreader loads content with ajax, the scrollbars aren't applied (it takes 4 seconds to load the rss content, and by that time, the scrollbars have already tried loading. Because no content was there, they dont appear). I need to use jquery to tell jscrollpane not to load the scrollbars until the rss is fully loaded. You can view the page here.
As you can see in the bottom left, the content is loaded, but doesn't display a scrollbar. I need a simple jquery command that says" do not run the jscrollpane commands until after the rss feed is fully loaded." Any ideas?
Comment: There is no callback function on the rss feed (i think), so how would I go about adding one to the existing code here:  http://vitaminjdesign.com/rss/jquery.rssreader-0.2.pack.js
Comment: couldnt i delay the loading of the scrollbar by 6 seconds? Its dirty, but it will work (assuming the rss loads in that timeframe)
Answer: You need a callback function on the rss feed plugin and apply the scoll bars plugin in it. If the rss feed plugin does not allow you to specify a callback function, you'll need to edit the code to add one.
Answer: if there is not a callback available on the rssfeed plugin you can use  setTimeout  checking until div newsfeed got some content from rssfeed . Then call jScroll and stop the timer . not an elegant solution but works


Using Boost.asio with cmake?

Question: I want to static link boost.asio to my small project without external libs (having only single exe/bin file in result to distribute it). Boost.asio requires Boost.system and i start to drown trying to figure out how to compile this all.
How to use Boost.asio with cmake?
Comment: Take a look at contents of `FindBoost.cmake`. You can find it in `Modules/` dir of CMake installation.
Comment: All boost components can be linked statically. What is your problem again?
Comment: i have googled it lots of times, every time i find some issue why i can't compile it. So i made Question how to exactly do it. I can't compile any part of boost with cmake, neither know how to use it on my project with cmake statically.
Answer: If I understand the actual question, it is fundamentally asking how to statically link against 3rd party libraries in CMake.
In my environment, I have installed Boost to /opt/boost.
The easiest way is to use FindBoost.cmake provided in a CMake installation:
set(BOOST_ROOT /opt/boost)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost COMPONENTS system)

include_directories(${Boost_INCLUDE_DIR})
add_executable(example example.cpp)
target_link_libraries(example ${Boost_LIBRARIES})

A variant that finds all Boost libraries and explicitly links against the system library:
set(BOOST_ROOT /opt/boost)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED)

include_directories(${Boost_INCLUDE_DIR})
add_executable(example example.cpp)
target_link_libraries(example ${Boost_SYSTEM_LIBRARY})

If you do not have a proper Boost installation, then there are two approaches to statically link against the libraries.  The first approach creates an imported CMake target:
add_library(boost_system STATIC IMPORTED)
set_property(TARGET boost_system PROPERTY
  IMPORTED_LOCATION /opt/boost/lib/libboost_system.a
)

include_directories(/opt/boost/include)
add_executable(example example.cpp)
target_link_libraries(example boost_system)

And the alternative is to explicitly list the library in target_link_libraries rather than the target:
include_directories(/opt/boost/include)
add_executable(example example.cpp)
target_link_libraries(example /opt/boost/lib/libboost_system.a)

Using Boost.asio with cmake?


cut or lengthen to reduce swr on vertical wire antenna

Question: Have tried measuring antenna wire using formula 234/frequency for 1/4 wave vertical but this gives high swr. How do I lower swr on a wire vertical antenna. Do I Cut or Add? wire'
Answer: If you're only measuring SWR at one frequency, or in a narrow range like the ham bands, you won't know until you cut it.
Mount the antenna in its final location as the SWR and resonant frequency will change a bit depending on the environment.
Because cutting is permanent, I recommend first extending the wire by 5% of its length, perhaps with a bit of aluminium foil and tape, or for lower frequencies and larger antennas, a crocodile clip lead. See if the SWR in your band goes up or down.
If it goes up, that's good, you can start trimming the antenna. Go slowly!
If it goes down, sorry, you've already cut it too short. You can extend it by soldering some wire to the tip. Fortunately the mechanical stress is low there so it doesn't matter if you use copper wire.
If you can measure over a wider band, like with a nanoVNA, then look for the minimum SWR - if it's at a lower frequency than you need, then cut the antenna slowly. If it's higher, extend it. (and if you're going to build any more antennas, I strongly recommend some sort of nanoVNA for your experiments).
Answer: The first consideration is that a 1/4 wavelength antenna has a wide bandwidth, it is not a high Q or high gain antenna. Don't worry about getting SWR as low as you can, it's not critically important and an SWR of 2:1 is just fine and won't affect your signal one iota. A VNA will give you the true picture of your antenna. If this is a VHF antenna, the best approach is to adjust the length of the whip, but take it easy!
Answer: Should you lengthen or shorten a radiating element to lower VSWR?
Well, one answer is to simply check your VSWR by transmitting on a higher frequency, if your VSWR goes down, you need to lengthen your radiating element for the frequency you want a lower VSWR for, conversely, if you get a lower VSWR when transmitting on a lower frequency than the frequency you wnat to use the antenna on, then you must shhorten it for the higher frequency you want to transmit on.  You can even use your formula to determine how much to cut or add:
Current Antenna Length - (234/Best VSWR Frequency) = If negative cut, if positive, lengthen.
IF you can't get a satisfactory VSWR anywhere near where you test, you have another issue that is not simply antenna length.


Is it true that Income Tax was created to finance troops for World War I?

Question: I remember hearing that income tax was specifically created to finance the war effort during World War I.  Is this true?  If so was it originally intended to be a temporary measure?
Comment: @JohnFX - Actually this question applies to more than just the United States.  Not sure if the UK is also affected by this question - folks from UK please feel free to comment.
Comment: I'm not sure I agree. I'm assuming each country made the decision to impose income taxes for their own reasons. It seems to me this question would have to be specific the country you were interested in. I assumed US (and added the tag thusly) because I had heard that story too about US taxation history.
Comment: Actually I had heard about this for the US, Canada and the UK and welcome answers for all 3.  I know that when income tax was introduced in most countries it was a contentious issue.
Answer: Canada did not introduce income taxes before World War I.  Specifically deficits forced them to in the later part of the war:

The Conservatives opposed income tax as they wanted to attract immigrants primarily from the United Kingdom and the United States, as opposed to Eastern Europe, and they wanted to give their preferred choice of newcomers some incentive to come to Canada. Wartime expenses forced the Tories to re-consider their options and in 1917 the wartime government imposed a "temporary" income tax to cover expenses. Despite the new tax the Canadian government ran up considerable debts during the war and were unable to forego income tax revenue after the war ended. With the election of the Mackenzie King-led Liberal government, much of the National Policy was dismantled and income tax has remained in place ever since.

So from a Canadian point of view they were introduced as part of the war effort.
Answer: The Income Tax was put into effect during the Civil War, but was later revoked because it was deemed "Unconstitutional".
It was re-instated in 1913, just one year before World War 1. This is largely the reason why people think it was created "for the war", when it actually pre-dated World War 1.
Edit: I don't have any sources, per-se. This is just what little information I remember from Grade 10 History class.
I remember this because I had a real ethical problem with how the government instituted the Income Tax, since it is effectively a tax on Productivity. I find this absurd, since it motivates people to do less, in an effort to be taxed less. This in turn promotes workers doing "cash jobs" and other such things to get around it.
I personally have refused a raise because it would put me into a higher tax bracket, and I wouldn't actaully see the new money. In exchange, I asked for other non-monetary perks instead. I personally think this situation should not exist.
...however, I don't have a better solution. So I suppose I can't really pass judgment.  :)
Comment: By the way, on your "refused a raise" anecdote:  Considering the tax system is progressive, and there being no "100%" tax bracket, you should *always* see *some* of the money you get in a raise.  But yes it's fair to say you don't get the full effect of a raise because the gov't gets a good share at marginal rates.
Comment: +1 cause I remember that from history class, but could you cite anything?
Answer: Income tax was seen as a way to exploit the revenues available from the rapidly expanding ranks of people with mid to high incomes. It was initially targeted at the very wealthy.
Previously, most Federal revenues came from excise taxes and tariffs, both of which have many negative economic effects, leave the government with limited revenue generating ability and bring a host of international and domestic political problems.
Since the successful implementation of the income tax required a constitutional amendment, it is very unlikely that anyone at the time seriously considered the income tax a temporary measure.
Answer: As regards the United Kingdom, this politics.co.uk page has a good history (under "Background"). Notable highlights:

It was introduced in 1799 as a temporary measure to fund the Napoleonic Wars (with France).
It remains to this day a "temporary" tax that has to be renewed each year in a provision of the annual Finance Bill.
It was repealed in 1816 (a year after the Battle of Waterloo) but re-introduced in 1842 to deal with massive public debt. At this time, it was levied only on the very rich.
Rates rose dramatically at the beginning of the 20th century, as did the number of people paying it. By 1918 the standard rate was 30% and by 1930 arond 10 million people were liable.
In 1944, the current system of deduction-at-source (Pay As You Earn, or PAYE) was introduced, as well as the system of "tax codes" that told employers how much to deduct, without revealing (too much) about an individuals finances.
Answer: I believe that in Australia it was a "temporary wartime measure".


Why did the letter X fall out of most Scandinavian languages, Dutch but not German or Icelandic?

Question: Every other Scandinavian I know, barely uses X and writes it as ks. Same with Dutch. So why does the letter X exist in German when it could be written ks in German? Why is the letter X so common in Icelandic and German when other Germanic languages barely uses it? Couldn't X be written gs in Icelandic?
Comment: For a very long time, language and orthography was driven by scholars. And a scholar would probably rather strangle himself than to write Latin loanwords with "ks".
Comment: @tofro: did the scandinavians have less scholars then or were these scholars more into choking than their german counterparts? ;-)
Comment: It is the same in Cyrillic. The is no letter corresponding to "x", one uses "ks".
Comment: @bakunin Swedish spells "maximal" as "maximal". Dutch as "maximaal". Maybe Danish scholars used to be more ruthless... (As you see, the OP's assumption that Icelandic with "x" is an outlier, severely lacks some proof. It seems that Danish with "ks" is)
Comment: And "Dutch uses no X"? Their former Queen, present Queen and present King all have an "X" in their first name.....
Comment: Please note: this site is about German language. Right now your question is off-topic since it needs expertise in a language other then German. Please rephrase.
Answer: It is never easy to answer a question about why something did not happen, but here is my take on it:
Obviously nobody (at least nobody with enough influence to initiate a spelling reform) saw a convincing reason to drop the x in favor of ks. After all, it makes all words with x one character longer. You could argue that children don't have to learn how to write the letter x but they will still have to learn it if they learn a foreign language that uses x.
The only reason to eliminate x in favour of ks is to make the spelling perfectly regular and phonetic, as having a distinct letter for the ks combination of sounds makes German spelling somewhat irregular. But while German spelling is more phonetic than e.g. English spelling, making the spelling perfectly phonetic and regular was never a goal in German spelling reforms as this was not seen as a worthwile goal.
There are several irregularities in German spelling with respect to pronounciation. In this regard, German differs from other languages where lots of effort was taken to make the spelling as phonetc as possible by the use of accents. For example, the German letter e can be pronounced in at least three different ways, and while there are ways to indicate that an e has to be pronounced long, these are not always used to indicate a long e. Any spelling reform with the goal of making German perfectly phonetic would have to fix this, maybe by the use of accents. But because for native speakers it is generally easy to tell how an e is pronounced, nobody (as far as I know) undertook to initiate a spelling reform to do this.
Comment: "it makes all words with x one character longer" - ... and still doesn't remove the inconsistency that quite some 'x' sounds are actually spelt 'chs' in German. Also, for most 'x' sounds written as 'x', the replacement should actually be 'cks' rather than just 'ks', to make it obvious that "Kekse" has a long 'e', while "Heckse" has a short one.


Is it safe to import my private key into another wallet?

Question: I sent some bitcoin to my bitcoin core wallet before it synced, not knowing this sync would take days, and was wondering if i was to import my private key into a different wallet if that would work?
Answer: It's safe as long as you're sure that no one else has access to that private key.
For example, you shouldn't import a private key someone else gave you. They could send coins to that key to make it look like they sent you money, and then steal them (since they have the key as well).
If it's just copying one private key on one of your own wallets to another one of your own wallets (both of which only you have access to), then you should be fine. Just be aware that coins given to that key will appear simultaneously in both wallets, and coins spent from that key will disappear simultaneously in both wallets as well. This doesn't sound like an issue in your case, since you won't be using the old one at all.
The alternative is to just do a standard bitcoin transaction to transfer it from one of your wallets to another. Although, I see that this is made difficult by the fact that your Bitcoin Core client not fully synced with the network.
Related: Did I just create counterfeit bitcoins?
Comment: Thanks, do you know the easiest way to import it? Thanks :)
Comment: That might warrant a new question if you can't find anything. It depends on what wallet you're importing into, so try looking at your wallet software's documentation. And don't forget to mark this as the answer if it answered your question! (green check mark)


Prove that if $d\mid\gcd(a,b)$, then $d\mid a$ and $d\mid b$.

Question: Prove that if $d\mid\gcd(a,b)$, then $d\mid a$ and $d\mid b$. I saw this used in proving another theorem but it was not proved. Does anyone know how to prove it?
Comment: The slightly trickier part is the other way: if $d\mid a$ and $d\mid b$ then $d\mid \gcd(a,b)$.
Comment: Hint: $\ d\mid c\mid a_1, a_2,\ldots\Rightarrow\, d\mid a_i\,$ by *transitivity* of the "divides" relation. In other words, this says that  a divisor of a common divisor remains a common divisor. $\ $
Answer: Because $\gcd(a, b)$ is the greatest common divisor of $a$ and $b$, it is a common divisor of $a$ and $b$, so we get $\gcd(a, b) \mid a$ and $\gcd(a, b) \mid b.$
Now, if $d \mid \gcd(a, b)$, by the transivity of factors, we get $d \mid a$ and $d \mid b$.
Answer: Hint:
$\gcd(a,b) | a $ and $\gcd(a,b) | b$
By transitivity of divisibility, $d | a$ and $d | b$.


Boundary of the set of critical points

Question: Let $u\in C^\infty(\mathbb{R}^d)$ and consider
$$ E = \partial\{x:Du(x)=0\}. $$
I am interested in understanding whether $\mu(E)=0$ or not, $\mu$ being the $d$-dimensional Lebesgue measure. What I could prove so far is that there exists a point $x\in E$ such that, for all neighborhoods $U\in U(x)$ we have
$$ \mu(E\cap \overline{U})>0. $$
Any idea on how to proceed with proving that $\mu(E)>0$, assumed that it is possible?
Answer: The measure $\mu(E)$ may be positive or zero.  It is easy to give examples of the case $\mu(E) = 0$, so below is an example in $C^\infty(\mathbb{R})$ with $\mu(E) > 0$.
In light of this post here, it suffices to exhibit a closed subset of $\mathbb{R}^n$ whose boundary has positive measure.  In the spirit of what you pointed out in your question, the so-called Fat Cantor Set is closed with empty interior (hence it is its own boundary).  Moreover, by computing a simple geometric sum one sees that it has positive measure.
Comment: It is possible to construct functions whose levels sets are a given closed set. However, in my case the function needs to be of the form $f(x) = |Du(x)|^2$ or something else such that $\partial f^{-1}(0)=E$. So maybe this constraint cancel the construction you are talking about.
Comment: @TommasoSeneci Let $f \in C^{\infty}(\mathbb{R})$ such that $f^{-1}(0)$ is given by the fat cantor set.  Such a function exists, as we agree.  Then just let $F$ be the antiderivative of this function.
Comment: you are right, thanks!

Boundary of the set of critical points


Is this business halal?

Question: AssalamuAlaykum. I'm trying to go into the cosmetology niche with web design. Meaning I create websites for businesses that specialize with cosmetology. Or even cosmetology schools. I know in these websites they show women with their hair and sometimes even awrah because that's what they teach you to do. How to cut hair, do nails, etc. Is it permissible to create websites for these people? The money I get means nothing if Allah doesn't like it.
Answer: AssalamuAlaykum. In response to your question about venturing into the cosmetology niche with web design, it's important to understand that any profession, including web design, is not inherently prohibited in Islam. However, it's crucial to conduct your work in accordance with Islamic principles. It is well known that displaying images, especially of women, can be problematic. Therefore, when developing websites for these businesses or schools, it would be wise to establish some rules that align with Islamic laws and share these with your clients. You could also select themes that are compliant with Islamic Laws. Indeed, the process may be challenging, but remember, for Muslims, faith (Iman) holds precedence over material gains. I hope this response provides clarity, but please feel free to ask additional questions if you have any.
Comment: Thank you brother. I don't want to transgress Allah's rules. So I decided to go and do a similar niche which is Dental. I believe it is more in fit with Islamic principle. Thank you.

Is this business halal?


Will my bags be checked to my final destination?

Question: I have a flight from Kathmandu, Nepal to Lubbock, Texas, USA on Qatar Airways with the DFW to LBB flight on American Airlines. Will my luggage be checked through to Lubbock, or will I need to collect in Dallas?
Comment: If Dallas is the OP's initial stop in the US, isn't (s)he going to need to collect their luggage there, and clear customs and immigration, regardless of whether the onward flight is on the same ticket or another one?
Comment: Is it a single booking, or separate tickets?
Answer: No. International baggage is never checked through to its final destination when transiting in the USA*, and it must be collected at your port of entry so that you can proceed through customs with it.
When you arrive at DFW, you will clear immigration, collect your hold luggage, and then pass through customs. After customs, but before entering the public area of the airport, you will find the AA baggage re-check desk. You will give them your hold luggage, and then enter the public area of the terminal. You can then walk or take a bus to the terminal your connecting flight leaves from, and pass through security. If you somehow miss the baggage re-check desk, you can leave your hold luggage at the appropriate check-in desk.
When you make the return journey, assuming the booking is a single ticket, your baggage will be checked through, and you will only have to clear security once, in Lubbock.

*Unless the airport you're departing from has pre-clearence, which it doesn't in this case.
Comment: Alright, thanks for the answers! That's how I thought it would be, but wanted to make sure! I was hoping Doha had pre-clearance, but they don't have it (yet). I only have 1hr35min in DFW so I'm hoping it's enough! I'm from the US so customs/immigration shouldn't take too long, but it'll still be really close!


Append and Prepend in slice 3D plot

Question: I am trying to get multiple StreamSlice in 3D and have a little confusion getting there.  I would like slices in the xy plane, yz plane and xz plane.  I would also like the ability to pick any plane. I am getting two plane slices, but when I try to get into the other plane I am unable to do so.  Also, I am not sure what Append and Prepend do in the Arrow function.  At first I thought it was appending lines, but if I change the code to Prepend[#,1] it shifts the plane over. The following is similar to my code:
ft[x_, y_, z_] := {y, -x, z}

gr1 = Graphics3D[(First@
  StreamPlot[ft[x, y, 0][[{1, 2}]], {x, -3, 0}, {y, -3, 3}]) /.
  Arrow[pts_] :> Arrow[Line[Append[#, 0] & /@ pts]]];
gr2 = Graphics3D[(First@
  StreamPlot[ft[0, y, z][[{1, 3}]], {y, -3, 3}, {z, 0, 3}]) /.
  Arrow[pts_] :> Arrow[Line[Prepend[#, 0] & /@ pts]]];
gr3 = Graphics3D[(First@
  StreamPlot[ft[x, 0, z][[{2, 3}]], {x, -3, 0}, {z, 0, 3}]) /.
  Arrow[pts_] :> Arrow[Line[Prepend[#, 0] & /@ pts]]];

Show[gr1, gr2, gr3]

I think from the code you can see what I am trying to get at.  I want the last graph gr3 to be in the xz plane.
Answer: gr3 = Graphics3D[(First @ StreamPlot[ft[x, 0, z][[{2, 3}]], {x, -3, 0}, {z, 0, 3}]) /.
    Arrow[pts_] :> Arrow[Insert[#, 0, 2] & /@ pts]];

Show[gr1, gr2, gr3]

Or, use Arrow[Riffle[#, 0] & /@ pts] instead of Arrow[Insert[#, 0, 2] & /@ pts]].

Append and Prepend in slice 3D plot


If you buy a physical copy on the 3DS, does it need to download?

Question: I own a Nintendo 3DS and I was wondering if you buy a physical copy of a game, e.g. Pokemon Sun, does it need to download?
Comment: What is it you expect to download? Updates, yes (though I'm not aware of any yet). The game, no.
Comment: @Nolonar The [1.1 update](http://serebii.net/sunmoon/patch.shtml) was released January 11.
Answer: When you purchase a physical 3DS cartridge, the cartridge contains the game on it. You will not need to download the game.
Note however that this is separate from game updates, which you will still need to download onto an SD card. I don't believe Pokemon Sun / Moon have any such updates yet, but if you were to buy, say, Animal Crossing: New Leaf, you'd need to download the updates that have been published since the release date.
Comment: Sun/Moon just had its first update released to fix some bugs that affects competitive play.
Comment: side note: You can still play without downloading the update. In nearly all cases, features like online play will require the latest update to a game. (as there's a server side check if the game version matches the server version.) - This feature is so that players without constant internet access can still play, but those with internet are required to play with the same update/security settings as everyone else.
Answer: You need to buy the game card (cartridge) that goes with it:

This isn't like a computer where you download stuff: all the memory is stored within the cartridge rather than the 3DS itself (speaking about the game memory). Updates may/will be downloaded onto the 3DS itself though.
Comment: Game updates may need to be downloaded to the 3ds memory.
Answer: If you have the physical game cartridge, then no. All data is stored on the game cartridge. Just note that while the game data is stored on the cartridge, update data is installed to the SD card
Comment: It's worth adding that while some games require the *system* to be updated before they're run, in those cases the cartridge has the system update on it, so you can install it from the cartridge without having to be online.
Answer: If you have the physical cartridge, you will only need to install/download updates for the software off of the Nintendo e-shop
Comment: Don't add a new answer just to repeat what others have already said
Comment: @n_palum To be fair, it does answer the question. It's simply a repeat of other answers


How to calculate the distance between vertices couples and show it as text

Question: I wish to create a function using geometry nodes that calculates the distance between consecutive vertices of a mesh, and adds text depicting the calculated distance between each pair of vertices, exactly at the center of the segment they form. I imagine I need to convert the mesh into a curve first, use the 'Geometry Proximity' node somehow, and also use the 'Value to String' and 'String to Curve' nodes... But this should be done in a loop, probably using fields, for every pair of vertex. I'm not sure how to proceed, normally I would include an example file, but I haven't been able to put together anything that makes sense. How should I go about this?
Answer: That can be optimised a bit if we only use the 11 needed base instances (meaning number from 0 to 9 and the dot).
The principle is the same:
Calculate edge lengths.
Iterate over the edges and sample lengths and positions.
Place instances calculated from the length at the edge position.

Now instances are first made from the "0123456789." text.
Its an iteration again, over the given text so that we create one text curve per character.

Then, another iteration from the length converted to text in order to associate the length text from the instances created above.

Result on a subdivided Suzanne:

 (Blender 4.0)
Comment: +1 really nicer solution!
Comment: Thank you, I really appreciated the feature that makes the text size proportional to the edge lengths, moreover, it was my intention to include it from the beginning but I did not specify it to avoid unnecessarily complicating the question and to get straight to the point. This was exactly what I needed. I was surprised to see how using more nodes makes the node tree more efficient; I would have expected the opposite, although I understand that this approach in the algorithm allows for saving on processing
Answer: with this node setup:

you get this:

Note: Try this out with a simple geometry. It is for sure not the
fastest solution, so for suzanne it can take a while

Note2: I recommend using a vertex group or another limiting factor so
that you show only "a few" distances for performance reasons.
Comment: Thanks, I manually recreated your node tree to learn and to better understand @lemon modifications. It worked perfectly, but when I tried the optimized solution from lemon I saw how much faster it is on my computer, and I am going to accept his answer because of this. Thanks very much for your time and for what you teached me and everyone


My photos disappeared from my Samsung S5 SD card. Trying to recover photos or find hidden files

Question: My photos disappeared from my Samsung S5 SD card.
I know SD cards get corrupted, but there were a couple of weird things that happened in conjunction with the disappearance. I saw a message on my screen briefly saying something about my photos not being gone. About a week later I saw them again just once when I went to look at other photos on the Google + app. I saw a suggestion to try to do a disk check on a computer to recover corrupted files. Disk check says the info cannot be directly accessed.I also have read that some files can be hidden. I need some help with this. Any ideas?
Answer: You can go to My Files, settings, check 'Show Hidden Files'. Now you can see hidden folders beginning with . (e.g. .hidden) in your device explorer. Check you sd card for such folders beginning with . that may contain your files. If not then you can connect your SD card via card reader to your PC and run the Windows app "Recuva" (search Recuva by Piriform) to search for deleted files.
Hope this helps :)


Will this setup allow me to grow a large jungle tree in Minecraft?

Question: I've been trying to grow a large jungle tree in a specific area, but the problem is nothing seems to be growing, and I'm not sure if the reason is how close it is to the walls or whatever the problem is.
Should this setup hail results, and if not, what can I do to fix it? How much space do I need on the side of the tree for it to grow?
Answer: According to Minecraft wiki:
In order to grow a 2×2 tree (be it spruce, jungle or dark oak), four saplings must be placed adjacent to each other in a square. For growth to succeed, there must be no blocks adjacent (even diagonally) to the north-western side up to the final height of the tree.

This jungle tree cannot grow because of the red wool block (looking from the northwestern corner)

And this looks like your case.
If you really want that wall so close to the tree, remove the wall and make the tree grow, then rebuild it in the same position.


How does contraction of polyethylene strip depend upon the heat it receives?

Question: Strip is made of polyethylene and is cold drawn so that all polymer chains are oriented in one direction. Now, if heat is supplied to it via external source then how much will this strip contract. Is there a general formula or any article which contains this data for some other similar material?
Answer: Answer to a related question detailing why some polymers contract
The change in dimensions of a material because of temperature change is determined by the Thermal expansion coefficient. In case of contraction, it will be a negative number. This coefficient can be defined for changes in volume, area, or length. For your question, length seems to be the preferred choice.
$\alpha_L = \frac{1}{L}\frac{dL}{dT}$
Here $\alpha_L$ is the coefficient, $L$ is length and $T$ is temperature.
If $\alpha_L$ doesn't change much in the ranges of $T$ that you are working in, and neither does $L$, the above equation can be simplified to
$\Delta L = L.\alpha_L\ . \Delta T $
The value of $\alpha_L$ for a material may be found in a list in a material engineering handbook. A quick internet search provided me with these results in $10^{-6} m/(m K)$ at $25ºC$
Polyethylene (PE) $ = 200$
Polyethylene (PE) - High Molecular Weight   $ = 108$
If you want to calculate how much $T$ will change by the amount of heat energy it receives, you will need to use the material's Heat Capacity


Infrastructure Wireless Network Routing

Question: Suppose there are two clients, A and B, on the same infrastructure-based wireless network with access point C. When A wants to send a packet to B, does C have to forward it to B, or can B just pick it up off the air directly from A. Basically what I'm asking is will the packet travel A -> C -> B, or just A -> B ?
Answer: The client is sending packets to the access point which it is associated with. The route is A -> C -> B
Comment: Yes, exactly as you'd expect from a wired network.
Comment: So even though its a shared medium and B can potentially see a packet that is addressed to it that leaves from A, it would wait until the packet is forwarded by the access point C, before replying to it?
Comment: The key word is potentially - the 802.11 protocols ensure that the communication channel in AP mode (rather than ad-hoc) is from client device to the AP and from the AP to wherever it needs to go, even if that is back to another wireless client. When encryption is enabled (which it should be) the content of the signal between Cleint A and AP C should be unintelligible to Client B. Assuming that weaknesses in encryption protocols and hacking are not what we're talking about here.

Infrastructure Wireless Network Routing


How to setup cscope with aquamacs on MacOS?

Question: Can you please tell me how can I setup cscope with aquamacs on MacOS?
I have followed a link from Google saying how to build a cscope database for my source code. But how can I invoke cscope with aquamacs?
Thank you.
Answer: M-x shell then 'cd your_dir; cscope ...." ?
Answer: Install xscope.el http://www.emacswiki.org/emacs/CScopeAndEmacs#toc3
I use the GNU Cocoa build of Emacs, but I think this will work for you too.
Answer: The following was performed using Aquamacs 2.3a [GNU Emacs 18.104.22.168 (i386-apple-darwin9.8.0, NS apple-appkit-949.54) of 2011-08-04 on braeburn.aquamacs.org - Aquamacs Distribution 2.3a] on Mac OS X 10.6.8:
Download cscope from http://sourceforge.net/projects/cscope/files/ (Version used 15.7a). bunzip2 and untar the software. Execute 'configure'; Do 'make'. If you find an error, check the following page and patch the file constant.h as described in instructions at http://cean2wizard.blogspot.com/2011/02/cscope-157a-build-with-mac-os-x-snow.html. Basically, set TERMINFO to be 1 for Mac. Do 'make' and then 'sudo make install'.
Go to the contrib directory. Copy xcscope.el into ~/Library/Application\ Support/Aquamacs\ Emacs/
Change directory to ~/Library/Application\ Support/Aquamacs\ Emacs/, and edit site-start.el and add the line:
(require `xcscope)
Start Aquamacs.


Is it haram to get to seek information for an exam from somebody who already took the exam?

Question: Is it haram to get to seek information for an exam from somebody who already took the exam? For example, me and my friend both took the same math exam. however she took it before me. Is it islamically permissible for my friend to give me details on the exam so that I might get a better grade.
Comment: getting advice and information might be permissible if you know that the paper will not be same and you are not asking what has came in exam, instead you can ask for probable questions, and info related to paper? not inside the paper
Comment: I think this question has nothing to do with religion. It is related to common sense and your natural understanding of right and wrong. The purpose of exams is to test your competence. Why would you take help when the sole purpose is to evaluate your learning capabilities? I believe that Islam only guides on issues which a sane person could not resolve on his own. Other than that, use your intuition and common sense which are God given gifts.
Comment: Are you absolutely certain that you will get the exact same questions? If so, surely this is a failure of the exam system, they should know that students will talk to each other about the exam if they schedule it this way.
Comment: Why should it be haram? Relevant [Is "X" halal (reference question)](https://islam.stackexchange.com/questions/36838/is-x-halal-reference-question?r=SearchResults&s=1|35.5560)
Comment: @mmm-anonymouse I'm a teacher. The purpose of an exam is obviously not to evaluate your learning capabilities, but to evaluate your actual knowledge.
Comment: @user354948, you're correct. I should have said it better.
Answer: It probably is haram. It is considered haram to cheat since cheating can be seen as a kind of 'lie' and it would be lying to take the test to show what are supposed to be your own abilities, but are actually answers you got from someone else.

Verily, those who forge lies they are Those who do not believe in Allah's Signs and Revelations and they are Indeed the liars. (Al-Nahl 105)

... Indeed Allah does not guide someone who is a liar and an ingrate.(39:3)

As stated by "Manual of Islamic Laws for Students" in response to the foregoing question, the grand jurists have unanimously and explicably considered cheating as impermissible.


Health Check command for docker(1.12) container (Not in Dockerfile!)

Question: Docker Version 1.12,
I got a Dockerfile from Here
FROM nginx:latest

RUN touch /marker

ADD ./check_running.sh /check_running.sh
RUN chmod +x /check_running.sh

HEALTHCHECK --interval=5s --timeout=3s CMD ./check_running.sh

I'm able to roll the updates and health checks with check_running.sh shell script. Here, the check_running.sh script is copied to image, so the launched container has it.
Now, my question is there any way to Health Check from out side of the container and script also located outside.
I'm excepting a health check command to get the container performance(Depends on what we wrote in script), IF the container is not performing good it should roll-back to previous version ( Kind of a process that monitors the containers, if it is not good, it should roll-back to previous)
Thanks
Answer:
is there any way to Health Check from out side of the container and
script also located outside.
Kind of a process that monitors the containers, if it is not good, it should roll-back to previous

You have several options:

From outside, you run a process inside the container to check its health with docker exec. This could be any sequence of shell commands. If you want to keep your scripts outside of the container, you might use something like cat script.sh | docker exec -it container sh -s.
You check the container health from outside the container, e.g. by looking for a process that should be running inside the container (try to set a security profile and use ps -Zax or try looking for children of the daemon), or you can give each container a specific user ID with --user 12345 and then look for that or e.g. connecting to its services. You'd have to make sure it's running inside the right container. You can access the containers' filesystem below /var/lib/docker/devicemapper/mnt/<hash>/rootfs.
You run a HEALTHCHECK inside the container and check its health with docker inspect --format='{{json .State.Health.Status}}' <containername> combined with e.g. a line in the Dockerfile:
HEALTHCHECK CMD wget -q -s http://some.host to check the container has internet access.

I'd recommend option 3, because it's likely to be more compatible with other tools in the future.
Comment: Regarding option 3: Do not execute this every 5 seconds. It would be crazy if 1 million users of your container, connect every 5 seconds to a website ;)
Answer: Just got comment from a blog!. He refered Docker documentation HealthCheck section. There is a health check "option" for docker command to "override" the dockerfile defaults. I have not checked yet!. But it seems good for me to get what I want. Will check and update the answer!
Comment: The `docker run --health-cmd ...` is just overriding the value of the Dockerfile's `HEALTHCHECK`. It doesn't change where the scripts runs, mainly, inside the container.
Answer: The Docker inspect command lets you view the output of commands that succeed or fail
docker inspect --format='{{json .State.Health}}' your-container-name

Answer: That's not available with the Dockerfile HEALTHCHECK option, all checks run inside the container. To me, this is a good thing since it avoids potentially untrusted code running directly on the host, and it allows you to include the dependencies for the health check inside your container.
If you need to monitor your container from outside, you'll need to use another tool or monitoring application, there are quite a few of them out there.
Answer: You can view the results of the health check by running docker inspect on a container.
Another approach depending on your application would be to expose a /healthz endpoint that the healthcheck also probes, this way it can be queried externally or internally as needed.


What if somebody sends me genuine certificate that they do not own?

Question: I just started learning about the digital certificates, its architecture and how it works internally. What will happen if someone sends me a genuine certificate for authentication which does not really belong to him?
Comment: Then they won't be able to prove they know the private key and authentication will fail.
Comment: What do you mean "does not really belong to him?" What does that mean to you? What is the certificate being used for? You have kind of asked, "what if someone hands me a key to a house they do not own?"
Comment: Can you be more specific? What do you expect to happen? Do you have an example?
Comment: I thought the question was reasonably clear. Do the provided answers help?
Comment: yes, I got what i expected.
Answer:
What will happen if someone sends me a genuine certificate for authentication which does not really belong to him?

A certificate is really just a public key that someone stamped with their approval.  With that in mind, the special properties of public/private key pairs (e.g., each can uniquely decode what the other encoded) are used to prove "belonging."
That certificate "belongs to" the person who owns the matching private key.  When used for authentication, a certificate is used to decode something that was encoded with the matching private key, thus proving that the connection is in the hands of the person the certificate "belongs to"; because nobody else has the private key required.
That's why certificates (public keys) can be public - if someone hands you a certificate they don't own, then they can't "back it up" with private key-generated proof, and the authentication will fail.
Answer: If someone sends you a certificate that they do not own and you encrypt a message using it, they simply will not be able to decrypt that message without having the private key associated with the certificate.
In the context of HTTPS/TLS the client authenticates the host by sending them something only they know (usually random) encrypted with the certificate public key and the host must prove that they have the private key by decrypting that something. The something is frequently a key to be used with a symmetric encryption algorithm such as AES. (Exact details here depend on ciphersuite used)
Answer: A certificate is basically just something that tells you something like:

The following public key belongs to example.com, and it's been verified by SEA (Some Example Authority)
Public key: 348abb1c...
SEA's signature on this document: 72ff541c...

Certificates are public, they are not meant to be secret. Now, what happens if a different malicious website gave you that certificate, pretending to be example.com? You would encrypt your data with that public key (belonging to example.com), and send the encrypted data to the malicious website. But the malicious website can't decrypt it, because they would need the private key for that, and only example.com has it.
The attacker could put their own public key in the certificate, so that they will be able to use their own private key to decrypt the data. But if they change the public key in the certificate, then the signature of the Authority is not valid anymore, so the certificate is not valid (you get warnings in browsers, etc), and you should not accept it.
There are special kinds of certificates though that you should handle with care, and those are the root certificates, or any self-signed certificates. They basically say:

The following public key belongs to example.com, and it's been verified by example.com itself. Just trust it!

Generally, you really shouldn't trust such certificates. However, some certificates like this are automatically trusted by your browser or your operating system, for example. Why? Because you need the public keys of some authorities in order to verify the signatures in the certificates. So the public keys of some authorities are trusted by default by your OS and some of your applications.


Is doctoral fellowship to be considered as funding source for a journal article?

Question: As title suggests. First year Doctoral fellow with a scholarship. The article has no bearing on my Doctoral thesis. It is a side project. My synopsis hasn't even been finalized yet. So should I have mentioned and declared ny fellowship as a funding source while submitting the paper?
Comment: To clarify more, the scholarship is given by my country's government's university regulator called UGC. I am also in my first year and the article has nothing to do with my intended thesis when it comes to overlap. It is not a grant or project specific scholarship. It is merely a merit scholarship
Answer: There is no need to list it if the funding didn't support the research (if any) that went in to the paper.
But it might be at least courteous to mention that you are "personally" supported by as scholarship, naming the source.
Answer: This is a case where the conventions of the journal probably override any answer that we can provide. In general, I don't see people acknowledging fellowships that were provided "for study" — for example fellowships that all graduate students in a department receive. Similarly fellowships that were awarded "for excellence" to attract a particular candidate to a university are often not acknowledged. On the other hand, fellowships that are "for research" or designed to further your research goals (even broadly) typically get acknowledged (in my field).
Regardless, it is okay to let this "grey area" slide for now and then ask the editor if you get a revision.
Comment: I would say that, same as with salaries, fellowships that all students receive are generally acknowledged by stating the affiliation. If I see "university of X" next to someones name, then I will generally assume that that university supported that person. Similarly, the university of X will certainly feel their contributions acknowledged by that.
Comment: In my experience, this is wrong.  Also, if it's a doctoral fellowship it is for research.  A doctorate is a research degree.
Comment: Well, then everyone in my PhD granting department is wrong because none of us ever acknowledged the uni funding, just above and beyond funding we had to apply for…
Comment: For instance, I would acknowledge NSF funding but not generic Harvard funding that came as part of admittance. I would acknowledge an above and beyond research funding that was administered by a committee or center at Harvard.
Answer: If you were paid by a fellowship, or your tuition was paid by a fellowship, while you worked on a paper, then yes the fellowship must be acknowledged in the paper.
You can skip the acknowledgement only if you did not use any fellowship resources in any way.  If you do not include the acknowledgement, you take on a small risk of angering the funder and violating the journal's policies.
Comment: This depends a lot if the fellowship is being provided by the university or a third party. In the former case, your affiliation is sufficient acknowledgment of your funding. In the latter the funding should acknowledged if in anyway this funding helped you in preparing this work.
Comment: Too stark. If I study, say, physics and publish an article "Personal Energy in Taiji", do I need to list my fellowship?
Comment: To clarify more, the scholarship is given by my country's government's university regulator called UGC. I am also in my first year and the article has nothing to do with my intended thesis when it comes to overlap. It is not a grant or project specific scholarship. It is merely a merit scholarship. I have given my affiliation to an Uni controlled by the authority that lends the scholarship too.


New Steam UI won't update

Question: I have steam on my windows 7 PC and I knew about the new UI for a while, yet I still have the old UI. Even when I check for new steam updates it say that steam is up to date. I also can't completely uninstall steam since I have many games installed. All I want to know is how to update steam to the new UI.
Comment: If you are talking about that Big Screen on your TV UI sort of thing, there is just a button to change to it.. Its a full screen app though and is not really meant for a PC running other things as well but when you want your games on  your TV or the like.
Comment: @James: They recently overhauled the UI, changing the colors *(more blue and more contrast-y)* and some of the fonts.  It's similar enough that most people probably won't even notice, though.
Answer: The update which included a minor change to the Steam UI was delivered via the normal Steam update. In the unlikely case that you have not yet received yet this update, go to your Steam Client and run the following menu entry while being connected to the internet:

Also, make sure that you do not have any custom skins activated:

After updating your Steam Client, you should have the new Steam Skin. If all that fails, shut down Steam, delete everything except Steam.exe and the folder userdata and steamapps. After that launch Steam.exe again and it should update regulary.
Comment: So the deleting issue fixed everything thanks a ton!

New Steam UI won't update


When we clip a shapefile , how to get both inside and outside clipped output in arcpy?

Question: I have tried the same scenario in FME and I am able to get both inside and outside features ,can I get the same functionality in arcpy ?
Answer: As far as I know the "Clip" tool will only output the area inside of the clip feature. To get the area outside (original minus the clip area) you can use the "Erase" tool although it requires an advance desktop license.
If you don't have the license for the "Erase" tool there are some workarounds here: https://gis.stackexchange.com/questions/133264/subtracting-erasing-polygons-from-polygon-using-arcgis-for-desktop/133265


What causes [almost] instant missle tone/launch while flying?

Question: Several times while flying, I seem to get in the insta-locked-on-and-missle-fired situation.   I don't hear the locking tone (when someone is trying to lock onto me), so deploying ECM is a pain (as the missile is already sent to me).  As I perfer ECM over flares (more time to get away), but why does this instant locking/missile launched happen?   Is this a glitch?  I also tend to use the stealth perk.
Comment: It might be the igla, since you can fire it without locking and then lock on quickly to hit you while the rocket is in the air already.
Comment: or active radar missiles. Do you know what the source of the missiles are?
Answer: Two possibilities:

If you're getting hit very quickly after hearing the warning: Active Radar missiles.
If it doesn't seem so "omg wtf" fast, then it's probably a bug with lockon weapons, where someone has been trying to lock you but you were out of their range, and then when you enter their ~350m range the lock sometimes finishes instantly.

If you're getting hit almost instantly, then they're Active Radar missiles, which are available for Stealth Jets and the Mobile Anti-Air.
The missiles are fired without a lock, and fly in a straight line... until a target passes close enough in front of them. Then they automatically lock and begin chasing that target.
This means that there is no "locking but not yet fired" phase, so your alert-beeper goes instantly to the highest threat level. In addition, they are often fairly close to you when they lock, so there's very little travel-time before they hit.
Answer: As an avid anti-vehicle player, I can tell you that this form of "instant locking" that you describe only seems to happen on one occasion. When I target a vehicle from a long distance, the launcher displays a muted lock-on icon as it recognizes that there is a vehicle but it's too far away to lock-on. However, if I keep this "muted lock" on the vehicle as it gets closer to me, the launcher instantly locks on when the vehicle comes into range rather than requiring a period of waiting time.
Comment: @Anar If an SRAW hits either the light chopper or attack chopper it is a 1 shot, also for both jets. The only one that can survive an sraw is the transport chopper.
Comment: I believe SRAWS do not give a lock-on warnining unless they are being laser guided by a SOFLAM or PLD. I have taken down Little Birds with one SRAW rocket before, as well as a transport chopper, although the transport chopper could have taken some damage beforehand.
Comment: Can please someone confirm this? I also rarely get shot without any lock signal and suddenly drop from 100 to "red health region". I suspect it has to do with SRAWs since there is no signal but SRAW alone cannot inflict that much damage. I am confused :)
Comment: I, too, have only seen this when an aircraft is locking onto me while I am in a little bird.  I've noticed also when flying an airplane the lock seems to happen quicker on helis.
Comment: @Lyrion Actually I was on a transport heli, repairing it. Do you know how much damage does a single SRAW rocket inflict?
Comment: @Anar I don't know, but I do know that 2 shots is enough to take down a transport chopper. My guess is it does at around 70-80 damage


How do I get the MAC address of my router?

Question: Is there a Linux command that allows me to get the MAC address of my router?
Comment: which one? your router should have multiple mac addresses for both sides of communication (incoming / outgoing).
Comment: Should this go in Super User?
Answer: Don't use the obsoleted commands ifconfig(8), arp(8) or route(8).  Use the new command that replace them and can do more, ip(8).
Use ip route list to see which default router your machine have.  That should be a line wich starts with default (or 0.0.0.0) and have the IP address to the router after.  If you uses IPv6, just add the -6 switch, ip -6 route list.
default via 192.168.11.1 dev eth0  proto static

To see the MAC address of the default routers IP address, use ip neigh and look up the line with the IP address and MAC address after lladdr.e
192.168.11.1 dev eth0 lladdr 1c:af:f7:XX:XX:XX REACHABLE

If you don't find a machine in the list, you need to connect to it, because it has been removed from the list because not used for a while.  So just try:
ping -c 3 192.168.11.1

Then try the ip neigh command again. The option -c 3 will restrict ping to only send three ICMP ECHO messages and then end.  If not set, it will run until you stop the program with C-c.
Answer: If you don't know the IP of your router, it's most likely your gateway which you can get from the route command:
$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

Note the line with the flags UG. The address in the Gateway column of that line is what you're looking for. Then follow 2707974's suggestion with arp -n (ping the IP if it doesn't show up at first), and find the matching line:
$ arp -n
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.0.1              ether   00:11:22:33:44:55   C                     eth0
192.168.0.2              ether   66:77:88:99:aa:bb   C                     eth0

Here, your router's MAC would be 00:11:22:33:44:55.
Comment: The corresponding one-liner: ``arp -n | grep `route -n | awk '/UG/{print $2}'` | awk '{print $3}'``
Answer: I like one-liners:
arping -f -I $(ip route show match 0/0 | awk '{print $5, $3}')

arping shows the MAC associated with the default gateway IP address from the output of ip route show match 0/0, parsed by awk.
Comment: I tried this (and other answers). They give good info, but the MAC address shown was off by two digits from what I was looking for. My printer lists two routers with the same SSID (probably guest and regular), and wants me to pick by MAC address. This answer https://askubuntu.com/a/222553 gives me one of the two listed, with the `iwconfig | grep "Access Point"` command. I think the one that was off by two was the cached version of the wired connection, which I unplugged to try to make sure I was getting the wireless route.
Answer: Here is one-liner which works in dash, bash and zsh:
ip neigh|grep "$(ip -4 route list 0/0|cut -d' ' -f3) "|cut -d' ' -f5|tr '[a-f]' '[A-F]'

ip -4 route list 0/0 returns something like:

default via 192.168.0.1 dev eth1 proto static metric 100

we get IP from that line as third field with cut and grep line containing that IP and immediate space after it from the output of network neighborhood. (space is required to avoid matching of 192.168.0.1 with 192.168.0.10), the matched line would be something like:

192.168.0.1 dev eth1 lladdr ca:fe:ba:be:be:af REACHABLE

Now we get fifth field and make it uppercase:

CA:FE:BA:BE:BE:AF
Comment: A bit more explanation would help the rest of us understand your script!
Comment: For the last line there's a Bash feature that expands a variable to upper case: `echo ${info[5]^^}`
Comment: @DavidFoerster I wanted to write a portable command but the original variant relied on array indexing specific to zsh (from one) so I've updated the answer with the variant portable between three most popular shells
Answer: Is not a complete solution, but you check arp -n.
ddd@mmm ~ $ arp -n
Address                  HWtype  HWaddress           Flags Mask            Iface
xxx.xxx.xxx.xxx          ether   00:e0:1e:b4:12:42   C                     eth0
yyy.yyy.yyy.yyy          ether   00:14:78:52:28:d2   C                     wlan0

Comment: If you ping your router (say `ping 192.168.0.1`) you should then have its MAC address on the arp cache...
Comment: Doesn't this get the MAC address of the interfaces on the computer, not the router?
Comment: thanks @2707974 but I don't khnow no mac address no address ip and I want have a command that give me only the ip adress or mac adress of my router because I want to use the command in a script python for that show all arp table is not useful for me.
Answer: This is an improved version of Grief's answer. It is possible for ip -4 route list 0/0 to return more than one line (IP), in which case the complete one liner doesn't work. So the following modified version only uses the first line that ip -4 route list 0/0 returns.
ip neigh|grep "$(ip -4 route list 0/0|head -1|cut -d' ' -f3) "|cut -d' ' -f5|tr '[a-f]' '[A-F]'


How to implement mutex on single processor (single core) system other than using spinlock

Question: How does one implement mutex on a single processor system without using spinlock mechanism. Mutex is to be implemented in user space (for any user level library like pthread lib for example).
Answer: It is impossible to implement a mutex completely in userspace unless you have special CPU instruction that could simulate a semaphore or a lock (some "test and increment if true" instruction). pthread in Linux goes through the kernel to implement the mutex.
Comment: Are you suggesting I use some kind of atomic test and set instruction? But will that not be basically a spin lock?
Comment: No, if you test and fail, the running thread can go to sleep and wake up when the lock is released (i.e. you need a list of blocked threads in your mutex). Then the other threads can compete to grab the lock, again, everybody who fails goes to sleep.
Comment: Here's an implementation of a semaphore from NachOS: http://web.ics.purdue.edu/~cs354/Nachos/class_semaphore.html, as mentioned above - its done in kernel space, disabling interrupts.
Comment: I got what you are trying to say, thanks.
Answer: On a single processor system a spin lock won't work at all.  There's only one processor so if that one processor tries to acquire a locked mutex, it will start spinning, and there will be no other processor available to unlock the mutex.  The processor will be stuck spinning forever.
Rather on a single processor system one needs to use two other techniques.  First, if the mutex is supposed to protect some data structure during interrupt handlers, then you achieve mutual exclusion simply by turning off interrupts during the critical section.
For mutexes used for "normal" threads when a thread (let's call it "A") tries to acquire a mutex and finds it locked, it calls into the scheduler which selects some other thread(s) to run for a while before retrying to run thread A.  This can actually be viewed as a form of spinning (test the lock, find it busy, call the scheduler to run some other thread, eventually come back to me, test the lock again, and so on ...).  So a slightly more sophisticated approach is to associate a queue with each mutex.  When thread A tries to acquire the mutex and finds it locked, it places itself on the queue associated with the mutex, then calls the scheduler, which selects some other thread(s) to run for a while.  Eventually one of those other threads unlocks the mutex.  At that point the thread that unlocked the mutex removes thread A from the queue and places thread A in the schedulers "ready-to-run" list.  Eventually the scheduler will decide to run thread A again, thread A will again try to acquire the mutex, and (unless someone else has locked the mutex in the meantime) will find it unlocked this time.
Comment: I understand what you are saying, bt the limitations I have is I dont have access to kernel resources, meaning I dont have the luxury to enable disable interrupts or decide the scheduling (scheduling is done by kernel and I dont have control on it). Only thing I can do is deschedule my current running thread.


Download mega.nz files from command line

Question: I am running Ubuntu Server 18.04, and I was wondering if it was possible to download mega.nz files from the command-line, e.g. using putty or some other tool?
Answer: Megatools allow you to copy individual files as well as entire directory trees to and from the cloud. You can also perform streaming downloads for example to preview videos and audio files, without needing to download the entire file first. Megatools are robust and optimized for fast operation - as fast as Mega servers allow. This is quite fast. Memory requirements and CPU utilization are kept at minimum.
Megatools is provided in Ubuntu by the universe repository. You can install megatools in all currently supported versions of Ubuntu with the following command:
sudo apt install megatools

Then run man megatools to show the available command line tools. The SYNOPSIS section provides a synopsis of the available commands.
Answer: As of November/23 the megatools repo has been removed, you should look for megacmd (github, from @milahu's answer) instead.

As of November/21, Ubuntu 20.04 and megatools 1.10.2, you can use Megatools as mentioned in @karel's answer, but megadl has an unfixed issue while dealing with MEGA URLs.
If you need to download a file, the URL will be something like https://mega.nz/file/<some_id>#<some_other_id> and needs to be changed into https://mega.co.nz/#!<some_id>!<some_other_id> for it to work. Remember to put between single quotes, so:
megadl 'https://mega.co.nz/#!<some_id>!<some_other_id>'

Folder URLs need to be adapted too, from https://mega.nz/folder/<some_id>#<some_other_id> to https://mega.co.nz/#F!<some_id>!<some_other_id>, so:
megadl 'https://mega.co.nz/#F!<some_id>!<some_other_id>'

Comment: `strLink="https://mega.nz/folder/ExdyETia#m0FwgdqrHmfnS4Xakn_rMg/file/R00wWJYZ";megadl "$(echo "$strLink" |sed -r -e 's"mega.nz"mega.co.nz"' -e "s'#'!'g" -e 's"/folder/"/#F!"' -e 's"/file/"!"')"` (the link is for lineageos btw) but I think this link is not downloading (despite accepting the link now) because it is in an encrypted folder see https://github.com/megous/megatools/issues/254. I will try to compile the latest from that github.
Comment: It seems that the bug was resolved now, as far as I can see from the bug tracker.
Comment: The issue was already marked as closed back when I wrote this answer. You can see people as recently as Jan 21 https://github.com/megous/megatools/issues/157#issuecomment-1013698756 claiming the workaround is needed and works as expected.
I haven't touched in this recently, so I can neither confirm nor deny it's been fixed.
Answer: megacmd works without login
mega-get "https://mega.nz/file/bFdkyJhK#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

have fun building this on debian : P
"proper" distros like nixos or arch have a package for megacmd ...
but you can use nix on debian : D
sudo apt install nix nix-setup-systemd
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel update
export PATH=$PATH:$HOME/.nix-profile/bin

nix-env --install megacmd
mega-get ...

Comment: this only works if is a public shares; for private ones you'll still have to login
Answer: I solved this making a .sh file with 600 lines that look like this:

megadl 'https://mega.nz/xxxxxxxxxxxxxxxxxxxxxxxxx'

You hace to download megatools previously. Give to your .sh file execution permissions (chmod +x fileName) and launch it into your command line (./fileName.sh)


Profiling C code on Windows when using Eclipse

Question: I know I can profile my code with gprof and kprof on Linux. Is there a comparable alternative to these applications on Windows?
Comment: You can use gprof on windows with the MinGW port of the GCC compiler.
Comment: Which compiler are you using on Windows?
Answer: There's a MinGW port of gprof that works just about the same as the Linux variant. You can either get a full MinGW installation (I think gprof is included but not sure) or get gprof from the MinGW binutils package.
For Eclipse, there's TPTP but it doesn't support profiling C/C++ as far as I know.
Answer: Commercial software:

Rational Quantify (expensive, slow, but very detailed)
AQTime (less expensive, less slow, a bit detailed)

Free software:

Very sleepy (www.codersnotes.com)
Luke StackWalker (lukestackwalker.sourceforge.net)

These commercial alternatives change the compiled code by 'instrumenting' (adding instructions) to it and perform the timing withing the added instructions.  This means that they cause your application to slow down seriously.
These free alternatives use sampling, meaning they are less detailed, but very fast.  In practice I found that especially Very Sleepy is very good to have a quick look at performance problems in your application.
Comment: I tried both Very Sleepy and Luke StackWalker, but they're unable to tell me anything. They don't seem to have access to my source code. gprof however works just fine. How come? I really like GUI-based profilers, but they're not working.
Comment: This error was produced by Luke StackWalker: `ERROR: SymGetModuleInfo64, GetLastError: 1114 (Address: 7C90E514)`
Comment: I've opened a seperate question for this issue here: http://stackoverflow.com/questions/2302596/luke-stackwalker-returns-error-when-running-gprof-works-fine
Answer: Yes, you can profile code with Visual Studio
Comment: In any case, Visual Studio standard and express editions don't include a profiler. With pro, there's a simple (command-line) profiler which I believe is a separate download, and isn't easy to use. What Microsoft want is for (rich) people to buy Team Suite.
Comment: I'm an Eclipse user, so that's no option for me.
Comment: @Pieter: then please specify this important clause in *the question*
Answer: What's the reason for profiling? Do you want to a) measure times and get a call graph, or b) find things to change to make the code faster? (These are not the same.)
If (b) you can use this trick, using the Pause button in Eclipse.

Added: Maybe it would help to convey some experience of what performance problems are actually like, and where you can expect to find them. Here are some simple examples:

An insertion sort (order n^2) where the items being sorted are strings, and are compared by a string-compare function. Where is the hot-spot? in string-compare. Where is the problem? In the sort where string-compare is called. If n=10 it's not a problem, but if n=1000, suddenly it takes a long time. The point where string-compare is called is "cold", but that's where the problem is. A small number of samples of the call stack pinpoint it with certainty.
An app that loads plugins takes a long time to start up. A profiler says basically everything in it is "cold". Something that measures I/O time says it is almost all I/O time, which seems like what you might expect, so it might seem hopeless. But, stack samples show a large percentage of time is spent with the stack about 20 layers deep in the process of reading the resource part of plugin dlls for the purpose of translating string constants into the local language. Investigating further, you find that most of the strings being translated are not the the kind that actually need translation. They were just put in "in case" they might need translation, and were never thought to be something that could cause a performance problem. Fixing that issue brings a hefty time savings.

So it is common to think in terms of "hotspots" and "bottlenecks", but most programs, especially the larger ones, tend to have performance problems in the form of function calls requesting work that doesn't really need to be done. Fortunately they display themselves on the call stack during the time that they are spending.
Comment: I'm interested in profiling to see which parts of my code take longer to execute so that I can discover eventual inefficiencies.
Comment: @Pieter: Finding inefficiencies is (b). I'm trying to spread the word about this. Here's another take on it: http://stackoverflow.com/questions/2308026/which-has-been-the-most-reliable-fastest-windows-c-profiler-that-you-have-used/2311117#2311117
Comment: Sounds complicated for a C newbie like me. My ideal profiling application should be able to lay a heat map over my code to see which commands take the longest time to execute. Some code is supposed to take more processing time, I know, but there are plenty of cases where this would help detect the aforementioned inefficiencies.


Unicity-distance of Playfair

Question: Given the classical scheme Playfair, say, for 5*5 matrices, I am interested to determine its unicity-distance. How should one proceed to properly do that? I should appreciate it, if I could obtain a very terse recipe, listing the kind of computations such that I could effectively compute that value myself. (I am attempting to determine the unicity-distance of a suggested variant of Playfair.)
Answer: The unicity distance is defined to be the minimum number of ciphertext characters needed to have a unique significant decryption.
It answers the question 'if we try all the keys, how much ciphertext would we need to be sure our solution was the true solution?'.
The answer depends on the redundancy of the language in which the plaintext was written.
To find the unicity distance of a given cipher algorithm you calculate the ratio of the number of bits required to express the key divided by the redundacy of the language in question. Assuming the plaintext was written in English and that the Playfair Cipher is used to encipher it, we have that the unicity distance equals to 27 characters.
For a slightly more detailed discussion consider practicalcryptography.com
Comment: Playfair works with pairs of characters. It seems to me to be strange that the unicity distance is not an even number. Do you happen to have a bit more information (than the single value on that web site) on how the actual computation process for Playfair was done?

Unicity-distance of Playfair


Color contrast and hover state [a11y]

Question: When multiple pieces of information of different importance are presented within a same piece of UI (e.g., table row, list item), some designers prefer to have the "secondary" or "less important" information be presented using subtle colors (e.g., light grey) that fail the basic color contrast criteria. From the accessibility point of view, is the contrast less than 3 acceptable if the hover/focus state has over 4.5? If not, what is a viable alternative that maintains the primary-secondary relationship between different pieces of information (e.g., the need to reduce distraction)?
Answer: Relying only on hover and focus to provide enough contrast is indeed not sufficient. Informative/interactive elements should have enough contrast in every state.
But contrast is not the only way to provide "visual hierarchy". I quickly created these buttons and links to show that it is a matter of playing around with border thickness, font-weight, color, contrast etc.

So if lowering contrast is not sufficient due to the minimal accessibility requirement, you can combine multiple ideas. When you search for "visual hierarchy" you will find enough information to move forward, like one of the first results gave me this list of possible characteristics to use:

Size – Users notice larger elements more easily.
Color – Bright colors typically attract more attention than muted ones.
Contrast – Dramatically contrasted colors are more eye-catching.
Alignment – Out-of-alignment elements stand out over aligned ones.
Repetition – Repeating styles can suggest content is related.
Proximity – Closely placed elements seem related.
Whitespace – More space around elements draws the eye towards them.
Texture and Style – Richer textures stand out over flat ones.

Source: https://www.interaction-design.org/literature/topics/visual-hierarchy
Comment: I like these ideas. Note that the example might not pass contrast. I don't know the exact colors used for the text but I get roughly a 4:1 contrast for the "Secondary" button text on a gray background, which will only pass if the font size of "Secondary" is 18pt or larger (or 14pt bold and larger). The "Secondary" link text, since it's on a white background, might have a higher contrast but the text is too small/pixelated for me to test it. But the main point was using bold font (and border) for primary and normal font for secondary, which I like from an accessibility perspective.
Comment: That's strange, I tested the secondary button and got 5:1 otherwise I wouldn't have posted it. Have you clicked on the image to get it full size? Or maybe the tool I'm using isn't telling the truth.
Comment: Tried again with a zoomed version of your button but I'm getting some anti-aliasing so might not have the exact RGB values. The secondary button text came out as #636363 and the button background was #DADADA, giving a contrast of 4.3:1. That's probably close enough to 4.5:1 that I might not have the exact color values and the real colors might pass. But that's not close to the 5:1 you're seeing. It's somewhat irrelevant because I liked your ideas. I just wanted to make sure [WCAG conformant colors](https://www.w3.org/TR/WCAG21/#contrast-minimum) were used.

Color contrast and hover state [a11y]


How do we nominate someone else for moderator?

Question: I don't have 300 points, so I can't nominate myself. But that is a good thing, because I have no interest in being a moderator. However, I'm a heavy lurker on gaming.stackexchange, and I'd like to nominate some others that appear to be good community members. Is this possible?
Comment: As Fabian said, Nominating others is not possible. If you want to call them out and encourage them to nominate, try pinging them [in chat.](http://chat.stackexchange.com/rooms/35/the-bridge)
Comment: http://meta.stackexchange.com/questions/75382/how-can-you-nominate-someone-other-than-yourself-for-being-a-moderator
Comment: Thanks. I searched for the question prior to posting, wondering why the linked question didn't come up.
Answer: Nominating others is intentionally not possible.
Comment: To expand on this: The best way to "nominate" someone else is for you to convince them that they should nominate themselves.
Comment: ... or hack their accounts in order to nominate them
Answer: When we did allow outside nominations, it caused a lot of problems:

users often did not know they were nominated by someone else
users sometimes did not want to be nominated at all
it implies a lot of coordination, more than there actually is, between users

There is, I think, an important difference between nominating yourself and accepting someone else's nomination. While in theory this could work and feels very democratic, in practice it typically does not, and has a small but significant chance of causing confusion and possible hard feelings.
Best to let users nominate themselves so there is no chance of confusion or misunderstanding. I also think people who self-nominate are the most motivated to participate, anyway.


How to play split screen minecraft on the same PC?

Question: Can I play Minecraft 1.11.2 multiplayer using the same computer? If so, how?
Answer: for this you may require 2 accounts for Minecraft java version.
You set up a server on your computer and then open up 2 Minecraft windows and play.
An alternative solution would be using the Bedrock edition of Minecraft.
Answer: The easiest way to do this would involve spinning up a virtual machine such as Virtual-box running Ubuntu or some other free Linux distribution. Download and install Minecraft in both the VM and your desktop.
The next step requires you to start Minecraft in both the virtual machine and your desktop. Once Minecraft is started on both machines you'll need to start a LAN server from the desktop or VM whichever is most convenient.
You can connect to the LAN server from the VM by using localhost as the IP address as well as the port printed in chat. Set up a separate keyboard and mouse for the VM using this Superuser answer, and profit.
Disclaimer:
I have not followed these instructions and it will probably lag unless you have a decent CPU and graphics card as well as quite a bit of RAM.