javascript apply, call and constuctor

Let’s first create a simple function that we will be using through the rest of this post. This function will just return an array with the current value ofthis and the two supplied arguments. <script type=“text/javascript”> function makeArray(arg1, arg2){     return [ this, arg1, arg2 ]; } </script> Most common way, unfortunately, global function calls When we are learning JavaScript we learn how to define…

javascrip closure

First, a very very good article explaining CLOSURE Second, I like this answer in Stackoverflow: A function in JavaScript is not just a reference to a set of instructions (as in C language) but also includes a hidden data structure which is composed of references to all nonlocal variables it uses (captured variables). Such two-piece…

javascrip callback

How Callback Functions Work? Because functions are first-class objects in JavaScript, we can treat functions like objects, so we can pass functions around like variables and return them in functions and use them in other functions. When we pass a callback function as an argument to another function, we are only passing the function definition….

build rest api with node and express js

1. in the app js we need   2. To share the mongo db connection we can have the db info in a js file: 3. To share the model schema, we can put the content in a js file: 4. then in the rest implementation js module : DONE. To test them , remember…

set up mongo db in windows and osx

OSX 1. download mongo and unzip to some folder, rename folder to mongodb. i put it under ~/Documents/develop/mongodb 2. create  folder “data” under “mongodb”.  create folder “db” under “data” create folder “logs” under “mongodb”. create file “mongodb.log” 3. create file mongodb.conf under ~/Documents/develop/mongodb/bin with content: dbpath = ~/Documents/develop/mongodb/data/db directoryperdb = true logpath = ~/Documents/develop/mongodb/logs/mongodb.log logappend = true rest…

set up node js

Was playing around with node today, some notes for setting up. To install node, just go to the nodejs site and download. To run sample from the node site, create the something like yourapp.js file with the content they provide, open cmd or your terminal, navigate to the folder containing the js file. and run…

Thread interrupt is not always working!

  Background Interrupting a thread means stopping what it is doing before it has completed its task, effectively aborting its current operation. Whether the thread dies, waits for new tasks, or goes on to the next step depends on the application. Although it may seem simple at first, you must take some precautions in order…

speed up gwt compilation

1. use ” <draftCompile>true</draftCompile> ” in the gwt-maven-plugin configuration. 2. use another build profile to limit permutation: HERE is the detail . To set gwt up, use : mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.1 -DgroupId=com.goodtrendltd.gwt -DartifactId=MyDemo -Dversion=1.0-SNAPSHOT

gwt table td tr getOffsetHeight() inconsistency if border is set

In Gxt3 grid’s column header, if you set any border to the header row, your column header will grow. Also if you have filter in the header, even just hovering on the filter will cause the growth. After digging into the code, the following code in ColumnHeader causes this: (my current version is 3.0.6) This…