Inception – The film’s idea and my view

18 July, 2010 | | 5 comments |

Share |
The film’s named Inception and it indeed lives to its name. Directed by Cristopher Nolan, the maestro behind ‘The Dark Knight’ comes out with another screen-scorcher and action-packed thriller. Long time since I saw a film like that, the last one being - The Dark Knight … :)


Inception - The Movie


My disclaimer

I intend to write this post not as a review but as a base for those who’ll be watching this film after reading this post. The film’s tied up in a dream and anachronism right from the start which makes it difficult to comprehend for our die-hard Hindi film viewers (even I’m one of them). Probably, they have another reason to give this film a miss, but that’s what I don’t want to happen. The film is an extra-ordinary one with a great story, cast and some heart-stopping sequences. I’ll rate it a must watch for all boys! For girls/women - since they are moreover emotional animals than social, it would be your man’s call … :)


The core idea

The core idea of the film lies in the fact that to get a human-being to do something he has to have a perception regarding it or say he has to make a decision. But getting a stranger to have a perception when he's awake isn't a child's play and hence only a planned inception into human’s mind can help. That’s inception!

An individual has to be put into a dream or hallucinated (the same dizzy feeling when you smoke or get drunk) by some way. And once that's achieved, you can give the mind the feeling of the unrealistic ambience around him and force him into a trap to achieve our motive. That’s the dynamic of the story!

You can read more on the film at IMDB Here.

You can check out the following trailer which will give you the gist of it.




My view

Now the story in the film falls into place with Leonardo DiCaprio in lead role and the one who plants the inception. He along with his accomplices uses all possible sophisticated technology, planning and the right people to get the job done. In the way, you’ll see some breath-taking sequences filled with action, mature humor, thrilling scenes and romance (oh yeah !).


My rating : 5/5


Watching the film on VCD/DVD at your home will take the joy out of the entire experience and also won’t do justice to the idea of the film! So do watch it at a Multiplex nearby ….


Web Development: Printing a DIV tag using JavaScript

08 July, 2010 | | 3 comments |

Share |
A majority of times, web developers have to print an existing content on their web page. To be practical, you target the contents of a <div> tag. While a majority would choose to search for a string like ‘Printing a DIV tag in ASP.Net’ or ‘Printing a DIV tag in PHP’; the right search string should be ‘Printing a DIV tag using JavaScript’. This is because irrespective of the server side programming language used, using JavaScript would be the most apt solution. Following method will help you achieve the same using simple and effective JavaScript. You can get the LOC(lines of code) to negligible if you implement the same using jQuery.


Step 1:

The <div> tag to be printed should bear the id="DivToPrint". Following HTML snippet depicts the same with comments(do read them carefully). The Button is used to execute the ‘PrintResults()’ function on Mouse click.


  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  •  
  • <html xmlns="http://www.w3.org/1999/xhtml">
  • <head>
  •     <title>Example for Printing a DIV</title>
  •  
  •     <script src="PrintScript.js" type="text/javascript"></script>
  •  
  • </head>
  • <body>
  • <br />
  •  
  •     <!-- The contents of 'DivToPrint' will be printed. Avoid giving any styles to this <DIV>. -->
  •  
  •     <div id="DivToPrint">
  •         
  •         <!-- All content here onwards will be printed -->
  •         
  •         <div style="text-align:center; margin:50px; border:double 4px BLACK;">
  •             
  •             <br />
  •                 This is the Content which will be printed.
  •             <br /><br />
  •             
  •         </div>
  •         
  •         <!--  *************************************** -->
  •         
  •     </div>
  •  
  •     <button onclick="PrintResults()">Click to Print</button>
  •  
  • <br />
  • </body>
  • </html>


Step 2:

Import the JavaScript file which contains the ‘PrintResults()’ function. The Script contains code for printing the DIV tag which follows the following procedure:

  • Read the DIV tag with id="DivToPrint" and access its HTML content in a variable.
  • Create an additional DIV tag which will have your custom HTML content to be printed. Add the custom HTML content to this DIV tag.
    • Create a pop-up menu using ‘window.open()’. Open the document stream to this document and add the contents of both the DIV tags and close the stream. This Window when opened will open up the print window. On successful print operation, this window will terminate offering no user intervention with the window. You can remove the ‘window.close();’ code if you want this window to persist.

    Following is the JavaScript code with detailed annotations as present in PrintScript.js


    •  
    • /* JavaScript function to print the contents of the DIV */
    •  
    • function PrintResults()
    • {
    •          
    •     //alert("Function Entered!");   /* Test if the function is entered */
    •     
    •     /* We can create a DIV with custom content dynamically to be printed. */
    •     
    •     var elem = document.createElement("div");
    •     elem.innerHTML = "<div style='text-align:left;'>"
    •                         + "<br />This is the custom CONTENT.<br /><br />"
    •                     + "</div>"
    •                     + "<br /><br />";
    •     
    •     var content1 = elem.innerHTML;      // content1 has to HTML code for our Custom DIV
    •     var content2 = document.getElementById("DivToPrint").innerHTML; // content2 has to HTML code for our 'DivToPrint'
    •     
    •     var win1 = window.open("", "Print_Results", "scrollbars=yes,width=800,height=700,toolbar=no,resizable=true,status=false,location=false");
    •     
    •     //win1.moveTo(150, 100);        /* Use this to move the Window to a specified location  */
    •     
    •     //alert(content1 + content2);   /* Will show the entire HTML CODE to be printed in alert Window for Test */
    •     
    •     //Open the stream to the win1 for adding the CODE
    •     
    •     win1.document.open();
    •     
    •     win1.document.write("<html>"
    •                         + "<head><title>Window to be Printed</title></head>"
    •                         + "<body onload='window.print();window.close();'>"
    •                             + content1 + content2 +
    •                         "</body></html>");
    •     
    •     /* You can remove 'window.close();' to avoid closing the Window if you want. */
    •     
    •     win1.document.close(); //Closing the stream is mandatory
    •     
    • }






    You can download the source code Here:





    Source code for printing a DIV tag using JavaScript