No installation. USB stick portable applications.
Swiss File Knife

a command line
multi function tool.

remove tabs
list dir sizes
find text
filter lines
find in path
collect text
instant ftp or
http server
file transfer
send text
patch text
patch binary
run own cmd
convert crlf
dup file find
md5 lists
fromto clip
hexdump
split files
list latest
compare dirs
save typing
trace http
echo colors
head & tail
find classes
dep. listing
speed shell
zip search
zip dir list

Depeche View
Source Research
First Steps

firefox add-ons

using vm linux

windows GUI
automation

the d3caster
java game engine

command line
file encryption

free external tools,
zero install effort,
usb stick compliant:

zip and unzip
diff and merge
reformat xml
reformat source

java sources

thread creation

cpp sources

log tracing
mem tracing
hexdump
using printf

articles

embedded
stat. c array
stat. java array
var. c array
var. java array
view all text
as you type
surf over text
find by click
quick copy
multi view
find nearby
fullscreen
bookmarks
find by path
expressions
location jump
skip accents
clip match
filter lines
edit text
highlight
load filter
hotkey list
receive text
send in C++
send in Java
smooth scroll
touch scroll
fly wxWidgets
fly over Qt
search Java

 
Bookmark on del.icio.us Bookmark on Google Add to Mr. Wong
Bookmark on digg.com Add to StumbleUpon Bookmark on Yahoo

How to create one or more threads in Java with a few lines of code. Free source code examples with simple instant solutions.

SFK The Book - Read Syntax In The Subway.

starting point: a simple java program, having just one thread - the main thread.

public class csj01x1 
{
   public static void main(String args[]) throws Throwable  
   {
      new csj01x1().myfunc();
   }

   void myfunc() throws Throwable
   {
      for (int i=0; i<100; i++) {
         System.out.println("thread "
            +Thread.currentThread().getName()+" step "+i);
         Thread.sleep(500);
      }
   }
}
output:
   thread main step 0
   thread main step 1
   thread main step 2
   thread main step 3
   ...
solution 01: creating two parallel threads by implementing the Runnable interface, i.e. adding a "run" method.

public class csj01x2 implements Runnable
{
   public static void main(String args[]) throws Throwable  
   {
      csj01x2 obj1 = new csj01x2();
      csj01x2 obj2 = new csj01x2();
      new Thread(obj1).start();
      new Thread(obj2).start();
      // main thread is ending here,
      // Thread-0 and Thread-1 continue to run.
   }

   public void run()
   {
      try {
         for (int i=0; i<100; i++) {
            System.out.println("thread "
               +Thread.currentThread().getName()+" step "+i);
            Thread.sleep(500);
         }
      } catch (Throwable t) { }
   }
}
output:
   thread Thread-0 step 0
   thread Thread-1 step 0
   thread Thread-0 step 1
   thread Thread-1 step 1
   thread Thread-0 step 2
   thread Thread-1 step 2
   thread Thread-0 step 3
   thread Thread-1 step 3
   ...


solution 02: alternatively, we may create two parallel threads by deriving our class from the "Thread" class. in this case, we also have to provide a "run" method, because Thread uses the Runnable interface.

public class csj01x3 extends Thread
{
   public static void main(String args[]) throws Throwable  
   {
      new csj01x3().start();
      new csj01x3().start();
      // main thread is ending here,
      // Thread-0 and Thread-1 continue to run.
   }

   public void run()
   {
      try {
         for (int i=0; i<100; i++) {
            System.out.println("thread "
               +Thread.currentThread().getName()+" step "+i);
            Thread.sleep(500);
         }
      } catch (Throwable t) { }
   }
}
this produces the same output as solution 01, but it has one tradeoff: as we derive our class from Thread, we can no longer derive it from anything else. therefore solution 01 is more flexible.

Download the free Depeche View Lite Text Search Tool