actionshrimp.com

fun and geekery

04 2009

CakePHP: PagesController with Admin Routing

Posted by Dave | Tags: , , , , ,

For small Cake websites with admin routing enabled, I like to use the Auth component to require a login for all admin routes, and allow access to everything else using the following beforeFilter in the AppController superclass:


function beforeFilter(){
    $admin = Configure::read('Routing.admin');
    if (isset($this->params[$admin]) and $this->params[$admin]){
        $this->layout = 'admin';
    }
    else {
        $this->Auth->allow();
    }
}

The problem with this however is static pages handled by the pages controller cannot be password protected. To resolve this problem, I had to overload the PagesController class that Cake comes with, and add in the required functionality. Part of the reason for doing this for me was to allow a setup where there was a password protected admin welcome page or control panel located at my_app_URL/admin, so I’ll show you the necessary routing to achieve that too.

Read more…


31  03 2009

CakePHP Tutorial Part 2: Authentication and Tweaking

Posted by Dave | Tags: , , , ,

cake-logo1In the first part of my CakePHP tutorial, I showed you how to use Cake’s Bake utility to set up the basic back end of an online illustration portfolio. In this part, I’ll tweak the automatically generated code into useable website and admin section and show you how to use some of Cake’s features along the way, including the Authentication component.
Read more…


28  03 2009

CakePHP Tutorial Part 1: Bake Utility

Posted by Dave | Tags: , , , , , ,

cake-logoA friend of mine recently asked me to help him build an online portfolio for his illustration pieces, and I decided to use CakePHP 1.2 to get the back end up and running quickly. I thought someone might find a tutorial taking a simple website through from start to finish useful, so this tutorial series will do just that. This part of the series takes you through the first few steps I took to get the basic code together.  You’ll need a web server and database server such as MySQL, and some basic PHP and webserver management knowledge. We’ll be using Cake’s “bake” utility to create the basic code as well, so you’ll need console access to your webserver, and PHP’s command line utility (in Ubuntu/PHP5 you can just install the package php5-cli).

Read more…


03 2009

Using Lightbox with Apache directory listings as an image gallery

Posted by Matt | Tags: , , , ,

ScreenshotAs you may know, if it can’t find an index.html the apache web server will show a list of files in the current directory. I was browsing through lists of images on my file server the other day and I thought, wouldn’t it be nice to have a next button? So I started digging around.

In the end I used a wonderful little script called Lightbox 2 and a bit of JavaScript Prototype magic to produce this (try clicking on the image files).

The directory listings are provided by an apache module going by the name of mod_autoindex. This module allows you to insert a custom header and footer through the directives HeaderName and ReadmeName. The plan is to insert some HTML that includes the Lightbox code and tags all the links to images with the rel=lightbox attribute that Lightbox uses to function.

Read more…


02 2009

Installing awesome Window Manager on Ubuntu Intrepid

Posted by Dave | Tags: , , , ,

Today I had a go at installing awesome window manager. awesome is a great tiling window manager, useful if you have a large monitor and are fed up with having one window taking up all the space when it doesn’t really need it all. For example, having firefox maximised on a 1920×1200 resolution monitor can mean you end up with very large sentences that spread across the screen, decreasing readability. Unfortunately the version of awesome in the Interpid repos is 2.3.2-1, which is now deprecated, and the current stable release is version 3.1-1.

awesomescreenmini

The website suggests building from source – I attempted this but there are currently a couple of issues with compilation mentioned in the wiki, and even with the fix suggested I couldn’t quite get it to work – although I didn’t try too hard it must be said; instead I found another method which I will walk you through now.

Read more…


31  12 2008

Cryptic Crossword Solver

Posted by Dave | Tags: , ,

Click here for the cryptic crossword solver.

I have recently been working on a free cryptic crossword solver to be used by my sister and parents who are fanatics. It is linked to a database of around 250,000 words, with the word list from the UKACD. It lacks a few useful phrases, so if anyone has access to a free cryptic phrase list please let me know in the comments so I can add it to the database.

The solver allows you to get a list of words that match letters and space patterns that you may already have in the crossword, as well as easily get definitions for words. There is also an anagram solver – useful for cryptic crosswords.  It currently needs a bit of a makeover, something I’ll do at some point soon hopefully. Any other suggestions or improvements, let me know!


13  08 2008

Logitech QuickCam E2500 on Ubuntu Skype

Posted by Dave | Tags: , , , ,

193818I recently discovered the wonders of skype, and tried to get my new webcam working with it under linux, and of course this proved to be quite tricky. After much fiddling I eventually got it to work, hopefully these steps will work for you too.

Read more…


13  05 2008

jsvi and TiddlyWiki

Posted by Dave | Tags: , , ,

When adding posts to my TiddlyWiki, I oft found myself craving vi, rather than a simple textarea. There were a few options that involved using a plugin for Firefox such as mozEx, and using an external program to edit textareas. However, I found a nice ‘integrated’ option instead.

Read more…


13  05 2008

Integrating LatexRender into TiddlyWiki

Posted by Dave | Tags: , , ,

This post is adapted from my LatexRenderPluginDoc page on my wiki, so might contain a couple of errors on the copy over. If something doesn’t seem right, refer to that page, and please tell me in a comment below.

This uses LatexRender, my simple TiddlyWiki macro, LatexRenderPlugin, and a custom script I created for the purpose, render.php, which renders LaTeX fed to it as an argument. You’ll need imagemagick enabled on your server.

Read more…


05 2008

Laptop hard drive clicking in Hardy

Posted by Dave | Tags: , , , , ,

Since I installed Hardy a week or so ago, I noticed the hard drive in my laptop was making a strange clicking noise every 5 seconds or so. At first I thought it must be slowly dying, and I was starting to get a bit worried, but then realised it seemed a bit suspicious that it coincided with Hardy so closely, so I searched around.

Read more…


Next Page »