Bill Farmer

Random thoughts on random subjects

Getting Related Content working

by Bill Farmer. Categories: Hacking .

The latest release of Hugo includes Related Content, which I thought would be nice to add to my blog. However the docs, although they show you how to set it up, don’t explain how it works. To find that out, I had to look at the various threads on the Hugo forums. There are four parts - you need to create a new partial template in layouts/partials/related.html containing something like this:

Read more →

Adding a calendar event in android

by Bill Farmer. Categories: Hacking .

The android docs for the Calendar Provider are quite useful, but recommend the use of an AsyncQueryHandler for querying or adding events to calendars in an asynchronous thread. However the AsyncQueryHandler docs don’t include much guidance as to how to use it. To add an entry to an android calendar you first have to find out the calendar id using an asynchronous query on the calendars table. // QueryHandler public class QueryHandler extends AsyncQueryHandler { private static final String TAG = "QueryHandler"; // Projection arrays private static final String[] CALENDAR_PROJECTION = new String[] { Calendars.

Read more →

Whatever-o-meter revisited

by Bill Farmer. Categories: Hacking .

I wrote the whatever-o-meter about five years ago in PHP and Javascript as a Wordpress plugin. As I have migrated my blog to Hugo, I thought to have a go at reimplementing it. The exporter I used made a good job of translating the Wordpress custom fields to Hugo front matter parameters. I had to put dashes in quotes, otherwise they get interpreted as [<nil>]. intro: Please answer the following questions carefully and truthfully.

Read more →

Migrating this blog from Wordpress

by Bill Farmer. Categories: Hacking .

I have got fed up with Wordpress. It required constant updates, which doesn’t work automatically on Sourceforge developer web, and it’s slow, especially in admin mode. I came across a reference to Hugo while following up on something unrelated, so I decided to investigate. I looked for migration tools, and found two: Exitwp, which reads a Wordpress export xml file and converts to Jeckyll WordPress to Hugo Exporter, which is a Wordpress plugin and exports to Hugo I found a blog post from Justin Dunham documenting migrating his blog.

Read more →

Resolving content uris in android

by Bill Farmer. Categories: Hacking .

If you write an android app that handles images or any other sort of file your app may be required to deal with ‘content’ uris (content://). There is a very useful utility which resolves these into ‘file’ uris (file:///) FileUtils.java. This contains one external reference to LocalStorageProvider, which can be resolved by removing the function isLocalStorageDocument() and references to it. // import com.ianhanniballake.localstorage.LocalStorageProvider; // ... /** * @param uri The Uri to check.

Read more →
Previous page Next page