How to Query Ejabberd for Version

Send this:

<iq type="get" to="localhost">
  <query xmlns="jabber:iq:version"/>
</iq>

Receive this back:

<iq xmlns="jabber:client" from="localhost" to="bob@localhost/2943672495139718417282263" type="result">
  <query xmlns="jabber:iq:version">
    <name>ejabberd</name>
    <version>community</version>
    <os>unix/darwin 13.0.0</os>
  </query>
</iq>

Tail Recursion in Erlang

Suppose we have a try-catch block in Erlang as follows:

try Expression of
  SuccessfulPattern1 [Guards] ->
    Expression1;
  SuccessfulPattern2 [Guards] ->
    Expression2
catch
  TypeOfError:ExceptionPattern1 ->
    Expression3;
  TypeOfError:ExceptionPattern2 ->
    Expression4
end.

It’s important to remember that the protected part of the exception (that is, what is between try .. of, or in this case, Expression) must not be tail-recursive(!) The VM must always keep a reference there in case there’s an exception popping up.

Since a try .. catch block without the of term is nothing but protected code, calling a recursive function from here might be dangerous – especially if your code is supposed to run for a long time (as Erlang is designed to do).

Any recursive calls you want to make should be put between the of and catch terms.

FIX Protocol

FIX is a financial interchange protocol. Tutorials for it are terse. 

The following are some sample FIX messages, and what they mean:

Heartbeat

8=FIX.4.2|9=42|35=0|49=A|56=B|34=12|52=20100304-07:59:30|10=185|

Tag Field Value Description
8 BeginString FIX.4.2  
9 BodyLength 42  
35 MsgType 0 Heartbeat
49 SenderCompID A  
56 TargetCompID B  
34 MsgSeqNum 12  
52 SendingTime 20100304-07:59:30  
10 CheckSum 185