Friday, March 7, 2008

Playing around with the template

Well today I was playing around with the template to get it to display code better and what you see is the final result. I don't know if anyone will want it but I have uploaded it to google docs.

If you are interested in the template, you can display code by doing the following in the html:

Code goes here

Thursday, March 6, 2008

Blog Updates and Imagick Help

I have decided to turn my personal blog around and try and focus on some tech "stuff" as it will relate more to my current work.

Recently I found some interesting new tools to work with in PHP.
The first one is Imagemagick and the php plugin, Imagick, written partially by Mikko Koppanen. I will be using this to create previews of PDFs and other files for users to download.

Another interesting tool I have yet to mess around with is ezComponents. I found a reference to this site through Mikkos size. I will use this to make some nice looking graphs that will display stats.

I did find some functions to use in pdt/php ide on the eclipse site written by Nico Ehinger which I republished in plain text on google docs. I have also updated them and it should have all the current functions and constants but no comments or default values, available on google docs.

The following is the code I used to generate the last file:

isInternal() ? 'internal' : 'user-defined',
$class->isAbstract() ? ' abstract' : '',
$class->isFinal() ? ' final' : '',
$class->isInterface() ? 'interface' : 'class',
var_export($class->getParentClass(), 1),

echo "class " . $class->getName() . " {\n\n";

// Print class methods
echo "//Functions\n";
$methods = $class->getMethods();
foreach ($methods as $method) {
$class_method = new ReflectionMethod($method->class, $method->name);

$parameters = $class_method->getParameters();
$params = array();
foreach ($parameters as $parameter) {
$param_string = '$' . $parameter->getName();
if ($parameter->isPassedByReference()) $param_string = '&' . $param_string;
if ($parameter->isOptional() && $parameter->isDefaultValueAvailable())
$param_string .= ' = '.$parameter->getDefaultValue();
$params[] .= $param_string;
$method_params = implode(', ', $params);

//Comments Section
echo "\n\t/**\n";
foreach ($params as $i) {
echo "\t* @param $i\n";
if (!count($params)) echo "\t*\n";
echo "\t*/\n";

"\t%s%s%s%s%s%s function %s ( %s ) {}\n" ,
$class_method->isAbstract() ? ' abstract' : '',
$class_method->isFinal() ? ' final' : '',
$class_method->isPublic() ? ' public' : '',
$class_method->isPrivate() ? ' private' : '',
$class_method->isProtected() ? ' protected' : '',
$class_method->isStatic() ? ' static' : '',

echo "\n}\n\n";

// Print class constants
echo "//Constants\n";
foreach ($class->getConstants() as $constant_name => $constant_value) {
echo "define('".$class->getName()."::$constant_name', $constant_value);\n";