Posts Tagged Plugin

Hit Me With Your Best Shot

blog-tour-overload[1]I recently read a post on Coding Horror where Jeff Atwood was crowing about how well the blogging platform Moveable Type has worked for him over the last years.  I’ve been a WordPress user ever since I started blogging, and hadn’t realized that in a default installation, the dynamic page creation WordPress uses can really limit the number of pages that you can serve at a time.  And although I have yet to write that breakthrough post that gets on Digg, Reddit, and Slashdot all at the same time, I figured it might still be prudent to take steps to minimize the load on my relatively puny server.

After clicking through and reading some of the links describing different caching schemes for WordPress, I decided to grab one of the highly-rated plugins to handle caching this blog.  I chose WP-SuperCache.  Although it has a bewildering variety of options, it boils down to taking the dynamically-generated pages you publish, boiling them down to the raw HTML that ends up served to the client, and caching that on the server.

When this is done, the webserver only has to sling raw HTML to the browser, rather than make multiple round-trips through PHP to the MySQL database to construct the page.  This should be both faster and lower load on the server.

So feel free to load up this site as much as you want, and send links to all your friends.  Sure, even include another few hundred “Anubis Gates” spammers.  I can take it!

Tags: , , , ,

Cool Plugin — WP-Syntax

nerd-cake[1]I hope to eventually have some more programming-related updates here; I’m working on a solution at work to add compile-time type-safety to Windows message passing that will make a good article (or two) when I’m done.

In the meantime, I have my IFComp updates, although vacation and the sheer number of other projects I have at home is cutting down on the amount of time I have to code in Inform 7.

What both these types of posts need, however, is a good way to format code.  By default, WordPress does not do a good job at all with code samples.  Luckily, however, there are a wide variety of plugins available to do a better job.  The one I chose is WP-Syntax, which leverages the GeSHi highlighter engine to do formatting syntax highlighting for a wide variety of languages.

None of these languages include Inform 7, but syntax highlighting wouldn’t really do much for Inform 7 anyway. For that language I’m just happy to have a nice box and a good font, which I get by default.

Here’s a (nonsensical) example for C++, to show off the highlighter features:

template <typename T, typename U>
class Complicated <T *, U> : public ComplicatedBase
{
public:
    Complicated(const CString &szData) 
    { 
        if (szData.IsEmpty())
        {
            m_szData = "Error";
        }
        else
            m_szData = szData;
    }
    virtual ~Complicated() { /*do nothing*/ }
    void SomeFunction() const;
private:
    CString m_szData;
};

…and another for SQL:

SELECT t1.a AS Name, t2.b AS Something_or_other
FROM Table_1 t1
    INNER JOIN Table_2 t2 ON t1.t1_ID = t2.t1_id
WHERE t1.c BETWEEN 4 AND 8
-- had a GROUP BY here...

Pretty cool, eh? The drawback is that the very nice visual editor in WordPress is not compatible with the formatter, but I can live with writing in raw HTML to get results this nice.

Tags: , , ,

The Quern is Digg proof thanks to caching by WP Super Cache