
Posted from Instagram
Category: General
MediaWiki Statistics and Panic’s Status Board
I’m a big fan of Panic Inc. I use Coda daily and am an advent follower of the smart dudes out of Portland.
They have a new app out called Status Board that allows you to mix different data sources to provide at-a-glance information on your iPad. What is even better is that it can output to a HD display for big screen status board updates.
At work I help manage a MediaWiki environment that we use to document stuff.1 Lately I’ve been trying to figure out how to leverage the MediaWiki API and the External Data Extension to manipulate data from external sources and content within the wiki.
With a few minutes time I figured out how display statistics from MediaWiki on a Status Board!
Basically I use the MediaWiki API to return some XML into a wiki page. That page is then in turn included as an HTML widget in Status Board. The result is something that looks like this:

Here’s the secret sauce. First create a wiki page to house your content. Then use the #get_web_data function of the External Data extension to pull in a xml feed from the MediaWiki API. Here’s what my code looks like for query of the number of jobs currently in queue.
{{#get_web_data:
url=http://yourwiki/wiki/api.php?action=query&meta=siteinfo&siprop=statistics&format=xml
|format=XML
|data=Jobs=jobs,Pages=pages
}}</pre></pre>
<div style="width: 100%; text-align: center;">42px;">Jobs in Queue</div>
<pre>
74px;">{{#external_value:Jobs}}
<pre>
Then in Status Board enter in the address for your wiki page using the &action=render2 attribute.
http://yourwiki/wiki/index.php?title=wikipagetitle&action=render
Some other examples, as you can see in the screenshot above, are a list of the N newest articles, most recent edits, or even additions to specific categories (at the bottom). The sky is the limit!
Stop Content Manager Assistant from Automatically Starting at Login
Sony has this nice little utility for the PS Vita that allows you to sync and backup your content. It’s called Content Manager Assistant (CMA).3 It runs as a menubar item on your Mac (or a taskbar item on Windows) and after initial setup the interaction is managed from the PS Vita itself. You can back up your entire PS Vita, sync music and photos, and the whole thing works over USB or Wi-Fi. Pretty neat.

As a Playstation Portable owner I was happy to hear that they have a native Mac client. Back in the PSP days we had to hike both ways uphill in the snow with third-party software to sync content to our Macs.4
However – oh, you knew this was coming – there is an issue with how the application is installed. By default, and with no way to change this setting via the application’s preferences, it will run at login for all users. Trying to remove the login item via the Users & Group preferences pane will prove frustrating.

WTF Sony.
Here’s how to remove this. Note: if you update or reinstall CMA, you’ll have to do this all over again. Yay!
First navigate to the “Macintosh HD/Library /Preferences” folder and look for a file called ‘com.apple.loginitems.plist‘. This is not the same as your User directory (~/Library/Preferences). You should be able to open it with something like TextWrangler.5

If the only entry you see in the entire file is for Content Manager Assistant or CMA.app feel free to just delete the file. You’ll be prompted to enter your admin username/password to remove the file.
Update: SkatyGarcia on Reddit schooled me on a much better way to remove CMA from startup. Instead of all the mumbo-jumbo I describe above, instead click the ‘unlock’ icon in the lower left of the Users & Group preference pane. Enter your admin password and then you can remove CMA from the list. Much more logical than my directions.
Restart your Mac, check the Users & Group preference pane and curse the developers at Sony (nicely, they did make an otherwise useful app).
I hope this helps regain some control and relieve some frustration for other Mac/PS Vita folks out there in Internetland.
Creating a Navigable list of Property Values in Semantic MediaWiki
Update: I tweaked the code after posting this. It’s been updated to reflect my working solution!
One of the great things about Semantic MediaWiki (SMW) is the auto-generated fact box at the bottom of any wiki page that has any values for semantic properties.

It’s also relatively easy to create a list of all defined values for a given property. In fact, this idea uses this template as a basis for what follows.
However, I found that it’s not very intuitive to navigate to a list of all values of a property and see what other articles have that same property value. In order to see a list of all articles that have a particular property value you’d have to navigate to an existing page with that property and then perform a semantic search from there. Or know that there’s a page called Special:SearchByProperty that you could use.

I wasn’t satisfied with that, so I made a fancy list that’s actually really easy to implement and can be used across an entire SMW for other property values too.
The result is a list of all values for a given property that provide hyperlinks to a list of all wiki articles with that property value. It uses the Special:SearchByProperty page for displaying results.
First, I created a template called Property Values Columns. You can use it like so:
{{Property Values Columns|<em>Name of Property Here</em>}}
Here’s the contents of the “Property Values Columns” template6:
<noinclude>Use this template to list all the unique values for a given property.
== Template code ==
</noinclude><includeonly>
*{{#arraymap:
{{#arraydefine: valued
|
{{#ask: [[{{{1|}}}::+]] | mainlabel =- | headers = hide |? {{{1|}}} | limit = 10000|searchlabel= }}
|,| print=list, sort=asc, unique}}
|,|@@|[[Special:SearchByProperty/{{Space|{{{1}}}/@@}}{{!}}@@]]|
<ul>
<li>}}</li>
</ul>
</includeonly>
This is what it does.
1. Gets a comma separated list of property values for whatever property you’ve requested.
2. Parses the name of the property and each unique value to build a URL.
Example: http://wikiname.com/wiki/index.php/Special:SearchByProperty/Property Name/Property Value
3. The secret sauce is another template called ‘Space’ which uses the #replace function to replace all spaces ” ” with the “-20” syntax used in the Special:SearchByProperty query.
3a. The “Space” template contains the following:
{{#replace:{{{1}}}| |-20}}
4. Return the results as a series of list items.
The result is an list of all unique property values that when clicked will query the wiki for all pages containing that property value. You can then use some custom styling to format the results. In the example below I wrapped the template in a div creating two columns.7
<div class="twoColumns">{{Property Values Columns|Accounting Unit}}</div>

Pretty cool huh?
#%*#!@! Bike died on the way to work.

Posted from Instagram