circuit breaker issue

Question: I'm trying to figure out why my circuit breaker keeps tripping.  This is for the garage door opener.  It is the only thing that is on the breaker. I have lights in the garage but they are
rarely on. What are the potential solutions?
Comment: Does the opener sound like it's struggling? Does the door move at all? Does the breaker trip when the door is going up, down, or both?
Answer: The simple answer is that the breaker is tripping because two much current is flowing through it.
Here's a list of some possible causes for over-current:

Faulty wiring may be partly short-circuiting
Faulty appliance is drawing too much current
Too many devices on that circuit, in total drawing too much power

I would start by proving to yourself that there is definitely nothing else on that circuit other than the opener and the lights. Turn the breaker off and then go around and see if anything else is off. Outlets in the garage? Chest freezer? Sump pump?
Second, see if you notice a pattern of when the breaker trips. If it trips when you flip the light switch, then maybe the switch is faulty or maybe the lights are the extra current.
If you're positive there is nothing on the circuit, then you're looking at a defect. Finding it may or may not be in your skill set, but you could start checking the voltage at the opener with a multimeter. Then start opening outlet covers to see if there are any lose wires. Check for signs of arcing (which may leave black sooty marks around the outlet terminals.
FYI, the time it takes to trip a breaker depends in part on how much over-current there is. It may take several seconds or even a minute if you're only just barely over the circuit breaker rating.
Comment: +1 Also if the breaker trips while the garage door opener is operating, it is likely a faulty motor or a binding track, causing the motor to draw too much current.

circuit breaker issue


Cold storage for bitcoins

Question: I'm planning to store some bitcoins in cold storage. I'm doing a very simple setup, no complicated algorithms, no wallets...
Here is my plan

Create an air-gapped machine with a Linux distro. The machine won't have access to Internet and I'll disable wifi/mobile connection on purpose to be sure that no Internet is available.
Copy 4 files to the air-gapped machine using a microSD card. The first archive has a version of "coinb.in" which will help me create transactions. The second archive has a "bitcoin.sh" file which is a set of bash functions to create bitcoins addresses. The third archive, is a small HTML/JS qrcode generator. The forth file is the diceware words list.
On the air-gapped machine, create the mighty bitcoin address. I'm going to use a brainwallet with the following format (or a variation of it)

SALT (5 char) + 10 Diceware words + My Password (10 char) + SALT (5 char)

The passphrase will be hashed one time with SHA-256. The resulting Hex. will be used as the private key. Generate the address/public-key with the bitcoin utility.
With the Qr-Code generator, create a qrcode of the bitcoin address. Now I use my mobile phone to scan the QrCode and send a few millibits to that address.
Using my connected laptop, I retrieve the Transaction id and Script of the transaction that I made. I write those down on paper. I then go to my air-gapped machine and I enter these information to create the transaction and sign it.
Once signed, I use my qrcode utility again to create a qrcode of the transaction raw HEX code. I then use my mobile phone to scan that QrCode and send it to my pc.
I check that the transaction is valid and I broadcast the transaction.

Some precaution I'll be taking:

Make sure that the Wifi is not running when the air-gapped machine is running.
When scanning the QrCode, make sure that the private key is not visible somewhere in the screen.

So this is the setup that I implemented. I'm wondering if I missed something or something is possibly at risk. Since the setup is tested, I'm here referring to the problem of funds being stolen by cracking my passphrase or infecting my air-gapped machine.
Ideas and critics welcome!
Comment: You're very likely to lose your money doing this. You're using un-reviewed software which is running in an extremely vulnerable environment (coinbin.js), and you've created a long and arduous process which has you interacting directly with raw keys multiple times.
Comment: @Bitcoin Could you precise how I could lose money? Could the air-gapped machine get infected? or maybe through technical error? I'm not sure I get your point.
Comment: If the code is malicious it will produce compromised keys, online or offline.
Comment: @Bitcoin I'll be using the tool only to create transactions and verify them online. I'll be using another utility to create the private key.
Comment: Either one can compromise your money easily.
Comment: @Bitcoin Can you develop more on that part? The private key is derived from the SHA-256 of the passphrase. The utility I'm using is a simple bash script to calculate the address and WIF format of the private key.
Answer: Omar, you can do almost everything you want there with Armory using the offline feature. The offline, air-gapped computer can create the private key and store it there. The watch-only wallet on the internet connected computer can create transactions to be signed by the offline computer.
From a security standpoint, it's generally better to use something a lot of other people have used before than creating your own process.
Comment: I just downloaded Armory but I don't see the option to create a private key or create a custom transaction.
Comment: Create a wallet to create private keys. Import the watch-only wallet, create a transaction by doing a "send bitcoins" and on watch-only wallets, you'll create a transaction in ASCII that can be imported to the off-line machine to sign.

Cold storage for bitcoins


Algorithm to decide whether two quotient rings are isomorphic?

Question: Let $I_1,I_2\subset \mathbb{C}[x_1,\dots,x_n]=:R$ be two prime ideals (in practice we would probably work with $\mathbb{Q}$ instead). Is there an algorithm to decide whether
$$R/I_1\cong R/I_2$$
as $\mathbb{C}$-algebra's? i.e. whether $I_1$ and $I_2$ defined isomorphic varieties?
Comment: And probably $I_1$ and $I_2$ are input by a finite generating family.
Comment: @YCor Yes exactly.
Comment: Note that if you input finite sets $F_1,F_2$ of rational polynomials, the questions whether $\mathbf{Q}[x_1,\dots,x_n]/\langle F_1\rangle$ and $\mathbf{Q}[x_1,\dots,x_n]/\langle F_2\rangle$ are isomorphic, resp. whether $\mathbf{C}[x_1,\dots,x_n]/\langle F_1\rangle$ and $\mathbf{C}[x_1,\dots,x_n]/\langle F_2\rangle$ are isomorphic, are different.
Comment: @YCor Yes I realise that, but I'm curious about both questions. To point is that I'm actually most interested in the question over $\mathbb{C}$, but there is no hope of this being actually computable, hence the question over $\mathbb{Q}$, where more things do tend to be computable. Actually I guess we could work over $\overline{\mathbb{Q}}$.
Comment: You can work over an algebraically closed computable field (computable means that you can input its elements, compute operations, and determine whether two elements are equal).
Answer: Macaulay2 has an algorithm to compute minimal presentations of $I_1$ and $I_2$ ("compute a minimal presentation of the quotient ring defined by an ideal").  If those minimal presentation are equal (or otherwise observably isomorphic), then $R/I_1\cong R/I_2$.
I tried it with a few silly examples just now in Macaulay2, and it worked for those.  Maybe you will get lucky with the cases you are thinking about.
Answer: Your question is a special case of the general problem of deciding whether two varieties are isomorphic. This question is discussed here:
Isomorphism problem for commutative algebras and schemes.
There is no known algorithm for this problem, and the problem is not known to be undecidable. I suspect the same is true for your problem.


Java GC strange behaviour or memory leak?

Question: I am working on a Swing application and recently, I started to see the following problem:
I have to display in a separate window a very large job report. I close this window, then I re-open the same job report and I get an OutOfMemory Java heap space error.
The JVM is started with -Xmx512m and all the objects that are created when I open the job report take about 300MB on heap. Assuming that there isn't a memory leak, I would expect that the second time I open the same job report the JVM won't throw the OOM. But, looking at the GC logs after closing the first window, I don't see any GC activity.
The strange thing is that after I close the first window, if I take a heap dump with jmap (without the "live" option) the objects can still be seen in the heap dump.
If I run jmap with the dump:live option, the followings happen:

after the first heap dump is taken, I can still see the objects on the heap.
when I take the second heap dump, it no longer contains those objects, I can re-open the same job report again, with no problems.
So, if it was a memory leak, then those objects could not have been collected, am I right?

I tested this on Java 6 (1.6.0_25 ad 1.6.0_45, on Windows) and it reproduces all the time.
Running jmap -heap prints :
"using thread-local object allocation.
Mark Sweep Compact GC

Heap Configuration:
   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 536870912 (512.0MB)
   NewSize          = 1048576 (1.0MB)
   MaxNewSize       = 4294901760 (4095.9375MB)
   OldSize          = 4194304 (4.0MB)
   NewRatio         = 2
   SurvivorRatio    = 8
   PermSize         = 12582912 (12.0MB)
   MaxPermSize      = 134217728 (128.0MB)

"

JVM is started with the following options:
"   -Xms128m
    -Xmx512m
    -XX:MaxPermSize=128M
    -verbose:gc
    -XX:+PrintGCTimeStamps
    -XX:+PrintGCDetails
    -Xloggc:c:\my_gc.log
    -XX:+HeapDumpOnOutOfMemoryError"

So, my question is: why are all the objects collected when I take the heap dump with the live option (a sign that there isn't a memory leak) but, if I don't do this, I am unable to re-open another(or the same) job report because I get an OOM error?
Also, I tested another scenario:

open the first job report window, then closed it.
created a menu item that when pressed, creates in an infinite loop Long instances until the JVM throws an OOM.
I inspected the heap dump that was generated when the OOM was thrown and the heap was filled 99% with Long instances and none of my job report objects were on the heap.

Thanks in advance.
Answer:
So, my question is: why are all the objects collected when I take the
  heap dump with the live option

The jmap live option forces a collection. It has been discussed here .
Your observations corroborate that.
What can be done as an exercise is re-opening the window post some GC activity to see whether the memory has been reclaimed.


How to move EC2 instance to another ECS cluster

Question: Assume I have two clusters devcluster and qacluster on ECS.
How to remove an EC2 instance (ecs-optimized amazon-linux) from qacluster  and add to devcluster?
Answer: You need to follow these steps:

Set ECS_CLUSTER=devcluster in /etc/ecs/ecs.config
Stop all tasks/containers
Remove checkpoint file - /var/lib/ecs/data/ecs_agent_data.json
Start ECS agent again as explained here - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-install.html

To make sure it uses correct cluster, check logs - docker logs ecs-agent. It should have a message like:
[INFO] Registration completed successfully. I am running as 'arn:aws:ecs:eu-west-1:ACCOUNT_ID:container-instance/CLUSTER_ID' in cluster 'devcluster'

Comment: You should avoid publishing any ressource arn without masking your account id and the ressource id in my opinion. I've edited and cleared the the revision history.
Comment: @Tensibai you're totally right. But it was actually masked as I have replaced last 6 digits with zeros ;) But this change would not harm.
Comment: There's a small chance it match someone else account number, prefer replacing with xxxx than with 0 to avoid bots scanning the internet launching attacks :)
Answer: The way a cluster becomes aware of the EC2 instances associated to it, is a configuration file used by the ECS agent. You can modify this file, located at /etc/ecs/ecs.config, and name a different cluster. Then restart the ECS agent. This will effectively "move" the EC2 instance to the other cluster.
More information about ecs.config in the documentation - http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html
After the modification, it is possible to verify by sending an HTTP request to the ECS Agent metadata service and see the new cluster displayed. http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-update.html
The ECS cluster itself also needs to be notified. Can use the Register/Deregister API calls for this, for example using the AWS CLI:

http://docs.aws.amazon.com/cli/latest/reference/ecs/register-container-instance.html
http://docs.aws.amazon.com/cli/latest/reference/ecs/deregister-container-instance.html

More housekeeping might be required on the ECS agent itself. Like removing cached checkpoint files, etc. https://github.com/aws/amazon-ecs-agent/issues/139#issuecomment-123061463
Comment: i modified `/etc/ecs/ecs.config` to `ECS_CLUSTER=devcluster` and restarted ec2 instance. but the instance still appear on `qacluster`
Comment: @sith I updated the answer with details about registration of instances in the ECS Cluster metadata. Might need to be updated as well, or else the cluster does not know about a new instance or about a removed one.
Answer: Updated for ECS optimized AMI image as of May 2021. The sudo start command is not present and the checkpoint file /var/lib/ecs/data/ecs_agent_data.json changed to agent.db.

Edit /etc/ecs/ecs.config as previously described (add ECS_CLUSTER=devcluster).
Rename the agent state file with mv /var/lib/ecs/data/agent.db /var/lib/ecs/data/agent.db.old
Restart the ECS agent using sudo systemctl restart ecs

Check the status of the agent with systemctl status ecs, you want it to display Active: active (running).
This was a bit frustrating to figure out because the Amazon online documentation I found still displays the old information. Couldn't have done it without devops!


Is there an infant-equipped transportation service with car seat to and fro airports?

Question: My 6-week old child, my husband and I are taking a flight from East-cost to West-cost.  Is there a taxi or other transportation company that will provide a car seat on a short notice?  And also would you recommend that vs. bringing your own car seat?  If the latter, any recommendations for light-weight car-seat that are suitable for such trips?
Comment: Car seats are almost 100% (as in I've never seen a popular one that is not) designed for aircraft travel. You have to buy your infant their own seat, but then you can buckle the car seat in and place your infant in it. When you get off at the other end put your car seat in the taxi or rental car and you are good to go. No need to get a separate seat. Or you can gate check the car seat (a cover is recommended for that) and your infant can fly as a lap child. It will be waiting for you at the other end. Note that most airlines won't let you get check a car seat AND a stroller.
Comment: I just wanted to metion that I recently travelled with my 3 month old son. We were able to check both his jogging stroller and car seat at the gate. He laid on a pillow on my lap for the flight. Ask your airline before making any decisions.
Answer: Many cab companies offer this service, but remember you will need them in both cities, at both ends of your trip.
Some family friendly cab companies are listed at Families Go!. If the cities you are traveling to/from are not listed, you will want to Google what cab companies are available in those cities, and inquire directly with them. Many cities exempt taxis from car seat law, but that may not be an option you are willing to consider (I wouldn't). It means, though, that a lot of cab companies won't bother with the inconvenience.
There are also companies like Traveling Baby Company and Baby's Away that will deliver a carseat to the airport for you. They also supply travel cribs and other baby equipment. You can find alternatives to them by googling "car seat rental."
I have personally lugged a carseat on trips (pre-9/11), and it was a bit exhausting, but doable. I had a canvas duffel bag made to contain the carseat and protect it on the journey. You will obviously be charged for it, and there is a risk that it will be damaged and rendered useless in the luggage hold.
If you purchase a seat on the airplane for your child (usually a fraction of the price for children under 2), the airline may allow you to bring your car seat on board - you would need to consult the airline to confirm this. Some airlines do not allow rear-facing car seats, so be sure to ask that question.
If you decide to get a rental car instead of taxi, many rental car companies also rent car seats.
Comment: We've never been charged for car seats.  You just have to check them at the gate instead of with your other luggage.  You can also get bags designed to carry them, with both wheels and backpack straps.  Makes the trip through the airport much easier.


Customer order restrictions

Question: I want to restrict no of orders by customer to 99 per month and the total amount limit to $500 per month.
Answer: I suggest that you will need to create an extension with an observer that watches for the quote_totals, something like the following: http://www.blog.magepsycho.com/tag/event-observer/
This will need to check against your conditions and probably prompt the user in some way.
Another option would be to do it at the template and/or block level. Checking against the conditions there may be easier to implement, but would not be as future-proof.

Customer order restrictions


Photoelectric effect: current vs wavelength

Question: In an experiment where the type of metal,intensity of light and potential difference across a battery is kept constant at 2V the results show that an increase in wavelength, obviously in turn decreases the frequency, causes the current of the circuit to decrease (eventually to 0A).
what would be the direct cause for the current to become zero? i understand that with the increased wavelength there will be less energy supplied to the metal surface causing the emitted electrons to decrease but does this lack of energy cause the current to become zero?
Comment: What exactly do you mean my "the emitted electrons to decrease"?  Decrease in what sense or property?  For example you might be referring to the size of electrons or their mass ... I'm exaggerating to make the point ... but it would help if you could clarify what you mean.
Comment: @garyp he meant number of electrons
Comment: sorry, i meant the number of eletrons
Answer: The important part of this experiment should be that there's a relatively sharp cutoff.  "Classical" theory would say that the probility of electron ejection is proportional to the energy density, so a high-power long wavelength source would produce the same energy as a low-power, short wavelength source.  In fact, photons below a certain energy level cannot eject electrons at all.  This was one of the breakthrough experiments which showed that photons, or quantized packets of light energy, exist.
Answer: The photoelectric effect is usually explained in the following way: photons come in from some source and knock electrons out of the metal. These electrons then make up a current through the circuit.
When the photons do not have enough energy to knock out an electron, there will be no electrons to go around the circuit. This causes the current to go to zero.


Origin of 'diff' tool

Question: I can't seem to find any evidence that would place the origin of diff tool to the year 1972 (as stated on wikipedia). So where is any initial research paper on it, first release, source code?
Comment: Not sure if we're looking a the same Wikipedia, but the page states development on it happened in the early 70's and first shipped with Unix in 1974. Where is the 1972 coming from?
Comment: Sorry - my PDP-11 dies last week so I can't any longer retrieve any of it's original UNIX source files to verify their time stamps.
Comment: As @Giter says, Wikipedia doesn't seem to say 1972. Please clarify if this was a typo, or if you meant something else. BTW, wiki also links to a 1976 paper on the program, where the developer remarked "in two year we have had brought to our attention only one jackpost" which seems to match the timeline given.
Comment: What exactly are you challenging? I can assure you, from personal knowledge, that by summer 1981 the *diff* functionality was ubiquitous on both popular DEC operating systems: *UNIX* and *VAX/VMS*.
Comment: You might want to ask this over on StackOverflow or ServerFault, the former being more for coding/development questions.
Answer: The Unix Heritage Society shows that while diff's man page appeared in V6 (1975), its source code appeared in V5 (1974). The algorithm is described there as being "due to Harold Stone".

Origin of 'diff' tool


How did "that" get substituted for "who" or "whom" in common usage?

Question: I am curious at the ubiquitous use of "that"--rather than "who," or "whom"--when referring to a person.  Wondering how it happened that people became equated with objects.
    Some magazines still use "who" and "whom," but I have read "that" many times in print and almost always hear it used in everyday conversation.
Comment: Some examples, please!!
Comment: You can search "relative pronoun that" and read when it can replace who/whom/which and when it can't. Please include your own research when asking a question here. Good luck.
Comment: The point clearly stated in both title and question was to ask how "that" could reasonably be substituted for "who" or "whom" when referring to people, as opposed to things.
I thought JBright was very clearly asking specifically why anyone even accepted, let alone wanted to use "the man who came to dinner…". "The monster that came to dinner…" would show a correct use of "that"; "the man who came to dinner…" the correct term for a man.
How is any of the rest, bar AnderssonPublishing's support for JBright, relevant, please?
Answer: There is a fairly widespread analysis according to which "that" in restrictive relative clauses is not a relative pronoun, but is rather a clause introducer.  See, for instance McCawley The Syntactic Phenomena of English.  In this case, use of "that" rather than a wh-pronoun has nothing to do with somehow objectifying people.
Elsewhere, "that" introduces subordinate clauses -- in noun complements, such as "the fact that he disappeared", and in verb complements, such as "know that he disappeared".  And unlike a real relative pronoun, "that" in a relative clause always comes at the beginning of the clause -- compare "the book about which he talked" with *"the book about that he talked".
Answer: That  as a pronoun is an old usage that dates back to Old English:

Old English þæt, "that, so that, after that," neuter singular demonstrative pronoun ("A Man's a Man for a' that"), relative pronoun ("O thou that hearest prayer").....

From Proto-Germanic *that, from PIE *tod-, extended form of demonstrative pronominal base -to-.  With the breakdown of the grammatical gender system, it came to be used in Middle English and Modern English for all genders.

Etymonline
Answer: The that you refer to is apparently the that of relative clauses, which alternates with who/which

the man [that/who came to dinner] (either that or wh- is required for a subject pronoun)
the car [(that/which) he came in] (that and wh- are optional as non-subjects)

This that is not a demonstrative pronoun, and does not refer to a neuter noun; it's a complementizer that introduces a tensed subordinate clause, and it's used in English
also to mark subject and object complement clauses:

[That he has never seen that before] surprises her  (that is required for a subject clause)
I think [(that) he has never seen that before] (that is optional for non-subjects)

That used to appear even with tensed adverb clauses, and still does in some dialects, so that some people say

before that we set up the tent

instead of

before we set up the tent

So you don't need to worry so much about that. There's nothing wrong with that that.
Answer: I always fix this when I run across it in editing jobs. I'm with you, JBright, there is a difference and we should use precision in language. I don't think a horse is a who and I don't think a woman is a that.


Natural Scrolling in Lubuntu 17.04

Question: I've been trying to get natural scrolling running, but there is no option in the settings. I have looked at the parameters via synclient, and there is no option for natural scrolling there either, as in normal Ubuntu. Any ideas?
Answer: You can try this. Notice 6 and 7 are swapped.
NaturalScrolling:
echo "pointer = 1 2 3 5 4 7 6 8 9 10 11 12" > ~/.Xmodmap && xmodmap ~/.Xmodmap

Information from:
https://andym3.wordpress.com/2011/09/03/the-one-line-method-of-getting-natural-scrolling-in-linux/
Comment: Much easier than other answers and no restart required. Works on 16.04. +1
Comment: this solution works!!
Comment: works in lubuntu 18.04
Answer: As @Pilot6 suggested, make an edit to /usr/share/X11/xorg.conf.d/40-libinput.conf. But add to to BOTH the 'pointer' and 'touchpad' sections.
Find the 'pointer' section and add the "Natural Scrolling" option there.
Section "InputClass"
    Identifier "libinput pointer catchall"
    MatchIsPointer "on"
    MatchDevicePath "/dev/input/event*"
    Driver "libinput"
    Option "NaturalScrolling" "true"  # <-- add this line
EndSection

Do the same for the touchpad section:
Section "InputClass"
    Identifier "libinput touchpad catchall"
    MatchIsTouchpad "on"
    MatchDevicePath "/dev/input/event*"
    Driver "libinput"
    Option "NaturalScrolling" "true" # <-- add this line
EndSection

Save these changes, reboot, and natural scrolling should now work for you.
Comment: This is the right answer.
Answer: The listed solutions were only working for few applications on my Lenovo Z510. Add the following line to /usr/share/X11/xorg.conf.d/70-synaptics-conf under the first InputClass section:
Option "VertScrollDelta" "-90"

You can also test if this is working by executing the following command:
synclient VertScrollDelta=-90

However, the effect of the command vanishes after you log out. So it is preferable to edit the configuration file.
Source: https://diggle.tech/howto/2017/06/enable-natural-scroll-reverse-touchpad-on-lubuntu/
Answer: Run in a terminal
sudo -H gedit /usr/share/X11/xorg.conf.d/40-libinput.conf

and add
Option "NaturalScrolling" "true"

to the end of the touchpad section of the file (before EndSection).
In Ubuntu 17.04 libinput is used. It does not have GUI settings yet.
Comment: I had to add that 'Option "Natural Scrolling" "true" ' to the pointer section, in order for it to work. ( I actually ended up adding it to both the pointer and touchpad sections.)
Comment: Only adding it to the end of the touchpad section didn't work for me in Lubuntu 18.04
Answer: It is better to add a new configuration file for X11 libinput. The filename should start from maximum counter + 1 to be proceeded the last.
For example, I have a bunch of files with default configurations:
$ ls -l /usr/share/X11/xorg.conf.d/
-rw-r--r-- 1 root root   92 мар 20 15:02 10-amdgpu.conf
-rw-r--r-- 1 root root 1350 апр 13 18:31 10-quirks.conf
-rw-r--r-- 1 root root   92 мар 20 15:17 10-radeon.conf
-rw-r--r-- 1 root root  945 авг  1 11:28 40-libinput.conf
-rw-r--r-- 1 root root  590 мар  7  2017 51-synaptics-quirks.conf
-rw-r--r-- 1 root root 1751 мар  7  2017 70-synaptics.conf

So I added a new configuration file to the end of the list:
-rw-r--r-- 1 root root  113 авг  1 11:33 71-touchpad-scroll.conf

With the following content:
Section "InputClass"
        Identifier "touchpad catchall"
        Option "NaturalScrolling" "true"
EndSection

Answer: This worked for ubuntu 16.04 (If you have gnome desktop environment)
gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll true

Natural Scrolling in Lubuntu 17.04


Java TableLayout

Question: Im currently wanting to construct a table type of layout for JPanels. I found out there is a TableLayout for Java but I don't how to import it. On the other hand i found out there is a GridBagLayOut which also can construct a table like layout.But it seems more complicated. Any advice.
Comment: This doesn't strike me as specific enough to remain an open SO question ... to answer your question, persevere with `GridBagLayout` - it's not too complicated once you grok it.
Comment: Well I did some research on how to construct a table in java. And i came across TableLayout and GridBagLayout. TableLayout seems the way to go, but i couldnt really get it to work.
Comment: What's your question? GridBagLayout should do the job perfectly as far as I understand.
Answer: Here is an SSCCE of using a TableLayout, (Introduction to TableLayout)
<code>import javax.swing.JButton;
import javax.swing.JFrame;
import layout.TableLayout;

public class TestTableLayout {

    public static void main(String args[]) {

        JFrame frame = new JFrame("Example of TableLayout");
        frame.setSize(450, 450);

        double size[][] = {{10, 75, 75, 75, 75, 75, 10}, // Columns
            {10, 75, 75, 75, 75, 75, 10}}; // Rows

        frame.setLayout(new TableLayout(size));

        String label[] = {"(1,1)", "(1,5)", "(1,3)", "(5,3)", "(3,3)"};
        JButton button[] = new JButton[label.length];

        for (int i = 0; i < label.length; i++) {
            button[i] = new JButton(label[i]);
        }

        frame.add(button[0], "1, 1");
        frame.add(button[1], "1, 5");
        frame.add(button[2], "1, 3");
        frame.add(button[3], "5, 3");
        frame.add(button[4], "3, 3");

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
}
</code>

The required jar for the TableLayout can be downloaded from here

Also have a look at : A Visual Guide to Layout Managers ,In case.

In case you go for GridBagLayout, have a look at : How to Use GridBagLayout
Comment: Thank you very much for you time and effort. Really appreciate it. It helped me alot
Comment: Is it possible to customize alignment of objects in cells of this table layout (for example, center objects inside of cells)?

Java TableLayout


Can Windows XP be installed on a partition that starts at sector 64 (on Advanced Format 4k drives)?

Question: I could manually create 4k aligned partition (with linux tools, eg. live cd), that would start at LBA sector 64 (not at sector 63 as default in Windows XP installer).  I do not remember, but I guess that I've read somewhere that Windows XP won't boot unless the boot partition starts only at sector 63.  So, is this true?  Reference?
Comment: I have disassembled the boot sector from my XP that has been there since 2004, and it does have the assumed partition start sector hard-coded.
Answer: Answer: yes, Windows XP SP3 should boot if installed on partition that starts on sector other than 63.  For Windows XP SP2, there's a hotfix from Microsoft: http://support.microsoft.com/kb/931760.
At first I was thinking that the only way for Windows XP to deal with advanced format drives is through the hardware jumper on the drive itself (which virtually shifts all sectors to the aligned position).  But that's not true.  There are software utilities such as WD Align (or similar from other drive manufacturers) which, I make assumption, do the following:

physically relocate disk partitions with all data to new aligned location,
update partition table in MBR to reflect that new location.

So in that case (after partition relocation), Windows XP now sits in a partition that doesn't start at sector 63 anymore.  And it works.
Comment: That "WD Align" is based on Acronis Disk Director. Yes, it does that - and adjusts filesystem structures as well. It also only performs operations on WD Advanced Format drives.
Answer: There's a good article on advanced format drives on bit-tech. Windows XP does indeed start at sector 63, which cases problems for these drives. However, all this means is that if you don't take other steps, you'll pay a penalty when writing data.  Many advanced format drives (for example, the western digital drives) have a jumper to deal with this, by adding an offset to the sector mapping. Western digital also offers the WD Align software, which moves misaligned partitions around.  Anandtech covers this, and other aspects.
In summary, Advanced Format drives are a bit of a problem for operating systems as old as Windows XP, but there are some fairly straight-forward workarounds if you insist on using XP.
Comment: Doesn't answer the question, just a bunch of thoughts on the subject.
Answer: windows xp does not boot for me when installed on an aligned partition (i.e. one that does not start at 63).  It will recognise the partition install from cd to the bit where it says copying files but when it reboots to finish install will give an error.  similarly if i allow the xp cd to create the partition (starting at sector 63) it will install and work fine (but will not be aligned).  Then when I used the tool to align partitions from the Western Digital site it would no longer boot.  Waiting for a response from Western Digital but am not holding my breath.  I used a Windows XP (SP2 I think) CD.  SP3 may be different dunno.
Comment: You may need SP3. I use the Win 7 PE to partition and format discs, then install XP SP3 from an i386 folder on my Win 7 USB key. It works fine.


Emulate bidirectional scroll using hotkey + trackball

Question: I've built a custom keyboard with a trackball under my thumb and I want to map a scroll behavior in such way that when I press a shortcut (like left alt) and rotate the ball, it should behave like a scroll. I'm using Xorg here, but I'd be very interested in seing solutions for both X and Wayland (if the solution would involve display server).
Comment: As there are no answers: What exactly do you want to scroll? You can configure your window manager to scroll the virtual viewport, for example. If you want your trackball to emulate a mousewheel when used together with a key, you'll likely have to fiddle with some driver (either on the hardware level, or on the X resp. Wayland level). But as you built the keyboard yourself, maybe you are already using a custom driver.
Comment: I'm not using a custom driver. In fact the trackball is just embedded Logitech M570 trackball's ball into Kinesis Advantage. I want to use it as a scroll for all the content of my applications - like scrolling the code text area or pages in a web browser. I want it to behave just like mouse wheel when rotating vertical and like horizontal wheel when rotating horizontally. The idea is to have just one input device - keyboard with a trackball and being able to just scroll content using the ball while holding some modifier key. Is it clear now? :)
Answer: Emulate vertical and horizontal scrolling using libinput
The evdev driver from dirkt's answer only supports vertical scrolling emulation. If you (like me) also want to scroll horizontally, the libinput driver can be used to do that:

The details are in the manpage for libinput(4):

Option "ScrollButton" "int"
Designates a button as scroll button. If the ScrollMethod is button and the button is  logically  held  down, x/y axis movement is converted into scroll events.
Option "ScrollMethod" "string"
Enables  a scroll method. Permitted values are none, twofinger, edge, button.  Not all devices support all options, if an option is unsupported, the default scroll option for this device is used

For example:
Section "InputClass"
  Identifier "Some Trackball"
  # ... Stuff to match your trackball, see xorg.conf(5)
  Driver "libinput"
  Option "ScrollMethod" "button"
  Option "ScrollButton" "4" # Or whatever button suits your needs
EndSection

Comment: Try [this temporary with `xinput`](https://askubuntu.com/a/868173/349837).
Answer: Simulate mouse wheel with trackball
You can either use existing configuration options of drivers that do something similar to what you want, or write your own driver.
The Logitech M570 is a wireless trackball with an USB-receiver. That means it will show up as a  HID device, and mouse events will be made available via the input layer in the kernel, and can read from the corresponding /dev/event device.
The X driver in turn uses the evdev driver to read events from this layer, and turns them into X events. I'm not familiar with Wayland, but I assume it will work similarly there.
1) The evdev driver already contains options to emulate a mousewheel on a trackball, see man evdev. The most important ones are

Option "EmulateWheel" "boolean"
Enable/disable "wheel" emulation.  Wheel emulation means emulating button press/release events when the mouse is moved while  a specific real button is pressed.  Wheel button events (typically buttons 4 and 5) are usually used for scrolling. Wheel emulation is useful for getting wheel-like behaviour with trackballs.
Option "EmulateWheelButton" "integer"
Specifies which button must be held down to enable wheel emulation mode.  While this button is down, X and/or Y pointer movement will generate button press/release events as specified for the XAxisMapping and YAxisMapping settings. If the button is 0 and  EmulateWheel is on, any motion of the device is converted into wheel events. Default: 4.

So this works using a trackball button instead of keyboard shortcut (because the driver only sees events from the mouse, not from the keyboard), and will convert movement into wheel events, and not rotation.
2) Write your own driver by modifying several existing ones. You will need to combine the drivers for the keyboard and the mouse, so wheel emulation can be triggered by keypresses.
The source code for the kernel input layer is in drivers/input in the kernel tree.
The source code for the evdev X driver is in xorg/driver/xf86-input-evdev/tree/src/evdev.c.
The keyboard driver depends on what type of keyboard you used.


CoTURN Usage Statistics

Question: I am still a bit new to the WebRTC world and trying to find my way through. I have succcessfully set up CoTURN, and been able to route calls behind a firewall by using CoTURN. Now I am wondering if it is possible to somehow inspect and possibly visualize usage statistics of CoTURN? I would love to know how many users are utilizing the server at any given time, how much the bandwidth and CPU usage is etc.? I saw details on how to optimize bandwidth and CPU usage in the official docs, but I haven't found any info on actually monitoring the usage. Any help would be highly appreciated.
Comment: Is this question about programming? Maybe it would be better on a site like https://superuser.com/
Comment: Not about programming per se, however,  it seems that WebRTC has a much larger community on SO than on SuperUser (17k+ on SO vs 135 results on SU for the WebRTC keyword).
Answer: If you want to monitor standard usage statistics like CPU usage, load, bandwidth, etc., you can focus on what's available for your infrastructure. For example in AWS you could have CloudWatch, or in generic Linux deployments export the usage stats with Prometheus and have them presented with Grafana.
For the coturn/TURN specific statistics, then coturn allows to store some metrics in Redis; it's described in https://github.com/coturn/coturn/blob/master/turndb/schema.stats.redis
<code>Total traffic information is also reported when the allocation is deleted. The keys are
"turn/user/<username>/allocation/<id>/total_traffic" or "turn/user/<username>/allocation/<id>/total_traffic/peer".
Applications interested in the total amount of traffic per allocation can subscribe to these events as:

    psubscribe turn/realm/*/user/*/allocation/*/total_traffic
    psubscribe turn/realm/*/user/*/allocation/*/total_traffic/peer
</code>
Comment: Thanks, I'll have a look into the traffic information event.

CoTURN Usage Statistics


Project with multiple MapSeries - script to select specific series and range

Question: Currently working a project that contains 9 map series with over 22,000 pages total - split across datum and scale. Want to script a solution that allows us to export pages as individual PDFs by selecting a specific series and range - ultimately to allow us to have multiple PC's exporting maps at once.
All the examples on the ArcGIS Pro help appear to be referencing projects with a single Map Series so I'm a bit stuck how to approach. So far I've written a small script to check for the presence of the series and return the page count:
<code>    print("Layouts:")
    for lyt in aprx.listLayouts():
    print(lyt.name)
    ms = lyt.mapSeries
    if ms is None:
            print('\t'+"None available")
    else:
        if ms is not None:
            print('\t'+"Page count:",ms.pageCount)
</code>
I can export a PDF based off a selection on the index layer - however the problem I am finding is I don't know which map series the selection is operating on. Anyone have to suggestions to specify which map series? Would ideally prefer to go with ranges than selecting attributes (ie 1 - 500, 501 - 1000 etc)
<code>#make a selection based off index feature
if not lyt.mapSeries is None:
    ms = lyt.mapSeries
    if ms.enabled:
        ms = lyt.mapSeries
        indexLyr = ms.indexLayer
        arcpy.SelectLayerByAttribute_management(indexLyr, "NEW_SELECTION", "ZONE = '56'")
        ms.exportToPDF(Output + "\\TEST.pdf", "SELECTED")
</code>
Answer: A layout can only contain a single MapSeries object.
Consequently, to support multiple map series in a single project you will need to have multiple layouts (each with one map series enabled).
You can then use ListLayouts with an index to create Layout objects from them.


Low point density analysis

Question: I'm working on a project for a conservation plan. Part of the plan requires that areas added for conservation have less than one structure per five acres (these are pretty large, mostly undeveloped areas). I've done kernel density and and point density analyses before but always with many, many more points. In the past I've had problems if there are not enough points. Should I even be looking at density analysis options? Would Thiessen Polygons or a cost surface be a better option?
Answer: You could convert your points into a raster using the option count and perform a focal analysis on this raster. See ArcGis Help here and here. Choose a circular or square type corresponding to the size of 5 acres and use sum as statistic type. The result of this focal analysis will be a raster with the density of points per 5 acres.
Answer: I think that using point density would be fine (not Kernel). Use the buildings as input and set search radius to about 263.5 feet, which is the radius of a 5 acre circle (assuming you are using a circle-typed neighbourhood). Than if your units of choice are feet as well, than any value higher than 4.591e-06 will represnt an area (or a raster cell) in which density is higher than one building than 5 acers. You could use raster calculator to show only the areas that should be added to conservation, using the <= operator.
In a brief, point density tool counts the points within your serach radius defined neighbourhood (with no weights applied) and divide it by the neighbourhood area, namely 217800 squared feet. Hence the thershold mentioned above.
Comment: @whuber, you are right, in that case - if the territory is already divided to parcels that are un-changeable, it might be better to use spatial join between parcels and points to get the counts of all buildings within a parcel and divided by its area; yet no parcel feature is presented as available data in the question above. It is also worthwhile to check zonal statistics on the output of the method suggested above with parcel data, if available.
Comment: This actually converts the density criterion into a minimal distance criterion, which probably differs from what was intended.  For instance, if all buildings within a given parcel are clustered at one end, that very well might still qualify as having a sufficiently low density for the parcel--but not according to the calculation you propose.
Comment: Yes, that's an interesting point for the OP to clarify.  I think your proposed spatial join solution might very well be what was intended by the conservation plan.
Comment: @whuber, just added an edit for my comment, I stick with density analysis, and raster calculator to find "built" cells, than using zonal statistics as table (or just zonal) to count those cells and divide the built area by parcel area...
Comment: Yes, that's a good use of zonal stats. I believe one has to take some care to make sure that multiple buildings are assigned to distinct cells, though, for otherwise ArcGIS may undercount them.

Low point density analysis


How do I keep a summoned EnderDragon in a cage?

Question: I did /Summon in minecraft and I summoned an ender dragon. My friend and I thought it would be cool if we built a cage for the ender dragon. We build a huge cage out of end stone, obsidian and bedrock. We summoned the ender dragon in the cage, and it could fly right out of the cage. mobGriefing was off, and we used blocks that the ender dragon couldn't destroy. Is there any way we can keep him from flying out of a cage? The cage was definitely big enough for at least 3 ender dragons.
Answer: With the new summon command 1.7.4, you can summon a enderdragon on a minecart. Then it will still look to you but it can't fly away. You can also give it custom names. :-) Here is the command.... you can make these commands with the new summon program
Answer: As FEichinger explained, it's impossible keep an Ender Dragon in place using building blocks.
But you can continuously teleport the Dragon to the same location using a Command Block with the <code>/tp</code> command (since snapshot 14w02a it can work on any entities, not just players).

Use a clock to repeatedly execute the command:
/tp @e[type=EnderDragon] X Y Z
And the Ender Dragon will be stuck in that location, but will shake quite a bit because it will try to move constantly...

Of course, you can add a cage around the Dragon as a cosmetic feature...
Comment: Can you use a command block to apply the **slow** effect on a dragon to keep it in place?
Comment: This would be my best bet at doing it, but remember that the ender dragon CAN break command blocks. So make sure your TP circuit is a safe distance away. (but close enough that the same chunk is loaded)
Comment: That was a very good idea, @IQAndreas, but it seems like the Ender Dragon ignores the Slow effect.
Comment: Is a good idea that would work but the dragons movement may be too limited.
Comment: You might be able to use logic gates to trigger the command block to teleport the dragon when it reaches the boundary of it's cage
Comment: @Memor-X /tp @e[type=EnderDragon,x=X,y=Y,z=Z,rm=Sizeofcage] X Y Z
Answer: Any block the Ender Dragon cannot destroy, it will pass right through.
This can easily be tested in a superflat world in creative mode. Spawning a dragon and luring it through the Bedrock leads to these results:

As the screenshot shows, the Bedrock layer remains intact desipte the Dragon's attempts - And the dragon flies through it without a problem.
Conclusion: It is not possible to keep an Ender Dragon trapped in one location.
Comment: Seems like your conclusion is wrong. If one option doesn't work, that doesn't mean nothing will.
Answer: you could have a command block repeating this command
<code>/tp @e[type=EnderDragon,X,Y,Z,mr=minrange] x y z
</code>
The x y z would be the center of the cage, and the minrange = how big the cage is, so when ever the ender dragon went outside of the cage, it would be teleported back to the center
Answer: to get to stay in one place in 1.7.2+ do
/summon EnderDragon ~ ~ ~ {Riding:{id:"MinecartRideable",Tame:true}}
and the dragon will stay in one place


Tangent lines that pass through a point not on the graph.

Question: I have to find the tangent lines to the function
$$f(x)=(x+1)^{3/2}$$
that pass through the point $(4/3, 3)$. I found the derivative of the function
$$f'(x)=\frac{3\sqrt{x+1}}{2}$$
and know that that will be the slope of the two lines. I think I use the point-slope form to get the equation $f(x)-3=f'(x)(x-4/3)$. From here I try solving for $x$ and get absolutely nowhere.
Answer: A line passing through $\left(\frac 43,3\right)$ with slope $m$ has the following equation:$$y-3=m\left(x-\frac 43\right)$$
Now, if such a line passes through point $(x_1, y_1)$ on curve $f(x)=(x+1)^\frac 32$, it satisfies $$y_1^2=(x_1+1)^3,$$ and $$f'(x_1)=m=\frac{3\sqrt{x_1+1}}{2}.$$
You have unknowns $x_1,y_1, and\ m$. You also have three equations staisfied by the same. Can you now solve the problem?
Answer: At the point $\left(t,(t+1)^{\frac 32}\right),  \ f'(t)= \frac 32 \sqrt{t+1}$. The equation of the tangent to the curve at that point is
$y = \frac 32 \sqrt{t+1}(x - t) + (t+1)^{\frac 32}$.
Now let $x=\frac 43$and $y=3$. Then solve for $t$. You should get two nice integers for answers.
\begin{align}
   \frac 32 \sqrt{t+1}\left(\frac 43 - t \right) + (t+1)^{\frac 32} &= 3\\
   \sqrt{t+1}(4-3t) + 2(t+1)^{\frac 32} &= 6 \\
   (4-3t) + 2(t+1) &= \frac{6}{\sqrt{t+1}} \\
   6-t &= \frac{6}{\sqrt{t+1}} \\
   etc
\end{align}
Comment: Thanks bud. Big help.


Autobiography vs Perspective

Question: When discussing the life story (fictional/non-fictional) of an inanimate object (like a brick not AI), is it appropriate to claim this endeavor as an autobiography of an inanimate object, when it seems like a first-person perspective of the same?
Comment: "Appropriate" from what perspective? What is the context? What are you trying to accomplish by doing so? What kind of inanimate object? (I imagine the answer might be different for an artificial general intelligence than for, say, a TV.) Please [Edit] your question to add some more information.
Answer: You can claim it is anything you want; you are writing a fantasy about an inanimate object that can cogitate, observe its surroundings, etc.
I would consider it no different than a first-person tale of a ghost that cannot have any effect on the material world; let's say it can only think logically, feel emotions, discover new knowledge; and relate it's mental state in words on the page, but it cannot do a thing about any of that, it cannot take any action.
So, like the typical third-person narrator of a book, the ghost can relate the story of things going on around it, but can take no action to affect the course of any action. (putting aside telekinetic ghosts).
In effect you are granting intelligence and emotions to a brick, or a teapot, or a wedding ring passed down through generations, and it (in first-person) relates the stories of the people it has seen, from its own perspective. It is like an invisible spy camera, a receiver only.
I could see how that could be an effective story, an object (like a teapot) has a finite life that can be much longer than a human's, and it is also an interesting restriction to place on the narrator, the teapot may be moved about but always must be within "earshot" of the events it relates.
It would make sense to call such a story an autobiography of the object. It doesn't explain how the autobiography was ever told, but it is also never explained in millions of books how a third-person narrator knows everything that happened in a book! So it doesn't have to make any literal sense. Call it an autobiography.
Answer: You have two choices here.
If the object is truly inanimate and there are no surprises, then you are writing a history of the object.
If the object is anthropomorphized (think Disney talking teacups), you can call it a biography.  If you are writing in first person from the point of view of the object, then it is an autobiography.
Outside this dichotomy, you have stylistic choices.  There is a famous short story (I can't remember the name and it's not coming up on searches, if you know it, please edit it in) about a piano slowly decaying after being left on a beach by migrants who couldn't carry it to their home (not related to the movie The Piano).
While the piano here never does anything a piano in the real world couldn't do, we feel for it as if it was alive.  The author's haunting narrative turns this inanimate object into a character.  The main character.  In this case, you might be able to say biography vs just history.

Autobiography vs Perspective


How to soft boil an egg

Question: Is there a fool proof way to make sure the white of the egg is set but either all or some of the yolk remains runny?
Answer: Very few people have tried a perfectly cooked soft boiled egg.  There is a tradition among chefs of trying to show each other how perfectly they can cook something as simple as an egg.  Chef Fernand Point, who serves as inspiration for the affable chef Gusteau in Pixar's animated movie Ratatouille, would test his apprentices by asking them to fry an egg.  With a responsive thermometer, such an infrared one, you can approximate their work at home.
If you ever get that mad scientist feeling, try cooking the egg in a bowl of water placed in the oven.  Start with cold tap water in the bowl, place the eggs in the water and the ensemble in an oven set to its lowest setting.  Every five minutes, check the temperature of the water in the bowl.  If you are using an infrared thermometer, stir the water before measuring.   Let the water hover between 65°C to 68°C for an hour. In most ovens you will have to turn the oven off and on to keep the water in that range.  The result will be a bright yellow firm gel.  I have a picture of the gel for the fried version of the mad scientist egg (what I call Eggs Mondrian):

If you want the yolk runny, then the temperature of the water should be between 63°C (to cook the whites) but below 66°C to keep the yolk runny.
Comment: There's a great chart that shows the changes to an egg in order of degrees from CookingIssues. http://www.cookingissues.com/wp-content/uploads/2010/02/eggchart2.jpg
Comment: brilliant, I've got various kitchen thermometers so I'm going to try and experiment get my egg to just under 66, thanks
Comment: Heston Blumenthal has just written an article on this subject: http://www.theguardian.com/lifeandstyle/2014/nov/11/how-to-boil-an-egg-the-heston-blumenthal-way
Answer: Read this article for complete scientific explanation of the process: Towards the perfect soft boiled egg
The most important part is this formula:

which with boiling water (100C) and a refrigerated egg (4C) results in these plots:

so depending on exactly how soft you want your egg and how large it is, you might want a cooking time anywhere from 4 to 6 minutes.
Answer: Cook the egg in already boiling water for 4 minutes and remove. Hack off (more like tap) the top of the shell with your spoon, add some sea salt, and dunk in slender pieces of toast until you have consumed all of the egg deliciousness. If the egg is cold from the fridge, put it in the pan with the water as you bring to a boil; if the egg is room temperature (better), drop it into the already boiling water.
Answer: Like you, I love a runny yolk and hate a white that isn't set! I've been experimenting with the soft-boiled egg a few mornings per week for the past couple of years, and have discovered the following:

I like a 5-minute egg; the 4-minute egg is, by my lights, underdone and icky.
Barometric pressure does have an impact on how fast water boils and how quickly it boils away!
"Soft-boiled" eggs should actually be called "simmered eggs," because you DON'T want a hard, full-rolling boil.

To make a perfect soft-boiled egg:

Remove your egg/s from the fridge and set them on the counter.
Bring salted water to a boil.
Put the egg/s into the boiling water.
Boil gently for exactly 5 minutes, no more, no less.
Plunge into cold water for about 5 seconds.
Eat immediately!
Answer: I get ideal results from putting the eggs in boiling water and then turning off the heat. Start the timer.
I find 6-8 minutes is perfect, while up to 10 can produce good results.  Once the time is up, pour out the hot water and replace with cold water.  This helps both peeling, and to slow down the carry-over.  The whites are solid but not rubbery, and the longer time benefits a creamy, orange center.  It takes longer, but the results are really tasty.
Note: use enough water in a big enough pot so that the number of eggs doesn't overly change the water temperature, otherwise the timing will vary.
Answer: You can buy an egg boiler for cooking the eggs. Example:
Comment: What if he wants to *make* an egg boiler?
Comment: I can confirm that there are egg cookers that can do this. (They usually actually steam the eggs, but hey...)
Comment: I couldn't tell if the question form was rhetoric or a new question, but decided to make it a statement instead of deleting it. Hopefully somebody will be able to confirm or refute the idea that an egg boiler can do this.

How to soft boil an egg


I'm new to Coinbase and was wondering how to buy and sell on it, and what the buying and selling means for me? Please and thank you

Question: I'm new to Coinbase and my balance is zero, what does buying and selling mean for me, and how should I do it?
Comment: Hi there. I'd suggest reading their support pages: https://support.coinbase.com/. There's a section on buying and selling. What it means for you will depend on where you live, and what regulations Coinbase has to adhere to in your country. I'm going to suggest your question be flagged as off-topic as it's more about a third-party service than Ethereum itself.
Answer: Coinbase lets you buy and sell Ethereum using USD. You can hook up your bank account and then purchase the amount of Ether that you'd like using your bank account.
After you make your purchase and receive the Ether, you can tap Sell to sell off your Ether at the market price back to USD.


Is there a reason vectors in space are represented as column vectors (in that nothing works with row vectors)?

Question: As opposed to row vectors? It would seem that whenever performing operations on vectors in space (applying a matrix/linear transformation to it, for example) does not work unless the vector is in it's column form (since lots of things, such as matrix multiplication, are dependent on dimensionality). Why is it that things work with column vectors but not row vectors?
Comment: If you write vectors as rows, then applying a linear transformation is achieved by multiplying by a matrix on the right: $y=xA$.
Comment: Things do work just as well with row vectors.
Comment: Any asymmetry encountered in mathematics is due to human intervention and convention.
Comment: In some areas row vectors are used; for instance, fairly commonly, in error correcting codes.
Comment: Row vectors and right-multiplication by transformation matrices is a common convention in computer graphics.
Comment: Both of them work. Just the column one is easy to use as in notations.
Comment: @John Strongly disagree. What about nonabelian groups, which are fundamentally asymmetric?
Comment: Who defined them? And while you are looking that up, why must the fundamental theorem of calculus be proved so many times? Perhaps the proofs are not good?And are the Real Numbers real?
Comment: @MattSamuel I think that John means you could write all the products in the other order.
Comment: @John They're so basic that you might as well say mathematics only exists because of human intervention.
Comment: Getting warmer. Yes, are we discovering? Or are we prevaricating?
Answer: It seems that you consider the vector space $K^m$ of all $m$-tuples1 $\mathbf x = (x_1,\dots, x_m)$ with coordinates $x_i$ in a field $K$, for example $K  = \mathbb R$.
One can very well argue that it is just a notational issue (i.e. a mere convention) how to write the elements  $\mathbf x \in K^m$. The only requirement is that we can uniquely identify the coordinates of each vector. Expressed more formally, the chosen notation must come along with well-defined coordinate projections $p^m_i : K^m \to K$.
Some standard representation variants are

Tupel: $\mathbf x = (x_1,x_2,\dots, x_m)$
Row vector: $\mathbf x = (x_1 \quad x_2 \quad \dots \quad x_m)$
Column vector: $\left(\begin{array}{c}x_1\\x_2\\\vdots\\x_m\end{array}\right)$

The difference between tupel and row vector representation seems perhaps to be somewhat artifical since we only changed the separating character between the elements $x_i$ (comma / blank space), but we should be aware that in both row and column vector representation $\mathbf x$ is written as a matrix2.
As long as we only consider vectors in $K^m$, the choice of a representation is  absolutely irrelevant. We can add vectors and take scalar multiples in the obvoius way. However, the concrete representation variant becomes important if we consider linear maps $f : K^m \to K^n$. The point is that such a linear map is usually expressed in form of a matrix obtained by assembling the images $f(\mathbf e^m_i) \in K^n$ of the standard basis vectors3 $\mathbf e^m_i \in K^m$. This can be done based on row and on column vector representation.

In row vector representation: The $m$ row vectors $f(\mathbf e^m_1),\dots,f(\mathbf e^m_m)$ are written one below the other which gives a matrix $\mathbf M_{row}(f) \in K(m,n)$.
In column vector representation: The $m$ column vectors $f(\mathbf e^m_1),\dots,f(\mathbf e^m_m)$ are written next to each other from left to right which gives a matrix $\mathbf M_{col}(f) \in K(n,m)$.

Clearly these matrices are transposed, i.e. $(\mathbf M_{row}(f))^T = \mathbf M_{col}(f)$. It is well-known that the image vectors $f(\mathbf x)$ can now be computed via matrix multiplication 4. We have

In row vector representation:
\begin{equation}
f(\mathbf x) = \mathbf x \cdot \mathbf M_{row}(f) . \tag{1}
\end{equation}
In column vector representation5:
\begin{equation}
f(\mathbf x) = \mathbf M_{col}(f) \cdot \mathbf x .  \tag{2}
\end{equation}

These two equations explain why the column vector form is the most popular variant when working with matrix representations of vectors and linear maps: In $(2)$ the vector $\mathbf x$ occurs right of the operator on both sides of the equation, in $(1)$ the order is reversed.
To distinguish visibly between $\mathbf x \in K^m$ and its notational variants in row and column vector representation I suggest to write $\mathbf x_{row} \in K(1,m)$ and  $\mathbf x_{col} \in K(m,1)$. Doing so we get the two unambiguous formulas
\begin{equation}
f(\mathbf x)_{row} = \mathbf x_{row} \cdot \mathbf M_{row}(f) \tag{3}.
\end{equation}
\begin{equation}
f(\mathbf x)_{col} = \mathbf M_{col}(f) \cdot \mathbf x_{col} . \tag{4}
\end{equation}
Note that $\mathbf x_{row}^T = \mathbf x_{col}$.
Whatever our preference is, we have to make a fundamental choice either for the row or the column vector form.  This representation convention must then be strictly applied to all vectors of $K^m$ and all linear maps $f : K^m  \to K^n$; we never decide case-by-case.
To emphasize it, both possible representation conventions work perfectly.
In the sequel we  focus on the column vector representation and simply write $\mathbf M(f) = \mathbf M_{col}(f)$. The column vectors of $\mathbf M(f)$ are the images $f(\mathbf e^m_i)$ of the standard basis vectors of $K^m$, i.e. are regarded as ordinary vectors in $K^n$. What about the row vectors $(\mathbf M(f))_{(i)}\in K(1,m)$ of $\mathbf M(f)$? Clearly $(\mathbf M(f))_{(i)}$ is the matrix representation of the $i$-th coordinate function $f_i = p^m_i \circ f : K^m \to K$. Therefore the row vectors must not be regarded as ordinary vectors of $K^m$ written in row vector form, but as matrix representations of linear funtionals on $K^m$. Note that these are elements of the dual space $(K^m)^*$ of $K^m$. Thus our representation convention gives a simple rule of thumb:

Column vectors stand for the elements of some $K^n$.
$n \times m$ matrices stand for linear maps $K^m \to K^n$.
Row vectors stand for linear functionals on some $K^m$.

This seems to be very clear, but indeed we get two different, not to say inconsistent, interpretations of column vectors: On the one hand they stand for elements of $K^n$, on the other hand for linear maps $K \to K^n$. The correspondence between elements of $K^n$ and linear maps $K \to K^n$ is obvious: $\mathbf x \in K^n$ is identified with the linear map $f_{\mathbf x} : K \to K^n, f_{\mathbf x}(a) = a\mathbf x$. In fact, $\mathbf M({f_{\mathbf x}}) = f_{\mathbf x}(e^1_1) = f_{\mathbf x}(1) = \mathbf x$ in column vector representation.
So we have a "hybrid interpretation" of column vectors (and analogically of row vectors if we decide to adopt column vector representation). We must therefore admit that our above three vector representation variants are not only notational issues of complete arbitrariness; it requires a context-related explanation what a row or column vector stands for.

Footnotes

Formally we can use the definition $K^m =$ set of all functions $\mathbf x : \{1,\dots,m\} \to K$. Then $x_i =  \mathbf x(i)$.

The vector space of $p \times q$ matrices with entries in $K$ is denoeted by $K(p,q)$. Formally we can use the definition $K(p,q) =$ set of all functions $\mathbf A : \{1,\dots,p\} \times \{1,\dots,q\} \to K$. With $a_{ij} = \mathbf A(i,j)$ one usually writes $\mathbf A = (a_{ij})$. The $i$-th row of $\mathbf A$ will be denoted by $\mathbf A_{(i)} \in K(1,q)$ (lower index) and the $j$-th column by $\mathbf A^{(j)} \in K(p,1)$ (upper index).

The standard ordered basis of $K^m$ is the $m$-tupel of vectors $\mathcal E^m = (\mathbf e^m_1,\dots, \mathbf e^m_m)$ with $\mathbf e^m_i = (\delta_{i1},\dots,\delta_{im}) \in K^m$, where $\delta_{ij} = 1$ for $i = j$ and $\delta_{ij} = 0$ for $i \ne j$. For $\mathbf x \in K^m$ with coordinates $x_i$ we have $\mathbf x = \sum_{i=1}^m x_i \mathbf e^m_i$.

Let us recall how matrix multiplication $\mu : K(p,q) \times K(q,r) \to K(p,r)$ works. First observe that for a row vector $\mathbf v \in K(1,q)$ with coordinates $v_j$ and a column vector $\mathbf w \in K(q,1)$ with coordinates $w_j$ we take $\mathbf v \cdot \mathbf w = \sum_{j=1}^q v_jw_j \in K$. Now let $\mathbf A = (a_{ij}) \in K(p,q)$ and $\mathbf B = (b_{jk}) \in K(p,q)$. Then $\mathbf A$ consists of $p$ row vectors  $\mathbf A_{(i)} \in K(1,q)$ and $\mathbf B$ consists of $r$ column vectors $\mathbf B_{(k)} \in K(q,1)$. The matrix $\mathbf C = \mathbf A \cdot \mathbf B$ has then the entry $\mathbf A_{(i)} \cdot \mathbf B^{(k)}$ at position $(i,k)$. Thus we get the well-known representation $\mathbf C = (c_{ik})$ with $c_{ik} = \sum_{j=1}^q a_{ij}b_{jk}$. Clearly, the $i$-th row of $\mathbf A \cdot \mathbf B$ is $\mathbf A_{(i)} \cdot \mathbf B$ and the $k$-th column is $\mathbf A \cdot \mathbf B^{(k)}$. Moreover, for a row vector $\mathbf a \in K(1,q)$ with coordinates $a_j$ we get $\mathbf a \cdot \mathbf B = \sum_{j=1}^q a_j \mathbf B_{(j)}$ and for a column vector $\mathbf b \in K(q,1)$ with coordinates $b_j$ we get $\mathbf A \cdot \mathbf b = \sum_{j=1}^q b_j \mathbf A^{(j)}$

We have $\mathbf M_{col}(f) \cdot \mathbf x = \sum_{j=1}^m x_j (\mathbf M_{col}(f))^{(j)} = \sum_{j=1}^m x_j f(\mathbf e^m_j) = f(\sum_{j=1}^m x_j \mathbf e^m_j) = f(\mathbf x).$ Formula $(1)$ is obtained similarly.


Editting Attribute properties in QGIS

Question: I am trying to edit the precision of my area attribute in QGIS 2.0. It is currently at 0 but I want to change it to 3. I have not been able to find the answer to this anywhere. Is there a way to edit the properties of an attribute, or do I need to create a new column and plug the data into the new column.
Answer: I am unsure of a way to do this.  I do not believe you would get the output you are looking for, as the precision (decimal) information would not be stored along with the integer based attributes.  I would add a new column and recalculate the area in the field calculator using the following: $area
Answer: According to this discussion in QGIS User mailing list, there is no direct way to edit columns type, size or precision in QGIS (because most providers won't allow it anyway).
As you said the solution will be to use field calculator to create a new field with the right precision with the values from the old field (this won't help you much in your specific scenario) or even recalculating the area.
If necessary, you can use the table manager plugin, to delete the old column, and sort the columns so that the new one occupies the "place" of the old one,

Editting Attribute properties in QGIS


What is the difference between ++i and i++?

Question: In C, what is the difference between using ++i and i++, and which should be used in the incrementation block of a for loop?
Comment: Not sure the original poster is interested, but in C++ the difference in performance can be substantial, since the creation of the temporary object might be expensive for a user defined type.
Answer:
++i will increment the value of i, and then return the incremented value.
 i = 1;
 j = ++i;
 (i is 2, j is 2)

i++ will increment the value of i, but return the original value that i held before being incremented.
 i = 1;
 j = i++;
 (i is 2, j is 1)

For a for loop, either works. ++i seems more common, perhaps because that is what is used in K&R.
In any case, follow the guideline "prefer ++i over i++" and you won't go wrong.
There's a couple of comments regarding the efficiency of ++i and i++. In any non-student-project compiler, there will be no performance difference.  You can verify this by looking at the generated code, which will be identical.
The efficiency question is interesting... here's my attempt at an answer:
Is there a performance difference between i++ and ++i in C?
As @OnFreund notes, it's different for a C++ object, since operator++() is a function and the compiler can't know to optimize away the creation of a temporary object to hold the intermediate value.
Comment: jonnyflash, both will operate identically, since the increment of i and the print are in different statements.  This should be the case for any language that supports C-style ++.  The only difference between ++i and i++ will be when using the value of the operation in the same statement.
Comment: Since in most cases they produce identical code, I prefer `i++` because it's of the form "operand-operator", a la an assignment "operand-operator-value". In other words, the target operand is on the left side of the expression, just like it is in an assignment statement.
Comment: Won't this effect weather the loop runs once more upon reaching the end condition?  For example,  `for(int i=0; i<10; i++){ print i; }`  won't this be different than `for(int i=0; i<10; ++i){ print i; }`  My understanding is that some languages will give you different results depending upon which you use.
Comment: @MarkHarrison, it will operate identically not because `i++` and `print i` are in different statements, but because `i++;` and `i<10` are. @jonnyflash's remark is not that off base. Suppose you have `for(int i=0; i++<10){ print i; }` and `for(int i=0; ++i<10){ print i; }`. These will operate differently in the way which @johnnyflash described in the first comment.
Comment: @sam, because in a typical for loop there is no side effect (for example, assignment) in the ++i part.
Comment: no, since the print and increment are in different statements, the increment can be either ++i or i++.  If instead you had print ++i and print i++ the results would be different.
Comment: ++i means increment the value and then use. i++ means use the value and then increment it.
Comment: @ARUN `i++` means increment the value, and eval as the value *prior* to increment. It is the eval result itself, not when the increment happens, that differs. The pre-increment eval result is after the increment, the post-increment eval result is before the increment, but no matter what the increment happens before the eval result is made *available*. [See live example](http://ideone.com/YnmDPF) demonstrating as much.
Comment: "Prefer ++i over i++ in for loops"
This is contradictory to every modern style-guide I have ever seen.
Comment: So if you incremented within the loop instead of in the compound for statement it would make a difference, right?  Such as `for(int i=0; i<10){ print i; ++i;`
Comment: I had a doubt on this answer, and have posted a question. I think as the discussion is going on about this answer, you should check it and post what you actually meant: http://stackoverflow.com/questions/35643963/in-any-case-follow-the-guideline-prefer-i-over-i-and-you-wont-go-wrong. Even though it is marked as a dupe, many people are voting to reopen it, with currently 3 reopen votes. I don't think it is a dupe, and it would be helpful if you could clear  my doubt.
Comment: I mostly use --i and i-- in a do..while loop. In the first case 0 will not be evaluated inside the loop while in the second case it will.
Comment: Won't this effect weather a while loops?  Some languages definitely handle these differently, I was taught the practice of using C++ Style ++ trailing was the consistent method in college but that was 20 years ago... is properly accounting for the iteration of the loop?  `J=100; I=1;While (J*++I <=500){Print Do something for Five iterations!  Currently I = I }; Print Oh Good!  Clearly the result I need is I ?`
Comment: The easiest way to remember `++i` from `i++` is the position of the `++`. One reads "Add then use" while the other reads "Use then add".
Answer: i++ is known as post increment whereas ++i is called pre increment.
i++
i++ is post increment because it increments i's value by 1 after the operation is over.
Let's see the following example:
int i = 1, j;
j = i++;

Here value of j = 1, but i = 2. Here the value of i will be assigned to j first, and then i will be incremented.
++i
++i is pre increment because it increments i's value by 1 before the operation.
It means j = i; will execute after i++.
Let's see the following example:
int i = 1, j;
j = ++i;

Here the value of j = 2 but i = 2. Here the value of i will be assigned to j after the i incremention of i.
Similarly, ++i will be executed before j=i;.
For your question  which should be used in the incrementation block of a for loop? the answer is, you can use any one... It doesn't matter. It will execute your for loop same number of times.
for(i=0; i<5; i++)
   printf("%d ", i);

And
for(i=0; i<5; ++i)
   printf("%d ", i);

Both the loops will produce the same output. I.e., 0 1 2 3 4.
It only matters where you are using it.
for(i = 0; i<5;)
    printf("%d ", ++i);

In this case output will be 1 2 3 4 5.
Answer: i++: In this scenario first the value is assigned and then increment happens.
++i: In this scenario first the increment is done and then value is assigned
Below is the image visualization and also here is a nice practical video which demonstrates the same.
Comment: How can you increment somewhat not assigned?
Comment: @kouty You can increment a register not assigned to a variable.
Comment: You can increment the number without assigning it initially. For instance let i = 0, nums[++i].
Answer: ++i increments the value, then returns it.
i++ returns the value, and then increments it.
It's a subtle difference.
For a for loop, use ++i, as it's slightly faster. i++ will create an extra copy that just gets thrown away.
Comment: I am not aware of any compiler where it does make a difference for integers at least.
Comment: It is **not faster**. The values are ignored (only the side effect is effective) and the compiler can/will generate exactly the same code.
Answer: Please don't worry about the "efficiency" (speed, really) of which one is faster.  We have compilers these days that take care of these things.  Use whichever one makes sense to use, based on which more clearly shows your intent.
Comment: which, I would hope, means '_use prefix (inc|dec)rement unless you actually need the old value prior to the (inc|dec), which very few people do, and yet which a bewildering proportion of supposed teaching materials use, creating a cargo cult of postfix users who don't even know what it is_'..!
Comment: I'm not sure that "compilers these days ... take care of these things" is universally true. Within a custom `operator++(int)` (the postfix version) the code pretty much has to create a temporary which will be returned. Are you sure that compilers can always optimize that away?
Comment: Premature optimization is evil if it adds complexity. However, being curious about which one is faster and using it doesn't add complexity. It's curiosity about the language, and it should be rewarded. It also feels conceptually cleaner to say "Add one and use it" than "Save it somewhere else, add one, and return that saved one". `++i` is more desirable potentially in speed and in style. Additionally, a C student doing C++ might like that was taught to him if he wrote `i++` on a complex type that can't be removed by the compiler.
Answer: The only difference is the order of operations between the increment of the variable and the value the operator returns.
This code and its output explains the the difference:
#include<stdio.h>

int main(int argc, char* argv[])
{
  unsigned int i=0, a;
  printf("i initial value: %d; ", i);
  a = i++;
  printf("value returned by i++: %d, i after: %d\n", a, i);
  i=0;
  printf("i initial value: %d; ", i);
  a = ++i;
  printf(" value returned by ++i: %d, i after: %d\n",a, i);
}

The output is:
i initial value: 0; value returned by i++: 0, i after: 1
i initial value: 0;  value returned by ++i: 1, i after: 1

So basically ++i returns the value after it is incremented, while i++ return the value before it is incremented. At the end, in both cases the i will have its value incremented.
Another example:
#include<stdio.h>

int main ()
  int i=0;
  int a = i++*2;
  printf("i=0, i++*2=%d\n", a);
  i=0;
  a = ++i * 2;
  printf("i=0, ++i*2=%d\n", a);
  i=0;
  a = (++i) * 2;
  printf("i=0, (++i)*2=%d\n", a);
  i=0;
  a = (i++) * 2;
  printf("i=0, (i++)*2=%d\n", a);
  return 0;
}

Output:
i=0, i++*2=0
i=0, ++i*2=2
i=0, (++i)*2=2
i=0, (i++)*2=0

Many times there is no difference
Differences are clear when the returned value is assigned to another variable or when the increment is performed in concatenation with other operations where operations precedence is applied (i++*2 is different from ++i*2, as well as (i++)*2 and (++i)*2) in many cases they are interchangeable. A classical example is the for loop syntax:
for(int i=0; i<10; i++)

has the same effect of
for(int i=0; i<10; ++i)

Efficiency
Pre-increment is always at least as efficient as post-increment: in fact post-increment usually involves keeping a copy of the previous value around and might add a little extra code.
As others have suggested, due to compiler optimisations many times they are equally efficient, probably a for loop lies within these cases.
Rule to remember
To not make any confusion between the two operators I adopted this rule:
Associate the position of the operator ++ with respect to the variable i to the order of the ++ operation with respect to the assignment
Said in other words:

++ before i means incrementation must be carried out before assignment;
++ after i means incrementation must be carried out after assignment:
Comment: '(i++)*2 and (++i)*2 returns the same value' sure???
Comment: 2. example output also needs to fixed
Comment: @YusufR.Karagöz you are absolutely right, thanks for pointing that out
Answer: The reason ++i can be slightly faster than i++ is that i++ can require a local copy of the value of i before it gets incremented, while ++i never does. In some cases, some compilers will optimize it away if possible... but it's not always possible, and not all compilers do this.
I try not to rely too much on compilers optimizations, so I'd follow Ryan Fox's advice: when I can use both, I use ++i.
Comment: -1 for C++ answer to C question. There is no more "local copy" of the value of `i` than there is of the value 1 when you write a statement `1;`.
Answer: The effective result of using either in a loop is identical.  In other words, the loop will do the same exact thing in both instances.
In terms of efficiency, there could be a penalty involved with choosing i++ over ++i.  In terms of the language spec, using the post-increment operator should create an extra copy of the value on which the operator is acting.  This could be a source of extra operations.
However, you should consider two main problems with the preceding logic.

Modern compilers are great.  All good compilers are smart enough to realize that it is seeing an integer increment in a for-loop, and it will optimize both methods to the same efficient code.  If using post-increment over pre-increment actually causes your program to have a slower running time, then you are using a terrible compiler.
In terms of operational time-complexity, the two methods (even if a copy is actually being performed) are equivalent.  The number of instructions being performed inside of the loop should dominate the number of operations in the increment operation significantly.  Therefore, in any loop of significant size, the penalty of the increment method will be massively overshadowed by the execution of the loop body.  In other words, you are much better off worrying about optimizing the code in the loop rather than the increment.

In my opinion, the whole issue simply boils down to a style preference.  If you think pre-increment is more readable, then use it.  Personally, I prefer the post-incrment, but that is probably because it was what I was taught before I knew anything about optimization.
This is a quintessential example of premature optimization, and issues like this have the potential to distract us from serious issues in design.  It is still a good question to ask, however, because there is no uniformity in usage or consensus in "best practice."
Answer: ++i: is pre-increment the other is post-increment.
i++: gets the element and then increments it.
++i: increments i and then returns the element.
Example:
int i = 0;
printf("i: %d\n", i);
printf("i++: %d\n", i++);
printf("++i: %d\n", ++i);

Output:
i: 0
i++: 0
++i: 2

Answer: ++i (Prefix operation): Increments and then assigns the value
(eg): int i = 5, int b = ++i
       In this case, 6 is assigned to b first and then increments to 7 and so on.
i++ (Postfix operation): Assigns and then increments the value
(eg): int i = 5, int b = i++
       In this case, 5 is assigned to b first and then increments to 6 and so on.
Incase of for loop: i++ is mostly used because, normally we use the starting value of i before incrementing in for loop. But depending on your program logic it may vary.
Comment: Last statement seems wrong, ++i  and i++ work the same way in a for loop, but your sentence suggests otherwise.
Answer: i++ and ++i
This little code may help to visualize the difference from a different angle than the already posted answers:
int i = 10, j = 10;

printf ("i is %i \n", i);
printf ("i++ is %i \n", i++);
printf ("i is %i \n\n", i);

printf ("j is %i \n", j);
printf ("++j is %i \n", ++j);
printf ("j is %i \n", j);

The outcome is:
//Remember that the values are i = 10, and j = 10

i is 10
i++ is 10     //Assigns (print out), then increments
i is 11

j is 10
++j is 11    //Increments, then assigns (print out)
j is 11

Pay attention to the before and after situations.
for loop
As for which one of them should be used in an incrementation block of a for loop, I think that the best we can do to make a decision is use a good example:
int i, j;

for (i = 0; i <= 3; i++)
    printf (" > iteration #%i", i);

printf ("\n");

for (j = 0; j <= 3; ++j)
    printf (" > iteration #%i", j);

The outcome is:
> iteration #0 > iteration #1 > iteration #2 > iteration #3
> iteration #0 > iteration #1 > iteration #2 > iteration #3

I don't know about you, but I don't see any difference in its usage, at least in a for loop.
Answer: The following C code fragment illustrates the difference between the pre and post increment and decrement operators:
int  i;
int  j;

Increment operators:
i = 1;
j = ++i;    // i is now 2, j is also 2
j = i++;    // i is now 3, j is 2

Answer: Shortly:
++i and i++ works same if you are not writing them in a function. If you use something like function(i++) or function(++i) you can see the difference.
function(++i) says first increment i by 1, after that put this i into the function with new value.
function(i++) says put first i into the function after that increment i by 1.
int i=4;
printf("%d\n",pow(++i,2));//it prints 25 and i is 5 now
i=4;
printf("%d",pow(i++,2));//it prints 16 i is 5 now

Comment: The difference is not really tied to function calls (and you can spot the difference without making function calls).  There's a difference between `int j = ++i;` and `int k = i++;` even when there's no function call involved.
Answer: Pre-crement means increment on the same line. Post-increment means increment after the line executes.
int j = 0;
System.out.println(j); // 0
System.out.println(j++); // 0. post-increment. It means after this line executes j increments.

int k = 0;
System.out.println(k); // 0
System.out.println(++k); // 1. pre increment. It means it increments first and then the line executes

When it comes with OR, AND operators, it becomes more interesting.
int m = 0;
if((m == 0 || m++ == 0) && (m++ == 1)) { // False
    // In the OR condition, if the first line is already true
    // then the compiler doesn't check the rest. It is a
    // technique of compiler optimization
    System.out.println("post-increment " + m);
}

int n = 0;
if((n == 0 || n++ == 0) && (++n == 1)) { // True
    System.out.println("pre-increment " + n); // 1
}

In Array
System.out.println("In Array");
int[] a = { 55, 11, 15, 20, 25 };
int ii, jj, kk = 1, mm;
ii = ++a[1]; // ii = 12. a[1] = a[1] + 1
System.out.println(a[1]); // 12

jj = a[1]++; // 12
System.out.println(a[1]); // a[1] = 13

mm = a[1]; // 13
System.out.printf("\n%d %d %d\n", ii, jj, mm); // 12, 12, 13

for (int val: a) {
     System.out.print(" " + val); // 55, 13, 15, 20, 25
}

In C++ post/pre-increment of pointer variable
#include <iostream>
using namespace std;

int main() {

    int x = 10;
    int* p = &x;

    std::cout << "address = " << p <<"\n"; // Prints the address of x
    std::cout << "address = " << p <<"\n"; // Prints (the address of x) + sizeof(int)
    std::cout << "address = " << &x <<"\n"; // Prints the address of x

    std::cout << "address = " << ++&x << "\n"; // Error. The reference can't reassign, because it is fixed (immutable).
}

Answer: In simple words the difference between both is in the steps take a look to the image below.

Example:
int i = 1;
int j = i++;

The j result is 1
int i = 1;
int j = ++i;

The j result is 2
Note: in both cases i values is 2
Answer: I assume you understand the difference in semantics now (though honestly I wonder why
people ask 'what does operator X mean' questions on stack overflow rather than reading,
you know, a book or web tutorial or something.
But anyway, as far as which one to use, ignore questions of performance, which are
unlikely important even in C++.  This is the principle you should use when deciding
which to use:
Say what you mean in code.
If you don't need the value-before-increment in your statement, don't use that form of the operator.  It's a minor issue, but unless you are working with a style guide that bans one
version in favor of the other altogether (aka a bone-headed style guide), you should use
the form that most exactly expresses what you are trying to do.
QED, use the pre-increment version:
for (int i = 0; i != X; ++i) ...

Answer:
The Main Difference is

i++ Post(After Increment) and
++i Pre  (Before Increment)

post if i =1  the loop increments like 1,2,3,4,n
pre  if i =1  the loop increments like 2,3,4,5,n
Answer: The difference can be understood by this simple C++ code below:
int i, j, k, l;
i = 1; //initialize int i with 1
j = i+1; //add 1 with i and set that as the value of j. i is still 1
k = i++; //k gets the current value of i, after that i is incremented. So here i is 2, but k is 1
l = ++i; // i is incremented first and then returned. So the value of i is 3 and so does l.
cout << i << ' ' << j << ' ' << k << ' '<< l << endl;
return 0;

Answer: You can think of the internal conversion of that as multiple statements:
// case 1

i++;

/* you can think as,
 * i;
 * i= i+1;
 */

// case 2

++i;

/* you can think as,
 * i = i+i;
 * i;
 */

Comment: Case 2 suggests that `++i` increments `i` by `i`. This is wrong! See the other answers for the correct solution (e.g. this one https://stackoverflow.com/a/24858/3662030 ).
Answer: To add some more clarity:
This ++ operator overloading explains how pre/postfix increment can be done and then you'll get the difference between the prefix and the postfix ++ operators.
class Int {
    private:
        int i;

    public:
        Int(int i)
        {
            this->i = i;
        }

        // Overloading the prefix operator
        Int& operator++()
        {
            ++i;
            // returned value should be a reference to *this
            return *this;
        }

        // Overloading the postfix operator
        Int operator++(int)
        {
            // returned value should be a copy of the object before increment
            Int obj = *this;
            ++i;
            return obj;
        }
};

Answer: a=i++ means a contains the current i value.
a=++i means a contains the incremented i value.
Comment: This answer isn't accurate.  `a = i++;` means the value stored in `a` will be the value of `i` before the increment, but 'without incrementing' implies that `i` is not incremented, which is completely wrong — `i` is incremented, but the value of the expression is the value before the increment.


"omni" - prefixed word for " prepared to take up any challenge"

Question: Word for someone that will take any challenge thrown at him, prepared to take up any challenge. Preferably with "omni" as prefix. Doesn't have to be word that is commonly used. I have been trying to figure it out for a while.
Something like: "omni"-prefixed word for "all-hearing"
Comment: I don't think a word like what you're looking for exists. *aud* is the root I found for "all-hearing" which would make your word *omni-audial*... which doesn't seem like what you'd want. I can't find a word (omni- or no omni-) that means this.
Comment: 'Ready for anything' is the usual phrase.
Answer: One could use "omnivorous" metaphorically to describe someone with an insatiable/indiscriminate appetite (for challenge, or indeed other things).
Answer: There doesn't seem to be such a word! 'Tis a pity, since it would seem to be useful.
However, such a word could be coined using the Latin word for prepared or ready: paratus:
omniparatient
Interestingly, Google Translate gives the Latin word parabo for "ready for anything".  And omnes parati for "all prepared".


Is monoid the category for untyped lambda calculus?

Question: If cartesian closed categories are the model for simply typed lambda calculus, then can it be said that a monoid is a categorical model for untyped lambda calculus?
Answer: $C$-monoids and their variants is what you are looking for. You can find further references and an account of what is what in Martin Hyland's Towards a Notion of Lambda Monoid.
Comment: Nope. It's a rather special kind of object in a category whose structure allows you to model $\lambda$-calculus.
Comment: $C$-monoids are described in Lambek & Scott's "Introduction to higher-order categorical logic", [section 15](https://books.google.si/books?id=6PY_emBeGjUC&lpg=PP1&dq=lambek%20scott%20higher-order&pg=PA93#v=onepage&q&f=false)
Comment: Thanks for the answer. I'm new to category theory so pardon me if it sounds silly but is C-monoids the same thing as monoidal category?
Comment: Is there any other reference which talks and explains the monodical category other than the reference you mentioned? I couldn't find one on Internet!!
Comment: Following is the only thing I found: Möbius polynomial species, Domenico Senato, A. Venezia, J. Yang. Please let me know if there is a more direct reference to such.


LoadLibrary Reference Counting

Question: From MSDN:

The system maintains a per-process reference count on all loaded modules. Calling LoadLibrary increments the reference count.

Where is that reference count stored?
Answer: The actual windows loader is found in NTDLL.dll's LdrLoadDll function. This function is undocumented, and its internal functionality is subject to change in future versions of windows; only those with access to the windows source code could state for certain what happens behind the scenes.
However, wine's source is available, and you can see where it increments the reference count; it's stored in the LoadCount member of the LDR_MODULE heap structure. Since this doesn't seem to be a wine-internal structure, it's likely that this structure is based off the real, reverse-engineered windows structures, and thus windows probably stores it in the same way. However, since this is undocumented, it is subject to change in any future version of windows, or even with minor windows patches.
Answer: This is just a guess, but it's probably a global variable inside kernel32.dll (that's the DLL that imlements LoadLibrary).

LoadLibrary Reference Counting


Why can't we take space as universal frame of reference?

Question: Suppose we have a ball filled half with water in space with nothing else around (nothing else in the whole space except the ball) and suddenly it accelerates for time t. obviously, there would be movement in water which will tell us that the ball underwent motion. But since we have nothing to compare the motion with how can we say that it was in motion? can we say that it was at point A inertially (in space) and then in point B (again in the empty space)?
Comment: How does it accelerate?
Comment: Possible duplicate https://physics.stackexchange.com/q/1372/ and Dr. Muller's answer here is nice: https://www.quora.com/Why-is-linear-motion-relative-but-rotation-absolute
Answer: I don't know if you came with this thought experiment by yourself but if you did you are crazy smart. This is actually very close to the argument made by Newton, usually called Newton's Bucket. He believed that absolute space was a real physical scenario where physical processes were to happen. And something similar to that is his main argument for it's existence.
The truth is that today we don't consider this to be empirical evidence for that idea necessarily. To join a concept of relative space been the only one in existence with the results of this thought experiment you can just suppose that the objects of the rest of the universe are somehow mysteriously influencing the water communicating it what its movement relative to other objects is. In the extreme case were only your ball filled with water exists the believe is that water would actually not slosh at all. This is calles Mach's principle.
Today with the Einsteinian view we think in another way. Space is nothing more than a conceptual construct, an abstract aid for calculations, but space-time is something physically real and something entirely different.
Comment: The only way you can ***know*** it is in motion is to measure its position at different times. But if the only thing in the universe is the ball, you can't measure anything. You can't magically sit ***outside*** the universe and somehow measure what is happening ***inside*** it - except in these books ;) https://en.wikipedia.org/wiki/The_Science_of_Discworld
Comment: Thanks for such a quick response but why can't we say that it is in motion when we know it is in motion?
Comment: Motion is relative in principle. You know about motion from the perspective of a reference frame. If you assume motion is an absolute then it follows that space and time are absolute and you can refer motion to an absolute preferential frame. But since you are trying to prove that you can't start with that as a premise. So no, you wouldn't know if it is moving. Mach's argument is that not only you wouldn't know but that nature would have no means of applying the laws so the phenomena would actually happen in a different way as opposed to the universe having some other object in it.
Answer: You are asking if we can take space as a universal reference frame. Now what we usually use as universal reference frame, is the CMB. But in SR and GR, there is no universal frame of reference in theory.
But let's disregard that, and say you want to move that bucket with water.
First of all, how would you say if the bucket was in motion (constant speed) in the first place? In an empty universe you could not tell (about constant speed).
Speed is relative. You need to specify what your speed is relative to. In your case, in an empty universe, there is nothing to compare it to.
Now if you want to move the bucket what you really do is you accelerate it (at least for a while). Now acceleration is absolute.
Even in an empty universe, you are able to tell if your bucket accelerates or not. First, as you say, the water will move differently from the bucket because of the acceleration.
But, you can also drop beacons from the bucket as it accelerates. With a laser, you can check the distance between the following beacons, and you will see that this distance increases with each new pair of beacons. Thus, the bucket is accelerating, and you can tell even in an otherwise empty universe.