f1. Frequency Values for the Basic Notes

f2. The Different Octaves for the Musical Note A

August 19, 2008
Music, Physics and (JME)Programming
August 15, 2008
FileConnection optional API: example: Save a web-link file to phone
// open up web page
String version = “”;
try
{
//test if the phone support FileConnection
version = System.getProperty(“microedition.io.file.FileConnection.version”);
if (version != null) {
if (!version.equals(“1.0″))
throw new IOException(“Package is not version 1.0.”);
}
else
throw new IOException(“File connection optional package is not available.”);
System.out.println(“fc version is: ” + version);
Thread t = new Thread(){
public void run(){
//find out the root directory for the phone
// Enumeration drives = FileSystemRegistry.listRoots();
// System.out.println(“The valid roots found are: “);
// int ct = 1;
// while(drives.hasMoreElements()) {
// String root = (String) drives.nextElement();
// System.out.println(“\t”+root);//root1
// debug.debugTools.addMessage(ct, root);
// ct++;
// }
//Samsung A827: filesystem/ and Graphics/
//check the content of the root directory
String url = “file:///Graphics/MLinks.vbm”;
FileConnection wconn = null;
try{
// FileConnection fc = (FileConnection)Connector.open(“file:///filesystem/”);
// // Get a filtered list of all files and directories.
// // True means: include hidden files.
// // To list just visible files and directories, use
// // list() with no arguments.
// System.out.println(“List of files and directories under root1:”);
// Enumeration filelist = fc.list(“*”, true);
// int ct = 1;
// while(filelist.hasMoreElements()) {
// String fileName = (String) filelist.nextElement();
// fc = (FileConnection)Connector.open(“file:///filesystem/” + fileName);
// if(fc.isDirectory()) {
// System.out.println(“\tDirectory Name: ” + fileName);
// debug.debugTools.addMessage(ct, “dir: ” + fileName);
// } else {
// System.out.println
// (“\tFile Name: ” + fileName +
// “\tSize: “+fc.fileSize());
// debug.debugTools.addMessage(ct, fileName + ” size: ” + fc.fileSize());
// }
// ct++;
// }
// if(ct == 1){debug.debugTools.addMessage(ct, “nothing under filesystem”);}
// fc.close();
//write file to phone
wconn = (FileConnection)Connector.open(url, Connector.READ_WRITE );
if(wconn.exists()){
wconn.delete();
wconn = (FileConnection)Connector.open(url, Connector.READ_WRITE );
}
if (!wconn.exists()){
wconn.create(); // create the file if it doesn’t exist
OutputStream out = wconn.openOutputStream();
String ourl = “BEGIN:VBM\nVERSION:1.0\nTITLE:MLinks\nURL:http://www.mlinks.com/\nBEGIN:ENV\nX-IRMC-URL;QUOTED-PRINTABLE:=\n[InternetShortcut]URL=3Dhttp://www.mlinks.com/\nEND:ENV\nEND:VBM”;
byte[] ourlba = ourl.getBytes();
out.write(ourlba);
out.flush();
}
wconn.close();
} catch (Exception ioe){
System.out.println(“xxz: ” + ioe.getMessage());
debug.debugTools.addMessage(6, “xxz: ” + ioe.getMessage());
// tUI.mOpenDialog(“Unable to open browser.” + ioe.getMessage(),
// “OK”, null, 0, false);
repaint();
}
}//end of run
};
// t.setPriority(Thread.MIN_PRIORITY);
t.start();
}
catch (Throwable t)
{
OpenDialog(“Unable to open browser.” + t.getMessage() + “_” + version,
“OK”, null, 0, false);
repaint();
}
August 12, 2008
Set up an HTTPS server on top of Tomcat
Creating an SSL Certificate and Configuring Tomcat with SSL Connection (for Tomcat 6, Java 1.5 and Win XP SP2):
(from here: http://lemontz.blogspot.com/2007/01/opening-tomcat-ssl-connection.html)
- In command prompt, go to your Java home directory and go into the bin folder.
- Type in the following:
keytool -genkey -alias tomcat -keyalg RSA
This will open up the keytool from the JDK. It will create a SSL
certificate for you. For tomcat, the default password is ‘changeit’ (case
sensitive). - Once the certificate has been created successfully, a file called .keystore should have been created in your user home directory i.e. something similar to this on Win XP:
C:\Documents and Settings\xxzao\.keystore
Copy this file into your top most root directory of your tomcat installation directory i.e. on Win XP:
C:\
- Now go into the Tomcat installation directory and go into the folder conf and open you the file server.xml with an editor.
(C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\server.xml) - After this section “<!– Define a SSL HTTP/1.1 Connector on port 8443″, add the following:
<!– xxz custom stuff starts here for https aug 12 2008 –><Connector
port=”8443″ minSpareThreads=”5″ maxSpareThreads=”75″
enableLookups=”true” disableUploadTimeout=”true”
acceptCount=”100″ maxThreads=”200″
scheme=”https” secure=”true” SSLEnabled=”true”
keystoreFile=”${user.home}/.keystore” keystorePass=”changeit”
clientAuth=”false” sslProtocol=”TLS”/><!– Define a blocking Java SSL Coyote HTTP/1.1 Connector on port 8443 –>
<Connector protocol=”org.apache.coyote.http11.Http11Protocol”
port=”8443″ minSpareThreads=”5″ maxSpareThreads=”75″
enableLookups=”true” disableUploadTimeout=”true”
acceptCount=”100″ maxThreads=”200″
scheme=”https” secure=”true” SSLEnabled=”true”
keystoreFile=”${user.home}/.keystore” keystorePass=”changeit”
clientAuth=”false” sslProtocol=”TLS”/><!– Define a non-blocking Java SSL Coyote HTTP/1.1 Connector on port 8443 –>
<Connector protocol=”org.apache.coyote.http11.Http11NioProtocol”
port=”8443″ minSpareThreads=”5″ maxSpareThreads=”75″
enableLookups=”true” disableUploadTimeout=”true”
acceptCount=”100″ maxThreads=”200″
scheme=”https” secure=”true” SSLEnabled=”true”
keystoreFile=”${user.home}/.keystore” keystorePass=”changeit”
clientAuth=”false” sslProtocol=”TLS”/><!– xxz custom stuff ends here for https aug 12 2008 –>
- Restart Tomcat and you should be able to see the Tomcat splash page when you access https://localhost:8443.
Note: Use IE7 or Safari instead of Firefox.
Troubleshoot:
The best place to troubleshoot is always in the Tomcat log (yes! log is a wonderful thing which I have discovered since I entered the workfoce!!!).
If the following line is found in the log:
java.io.FileNotFoundException: C:\.keystore (The system cannot find the file specified)
This means it can’t find the .keystore file. Make sure the file is in the correct location (see above in the log that it expects the file to be found in the top most directory of your Tomcat installation folder).
If the following line is found in the log:
java.io.IOException: Keystore was tampered with, or password was incorrect
This means that the password you have entered is incorrect. The default password for Tomcat is ‘changeit’. A custom password can be used by setting the correct attribute for the connector element in server.xml. A new certificate must be created in order to fix this.
For more information:
This is only a summary of the steps I did in order to set up SSL connection for my Tomcat. I followed the following to help me to set up my SSL connection (which is where I got my information from):
Which has much more detailed information in there.