Moving Kohana to a non public directory

Kohana, PHP framework

This is the second post in my series on the Kohana php framework.  For more, see:

Part 1: Getting started with the Kohana php framework

One of the simplest, and most basic security precautions that you can take is to move your application’s files into a non-public area of your webhost. Having your applications code and configs sitting there in your document root is just never a good idea. An attacker could very easily gain access to the source code of your application, as well as configuration. Next thing you know, there’s empty beer cans all over your apartment and the silverware’s missing. In general, this applies to any kind of web based application, but I’m going to be dealing specifically with Kohana, as part of my series on Getting Started with Kohana.

Continue Reading…

Getting started with Kohana, the Swift PHP Framework

Kohana, PHP framework

This is the first in a series of posts on installing and using the Kohana PHP framework.  For more in the series, see:

Part 2: Moving Kohana out of the docroot

Kohana home page

Kohana is an open source, object oriented, MVC framework that originated as a fork of the CodeIgniter project.

For a long time, I’ve been a big fan of CodeIgniter, the PHP framework. I’m still a big fan. CodeIgniter is lightweight, fast, and has a short learning curve. The problem is that it’s dead in the water, see After looking around at some other options, I’ve started putting Kohana through it’s paces. Kohana was originally a fork of CodeIgniter, although later versions have been rewritten from the ground up. So, first off the bat, there’s that shared ancestry, which should mean that a lot of my CodeIgniter knowledge will be directly translatable to the Kohana world. Kohana also keeps that commitment to being fast and lightweight. That’s important to me. A framework is a development tool. It should enable me to get something up and running quickly, but it shouldn’t be so heavy that it gets in the way. Kohana looks like a good option, so I’m going to take a look at what it takes to get something up and running.

Continue Reading…

Emulating powerline with just Vim and tmux


In a recent post, I looked into powerline, a bash status line utility. Powerline looks pretty cool, and I really wanted to run it, but try as I might, I just couldn’t get it working with my set up. Specifically, it doesn’t work really well with tmux. If you spend as much time on the command line as I do, them tmux is indispensable for serious work. That’s another post, but what I really want to talk about is how I emulated some of Powerline’s features using just the native tmux configuration. In addition, there’s a great Vim plugin, airline, which is sort of a vim only powerline. Using the combination of tmux and vim-airline gives me a status line that I’m really happy with.

Continue Reading…

Perl arrays for fun and profit

In my day job, I deal with a lot of perl. After really taking the time to learn it, and working with it in a production environment, I really have a new respect for perl. But that’s a topic for another day. The other day, someone presented me with a perl coding challenge, and it took me a while to come up with the answer. Granted, I’m not really a perl guru, so I’m not too concerned, but I wanted to talk about and document how I solved the problem. The challenge can be simplified a little bit, and restated almost like a homework problem:

Given 2 arrays, find the union, intersection and difference.

See, here’s the thing. Most every other high level language makes this pretty trivial. PHP has the built in functions array_intersec and array_diff, in Ruby, you can just do something like ary1 & ary2 or ary1 - ary2, etc… Perl’s arrays suck eggs. I’m serious, arrays in perl are virtually useless… Well, that’s too strong. Array’s in perl are emenintly useful, they’re just kind of dumb. In order to do most serious processing in perl, you wind up turning things into hashes. And that’s basically what you have to do to get the array intersection, difference and union. Here’s a little script that does the job.

Continue Reading…

Custom macros to integrate Todo.txt with Komodo Edit

Komodo edit code editor

I went to a PHP developer’s meetup recently, where the topic was IDE’s. As some of you may know, I’m a dedicated Vim user, but that’s because I’m most productive using Vim. I don’t have any extreme aversion to using an IDE. As a matter of fact, if I ever find one that really works for me, then I’d start using it. In any case, I’ve started trying to work Komodo Edit into my workflow. As far as I’m concerned, Komodo Edit is the most flexible IDE out there, and that’s part of the reason that I have trouble finding IDE’s. At any given moment, I may have a mix of perl, python, ruby, xml, yaml, javascript and html files open. No IDE that I’ve ever used has been able to handle that kind of mix. Language optimized IDE’s like PHPStorm or PyCharm are great for their intended language, and if all you do all day is work PHP, then that may work for you. For me, Komodo does a good job with almost every language that I work with.

Continue Reading…

More Cascading AJAX Dropdowns with CodeIgniter


Probably the most popular post in the history of this blog is “Populate DropDowns with jQuery and Codeigniter”. In that post, I gave a quick overview of how to set up a dropdown or select box that depends on the value selected in another form element. That post was never really intended to be a complete “How To”, but it’s been such a popular post that I wanted to revisit the idea, and write up a more complete discussion of this technique.

What I’m going to do here is to create and populate an HTML select element using values that are dependent on a selection in another HTML input. In this case, I’m using two select elements, but you could adapt the technique for any kind of input. For example, let’s say you have a form that displays data for a zip code. Now, there are a LOT of zip codes in the US, and you probably don’t want to make your users scroll through such a long list to choose the value they’re interested in. So, you add another HTML select element that allows the user to choose the specific state that contains the zip code. So, initially, the zip code select element is blank, or set to some default value. Then once the user chooses a state, the zip code element is populated with all of the zip codes for that state. Nice, huh?

Continue Reading…