2009/05/27

initial array in java

1. static one:

int[] a;           // Declare a to be an array of ints
a = new int[100];  // Allocate an array of 100 ints
//or in a line
int [] a = new int[100];
//string type
String [] b = new String[100];

2. dynamic one:

Note: ‘Java does not offer arrays that can be extended at run time, for primitives or Objects, so it is common to use a Vector for a set of elements that needs to be able to grow.’ from javalobby

Vector v = new Vector();
int count = v.size();
String[] dynArray = new String[count];
v.copyInto(dynArray);

2009/05/08

How to embed youtbe video on the webpage

Here is code:
<object width="336" height="300">
<param name="movie" value="http://www.youtube-nocookie.com/v/VCtIS9vKdWg&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube-nocookie.com/v/VCtIS9vKdWg&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="336" height="300">
</embed>
</object>
Here is what it looks like: