dark_light changed the topic of #ocaml to: OCaml 3.09.2 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
asbeta has quit []
<Smerdyakov> youknow365, active active active!
shawn has quit [Connection timed out]
hikozaemon has joined #ocaml
jcreigh has joined #ocaml
DRMacIver` has joined #ocaml
shawn has joined #ocaml
DRMacIver has quit [Read error: 110 (Connection timed out)]
DRMacIver` is now known as DRMacIver
jcreigh has quit ["Cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet."]
Shimei has joined #ocaml
Jessehk has joined #ocaml
<Jessehk> I apologise for asking a stupid question, but if I've written a function in an *.ml file, how do I call it in interactive ocaml?
<youknow365> Smerdyakov: lol
Jessehk has quit ["Ex-Chat"]
Smerdyakov has quit ["Leaving"]
jcreigh has joined #ocaml
jcreigh has quit ["Cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet."]
pstickne has joined #ocaml
<pstickne> hello
typecheck has joined #ocaml
dark_light has quit ["Ex-Chat"]
shawn has quit ["This computer has gone to sleep"]
zmdkrbou has quit [Remote closed the connection]
shawn has joined #ocaml
hikozaemon has quit ["Leaving..."]
ulfdoz has quit [Read error: 54 (Connection reset by peer)]
ulfdoz has joined #ocaml
zmdkrbou has joined #ocaml
shekmalhen has joined #ocaml
revision17_ has joined #ocaml
Revision17 has quit [Read error: 110 (Connection timed out)]
<flux__> funny.. I have a threaded ocaml-program that for apparently no reason exits sometimes
<flux__> that is, the only way to exit should be either via an exception handler or by the normal route, both of which produce output
<flux__> but that output never appears
<flux__> sometimes it keeps running for weeks, sometimes only for less than a day
<flux__> it might have got something to do with establishing tcp-connections in a non-blocking fashion..
ulfdoz has quit ["deprecated"]
shekmalh1n has joined #ocaml
shekmalhen has quit [Read error: 110 (Connection timed out)]
shekmalhen has joined #ocaml
shekmalh1n has quit [Read error: 110 (Connection timed out)]
shekmalh1n has joined #ocaml
d-bug has joined #ocaml
shekmalhen has quit [Read error: 110 (Connection timed out)]
shekmalh2n has joined #ocaml
shekmalh1n has quit [Read error: 110 (Connection timed out)]
<youknow365> how difficult is it to make ocaml bindings for a small C library ?
<flux__> not very difficult
<flux__> quite easy infact if all your functions don't deal with sym types or records
<flux__> and even then it isn't that difficult
<flux__> I guess it mostly depends on your C-skills
<youknow365> i have so so C skills but this Ocaml stuff is really new to me
<youknow365> flux__: i am making an im client in Ocaml, i am going to use LablGTK2 and XMLIGHT and i am going to write A jabber Library
<flux__> youknow365, what do you need custom c-library bindings for?
<flux__> xmlight?
<youknow365> xmlight is a native ocaml lib
<youknow365> i dont need a C library right now ...........but in the future i might want to make some
<youknow365> is it also modertely easy to bind a c++ library ?
<flux__> well, binding c++ is not very easy to any language
<flux__> there is a binding generator (I don't recall the name now) that covers c++ too, though
<youknow365> yea
<flux__> otherwise you can do it the traditional way one uses when interfacing c++ libraries with c..
<youknow365> is there any speed loss in using bindings ?
<flux__> infact now that I think of the c++ binding generator, it also boosted a language extension which made it quite convenient to use those c++ functions
<youknow365> or is it still fast ?
<flux__> obviously some loss of speed occurs when the call is made
<flux__> but unless the function does something trivial and is called a lot, I don't think that's anything to worry about
<youknow365> yes
<youknow365> well like for instnace using GTK with C vs LablGTK
<flux__> gtk is very high level library
<youknow365> i was reading and it was saying ocaml is the 2nd fastest language
<flux__> so a single call will make lots of things
<youknow365> faster then c++
<youknow365> yea
<youknow365> theres just not to much info about ocaml around
<youknow365> and that jabbr library
<youknow365> the author site is down and i swear all they have in the internet is FreeBSD versions and i have that and i extraced all the files out of it and stuff but the documentation is very advanced and he has no examples or anything like that
<youknow365> i also might use Ocaml and SDL for a game i have in mind
ld has joined #ocaml
<ld> hi, if I need to do binary stuff like read an integer on 24 bits from a binary file, is there anything in ocaml that can help me do that?
<ld> (or a library?)
ld has quit []
Smerdyakov has joined #ocaml
<youknow365> i would still like to know if anyone has the Jabbr lib for Ocaml the sources or something
<youknow365> i see no documentation on how to do networking on ocaml at all
<flux__> with jabber or in general?
<flux__> well, it is true that ocaml expects one to know the (C) sockets interface, but after that, it's trivial (basically 1:1 mapping from C to Ocaml)
<youknow365> just networking in general
<youknow365> i cant find anything on it
<youknow365> my app needs to hold a persisent connection to the jabber server of course
<youknow365> flux__: and http://www.ocaml-programming.de/programming/netclient.html is the closest librry kind of thing i have found
<youknow365> but where can i find info on how to do regualr networking tcp udp all that kind of stuff ?
<flux__> youknow365, well, you have done some C. on linux? info libc, m sockets - it's basically the same on ocaml
<youknow365> no networking in C no
<youknow365> i have used C for many things but not networking
<flux__> the gnu libc info pages cover that topic nicely
<youknow365> i have only used things like perl and python for netwroking
<flux__> well perl has a similar api too
<flux__> but I'm not sure if you've used that
<youknow365> i seeeeee
<flux__> or some additional library
<youknow365> i mean is it trivial working with sockets ?
<youknow365> or is it moderately easy once you knwo how ?
<flux__> well, it has its issues ;)
<flux__> I'd say that's more accurate
<youknow365> grrrrrr
<youknow365> i mean
<youknow365> i just need to make connections to the jabber server
<flux__> and only one connection I take it?
<youknow365> yes
<youknow365> jabber works you jsut set a port and you send packets(xml messages)
<youknow365> and you listen for incoming packets and parse them
<youknow365> and display in the im window of course
<youknow365> so yea i havent done much networking stuff except from perl php python ruby but im determined to get this done ...... I neeeed it really bad
<flux__> basically it goes like (for clients): first you create socket in address family AF_INET, of type SOCK_STREAM, the you connect it to an address (ADDR_INET (((gethostbyname "foo.com").h_addr_list.(0)), port)
<flux__> and then write and read stuff from it
<flux__> while being aware that a read might return less bytes than you asked for
<youknow365> :\
<youknow365> looks like i am going to have some learning :P
<flux__> yes, it's fun to learn :-)
<youknow365> yea i like learning ........only if i can find material
<youknow365> but give me some adivce here so
<youknow365> all i need is a very small IM clinet written in Ocaml and i am going to use LablGTK 2
<youknow365> this is for my bussiness for users to talk to one another ..........it will work very well
<flux__> well, the IM-part will be very separate from the LablGTK2-part
<youknow365> i messed with lablgtk2 for a few hours ..........seems to work fine
<flux__> so you can write your module and test it with a toplevel
<youknow365> im jus saying ;) so wait
bzzbzz has joined #ocaml
<flux__> and then "just" connect it to lablgtk2
<youknow365> so the way jabber works is you send and recieve XML
<flux__> I personally have done almost no lablgtk2-stuff
<youknow365> yea
<youknow365> so when reciving XML you need to parse the packet
<youknow365> i founda small xml parser called XML LIGHT for ocaml that will do just that write and parse xml into a datastructure
<youknow365> so all i need is to get 1 connection working that can send packets and listen for ones and then incoming packets can be parsed for server messages .......im messages etc
<youknow365> when they log in the buddy roster is then caculated and sent on the connection
<youknow365> and then displayed in some form of a LIST
<youknow365> then theres some GTK stuff to do for user activity
<youknow365> flux__: sounds very easy and is in interpreted lang .......but i feel if u use ocaml and when i get this done it will be much better
<youknow365> and i think ocaml will be easier then C once i get it done
superjud1e has joined #ocaml
<youknow365> also if i do this can this be portable to Windows
superjudge has quit [Read error: 110 (Connection timed out)]
<flux__> I don't have experience on that, but I believe it can
<youknow365> flux__: i am still lost with the whole sockets in Ocaml ..........i have saw how its done in C
<youknow365> looks failry simple
<flux__> start toplevel
<flux__> #load "unix.cma";;
<flux__> open Unix;;
<flux__> and start testing :-)
<youknow365> is there any documentation on sockets for ocaml anywehrre ?
<flux__> like, let s = socket AF_INET SOCK_STREAM 0
<flux__> not as such, but there is the documentation on the Unix-module
<youknow365> i am suprised there is nothing on sockets
<youknow365> looks like it could take 3 weeks to just get a working socket
<flux__> maybe there's a tutorial on the web that covers it (although maybe not, because I did a quick google on it and didn't find anything relevant)
<youknow365> i mean i looked at it in C and it loosk failry simple
<youknow365> is ocaml code usually shorter then C code ?
<flux__> yes
<youknow365> theres a simply client in C
<youknow365> a simple
<flux__> well, you could try converting that into ocaml
<flux__> you don't need htons
<youknow365> dammit
<flux__> or bcopy-stuff
<flux__> (actually I referred to that h_addr_list earlier)
<youknow365> this is such a switch from like python
<flux__> so python has a nice networking library?
<youknow365> well python you can send info to a socket in a matter of 4 lines
<youknow365> bnuut python is interpreted
<youknow365> so i guess theres a trade off
<flux__> so you said you had looked into some ocaml libraries?
<Smerdyakov> youknow365, it takes four lines to do a socket send in Python?
<flux__> I think, without error checking, it's not much more in ocaml, if not infact four?
<flux__> but they are not very simple lines..
<youknow365> Smerdyakov: well a tad more but not as many as this
<Smerdyakov> youknow365, I mean that four lines it too many!
<Smerdyakov> youknow365, it should only be one.
<youknow365> welll
<youknow365> depends on what you are doing :P
<Smerdyakov> I said, a socket send..
<youknow365> i havent used python in a little while and jus really breifly looked over networking
<youknow365> ruby is 2 lines
<youknow365> but damn
<youknow365> this is becoming super hard for me
<flux__> let _ = let s = socket AF_INET SOCK_STREAM 0 in let _ = connect s (ADDR_INET (((gethostbyname "localhost").h_addr_list.(0), 22)) in let msg = "hello" in write s msg (String.length msg)
<flux__> or something along those lines..
<Smerdyakov> Try Standard ML instead. There is a standard socket library whose types really describe completely how to use it.
<flux__> smerdyakov, does it offer something more different than a straight-forward mapping from posix sockets?
<Smerdyakov> Yes.
<youknow365> well i have time to learn
<Smerdyakov> The types distinguish listening vs. normal sockets, for instance.
<flux__> sometimes I thought phantom types could be nice for that distinction
<youknow365> what exactly is a socket ?
<youknow365> in technical terms
<Smerdyakov> flux__, that's what is done in the SML Basis Library.
* Smerdyakov disappears.
<youknow365> so ocaml is a oo version of ML
<youknow365> or add ing oo should i say
<youknow365> damn i wish this stuff was better documented
<youknow365> so s socket is a interprocess of information .......that you can bind to an address (port) right ?
descender has quit ["Why has elegance found so little following? Elegance has the disadvantage that hard work is needed to achieve it and a good e]
<flux__> I'd say it's an operating system resource, and when you acquire a socket, you get a handle of it, so you know how to refer to it.. and yes, to accept incoming connections (or establish them from a certain port) the socket must be bind into some address
<youknow365> welll
<youknow365> can sockets be used for other things besides networking ?
<youknow365> like sending info between applications
<flux__> yes
<flux__> in unix you can have 'unix domain sockets'
<flux__> which appear in the file system
<youknow365> i seeeeeee
<youknow365> flux__: look like i am in for a treat :P
<youknow365> all i have is programming knoledge of some c and interpred langs
<youknow365> typos
<youknow365> flux__: damn this seems impossible
<flux__> it is not, have faith :)
<youknow365> i wanted to have a good chunk of my jabber linrary completed in like 8 or 9 hours i just need a few things in my jabber lib
<youknow365> login - send and recieve messages
<youknow365> and roster get on sing on --- and add remove roster .......thats it
<youknow365> most jabber libraries have tons of crap ....... chat and a whole bunch of useless features
<youknow365> file transfer tons of crap
<youknow365> what i need is very simpl
<youknow365> y
descender has joined #ocaml
<youknow365> flux__: i wish there was some kind of library already made for this
<youknow365> flux__: i found a http connection library and it says it can hold stable connections ? should i edit that to my needs ot try to write my own from ground up
erikp has joined #ocaml
slipstream-- has quit [Read error: 104 (Connection reset by peer)]
<flux__> youknow365, does jabber use http connections?
<flux__> if not, I wouldn't suggest that
<youknow365> i think it can
<youknow365> Another interesting aspect of the Jabber protocol and server is the HTTP binding for users behind restricted firewalls. Jabber can use HTTP in two ways: polling and binding. HTTP polling essentially implies messages stored on a server-side database being fetched (and posted) regularly by a Jabber client by way of HTTP 'GET' and 'POST' requests. With the binding, the client uses longer-lived HTTP connections to receive messages as so
<youknow365> ing.
<youknow365> o wow laot of test oops
<youknow365> text
<youknow365> buti think opening a TCP connection would be much more efficient
<flux__> I doubt efficiency is of concern with jabber
<youknow365> i think the beter way to do it would be to open a tcp connection
<youknow365> the http protocol should be used when those services are not avaliable firewall or something
finelemon has joined #ocaml
finelemo1 has joined #ocaml
_jol_ has joined #ocaml
<youknow365> flux__: holy shit man i have never done some shit this hard before
finelemo2 has quit [Read error: 110 (Connection timed out)]
finelemon has quit [Read error: 110 (Connection timed out)]
shekmalh2n has quit ["bêêêêêêh"]
rillig has joined #ocaml
slipstream has joined #ocaml
_jol_ has quit ["leaving"]
piggybox has quit [Read error: 110 (Connection timed out)]
piggybox has joined #ocaml
<youknow365> flux__: still lost :P
erikp has quit ["Leaving"]
<youknow365> this shit is a pain in the ass big time
<youknow365> if anyone else has any experince with Networking stuff let me know please
Romel has joined #ocaml
Romel has quit ["Leaving"]
<youknow365> ey flux__ you still there?
<youknow365> i think i might have found the best documenation ever
slipstream has quit [Read error: 113 (No route to host)]
slipstream has joined #ocaml
shawn has quit ["This computer has gone to sleep"]
shawn has joined #ocaml
superjud1e has quit []
joshcryer has joined #ocaml
rillig has quit ["exit(EXIT_SUCCESS)"]
d-bug has quit ["This computer has gone to sleep"]
shekmalhen has joined #ocaml
khaladan has quit [Read error: 104 (Connection reset by peer)]