April 27, 2009

GeoServer in Ubuntu

It's not difficult to setup Geoserver on your local Ubuntu by following these steps bellow:
======================================

1./ install java
2./ download binary Geoserver then unzip it in usr/local

3./ edit file startup.sh:
#PATH=/usr/sbin:/usr/bin:/sbin:/bin;
#DESC="Description of the service";
#NAME="geoserver";
#SCRIPTNAME=/etc/init.d/$NAME;

JAVA_HOME="/usr/lib/jvm/java-6-sun";
#GEOSERVER_USER="geoserver";
#GEOSERVER_DATA_DIR="/usr/local/geoserver/data_dir";
GEOSERVER_HOME="/usr/local/geoserver";

4./ to change default port 8080 to other by :
edit file jetty.xml

April 21, 2009

Mercurial

It's the way to access mercurial by hg command.
======================================
Clone from webserver to local-1
Clone from local-1 to local-2
After modifying local-2 then
"hg add filename/foldername"
"hg commit and write file"
Go back to local-1 then
"hg pull ../local-2"
"hg update"



Assign tag number with specific revision number
hg head //check revision number
hg tag -r 45 2.0.5

Sprockets & JSDoc

Sprockets is the Ruby's method which is used to generate all associated namespaces into one file.
----------------------------------------------
1./ Install Ruby and then install Sprockets by this command "$ gem install --remote sprockets" after Ruby.
2./ Write comments in your file as Sprockets' format.

/**
* Dependencies - for Sprockets packaging
**/
//= require
//= require
//= require
//= require

3./ Run command sprocketize with it's options in order to get your binded file.
$ sprocketize method_injector.js > method_injector_spro.js

======================================

JSDoc is a good way to write the project's documentations.
----------------------------------------------
1./ Install Java and download JSDoc toolkit into your computer.
2./ Write comments to describe your project as JSDoc's format.

/**
* Class that detects changes of a property on a source object then passes that new value to
a method on a target object
* @constructor
* @extends LL.AbstractNode
* @param {string} targetSetter The name of the method on the target objects
* @param {function} source Constructor of the object whose property we wish to observe
* @param {string} sourceKey The property we wish to observe on the source object
* @property {string} targetSetter The name of the method on the target objects
* @property {function} source Constructor of the object whose property we wish to observe
* @property {string} sourceKey The property we wish to observe on the source object
*/

3./ Run command bellow to generate your documentation as HTML file.

java -jar jsrun.jar app\run.js -a -t=templates\jsdoc mycode1.js mycode2.js mycode3.js

April 19, 2009

Javascript & Cookie

Here are the initial functions of Cookie in Javascript.
======================================
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.valueOf() + (30*60*1000)); // next 30 mins
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

function eraseCookie(name) {
createCookie(name,"",-1);
}