• Home
  • Genetik
  • Google
  • Links
  • About
  • Yohan Naftali

    Programming

    Even or Odd?

    Oct. 20, 2009

    There are many ways to determine wheter the number is odd or even. Here is two:
    1. Check with modulus operator (%)
    The modulus operator returns the remainder when dividing two numbers.
    Even numbers doesn’t have a remainder, but Odd numbers have 1.
    2. Check by bit operators

    Here is the code:
    1. With modulus operator (%)
    ———————————-
    #include
    int main() {
    int number;
    printf(”Input integer\n”);
    scanf(”%d”,&number);
    if(number % 2 == 0) {
    printf(”Even\n”);
    }
    else {
    printf(”Odd\n”);
    }
    return 0;
    }
    ———————————-

    2. Check by bit operator
    ———————————-
    #include
    int main() {
    int number;
    printf(”Input integer\n”);
    scanf(”%d”,&number);
    if(number & 1) {
    printf(”Odd\n”);
    }
    else {
    printf(”Even\n”);
    }
    return 0;
    }
    ———————————-


    Share on Facebook Delicious Bookmark this on Delicious

    Blackberry LED Programming

    Aug. 25, 2009

    This article show how to access LED on blackberry handheld.

    For LED programming, we need to import net.rim.device.api.system.LED.

    LED (continue reading…)


    Share on Facebook Delicious Bookmark this on Delicious

    BlackBerry Programming

    Jul. 29, 2009

    The Blackberry platform is Java® based, and there are number of different tools that you can
    use to develop your applications. This tutorials only show basic programming for Blackberry® application. We assume that you’re not beginner in programming. Java® language is mandatory. This tutorials use Windows® OS, but you may develop use other OS. (continue reading…)

    Share on Facebook Delicious Bookmark this on Delicious

    Exec PHP

    May. 24, 2009

    This article is for wordpress.org users.

    Exec-PHP is the best plugin i ever use. Just download from http://bluesome.net/post/2005/08/18/50/.
    Exec-PHP enable you to run PHP and script from your blog. It’s easy to install, just follow the note. If you’re PHP programmer and want to enhance your blog, it’s recommended to install this plugin to your wordpress blog.

    Technically Exec-PHP executes code inside of arbitrary text by wrapping the whole text into “? > < ?” php tags and hand it over to the PHP eval() function. This requires that the executable code itself is encapsulated into “< ? php ? >” tags. By that no parsing of your code needs to be done by the plugin itself.

    Difference to similar plugins

    There are a lot of PHP plugins available all doing slightly different things. The following list was gathered back in the beginning of 2007 and may not be complete and probably outdated because some of the plugins may have been updated, including more features. Therefore the names of the compared plugins are given including the version number.

    Sniplets
    The Sniplets plugin by John Godley seems to be a good alternative to Exec-PHP. Although it is harder to configure than Exec-PHP, you may gain some improvements in security due to the way the Sniplets plugin is working.

    RunPHP 0.2.2 (Mark Somerville)
    The RunPHP plugin by Mark Somerville uses XHTML tag syntax to separate code from HTML. It does strange conversions to “fix” texturized posts and does not support WordPress’ 2.x roles and capabilites system.

    RunPHP 2.1.1 (James Van Lommel)
    The RunPHP plugin by James Van Lommel creates parsing errors with most of the test code below.

    PHP Exec 1.7
    The PHP Exec plugin by Priyadi Iman Nurcahyo uses XHTML tag syntax to separate code from HTML. It does strange conversions to “fix” texturized posts.

    EzStatic 3
    The EzStatic 3 plugin by Owen Winkler


    Share on Facebook Delicious Bookmark this on Delicious

    Two Dimensional Array

    May. 19, 2009

    This article demonstrate how to passing parameter of two dimensional array (C++ languange);
    Artikel ini menjelaskan bagaimana melakukan passing parameter untuk array 2 dimensi (bahasa C++);

    // Author: Yohan Naftali
    // Prototype
    void myFunction(long double (*myArray)[noRow]);
    //Global Variable
    const int NoRow = 10;
    const int NoCol = 10; //for array 10×10
    void main()
    (continue reading…)


    Share on Facebook Delicious Bookmark this on Delicious