Skip to main content

2 posts tagged with "Code"

View All Tags


Recently in one of the project I am working on required me to do a “JavaScript” based url redirect. Originally I used a PHP header based 301 redirect

header("HTTP/1.1 301 Moved Permanently");
header("Location:  ");

But this approach has one limitation.The limitation is that you can not send any data before the header. My client used third-party JavaScript based tracking service and he also wanted to use this service on a redirect page. ( Client demands. You deliver ). The code given below demonstrates the delayed JavaScript redirect. i.e redirect to a page after a pre specified delay in milliseconds.

window.onload = function()
// Redirect after 5 seconds
var count = 5;
function Redirect()
if (count > 0){
document.getElementById("redirect").innerHTML = count;
count = count - 1;
setTimeout("Redirect()", 1000);
else {
document.getElementById("redirect").innerHTML = "redirecting...";"", "_self");

<!doctype html>
<meta charset="utf-8">
<script src="redirect.js"></script>

<div id="redirect"></div>



What you do once you have learned the basics of a new programming language ? Obviously you would want to test your skills ( Self evaluation ). There are few ways to test your ability to program , You could try to solve the programs given in the reference book or come up with a little project of your own. Either way it will help you improve your skills.

But if you would like to know how good you are at programming ( irrespective of the programming language ) compared to other programmers then you should examine one of the following Programming contest sites.

1. HackerRank

HackerRank formerly "InterviewStreet" was the first of its kind. HackerRank offers programming challenges of Artificial Intelligence, Algorithms, Functional Programming, Code Golf - Solve coding problems using the least number of keystrokes and Machine Learning.

HackerRank supports BASH, C, C++, Java, C#, PHP, Ruby, Perl, Haskell, Clojure, Scala, Lua, Go, 
Javascript, Erland, D, OCaml, Pascal, Python 2, Python 3, Groovy, Objective C, F#, VB.NET, LOLCODE, Smalltalk, Tcl, COBOL, Whitespace, Brainfuck, Lisp.

Click Here to check out theirs upcoming contests.

2. CodeChef

CodeChef is a noncommercial organization operated by Directi, an Indian software company based in Mumbai, India. You can either practice, take part in contests or discuss about programming challenges.

They support ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.8.1, CPP11, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC.

Supported Programming languages differ from challenge to challenge.

3. TopCoder

There are three types challenges you can take on TopCoder.

* Graphics Design
* Software Development
* Data Science

You could also win cash prizes if you finish in the top three places. Most of the challenges they offer are real world problems provided by real companies / organizations. 

4. programmr

Another favourite of mine is programmr. One of the cool feature of theirs is "Challenge your friend" which lets you challenge one of your friends.

I am not going to write about every site on the list. I recommended that you should explore each website on your own.Here is the rest of the list containing Competitive Programming and Online Judges websites.