Category: Internet

16Nov 2011

Recovery

Some of you may have noticed that most of the images on my blog have been missing for some time.  Actually, if I’m honest, I very much doubt if anyone has noticed.  Let’s face it, who reads blog posts from last year?  Hmm?  Anyone?  No, I thought not.  Nonetheless, the images were missing, and it was only this evening that I managed to resolve the issue.

The problem started when I moved from my old hosting provider, PearTreeUK, to my new hosting provider, WebhostingUK.  I was determined to be clever, being a professional web developer, and decided to merge a load of old domains onto one master domain and host my blog there, so now you’ll find that www.minipix.co.uk, www.chapternine.co.uk and www.giftlistcentral.co.uk all redirect to www.matthewdawkins.co.uk.  Seamlessly.  Well, almost seamlessly.  The trouble was, despite all my cleverness, I forgot to download all the images on my blog before cancelling the old hosting.  Foolish fool.

So while everything worked, it looked rather bare.  For the most part it wasn’t a huge issue, but believe it or not there are actually some blog posts that Google quite likes, such as my demonstration of OpenTTD junctions, which is somewhat underwhelming without the images.

Thankfully, the folks at PearTreeUK have their heads screwed on.  I emailed them on the off-chance that they might have my old data lying around somewhere, half hoping that they didn’t (because that would be careless and unprofessional).  The reply came back positive, and thankfully it’s not unprofessional at all – they actually have a policy in place to hang onto expired accounts’ backups for several months before automatically deleting them.  Which is a very wise policy.  And it meant that they were able to provide me with a full backup of my blog, including images.  So I downloaded the images, put them in the right place, fiddled with my .htaccess file to make sure I didn’t get any straggling 404s, and hey-presto my images are back!  Feel free to take a wander through my archives if you like, to marvel at my newly-found old images.

As an extra bonus, I’m pleased to say that something else fairly significant was also recovered at the same time.  I had been writing a pregnancy diary during 2009, before Samuel’s birth, and I’d put it online (though hidden from public eyes) so that I could update it from wherever I happened to be.  It seemed like a good idea at the time.  Anyway, I kind of forgot it was there, so when I came to migrate all my websites from the old web host I completely forgot to take a backup of that diary.  Thankfully, the backup PearTree were able to send me included all that hard work.  One day I’ll finish off the last few weeks worth of entries (which are currently only in note form) and maybe make it public.  Might make an interesting read.  Maybe.

20Oct 2011

pShadow – a jQuery extension for gorgeous drop shadows

What’s pShadow?

pShadow, short for ‘paper shadow’, is a jQuery extension that adds realistic drop shadows to HTML elements, which works in Internet Explorer (IE8, IE7, IE6 with some clever trickery), Firefox, Chrome, Safari, Opera, and any other modern browser you care to mention.  It’s free to download and use, and you can see an example on the demo page.

Cut to the chase – how do I get it?

Download pShadow1.0 and unzip it somewhere.  You’ll see pshadow.js and 2 png images, and I’ve included the jQuery script too (but feel free to download it fresh from the jQuery site if you prefer).

In the <head> section of your HTML file, add the following lines:

<script type="text/javascript" src="jquery.1.x.x.min.js"></script>
<script type="text/javascript" src="pshadow.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $('.someElement').pShadow();
});

Now all elements in your markup with the class .someElement will have a lovely drop shadow!

The options

There is more than one way to skin a cat.  By the same token, there is more than one way to use pShadow.  Below are some options you can set.

There are 2 built-in shadow types, using one of the 2 .png images bundled in the zip.  Choose which one you want to use by setting the type parameter to either ‘corners’ (default) or ‘middle’.  See the demo page to see the difference.

$('#element').pShadow({type: 'corners'});

You can set how deep the shadow is, i.e. the vertical height of it, by setting the depth parameter to a number (assumes pixels).

$('#element').pShadow({depth: 30});

You can vary the strength (i.e. the darkness) of the shadow by setting the strength parameter to a value from 1 to about 5.  See the technical stuff below for an explanation of what those numbers mean, but 1 is lightest and 5 is probably the highest you’ll need to go.

$('#element').pShadow({strength: 2});

And of course you can combine those options into one array, and even chain other functions on afterwards.

$('#element').pShadow({
    type: 'corners',
    depth: 10,
    strength: 2
}).css('background','blue');

How it works

Okay, here’s the more technical low-down on how this all works, and what makes it so special.

We all know that modern browsers (apart from IE anyway) support the lovely CSS3 box-shadow property.  But there are times when we need to cater for IE too, and sometimes a simple box-shadow just doesn’t cut the mustard.  The pShadow jQuery extension does what all great performers do – it masters the art of illusion.

The shadow itself is actually a .png image, carefully designed to sit on the bottom edge of an element and give impression of depth and shadow, as if the element was a piece of paper sitting on your screen.  No shadows are needed on the other edges, because the bottom shadow does all the work for you.  Your eyes do the rest and turn it into a 3-dimensional object.

pShadow uses jQuery to take (nearly) any element, or set of elements, and dynamically adds the .png image to it, positioning it carefully so that it lines up with the bottom edge of the element.  In the case of self-closing elements like <img />, pShadow adds the shadow element immediately following it in the markup, and positions it absolutely to the target element’s position on the screen.  In the case of non-self-closing elements like <div></div> the shadow is added inside it and then positioned relative to the parent.  Then it scales the width of the image to match the target object.  And, to my knowledge, that can’t all be done purely with CSS.

The darkness of the shadow (known in the code as the ‘strength’) is a quick and dirty approach but generally works well.  There is still only one .png image, but if you layer them on top of each other it gets progressively darker.  If you leave the parameter to its default setting, or set it to 1, it will place just one copy of the shadow under the element.  If you set it to 3, you’ll effectively get 3 shadows stacked on top of each other, making it darker.  By my reckoning the scale can sensibly go up to about 5, although there is technically no limit.  And if you want more control you can create your own shadow image that’s really really light and stack loads of them on top of each other, if you really want to…

Limitations

No, it’s not perfect.  Yes, you can break it.  No, I can’t guarantee to be able to fix every issue you have with it.  Here are some things I’m already aware of:

  • PNG images are not totally supported in IE6, because it forgets to take transparency into account.  However, there are a number of ways to force IE6 to do transparency, so do a Google search for “IE6 transparency” and use any of the solutions there!
  • If you apply a shadow to a self-closing element like an image, and then move the position of that element, the shadow won’t follow it.  Because the shadow is positioned absolutely to where the target element was relative to the page, if you then move the target element the position of the shadow would need to be updated too.  That’s beyond the scope of pShadow at the moment.
  • If you have CSS targeting images, there’s a possibility that you might affect the shadow elements too.  I’ve tried to cancel out some typical CSS parameters, but it’s no silver bullet, so beware.
  • pShadow doesn’t take into account rounded corners, so if you’re using a hefty rounded corner on an element then the shadow might look a little odd.  Tough luck, I’m afraid.
  • Also, pShadow doesn’t currently handle nested pShadowed elements perfectly.  Hopefully that’s something I’ll find a fix for though!

Frequently Asked Questions (or at least questions that I imagine might be asked frequently)

Is pShadow free?

Yes.  It is.  And always will be.

Do I have to use jQuery?

Yes.  Technically you could achieve it all in raw Javascript, but it wouldn’t be as elegant, nor anywhere near as easy to use.  And I have no plans to convert it to use any other Javascript framework.

Can I apply pShadow to any element?

Yes.  But I can’t guarantee it’ll work in every case.  It’ll definitely work for <div>, <p>, <h1> etc, <img>, and any other element that a browser will treat as if it’s a block element like <div>.  It won’t work quite right with <input>, <textarea>, <button> yet, but that might come later.  And I’m sure you’ll all tell me if other elements don’t work either.

Can I use pShadow?

Yes.  You can use it on your personal blog.  You can use it on your company website.  You can use it on your corporate intranet.  You can use it in your web application.

However, you can’t use it on your oven.  Or your car.  Or your girlfriend.  Or your sense of pride.  Or the sunset.

What happens if I have a problem with pShadow?

Leave a comment below and I’ll see what I can do to help.  Unfortunately I have a 9 to 5 job to attend to, so I can’t provide unlimited tailored support, and you can’t employ my services either, even for money.

When is the next version of pShadow due?

It’s not.  Not as such.  This is a little personal project of mine, initially knocked up in an afternoon.  I hope to find time to tweak it as necessary, as and when people point out critical failures, but there is no roadmap for development.

21Jun 2011

Officially the end of the line

You should read this if you have previously received services from Matthew Dawkins Web Design or ChapterNine Web Design.

Matthew Dawkins Web DesignChapterNine Web Design

It’s officially over, and my what a journey it has been!  Way back in 2005 I was approached by the St Albans Diocese Youth Service and asked if would be able to design them a new website or three.  And so my freelance business began, primarily offering web design services for churches and Christian organisations.  The business grew, I took on more clients, and I started providing services such as web hosting too.

But, like all good things, it had to come to an end.  In October 2010 I got a ‘real’ job – a full time position as a web developer for another company, and my own business had to be gracefully turned off.  After a lot of dallying and helping clients out with migrations to other web hosts, today finally sees the final milestone completed.  My old websites are being taken offline and my reseller hosting package cancelled.

I would like to take this opportunity to thank everyone who I’ve had dealings with over the years who have made it all worthwhile.  Thanks to Rob for being so helpful, especially in those stressful downtime moments, and for resetting the firewall every time I blocked myself by trying to remote MySQL into something!  Thanks to Ralph giving me plenty of work to do, and for being cause for much entertainment.  Thanks to Anthony for getting me started in the hosting business.  Thanks to Liz for getting me my first job.  Thanks to Ellie for putting up with me, for bringing me cake batter at just the right moments, and for reminding me of the time.  Thanks to David for lending me your clients while you were away.  Thanks to Elliot for giving me work when times were quiet, and for looking after several of my clients when I started closing down.  Thanks to antoniojl for selling me the G5 Mac that’s been so useful the last few years.  Thanks to Phill for the opportunity to collaborate with you on a revolutionary idea.  And thanks to God for leading me down this path, for reminding me at regular intervals that I was still on the right track, for providing for me in so many different ways, and for showing me clearly when the time was right to move on.

Will I offer my services again in a freelance capacity?  Possibly.  I can’t rule it out.  But, that said, one of the lessons I learnt very early on (and had to either ignore or find ways round) was that I’m not a natural businessman.  I hate invoicing people, I find it hard to charge a realistic price for my talent, and I still don’t understand all the jargon of the Self Assessment Tax Return form.  For now, God has led me somewhere new and I’m really enjoying it, so I won’t be hurrying back to being my own boss.  But if you do have questions for me, feel free to ask, and if I get a free moment between family and church commitments I’ll try to answer!

So, for now, it’s adios, au revoir, auf wiedersehen, aloha, arrivederci, hagoonea’, tot ziens, and a fond farewell to all my old clients, colleagues, and various previously-important icons on my desktop.

2May 2011

Shiny and new (part 2)

Yes, this is my second post today, and with the same title, but on a completely different topic.

Some time ago, as some of my faithful readers will know, I got a new job.  That meant getting rid of… I mean, encouraging my old clients to go elsewhere for their services.  Getting everyone’s web hosting moved to new providers was a bit of a challenge, and understandably there were some people who were none too pleased at having to move at all, and others who didn’t have the first idea what might be involved.  So I’ve helped as much as I can, given that I’m no longer actually working from home.

So the time is nearly upon me where all my clients will be migrated, and all that’s left is my own sites.  At that point, I’ll need to move my own sites to a new host too, as I can’t afford the reseller package I’d been using.  An upshot of that is that I can’t really afford to be running lots of personal sites for free, as I used to through my business.  What’s needed is a careful rationalisation of my online presence, to ensure continuity and sustainability.

So here’s what’s going to happen.  ChapterNine (www.chapternine.co.uk) will cease to exist, although I’ll keep the domain for now and just forward that on to another page on another website.  Minipix (www.minipix.co.uk) will also be shut down, again with the domain forwarding on elsewhere.  Now, before you all get cross and up in arms and worried that I’m shutting down my blog, I must stress that I have no intention of stopping blogging, nor of losing the last 10 years’ worth of personal history.  What’s actually going to happen is that my blog will be moved to www.matthewdawkins.co.uk, which will no longer serve as a business website but will be my personal website instead.  So everything you see here on minipix.co.uk will soon appear on matthewdawkins.co.uk instead.  Some of the stuff on ChapterNine will appear there too, as will some of the material currently on matthewdawkins.co.uk.  It’s all a bit confusing, but it’ll make sense once it’s done – basically it’ll all be in one place instead of on three separate sites.

I’m still in the process of building the new site (I’m a web designer after all, I can’t just move it and have done with it, I’ve got design myself a completely new theme to go with it!), but I’m hoping it’ll be sorted out at some point this month.  And, as I’ve said, I’ll keep the old domain names now, so all your old bookmarks and links should continue to work.  It’ll just all appear in one shiny new website over on matthewdawkins.co.uk.

22Aug 2010

Making my blog more personal

Successful bloggers, and indeed writers in most fields, will tell you that the key to success is to pick your target market and stick to it.  No surprise, then, that the most read blogs are ones where their authors talk religiously about their chosen topic, whether that be a blog about programming methods or a blog about one man’s journey to become a vintage bus driver.

In spite of this well-acknowledged fact, you’ll notice that my blog is still littered with a whole plethora of categories, covering all sorts of topics and areas of life.  I have chosen not to focus on one target audience, but to write infrequently about everything instead.

Now, finally, I’ve got round to introducing a way for you, the reader, to take control of my blog and only show the articles you’re actually interested in.

(more…)

28May 2010

Is it Chrome? Is it Safari? No, it’s Firefox.

In all honesty I fell in love with Macs back before they were popular, back in the days of System 7.  My Dad used Macs every day, when he worked as a graphic designer for a local newspaper, and even then I could tell that the user interface was just so much ‘better’ than Microsoft’s offering, which back then was Windows 3.1.

Times have changed since then, of course.  Now I’m running Mac OS X Leopard on a dual-processor G5 tower.  Not new by any means, but it still beats the pants off Vista on my laptop.  Of course, Google has had its part to play in driving things forward, revolutionising web searches and pretty much anything we do online.  They’ve even brought out their own web browser, but sadly they didn’t think it worth while to port a PPC version of it, so I can’t use that.

However, I can trick out my Firefox to do some of the same things that make Chrome such a fantastic browser.

(more…)

29Apr 2010

A few changes

A while back my blog decided, in its infinite wisdom, that allowing access to the control panel was in fact not what I wanted to do, despite my many attempts to do so.  I would go to the login page, enter my details, hit the ‘go’ button, and be instantly redirected back to the login screen.  Helpful.  I did some digging around, and it appeared that as far as WordPress was concerned I was actually logged in, it just wouldn’t show me the control panel itself.  That meant I couldn’t approve or reject comments, I couldn’t add new posts, I couldn’t update the templates, I couldn’t add or remove any plugins, and I couldn’t spend time tinkering with my blog.  Maybe it thought it was doing me a favour.

In any case, it’s taken me until last night to resolve the matter.  I had previously tried copying new files across to upgrade to the latest version, but that didn’t work.  So last night I took a full backup of everything, deleted all the core files from the server, and uploaded a fresh load of files.  And as if by some deep and powerful magic, my command over my online presence was finally restored.  With that liberation still fresh, I jumped on the opportunity to make a few changes.

The most obvious change you’ll see is that I’m now importing my Twitter feed.  When I post a new tweet, it’ll get displayed here on my blog too, appearing like a little speech bubble.  This is actually a category in WordPress too, so I can non-Twitter mini-posts too.  Like for those times when I really feel the need to say something to the world, but Twitter doesn’t give me enough characters, and a full-on multi-paragraph post isn’t necessary.  Of course, I understand that you may not want my Twittering to come up in your RSS reader, so if you want to continue reading my blog by RSS but excluding these micro-posts you can now use this new RSS feed URL: www.minipix.co.uk/?feed=rss2&cat=-342.

Other changes I’m bringing in include a mobile-enabled view of my blog, so that you can read my posts from your phone.  I’ll hopefully also figure out a way of updating my blog from my mobile too, so that I can blog on the move.

I shall also be adding a new ‘Family’ category, as I seem to be writing an increasing amount about our son Samuel, and it feels appropriate to recognise his significance with his own category.

EDIT: If you’re seeing the Twitter micro-posts but they’re unformatted (i.e. not in funky speech bubbles) you probably need to refresh your browser to reload the stylesheet.  To refresh your browser, click the refresh button in the toolbar.  Or press F5.  Or press CTRL-R.  Or CMD-R if you’re on a Mac.  Or ALT-CTRL-SHIFT-TAB-R-X-N-SPACE if you happen to have that set up as a custom keyboard shortcut.

18Apr 2010

The Competition

I remember when I first started blogging.  My friend Phill was responsible for starting me off, back when we were at uni together.  He had a blog, and said that I should have one too.  So I registered a free domain name – www.minipix.cjb.net – and pointed that at some free webspace that came with my Dad’s dial-up internet connection (with permission… I think), and wrote my first blog.  If memory serves, it said something along the lines of ‘hey, I’ve got a blog, not sure what to write here, but we’ll see how it goes’.  Once the bug had bitten, there was no stopping me.

That first blog was a straight HTML page.  I edited the HTML, probably in Notepad, put the latest post at the top of the page, and re-uploaded the file.  Simple but effective.  But over time it became a little unwieldy.  So Phill got me to beta-test his PHP-MySQL blogging system that he’d been tinkering with, and that opened up a lot more options.  Before long though I felt it necessary to migrate to something more substantial, made the move to WordPress (importing my old blog posts), and have been a blogging sensation ever since.  Well, maybe not the sensation bit.

But now, an ominous cloud hangs on the horizon.  A tiny ripple out at sea that has the potential to grow into a tidal wave that will rip through all that once was safe and secure.  My wife has a blog.

(more…)

19Feb 2010

In need of some TLC

Just a quick message here to say that my blog isn’t letting me in.  WordPress has failed me.  I can’t log in to add new posts, because when I enter my login details it just redirects me back to the login page rather than taking me to the admin panel.  And yes, I have tried disabling all my plugins.  And yes, I have tried upgrading to the latest version of WordPress.  And yes, it is amazing how I can still post to my blog if I can’t access it (I’m using Flock instead, hopefully this will work in the meantime).

So apologies for the lack of content here lately, when I get it all back up and running again I hope things will return to normal, with posts planned about how I get Samuel to sleep, video editing, rants about Google Buzz, revelations about split infinitives, and so on and so forth.

1Oct 2009

The intricacies of synchronisation

(Below is a solution for getting iSync to sync iCal’s “delegate” calendars from Google Calendar onto a mobile phone.  Feel free to skip all the blurby bit at the top if you’re not interested in my life story.)

My job means sitting in front of a computer all day, playing with the internet.  There are of course times when I leave my desk, or need to use a different computer, and then it’s nice to still have the same tools to hand.  So I’ve put my diary onto Google Calendar, so that it’s available wherever I am.  Nice.

Oh no, wait a minute.  I also need that same calendar on my mobile phone.  So far there is no bridge directly between Google Calendar and my Motorola L6, unless I load up Google Calendar on my phone’s browser – but that costs me money because I’m on a PAYG tariff and I don’t get any free data, so that’s out of the question (not least because it’s far from instant, even using the incredible Opera Mini browser and its clever servers).  So, that means having the calendars on iCal as well, so that I can use iSync to copy everything across.  And here’s where it all gets rather complicated.

(more…)