[Caml-list] Help with Elliom syntax

2010-11-04 Thread Till Crueger

Hi,

I am still trying to find my way with Elliom and Ocsigen. Right now I can  
use OCaml to generate the pages I want, but I still have problems to  
figure out how to encode the XHTML. The main question I have is how to  
assign attributes to elements,
like div blocks or others. I found the a_id functions that should return  
an id object, but I have not figured out how to use it to actually assign  
the id.


Thanks for your help again,
  Till

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Re: Help with Elliom syntax

2010-11-04 Thread Sylvain Le Gall
Hello,

On 04-11-2010, Till Crueger  wrote:
> Hi,
>
> I am still trying to find my way with Elliom and Ocsigen. Right now I can  
> use OCaml to generate the pages I want, but I still have problems to  
> figure out how to encode the XHTML. The main question I have is how to  
> assign attributes to elements,
> like div blocks or others. I found the a_id functions that should return  
> an id object, but I have not figured out how to use it to actually assign  
> the id.
>

Most of the time you have an ~a parameter.

Example:
div ~a:[a_class ["statistics"]] [ h2 [pcdata "Statistics"]; ... ]

Regards,
Sylvain Le Gall

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Re: Help with Elliom syntax

2010-11-04 Thread Till Crueger
On Thu, 04 Nov 2010 13:31:35 +0100, Sylvain Le Gall   
wrote:



Most of the time you have an ~a parameter.

Example:
div ~a:[a_class ["statistics"]] [ h2 [pcdata "Statistics"]; ... ]


Thanks for the help again.
Is there a place where such things are documented? Because I was not able  
to figure out how to do this using the Elliom developer manual.


Bye,
  Till

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Re: Help with Elliom syntax

2010-11-04 Thread Sylvain Le Gall
Hello,

On 04-11-2010, Till Crueger  wrote:
> On Thu, 04 Nov 2010 13:31:35 +0100, Sylvain Le Gall   
> wrote:
>
>> Most of the time you have an ~a parameter.
>>
>> Example:
>> div ~a:[a_class ["statistics"]] [ h2 [pcdata "Statistics"]; ... ]
>
> Thanks for the help again.
> Is there a place where such things are documented? Because I was not able  
> to figure out how to do this using the Elliom developer manual.
>

Well, you have to figure how nullary/.../star works.
http://ocsigen.org/docu/1.3.0/XHTML.T.html#TYPEnullary
All is in the type ;-)

E.g. for nullary 
type ('a, 'b) nullary = ?a:'a attrib list -> unit -> 'b elt 
and 
val br : ([< core ], [> `Br ]) nullary
and 
type core = [ `Class | `Id | `Title ] 

So you know that br accept only a_class, a_id and a_title...

I would recommend you to learn by examples, because ocsigen is a big
application and can be pretty hard to learn. There are already good
websites around:
https://github.com/mfp/ocsiblog
http://darcs.ocamlcore.org/cgi-bin/darcsweb.cgi?r=oasis-db;a=tree
http://ocsigen.org/ocsimore/sources/

Regards,
Sylvain Le Gall

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Merging object signatures

2010-11-04 Thread Dario Teixeira
Hi,

Similarly to polymorphic variants, is there a way for object signatures to
be merged by type name?  Consider the example at the end; I'm wondering if
it is possible for the declaration of 'foobar' to be something along the
lines of 'val foobar: int -> int -> < foo_t; bar_t >' instead of needing to
explicitly list all the methods in foo_t and bar_t.

Thanks in advance for your help!
Best regards,
Dario Teixeira


module Test:
sig
type foo_t = < a: int >
type bar_t = < b: int >

val foobar: int -> int -> < a:int; b: int >

(* val foobar: int -> int -> < foo_t; bar_t > *)
end =
struct
type foo_t = < a: int >
type bar_t = < b: int >

class foo a = object method a: int = a end
class bar b = object method b: int = b end

let foobar a b =
object
inherit foo a
inherit bar b
end
end





___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] Causes for segfaults

2010-11-04 Thread Jamie Brandon
Is there an authoritative list anywhere of the possible causes for
segfaults in ocaml? I'm not using the FFI or -unsafe and I have ruled
out overflowing the c stack and allocating large strings/arrays. I'm
using ocaml 3.09.3 with extlib, netclient, json-static, xml-light, str
and no compilation options.

Cheers

Jamie

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Causes for segfaults

2010-11-04 Thread Raphael Proust
Le jeudi 04 novembre 2010 21:19:33, Jamie Brandon a écrit :
> Is there an authoritative list anywhere of the possible causes for
> segfaults in ocaml? I'm not using the FFI or -unsafe and I have ruled
> out overflowing the c stack and allocating large strings/arrays. I'm
> using ocaml 3.09.3 with extlib, netclient, json-static, xml-light, str
> and no compilation options.

Unmarshalling can cause segfaults and Obj.magic too.

-- 
___
Raphaël

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Causes for segfaults

2010-11-04 Thread Jamie Brandon
I'm not using Obj. I am unmarshalling. I have 'ulimit -s unlimited'
set and I'm unmarshalling with the exact same binary that did the
marshalling. The unmarshalling itself finishes ok but I guess the
segfault could be caused when accessing the resulting data structure?

I'm marshalling data which contains a DynArray which in turn contains
functional values, but I'm using [Marshal.No_sharing;
Marshal.Closures] and I haven't changed the code between marshalling
and unmarshalling.


On Thu, Nov 4, 2010 at 8:25 PM, Raphael Proust  wrote:
> Le jeudi 04 novembre 2010 21:19:33, Jamie Brandon a écrit :
>> Is there an authoritative list anywhere of the possible causes for
>> segfaults in ocaml? I'm not using the FFI or -unsafe and I have ruled
>> out overflowing the c stack and allocating large strings/arrays. I'm
>> using ocaml 3.09.3 with extlib, netclient, json-static, xml-light, str
>> and no compilation options.
>
> Unmarshalling can cause segfaults and Obj.magic too.
>
> --
> ___
> Raphaël
>
> ___
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Causes for segfaults

2010-11-04 Thread Till Varoquaux
I have a personnal marked dislike for xml-light; one of the reason
being that it is tied together using duct-tape and generous sprinkling
Obj.magic. Probably not the cause of your problem but, and again, who
knows.

We (Jane street) have a patched version that does not use Obj.magic;
the main reason that I haven't pushed for us to upstream these patches
is that I'd rather see Xml-light die in favour of something that
adheres better to the xml standards (like xmlm).

It might be intersting for you to run your app in gdb and sent the
backtrace of the segfault. Valgrind could also be very useful here but
it is not for the faint of heart.

very quick guide to gdb (although I am sure you know):

_ 1) Make sure your program is compiled with -g
_ 2) gdb ./my_pgm
   > run
    (boom!)
   > bt

On Thu, Nov 4, 2010 at 4:19 PM, Jamie Brandon
 wrote:
> Is there an authoritative list anywhere of the possible causes for
> segfaults in ocaml? I'm not using the FFI or -unsafe and I have ruled
> out overflowing the c stack and allocating large strings/arrays. I'm
> using ocaml 3.09.3 with extlib, netclient, json-static, xml-light, str
> and no compilation options.
>
> Cheers
>
> Jamie
>
> ___
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] rpc: type conversion

2010-11-04 Thread Philippe Strauss

Hello,

I need to use RPC in a current project of mine, but I don't get how do 
you write the type conversion and what is provided, taking a very basic 
example:


--8<--
program Rpc_control {
version V1 {
int add(int, int)= 1;
} = 1;
} = 0x207f;
--8<--

and the server code:

--8<--
let add arg =
match arg with
| (a, b) -> a + b
| _ -> 0

let _ =
let esys = Unixqueue.standard_event_system () in
let server = Deconv_srv.Rpc_control.V1.create_server ~proc_add: add
(Rpc_server.Localhost ) Rpc.Tcp Rpc.Socket esys in
Unixqueue.run esys
--8<--

my add fun is wrong regarding the types, I've read about type conversion 
but the doco lacks examples, the examples lacks basic use of int <-> 
Rtype.int4.



Thanks

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers

2010-11-04 Thread Philippe Wang
Dear all,

this is an announcement for "OCAPIC", a project which brings OCaml to 
programming PIC micro-controllers.

Some PIC18 series characteristics:
- 8 bit architecture
- low cost (a few US dollars), fairly spread in electronics world
- very low volatile memory (a few bytes only, up to ~5000 bytes, depending on 
the model)
- very low non-volatile memory (less than a KB up to 128 KB)
- EEPROM : 0 to 1024 bytes

How to program those little chips with OCaml:
- write an OCaml program, compile it, transfer it to the PIC.

Well, actually it demands a little more than just that:
- write an OCaml program, like usually, while keeping in mind that the stack is 
more limited than usual, same for the heap
- compile it (with ocamlc)
- reduce the binary (with ocamlclean : a bytecode reducer which removes 
dead-code)
- transform the (reduced or not) binary (with bc2asm : take back not useful 
zeros, thence reducing the binary size)
- transfer it to the PIC along with its OCaml VM.

Indeed, an OCaml VM has been implemented in PIC18 ASM in order to run OCaml 
programs on a PIC ! :-)

An example of real program is in the distribution (open source, downloadable 
from the website):
ocapic-1.3/src/tests/goblet/ (722 lines of ML code).

We also provide a simulator in order to run on a PC (needs X11 (Linux/MacOSX) 
and GCC) your programs written for PIC18.

The whole implementation has been fairly well tested, however the documentation 
is still quite young.

Here is the website : 
http://www.algo-prog.info/ocaml_for_pic/ 

Cheers.

Benoît Vaugon (developer and initiator of OCAPIC project)
Philippe Wang (supervisor)
Emmanuel Chailloux (supervisor)

P.S. si vous êtes francophone et nous contactez directement, merci de le faire 
en français

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] rpc: type conversion

2010-11-04 Thread Philippe Strauss

oops, Rtypes.int_of_int4 and int4_of_int.

sorry.

Philippe Strauss wrote:

Hello,

I need to use RPC in a current project of mine, but I don't get how do 
you write the type conversion and what is provided, taking a very 
basic example:


--8<--
program Rpc_control {
version V1 {
int add(int, int)= 1;
} = 1;
} = 0x207f;
--8<--

and the server code:

--8<--
let add arg =
match arg with
| (a, b) -> a + b
| _ -> 0

let _ =
let esys = Unixqueue.standard_event_system () in
let server = Deconv_srv.Rpc_control.V1.create_server ~proc_add: add
(Rpc_server.Localhost ) Rpc.Tcp Rpc.Socket esys in
Unixqueue.run esys
--8<--

my add fun is wrong regarding the types, I've read about type 
conversion but the doco lacks examples, the examples lacks basic use 
of int <-> Rtype.int4.



Thanks

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] rpc: type conversion

2010-11-04 Thread Gerd Stolpmann
Alternatively, you can instruct ocamlrpcgen to directly translate RPC
int's to int/int32/int64. E.g. "ocalmrpcgen -int unboxed", or
you demand the types in the .x file, e.g. use "_unboxed int".

See the manual for details: 
http://projects.camlcity.org/projects/dl/ocamlnet-3.0.3/doc/html-main/Rpc_intro.html,
section "Mapping integer types".

Gerd

Am Freitag, den 05.11.2010, 00:15 +0100 schrieb Philippe Strauss:
> oops, Rtypes.int_of_int4 and int4_of_int.
> 
> sorry.
> 
> Philippe Strauss wrote:
> > Hello,
> >
> > I need to use RPC in a current project of mine, but I don't get how do 
> > you write the type conversion and what is provided, taking a very 
> > basic example:
> >
> > --8<--
> > program Rpc_control {
> > version V1 {
> > int add(int, int)= 1;
> > } = 1;
> > } = 0x207f;
> > --8<--
> >
> > and the server code:
> >
> > --8<--
> > let add arg =
> > match arg with
> > | (a, b) -> a + b
> > | _ -> 0
> >
> > let _ =
> > let esys = Unixqueue.standard_event_system () in
> > let server = Deconv_srv.Rpc_control.V1.create_server ~proc_add: add
> > (Rpc_server.Localhost ) Rpc.Tcp Rpc.Socket esys in
> > Unixqueue.run esys
> > --8<--
> >
> > my add fun is wrong regarding the types, I've read about type 
> > conversion but the doco lacks examples, the examples lacks basic use 
> > of int <-> Rtype.int4.
> >
> >
> > Thanks
> >
> > ___
> > Caml-list mailing list. Subscription management:
> > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> > Archives: http://caml.inria.fr
> > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> > Bug reports: http://caml.inria.fr/bin/caml-bugs
> 
> ___
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 


-- 

Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany 
g...@gerd-stolpmann.de  http://www.gerd-stolpmann.de
Phone: +49-6151-153855  Fax: +49-6151-997714


___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs