Reply To: Q& A from the chat

Home Forums Basic Erlang Q& A from the chat Reply To: Q& A from the chat


Jan Kowalski (bulwersator): How can I check whatever something fulfils two conditions? Something like fun(X) -> X rem 13 =:= 0, X rem 3 =:= 0 end – but with AND operator, not OR. Sorry for stupid question.

Maruthavanan Subbarayan (maruthavanan): for AND you have “andalso” keyword and for OR you have orelse keywords example

Denis Kononenko (chaos): How to use -extends directive?

2013/12/11 [16:09:23] Tomasz Kowal: It is better not to use it at all:

rastin rastini (rastinrastini): what must do if dont use extend?

Tee Teoh (tteoh): use a process. every problem in Erlang can be solved by another process :D

Lili Bumbum (_flipout): Hey Guys, I have got a curious problem, I am able to ping from an erlang node a java node but not the otherway round
may someone please enlight me

Mattias Jansson (mattias): is it on the same machine?
Lili Bumbum (_flipout): yes
rpc fails aswell
it seems that I am only able to contact from erlang but not from java
if I open another shell and try to contact the master node it works
erlang erlang works, erlang java works, but java erlang not

Mattias Jansson (mattias): what’s the code for creating the OtpNode instance?

Lili Bumbum (_flipout): mom
_node = new OtpNode(_node_name, “cookie”);_mbox = _node.createMbox(“do”);
just creating a node and a mailbox
I can receive messages
I didn’t try to response yet, because the initial contact has to be made by the java node

Mattias Jansson (mattias): and, “cookie”); returns false?

Lili Bumbum (_flipout): I am pining without cookie

Mattias Jansson (mattias): oh. right. ofcourse

Lili Bumbum (_flipout): since the cookie is already in the node
its false
the otherway round works fine

Mattias Jansson (mattias): what is the timeout?

Lili Bumbum (_flipout): 2000
rpc call fails as well
ahhh I might have an idea
the rcp fails with
wait i have to test it mom<
btw thanks for helping me

Mattias Jansson (mattias): np. but tell me if you find the answer ;)

Lili Bumbum (_flipout): dont go away<
the Nameserver cannot find the node on the server

Mattias Jansson (mattias): oh
try long names
erl -name “erl_node@″ -setcookie cookie
_node = new OtpNode(“otp_node@″, “cookie”);
_node = new OtpNode(“java_node@″, “cookie”);“erl_node@″, 2000);
“The constructors for the OtpNode classes will create names exactly as you provide them as long as the name contains ‘@’. If the string you provide contains no ‘@’, it will be treated as an alivename and the name of the local host will be appended, resulting in a shortname.”

Lili Bumbum (_flipout): ok< Nameserver not responding on fed when looking up master
here is the test code

Mattias Jansson (mattias): replace “fed” by a real IP. should be fine for now

Lili Bumbum (_flipout): its working I replaced -sname with -name and used a real ip and it worked

Mattias Jansson (mattias): nice!

Lili Bumbum (_flipout): do you know the reason why exactly the one sees the other but the other doesnt?
thanks a lot
Mattias Jansson (mattias): the thing is
the Java machine seems to need a real DNS to look up the address of the host name but if you use ip-adresses it’s not needed

Lili Bumbum (_flipout): good to know, again thanks!