They say you learn something new every day.

Posts tagged ‘websites’

URL Encoding (03/04/2012)

Ah encoding! One of those things that causes me so many problems, but which I’ve put so little thought into. Today, I discovered you can set Internet Explorer to do so automatically:

To configure Internet Explorer for automatic encoding

  1. Choose Tools > Internet Options.
  2. Click the Advanced Tab.
  3. Select the Always send URLs as UTF-8 check box.
  4. Restart the browser.

What Makes a Good Post (04/03/2012)

L was flicking through my iPhone today, and I watched over her shoulder as she browsed through this very site.

It was interesting to watch her, and read the site as someone who didn’t write it. Looking at it this way, I realised a number of things I could do differently if I wanted to make a site that lots of people read.

I should add – I don’t want to make a site that lots of people look at. This site is really just for me, but it’s always nice when people like what you’d done with the place.

I don’t consider myself an “expert” on social media in any way. Really, I suspect anyone who thinks they’re an expert is a charlatan anyway. But here’s what I’ve figured out today when I was thinking about this.

  1. The first thing you need to do is make your posts less wordy. Watch as I completely avoid this in this (and basically every other) post. However, you have to think about how people use your site. And most of them time they’re going to come to your page through browsing a Tumblr feed or a WordPress tag or whatever. They’re not looking for wordy things, so they’ll skip over you. Short and frequent is better than long and infrequent.
  2. Link-bait is a hideous term, but it’s how you make people share your content and start following you. Part of me knew, with my post the other day about quotes, even though it’s long, it is quite linkable and likeable.
    If I’d really wanted this to take off, I’d done a series of short posts, each with one quote and why I like it.
  3. Tags. Tags are important with social media. As most people are going to find you by browsing tags, rather than through Google. Obviously, Google is important for your natural search visitors, but a lot of your followers are going to come from your community.
  4. Speaking of which, engaging with the community is vital. Which means liking and reblogging other people’s work. I got more followers, more quickly, than anything else just by reblogging things I thought were funny.
  5. Answer one question. My most viewed and popular post is this one. It’s weird, because it’s short and not really that interesting. It’s just how to list all the tables in a database. But if that’s what you’re looking for, it answers the question perfectly. And concisely. And in one page – you don’t need to go hunting.
  6. The final thing is, as I saw today – read your posts over someone else’s shoulder. There’s nothing quite like that for seeing how you appear to someone else. It’s amazing how differently your site will look over someone else’s shoulder.

How to Write a Report (29/02/2012)

I did something in the description of this blog (and edited it into the very first post) that I’ve realised I need to reuse.

Elevator Conversation

They say you learn something new every day. This is my attempt to document that.

More Detail

If you do learn something new every day, how long do you remember it for? That’s a lot of things to store. This is my store of “learned things”. I like Steve Makofsky’s description of his blog as “backup of my brain”.

Even More Detail

My other thought was about Steve Yegge’s comment that “I sucked, and I still do, although hopefully less every year.” Steve’s talking about coding, but I think it works for every aspect of your life.

After all, replace the word “code” with your chosen profession in this quote from Jeff Atwood and you’ve got what this site is all about:

“You should be unhappy with code you wrote a year ago. If you aren’t, that means either A) you haven’t learned anything in a year, B) your code can’t be improved, or C) you never revisit old code.”

I was somewhat frivolous when I did it, but there’s something really useful about this style.

You capture everything in the first iteration, and people can stop reading there. Or, if they want more information, they can keep reading. It suits different audiences.

I think this is a good way of putting together reports and documents:

This report in one line.


This report in one page


This report in graphs and charts


This report in detail


This report in technical detail

Or something like that. It allows readers to get the gist of it all at once, and then jump to the level of detail they require. Obviously, you could do some even cleverer things if you delivered it in web format or something like that. Sadly, at the moment, people are still printing things off, but I think this can still work in the printed format.

I’m going to try it the next time I have to put something together.

There’s been a couple of times now when I’ve prepared a page report and people have wanted a 10 page one or a 10 page one and people have only really wanted a page one. This way, you can allow people to easily flow from one category to another.

Couting Words (27/02/2012)

So, as I said, proof reading is hard. Really, to misquote Douglas Adams, hard. You just won’t believe how vastly, hugely, mind-bogglingly hard it is. I mean, you may think doing maths is hard, but that’s nothing compared to proofreading.

One of the things I find difficult to spot is duplicate words. Being a techie sort, I decided to code myself out of it, so I wrote a little internet app: the repeated word finder.

Basically it searches for cases of the same word being used in close proximity and highlights them. Obviously, there are lots of legitimate uses for repeated words (like both the ones in the illustration), and I know that you can never code better writing, but it helps you see the errors. My hope is that by highlighting these things  it’ll help me spot them.

It’s interesting – there are some things humans are good at, and some things computers are good at. Humans are very good at reading what should be there, and improving phrasing etc. Computers are very good at reading what is actually there and highlighting things that humans would just gloss over.

Hopefully, this is just the beginning of a larger proof reading tool. It’s something of a sister to the uber-wordcount tool, which needs a bit of a rewrite really. My plan is to handle all of this sort of thing – stats, wordcounts, etc, in one javascript based application. There’s no need to do anything server side with this at all.

I’ve written the app in javascript, and I have to admit, my javascript is rusty. I was quite exicited to find a javascript minifier. This is the original:

function countit(){

var formcontent=document.wordcount.words.value
formcontent = formcontent.replace(/\n/g, “

formcontent = formcontent.split(” “)
var recentbits = “”

for ( var i = 0; i < formcontent.length; i++ )
if ( recentbits.toLowerCase().indexOf(” ” + formcontent[i].toLowerCase()) > 0)
formcontent[i] = “” + formcontent[i] + “

recentbits = “”

for (var count=0; count < 20; count++)
recentbits = recentbits + ” ” + formcontent[i-count]


var totalwords = formcontent.length

document.getElementById(‘totalwords’).innerHTML = “Output: (” + totalwords + ” words)

” + formcontent.join(” “)


And this is after minifying:

function countit(){var a=document.wordcount.words.value;a=a.replace(/\n/g,”

”);a=a.split(” “);var b=”“;for(var c=0;c0){a[c]=””+a[c]+””}b=”“;for(var d=0;d<20;d++){b=b+” “+a[c-d]}}var e=a.length;document.getElementById(“totalwords”).innerHTML=”Output: (“+e+” words)

”+a.join(” “)}

Obviously, you can’t read it, but it’s so much more compact.

Going through it, I don’t think it does anything cleverer than renaming all the variables to consecutive letters and getting rid of all the space. But it’s pretty nifty for loading into the live system.

It’s too Easy (07/02/2012)

I’m designing an internal web application at work. Gathering feedback today, one person said it was “too easy” to use.

It’s an interesting problem to have. Generally things are too difficult to use.

I think there were actually two parts to this problem:

  1. The application was very sparse and didn’t seem like a fully featured application. It reminds me of how Google had to put the copyright bar on the bottom of the bar, because people kept thinking the page hadn’t fully loaded.
  2. It wasn’t giving users enough feedback telling them that things had been finished or achieved successfully. 

To combat both of these things, I redesigned it a bit today to make it look more solid (largely this involved putting a fade on the header background, and a background colour on the main part of the page, with the main text centered).

It was amazing how much of a difference this made. Almost at once the application looked more “solid”. While it wasn’t harder to use, it felt more “solid” somehow. When you clicked the button you felt like you were doing something.

I’m reminded again of how important design is. It’s depressing, I know, but everyone does judge books by their covers.

Asps in Nets (31/01/2012)

I’m struggling a little bit with .Net. It’s a little bit different from languages I’ve used before, and I’m worried that I’m falling back on what I know a bit – doing things in less efficient ways because that’s how I’ve always done them.

This is a bit of a problem really. What’s always inspired me to learn something new is the drive to get something to work. If I can get it to work, albeit in the “wrong” way, then I tend to stop.

Now, on the one hand, this may result in code that’s a little tatty, but on the other, the user doesn’t care. What they want is the functionality, and if it looks nice, works and is easy to use, they’re happy.

If it’s written in nice OOP code, or cobbled together from bits and bobs then they’re happy.

Now, I’m not advocating crappy code in any way. Oh God no, I’ve had enough problems with my own crappy code without writing more. But what I’ve realised is that more important than the neatness of the code is the richness of the application.

It’s much more important to get the functionality in there, make it work and tweak from there.

I realised this when putting together this function to return the group membership for a particular computer. It’s a little cobbled together, but it works. And now that I’ve got the functionality I can start tweaking it to make it work better and faster, and start identifying faults and fixing them.

I think people need to remember. We don’t code to write code. We code to solve a problem. 

FUNCTION GetMembers(Asset AS String) As String

DIM members

DIM objADAM As DirectoryEntry = New DirectoryEntry() 


DIM objSearchADAM As DirectorySearcher = New DirectorySearcher(objADAM)

objSearchADAM.Filter = “(&(cn=” & Asset & “))”

objSearchADAM.SearchScope = SearchScope.Subtree

DIM objSearchResults As SearchResultCollection = objSearchADAM.FindAll()

If objSearchResults.Count 0 Then

Dim objResult As SearchResult

For Each objResult In objSearchResults

DIM memberof AS Object =“memberof”).value

IF NOT IsNothing(memberof) THEN

DIM collectiontotal= objResult.GetDirectoryEntry().Properties(“memberOf”).Count -1

Dim member,adgroup, i

For i = 0 To collectiontotal

member = objResult.GetDirectoryEntry().Properties(“memberOf”)(i).ToString(

members = members & member


members = “There are no groups on this computer.”


Next objResult


members = “Computer could not be found.”

End If

GetMembers = members


At Least the Directories are Active (30/01/2012)

I may be struggling with my house situation, but life trundles onto.

I’ve been building my web application at work, which I’ve really been enjoying doing. It’s great to be totally in control of a project and just fix it however you like.

However, I’m writing it in ASP.Net, which is a language I don’t really know that well.

Today I a discovery. If the DNS is set up correctly, you can get the asset number of the machine that’s connecting to the webpage.

Assetnumber = System.Net.Dns.GetHostEntry(Request.ServerVariables(“REMOTE_ADDR”)).HostName

This is brilliant. It’s something I didn’t think you could do. But the header data contains the IP address, and if you do a Reverse DNS lookup, you can get the asset number.

Of course, it’s the full domain name, so you have to trim a bit off the end, but that’s easy:

Assetnumber = UCASE(LEFT(Assetnumber,INSTR(Assetnumber,”.”)-1))

Once you can do this, the possibilities are quite exciting. It means you know who the user is, and what computer they’re on, so you can really tailor the results back to them.

Pimp my Tumblr Search (18/01/2012)

Yesterday I was looking for something I’d learnt before (about adding a new table in SQL, I believe), so I thought I’d search my Tumblr for it. Wrong. It turns out the Tumblr search box doesn’t work. What on Earth? Did I break my theme when I pimped my Tumblr?

It turns out I didn’t. This is quite a common problem. The search on Tumblr just doesn’t work. I genuinely found this hard to believe at first. “It must work”, I thought to myself, “they wouldn’t just leave a broken feature there”. But, it doesn’t.

I was left really stumped that a Web 2.0 project which seems to care so much about usability, would make such a mistake. I suppose the themes are made by individuals so Tumblr can’t get rid of the search box. But it must have worked at some point for people to add it in. Maybe it causes too much load on the system. Whatever the reason, we have to deal with the problems that we’re dealt. The Tumblr search just does not work.

It’s a problem to which some people have come up with some innovative solutions.

The standard solution seems to be to use a tag search:

You put this bit of code in the HTML head of your theme:

function handleThis(formElm)
return false;
// —>

And then edit your search box:

It’s quite a nifty bit of code – and a bit like the code that I hacked together (and didn’t really understand) years ago to make my own custom search page:

Looking at this code, I understand it completely, which is a really nice feeling.

It takes “this” (the value from the form) and adds it to the string to get a new page location. It then uses “window.location” to load the new page created. Technically you could create any page with this. And hence, point to any form that uses GET variables.

The problem of course is that all it’s doing is loading tag pages, which isn’t really a proper search.

One option would be to add it into a Google search using the “site:” feature, like this:

But the problem with this is that it takes you to Google and away from Tumblr, which is a bit jarring. It’s like opening the fridge door and finding yourself in Tesco. It’s great and thanks for all the choice and that, but I only wanted the milk.

Added to this is the fact Google’s crawling may be a few days out of date. It’ll be fine for the old pages, but given I update this every day, that might be a bit annoying for me when searching.

Dropping the JavaScript Off (12/01/2012)

I have an Amazon Associates account. I’ll put my hands up and admit it – sometimes I try to make some money. Sue me! (Well, don’t that would be a bit ironic, seeing how as what I’m trying to do is get some money, not lose it). Maybe the internet doesn’t think too highly of this, and it makes me a bit of an advertising weasel. But hey, we’re all those these days, whether we like it or not.

The good thing with Amazon Associates is that it’s not blatant marketing. You just put a link to an Amazon product and if anyone buys it, you get a small percentage of the sale.

Some of you may be thinking that this could produce a conflict of interests, since it’s in your interests to say “this is great, oh and by the way, here’s a link to buy it on Amazon, which you should totally do if you’re not an idiot.” However, Amazon sells everything. So if you’re writing about something you like anyway, you’ll be able to find it on Amazon, so as long as you do it that way, rather than linking to the most expensive thing you can find on Amazon.

However, the problem is, I’m very lazy. And converting the standard Amazon link to an Associates link is sometimes a bit of a pain.

So I thought I’d have a look at the Associate links and figure out how they work. It seems each item on Amazon has a 10 digit alpha-numeric ID number.

For example, the link to the book I’m reading at the moment (Emma Forrest’s Your Voice in My Head, which really is very good and I strongly recommend it), is:

 And the ID number is 1408808218

To convert this to an associate link (so I get a teeny, weeny little bit of the money), you need to add that ID into this template link, (twice): 1408808218 /ref=as_li_qf_sp_asin_tl?ie=UTF8&tag=imagedisse-21&linkCode=as2&camp=1634&creative=6738&creativeASIN= 1408808218

That’s neat. However, I’m not quite sure it’s simple enough. In actual fact, during the course of writing this, I discovered Amazon have an Associates bar you can turn on, which allows you to click to generate the links while searching Amazon.

Amazon already let you do this

So that, in fact, is problem solved. However, now I’ve started looking at this, I thought I’d finish off my learning. As Jeff Atwood says:

Don’t Reinvent The Wheel, Unless You Plan on Learning More About Wheels

Well, I’ve come this far, maybe it wouldn’t be too bad to learn a bit more about wheels. Always helps if you ever need to fix one.

I’ve noticing an increasing number of sites saying “drag this button onto your bookmark bar”.

There's loads of these around!

I know it takes advantage of some sort of weird javascript hack, but I thought it was time to see if I could create my own today.

In actual fact, it was easier than I thought:

// You need to begin with javascript and then a colon

// This gets the URL of the current document
var url=document.location.href,

// This trims out the link to leave just the product ID

// Echos out the new link
alert(“” + id + “/ref=as_li_ss_tl?ie=UTF8&tag=imagedisse-21&linkCode=as2&camp=1634&creative=19450&creativeASIN=” + id)

You need to put it all onto one line, but other than that you’re away. And once you’ve got this there are loads of possibilities for extending it further.

In actual fact, now that I’ve realised the Amazon associates bar does this for you, I probably won’t bother with this, but I’ll definitely look at doing something with this in the future.

You scratch my backup, I’ll scratch yours (05/01/2012)

So, like everyone else in the world, I don’t backup any of my data. I just assume that losing data is something that happens to other people. And then when I do lose data I find someone to blame.

The standard backup strategy

However, I’ve decided I’m going to change all that. Of course there are a few requirements for my backup plan:

  1. It must be automatic. Ideally fire and forget. I love stuff that’s fire and forget. It’s as close to perfect as … stuff can get. And not just computers. Take inoculations, for instance. The perfect example of fire and forget medicine. The problem is if it’s not fire and forget, then I’ll have to remember to do it. And I’ll forget.

    This is a general point about everything, not just backups and not just computers. If it’s not something you’re interested in, you will forget. Everyone seems to have their own laws and rules these days, so I’ll propose the Pitt Principle:

    Anything that someone can forget to do, someone will forget to do

  2. It must be free. I’m not going to pay to store all my stuff. Again. That would really be a kick in the teeth. No, sometimes I have mixed feelings about this philosophy, but overall, as a starting point I try to do things in a way that’s free.
  3. The process must not affect my life or computer use. I don’t want some background task that uses up 100% of my CPU so I can’t do anything productive, or some upload task that uses up all my bandwidth. Or even, some application that slows my boot time down or takes up 50GB of hard disc space. The simpler the better as far as I’m concerned.

Now, that’s enough of what’s it’s not. While it’s helpful to have a nemesis, I was watching a documentary about Blackadder (I think it was this programme, although I can’t find the quote, despite hunting through the subtitles) the other day where they said they spent so much time talking about what they didn’t want to make that they almost painted themselves into a corner.

So, what should my backup plan contain?

  1. I’m happy to put in more effort in advance if it means less effort in the future. I regard this as quite a central tenant of being lazy. There’s no use being lazy now, if you have to do twice as much work tomorrow. That’s bad laziness.
  2. I’m happy to script some stuff if it means it does just what I want it to do. There’s a tension here, I always think, between getting software that’s already written, and writing your own that does just what you want. I fight this a lot at work. But there is a sweet spot, and partly that sweet spot depends on how good you are at coding.
  3. I’m happy for it to be several processes as long as they’re all automatic.

I came across the first part in my plan yesterday: the excellent site If This Then That. It’s such a great idea for a website, and it’s really nice to use as well.


It takes as an input a number of social media sites, RSS feeds or emails (so you can insert arbitrary inputs), and allows you to automate another task based on those. It’s a bit difficult to explain, so it’s easier to show with an example.


Yesterday, I created a task that automatically posts a copy of an article to my backup wordpress blog every time I post an article to Tumblr.

I’ve never really thought blogs needed backing up; I assumed the hosts did that for you, but that isn’t always correct. Now, though, I’ve got blog redundancy. If Tumblr goes down (I’m sure that it won’t), this will still be available on wordpress. And if it dies, all my text content will be save.

Perhaps a bit overkill, for this site, which is really just for me, but that’s not the point. It’s the right thing to do,

Now, of course, that’s just the first part of my plan. I’ll need to do something similar for my website. I store all the images for this blog centrally in my website, so what I need to do is automate a back up of them to something like dropbox or Flickr.

Now along with this the other day I read Jamie Zawinski’s tongue-in-cheek blog post about backing up:

Learn not to care about your data. Don’t save any old email, use a film camera, and only listen to physical CDs and not MP3s. If you have no posessions, you have nothing to lose.

He means this facetiously. but there’s something a bit appealing about this. It’s like getting rid of possessions. It’s quite liberating. But, having said that, there is some data I’d be really sad if I lost.

The real option, Jamie tells us, is to buy a load more hard drives and back up to them. And a server. And leave a hard drive at work. And post one to your Aunt in New Zealand, and put one on the Voyager shuttle etc.

Hard drives galore

Obviously there’s such a thing as backup overkill. And I suspect if 95% of the world doesn’t backup at all, 4% obsessively over backup to a ridiculous level. The idea is to be the 1%, that backup to a degree appropriate to their content.

I have 4x1TB hard drives in my computer. However, most of this is media (video, games, music) which I could rip or download again if necessary. The key part is my self created content (like this site) that I would be sad to lose. I may copy some of the more rare media to my unused external hard drive, but that’s as far down that path as I want to go.

I also need to create a boot disc (tick, I’ve got a Win PE disc lying around somewhere) and create an image of my current C Drive for bootable purposes. Somewhere I have an Acronis True Image bootable disc lying around. It’s not too important to me that this up to date, as I’ll only be using it to restore my machine to get it bootable.

However, it’s scattered around my computer, so I think when I get home, one of my first tasks will be to organise my computer a bit more, and then write some script to automate an incremental backup to my web server. That second stage will be for another day, I think. Right now, I’m pleased to have found and set up If This Then That.

Of course, the final part of my backup strategy, what I’ve learnt and discovered, is this site.

Tag Cloud