- 博客(101)
- 资源 (10)
- 收藏
- 关注
原创 java wildcards examples
Specifying upper bound with extends // drawAll() can draw a list of shapes as well as a list of subtype of // shapes public static void drawAll(Collection shapes) { for (Shape
2013-05-14 13:26:35
576
原创 Sort
Selection sort: int i, j; for( i = 0;i < size - 1; i++ ) { int minValIndex = i; for( j = i; j < size; j++ ) { if( constianer[minValIndex].value
2012-12-14 00:47:39
395
原创 C++ static variable initialization
Because static member variables are not part of the individual objects, you must explicitly define the static member.If you fail to initialize the static variable,Undefined Reference to staticVal
2012-10-15 04:07:52
828
原创 Saxon PE usage
To be honest, saxon PE documentation is super confusing. All I know is just a simple usage from Saxon PEBasic usage: java -cp saxon9pe.jar net.sf.saxon.Transform -s:${source} -xsl:${xslt file
2012-10-12 07:12:44
546
1
原创 Java Reading XML using DOM parser
Document, Element and Attr Interface ALL extend from Node Interface.The Document interface represents the entire HTML or XML document. Conceptually, it is the root of the document tree, and provides
2012-10-03 09:02:11
530
原创 Tomcat MVC example - FindCat
This program is developed in Tomcat7 Eclipse EEprogram purpose: Find the cat by its nameindex.html - has a input box that requires the name of the catInsert title hereCat name:
2012-10-02 10:25:19
540
原创 Javascript Array
ReferenceFor...inFor...in loop does not guarantee to keep the original order of the array, Use traditional for loop instead.Deletearray.splice(index,howmany,item1,.....,itemX)index: th
2012-08-24 06:51:41
376
原创 C linkedList
One Way Linked List/* * File: OneWayList.c * Author: xinghuazhang * * Created on March 22, 2012, 9:41 PM */#include #include #include #include /* one way linked list*/struct Node{
2012-08-20 07:40:13
2098
原创 XSLT(19) document() Function to access external xml
node-set document(object,node-set?)object Required. Defines an URI to an external XML documentnode-set Optional. Used to resolve relative URIExample:NOTE: WHEN use this funct
2012-08-18 09:58:05
1890
原创 Graph
graphgraph is an abstract data type that is meant to implement the graph and hypergraph concepts from mathematics.EdgeAn edge represents a connection between nodes. Edges can be either directe
2012-08-18 01:04:38
448
原创 Tree structure
treea tree is a widely used data structure that simulates a hierarchical tree structure with a set of linked nodes. Tree is a subset of graphnodeA node is a structure which may contain a value o
2012-08-18 00:55:55
652
原创 BinarySearch
Type: logarithmic algorithmPerformance: O(log N)Worse case: logN + 1Requirement - a is already sortedreturn index of the key from the array or -1 if not found public static int binaryS
2012-08-17 01:42:53
334
原创 Javascript Pattern Module pattern
The Module pattern encapsulates "privacy", state and organization using closures. It provides a way of wrapping a mix of public and private methods and variables, protecting pieces from leaking into
2012-08-13 12:03:45
350
原创 Javascript Closure
Simple example of closure:function sayHello(name) { var text = 'Hello ' + name; // local variable var sayAlert = function() { console.log(text); } return sayAlert;}var say = sayHello( "fef
2012-08-13 10:23:56
378
原创 Javascript OOP augmenting with prototype
prototype referenceAllows the addition of properties to all objects of type Object.we can extend the functionality of build-in types:// Add a method conditionally.Function.prototype.meth
2012-08-13 04:35:37
339
原创 Javascript Exception
The throw statement interrupts execution of the function. It should be given an exception object containing a name property that identifies the type of the exception, and a descriptive message propert
2012-08-13 03:23:47
510
原创 Javascript call and apply
Function.prototype.applyCalls a function with a given this value and arguments provided as an array.syntax:fun.apply(thisArg[, argsArray]).thisArgThe value of this provided for the call
2012-08-13 03:12:56
450
原创 Javascript Function
Functions are link to Function.prototype. Function.prototype is linked to Object.prototype.Since functions are object, they can have property, method, they can be passed to functions.The missing p
2012-08-13 02:33:10
374
原创 Dynamically add/remove class via Javascript
get classdocument.getElementById('id').classListdocument.getElementById('id').classNameadd/removedocument.getElementById('id').classList.add('class');document.getElementById('id').cl
2012-08-12 13:11:46
463
原创 Dynamically add/remove elements via JavaScript
Adding Elementsexample: appending an error span to formvar errSpan = document.createElement( "span");errSpan.style.display = "block"; // add styleerrSpan.classList.add( "error"); // add a class
2012-08-12 13:03:41
410
原创 Javascript Avoid global objects
Global objects are accessible through out the program. Wrapping global objects in a object that has the same name as the file name will decrease the number of global variablesmyapp.jsvar myap
2012-08-12 04:41:12
541
原创 Javascript validating form input using RE
Usually checking validity of form input involve regular expression.javascript RE is object it begins with / and ends with /syntax:var patt=/pattern/modifiers;modifiers:g: globali: case-i
2012-08-11 10:22:53
347
原创 Javascript OOP object literal
Everything in Javascript is object. Arrays, functions objects, regular expression are all objects. They are all passed by reference!Object in Javascript looks like HashMap in JavaObject Literal:
2012-08-11 06:22:47
821
原创 Node(25) sharing code between client and server
http://caolanmcmahon.com/posts/writing_for_node_and_the_browser/(function(exports){// your code goes hereexports.test = function(){return 'hello world'};})(typeof exports === 'undefined'
2012-08-11 04:07:30
1382
原创 Node(24) Express Project
make a express project using command promptexpress projectNamecd to the projectnpm installgo to localhost:3000 to see the project
2012-08-10 07:29:48
352
原创 Javascript Debug
Some of the best javascript debug tool is FIrebug in Firefox, developer tools in google chrome.make sure preserlog upon navigation, if not, the log will be disappear.make sure to check if ther
2012-08-09 06:13:53
470
原创 HTML5 - Form validation
validation should be done by Javascript before The form is submitted.JavascriptInput Elements has two most used propertiestype and valueexample : textbox( http://www.w3schools.com/js
2012-08-07 03:03:11
635
原创 Node(23) Express
Express is the most popular Node framework. Use Express to handle get and post are extremely simple.Hello Worldvar app = require('express').createServer();app.get( '/',function( req, res
2012-08-05 22:15:29
532
原创 Node(23) JSON
JSON example profiles.jsmodule.exports = { Peter : { name: 'Peter Parker', age: '18', gender: 'M', grade: 'B' }, Alex : { name: 'Alex Giggersn', age: '23', gender: 'F', grade
2012-08-05 19:59:40
1231
原创 Node(22) Downloading
example with throttlevar http = require( 'http');var fs = require( 'fs');var options = {};options.file = 'pride.txt';options.fileSize = fs.statSync( options.file).size;options.kbps = 32;htt
2012-08-05 08:28:49
806
原创 Node(21) DNS- lookup and resolve
resolve IP address:example from node.js APIvar dns = require('dns');dns.resolve4('www.google.com', function (err, addresses) { if (err) throw err; console.log('addresses: ' + JSON.stringi
2012-08-05 05:51:52
1054
原创 Node(20) File Upload with formidable module
handling file upload needs to include formidable module, writing raw code for file upload is tough.var http = require('http');var formidable = require('formidable');var form = require('fs').r
2012-08-04 23:36:03
714
原创 HTTP
The HTTP protocol enables web servers and browsers to exchange data over the InternetHTTP is connectionless - no connection is ever maintain.HTTP is media independent - any type of file can be s
2012-08-04 08:30:28
741
原创 Node(19) Global Objects
ReferenceA very important global object is process. process represent the current running node program.console is also a global object. console.log is the most common method to print debug c
2012-08-04 05:51:39
1498
原创 Javascript basics - types and variables
Javascript TutorialJavascript Core and HTML DOM ReferenceJavascript XML DOM ReferenceJavaScript OOP:http://phrogz.net/js/classes/OOPinJS.htmlhttp://phrogz.net/js/classes/OOPinJS2.html
2012-08-03 00:35:57
429
原创 CouchDB - Introduction
Reference HTTP APICouchDB: The Definitive GuideNoSQL is a class of database management system identified by its non-adherence to the widely used relational database management system (RDBMS)
2012-08-02 21:13:51
502
原创 Node(18) child_process
child_process has stdin and stdout for input and outputchild_process.exec(command, [options], callback)execute a commanddefault options:var options = { encoding: 'utf8',
2012-08-01 11:17:43
1620
原创 Node(17) Debug
Debug with consoleconsole.log( objects );to see the details of a object use util.inspectutil.inspect(object, [showHidden], [depth], [colors])Debug with EclipseFirst, instal
2012-08-01 10:46:46
804
原创 Node(16) working with couchDB
Apache CouchDB™ is a database that uses JSON for documents, JavaScript for MapReduce queries, and regular HTTP for an API. It is a NoSQL database. It is not a relational database.Node example to
2012-07-31 10:06:25
601
原创 Node(15) vm
vm is similar to eval(), but eval() can change the surrounding context, whereas vm cannotvm is like creating a sandbox, the code will be executed in the different namespace instead of running in the
2012-07-31 00:21:29
655
Computer Networking, A Top-Down Approach.pdf
2012-12-19
Sams teach yourself C++ Builder in 14 days
2010-08-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人