I'm working on a CouchDB library for PHP, and so I needed to write some tests for it. CouchDB has an HTTP API so I'm basically making web requests and while I could certainly set up a test database and run full-on integration tests, there are a few limitations with that approach. Firstly: it means I'm testing the database as well, which isn't what I want and brings extra dependencies that make the tests harder to run. Also: I want to be able to test error cases, rate limiting and so on, that would be difficult to recreate reliably. Continue reading
I'm not a huge fan of the live demo in conference talks - it's really hard to do well so I see a very large number of bad ones. Also, it's super hard work to include them in my own talks in a meaningful way because they are so difficult to pull off. I could write a very long list of reasons not to ever live demo (nobody wants to watch you type, now you are talking to your laptop, conference wifi rarely works, you could tell me three much more useful things in the time you've spent doing this ...) but in truth as developers we love the "new shiny" and it can be super helpful to get an actual walkthrough of how to do a particular thing. So if you absolutely must live demo, here's my own general plan and tactics: Continue reading
Most of the PHP I write runs on Bluemix - it's IBM self-service cloud, and since I work there, they pay for my accounts :) There are a bunch of databases you can use there, mostly open source offerings, and of course with PHP I like to use MySQL. Someone asked me for my connection code since it's a bit tricky to grab the credentials that you need, so here it is. Continue reading
An increasing number of applications now offer webhooks as an integration, often in addition to an API. The classic example, familiar to most developers, is the GitHub webhooks which can notify your other systems such as CI tooling that a new commit has been added to a branch. If you imagine how many repositories exist on GitHub, and how many other systems react to changes on each repository ... there's a reason they are excellent with webhooks! Whether it's your source control, updates from your IoT sensors, or an event coming from another component in your application, I have some Opinions (TM) about handling webhooks, so I thought I'd write them down and include some code as well, since I think this is an area that many applications will need to work with. Continue reading
At a conference a few days ago, I put up a slide with a few of my favourite tools on it. I got some brilliant additional recommendations in return from twitter so I thought I'd collect them all in one place in case anyone is interested - all these tools are excellent for anyone working APIs (so that's everyone!). First, my original slide:
I mostly use OpenWhisk with NodeJS (which is lucky for me, it's the best supported of the languages and default for the documentation examples!) and while there are a bunch of npm modules already installed on OpenWhisk, sometimes there will be others that you also want to include. Alternatively or additionally, you might also want to deploy your
package.json since this can specify the entry point if it's not
index.js which is the default.
Having an Amazon Echo Dot in my office is quite fun, and I've accidentally started writing more skills and giving a few talks about building skills for the Alexa toolchain. Today I created a skill that uses multiple steps to make a conversation and thought I'd better write down what I did so I'd be able to remember!
The basic idea is that when creating the "intent", i.e. the action that you want Alexa to do, you also define "slots". The slots are the variables; if this were a command line tool, they'd be the arguments you typed. It's possible to include both intent and slots in your wording when you speak to Alexa, but equally you can just invoke the skill and have it prompt you for the rest of the information. Continue reading
I love OpenWhisk but I struggled a little to get the parameters attached in a sane way for a while so I am capturing my notes here for future reference! Parameters can be attached to actions or packages; I tend to break my actions down really small and pass data into them, while preferring to set parameters on the package that the actions belong to. Continue reading
Did GitHub change their activity feed? Or am I getting more confused now I contribute to so many different projects that I'm not a maintainer of? Either way, I struggle sometimes to find the pull request or issue that I had a discussion on to revisit or continue that discussion (yes, I get email notifications - and no, I don't take good enough care of them to find things that way).
GitHub has brilliant advanced search functionality, and what I wanted was:
is:pr commenter:lornajane sort:updated-desc
Which gives me a list of all the pull requests I've commented on, with the most recent first. I couldn't remember the exact repo name and I also often switch
is:issue as appropriate, but this search string has been very helpful for finding those odd things you want to follow up on.
Do you have a favourite GitHub search string combination? Would you care to share it in the comments? Thanks :)
I work quite a bit with CouchDB (Cloudant, a hosted CouchDB solution, is part of Bluemix, IBM's cloud platform - and I work for IBM so I get to use this as much as I like) and today I found a feature I hadn't seen before. I struggled to find the docs, so I thought I'd post my working example here in case anyone else is solving a similar problem: wanting to use more than one set of key ranges when filtering a CouchDB view. Continue reading