Making working with DB records easier with a controller helper

July 5, 2008 – 10:27 pm Tags:

The other day I noticed a pattern that repeats quite much in my code:

  • Take a parameter from the request, such as id
  • Query the DB for a record that matches the param
  • Redirect or throw a 404 exception if record was not found

Why do all this, when it could be simply a helper call?

Read the rest of this entry »

Ideas for testing Zend Framework apps

July 3, 2008 – 6:52 pm Tags:

Here are some ideas I was thinking of for making testing Zend Framework (and Doctrine) based apps nice and easy.

Read the rest of this entry »

JavaScript Canvas charting/timeline example

June 30, 2008 – 4:46 pm Tags:

I was on holiday last week and haven’t been really able to think of anything really really interesting to write, so here’s something I made a while back: A Canvas-element powered chart/graph/timeline thing of my programming language skills, which I made as an excercise for making chart-type stuff with canvas.

I think the canvas element is starting to get quite feasible for charting, since it now works in Internet Explorer using the great ExplorerCanvas script.

Feel free to use/take apart/break/something the canvas script in the example if you like. It should work out of the box if you just provide it with some custom data in a similar format as seen in the code.

Simple Photoshop-style layers using JavaScript

June 23, 2008 – 7:18 pm Tags:

Today I wrote a small JavaScript class to display images layered on top of each other, in a similar manner as layers are shown in editors like Photoshop.

I wanted to show my Dwarf Fortress to someone, but I didn’t just want to stack screenshots below each other like you’d usually do. Since dwarf forts can span multiple depth levels, it would be pretty neat to be able to show the levels on top of each other, with transparency too.

See it in action here.

It’s relatively simple. You point it at a div which contains the images you want to make layers of, and a div where it should display the controls, and it does the rest.

If you want to use it, feel free. Just copy the script file and write some similar CSS and HTML as shown in the example page. You probably won’t need all of the CSS styles, just take note of the #controls .selected one, as “selected” is the class used for highlighting the selected layer. Note that you will need to link to the Yahoo UI libraries, as it is used in some places in the code.

You could probably use that for a JS based image editor, to name other uses than fortress showcases. :D

Dependency Injection, or how to make simple concepts sound difficult

June 21, 2008 – 3:15 pm Tags:

You may have heard of Dependency Injection. It’s essentially a way to remove implementation dependencies from classes, or “the process of supplying an external dependency to a software component. It is a specific form of inversion of control where the concern being inverted is the process of obtaining the needed dependency.” as Wikipedia puts it.

Sounds complex? Yep. Is it complex? No. You might’ve even used it without knowing about the name.

Read the rest of this entry »

Put Excel on the net with ASP.NET

June 18, 2008 – 9:39 am Tags: , ,

Remember when I introduced the idea of cloning Google Spreadsheets with ASP.NET using Excel?

Well, it turns out to be a perfectly feasible task, and I have a working prototype too!

Read the rest of this entry »

Is web application development less challenging than desktop application development?

June 16, 2008 – 10:39 am Tags: ,

I have heard several times that what I do is not “real programming” - web application development is supposedly less challenging than “proper” desktop application development. But is it really so?

Read the rest of this entry »

Good habits I learnt from Django

June 13, 2008 – 5:39 pm Tags: ,

Django has various good features I’ve previously mentioned. While they can’t be taken out and applied to other languages like PHP right away, it also has some nice ways of doing things that can be taken and used elsewhere.

Let’s look at some good habits I took from Django and started using in PHP, that could benefit you too.

Read the rest of this entry »

Page2Rss and Yahoo Pipes

June 11, 2008 – 10:16 am Tags: ,

There are many RSS feeds that I’ve subscribed to, and some websites that I check often that don’t have feeds, for example to read comics. With all the stuff in the feeds, there’s also some things that I don’t want to see, such as newsposts in some comic feeds that I only read for the comic. It would be nice if I could have those inexistant feeds created and those useless posts filtered…

Page2Rss and Yahoo Pipes are two very useful services, almost like tailor made for the purprose of adressing the above problems!

Read the rest of this entry »

Google Spreadsheets, ASP.NET and Excel

June 9, 2008 – 12:32 pm Tags:

I’ve lately been using Google Spreadsheets to display project costs to my clients etc., and for that it’s quite nice. Quite similar to Excel, too, so it was easy to get going.

What bothers me to no end, though, is that editing spreadsheets does not work in Opera at all. Why is it? It works in Internet Explorer, which means there can’t be any totally hardcore (like Gandalf-level) JS magic or other stuff going on… I’ll just say that Google is plain and simple lazy.

Being a programmer myself, using such an impressive web app naturally got me thinking how much work it would be to build something similar to Google Spreadsheets…

Read the rest of this entry »