programming books and videos

We’re snowed in today here in my part of NJ, so today’s probably a good day to review and clean up some of the “independent study” stuff I’ve been working on over the last several months.

First, I decided to finally finish up a book that I started reading about a year ago, Real-World Functional Programming. I’d been reading it a little bit at a time for quite a while. I started in on a program to learn F# back in 2014. I read a few books, and learned a bit, but I never really got a chance to apply any of that knowledge on a practical project. So I skimmed through the last couple of chapters of that book today, marked it as “read” in Goodreads, and decided that my F# experiment is over for now.

I started (and finished) reading a book on JavaScript this week, Object-Oriented JavaScript. I’m doing a bit of JavaScript programming at work right now, but I’m rusty, since I haven’t used it much lately. I got this book for free at some point from Packt, so I thought maybe it would be a good way to brush up and refresh my memory. It was a good refresher, and even had some stuff in it that I hadn’t stumbled across before.

On the video front, I’m still working my way through SharePoint videos on Pluralsight. I’ve completed Andrew Connell’s “SharePoint 2013 Developer Ramp-Up” series, and Sahil Malik’s “Understanding SharePoint 2013” series. Now I’m working on David Mann’s “Developing SharePoint 2013 Solutions with JavaScript,” which is helping me out with the SharePoint/JavaScript stuff that I’m currently working on. When I paid for a year’s worth of Pluralsight, I wasn’t sure if I’d get my money’s worth out of it, but I think I’ve been making good use of it so far this year.

I’ve also now been sidetracked into messing around with TypeScript. I read a book on CoffeeScript a few years back, but CoffeeScript never really took off (at least in the .NET community), while TypeScript seems to be very popular right now. (Take a look at this Google Trends graph.) So I’ve been experimenting with using TypeScript and JSOM together in a SharePoint project. I’m not sure if it’s worth the effort, but it’s interesting. I haven’t devoted too much time to TypeScript yet, but I’ll probably watch a Pluralsight video or two on it and see if I can persuade myself into using it.

Finally, I feel like I should get back to Ruby on Rails at some point. I started learning Ruby back in 2015, and learned the basics (of both the Ruby language and the Rails framework) but really didn’t get as far as I wanted. I got partway through Michael Hartl’s book/tutorial, but I guess I got off track at some point, since I haven’t touched it since June 2015. As with F#, I never had any real project in mind, or work-related reason to learn Ruby, so I probably abandoned it in favor of something else I needed to learn.

So I guess I’ve got some goals for the rest of 2017: keep working on SharePoint, brush up on my JavaScript some more, look into TypeScript more deeply, and maybe get back to Ruby on Rails, if I have time.

WordPress syntax highlighting

I occasionally post code here, and I’ve never been entirely satisfied with the various ways that one can post nicely-formatted code on a blog. This blog has been around for so long that I’ve gone through several approaches. Recently, I’ve been putting all my code snippets in Github Gists, and then embedding those Gists here.

That looks pretty good, and works pretty well, but I’ve discovered a couple of downsides to that method. First, the code itself is not actually in my posts, so it doesn’t show up in searches, either here at the blog or (presumably) in Google or other search engines. I realized this a while back when I tried to search for a past post, using a bit of code that I knew was in the post. When I didn’t find it, I realized that of course the code wasn’t in the post, it was only out on Github. So I wanted to fix that, and get the code itself into my post database.

Second, the company I work for has started blocking the Gist site. I’m not sure why, but I guess maybe it’s occasionally used to post malicious code? Regardless, it’s a problem, since I sometimes want to bring up an old post of mine at work to remind myself of how I solved a problem in the past. When I do that now, the post is visible but the embedded gist is missing. And if my company is blocking gists, other companies are probably doing it too, so other people looking at my blog might be confused when they see a post with missing code.

So there are some good reasons to include actual code in my posts, rather than relying on Github. I could go back to just wrapping the code in <pre> and/or <code> tags, but I wanted to have something that would look at least as good as the embedded gists. So I started looking at syntax-highlighting plugins for WordPress.

I looked at Enlighter and WP-Syntax. Enlighter looks pretty cool, but I decided to go with WP-Syntax in the end. It uses GeSHI, which I’ve used before (in Drupal), and supports a lot of languages, including X++, which is a pretty obscure language. I installed it about a week ago. Today, I decided to spend a little time editing some of my old posts to move code from gists to WP-Syntax. It worked out pretty well. (And I’m still linking to the gists, so if the code gets scrambled, it’ll still be there on Github.)

To some extent, I guess this is just pointless busywork. My old posts don’t really get a lot of hits, and I really don’t refer back to them that often. But it was a nice little way to spend an hour on a cold Sunday afternoon, and it gave me a sense of accomplishment.

a birthday, a parade, and a good book

Tomorrow will be my 50th birthday. I wasn’t sure if I wanted to mention that on the blog, but I’ve previously posted about my 35th and 45th birthdays, so it’s not like it would be hard for anyone to figure out how old I am, if they wanted to know. So here it is: I’ll be 50 tomorrow.

The Somerville St Patrick’s Day parade is going on right now. I’ve been watching a bit from my window; it’s too cold out for me to want to go outside and watch. And I’ve been getting wrapped up in the final chapters of the final book of the His Dark Materials trilogy. I started re-reading it a few weeks ago, and I’m almost done now.

I had been planning to visit a friend yesterday to celebrate my birthday, but that fell through. That will probably happen next weekend now, but that means it’s been a generally uneventful weekend, since I didn’t plan anything else.

I used my Starbucks birthday reward to get a free chicken sandwich for lunch, so that was my big birthday meal. I’ve got a couple of Justin’s peanut butter cups I might eat later, in lieu of birthday cake.

I’m expecting that tomorrow will be a pretty normal, quiet day at work. But we’re supposed to get a lot of snow on Tuesday, so I think it’s going to be a chaotic week overall. I decided this year that I’m no longer going to be the guy who valiantly drives in to work in a snowstorm, so I expect I’ll either be working from home on Tuesday (and possibly Wednesday) or taking a PTO day. And if we get as much snow as expected, the whole week will be a mess. Here’s hoping that something vaguely approximating Spring gets started soon!

Getting master page URL in SharePoint 2013 with JSOM

I’m only just starting to learn JSOM (after previously learning the server-side object model, and CSOM, via C#). There are some slightly weird requirements and limitations that are constantly tripping me up. Here’s today’s waste of time: trying to get the current site’s master page URL.

Here’s what I came up with:

$(document).ready(function () {
            $('#divMain').text('Hello World.');
            getMasterUrl();
        });
        function getMasterUrl() {
            var myCtx = new SP.ClientContext();
            this.site = myCtx.get_site();
            this.web = myCtx.get_web();
            myCtx.load(web);
            myCtx.executeQueryAsync(
                Function.createDelegate(this, this.onSucceededMasterUrl),
                Function.createDelegate(this, this.onFailed)
                );
        }

        function onSucceededMasterUrl() {
            $('#divMain').text('Master URL: ' + web.get_masterUrl());
        }
        function onFailed(sender, args) {
            $('#divMain').text('Failed: ' + args.get_message());
        }

This just kept failing. I tried a bunch of random stuff to get it to work. In the end, I made a fairly minor change that got it to work. But then, I changed the code back, and it still worked. So this was going to be a post about a minor quirk of JSOM, but now it’s more of a “WTF” post. I’m sure I did something to make it work, and I just lost track of what it was. Well, either way, I’m having some fun with JavaScript.

Anime

There’s an interesting article on the NewsHour site about anime’s absence from the Oscars this year. It mentions the movie Your Name, which I’ve heard a lot about, but haven’t had a chance to see. (As far as I can tell, it was only released for a short run in 2016 in the US, to qualify for the Oscars and won’t get a “real” release until April.) I don’t know much about the director, Makoto Shinkai, but he seems to be well-regarded, so maybe I should hunt down some of his older movies.

I’ve been getting interested in anime again lately. This week, I watched the first three parts of Ghost in the Shell: Arise on Netflix. It’s not nearly as good as the GITS: Stand Alone Complex series, but it’s not bad. And I really liked the music, some (or all) of which is by Cornelius. There’s even one song which, apparently, is a collaboration between Cornelius and Sean Lennon. It seems like only those first three parts of Arise are available on Netflix, so now I need to decide if I want to buy the rest on Blu-Ray from Amazon, or maybe from iTunes. The series is a bit confusing, just in terms of the way it was released. Wikipedia does a (relatively) good job of explaining it. There are five main episodes, each about an hour long. In the US, they’ve been released on Blu-Ray as Borders 1 & 2 and Borders 3 & 4. (I’m not quite sure about the fifth episode, “Pyrophoric Cult”.) There is also something called The New Movie, which completes the series (I think). Those episodes/movies have also been re-edited into an anime TV series, with typical 30-minute episodes. That TV series is available on iTunes.

All of this leads me to think that I should maybe dive back into my old pile of unwatched anime DVDs.

Pocket acquired by Mozilla

Well, this is interesting. Mozilla has acquired Pocket. I blogged recently about Instapaper, and their acquisition by Pinterest. Now, their one big competitor has been acquired too. That’s a little disappointing, but maybe not unexpected. Though I wouldn’t have guessed that Mozilla would be the one to buy them out.

I’m still using Instapaper. They’ve restored all the data that was lost in their big crash a few weeks ago, and their site has been working fine for me ever since. So I’m hoping that they’re doing OK.

Amazon Affiliate Links

Amazon has recently made some changes to their affiliate program that are going to have a negative impact on some bloggers. Here are a couple of articles about the change, from The Verge and The Digital Reader.

I’ve been using Amazon affiliate links here on my blog for a long time. And I’ve never earned a penny from them. And that’s fine. I used to use SiteStripe to generate fancy image links, but I’ve had problems with those since I switched from Blogger to WordPress. So lately I’ve just been using SiteStripe’s short URL links. For me, it’s really just a way to get a short URL that might (but probably won’t) make me a buck or two at some point. But there are some sites that have based their “business model” on Amazon affiliate links, and they’re going to be in a bit of trouble. The Wirecutter and The Sweethome used to be in that category, but since they’ve been acquired by the NY Times, maybe they don’t have to rely so much on Amazon.

Either way, relying on something as fragile as affiliate links for anything other than a little extra coffee money has always seemed a bit daft to me. On the other hand, online advertising is a mess too, with so many people using ad blockers, and getting people to pay for content doesn’t usually work out too well either. I’m glad I have a good day job!