The web is full of source code sample, search google.