Jan
27
2010
0

Server-side Prototype JS in classic ASP

Back in 2007, I found myself doing a lot of classic ASP work in VBScript. For anyone who has had to endure this, I created a library to help you out (released under the MIT open source license). Since classic ASP runs under Microsoft Active Scripting, this means you can write ASP pages in page in any supported scripting language; I’ve even gotten Python working under classic ASP.  The library allows you to use a more functional programming idiom on the server-side, thanks the Prototype library and JScript, a supported scripting language. I’ve merely reposted my original version, but I plan to update it to the latest version of the Prototype library and move the code to either GitHub or Google Code. Until then, give it a shot.

Written by Dan in: General | Tags: , , , , ,
Nov
18
2009
0

Verified by Visa’s insecure password requirements

Several retailers have signed up for Visa’s Verified by Visa program, which adds an additional step to the familiar online credit card process. Theoretically, this step makes the transaction more secure by allowing you to specify and use a password in addition to the usual details like “name on card” and “billing address”. Unfortunately their password requirements are terrible. Passwords must contain at least 6 characters and at most 8 characters, must contain at least one letter and at least one number and no special characters allowed.

Here is their javascript password validator:


if( (/\W/).test(document.passwdForm.pin1.value) || (document.passwdForm.pin1.value.length < 6) || (document.passwdForm.pin1.value.length > 8 ) )
{
    alert("Your password does not conform to the Password Policy. Please try again.");
    document.passwdForm.pin1.focus();
    return false;
}

For a feature that supposedly exists to protect my money on the web, this is just pathetic.

Written by Dan in: General |
Nov
17
2009
0

No Leonids for Littleton

Not wanting to drive outside of the city at 2 AM, I figured I’d try to catch one or two meteors from The Leonids from my backyard. Sadly, all I got was a pretty indigo sky and some nice looking stars. Until next time…

No Leonids for Littleton

No Leonids for Littleton

Nov
05
2009
0

Groovy deserialization troubles

In a grails application, I needed to persist a complicated expression tree to the database, but I didn’t want to have Hibernate generate a database table for the information as it would greatly affect read performance (lots of joins) and I don’t need to have relational access to subsets of the tree. I decided to serialize the entire tree into a BLOB.

After creating a Hibernate userType to handle the serialization/deserialization, I ran into a ClassNotFoundException when attempting to deserialize my object.  I found out that this is due to java using the “last defined ClassLoader” when deserializing with an ObjectInputStream, which might not be the right ClassLoader in a Groovy environment (see: http://jira.codehaus.org/browse/GROOVY-1627.

The solution? Subclass ObjectInputStream to allow you to pass in a predefined ClassLoader and override the resolveClass(ObjectStream classDesc) to use this ClassLoader parameter:


public class ClassLoaderAwareObjectInputStream extends ObjectInputStream {

 private ClassLoader myClassLoader;

 public ClassLoaderAwareObjectInputStream(ClassLoader myClassLoader) throws IOException, SecurityException {
 super();
 this.myClassLoader = myClassLoader;
 }

 public ClassLoaderAwareObjectInputStream(InputStream in, ClassLoader myClassLoader) throws IOException {
 super(in);
 this.myClassLoader = myClassLoader;
 }

 @Override
 protected Class resolveClass(ObjectStreamClass desc) throws IOException,
 ClassNotFoundException {
 String name = desc.getName();
 return Class.forName(name, false, myClassLoader);
 }
}

Thanks to Satish Gunnu for the tip.

Oct
27
2009
0

Why I choose to run linux

Automatic Updates automatically restarts your computer for you

Automatic Updates automatically restarts your computer for you

Written by Dan in: General |
Oct
27
2009
2

Grails GORM and UUIDs

Let’s say that you’ve decided you want to add a globally-unique identifier (GUID/UUID) to one of your domain classes. You might want to do this for portability to other systems or for a variety of reasons. Given that some people in the Grails community don’t recommend using a UUID or string as a primary key, you might find that you want to add a UUID as a separate natural key to your class and set it using GORM’s beforeInsert event hook:

class Person {
    String name
    String uniqueIdentifier

    transient beforeInsert = {
        uniqueIdentifier = java.util.UUID.randomUUID().toString()
    }
}

This works great, but if you’re like me, in that you like to work with test data while developing, you probably have some code in your BootStrap.groovy file that no longer works. The problem is that GORM’s validate() method does not call event hooks, and that property we just added is not nullable. One small change and we’re back in business:

class Person {
    String name
    String uniqueIdentifier

    stating constraints = {
        uniqueIdentifier(nullable:true)
    }

    transient beforeInsert = {
        uniqueIdentifier = java.util.UUID.randomUUID().toString()
    }
}
Written by Dan in: Grails |
Jun
29
2009
0

HR 2454 and the redistribution of wealth

H.R 2454 contains a provision to pay tax (aka “your”) dollars to low-income households to offset the “estimated loss in purchasing power resulting from this Act”. What does this mean? Everybody loses purchasing power as a result of this legislation, but only low-income families get the privilige of a refund funded by taxes–taxes which are 67.7% funded by the top 10% of income earners (social security excluded). The only way this makes sense is if you think that people become rich by stealing from others, as opposed to the (much more reasonable) concept that they produce goods and services that benefit society as a whole in addition to themselves.

Written by Dan in: General |
Jun
25
2009
2

Happiness is a 3-minute build

We just recently moved our continuous integration server to new hardware and removed a costly database comparison step, which shortened our build time from 10 minutes to less than 3. Half the time is spent on unit tests, and we include a build versioning step which prepares every build for potential release.

Cutting those seven minutes out of the feedback loop may not seem like much, but when you consider that we average about 20 builds per day that’s significant savings, even if there were only one developer waiting on the build results each time. Next up: database versioning using liquibase.

Written by Dan in: General | Tags: ,
Feb
23
2009
0

with spring comes flying weather

I’m excited for spring to arrive. It’s been far too long since I’ve been up in the air without the roar of a jet engine and the annoying beeps and dings of the seatbeat-sign.

My Wing - Advance Epsilon 4

My Wing - Advance Epsilon 4

It was too windy to fly that day

It was too windy to fly that day

Written by Dan in: General | Tags:
Jan
01
2009
3

danlynn.com at last

I finally got ahold of the domain danlynn.com. I had to wait about 5 years for this other Dan Lynn who lives in Sugar Hill, Georgia to cede the domain, but it’s mine now. Posts might be photography, bits of code, experiments in the kitchen, paragliding horror stories, or anything else that I find interesting that I think a few people might appreciate as well.

Written by Dan in: General |

Powered by WordPress | Theme: Aeros 2.0 by TheBuckmaker.com