Tuesday, March 20, 2012

HTML5 Community Night


5:00 - 6:00 pm      Registration, Demo showcase, Social, food, drink
6:00 - 6:30 pm      Kick off  (Doris Chen, Ann Burkett, Kevin Nilson)
6:30 - 7:10 pm      The Graphical Web - Fostering Creativity (Adobe: Vincent Hardy)
7:10 – 7:50 pm      Dart (Google: Seth Ladd)
7:50 – 8:00 pm      break
8:00 - 8:20  pm     WebFWD (Mozilla: Diane Bisgeier)
8:20 - 9:00  pm     Behind The Scenes of Cut The Rope (Microsoft: Giorgio Sardo)
9:00 - 9:30 pm      Panel Discussion & Q&A (Kevin Neilson, Vincent, Seth, Giorgio)
9:30 - 9:40  pm     Give Away and Wrap

Saturday, February 18, 2012

TSG Javascript Programming - Part I




Title
TSG Javascript Programming - Part I

Prerequisite
This class ( Part I ) does not requires any javascript background, but basic knowledge on HTML and CSS is preferred.

Location
G5 ROLCC -  Please click the logo below for more detail on TSG location.

Cost
$65 Dollars

Date & Time
Time will be 7:30 pm - 9:15 pm
  • 3/06/12 ~ Basic Introduction - Doing Javascript The Right Way
  • 3/13/12 ~ The Building Blocks of Javascript
  • 3/20/12 ~ Array and Functions
  • 3/27/12 ~ Creating Objects 
  • 4/03/12 ~ Document Object Model
  • 4/10/12 ~ Field Trip to HTML5 conference
  • 4/17/12 ~ DOM Interaction Hands on Session / Debugging Javascript






Description
This JavaScript course provides the knowledge necessary to design and develop dynamic Web pages using JavaScript. It introduces participants to JavaScript and how the language can be used to turn static pages into dynamic, interactive Web pages.  Besides learning the syntax of the JavaScript language, other additional topics may include the Document Object Model, form validation, how to create functions, and how to create your own script files.  At the end of this class, participants will have the knowledge necessary to utilize the power of JavaScript to provide dynamic content on their Web sites.  We will reserve 30 minutes each class for hands on session, so please bring your laptop when you come to the class. [Note] Feel free to leave comments or send me email if you have any questions.  Thanks. 


[ Note ]
We don't have an assigned book in this class, but if you are new to javascript, I would recommend this one.
http://www.amazon.com/Simply-JavaScript-Kevin-Yank/dp/0980285801/ref=sr_1_1?ie=UTF8&qid=1331147166&sr=8-1
...
What's Next  (Future Classes)
For Javascript Programming Level II, here is the proposed schedule.
  • Javascript Events
  • Form Handling and Validation
  • Javascript Events II
  • JSON and Ajax
  • Javascript Animation
  • Introduction to JQuery

For Javascript Programming Level III, here is the proposed schedule.
  • Closures
  • Scopes and Prototypes
  • Javascript Object Oriented Programming
  • Javascript Design Pattern - Part I
  • Javascript Design Pattern - Part II
  • Introduction to Events Driven Development
...
There will be one more class as the last of this Javascript Programming Series.  Instead of calling it Javascript Programming Level IV, let's called that "Let's start your Javascript Ninja Road Trip".

Let's start your Javascript Ninja Road Trip, here is the proposed schedule
  • Common mistakes in Javascript development
  • Understand your Javascript Engine
  • Writing high Performance Javascript
  • Dive deeper into Events Driven Development
  • Introduction to Server Side Javascript and Persistent Layer using Javascript
  • Design your custom Javascript Framework

Thursday, January 26, 2012

Twitter bootstrap popover doesn't work with click event

We were playing with the Twitter bootstrap javascript library lately,  and found out the popover doesn't play well with 'click' event in Chrome (FF works though).  I tried to find solution on the web, but didn't find what we want or the solution doesn't work. Hopefully this post might provide a solution that can help others.

The way we get around this is to wrap the popover call inside a callback which listen to click.
        // ... probably in your initialize function
        $('my-selector').bind('click', this.showPopover);

        // ... somewhere inside an object
        showPopover: function(e){
            var $popTrigger = $(e.target),
                $closeBtn = $('.popover .close-btn');

            $closeBtn.trigger("click");

            (function(that){
                $popTrigger.popover({
                    html:true,
                    placement:'below',
                    offset:8,
                    trigger:'manual',
                    title:function () {
                        return "Well, title!"
                    },
                    content:function () {
                        return that.getContent();
                    }
                });
            })(this);

            $popTrigger.popover("show");

            $closeBtn.live('click', function(e){
                $popTrigger.popover("hide");
                e.preventDefault();
            });

            e.preventDefault();
        }


You can enhance the code by checking if the elements already have desired events attached, so you don't need to trigger that twice.  And if you are designing a one page app, you may need to add function to  hide/remove the popover when the page context is changing.

Wednesday, January 4, 2012

Another good javascript interview question

I was debugging some Node.js code recently and found a bug that is so obvious but very easy to get that  to creep in if you are not careful enough. The following code is just a sample, not reflecting the real code that I'm working on.

The buggy version
Do you see the problem??  That could be one of the interview questions for my next candidate.  I can think of  three different ways to solve this scope issue, two of them are pretty standard, the other one is more elegant :)  Can you think of at least one?

(function() {
//...
for ( key in MyModules){
    if(MyModules.hasOwnProperty(key)){
        module = MyModules[key];
        // if you're not coming from Node.js, the code 
        // inside will get execute during runtime
        app.get(module.regEx ,function(req,res,next){
            module.router(req,res,next,module.collection); 
        });
    }
}
//...
}());

As a javascript developer, the basic minimal concepts we should know before going into an interview would be "prototype, scope and closure".  Because from those concepts, one can generate different patterns out from them.