All Marked Up

A tasty brew of web standards and internet culture.

jQuery Event-Driven Pagination plugin & more

I have just released a replacement for my Quick Paginate jQuery plugin – it has similar functionality but uses a custom event-driven API for much more flexibility! It’s been re-thought and re-written from the ground up, and although the documentation is still a bit lacking there are a few demos up that should help to get you started.

View the documentation and download the Event-driven Pagination plugin here

I have also decided put up some links to some of my undocumented and alpha/beta code on the landing page of my projects area. Feel free to have a poke around but don’t be surprised if what you find there is a little on the buggy side!

No Comments »

It should be about people, not channels.

Social networking is failing me.

I use Twitter everyday. I love it dearly, and it has allowed me to get to know a lot of cool people that I would (in all likeliness) have never come across without it.

But the majority of my ‘in real life’ friends – the people I grew up with, the people I went to uni with – don’t use Twitter. Most of them are pretty active on Facebook – but Facebook really isn’t my thing. I can’t deal with the noise.

So I find myself in a situation where, thanks to a social networking tool mis-match between myself and my closest friends, I know nothing about what they are up to every day, and everything about the lives of people who I have never met. Seems a bit odd, doesn’t it?

Because even though social networking feels people-centric while we’re interacting with it, in reality it is channel-centric. You can only be friends with your friends if they play in the same channel as you. Even if you and your friends all spend the hours of the day on the internet, if you are not using the same tools you can pass each other by like two ships in the night.

In my mind this is really the main problem that the next generation of ’social networking’ tools need to solve. The emphasis needs to move away from the tools and onto the people - so I can keep up with my ‘IRL’ friends just as well as I can my digital acquaintances, without having to chain myself to a dozen social networking tools that i really have no interest in, just to cover all my bases.

No Comments »

SublimeVideo. Webkit only – at the moment – but very cool taste of the things that can be done with a little HTML5 video, JavaScript and some clever coding. Great stuff.

I (heart) FreeAgent

It’s a bit of a mission of mine to always try and spread the word to other people about great products or services that I come across. I think it is really important that the users of these products and services help to promote them – as more often than not they are smaller companies without trillion-dollar marketing budgets to spend on flashy ad campaigns and endorsements.

One such quality service that I have been using recently is FreeAgent. It’s basically an online accounting web app for freelancers and small businesses, and I’ve been very impressed with both the product itself and the people behind it.

I started using it about nine months or so ago to track the odd bits of on-the-side work I was doing whilst employed at my last job, and now that I am freelancing ‘proper’ I’ve been getting a bit deeper into it. It’s straightforward, easy-to-use and it has really changed the way I look at my personal book-keeping, making it much easier for me to track my finances, expenses, tax liabilities and so on.

I’m not going to go into detail on all the functionality here – instead I would urge you to go and try the demo and/or the 30 day free trial available over at their website to see if it would fit your needs. But for the vast majority of freelancers (especially UK based ones) and small businesses I think that it should cover pretty much all your bases as far as bookkeeping, invoicing and time tracking are concerned. And more importantly it does it in a straightforward, easy to use and understand manner: no Quickbooks-style crap here.

But no app stands up on merit alone these days – it’s the support and openness of the companies behind them that really makes a product great. And the guys and girls behind FreeAgent have very much impressed me here too! Updates to the app are well planned, users are well notified of any (rare) scheduled downtime, the staff are helpful and responsive on Get Satisfaction (which they use for their customer service enquiries) and active on Twitter – in fact yesterday, after I posted a tweet about how nice it would be to be able to more easily customise the CSS for invoices, they tweeted back to say that this functionaliy was actually a beta feature in testing, and they had enabled it for my account! Legendary.

So, go check it out, I’m sure you won’t be disappointed. And thanks to the magic of their referral system, if you do sign up and put in the code ‘31crg0ak’ (without the apostrophes!) or use this link to go there we’ll both get 10% off the monthly cost – another nice touch that is available to to all users (and which means if you refer 10 people you would get the service free!).

Great work, @freeagentapp.

3 Comments »

Introduction to Google Public DNS. I switched over to this yesterday and it seems pretty damn speedy. Also, none of the weird redirection behaviour that OpenDNS forces on you in order to show you ads on mistyped URL lookups, which I hated.

On variables and mixins in CSS

So in a previous post I talked briefly about my ‘wishlist’ for CSS3 (or beyond) – additions to the language that I would really like to see implemented in order to give us a better, more flexible way of tackling  a wide variety of issues.

Out of the five things I mentioned – Basic math, delegation, positioning model tweaks, constants, mixins – the last two are perhaps the most straightforward. Whilst in the post I talked about better tools for problem solving, variables and mixins are really more about being able to write cleaner, more maintainable and flexible CSS code with a better separation from the associated HTML.

I’m going to go into a little more detail on what I actually mean when I talk about variables and mixins in CSS, how they could help us write better code, and why they haven’t yet been (and may never be) implemented.

Constant Variables

Before I start talking about variables in CSS, a quick word on terminology: I use the term ‘variables’ here because it has gained some popularity, but it would really be more correct to describe them as ‘constants’; their value, once assigned, is not expected to be mutable over the course of the document.

So, the basic concept is that you would be able to define a variable that holds a value (such as a hex colour, or a width) and then be able to use the name of that variable to refer to it later on in the stylesheet. So you could do something like this:

@variables {
    myCompanyBrandingColour: #F00;
    myCompanyFonts: 'Comic Sans', Arial, sans-serif;
}
 
#header {
    background-color: var(myCompanyBrandingColour);
}
 
p {
    font-family: var(myCompanyFonts);
{

That way, when your company rebrands, to change the branding colours and fonts throughout the site you would be able to update the value of just one or two variables, rather than having to trawl through your stylesheets looking for instances of that colour or font-family.

Sounds good doesn’t it? This idea is certainly not new, and has cropped up repeatedly in one form or another over the last ten years or so. A few members of the W3C have even written a detailed spec for it, and it was even implemented in Webkit nightlies for a while (it was removed because it’s implementation in Safari would have been “hugely popular“, but they didn’t feel confident enough that the spec wouldn’t change in the future and thus leave them having to support an outdated implementation).

Yet this concept keeps on getting repeatedly shot down on mailing lists and influential people in the W3C such as Bert Bos (one of the original formulators of CSS, nonetheless) have written at length about why this idea will not get included in the spec anytime soon, if ever.

This is a real shame, in my opinion. There is a clear demand for this feature in CSS, and the arguments made against it just don’t work for me. Some of Bert Bos’ arguments in the aforelinked essay seem almost laughable:

“…it is quite likely that somebody who is trying to learn CSS will give up learning it when he sees that style sheets that occur on the Web don’t actually look like the tutorials he started from.”

…which sounds like an argument against progress in any web development language (or in any other programming language at all for that matter!) and is clearly nonsense – what about all the new additions to CSS to be implemented as part of the CSS3 spec, for instance?

He also talks about the ‘implementation effort’ of including variables/constants in CSS. This is another argument that I have no time for – I just don’t think that (within reasonable limits) the W3C should be concerned with how difficult features are to implement. The Webkit nightlies implementation has already shown that this is achievable, and if this was to be included as part of the official CSS spec then I have no doubt that browsers manufacturers would scramble to implement it, effort required or not.

The only serious issue with this idea, in my mind, is backwards-compatibility. Older browsers that didn’t support this feature would ignore rules specified in this way, so there would need to be some way of providing a fallback. I’m confident an acceptable solution can be found to this; and in the meantime at least if there was a officially supported spec then the gap could be temporarily filled with ’standards compliant’ CSS pre-processors, rather than having the mishmash of non-compatible CSS pre-processor implementations that we have today.

Mixin it up

So, on to mixins. A mixin is an author-defined rule-set that can be ‘mixed-in’ to other sets of rules for particular selectors. The LESS CSS pre-processor implementation of mixins looks like this (from their documentation):

.bordered {
    border-top: dotted 1px black;
    border-bottom: solid 2px black;
}
 
.post a {
    color: red;
    .bordered;
}

What is happening here? Well firstly, we are defining a rule-set with a class selector of ‘bordered’ in the usual fashion. Then, in the .post a rule-set you can see that the class name has been used inside the braces – indicating that the rules defined in the .bordered class are to be imported into the .post a rules at that point.

It’s possible to do something very similar to this today; in fact I use it all the time – I split my rule-sets up into discrete chunks using class names, and then apply those one or more of those classes in the HTML markup to achieve the desired result. However, this has one big problem associated with it: it breaks the paradigm of the separation of style and content, and ties our markup and styles together in a way that wouldn’t be necessary if we could use mixins in our CSS.

Again, there are many people both for and against the ideas of mixins being added to the CSS spec. In fact, Bert Bos’s arguments in his article could probably be equally applied to mixins. However the advantages of having the ability to be able to define class-based style rules and then have them available to use as part of compound rule-sets seem obvious to me; helping us stick closer to DRY principles, reducing maintenance, helping to ensure consistency within sites, and removing a common dependence on markup would all be good things, would they not?

In summary

What I would like to see is a way to cut down on the amount of CSS I write, and make it more portable, more flexible and more maintainable. I think that variables and mixins in CSS would help that become an achievable goal. There are many others who feel similarly; I just wish that it didn’t seem like the W3C had completely closed out the subject of additions such as these to the CSS language.

A quick footnote on CSS pre-processors:

I have mentioned ‘CSS pre-processing’ various times above; basically this refers to the server-side parsing of CSS code before it is output to the browser (cached, hopefully!). This is a way that some of these features can be used today – the rules are included in the stylesheet, they are converted to ‘normal’ CSS by the pre-processor, and then the browser can parse the stylesheet as per usual.

Pre-processing has been recommended by various members of the W3C and others as the preferred way to use features like these without them having to be added to the spec. Which is fine, except many people don’t want to use a server-side technology to do this, or can’t, for technical or access reasons. And another problem with them is that they are not working to any particular spec – all the implementations vary greatly, so your CSS code instantly becomes non-portable and your knowledge non-transferable.

No Comments »

IxEdit. Generally I have no time for code generators of any type, but this looks like it could actually be a useful little tool for quickly creating jQuery’d prototypes. Uses a inspector-panel type overlay to allow point-and-click creation of jQuery code.

« Older Entries