WordPress Meetup Presentation: Decentralized Social Networking with WordPress

Wpvie Friends

This is the presentation I held yesterday, November 7, 2018, at the WordPress Meetup Vienna about the Friends Plugin.

I created this presentation with Deckset which allows to generate the presentation from a Markdown file.

Veröffentlicht unter web

Decentralized Social Networking with WordPress

Over the past year, I've been working on the side on a WordPress plugin that implements an idea that has been growing in me over the last couple of years. Decentralized Social Networking. The plugin that does it is called Friends.

Starting with the frustration that there are few alternatives for people who use Facebook: if you don't want them to own your data but still want to privately keep your friends and family up to date about your live and discuss what interests you, where do you go?

I realize that many people just switched to instant messaging (like WhatApp) which does allow exchanging private messages (and photos) with your friends, but overall I do like the idea of having a more structured publishing platform. I just don't like a single entity to control it all.

So I realized: We actually had an alternative all along: blogging.

Blogging is decentralized: you decide where you host, you decide which blogs you read and nobody really knows which ones you have subscribed to.

What disqualifies it as an alternative to my wish to keep friends and family up to date, is that it public by default. While there is the option to publish something as „private," there is not a lot you can then do with a privately published post.

So what if you were easily able to give your friends access to your private posts?

Here comes the Friends plugin. And with it, the downside to the solution:

You need to have your own blog to become friends with each other.

Right now, this is only implemented on WordPress, the technology is framework agnostic, though.

Your friends get their own user on your blog. Here my request is still pending.

When everyone involved has their own blogging platform and they'd decide where they want to host, we automatically get a decentralized platform.

The technological ingredients to this are actually pretty old:

  • RSS
  • REST API
  • Authentication via keys

After friendship has been established (this involves both parties accepting friendship and exchange private keys in the background), your server will use that key when requesting your friend's RSS feed which will in turn (since you are friends) contain private posts. And vice versa.

For commenting, you'll go to your friend's blog, it's a one-click-authentication away. This can also eliminate spam if you only allow friends to comment on your posts.

All of this is highly compatible with standard WordPress: if you want to accept a friend request on your mobile phone, use the WordPress iOS or Android app and change that user's role to „Friend."

Chicken-and-egg problem: I use a social network because all my friends are there.

So why use a social network that not all of your friends use (yet)? Because the Friends plugin is actually a pretty decent way to consume RSS feeds.

Since it is based on RSS, it means you can also subscribe any blog or website that offers this well-established way of distributing content.

As you are in control of the server, you can also decide what you're interested in and tailor the feeds to your liking: you can define rules for incoming feed items and ignore posts you know you won't be interested in.

I personally like to consume notifications via e-mail as it provides read/unread functionality and I can sort and categorize e-mails to my needs. You can now also read your friends' posts (or subscriptions) via e-mail. But you don't need to.

Another method to view your friend posts and subscriptions is the „Friends Page," a timeline of friend posts and subscriptions. You can therefore scroll down the list of your friend's posts and subcriptions, just as you see it people doing it all the time on Facebook.

Read your friends' posts on the Friends Page

There is quite a bit more to this, you can Emoji react to a post, recommend it specifically to friends, have sections in your posts for friends/not-friends, and more.

Overall, I see this as a way to take blogging to the next level: Choose your private audience. Choose where you host. Publish publically if it's meant to be public.

It's clear that setting up and having your own blog is not (yet) for everyone. It's more work than just signing up for some social network. Often you'll need to pay for hosting (and domain). But it also gives you the freedom to take your data somewhere else if you want to. Or delete it.

We'll have to see who will use this. As of now, it's for a technical audience but maybe someday there will be dedicated Friends-WordPress hosting?

The Friends Plugin is open source under GPL2. If you have a WordPress blog, try it out, and if you think this could be better, different, enhanced: create an issue, or better: create a patch and send a pull request.

Probably it's not ready for prime time yet, we're at version 0.14. But it's getting there, at least I am already using it daily :) There are many ideas left to be implmented, and these are only mine so far.

Oh, if you happen to be in Vienna coming week, I'm going to talk about Decentralized Social Networking with WordPress at our WordPress meetup on November 7, 2018.

November WordPress Meetup Vienna

Wednesday, Nov 7, 2018, 6:30 PM

CodeFactory Vienna
Kettenbrückengasse 23/2/12 Wien, AT

29 People Attending

Schedule 18:30 | Arrival, Registration 19:00 | Welcome & Introduction 19:15 | Alex Kirk – Decentralized Social Networking with WordPress 19:45 | Break 20:00 | Harry Martin – Hello to 5.0, a first look at the next major release and the new theme Twenty Nineteen 20:30 | Socialising! 21:00 | Leaving CodeFactory, maybe for drinks somewhere close by __…

Check out this Meetup →

Veröffentlicht unter web

Fixing WhatsApp image dates after Android Migration

Recently I've had the issue to have a completely unsorted Photo Library in Android after migrating to a new phone. The reason is that WhatsApp images are copied into internal storage and end up with the last modification date when they were copied, thus conglomerating together when they should be spread out over time.

The problem is not that trivially to solve because you cannot mount internal storage into a computer and then modify the file dates. Thankfully, I was still able to create a viable solution using a bash script.

It all revolves around the Android Terminal Emulator Termux which allows you to execute scripts on your phone.

  1. Install Termux .
  2. Grant Termux access to your storage directories.
  3. Install core tools apt install coreutils
  4. Copy this script into your file tree (for example via Android File Transfer):
for f in IMG-20* VID-20* AUD-20*; do
    [ -e "$f" ] || continue
    NEWDATE=`echo $f | cut -c5-8`-`echo $f | cut -c9-10`-`echo $f | cut -c10-11`
    echo touch -d $NEWDATE "$f"
    touch -d $NEWDATE "$f"
done
  1. Run the script in the directories you need to fix file dates (for example in /storage/emulated/0/WhatsApp/Media/WhatsApp Images)
  2. Delete the data of MediaStorage (and maybe reboot) to make Android re-index the files with the new file dates.
Veröffentlicht unter web

Stack Overflow: Ways out of the negativity

This is in response to the Stack Overflow Meta question: Why is Stack Overflow so negative of late?

In my opinion the problem that Stack Overflow is currently facing is caused by a lot of new users that are characterized by user Mysticial as "help vampires". They care nothing for the site and just want their code fixed. They don't research (or very little) and provide less than the minimum information needed. Most of the times the questions are very basic and can be answered by an intermediate programmer in a few minutes.

In a normal forum, users would not yield any responses. Not so on Stack Overflow: you get reputation for answering questions and therefore even theses badly researched questions get answers within under a minute. Mystical calls these users "reputation whores".

The problem is that "help vampires" and "reputation whores" create a vicious circle: they both need each other and therefore the circle continues to spin.

The outcome of this situation: the site is flooded with a high number of low quality questions, experienced programmers who are interested in learning something don't see the forrest for the trees. Even though questions can be voted up, they don't stand out enough to gain momentum.

Proposed Solutions

a) Create a "beginners test"

This would create a higher burden for low reputation users before they can ask their question. They need to invest more time and rethink their action before they get to post something.

A few ideas what that could be:

  • The user needs to give 3 search queries that he used either on Google or on Stack Overflow that didn't yield results.
  • If they don't include any code, they must confirm that they are asking a non-code question. See this proposal on Stack Exchange Meta.
  • Specify the time that they took to research the problem (while this can be easily faked, it makes the user reconsider if they had taken enough time for the problem)

b) Have experienced users review a question, before it goes online

There would be a process where a new user asks his or her question, but it doesn't go online. Higher reputation users read the question but are unable to answer it, and give feedback if the question has enough information or has been researched enough. Finally, the question get's thrown into the shark tank.

It would be fine to give these reviewing higher reputation users even more reputation for reviewing this: they are helping to improve the site, this is actually what the reputation system has been designed for: to make the site interesting, not for feeding the "help vampires".

All in all it is remarkable that despite the current situation, Stack Overflow has reached the quality it has. The reputation and badge system has for sure been a very big factor in this but it is very appalling that in order to reach a certain reputation level, you really have to feed the "help vampires".

You can find me on Stack Overflow as akirk.

Veröffentlicht unter web

Fix qTranslate with WordPress 3.9

When updating a blog of mine to WordPress 3.9 the page wouldn't load anymore because of qTranslate not able to cope with the update. In the error log it says:

PHP Catchable fatal error: Object of class WP_Post could not be converted to string in ../wp-content/plugins/qtranslate/qtranslate_core.php on line 455

The error is caused by this change: get_the_date() to accept optional $post argument

There is a proposed quick fix by Saverio Proto, but it doesn't take the problem at its root:

qTranslate registers the function qtrans_dateFromPostForCurrentLanguage($old_date, $format ='', $before = '', $after = '') for the hook get_the_date but it actually only accepts one parameter. With the new update it accepts a second parameter $post, which now wrongly fills the variable $before that is in the process being converted to a string.

So the solution simply is to delete the two parameters that were assigned the wrong meaning and have defaults anyway.

Veröffentlicht unter web

Thinkery API launched

Just a quick note, we made the Thinkery API public.

If you don't know thinkery.me, it is a simple yet powerful tool for storing both notes and bookmarks. The contents of the saved page is stored in your Thinkery which you can keep even if the webpage goes down. With #hashtags you can easily categorize everything.

Check it out!

Veröffentlicht unter web

Genial Daneben Analyse

Zur Abwechslung mal ein Post auf deutsch. Ich bin Fan der (inzwischen abgesetzten) Fernsehsendung Genial daneben. Es gibt da eine Genial Daneben Datenbank mit (nahezu) allen Fragen, die in den Sendungen vorkamen. Ohne konkreten Nutzen habe ich diese Daten aus der Text-Form in eine echte Datenbank konviertiert (Script hier) und bin zu folgender Tabelle gekommen. Für alle die es interessiert:

Fragen: 2732 (1087 beantwortet, das sind fast 40%)

Teilnehmer Teilnahmen gelöst gelöst pro Teilnahme
Bernhard Hoecker 399 223 0.56
Hella von Sinnen 390 202 0.52
Wigald Boning 120 56 0.47
Guido Cantz 96 51 0.53
Barbara Schöneberger 62 14 0.23
Dieter Nuhr 62 18 0.29
Bastian Pastewka 62 6 0.10
Ralf Schmitz 60 6 0.10
Oliver Kalkofe 55 6 0.11
Herbert Feuerstein 47 25 0.53
Georg Uecker 39 13 0.33
Olli Dittrich 38 11 0.29
Oliver Welke 37 11 0.30
Ingo Appelt 32 8 0.25
Martin Schneider 31 0 0.00
Michael Kessler 29 6 0.21
Thomas Hermanns 27 7 0.26
Anke Engelke 26 8 0.31
Matze Knop 23 2 0.09
Christoph Maria Herbst 20 3 0.15
Mario Barth 20 8 0.40
Jürgen von der Lippe 19 3 0.16
Lou Richter 19 7 0.37
Ingo Oschmann 13 2 0.15
Guildo Horn 13 1 0.08
Dirk Bach 12 3 0.25
Kim Fisher 12 1 0.08
Urban Priol 10 2 0.20
Cordula Stratmann 9 0 0.00
Eckart von Hirschhausen 9 0 0.00
Tetje Mierendorf 8 0 0.00
Oliver Pocher 8 0 0.00
Bodo Bach 8 0 0.00
Hennes Bender 7 1 0.14
Rüdiger Hoffmann 7 0 0.00
Elton 7 1 0.14
Johann Köhnich 7 0 0.00
Bürger Lars Dietrich 7 2 0.29
Helge Schneider 7 7 1.00
Anka Zink 6 0 0.00
Hans Werner Olm 6 0 0.00
Cindy aus Marzahn 6 0 0.00
Kaya Yanar 5 2 0.40
Mike Krüger 5 2 0.40
Horst Lichter 5 2 0.40
Susanne Pätzold 5 1 0.20
Jochen Busse 5 1 0.20
Karl Dall 5 0 0.00
Mirja Regensburg 4 1 0.25
Oli Petszokat 4 2 0.50
Janine Kunze 4 0 0.00
Michael Mittermeier 4 0 0.00
Paul Panzer 3 0 0.00
Florian Schroeder 3 0 0.00
Konrad Stöckel 3 2 0.67
Axel Stein 3 0 0.00
Gayle Tufts 3 1 0.33
Verona Pooth 3 1 0.33
Zack Michalowski 2 0 0.00
Atze Schröder 2 1 0.50
Emily Wood 2 1 0.50
Susanne Fröhlich 2 0 0.00
Gabi Decker 2 0 0.00
Helfried 2 1 0.50
Mirja Boes 2 1 0.50
April Hailer 2 0 0.00
Michael „Bully" Herbig 2 1 0.50
Roberto Cappelluti 2 0 0.00
Olaf Schubert 2 0 0.00
Sissi Perlinger 2 0 0.00
Ottfried Fischer 2 0 0.00
Klaus Eberhartinger 2 0 0.00
Rick Kavanian 2 0 0.00
Lisa Feller 1 0 0.00
Sascha Korf 1 0 0.00
Marc Metzger 1 0 0.00
Joachim Fuchsberger 1 1 1.00
Martin Klempnow 1 0 0.00
Tom Gerhard 1 0 0.00
Ralph Morgenstern 1 1 1.00
Valerie Bolzano 1 0 0.00
Kurt Krömer 1 0 0.00
Hubertus Meyer-Burkhardt 1 0 0.00
Smudo 1 1 1.00
Badesalz (Gerd Knebel und Hendrik Nachtsheim) 1 0 0.00
Markus Maria Profitlich 1 1 1.00
Sven Nagel 1 0 0.00
Bernd Stelter 1 0 0.00
Matthias Matschke 1 0 0.00
Otto Waalkes 1 0 0.00
Till Hoheneder 1 0 0.00
Waldemar Hartmann 1 0 0.00
Lisa Fitz 1 0 0.00
Fatih Cevikkollu 1 0 0.00
Matze Knop (als Franz Beckenbauer) 1 0 0.00
Ralf Morgenstern 1 0 0.00
Ulrike von der Gröben 1 0 0.00

Ich habe den Großteil der Daten nicht überprüft, aber im Groben dürfte es stimmen.

Veröffentlicht unter web

Android WebView: Web page not available

Just a quick note in order to save someone else searching for a solution to this problem.

When you want to display HTML content in an Android WebView do it like this:

String html = "my >b<HTML content>/b<. 100% cool.";
WebView webView = (WebView) findViewById(R.id.myWebView);
webView.loadData(">?xml version=\"1.0\" encoding=\"UTF-8\" ?<" + html.replace("%","%25"), "text/html", "UTF-8");

If you don't replace the % to its url encoded equivalent you will get a „Web page not available". Simple, arguable but not at all apparent.

Veröffentlicht unter web

Git tip: Changing your mind: Push pending changes to a (not-yet existing) new branch

It happens quite often to me that I start committing things and only afterwards decide I should have created a new branch.

So git status says something like:

Your branch is ahead of 'origin/master' by 4 commits.


but I don't want to push to origin/master but rather create a new branch. (Of course this works for any other branch, not named master)

So you can use this sequence of commands:

git checkout -b newbranch
git push origin newbranch
git checkout master
git reset --hard origin/master

Explanation: This…

1. creates a new branch pointing to the current changes (and switches to it)

2. pushes this new branch including the changes to the server

3. switches back to the branch master
4. and undoes the changes that were made locally

The important thing to know is that the changes remain in the repository because a branch is merely a pointer to a commit.

Afterwards you can continue to commit to master, for example:

(screenshots done with a fork of gitx)

Veröffentlicht unter web