Saturday, 28 March 2009

HTML and CSS basis [video]

http://css-tricks.com/video-screencasts/58-html-css-the-very-basics/

Sunday, 22 March 2009

Using javascript to display RSS

Javascript to parse RSS
Simple AJAX style example
Using javascript library

Using java to retrive and display RSS

Basic method to retrieve RSS content
Another widely used method to retrieve RSS content by TAG

The RSS example

Monday, 9 February 2009

Advanced Thread Programming: Synchronization

import java.util.*;

public class Que {

/**
* @param args
*/
public static void main(String[] args) {

mapQ q = new mapQ();

new genQ(q);
new conQ(q);
}
}

////////////////// the commodity Queue /////////////////
class mapQ {

String s;
LinkedList que = new LinkedList();

synchronized void put(String s) {

if (que.size()>10)
try {
wait();
}
catch(InterruptedException e) {
System.out.println("InterruptedException caught");
}
que.addLast(s);
System.out.println("Put: " + s);
notify();
}

synchronized String get() {

if (que.isEmpty())
try {
wait();
}
catch (InterruptedException e) {
System.out.println("InterruptedException caught");
}
String temps = (String) que.removeFirst();
//System.out.println(que);
System.out.println("Got: " + temps);
notify();

return temps;
}
}

//////////////// producer /////////////////////
class genQ implements Runnable {
mapQ q;

genQ(mapQ q) {
this.q=q;
new Thread(this, "Producer").start();
}
public void run() {
int i=0;

while(true) {
int tempi = i++;
q.put(Integer.toString(tempi));
}
}
}

/////////////// consumer ///////////////////////
class conQ implements Runnable {
mapQ q;

conQ(mapQ q) {
this.q=q;
new Thread(this, "Consumer").start();
}

public void run() {
while(true) {
q.get();
}
}
}

Sunday, 1 February 2009