Tweeter buttonFacebook buttonLinkedin button
  • 03 Mar 2011 /  Embedded, Programming

    Darjeeling is a Virtual Machine (VM) for Micro Controller Units (MCU). It can execute a large subset of the Java language on 8- and 16-bit platforms, such as Atmega128 or MSP430.

    Features and limitations

    We designed the VM from the ground up for extremely limited devices. Where other JVMs often require at least several hundreds kB of RAM, Darjeeling can run meaningful programs in as little as 2kB. In order to achieve this we dropped several features from the Java language.

    Features:

    * Precise, compacting garbage collection
    * A 16-bit instruction set to reduce stack space consumption
    * Threads with ad-hoc stack space allocation (linked stack) and synchronisation
    * A simple method for calling with native C code from Java
    * Uses a static linking model to reduce code footprint

    Limitations:

    * Does not support reflection
    * Does not support 64-bit and floating point types
    * No support for multi-dimensional arrays
    * Does not call static class initialisers in lazy order
    * Supports a limited subset of the Java class library

    Source:
    http://darjeeling.sourceforge.net

  • 15 Jul 2010 /  BASH, Programming

    Example:

    export IFS=$'\n'

    for i in $(find .);
    do
    echo LEXO$i
    done

    It work better for me under GNU/Linux Slackware, but is reported that under GNU/Linux Ubuntu it doesn’t work and the change for it is:

    Example:

    export IFS=$'
    ' # in the second line, generating the newline

    for i in $(find .);
    do
    echo LEXO$i
    done

    We can use hexadecimal too:

    IFS=$’\x20′ # Space
    IFS=$’\x09′ # Tab
    IFS=$’\x0A’ # Line Feed
    IFS=$’\x0D’ # Carriage Return

    Source:
    http://tldp.org/LDP/abs/html/internalvariables.html
    http://wikiri.upc.es/index.php/BASH_uso_IFS
    http://forum.soft32.com/linux2/Bug-409179-DASH-Settings-IFS-work-properly-ftopict70039.html

  • 04 Mar 2010 /  Programming

    LightBlue is a cross-platform Bluetooth API for Python which provides simple access to Bluetooth operations. It is available for Mac OS X, GNU/Linux and Nokia’s Python for Series 60 platform for mobile phones.

    LightBlue provides simple access to:

    * Device and service discovery (with and without end-user GUIs)
    * Standard socket interface for RFCOMM and L2CAP sockets (currently L2CAP client sockets only, and not on PyS60)
    * Sending and receiving files over OBEX
    * Advertising of RFCOMM and OBEX services
    * Local device information

    Source:
    http://lightblue.sourceforge.net/

  • 07 Dec 2009 /  PHP, Programming

    This is an alternative of fork in PHP with exec() function:

    exec("/bin/ping 192.168.0.1 -c 12 2>/dev/null >&- <&- >/dev/null &");

    Sources:
    http://joseph.randomnetworks.com/archives/2005/10/21/fake-fork-in-php/
    http://immike.net/blog/2007/04/08/fork-php-and-speed-up-your-scripts/

  • 28 Apr 2009 /  BASH, Programming

    Some times we don’t want that command print out messages, and we need to clean all out messages (error or standard out) that it generates. For to solve this, we are going to use the I/O facility provided by BASH.

    BASH provide 3 file descriptors, and they are:
    0 – stdin – Used for get data.
    1 – stdout – Used for write standard data into screen.
    2 – stderr – Used for write error messages into screen.

    So, using redirector (>) we can redirect(obviously) this data/messages wherever we want and also files.

    Examples:
    ¿How to redirect error messages(stderr) to standard out(stdout)?

    ls this.file.doesnt.exist 2>&1

    ¿How to redirect error messages(stderr) to limbo(/dev/null)?

    ls this.file.doesnt.exist 2> /dev/null

    ¿How to redirect error(stderr) and standard out(stdout) messages to limbo?

    ls this.file.doesnt.exist &> /dev/null
    or
    ls this.file.doesnt.exist 2> /dev/null 1>&2