slideout menu

Welcome!

Julian's photo Hi there! I'm Julian M Bucknall, a programmer by trade, an actor by ambition, and an algorithms guy by osmosis. I chat here about pretty much everything but those occupations. Unless you're really lucky...

Most recently this is what I've come up with:

Now we are nine

Yesterday was an anniversary in the Bucknall household. It marked nine years since I joined DevExpress as their CTO. It was on the Ides of March, 2006 that I started this life of a remote employee – I live in Colorado, DevExpress was in Vegas and is now in Glendale, CA – and I must admit it’s been fairly successful, at least on my side. What can I say about the last nine years from that personal viewpoint?

Working at home

Yeah, brilliant. Well, sometimes.

Now We Are Six -- well almost

Close, but no cigar

For the first 8 years I worked exclusively at home, not counting the week-long trips to the office every month or so or to conferences representing the company. Since April last year I now spend some of my time working at Epicentral Coworking, if only to get out and about and to talk to people face to face , where “talk” doesn’t mean “type something in Skype”. The problem with working at home is, well, loneliness. No one to have a chat with, no one to bounce ideas off of, no one to just say good morning to. Having said that you do have complete freedom to work whatever times you want in whatever clothes you want (although I tend to get dressed properly and work Colorado time in the morning and California time in the afternoon) but then if you are not careful the normal home chores rear their head. After all, I’m at home and so I can put the dishes on, or do the clothes washing. Oh and while I wait for the coffee to brew I can whizz the vacuum cleaner around a bit. Sometimes the cats come in for some lovin’ and cuddling. It takes some doing some days to just close the door on it all and concentrate on the work – hence Epicentral.

Working at Epicentral is great. It’s just like going to work in an office. You sit down in their communal work area, and because everyone around you is working, so do you. You can concentrate on what you have to do and get it done. The biggest issue I find is that I can’t do anything that involves webinars, such as the rehearsals and so on. After all, you’re in a big room with a bunch of other people and chatting via your mic is distracting to others. So those get done at home. Another issue (unless I pay $100 a month more for a private desk) is I do like to have two or three screens. Maybe the old eyesight is going (or my memory) but I find it easier to work on several monitors: have a browser open on this monitor and Visual Studio open on that one. With a private desk I could buy a spare monitor and leave it there. Mind you, the last few times I’ve gone I’ve taken my MacBook Air as well so that I can have two screens going with that particular permutation – Synergy is loaded on both so I can share the keyboard and mouse (and use copy/paste) between them.

At home of course I have a three-screen setup on a bigger faster laptop, with a mic on a RØDE boom arm permanently attached to my desk. So I parry the convenience factor of working at home with all mod cons versus the working with other people around and with smaller laptops and lesser peripherals.

Working remotely

Yes, I decided to split this off into its own section. Working remotely is difficult. Coincidentally Scott Hanselman wrote about this today Tragedies of the Remote Worker: "Looks like you're the only one on the call" and I’d have to say I agree with most of it. I’m usually online from 8am Mountain to 6pm Pacific. The client services people can reach me, the evangelists too. If needed, I can voice-Skype too, with a dash of webcam.

The biggest issue is meetings. Holy crap, but they’re difficult when you are remote. Now I can imagine Hanselman has more group meetings than I do – I basically have a lot of one on one conversations – but when there’s a group meeting (say sales-related, or perhaps about something internal like office issues) I wish for younger ears and better hearing. Imagine: your co-workers are gathered around a table with a meeting phone in the middle. They can see what’s projected, can see each other’s reactions. You on the other hand? Ha. Let me laugh a bit more: ha ha ha ha ha! You see nothing. When a discussion starts in the conference room you have major issues actually parsing the words between the people talking over each other. Bah.

The other issue with working remotely is finding out what is actually happening in the office. You are reliant on your web of informants in a way (you know who you are!) to tell you about the office politics, what’s going on with who and where and when. If you didn’t know, you feel cut off.

Technologies

Timbered frame

An app with no UI, just structure

OK, I’ve given up. When I joined, there was VCL and WinForms and ASP.NET. Piece of cake. I’d actually written apps using them, and lots of those apps. Then came WPF and Silverlight. Er, OK. Let’s learn enough to understand the issues and solutions, but anything more than that you’ll be lucky. MVC? Thumbs-up. Then I got into JavaScript. Big time. You may have noticed. So lots of client-side, and then DevExtreme and TestCafe. Now we have Modern apps for Windows 8+ (aka, Metro), and Universal apps for Windows 10, and Xamarin.Forms. Again: you’ll be lucky if I learn more than the absolute basics. IF anyone ever asks me to write a XAML app, it would be slow going at first (with lots of Googling), but after that, sure thing. You could say I’ve given up being a passable Jack-of-all-trades, I’ve struck my stake into the ground.

And I think that’s so for the largest part of our trade, of our market. People know what they know and are able to pick up a new technology should their job require it or are forced to because of changes in hardware or the platforms. (An example: more and more often we are getting laptops with ultra-high-resolution screens. Far more than in the old days we use text settings that are not the usual 96dpi of old. If we did we wouldn’t be able to read the text on the screen at the usual visual distance. You wouldn’t believe the number of apps that do not do well at these larger text size settings – my new Surface Pro 3 has four settings, my Dell XPS 12 three. Even apps from Microsoft as I discovered with Word the other day. Content is cut off, lines are cut in two horizontally so you only see the top half, the works. Older run-times like WinForms just don’t do well with this situation at all, you have to use a run-time based on vector art, text that isn’t nailed down to a certain pixel width, XAML. Or you use a browser and web apps. Either way, you’re forced into learning a new run-time and a new platform.)

And that’s even before we talk about mobile: the phone and the tablet and the watch and the Internet of Things. Yes, there are experts in these platforms. But they tend not to be experts at the desktop, and vice versa. And they’re even split by platform: iOS vs Android vs Windows vs Blackberry vs (god help us) Tizen.

The developers’ trade has become more fragmented over the past nine years, split by the hardware they have to support, and the platforms they have to develop on. Choose your platform and run-time well, grasshopper. You will get to know them very well before time and tide force you to learn something else.

Third-Party Libraries

I’ve now accumulated nearly 18 years in the third-party library business, almost nine years with TurboPower Software and now nine years with DevExpress. From this vantage point I can safely say, now, more than ever, developers are reliant on external libraries. Sure, in the JavaScript space there’s the old joke about not liking a particular library: just wait a couple of days and there’ll a new open-source library to replace it. Nevertheless everywhere there’s the constant pressure to release something quickly, release something visual, release something with great user experience. Sure you can do this all on your own, writing dashboard elements, deploying charts, designing layouts. Or you can leverage other peoples’ code and previous work and get finished faster. Yes, it sounds like marketing-ese, but it’s true.

At DevExpress, for example, a team of three or four can release the first iteration of, say, a charting product for Universal apps in six months. The only way they can do that is because of the previous ten plus years writing charting products for all the other run-times and platforms. Experience, in other words. They know how to make sure labels don’t overlay each other in a chart. They know how to track the mouse cursor with an element of the chart so that a subtle animation can happen when it travels over the element. All of those myriad interactions take time to learn, take time to design, take time to develop. Not impossible, sure, just expensive in terms of time and resources. Only you can say whether the cost of a third-party library is worth avoiding all that other work. From my viewpoint: take advantage of third-party libraries whenever you can to save you time and effort in the long run.

We’re entering (and have been entering) a development arena where time is of the essence. There is so much software to write, so many platforms to support, so many users to make happy. Just don’t waste it on stuff you don’t have to write.

Summary

Anyway you look at it, nine years is a lot in any position, let alone a technology position in a market that changes so rapidly. I’ve learned a lot at DevExpress in my position as CTO, and I hope I’ve imparted a lot to the rest of the company. Let’s see what happens in the next nine…

Album cover for Getz/GilbertoNow playing:
Stan Getz - Só Danço Samba [feat. Antonio Carlos Jobim]
(from Getz/Gilberto)


Generating permutations with Heap’s algorithm

This evening I wanted to solve a particular problem, and it required me – or so I thought – to permute an array of items. Back in the day I wrote an article for PCPlus on the subject and mentioned in there Heap’s algorithm. I hasten to add here that “Heap” here is not the traditional computer science heap, or even the application memory heap, but B.R. Heap, who first formulated and published this algorithm in 1963 (pdf).

Make up my room

Permutation 1: we're out

Wikipedia has a small article on Heap’s algorithm (although Heap’s paper is not that difficult to read – it even has flow charts!), and even gives some pseudo-code for it:

procedure generate(n : integer, A : array of any):
    if n = 1 then
        output(A)
    else
        for i := 1; i ≤ n; i += 1 do
            generate(n - 1, A)
            if n is odd then
                j ← 1
            else
                j ← i
            swap(A[j], A[n])
  

The problem with this pseudo-code is that, although it looks simple enough, there is no discussion as to whether the array A is zero-based or one-based. Some perusal will lead you to assume that it is, in fact, one-based (that is, the first element is at position 1, and if there are n elements, the last element is at position n). Fair enough, but of course, I’m sure that most of my readers are firmly in the zero-based camp in real life, as am I. How do you change it to cater for those types of arrays? There are a couple of answers, I suppose.

The first one is to keep the pseudo-code pretty much as is. Notice though that the only time the elements of the array are referenced is in the call to the swap function, so the simplest answer is to rewrite that to something like this:

procedure swap(x, y : integer, A : array of any):
    temp = A[x - 1]
    A[x - 1] = A[y - 1]
    A[y - 1] = temp
  

and then you just call it with the two indexes j and n and the array, and let the routine do its stuff taking care of the array being zero-based.

Nesting

Permutation 2: we're asleep

Of course, the second one is to rewrite it completely to assume zero-based arrays. Here’s a JavaScript example where I chuck away the variable n and call it what it really is: the index of the last item you are permuting up to:

var generatePermutations = function (items, process) {
  "use strict";
  var generate = function (last, items, process) {
    var
      i,
      swap = function (x, y) {
        var temp = items[x];
        items[x] = items[y];
        items[y] = temp;
      };

    if (last === 0) {
      process(items);
    }
    else {
      if ((last & 1) !== 1) {
        for (i = 0; i <= last; i += 1) {
          generate(last - 1, items, process);
          swap(0, last);
        }
      }
      else {
        for (i = 0; i <= last; i += 1) {
          generate(last - 1, items, process);
          swap(i, last);
        }
      }
    }
  };

  generate(items.length - 1, items, process);
};

generatePermutations(['a', 'b', 'c', 'd'], function (items) {
  console.log(items.join(""));
});

Notice that I wrapped Heap’s algorithm in a function that you actually call, so you don’t have to remember that you don’t pass in the number of items, just the index of the last item.

Album cover for The Singles CollectionNow playing:
Spandau Ballet - Round and Round
(from The Singles Collection)

Issues using MathJax 2.5 with Chrome

So yesterday I wrote an article about the conditional support of MathJax in my posts here on the blog. The post required MathJax since I deliberately put an equation in it. Today I noticed that viewing that post in Chrome led to the equation being rendered three times across the page:

Chrome error with MathJax 2.5

Chrome displays three equations. Whut?

Even refreshing the page didn’t solve the issue. A mild bit of panic later – Does it work in FireFox? Yes. In Internet Explorer? Yes. In Safari on the Mac? Yes. On an iPad? Yes. – it was time for a bit more research.

It turns out that MathJax was updated to v2.5 on January 30, 2015 and I’d coded the <script> element to download the latest version:

<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

And there in the PR report about it was the hint:

If you are using the mathjax/latest address you might get a mixture of files in your browser cache, and so may need to clear your browser cache and for some browsers (e.g., Chrome) restart your browser in order to get a consistent version of all files.

I opened Chrome’s History page, clicked the Clear browsing data… button, made sure the Cached images and files option was checked, and cleared the browsing data. I restarted Chrome and everything worked as it should have.

Phew! Saved, at least until the next time…

Now playing:
Aphrodelics - Rollin' on Chrome [Wild Motherf***er Dub]
(from The K&D Sessions)


Conditionally loading MathJax with GraffitiCMS

A couple of years ago I did a series of posts about TVM, the Time Value of Money (1, 2, 3). Because they were mathematical in nature, I had to write a few math expressions and equations. Way back when I’d have written them out in the Equation Editor in Word, and taken screenshots, but this time I decided to go for a browser-based solution: MathJax. In essence, I’d write the expressions in LaTeX format, such as x = \frac {-b \pm \sqrt{b^2 - 4ac}} {2a}, and have it rendered as:

\[ x = \frac {-b \pm \sqrt{b^2 - 4ac}} {2a} \]

Writing maths on chalkboard

Eek, maths on a chalkboard!

This was a great solution, except for one thing: I didn’t really write that many mathematical expressions in my blog posts and MathJax was being loaded and executed for every single page no matter whether there were expressions to be rendered or not. In other words, the specialized infrequent need was dominating the more general use of my blog. The majority of pages were slower to load than they should be. What I wanted was a way for the page renderer to load MathJax only when it was necessary.

The first step was to be able to mark those posts that used MathJax in some way. Enter GraffitiCMS’ Custom Fields. I set up a custom checkbox field called UsesMathJax and then went back over my posts to find those that needed MathJax processing of LaTeX expressions. (It wasn’t as bad as all that: in essence I regex-searched for \[, some characters, followed by \] or the equivalent with ordinary parentheses in a loop for each post.) This post has been so marked.

Now that was done, the fun begins. I had to alter the views I use for the site so that the rendering engine (it’s NVelocity) knows to output the <script> element that references the MathJax library. I started off with a simple variable, #NeedsMathJax, that I set false at the beginning of layout.view and then was checked to be true at the end of the <body> element.

<body class="Graffiti-$where">

  <div id="wrapper">

    #set($NeedsMathJax = false)

    $childContent

    <!-- Other HTML -->

  </div><!--end of wrapper -->

  <script type="text/javascript" src="$macros.ThemeFile('minifiedBoyet.js')"></script>

  #if($NeedsMathJax == true)
  <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
  #end

  <!-- Other scripts -->

</body>

And then, for post.view, which is loaded by $childContent, I had this at the end of the HTML:

#if($post.Custom("UsesMathJax") == "on")
  #set($NeedsMathJax = true)
#end

(Note the string value that the custom checkbox field uses: “on” . Similarly if it’s unset it defaults to “off”.)

Except … it didn’t work. After a bit of investigation, it turns out that GraffitiCMS/NVelocity first evaluates $childContent before rendering layout.view. The value of $NeedsMathJax was being reset in layout.view after it had been properly set in post.view. The solution? Easy: just don’t have that initial setting of $NeedsMathJax to false. I was a little uncertain about removing it: after all, if the post doesn’t need MathJax then the variable won’t have been declared anywhere at all (let alone set to true) and what would happen then to the if statement? Turns out, not much, NVelocity seems to take the undefined variable in its stride (no exceptions are thrown) and certainly doesn’t evaluate it to be equal to true.

So you’ll be glad – I certainly am – to know that MathJax is now only loaded when it is needed. Like for this post.

Album cover for Sleeping With the PastNow playing:
John, Elton - Stone's Throw From Hurtin'
(from Sleeping With the Past)


Slide menu

You may have noticed. Or quite possibly, not. I won’t hold it against you; it is a bit nerdy. The thing is, I’ve revamped my blog so that the “ancillary” stuff is now hidden behind a “hamburger menu” over there on the left. Click the icon (it’s known in the trade as a “hamburger”) – or, if you are on a tablet or phone, touch it – and the extra stuff about me, the site, and other information slides in, pushing the normal blog content over to the right. This is my first tentative step to being “ responsive...

Read more »

Using server-side MarkDown for comments

Nearly four years ago now, I “implemented” MarkDown for the comments here on my blog. At the time, Graffiti CMS (the blog engine I use) was being fairly regularly updated and I didn’t want to change my server-side code unnecessarily. I’d already run into merge issues in the past with new fixes from the CodePlex repository . Wrong Way - Not An Exit Why the air-quotes for “implemented”? Because I had decided to do this via JavaScript in the browser. Essentially if you opened a blog post, the code would...

Read more »

Declare that function! But, how?

So, I read a blog post about declaring functions in JavaScript recently. It was just about technically correct as far as it went, but, ow, the way it was written hurt (missing semicolons, invalid code samples, etc). I’ll decline to link to it, thanks very much, but instead I’ll bring out its main points together with a recommendation or two (that, in fact, the original blog post did not). There are two ways to declare a function in JavaScript, although we can spin ’em out a bit...

Read more »

Globals, IIFEs, this, and strict mode

It started like this: I was reading some JavaScript code, written – he says charitably – some years ago. Much simplified, it looked something like this, with all identifiers renamed to protect the guilty: timer = {}; timer.timerID = null ; timer.cancel = function () { if (timer.timerID !== null ) { clearTimeout(timer.timerID); timer.timerID = null ; } }; timer.start = function (delay, onDone) { timer.cancel(); timer.timerID = setTimeout(onDone, delay); }; Colored light Let’s just...

Read more »

Best supporting actor in a comedy?

Holy crap. Every now and then (and it’s very rare these days because of the business travel I have to do), I manage to get a role in a local theatre production. Yes, indeed, I’ve been known to act a little. In December, after some four years away from the stage apart from a very small role in The Wild Duck for Theatreworks in March 2013, I landed the role of Reverend Shandy in The Lying Kind , also for Theatreworks. The part was a hoot, as was the play, a strong British farce. We had...

Read more »

Back in the day: a PC Card adapter for USB 2.0

Time for a quick giggle as I look at some old hardware I used to use, some 14 years ago, before I take it off to recycling. This past weekend, in a box at the back of the cupboard, I found this: PC Card adapter for 2 USB 2.0 ports - top It’s an adapter for a laptop that didn’t have USB 2.0 ports but that did have a PC Card slot. PC Card adapter for 2 USB 2.0 ports - end Way back when, that’s exactly what I had: a big chunky laptop with USB 1.1 ports but no USB 2.0 ports. The laptop...

Read more »

Extras

Search

About Me

I'm Julian M Bucknall, an ex-pat Brit living in Colorado, an atheist, a microbrew enthusiast, a Volvo 1800S owner, a Pet Shop Boys fanboy, a slide rule and HP calculator collector, an amateur photographer, a Altoids muncher.

DevExpress

I'm Chief Technology Officer at Developer Express, a software company that writes some great controls and tools for .NET and Delphi. I'm responsible for the technology oversight and vision of the company.

Validation

Validate markup as HTML5 (beta)     Validate CSS

Bottom swirl