Wednesday, 20 January 2016

Blocking ads on the Daily Telegraph

The Daily Telegraph has recently forced their subscribers (ie people who pay for the paper) to not use ad blockers while looking at the content they have paid for.

I am very happy to look at unobtrusive adverts but reading the Telegraph without an an blocker requires having to constantly dodge videos that pop up, often with sound.  I have tried it for a week and given up.

My answer - to fiddle with my adblocker and block the code that insists I watch their ads.

Adblock Plus on Firefox allows you to edit filters.

Left click the ABP logo.
Filter preferences
Custom filters
Ad Blocking Rules
Add filter

Add the following filters:

telegraph.co.uk##*#opaquer
telegraph.co.uk##*#modalDialog
||optimize.aws.telegraph.co.uk:3001/images/*
|http://www.telegraph.co.uk/template/ver1-0/i/tmglBody.gif

Click close.

You will lose the scroll bar on the page but the up and down arrows still works, so does clicking on the page with your centre button, and dragging up and down.

If you want to  restore the scroll bar, you need to install the Stylish Ad on  and add the following code

@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("telegraph.co.uk") {

body { overflow:scroll !important }

}


I suspect this may not work for long.

Thursday, 2 January 2014

bcmod()

Earlier I mentioned how to fix a problem if you haven't got bcmod installed on your server and you are too idle to install it.  I think it may have been a bit of a bodge.

Below is a better fix from php.net.  Just define the bcmod function on the page above where you need to use it.

function bcmod( $x, $y )
{
    $take = 5;   
    $mod = '';

    do
    {
        $a = (int)$mod.substr( $x, 0, $take );
        $x = substr( $x, $take );
        $mod = $a % $y;  
    }
    while ( strlen($x) );

    return (int)$mod;
}

Monday, 23 December 2013

Fatal error: Call to undefined function: bcmod()

If you get this error in PHP Fatal error: Call to undefined function: bcmod() there is a simple fix which is hinted at on the PHP web site. Where you have $value = bcmod('4', '2'); replace with value = 4%2; This is a bodge, but a nice simple one.