Drawing a single pixel on Javascript

well after a long procedure and searching for a whole day to draw a single pixel on a HTML5 canvas, this code as I wrote worked out to draw a single pixel.

function drawpix(x,y){

   var c1 = document.getElementById(“mainCanvas”);
   var rContext = c1.getContext(“2d”);
   rContext.beginPath();
   rContext.moveTo(x,y);
   rContext.lineTo(x+1,y+1);
   rContext.closePath();
   rContext.strokeStyle= ‘white’;
   rContext.stroke();
  

}

drawpix(10,10);

Advertisements

Online compilers for your codes

If you are a programmer, you must be compiling your code stuffs in the PC. But are you aware that there are some online compilers. well then you can find this in the link which is given below. Check this out! Even your pc does not have the compilers installed you can run the codes in the link given below:
http://liveworkspace.org/
gcc.godbolt.org

Rise4Fun

and some of are given in the link below

http://isocpp.org/blog/2013/01/online-c-compilers

Hello world in C#

// A Hello World! program in C#
using System;
namespace HelloWorld
{
    class Hello
    {
        static void Main()
        {
            System.Console.WriteLine(“Hello World!”);

            // Keep the console window open in debug mode.
            System.Console.WriteLine(“Press any key to exit.”);
            System.Console.ReadKey();
        }
    }
}

Here the first line starts with the // sign which indicates that the line is comment and has nothing to do with the programming. This comment helps you to understand what your code is so that in future if you see the code it would not be hard for you to understand what you have written. The Second line ‘using system;’indicates the namespaces that your program must have in order to access the functions. As being the object oriented programming the concept of class must be understood. And lastly there is the void main() function which is invoked as soon as the program is launched. and there you can see the ‘writeline()’ function which consists of the text hello world in it, that means this line of code writes the hello world to the console screen. The last line code which is readkey() reads the key entered by the user. That is all you have to understand about the starting program of hello world. Happy C#ing.