Drive Caffeine: Keep Sleepy Drives Awake

Got a tired drive that just won’t stay awake? Then you may find my new (open source) utility, Drive Caffeine, useful.

Drive Caffeine sits quietly in the system tray and pings any selected drives at the interval you specify, to keep them awake (it just writes a file to the disk and deletes it again). Simple as that!

“But you can just set the drive to not sleep!”. In many cases this is true, but if you have one of these newfangled external “eco” drives that enforce naptime after a short interval at a hardware level then this can lead to frustration, lost productivity, and even hairloss.

drivecaffeine1.3

I’m always happy for any feedback, good or bad (especially bad) so feel free to tell me what you think of it.

There are some circumstances that will break it at the moment. It doesn’t know about drives disconnected while it’s running. If you don’t have write permissions to the root of said drive then you will also get an error. I’ll fix these in future.

Software Development, Systems Administration

console.log() with jsFiddle

jsFiddle is a great tool for quick JavaScript prototyping. While it’s possible to use your browser’s console log to preview bits and pieces of output, I was looking for a cleaner way to do this, using just the jsFiddle panes. I’ve come up with a simple way to add a logging facility to the Result pane if you are using jQuery.

You can either start with my Fiddle directly here or add the following to your Fiddle:

HTML pane:

<div id="console-log"></div>

JavaScript pane (near the top):

?View Code JAVASCRIPT
var consoleLine = "<p class=\"console-line\"></p>";
 
console = {
    log: function (text) {
        $("#console-log").append($(consoleLine).html(text));
    }
};

CSS pane:

.console-line
{
    font-family: monospace;
    margin: 2px;
}
Code Snippets, Software Development, Web Development , ,

JavaScript snippet: Remove base URL from link

I needed this function this morning so I thought I’d share it in case someone else does too.

?View Code JAVASCRIPT
function RemoveBaseUrl(url) {
    /*
     * Replace base URL in given string, if it exists, and return the result.
     *
     * e.g. "http://localhost:8000/api/v1/blah/" becomes "/api/v1/blah/"
     *      "/api/v1/blah/" stays "/api/v1/blah/"
     */
    var baseUrlPattern = /^https?:\/\/[a-z\:0-9.]+/;
    var result = "";
 
    var match = baseUrlPattern.exec(url);
    if (match != null) {
        result = match[0];
    }
 
    if (result.length > 0) {
        url = url.replace(result, "");
    }
 
    return url;
}
Code Snippets, Geeky, Tips and Tricks, Web Development

It’s Not That Bad…

It’s taken nearly a year for me to become angry inspired enough to blog again.  The culprit this time is ASP.NET poster boy Scott Hanselman.  I’m only mentioning him and will be linking to the inflammatory material in question because nobody reads my blog; he certainly doesn’t need the publicity.

So, what’s got me so annoyed?  Simply the fact that he’s bashing the software development profession.  He’s just written a post entitled “Everything’s broken and nobody’s upset”.  Before now I’ve never really had a strong opinion on the guy one way or the other, and from what I’ve heard he’s done some great things for ASP.NET, but now he’s left me wondering whether he’s ever written a piece of software in his life.

After reading his post my first thought was that his PC clearly needs some love.  He bitches about the fact that he couldn’t find answers to his problems on Google.  In the old days, pre-Google, we would “debug” our own PCs.  Remarkable, I know!  With just a pinch of know-how of the basics of software and a smidgeon of motivation I know he could go a long way to solving some of these earth-shattering, depression-inducing problems he has (e.g. Outlook “never shuts down cleanly”).

I wonder if he is aware that there is not just one piece of software for every task?  He complains repeatedly about iPhoto.  Why not use an alternative?  Put capitalism to work!  Vote with your feet!  Embrace competition!

Don’t get me wrong, I fully empathise with Joe Average who just wants to get things done on his PC.  I encourage users to complain and am only too grateful as a developer when users alert me to a problem I was previously unaware of.  After all, I can’t fix something I’m not aware of.

I appreciate the sentiment of the article, but the way he’s presented his point is simply over the top and unnecessarily whiney and unconstructive.  If his everyday tools are giving him this much hassle then HE, as an empowered user, is at fault.

Am I saying software is perfect?  Obviously not.  What I’m saying is that software development, like anything in life, is about priorities.  With development platforms as highly abstracted and diversely layered as just about anything we work with today, bugs, and even just the potential for bugs, arise exponentially quickly as a system grows.  With cloud-based applications we at least have the opportunity to update quickly and frequently with far greater transparency and less hassle for our users.

The problem basically sorts itself out.  In the world of capitalism, those products which work will float up the crowd psyche into a pleasant mental association and enjoy the praise they deserve.  It’s a tough world out there, but that’s what we signed up for.  People will vote with their feet and judge with their keyboards.  There is no more realistic and honest appraisal than this.

As software developers, we have several jobs to do.  One of those jobs is making it easy and rewarding for users to let us know what part of our software is getting in their way.  We need to make sure that we provide a channel where users can easily let us know their thoughts and where we can let them know we are listening and are grateful for their feedback.  We need them more than they need us, and we need to show them that our product is better than the competition.

Scott’s closing line really kills me:

If you think I’m just whining, let me just say this. I’m am complaining not because it sucks, but because I KNOW we can do better.

All I can say is that’s such a cop-out.  He doesn’t offer any explanation or real advice on improving the status quo as he perceives it.  None of the software he mentioned is even as broken as his grammar.

Geeky, Rants , ,

Steer Well Clear

This morning a friend told me about this article, all about a new advertising campaign run by Steers, a South African fast food chain.  The article is all about the gross misuse of grammar in the campaign and musings on corporate irresponsibility.

I’d like to take this opportunity to share my thoughts on the humble, often-neglected, apostrophe and the evolution of language.

I fear we are witnessing its end times.  I believe that in three to four generations it will be completely gone from our language.

I’ve been amazed just how drastically its usage has dropped in the last few years.  I believe that gross misuse, such as that perpetrated by Steers, will be among the final nails in the coffin.

It’s unfortunate, but, on the other hand, who are we to fight the natural progression of any language as (perhaps inadvertently) orchestrated by its users?  Is that not how it became what it is today?  We must not forget that the primary function of any language is to communicate thoughts.

Maybe I just feel somewhat defeated after harping on about this kind of thing for so long.  Then again, I can’t quite bring myself to accept what feels like such an outright intellectual injustice more than anything.

Culture, Language ,