http://javascript.crockford.com/→ Continue reading “JavaScript Resources”
Category: Ryan’s Internet Technology, and Web Design Blog
ECMAScript 5 Compatibility Table
Very handy ECMAScript 5 compatibility table for the JavaScript programmer:
http://kangax.github.com/es5-compat-table/→ Continue reading “ECMAScript 5 Compatibility Table”
Creating a MD5 Hash in Java From Either a String or the Byte Value of a Long
Following is a quick example of how to generate an MD5 Hash (SHA-256, SHA-512 or any other supported hash algorithm) of either a String or the byte value of a long. You should be able to adapt for your particular application:
package com.ryanchapin.util;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class HashGenerator {
public static String createHash(long input, String hashAlgorithm) {
// Generate a byte array from the long
// Extract the byte value → Continue reading “Creating a MD5 Hash in Java From Either a String or the Byte Value of a Long”
Great PL/SQL Overview and Tutorial
List All Active Sessions in Oracle 11g
Here is a query with which you can see all of the active sessions on an Oracle database:
SELECT SID, Serial#, UserName, Status, SchemaName, Logon_Time
FROM V$Session
WHERE
Status=’ACTIVE’ AND
UserName IS NOT NULL;→ Continue reading “List All Active Sessions in Oracle 11g”
Adding MultipartConfig Configuration to web.xml in JBoss 6.x for a Servlet 3.0 File Upload Servlet
If you do not want to hard-code your file upload servlet with the @MultipartConfig annotation but would rather add it to your <servlet> configuration element in web.xml, following is the syntax (add this as a child element of <servlet>):
<multipart-config>
<location>/tmp</location>
<max-file-size>20848820</max-file-size>
<max-request-size>418018841</max-request-size>
<file-size-threshold>1048576</file-size-threshold>
</multipart-config>→ Continue reading “Adding MultipartConfig Configuration to web.xml in JBoss 6.x for a Servlet 3.0 File Upload Servlet”
Invocation of request.getParts() in a Servlet 3.0 doPost Method Will Not Throw IllegalStateException
This one requires a bit of explaination.
When writing a Servlet that will enable users to upload files from a form you need to be able to limit both the size of the file(s) and the entire multipart/form-data request. The Servlet 3.0 spec now includes a @MultipartConfig annotation (which can also be specified in web.xml, see other post in this blog).
Based on the Servlet 3.0 spec here is what is supposed to happen.
- The user submits a multi-part
Touching a File in Java
The following is a tutorial on how to create a empty file on the filesystem:
// Destination directory
File destinationDir = new File(“/some/path”);
// The ‘touched’ file
File doneFile = new File(destinationDir, “some_file_name”);
// The JVM will only ‘touch’ the file if you instantiate a
// FileOutputStream instance for the file in question.
// You don’t actually write any data to the file through
// the FileOutputStream. Just instantiate it and close it.
FileOutputStream doneFOS = null;
try {
doneFOS → Continue reading “Touching a File in Java”
Fixing "Software installation has been disabled by your system administrator" Notice When Attempting to Install An Addon for Firefox
When I attempted to install the Web Developer Add-on in Firefox I was presented with the error in the title of this post.
After some searching it seems that the least intrusive way to go about fixing it is to update the Firefox configuration for your user profile.
If you are on WinXP look in C:\Documents and Settings\UID\Application Data\Mozilla\Firefox\Profiles\fxlme5ka.default. On my install the following preference was in prefs.js
Change:
user_pref(“xpinstall.enabled”, false);
to:
user_pref(“xpinstall.enabled”, true);
Save the file and restart Firefox.→ Continue reading “Fixing "Software installation has been disabled by your system administrator" Notice When Attempting to Install An Addon for Firefox”
Configuring JBoss 6.x for HTTPS with a Self-Signed Cert
This tutorial makes the following assumptions:
- That you are running JBoss under a ‘jboss’ user whose home directory is /home/jboss/
For the following examples the string “<server-name/ip>” should be replaced with the domain name, or ip address from which the site will be accessed via https. Also the path to your installed JDK is likely different.
- Create a new keystore using the jdk provided binary:
# /usr/lib/jvm/java-1.6.0-openjdk/bin/keytool -genkey -alias your_alias -keyalg RSA -keystore keystore.jks
Enter keystore password:
Re-enter new password:→ Continue reading “Configuring JBoss 6.x for HTTPS with a Self-Signed Cert”