Uncategorized
php string contains
by ventrix on Feb.12, 2009, under Uncategorized
$text = “this is a happy cow”;
$a = “happy”;
if (strlen(strstr($text,$a))>0) {
echo “contained”;
} else {
echo “not contained”;
}
Creating random numbers in j2me and android within specific space
by ventrix on Nov.23, 2008, under Uncategorized, android, j2me, java
Creating random numbers in j2me within specific space
import java.util.Random;
/**
* Random Number Generator within specific space
* @param min is the minimum number to be produced
* @param max is the maximum number to be produced
* @return the random number
* @author ventrix
*/
public final class RandomCreator{
public static int getRandomInt(int min,int max)
{
try {
//Give the currentTimeMillis some time for the seed
Thread.sleep(2);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
Random randomizer = new Random(System.currentTimeMillis());
return randomizer.nextInt(max-min+1)+min;
}
}
Use it as: System.out.println(RandomCreator.getRandomInt(5,10));
System.out.println(”Hello world!”);
by admin on Oct.06, 2008, under Uncategorized
class Myfirstblogpost
{
public static void main(String args[])
{
System.out.println("Hello world!");
System.error.println("Nothing special here, except some code");
}
}