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.
Advertisements

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.

Then:

This report in one page

Then:

This report in graphs and charts

Then:

This report in detail

Then:

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() 

objADAM.RefreshCache()

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 = objResult.GetDirectoryEntry.properties(“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
Next

ELSE

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

END IF

Next objResult

Else

members = “Computer could not be found.”

End If

GetMembers = members

END FUNCTION 

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.

Tag Cloud