Echoing something with multiple quotes and key characters (&, $, !, etc.)

Question: Let's say you have to echo this into a file:
RZW"a4k6[)b!^"%*X6Evf

How do you do it?
My actual "line" to echo is a 2048 characters line.
Comment: You're planning to type `echo` *`2048 random nonsense chars here`*? I suspect it comes from a file or is generated somehow, yes?
Comment: @mikeserv , yes. Actually I was trying to make gpg read the passphrase from a file descriptor. Didn't know there was an option for that. My initial "stupid" idea was to echo the passphrase by using an alias in .bash_aliases.
Comment: Not stupid, just the wrong question.
Answer: Just put it in single quotes:
echo 'RZW"a4k6[)b!^"%*X6Evf' > file

But if you have any single quotes in the string you need to escape each of those in double quotes ("'") and "glue" the result together like this:
echo 'text without single quotes'"'"'and other text without single quote'

Answer: For arbitrary content, you can also use:
cat << 'EOF' > file
RZW"a`4$k6[)b!^"'%*X6Evf
RZW"a`4$k6[)b!^"'%*X6Evf
EOF

(as long as that content doesn't contain lines that consist of exactly EOF, in which case you can use a different delimiter).
To include NUL characters (^@ usually entered with Ctrl+VCtrl+Space or Ctrl+VCtrl+@), the above will only work with zsh. With other shells (and zsh), you can do:
cat > file

Enter the text and hit Ctrl+D on an empty line (or Ctrl-D twice if you want to include a non-terminated line) when finished.
Another approach to deal with arbitrary, potentially binary data is to use things like uuencode or base64:
For instance:
 printf '\0\1\2\3' > file

Can be written:
uudecode << 'EOF'
begin 644 file
$``$"`P``
`
end
EOF

(that output being obtained by running uuencode file < some-file where some-file contains that particular content).
Answer: I would use a "here document".
cat >my_file <<__EOF__
RZW"a4k6[)b!^"%*X6EvF
__EOF__

When the shell sees the <<foo syntax, it remembers what foo is and continues reading until it sees foo on a line by itself.  Then it passes everything it read (except for foo) to the program's standard input.
Comment: That variant (with the delimiter not quoted) still has issues with `$`, backtick and backslash.
Answer: To generate something to use as a command line argument, put it into a variable (or something else that you can ensure it gets into a word — then a single argument that gets passed to printf), then let bash/ksh93 do the rest.
# Reading from stdin
# pbpaste | bash -c '
printf echo\ %q\\n "$(cat)"
# ' | pbcopy
# Then paste it into your script and echo happily.
# Maybe I should use the `read' builtin instead..

Comment: Also in `zsh`. Note that it removes all trailing newline characters and adds one. It won't work with NUL characters except with `zsh`. You probably don't want to use `echo` here as you'll have trouble with values like `-n`/`-e` or containing backslash depending on the `echo` implementation or the environment.


Prevent users from saving back to Sharepoint

Question: I have a document library that stores Word and Excel files that are used by several people in our company.  They access them from a link list.  The documents are fillable forms so I have set the permission level to Contribute so they can fill the forms out.  The problem is that I don't want them to save back to the SharePoint copy. I want it to always be blank when the next person opens it.   I want to force them to "Save As" to their personal folder if they need to Save their copy.  Is this possible?
Comment: give them read only access, so when ever they access it and trying to save it will ask for location as they have read only access then will save on local
Answer: Change the general permissions from 'contribute' to 'read' on your list, then everyone should be able to open the documents, but not write back to the server. They don't need to contribute to open the form, just to write back to the server (which seems to be what you don't want them to do!)
Comment: Yeah they'll have to save a local copy before they can edit it, which is what you described originally as the desired behavior :) -- If you want to avoid not being able to fill it out right away, you might be able to somehow disable saving on the document and create a special button that would force a save as from the form documents but this would be quite a bit of work...
Comment: I tried that, but then they couldn't fill the form in, they could only view it.
Answer: Use content types with  document/excel template.  You can see how to create a content type with a document template  at https://stackoverflow.com/questions/9175300/excel-template-in-sharepoint-how-to-open-as-a-new-file-from-template.
The steps are straightforward: a) create a new content type, derived from document content type and add the document template b) Add the new content type to the list and disable any other content types.
http://www.documentmanagementworkflowinfo.com/sharepoint-document-management/add-document-template-sharepoint-document-library-site-content-type.htm
In that way, document templates won't be changed by the users and you can always update them!
Comment: Please add details from the link to your answer. If the link breaks your answer is not as useful as it has potential to be :) of course leave the link as a source of the content you do copy
Comment: Comments and suggestions are always welcomed.
Answer: Save the file in downloadable format ( Url) , that will allow the user only download the file when they click on it .
Steps :
Create a folder "Source"
Move the file to "Source Folder"
Copy the link of the file ( Not the folder)
get back to the original destination where file was before moving to source.
Click on new (click on link Option under new)
there will be popup to paste link , Paste the link copied.
To the link at the end add the code as &=Download without space.
Save, Your Downloadable format should be ready.
Whenever you want to make any changes in the file , you should be doing in the source file . Do not download , open excel on web and make changes.


Opening files from Eclipse in gvim skips vimrc and gvimrc

Question: When I try to open a file in an Eclipse project in gvim (using Eclipse's "open with -> other"), gvim seems to skip loading the global gvimrc and vimrc files and opens a bare white window with the default settings. Is there any way I can configure the command line Eclipse uses to launch gvim to add in the -u and -U options to specify the configuration files manually?
Answer: I did not find an option for that in the Eclipse preferences. I found the respective config file to be <Eclipse Workspace>\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.ui.workbench.prefs but I didn't find a place to plug parameters into that XML.
So what you can do is use a batch file which runs the executable with parameters. Maybe when you installed vim, you already generated C:\Windows\gvim.bat (or more generally %WINDIR%\gvim.bat). Otherwise you can create a dummy batch yourself, e.g. gvim.bat in your vim directory, a text file containing the following one-liner:
%~dp0vim73\gvim.exe -u %~dp0_vimrc %*

%~dp0 expands to the directory path of the batch file itself, which is available as the invisible parameter %0.
%* means "all (other) parameters (%1 %2 %3 …)" - this is where Eclipse will pass through the name of the text file to edit

Note that it works fine for me out of the box, without the batch workaround. So instead of specifiying the vimrc manually, you could try finding out why your config isn't loaded in the first place and fixing that by consulting the :help vimrc on where vim looks for rc files on startup.
For other approaches to vimming with Eclipse, check out https://stackoverflow.com/questions/597117/painless-integration-of-eclipse-with-vim


Receive credit card payment sending my customer details to a credit card processing company?

Question: I would like to receive credit card payments for my business (tourist apartment).  I actually get my guests via the booking.com website. This company provides me the guests' credit card details. But I don't have any POS equipment because it's very expensive to buy or rent one here (Cyprus). Are there any web-based companies that can do the process for me (I am sending the details, they make the processing, then transfer to my account)?
Comment: Have you considered paypal et al?
Comment: I've seen a lot of small businesses using Square. Don't know much about it, but it might be something to check out.
Comment: Square is a good option but they charge more for manual entry. ~1.25 percent more. You may be better off finding a merchant that will lease you the equipment for free.
Answer: Yes, there are a bunch. I have used Paypal and it worked quite nicely. I see endless ads these days for Square, a tiny card reader that you plug into a smartphone that lets you swipe the card. (With Paypal you have to type in the credit card number.)
Comment: The little box is Square, probably.
Comment: @joe Yes, thanks, I couldn't think of the name and I had to get back to work so I didn't want to take the time to look it up. :-)
Comment: No problem.  Added to the post.
Comment: There are several competitors to Square -- I know Staples gas one under their own brand, and there are  others out there. We can't recommend, since the deals being offered nay change at any time. Shop around, and recheck every year or two to see if soneone can offer you a better option.
Comment: Paypal actually has their own version of the card reader, no need to type anything in. My comic book guy uses this for his store.


How to connect to SQL Server database from Delphi FireMonkey

Question: I want to connect to MS SQL Server to insert or update some data with FireMonkey for my Android app, I'm using Delphi xe8.
Is there any way to do this with default component? Not using other component.
I'm using the remote server over ID address.
Comment: Um, yes. Via the standard FireDAC components. It's [covered in the [documentation](http://docwiki.embarcadero.com/RADStudio/XE8/en/Database_Connectivity_%28FireDAC%29)
Answer: I suggest you to use XML/JSON services to connect SQL Server database. It will save your time, data security, app security and application development time.
Indy components are great for Http Rio, also you can create your soap connection objects directly from code too. It depends on your choices.
Also you can connect databases from FireMonkey directly using FireDAC components. It can be useful for SQLite database but I never used FireDAC for SQL Server connections.
Answer: Normally, you don't access a remote database directly from your device like we do in desktop applications.
I suggest you do a request to a web service, include all parameters for insert/update and web service do the job for you.


Independent sets generation in a graph

Question: Is there an algorithm that, given an undirected graph and one independent set IS1, finds an other independent set IS2 by adding and deleting vertices from the first IS1?
Answer: Yes, most algorithms for enumerating maximal cliques are based on exactly this principle.  Since a clique is just an independent set in the complement, you could simply take $\overline G$ and enumerate cliques.  Of course, if your graph is very sparse, this might in practice not be a good idea.
The trivial branching algorithm would just try to add a new vertex to the solution, and delete all its neighbors in the solution.
On the other hand, there is a class of problems called reconfiguration problems in which we want to go from one solution to another with certain restrictions, e.g., we want to go from solution to solution with only adding and deleting vertices, or we want to move solutions along edges, etc.  There is a paper on this for independent set, Complexity of independent set reconfigurability problems, by Kamiński, Medved, and Milanič.
Comment: the reconfiguration problems assume a graph with two feasible solutions (Independent sets) and tend to find the sequence of independent sets to reach the given feasible solution from the initial one. I want to know is there an algorithm that, from a feasible solution can generate an other feasible solution through adding and deleting vertices. In other words, given a graph and one independent set IS1 (not two), how to add or delete vertices in a way that the new set is also independent?
Comment: Yes, deleting any vertex from the solution will be another solution.  Adding any vertex to the solution and then deleting its neighbors from the solution is yet another solution.

Independent sets generation in a graph


Creating an event from Last Imported in Photos.app

Question: How do I make an event from my last import using Photos? Does Photos only use albums rather than events? Is it still possible to merge events?
Answer: Photos uses Albums instead of Events and you can create an Album from the last imported by selecting all in the Last Imported album and clicking the + icon on the toolbar. Albums are merged by selecting the contents of one, copying it to another, then deleting the first.


Do all decomposition reactions involve heat?

Question: When water decomposes into Hydrogen and Oxygen as in 2H2O—-> 2H2+O2 does this involve heat? Is it always implied that heat is involved in a decomposition reaction or does this just spontaneously occur? Chemistry 1st semester so excuse the fundamental nature of the question. Thanks
Comment: Water: yes. Always: no.
Answer: Plainly put: no, decomposition reaction does not always have to entail providing heat. A decomposition reaction (in simple language) is when one compound breaks into multiple other compounds, like so:
$$\ce{A -> B + C}$$
As a general rule, if the product side is relatively more stable, it will decompose without you having the to provide extra heat. In the case of the reaction you gave, $\ce{H2O}$ is more stable than $\ce{H2}$ and $\ce{O2}$, and thus you will have to provide heat for the breaking of bonds.
Answer: Check out the iron oxygen phase diagram.  Wustite ($\ce{FeO}$) decomposes upon ... cooling, below 570°C, to magnetite ($\ce{Fe_3O_4}$) and metallic iron.  Steel strip manufacturers deal with this reaction because it impacts the acid pickling of hot mill scale.


Theoretical function question

Question: Suppose we have the function $f(x)= x^2 $. This function associates real numbers with real numbers ( $f:\mathbb{R}\rightarrow \mathbb{R}$). Now, what i get confused sometimes is what exactly the function is. Sometimes textbooks compares functions with a machine that have raw material / inputs (in this case the real numbers) and then processes it into an output (which can be any number in the codomain). So, what I get confused is: the function is the operator (in this example raising to a power) or the general concept of 'transforming' a number? Like, if we use another example $f(x)= x + 2 $, is the function an operator (the addition), a process that transforms number or something else more general and the operator is part of the function, only an association of numbers from the domain to the codomain?
Comment: I'm not sure I understand the question. Are you asking what the difference is between  $f $ and $f (x) $?  If you are $f(x) $ is the image of $x $ under the function  $f $
Comment: See [this post](http://math.stackexchange.com/questions/1071944/confusion-about-the-definition-of-function).
Answer: Your confusion is quite justified, and historically accurate, even!
Historical Prelude
For some context, I'll quote a few snippets from Remmert's fantastic book, Theory of Complex Functions.

The word "function" occurs in 1692 with Leibniz as a designation for
certain magnitudes (like abscissae, radii of curvature, etc.) which depend
on the points of a curve, these points thought of as changing or varying. As early as 1698 in a letter to Leibniz, Joh. Bernoulli spoke of "[...] magnitude which is
built up from a variable and any constants whatsoever [...]"

and Euler

[...] called any analytic expression, involving a variable and
constants, a function.

So, the mathematical word "function" has its roots in these sorts of things - very nice, continuous (often enough, smooth even!) functions given to us by evaluating nice algebraic expressions at certain inputs; the "function machine" concept that we know and love.
Still getting information from Remmert's book, we learn that Dirichlet (nearly 150 years later, around the 1830s) pushed the boundaries, defining a function $f(x)$

[...] equal to a certain constant
$c$ whenever the variable $x$ takes on a rational value and equal to another
constant $d$ whenever this variable is irrational [...]"

and finally going so far as to consider functions in a very modern way, saying

[...] in fact one need not even think of the dependence as given by explicit mathematical operations."

My point here is that it's very natural to view functions in the "Take $x$, and square it" or "add $2$ to $x$" kind of way, and that it was a very long journey to begin thinking of functions as mere associations (with certain easily-fulfilled properties) between objects in two sets.

The modern interpretation is indeed that a function $f\colon X \to Y$ is simply a set of ordered pairs $\{(x, y): x \in X, y \in Y\}$ in which each element of $X$ appears as a "first coordinate" exactly once in the set of ordered pairs.
Of course, if you do have a rule such as \begin{align*}f\colon X &\to Y \\ x&\mapsto f(x) =  x^2\end{align*}
there's a great benefit to viewing the function $f$ as a sort of machine that turns input $x$'s into output $x^2$'s! The modern view simply says this isn't necessarily true of all functions (at least, it isn't necessary for a function to be summed up so tidily with a simple formula), and that it's the association of each $x$ with its $x^2$, or the set of ordered pairs $\{(x, x^2): x \in \Bbb R\}$ that's really the squaring function $f\colon \Bbb R \to \Bbb R$.
I personally only think this way when it's strictly necessary to be pedantic, and quite like the "transformation" aspect; that functions are the "movers and shakers" of the math world.
Comment: Thanks @pjs36 for such an elegant, clear and concise answer.
Comment: I'm happy to have helped! Of course, Remmert and others did the footwork, I just brought it to your attention with a little added commentary :)
Answer: Formally, the function is defined to be the set of corresponding ordered pairs of numbers (that is, it is defined to be the set of points on its graph). Informally, in elementary mathematics, it is viewed intuitively as a machine which transforms, and this is of course inherently vague.
Comment: Expanding on Jasper Loy's answer, a function is a $set$ of ordered pairs $$ such that if $ \& $ then $y_0 = y_1$. So a function can be understood in ZFC set theory, a kind of foundation for mathematics, as simply a $set$ rather than a "black-box" or mysterious transformation. Indeed, this is part of the utility behind set-theory: a function is part of the same ontology as numbers since every mathematical object is just sets.
Comment: @letsmakemuffinstogether Thanks for the comment. I love muffins.
Answer: The formal definition say that a function $f:A\rightarrow B$ is a subset of $A\times B$ that contain only one couple $(x,y)$ for any $x \in A$.
For $A=B=\mathbb{R}$ the set of all these subsets is uncountable, so we ''suspect'' that not all functions can be expressed as machines that transform some input to an output, since the number of this machine is at most countable and this suspect become an exact statement introducing a definition of computable functions.
For our purpose this means that the concept of function is something more than some operation rules given for calculate a real number from another one.  There are function that can be expressed in such way, and are the functions that we use normally, but these are only a countable subset of all the possible functions.
Answer: The function is the general concept of transforming numbers. Don't be confused with functions such as $(+)$ and $(*)$ these are functions as well with range and domains. $(+):\mathbb{R}\times \mathbb{R} \mapsto  \mathbb{R}$ and $(*):\mathbb{R}\times \mathbb{R} \mapsto  \mathbb{R}$. It's just that we normally write these functions infix meaning in-between arguments rather than before.
Answer: According to Bourbaki's first volume of Elements of Mathematics - Theory of Sets - a function is a triple $(A, B, G)$, where $A$ and $B$ are two non-empty sets and $G$ is a subset of $A \times B$ such that for all $x \in A$ there exists $y \in B$ such that $(x, y) \in G$. $A$ is called domain, $B$ target set and $G$ graph of the function. I think the strength of this definition lies in the fact that it does not confuse a function for its graph.

Theoretical function question


How To Transfer Tokens Out Of Metamask Wallet

Question: I have some tokens in my Metamask wallet and want to transfer them to an exchange to trade but I don't know how to do.  Metamask now allows you to see the tokens as per the recent upgrade but I don't see any way to send tokens.
Would appreciate your advise.
Best regards,
Comment: So basically if you have gotten tokens sent to your Metamask ETH address, you cant send those tokens out of your account yet ? We have to wait for them to program that into the software to do that ? Ive gotten some tokens sent to my Metamask account that i created an ETH wallet on ... Its shwoing the tokens, but i cant send them out :( Once the ICO goes live. Please let me know what I could possibly do.
Answer: MetaMask does not have a default UI for sending tokens yet. The official guide lists three current web interfaces that can be used for sending tokens, but none are provided as a default because they do not all necessarily work with all tokens.
Using the wallet.ethereum.org interface, you should be able to manage tokens easily enough.
A default 'send' page will be coming soon.
Answer: Have you tried importing the private keys into another wallet, say myetherwallet.com (or Mist or Ethereum Wallet from ethereum.org)?
In case you want to do that, in Metamask open the menu for your wallet (the three dots next to the wallet name) and select 'export private keys', then you can import them in one of said wallets.
Comment: You don't even have to export your keys - myetherwallet has a metamask integration, so you can initiate a metamask transaction using myetherwallet and confirm it using metamask.
Answer: You can send tokens using new (as in MetaMask 4.8.0) beta UI.
See official guide here.

Answer: One option would be to use the ShapeShift MetaMask integration at https://www.efolio.info/shapeshift. It allows you to shift any ERC20 tokens supported by ShapeShift into other crytocurrencies.


Did Malachi 4:5, 6 prophesy the coming of John the Baptist?

Question: Malachi 4:5 "See, I will send the prophet Elijah to you before that great and dreadful day of the Lord comes. 6He will turn the hearts of the parents to their children, and the hearts of the children to their parents; or else I will come and strike the land with total destruction."
Answer: Did Malachi 4:6 prophecy the coming of John the Baptist?
Yes, it is confirmed in

Luke 1:11 Then an angel of the Lord appeared to him, standing at the right side of the altar of incense. 12When Zechariah saw him, he was startled and was gripped with fear. 13But the angel said to him: "Do not be afraid, Zechariah; your prayer has been heard. Your wife Elizabeth will bear you a son, and you are to call him John. 14He will be a joy and delight to you, and many will rejoice because of his birth, 15for he will be great in the sight of the Lord. He is never to take wine or other fermented drink, and he will be filled with the Holy Spirit even before he is born. 16He will bring back many of the people of Israel to the Lord their God. 17And he will go on before the Lord, in the spirit and power of Elijah, to turn the hearts of the parents to their children and the disobedient to the wisdom of the righteous—to make ready a people prepared for the Lord."

Pulpit Commentary

To turn the hearts of the fathers to the children, and the disobedient to the wisdom of the just. The usual explanation of these words of the angel, who uses here the language of Malachi (Malachi 4:5, 6), is that the result of the preaching of this new prophet, who is about to be raised up, will be to restore harmony to the broken and disturbed family life of Israel, whereas now the home life of the chosen race was split up - the fathers, perhaps, siding with the foreign or Roman faction, as represented by Herod and his friends; the sons, on the other hand, being Zealots attached to the national party, bitterly hostile to the Herodians.
Answer: At first glance the NT appears equivocal on this question.  Luke 1:17 quotes Mal 4:5, 6 about John the Baptist but John the Baptist appears to deny the suggestion in John 1:21.  What is going on here?

Matt 11:11-14 - Truly I tell you, among those born of women there has risen no one greater than John the Baptist. Yet even the least in the kingdom of heaven is greater than he. From the days of John the Baptist until now, the kingdom of heaven has been subject to violence,f and the violent lay claim to it. For all the Prophets and the Law prophesied until John. And if you are willing to accept it, he is the Elijah who was to come.
Matt 17:11-13 - Jesus replied, "Elijah does indeed come, and he will restore all things. But I tell you that Elijah has already come, and they did not recognize him, but have done to him whatever they wished. In the same way, the Son of Man will suffer at their hands." Then the disciples understood that He was speaking to them about John the Baptist.  See also Mark 9:12, 13.
Luke 1:13, 17 - But the angel said to him, "Do not be afraid, Zechariah, because your prayer has been heard. Your wife Elizabeth will bear you a son, and you are to give him the name John. ... And he will go on before the Lord in the spirit and power of Elijah, to turn the hearts of the fathers to their children and the disobedient to the wisdom of the righteous—to make ready a people prepared for the Lord."

Thus, Jesus is quite emphatic that John the Baptist was the prophesied person of Mal 4:5, 6 who would preach in the spirit and power of Elijah.
So, what are we to make of John's denial in John 1:21, ""Then who are you?" they inquired. "Are you Elijah?"  He said, "I am not."  ...
I believe John was answering the question, "Are you actually [the person of] Elijah, which he obviously was not.  However, according to Jesus John was a prophet who preached in the spirit and power of Elijah and who prepared to way for Jesus and turned the hearts of the fathers back to God.
Ellicott summaries this well in his remarks on Mal 4:5 -

(5) Elijah.—There is no more reason to suppose that this refers
actually to "Elijah" the prophet, and that he is to appear upon earth,
than to imagine from Hosea 3:5; Ezekiel 24:23; Ezekiel 37:24; Jeremiah
30:9; that David himself is to come again in the flesh. When John the
Baptist answered the question of the deputies of the Sanhedrim, "Art
thou Elias?" by "I am not," he simply gave a negative reply to their
question, which was formulated on their misapprehension. On the other
hand, that John the Baptist is the "messenger" of Malachi 3:1 and the
"Elijah" of this verse is shown conclusively (as far as Christians are
concerned) by Luke 1:16-17 before his birth, by Matthew 3:1-12, Mark
1:2-8, Luke 3:2-18, at the commencement of his ministry. Moreover, our
Lord Himself assured the people that John was this "messenger" and
"Elijah" (Matthew 11:10, seq.; Luke 7:27, seq.), and His disciples
that he had appeared, and not been recognised (Matthew 17:11, seq.;
Mark 9:1, seq.).
Answer: It is abundantly clear in Mark 1:1 that Mark is asserting that the prophecy of Malachi respects John the Baptist :

As it is written in the prophets, Behold, I send my messenger before thy face, which shall prepare thy way before thee. [Mark 1:1 KJV]

Here, Mark is quoting, almost verbatim (apart from changing the wording 'my' face to 'thy' face) from Malachi 3:1 :

Behold, I will send my messenger, and he shall prepare the way before me: and the Lord, whom ye seek, shall suddenly come to his temple, even the messenger of the covenant, whom ye delight in: behold, he shall come, saith the LORD of hosts. [Malachi 3:1 KJV].

Mark immediately references John the Baptist and by highlighting the Malachi quote first ( a more minor prophet and a later prophet than Isaiah, whom he also quotes) he draws attention to the 'Messenger of the Covenant' who is 'the Lord' himself.
The 'messenger' of preparation is without doubt, according to these two passages, John the Baptist.
So, also, is the further defining of the prophesy in Malachi 4:5 and 6 indicative of the prophet (John the Baptist) of whom Jesus says that 'none greater begotten of woman ... hath arisen'.
As to Mark's changing 'my' face to 'thy' face, it is a matter of further revelation of the Father and the Son in which Mark follows the words of Jesus when he quotes the same passage in Matthew 11:10 :

For this is he, of whom it is written, Behold, I send my messenger before thy face, which shall prepare thy way before thee. [Matthew 11:10 KJV]
Answer: Yes, John was a type of Elijah who prepared the way for Christ, but Malachi 4:5,6 has a dual fulfillment. Christ comes twice, and his people are in apostasy on both occasions. The reason that John denied that he was Elijah is that he knew that another Elijah would come. Jesus Christ himself confirmed this:

In reply he said: "E·liʹjah is indeed coming and will restore all things. However, I say to you that E·liʹjah has already come.."

So there is to be a future "Elijah" who will "restore all things." John the Baptist did not restore all things. What does this mean? The restoration of all things includes the restoration of Christianity itself and true Bible cosmology which has been hidden from God's people by Babylon the Great. Elijah delivered the Jews from the Babylonish religion at Mt. Carmel. The coming prophet Elijah will perform a similar act. The restoration of all things is spoken of in Acts 3:21-24 in connection with the prophet like Moses.
In addition to the prophet like Moses, the prophet Elijah is also the "two" witnesses who prophesy for a period of 42 months during the last days. This is foreshadowed by the transfiguration. Therefore, Malachi 4:5,6 rightly states that this future Elijah will come just before the "great and awe-inspiring day of Jehovah" - Armageddon. Clearly, this did not apply to John. It should be noted that the number two used to describe the two witnesses is symbolic. It means that the message presented is true. The prophet like Moses and the prophet Elijah (as the two witnesses) are a single man (I can prove this with the original Greek text).
But what does verse 6 mean when it says that Elijah will "...turn the hearts of fathers back toward sons, and the hearts of sons back toward fathers...?"
This is referring to the unbiblical, unchristian, and ungodly practice of shunning which separates Christian family members. Some translations say "children from parents and parents from children." Which denomination is (in)famous for practicing shunning which divides families, sometimes with disastrous consequences such as suicide and even murder of other members of their family or congregation, thus profaning God's name among the nations and presenting themselves as having cult-like tendencies (according to the BITE model)? Answer this and you will know who Jehovah God is addressing in Malachi 4:5,6.
Interestingly, in the very chapter before Malachi 3:1-4 (2:1-4) just before the Elijah messenger is sent (3:1) there is a warning given to the "priests" (the anointed rulers of God's people) to glorify God's name, and the consequences they face if they do not. In fact, the verse says that they definitely will be punished for failing to glorify Jehovah God through this wicked practice and for also acting like a cult.
Malachi 4:6 confirms the serious consequences for God's people if the prophet Elijah does not fulfill his commission:

...so that I may not come and strike the earth, devoting it to destruction.


Standard Form of linear programming

Question: How can we prove that all linear programming problem cannot be converted to the form below: \begin{array}{ll}
\text{maximize}  & c^T x \\
\text{subject to}& A x = b \\
\end{array}
I think we need to come up with an example that cannot be converted to this form, but I can't figure out how to mathematically define "not being able to be converted to that form". suppose we have an LP in the standard form whose answer would be $x$ if there is a function $f(x) $ that can convert x to an answer of a problem of the above form then these  two problems are equivalent, but $f$ can be any function so this definition is not very helpful.
Comment: You can't. Missing are the bounds $x\ge 0$.
Answer: Hint: If $\ x_1\ $ and $\ x_2\ $ are any feasible solutions with $\ c^Tx_1 \ne c^Tx_2\ $, can you show that $\ x_t = (1-t)x_1 + tx_2\ $ is a feasible solution for any real $\ t\ $?  Using $\ x_t\ $, can you determine  what must be the range of values the objective function takes over the set of feasible solutions? Can you find a linear program whose objective function is not constant, but has a different range over its set of feasible solutions?
Clarification: The OP has correctly pointed out in the comments below that, under a sufficiently loose interpretation of what it means to "convert" one linear program to another, it would be true that any linear program could be "converted" to one of the given form.
In the above hints, I was assuming that "conversion" of one linear program $P_1$ with objective $\ c_1^Tx\ $ to another, $P_2$ with objective $\ c_2^Ty\ $, meant that there would be a surjective mapping $\ \varphi\ $ from the feasible solutions of $P_2$ onto those of $P_1$ such that $\ c_1^T\varphi(y)=c_2^Ty\ $ for all feasible solutions $\ y\ $ of $P_2$.  Under this interpretation of "conversion" it is true that not all linear programs can be converted to the given form.
Comment: What if $ Ax = b $ has only one solution, in that case, the optimal solution is also that point
Comment: Unless I'm misunderstanding your question that's irrelevant.  Obviously *some* linear programs *can* be written in the given form, so I was presuming you wanted to show that *not all* linear programs can be.  To do that, all you have to do is find just *one* linear program that can't be written in that form.   My hint outlines a strategy for finding such a one.
Comment: Thank you for your hint. I understood the clue, but I thought maybe if there is a problem with that form whose optimal solution is $y$ if and only if $f(y) = x$ is the solution of a special LP in the standard form, then we can say that this problem can be transformed to that form.
Comment: Ah, I see your point.  Yes, if all you require of being "converted to that form" is that the converted form have the same optimal solution as the original (or no optimal solution if the original has no optimal solution) then it would be true that any linear program could be "converted to" the given form.  However, I don't think that's a very useful interpretation of what "converted to" should mean, or is likely to be what anyone using that expression would mean.  I'll add a clarification to my answer.
Comment: Thank you for the clarification, I marked it as the answer.

Standard Form of linear programming


How can I locate a process' global and stack areas in Win32?

Question: How can I locate which areas of memory of a Win32 process contain the global data and the stack data for each thread?
Answer: There is no API (that I know of) to do this.  But If you have a DLL in the process, then you will get DLL_PROCESS_ATTACH/DLL_THREAD_ATTACH notifications in DllMain when each thread is created.  You can record the thread ID and the address of a stack object for that thread when you get these notifications, because you will get called on the new thread.  So store the thread id and stack address in some table that you create at that time.  Don't try to do a lot of work in DllMain, just record the stack location and return.
You can then use VirtualQuery to get turn the address of a variable on each thread stack into a virtual allocation range,  that should give you the base address of the stack (remember that stacks grow from high addresses to low addresses).   The default allocation size for a stack is 1Mb, but that can be overridden by a linker switch or by the thread creator, but a stack must be contiguous.  So what you get back from VirtualQuery will be the full stack at that point in time
As for the heap location - there can be multiple locations for the heap, but in general if you want to assume a single contigous heap location then use HeapAlloc to get the address of a heap object and then VirtualQuery to determine the range of pages for that section of the heap.
Alternatively You can use VirtualQuery on the hModule for the EXE and for each DLL. and then you can assume that anything that is read-write and isn't a stack or a module is part of the heap.  Note that this will be true in most processes, but may not be true in some because an application can call VirtualAlloc or CreateFileMapping directly, resulting in valid data pointers that are not from either stack or heap.
Use EnumProcessModules to get the the list of modules loaded into a process.
VirtualQuery basically takes a random address, and returns the base address of the collection of pages that that address belongs to, as well as the page protections.  So it's good for going from a specific pointer which 'type' of allocation.
Answer: Take the address of variables allocated in the memory regions you are interested. What you do with the addresses when you have them is another question entirely.
You can also objdump -h (I think it's -h, might be -x) to list the section addresses, including data sections.
Answer: Global Data
By "Global" I'm going to assume you mean all the data that is not dynamically allocated using new, malloc, HeapAlloc, VirtualAlloc etc - the data that you may declare in your source code that is outside of functions and outside of class definitions.
You can locate these by loading each DLL as a PE File in a PE file reader and determining the locations of the .data and .bss sections (these may have different names for different compilers). You need to do this for each DLL. That gives you the general locations for this data for each DLL. Then, if you have debugging information, or failing that, a MAP file, you can map the DLL addresses against the debug info/mapfile info to get names and exact locations for each variable.
You may find the PE Format DLL helps you perform this task much easier than writing the code to query the PE file yourself.
Thread Stacks
Enumerate the threads in the application using ToolHelp32 (or PSAPI library if on Windows NT 4). For each thread, get the thread context and read the ESP register (RSP for x64). Now do a VirtualQuery on the address in the ESP/RSP register read from each context. The 1MB (default value) region around that address (start at mbi.AllocationBase and work upwards 1MB) is the stack location. Note that the stack size may not be 1MB, you can query this from the PE header of the DLL/EXE that started the thread if you wish.
EDIT, Fix typo where I swapped some register names, thanks @interjay
Comment: Did you mean ESP instead of EIP?
Comment: @interjay. Whoops! Yes I did. ESP/RSP rather than EIP/RIP. Edited the article to fixup. Thank you for the save.


How to access quests that are required for certain building?

Question: When looking at potential buildings I can make, some of them say they require level x and completing some quest.  Unfortunately, I've surpassed some of the levels required for these buildings but I can not seem to get the quest to be offered by any of the resident of my town. Is there any way I can trigger certain residents to offer me new quests?
Comment: Playing the game and completing the quests you currently have should eventually unlock the quests you need for buildings IIRC
Comment: I have all my current quests complete.. Everyone is just going about their normal tasks now making expz & money
Comment: Did you build all the buildings to get all the characters then? If you did then I don't know what it is.
Comment: Maybe I'm just impatient, so as to not answer my own question, wanna combine your comments and add the answer?
Answer: Playing the game and completing the quests you currently have will eventually unlock new buildings. Once you do have those buildings build them to unlock new characters, each having their own new quests to complete.


Emails from custom domain going to spam

Question: I just bought a custom domain that I'm trying to use as my primary email address. However at the moment many of my emails are landing in people's SPAM accounts. Are there any cheap ways around this problem (no-spam lists at internet providers or that sort of thing)? I'm not a spammer, I'm a fourth year college student.
Comment: What is a "custom" domain? What makes it a "custom" domain?
Comment: Custom as in not gmail or hotmail
Comment: Understood (although I wouldn't consider any non gmail or hotmail address custom).
Answer: There are a few ways to approach this, none with 100% certainty, but if you try several you'll at least improve your delivery rate. I'm going to assume you have control of DNS for your domain. This is not an exhaustive list.

Have an MX record for your domain, so you're able to accept responses.
Set up an SPF record for your domain. This isn't too hard if you know the sources of all email (e.g. you'll always be sending through the same subset of SMTP servers). Microsoft encourages submitting your record to them after setting up SPF, which helps you get through to Hotmail.
Check to see if your sending IP address is on any blacklists. Get it off if you can; this process is different for nearly all of them, though.
If you can, set up DKIM authentication.

The last part is just to send "good-looking" email, and this is going to vary a lot depending on how you're creating your messages (in a webapp or in your own desktop client). Docunext's answer is an example of how to approach that problem. This includes things like having the reply-to and from headers match, not using blank subject lines, etc.
Answer: You'll have to find out why they are going into their spam folders. Depending on what filtering system they use, the scoring might get added to the email header. Ask they forward you the email as an attachment, then view the original.
If you are lucky, you'll see something like this:
<code>X-Spam-Flag: YES
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
    pro-12-gl.savonix.com
X-Spam-Level: ******
X-Spam-Status: Yes, score=6.2 required=4.0 tests=BAYES_99,HTML_MESSAGE,
    MIME_HTML_ONLY shortcircuit=no autolearn=disabled version=3.2.5
</code>
In this case, the BAYES_99,HTML_MESSAGE,MIME_HTML_ONLY spamassassin rules caused it to get classified as spam. The other answer mentioning rdns also has a rule, but many ISPs simply block emails sent from an IP without an rdns, or from an IP with an rdns that doesn't match the name of the SMTP server.
Answer: You didn't mention your email service provider.
Did you register a fresh domain name or an old one mate? If it is an old one, do a Google search or use Internet Archive to see whether your domain is blacklisted or affected by any Google algorithms or any such hit lists.
If your domain's previous life was a spammy one then probably it could affect your emails as well. Also setting up an SPF record for your domain name will increase trust.
Answer: Maybe you need to set up Reverse DNS?
It's a common anti-spam technique to check the domain names in the rDNS.

Emails from custom domain going to spam


How do I know if I am mining in a pool?

Question: So I started mining from monero-wallet-cli using "start_mining 2".  When I enter "status", the output is as follows; "Refreshed 1254269/1254269, synced, daemon RPC v1.0".  Am I actually in a pool?  I have seen references to stale blocks if you are not mining in a pool, which leads me to believe that I may be.
Answer: You are mining in a pool when you are running a pool miner. If you mine directly from the daemon or wallet, you are solo mining, not pool mining.
Solo mining, which is your case, means you will take a long time to find a block. However, when you do find one, you will get to keep the entire block reward (currently about 8 monero, I believe) instead of it being distributed among all pool miners and getting a pittance.
Note that solo mining is done by the deamon. Starting mining in the wallet merely instructs the daemon to do so. If you want to double check you are actually mining, run status in the daemon itself. If you restart the daemon, mining will be automatically off on restart, for instance, though you would not have told the wallet to stop mining.
Answer: Go to pool web site and enter your address to field "Your Stats & Payment History"
Bellow that you will see your hash rate.
Probably you have to a wait a couple of minutes as pool show hash rate only from accepted shares.
Comment: while it is a good answer, the question was asked in the wrong place to begin with; hopefully the asker will re-post using a proper channel to keep our SE site tidy
Answer: You can go to the pool's web site where you should be able to track your status and submitted shares.

How do I know if I am mining in a pool?


What is the importance of XML in the world of JSON?

Question: How important is it to learn XML when JSON is able to do almost all that I need? Having said that, I use JSON mainly for AJAX requests and obtaining data from various APIs.
I am a total newbie to web development and the reason I am asking this is that I want to know whether I should go ahead and buy a book on XML or whether I can just give it a pass.
Comment: Just read the standard.  I've never found XML challenging to learn/understand, just tedious.
Comment: Given that you'll encounter XML on a rather consistent basis, I'd go ahead and get the book.
Comment: @KeithPalmer: and still there is a high amount of mistakes to be found all around the web. From wrong encoding declaration, to missing escapes for characters that need them to simply using a XML file as one huger CDATA container. And don't get me started about how to misues namespaces.
Comment: I never understood that either- what is so difficult about understanding XML? 99.9% of XML out there is just used as a container for data- it's simple text files people, not anything complicated!
Comment: everyone should us CSV...
Answer: You'll need to learn XML to get anywhere in the web world. It's what drives of lot of B2B communications and there are many standard XML formats describing important.
Just restricting yourself to JSON is hugely self-limiting. Yeah, you'll be chucking AJAX calls around but what happens when you need to communicate with a GeoServer? It'll be adhering to GIS standards and will be spurting out XML in WCS (Web Capabilities Service), WMS (Web Map Service) and WFS (Web Feature Service) formats among others. If you don't know how to handle XML, you'll have some trouble with that.
Of course, any marshaller (domain object to text format) worth its salt will be able to convert their objects to and from XML/JSON/YAML so you could make the argument that so long as you can hide behind the marshaller you only have to deal with the domain objects. Web services provide WSDL exactly for this purpose. But sooner or later you'll need to read and understand the contents of your requests and responses and that will certainly require an understanding of XML.
And let's not forget good ol' XHTML the old web standard for HTML pages. It's XML.
So, in short, learn XML - and keep JSON wherever you can 'cos it's lovely.
Comment: +1, though for what it's worth, XHTML isn't really all that new and seems to have moved to the backseat with HTML 5.
Comment: Thanks  a lot Gary!XML looks so bloated and really scary to dive in though, but going by what you said, seems like I will have to learn it......!
Comment: I don't know what language / framework / platform you use, but whichever it is, I'm sure you'll find that it has standard libraries for parsing and generating XML, you shouldn't find yourself interpreting pointy brackets manually.
Comment: Maybe. My point was more that the W3C *seems* like their thinking on XHTML has changed a little in the past few years. It's still there and supported, but it's no longer like you're some kind of IE-loving table-layout-using script kiddie if you use plain HTML instead of XML. It's kinda tangential to your answer anyway though, sorry about that.
Comment: @Alice Start off slow. Think of it as repetitive HTML. Then allow for case sensitivity. Then consider how different data types (e.g. int, string, date) could be represented and tagged inside those elements or attributes. Then make that data type representation a bit more formal (XSD) and you're about as far as you'll need to go. This tutorial should help: http://www.devguru.com/features/tutorials/xml/beginning_xml.html
Comment: @John M Gant Hmmm, maybe I should edit it to say XHTML5 instead...
Answer: XML definitely outshines JSON for markup (which is, after all, hinted at in the name).
I wouldn't like to see a random XHTML page converted into JSON format. It would be horrible. OpenOffice and the latest editions of Microsoft Office all use compressed XML as their format of choice.
As a general rule: Markup goes in XML; structured data goes in JSON.
That's when you're outputting data and have full control yourself over the format. If you're outputting data according to industry standards, or consuming other people's data, you may need to use XML even in places where JSON would seem more appropriate. That's because XML is longer established and has been used in many standards.
Comment: +1, especially for noting the difference between markup and structured data.


Differences between Ant and Maven

Question: Could someone tell me the differences between Ant and Maven? I have never used either. I understand that they are used to automate the building of Java projects, but I do not know where to start from.
Comment: Since answers are dominated by Maven advocates I would like to balance it a little. See this answer for example http://stackoverflow.com/questions/1306579/buildr-gradle-or-wait-for-maven-3/2050753#2050753
Comment: While this does not directly answer the question of comparing Ant vs Maven, my input would be to look at using Gradle, which could give you access to both Ant and Maven simultaneously. http://www.gradle.org/
Answer: In Maven: The Definitive Guide, I wrote about the differences between Maven and Ant in the introduction the section title is "The Differences Between Ant and Maven".  Here's an answer that is a combination of the info in that introduction with some additional notes.
A Simple Comparison
I'm only showing you this to illustrate the idea that, at the most basic level, Maven has built-in conventions.    Here's a simple Ant build file:
<project name="my-project" default="dist" basedir=".">
    <description>
        simple example build file
    </description>

    <property name="src" location="src/main/java"/>
    <property name="build" location="target/classes"/>
    <property name="dist"  location="target"/>

    <target name="init">

      <tstamp/>

      <mkdir dir="${build}"/>
    </target>

    <target name="compile" depends="init"
        description="compile the source " >

      <javac srcdir="${src}" destdir="${build}"/>
    </target>

    <target name="dist" depends="compile"
        description="generate the distribution" >

      <mkdir dir="${dist}/lib"/>

      <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
   </target>

   <target name="clean"
        description="clean up" >

     <delete dir="${build}"/>
     <delete dir="${dist}"/>
   </target>
 </project>

In this simple Ant example, you can see how you have to tell Ant exactly what to do. There is a compile goal which includes the javac task that compiles the source in the src/main/java directory to the target/classes directory. You have to tell Ant exactly where your source is, where you want the resulting bytecode to be stored, and how to package this all into a JAR file. While there are some recent developments that help make Ant less procedural, a developer's experience with Ant is in coding a procedural language written in XML.
Contrast the previous Ant example with a Maven example. In Maven, to create a JAR file from some Java source, all you need to do is create a simple pom.xml, place your source code in ${basedir}/src/main/java and then run mvn install from the command line. The example Maven pom.xml that achieves the same results.
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.sonatype.mavenbook</groupId>
  <artifactId>my-project</artifactId>
  <version>1.0</version>
</project>

That's all you need in your pom.xml. Running mvn install from the command line will process resources, compile source, execute unit tests, create a JAR, and install the JAR in a local repository for reuse in other projects. Without modification, you can run mvn site and then find an index.html file in target/site  that contains links to JavaDoc and a few reports about your source code.
Admittedly, this is the simplest possible example project. A project which only contains source code and which produces a JAR. A project which follows Maven conventions and doesn't require any dependencies or customization. If we wanted to start customizing the behavior, our pom.xml is going to grow in size, and in the largest of projects you can see collections of very complex Maven POMs which contain a great deal of plugin customization and dependency declarations. But, even when your project's POM files become more substantial, they hold an entirely different kind of information from the build file of a similarly sized project using Ant. Maven POMs contain declarations: "This is a JAR project", and "The source code is in src/main/java". Ant build files contain explicit instructions: "This is project", "The source is in src/main/java", "Run javac against this directory", "Put the results in target/classses", "Create a JAR from the ....", etc. Where Ant had to be explicit about the process, there was something "built-in" to Maven that just knew where the source code was and how it should be processed.
High-level Comparison
The differences between Ant and Maven in this example?  Ant...

doesn't have formal conventions like a common project directory structure, you have to tell Ant exactly where to find the source and where to put the output. Informal conventions have emerged over time, but they haven't been codified into the product.
is procedural, you have to tell Ant exactly what to do and when to do it. You had to tell it to compile, then copy, then compress.
doesn't have a lifecycle, you had to define goals and goal dependencies. You had to attach a sequence of tasks to each goal manually.

Where Maven...

has conventions, it already knew where your source code was because you followed the convention. It put the bytecode in target/classes, and it produced a JAR file in target.
is declarative. All you had to do was create a pom.xml file and put your source in the default directory. Maven took care of the rest.
has a lifecycle, which you invoked when you executed mvn install. This command told Maven to execute a series of sequence steps until it reached the lifecycle. As a side-effect of this journey through the lifecycle, Maven executed a number of default plugin goals which did things like compile and create a JAR.

What About Ivy?
Right, so someone like Steve Loughran is going to read that comparison and call foul.  He's going to talk about how the answer completely ignores something called Ivy and the fact that Ant can reuse build logic in the more recent releases of Ant.   This is true.  If you have a bunch of smart people using Ant + antlibs + Ivy, you'll end up with a well designed build that works.   Even though, I'm very much convinced that Maven makes sense, I'd happily use Ant + Ivy with a project team that had a very sharp build engineer.    That being said, I do think you'll end up missing out on a number of valuable plugins such as the Jetty plugin and that you'll end up doing a whole bunch of work that you didn't need to do over time.
More Important than Maven vs. Ant

Is that you use a Repository Manager to keep track of software artifacts.   I'd suggest downloading Nexus.   You can use Nexus to proxy remote repositories and to provide a place for your team to deploy internal artifacts.
You have appropriate modularization of software components.   One big monolithic component rarely scales over time.  As your project develops, you'll want to have the concept of modules and sub-modules.   Maven lends itself to this approach very well.
You adopt some conventions for your build.  Even if you use Ant, you should strive to adopt some form of convention that is consistent with other projects.   When a project uses Maven, it means that anyone familiar with Maven can pick up the build and start running with it without having to fiddle with configuration just to figure out how to get the thing to compile.
Comment: Links are broken again.
Comment: I use Nebeans and Ant works by default without any tunings (Netbeans conventions?). Currently trying Maven and find it more lengthy during first builds and constantly using internet connection. Building offline is possibly impossible. This is uncomfortable.
Answer: Maven is a Framework, Ant is a Toolbox
Maven is a pre-built road car, whereas Ant is a set of car parts. With Ant you have to build your own car, but at least if you need to do any off-road driving you can build the right type of car.
To put it another way, Maven is a framework whereas Ant is a toolbox. If you're content with working within the bounds of the framework then Maven will do just fine. The problem for me was that I kept bumping into the bounds of the framework and it wouldn't let me out.
XML Verbosity
tobrien is a guy who knows a lot about Maven and I think he provided a very good, honest comparison of the two products. He compared a simple Maven pom.xml with a simple Ant build file and he made mention of how Maven projects can become more complex. I think that its worth taking a look at a comparison of a couple of files that you are more likely to see in a simple real-world project. The files below represent a single module in a multi-module build.
First, the Maven file:
<project
    xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-4_0_0.xsd">

    <parent>
        <groupId>com.mycompany</groupId>
        <artifactId>app-parent</artifactId>
        <version>1.0</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>persist</artifactId>
    <name>Persistence Layer</name>

    <dependencies>

        <dependency>
            <groupId>com.mycompany</groupId>
            <artifactId>common</artifactId>
            <scope>compile</scope>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.mycompany</groupId>
            <artifactId>domain</artifactId>
            <scope>provided</scope>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate</artifactId>
            <version>${hibernate.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>${commons-lang.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
            <version>${spring.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.dbunit</groupId>
            <artifactId>dbunit</artifactId>
            <version>2.2.3</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng.version}</version>
            <scope>test</scope>
            <classifier>jdk15</classifier>
        </dependency>

        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>${commons-dbcp.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc</artifactId>
            <version>${oracle-jdbc.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <version>${easymock.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

</project>

And the equivalent Ant file:
<project name="persist" >

    <import file="../build/common-build.xml" />

    <path id="compile.classpath.main">
        <pathelement location="${common.jar}" />
        <pathelement location="${domain.jar}" />
        <pathelement location="${hibernate.jar}" />
        <pathelement location="${commons-lang.jar}" />
        <pathelement location="${spring.jar}" />
    </path>

    <path id="compile.classpath.test">
        <pathelement location="${classes.dir.main}" />
        <pathelement location="${testng.jar}" />
        <pathelement location="${dbunit.jar}" />
        <pathelement location="${easymock.jar}" />
        <pathelement location="${commons-dbcp.jar}" />
        <pathelement location="${oracle-jdbc.jar}" />
        <path refid="compile.classpath.main" />
    </path>

    <path id="runtime.classpath.test">
        <pathelement location="${classes.dir.test}" />
        <path refid="compile.classpath.test" />
    </path>

</project>

tobrien used his example to show that Maven has built-in conventions but that doesn't necessarily mean that you end up writing less XML. I have found the opposite to be true. The pom.xml is 3 times longer than the build.xml and that is without straying from the conventions. In fact, my Maven example is shown without an extra 54 lines that were required to configure plugins. That pom.xml is for a simple project. The XML really starts to grow significantly when you start adding in extra requirements, which is not out of the ordinary for many projects.
But you have to tell Ant what to do
My Ant example above is not complete of course. We still have to define the targets used to clean, compile, test etc. These are defined in a common build file that is imported by all modules in the multi-module project. Which leads me to the point about how all this stuff has to be explicitly written in Ant whereas it is declarative in Maven.
Its true, it would save me time if I didn't have to explicitly write these Ant targets. But how much time? The common build file I use now is one that I wrote 5 years ago with only slight refinements since then. After my 2 year experiment with Maven, I pulled the old Ant build file out of the closet, dusted it off and put it back to work. For me, the cost of having to explicitly tell Ant what to do has added up to less than a week over a period of 5 years.
Complexity
The next major difference I'd like to mention is that of complexity and the real-world effect it has. Maven was built with the intention of reducing the workload of developers tasked with creating and managing build processes. In order to do this it has to be complex. Unfortunately that complexity tends to negate their intended goal.
When compared with Ant, the build guy on a Maven project will spend more time:

Reading documentation: There is much more documentation on Maven, because there is so much more you need to learn.
Educating team members: They find it easier to ask someone who knows rather than trying to find answers themselves.
Troubleshooting the build: Maven is less reliable than Ant, especially the non-core plugins. Also, Maven builds are not repeatable. If you depend on a SNAPSHOT version of a plugin, which is very likely, your build can break without you having changed anything.
Writing Maven plugins: Plugins are usually written with a specific task in mind, e.g. create a webstart bundle, which makes it more difficult to reuse them for other tasks or to combine them to achieve a goal. So you may have to write one of your own to workaround gaps in the existing plugin set.

In contrast:

Ant documentation is concise, comprehensive and all in one place.
Ant is simple. A new developer trying to learn Ant only needs to understand a few simple concepts (targets, tasks, dependencies, properties) in order to be able to figure out the rest of what they need to know.
Ant is reliable. There haven't been very many releases of Ant over the last few years because it already works.
Ant builds are repeatable because they are generally created without any external dependencies, such as online repositories, experimental third-party plugins etc.
Ant is comprehensive. Because it is a toolbox, you can combine the tools to perform almost any task you want. If you ever need to write your own custom task, it's very simple to do.

Familiarity
Another difference is that of familiarity. New developers always require time to get up to speed. Familiarity with existing products helps in that regard and Maven supporters rightly claim that this is a benefit of Maven. Of course, the flexibility of Ant means that you can create whatever conventions you like. So the convention I use is to put my source files in a directory name src/main/java. My compiled classes go into a directory named target/classes. Sounds familiar doesn't it.
I like the directory structure used by Maven. I think it makes sense. Also their build lifecycle. So I use the same conventions in my Ant builds. Not just because it makes sense but because it will be familiar to anyone who has used Maven before.
Comment: I really like how you "Stole" ideas from Maven and apply them to your Ant builds to follow common conventions and make transition easer for others.
Comment: To avoid bloat in `pom.xml`s, I generate most of them via XSLT.
Answer: Ant is mainly a build tool.
Maven is a project and dependencies management tool (which of course builds your project as well).
Ant+Ivy is a pretty good combination if you want to avoid Maven.
Comment: @Benson: It's a controversial issue. If it was the silver bullet then everyone would be using it.
Comment: This. Comparison between Ant+Ivy and Maven2 here: http://ant.apache.org/ivy/m2comparison.html
Comment: Why would you want to avoid Maven?  Maven is, in my experience, one of the few parts of java development that's pleasant.
Answer: Just to list some more differences:

Ant doesn't have formal conventions. You have to tell Ant exactly where to find the source, where to put the outputs, etc.
Ant is procedural. You have to tell Ant exactly what to do; tell it to compile, copy, then compress, etc.
Ant doesn't have a lifecycle.
Maven uses conventions. It knows where your source code is automatically, as long as you follow these conventions. You don't need to tell Maven where it is.
Maven is declarative; All you have to do is create a pom.xml file and put your source in the default directory. Maven will take care of the rest.
Maven has a lifecycle. You simply call mvn install and a series of sequence steps are executed.
Maven has intelligence about common project tasks. To run tests, simple execute mvn test, as long as the files are in the default location. In Ant, you would first have to JUnit JAR file is, then create a classpath that includes the JUnit JAR, then tell Ant where it should look for test source code, write a goal that compiles the test source and then finally execute the unit tests with JUnit.

Update:
This came from Maven: The Definitive Guide. Sorry, I totally forgot to cite it.
Comment: @vakio - I am going to guess you mean because I used "site" instead of "cite"? That was totally a bad spelling on my part and I fixed it
Comment: Was that update a pun?
Answer: Maven or Ant? is a very similar question to this one, which should help you answer your questions.
What is Maven? on the official site.
edit: For a new/greenfield project, I'd recommend using Maven: "convention over configuration" will save you a decent chunk of time in writing and setting up build and deployment scripts. When you use ant, the build script tends to grow over time in length and complexity. For existing projects, it can be hard to shoehorn their configuration/layout into the Maven system.
Comment: first link is now dead :/
Comment: Maven will save you time at the beginning of your project but over time, if you have anything other than a very simple project, the Maven scripts will become far more complicated than the Ant equivalent. For example, look at the Maven Assembly plugin.
Comment: I would argue that accomplishing what the Assembly plugin does is so much easier to do in it's Maven format (where you lay out the model of the assembly in xml format) than to do all of the manual steps in Ant, but YMMV
Comment: Hi Matt, the learning curve for the assembly plugin is much steeper than that for the Ant tar or zip task. The descriptor format is something like 150 lines long and contains a whole bunch of non-intuitive configuration options. On top of that, it doesn't work! At the point I gave up on the Assembly plugin, filtering on unpack didn't work and neither did file mode options and it couldn't fixcrlf. Not sure what you mean by "all of the manual steps in Ant". I spent about 5 minutes getting Ant to do what I couldn't get the assembly plugin to do in hours.
Answer: Maven acts as both a dependency management tool - it can be used to retrieve jars from a central repository or from a repository you set up - and as a declarative build tool. The difference between a "declarative" build tool and a more traditional one like ant or make is you configure what needs to get done, not how it gets done. For example, you can say in a maven script that a project should be packaged as a WAR file, and maven knows how to handle that.
Maven relies on conventions about how project directories are laid out in order to achieve its "declarativeness." For example, it has a convention for where to put your main code, where to put your web.xml, your unit tests, and so on, but also gives the ability to change them if you need to.
You should also keep in mind that there is a plugin for running ant commands from within maven:
http://maven.apache.org/plugins/maven-ant-plugin/
Also, maven's archetypes make getting started with a project really fast. For example, there is a Wicket archetype, which provides a maven command you run to get a whole, ready-to-run hello world-type project.
https://wicket.apache.org/start/quickstart.html
Answer: I can take a person that has never seen Ant - its build.xmls are reasonably well-written - and they can understand what is going on.  I can take that same person and show them a Maven POM and they will not have any idea what is going on.
In an engineering organization that is huge, people write about Ant files becoming large and unmanageable. I've written those types and clean Ant scripts. It's really understanding upfront what you need to do going forward and designing a set of templates that can respond to change and scale over a 3+ year period.
Unless you have a simple project, learning the Maven conventions and the Maven way about getting things done is quite a bit of work.
At the end of the day you cannot consider project startup with Ant or Maven a factor: it's really the total cost of ownership. What it takes for the organization to maintain and extend its build system over a few years is one of the main factors that must be considered.
The most important aspects of a build system are dependency management and flexibility in expressing the build recipe. It must be somewhat intuitive when done well.
Answer: I'd say it depends upon the size of your project... Personnally, I would use Maven for simple projects that need straightforward compiling, packaging and deployment. As soon as you need to do some more complicated things (many dependencies, creating mapping files...), I would switch to Ant...
Comment: I disagree.  I agree that it's good to use maven for simple projects, but I would argue that with increased complexity your benefits from using maven increase by orders of magnitude.
Comment: I disagree as well, Maven really starts to work well when you have a more complex system with many interrelated modules.   If you need to write functional tests, run reports, and deploy artifacts to a repository manager, why would you do all of that yourself with Ant?
Comment: Maven is fine for a simple project, but I had a nightmare of a time trying to do things that should be simple in a more complex project. E.g. creating a distributable package, obfuscating code, creating a webstart bundle, configuring profiles. @Benson, as your project becomes more complex, Maven becomes a ball and chain. The power and flexibility of Ant will give you greater productivity benefits than Maven. @tobrien, Ant works just fine for multi-module projects, writing functional tests etc. Configuring non-default reporting plugins in Maven is usually more verbose than the Ant equivalent.
Comment: I've just started to add maven to an existing project and I found that things doesn't work as expected. The website is built in php and it is deployed using a script. These things doesn't work smoothly in Maven, you have to make very odd things to make it work.
Answer: Maven also houses a large repository of commonly used open source projects.  During the build Maven can download these dependencies for you (as well as your dependencies dependencies :))  to make this part of building a project a little more manageable.
Comment: +1, having seen what it takes to keep the Central Maven Repository up and running, I'll have to chime in and suggest that everybody using anything like Maven and Ivy should consider installing a repository manager.

It doesn't matter which one, but I am partial to Nexus http://nexus.sonatype.org.

Differences between Ant and Maven


Which professional should I call for leak coming down the furnace exhaust flue?

Question: During heavy downpours, especially ones when windy, water would begin to trickle and drip from the outside surface of the exhaust flue in the basement. Not sure how long this has been going on since the house was just purchased recently. Should I call an HVAC or a roofing pro to take a look? Initial Googling suggests a bad rain cap, but I'd prefer someone with the correct experience to make sure it's nothing else. Also, would the white coating be an indication that this has happened before? The home inspector never mentioned anything.
Comment: Based on the information you provide one would assume that it is the flashing around the vent pipe where it exits the roof ( if the vent exits through the roof  ) So that would be a roofing matter not HVAC.  Further investigation is required to narrow down exactly where the leak is coming from then you can know how to proceed.
Answer: This is a common problem in windy areas with rain. In many cases the leak is rain getting inside the pipe and running down. Based on your photo I would say this has been happening for a long time.
I would want to call a general contractor that also does roofing because the roofing only guys may not be the best at repairing the interior damage. The cleanout looks like it is rusting through.  Water has probably been sitting in there a long time.
Answer: As Alaska Man said, call a roofer.  That b-vent likely exits the roof through a 4" flashing collar and resealing it or replacing it should not be an expensive roofing repair unless the roof is in bad shape.


How do IC's know when there is a downward or upward transition of a clock pulse?

Question: Title pretty much says it all.  But how do most IC's, micro-controllers, etc. know when a clock cycle starts a downward or upward transition from the clock source?
Comment: I have a mental exercise for you: If you have [an image of a square wave](http://i.stack.imgur.com/LykY8.png), how would you find the rising and falling edges? What mental process are you using to pin point them? Try to describe in detail how you manage to find them.
Comment: Stating the question in terms of knowledge always makes me worry that the interlocutor might be over-personifying things. On the off chance that this is going on, let me [say again](http://electronics.stackexchange.com/a/8722/1882) that the chip doesn't need to "know" it just has to be designed to to function in certain ways when that happens. The answer so far have explained how to accomplish that.
Answer: By comparing the signal in two points of time.
Given that real gates have a non-zero propagation time, this shows a simplification of such:

simulate this circuit – Schematic created using CircuitLab
At rest state, IN is low and hence the inverter output is high. This results in a low at OUT. When IN switches to high, the high reaches both the inverter and and gate within picoseconds of each other. The inverter is still outputting high at this time, so the and gate switches to outputting high. The propagation time of the inverter then elapses and its output switches low. This propagates to the and gate, which then switches low. This low-high-low transition at OUT indicates that we have detected a leading edge.
Comment: Ah, that's a nice explanation.  On a side note, I could see that kind of circuit causing issues in high-frequency applications?  Ignoring propagation delays and the speed of electricity, that bounce would never happen.  Obviously, in real-life it does.  But that makes sense.
Answer: In general they don't "know" when the clock line starts a transition- the effect takes place somewhere in the middle between valid 1 and 0 states.
The simplest circuit that starts with gates and illustrates the effect of a clock edge (rather than a level) is probably the master-slave flip-flop. The diagram below is taken from here, and I would have shown the input clock as inverted  (because it is a negative-edge-triggered JK flip-flop).

It consists of two RS (level triggered) latches with some gates.
The master is locked out from changes at the instant the clock goes low, and the current state of the master is passed to the slave, also at the falling edge of the clock. So you can consider the J and K inputs as having been 'sampled' at the  falling clock edge. If given states on the J and K inputs are present slightly before the clock edge (setup time) and slightly afterwards (hold time) they will define the output state once the clock has reached low level and things have settled out.
Note that the clock edge is required to transition the "no mans' land" between 1 and 0 fairly rapidly when the outputs Q and /Q  are part of the logic equation for J and K since they must not change during the clock transition (and should stay valid for a short time). What buys you this time is the propagation delay of the gates. This is the reason for maximum clock rise/fall time specifications- fast gates require sharper clock signals. If the input clock is not guaranteed to be a nice sharp waveform, a Schmitt trigger or just a lot of gain can clean it up.
Comment: @PhilFrost Yes, maximum rise/fall time, minimum slew rate. Thanks, will edit.
Comment: When using a master/slave arrangement, I would think one could cheaply and easily improve noise tolerance by saying that the master master latch will only capture its input while the clock input is significantly above mid-rail, and the slave will capture its input (the master's output) when the clock input is significantly below mid-rail.  I don't think I've seen that done much, but it would seem like it would allow one to eliminate all race conditions provided the clock doesn't rise or fall too fast (which could be ensured by using a simple RC delay). Such a design would be a bit different...
Comment: ...from a Schmidt trigger (if the clock is noisy, the input would need to be stable any time it was near the master-latch threshold, and output may not switch cleanly until the clock is cleanly past the slave-switch threshold, but if all devices run from a common clock, the outputs would be clean whenever anyone cared about them, even if the clock was noisy.  Any idea if such approaches are used much these days?


Minimum Group Size for Sterile Workers?

Question: Essentially, I'm planning on designing a race of sapient aliens with a sterile worker caste, but I have one big problem:
On earth, sterile workers castes are only found in groups of thousands or millions.
How can I have a group have sterile workers when it only contains 30-45 adults?
Is this even remotely possible, and, if it isn't, what is the smallest number that can sustain sterile workers?
Comment: *functionally* the males of all herd species are 99%+ "sterile", in that they will never participate in mating. It's only the bull of the herd that is effectively male, all the rest of the males are merely spares. It is no great stretch to go from "socially sterile" to "actually sterile"
Comment: There used to be ant species with only 30 to 60 members per colony if I remember correctly ("T-rex Ant"). The reason they didnt work was evolution rather than the workers not being able to sustain them. If a colony of a few tens of thousands decided to attack there just werent enough small colonies to withstand them. I would even say that you can have a single sterile worker per person. They can feed themselves and you if they work hard enough.
Answer: You are probably neglecting the size of those beings and the influence it has on the survival effort.
Sterile workers are present in insects like bees, ants and so on. They have to supply with numbers to their small size.
On the other hand, for a human sized creature, a few tens of adults can be self sufficient. Many monasteries or monastic communities in the past had that many elements, were forcefully non reproducing (at least in theory) and were able to be self sufficient. They just relied on the outside for a continuous influx of new members, since of course they could not produce them in situ.
Answer: Make them haplodiploid
It is thought that the reason why hymnopterans (ants, bees, and wasps) are prone to developing eusocial tendencies is mostly due to a quirk in their sexual selection traits on a genetic level. Hymnopterans exhibit haplodiploidy, where unfertilized eggs develop into males and fertilized eggs develop into females. This creates an unusual situation where sisters are more closely related to each other (sharing 3/4ths of genes) than they are to their own daughters (sharing 1/2 of genes).
According to the kin selection theory of altruism, this suggests that sisters will be more prone to treat each other altruistically than any one of their own children (or, if you want to translate into human terms, it means that their "sisterly love" will tend to be stronger than "parental love").  This is in contrast to most animals, where they are around the same. It means that, while they would still prefer to reproduce themselves, they will be more likely to sacrifice their own reproductive potential for the sake of their sisters than non-haplodiploid animals would be.
Mammals are pretty firmly locked into the X-Y sex determination system, and so are not likely to go haplodiploid.  But there's no reason why that must have been the case. On an alien planet, haplodiploidy could be the norm for the clade where intelligence emerged and eusociality would be far more likely.
It is worth noting that eusociality is a spectrum, not a line. Some social hymnopterans don't have true queens, but rather gamergates - reproducing dominant females who actively keep their sisters from reproducing using chemical signals and sometimes even worker policing, destroying the eggs of their rivals and punishing the one who laid them. Bees have non-reproducing castes but multiple potential queens often exist within the same colony and may fight for dominance (notably, bees will also reproduce with multiple drones, and the children from different drones are less related to each other than children from the same drone.) And some do not exhibit eusociality at all, but are still gregarious and live within the same hive.
While there is an observed association between colony size and eusociality in insects, this is less because small groups can't be eusocial, and more because large groups can't not be eusocial.
Eusocial groups tend to grow at a linear rate, while non-eusocial groups tend to grow exponentially. This means that the food requirement of a non-eusocial group is much more pressing than that of a eusocial group. Without technologies such as farming, a non-eusocial group that does not disperse and find new territories (breaking up the colony) is likely to starve to death, while a queen can simply stop having children once the food/population ratio drops too low.
In short, there is no reason why a small group cannot have sterile workers, but you can make it more likely through haplodiploidy.
Answer: Dinoponera grandis colonies have an average size of 14-30 individuals.
Life on Earth is diverse and adapts to many different niches and situations. The Dinoponera genus took a page from the french and destroyed their nobie class. The revolution made it so that all ants are equal and able to reproduce. Then the little godless bastards saw that it is much harder to rear children when you don't have three thouaand nannies and you have to make them on top of foraging or guarding the nest.
In practice you have single moms being the chiefs of 10-30 ant households. Many of their daughters will never leave their mothers' homes to reproduce, and being a spinster is as good as being sterile. They blame the economy and the behaviour of the males.

So in your case, make it so that the reproducing individuals do not specialize in doing just that. They will have less children because of resource allocation - they just don't have the time, money and motivation to make more.
Human societies kinda work like that too. In developed countries populations are aging and shrinking because people don't prioritize making more people. But even in those places there are always communities in which women are expected to be professional mothers and nothing else (e.g.), and so you see couples with nine or ten children.
Answer: It's been a few decades since my bees escaped my bonnet, but if I recall from Basic Beekeeping 101 (aka How not to get stung to death while gathering honey), ANY freshly hatched female bee pupae could emerge as a queen if the workers provided her with large quantities of the correct food (royal jelly).
It looks like you want a species in need of more breeding females plus a much smaller number of a helpful sterile (or nearly sterile) worker caste. In this case, the method of treating the babies lets a more individually intelligent breeding female of a species decide exactly how many female eggs are raised to be able carry on the family line and how many are to be feed the correct diet to become workers.
If these queen equivalents are cabable of caring for themselves, their husband(s) (who may not be around, depending on how closely the bee analogy is followed) and their offspring, the absolute  minimum number of workers needed is zero. You could just have a queen and a few young daughters not yet ready to mate taking care of some eggs.
Of course, a busy queen has a lot to do, so most would probably want a few workers to help around the house and some more to go out and gather pollen, or paychecks if that's how your planned world works.
Answer: If I understood correctly by small groups you mean small group of workers (slaves) for a wealthy family, something like a constant slave trade would work. A big company produces them using in vitro fertilisation and sells the embryos to be raised in vitro where they are needed. Or they could be produced the in the style of Brave New World.

Minimum Group Size for Sterile Workers?


Using CiviCRM version number as a tag

Question: I notice some question askers have been using the version number as a tag (e.g. 4.6.2) -- is that recommended, or is it better to just list it in the question itself?
Answer: Generally, we tag items to take advantage of search and favorites functionality. You set favorite tags, and questions with any of those tags will appear highlighted as you browse the site. You can also set up RSS or email feeds to get notified of new questions matching your favorite tags. I don't think a version number is super-useful when I am searching for things to answer; if I'm searching or asking a question, I would narrow down my search using tags that reference functional areas, before I would search by version.
Comment: I agree. If I'm editing posts that have version tags I will remove them going forward.
Answer: I agree with Nicholai it doesn't seem like a great use of tags. A question tagged 4.4 might well be (probably is) still relevant to versions 4.6 and later.

Using CiviCRM version number as a tag


Exclude URL in Google search console will affect the site performance and ranking?

Question: In my search console number of excluded url is greater than number of valid url. In large number of excluded url will affect the site ranking?
Answer: That depends, but yes, most probably.
Any value those pages have towards your website's overall performance will be excluded by Google. Their inherent keywords and content, internal links to and from those pages, and (most importantly) inbound links to your site targeting those pages would all be discounted by Google's ranking of your website.
Conversely, any negative SEO practices (duplicate content, keyword stuffing, etc), would be also discounted. However, any malicious content (malware) contained on these pages would still trigger a warning and possible exclusion of your entire website from the index.
Answer: Having lots of pages that Google doesn't want to index won't usually hurt the pages that Google does want to index. It is usually caused by one of the following:

Your site has lots of pages and little reputation.   As your site gains reputation, Google will be willing to index more pages from your site.  See Why aren't search engines indexing my content?
Your site has lots of duplication.  When you internally duplicate content between URLs, Google chooses one to index and excludes the duplicates.  See What is duplicate content and how can I avoid being penalized for it on my site?
Your site has low quality pages.   If your pages are thin, poorly written, not well received by users, scraped, or spammy; Google will choose not to index them and they could hurt the other pages on your site.


Invariance of inner product under Poincaré transformation

Question: The Poincare transformation reads,
$$x\rightarrow x^\prime=\Lambda x +a $$
The scalar product is preserved under Lorentz transformation. However I do not see how it is preserved under the more general Poincare transformation,
\begin{align}
x^T\eta x\rightarrow {x^{\prime}}^T\eta x^{\prime}&=\left(\Lambda x +a\right)^T\eta\left(\Lambda x +a\right)\\
&=\left(x^T\Lambda^T+a^T\right)\eta\left(\Lambda x +a\right)\\
&=x^T\Lambda^T\eta\Lambda x+a^T\eta\Lambda x+x^T\Lambda^T\eta a+a^T\eta a\\
&=x^T\eta x+a^T\eta\Lambda x+x^T\Lambda^T\eta a+a^T\eta a
\end{align}
I don't know what to do with the rest of the terms. I will also have to show that the scalar product $$u^\mu A_{\mu},$$ where $u^\mu$ is the four velocity and $A_{\mu}$ is the vector gauge potential, is invariant under Poincare transformations. Basically I am trying piece by piece to show that the charged particle in a Electromagnetic field is invariant under Poincare transformations,
$$\int \left(-m +eA_{\mu}u^\mu\right)d\tau-\int d^4x\frac{1}{4}\left(F_{\mu\nu}F^{\mu\nu}\right)$$
Comment: It's not. Like the inner product of two position vectors under Galielean transformation. You should look at displacement, or any derivative of the position, not at the position itself
Answer: The quantity $x^{2} = x^{\mu}x_{\mu}$ is Lorentz invariant but not Poincar'{e} as you have clearly shown. However, the four velocity is defined by the derivative $u^{\mu} = \frac{dx^{\mu}}{d\tau}$ and hence, under $x' = \Lambda x + a$, we have $u' = \Lambda u$. Now, it is easy to see why $u^{\mu}A_{\mu}$ is Poincare invariant using $u'=\Lambda u$ and $A'_{\mu}(x') = \Lambda_{\mu}^{\nu}A_{\nu}(x)$.
Comment: I don't understand this: why is $A_{\mu}(x^\prime)=\Lambda^{\,\,\,\nu}_\mu A_\nu(x)$? Shouldn't this be something like: $A_\mu^\prime(x^\prime)=\Lambda^{\,\,\,\nu}_\mu A_\nu(\Lambda x+a)+a_\mu$? Sorry, but I am a very confused soul! Please explain this a bit further.
Comment: Sorry, I think I made a typo earlier. It's now corrected. No, there won't be any extra $a_{\mu}$ term. For example, think of a scalar field $\phi(x)$. If one performs a translation $x'=x+a$ then we have $\phi'(x')=\phi(x)$ or $\phi'(x) = \phi(x) - a^{\mu}\partial_{\mu}\phi(x)$ (if $a$ is infiniitesimal). The same idea applies for the vector field $A_{\mu}(x)$ but since it is a vector under Lorentz transformation, it picks up a $\Lambda$ term.
Comment: Okay! I see. The key thing to understand is then $A_{\mu}$ is a vector under Lorentz transformations and not the whole Poincare transformation. I was working under a wrong impression then.
Answer: Lets look at the displacement vector with the components explicitly written out as $\Delta s = (x^\mu - 0^\mu)$. Under a full Poincare transformation, this coordinate difference would transform as $\Delta s^{´} = (\Lambda x^\mu+a^\mu - (\Lambda 0^\mu+a^\mu))$, and the invariance of the inner product for 4 - vectors would then follow from invariance under homogenous Lorentz transformations.


Simple Harmonic Motion Derivatives, and the equation

Question: If the velocity time graph of a SHM is the derivative of the Distance time graph, and the kinetic energy of the mass in the SHM is maximum when the displacement is 0, how can the maximum velocity be Amplitude* angular velocity?
Comment: Take the derivative of position equation and you see that the maximum of velocity is amplitude of position times the frequency which could be considered as the angular velocity.
Answer: This relationship comes from Hooke's Law and the maximum amount of energy that can be stored in a spring.  From Hooke's law, $$F=-kx$$  we know that the frequency of oscillation is given by $$\omega = \sqrt{\frac{k}{m}}$$  We also know that the maximum amount of energy that can be stored in a spring is when the spring is stretched fully to its amplitude, and is given by $$U = \frac{1}{2}kA^2$$ where $A$ is the amplitude.  When the displacement is zero, the velocity of the mass is maximum, and all of the springs potential energy is converted into kinetic energy, which leaves us with $$\frac{1}{2}kA^2 = \frac{1}{2}mv_{max}^2$$
and thus
$$v_{max}^2 = A^2\frac{k}{m} = A^2\omega^2$$
and therefore
$$v_{max} = A\omega$$
As Amin R. points out, this result is the same as the result of taking the derivative of the position function:
$$v(t) = \frac{d}{dt}A\sin(\omega t + \phi) = A\omega \cos(\omega t+\phi)$$
and $v(t)$ is maximum when $\cos(\omega t + \phi) = 1$