Tuesday, April 09, 2013

Standing on the shoulders of giants

Image: 'untitled
Found on flickrcc.net

This lesson is about rapid prototype development using some of the tools we've explored so far (and a couple of new ones).
Let's say you've been given a brief: 'build a website about x' (x could be anything, today lets say it's the samsung galaxy phone). Where do you start?
The way I see it you need 3 things for a website to work:
  1. A usable site structure
  2. An appealing design
  3. Good content
Let's tackle them one at a time.

Site Structure

I've put this first because it seems to be a stumbling block for many people. What pages will your site need and how will you lay them out? Often a customer will have an idea about what pages they need. If not you might build a site around the activities it supports (e.g. looking for products, reading feedback about them, putting them in a virtual basket, looking at your basket, purchasing, tracking delivery), or it could be layed out along company lines (departments, regions etc).
But what if, like us, you're starting with a blank slate? A great way to lay out a site is to find out what people are interested in and go from there. If you had the money you could hire a marketing firm and do some work with focus groups. But if you're cash strapped Google has a great tool in it's adwords product: the keyword suggestion tool (to use it you may need to sign up for an account). Put in your starting term (in this case: samsung galaxy), tinker around with the settings  and you're away:

Looking at the results you'll see what people have been searching for (and how many searched for those terms). If you're interested in making money from running google ads you'll also see which terms are compeditive (i.e. have advertisers competing to put ads on your pages). When sorted the results for our samsung galaxy query look like this:

From here you could refine your search by clicking on any of the search results, or just look through the list for ideas. Looking at this list I'd say we need top level pages for the Galaxy A, S, S2, S3, Ace and Tab. By clicking on the dropdown next to the results and selecting 'Google Search' you can see what other people are writing about the subject, and also (at the bottom of the results page) see some more suggestions. Here's what comes back from 'samsung galaxy a':

These would make good second level pages (i.e. pages linked to from the top level 'samsung galaxy a' page.


We've already had a bit of a look at fast tracking design using Lavish. We can take this a step further by using one of the bootstrap example templates. To use one of these, open the example then save the page to your local drive.


If you're starting from scratch the quickest way to put in content is to find stuff other people have created and made available. That means content that has no copyright (public domain), or limited copyright (Creative Commons).
All the wikipedia content is released under a Creative Commons Attribution-ShareAlike License so there's a ton of text to begin with (don't forget to add the attribution though).
For media (music, pictures, video, clipart etc.) there's a range of sources. A good place to start looking is on the Creative Commons search page. I used flickrCC.net to find the image at the top of this post.
 Using pre-made content is a good start, but you'll get no credit from Google for recycling stuff they already know about. To get some ranking you need to add your own information, and/or get your visitors to add to it.

Tuesday, March 19, 2013

CSS Layout

Image: 'left arrow
Found on flickrcc.net

Getting sick of everything aligning to the left or the centre of the page?
This week I want to have a look at using CSS to layout you pages in a more appealing manner. I was going to write a post about it, but then came across the excellent Learn CSS layout site. Highly recommended.
After you've worked through some of the examples do yourself a favour by looking at Bootstrap Scaffolding - it takes a lot of the pain out of using CSS to lay out a page.

If you want some more detail than the admittedly sparse documentation on the bootstrap site, there's a nice selection of video tutorials on Bootstrap 101

Tuesday, March 12, 2013

Long content and linking pages

So far we've been working with single short pages of information. But what happens if you've got some big slabs of text to present? How would you present long texts so that people don't get overwhelmed? In this post we'll have a look at a few different solutions...

Setting up a template

Before we start let's create a space and some pages to work with.

We'll be using Twitter Bootstrap to style our pages. So if you haven't already got a copy, head over to the Bootstrap site and download a copy, then go to the template section of the 'Getting Started' tab and copy their page template.

We'll need some text on the page too. So that it's not too distracting, we'll use something nonsensical. Lorem Ipsum is the text of choice for web developers. Go to a lorem ipsum generator, grab 5 paragraphs and paste it into your template just below the 'Hello World' header.

Edit the text you just pasted so that it has <p> </p> tags around each paragraph.

Now you've created a template, save it into your bootstrap directory as page1.html
Now make 4 copies (page2.html, page3.html, page4.html and page5.html); we're set to go...

Linking separate pages

The traditional approach to presenting large amounts of information is to create separate pages of and link them together. You may need to put in several links so that viewers can navigate directly from one page to any other.

Add this code just after the body tag on page1.html:

    <a href="page2.html">Page 2</a>
    <a href="page3.html">Page 3</a>

To get your other pages linking back to the home page and to each other you just need to copy this code and edit it so that it points to the other pages. For example, on page2.html it should look like:

    <a href="page1.html">Page 1</a>
    <a href="page3.html">Page 3</a>

Update and test for page 1, 2 and 3.

Beautifying your links

The bootstrap css allows you to style your links so that they look like buttons. Just add the btn class to your anchor tags:

    <a href="page2.html" class="btn">Page 2</a>
    <a href="page3.html" class="btn">Page 3</a>

Adding some icons

You can add some icons to the buttons using the 'icon-xxx' class. See the Boostrap icon documentation for the various icon names available*.

                <a href="page2.html" class="btn"><i class="icon-book"></i> Page 2</a>
<a href="page3.html" class="btn"><i class="icon-book"></i> Page 3</a>

* If you want more icons, you can change the icon set available. This post tells you how to use the famfamfam icon set instead

Creating one long page 

Instead of creating separate pages, you could make one long scrolling page and linking to headings inside the document.

Open page4.html in your editor, copy and paste your H1 and lorem ipsum text a three of times so that you have a nice long bit of text (you should have 4 headings now, with text after each one of them). Change the heading text in each section so you can tell them apart (I just added a number after each one).

To link within the page we're going to create sets of anchor tags. One acting as a target, and the other linking to it. Just above the first H1 tag add the following code:

     <a name="1"></a>

This is our target.

Go to the bottom of the page and enter this code:

   <a href="#top">Top of page</a>

This link looks for the target with the name '1'. Clicking on it will take you to that anchor tag.

To complete the navigation for the page, we need to add named anchors above each of the H1 tags on the page: <a name="2"></a>, <a name="3"></a> and <a name="4"></a>

Below them we need to create links to the other sections, but instead of the anchor tags we used with our 3 page experiment, we'll use another Bootstrap component: the navbar.

To create a navbar for our page, add this code to the top of the page:

  <div class="navbar">
    <div class="navbar-inner">
      <ul class="nav">
        <li><a href="#1">Hello 1</a></li>
        <li><a href="#2">Hello 2</a></li>
        <li><a href="#3">Hello 3</a></li>
        <li><a href="#4">Hello 4</a></li>

Here we're using an unordered list of links to the named anchors on the page. We could copy this nav bar onto the page 4 times, so people could navigate from the end of each section, but a better idea would be to fix the navbar to the top of the page so that it remains visible as you scroll up and down through the content. You can do this by adding the class: navbar-fixed-top to the navbar link:

<div class="navbar navbar-fixed-top">

Making a tabbed interface

A solution to the confusion our 'scrolling page of death' might create, is to hide sections of the page until they're needed. You can do this by making a tabbed interface.

The easiest way to start is by copying the code from the Bootstrap site:

<div class="tabbable"> <!-- Only required for left/right tabs -->
  <ul class="nav nav-tabs">
    <li class="active"><a href="#tab1" data-toggle="tab">Section 1</a></li>
    <li><a href="#tab2" data-toggle="tab">Section 2</a></li>
  <div class="tab-content">
    <div class="tab-pane active" id="tab1">
      <p>I'm in Section 1.</p>
    <div class="tab-pane" id="tab2">
      <p>Howdy, I'm in Section 2.</p>

You can see that each of the tabs are defined in an unordered list and that they link to an ID on the page (#tab1, #tab2). Each of these are IDs for the divs that contain the content (e.g. <div class="tab-pane active" id="tab1">)

Replace the code: <p>I'm in Section 1.</p> with our H1 and Lorem ipsum text (and the other <p>Howdy, I'm in Section 2.</p> with the second section) and we've got the start of a tabbed interface. Add two more tabs for the remaining sections and we've converted our page altogether:

Something to explore

A different approach than using a tabbed interface is the collapsible or accordion page but I'm tired of typing now so I'll leave this one for you to explore and learn about ;-)


Image: 'The Long Book
Found on flickrcc.net

Tuesday, August 21, 2012

Finding free images you can use on your site

There's no doubting that old adage: "a picture's worth a thousand words", and nothing sadder than a web page full of text with no supporting images. So you owe it to yourself and your readers to add a few eye catching graphics to every page you write.

If you want to download pictures to use you'll want to find royalty free stock images or pictures released under a creative commons license. In this post I'll walk you through the process of finding photographs that use the flickr creative commons license using a search engine I wrote called flickrCC

1. Go to flickrcc.net

2. Enter your search term and click on the 'Find' button

The two check boxes allow you to fine tune your search. Generally the default is all you need, but sometimes you'll need some more control.

By selecting 'For editing' you restrict your search to just those images that allow derivative works: 
  • Attribution (CC BY); Attribution-NonCommercial-ShareAlike (CC BY-NC-SA); 
  • Attribution-ShareAlike (CC BY-SA) and Attribution-NonCommercial (CC BY-NC).

If you de-select the 'for editing' option you include images from the remaining two Creative commons licenses:
  • Attribution-NoDerivs (CC BY-ND) and 
  • Attribution-NonCommercial-NoDerivs (CC BY-NC-ND). 
Selecting 'For editing' will give your larger pool of images to draw from, but it will also mean you cannot edit your image, so I'll leave the 'for editing' on for now.

If you check the 'Commercial' box the search will exclude images posted with Attribution-NonCommercial-ShareAlike (CC BY-NC-SA) and Attribution-NonCommercial (CC BY-NC) licenses. If you're planning on selling the final image, or using it in a product that you're going to sell you need to put a check mark in this box. Since I'm putting this image up on the blog here, I don't need to worry about this.

By combining the two check boxes you've got quite a bit of fine control over what gets displayed, but generally you'll be fine if you go with the default. You can read more about the Creative Commons licenses on the Creative Commons license page.

3. Choose one of the images in the left hand panel

Once you've clicked on the 'Find' button you'll get back up to 30 thumbnails matching your search term.

You can get another 30 thumbnails loaded by clicking on the 'next' link at the bottom of the panel.

When you click on a thumbnail the corresponding attribution will load in the right hand panel, along with a larger version of the image...

4. Select the image resolution

When you've found an interesting thumbnail and clicked on it a bigger version is loaded into the right hand panel. Unlike the little, square thumbnails this image will have the picture's correct dimensions.

Clicking on the links below the image will load larger or smaller versions. The medium size is the one you'd usually use for a blog post or web page, but the other sizes can be handy for different applications too. For this tutorial we'll click on the 'medium' link to load it...

4b. Optional extra: edit the photo

Well, if you left the 'For editing' checkbox selected when you started your searech you'll see an 'Edit' link above the copy in the right hand panel. Clicking on this will allow you to edit your picture using the online image editor, aviary.

Aviary will let you crop the image, resize it, rotate it, and add text and other artefacts, making it truly yours.

5. Save the image

When you've loaded the picture size you want (and optionally edited it), right click on it and save it to your PC by selecting 'Save image as...' from the pop up menu (if you're using Firefox, Safari or Internet explorer the menu option might say something else, but should look a bit like: 'save image').

When you save your picture use a descriptive file name rather than the boring string of letters and numbers that comes up by default, it will make it much easier to find later. Also, note which directory you save it in so you can find it again later (my hard drive is full of lost images because I didn't pay attention when I clicked that 'save' button :-)

6. Copy the attribution text

So that we comply with the Creative Commons license we need to add an attribution to our final post. FlickrCC makes this easy by putting the attribution text above the picture. Select this text by left clicking and dragging the mouse over it, then right click on the selection and choose 'copy' from the context menu.

7. Putting it all together

We're all set now to add our free picture by uploading it to our blog or web page along with it's attribution. Something like:

Image: 'Dolomiti - le Odle viste dal Seceda
Found on flickrcc.net

And there you have it, everything you need to know about using flickrcc.net to locate free images, released under a creative commons license on flickr along with a free picture editor for crafting unique new images for your blog, web site or training material - have fun and stay creative,

PS. if you'd like to spread the word, feel free to re-use any of the material in this post, or the accompanying slideshow 

Tuesday, May 29, 2012

A programming prescription: JavaScript tonic

Image: 'the JavaScript Code

A little JavaScript revision, followed by an introduction to the jQuery library.

So far we've covered quite a bit of ground in our JavaScript lessons. Here's a few of the highlights...

To get some practice with these three areas, we're going to work through building a Web page which the user can add notes to and edit the content of those notes.

OK, now that we've experienced some of the pleasure and the pain of coding JavaScript from scratch it's time to take a look at the web's most popular JavaScript library: jQuery. Once you've downloaded a copy, try working through this introduction to jQuery.

Now, if you've got a taste for it, choose one or two of these 51 tutorials and examples and work through it/them. If any of them float your boat (or sink it) report back here on what you've found...

Mobile first - Responsive web page design

Image: 'Browser'  http://www.flickr.com/photos/38305415@N00/4397800453
Image: 'Browser' http://www.flickr.com/photos/38305415@N00/4397800453

Following on from last week's efforts with the jQuery mobile javascript library, I thought we might have a look at building a responsive web page (one that will display its data in different ways on different screen resolutions).
Once again, we're going to stand on the shoulders of giants to achieve our goal. This time using HTML5 Boilerplate. This is a set of HTML5, CSS3 and JavaScript that solves a lot of cross browser compatability issues. Not everyone likes the 'include everything you might need' approach (Harry Roberts, for example), but for our purposes its pretty close to perfect... especially when you find that someone's built a template generator to help you to get started with new responsive design projects based on HTML5 Boilerplate.
Here's a few links to get us started:

Monday, May 14, 2012

Developing a mobile web site

Image: 'Traditional English Bow-top horse-drawn wagon

Going Mobile

This week we're going to look at building a mobile web site (albeit a rather small one).

Before we start, I have to say that there's quite a bit of debate about the best way of going about adding 'mobile content' to a site. As I see it there are 2 schools of thought:

  1. Create a separate site just for mobiles and direct any mobile based browsers to these pages. This has the advantage that you've built the best user experience you can for your mobile visitors, but the disadvantage of having to maintain 2 sets of pages
  2. Build a web site that's 'responsive' to different devices, scaling larger and smaller as screen size dictates. There are two groups in this camp: one that says you should start with a mobile phone sized version and then design in additional elements for progressively larger screens (such as tablets, netbooks and desktop computers, and possibly tabletop screens in the near future). The other school works down from desktop sized screens (presumably from an existing web site), trimming out 'extra' data or moving it down the scrolling mobile screen. The advantage of this second approach is that you only need to maintain one set of pages. The disadvantage is that these pages can be much more complicated to build and maintain. You can read more about responsive design on scoop.it
For today's exercise I've decided to go with the first school and build a site from scratch.

The development environment

For testing there's nothing like a real mobile phone. You can build pages on your local machine and test on a mobile, but it's a bit fiddly: involving setting up a local web server, connecting to a wireless router and connecting the phone to the development machine's local IP address through that router. An easier method is to install the Ripple Mobile Environment Emulator in chrome.

Once you're set up you can download a mobile web development framework. There are a whole mess of these, but we're going to use the one that seems to be getting the most press at the moment: jQuery Mobile. Not only is it a stable, well supported piece of software, but it has some excellent tutorials and discussions on Quora and stackoverflow.

Here's a couple of tutorials for starters:

Wednesday, May 09, 2012

Open source HTML editors

Long time, no see

It's been a long time between drinks here on the web development blog, but I've started teaching web development again after a stint as an e-learning evangelist, teaching other trainers how to use web technologies to deliver vocational education, so it seemed a good time to dust off the keyboard and post a little more information.

There may be a few things to catch up on...

First up then was a search for a web editing tool that the class could use for the subject: ICAU4207B - Apply web authoring tool to convert client data for websites (you can read more about it on the ntisthis web site).

If you've got the cash and the inclination the daddy of all web authoring tools is undoubtedly Adobe Dreamweaver. They have a student discount but you're still looking at a $400 price tag for the full suite. 
If you're on a budget, there are some free alternatives, and this week we had a look at Blue Griffon.

The good

  • This WYSIWYG editor is available for Mac, PC and linux distros.
  • the no-frills version is free
  • out of the box it's pretty capable and could result in productivity gains

The not-so-good

  • Added functionality will cost you. There are downloadable add-ons ranging in price between $10 and $15. We might need the snippet add-on to address all the performance criteria of the unit
  • There's no documentation (this is one of the 'value added' components you pay for)
So, we took BlueGriffon for a spin in the class last night and I think reactions were mixed. A few students thought that they'd be better off learning an industry standard, and will be looking at buying the education version of the Adobe product. Others could see the advantage of BG, but thought that Notepad++ was easier to use and were a bit reluctant to let it go. I've left it with them for the week and will do a poll next Tuesday to see how many of them want to stick with it. If they do we might build a user manual on wikibooks. On the other hand, we've got a bit of time up our sleeves and there are a few alternatives we could explore, including:
These three are all free and open source, have documentation and run on linux and windows, but I'm not sure about their Mac support.