Successful completion of my academic project

If you asked me about the SMS API, a few months ago i would have failed to answer you. But working on the academic project under the co-ordination of my seniors and my team mates(Midusha Shrestha, Anjan Rai, Ritu Jain and me), have successfully completed the project and were able to show in time.

Our project was based on the SMS based resulting system and named as “Sajilo Result”. It was almost similar to the service provided by one of the renowned company of Nepal, named as Sparrow SMS. We worked as our supervisor demanded and was different from that service as we included the interface for uploading the data to the database.

We worked with our own cell phones as a SMS gateway and sent the result after processing the queries sent to us. Also on the admin side, we included the feature of data visualization which showed the visual view of the data uploaded.

I am very thankful to my team members and my seniors who helped a lot in this project.

Advertisements

Calling a function at certain interval of time

Here is the piece of code that helps you to update a function at certain interval of time. The time is usually calculated in milliseconds. As you can see the code has 1000 somewhere in the setinterval function. This code helps to call the function every second. Here in the first line you can see the ‘mainCanvas’. It is nothing but the id of HTML5 canvas.

var drawingCanvas = document.getElementById(‘mainCanvas’);
if(drawingCanvas.getContext) {
    /* Initaliase a 2-dimensional drawing context */
    var context = drawingCanvas.getContext(‘2d’);
    setInterval(“update()”,1000);

}

function update(){
//call the function which you want to update.

}

All right test the code and see the result. Happy Coding…. Smile

Code for drawing a line using Bresenham algorithm in Javascript

Here is the snippet for drawing a line in javascript.

function drawline(xa,ya,xb,yb){
    var dx=Math.abs(xa-xb);
    var dy=Math.abs(ya-yb);
    var p=2*dy-dx;
    var twody=2*dy;
    var twodydx=2*(dy-dx);
    var x,y,xend;

    if(xa>xb)
    {
        x=xb;
        y=yb;
        xend=xa;
    }
    else
    {
        x=xa;
        y=yb;
        xend=xb;
    }
    drawpix(x,y);
    while(x<xend)
    {
        x++;
        if(p<0)
        {
            p+=twody;
        }
        else
        {
            y++;
            p+=twodydx;
        }
        drawpix(x,y);
    }
}

As in previous blog you can find the code for pixel drawing code. Here is the link for the pixel drawing code. http://bit.ly/Wzm0xG

Go through it and happy coding… Smile