Tuesday May 31, 2011

[Time] NameMessage
[07:56] koral hi
[07:57] koral is there a way to use the OMQ library in a linux shell ?
[07:58] th zmq_push () { m=$(cat) && echo -e $(printf '\\x01\\x00\\x%02x\\x00%s' $((1 + ${#m})) "$m") | nc -q1 $@; }
[07:58] th like that?
[07:59] th see mailing list 2011-05-06 "Smallest 0MQ stack ever"
[07:59] koral I wish I had a linux environment right now to test it
[08:00] koral however, I can't understand what you wrote
[08:00] koral you're defining a new shell function, right ?
[08:00] th the above defines a shell function, yes.
[08:01] th but i'm not the author. i just remembered reading that on the mailing-list
[08:01] th and pasted for you
[08:01] koral thank you then, I'll investigate on it and come back to bother you again :)
[08:03] koral ^^ I just found the post you mentioned
[08:03] koral there is NO explanation
[08:05] th correct.
[08:06] th basically it takes stdin with m=$(cat) then prints parts of the wire-format with that printf, then it adds 1 to the length of the initial message (now in $m); then netcat is used to do the real pushing to the net
[08:07] th the ${#m}+1 is used as a printf argument btw
[08:07] koral so it only aims at pushing something to the net
[08:07] koral what if I want to monitor a publisher ?
[08:08] koral isn't there a versatile tool ?
[08:08] th koral: none i know
[08:08] th koral: the function above just pushes
[08:10] koral I'll then have to implement it myself for my application
[08:10] koral which I'd like to monitor
[08:10] th well - why not use pythong?
[08:10] th s/ong/on/
[08:11] th why do you need it implemented in shell?
[08:11] koral oh I don't need it implemented in shell actually
[08:11] koral I just need something I can call from shell
[08:11] th then just use the python bindings
[08:11] th koral: you can call _everything_ from shell
[08:12] koral th: as soon as a dedicated tool to perform the job exists
[08:12] koral I'm looking for such a tool, not for a binding
[08:12] jsimmons why do you need a dedicated tool?
[08:12] th "I just need something I can call from shell" ;-)
[08:12] koral well, why do people need socat ?
[08:12] th koral: such a tool would probably be a 5-liner in python
[08:12] jsimmons i dunno why do they need socat?
[08:13] th depending on your needs
[08:13] th koral: if i would want to debug such stuff, i'd just drop into the python shell import zmq and so on
[08:13] koral jsimmons: because you often want to monitor a socket while developing an application
[08:14] jsimmons you can do that with any of the language bindings though, hell it'd only be a few lines of C
[08:14] koral th: I'm fine with python binding; the thing is: if such a tool already exists, it's better than if I make it myself since I'm a beginner in using zeromq
[08:15] jsimmons a zmq debug device would be cool i suppose
[08:16] th koral: i think exactly _because_ you are a beginner it is a good idea to do the 5-liner instead of using a ready tool
[08:16] koral jsimmons: and socat is that bunch of few lines of C :)
[08:21] koral th: well, I will do, but I won't spend too much time on it so it won't be a generic piece of code reusable for other projects
[08:21] koral anyway
[08:21] guido_g youc could have done it the time you are talking here
[08:21] th koral: most others should probably do the 5-liner as well ;)
[08:22] koral thank you for you answers
[08:22] th koral: thanks for telling me about socat ;)
[08:22] koral th: as a member of #zeromq, you didn't know it ?
[08:23] th koral: i'm just a random visitor like you are
[08:23] guido_g it's not related to ømq
[08:23] koral well, it's related to sockets
[08:23] guido_g os sockets
[08:24] guido_g differnt thing
[08:24] th koral: python / tcp{flow,cat} / netcat / wireshark was good enough for me for the time being
[08:24] guido_g ømq uses a specific wire protocol
[08:25] koral guido_g: yes of course, I only meant that I expected someone to know the bad level before knowing the high level
[08:25] koral -bad + low
[08:26] guido_g you expect a lot
[08:26] koral I guess
[08:34] th i think it's easier to approach from the high level and go down as low as necessary
[08:35] koral you're right
[08:35] th the higher the easier. i heared about schools teaching programming by moving some graphical blocks around and connecting them with arrows.... *shiver*
[08:35] koral but as a matter of fact, I first used os sockets, and then I was looking for something more convenient
[08:50] th koral: yea - i knew lower level stuff before 0mq as well.. probably most of the 0mq users
[10:29] evax mile: I'm here if you need
[10:29] mile evax, cool :)
[10:30] mile I'm wondering about active/passive receive in erlzmq
[10:30] mile if I do erlzmq:recv(S) in a loop
[10:30] mile is that active or passive?
[10:33] evax mile: passive
[10:33] evax active would be that you receive directly to your process mailbox
[10:33] mile ok, now I get it :)
[10:34] mile according to the benchmarks, passive was the faster way
[10:34] mile I wanted to make sure I am actually using it
[10:35] evax benchmarks indeed show passive is generally the best except for very big messages
[10:36] evax (for throughput, passive is always the best latency-wise)
[10:36] mile I have measured up to 1kb, passive was a clear winner
[10:36] evax big messages would be > 32kb
[10:39] mile ok, that is a bit bigger
[12:38] CIA-31 libzmq: 03Martin Sustrik 07bidi-pipes * ra24a7c1 10/ (4 files): Session termination induced by socket fixed ...
[14:23] CIA-31 libzmq: 03Martin Sustrik 07bidi-pipes * ree7313b 10/ (src/xpub.cpp src/xpub.hpp): Subscriptions are processed immediately in XPUB socket ...
[19:15] k3n5h1n I cannot use zmq on ubuntu with g++
[19:15] k3n5h1n i followed all the steps on the website
[19:15] k3n5h1n it cant find the zmq header file
[19:16] k3n5h1n any suggestions?
[19:35] k3n5h1n oh never mind
[19:35] k3n5h1n had to use -lzmq as a switch with g++ :)
[20:01] k3n5h1n i get: terminate called after throwing an instance of 'zmq::error_t' after running Hello-World server
[20:10] sustrik what's the error?
[20:10] sustrik ah
[20:10] sustrik that's C++ runtime warning you about unhandled exception
[20:14] Toba gdb it for a backtrace.
[20:14] Toba check the num() on the error_t acter catching it byref.
[20:14] Toba *after
[20:17] k3n5h1n or may be this had to do something with localhost?
[20:17] k3n5h1n er, i dont know how to use gdb
[20:18] k3n5h1n its the simple helloworld server from the zmq site
[20:18] k3n5h1n used - tcp://localhost:5555
[20:19] k3n5h1n and also - tcp://
[20:19] k3n5h1n but doesnt work
[20:19] k3n5h1n i have wireless enabled on the laptop(if thats the problem)
[20:20] k3n5h1n i ran the same code on Win this morning and it ran fine
[20:20] k3n5h1n used tcp://*:5555
[20:21] Toba if you don't know how to use a debugger I suggest learning how to use a debugger and then coming back for help once you have :)
[20:21] Toba sadly, this world is made up of tools that you need to understand in order to get things done.
[20:21] k3n5h1n :D
[20:21] k3n5h1n great!
[20:22] k3n5h1n ok. will learn how to use a debugger in linux and then come back with the results.
[20:23] Toba running the program in gdb and then using the 'bt' command when it crashes are key.
[20:24] k3n5h1n ok. was what i looked at. But did not understand what the op did.
[20:24] k3n5h1n anyway. will look into gdb.
[20:24] k3n5h1n thanks.
[20:32] k3n5h1n i ran backtrace using gdb
[20:33] Toba did you learn wisdom
[20:33] k3n5h1n and seems that exception was thrown while creating context_t object
[20:33] k3n5h1n umm, not sure :)
[20:33] k3n5h1n but will
[20:35] Toba oh my.
[20:35] Toba what arg did you give it?
[20:35] Toba any? I suggest 1 as an arg to that constructor if you don't know what else to do
[20:35] k3n5h1n zmq::context_t context(1);
[20:35] Toba hrm.
[20:35] k3n5h1n ^^thats what i did
[20:35] Toba did you link with pthread
[20:35] k3n5h1n umm, nope.
[20:36] k3n5h1n i have to?
[20:36] Toba well, yes.
[20:36] Toba if you want to make it work, I mean.
[20:36] Toba -lpthread :)
[20:36] k3n5h1n and include pthread.h too?
[20:37] Toba you shouldn't have to do that.
[20:37] Toba I'm surprised it built without -lpthread.
[20:37] Toba what platform?
[20:37] k3n5h1n ubuntu
[20:37] k3n5h1n g++ 4.5.1
[20:38] k3n5h1n *ubuntu 10.10
[20:38] k3n5h1n yes it built without -lpthread and without including pthread.h
[20:39] Toba add lpthread.
[20:39] k3n5h1n added. Same error.
[20:39] k3n5h1n (right after you told me :)
[20:40] k3n5h1n g++ -lzmq -lpthread HelloWorldServer.c++ -o HelloWorldServer
[20:40] Toba well, I've exhausted my quota of helping strangers for today, good luck :)
[20:40] k3n5h1n hahahaha
[20:40] k3n5h1n awww common
[20:40] k3n5h1n not so early
[20:40] k3n5h1n :)
[20:41] k3n5h1n Windows is so easy
[20:42] Toba well, the debugger helps those who help themselves.
[20:43] Toba you may have mistaken me for someone who has any obligation to assist :)
[20:44] k3n5h1n wish the debugger was VS in Linux :)
[20:45] k3n5h1n oh no. not at all. I am thankful for your help.
[20:45] k3n5h1n *VS debugger
[20:46] Toba I've heard the vs debugger is mad sexy.
[20:47] k3n5h1n yes. very. :)
[20:52] k3n5h1n should check the API.
[20:53] Toba always check the API.
[20:54] k3n5h1n hmm. Told that to myself after i wrote that :|
[20:57] k3n5h1n i think i'll uninstall zmq and reinstall it.
[20:58] k3n5h1n because i also installed libzmq0 and the dependencies from synaptic.
[20:58] k3n5h1n i dont know if thats the reason(version incompatibility or something)
[21:00] k3n5h1n lol
[21:00] k3n5h1n :D
[21:00] k3n5h1n it worked
[21:01] k3n5h1n hahahahaha
[21:01] k3n5h1n wow
[21:02] k3n5h1n will someone put this on the zmq site please?
[21:02] Toba did you try rebooting
[21:02] Toba ;D
[21:02] k3n5h1n no.
[21:02] k3n5h1n just removed those packages and ran the compiler :)
[21:02] k3n5h1n voila!
[21:05] k3n5h1n hope zedshaw is not reading this :)
[21:05] Toba unless you fill his github account with dicks you'll probably be fine.
[21:06] k3n5h1n :D