Sunday, August 29, 2010

SA police, the media and defeating the ends of justice

Media attention has recently been focussed on proposals to exert greater control over it. The proposals include a “media tribunal” and the new Protection of Information bill. In contrast to this concern government agents have defended the proposals as necessary for state security and fairness . Chief spokesman Themba Maseko recently declared that "there is no intention or plan to muzzle the media in any shape or form”, However with attention directed on the explicit attempts to control the “fourth estate” media representative have seemingly been blind to more in insidious moves by the state.

These moves include using existing legislation to achieve the effects envisaged, for example, by the new Protection of Information bill. This bill seeks to criminalise journalists for being in possession of “sensitive” documents that may have been leaked to them. However the recent arrest of Sunday Times journalist Mzilikazi Wa Afrika for, it seems, being in possession of a “fraudulent letter of resignation” suggests that the SA Police Force is already treating the mere possession of sensitive documents as criminal. The initial charges against Afrika were “fraud” and “defeating the ends of justice”.

Although the charge of “defeating the ends of justice” was later dropped in favour of one of “utterance” the fact that this charge was used at all is of concern. “Defeating the ends of justice” is a somewhat vague charge relating to efforts to subvert the judicial process by intimidating witnesses or destroying evidence. If media coverage is anything to go by until recently those charged with the offence were invariably police staff. Examples include Jackie Selebi, the station commissioner who tampered with the drunk driving evidence against Tony Yengeni, former crime intelligence boss Mulangi Mphego and the then head of the Scorpions Gerrie Nel. By contrast it is difficult to find, prior to the appointment of Bheki Cele, reference to the charge being lodged against people outside of the criminal justice system.

In a dramatic departure from this tradition this law is increasingly being used against journalists. In the past two months at least two journalists have been arrested and brought to court for “defeating the ends of justice”. The most recent instance is that of Afrika. In the previous month english journalist Simon Wright faced the charge. The charges against Wright stem from his cloistering of soccer fan Pavlos Joseph in a hotel. During the world cup Josephs entered the English football teams' dressing room to reprimand them for their poor performance. Wright, in his enthusiasm for securing an exclusive interview, booked Josephs into a hotel under a false name. This gave rise to the accusation of him attempting thwart justice from prevailing in Josephs' case. In these instances the veracity the “defeating the ends of justice” charge was justified largely by the vagueness of the allegation. The severity of the charge was aggravated by SAPS intimating, in both instances, that the offences constituted part of a wider conspiracy. The alleged conspiracy, coupled to the vagueness of the charge, invited wild speculation as to what the actual misdeed was.

In court the merits of the “defeating the ends of justice” charges were illustrated by the rapidity with which they were dismissed. The dropping of this charge reflect, on the one hand, the historical difficulty in securing such a conviciton – as was demonstrated in the cases against Selebi , Nel and Mphego. On the other hand the message to journalists remains clear - the police are increasingly prepared to use this charge against them precisely because of the opportunities afforded by its vagueness.

The common theme in both these cases is that the journalists had recently embarrassed the SAPS. Afrika had just accused police head Beki Cele of signing a R500-million lease without observing the required procedures. Wright had pointed out the ease with which a fan could wander into a key area secured by the SAPS. Could it be that the arrests were to punish this behaviour rather than any overt criminal act?

In a short period “defeating the ends of justice” has come to be associated less with tampering with evidence or bribing witnesses and more with journalists publishing the true face of the police.

The extent to which the police hereby undermine the fourth estate is the extent to which they may not need the full measure of the Protection of Information bill. What their action does show is that, assurance that "there is no intention or plan to muzzle the media in any shape or form” aside, the state seeks to cow the media irrespective of whether or not the Protection of Information bill is passed in its current form. Those who view the proponents of the protection of information bill as naïve but well intentioned people operating a bit out of their depth should wake up. In this one regard the writing (on the wall) is getting clearer.


WOL (wake-on-lan) over the Internet

You learn about internet sites that allow you to use wake-on-lan (WOL) over the Internet and have a wake-on-lan (WOL) enabled PC. You now reckon you can wake your home PC from a remote internet location. From that location you can then use SSH, telnet, or tightvnc to access your  PC subject, of course,  to the limitations of internet speed.  When you try this you will soon discover that it does not work.

Unfortunately WOL requires that at least part of a  LAN must be awake.  If you put your PC off it, to all intents and purposes, ceases to exist on the web. Under these circumstances the WOL-over-internet providers like www.depicus.com and www.wakeonlan.me will work for up to 30 minutes after you powered off. This is obviously not what is needed.

However your ADSL router is part of your home LAN and it remains on all the time. So to use WOL over the internet you need to set things up so that  your ADSL router can send a "magic packet" to  the PC. This magic packet will then wake the PC. To do this the following must happen.

1) Your motherboard and the relevant network card needs to support WOL.

2)  You must be able to "http" into your ADSL router from a remote location.

3) You must be able to administer remotely (in order to send the WOL packet)

 4) You must be able to tell the router what the IP and MAC addresses of the network card are.

4) Your router must be able to send a WOL "magic packet" to that address.


In detail:

1) is a no-brainer. Either your PC does WOL or it doesn't.  If it does use the BIOS setting to enable WOL. This usullay requires you pressing some key (usually DEL) before the computer boots.

2) The usual way of changing router settings is via your browser. For example, my Linksys WAG2000 requires that I go to http://192.168.1.1 and enter the username and password written on the underside of the router. However this address only works if the PC is linked directly to that router.

To be able to link to the router remotely (i.e. form elsewhere on the internet) you need to subscribe to a service like "DynDNS.com" or "no-ip.com". These two services are free and provide you with a domain name that you can use to http into your router from anywhere. After obtaining your address make the appropriate changes on your router and reboot it.

There are two changes that need to be made.

1) The router must be told that you are using a DNS system like DynDNS. On the Linksys this is under Setup - DDNS. This links your router to a fixed ip address like mine (maodonovxxx.yyy.zz).
2) The router must be enabled for remote adminstration. On the Linksys this is under Administration - Management - Remote Gateway Access. All you have to do is enable the facility and record the port number.

Once you have saved the settings and rebooted your router  you can access it via secure http. In my instance is go to

https://maodonovxxx.yyy.zz:8080

NOTE there is a "s" in the address above.

Remember to change your router password to something different from the default. If I had not done that  you could http into my router and change my settings.

3) To access the WOL network card from the router you have to be able to identify it by IP and Hardware address (MAC). On a linus (Debian) system you would (as superuser) run ifconfig. My system says for network card eth0:

eth0
Link encap:Ethernet  HWaddr 00:21:85:61:da:9e
inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0

inet6 addr: fe80::221:85ff:fe61:da9e/64 Scope:Link

UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:11415 errors:0 dropped:0 overruns:0 frame:0
TX packets:9971 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000
RX bytes:9922062 (9.4 MiB)  TX bytes:1663804 (1.5 MiB)
Interrupt:250 Base address:0x4000



(On Windows run ipconfig.)

Note your inet addr (the IP), Bcast (Broadcast),  HWadd (i.e. the MAC) and Mask.

If you are using a dynamic addressing system (DHCP) the IP address will change regularly and you will not know what IP address to enter. So use a static address  for the hardware card. On linux (Debian) systems you will do this by editing /etc/network/interfaces. On Windows you will presumably be able to change the settings by right clicking on the network card.

If you do not know what setting to use try those published after running ifconfig (*nix) or ipconfig (Windows). Remember to restart your network (Debian uses "/etc/init.d/networking restart")

 
4) Theoretically you could now http into your router from the internet and issue a wake-on-lan command to the IP and MAC address you just set. However chances are that your router has not provided any WOL facility. This is certainly the case for Cisco and Netgear. Fortunately the OpenSource community has provided the required software for many routers, This software is model specific so do not use software for another brand or model router.

Relevant sources are:
Netgear             http://dgteam.ilbello.com/
Linksys              http://sourceforge.net/projects/openwag200/
Other routers   http://openwrt.org or  http://google.com



The process of installing the software is one of downloading a zipped/ compressed file, uncompressing it and then updating the "firmware" on the router. Your router will already have  update facility. Although flashing your router is simple read the instructions (and warnings) provided. Although the upgrade preserves settings it does make sense to back them up to your hard drive first.


Once flashed and rebooted you can http into the router. You will now have a new menu item under which various new services are listed. On OpenWAG (used for the LinkSys WAG200) it is - "MySetup".

Negotiate your way to the WOL facility. On OPenWAG it is under:

MySetup - other -  Wake on LAN Interface.

Here you enter the MAC address (from ifconfig/ipconfig) and the IP address. This is the IP address of your LAN  and not the IP provided by no-ip or DynDNS.  In my case it is 192.168.1.4.

Press "save" and a magic packet is sent to the PC powering it on.

..... thats it

Sunday, June 20, 2010

Weighted mean: tapply

To obtain weighted means for categories of a dataframe use has to be made of
a) the tapply function and
b) the weighted.mean function.

The information required for the tapply component is:


"lll" -  a list of the rows to which the function must be applied
"rrr" - the categories over which the function must be aggregated
"function(i, x, w,)...." - the function to apply. In this instance the 'weighted mean'.

The info required for the weighted.mean component are 'x' (the values to be weighted) and 'w' (the weights).

The general form is:

tapply(seq(along=lll), rrr, function(i, x, w) weighted.mean(x[i], w[i]),x=lll, w=ttt)

An example of weighting incomes ("incval") by frequency counts ("worker_wgt") for each "tbvc" category is:


tapply(seq(along=incval),tbvc, function(i, x, w) {weighted.mean(incval[i], worker_wgt[i],na.rm=T)})

Obviously this is done after attaching the relevant dataframe.