One to be put squarely into the head-meets-desk section. For a little while now, I’ve been meaning to update how I minify and compress the JavaScript files used by this website (and others that use JS to some lesser degree). For ages I’ve been using compressor code that runs as a Java app (I know, I know! Just step away from the pepper spray right now!) – first it was the YUI Compressor (last release: eight years ago), and then a couple or more years ago I moved to the Google Closure Compiler because I was now using the more modern ES5+ syntax that the YUI Compressor couldn’t parse. […]
READ MOREFor some time now, I’ve been pondering whether or not to post my old articles from The Delphi Magazine here on my blog. I supplied Chris Frizelle, the editor, with algorithm articles for a good nine years from November 1997 (with an eight month hiatus while I worked at Microsoft: at the time they frowned upon that kind of thing, especially writing about Delphi and not C# – eek!), under the soubriquet Algorithms Alfresco. It would not be hard to discern that that the early ones formed the basis for my algorithms book. […]
READ MORESo, just before Christmas, I switched to using a client-side library to highlight the code in my blog posts. The library I chose was Prism JS, and it works by marrying up some JavaScript and CSS to specially decorated pre
and code
elements so that their content (the code itself) is highlighted nicely. […]
Once upon a time, I wrote a plug-in for Windows Live Writer that took code that had been copied from Visual Studio to the clipboard and converted it to an HTML pre
block for my blog posts. The different colors were maintained during this conversion (in essence VS copies the code as RTF) so that the code displayed here in my blog posts would be nicely highlighted. I even published it to GitHub so that it could also be used for Open Live Writer too. […]
In my blog post “Thoughts on open source” I ended cryptically with But be aware that just because they’re “free” doesn’t mean that the cost to use them is zero. Let me expand a little on this with especial regard to JavaScript libraries. […]
READ MOREWaaaay back when (yes, it was eight years ago, an eternity in software development), I wrote a post on my old blog about using “Code from the Internet”. In those days, for me and my readers that meant finding some C# code from some blog post somewhere out there written by some Joe Blow and using it in your own app. These days however, if you’re doing any kind of web development, you’re going to be pretty well using a whole bunch of code from the internet, and in general from that internet outpost called GitHub. […]
READ MOREI’ve been talking about functional JavaScript for a few posts, but, to be honest, it’s nice to put the theory aside and just practice thinking and writing functionally. With that in mind, let see what we can do about fixing some “copy-n-paste” code. […]
READ MOREIn continuing this series of posts about functional JavaScript (one, two), I whimsically wondered if we could apply the SOLID principles of object-oriented programming. We took a look at S last time (the Single Responsibility Principle), and were fairly successful. The principle I introduced there was not only that the functions we write should do one thing and do it well. If we can embrace global immutability, so much the better (in other words, the function should not have side effects). Small functions of this type are also well worth writing since they help document the code via their names. It’s now time to look at O, the Open/Closed Principle. […]
READ MOREToday so far has been a comedy of errors with some web programming I wanted to do. A confederacy of dunce issues, one after the other. […]
READ MORELast time I took a quick look at why JavaScript can be used in a functional manner, primarily though the use of higher-order functions. Another way of putting this is that functions are objects in JavaScript, in the sense that they can be passed to and returned from other functions. And once you say “objects” as a programmer, you start thinking about things like composition, state, inheritance, and so on. […]
READ MOREYesterday evening as I was putting to bed a few changes to this blog’s JavaScript (that would provide fodder for my continuing series on functional JavaScript), I decided to update the version of JSLint I was using in Sublime Text. When I had done so, suddenly my JavaScript file produce a huge slew of warnings that had not been there before. Whaaaat? […]
READ MOREOver the Christmas break, when traditionally things are a little quieter at work, I do a bit of research into topics that interest me and that might have some bearing on our future products. This year was no exception and I decided to investigate React, Facebook’s library (framework?) for building user interfaces for the web. It’s a fascinating library to be sure (and I’ll talk more on it in another post), but there was one paradigm it uses which I haven’t really talked about before: immutability. Don’t get me wrong: sure, React components have properties and state, but the way they change (or rather are allowed to change) is very circumscribed. […]
READ MOREOK, so this afternoon I got bitten by an issue that has bitten a gazillion web developers (and will probably continue to bite more in the future). I’m talking about the syntax for the callback function that’s used for jQuery.each()
versus that for JavaScript’s Array.prototype.forEach()
. They are, dear reader, not the same. […]
Back in March last year I presented an implementation of Heap’s Algorithm – an algorithm devised to generate all permutations of a set of items – in JavaScript. The article was interesting to write because in doing so I had found a bug in the pseudo-code on the Wikipedia page for the algorithm, which led to a discussion with the main editor for the page on how to make it better. […]
READ MOREThe one issue that’s weird about JavaScript that I’ve found is that it has no compiler: the first time you find a bug is when you run your code, not when you compile it. So, since I’m adamant about writing “good” JavaScript code as I write it, I’ve installed a couple of JSLint plug-ins, one for Visual Studio and one for Sublime Text. JSLint is Douglas Crockford’s linter for JavaScript and, although utterly (perhaps barmily?) strict in certain areas, is the one I’ve settled on for checking/validating my code before I run it. […]
READ MOREYou 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”, at least in the web sense. The rest of the responsiveness will come later, when I change how posts are rendered in the browser. […]
READ MOREA short and quick example of some baffling coding today. It so happens this past weekend I was updating some HTML and CSS and JavaScript on this site. One of the JavaScript source files (luckily not written by me) had this: […]
READ MOREI had occasion the other day to mess around with a particular web page. The page was designed to provide an overview of a particular topic (essentially a list of high-level headers) and that had detail sections that were hidden. The user had to click on a “more” button on a particular header to show its individual detail section. Not only that, but should a detail section be shown, the “more” button was changed to a “less” button, so that the user got a hint that he could close that particular detail section (at which point, the “less” button became a “more” button once more). […]
READ MOREThis whole thing started out as a nice-to-have. I have a blog (you’re reading it). I have a URL shortener (jmbk.nl). They are separate apps on separate domains. When I publish a post here, I diligently create the short URL for it manually in order to publish that short URL on social sites (the URL shortener has some minimalist stats associated with each short URL; so minimal, it’s only a count of the number of times it was used). Yeah, I know, silly, huh: why can’t each post generate its own short URL? […]
READ MOREI don’t know about you, but one of my favorite commands in the browser is “View Page Source”, especially on a site that’s modern, visually attractive, or shows off some clever interactions. After all, I’m a developer: I like to find out how things work so I can, if I want to, replicate on my own web sites. […]
READ MOREAn article detailing the history of JavaScript, as well as a discussion about its major functionality. I’m going to guess I was late on this deadline, because I probably wrote it in my sleep, the topic was so familiar. […]
READ MOREI was reading some JavaScript code the other day, because, you know, reading someone else’s code gives you insights and inspirations to improve your own, when I came across this function to calculate the maximum element in an array: […]
READ MORESo far in this series (one, two, three) we have specialized content, detection of phone orientation, basics of being Web Clip capable, and a back to home page functionality. This post wraps it all up by removing the latter, implementing some simple Back button functionality, a “loading” indicator, and I do a little bit of code housekeeping too. […]
READ MOREThe story so far (one, two) is that I’ve simplified the content of this blog for viewing on the iPhone, I’ve added code that recognizes when the phone’s orientation is changed from portrait to landscape (and vice versa), and I’ve added the necessary elements to the head element to indicate that this site can be viewed as a Web Clip. With the current state of play though, the moment you touch on a link, Safari fires up to display the page. […]
READ MORENow that we have a special web site that displays properly either in portrait or landscape mode, let’s make it a web application that we pin to the Home screen. Boiled down to its essence, this is easy: you bring the web page up in Safari, touch the middle button in the bar at the bottom of the screen, and then select the Add to Home Screen option. […]
READ MOREWith the iPhone you easily view a web site in Safari, but you get the annoying bits of chrome at the top (the address bar) and at the bottom (the buttons). What if you wanted your site to occupy the whole of the screen? Well, you can pin the site to the Home screen and, provided that you make a few changes to the HTML, CSS, and JavaScript, you can make your site behave as if it were pretty much a native app. […]
READ MOREA reader asked me how the Extras tab on my blog was made. It’s a bit of CSS and a bit of JavaScript, so let’s describe it all. […]
READ MOREI came across this mathematical problem the other day: […]
READ MOREThe story so far: in essence I’ve added AddThis and Google +1 support to this blog using their “simple” markup. Unfortunately, the simple way breaks XHTML validation using the W3C validator because of the non-standard attributes (addthis:url
, addthis:title
) and elements (g:plusone
). As I said previously, time to break out the JavaScript. […]
I’ve been meaning to do a bit of housework on this site to clean up the CSS and to add a bit of interactivity. After all, I write a lot about JavaScript, so I might as well start adding some to my blog. […]
READ MOREI just published a blog post on my DevExpress ctodx blog about taking some non-idiomatic JavaScript code (actually from a DevExpress CodeCentral example program) and refactoring it to follow JavaScript best practices. […]
READ MOREI set myself a task: write some raw JavaScript for a web page. By raw, I mean no jQuery, no Prototype, no MooTools, just me and the editor. […]
READ MORE