Entries Tagged as 'Code Snippets'

Sunday, May 4th, 2008

Releasing Java Vector Class

This semester, I took a class called “Computational Physics,” where we simulated various physical properties. For my final project, I wrote a simulation of the Solar System, and in the process, I wrote a “Vector” class for Java. It allows you to do 3 dimensional vector math operations pretty easily, like in the […]

Tuesday, April 15th, 2008

Cleaning Up User Submitted Data

A little while back, I complained about WordPress’ handling of URLs without “http://”. While it turns out WP actually handles these correctly, it brings up the question on how to handle a user’s inputted data. It’s always important to format or sanitize incoming data, and for items like URLs, which have a well-defined […]

Tuesday, April 8th, 2008

Clean Up Your Code By Overwriting Methods

Just wanted to share a quick Rails tip that has come in useful for me in the past. Let’s say you’re creating a forum, and when users register, they create a username (like “kyleslat”). However, they can edit their profile and add their full name (like “Kyle Slattery”). They also can decide […]