Posts

Automatic Spotify Playlist of loved Last.fm tracks

Image
I came across this post on Reddit and was surprised to find that there were no suggested solutions that would automatically add my loved tracks on Last.fm to a Spotify Playlist. Immediately, I thought back to the "live Twitter bio" post I wrote a few weeks back (or months, I've completely lost track of time over the exam period).
It turns out that it's quite easy to use the RSS and Spotify connections that will work in the background soon after a track on Last.fm is "loved". I have created an IFTTT applet that you can set up. Turns out you can no longer share Applets on IFTTT, so here are the steps to replicate mine:
If This... Head to https://ifttt.com/create, login and set the trigger to "RSS". Hit new feed item and enter the feed url https://xiffy.nl/lastfmrss.php?user=danster103&loved, but change the username to your own.
Then That... Search "Spotify" and choose the "Add Track To Playlist" option. Enter a playlist name…

My Twitter Bio Is Alive

Image
Since you're always checking my twitter profile to see if I have posted some more comedic gold, you've probably noticed how my bio is constantly changing to display my most recent listened to track.

It takes a lot of time to update the bio every hour for you guys - you just have to know what I was last listening to. (more quality humour right there)

The way I have this set up is actually quite simple and takes the form of one small IFTTT Applet. This applet checks the RSS feed for my last.fm profile regularly and changes my Twitter bio with the entry title for the latest track. Quite simple really.



I think the coolest thing here is the fact it allows you to have a dynamic Twitter bio - there are definitely many more interesting use-cases than just showing recent tracks. Let me know if you come up with something original!

Graphing Energy Consumption with TP Link HS100 Smart Plug

Image
Monitoring energy is a rather large interest of mine - I've developed Monitor for EnergyHive and Efergy Engage and my family have solar panels. It's interesting to see trends in our energy usage with my app, however it doesn't give us any information about which devices in particular are using the most energy.

I happen to use a HS100 smart plug to control my desk but was disappointed by the little information that the Kasa application displays and therefore have never used it to track my energy consumption. Today I got a bit of free time and decided to look into reverse engineering the smart plug. Luckily this had been done before by @ggeorgovassilis on GitHub so I didn't need to look into it myself - I just grabbed the script, made a few modifications and then wrote my own logging shell script.

This was one of my first properly functional shell scripts and, wow, I actually quite like working with shell scripts. They are versatile and reliable and also fun to write. I …

Material About Library - Release 2.3.0

Image
Earlier today I released version 2.3.0 of material-about-library. This is a brief summary of the changes in the release.
In this release, we have addressed the issue of the ActionItem and TitleItem text from being misaligned. (#79)

Since the design of the default items has changed, please note that this update contains breaking changes. If you have created your own custom items to use alongside the defaults, make sure that they still look good and check their alignment with the new design. The photo below is a comparison between the old layout and new layout. There was some discussion in issue #79 in which @code-schreiber and I decided that the 'new' (right side) layout is more aesthetically pleasing.




In addition to this, I would like to thank @code-schreiber again for updating translations in the library and tidying up the readme.

Finally, the bundled version of the support library has been updated to 27.1.1 which fixes some Fragment Transactions that you might have encountere…

Last.fm Desktop Wallpaper

Image
As you've probably gathered by now, I listen to music basically whenever I can. I keep track of my listening statistics using a fantastic service called Last.fm. This benefits me in multiple ways - they're able to suggest me new tracks based on the type of songs that listen to (albeit the algorithm isn't as good as the one Spotify uses), and I can see how my music taste shifts over time. Statistics interest me, so the weekly report is a fantastic method of visualising my listening habits. I tend to listen to a large number of tracks over the course of a week.
Another great thing about Last.fm is the number of 3rd party applications available. The API allows these services to access your listening data and provide all kinds of cool stats & visualisations. There's a great post over at /r/lastfm with list of all the currently working websites.
One of my favourites is lastfm.dontdrinkandroot.net which creates a word cloud of your top artists. Here's mine:

I was al…

Custom Error Handling with RxJava & Retrofit 2

Recently I started redeveloping my Android app Monitor for EnergyHive in order to try and take advantage of some of the new techniques that "modern Android devs" are using. I must say, the many hours of reading up and research was totally worth it - MVP keeps everything much simpler, Retrofit stops me from having to build API calls myself and RxJava handles threading - letting me focus on the code instead of avoiding the dreaded memory leaks.

Before I added RxJava, in an effort to modularise things, I made use of Retrofit Callbacks. These had some extra logic that would take the erroneous server response and parse it into my own custom Exception. I would check for response error messages and error codes even when the server returned something other than code 2XX and then create a custom ApiError object. I was able to create my own Callback that extended the Retrofit callback, and performed some logic in the Retrofit methods that passed the relevant Exception to two new abstr…

Amazon-Hyphen

Image
So, you’ve probably seen the Amazon Dash Button - a compact little wifi connected button. There have been loads of different “hacks” circulating on the internet, and since they were recently released in the UK I decided to order one.

One day later I had it toggling my Lifx light bulb thanks to the countless tutorials on the internet. I followed Steven Tso’s blog post and it only took me about half an hour.
Setting up the Dash Button with the app was simple, and cancelling at the final step (selecting the product) let’s you press it without ordering anything. Since the Dash only connects to WiFi when it’s pressed, the majority of the “hacks” online involved monitoring the WiFi network, waiting for the Dash Button to join, and then executing the relevant code.

Works great… Until your internet dies. I don’t know about you but I have to restart my WiFi router almost daily to avoid slowing down, which seems to break the ARP monitoring code. When trying it again today, I realised that I cou…