Back to Top

Author Archives: Dunnie

Fixing youtube video downloading software


If you use youtube-dl or other similar youtube video downloading software for legally downloading videos you might get an error –  Unable to download Youtube videos – SSL: CERTIFICATE_VERIFY_FAILED

The following method fixed it for myself..

run certmgr.msc





menu -> action -> find certificates.






choose “look in fields: issued to”

On the “contains” field type enter “google”.

click “find now”

mark all the expired certs (sort by expiry date)

right click and choose “delete”






Now try using your video downloading software again – may now work fine.


Posted in Other |

Getting around the 255 axis label separation limit in Excel 2016

Start with a graph with a large x-axis range of data – the x axis looks unrealistic:


Need to set a more realistic x-axis label separation, but limited to upto 255 separation in Excel 2016.


Change x axis data type to date

graph3-selected date-type-x-axis

Then change both the marker types to days, and set the major and minor units to say 1000 and 1 respectfully – now the graph axis look more realistic.

graph4-selected days-1000-1

Posted in Excel |

Linking Dailymotion rss feed to twitter

The purpose of this post is to show how to link a dailymotion video rss feed to your twitter account using Codebird php, so when the script runs it adds one video post to your twitter account.. can then be run via a cron setup (won’t cover here as system dependent – windows v linux servers).

You need three things sorted out first..

(1) Down the codebird for php library from

(2) Obtain a twitter developer api key details from (best to log into your twitter account first)

(3) Have a Dailymotion rss feed – usually of format[daily motion user name] – where [daily motion user name] is your user account name of account.

The code looks like the following.. things to replace are in [] brackets.

Note: I have taken out my code for shortening links and auto hash tagging using str_ireplace(), but the principles here should get you in the right direction.

require_once("codebird.php"); // reference the codebird php library file (downloaded in step one above)

class BlogPost
    var $date;
    var $ts;
    var $link;
    var $title;
    var $text;

class BlogFeed
    var $posts = array();

    function __construct($file_or_url)
        $file_or_url = $this->resolveFile($file_or_url);
        if (!($x = simplexml_load_file($file_or_url)))  {

        foreach ($x->channel->item as $item)

            $post = new BlogPost();
            $post->date  = (string) $item->pubDate;
            $post->ts    = strtotime($item->pubDate);
            $post->link  = (string) $item->link;
            $post->title = (string) $item->title;

            $post->text = ""; // not using this for tweets

            $this->posts[] = $post;

    private function resolveFile($file_or_url) {
        if (!preg_match('|^https?:|', $file_or_url))
            $feed_uri = $file_or_url;
            $feed_uri = $file_or_url;

        return $feed_uri;

    private function summarizeText($summary) {
        $summary = strip_tags($summary);

        // Truncate summary line to 100 characters
        $max_len = 100;
        if (strlen($summary) > $max_len)
            $summary = substr($summary, 0, $max_len) . '...';

        return $summary;

// read in posts

$ps = new BlogFeed("[daily motion user name]"); // your dailymotion rss feed (step three above)

$posts = $ps->posts;

if($link!="") {

$message = $title." ".$link; // note that the twitter 140 character limit applies to the total of message sent

// now tweet - [] key information unique to twitter account - obtain keys via (step two above)

\Codebird\Codebird::setConsumerKey('[YOURKEY]', '[YOURSECRET]');
$cb = \Codebird\Codebird::getInstance();
$cb->setToken("[YOURTOKEN]", "[YOURTOKENSECRET]");

$params = array(
    'status' => $message

$reply = $cb->statuses_update($params);

// display message to screen




Note: disclaimers on code/snippet usage applies – no responsibility on usage.

Posted in Misc Topics |

Making sure php file_get_contents accept all SSL certificates websites


When accessing https SSL certified websites, they are often rejected as php cannot process the certificate attached to the website and/or user agent exceptions, one way around that is to make php accept all certificates.

file_get_contents SSL operation failed with code 1 SSL3_GET_SERVER_CERTIFICATE certificate verify failed.

Here is the code to get around that.. also sets a 60 second timeout, and a user agent string.

$dargs=array("ssl"=>array("verify_peer"=>false,"verify_peer_name"=>false),"http"=>array('timeout' => 60, 'user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071025 Firefox/'));

$response = file_get_contents("your SSL url entered here", false, stream_context_create($dargs));

echo $response; // or code to handle returned url contents
Posted in PHP |

Checking http header codes for dead links, redirects

Simple code to check the http returned header code of ‘real world’ websites… I say real world websites as many servers these days block invalid user agent strings (mod_security plugins), so need to set a fake valid one first.

$user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071025 Firefox/';
ini_set('user_agent', $user_agent);

$url = "url to test here"; // eg
$statuscode= $urlinfo[0];

echo($url." ".$statuscode."\n");

Posted in PHP |

Top Three Simple Things I Would Like To Be Sorted Out On OneDrive Online

This relates to office365 onedrive for business

A list of three I believe to be simple things I would like, really like, to be sorted out on onedrive online so I can actually use it without ripping my hair out on a day to day basis.. pretty please…

1) ‘Keep me signed in’ tick box actually worked on firefox browsers – no cleaning software or cookie removal plugins, just doesn’t work on firefox fullstop. Tried a fresh profile, still doesn’t work, forced to play enter the email/password game each time.

2) Developers stopped or reduced making subtle changes to the login form url and/or field names – ok storing your email address and password in browser wallets isn’t ideal, but given (1) above, it becomes tiresome when the url or field names change, so then your email and password isn’t automatically filled in, so then have to play hunt the password game to login each time – kind of important if shares are sent to me with login forced on them.. (note I do have a firefox plugin which allows SSL / https passwords to be auto filed, but like all sites only works if the login form urls are kept consistent… unlike right now).

3) Once logged into a onedrive shared FOLDER, if I move from ‘FILES’ to ‘OUR FILES’, then switch back to ‘FILES’ again all the shared files disappear – only solution is to log out, then (hoping url hasn’t been altered rofl in the meantime) re-enter email/password details, and log back in, just remembering not to switch to ‘OUR FILES’ by mistake – this tends to happen if the same client has sent more than one share eg input folder as one share and an output folder as another share – annoying as hell anyway.

Many other issues on Onedrive online, but if these 3 issues above were fixed, could possibly regain my hair cover and lower overall stress levels.

Additional: The protected mode ‘file is corrupted’ message when two different people using excel 2016 share the same document but slightly different versions of the software used ought to be changed though – cannot keep expecting clients to change their security settings just because say my version of excel 2016 is 2 weeks more up to date than theirs or vice-a-versa.. tested and found to be the case. Probably less of a case on forced updating windows 10, but as those people who might rely on expensive mobile broadband turn off auto updates (5GB == £40, which can soon mount up on office 2016 updates), is definitely an issue in my opinion.

Posted in Misc Topics |

Remote url mime type function

PHP function to return a remote url mime type:

function get_remote_mime_type($url)
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
return curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
Posted in PHP |

Setting Excel chart x-axis to date/time type and major/minor unit separations

Code snippet to set the first chart on a wordsheet ($ws) x-axis to a date/time type and set the major unit to 500 and minor unit to 1 – useful when dealing with long data setup where the general/text type requires a greater than 255 manual separation value.

$chart.Axes(1).CategoryType = 3
$chart.Axes(1).MajorUnitScale = 0
$chart.Axes(1).MinorUnitScale = 0
$chart.Axes(1).MajorUnit = 500
$chart.Axes(1).MinorUnit = 1
Posted in Excel PowerShell |

mysql code to find wordpress posts not associated with a category

WordPress mysql code to find posts not associated with a category.

FROM    wp_posts p
WHERE   p.post_type = 'post' 
        AND p.post_status = 'publish' 
        SELECT  *
        FROM    wp_term_relationships rel
        JOIN    wp_term_taxonomy tax
        ON      tax.term_taxonomy_id = rel.term_taxonomy_id 
                AND tax.taxonomy = 'category' 
        JOIN    wp_terms term
        ON      term.term_id = tax.term_id
        WHERE   p.ID = rel.object_id 
Posted in Wordpress |