MediaWiki Hastags

Been playing around with my local MediaWiki. Since I couldn’t find an extension to use tags for Categories, I created my own one. You can find the code on my Github page.

Inspired by the plugin by Jeroen de Dauw

It’s easy to install.

  • Download the files from GitHub
  • Put them in a folder called Hashtags in the Extensions folder of your MediaWiki
  • add the following to your Localsettings.php
    require_once( “$IP/extensions/Hastags/Hastags.php” );

Now when you save your articles it will work for you

#Hastag to [[Category:Hastag]].
@Article to [[Article]]
&file to [[File:file]]

That’s it!

Feel free to use it. MIT License applies.

 

Fun with properties

So this is the new lazy way to declare a class for storing data… well not yet maybe, but soon.

class Person(string Name, int age, int shoesize);

and to think of that it was not long ago this was considered bad and lazy coding

internal class Person
{
public string Name { get; set; }
public int Age { get; set; }
public int ShowSize { get; set; }
}

After all, this is the what happens when you use that code


internal class Person
{
private string _name="John Doe";
private int _age=55;
private int _shoeSize;

public string Name
{
get { return _name; }
set { _name = value; }
}
internal int Age
{
get { return _age; }
set { _age = value; }
}
public int ShoeSize
{
get { return _shoeSize; }
set { _shoeSize = value; }
}
}

But then… nowadays you can write it this way…

internal class Person
{
private string _name="John Doe";
private int _age;
private int _shoeSize;

public string Name { get => _name; set => _name = value; }
internal int Age { get => Age; set => _age = value; }
public int ShoeSize { get => _shoeSize; set => _shoeSize = value; }
}

or

internal class Person
{
public string Name { get; set; } = "John Doe";
internal int Age { get ; set ; }
public int ShoeSize { get ; set; }
}

Ok, so I wrote this mostly to remind myself in the future of different nice ways to write simple classes with only properties.