Author: MC

  • Time Synchronisation With Windows 2000 or XP

    If you’re running Windows 2000 or XP at home, it’s very unlikley that you have a ‘Primary Domain Controller’ to give you the time of day. πŸ˜‰ Windows 2000 & XP has a built in “Windows Time” service that is also compatible with public SNTP Time Servers, all you need to do is configure it.…

  • Fedora Core 4 and SELinux paranoia

    β€”

    by

    in

    The default configuration of Fedora Core 4 with SELinux enabled causes problems when you want to use the UserDir feature in Apache Httpd. Problem: SELinux is stopping the httpd processes from accessing your home directory. [code] Forbidden You don’t have permission to access /~foo/ on this server. Additionally, a 403 Forbidden error was encountered while…

  • Velocity Templates and Newlines

    If you’re reading this article you’ve probably encounted the same problem as I have. I was trying to put a newline ‘\n’ character in the value of a variable in a Velocity template. Attempt 1: I assumed \n would work… [code] #if ( !$foo ) #set ( $foo = “There was no foo set in…

  • Java Object Digester

    β€”

    by

    in

    I was working on a web-based application recently and wanted a lazy way to get data from a simple ‘value object’ out to the front end without having any hard-coded field names; I came up with this. Basically, this method will take any Object, iterate through its methods looking for any of the format “get<something>”…

  • Unicode? Character Sets? UTF-what?

    I was inspired to add this note after recent frustrations about the complete ignorance of character sets in both Commercial & Open software… I seriously recommend everyone reads the following, less ISO-blahblahblah and more UTF-8, no excuses! The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) http://www.joelonsoftware.com/articles/Unicode.html

  • SSL Certificates Rant…

    It’s May; it’s coming to that time of the year where I have to update my SSL certificate again. As I did last year I had a good look round for an official SSL option. Since I only use it for accessing my own web-mail and a few other toys, I loath the thought of…

  • Prolific PL-3507 Hi-Speed USB & IEEE 1394 Combo to IDE Bridge Controller

    β€”

    by

    in

    I have a generic USB2/IEEE1394 (Firewire) external hard drive enclosure. It is built on the Prolific PL-3507 Hi-Speed USB & IEEE 1394 Combo to IDE Bridge Controller; this is a record of my recent troubles with it. Currently it house’s a Maxtor 6 Y130M0 (120Gb) Hard Drive. I’ve found it to be totally unreliable over…

  • Java Snippet – ANT Jar Task

    β€”

    by

    in

    Builds a JAR file Test.jar and generates a manifest specifying that class Test is the Main-Class. [xml] [/xml]

  • Java Snippet – Using SecureRandom

    β€”

    by

    in

    A better random number generator [java] import java.security.SecureRandom; … public static SecureRandom random = null; static { try { random = SecureRandom.getInstance(“SHA1PRNG”); random.setSeed( random.generateSeed(256) ); } catch( Exception e ) { e.printStackTrace(); } } [/java]

  • Java Snippet – Fast File Copy

    β€”

    by

    in

    When using JDK 1.4 and above… [java] public static void copyFile(File in, File out) { try { FileChannel sourceChannel = new FileInputStream(in).getChannel(); FileChannel destinationChannel = new FileOutputStream(out).getChannel(); sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel); // or, you can also copy it this way // destinationChannel.transferFrom(sourceChannel, 0, sourceChannel.size()); sourceChannel.close(); destinationChannel.close(); } catch ( Exception e ) { e.printStackTrace(); } }…

  • Java Snippet – Recursive Directory Deletion

    β€”

    by

    in

    Returns true on success, false on failure: [java] public static boolean deleteDir(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); for (int i=0; i<children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { return false; } } } return dir.delete(); } [/java]

  • Instant Password Recovery Tool

    β€”

    by

    in ,

    I made this back in April 2004, it only took a couple of hours to write and build the database. Basically, I took a wordlist of 535,683 words and hashed them in MD5, SHA1 & LANMAN. The results are stored in a simple MySQL table, indexes on that table make lookups REALLY fast and thats…