Battery_usage

Android phones generally don’t get a lot of battery life. Judging by some of the forum threads and blog posts I’ve read, 20 hours or so is about the average. With the stock I’ve occaisionally had it scrape past that, but not by much. Using a lighter-weight Sense-based ROM I was able to get around 36 hours of charge

If you switch the Desire HD to a ROM without HTC Sense (such as CyanogenMod 7)you’ll find your battery life reduced even further. There is a battery drain issue with all custom, non-Sense ROMs for the DHD, due to a bug in the open-source code controlling the aic3254 chip used for processing sound (the closed-source HTC driver doesn’t have the issue). Once the chip comes on it doesn’t switch off, consuming power at a steady rate. Continue reading

The beauty of web development is that, ultimately, the code behind it is simple. Yes, web apps have taken leaps and bounds over the last few years, and are capable of so much more than ever before, but lets face it – we’re not exactly writing DNA sequencers. Yet.

It frustrates me when I find someone has made life difficult for themselves or the person who will inherit their code, by using the wrong tool for the job. I’m not claiming to be a saint here either – I often look back at some of my own code and shudder (it helps keep me right in the future!).

Consider the following snippet, from the View (presentation) file of an MVC app I inherited:

<?php
echo "<h1>$category</h1>";
echo "<h3>$company ($name)</h3>";
echo "<p>";
echo "$address<br />";
echo "$town<br />";
echo "$city<br />";
echo "$post_code<br />";
echo "$phone<br />";
echo "$email<br />";
echo "</p>";
echo "<br />";
echo "<br />";
?>

PHP needs to be used to output the data passed from the Controller, yes, but there’s no need for it to be outputting the HTML too. Let HTML itself worry about that!

<h1><?= $category ?></h1>
<div>
<h3><?= $company ?> (<span><?= $name ?></span>)</h3>
<address>
<span><?= $address ?></span>
<span><?= $town ?></span>
<span><?= $city ?></span>
<span><?= $post_code ?></span>
<span><?= $phone ?> </span>
<span><?= $email ?></span>
</address>
</div>

I don’t know about you, but the HTML-based version above is easier to follow and spot coding errors. No doubt someone will point out there’s more HTML tags/bytes in this example than the first, but that is because I coded it with semantics and microformats in mind; add in the right classes and you suddenly have a hCard.

Possibly more importantly in my mind, the HTML example is easier to follow for someone who isn’t PHP literate, like many front-end designers I know.

I’m picking on this example as it’s the most recent I’ve come across, and the first to come hand. It’s not the first example I’ve come across, it won’t be the last, and it’s certainly not the worst!

Pure, simple HTML can be a wondrous thing. Lets try not to spoil it by abusing it with our fancy server-side languages. K.I.S.S!

With all this iPhone hoo-ha happening of late, I’ve finally started thinking about this “mobile web” thing. It’s been hard not to, with all the noise about iPhone SDKs – or lack thereof. Personally, I’m all for the whole web app thing when it comes to phones. Maybe it’s just me, but it makes sense. Obviously there’s the local data storage issue, but I’m sure some bright spark will figure out a solution some day.

Anyway, where was I going with this? I forgot. Oh yes… Blogging from a phone. We have WordPressMovableTypeSimpleLogTextpattern, and so on, but they’re all desktop web browser dependent. Most are graphic – and JavaScript – heavy. Most which I have tried out reward larger screen estate. These are all major limitations of the mobile web as it stands.

This week I will be getting my hands on my new phone. It’s not an iPhone, but an HTC P43501. We’ve been using them at work for a while now, and they rock pretty hard. Yes, yes, I know I’m a Mac user, and it’s a Windows Mobile device… big whoop. Anyway, I’d love it if there we a nice blogging tool like the afore-mentioned WordPress, etc, which featured a nice, mobile optimised writing interface in addition to the fully-featured desktop version. Something which fits a 240×3202 screen nicely.

I have a feeling though that if I want something like this, I’ll have to make it myself. Which is a shame, because it means it’ll probably never get done…

  1. Catchy, huh? Maybe they should have stuck with the “Herald” code-name instead. 
  2. Well, 320×240 once oriented for use with the keyboard. 

If you thought I’d maybe given up on this blog already (what is it? A week?), I’m sorry to disappoint you. Truth is, I’ve been quite busy this week, with lots going on, here there and everywhere. Instead of splitting things into multiple posts for more page views, I’m going to run through everything in one go:

1. Guitar Hero II Rocks

You may have seen some of the pictures on Flickr already, but I just want to say how genius Guitar Hero II on Xbox 360 is. The whole family has been rocking out all week. None of us are any good, but it’s part of the fun!

2. My Company Bought Another Company

The management are saying “merger”, but the official legal term is “acquisition”. Either way, the company I work for is joining withanother company. This is quite interesting for me, because the other company (PGL) have a software development division. I need to have a chat with the management involved, but there’s certainly an opportunity for me to move into desktop application development instead of doing web stuff.

3. I’ve Been Setting Up My Networked Media System

OK, that’s probably a fancier title than it needs, but basically I’ve been getting all the pieces in place to have all my media available to stream to the living room and bedroom. The system is mostly Mac based, with an Xbox 360 in the living room. For network connections I’m using HomePlug AV units – which so far have worked brilliantly. At the centre of everything will be a Mac Mini, an external hard drive, iTunes, and a copy of Vista media center running in a virtual machine. I’d have it up and running just now, but i picked up the wrong type of RAM for upgrading the mini… Doh!

4. I’ve Been Running

Well, not so much as I’d have liked this week, but I’ve slowly been ramping up the milage in my quest to be ready for the Aberdeen 10K run in a months time. Gym sessions have been going great, and I’ve dropped a stone and a half in weight since I started, which is a bonus!

So there you have it; that woz the week wot woz. Quite a bit going on, which was a bit unusual for me. Everybody else been having a good week?

I’ll be honest – I suck at blogging. I’ve tried and I’ve tried, but I just can’t seem to get it right. Things will maybe start off OK for a little while, but then this usually happens:

  1. I start deciding what I’m writing about isn’t worth posting, so won’t post until I have something I think is really worth posting.
  2. The blog goes silent for week/months.
  3. I feel bad, so post a couple of weeks worth of rubbish.
  4. I feel worse for writing crap and in a fit of frustration abandon the blog.

I’ve lost track of how often I’ve done this…

So what makes this time different?

Nothing. I just hold a bit of an affinity with Pixel Meadow, over and above any of my other sites – it was my first (and probably most successful) blog. I’m going to try and get it going again; if it works then great, if not… well at least you’ll maybe get a bit of a laugh out of it.

There’s a bit of a long-standing bug in Textpattern, and its handling of time zones. It’s a bit of a head-scratcher to get your head around, so bear with me. It’s probably best described with a simple example, so here goes:

  • Our writer/site admin lives in the UK. It is British Summertime. His time zone is therefore GMT+1.
  • Textpattern is installed on a server in Australia. Its time zone is GMT+10.
  • The site admin sets the time zone in TXP to his own GMT+1 and writes a few articles.
  • British Summertime ends, so the writer’s time zone is now just GMT. Daylight Savings Time (or whatever) starts in Australia, making it GMT +11.
  • All the date-based permalinks in TXP go all to hell. Most appear a day out of line.
  • New stuff that gets written is inaccessible as TXP can’t decide if the publish time has passed or not.

It’s a strange one, and a bit of a pain in the ass. There’s been some discussion in this forum thread, but no consensus on how to fix it or even if it is a bug. The common workaround – which isn’t an ideal one for many people – is to just keep to one time zone and ignore anything like DST, BST or other “time modifiers”.

I loves me some jQuery – without it I probably wouldn’t write any JavaScript at all (seriously, I hate the stuff). Anyway, today I needed to add some “open in new window” links to an internal application using jQuery. Being the Standardista I am, I wanted to make it a)Accessible, and b) Unobtrusive . If the user has JavaScript disabled (it happens, even on “controlled”, intranet environments), the link should just go to the new page anyway — new window be damned.

My first attempt (below) didn’t work as expected. The following code takes all <a> tags with a class of “newwindow” and applies an onclick event to open a new window.

$(function(){
$('a.newwindow').click(function(){
var w = window.open($(this).href(), 'newWindow', '');
return false;
});
});

Nothing would happen with the above, because of the return false;. Removing return false; would open a new window, but also send the opening window to the new page. In the end, the following worked the way I wanted:

$(function(){
$('a.newwindow').click(function(){
var w = newWindow($(this).href(), 'newWindow', '');
return false;
});
});
function newWindow(url, wName, opts){
w = window.open(url, wName, opts);
return true;
}

Basically the “heavy lifting” was moved to a seperate function. It’s slightly longer to type, but not exactly finger-breaking stuff. No doubt some bright-spark could tell me an even betterway (feel free!), but this’ll do for now.

Hello again, you crusty inhabitants of the Interwebs. It’s been too long – far too long. But, like The Good Ship Galactica, I’m back.

I could bore you all with an in depth look at why I’ve not been blogging, but it doesn’t really matter. Suffice to say it’s been down to a combination of things: the stroke I had last summer; being a ‘family man’; that perennial favourite – work, and a general lack of enthusiasm about the whole blogging thing in general. I’d like to say this time around it will be different, but I just don’t know, so I’m making no promises.

So enjoy it while it lasts (i.e. as long as I do). Much like Stargate1 really.

1 SciFi, how could you?.

There’s been a few things going on this last week which I wanted to talk about, but it’s been a hassle finding the time. Excuses, excuses, yadda yadda. Just shut up and get on with it…

I was all set to record this entry as my first podcast, but no, I went and broke my new headset mic as I was getting setup. A podcast is something I’ve wanted to record for a while, but I’ve never got round to it. I’m trying to, so keep your eye out.

Speaking of keeping an eye out, I registered gochrisgo.net in the last few days. Watch it… like a hawk as it were.

Back to Podcasts, I’ve been subscribing to a lot more recently. I used to find them quite dull and boring. Generally I still do. I’m not really a fan of the talk-radio style podcasts which only cover one topic. Michael over at Binary Bonsai is doing a nice job with his podcasts, though I will say I have preferred his two shorter episodes over the other, near hour-long episodes he has done. I’m also digging Jon Hicks approach to podcasting. This is similar to something I had in mind for my podcasts. In mine, I was going to ramble for a bit then play a track by a local band, or other track I felt worthy of sharing.

One last bit on the podcasting subject – for some reason, my iMac G5 goes all to hell when trying to add music from iTunes to a podcast in Garageband 3. It just hangs the whole machine. My iBook has no problems at all (albeit it’s slower). It’s been a little frustrating, as I really didn’t want to install something like Garageband on my “work” machine.

So stepping away from podcasts, what else has been going on? The biggie at work has been moving from internally managed web servers to fully-managed, dedicated hosting run by a third party. As part of the exercise, I had to write a proposal putting Apache on Linux up against IIS and Windows Server 2003. For years I’ve been hinting we should move to Apache, but when it came to writing this proposal, I had a tough time justifying such a move. In the end, Apache lost out on business reasons; the cost of switching now would be too high, mostly for time spent redeveloping existing web sites. However, PHP and MySQL are being installed so we can run Mint for stat-tracking.

What else..? I finally got round to buying Battlestar Galactica DVDs (season 1 and the mini-series). Not had a chance to watch them yet, even though I’ve watched the latter-half of season 2. Maybe this weekend. My Firefly soundtrack arrived today, I’m listening to it now. It’s very good, very relaxing. Other things I’ve been listening to a bit recently include Yellowcard’s Lights and Sounds (sounds a bit like early Feeder) and Hell Is For Heroes’ Neon Handshake (which is not new, but I only came across it recently… shame on me).

The CSS Reboot is drawing ever closer and while I’m not quite on schedule, I should be ready in time. Certainly for part one of the Master Plan. Phase One is very nearly complete; I have a bit of copy I need to write and a few design details to nail down before I can start pulling it together. Phase Two is a little more complex and might not be ready for May 1st although I will endeavour.

Speaking of redesigns, I like the refreshed Simplebits and Scrivs’ improved Whitespace. Whitespace in particular is quite good, with the combination of “full” entries and smaller “asides”. I think I prefer this to the usual mixing the two together (usually making the asides slightly less noticeable).

What else..? well there’s a couple of other things (Windows Mobile Phones and no Apple birthday surprises spring to mind…), but I think I’ve rambled for long enough for now and it’s late.

If I’ve touched on anything you’d like to comment on in this whistle-stop tour through the last week, please feel free to. I enjoy getting feedback and wish more readers would leave their thoughts!

Jennifer Laycock at Search Engine Guide, is writing a great little series on building a web startup from nothing: “Zero Dollars, a Little Talent and 30 Days”. In this (unsurprisingly) 30-part series she details her efforts to build a small t-shirt business while starting from a balance of $0. It’s a great experiment on the combined power of marketing, targeted sales, niche products and blogging. It’s only on day 18 and Jennifer is making a healthy profit – not huge profit, but it’s a profit none-the-less!

Side-stepping the other del.icio.us items you will see today…

I was browsing through Darren’s ProBlogger site (despite railing against much of the “pro-blogger” hype a few days ago, I still find it all fascinating) when I came across a post entitled“Social Bookmarking – Getting your Blog Noticed”. Much of it makes sense – get your site listed on a “social” site like Digg, Slashdot or del.icio.us and you’ll get a boost in site traffic. It makes sense, but it also raises a question in my mind – does submitting your own site/entries to these sites go against the spirit and ethos of the sites in question? Or is it just harmless self promotion?

Lets come back to del.icio.us for my example. It’s a sort of social-network, global bookmarks folder… and how often do you bookmark your own entries in your browser favorites? You could counter-argue you’re just highlighting something others may find interesting, but where do you draw the line? When does it become spamming?

For something different to do on a Friday night, Nicola and I went to see the new Harry Potter film on Friday. Both of us thought it was very good. Ron’s brothers, Fred and George are hilarious. I was a little dissapointed with the cut of the film; it was so fast-paced that a lot of stuff got left out—stuff that is important later in the series (Harry learning the story of the Longbottoms from Dumbledore, for one… it was glossed over far to quickly for my liking.). To be fair though, they did have a lot of material to cram into a 2h 15 min movie! Over all, it’s a good addition to the series and if you’ve enjoyed the previous films you’ll love it.

The iMac announcement yesterday has me intrigued (yes, the pissed-off feeling has abated). All of a sudden, it seems that the iMac is being positioned for a stab at the media centre market. There has been wild speculation about what Apple’s plans for the living room computer market might be. I think now we might be seeing the start of a push into that area.

A 2005 Widescreen iMac has a big screen. Not quite big enough for [most] living rooms, but close. It’s big enough for most “dens” I’d say. It has everything built in to the screen, so fewer are extra boxes needed. It does three of the four basic requirements for a media centre: music, movies (both DVD and downloaded/ripped) and pictures all tied together in the new Front Row software and accessible from your sofa via IR remote control. The only thing missing is [a native solution for] connecting live TV. Sure you can download yesterday’s TV abc programming via iTunes, but who wants to watch yesterday’s shows all your friends/colleagues were talking about this morning?

So the current iMac isn’t quite there as a media centre solution, but it’s close. If Apple were to, say, release an iMac based on the 30” Cinema display (or even larger), with some sort of TV-in and PVR capabilities, and they could own the media centre market much like the iPod owns the portable music player space. Why have another box under your screen for your media centre, when it could be built in to the screen?

When the new iPod was announced, I was a little concerned about the video playback capabilities. All the marketing blurb was referencing movie trailers, music videos, home movies… short video clips in other words. This got me worried that there might be some sort of restriction on video length/file size (which would be a similar ploy as the ROKR’s stupid 100 song limit). Thankfully, my fears were unfounded – I’d simply missed one of the announcements: TV shows for download via iTMS (would that now be the iTunes Media Store?). Interesting… These new iPods are getting more attractive the more I read about them. Back, Credit Card! Get back in your wallet!

Today was a bit of a milestone in my recovery from the stroke – I started back to work. Not full-time, mind you. On the advice of my Occupational Therapist, I’m starting back on reduced hours for a couple of weeks.

To say it was weird would be an understatement. In the time that I’ve been away a lot has changed. The company completed a merger and subsequent rebranding; moved office to a much bigger (lots of stairs… yay), much nicer building; and a lotof new people have started to work there.

On top of that, I had to use a PC for the first time in 4 months. Every 5 minutes I had to correct myself before I issued a OS X keystroke command that would possibly have spelt disaster for whatever I was working on at the time.

Footnotes seem to be all the rage at the moment. While some other CMS may require a plugin to get them working, we Textpattern users have been able to create them since day 1. However, the problem with the footnotes Textpattern generates, is that once you’re down there, you have to manually scroll back up the page o where you were. Wouldn’t it be nice if we could have “return links” like at Daring Fireball? Well, it’s easy enough to do and requires only a minor change to the code1. Simply change the following two lines of code to read as below:

475: $content = '<sup>' . $fns<sup><a href="#fn1" id="fn1-link">1</a></sup> . '</sup> ' . $content ."<a href="#fn$fns<sup><a href="#fn1" id="fn1-link">1</a></sup>-link">↩</a>";

729: '<sup><a href="#fn$1" id="fn$1-link">$1</a></sup>$2', $text);

1 Note that I’m still running RC3 on this site, so line numbers might be slightly out compared to 4.02

2 Update – in TXP 4.0, these lines are 482 and 736 respectively.

I’ll start this one by quoting a comment I made over on Joshuaink –

I go through phases where I don’t feel a lot of enthusiasm for my blog. Usually, I find this is an indicator that I’m fed-up of the design… strange as it may sound, I find the design of my site dictates the type of thing I want to/feel I have to write about. When I launched the current design, I went through a phase where I felt that I had to write “professional”-style posts on web development techniques… but that’s not really something I can write about for long. It’s like taking your work home with you – you soon get fed-up and pissed off.
I guess my point on that is that a design can not only influence a visitors perception of your site, but your own. Yeah, something like that…

I’ve added my own emphasis to the important bits.

Until yesterday, this wasn’t really something I thought too much about. I think (as a web developer) I get too wrapped up in how I think others perceive my blog (including the design) to remember the number one reason to blog – as a personal form of expression. Our blogs are for (usually) for ourselves and I think it is something many of us forget. Maybe it’s why some of us take criticism of our blogs so badly.

A blogger is a writer, and a writer needs inspiration. One of the closest and easiest sources of inspiration to hand, is our own blogs. The problem is, I think many of us (and I count myself here) try too hard to please and impress others. Particularly the “showcase” sites (Stylegala, etc) perhaps, but that’s another rant.

In a post over at Binary Bonsai, Michael Heilemann acknowledges his site design influences his writing and for that reason he is currently having trouble with inspiration/motivation. He specifically mentions I need to carve out a more personalized space for me to feel at home – this is exactly how I am feeling at the moment.

Do you also feel you have to write about certain subjects or with a certain writing style, due to the design of your blog?

Related to my previous entry, is a little peeve about the MovableType API, or perhaps it’s just its implementation in Marsedit. Who in their right mind decided that the process for creating a new post via XML-RPC in this API should involve the following steps from the client software?

  1. send new post data. Don’t send category information. Set the publish flag to false.
  2. send the category information for the new post in a separate XML_RPC call.
  3. finally, send all the data from step 1 again, in an edit post function call, this time to set the publish flag to true if need be.

Kinda a silly and wasteful way to do things, IMNSHO. The standard MetaWeblog API (from which Movabletype’s is derived) does it better:

  1. send post data, including category information. Set publish flag to true or false, as appropriate
  2. that’s it.

Much simpler, with no wasted bandwidth or processing time.

I’ve spent the last two days looking at the same line of code, trying to work out why the fuck it’s not working right.

It’s one of those annoying situations where the code looks perfect for doing what you want it to do, yet for some reason, it refuses to play nice. There’s only a finite number of ways to write a conditional statement, after all…

Hrm. Perhaps it’s time to say “enough for today” and move on to something else. Fresh eyes always help solve problems. Maybe “third day’s a charm”?

I was having an informal chat with a former colleague1 today. After shooting the breeze about this and that, he announced how he had become a big fan of 37Signals’ Get Real methodology and was applying it to his own work. Fine, I thought… Until he started going on about how it allows him to start a project without much of any sort of planning. “Oh no it doesn’t” says I. You still have to know what you’re building and why, before you jump in and code. Without some sort of plan, you end up with a mess. A big unwieldy app that doesn’t focus on the job (nor do it well). You end up missing one of the big points of “Getting Real” – Lean Software

You Have to Know Where You Are Going, Before You Can Get There.

I never managed to convince my ex-colleague of this point, but the very article at 37Signals he thought was telling him to “dive right in” describes what he should be doing instead:

So what do we do in place of a functional spec? We write a one page story about what the app should do. If it takes more than a page to explain it, then it’s too complex. If it’s simple and it takes more than a page to write it then we’re not writing clearly enough. This process should take no longer than a few days.

Personally, I don’t even go this in-depth. A simple list of bullet-points describing what I need to achieve is usually sufficient. This then gets tape to the edge of my screen as a constant reminder.

1 He’s an ex-colleague because he left to try and cash-in on the success of Flickr and Basecamp et al. That was 9 months ago or so and he’s still not got anything to show for it.

A lot of catching up to do, so I might go into post overdrive for a little bit.

While I was away, a mini-meme appeared where people posted pictures of their set-up/working environment. Prior to hospital, my set-up was simply my iBook on the kitchen table – nothing to write home about. One thing that my family did for me when I was about to come home, was buy me a proper desk. Over the weekend of my discharge, I set about gathering all the bits and pieces I needed to give myself the work environment I really wanted.

The Set-up

The new set-up is:

  • 1.33GHz iBook G4 with 768MB RAM, resting on a
  • Griffin iCurve and next to a
  • 17” Acer LCD screen, which I dual-screen thanks to this handy script
  • there’s also a 30Gb External USB2 disk connected to
  • a 7-port USB hub which also connects my
  • Apple keyboard,
  • 20GB iPod with colour screen,
  • an HP Deskjet Printer,
  • an HP Photosmart printer and
  • a Belkin Bluetooth dongle which lets me use my
  • MS Bluetooth Intellimouse

Much better than just the kitchen table, no? Plenty of cables though – I may invest in a couple of these sweet cable-tidies

I’ve been “on holiday” this week. With everything that I’ve got going on at the moment, that simply means I’m not working the day job for a week. It’s given me a chance to sample working from home, which has been a good – if somewhat strange – experience.

The most interesting part has been trying to get into that psychological state where you know you’re “at work” and you have to get things done. It’s taken me a few days (well, plus the odd weekend here and there prior to this “break”) to get into the swing of things, but I think I’ve learned a few pointers that hare helping me be more productive, which I’d like to share.

1. Get Up Early.

The temptation is to lay in bed for hours after you would normally have to get up and leave for work. Don’t give in. Get up early, with a clear head, knowing what you have to do that day.

2. Get Showered/Dressed/Fed ASAP.

I don’t know about anyone else, but given the chance, I’d laze about for a couple of hours in the morning – leaving food/showering and dressing until the last possible moment. Don’t do this. A good shower, a fresh set of clothes, and a fine breakfast all leave you motivated to do something.

3. Take Time-out to Exercise.

You might want to do this before #2, or you might want to use it as an excuse to “take a break”, but getting in some exercise during the day can leave you with that ready-to-achieve-something feeling. Besides, it stops you turning into the Stay-Puft Marshmallow Man.

4. Don’t Work in the Kitchen.

Until I get the cupboard under the stairs converted into an office, my desk is the kitchen table. Bad idea. Easy access to snacks is distracting. Besides, the kitchen can be the busiest room in the house, leading to many, many interruptions.

5. Train Housemates/Partners and Children.

The people you live with need to know that they can’t just interrupt you. This is very important!

6. Enjoy It

Probably the biggest tip here – if you’re not enjoying it, go do something else for a while. Fix those shelves. Clear out that cupboard. Anything to get your mind out of a “this sucks and I’m not getting anything done” moment. Clear your mind and come back with a fresh head. This is the big difference between working in an office and working at home – you have the choice of finding something else to do in those unproductive moments. As long as you do actually come back and finish the job of course!

Different Strokes…

As these are just a few thoughts I’ve had over the last couple of days, I am in no way am I claiming to have found the “golden rule” of working from home. Heck, I’ve probably listed off a load of “well, duh!” statements that every home worker knows. Likewise, I’m no doubt missing off a load of obvious tips. So if you know of any other best practices for home working please share. If you work at home, how do you make sure you’re as productive as you can possibly be?