An Experiment in Social Media Stuff

November 3rd, 2008

I’m a member of the Perth Atheists meet-up and we had our monthly get together at the Flying Scotsman in Mount Lawley tonight. Instead of the usual short talk (which are always entertaining, informative, excellent and awesome) this week was for “housekeeping” — namely talking about what sort of group we want to be. The “housekeeping” label might have had something to do with the slightly reduced numbers, but the discussion was good nonetheless, with some excellent views and ideas of who and what and how our little group can grow and be and do something.

Read the rest of this entry »

Matching Brackets in Cocoa

August 10th, 2008

My last post was a solution to A Programming Job Interview Challenge #13 - Brackets using Haskell. My Haskell solution basically defined a function that processed the input string in O(n) time and returned True if it was valid and False if it was not. This is good and useful and (I believe) idiomatic Haskell, but almost completely trivial. In this post I’ll describe a solution to the same problem, this time in Objective-C as an NSFormatter sub-class for use in a Cocoa program.

Read the rest of this entry »

A List Apart Survey for People Who Make Web Sites 2008

August 2nd, 2008

I just finished the A List Apart Survey for People Who Make Web Sites, 2008. They told me I ought to post this on my blog and I do find the results interesting to look over, so why don’t you follow the link below and do of yourself (if you make web-sites)?

I Took the 2008 Survey! And so should you.

Matching Brackets in Haskell

July 24th, 2008

I have no idea where I came across the link (someone’s solution in PHP?), but I stumbled on A Programming Job Interview Challenge #13 - Brackets the other day. It’s a pretty trivial problem but I was bored tonight, so I hacked up a quick solution in Haskell. Haskell is a statically typed, non-strict, purely functional programming language that has whole great big piles of awesome built right in. What follows is pretty routine, but in world dominated by the likes of Java, C, .Net and the other misfits, Haskell is pretty strange so I’ll try to explain.

Read the rest of this entry »

Native iPhone/iPod Touch WordPress Client

July 23rd, 2008

This is my first post using the native client on my WorsPress client. It is very nice (and free) but makes me miss copy and paste even more.

The SPIP Template Language

July 22nd, 2008

SPIP, like many content management systems, provides a templating facility based on the idea of loops. A template is a mixture of static content — HTML tags, for instance — dynamic content placeholders — that stand for things like “the title”, “the body”, “the date of publication”, etc.— and loops — which determine what and how much is displayed. Unlike some CMS’, SPIP uses a rather sophisticated language for its template system rather than just providing a library of PHP functions that can be called. The placeholders in SPIP templates look like #VALUE and can be supplied with arguments #VALUE{argument}, modified using filters #VALUE|uppercase (which can also take arguments #VALUE|foo{bar}), and bracketed with conditional content which is output only when the tag has a non-empty [<li>(#VALUE)</li>]. I can’t remember if it’s necessary, but I always wrap any tag with a parameter or filter with brackets, just in case.

The loops look somewhat stranger with a pseudo HTML tag format. In general each loop has : - a name; - a type (of things it iterates over, pretty much 1-to-1 with database tables); - some of criteria (determine which things to loop over); - a body; and - optionally, some conditional content.

An example will help illustrate:

<b_aloop>
    <ol>
    <boucle_aloop(ARTICLES){id_article IN 1,2,3,5,7,11}>
        <li>This article was published on: [(#DATE|affdate('Y'))].</li>
    </boucle_aloop>
    </ol>
</b_aloop>
    <p>There are no matching articles.</p>
<//B_aloop>

Upon seeing this code SPIP does the following (along with some other stuff in the database and caching layers). It retrieves all of the articles with an ID of 1, 2, 3, 5, 7, or 11. If there are some articles it outputs <ol>, followed by a line like <li>This article was published on: 2008</li> for each article, followed by </ol>. If there were no matching articles, then it instead outputs <p>There are no matching articles.</p>.

There are a few more details (the name of the loop above is “_aloop” not “aloop”, you can reach out of a loop to one that contains it like so #outerloop:VALUE…), but that’s basically it. For more details about the specific loops, criteria, tags, and filters available in SPIP you can see the SPIP Glossary, though do note that SPIP, like pretty much all open source software, has documentation that is a little bit patchy in places, especially in English.

In my next SPIP post, I’ll describe ways to extend SPIP with your own tags and filters and alter on, I’ll explore modifying and even creating our own custom loops.

Emulating Operators for Core Data

July 21st, 2008

My last Cocoa post described a problem I encountered extending a Core Data tutorial by using bindings operators to aggregate a property of Core Data entities through a relationship. With a bit of grovelling through documentation and some help and guidance from Tim Isted I’ve managed to get it to work, sort of.

Given Department and Employee entities and a ‘employees/department’ relationship between them, I tried to bind a column in an NSTableView to employees.@sum.fte to display the Full Time Equivalent staffing for each department. Alas, it was not to be and in this post I’ll explain [a little] why this is not the case, and one way [a dirty, filthy hack] to work around it.

Read the rest of this entry »

Protecting Content with SPIP

July 20th, 2008

SPIP is a great CMS with lots of powerful features, but it does embed quite a lot of policy within its workings. One aspect of this is the difficulty of restricting access to content to authenticated users. Doing so is not particularly difficult, but doesn’t appear to be documented in any great detail anywhere, so I’ll describe the approach I used for one client’s site.

Read the rest of this entry »

Computed Attributes in Core Data, How?

July 18th, 2008

I’ve worked through a few Core Data and Cocoa tutorials in the last few weeks and most of them are exceedingly awesome. That fact that there are so many capable Cocoa developers out there who spend time creating tutorials and sharing their hard earned experience is fantastic and speaks volumes about the Cocoa and the wider Mac communities. To (not really) give a little back and (more) attempt to solicit suggestions I’ll be posting about some of the problems that I’ve run into trying to move beyond the “getting started” tutorials and ways to solve them. First up is computed attributes in Core Data applications.

Read the rest of this entry »

Binding Operators With Core Data

July 15th, 2008

Tim Isted posted an excellent tutorial on building Core Data applications with multiple windows which really cleared up some of the mystery of using Core Data for me. He guides you through the process of modifying a “Core Data Document-based Application” project to support multiple windows per document. There are a few enhancements to the project that simply cry out to be made.

Read the rest of this entry »