UDP Response

Question: UDP doesnot sends any ack back, but will it send any response?
I have set up client server UDP program. If I give client to send data to non existent server then will client receive any response?
My assumption is as;
Client -->Broadcast server address (ARP)
Server --> Reply to client with its mac address(ARP)
Client sends data to server (UDP)
In any case Client will only receive ARP response. If server exists or not it will not get any UDP response?
Client is using sendto function to send data. We can get error information after sendto call.
So my question is how this info is available when client doesn't get any response.
Error code can be get from WSAGetLastError.
I tried to send data to non existent host and sendto call succeeded . As per documentation it should fail with return value SOCKET_ERROR.
Any thoughts??
Comment: It is slightly worrying that you're using UDP and asking that question. It probably means that you should be using TCP.
Comment: I'd like to know if your non-existent host had an fictional IP-address in the same subnet as the origin of the datagram, or if it would have been on the outside of the router.
Answer: You can never receive an error, or notice for a UDP packet that did not reach destination.
Answer: The sendto call didn't fail. The datagram was sent to the destination.
The recipient of the datagram or some router on the way to it might return an error response (host unreachable, port unreachable, TTL exceeded). But the sendto call will be history by the time your system receives it. Some operating systems do provide a way to find out this occurred, often with a getsockopt call. But since you can't rely on getting an error reply anyway since it depends on network conditions you have no control over, it's generally best to ignore it.
Sensible protocols layered on top of UDP use replies. If you don't get a reply, then either the other end didn't get your datagram or the reply didn't make it back to you.
Answer:
"UDP is a simpler message-based connectionless protocol. In connectionless protocols, there is no effort made to set up a dedicated end-to-end connection. Communication is achieved by transmitting information in one direction, from source to destination without checking to see if the destination is still there, or if it is prepared to receive the information."
Answer: The machine to which you're sending packets may reply with an ICMP UDP port unreachable message.
Answer: The UDP protocol is implemented on top of IP. You send UDP packets to hosts identified by IP addresses, not MAC addresses.
And as pointed out, UDP itself will not send a reply, you will have to add code to do that yourself. Then you will have to add code to expect the reply, and take the proper action if the response is lost (typically resend on a timer, until you decide the other end is "dead"), and so on.
Answer: If you need reliable UDP as in ordering or verification such that TCP/IP will give you take a look at RUDP or Reliable UDP.  Sometimes you do need verification but a mixture of UDP and TCP can be held up on the TCP reliability causing a bottleneck.
For most large scale MMO's for isntance UDP and Reliablity UDP are the means of communication and reliability.  All RUDP does is add a smaller portion of TCP/IP to validate and order certain messages but not all.
A common game development networking library is Raknet which has this built in.
RUDP
http://www.javvin.com/protocolRUDP.html
An example of RUDP using Raknet and Python
http://pyraknet.slowchop.com/

UDP Response


For obejct detection, should I resize my custom images first and then start the annotation or it won't matter?

Question: I have my custom dataset images of size (1080 x 1920) and I am trying to use yolov3 for object detection. I noticed that yolov3 model accepts an input image size of 416 x 416. So I am in confusion if I should resize the image and apply zero-padding to save the aspect ratio and start my annotation after that OR should I annotate my custom images in original size? And will data argumentation affect the annotation while training? Thanks
Answer: It is best practice to resize the input data to the size a pretrained model expects. A pretrained model has feature detectors for relative differences.
Resizing should be done early in the process so subsequent steps use consistent data. Sometimes resizing is a non-linear process that can use interpolation.


Could someone running to replace Cameron as PM just pledge not implement Brexit vote result as part of their platform?

Question: Could someone running to replace Cameron as PM just pledge not implement Brexit vote result as part of their platform? The Brexit vote is non-binding, so wouldn't a PM candidate campaigning with the promise of setting aside the outcome of the Brexit somewhat legitimize not implementing the referendum's result?
Comment: Are you aware that the prime minister is campaigning among the parliament members and not voted by the population, or are you confusing a candidate campaign with the parliamentary campaign?
Comment: I'll pretend I knew that (I think I did actually, but it skipped my mind when I wrote the question) That being said though, when one campaigns among other members of parliament, is it done all behind closed doors is is there still a public facing side to the campaign for PM?
Answer: The simple answer is yes.
However, there are a couple of important aspects that need to be considered.
The next Prime Minister will come from within the Conservative MP block and they are nominated by MPs from within the Tory Party, ratified by the Tory executive, and in the case of more than one nominated candidate, elected by the Tory Membership. The accepted answer to this question details the process in more detail.
If there is more than one candidate, and it goes to a vote through the membership, then the 'platform' on which a candidate stands would geared towards the Tory Membership. Now a breakdown of how Tory voters voted in the referendum shows that they voted to Leave by 58% to 42%, assuming the membership followed a similar pattern. Therefore, it would be unlikely that a candidate would openly campaign to obtain a mandate to not enact Article 50.
The other aspect to consider is that the UK's membership of the EU is enshrined in law. To enact Article 50 would require the repealing of that law and this requires an Act of Parliament. Therefore a Prime Minister cannot enact Article 50 without the MPs ratifying that decision. And this where it can get interesting as the majority of the Members of Parliament were aligned with the Remain campaign. If enough of them (majority on the motion) provide a vote of 'no confidence' in the current Government then a General Election would be called. There are 23 examples of a successful motions of no confidence in a UK Government; the last being in 1979 when the Labour Prime Minister, James Callaghan, dissolved the Government after the 'Winter of Discontent'.
With the Government dissolved Article 50 would remained un-enacted until a new Government is formed.
This would mean a General Election and campaigning on a national scale. If the next Prime Minister, and their Government, was voted in on a 'Remain' campaign pledge they would have a legitimate mandate to ignore the referendum and not enact Article 50.
Comment: The EU cannot force a member out of the EU. Only an EU member can enact Article 50 of the Lisbon treaty. So the only concern for the UK Government is a hardening line during the potential negotiations of an exit and the issues that instability causes the economies. In relation to 'ignoring' the referendum, if a new Government is elected on a mandate for not enacting Article 50 then his supersedes the referendum result.
Comment: But the EU want the UK to leave now. So I suppose they will force it to do so. Ignoring a referendum is really dangerous !
Comment: @GautierC That is conjecture and not factual of the current situation. As it currently stands, the EU cannot force an existing member out of the EU.
Comment: For the moment... If it continues, European Commission will create a law in order to push UK out. I agree with you on the principe, but you know they will find a way to force it out, when politics want something, they find a way to do so.
Answer: Yes, de iure, it is possible for the future prime minister to be someone who is determined not to pay attention to the referendum. Because the U.K. Parliament picks the prime minister, it would almost certainly have to mean that a majority of the lawmakers finds this attitude acceptable, too. The only problem is that this politician and those who adopt his or her attitude are flagrantly dismissing the will of the people. It's something not expected in the U.K. which is one of the cradles of democracy, freedom, and capitalism.
On the other hand, David Cameron is already helping this scenario. The very fact that he wants to avoid the "activation of Article 50" – he doesn't want to send the letter to the European Commission saying that the departure process is being officially started and he wants his successor to do it – means nothing else than the fact that Cameron wants his successor to have the freedom to decide whether the letter is sent at all.
If Cameron thought that the successor shouldn't have this freedom to acknowledge or dismiss the referendum, he would begin the departure process himself. So it's possible that after some time, it becomes "politically acceptable" to ignore the referendum and Cameron's successor will actually do so. It would clearly mean that Cameron's pledge of the referendum and the referendum itself will have been a fraudulent game. To some extent, it's already now. If Cameron were decent and respectful towards the referendum, he would send the letter himself and either start the process of the departure, or immediately resign to allow someone else to do the work.
One must realize that the departure of the U.K. has the other side as well. The EU will try to influence things in various ways. I think that the most important EU officials have understood that a majority of the Britons isn't really compatible with the kind of the EU they want to build. So politicians like Juncker probably actively want the U.K. to leave. But as discussed in a previous question, they have no legally prescribed procedures to expel a member state. The referendum result means nothing from the perspective of the EU law – only the letter activating Article 50 would.
It's totally plausible that the U.K. will continue to be a full member for a long time with the extra advantage that it may send the "Article 50" letter at any moment and it may use this threat as a powerful weapon. This situation is clearly a defect in the EU law that no one has been prepared for. But there are many other, more serious defects in the EU law so one shouldn't overstate the importance of this particular glitch.
Comment: `If Cameron thought that the successor shouldn't have this freedom to acknowledge or dismiss the referendum, he would begin the departure process himself.` I disagree, lacking general elections that somehow validate a change of policies, his successor will have the same freedoms he has now. There are precedents of politics resigning before being forced to implement policies they are against. Since there were members of his party who agreed to the Brexit, he is leaving them to be elected as PM and get the blame if the consequences are not as nice as promised.
Comment: "his successor will have the same freedoms he has now" - That's exactly what I am saying. His successor will have the freedom to bring the result into practice, or ignore the referendum. And his successor may have a much shallower connection with the referendum and all the pledges, so he will have a higher freedom to ignore the referendum. Cameron must know it so the delay means that he wants to make this scenario more likely. ... I didn't say that there were no precedents.
Comment: However, I think it would be absolutely crazy if Cameron weren't blamed for possible bad consequences of the referendum. He is the man who promised and organized the referendum and also the main man who was incapable of convincing the voters that Remain is better. Now he's also the main man who is preventing the work on the future independent Britain - so harming the work of the true champion of Brexit who could possibly do this work just smoothly and nicely. Only people like Juncker, Merkel, and Hillary may deserve more blame than Cameron.


Can't get jQuery to fire when HOTSPOT is clicked

Question: I tried numerous suggestions, but nothing worked with my particular jquery. This script hides the double scrollbar when my popup is opened. It works great on regular images. But I can't get it to fire from a hotspot/map. I tried putting my class "pop-open" in the image tag, area tag, and even the map tag lol. Can somebody help me? Thx in advance.
<map name="hotspot"><area class="pop-open" shape="rect" coords="0, 0, 150, 200" href="#pop_vid"></map>

$(document).ready(function(){
$('.pop-open').click(function() {
        $('body').css({
        'overflow': 'hidden',
        });
    });
$('.lightbox').click(function() {
        $('body').css({
        'overflow': 'visible',
        });
    });
});

p.s. If somebody can tell me how to put 2 selectors in where I have lightbox it would be VERY appreciated. Really I want to use classes close-x and close-btn, but since I couldn't figure it out, I had to set it to close the whole lightbox. I tried this which made neither class work.
$('.close-x, .close-btn').click(function() {

Answer: This is solved. It actually DOES work. I'm having a conflict with another modal script, that's the issue. Posting a separate question about that. I didn't figure out my p.s. up there ^ but oh well.


Does QUIC use a 96-bit MAC tag? If so, what are the implications?

Question: Does QUIC use a 96-bit MAC tag?  If so, what are the implications regarding forgery of messages?
Answer: One can argue about whether security for adversaries running in time $2^{96}$ is feasible or not, and the current standard is to require 128-bit security (or at least 112). However, an attack requiring sending in the range of $2^{90}$ messages to attempt to forge is way beyond feasible. The success probability of an attacker shouldn't exceed something reasonable, but what is reasonable is also subjective. NIST recommends that for block cipher modes of operation, the probability of a breach shouldn't exceed $2^{-32}$. For that reason, with a random IV, you can only use CTR or GCM to encrypt $2^{32}$ different messages (since the IV is of length 96 and you have a birthday problem). For MAC tags, taking 96 bits is more than enough...
Comment: What about for Poly1305?
Answer: Just from the draft it seems that they only specify that AEAD is used but not which kind of tag specifically.
However, the code for the go implementation does seem to use AES-GCM with 12 byte tags.
The implications are that finding a valid MAC by guessing randomly now only requires about $2^{95}$ guesses instead of $2^{127}$ when compared to a 16 byte tag. So it's obviously less secure but probably still perfectly fine in practice.
(Edit: As correctly pointed out by poncho the following paragraph does of course not apply to stream ciphers.)
Especially, when considering that this will only allow you to mess with the associated data because there is probably some inherent formatting in the transmitted data. Therefore just messing with the encrypted payload will probably produce bogus plaintext which gives some extra security for that part.
Comment: Actually, GCM with 96 bit tags and circa 1k ciphertexts allows a guess with probability $2^{-91}$, not $2^{-96}$.  In addition, if the modified ciphertext validates, then flipping a bit in the ciphertext will flip the corresponding bit in the plaintext, hence the changes made to the plaintext are predictable (and hence I wouldn't count on any formatting check on the plaintext to save you)
Comment: The question how much time you have to forge a valid MAC, you cannot hold back a packet indefinitely, so biggest danger would be packet injection, so the question is when the keys are rolled over.
Comment: @poncho Where does this $2^{-91}$ probability come from?


Why do we use multiple reinforcing bars instead of one bar with a big diameter in reinforced concrete?

Question: Why do we use multiple reinforcing bars instead of one with a big diameter in reinforced concrete?
Does increasing the number of reinforcing bars means that the reinforced concrete will have a higher tensile strength?
Answer: There are a few reasons.
I'm firstly going to assume you're talking about replacing a bunch of small rebars by a single reasonably-sized one: i.e. instead of $15\phi8$ (7.54 cm2), using $1\phi32$ (8.04 cm2).
One reason is to improve ease of constructibility. Reinforced concrete beams also have transversal reinforcement, and it's very common to place rebars at the four corners of the transversal reinforcement to tie everything together into a self-supporting cage (this also inhibits crushing of concrete at the corners of the transversal reinforcement). But that just means you should place a lower boundary of 2 rebar in each face (upper and lower). But why not adopt $4\phi16$ (8.04 cm2) instead of $15\phi8$?
Multiple small rebar improve the behavior of the concrete-steel interface. The total surface area to transmit the tensile forces from the steel to the concrete at the anchorages is greater, reducing the tensile stress and therefore shortening the anchorage and lap splice lengths. This also reduces the cracks that will develop in the concrete.
Lastly, one can usually also be more efficient with smaller rebar: if what you actually need is 7.5 cm2, you'll need either $15\phi8$ (7.54 cm2), $10\phi10$ (7.85 cm2), $7\phi12.5$ (8.59 cm2), $4\phi16$ (8.04 cm2), $3\phi20$ (9.42 cm2), $2\phi25$ (9.82 cm2), or $1\phi32$ (8.04 cm2). $\phi8$ gives the most efficient use of steel, putting as little extra as possible. Obviously, however, this isn't always the case. It just often is.
Now I'm going to assume you're talking about using one ridiculously large steel bar: i.e. instead of $20\phi20$ (68.2 cm2), using $1\phi94$. Some of the points raised here are still valid even if you're talking about being reasonable, but their significance is reduced.
One reason is cost. This concept implies in making custom-diameter rebar for each beam (otherwise, all you're saying is that current rebar is too small), which would impede use of scale to reduce costs. A factory can reduce the unit-cost of a $\phi10$ bar by making millions of them. If each beam in each job site will require a custom diameter, such cost-savings aren't possible.
Also, a single $\phi94$ rebar would weigh almost 54 kg/m, meaning you'd need to use a crane to put it into position, while $20\phi20$ can be easily placed by hand by a single worker, one at a time.
As well, at the extremities of your beam the steel will probably need to be bent. The larger the diameter of the rebar, the larger its bending radius.
And then there's this:

Since the center of gravity of your steel will be farther from the face of the concrete, it will also be less efficient: you'll need more steel to achieve the same strength. This also applies for the first part of this answer, where we were talking about reasonable sizes, but then the difference is obviously much smaller.
But why not use a sheet of steel then, instead of one large circular rebar? Hell, since it would no longer have the spaces between the rebar, you could choose a sheet which is thinner than the multiple rebar's diameters, and which is therefore more efficient as well! But then your surface area would be reduced, increasing the transfer stresses and therefore the anchorage and lap splice lengths. Also, a sheet is a two-dimensional element, so there may be other transversal behaviors which may lead to problems. Also, how would you pour the concrete for the bottom face of the beam?

At the end of the day, the best rule of thumb (or, well, the one I try to use) is to do your best to fit everything into as few layers of rebar as possible, but filling those layers as much as possible (while still leaving comfortable space for proper concrete pours, including the necessary space for the vibrator). The only exception is the last layer (farthest from the relevant face of the beam), which can be left emptier (but preferably with a number of bars that's allows it to follow a symmetric pattern of the previous layers). Well, balance that with being efficient with the steel: if this requires using large rebar and results in an adopted area of steel much larger than if another layer were added with smaller rebar, then maybe another layer is best.
Comment: I think the simplest argument against using fewer but larger pieces of rebar would be that rebar serves to protect the concrete which is near it, and the extent of protection decreases with distance.  If one were to cram all the rebar from the first picture into the middle 60% of the concrete, it would have just as much surface area as in the first picture, but the edges of the concrete would be more prone to failure.
Answer: The main purpose of rebar is to improve the tensile strength of concrete and in practice most of these loads come from bending rather than pure tension.
When a beam in subject to bending forces the greatest stress are at the edges and faces of the beam  so just having one big bar running down the centre wouldn't do very much as this part of the structure sees very little load until it starts to fail.
Having smaller diameter rebar distributed throughout the structure also distributes the load from the concrete to the steel more effectively as there is a greater area of contact for adhesion between the two.
In practice the size and placement of the steel reinforcement will be determined by the expected loading on the structure and is a compromise between strength, weight, cost and the practicalities of assembling the steelwork during construction.
Comment: Also crack control.
Answer: From a purely conceptual standpoint, one large bar of the same area as multiple smaller bars provides the same moment capacity for a concrete beam.  This is assuming that the center of the bars are all at the same depth.
The distribution of the bars (multiple smaller bars) help to limit cracks by spreading the tension force through a greater width of concrete.
Multiple smaller bars also help when looking at the interaction at the interface of the concrete and reinforcing steel. A single large bar has less surface area than multiple smaller bars. This means that for a given load, the stress between the surface of the bar and the concrete is greater in the single bar case. This has applications to the development length of the reinforcing.
Answer: In addition to Wasabi's answer - which is great - large diameter bars need insane development length and lap length.
A rule of thumb estimate for development and lap length is 40 diameters. For 20 mm bars that is a large but reasonable 80 cm, but it becames 128 cm for 32 mm bars and 2 meters for 50 mm bars.
Lap length problem can be avoided by using mechanical connectors, but 2 meters development length would waste a lot of steel and need a large space, very often unavailable.
Answer: Concrete and Steel behave in drastically different ways: concrete is assumed not to be able to bear any tensile stress as soon as first cracks appear while steel is ideal material for tensile stress. Optimally it would be ideal to have thin tiny strands of steel as opposed to few large ones, kind of similar to how fiberglass works homogenously.
Specially since we know our design assumptions are highly simplified to make the job of engineering practical.  Things like climate and deferential sun exposure, humidity, permeating of corrosive agents through cracks in a member, all impact the behavior of a member. Also as mentioned above the area and contact surface of steel bar are related in a disadvantage ratio of power of two for area of the bar that transfers tension through skin friction to concrete.
On the other hand practical requirements during the course of construction such as bars not easily be deformed under the foot traffic of workers or accommodation space to allow passage of transient pipes or conduits should be permitted. that's were engineering codes come into play to make a uniform and predictable game plan. so the mechanical engineer or hardware designer know what they specify or expect will work.
Answer: small diameter of bar  center of gravity is near to the concrete surface. larger diameter of bar center of gravity is far from the concrete surface.
small diameter of bar easy to handla then the larger diameter of bar.
The larger the diameter of the rebar, the larger its bending radius.
Answer: I think that 4 bars D1 will better than 1 bar D2 (same tensile area, but more bonding surface).
In addition to that, bigger bars are more brittle while smaller bars have dominant surface yield (more elastic and plastic than brittle). It adds safety when failure happens.


Reverse Polish Calculator Exception Handling in Python

Question: So I've almost finished this program but I can't figure out how to put in proper exception handling based on these rules:

You must handle the following situations (errors):
Too many operators (+ - / *)
Too many operands (doubles)
Division by zero

Prompt
For this assignment, you are to write a program, which will calculate the results of Reverse Polish expressions that are provided by the user.
You must use a linked list to maintain the stack for this program (array implementations of the stack will not receive full credit).
You must handle the following situations (errors):
Too many operators (+ - / *)
Too many operands (doubles)
Division by zero
The program will take in a Polish expression that separates the operators and operands by a single space, and terminates the expression with a new line.
The program will continue to take and evaluate expressions until the user enters a zero (0) on a line by itself followed by a new line.
Your sample output should show the handling of all the error conditions as well as make use of all of the operators.
Sample IO: (note: formatting of output isn't a critical issue)
Input    Output
10 15 +  25
10 15 -  -5
2.5 3.5 +    6 (or 6.0)
10 0 /   Error: Division by zero
10 20 * /    Error: Too many operators
12 20 30 /   Error: Too many operands
-10 -30 -    20
100 10 50 25 / * - -2 /  -40

Program
Here's what I got so far:
# !/usr/bin/env python

import sys
import re

class LinkedStack:
  #LIFO Stack implementation using a singly linked list for storage.

  #-------------------------- nested _Node class --------------------------
  class _Node:
    #Lightweight, nonpublic class for storing a singly linked node.
    __slots__ = '_element', '_next' # streamline memory usage

    def __init__(self, element, next): # initialize node's fields
        self._element = element # reference to user's element
        self._next = next # reference to next node

  def __init__(self):
    #Create an empty stack.
    self._head = None # reference to the head node
    self._size = 0 # number of stack elements

  @property
  def __len__(self):
    #Return the number of elements in the stack.
    return self._size

  def is_empty(self):
    #Return True if the stack is empty.
    return self._size == 0

  def push(self, e):
    #Add element e to the top of the stack.
    self._head = self._Node(e, self._head) # create and link a new node
    self._size += 1

  def pop(self):
    i = self._head._element
    self._head = self._head._next
    self._size -= 1
    return i

ls = LinkedStack()

# Changing the operators to behave like functions via lambda
# Needed for stack push and pop rules down below
# '+' : (lambda x, y: x + y) is same as def '+' (x,y): return x + y
operators = {
  '+' : (lambda x, y: x + y),
  '-' : (lambda x, y: y - x),
  '*' : (lambda x, y: x * y),
  '/' : (lambda x, y: y / x)
}

def evaluate(tokens):
  # Evaluate RPN expression (given as string of tokens)
  for i in tokens:
    if i in operators:
        ls.push(operators[i](ls.pop(), ls.pop()))
    else:
      ls.push(float(i))
  return ls.pop()

def main():
  while True:
    print("Input the expression: ", end='')

    # Read line by line from stdin + tokenize line + evaluates line
    tokens = re.split(" *", sys.stdin.readline().strip())

    # Output the stack
    print("Stack: ",tokens)

    # Output result
    if not tokens:
      break
    print("Result: ",evaluate(tokens),'\n')

# Call main
if __name__=="__main__":
  main()

Thank you for your help guys!
Comment: Look at a [Shunting Yard](http://en.wikipedia.org/wiki/Shunting-yard_algorithm) implementation in [Python](http://rosettacode.org/wiki/Parsing/Shunting-yard_algorithm#Python)
Answer: Suppose some input has n numbers and o operators. It appears that o == n-1 for valid input. So perhaps you can assert that o == n-1. If there are too many operators then perhaps o > n-1 or too few, o < n-1. To detect division by zero you might check the "right-hand operand" given a request for division, and assert that it is not zero.


How do I get WatchESPN to work?

Question: I've tried Chromium, Chrome, and Firefox.  I've tried various flash players (including Adobe Flash).  I'm logged in through my cable provide.  Still, no dice.  I see some very old posts about installing "hal", but hal doesn't exist as a package any more, it seems.
Answer: They require Adobe's Hardware Abstraction Layer (HAL) to be installed to view secured content (i.e DRM encumbered). The solution to install HAL is:
sudo add-apt-repository ppa:mjblenner/ppa-hal
sudo apt-get update
sudo apt-get install hal

Source: http://ubuntuforums.org/showthread.php?t=2255621
More information can be found here:
https://launchpad.net/~mjblenner/+archive/ubuntu/ppa-hal
A few are still complaining it isn't working while others state that it works for them and that it works for other sites that they had previous issues with. Make sure to follow the directions carefully - if you have any questions then feel free to ask. Ensure that you have ad blocking software or script blocking software disabled for the site in question as well. If this resolves your problem then please be sure to mark it as solved to let others better find the solution.
Edit: I forgot to mention that the project appears to still be active but doesn't have a lot of resources. Their most recent package was July 3rd of this year.
Comment: Still not working.  Ubuntu 15.10.  Chrome and Firefox.
Comment: @DustinKirkland As 15.10 is still *very* new there may be a conflict which will require the HAL package to be updated. What I can suggest is adding the PPA and *hopefully* a package will drop soon. Are you using any third party add-ons with your browser? Hulu is, for instance, pretty specific with what works and what doesn't.
Comment: Worked for me on Kubuntu 15.10, but it was buggy and had to sign in and out several times before it worked.
Answer: The instructions about installing HAL and using flashplugin-installer worked for me on one computer (in 15.10), but not on another (also in 15.10).  After deleting ~/.mozilla/ a few times, I finally came upon this arch wiki entry about Flash DRM which mentioned that the Adobe flash plugin keeps a cache of files that may cause some trouble.  It suggests:

rm -rf ~/.adobe/Flash_Player/{NativeCache,AssetCache,APSPrivateData2}

I was a bit less careful and just removed the entire ~/.adobe/ directory, at which point I was able to get espn3 working.

How do I get WatchESPN to work?


Find the most frequent alphabet appearing in the given string. In case letter with same frequency, choose the one which comes first alphabetically

Question: This is the desired result which I want:
Comment: You could use an associative array in which the keys are the alphabet, in order, and the values start with $0$ and get increased with each new occurrence of the corresponding letter. After the input has been processed, go over the array keeping the position with maximum value so far and only updating if a new position appears with an **strictly** larger value.
Answer: Just use an array indexed by the characters, loop over the string increasing the respective count.


what's the principle of sending money and receiving money? who do the work to put money into account?

Question: If i want to send money, Who gives the payment address. You know, it is said there are no center.
Another question is that if someone send money to me, who help me  put the money into my account?
Answer: An individual or merchant requesting payment will generally want to obtain a bitcoin address specific for that transaction.  When done manually, this is obtained from the Bitcoin-Qt client by clicking "Receive".  A merchant would have software that would query the Bitcoin.org client to obtain the address. An EWallet provider will provide for you this address.
The concept you possibly are misunderstanding is like how with a bank account, the account is assigned to an individual or organization before payment is transferred.
With Bitcoin, the client uses math to create the private key (and from that determine the Bitcoin address).  So there doesn't need to be some master registry where Bitcoin addresses are stored.  The person's client simply holds the keys necessary to spend any funds received by an address.
So that answers your second question -- bitcoin never really exist "in your account" but instead if you have the private key for an address, you can spend any funds received by that address.  Every node performs verification of your transaction and won't accept a transaction in which you try to spend funds that aren't yours.   Nodes that are mining will make these transactions permanent by including them in a sequence of data blocks -- which is named the blockchain.
So there are no people doing work, and instead there is simply an electronic communications protocol that is being employed.
Comment: Thanks very much! For the first answer, does the bitcoin.org client obtain the address based on public key?
Comment: As the blockchain grows, in order to verify the transaction, does node need to traverse the blockchain? If so, that's a hard work. Any optimization for it?
Comment: The client makes up a random private key for you.  From that it can calculate the public key, and from the public key it can calculate the address.  There is no central body to make sure that 2 people don't make up the same private key, but private keys are so long that it is incredibly unlikely that it will even happen.
Comment: Your comment about optimisations should really be asked as a separate question.  It may already have been asked as its own question.  In short, "yes", and "not yet, but it's being worked on".

what's the principle of sending money and receiving money? who do the work to put money into account？


Choosing right algorithm for binary classification

Question: I'm having a problem to predict hits from original features. I tried using LDA on original matrix but the thing is that probability of getting a hit vs non-hit is 95% vs 5%. That said after running LDA I get true positive rate of 5% and true negative rate of 96%. Now, my understanding of LDA makes me think that when it separates hits from non-hits into two groups the later gets more attention, however what I really want is to minimize the false discovery rate, even better to control it.
The question is what algorithm is best suited for this? I have two binary coexclusive groups (Hit/Not-hit).
Comment: What software are you using? In LDA you can adjust the penalty for being wrong in different ways, but the way to do this depends on software.
Comment: Can you post more info about the data? There is a plethora of binary classifiers you can try, so some details are crucial to show you the right direction.
Comment: The software is R, MASS package. The data is different features extracted from images (e.g. Haralick texture features) minus reference value per each feature. The manual annotation was done by expert in biological field. He marked every image as class 1 if the image was different from reference image in his opinion.
Comment: By "true positive rate" and "true negative rate" I think you mean "predicted positive rate" and "predicted negative rate", otherwise this would be a very, very poor (or very lopsided) classifier...
Comment: But this is a great question: I would love to know which classifier is the most robust to "rare" outcomes.
Answer: A classical binary classifier that you could use is logistic regression, and for this particular case the Firth's method seems adequate to correct for the "rarity" of your hits.
See here for more info
Comment: Would you mind expanding on this a bit? I've never heard of this method, or for that matter of exact logistic regression. The page is all code and I'd like some of the theory. And the link on that page to the "nice summary" is broken.
Comment: @ssdecontrol, I believe LionelB is referring to something similar to Scortchi's answer here: http://stats.stackexchange.com/questions/67903/does-down-sampling-change-logistic-regression-coefficients?noredirect=1#comment251904_67903
Answer: You can use any binary classifier e.g. Logistic Regression. The problem is more tricky at model selection stage, more precisely - how are you going to select the model. Here you will need to estimate the performance (on some held-out set). Your case is typical for real-world data since you have big class imbalance. Computing performance indicator as accuracy will be very biased. I propose you to use a balanced measure of accuracy (see Talk Slides).
Answer: I think your problem is actually evaluating a model's output, not finding a good model per say. Unfortunately, that's the more difficult problem.
Look at ROC and AUC- a good source is http://www-bcf.usc.edu/~gareth/ISL/  The R package ROCR is quite useful.
Scoring Rules can be very helpful as well.


Why would a legitimate application run on a non-standard port?

Question: Among the many "threats", I see on my SIEM, a non-standard port is a top one. It's always been a false positive, but I don't understand why this happens frequently?
Comment: There are tons of reasons to run a service on a non-standard port. Can you provide the services you are seeing?
Comment: Do you mean a web server (or similar) on a non-standard port because some operating systems prevent opening ports under 102X as a regular user?
Comment: @schroeder Is there a link you could direct me to so I could read up more on this? Searching my question leads me nowhere I want to be.
Comment: I didn't answer because, as I said, there are tons of reasons. There's no "link" that will explain all the reasons. Can you provide more detail in your question?
Comment: I think it's more likely to be a IOC if it finds a non-standard protocol on a standard port.
Comment: Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
Answer: It is not a threat per se, but can be an indication of something unexpected.
For example, HTTPS runs on port 443. If someone starts a rogue HTTPS server on port 10443, for example, it could be used for data exfiltration. Or it could be a development environment running there, with insecure settings.
It is not expected to run HTTPS on port 10443, so finding one HTTPS server there should be investigated.
Answer: Some, non-exhaustive reasons a legit server might operate on a non-standard port:

A development instance that nobody should connect to by accident.
A low-privileged app that can't listen on ports below 1024
A second server of a type that already is running on the same host (e.g. you could have a "normal" web server on 80/443, and another one that is used for diagnostics or debugging or a control plane or so on, running on a high port).
Obscurity to limit the number of bot attacks (e.g. it's relatively common to move SSH or Terminal Services/RDP off their default ports, because there are lots of bots that basically probe ever machine on the Internet trying to brute-force passwords on those services and most such bots give up if the service isn't on the expected port).

Some reasons a legit client might make an outbound request on a non-standard port:

The client is connecting to a server that has changed its listening port for any of the above reasons (or any other).
The client is connecting to a proxy that listens on another port (e.g. a web proxy on 8080 that relays traffic to 80/443).
The client is a port scanner being run for legitimate verification of attack surface (possibly by your security team).

Really, though, you're just going to have to ask the people running those clients and/or servers why they're doing that. They might have great reasons, or they might have safe reasons but not great ones (e.g. "it's just easier to launch the server without sudo"), or they might be legitimately putting your network at risk (through malice or ignorance).
Answer: The SIEM can't tell whether it turns out to be a false positive, so will just report this every time. And the SIEM should report on this, because this is an important deviation for a SIEM.
Why do teams keep using non-standard ports?
If it happens to you a lot, you could either try to have people use standard ports or get teams to inform you better about when/why they need to use non-standard ports.
Why is this reported as a threat?
The goal of a SIEM is to detect adversaries on your network. This means that when it notes a 'threat', that whatever they're seeing is not so much something that's coming after you. The SIEM is trying to tell you it's seeing something that's (also) typical behaviour of an adversary.
It is a given that an adversary needs some channel out of your network. Sometimes for data exfiltration, but it could also be to allow the adversary to command and control whatever system it is in your network that they compromised. The SIEM is the prime measure in your collection of security measures that makes use of this fact. Therefore, it is of great importance that the SIEM draws enough attention to events that are potentially indicative of a channel out of your network controlled by an adversary.
The adversary wants to stay undetected, so will try to conceal their channel out of your network some way. Therefore, services running on non-standard ports should be investigated because they might be such a concealed channel.
Comment: Your last 3 paragraphs can be reduced to a single line: "SIEMs alert you to anomalies that are worth investigating". Yes, that's fine, and also true, but doesn't answer the question.
Comment: You don't know if "the teams" are using non-standard ports. We know very little about ***why*** it's a false positive. You're making broad assumptions.
Comment: "the SIEM should mark this as a high priority, because this is an important deviation for a SIEM" -- I challenge this claim. It's important to understand the anomaly, yes. But I would not place this as a high priority since, as the OP states, it is often a false positive.
Comment: Fair enough, you shouldn't drop everything you're doing because of this.


Derivation of Lorentz Transformation from Principle of Relativity

Question: Hello everyone, hope you all are having a good day. I am trying to derive Lorentz transformations from the principle of relativity. I read a few papers on the topic and one of the papers I read was this.
The paper is about how only the principle of relativity can be used to derive the general form of transformation between inertial frames of reference. However, I am getting confused over the part where the author shows such a transformation is a linear one. Their argument goes like this:
Suppose you have two inertial frames of reference A and B and B is moving at a relative velocity v with respect to A, say in the positive x-direction. In general, the transformation between any two arbitrary frames of reference will be of the form-
xA=X(xB,tB,v)
tA=T(xB,tB,v)
The author then says that if we have one end of a rod (placed along the x-axis) of some length l, in B's frame of reference, at point xB1 then the other end of the rod will be at xB1+l at that instant. Thus, the the position of the first end in A's frame of reference will be X(xB1,tB,v) and the position of the other end will be X(xB1+l,tB,v). The author then says that the length of the rod in A's frame of reference will be
l'= X(xB1+l,tB,v)-X(xB1,tB,v) .....1
And this where I am confused. How is this the length of the rod in A's frame of reference? Even though the positions of the two ends of the rod are known, these positions are taken at different times in A's frame of reference in general. The time in A's frame of reference for the position of the first end will be T(xB1,tB,v) and the time when the position of the other end is taken is T(xB1+l,tB,v). Unless the rod is stationary in A's frame of reference, l' won't be the length of the rod in A's frame of reference in general, right? The rod could be in motion with respect to A and as far as I know, there shouldn't be any restrictions on whether the length being measured is stationary or moving or accelerating. Shouldn't the position of both ends be taken at a fixed time in A's frame of reference to measure the length? This is a crucial step in the derivation because later the author displaces the rod in B's frame of reference and homogeneity of space implies as long as the rod is identical, the length of the rod doesn't depend on where it is kept along the x-axis. Then in A's frame of reference the new positions of the ends are calculated and using the above equation 1, the new length is equated to the original length to show that xA varies linearly with xB.
At the start I was convinced about this method's validity and I only came up with this doubt when I was trying to find what argument can be used to show that tA varies linearly with xB and I was stuck. So far I've only been able to show that xA and tA vary linearly with tB using homogeneity of space and time.
I have seen identical derivation in other papers but I am still confused about the method the authors use. Am I just missing something simple? Can someone give a physical explanation of whether the method used by the author is correct or not?

Comment: Note we use [Mathjax](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) for mathematical expressions.  It's the site standard.
Answer: I cannot speak in detail about that paper (I have it myself and have only glossed over it, but it seems valid - it gets the right answer for a start!).
The reason I did not persevere is that I already had this article, which is (to me) much simpler.  The derivation itself starts with the paragraph beginning "For a typical axiomatic derivation of the Lorentz transformation, . . .", but it is well worth looking at the whole thing.
Reading this might help in understanding the "Nothing but Relativity" paper, if you find you still need to.
Comment: Thanks for the reference. I am convinced that the arguments the author has used are correct. I am just confused about the way they have used those arguments.
Comment: So am I, hence my answer!


persistent accesibility settings

Question: I am trying to modify accessibility settings using unity tweak tool to make the mouse cursor larger. It works, however, as soon as I log out and log back in the mouse returns to it's normal size and a message is displayed about some sort of error. It seems that Ubuntu isn't able to persist the settings from one session to another. How can I fix this?
Answer: I'm not too familiar with Unity tweak tools, as I do minor tweaks through the terminal mostly.
There is a way you can change the size of the cursor through the terminal, and it's automated:
<code>dconf write /org/gnome/desktop/interface/cursor-size 48
</code>
You can change the 48 to any number of your choice, and if the cursor still resets after reboots, then try creating a startup command that changes the size for you.
:)
Comment: for some reason this doesn't persist. i tried adding this to .profile but it produces an error...
Comment: That's odd. Do you remember what the error is? If not that's OK. Again there is always the option to make the code I stated above launch at login
Comment: the error was about dconf usage (dont' remember exactly) stating the appropriate way to use it. to do it at login, where would you put the command.. i thought it would be in .profile?
Comment: Oh sorry, I should've been more clear. To make the command run at startup, use the Dash to find and open Startup Applications. Click Add and enter dconf write /org/gnome/desktop/interface/cursor-size 48 into the command box. You can add an optional name or comment if you please, then when you are finished, press OK and reboot to test.
Comment: It would be great of you could add the instructions from your last comment to your response. Comments are not persistent (or not guaranteed to be).

persistent accesibility settings


What is the best way to learn VFX?

Question: I am new to this field but I'm very interested in making VFX and I had done some VFX clips on my phone. But I want some software names which I can understand easily and also create visual effects.
Comment: I disagree that is a dupe. They are different questions. One is how to learn. Another is which tool to use.
Answer: VFX on a phone is much different than actually doing it on a computer. You might want to take stepping stones to VFX and start by editing videos with a NLE. One of my favorites is Premiere Pro (though, it's been buggy lately). Once you learn how to edit videos, you can then move onto VFX with Adobe After Effects, or Hitfilm for more simpler stuff.
Answer: [I assume you have some experience in video editing, if you don't you MIGHT struggle with vfx]
Adobe After effects is probably the easiest yet very powerful vfx software. It is layer based as opposed to node base so it will be easier to learn and understand. It might not be as powerful and flexible but it will more than you need when starting out. One of the best tutorial site for After effects is www.videocopilot.net .
If you want some more recommendation of softwares, here is a short list:
Adobe After effects,
The Foundry Nuke(use commonly in the industry),
BlackMagic fusion(use commonly in the industry), Fitfilm(all in one solution, cheap, not used in the industry)
Answer: You don't need to know editing to start making Vfx although it doesn't hurt to have some editing experience. It depends on what you are aiming for when learning Vfx. After effects is predominantly used in TV visual effects and motion graphics, while more complex visual effects tend to use software like fusion, nuke etc.pp.
How to start learning this? There is around 1 million tutorials on YouTube so why don't you just pick something you want to do and start following a tutorial about it. If you want to have an idea how things are done, watch some behind the scenes for Vfx heavy movies...

What is the best way to learn VFX?


Help with string gauges for my vintage bass

Question: I need help with my vintage 1956 Danelectro bass, its in a baritone style body and i believe its either a short or a medium scale neck. I'm just terrified of what gauge strings to give it, cause i dont want to bend the neck at all. i want to use .35-.90 but they are only extra long scale or long scale, im just not sure what to buy for it. i want super lighter strings for it. Im not sure what to do.
Comment: I'm no expert on this but I did some google searching.  You want to determine whether or not short scale strings are what you actually need, which seems to be the case based on my search.  I've seen people using .45 to .105 as well as .40 to .95.  Hopefully this link will be helpful: http://www.bassstringsonline.com/30--31-inch-Short-Scale_c_587.html
Comment: Good start point is what's on it now. Another is to establish exactly what the scale is.
Answer: You need to do your own research. The bass already has strings - which can be miced up to determine gauge. Measuring from bridge to nut will give scale length. You say you don't want to bend the neck - fair enough, but if the super light strings you want for it are too light, the neck tension will decrease and possibly allow the neck to straighten too much! So adjustments will need to be made, was that the case.
Changing to strings that are 10-15% lighter is probably a good start point, but be prepared to change again, as you won't know if the feel (and re-adjustment) are right for you till you try. I say for you, as someone on this site maybe has the exact same guitar, set up in their favourite way, but that may - or may not - be one that suits you.
You already have a datum point, if it's strung already. It has to be a good start.


Cannot sign in because game asks for my date of birth and I cannot remember which date I had written

Question: Trying to make AR work on my mobile,, I cleared data and cache of my Pokémon Go app on my mobile. After that, when I tried to sign in as a returning player, I was asked for my trainer's club code and password which I don't think I ever had. I know how to sign in with my email and password but how to get to the screen where email and password are required for signing in?
About AR, are there any specific settings for Samsung Note 9?
Why it doesn't work?
Answer: To answer the initial login question - if it's the date of birth that you're asked for before selecting a login method (Google, Apple ID, Trainer Club etc) then you can add in anything at all.  It doesn't matter if it's the DOB you originally entered.


Cannot view Newest or Activity on Stack Exchange

Question: A recent change to Stack Exchange has added a message to the top of the tagged sets asking if I wish to receive email updates. Since this change, I find I cannot switch the view to Newest or Activity, furthermore, the note constantly reappears.
Comment: Reproduced.  That's annoying.
Comment: If you manually remove the `subscribe` url parameter, you can change the tab.
Comment: Yes it is annoying :) I find I need to type in the sort= tab manually as well as removing the subscribe parameter.
Answer: Fixed.  Sorry about that -- the subscribe message at the top is only supposed to show up for certain paths, but it was getting added to the URL everywhere.


Is it possible to get through an airport in less than 2 hours?

Question: I have never been on a plane before and I am traveling from Orlando to Bogota, in a few months and i have to take a train which should get me to Orlando around 10 and my flight leaves at 1.
Its a 30-40 minute drive to the airport and i only need 1 carry on bag.
So worst case, i get there with 2 hours exactly.
How long do i have to get everything done and should i be worried?
Is 2 hours enough time to finish everything?
Answer: There are countless variables that will affect how long it takes to get through an airport, ranging from the time to day to what (if any) status you have with the airline, to whether you get given PreCheck access on that day.
However given that you only have carry-on bags, you will most likely be able to check-in relatively quickly - probably either online or at a kiosk (again, depends on your airline!)
US airports do not have any form of (physical) exit immigration, so the only real wait you'll have will be to get through security, which even on a bad day shouldn't take more than half an hour (probably well less)
So yes, 2 hours is plenty of time to do this. Even if you did have bags to check 2 hours would almost certainly be plenty of time.
Of course, that is presuming that your train isn't delayed, and that traffic isn't particularly bad on the drive to the airport, etc...
From a planning perspective, keep in mind that for an International flight there is a legal requirement to check in at least 60 minutes before departure.  If the airline allows it, I would suggest checking-in online just to remove this as being a potential issue in case you are running a little late.
Comment: You forgot to mention that he should be at the gate about 30 minutes before take off. Still two hours are plenty.
Answer: Almost anywhere in the world 2 hours in enough. The usual suggestion is to come 3 hours in before an international flight is a recommendation but most tickets actually say that you need to be there 90 minutes ahead. Even so, I have made it with much less time in many countries.
The first thing to speed things up is for you to do your online checkin. You have no bags to check so it is mostly likely that you will be able to print your own boarding pass.
Orlando airport is not so large and I would expect that you would have plenty of time left even if you arrive just 90 minutes before. If your flight is not direct and goes through a domestic destination first, you need even less time.
There are a few times when an unusual circumstance caused an airport I was at to be unusually busy. In this case I always still made the flight by pointing out to the staff that I was in a rush due to my own departing flight being sooner than other people waiting and I was moved ahead. In other words, even if you are actually getting late, the staff is there to help you out.
Answer: While I would have no qualms about getting to the airport 2 hours from flight time for a domestic flight I would not recommend it in your case as you're not used to the system.  Airports are big and can be confusing to the uninitiated.  Doing something like going through the wrong security checkpoint could delay you enough to miss your flight.
Comment: A strong up vote here.  Seasoned travellers would probably be very comfortable with this.  I have made international flights in much less time than that frequently.  However, these are people very familiar with the procedures of airports; it could be quite different for someone new to it.  It would be easy to get lost or make another simple mistake that lost you a lot of time.  You have said nothing your nationality or visas.  Have you checked?  Ensure that your paperwork is in order.  Also, check the rules on permitted items in your luggage to avoid another potential delay.
Comment: @badjohn A simple incident to illustrate the problem:  My wife asked an airport worker for directions--oops, that caused an extra trip through security.  She had plenty of time so it didn't matter but that probably cost her 30 minutes from failing to note a non-obvious (temporary) sign.
Comment: Yes, even an experienced traveller can easily make a mistake that wastes a lot of time.  I was at the gate in Atlanta once waiting for my flight to Manchester UK.  A soldier in uniform asked whether this was the right gate for Manchester.  I said: "Yes but maybe not the Manchester you want".  He wanted New Hampshire, he had to run a long way very quickly; a but of unplanned extra training.
Answer: Normally, I'd say 2 hours is plenty, but I just stumbled upon an article on wesh.com from July this year, saying that:

JetBlue officials are telling passengers that plan to travel out of Orlando International Airport in the next eight months to arrive at the airport three hours early.
Airline officials say the recommendation is being made due to construction on the tram system that shuttles passengers to gates 1-29.
Throughout the construction period, a single train will remain operational to shuttle customers between the terminal and gate area.
Construction on the $90 million project to replace trains that service gates 1 through 59 has caused at least six tram outages since mid-April.
"We recommend arriving at the airport three hours prior to your flight departure, and please be sure to check the status of your flight online or via the JetBlue app prior to arriving at the airport," the website for JetBlue reads.

You can find the same information on the website of the airport including a list of impacted airlines. Avianca is also mentioned which is the second airline offering direct flights from MCO to BOG. (But of course they might also leave from different gates, too.)
But at least today, according to flightstats.com, the flights of both airlines left from the affected gates. The Avianca flight left from gate 28 and the Jet Blue flight left from gate 5.
So you should be prepared for needing more time inside the airport since your flight might leave from an affected gate to which the airport tram is not running very often. Or you are lucky and the construction work is already finished when you're flying to Bogotá.
Interestingly, JetBlue recommends on their website that you should arrive for flights to Bogotá even four hours before departure.
Comment: They all recommend that, but it's pretty much BS. I am flying out of MCO every month, and the tram is no issue. If you know your way, you can be through in 30 mins; without TSA-Pre maybe worst case an hour. Unless it's Thanksgiving, and everybody and his aunt are travelling; then you need _more_ than three hours.


Please don't suggest starting a bounty to users who are unable to do so

Question: I asked a question that went for a long time without getting a definite answer. Later, when I looked at my user page, I saw the text "Have you considered accepting an answer or starting a bounty for this question?". I tried to figure out how to start a bounty, and read through the FAQs, and eventually found out that I can't offer a bounty unless I have at least 100 reputation points. So my suggestion is to not suggest starting a bounty to users who are unable to do so.
Comment: That seems like a pretty straight forward suggestion.
Answer: In 2009, 10 days after this question was asked, Jeff Atwood (I think you all know he was one of the creators of Stack Overflow) tagged this question as status-completed. So, I think it pretty evident the bug was fixed at that time.


Angularjs chaining .then to depend on each other

Question: I have a chain of events set in .then statements.  I wish I understood a way to use .when() in this case.  This function is called on a ngn-click.  The issue is that I have to click twice for it to go through.  The $rootScope.csa has data going into the function that is used in the .then( functions ).  I when in inspect in the chrome debugger the and step through everything works fine I believe it is because the debugger is slowing down the application and allowing it to keep up with its self.  Other wise when I go through with out the debugger it goes so fast that it takes two clicks for $rootScope.csa.section.data to be populated for the next function to work as expected.  The first two then statement functions are services that are wrapped in a promise and $timeout on there end and the $timeouts do not seem to be delaying the process.  I have looked over q.derer() many times but cannot wrap my head around how it would be implemented in this case.  Any help or information to get to the needs that I am looking for would ne appreciated.
audit.LockData('section', $scope.csa.ID, user.ID, $scope.csa.Revision)
    .then($rootScope.csa = audit.RecordsCheck($rootScope.csa))  //  gets data and pupulates it to the $rootscope.csa.section.data
    .then($rootScope.csa = audit.GetInstance($rootScope.csa), function(){ return $rootScope.csa})  //  gets ID(s) from $rootScope.csa.section.data.instances.ID(s) and populates them to the $rootScope.csa.section.instances
    .then(function() {if($rootScope.csa.section.data) $location.path('/Update')})
    .then(function() {if($rootScope.csa.section.data) $rootScope.$broadcast('root_updated')
});

Answer: You always need to pass a callback function to then, not some call result (even if it is a promise). I have not wrapped my head around what these functions do, but try
audit.LockData('section', $scope.csa.ID, user.ID, $scope.csa.Revision)
.then(function(lockResult) {
    return audit.RecordsCheck($rootScope.csa)) // gets data and pupulates it to the $rootscope.csa.section.data
})
.then(function(checkResult) {
    return audit.GetInstance($rootScope.csa) //  gets ID(s) from $rootScope.csa.section.data.instances.ID(s) and populates them to the $rootScope.csa.section.instances
})
.then(function(instance) {
    if ($rootScope.csa.section.data) {
        $location.path('/Update')
        $rootScope.$broadcast('root_updated')
    }
});


Ubuntu 16.04 guest OS on a Windows 10 VirtualBox host won't boot

Question: Disclaimer
I am not a Linux expert. I use Ubuntu to educate myself about Linux and to run my Kodi media center, so when things go wrong, I like to try to fix them instead of simply re-installing or going back to a previous snapshot (which in this case isn't working either!).
Background
So I recently did a system update on my 16.04 and a lot of files were downloaded and installed (I'm assuming this update included the Intel Spectre/Meltdown bug fixes to the kernel). I also upgraded my VirtualBox host to 5.2.6 and installed the latest Guest Additions package.  Everything seemed fine except I started to have sound issues (Sound Problem With VirtualBox -5.2.x branch).  One of the suggestions on that thread was to revert to an earlier version of Virtualbox, which I did, but couldn't get any of my Ubuntu VMs to boot.  It seems that due to the patches for the Intel CPU bug, to enable me to use an old version of VirtualBox, I would need to downgrade my kernel.  As this is beyond my abilities, I decided to just re-install the latest 5.2.6 VirtualBox host instead.
Problem
This is where the fun and games start. My Ubuntu VM wouldn't boot!  I was able to get to the GRUB boot selector and tried each of the 3 kernels listed, but in each case the boot process would stop at the same place.

I did some research and tried disabling a few things (3D acceleration, network adapters, sound card etc), but from what I can see in the boot window, its not even getting close to requiring those items so I cant see how they can be the issue.  I tried reverting back through several snapshots of the VM, but all of them experienced the same issue, which now makes me believe there must be something corrupt with the VM container.
I've posted this problem here because I was hoping someone could educate me as to the correct course of action to evaluate and fix a non-booting Ubuntu system.  I appreciate that VirtualBox is probably part of the issue here, but I have to choose one path of evaluation before another.
Things I've tried

Tried all 3 kernels in recovery mode
Tried disabling graphics, network and sound cards
Booted into a Ubuntu 16.0.4 LiveCD to do a repair install, but wasnt given an option to "install but keep files" even though it detected that I had a current installation on the disk
Tried a couple of different Linux VM's I've got (Kali, CentOS) and a Windows 10 VM which all worked fine but I've not yet patched any of them.

Concluding notes
I created a brand new 16.0.4 VM, fully patched it and it ran fine, hence another reason why I think its a corrupted container.  I am having problems getting the latest Virtualbox Guest Additions to enable 3D acceleration (even after following Oracle VM VirtualBox 5.1: 3D Acceleration for Ubuntu guests), but with acceleration disabled, at least it runs (but still have the sound issue!).
I don't want to give in.  There appears to be further GRUB boot options that I've never used before (e.g. 'c' for a grub command line), so any help trying to educate me on resolving such a difficult issue would be appreciated.
Answer: I had the same issue.   After fighting with VBox for 4 hours, finally I won.  The change I had to do was enable back 3d acceleration and thing which I think made it workis the "Version" mentioned in "Settings->General->Basic".  I set it to "Ubuntu (64-bit)" instead of the 32 bit version, and voila, it worked.
Comment: My Ubuntu VM was working fine.  Then I upgraded to 5.2.20 and it was not working.  I would get to the GRUB screen, select to boot Ubuntu and then only get a blinking cursor.  No boot log scrolling away.Turns out the Version was set to Ubuntu 32 bit.  Setting back to Ubuntu 64 bit fixed the issue.  HTH someone else.


how to go from front suspension to full suspension?

Question: I got a bike for my birthday, a cheap one, 200€ 27,5 with front suspension, but I want a full-suspension bike.  My question is: is it cheaper to buy a full-suspension frame and move the parts to the new frame, or buy a new bike?
Comment: It's cheaper to buy a *used* bike.  Many perfectly serviceable bikes are sitting in garages, basements, and sheds, essentially unused.
Comment: Another option - if you haven't assembled the bike - it may be possible to do a return to the shop.  You'll need the sales receipt/docket though, and depending on locale you may only get store credit.   200 euro won't buy much of a full suspension bike, so you'll need to top it up with your own money to even get a BSO full sus.
Comment: Why do you want full suspension? Do you plan to do a lot of riding where that will actually be useful? If you're mostly riding on roads and cycle paths, full suspension is just a huge pile of extra weight to carry around and it saps your power by flexing as you pedal.
Comment: I ride down stairs on my hard tail 29'er BSO, unsure how much difference your smaller wheels make.
Answer: You have a "BSO" and as such is built down to a price.  A bare full-suspension frame will cost more than that whole bike, and no guarantee the parts will move over.
I suspect you're a teenager?    Your best bet is to just ride your new bike.  Develop endurance and leg power and aerobic capacity.  While you're riding, look at other riders and learn.
Even though you call it a "cheap bike" its still worth looking after.   Store it inside at night and not out in the rain.  Tune it up occasionally, and don't biff it around.   Lock it too.
In 3-5 years you can decide to replace it outright with something that you've saved up for - so budget to save 10 euros a week and in 3 years you'll have over 1500 euros to spend on the bike you want.  By then your legs should be fully grown so the current bike frame will be too small.
And be grateful that someone bought you a bike, even if its not exactly what you wanted.
Comment: The reason it broke is it was cheap not because it was a HT. A FS bike that can reliably handle that stuff riding style will start at about 1500€. If you can't afford that, you are much better to stick to a higher quality hard tail if that is the style riding you want to do.
Comment: @RazzeT ok fair enough - you're "full sized" so you won't grow out of it.   A BSO won't like being ridden down stairs or any sort of stunting.  But at 21 you're an adult and can make your own decisions about how to treat your stuff.   The short answer is "if you want a full sus, buy a full sus"
Comment: 21 yo thats not my first bike the other broke
im grateful dude but my other bike broke cause i was riding and jumpin and go down stairs etc
so i thougth a fs was safer
thanks for your advice man


What are the downsides of setting the autofocus point brightness to the highest setting?

Question: On the Canon 1Ds bodies there is a custom function that lets you set the brightness of the autofocus points. I find them a lot easier to see if set to the brightest setting. Are there any downsides of doing this. I guess the battery consumption would be slightly higher, but other than that are there any cons of doing this? Does it decrease the life of these lights at a higher rate maybe?
Comment: I highly doubt it would measurably reduce the life of the LEDs or even affect battery life to a quantifiable degree. The setting is there strictly for user preference an to adjust to changing conditions.
Answer: That's a new one on me.
But no, the battery life won't be noticeably shorter in standard use (via a quick search for "LED power drain") and LEDs like that will outlast the camera body (unless you start spending 100's on repairs to other parts of the body).
You personally could experience a slight loss of night vision if you're looking at the night sky or wildlife. And if you keep pressing the shutter down without your eye blocking that viewfinder then it would be a tiny bit more visible from elsewhere.
Other than that it's as Michael Clark 1 says in that it's to adjust to changing conditions.
Happy clicking!
Answer: The only downside might be that you might get a little more glare/light bleed from it bouncing off the focus screen and if shooting in low light, it might have more of an impact on your night vision.  It's entirely a user preference thing though, there isn't really any advantage or disadvantage beyond using it the way you like.


$\kappa$-dense ideals on successor $\kappa$

Question: Woodin gave a consistency proof of a normal $\omega_1$-dense ideal on $\omega_1$ from an almost-huge cardinal.  He never published this argument, but it is written up by Foreman in the Handbook of Set Theory.  In this article, and in a paper from the 90s, Foreman claims that this argument is adaptable to other cardinals to yield the consistency of an $\kappa$-dense ideal on $\kappa$ where $\kappa$ is the successor of a regular cardinal.  I have had great trouble trying to prove this claim, as one crucial part of the argument seems specific to $\omega_1$ (which I will explain if you ask).  So does anyone know how to prove Foreman's claim?
Comment: What is the crucial dependence on $\omega_1$? I'm looking at Foreman's article right now, and I'm not sure exactly what you mean.
Comment: Look at the paragraph that starts with the following:" We let W be the model V1[G0] and construct the partial ordering C ∈ W as in Lemma 7.61. In V1[G ∗ C], the cardinality of P (C)W is countable, so we can build a W -generic object for C." What are we supposed to do at higher cardinals? Let's say we try for ω2. The analogous forcing C for amalgamating small Levy generics is not countably closed, so how do we build a generic for it in the appropriate model?
Comment: What about $|C|$-strategically closure?
Comment: Eran, that would be good, but how would you show it?
Answer: This is answered in chapter 2 of my thesis.  As far as I know, this is essentially the only method for obtaining such ideals.  I am very interested in finding alternative constructions.  Please contact me if you have some ideas.


Are there any tools to automatically search and download literature in a given .bib file?

Question: I'd like to download automatically tons of papers listed on .bib file so I'm trying to find a way to facilitate the process by, e.g. I import or input to a tool a certain .bib file which contains a list of literature, the output is the literature's .pdf file. Any idea to do so?
Comment: Aaron Swartz's issue wasn't the automatic downloading, it was the intent to distribute the copyright materials.
What Macchiavalley is asking has no such problems, at least not directly -- it may still be against policy, but it won't be anywhere near as much of an issue.
Comment: Maybe a stupid question: Why would you do that? Surely, the bottleneck for reading through the papers is not finding and downloading them, but actually reading and understanding them?
Comment: Does it contain DOI or arXiv identifiers? If it does, it may be possible (though, automatic downloads are usually not allowed by journals).
Comment: Related questions [here](http://academia.stackexchange.com/q/15705/65) and [here](http://academia.stackexchange.com/q/17858/65) and [here](http://academia.stackexchange.com/q/2169/65)
Comment: Don't forget what happened to [Aaron Swartz](http://en.wikipedia.org/wiki/Aaron_Swartz#JSTOR).
Answer: In contrast to the freemium/proprietary tool suggested in the answer by andreas, I propose a FOSS solution that works reliably for this specific task.
Assuming you are connected to a network that provides permissions to legally download the required content, the cross-platform reference manager,JabRef has integrated fetchers to download full-texts for the entries in your library. Import your bib file into Jabref (maybe just start a new library for this task to keep things clean) and select the desired number of entries for which full-text PDFs are needed. Then, from the Quality pull-down menu, select Lookup Fulltext documents.
However, you still have to manually confirm all downloads. From the user's perspective, this requires just a bunch of clicking the OK button in the same on-screen co-ordinate (for pop-ups that appears sequentially for each citation entry). Jabref does all the heavy-lifting and correctly downloads the desired PDFs of the full-text and link each of them appropriately by matching to their relevant citation entry in the library.
The latest master build of Jabref is recommended, since there were some recent fixes to its IEEE fetcher (i.e. if IEEE matters to the OP).
Comment: Thanks for sharing it, that's an excellent solution, on top of being a FOSS one!
Comment: As of Sept 19, `JabRef` didn't work for me, the program freezes after every `OK` operation.
Answer: BibTeX is usually a very heterogeneous source of bibliographic references. URLs can be stored in several fields like 'url', 'howpublished', or 'citeulike-linkout-0',  'citeulike-linkout-1'... 'citeulike-linkout-n'. Moreover, some entries have a DOI, arXiv ID, PubMed ID or PMC ID and some don't.
As a developer of Paperpile I had the pleasure to dig into this over the last years, and there is no easy solution to a problem like this, but I think Paperpile comes close to a 'least effort' solution for the user. Let me explain
how you can handle such a task with Paperpile.

Simply upload the BibTeX file to Paperpile
Paperpile will automatically match the uploaded references against databases like PubMed or Google Scholar to get better bibliographic information. The key point here is that it will retrieve DOIs which point to the website of the article at the publisher.
You can then trigger automatic download of the PDF of these articles

The nice side effect is that you will have an updated bibliography with many of the articles being up to date and having the abstract. Of course, you can also export your references then again as BibTeX.
Answer: I have taken the script developed by Janik Vonrotz (https://janikvonrotz.ch/2020/05/07/bulk-download-papers-from-scihub-for-text-mining/) and updated it:
urlencode() {
    # urlencode <string>
    old_lc_collate=$LC_COLLATE
    LC_COLLATE=C

    local length="${#1}"
    for (( i = 0; i < length; i++ )); do
        local c="${1:i:1}"
        case $c in
            [a-zA-Z0-9.~_-]) printf "$c" ;;
            " ") printf "+";;
            *) printf '%%%02X' "'$c" ;;
        esac
    done

    LC_COLLATE=$old_lc_collate
}

readarray list < ./doi-list.txt
for doi in "${list[@]}"
do
    echo "Download for term: ${doi}"
        echo "$(urlencode "${doi}")"
    link=$(curl -s -L 'https://sci-hub.se/' --compressed \
        -H 'authority: sci-hub.se' \
        -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
        -H 'accept-language: en-US,en;q=0.9,es-CO;q=0.8,es;q=0.7' \
        -H 'cache-control: max-age=0' \
        -H 'content-type: application/x-www-form-urlencoded' \
        -H 'cookie: __ddg1=BtxiJLnNZJLBkABn4hpt; session=97bea0eea9e31566256d52c73ff7f0c8; refresh=1632424058.9403; __ddgid=ZhCUNBqgvzZw8NyO; __ddgmark=fwbZCB5monJGgo14; __ddg2=xmUHEIajmbeImx4L' \
        -H 'origin: https://sci-hub.se' \
        -H 'referer: https://sci-hub.se/' \
        -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="92", "Opera";v="78"' \
        -H 'sec-ch-ua-mobile: ?0' \
        -H 'sec-fetch-dest: document' \
        -H 'sec-fetch-mode: navigate' \
        -H 'sec-fetch-site: same-origin' \
        -H 'sec-fetch-user: ?1' \
        -H 'upgrade-insecure-requests: 1' \
        -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36 OPR/78.0.4093.231' \
        --data-raw "sci-hub-plugin-check=&request=$(urlencode "${doi}")". | grep -oP  "(?<=//).+(?=#)")

    echo "Found link: $link"
    cd ./Downloads/papers/textmining && { curl -s -L $link -O ; cd -; }
done

This version accepts one URL (BibTeX URL field), PMI/DOI, or search string (BibTeX title field) per line in the input file
Answer: You may don't like this answer but automatic download is explicitly forbidden by many publishers and can result in the ban of labs/campus access to the journals of the publisher. Such automatic download can made by e.g. EndNote (actually, it does it automatically in some settings), and done by some students in our lab - as a result,  a bunch of IP addresses get blocked.
Answer: Mendeley can do this, though for non open access articles, you will get at most the abstract. Also, there's no guarantee on automatically getting pdfs, as this depends on user uploads.
Comment: can you please elaborate on how this can be done using Mendeley?
Comment: Sorry, I haven't used mendeley in years, though maybe someone else can answer. I thought it was just a matter of synchronizing, but as I said, it has been years.
Answer: Some of these answers are overtly incorrect. OpenURL is a publisher endorsed standard (amongst others, such as DOI), that was built to facilitate exactly this. There are subscription models which most universities sign up to for this. The issue around Schwartz and Scihub etc. is linked but it is possible to legitimately download many articles in an academic bibliography in a batch/automated fashion. Endnote is a commercial tool that specifically has a function which involves downloading full text, as an example.
Answer: Zotero can import many formats, including *.bib.


Fix position for a time-series of graphs

Question: I have I have a (time-)series of directed cyclic graphs. Every time step has only a few modification over the past one. Is there a way to fix (maybe not completely) the position of the notes, so that the changes become more evident.
Answer: I had the same necessity to fix a part of nodes (the graph was bilobed). I needed to fix the nodes from one lobe. I tried to use graphviz but then realised that it didn't have such an option. That's why I wrote my own code on Matlab for bilobed graphs. Probably you'll have to cope with the same.


How can I get all my Twitter related activity in counts?

Question: How can I get all my Twitter related activity in counts? Example: my tweet count is 50; my favorite is 10. I need counts of following: mentions, favorites, retweets, liststatus, hometimeline, direct messages, followers, and users I follow.
Answer: You can use the api method user/show:
https://dev.twitter.com/docs/api/1.1/get/users/show
It will return all kind of info about a twitter user like:

favourites_count
listed_count
followers_count
statuses_count
friends_count
Answer: There are a number of sites that offer Twitter stats.
For what you are after Twitter Counter is probably your best bet for just providing counts (you'll need to give it access to your account for a full profile).


Term for period between vernal and autumnal equinox

Question: What is the appropriate term to describe the 6-month period between equinoxes, when the Earth's northern axis is tilted towards the sun? Most dictionaries define summer as only the warmest months, June to August (in the Northern hemisphere).
Comment: spring and summer
Comment: Summer used to be the entire half-year, not just the single season it is now more usually reckoned.    I say usually, because *midsummer* betrays the old two-season calendar. See my answer.
Comment: What about from autumnal to vernal? What about from solstice to solstice?
Comment: Spring and summer are separate terms, I was wondering if there was one all encompasing term.
Comment: Summer time (in Europe) and Daylight Saving Time (in North America) is not that far away.
Answer: Not that I am whole-heartedly suggesting this as a viable modern sense, but during elder days in the Northwest of our world, the word for the period extending from the vernal equinox to the autumnal one was quite simply Summer — nothing more, and nothing else.
There were only two seasons not four in this system, and we preserve this even today in our own Midsummer and Midwinter. That is why its midpoint at the solstice is called Midsummer's Day.  That is also why the midpoint of Winter is on Midwinter's Day, which is the opposite solstice.
Alfta Lothurrsdottir discusses this in her Religious Practices of the Pre-Christian & Viking Age North under time-keeping:

The Two Great Seasons
The major unit of time keeping for Heathens was the two great seasons. Unlike our four seasons, they had two which consisted of Winter and Summer. Sometimes they were called Spring and Autumn but it was still only two seasons that were meant. Each one was 26 weeks long. This practice turned into four seasons the farther South one went but for the most part, the Northern Europeans seemed to have kept a two season calendar. [...] Both the Anglo-Saxon and Old Norse have terms that support this two-fold division of the year.

Iceland, Greenland, and indeed also England reckoned the year into having two seasonal halves.  That means that old records that measured things in seasons were actually twice as long than many casual readers would reckon things: eight seasons ago is four years, not two.
It is not hard to see why they did this.  In Reykjavík during midsummer, the sun never completely deserts them, and during midwinter, it is hardly to be seen.
We can see this in our earliest records of the words in English, where winter and summer — or equally, summer and winter — was how one specified a full year.  Citations from the OED:

A. 1000 Phœnix 37 (Gr.) ― Wintres & sumeres wudu bið ʒelice bledum ʒehongen.
C. 1205 Lay. 2861 ― Enne blase of fure, þe neuer ne aþeostrede wintres ne sumeres.

Time was reckoned differently then.  They would often count years by counting winters, and so a man of twenty winters was a twenty-year-old, just as a two- or three-year-old was a twinter and a thrinter respectively.
However, even their ideas of summer and winter were not quite ours.  For them, the summery half the year began during mid-to-late April, and the wintry half during mid-to-late October.  Samhain marked the end of the harvest and the beginning of winter, and Beltain, close to our own May Day, the beginning of summer.  The cross-quarter days were useful in the common mindset, because of the thermal inertia that causes the apparent season to lag behind the actual solstices and equinoxes.
It wasn't too long after the invasion of the southern occupiers from Normandy that the sense of a four-season year began to evolve:

C. 1200 Ormin 11254 ― O sumerr, & onn herrfessttid, O winnterr, & o lenntenn.

That is, not just summer and winter, but also a lenten season and a harvesttide.
Comment: Twinter and thrinter?! +1 for interestingness.
Comment: I don't know if I believe a northern origin for this: I grew up in a temperate region (southern California, to be exact), and I really didn't understand the concept of *four* seasons until I moved further *north* (to Pennsylvania). Here, there are definite differences: spring is not the same as summer, and autumn is not the same as winter (though autumn here does make a passable California winter, just with more colorful leaves).
Comment: @Marthaª What is it you do not believe a northern origin for?  That our calendar had once but two seasons not four? This is quite well documented.  Or why midsummer and midwinter fall on (or just past) the solstices instead of on their respective cross-quarter days following that six weeks later? This too is well documented.  It's all about a two-season year. You have never lived at these high latitudes.  The sun is quite dramatic: Edinburgh stands at 56°N, Reykjavík at 64°N. Philly at merely 40°N simply doesn't compare.
Comment: Yep, exactly. In Reykjavík you basically can read a newspaper outside in summer after dusk and in winter you rarely ever see the sun and its "bright" only for a few hours. Keep in mind that the polar circle is at 66°N.
Answer: The period between equinoxes would be interequinoctial:

Coming between the equinoxes.
Summer and winter I have called interequinoctial intervals. — F. Balfour.

The term appears to be a little dated.
Comment: But how to refer to the particular interval asked in the question?
Comment: @Fuhrmanator hmm. Perhaps, _aesitval/vernal interequinoctial_ vs. _hibernal/autumnal interequinoctial_?


Log parser for ftp server

Question: Can anyone suggest good log reporting software for Proftpd?
I am looking for something at least as good as http://xferlogdb.sourceforge.net  where log is fed into the database and dynamic web pages are built to retrieve historical data and statistics per user, time period and so on.
Xferlogdb is very helpful , but unfortunately latest release is 2004
Answer: http://www.proftpd.org/docs/howto/Logging.html lists like 5 packages that can be used.
Hey, a note though - be aware that most of these packages do NOT do ftp reporting properly, though it's probably not their fault.
We do a lot of software downloads here and we bit this problem off before.  Because so many people use download accelerators of one sort or another, when there's a download for a 5 MB file it is likely to show up in your logs (though I haven't used proftpd, it's true of wuftpd and ncftpd) as a bunch of different lines of some smaller increment - like 100 lines of 50k apiece.  If you run this through most log analysis programs, they will all tell you "100 downloads of your file, sir!"  Which is bad and wrong.
Some FTP daemons - and it looks like proftpd does this - have a "completion-status" field at the end that is set to "i" for incomplete or "c" for completed download.  So in theory you could look for the "c"'s and determine how many were successful or not.  But IT'S A TRAP!  That field is set by the client.  If you inspect your logs carefully you'll see some naughty stretches of some that set every transfer - even for just a specific byterange chunk of the file - to "c".  Even if it was set correctly, it would be hard to determine completion rates as a percentage of total without doing stuff like "Well, we'll assume all attempts to this one file from one IP over, say... an hour?  Is the same attempt."
There are only two fixes to this I know of.

Have your FTP daemon clearly log when it sends the first byte and last byte of a file (still, maybe they missed chunks in the middle, but it's close).  I know Akamai hacks their FTP server to do this, we suggested it to the ncftpd guy and he put it on his list but don't think it's done.
Keep track of how big every one of your files is and do complicated math to determine if you think one IP downloaded about the right amount of file.  Doesn't fix someone who makes ten attemptes and gets 1/10 of the file before the transfer fails each time, but again it's closer.

You don't have to go to this trouble if you don't care, but I wanted to FYI you that you can NOT trust the numbers most log analysis programs spit out for FTP, they will be off by an order of magnitude.  Verify real logs against them to understand what it is you're getting.
Answer: AWStats supports ftp.
Comment: Thank you , I did try Awstats already .In my opinion it still does not seem to match xferlogdb when it comes to ftp logs.
Answer: The proftpd docs page has links to The Webalizer and FTPWebLog.

Log parser for ftp server


How to get this look in photoshop?

Question: How to get this look in Photoshop or by any other online application?
Comment: Convert to gray scale -> add some guassian blur -> save it at the highest JPG compression rate.
Comment: Which part of the image's look do you want to replicate? It just looks like a black and white image with high contrast so the shadow regions are completely black. Convert to greyscale then using Levels will do that in Photoshop.
Answer: That's not so much a Photoshop thing as it is a photographic technique. It's just a high contrast shot with spot lighting. The Photography SE could give you pointers for reproducing this in camera.
If you must do it in Photoshop to an existing image, there is some hope.

Mask off the various regions of the photo from the desired highlight to the shadow and some way to progressively adjust between the two. You could feather the shadow side, for instance.
Use adjustment layers with those masks applied to get the lighting right. There are a lot of options here depending on the photo: Curves, levels, exposure, etc.
This style usually comes with a bit of graininess too. If you want that, apply the film grain effect.
Comment: Just to extend: This photographic technique is called low-key photographing and is all about the lighting setup. For more info: http://www.lightstalking.com/low-key-photography
Answer: It looks like your link isn't working, so here's another low key photography lesson: https://medium.com/@fromtherooftopsphoto/titillating-viewers-with-nudity-in-my-work-bc929758058f

How to get this look in photoshop?


How can pKas differ across similar protons of the same atom?

Question: For example, citric acid has three acidic protons, all of which are carboxylic acids. Despite being part of the same functional groups, they all have very different pKas. Why (and how?) is this?
Comment: The concept of same atom is somewhat misleading here.  They are the 'same type' of atom, not the 'same' atom.
Answer: Here is a picture of citric acid.

As you noted, there are 3 carboxylic acid groups in citric acid, so there are 3 acidic protons. A chemist looking at this unionized molecule would say that the carboxylic acid group drawn on the right side of the molecule is equivalent to (the same as) the carboxylic acid group drawn on the left.  Therefore, these 2 equivalent carboxylic acid groups should have the same pKa.  The carboxylic acid group drawn in the middle of the diagram is different from the other two (it is not the same as the other two) and should therefore have a different $\ce{pKa}$.  In chemistry, groups are either the same or different.  If they are the same they must be indistinguishable in all aspects, including physical properties like $\ce{pKa}$
That said, we might expect when we treat citric acid with more and more base to see only 2 different $\ce{pKa}$'s, but that is not the case.  In actuality when we treat citric acid with base one of the two different (right and left or middle) carboxylic acid groups will ionize.  Once that happens the ionized citric acid molecule contains a negative charge.  It will be harder to ionize the molecule again and remove the second proton and place a second negative charge on the molecule (bringing like charges together is destabilizing and costs energy).  The same argument tells us that removing the third and final proton will be even more difficult because we wind up with 3 negative charges on the molecule.  As a consequence of this increasing difficulty to remove protons, we observe 3 different $\ce{pKa}$'s.
Answer: Let's begin this discussion with the simpler oxalic acid.
<code>     O
     #
HO-C-C-OH
   #
   O
</code>
There are two carboxylic acid functional groups, and there are two different pKa's.  This is because double deprotonation does not happen simulateneously.  One gets deprotonated first, then the other.  After the first deprotonation, the residual molecule has a negative charge.  The result:
<code>     O
     #
HO-C-C-O~
   #
   O
</code>
Is much less acidic because the presences of the carboxylate functional group changes the acidity.
Let's continue the discussion with the (still simpler) alpha-chlorosuccinic acid:
<code>    Cl H O
     | | #
HO-C-C-C-C-OH
   # | |
   O H H
</code>
The acid closer to the chlorine is more acidic because the chlorine is strongly electron withdrawing, and 'pulls' the electrons out of the carboxylate function, which then 'pulls' electrons away from the hydrogen, making it more acidic.  This effect decreases with distance, so the chlorine pulls on the acid function farther away less strongly.
In a more generalized way, remote groups will modify acidity because of electron withdrawing or donating effects, but the farther away from the acid function, the less effect there is.
For citric acid, there are actually two different flavors of acid function, so one of the kinds will be intrinsically more acidic before deprotonation because of the remove effect.  However, because of the sequential deprotonation discussed above, all three will have different pKa's