Querying the Day One Database

WARNING! Make a copy of your database before trying any of this!

Why do it?

I have been using the Day One journaling app to keep a daily personal diary for many years now. I have been recording my mundane thoughts there for over seven years and have transcribed five paper diaries too giving me a total of 14 year held there.

That’s currently 4,267 entries and counting of which I know very little about other than the text itself. I wanted more detail than Day One offered and had ideas of how I could mine my entries in … Read the rest

Transitioning from Twitter API v1.1 to v2 (Part 1)

As part of The Twitter Debacletm I have spent the last few weeks trying to get my Twitter bot working again which has taken quite a bit of effort.

I thought it might be worth looking at what I did to get my bot working again once access to the API was cut in February. As there is so much in this I have broken it down into two parts:

  1. setting up your project and getting the keys you require to use the API
  2. calling the API from PHP

Getting the keys

I struggled to find which keys to … Read the rest

The Twitter Debacle

Ever since Elon Musk took reluctant control of Twitter he has been walking a tightrope as he balances bringing Twitter into the black with not losing the core base of users. That includes laying off a large number of staff.

One decision that I think he might yet come to regret is the change to the API access moving from free access to a freemium model. Where you used to be able to post an unlimited number of tweets this is now restricted – 1,500 a month for the free account, 50,000 a month for $100 and so on up.… Read the rest

Untethering a Raspberry Pico from your Computer

In my series on the PiHut Maker Advent Calendar, I posed a couple of questions:

  1. how do you move from a wobbly breadboard to something more permanent?
  2. How do you run code without having the Pico tethered to a laptop running Thonny?

I have, at least, now worked out how you do the latter of these two and I will explain how below.

In order to get a script to run on start-up you need to save a file called “main.py” to your Pico device. To do that I have included steps for this using Thonny. Firstly, make sure … Read the rest

/usr/bin/git-receive-pack: stale NFS file handle Error

What do you do when you want to commit some work, you go to do a git push and what you get back is the following?

fatal: protocol error: unexpected 'Error running git: fork/exec /usr/bin/git-receive-pack: stale NFS file handle'

At first I spent ages doing a search and checking various Stack Overflow questions to see whether I could find a fix. All sorts of things were suggested and I looked into before I remembered that a push in my case was to a remote origin. The third party service BitBucket. When I had a look at their status page the … Read the rest

The controller/method pair you requested was not found.

A very quick Codeigniter tip this week which will hopefully save you hours of tearing your hair out.

As you can see from the image above I have been writing a command line function and was getting the following error:

The controller/method pair you requested was not found.

This was incredibly confusing as the name I was giving on the command line matched that on the controller – or so I thought. What I actually had in the controller was this:

class kanboard extends CI_Controller {

Turns out that Codeigniter3 expects controller names to have leading caps so changing the … Read the rest

Automatically auditing User Actions with CodeIgniter

One important action you might want to carry out is auditing what actions users have taken in your application. Having this knowledge is useful for working out which functions are being used and in what order. Sometimes users reach functionality in a way you might not have imagined when writing your code. Of course this is also very useful for carrying out support too.

MY_Controller

Fortunately it is very easy to record actions without too much coding and even better you don’t need to add the call to audit into everyone of your functions making a retrofit of user auditing … Read the rest

Applying .gitignore Change to a Repository

A great feature of git is the ability to mark certain file and folders as being excluded from the repository which is done via entries in the .gitignore file.

One issue I regularly have is when things change and I need to update the .gitignore file and I always forget how to apply that change. That’s because it is something that isn’t obvious or something that I do regularly. Fortunately it is incredibly easy to achieve and here’s how…

How to apply .gitignore changes

Assuming that you have already edited and made your changes to .gitignore the next this to … Read the rest

Styling Codeigniter form error messages

As I get more and more deeply involved in using Codeigniter for my projects I discover bits and pieces that I think might be useful to others.

Today is a very quick tip about styling the error messages that are thrown on a form. Looking at the statement that you have in your view it isn’t immediately obvious how you apply any styling to this at all.

The answer, strangely, is to apply the look and feel through a call to set_error_delimiters in your controller and not in the view. The function takes two parameters: the html code that should … Read the rest

Accessing Local Resources over the Internet with Packetriot

When I am doing any development, such as for PostRecycler, I do the coding on my laptop running Apache, PHP and MySQL locally via MAMP. This is fine until I need to share work with others which means I have to either upload the work onto a public server or do it via screen sharing. Neither are particularly ideal.

I was vaguely aware of the service ngrok which allows you to expose your local services on the web and then, via Reddit, saw the similar service Packetriot which does a similar thing so I thought I would give … Read the rest