木曜日, 6月 26, 2008

GenaratePassword.java

As the name suggests -- this snippet generates an 8-letter password (that's all).


public class GeneratePassword
{
public static void main(String args[])
{
String alphanumeric="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
int len=alphanumeric.length();
for(int i=0;i<8;i++)
{
int index=(int)Math.floor(Math.random()*len);
System.out.print(alphanumeric.charAt(index));
}
}
}

PHP: 定数を扱う

プロジェクトごとの定数を扱うクラス Config\Constants の紹介です。 <?php namespace Config; class Constants {     public const DB_USER = "linguist...