Archive for the ‘Code’ Category

WordPress eBook Export

This is a very very early development release of a plugin for WordPress to export a category as an eBook, currently only ePub. Some features don’t work and many are not implemented.

Anyway, use at your own risk.
Download Plugin

Git repository.

Posted January 28th, 2010 in Code, PHP, WordPress - View Comments

Simple Cache Library for CodeIgniter

I wrote a simple caching library for CodeIgniter since database caching and page output caching were not suitable for my needs.

Usage:

class Test extends Controller {
 
	function main()
	{
 
		// load the library
		$this->load->library('simple_cache');
 
		// key is the name you have given to the cached data
		// will check if the item is cached
		if (!$this->simple_cache->is_cached('key'))
		{
			// not cached, do our things that need caching
			$data = array('print' => 'Hello World');
 
			// store in cache
			$this->simple_cache->cache_item('key', $data);
 
		} else {
			$data = $this->simple_cache->get_item('key');
		}
 
		$this->load->view('hello', $data);
	}
 
}

I don’t think I need to explain anymore? Maybe I will update with a better description later.

I’m releasing it under the GPLv3. Enjoy.

Download simple-cache.7z

Posted January 24th, 2010 in Code, PHP - View Comments

WordPress Tutorial – Table of Contents in a Page

This tutorial will explain how to add a table of contents to a generic WordPress page. Our table of contents will be a list of posts in chronological order. This tutorial is a follow up to a comment on the post for my WordPress Table of Contents Widget by Ashley who indicated that she would be interested in the capability of having a table of contents in a page rather then the sidebar. Read more

Posted September 23rd, 2009 in Code, Tutorials, WordPress - View Comments

Introduction to PHP: Installing PHP (Windows)

This tutorial will take you through the steps needed to install PHP on Microsoft Windows. I’m using Vista, but with minor changes, these instructions should also be valid for Windows XP and Windows 7 as well. Read more

Posted July 15th, 2009 in PHP, Tutorials - View Comments

My Development Environment

I thought it would be nice to make a post about my development environment. That is, the tools and applications I use in my development of Muse’s Success and other projects.

Editor: Eclipse plus Aptana Studio and CFEclipse. I also like Winsyntax for PHP development.

Source Code Management: Git.

Test Server: Apache/2.2.11 PHP/5.2.9-2 mod_python/3.3.1 Python/2.5.4 JRun/4.0

Operating System Windows Vista + Ubuntu. I want a Mac OS X machine as well.

Database Management: phpMyAdmin

File Upload: Filezilla

I would be interested in hearing about what you use to develop your web applications in either the comments or as a trackback to this post.

http://www.phpmyadmin.net/home_page/index.php

Posted July 12th, 2009 in Code - View Comments

Introduction to PHP: Hello World + MySQL

This tutorial builds on the previous tutorial – Introduction to PHP: Hello World and as such, you should take that tutorial first if you have not already.

In this tutorial, we are going to take our previous Hello World script, and store the date in a database. We will then add the last access time to our original script. Read more

Posted June 30th, 2009 in PHP, Tutorials - View Comments

Introduction to PHP: Hello World

This tutorial will introduce you to PHP with the customary Hello World script. You will be introduced to the echo language construct and the date() function. The goal of this tutorial is to show you how to output text, and display the current date.
Read more

Posted June 18th, 2009 in PHP, Tutorials - View Comments

Introduction to PHP: Includes

This tutorial will introduce you to the PHP include statement, and its almost identical sibling, require.

The include statement is used to insert the contents of one file into the contents of another.
Read more

Tags: , , , , , ,

Posted June 11th, 2009 in PHP, Tutorials - View Comments

Thoughts on ColdFusion

One of the units I am taking this study period is Internet Design – Dynamic Environments. We have been given the choice between learning either PHP or ColdFusion. Since I’ve already been coding in PHP for a number of years, I have decided to learn ColdFusion. I was originally planning on learning Python this month, but I may have to put that on hold for awhile. I don’t mind learning two languages at once, but I am already learning Japanese, and have commited myself to doing some work on Muse’s Success, and regularly blogging here.

I started ColdFusion learning last week, and I appear to have made some decent progress. I have a basic forum working. I’m not sure how secure it is, and posts are not formatted, not even paragraphed, but I will look into that soon. Compared to when I learned PHP, I’ve made a lot more progress then I did in PHP in the time-frame of about 5 days. Many of the concepts used in one language seem to be able to be applied to another, and I’m attributing it to familiarity of the concepts that my progress has been swift.

Age may also have something to do with it, I was around 13, perhaps 14 when I began learning PHP and it was before I could say I had a solid grasp of HTML and CSS which certainly did not help. I remember being quite proud of myself when I was able to modify existing scripts, and archive desired effects. Even happier still, when in either late 2004 or early 2005 I was able to get my first significantly custom forum script (a GameFAQs spin-off) to run – not modified existing code. The main project before that was a video game database script, somewhat based on Vortex Portal on the back-end.

I am a bit disappointed in myself when I realise its been approximately 5 years since I first began learning PHP, and its still the only language which I work with. I should have attempted to learn another language before now. That being said my hosting environment only supports PHP5, so I won’t be able to use a new language for anything web based without purchasing another hosting account elsewhere.

ColdFusion appears to encourage the mixing of presentation and business logic which I dislike. There is probably a template engine that addresses this.  I also dislike mixing both ColdFusion Markup Language, and JavaScript… I mean CFScript. I would prefer ColdFusion chose one and stuck to it. That ColdFusion works based on tags also means that I cannot produce well formatted HTML (properly indented and nested) without making my source code unreadable, so a lot of unnecessary white-space in the outputted pages is annoying.

Being a fan of open source, I also dislike that ColdFuson is proprietary unlike most other popular web scripting languages. I am somewhat encouraged that there are some open source implementations of CFML. They seem to be more or less compatible with what I have written so far. I wonder if that holds true for more complicated applications. Those interested in ColdFusion but who are put off by it being a proprietary product should check out either Smith or BlueDragon.

I’ve pointed out what I dislike, but there are also things that I like. I like the built in form validation feature. I’m not a fan of the route it takes in implementing this, but it certainly makes producing a working and secure form much quicker. I also like how ColdFusion handles databases. I was initially opposed to it, but the system appears to prevent issues with database details being exposed if the server is miss-configured and exposes the source code. I also like that I only have one interface to work with any supported database. I generally use abstraction in my PHP scripts but ColdFusion does not need this in the first place. I also like that ColdFusion’s error messages are much more useful to me then PHP’s which are rather vague in some cases.

I can’t see myself developing any major projects in ColdFusion, but I am putting enough effort into learning it that this unit shall expand my horizons are far as career choices go once I conclude university. I don’t think I will mind developing in ColdFusion, but will likely continue to prefer PHP, and from the looks of things Python once I get around to learning it.

Tags: , , , , , , , ,

Posted June 11th, 2009 in ColdFusion - View Comments