Mediawiki Forms to present and edit data with key-value structure

Have you been working with tables in Mediawiki? It is a somewhat gnarly process. The mediawiki markup for a small example table is like this:

{|
|Orange
|Apple
|-
|Bread
|Pie
|-
|Butter
|Ice cream
|}

The result on the Mediawiki article will then be shown like this:

Orange Apple
Bread Pie
Butter Ice cream

This is fine with small tables, but when they grow in length, it’s getting more difficult to edit.

With Mediawiki Forms, you can add functionality so that you will get a HTML form to edit your data.

Here is an example that shows data being edited with a HTML form in Mediawiki. This makes it much easier for a user to add and edit data, compared to edit mediawiki table markup:

The downside of Mediawiki Forms is that it is slightly difficult to get started. One need to install this extension: https://www.mediawiki.org/wiki/Extension:Page_Forms

After that you have to create a template, then a form based on that template. In the process one also creates a category.

I recommend that one read this page carefully: https://www.mediawiki.org/wiki/Extension:Page_Forms/Quick_start_guide

and remember adding forms to a Mediawiki site might take you a bit more time than you might think.

It is worth it though, especially if you have spreadsheet like data in the form key-value that you like to have presented on the web, and at the same time want your users to easily add and change existing data in your wiki.

Good luck!

Searching and writing

How to do a good scientific search, and manage to write something that people will believe in? Here is a informational website that you should look into, it is really informative, and it will prepare and help you to write in an academic way so that people can understand.

http://sokogskriv.no

Good luck!

How to remove carriage-return character in multiple files

I was trying to move several PHP files from and old REDHAT5 server to new REDHAT7 server. What we saw was that in every file a ^M character was present.

This was ok on the old server, but everything crashed on the new server.

This is how I removed this carriage-return character from every file:

First find all php files:

find . -type f -name '*.php'

then use sed to replace each character:

sed -i 's/\x0d/\n/g'

All put together:

for i in `find . -type f -name '*.php' | sed 's/\.\///g'`; do echo "sed -i 's/\x0d/\n/g' " $i; done

The command above will print out the necessary commands that you can run directly:

sed -i 's/\x0d/\n/g' finnfeleskrin.php
sed -i 's/\x0d/\n/g' search_oeld.php
sed -i 's/\x0d/\n/g' litt_test.php
sed -i 's/\x0d/\n/g' finnfele.php
sed -i 's/\x0d/\n/g' manager/bibliografi.php
sed -i 's/\x0d/\n/g' manager/list.php
sed -i 's/\x0d/\n/g' manager/linklist.php
...

or send them to a bash script. For instance:

for i in `find . -type f -name '*.php' | sed 's/\.\///g'`; do echo "sed -i 's/\x0d/\n/g' " $i; done > runme.sh; ./runme.sh

git-cola in Windows 7

I have Windows 7 on my computer, but needed to run a git gui tool for our project. Searching on Google I found several, but they all were software for Linux. We have plenty of Linux Redhat servers, but no one running X window.

I installed then a Xming X server (http://sourceforge.net/projects/xming/) on my Windows 7 computer, and by configuring Putty (also a Windows program) and the sshd_config on the Linux server I could run git-cola and other Linux software in my Windows enviroment:

git-cola3

Putty configuration:

Connection -> SSH -> X11:

Enable X11 forwarding = true

X display location: location:0.0

 

Linux Redhat server configuration:

X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

 

Also I noticed if I changed to another user in Putty (SSH) with:

sudo su –

then I wouldn’t be able to forward any X program. So, just after loggin in to the server in Putty with SSH, I had to start the program right away:

 

 

References:

 

 

 

Vim (Vi improved)

Vim is an editor on Linux and Unix systems.

Tip 1:

If you like to add “softwrap”, you can do this:

:set wrap linebreak nolist

then lines will be wrapped per word.

If you like to cut and paste a section:

Press v to start selecting. Move the cursor to the end of selection (up or down). Den press d to cut. Move cursor to destination, press P to paste the text you have selected.

Tip 2:

If you have a file with millions of lines, and you need just a chunk out of it, starting at one point, ending at a certain line, you can first open the file in VIM:

vim filename

Then set line numbers:

:set number

Then find your first line. Most likey you will scroll, or search inside your file. Write down the line number.
Then find you second line number. Then you can write all lines to a new file with:

:6446324,6590789w newfile

where 6446324 is the first line number, 6590789 is the last line number. “newfile” is the new file that will contain all lines between 6446324 and 6590789.

More interesting stuff can be found here:

http://vim.wikia.com/wiki/Vim_Tips_Wiki