Category Archives: Programming

Thoughts on programming

Gosh, This Is A Weird Sentence

I just completed the Offline-First course. I must say it became progressively more frustrating as I approached the end. I continually wrote “fetch(response)” even though I know it is “fetch(request)”. I swear Visual Studio Code has it in for me and changes my text just to annoy me. Another example, why else would it keep typing “I f” instead of “if”? All in all, it might just be an indication that I am pushing myself too hard and not getting enough sleep.

Anyway, I have moved on to the next course on ES6 = ES2015, which probably should come before the Offline-First course even though the Offline-First course only uses ES5. And I just ran into this sentence:

This behavior prevents variables from being accessed only until after they’ve been declared.

Here it is fixed:

This behavior prevents variables from being accessed until after they’ve been declared.

Here it is fixed a different way:

This behavior allows variables to be accessed only after they’ve been declared.

You can’t have it both ways. You are welcome.

I also disagree with the average of nothing being zero (0).

Very Frustrating, Old, Familiar Territory

I am starting to run into very familiar problems that Udacity courses seem to always fall into. The first is outdated content. Given that Udacity and Google started accepting applications for the Grow with Google Challenge Scholarship months ago, you would think they would have time for one person to walk through the course material and notice that, gee, the current version of Google Chrome Canary looks nothing like the version of Google Chrome Canary in the video. They could then maybe write some notes at the bottom of the video pointing out the differences and how to accomplish in the newest version what you need to accomplish.

The second is a rash of putting the cart before the horse episodes. It was just plain cruel to point out how useful MDN is as a reference immediately after the quiz where you needed to use MDN as a reference. Those references need to be introduced before we need them, not after. They also be listed as usable links underneath the quiz video/interactive page.

Finally, about those quizzes used as pause buttons. I really dislike having to click a button that says “I just did this really great thing!” when I have done nothing of the sort. Every “quiz” like this needs to have an “I have yet to accomplish this great thing, but I just want to move on anyway” button. I would think Udacity would want to know how many people are just blitzing through the material and don’t really care about actually doing what the quizzes are asking them to do, or how many people get stuck on any one particular quiz and just give up because they really don’t have any other choice.

UPDATE: There is such a button. It says “View Answer” and it is right next to “Submit Answer”. I don’t know how I forgot about it and missed it this time around.

Sliding Into Familiar Territory

This course starts out strong and I like the dynamic between the two instructors, but here in the middle of Lesson 3 we are starting to slide into familiar territory. The lessons are about one thing (e.g. service workers), but the quizzes are about another (e.g. finding information on the web about responses and string comparisons). We just (in 3.15) had a quiz that sets you up for one answer (using fetch() in a new Response), only to leave you baffled as to why we just use fetch(), no new Response needed.

(Hmm, fetch() returns a Response. Maybe it was obvious in retrospect.) Be that as it may, they make a big deal of it, but they don’t really explain it.

And another recurring Udacity problem is the out-of-dateness of the material. That seems especially unforgivable with the big build-up to this course. The (video) material is about two-years old, and there has been no attempt to update the course notes. Considering that they are encouraging us to live on the bleeding edge by downloading and using Google Chrome Canary, you would think that they would have expected everything to change a great deal in a short amount of time.

New Udacity Course

I have yet to complete my iOS Developer Nanodegree as I am trying to finish up my final project before I actually begin. That is finally starting to wrap up. But I am now beginning a new endeavor on Udacity called the “Grow With Google Challenge Scholarship” on the “Mobile Web Specialist” track, and I will write about it here. Today is Day 0.

#GoogleUdacityScholars and #GrowWithGoogle

Universal Links and Apple’s Cruelty

You may be interested in using Apple’s Universal Links. It is not too complicated, with one possible exception. Apple insists on the following:

  • You need a file named apple-app-site-association
  • The file name cannot have an extension
  • The file must be of type application/json
  • The file must reside in one of two directories that are likely to have other files of other types

The difficulty is in assigning a type of application/json to a single file without an extension. Here is the solution for .htaccess (thanks to my elder son!) for those hosting the file on an Apache server:

<Files apple-app-site-association>
ForceType application/json

Well Played, Udacity!

This past week, Udacity was offering a “Discovery Week” special of 50% off tuition for the first two months of the iOS Developer Nanodegree. I was very, very tempted. I however did not take advantage of the offer for the following reasons:

  • I set out on this task to complete the requirements for the Nanodegree without signing up and thought it important to finish the experiment as originally laid out
  • I am not yet finished
  • Although I appear to be on schedule for finishing in the next month, I never know what might prevent me from doing so
  • Every month I am not signed up for the Nanodegree is a month I don’t have to send Udacity any money
  • In the past, Udacity regularly offered me the opportunity to sign up for the Nanodegree with the first two weeks free, which is cheaper than 50% off if I finish in the first two weeks

What would have tempted me enough to abandon my original plan and sign up? 50% off the first three months probably would have done it.

I have to say that I don’t think the subscription model is the right one for this Nanodegree. I would think a better means of monetization would be a fixed price with a six month payment schedule. If you finish early and want your Nanodegree earlier than six months, then pay the remaining tab early. If you need to drop out for a while and can’t afford the payments, fine, pause the payments and jump back in when you can afford it.

Yes, Udacity would potentially have to support students pursuing the Nanodegree beyond six months without additional funds coming in after that time (because they would have already paid in full), but I think those people would be few and far between and not likely to linger too terribly long. Getting their Nanodegree is incentive enough; they don’t need further financial incentive. If there is a significant cost associated with these stragglers, it can probably be spread across the student body (in the form of slightly-higher tuition) without negatively impacting the number of people signing up.

Set Title For State

This announcement brought to you by every dynamic UIButton with truncated text ever:

When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)
When using a button (UIButton) with dynamic text, I will use setTitle(_:for:)


The Grumpy Old Programmer and MapKit

I really ought to rename my blog “The Grumpy Old Programmer”. Today I am going to pick on Apple and MapKit.

Now, MapKit had some issues at the start of its life. Fortunately, those are in the past. I have actually found MapKit to be an enjoyable experience so far. But I do have one issue with it that I just came across.

You can tell MapKit where you want your map centered and how tall it should be (in degrees latitude) and how wide it should be (in degrees longitude). MapKit will supposedly give you a map as close to what you requested as it can, but it can’t guarantee that you will get exactly what you asked for. This is because MapKit is going to fill the available space with the map while still maintaining the Mercator projection. The upshot of this is that a full-screen display can only display half of the earth at a time.

The Google Maps API will readily serve up not just the whole earth, but the whole earth repeated several times over. It does this by clipping off the poles and letter boxing the map to preserve the projection.

As an added twist, I really want a different center to the map based on orientation. For a portrait orientation, the default map at minimum zoom can be centered on (0, 0) and you will see everything of interest (in that hemisphere, anyway). But in landscape orientation, the discrepancies between the Northern Hemisphere and Southern Hemisphere become obvious. I would much rather see more of the northern land than the southern seas in this case. That’s the Earth’s fault, not Apple’s. But again, this is a non-issue with the Google Maps API.

Fortunately, there is only one time when I want to set the center and size of the map, and that is at startup. The rest of the time, I am going to preserve the last location and zoom level that the user set. So, my apologies to Asia and Australia. Perhaps someday the iOS version of Steampunk Road will show your your half of the world as well as mine.