Does a tooltip require close button?

Question: I'm working on tooltips, when I was told there are some tooltips that have close buttons. Is a tooltip with a close button user friendly?
Comment: I wouldn't call it a 'tooltip' if it requires the user to click something. I'd call it an alert or pop-up dialog.
Comment: yes i agree Phil, but there are some tooltips with close button on user hover something.
Comment: Then it's not a true tooltip, and shouldn't be called one. It's a pop-up dialog triggered by mousing over an element, and a bad design to boot.
Comment: I was asking myself the same thing whether to add a close icon. On desktop I didn't need one, it was triggered on hover but on "mobile" I added a close icon because there was not enough space to tap in a clear space. The user could tap the tooltip to make it go away but I felt it wasn't clear. I do wonder for a tooltip close icon on mobile would having the label dismiss or close matter matter vs close icon.
Answer: To know if the tooltip should be closable by the user, we should know when it gets displayed.

As a mouse-over: no, it is hidden, when the user moves away.
On some event: How would it get closed otherwise? Time is not a good option as it would a break accessibility guidelines.
Click in text line: Not necessary, but I would provide this option as stackexchange is doing it. Users like to have control.

In general I would provide a close button. Usually it doesn't destroy a design but most people will like it.
Comment: Agree, if it is a static tooltip that appears after a click (on a button) then a close button should be added **and the tooltip should disappear when an other element is clicked**. Tooltips that appear on hover don't require close buttons.
Comment: I agree with having a close button. When I'm interacting with a pop-up or a lightbox I click somewhere in the background for it to disappear. But I've come across many users who doesn't know this and look for a close button.
Comment: @nuwa I'd say that if the tooltip is triggered by a click event, then it needs a close button because users would expect another click to close it. However, if the tooltip appears on hover then it isn't required because it would be expected the disappear as soon as the mouse moves out.
Comment: I agree with @AlanChavez.  Though, on mobile you would need a close button, unless the tooltip closes once the user clicks outside.
Answer: The thing with tooltips (as with everything else on screen) is that it increases cognitive load and requires to be processed (read) by the user.
So the general question to ask is: does the user need (or want) to see the tooltip permanently, or should be allowed to close it? Is the tooltip really helpful or trivial?
I'd say that tooltips in general need to be visible only as long as they convey important message to the user. So they should have close button or disappear themselves after some other user input (mouse hover, click on associated element, fixing the problem etc.), or time delay (but as it was stated in previous answers - it is at odds with good accessibility guidelines, so should be used only for trivial information).
TL; DR;
In the current context what is shown in your screenshot I see two bad UX issues and would advise not to put close button on your tooltip.

There was a problem with username and/or password. This happens very often and most of the people know what to do in this situation: You need to select username input field, reenter your username, press tab or click to select password field, reenter password and then press enter or click on submit button.
For user to click to close popup is a redundant click operation (unless the popup blocks the input fields, which then is a terrible placement and I would suggest to show this message as a text string bellow the form and not as a tooltip).
A tooltip is generally associated with an element and has a pointer towards it. Your tooltip says "There was a problem" and points at the submit button As if the submit button was clicked incorrectly or is somehow responsible for wrong username/password. :) So either you point it at the username/password field or use string text error message under the form.
Answer: I agree with Harijs' answer.
You need to address the question of why you are using the Tooltip for error handling in the first place. Here is a helpful article:

In order to display error messages on forms, you need to consider the following four basic rules:

The error message needs to be short and meaningful.

The placement of the message needs to be associated with the field.

The message style needs to be separated from the style of the field labels and instructions.

The style of the error field needs to be different than the normal field.

Source:
http://www.nomensa.com/blog/2010/4-rules-for-displaying-error-messages-from-a-user-experience-perspective/
You should also not use tooltips for error messages.

Is the supplemental information an error, warning, or status? If so, use another UI element, such as a balloon, error message, or status bar. Notification area icon infotips are an exception because they can be used to show status information.

Source: http://msdn.microsoft.com/en-us/library/aa511495.aspx#rightcontrol
Consider also the conditions to use Tooltips in the first place as outlined in another SE post here:
To tooltip or not to tooltip?
I highly recommend you try a different approach for your error handling especially within the login. Here are some great examples:
Using colour:

Using the whitespace on the right:

Below each field:

This example looks tooltip-esque but I believe the error message stays there as long as the validation marks it as wrong. It could be dynamic or when the user clicks on log in.
Answer: I would definitely use a close button on tooltips for websites that are responsive since there is no such thing as hover on a touch screen device.
This would be in cases where the tooltip is accessed via a click instead of a hover. In my work I strive to have a single method for accessing this type of information to keep a code base small and have the user only need to learn one way of doing things no matter which device they happen to be using right then.
In practice this has led me to avoid using hover at all because touch screen devices are becoming so popular.
Comment: Air view recognizes if your finger is nearby. This site describes it very well: http://allaboutgalaxys4.com/galaxy-s4-features-explained/air-view/
Comment: I always have to mention, my mobile phone (Samsung S3) supports hover and I love it. Hope it gets more popular in the future.
Comment: how does it do that? Can it tell your finger is close to the screen or does it have a cursor or something?
Answer: I think for tooltips the "close" button serves the purpose of reassuring the user that this is indeed a tooltip and it can be closed. It's a quick fix for cases when users are inexperienced with interfaces, and definitely not a requirement.
Remember that you have to teach the users how to use your apps, not just give them "faster horses".
But in this specific example, I don't think this message should be shown in a tooltip, but in an appearing text field that lists all the encountered errors.

Does a tooltip require close button?


How to display a picture using data from ViewData.Model [as opposed taking data from a remote location using, for instance, Url.Action]

Question: I'm doing kind of wizard application that captures information on Contacts. So, before saving to DB, all data collected during the process are kept in memory as model's properties (using serialization/deserialization). Data collected includes the uploaded picture of the contact. The last page is called "preview" where I display all the information entered during the process before saving them to the DB. On that preview page, I'd like also to display the photo of the contact on left and his information on the right.
It is easier to display picture using the following statements

<img src = "<% = Url.Action("Action", "Controller", "routevalue")%>"/>

How about if the data is not located in remote locations like in the above samples, but rather in the ViewData.Model?
By the way, my model, ContactData, has 2 properties ImageData and ImageMimeType holding data for the picture. How do I use them?
Thanks for helping
Answer: Usually, you'd store it in a session variable, and when the request for the image comes around you'll feed it whatever is in the session. There are a couple of things that need to work in order for this to function, but usually it does.
There is one more option, if the image is small, you can inline it directly into your document using a data uri, like so:

(example is stolen from wikipedia, paste uri into your location bar, and it'll show you an image of a red dot). You'll need to base64 encode the binary data (or url-encode, but base64 is usually preferable for binary data).
Comment: Please, can u edit your example, I don't understand. I'm sorry for that.
Comment: I thought there was a problem with your answer. So, is it the way above that I'll get my mark up???
Comment: What needs to be stored in the variable session? In fact, ImageData is the model's property that stores data for the picture. The whole model, called ContactData, is serialized/Deserialed i.e. all the data, including data on picture, live untill it saved to the database
Answer: Roe,
It took me 2 days and many frustrations just to realize what you meant by storing data in the session state variable. Anyway, below is the solution for anyone to take advantage of.
I, first, put data needed to display in the session state variables
public ActionResult PreviewPage()
{
  Session["ImageData"] = contactData.ImageData;
  Session["ImageMimeType"] = contactData.ImageMimeType;
  return View(contactData);
}

I also created a action method to send data to view. This is where all the magics are done. This action picks up data contained in the Session variables
public FileContentResult GetImage()
{
  return File((byte[]Session["ImageData"], (string)Session["ImageMimeType"]);
}

Finally, this how I view accesses to that data without having to fetch needed from a database.
<img src = "<% = Url.Action("GetImage", "Contact")%>" />

It was important that I be able to understand how this works because I'll be doing more of Wizards-like applications in the future.
Thanks very much for helping.


Do skill enchantments on armor work for companions?

Question: I have been using Lydia and have noticed the following:  If I put on a ring, armor, boots,  necklace and head piece all with bow damage percentage increase, my bow damage rating in my own inventory screen goes up to about 140 for an ebony bow.  If i then give this bow to Lydia, the damage on the bow is the 140.  If I give her the bow to start then give her the clothing with bow damage percentage increases, the bow damage remains at the base level in her inventory screen.  Same thing if I give her the bow with bonus damage to start then give her the clothing.   The bow damage always remains the same as what it was when I gave it to her...so do enchantments on armor and such actually provide a benefit or bonus to your companion?  Perhaps it is just not visible?  Thanks!
Answer: Enchanted gear does work on companions, but they don't take enchantments into account when choosing the items to equip. What you're seeing is the stats adjusted for your character, because the companion's inventory acts like a container.
Comment: Thanks @kotekzot.  To clarify a little further though, is there a glitch in the game that makes it so that the new damage on the bow that Lydia is holding, once she has equipped the bow damage enchanted items, does not actually reflect on the item in her inventory.  Because when I give her the bow with base damage, then give her the apparel with a bow enchantment the bow's damage itself never changes even though she is wearing the items.  To note, I am playing on PS3.
Comment: @MarkRipek, have you somehow measured Lydia's exact damage or are you judging it by the numbers displayed in her item transfer menu? Because in the transfer menu you're seeing **your** damage with the bow, not hers.


Which file of wordpress manage plugins functionalities?

Question: Which file of wordpress manage the plugins functionalities. For example if a have to insert another rule in a plugin functionality where i go to modify?
Comment: Modifying core WP files is considered **extremely** bad practice and almost never required to accomplish things. Please add some details on what exactly you want done so you get good answers.
Answer: There should never be a case where you edit the core. Filters and actions were created so plugin developers could navigate the intricacies of Wordpress wihtout touching core files. You should reference the following:

http://codex.wordpress.org/Plugin_API/Action_Reference
http://codex.wordpress.org/Plugin_API/Filter_Reference

There are quite a few undocumented filters that I find when viewing WP core. If you do go to core, I would look for a filter that's being used in the area you wish to alter Wordpress rather than change the file outright.


Can I play a game installed on my Xbox with another disc?

Question: So I have Skyrim, but part of the disc is scratched and it won't ever get passed the standard Skyrim loading screen when I try to load a saved game. If I was to install it on my Xbox with another disc (a friends) would I be able to play that installation using my disc?
Answer: The answer is - it depends.
There's a type of "authentication check" that does a rudimentary "is this a valid Xbox 360 Skyrim disc" that happens when you first start the game.  The intent of this check is to ensure you're not sharing or selling the disc after install.
This isn't anywhere as intense as the actual game itself, but there's still a chance that the part of the disc it checks has been damaged.  If it hasn't been, then you'd be fine.  If it has, then this technique will not work.
I've seen discs go either way though, so the only way to know is to try.
Comment: @James, it's disc-specific.  It can't be definitively answered without having the specific disc that is scratched.  Nobody can reproduce his situation but him.
Comment: This should be a comment, not an answer.
Comment: @James, I don't understand - sometimes "it depends" is an answer.  ([for example](http://gaming.stackexchange.com/search?page=2&tab=relevance&q=is%3aanswer%20depends))
Comment: "It can vary between games so the only way to tell for this game is to try it" seems like a message to me for someone to actually give it a try for the answer.. Sorry man but that is a comment to me, not an answer. If the question was more generic to just cover all games then this is the answer, but this question is about a specific game and so to me is a comment.
Answer: I can answer this to some degree, because I've dealt with the problem before. My grandson had Call Of Duty and he would always play on disk.
I always played on install and disk. He had damaged his disk, so I went over his house and installed the game off of my disk, which resulted in him being able to play with no problems. Therefore, it does not matter if you are using the same disc, as to it continuously referring to the disk after install obviously does not matter, since his  disk would not play.
It appears to be the first time that this is happening. It does just a small system check for a disk that is not damaged.
Now, what does that allow? Legally, you cannot make a copied disk and play it. But you could spend pennies on the dollar for certain damaged disks, rent the disk from a kiosk or video store then install and play the game.
In other words, Microsoft tries to prevent most piracy scenarios, but it does not go overboard to prevent them all, and it most likely does not matter if you had purchased an original disk.
Answer: Yes but the chances of it working if your original disk doesn't work are slim. It does not install the entire game to load it off your hard drive, but rather things like textures and other resource intensive items.
You will still need a functioning disk to play the game successfully.
Comment: this is incorrect. If you have a game installed your diskdrive will not be spinning except for the dick check routine.


can't make my RPI booting

Question: i m a manupilating RPI B+ for the first time excuse me for my language i m Tunisian and i m having problem with making my RPI  works headless ,the first one is i m using win32diskimager to write WHeezy on my SDcard,i m actually following a tutorial to make my RPI works on my laptop using local area connection but when i enter The SD card to extract file that i already written i can't open it,the second problem is i have this chargeur of my phone that in first time then it was corrupted (my chargeur 4.8v supply and 0.4A) remebering i m not connecting anything else with my RPI,now i have connected a usb alimentation to my laptop it first worked then turned off ,is there a chance that my RPI is corrupted while getting low alimentation!!i hope not , asking for help.thnks any way.
Comment: It might run off the laptop but don't use that charger.
Comment: @goldilocks i did command a new chargeur with 5v nd 1A ,i guess it ll work but still have my SDcard problem
Answer: B+ should have 5v at least 1.2a (maybe higher current for USB devices - suggested even 2A+) - this information available on official FAQ : http://www.raspberrypi.org/help/faqs/#powerReqs

can't make my RPI booting


How is time measured in particle experiments?

Question: I was reading about the half life measurements and was curious to understand the experimental setups that allows so minute measurements to be captured. Specifically looking into half life of Higgs boson. I am looking to understand one example method of measuring Higgs boson half life. Please feel free to explain any one setup
Comment: I just added requesting one example, any other suggestions
Comment: Do you have an example of a specific experiment? It would be hard to answer without that. Nonetheless I would be interested in the answer as well.
Comment: Often, even different experiments measuring the same thing use different methods. So currently the question may not be answerable. You would have to show us a specific paper, or an article referring to a specific experiment that some people did. Or you could just ask for *any* one example of a method which could measure the half life of a higgs boson, for example.
Comment: I have used my mod superpower to reopen this question, which survived its first trip through the close review queue and which was improved after two of three close votes were cast. The answer by tobi_s is an exceptionally fine bit of physics explication. If the community feels my unilateral action is inappropriate because I also answered the question, please raise a flag to summon another moderator, or we can have discussion in [chat] or on [meta].
Answer: The Higgs is a challenging example because the tabulated quantity is the decay width $\Gamma$, from which a mean life $t≈\hbar/\Gamma$ is inferred.  That is, nobody starts a clock when the Higgs is born and then stops it $10^{-22}$ seconds later.  Instead, the short lifetime of the Higgs contributes an intrinsic uncertainty to its mass, and those variations in the masses of "Higgs events" show up in energy measurements.
Sub-nanosecond timing is a solved problem — consider that you are probably reading this post on a computer whose processor is driven by a sub-nanosecond (multi-gigahertz) clock.  For picosecond-level timing, you have to account for the fact that electromagnetic signals travel no faster than 0.3 millimeters per picosecond, about the size of a flake of pepper.  So you can't do reliable picosecond timing on a signal that's gone through a coaxial cable, because the propagation time through the cable might vary with temperature.
However, if you have a cloud chamber photograph of a relativistic particle, you might be able to measure the distance between two events with sub-millimeter precision, and get picosecond timing from your position data.  Modern detectors don't take photographs of vapor trails, but instead collect ionization from relativistic particles on an array of wires.  The position and timing resolutions of modern detectors are the subject of lots of PhD theses.
You can use $\hbar≈6\times10^{-4}\rm\,eV\,ps≈0.6\,eV\,fs$ to do your own conversions between energy width and lifetime (though there's a $\ln2$ floating around if you want half-life).  The Higgs width is $\Gamma≈4\,\rm MeV$.
Comment: Right, that's a 9% difference, which would have been a 6% difference if I had rounded the single digit up instead of down. At the level of this answer, I don't care. My concern was getting the decimal point in the right place.
Comment: Where do the 0.6 eV fs come from? Wikipedia says it's closer to 0.6582 eV fs.
Comment: Really nice answer.
Answer: The shortest lifetime that was directly measured is that of the neutral pion, or $\pi^0$, the lightest meson at a mass of $m=135\,\textrm{MeV}$.  It decays to (predominantly) two photons and it has a lifetime of $\tau=8.1\times 10^{-17}\,\textrm{s}$.  As such, it is both lighter and longer-lived than the Higgs by orders of magnitude, so much actually that particle physicists call it a stable particle.  Nevertheless, it is interesting how such a lifetime could be measured.  There is only one such measurement, performed in 1985 Phys. Lett. B 158 (1) 1985, pp. 81-84.
Let's discuss the principle of the measurement, but leaving aside some of the auxiliary difficulties.  The idea is quickly told: at high energies $E$, the (observed) lifetime of the neutral pion increases by the usual dilation factor $\gamma=E/m$.  Assume the neutral pion is produced by a beam incident on a thin foil of a dense material.  Then to a very good approximation, the point of production will be equally distributed over the thickness of the foil and the total number of pions will be proportional to the thickness of the foil.  Additionally, secondary hadronic reactions can be neglected for a thin enough foil.  Two things can happen: the pion flies out of the foil and decays there, or the pion decays inside the foil.  If it decays inside the foil, there is a chance for one or both of the decay photons to undergo pair conversion.  The resulting electron/positron pairs are counted.
Let's have a look at some numbers.  For ease of calculation, let's assume that $\gamma = 1000$ meaning an energy of $135\,\textrm{GeV}$, not uncommon in experiment.  Then the lifetime will increase by a factor 1000, so $\gamma\tau\approx 8.1\times 10^{-14}\,\textrm{s}$.  At these energies the velocity of the pion will be indistinguishable from the speed of light, i.e. (in useful units) $30\,\textrm{cm}/\textrm{ns}$, allowing the pion to propagate $25\,\mu\textrm{m}$.  A foil of this thickness is technically feasible, e.g. Rutherford's famous experiment used a $4\,\mu\textrm{m}$ gold foil.
The experiment now proceeds by using foils of different thickness.  The total number of pions produced is then proportional to the thickness of each foil.  Once the foil becomes thicker than the speed of light times the (dilated) lifetime of the pion, the number of pair conversion will increase significantly, and the exact relation can be modeled as function of the neutral pion's lifetime.  Fitting the model to the data gives the lifetime.
Comment: Particle physicists don't call the pi0 stable -- even in collisions in the detectors at the LHC it decays into two photons before it reaches the calorimeters
Comment: A top-notch answer.
Comment: @Andre Holzner a stable particle as opposed to a resonance. Historically, the terminology comes from nuclear physics, and so the definition is "crosses a distance larger than a nucleus before decaying." BTW just a funny observation: the EM calorimeter wouldn't really be important to the $\pi^0$ if it managed to reach it.
Comment: I'm tempted to add a another answer that discusses what the lifetime of the Higgs means, but I see how this would be an encyclopedia article in itself. I already refrained from adding how the $\pi^0$ lifetime is indirectly measured. That would only need 1) relation width ⇄ lifetime 2) crossing symmetry 3) off-shell (virtual) photons and 4) photon-induced reactions. The short answer would be that when particle physicists talk about lifetime of short-lived particles (everything shorter than the $\pi^0$) they mean inverse width and assume that the physics connecting the two is correct.
Comment: Note: I corrected the propagation length, I had lost a factor 10 when I was doing the math in my head. I was thinking that $3\mu$ was too thin, so I redid the math on paper, and now it's more in line with what I remember from when we discussed redoing the experiment a few years back.
Comment: "when particle physicists talk about lifetime of short-lived particles (...) they mean inverse width and assume that the physics connecting the two is correct." ← let me add that since the $\pi^0$ lifetime can be measured directly, it is a good testcase for the fundamental property connecting lifetimes and widths. Nowadays, the width of the $\pi^0$ is determined to such accuracy that there is some tension with the direct lifetime measurement described above. It would thus be a test that our understanding of the dynamics is correct to re-do the experiment with higher precision.


Is it possible to combine RSS feeds and other stories in the same view?

Question: I subscribe to an RSS feed I would like to post in the same view as some user-generated stories and I would like both types of content to display as a uniform list. Can that be easily done?
Answer: Can you give more details? Do you mean importing a feed into your website and then displaying its contents alongside your own? You'd need the Feeds module to do that.
UPDATE: Yes, this is possible. You need the Feeds module, and to create a content-type to hold the feeds. When displaying your view, use Filters to narrow it down to just your user-entry content-type and the Feeds-info content-type, and they will both display (in whatever order you set, the default is posted date).
Comment: Yes basically I have a view that I want to populate with an RSS news feed on a daily basis, but I also want my users to be able write stories that would appear in that same view. So the view ends up being a combination of RSS news stories as well as stories submitted by the website's administrators.


How do I make a contract mint NFTs randomly with a metadata that's already on IPFS?

Question: I want to deploy an NFT that at mint time, selects at random one of an enum of several metadata choices. Obviously I can't do this on a static mint site because you could exploit the contract by passing your own integer via a script directly to the contract. I could make an IPFS folder of pre-generated metadata that is named incrementally as in: 1.json, 2.json, 3.json, etc... I could make the metadata contents a random assortment of a few metadata choices. If I had 3 files 1.json, 2.json, and 3.json, I could make the metadata: 1.json 2.json 2.json 1.json 3.json 2.json 3.json 1.json 1.json 2.json 3.json 2.json 1.json 1.json 1.json 1.json 3.json 2.json 3.json 2.json 2.json 2.json 1.json, and so on... But this isn't ideal because an attacker could just view the metadata files, decide which one the attacker likes and wait for that integer to be next in line for minting. Chainlink VRF is probably the only thing that can actually generate a true random value at mint time that is somewhat hard to attack. But I can't find a recent enough tutorial on how to mint an NFT this way. Is there any tutorial that shows how to mint an NFT that selects the metadata at random at run time? Whether it uses Chainlink or something else?
Answer: Yes, you are correct that Chainlink VRF is a good solution to generate a random number at mint time for your NFT, and it can help to prevent any potential exploitation of the contract.
Here's example code I got from somewhere, worked for me
pragma solidity ^0.8.0;

import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";

contract MyNFT is VRFConsumerBase {
    uint256 public tokenIdCounter;
    enum MetadataChoices { Choice1, Choice2, Choice3 }

    bytes32 internal keyHash;
    uint256 internal fee;
    uint256 public randomResult;

    mapping(bytes32 => address) public requestIdToSender;
    mapping(bytes32 => uint256) public requestIdToTokenId;
    mapping(uint256 => string) public tokenIdToMetadata;

    event requestedRandomness(bytes32 requestId);

    constructor(address vrfCoordinator, address link, bytes32 _keyHash, uint256 _fee)
        VRFConsumerBase(vrfCoordinator, link) {
        keyHash = _keyHash;
        fee = _fee;
        metadataChoices.push(MetadataChoices.Choice1);
        metadataChoices.push(MetadataChoices.Choice2);
        metadataChoices.push(MetadataChoices.Choice3);
    }

    function requestRandomNumber(uint256 tokenId) external returns (bytes32) {
        require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK to fulfill request");
        bytes32 requestId = requestRandomness(keyHash, fee);
        requestIdToSender[requestId] = msg.sender;
        requestIdToTokenId[requestId] = tokenId;
        emit requestedRandomness(requestId);
        return requestId;
    }

    function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
        address sender = requestIdToSender[requestId];
        uint256 tokenId = requestIdToTokenId[requestId];
        uint256 index = randomness % metadataChoices.length;
        tokenIdToMetadata[tokenId] = _metadataForChoice(metadataChoices[index]);
        randomResult = randomness;
        _safeMint(sender, tokenId);
    }
}

Comment: Sure and if you have any issues lemme know
Comment: Awesome thank you for the answer! I will spin this up on a testnet to double check that the code works.
Comment: I'm currently getting this error https://imgur.com/a/DhqegWC. Was `metadataChoices` supposed to be declared earlier in the contract?


Pedal floored and my ibiza 1.6 mpi 2018 with 53000 milage can't reach max speed of 150km/h

Question: I have a problem with my ibiza 1.6 mpi engine 110 hp. I can't exceed 150 km/h but in inclined roads i hardly reach it  170 km/h with a cut in engine what do think the problem is due to although the computer shows everything is ok.
Comment: Serviced it lately? oil, filters? checked the brakes?
Comment: Everything is alright oil filter air filter I have also changed spark plugs.
Comment: Notice that the cars behaviour under 150km/hspeed is very normal
Answer: The technical specs for your vehicle are listed here:
Technical specs
They list a MAXIMUM speed of 187 km/hr.  So your 170 km/hr is close enough to that figure that I suspect there is nothing wrong.  The 187 figure was likely obtained under controlled conditions at a track where you are running on a public road with varying conditions.
This is not exactly a "performance" vehicle as the 105 HP listed is quite low for a vehicle that weighs more than 1000 kg.
Comment: I have I reached 150 km/h but 170 I couldn't reach it in flat road but in descending one with cuts in the ignition I think


Does mass of universe at the moment of big bang changes compared to present day?

Question: Empty space isn't empty as it can contain energy in terms of quantum fluctuation, so since inflation I like to know whether if the present day universe has put on weight?
Comment: Possible duplicate of [Is the total mass of the universe constant in time?](https://physics.stackexchange.com/q/77322/) which is a duplicate of [Total energy of the Universe](https://physics.stackexchange.com/q/2838)
Comment: Note that the issue is not just about mass/energy-conservation; the deeper issue is that there is no satisfactory definition of gravitational energy in the first place. Possible duplicates: http://physics.stackexchange.com/q/2838/2451 ,  http://physics.stackexchange.com/q/10309/2451 , https://physics.stackexchange.com/q/2597/2451 , https://physics.stackexchange.com/q/7060/2451 , https://physics.stackexchange.com/q/35431/2451 , https://physics.stackexchange.com/q/109532/2451 , https://physics.stackexchange.com/q/127397/2451 , https://physics.stackexchange.com/q/175186/2451 and links therein.
Comment: -1. No research effort.
Comment: Quantum fluctuations don't add energy or mass. There are two views. (1) The universe started from a point and expanded. In this case its mass is finite and is decreasing due to the red shift of light and similar effects. I don't believe the current cosmology renormalizes this, so mass is decreasing. (2) The universe started from an infinite size of infinite density and infinite mass. Then the density decreased, but mass and size remain infinite. Infinite quantities have no physical meaning, but this is still what many believe today.
Answer: We should start with the usual reminder that the vacuum doesn't fluctuate and it isn't full of pairs of virtual particles. See Are vacuum fluctuations really happening all the time? for more on this.
However there is an energy associated with the vacuum state of a quantum field, and this energy density, i.e. energy per cubic metre, doesn't change as the universe expands. That means the the expansion of space does produce energy out of nowhere.
Well ... sort of.
The problem is that if the universe is infinite, which it may well be, then it makes no sense to talk about total energy because you can't do arithmetic with infinity. So your question has the universe put on weight doesn't have any simple answer.
And there are other complicating factors. If we do a naive calculation of the vacuum energy we end up with such a large number that it would have blown up the universe in a tiny fraction of a second and we wouldn't be here now. That means the vacuum energy cannot contribute to gravity - either that or our calculation of the vacuum energy is totally wrong. But there does appear to be some vacuum energy that does contribute to gravity, and this is the dark energy that you've probably heard of.
So I think we'd have to say that right now we don't really understand what the situation is with vacuum energy and so we can't answer your question.
Answer:
so since inflation I like to know whether if the present day universe has put on weight?

From the title you mean mass and not weight as in the question , which I suppose is a humorous one.
One has to define mass. Mass in special relativity is the length of the four vector

The length of the energy-momentum 4-vector is given by

The length of this 4-vector is the rest energy of the particle. The invariance is associated with the fact that the rest mass is the same in any inertial frame of reference.

Discussing a flat  universe, where special relativity holds, the mass of the invariant mass of the universe is the length of the summed four vectors of all the constituents, particles and radiation. As the name implies this mass is invariant.
Now as discussed here, the question of whether the universe is flat or curved in some way is an open research question.
If curved anything goes as far as masses go, though people are still trying to get a mass estimate for the universe.
So if a Big Bang model is used, one cannot answer if at the beginning there was a  possible times where the universe was curved. Only after reaching flatness, or approximate flatness one can talk of conserved invariant mass of the universe,   which is consistent with our observations at the moment.

In reality, determining the value of the density parameter and thus the ultimate fate of the universe remains one of the major unsolved problems in modern cosmology. The recently (June 30, 2001) launched MAP mission will be able to measure the value definitively within the next 5 years.

See also the answer here. .
Edit after comment by MBN
This article in wikipedia on mass in general relativity shows that all of the above discussion is on shaky ground, as there are many possible mass definitions in GR, which are still under research.
So my generalizing the concept of invariant mass to the total four vector of the universe is on shaky ground, even for flat spaces, as time also enters the frame and is constrained only locally. So take the above with many grains of salt. You can keep that the mass density of the universe  is a measurable goal.
Comment: Special relativity doesn't hold in a spatially flat universe, which is what is usually meant by flat. It holds if the whole space-time is flat.
Comment: @MBN Do you have a link for this statement which defines the difference? You mean that when we say x.,y,z  can be flat and   time may be curved? It is the only way I see that Lorenz transformations would not hold.
Comment: This is very basis, any book on GR or cosmology would have it. A Friedman model with flat space, will not be flat as spacetime. You can compute that quite easily. Any way it spacetime were falt it would be Mikowski it wouldn't have gravity.  Or if you wish if there is stuff in the universe, the stress-energy tensor would be non zero, but if the spacetime is flat, then the Eisntein tensor would be zero, so the equations wouldn'thold.


Is this an observational study or an experimental study?

Question: I'm doing a project where I predict whether the US will reach its carbon-neutral goal using past data. And I want to know if it would be an observational study or an experimental study. I feel like it's a bit of both so I'm not sure which one it would be.
Comment: I fail to see how this question is related to mathematics...
Comment: Are you doing something as part of your study that would affect the US outcome?
Answer: First, welcome to MSE. This question is probably better posted to Cross-Validated, the statistics and data analysis Q&A site. However, given this is a conceptual statistics question, I think it has a place here.
You are performing an observational study, not an experimental one. Why?

You are not applying changes to treatment and control groups.
You are using historical data that was generated for other purposes.

Experimental studies require active manipulation of a situation to see a result. Outside of the natural sciences, it is very hard to accomplish this (save for psychology, which has had some good successes).
You are planning to use historical data for your study


DNS lookups - determine destination server

Question: I have a question regarding destination determination of DNS lookups when a machine is connected to multi network interfaces (Linux).
Intro:
I am developing a Linux box which is connected to 2 (or more) networks.
Each Network interface is connected to a different network (ISP) and receives (DHCP) different IP / Default Gateway and 2 DNS servers.
The box runs different network applications (clients) which are bounded to a specific interface.
For example:
Application A connects to a server via network 1 (interface 1).
Application B connects to a server via network 2 (interface 2).
I can use source based routing to control the destination interface for each Application.
(In Linux with routing policy - ip rule/ ip route / etc…).
My question is regarding DNS lookups:
Linux share one resolv.conf file, both networks (1,2) DNS server are maintained in this file.
When an application uses the standard getaddrinfo() function, it uses Linux default resolving mechanism (which goes through the reolv.conf file).
This means that Application B can send its DNS queries to a DNS server which is related to network 1.
I have access to the code, I can do it manually and send a DNS query directly to a specific DNS server from my application, but this is not the preferred option.
Is there standard ways (code/or configuration) to cause DNS lookups from Application A choose network 1 DNS server and Application B choose network 2 DNS server?
Thanks
Answer: No. You'll need to perform DNS resolution in a different manner than depending on the IP stack.


Force.com Site data

Question: I need to integrate with client Force.com site and there is something I have problem with....
Is it possible to retrieve data that was used to create this page?
I mean one of parameter is parent record Id, child records are displayed in table.
When I use REST GET method I get html page as response.
Is it possible to retrieve this data(child records) in XML , JSON or some other form just having Force.com Site URL?
Answer: The Force.com database is a secure database. If you're asking whether you can query the database using the URL of a page that displays the data you're looking for, the answer would be no. The page that displays that data would be generated using VisualForce on the Server Side and displayed as HTML on the browser side.
Answer: If you have control of the force.com site and you're not just trying to scrape someone else's site, you could create an Apex class and use the REST modifiers to create REST actions.
https://developer.salesforce.com/page/Creating_REST_APIs_using_Apex_REST
After creating the REST service you can make it public on the Force.com Site by adding it to the public access settings for the Site.
Can I have a public APEX REST API?
The same can be done for a SOAP API as well if SOAP is better suited to your integration.
Otherwise, no, as crmprogdev mentioned, Force.com Sites is a secure product designed to allow the developer to expose as much as wanted, but not more than that.  If the product were open in the way you ask, anyone could just come through and "borrow" your sales leads, accounts, etc.
Answer: If you have access to the Salesforce instance outputting this Site
You could create a distinct Visualforce  and output as a JSON object the result of that SOQL query processed in that other page. Then, you simply have to expose that Visualforce page to the Site.
If you do not have access to that Salesforce instance and if this system doesn't provide any REST endpoint
I see two options:

Contact the Salesforce administrator to do the first suggestion;
See if there're any XHR calls to populate the content of the page - you could then query that;
If you can't do that with their agreement, the only other option is to build a good old scraper and process the output (of course, this is considered questionable/illegal for many people).

If #3 is your only option, I'd suggest building a middleware in a different language than Apex providing some good libraries to consume that HTML and process it, and then expose it in JSON through your own REST endpoint. Then, call that JSON endpoint from your Apex code.

If you know JavaScript and are familiar with Node.js, there are great libraries to simplify scraping, such as cheeriojs (https://github.com/cheeriojs/cheerio). I know you can find some interesting ones too in Ruby, Golang or Python.
Good luck!

Force.com Site data


Data structure similar to a 2-argument map

Question: Is there a data structure (readily available in STL or boost), that accepts two arguments and maps it to a certain value?
Examples would be for returning certain information in a coordinate grid or getting the weight of an edge in a graph:

coordinate_quadrant(-1,-1) = 3
weight_of(u,v) = 10

The quadrant example could be done in a simple function with four if statements.  I'm mainly looking for an example that would suit the weight example. I'm trying to avoid having to create an edge class and pass that into the weight_of(Edge edge) function.
Answer: You could use std::map< std::pair<Type1,Type2>, Type3 >.
Answer: I would consider the following choices:
Option 1
std::map with std::pair< Type1, Type2 > as the key and Type3 as the value
std::map< std::pair< Type1, Type2 >, Type3 > data;

Option 2
2-dimensional std::vector
In case that the Type1 and Type2 are integers, as you might find when modeling a graph or Cartesian space:
    std::vector< std::vector< Type3 > > data;
Option 3
user-defined class containing Type1 and Type2, which can be mapped to Type3
In case you might ever want to decorate your two types with more values, you could define a class that contains both of your types, and use a std::map to map it to the third type:
public:
    MyClass( Type1 x, Type2 y ) : x_( x ), y_( y )

    Type1 x() const {
        return x_;
    }

    Type2 y() const {
        return y_;
    }

private:
    Type1 x_;
    Type2 y_;
};

std::map< MyClass, Type3 > data;

The benefit of Option 1 is that it's really fast and easy to code, and should make sense to anyone who knows C++. Option 2 is likely a small bit faster, and has the added benefit that it can easily be modified to have more dimensions. The downside of Option 2 is that your values need to be integer indices into the 2-dimensional vector.
In my opinion Option 3 is the best choice to me because it's readable, places no requirements on the type of Type1 and Type2, and can be extended to contain more data in a very reasonable way. The downside to Option 3 is that you need to define a StrictWeakOrdering for comparing MyClass objects to each other, but that's fairly straightforward:
bool operator<(const MyClass & rhs) const {
    return ( rhs.x() <= x() && rhs.y() <= y() );
}

Make that a member function of your class, and you should be ready to go.
Like many things in programming, there's not an obvious right answer until you consider the specifics of what you're doing and how much time you're willing to invest. Don't forget to check for key existence and out-of-bounds errors. :)
Comment: Your operator< is wrong, I think. If lhs.xrhs.y then both lhs<rhs and rhs<lhs are false. This is technically allowed but usually not intended. For instance, it means that (1,3) and (4,1) are considered equivalent.
Answer: Use an object that is a pair of integers on the back end. In other words, implement map, but for this pair object. You can't override operator [] to accept multiple arguments, but you can override operator
() on a custom  map class, so you can get some syntactical sugar e.g. my_map[row](col) = whatever


Sword of Truth 4e Setting

Question: Has anyone seen or heard of anyone working up a Sword of Truth series 4e setting?
Answer: There is not an official RPG setting for The Sword of Truth. Terry Goodkind will not license the book for an RPG. From the official Sword of Truth FAQ:

QUESTION 4 Are there any SOT RPGs or
  video games or D&D type games out
  there?
ANSWER 4 No, there is not. Terry is
  adamantly against having his books
  made into a video game because he sees
  them as a medium that is incapable of
  incorporating his philosophy and story
  elements into the game, which he sees
  as the most important parts. So he
  doesn't want to have a game made when
  it will just contain the fantasy
  elements as well as changes to the
  story, which there would have to be to
  make the game viable. The same thing
  applies to the D&D type game. We may
  disagree with him and might not like
  it, but 'dems the breaks.

You might adapt the work others have done creating a Sword of Truth setting for D&D 3rd Edition.
Comment: That sucks massive amounts... Thanks for the indie work.
Comment: @Adam: For what it's worth, you've got linkrot on your Sword of Truth forum links.  Not sure if these have been reposted elsewhere, since I don't see anything obvious.  I could guess, but you might have a better idea about what you're looking for.
Answer: No
It would be challenging to do moreso because of the relative rarity of magic, the naturalist tones (the difference between men and women's han for example), the rather absolute nature of some of the magics (do you see a confessor's touch being Save ends) and the difference in power level between say richard and more or less anyone else.
and just to comment on the above, after watching the tv version, I have a hard time believing philosophy has much to do with it.

Sword of Truth 4e Setting


Instant trigger email to new subscribes only in a data extension

Question: I have a data extension in SFMC that is being populated with opt-ins from an external source. I would like to trigger an instant welcome email ONLY to anyone who is added to this data extension. How do I go about doing this? I want make sure I don't resend to the anyone who was already on this data extension and has received the email.
Comment: How firm are you on the term "INSTANT".  If you're not ultra familiar with engineering an API to create a triggered send, then you can easily use Journey Builder.  The caveat there is that any automation you run to refresh your DE has a default minimum reoccurrence of 1 hour.  So, there could be a lag of delivery between 1 min & 59 mins depending on the contact.
Answer: You would have to either do a Triggered email or an API event for a journey.
Either way, you would have to use APIs to trigger them.
After that, you could use a DE as an exclusion list in the email deployment so you don't send the email twice.
If you are doing it as a journey then just select that people can only enter the journey once.


Can't login after installing Craft CMS 3

Question: I just installed Craft CMS 3 and I tried logging in as my admin user but it's not working. I enter the correct login information and nothing happens. I tried the reset password option but never got the email for some reason. Anyone have any ideas what is going on?
Comment: Does the login button turn red when you've typed enough? Craft might not have access to all of its javascript?
Comment: @kr37 Yes the login button turns red. I don't have JavaScript errors.
Comment: So just to be clear, you're not getting the message, "Invalid username or password", you're literally getting no message or action at all?
Comment: @TimKnight Yes, that is correct!
Answer: It was a permission issue. I used the command below on the entire craft folder to get this to work:
sudo chmod -R 777 craft/

The logs were saying that it didn't have permissions to open many files.
Answer: In case someone else is struggling with this: For development purposes I usually install Craft taking a subdomain. So my base domain "name.com" has an SSL certificate, the subdomain "sub.name.com" doesn't - that's causing the same problem. Just add a SSL certificate to the subdomain aswell and it should be working fine. Hope it's helping someone some day. :-)
Answer: In my case I was getting [error][yii\web\HttpException:400] yii\web\BadRequestHttpException: Unable to verify your data submission. in /app/vendor/yiisoft/yii2/web/Controller.php:218 on web.log
This worked for me:

clearing cookies on chrome chrome://settings/clearBrowserData
then cleared caches  craft clear-caches/all
Answer: I had the same problems after installing Craft CMS 3. I have been able to resolve it by adding write permissions to all directories in the storage directory. Just issue sudo chmod 777 -R storage.
Then I could login to the admin page.
Comment: Requisite permissions disclaimer: Please be careful when fully opening permissions, _especially_ if you are in any kind of shared environment.


Determine process uptime

Question: Is there a way to determine the 'uptime' of a process in Windows. Disappointed to find that it is not one of the attributes available when using the Task Manager.
Answer: This can be done using Powershell.
Run it as admin and then execute
Get-Process | select name, starttime
You will get a list of all running processes and their start times
Referenced from:
http://blogs.technet.com/b/heyscriptingguy/archive/2012/11/18/powertip-use-powershell-to-easily-see-process-start-time.aspx
Comment: I see values for most of the services but the one I want (w3wp) doesn't have a start time listed.
Answer: You can see this with Process Explorer. In the taskbar menu select View and check Show Process Tree and the Show Lower Pane options. Right click on any column and Select Columns, now click on the Process Performance tab and check the Start Time box.
Community Update:
As mentioned in the comments, in more recent versions of the tool (currently as of 2019), the information has been relocated into the image tab of the property sheets regarding each process-tree item (Just double-click the process name, no other steps are required).
Comment: Hey TiZon. This looks a really useful tool. Thanks
Comment: This answer is outdated. For Process Explorer v16.26, right click the process -> Properties -> Threads tab -> start time is listed below. No need to check `Show Process Tree` or `Show Lower Pane`. The `Performance` tab does not list start time any more. The lower pane isn't used to find the start time.
Comment: In the link, Download section, "Run now from Sysinternals Live", when running, the `process tree` is not clickable in the view. I have windows 7 enterprise, so maybe it is blocked by my firewall.
Comment: @Betlista, there is no threads tab in Properties
Comment: Or you can right click, Properties and on Threads tab, there is start time.
Answer: If you're on a server where you cannot install any external tool, you still can :

Open the task manager
Click on the process tab
Locate your process
Right click on it
Select the Properties option

You can see a "creation date" right there, which should be the creation date of your process. With a simple substraction you can deduce the uptime.
Comment: Win 8.1 also shows executable file properties
Comment: This only works on Windows 8. If you are still on Windows 7, the Properties option shows properties of the running executable file, not of the process.
Comment: Windows 11: this displays the file creation time, not the process creation time.
Answer: In CMD you can use standard Windows Management Instrumentation Command-line (WMIC) utility to get the process start time:
wmic process where Name="<process name>" get CreationDate

or
wmic process where ProcessID="<PID>" get CreationDate

You'll get a datetime like this: 20201021010512.852810+180.
Format: YYYYMMDDHHMMSS.ssssss+MMM(UTC offset)
If you want a more readable representation you'd need to prep it with a script. Here I have written a little batch script for the purpose:
@ECHO OFF
SETLOCAL

IF [%1]==[] (
    ECHO Prints process creation date in ISO format.
    ECHO:
    ECHO USAGE: %~n0 ^<PID or Process name^>
    EXIT /B 1
)

IF [%~x1]==[.exe] (SET type=Name) ELSE (SET type=ProcessID)

FOR /F "tokens=1,2 delims==" %%a IN ('wmic process where %type%^="%~1" get CreationDate /value') DO (
    IF [%%a]==[CreationDate] SET proc_cd=%%b
)

IF DEFINED proc_cd (
    ECHO %proc_cd:~0,4%-%proc_cd:~4,2%-%proc_cd:~6,2%T%proc_cd:~8,2%:%proc_cd:~10,2%:%proc_cd:~12,2%
)

Feed it with a PID or a process name ending with .exe and it will output when the process was started. Caveat: If there are many processes with the same name it would output the time only for the last one started.
Answer: Open Task Manager and right-click on the process. Choose Properties in the menu and look at the field Accessed in the first tab. Unless multiple instances have been started this will give you the start time of the process.
Answer: maybe you can try procxp http://technet.microsoft.com/en-us/sysinternals/bb896653
Answer: With the PID from Task Manager, you can use the following Powershell command with the implied -End (Get-Date):
New-Timespan -Start (Get-Process -Id PID).StartTime

Determine process uptime


Event selection cuts and cross section relation

Question: I was working on experimental HEP project where I am bit confused. I generated 1000 MC events with say "x" cross section and without selection cuts. Now suppose I put some selection cuts while writing the C++ code for the data analysis of these events. Because of this, the number of events now drops down, say "y" (<1000) which is logical but while doing any computation should I write the cross section now as (y.x)/1000 ?
Comment: If you are looking for the probability of an event that matches your cut (e.g. "scatters by at least 10°"), then yes - you have just calculated that that probability is (obviously) smaller than the probability of "any" scatter, including the ones you don't care about
Comment: Do you want to say "cross section, given cuts x" , or "over all probability"? That changes the answer.
Comment: @Floris   I meant that say 10pb is the cross section of 1000 events without selection cuts. Now, I write a C++ code where I put a selection cut which reduces the events to 900. So now, should I also normalize the cross section to 900*10/1000 = 9pb and use this value for further analysis instead of 10pb?
Comment: @Floris Should I equate probability with cross section and conclude that my new cross section after selection cut is 9pb?
Answer: The particular cross section is fixed by the physics of the interaction. A Monte Carlo modelling the data has all the possible channels and phase space defined by construction. In the experiment one cannot access all the phase space, due to the experimental limitations.

The transition probability per unit time for the interaction under study is given by the specific quantum mechanical model ,used in the generator of the MC events.
When the MC data fit the part of the cross section available to the detectors, one extrapolates to the full cross section , assuming that the model is perfect.
So if your experiment covers lets say an angle between two particles of 90 degrees, the Monte Carlo is used to extrapolate to the full crossection 360 degree phase space.   Suppose you found 2 events within the experiment's phase space, and the MC extrapolates another 3. Then the cross section for the interaction gives five events, of which two detectable by the experiment. Thus the theoretical cross section is measured by the use of the Monte Carlo events.


Etymology of words used to start and ask questions

Question: Could you please help me understand the etymology of words used to start questions? I am particularly interested by the words 'how' and 'why'. Thank you!
Comment: I think that your question is too broad. Maybe the site https://english.stackexchange.com is the place where you should ask about etymology but after doing some research on your own. You have to ask more specific questions, about a particular aspect of the etimology of those words that you don't understand or find difficult.
Answer: The OED gives them both as coming from Old English:

how Old English hú < *hwó, corresponding to Old Frisian hû, hô, Old Saxon hwô, hwuo, wô (Middle Dutch hoe (ho, hou), Dutch hoe, Middle Low German woe), Old High German (Tatian) wuo < Germanic *hwô, an adverbial formation from the interrogative pronoun stem hwa- who? Parallel to Middle Dutch hú, and to Gothic hwaiwa, Old High German hweo, weo, wio, German wie, with different suffixes.
why Old English hwí , hwý instrumental case of hwæt what pron., adj.1, adv., int., conj., and n., governed by to or for (see forwhy adv. and conj.) or used simply as adverb, corresponding to Old Saxon hwî used with prepositions (bi hwî , te hwî ) and simply = why, wherefore, Old Norse hví used as dative of hvat , and as adverb = why (Middle Swedish, Danish hvi ) < Old Germanic *χwī < Indo-European *qwei , locative < *qwo- who pron.; compare Greek (Doric) πεῖ where.


Why use dim=0 when using torch.softmax() for getting predictions probabilities?

Question: I was watching a tutorial, when he want to calculate the probabilities of a predictions from logits it use softmax with dim=0 why? isn't dim=0 means take softmax across the rows?
so shouldn't we use dim=1? like when we want to get the class id we use torch.argmax(**, dim=1)
because every row is representing the probability of different classes for one sample so why not use dim=1?
what's the differences between these two(when we're getting class id using argmax and when getting probabilities using softmax)?
I read some answers on the other questions but I didn't understand it
Answer: It's hard to say why it might be in the tutorial, but usually you have (batch_number, **your_data) shape as input in your network, output in case of classification usually has (batch_number, number_of_classes), and you're right that in that case you should use dim=1(or recommended way use even dim=-1 because you can have more complicated output, for example - (batch_number, some_more_data, ..., number_of_classes) ) to get model confidence along dim which sum to 1, but sometimes in architecture of deep network might reshape dimension of the data for some purpose then you can check in what dimension number_of_classes is
and other part of question the difference between of argmax and softmax is that first one returns the confidences along number of classes, the second one returns the one class index with the highest confidence for each sample, usually you apply softmax and then argmax in order to get final class index
Hope it helps


Customizing CERTAIN Function Keys on Mac

Question: Is there a way to customize certain function row keys on Mac, without losing the functionality of others? I have a third-party display hooked up to my Mac mini and I want to use the standard F1 and F2 keys to control its brightness with a third-party app, but I can't find a way to do that without losing the correct functionality of all the other keys that I want to keep in place (like music controls, volume, etc). Is there a way to only customize certain function row keys while keeping all the other ones in tact, and if so, how to do this?
Comment: Your problem comes in that the 'Special Function' keys are not true F-Keys, so to reassign them you'd have to involve the Fn key for one 'half' of your shortcuts. You can assign an F-key to a menu item or a scripted Automator Service [which could be the trigger for many things] but you cannot reassign the Special Functions. What's the 3rd party app?
Comment: It's called ExternalDisplayBrightness, its name basically implies what it does - allows you to control a third-party display's brightness using the Fn keys on your Mac's keyboard. I want to assign the raise/lower brightness function keys already on the keyboard to this utility so it works the same way, but I can't do that at the moment without disabling all of the other special keys' functionality. Currently those two buttons are useless since Apple doesn't allow you to do this natively with most external monitors.
Answer: To maintain the functionality of your other Special Function keys whilst also being able to map ExternalDisplayBrightness to, 'true' F-keys will require that you use them whilst holding the Fn Key.

Assuming you set these to F1 & F2, then to action them you would press  Fn   F1  or  Fn   F2


How to Read a PDF File

Question: Aside from using ADO, is there any other way of extracting data from a PDF file using VB6?   I have successfully managed to open a PDF file using VB6 without using an Acrobat Reader, but the next step in my project requires reading the PDF file and finding data from it.   Example what pages show the word "cement"?
Comment: PDF parsing is [very tricky indeed](http://stackoverflow.com/questions/1251956/is-there-a-pdf-parser-for-php), apparently (that's for PHP, but will give you an idea regarding complexity). Meanwhile: VB6?!
Comment: Have you looked here: http://stackoverflow.com/questions/7784235/read-pdf-file-contents-in-vb
Answer: In general, you will need to rely on an external library. A pure VB solution (i.e. read file as text and process yourself) is nothing you pull off in a week.
You can use Adobe Acrobat via automation. An example to get you started is e.g. http://www.freevbcode.com/ShowCode.asp?ID=7066. Note however that the Adobe Reader is not sufficient, you really need full Acrobat. There are other popular PDF reading libraries (e.g. poppler), however you might have a hard time using those in VB6.
On a general remark, your chances of success depend on what you mean by "extract". Simply put,
 PDF is a purely descriptive format without metainformation. I.e. the file contains instructions like "Put an A at (x1,y1); put 'foo' at (x2, y2)", etc. Reading tables or any kind of structured information would require huge amounts of heuristics.
The best course of action is probably to try and get the data you seek to extract in a better suited data format (plaintext, XML, whatever).

How to Read a PDF File


Cirq: easiest way to compute qubit Hamiltonian expectation value with number of shots

Question: I was wondering what was the easiest way to take a qubit Hamiltonian, and get an expectation value estimated with a certain number of shots over a parameterized quantum circuit (or ansatz) with Cirq.
Comment: Could you please provide more details?
Comment: @MartinVesely What kind of details? What is a qubit hamiltonian maybe?
Comment: Thanks, the link helped me to understand the question.
Answer: tl;dr: You need to compute the average of the parity of the observed bitstrings, with an understanding that the circuit was executed with some appended measurement gates like $V_{measure} U(\theta)$. Check out footnote 3 for an example implementation in Cirq.
The core idea of how to do this is fairly simple, but I'm going to provide a series of progressively more complicated examples that emphasize that this computation is very contextual.

Compute $\langle Z_0 \rangle$: To do this, you would run your parametrized circuit (call it $U(\theta)$), and then you want to do a weighted average of the bit that you observed. If we use the convention that $Z | 1 \rangle = -1$ and  $Z | 0 \rangle = +1$, then computing the expectation value of $Z_0$ with respect to a single-qubit state $| \psi \rangle = c_0 | 0 \rangle + c_1 |1 \rangle$ gives:
\begin{align}
\langle Z_0 \rangle &= \langle \psi | Z_0 | \psi \rangle \\
&= |c_0|^2 - |c_1|^2
\end{align}The squared amplitudes $|c_i|$ are the probability $P(i)$ of observing bitstring $i$, so if we want to determine this quantity experimentally we would compute

\begin{align}
\langle \tilde{Z}_0 \rangle &= P(0) - P(1) \\
&= \frac{n_0 - n_1}{n_0 + n_1}
\end{align}where the tilde indicates that this is an estimator for the expectation value (and therefore carries along with it some statistical baggage) and $n_i$ is the number of bitstring $i$ that we observed.
The above formula makes a lot of intuitive sense if you're used to computing expectation values for Hamiltonians by hand using weighted sums of eigenvalues. However it will be easier later if we recast this as a problem of computing the parity of the bit we observed. To do so, first convert each bit measured as "0" to $1$ and each bit measured as "1" to $-1$. The function that converts individual bits to signed eigenvalues is $f(b) = 1 - 2b$ where $b\in \{0,1\}$. Then the estimator computed for $n$ repetitions of the circuit is:
$$
\langle \tilde{Z}_0 \rangle = \frac{1}{n} \sum_{i=1}^n f(b_0^{(i)})
$$
where $b_k^{(i)}$ is the observed outcome of the k-th qubit for the i-th repetition of the circuit.

Compute $\langle X_0 \rangle$ - This task is just another way of saying, "compute $\langle Z_0 \rangle$ in the x-basis". So, if you prepend the measurement with a Hadamard that sends the $|+ \rangle$ state to $|0 \rangle$ state$^1$, i.e. run $H_0 U(\theta)$ as your quantum circuit $^2$ then the computation is identical:
\begin{equation}
\langle \tilde{X}_0 \rangle = \frac{1}{n} \sum_{i=1}^n f(b_0^{(i)})
\end{equation}

Compute $\langle Z_0 Z_1 \rangle$ - this measuring the parity between two bits that we measure: It will be positive if both Z-measurements are the same, and negative otherwise. The basis states that you can measure and their corresponding eigenvalues are:
\begin{align}
|00 \rangle &\rightarrow 1 \\
|01 \rangle &\rightarrow -1 \\
|10 \rangle &\rightarrow -1 \\
|11 \rangle &\rightarrow 1 \\
\end{align}

$$
\langle \tilde{Z_0 Z_1} \rangle = \frac{1}{n} \sum_{i=1}^n f(b_0^{(i)}) f(b_1^{(i)})
$$
Again, this is just computing the average parity of bitstrings measured from the circuit output.

Compute $\langle \prod_k \sigma_{k,p(k)} \rangle$ - from (2) we saw that the measurement-based estimation of Pauli products is the same regardless of the identity of the pauli. I'm using the subscript $k, p(k)$ to represent a the Pauli operator on qubit $k$ whose identity is described by $p(k)\in 0, 1, 2, 3$. So given measurements extracted from $V_{measure} U(\theta)$ (your unitary appended by a set of measurement gates), you just need to compute the mean parity over all observed bitstrings by generalizing the previous formula:

$$
\langle \tilde{\prod_k \sigma_{k,p(k)}} \rangle = \frac{1}{n} \sum_{i=1}^n \prod_{k=0}^{N-1} f(b_k^{(i)})
$$
This looks complicated, but all it is a general formula for stating the average parity of bitstrings measured from the circuit output for a circuit that has been appended with the appropriate measurement gates.

1 The change of basis operation from basis $A$ to basis $B$ is generally the inverse of the operation that rotates any given vector in basis $A$ into the corresponding vector in basis $B$ - you're shifting your reference frame, not the vector.
2 Read from right to left!
3 To do this efficiently in Cirq, I would probably do something like
# Compute a pauli product estimator from n repetitions of a circuit prepended by
# a measurement unitary over N qubits
measurement_gates = cirq.Circuit(...)
results = cirq.Simulator().run(circuit + measurement_gates , repetitions=n)

# get the bool-type measurements, shape (n, N).
bool_outcomes = results.measurements.get("my_measurement_key")

#convert to an array of integer representations of the binary arrays, shape (n,).
int_outcomes = bool_outcomes.dot(1 << np.arange(bool_outcomes.shape[-1] - 1, -1, -1))

# Compute the parity of bitstrings averaged over n repetitions.
expectation_value = np.mean(find_parity(int_outcomes))

where find_parity is the function defined here.
Comment: TBH, I'm a bit surprised / shocked by the absence of a built-in function for measuring Pauli operators in a given state, using sampling on a real machine. Isn't this what VQE is all about?..
Comment: Last I heard they were working on getting that feature into Cirq and it may be there by now; another takeaway from this answer is that an API for computing sample-based pauli estimators can be quite confusing since the outcome has nothing to do with a standalone Pauli term and everything to do with an implied readout prep subcircuit.


Android any orientation XML layout

Question: Hello I am trying to make my layout compatible with all orientation screen types (landscape/portrait). For that I am using layout-land and layout-port.
This works for devices that have only 2 orientation positions (landscape and portrait) but is not working if I rotate a device that supports 4 orientation positions (land left/right, port upside down/upside). Is working only on default land position but if I rotate the device on the other landscape position, android choose the layout-port layouts instead of layout-land.
How can I solve this problem in XML? Or the only solution is to manage myself the orientation changes?
Answer: Here you will notice that I just listen to the stage for the StageOrientationEvent.ORIENTATION_CHANGE event. When the event fires there are five possible orientations that the stage can be in: default, rotated left, rotated right, upside down, and unknown.
http://www.unitedmindset.com/jonbcampos/2010/09/27/air-for-android-screen-orientation/
Answer: You can't do this using XML. You have to do programmatic. To detect orientation change  you can use OrientationEventListener
Answer: Your targetSDK has to be 2.2 (when the reverseLandscape and reversePortrait orientations were introduced... pretty sure it was in 2.2) and your device has to support these orientations. For example a Sony Tablet S won't go into reverseLandscape but will do reversePortrait
Comment: Oh.. I have android sdk 2.1 .. so maybe that could be the problem?
Answer: It seems that the layout-land works.. the problem was that I managed the orientation change by myself and took only 2 types of orientation..
(I manage the orientation just to get down the app title and make it full screen in landscape..)
Thank you for your answers though

Android any orientation XML layout


My abstract has been accepted for oral presentation but there is no info in the preliminary programme?

Question: I am a graduate student and just had my first abstract accepted for an oral presentation at a conference. We have been notified by email about our acceptance. Wheb I checked the preliminary programme today I couldn't find my name in any session. Does that mean I can't attend the conference or have been removed from the presentation list? I am really nervous about it since this is my first time presenting at a conference.
Answer: In my field, it's common that the preliminary program includes the plenaries and symposia (where the authors are chosen ahead of time), but not the research sessions (where the presentations are chosen from the abstracts submitted).  I suspect that's what's happening here, but it's fine to contact the organizers for clarification.
Comment: This is the most likely scenario. The final program should include more detail.
Answer: You need to contact the organizers of the conference and ask for clarification. It's unlikely that they canceled your talk without notifying you, but there is a problem and only the organizing committee can figure out what actually happened.


I took part in Tezos ICO in 2017, but I do not know the site where my coins from ICO are now

Question: Please help me!
I took part in Tezos ICO in 2017,  but I do not know the site where my coins from ICO are now. Where is this site now? What is its name?
Answer: There is no "site where my coins from ICO are now". Blockchain 101: Coins live on the chain, not in any wallet nor on any website. Wallets and websites are just visual interfaces to the chain. This is true for every crypto type.
From the ICO, you should have received a PDF with your email and a private key. If you have this PDF and the key, you can import this key to any wallet and access your ICO funds.
If you don't have that PDF and the private key, then you've lost it all.
Answer: By Tezos ICO I assume you mean the Tezos Fundraiser. The process of claiming a fundraiser allocation can be broken down into 2 main steps.

Activate the allocation (requires KYC)
Import the fundraiser account into a Tezos wallet of your choice

To complete these steps you will need some information that you received when you participated. You can find that information in a PDF file that you should have downloaded and stored safely, without which it will be impossible to claim your allocation.
From that PDF file (which should look similar to this) you will need:

Your Public Key Hash (commonly called Tezos address, starts with tz1)
The email address that you provided during the fundraiser
The 15 word secret key (do not reveal this to anyone)

You will also need a password which you provided during the fundraiser process. Unfortunately this password is not included in the PDF (you should have memorized it). If you cannot remember the password, I suggest you try different passwords, and failing that, you may try the official password recovery tool.
If you plan to keep your tez, remember to delegate your tez account so that you can start earning baking rewards. It's also highly recommended that you use a hardware wallet (like a Ledger) for any long-term storage.


Advice needed for Skinny to Muscular

Question: I'm very skinny boy ( Height 5'11" weight 65kgs ) . I'm daily eating only 2 meals a day due to work . Is there any alternative solution for transforming to athletic or physically fit body??  I can't exercise regularly also !!
Answer: If you can't eat properly and exercise then no, there is no chance you'll transform to an athletic or physically fit body. I try to be helpful and supportive but aside from diet and nutrition, what other options do you have?
Not having time really isn't much of an excuse. You could have decent progress with a commitment of this level:

Training 3 times a week for ~45 minutes.
20 minutes a day prepping some decent meals for yourself.
A marginal increase in grocery shopping.

But no, if you are going to eat two (probably bad) meals a day and not exercise, you will remain deconditioned. Hopefully you won't suffer health problems, but you might.
Comment: It is possible for me to workout 3 times a day and daily I can arrange 1 hour for cooking. From now on I'm going to take this seriously!! Thanks for your advice! :-)
Comment: @user75508 you might want to ask separate questions for those, or search around. "what's a good starting strength program" and "what are basic diet changes I can make to support a fitness program". For both of those, make sure you put in what you're doing now and for how long.
Comment: I'm eating almost vegetarian foods!! Does this affects my health gaining decision?? Is there any alternative way like taking protein powders ?? I'm mentally affected by My low BMI of 19.6 although I'm financially independent. I started thinking myself that my appearance is a basic hurdle for my career and I can't influence my employees due to My physique. If I start serious workouts and food intake schedules , Is there any chance of change in my appearance starting from my facecut?? (My forehead skull and cheeks are also thin :-( ) I started thinking to take any medical treatments :(
Answer: If you're willing to workout and eat a lot (as you said you could in the comments on Eric's answer), you'll get bigger, barring rare metabolic conditions. Just get a beginner strength program like Starting Strength and eat >2800 calories a day with 40% of that being protein (and protein powder is acceptable).
You also mentioned "medical treatments" in the comments. There are no medical treatments that will make you look more athletic without exercising. Even illegal steroids require you to lift weights to see any benefit.
Answer: If you can't eat during work or you don't have time to, I suggest you to prepare your shaker with everything you need for a meal.
Check this out :
Youtube
Muscle and Brawn
Answer: I have the same issue - 6 foot 150 and although this isn't that skinny, I can't gain a pound for the life of me.
It is impossible to attain what you are asking without essentially destroying your health which, in my opinion, is not worth it.
Methods I've tried:
Non healthy
- weight gainers
- pre workout supplements
- lift 3 to 4 x a week
Healthy
- Eat often and generously of all kinds of healthy foods (3 large meals)
- lift 3 to 4 x a week
And I've never had any luck gaining weight. Although, I did get pretty toned.
I believe in our situation and others alike, it is necessary to hit the weight room HARD for minimum of 5 days a week while eating as much as possible (4 generous meals and snacks in between).
Of course, everyone takes slightly different.
On a side note, you don't need a bigger body. You're good as you are. If someone thinks otherwise , they are no good.
Best of luck.

Advice needed for Skinny to Muscular


If I make more in capital gains than I did in my employment, will I owe employment taxes?

Question: If I have a year in which my capital gains are greater than my employment income and the capital gains, when combined with my employment income, would put me in a higher tax bracket than my normal income alone - will I owe additional taxes on my employment income that was not withheld because the new tax bracket was unexpected?
Answer: No.  Your taxes on your job will not be affected.  However, you will have to pay taxes on your investment income, and that may be taxed at a higher rate than you were expecting.
Think of it this way: each dollar you earn has a certain tax rate associated with it, so you give a percentage of that dollar to the government.  As the number of dollars you earn goes up, so does the percentage taken from each additional dollar.  Thinking this way, wages get counted first, then investment income.  As a result, investment income doesn't affect the tax rate on your wages.  But your wages do affect the tax rate on your investment income.
Check the tax worksheet on page 15 of the instructions for Schedule D.  This is where you will compute your tax.  It's complex, but will give you the right answer.
Note that the additional investment income may possibly reduce or preclude various tax benefits like the child tax credit.
Comment: This answer is really incorrect. The question is about capital gains, which, if long-term, do not get taxed via the normal tax brackets as the answer describes. For most taxpayers, the long-term capital gains rate is 15% regardless of income. (At lowest and highest incomes it is a bit different, but it still doesn't work as described here.)  Short-term capital gains is treated as regular income, and for those this answer is more correct.
Comment: No.  This is correct.  Please read carefully.  The fact that there are only 3 capital gains brackets and 7 ordinary income brackets at the moment is irrelevant.  As the ordinary income increases, the rate on the first dollar of capital gains goes from 0 to 15 to 20 just as I have described.  On the other hand, capital gains will not change the amount of tax due on ordinary wages.
Comment: Good point about the AMT.  Regarding 0, 15, and 20 percent, I don't agree that 15% covers almost everyone.  Many people are near one border or the other..  We can make no assumption about the income is of the OP.  Further, these brackets may change in the future.  Note that short-term capital gains also work as I have described: the tax rate of the first dollar depends on your ordinary income, even if it uses different brackets.  I agree it's odd to split up where taxes are coming from, but that was the nature of the question.
Answer: When you file your Form 1040 you compute a total tax.  Your question about tax on employment income vs tax on capital gains is a little misguided.  It is likely that your withholding will not cover your tax obligation though, assuming that you had the withholding set based on your employment income only and you didn't pay any estimated tax.
This isn't necessarily a problem with the IRS right now, but you should make sure that you're planning to have enough cash on hand to pay the bill in April.
Although it's possible that you'll have an underpayment penalty, in the case that you described it seems likely that you'll hit one of the exceptions and not have a penalty.  It wouldn't hurt to do your taxes early though just to be sure and to help plan for the payment.  Even if you finish the paperwork this week, you can hold the return and the payment until April 15 if it benefits you.  Filing by mail on paper would also buy you a few days relative to e-file if you're cutting it very close. (Don't cut it that close if you don't have to!)


802.1Q VLAN Tagged Vs Untagged

Question: If I have a port A which has say VPID 200, has VLAN 200 untagged and also VLAN 150 untagged, does that mean that frames on the switch tagged 150 can reach port A, and open a connection, but port A cannot go find IPs/MACs on VLAN 150?
I haven't seen this discussed in detail, but does this create 1 way VLANs in a sense?
Answer: In principle you can have only one untagged VLAN. This vlan may be called differently based on the brand but all the time it is pointing the same status. You are pointing trunk mode but there is allowed just single one native / default / untagged VLAN.
The configuration should not allow you to set more untagged VLANs and in case you could set it up that way the "last set" wins the selection so my guess is highest VLAN "win competition" about native VLAN ;-).
Available port modes:
Access mode
You can use one and only this one VLAN on the port and this VLAN is in principle untagged. This mode is used normally for connecting end nodes.
Trunk mode
This mode is when there is possible to communicate using more VLANs where one is default / native / untagged (all not tagged traffic is "assigned" to this VLAN). ALL the rest allowed VLANs have to be tagged. Based on the configuration you can allow / limit communication just for listed VLANs or you can allow all known VLANs on the device to go via the trunk port.
Comment: I understand that you can only have 1 VPID, for untagged packets entering a switch port, but I haven't found (or perhaps understood) an explanation regarding multiple untagged VLANs on a port, which I have found to be possible on both TP-Link and Mikrotik switch configs..
Comment: It is just not possible. In case you can set it up (somehow) you just rewriting the previous set so at then end there is again just one set native VLAN (untagged). So as there **cannot** be multiple untagged VLANs you just can't find the explanation for that ;-).
Comment: In case you would not set it up (on some device it is not shown in config as it is default) the VLAN 1 is set up se default. The way how to get "other" native VLAN on the port (in one direction) could be port mirroring but it is other topic... For normal communication the situation you are asking for can't happen - one thing is what you see in configuration and other thing is how the device behave ;-).
Comment: In this image https://i.imgur.com/oj4Nukw.png you can see how a port (for example an 'access' port) can have multiple untagged VLANS, for both TP-Link and Mikrotik

802.1Q VLAN Tagged Vs Untagged


Can I use WordPress Cache Plugins Like W3 Total Cache with Google Adsense?

Question: Can I use WordPress Cache Plugins Like W3 Total Cache with Google Adsense? Is it against Google Adsense? Do these type of plugins cache Google Adsense ads too?
Answer: Yes, you can use adsense with cache plugins like w3 total cache.
Adsense loads through ajax request after the DOM is rendered (or being rendered) to the browser. Adsense ads are responses to communication between visitors computer and adsense servers. They have nothing to do with PHP server delivering wordpress site.
Cache plugins only cache the html part (and/or css and script) of the code. Just check if the adsense snippet is correctly implemented by seeing the page source in browser.


DFA to regular expression how to deal with 'sink state'

Question: Didn't find a clear statement on this so I just want to make sure I'm right. If I have DFA with edges leading to a 'sink state' (non-accepting state we don't get out of) the edges leading to the sink state and the edge from the sink to itself won't get any representation in the regular expression right? We can just remove those edges and stated at the beginning.. Am I right?
Comment: Did you check our [reference question](http://cs.stackexchange.com/questions/2016/how-to-convert-finite-automata-to-regular-expressions) to see how the different algorithms deal with this?
Answer: Yes, if you have a DFA with a state $q_{rej}$  acting as a sink state, then it is there only for the formal definition of the DFA, so that our DFA will "know"  to reject any other inputs that loop in there. An NFA on the other hand, does have to have a sink state, and you can just erase it. A DFA must describe what to do on each input, whether it is an input that will be accepted or whether rejected. An NFA describes which words you will accept, it has no need to describe which you reject. A regular expression works on the same principal, it only describes which inputs you accept, it does not describe which are rejected.
Hope this clarified your question.
(note that you cannot remove those edges and the sink state in the DFA, because, as stated above, a DFA must decide an answer on each input, even if it loops in a sink state. Removing it will result in an NFA)
Answer: It depends on the definition you take for a DFA. If you insist that your DFA should be complete, that is, if the transition function is a total function from $Q \times A$ to $Q$, then you need to keep the sink state. But if you consider an incomplete DFA (that is, the transition function is only a partial function from $Q \times A$ to $Q$), then you can remove the sink state.


Why is pawn to c4 opening advantageous?

Question:
Why is pawn to c4 opening advantageous in the screenshot above?
Comment: Play c4 it's explosive.
Answer: Because if black takes on c4 it loses Control of the centre and white will generally get that c pawn back sooner or later
Comment: Yes, the Queen's Gambit isn't much of a gambit at all, white can guaranteed pick that pawn back up if desired.
Answer: c4 in general, controls more central square, opens Qa4 diagonal, gains Q side space. Your N can now hop to c3 without blocking your c-pawn (and in turn blocking your Q to a4 or b3).
c4 in this particular position (Queens gambit) is as @DammJoe said. To challenge d5 and black's center and white can easily regain it if black takes immediately.
Answer: The Key Centre Squares of Chess are e4,e5.d4,d5 . Usually any of your Piece resides in these Squares it provides more Centre Control and best possible activity . Now coming to your Q c4 tries to deflect Black's centre pawn and opens up a diagonal for White . You see that White captures back the pawn with a Check and Queen gets activated . Similarly the c-file for White also opens up in this case .

Why is pawn to c4 opening advantageous?


Unit of measurement for the area of the polygon

Question: I have an image. I found the dimensions of the image as the following code:
  ImageDimensions[img]

I found the image dimension as {224, 88}. Now, I run the voronoi mesh by image corners as follows:
c = ImageCorners[img, MaxFeatures -> 20];
vm = VoronoiMesh[c];

Now, I calculate the area of the meshes by following code:
 area = PropertyValue[{vm, 2}, MeshCellMeasure]

I found the following values of the area:
 area = {228.984, 625.627, 355.573, 683.894, 1504.49, 354.351, 1621.32,
 2025.66, 1705.12, 1372.34, 151.88, 745.945, 3366.67, 272.885,
 241.687, 345.624, 2768.74, 1836.03, 5300.41, 2275.76}

Now, I want to know the unit of the area of these polygons. Are the in DPI? Is it possible to present them in meter-square?
Comment: yes unit is pixels. multiply by the dimension a pixel represents in meters ^2.
Comment: Hi, Thanks for your comment. But, I still don't get the answer. So you are saying those values are dot per inch (DPI)? Can you Please explain why? I don't understand it.
Comment: well not "dpi" (dots per inch), just dots.  The entire image area is `228*88=19712` "dots" or pixels.  Mathematica image data doesn't contain any resolution information to be able to map pixels to a physical size.
Comment: @george2079. If the elements give in `area` were in square-pixels, I would expect `Total @ area - 224*88` to be close to zero, but it's `8070.99`. So I think we need access to the actual image to figure out what is going on.
Answer: I see whats happening:
VoronoiMesh doesn't know the dimensions of the image and produces a meshregion that is larger than the image.  You can supply the image dimensions to VoronoiMesh as a second argument and it works out just right.
using the "tower bridge" image from the ImageCorners doc page:
c = ImageCorners[img, MaxFeatures -> 20];
dim = ImageDimensions[img]

{320, 233}

vm = VoronoiMesh[c, {{0, dim[[1]]}, {0, dim[[2]]}}];
area = PropertyValue[{vm, 2}, MeshCellMeasure]
Total@area
Times @@ dim

74560.
74560

Show[img, Graphics[{{Blue, PointSize[.02], Point[c]},
   FaceForm[Transparent], EdgeForm[Red], MeshPrimitives[vm, 2]}]]

so now suppose that image is 160 meters wide (yes I wiki'd the span of the tower bridge), then each pixel is a half meter square, so multiply your areas by (1/2)^2 to get the area values in square meters.
Here is what VoronoiMesh generated originally:
Comment: @Odrisso DPI is not a unit of area.  It's a unit of linear density. In a digital image, a pixel represents a square region and thus could be considered a geometric area (not an area measurement per se).  The measurements above treat the pixel as the unit square and measure areas in units of pixels.
Comment: Hi, that's a great example. So, you are saying that, if I want to convert it in meters then I need to know the actual size of that object. Other wise I can't find how much each pixel is equal to meter square. Right?

So, In general, can you please tell me what is the unit of the area= 74560 in this image? is it in pixel?or DPI?