How to fix the Unbound module Graphics in an ocaml project

Image
From ~/pr/gitl/ocaml-gol In a constant effort to learn new programming languages, I'm currently trying to use ocaml , a free and open-source general-purpose, multi-paradigm programming language maintained at the Inria . It's basically an extension of Caml with object-oriented features. I'm mostly interested by its functionnal and pattern matching features but the module part of the language can be a bit difficult to understand for someone with little to none ML (Meta Language) background.   The error When trying to use the graphics module to create a graphical window and go just a little further than the simplest helloworld program, here is the result : If the project uses dune : (executable (name ocaml_project) (libraries lwt.unix graphics) ) with this code : let () = Printf.printf "Hello, world!\n";; Lwt_io.printf "Hello, world!\n";; Graphics.open_graph " 800x600";; The first times I built this project running the du

Using a JQuery datepicker in meteorjs

Today's work on mrt-manager was to add a JQuery datepicker widget to the news addition modal dialog.
A JQuery datepicker in a modal

Include JQueryUI

In case you don't yet use JQueryUI in you meteorjs application you must add a new package :
meteor add mizzao:jquery-ui
Please read the package documentation for potential incompatibilities between jQuery UI
and Bootstrap 2.

Template work

Put your datepicker in a new template (the id field must be unique):
<template name="datepicker">
  <input id="datepicker"  name="date">
</template>
So you just have to use <tt>{{> datepicker}}<tt> in the parent template.

Javascript helper

In the javascript file, you must add a code that loads th datepicker UI at rendering. Please note the datepicker here are related to the HTML one. If you change the HTML input id, or if you have multiple datepicker in one HTML file, you must change them accordingly.
Template.datepicker.rendered=function(){
  this.$('#datepicker').datepicker();
};

Additionally, you can set the today's date as default with this line :
this.$('#datepicker').datepicker('setDate', new Date());

Comments

Popular posts from this blog

How to make a map of variant in C++