Make heartmonitor.Heart monitorable

If a mon_addr is given, send any ping to this zmq socket. This can be
used to monitor the heartbeat on the engine side to check if the cluster
controller is still active.

Also correct the code on __main__ to work (for testing purpose).

Signed-off-by: Jan Schulz <jasc@gmx.net>
Monitor the heartbeat of the cluster controller

Monitor the heartbeat pings from the cluster controller every few
seconds (default = 5sec) and shutdown the engine if too many (default=5)
heartbeats were missing.

Signed-off-by: Jan Schulz <jasc@gmx.net>
remove old debugging code
Change initial values of monitor states for Py3 compatibility
Change types of some config items and adjust code accordingly

Use Integer and Float instead of CInt and CFloat (per MinRK)
Use ms instead of seconds for check period as the "HeartMonitor.period"
also uses ms.

Signed-off-by: Jan Schulz <jasc@gmx.net>
Allow the user to interact with link anchors in the qtconsole

Since the qtconsole can display hyperlinks, it would be useful
to allow interacting with them.

This adds showing a tooltip when the mouse is over a link.
The tooltip code stores the anchor in ConsoleWidget._anchor,
so when the user right-clicks to select the context menu for
"Open Link" or "Copy Link Address", it uses the text that was
displayed and not whats under the current context menu pointer
location.

Also storing the anchor allows me to check to see if we've
already displayed that anchor on a new mouseMoveEvent so the
tooltip doesn't keep getting redrawn.
Test _anchor tracking in response to mouseMoveEvent Messages

Test the _anchor updating for implementing qtconsole clickable links.
Move mouse move handling to ConsoleWidget.eventFilter

Bradly Froehle pointed out my original implementation broke selecting
text and suggested moving the link tooltip handling to eventFilter.

The current version doesn't report that it handled the mouse move
message, I think this may be better as in addition to showing
the tool tip you can still select text inside the linkable object.

(Its always been a problem to select some chunk of link text in
gnome-terminal as their link handling overrides the other mouse
selecting functionality)
Merge remote-tracking branch 'upstream/master' into clickable-links
Update ConsoleWidget anchor handling test code.

The test code wasn't updated to test the eventFilter based implementation.
partial refactor, can't quite get environments working
correct environment rendering
added math typesetting example notebook
Refactored to JS standards.  Fixed Attribution.

thisStyle      --> this_style.
function foo() --> var foo = function()

StackExchange improperly attributed for Davide Cervone's
Markdown+MathJax handling.  This has been fixed.

Ref:
http://stackoverflow.com/a/11231030/122022
http://www.math.union.edu/~dpvc/transfer/mathjax/mathjax-editing.js
Add the heartbeat period to the registration reply

The heartbeat period can then be used to set the check period on the
engine side.
Rework the heartbeat checking (configureable, period from hub)

Make the new heartbeat monitor checks configureable.

Also use the heartbeat monitor period from the hub as the
value for the check period. This way you don't need to ensure
that the period on the engine side is bigger than on the hub side.
Run code only when monitoring is enabled

Setting up the monitor sockets is only usefull when actully using
heartbeat monitoring, so only run it in that case.
Add deprecation warnings for sympyprinting

The sympyprinting extension has been moved to SymPy as of version 0.7.2.
For versions containing the new extension, print a deprecation warning
and load the extension from SymPy.
add missing 'qtconsole' extras_require

The docs mention `easy_install ipython[qtconsole]`, but that would fail. The alternative would be to change the docs, but then we would have no expression of the pygments optional dependency.

should be back ported to 0.13.1
Enable heartbeat montoring on default

With the change, the heartbeat monitor will kill the engine after
50 missed heartbeats (~150 secs under the default config).