Tracking MediaWiki External Links Statistics Using Google Analytics

When you track MediaWiki statistics, you usually track only internal page statistics, but tracking external links that lead out of your site is not something you can ignore. Unfortunately, we probably can’t put actual tracking code in the pages linked to by our site’s external links. Fortunately, we can track the actual clicks on those links that lead out of the site, and it’s quite easy to do when tracking statistics with Google Analytics. If you don’t already use Google Analytics with your MediaWiki site, open a new account in Google Analytics and see my previous post: Track MediaWiki Statistics using Google Analytics.

Continue reading Tracking MediaWiki External Links Statistics Using Google Analytics

Track MediaWiki Statistics using Google Analytics

Google Analytics is one of the best free web-statistics services available. It’s also quite easy to use with MediaWiki. To install Google Analytics in your MediaWiki, you should put the tracking code, which is something that looks like:

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct="UA-xxxx-x";
urchinTracker();
</script>

in every page, preferably just above the </body> tag. The best way to do so is to put the tracking code inside the base skin PHP file. That means that unless you changed the default skin for MediaWiki, you need to edit /wiki/skins/MonoBook.php. In this file, you will find the </body> tag towards the bottom of the file. Insert the tracking code just above it, save the file, and you’re done, as all pages will now show the script. Google Analytics will start gathering statistics usually in about 24-28 hours.

Update: If you also want to track external links to files and other websites, take a look at Tracking MediaWiki External Links Statistics Using Google Analytics.

Installing IvriTeX-1.2.1 on teTeX-3.0

A few days ago, I finally decided to install IvriTeX-1.2.1 on my system. I’m running teTeX-3.0. The new version of IvriTeX includes some very important improvements and, at least for me, the most important thing is support for the Culmus fonts. teTeX-3.0 introduced a major directory change, which causes many problems when installing packages that are unaware of the changes. In this post, I will try to walk through the installation process.

TEXMF will be the directory of your local TeX tree (usually /usr/share/texmf). Before beginning the installation process, make sure you have the Culmus fonts installed. Apparently, Culmus is not optional; it’s a requirement. I’ll assume that your Culmus fonts are installed in /usr/share/fonts/culmus.

  1. Download the IvriTeX-1.2.1 source code from here.
  2. Extract the archive into a temporary directory.
  3. Save the diff file below to a file named “Makefile_patch” and save it inside ivritex-1.2.1/fonts/culmus.
  4. Apply the patch by going to the ivritex-1.2.1/fonts/culmus directory (under the directory where you extracted the source archive) and executing “patch Makefile_patch”. The patch will alter the places where some files will be installed.
  5. As root, execute “updmap –enable Map culmus.map”.
  6. Still as root, execute “mktexlsr”.
  7. IvriTeX 1.2.1 should be installed now.
--- Makefile    2007-02-14 19:59:52.000000000 +0200
+++ Makefilenew 2007-02-16 10:11:07.000000000 +0200
@@ -20,8 +20,8 @@
 vf_target     = $(TEX_ROOT)/fonts/vf/culmus
 # this is where ivritex will eventually be:
 tex_target    = $(TEX_ROOT)/tex/generic/babel
-encode_dir    = $(TEX_ROOT)/dvips/base
-dvips_cfg_dir = $(TEX_ROOT)/dvips/config
+encode_dir    = $(TEX_ROOT)/fonts/enc/dvips/base
+map_dir       = $(TEX_ROOT)/fonts/map/
 sysconf       = $(DESTDIR)/etc
 updmap_dir    = $(sysconf)/texmf/updmap
 #culmus_target = $(PREFIX)/fonts/culmus
@@ -137,11 +137,11 @@
    mkdir -p $(sysconf)/texmf/updmap.d
    echo &quot;Map culmus.map&quot; &gt;$(sysconf)/texmf/updmap.d/10culmus.cfg
 else
-   mkdir -p $(dvips_cfg_dir)
-   cp culmus.map $(dvips_cfg_dir)/
+   mkdir -p $(map_dir)
+   cp culmus.map $(map_dir)/
   ifeq ($(tetex_ver),2)
    # this should run mktexlsr as well
-   $(updmap) --enable Map $(dvips_cfg_dir)/culmus.map
+   $(updmap) --enable Map $(map_dir)/culmus.map
   else # for tetex-1
     ifeq ($(tetex_ver),1)
    # TODO: fill in sed line here

Samba and Firewall Configuration

I’ve been using Guarddog as a GUI for iptables for some time. I’ve configured it to allow connections to Samba network shares, but for some reason it won’t allow me to connect to the shares without disabling the firewall first. The blockage happened despite the proper configuration in Guarddog. So today I decided to look at the problem again and fix it.

After inspecting the output of ‘dmesg’, I found out that it tries to connect to 192.168.2.255 (192.168.2.* is my network), which is the broadcast address for the network. I tried enabling connections to that address, and to my surprise this fixed the problem. I guess Samba, for some reason, requires access to the broadcast address for some name/address lookup of hosts in the network.

Prevent Line Breaking Inline Formula in TeX/LaTeX

If you ever wrote a document in LaTeX (or TeX) that used inline formulas, you know how frustrating it is when LaTeX insists on breaking your inline formula across two lines. The easiest solution to this problem, in my opinion, is to prevent line breaks in inline formulas at all except under extreme cases. To prevent line breaks in inline formulas, just add the following two lines to your preamble:

relpenalty=9999
binoppenalty=9999

Now I will explain what we did. relpenalty=[number parameter]: the parameter specifies the penalty for breaking a math formula after a relation when the formula appears in a paragraph. Plain TeX sets relpenalty to 500. binoppenalty=[number parameter]: the parameter specifies the penalty for breaking a math formula after a binary operator when the formula appears in a paragraph. Plain TeX sets binoppenalty to 700. Both parameters can be set anywhere from 0 to 10000. If set to 10000, the inline formulas will never break, even in extreme cases. Setting it a bit lower would prevent line breaking except where TeX would encounter extreme cases that must have a line break because of the situation.