You mark that frame an 8 and you're entering a world of pain
Loosely Typed in Ohio

General n-Tier without tears

Building n-Tier apps can be difficult. Instead of a single monolithic application that can easily hide its imperfections, a client-server model traditionally means making an API, choosing a transport, and sticking to it.

It’s like marriage, but with TCP/IP settings. Throw in a wireless client and it can be difficult to find a solution that fits. XML-RPC? SOAP? REST? Each way of communicating has benefits and drawbacks.

This is what we’re doing for client X, a niche healthcare business.

Continue Reading…

Productivity Flickr and Versioning

We often maintain and deploy projects as a single HEAD version in a Subversion repository. We don’t, generally, tend to do a lot of forking. This is good, as forking can be undisciplined, but sometimes you might want to be able to add or change features and not have to worry about adding broken code to a project.

It turns out that Flickr does the same sort of thing. Their solution: flags and flippers. Interesting read.

General Visualizing CSS

animation2

Converting a Photoshop pitch to a static HTML/CSS layout is a fundamental part of client-oriented web development. It can be hard work, not least because it is difficult to simultaneously focus on the appearance of the site and its structural foundations.

The usual solution to this is to muddle through and keep tweaking a steadily expanding morass of CSS until the site resembles the original .psd. This way of working is unstructured, which makes it stressful and self-limiting.

Let’s look at a better way.

Continue Reading…

Open Source I <3 iTextSharp

I’ve just started using iTextSharp, a .NET port of the Java iText library. It’s surprisingly good.

The library can create files or streams of PDF. I’m caching my output, so this example uses files:

        // create a document
        Document document = new Document();

        // associate it with a file
        String filepath = Request.MapPath("/Pdfs/test.pdf");
        FileStream file = new FileStream(filepath, FileMode.Create);
        PdfWriter.GetInstance(document, file);

        // write the pdf
        document.Open();
        document.Add(new Paragraph("OMG this thing works"));
        document.Close();

Software Database Models I Have Known And Endured

One thing you might have noticed that we do is SQL. We do a lot of SQL, so you’d think we would have figured out the best way of hooking up applications to databases.

To an extent, we have become so familiar with the requirements of database-driven development that we have come to accept the tools that we have as being adequate. Even ODBC.

Obviously we’ve long ago moved past PHP functions like mysql_fetch_row. We expect things like sanitizing and escaping, multiple vendor support, query abstraction, and so on. We look back fondly on the clumsy simplicity (and scope for injection) of things like this:

    PHP

    mysql_query( "SELECT * FROM T_Shirt WHERE color = '{$favorite_color}'" );

Nowadays we’re more likely to fetch records through a framework API, such as this use of Zend Framework’s Zend_Db:

    PHP / Zend Framework

    $db = Page::getDb();
    $select = $db->select();
    $select->from( 'T_Shirts' );
    $select->where( 'color = ?', $favorite_color );
    
    return $db->fetchAll( $select );

Because the query is broken down into a set of calls we can pass the select object around before we do the fetch. This is surprisingly handy.

But what else is out there that might be better than what we’re doing now? What would be the next step, the thing that would make Zend_Db look like mysql_query?

Continue Reading…

Close
E-mail It
Socialized through Gregarious 42