Laravel 8 with Wikimedia OAuth login

I recently wrote a little app called wikicrowd (blog post to follow) using Laravel and MediaWiki / Wikimedia authentication. It certainly wasn’t entirely out of the box, and the existing docs still need some tweaking.

This post reflects the steps I went through to set this app up, and it should only take a few minutes.

You can find a tag of the code at the end of this walkthrough on Github for PHP 8. (There is also a tag for PHP 7.4)

Shout out to the developers that worked on the Wikidata Mismatch Finder which is also a Laravel app with MediaWiki OAuth and was used as inspiration when writing this post, along with the documentation for the package used by Taavi.

Setup Laravel

First off I need a Laravel installation. Currently 8.x is the stream of the latest versions, and the installation docs say to run the below command.

curl -s https://laravel.build/demo-laravel-mediawiki-auth | bashCode language: JavaScript (javascript)

I’m not a fan of running random code on the internet on my machine, but this is what the docs say. It creates a directory at the location you specify at the end of the URL, in my case demo-laravel-mediawiki-auth , creates a laravel/laravel project, and does a composer install.

Read more

Installing Android Studio on WSL2 for Flutter

I’m trying to do some “modern” Android development and want to experiment with Flutter while running Windows, and WSL2 with Ubuntu.

Flutter isn’t as easy to install as some programs, no simple apt-get etc, but instead a collection of binaries distributed by different organizations that all need to be tied together.

To start with, you’ll want to read Installing Flutter 2.0 on WSL2 by Josh Kautz. This can guide you through getting Flutter and also the Android SDK with some copy & paste commands.

This post is inspired by these simple steps there to make this easy for folks to copy for Android Studio.

Read more

2021 Year Review

This entry is part 5 of 7 in the series Year Reviews

I have been doing some sort of year review since 2017, covering projects I work on, this blog, Github and Twitter. You can find the past posts using the tag #year-review.

2021 has seen the continuation of COVID-19 with the Omnicron variant making its first appearance in the last few months. Currently living in the UK we currently have the highest reported numbers of this new variant, as well as high covid levels overall. Who knows what 2022 will bring.

Blogging

At the time of writing this, I have written 43 blog posts this year, likely to leave my end of year total at ~47. That’s double what I wrote in 2020. In December I attempted to write a blog post a day, turning out to be too much, but it looks like I should be able to hit a secondary target of a post every 2 days, so ~15 in December.

  • ~40,000 page views, down from 47,664 (~16% decrease, but trending up looking across more years)
  • ~30,000+ visitors, down from 32,197 (~7% decrease)
  • ~47 posts, beating my previous record of 25 in 2018

It’s really easy to see how a single post can skew growth year by year. That post last year was Quickly clearing out your Facebook advert ‘interests’ which alone brought in 10k views, this year reducing to 3k. The peak post of 2020 only has around 6k views.

I quite like looking at most viewed posts so I can get some sort of gauge on what I should perhaps be writing more about, or projects that generally interest people. Development on Windows is the theme of the first 2 posts in my top 10. The majority of the rest of the top 10 are short posts covering problems I have encountered and solved over the years. And, also lasagnes… (more on that below)

Read more

Wikidata user and project talk page connection graph

Talk pages are a pretty key part of how wikis have worked over the years. Realtime chat apps and services are probably changing this dynamic somewhat, but they are still used, and also most of the history of these pages is still recorded.

I started up an IPython Notebook to try and take a look at some of the connections between different users on Wikidata over the years. Below you’ll find a few representations of these connections, as well as notable things I spotted along the way, the generating code, SQL query and more!

The data

MediaWiki maintains links tables for all pages, so getting all of the current links out of Wikidata is very easy. I made use of the Wikimedia Cloud Quarry service to run this query and host a CSV of the results.

SELECT
  SUBSTRING_INDEX(page_title, '/', 1) AS t1,
  pl_from_namespace AS t1ns,
  SUBSTRING_INDEX(pl_title, '/', 1) AS t2,
  pl_namespace AS t2ns
FROM pagelinks, page
WHERE pl_namespace IN (3,5) AND pl_from_namespace IN (3,5)
AND page_id = pl_from AND page_title != pl_title
GROUP BY t1, t2Code language: PHP (php)

I then loaded this data directly into an IPython Notebook and did some cleaning, such as removing all IP addresses. I then spent quite some time applying more filtering and twiddling knobs to try and get some graphics out that are easy to look at. The first attempts looked like solid blobs as you can see in this tweet.

You can find a copy of the Notebook on notebooksharing.space.

Read more

Most liked Wikibase tweets

Wikidata is 9, and Wikibase the software that powers it is also thus about 9! Twitter has been around for the entire Wikibase lifespan. So let’s take a look back through time at some of the most liked Wikibase tweets (according to Twitter free search) since creation.

Want this list but for Wikidata? Check out my Wikidata focused post!

2021, @annechardo 113 💕s

My thesis on “Managing Archival Authority Data in the Data Web” is online! The first part (from #maintenance to #MetadataDebt via #RiC ) is completed by a case study using #Wikibase :

@annechardo, Twitter Translate
https://twitter.com/annechardo/status/1348650172268617731

Read more

Most liked Wikidata tweets

Wikidata is 9, and Twitter has been around for the entire Wikidata lifespan. So let’s take a look back through time at some of the most liked Wikidata tweets (according to Twitter free search) since creation.

Personally, I think it’s rather cool that half of the tweets are in languages other than English!

Want this list but for Wikibase (the software that runs Wikidata)? Check out my Wikibase focused post!

2021, @wikidata 412 💕s

Announcement of the new Wikidata Query Builder by @wikidata!

Read more

Finding the most liked tweets for a topic in a year

I’m nearly halfway through writing a month of daily blog posts. I wanted to write some posts covering the history of both Wikidata and Wikibase on Twitter. Being a developer, I looked for APIs, but it seems tweets are not as accessible as they once were.

This is a short write up of my adventure, covering APIs, scraping thoughts, and finally, my working solution, all be it with a quirk of 2 that I can’t explain.

Read more

A PHP library for jsonstorage.net

I first heard about jsonstorage.net when searching around for a quick place to persist some data while writing a Twitter bot.

jsonstorage.net provides a simple JSON storage, with a free tier that can be very useful for small personal projects. The REST API is super simple, GET POST PUT DELETE etc. You can have either public or private JSON objects.

During my first use of this service, I remember writing some random code in PHP to interact with the service and deal with authentication. I remember thinking it would be nice if there were a small library that I could grab off the shelf for this, and it would have saved me some minutes… Today is the day I write that simple library!

Read more

SMWCon 2021, Development environments using containers

SMWCon 2021 is happening as I write this post. I was invited to give a short talk as part of a MediaWiki and Docker workshop organized by Cindy Cicalese on day 2. As I am writing a month of blog posts I’m going to turn my slides into a more digestible and searchable online blog post.

The original slides can still be found on Google Slides, and when the conference recording is up you should find it on the associated event page.

Disclaimer

Read more