Tag: Misc

A Knight’s Watch

Recently I came across this interesting problem through Toptal (on Codility) which kept me thinking hard for a few days. Finally, I now have a solution to this problem and would like to share it here. Problem: Basically, the problem deals with a knight piece on an infinite chess board. Assuming the knight is positioned […]

Read More

Revealing Module Pattern

Using closures in javascript, we can create public and private methods. Only the methods and variables that are specifically returned are available publicly and we can provide references to privately declared methods and variables inside the public methods. Layout for RMP:

Read More

Automating Development in ASP.NET MVC

Inspired by rapid development framework Artisan in Laravel for PHP, I am thinking maybe we (.NET developers) can do something similar in our environment as well. http://laravel.com/docs/5.0/artisan Basically I am thinking of automating the whole process of creating Repository classes (including required entries for properties and fields), Model classes,  Service layer (layer where you put […]

Read More

Drawing Basic Patterns In Canvas

Begin with drawing a simple rectangular blue box like this:          function drawScreen() {            context.save();            drawPattern();            context.restore();        }        function drawPattern() {            context.fillStyle = “blue”; //    […]

Read More

Basic Setup for HTML Canvas

This is a basic setup for starting any project in HTML5 CANVAS and Javascript.The script that is being used is Modernizer.js which is is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.         Canvas Study     http://modernizr.js                   […]

Read More

Android: Updating View from Background Thread

Issue: android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.   For a small game application that I am currently working on, I needed to change the display text at certain intervals of time. Initially I tried to simply update the view(UI) using a timer class that runs after every […]

Read More