Login | Sign Up Register with Facebook

Cameron's Thoughts

Why would you want to know what I'm thinking? Weirdos.

PHP and the Lack of Named Parameters

When using PHP, one issue I've had for a while is figuring out a way to map API input parameters to methods in my code. For instance, I have an API for John VanOrange that allows anyone to access most of the site's functionality. The public API methods all map to classes and functions inside those classes. Each of these methods allow for various parameters to be passed into them.

No comments yet

Image Renaming

I had a large directory of images that were all randomly named. None of them had file extensions or anything. So, I wrote up some lines of bash that uses ImageMagick to figure out what type of images these were, and then give them a random filename based on the MD5 hash of the current name. This way everything was at least normalized.

No comments yet

Displaying a Simple Calendar in PHP

I noticed that there wasn't much out there when it came to just simply displaying a calendar on a website. Most the examples I found were overly complicated. So, I came up with a little snippet of code that outputs a calendar for any given month and displays it as an HTML table.

No comments yet

PHP and the pcre.backtrack_limit

Just came across this today. Looks like in PHP 5.2, they decided to add a 100000 byte limit to regular expression matches. This can stop a lot of searches on long strings, and the worst part is that PHP doesn't throw any error when that limit is reached. If you are using the perl-compatible regular expressions in PHP, you will likely want to change the pcre.backtrack_limit in the php.ini file to something larger than 100000.

No comments yet

CommentAPI for Movable Type

I was going through some things on my site today, fixing up some bugs and such. One thing I noticed was that I never rewrote my CommentAPI support after I changed the way comments were handled on this site. I don't believe anyone ever posted a comment using CommentAPI, but I thought it was kind of nice to learn how it worked and to provide some support for it. It's somewhat of an older standard, and never really caught on, but I think it is really handy. Anyhow, I thought I'd release the code I had come up with. It still needs a little work to be perfect, but this did allow comments to come in on my Movable Type 3.2 system.

1 comment

New DataAdmin Documentation

So, I've finally decided to create some decent documention for the DataAdmin PHP class I wrote. Before, a lame text file was all there was. There is now a wiki available. The current state of the information is about the same as it was before in the text file, but it's now much more organized and easier to browse through. I plan to add more full coding examples and such soon. Additionally, the login system for the wiki has been hooked into the login system for this site, so if you have an account here, you can also use the same info for the wiki.

No comments yet

DataAdmin Class 1.08 Update

I made a small little update to the DataAdmin class today. This is the first update in close to a year. All I did was add the ability to set a variable 'editable' to FALSE which then disables being able to click on data to edit it. This was simply a feature I needed for part of a backend update to this site.

No comments yet

Database Admin PHP Class

I've got around to releasing a PHP class that I use for MySQL database administration. It's released under the LGPL. I plan to do a more detailed write-up about this soon. Basically, this class will allow you to add, edit, delete, and cross-reference data from databases and requires only minutes to setup with basically no HTML to do.

No comments yet

Validating Web Pages

Thought I would share this bit of code as some people might find it useful. Ever since I started working to make sure my pages were compatible, I have come up with a number of things to help me to accomplish this. Now, every page on this site should be fully xHTML compliant and I have setup a number of backend protections to stop most things from causing the sites to stop validating. One thing I wrote was a simple PHP function that can be used in any script that gives some feedback as to if a website is valid or not.

No comments yet