Writing on Tablets Tech stuff from @yeltzland

Writing a Category Index Page for Jekyll

I’ve added a Posts by Category page to the site, as now there are a few posts on here I thought it would be useful to be able to browse them quickly.

As I’ve mentioned before, this site is statically generated using Jekyll which is great but it can be challenging at times to do anything slightly different.

How Jekyll works is that each post is a Markdown file with some meta-data (also known as Front Matter) at the start. For example, this post has this meta-data:

The offline generator can then use this meta data in the templates as required.

I use the categories in two places:

  1. The category labels used at the end of each post showing the category a post is in (and linking through to a section of the index page)
  2. In the categories index page itself to group the pages by category

Templates in Jekyll use the Liquid templating system from Shopify, which is pretty flexible if a little obtuse at times.

For example, here’s the template I wrote for the category index page:

Basically what this does is a hell of a lot of work to get:

  1. A unique list of category values in a concatenated string (get_items)
  2. A count of how many categories there are (num_words)

We then go through each category name in sorted order, and go and get the posts in that category.

Clear as mud really, but luckily I’d built something very similar already on another site a while back with a lot of help from the Internet.

The one downside is that I can’t find any way to do a case-insensitive sort of the categories. According to the documentation, there should be a sort_natural which does exactly what I want, but I couldn’t get it to work 😒

The workaround is to only use lower-case categories (I couldn’t face mis-casing iPad and iOS - too ugly), which isn’t perfect but it will do for now.

[Update: I added some old posts that had title casing for the categories, so gave up on the lower-case only, and will continue to search for a case-insensitive sort soultion]

P.S. This was all written on my Mac and not on my iPad - turns out there are limits on my patience, especially when copy and pasting code between files. Don’t judge me.

Blogging Jekyll

A Short iOS 10.3 iPad Wish List

Assuming we get some iPad specific updates in the forthcoming iOS 10.3 releases, here's what I'd like to see

Many people (including me) are assuming Apple’s sticking to last year’s release cycle, and iOS 10.3 will have some new iPad only features.

I’m feeling pretty productive right now using my iPad Pro to make this site, but there are definitely improvements to be made.

None of these are very clever, but be interesting to see what we do get - if anything - in the next few weeks.

A better split view app selector

I think everyone agrees the current way of changing which app is shown in split view is really poor.

Split screen selector

The list of apps, in order of last used, really doesn’t scale when you’ve loads of apps you use regularly.

Even just having a search filter to quickly find the app you want would be better, but there must be a better way than this. @viticci’s suggestion of having a view similar to the home view makes sense, especially if you can chnage the order app icons are shown in split view.

Estimated probability: 100% (of something happening)

Picture in picture video without developer support

PiP video is great, especially for big sports watchers, like myself to be able to watch the game in the background while doing something else.

However developers have to update their apps to support PiP, and not everyone has done that - in particular I’m looking at Sky in the UK and their woeful support in their Sky Go and Sky Q apps.

Surely if the video is being shown full-screen there should be a system level facility to let me make it PiP, rather than the developers having to opt-in?

Estimated probability: 10%

Easier data transfer between apps in split view

The most common use for me of having 2 apps running in split view is transferring information between them - very often copy and paste.

Be very nice if there was a simpler way of doing this. Maybe drag and drop between the apps, or maybe an automatic option to be able to paste into the 2nd app what is highlighted in the 1st app?

Estimated probability: 75%

I’d be happy with any of these being implemented, and will be a bit disappointed if none are. However recent Apple missteps don’t give me much confidence right now 😏

iPad iOS

A Workflow to open an Amazon US page in the local Amazon site

Making it easy to switch between Amazon sites using Workflow

Quite often someone on Twitter posts a link to an interesting product on Amazon in the US, but I want to see if it’s also available on the Amazon UK site.

For a while I’ve just been hacking the URL in the address bar to change “.com” to “.co.uk”, but realised there’s an easier way to do it in Workflow.

I started by using a regular expression to extract the path and query from the URL, but obviously nobody likes RegEx 🙂. Luckily I discovered the “Get Component From URL” action which does all the fiddly parsing work, and without much effort I now have a share extension I can call to open any Amazon page in any local Amazon site.

I’ve submitted the workflow to the Workflow Gallery, so I’ll let you know if it gets accepted.

Update: The Workflow got accepted into the Gallery, and can be found at https://workflow.is/workflows/f55a44739e8945b2b20ed00e14ad5158. Hurrah!

Workflow Amazon

My new super cheap Android phone

My £45 phone is actually pretty decent (except for the very average cameras)

I’m back working on an another Android app for the next few weeks, so I thought I’d treat myself to a new phone for development.

Now I didn’t want to spend a massive amount (seeing as I’ll won’t be using it as my main phone), and I found just what I was looking for at Argos - a Sim Free Alba 5 Inch 3G Mobile Phone in Black for just £44.95 (about $55 at the current awful exchange rate)

My new Alba phone

After playing with it for a couple of hours it’s surprisingly fast (in relative terms), with a nice bright screen that’s not bad to use at all. I’m really missing Touch ID to login, and the cameras are very average (or is it I’m just spoilt by my iPhone 7 Plus?), but other than that it’s definitely usable for most things I’ve tried so far.

Clearly I’m not going to switch away from iOS and my iPhone right now, but am I really getting value for money from a top of the range iPhone compared to a very run of the mill but completely adequate basic Android device?

Android

Windows as a runaway truck

Getting close to breaking point with Windows

I’m starting 2017 returning to Android development (which I’m really looking forward to!), and for reasons now escaping me I decided I should do this on either my Windows desktop or laptop.

I hadn’t turned on either machine for a few weeks, and therefore was hit by a barrage of updates, fixes and other processes absolutely caning the hard disks. In combination with having to update Android Studio x2, it basically took all morning to get nowhere fast.

With lots of discussion recently about Steve Jobs’s ‘Cars vs Trucks’ metaphor for mobile OSes vs traditional PCs this felt like being run down by the demonic truck in Steven Spielberg’s very early movie Duel - watch it if you haven’t seen it.

I’m almost certainly going back to installing Android Studio on my MacBook Pro this afternoon. No idea what I was thinking before!

Windows