Monthly Archives: June 2014

What is the DOM?

The Document Object Model (DOM) is an application programming interface (API) for valid HTML and well-formed XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated.

Posted in Javascript | Leave a comment

jquery – some frequent questions

1) How do I test if an element exists? if ( $( “#myDiv” ).length ) { $( “#myDiv” ).show(); } 2) How do I determine the state of a toggled element? var isVisible = $( “#myDiv” ).is( “:visible” ); var … Continue reading

Posted in General, Javascript | Leave a comment

Closure and Lexical Scoping in Javascript

A closure is a function having access to the parent scope, even after the parent function has closed. A closure is a function that returns a function. The function that is returned (the inner function) is created inside the called … Continue reading

Posted in Javascript | Leave a comment

Interview questions from Pinank

here are the questions: 1. Given a library of Stack with 2 functions (push(x), pop()), implement a queue library (i.e. enqueue(x), dequeue()) Use 2 stacks: enqueue() : keep push(x)ing in Stack1 only dequeue() : keep pop()ing from Stack2 only. (Incase … Continue reading

Posted in Interview Questions | Leave a comment

Why is ENUM considered evil ?

Disadvantages of Enum datatype in MySQL: http://komlenic.com/244/8-reasons-why-mysqls-enum-data-type-is-evil/

Posted in Database | Leave a comment

Top 20 MySQL Best Practices

http://net.tutsplus.com/tutorials/other/top-20-mysql-best-practices/

Posted in Database | Leave a comment

PHP Interview Questions (Set1)

1) What is the difference between this and self? http://www.programmerinterview.com/index.php/php-questions/php-self-vs-this/ 2) What is __toString used for ? If an object needs to be used as a string (e.g.: echo $obj;). If you don’t use __toString then the statement will produce … Continue reading

Posted in PHP | Leave a comment

What are magic methods, magic quotes, short tags in php?

Magic Methods: PHP functions that start with a double underscore – a “__” – are called magic functions (and/or methods) in PHP. They are functions that are always defined inside classes, and are not stand-alone (outside of classes) functions. The … Continue reading

Posted in General, PHP | Leave a comment

PHP script to report download size of any URL

Write a PHP script to report the total download size of any URL. You may not use any 3rd-party code that performs the entire task described below. No HTML interface is necessary for this exercise; you can write this as … Continue reading

Posted in PHP | Leave a comment

Difference between print and echo

echo – can output one or more strings print – can only output one string, and returns always 1 Tip: echo is marginally faster compared to print as echo does not return any value. echo “This”, ” string”, ” was”, … Continue reading

Posted in PHP | Leave a comment