
Here's a quick way to display how many times a WordPress post has been read. For this, you will need: A blog running WordPress. The JetPack plugin installed. The ability to edit your themes. Here's the snippet of code I'm using to add "This post has been read 12,345 times". I'll explain how it works in a bit more detail. if( function_exists( 'stats_get_csv' ) ) { $stats_query = "page_stats_for_" . get_the_ID(); if ( false === ( $special_query_results =…
Continue reading →
I'm really enjoying driving the BMW i3. I'd love to have it tweet its driving efficiency, or upload its location to my server, or let me turn on its air-conditioning when the temperature gets too warm - there are a hundred interesting things to do with the car's data. The official app has some of these features - but is slow, ugly, and a pain to use. BMW used to have an API available for hackathons, but they shut it down. Terence Eden is on Mastodon@edentReplying to @BMW@BMW I've just got…
Continue reading →
In the glorious past, Amazon had an API for interacting with its "Wishlist" service. Not any more though. So, here's the inspiring story of how a rag-tag band of adventurers brought it back from the dead! Several years ago, Justin Scarpetti created a tool to extract data from an Amazon wishlist - the imaginatively named Amazon Wish Lister. It used that most vulgar of programming practices - Screen Scraping! Yup, gobble up the HTML and attempt to parse it. Needs must in a dire situation. …
Continue reading →
Go take a look at this tweet https://twitter.com/edent/status/650948940431511552. You can't - I deleted it! I've been looking at how to track politician's deleting tweets, when it occurred to me - is there any way to prove that a Tweet ever existed? It's possible to automatically take a screenshot of a page, but screenshots can easily be manipulated. So, can we preserve deleted tweets with reasonable proof that the Tweet existed? I think the answer is yes - although it's cumbersome,…
Continue reading →
I've been looking for a way to programmatically take screenshots of websites. Most of the solutions I've found won't work on headless servers, require complex libraries to be installed, or cost money. So, what do we do when faced with a knotty programming problem? Hack it! Google has a "Pagespeed" service, it allows any webmaster to get a comprehensive report on how Google assess their page. It also includes a screenshot of how Google sees the webpage. Here's how my blog looks according to …
Continue reading →
Last year, I wrote about how to extract Location History from Google. Once again, Google have changed their URLs to make it even harder to get one's current location out of their data-greedy hands. It used to be the case that Latitude gave that information - but they killed it. Then they promised it in Google+ - but never delivered. Now they offer you a data-dump which they will email to you. Hardly convenient if you want a single day! sigh Recently Google released Timeline - an…
Continue reading →
Twitter, as part of its never-ending quest to alienate users and appease the rich and powerful, have shut down Politwoops accounts. Politwoops monitored politicians' Twitter accounts and noted when they deleted a tweet. Most of the time deletions were done for the same reason we all deleted content - mispellings, broken links, etc - but occaisionally they caught politicians attempting to flush history down the memory hole. If you're a dab hand with Python, and have a server upon which to run …
Continue reading →
There are two very clear signs that I'm getting old. The first is that I bought a domestic robot to help me with the chores. The second is that, rather than spending my evenings and weekends reading decades old forum postings, reverse engineering serial interfaces, and soldering components together - I plunked €99 on a bit of kit which "just works". Enter the Thinking Cleaner - it's a replacement faceplate for Roombas which adds WiFi and a sweet hackable API. This post looks at how the unit …
Continue reading →
Twitter now allows people to upload videos directly to the micro-blogging platform. It's an attempt to bypass 3rd party sites like YouTube (owned by Google) and Instagram (owned by Facebook). In an uncharacteristic display of openness, Twitter's API allows developers to get direct access to video. This is a quick blog post to explain how you get access, and what you can do with the information. I presuppose that you're already familiar with the Twitter API and know how to make basic calls. …
Continue reading →
Twitter has just launched embedded videos in Tweets. How can we, as app designers, present them to our users? So, what options do we have? First of all, let's take a look at what the Twitter API provides. Send a signed request to : https://api.twitter.com/1.1/statuses/show/560070183650213889.json In return, we get these entities : "entities": { "hashtags": [], "symbols": [], "user_mentions": [], "urls": [], "media": [ { "id": 560070131976392700, …
Continue reading →
I've been playing around with PVoutput.org - it's a community site which lets you quickly and easily publish live details of your solar panels. I couldn't see a pre-built library for my model of Solar Power Inverter - the Fronius - so I thought I'd build one. Important: the PVoutput API doesn't run over HTTPS. All of your communications with it are in the clear. While there's a limit to the amount of damage a malicious party could do, be aware that your API key isn't secure. The API is…
Continue reading →
Update! There's a new way to do this - read my latest post to find out how. Two or three years ago, I was contacted by a recruiter from Google. They wanted to know if I'd be interested in working for the advertising giant. We played the usual game of dancing around salary and schedules, when he dropped the bombshell - they were looking for people to work on Google+. I asked the recruiter if he'd seen my G+ profile. At the time, it had this childish scrawl all over it. We mutually…
Continue reading →