Stickybits

Blog Categories
Twitter Updates
    follow me on Twitter
    Currently Reading
    Powered by Squarespace
    Git Projects
    Main | Edging your way towards Ruby 1.9.1 and Rails 3.0pre »
    Sunday
    Jan032010

    Erlang Quick Tip: The user_default module

    If you are anything like me you spend a lot of your time in the erlang shell debuging and testing your code. And some commands are used more than others but they may be a bit on the long side and you may make regular errors while typing it. One of these wonderful functions is make:all([load]). that will compile using your Emakefile and then magically reload the newly compiled modules into the running shell. What I reglarly do is to type load instead of [load].

    Enter the user_default module. Any function defined in the user defined user_default module or in the Erlang defined shell_default module will be allowed to run without typing in the module name. One of these functions that you may use often is the c(module\_name). function. First start by creating a directory for your utility modules. I like having it in the ~/.ebin/ diretory. Now add that direcory to the code path by opening or creating the file ~/.erlang and inserting this line:

    code:add_pathz("/Users/username/.ebin").
    

    Create your user_default.erl file and but in the following:

    -module (user_default).
    -export ([sync/0]).
    
    %% Compiles all files in Emakefile and load into current shell.
    sync() ->
      make:all([load]).
    

    Then compile it with erlc user_default.erl and start an Erlang shell. Now inside a project you can run sync(). and it will recompile and load you project.

    For those interested I will put up my ~/.ebin code up at github.com/JonGretar/erlang_user_utilities. Please fork and make your own changes and share with the world.

    Reader Comments (3)

    This simplifies things quite a bit! Thanks for the information, it has helped me save a lot of time already. Looking forward to reading more of your blog in the future.

    Jul 8, 2010 at 13:51 | Unregistered CommenterBill G

    Author simplified it greatly ,this will help me save time on my project
    casino en ligne

    Jul 20, 2010 at 4:18 | Unregistered Commenterstewbiff

    As a famous Paris Fashion brand, Herve Leger Strapless is taking great effort to show women`s perfect figures and gentle charactors. 2010 new style Herve Leger help women to show this line of beauty perfectly. This is also the tenet of Herve Leger Strapless .Originating in France,2010 new style Herve Leger also have the charactor as Paris Women does, natural but not fake, romantic, elegant and Vogue .In the 1980s, Moncler Polo Shirt become unprecedentedly popular all over the world. They are poplular because all the
    Moncler Jackets Vest are made of high- quality down.So many young people are fascinated with Moncler Polo Shirt , and we guess you must be one of them. Start to be the trend-spotter from owning an Moncler Accessories.The red outsole is the distinctive features of Christian Louboutin Boots , also is the female of gentle, lovely, beautiful and sexy logo.Soon, the red high-heeled Christian Louboutin Flats spread all over the world after Cinderella's fairy tales, especially the big stars and royal aristocrats let
    Christian Louboutin Flats appear in the front of the world. Christian Louboutin Boots favor gorgeous colors with various exotic. . No matter what kinds of HERMES PURSE you like, you can have a look at HERMES BELT .Please go and check out, you will be attracted by those beautiful and elegant belt. And among the various Hermes Kelly , there must be one suitable for you.Hermes Lindy&Hermes Evelyne one of the best handbag brands in the world.

    Jul 27, 2010 at 8:38 | Unregistered Commenterjun

    PostPost a New Comment

    Enter your information below to add a new comment.

    My response is on my own website »
    Author Email (optional):
    Author URL (optional):
    Post:
     
    Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
    Fork me on GitHub