Challenges that each developer faces every day

Friday, 1 November 2013

Content type for the audio files aac - extension m4a

The correct content type for audio that is AAC encoded is:

If you have access to webserver's conf/mime.types file add this line

audio/mpeg     mpga mp2 mp3 m4a

 Digg  Reddit  SlashDot

Monday, 24 June 2013

New Marketplace for WordPress Themes & Plugins (coming soon)

I started working on a WordPress theme and plugins marketplace.

The goal for the marketplace ( is to provide better opportunities for designers, developers, and affiliates.

When developers/designers sell their products on our marketplace the commission rates will range between 70%-85% per sale and the products don't have to be exclusively sold on our marketplace.

For more info go to:

Make sure you join the email list

 Digg  Reddit  SlashDot

Wednesday, 27 June 2012

Android: AndroidRuntime android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application

Have you seen this ugly error where is is totally not supposed to be there?

Error: AndroidRuntime android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application

I was working on an app about local restaurants in Niagara and had an about window.


private static Context context;

MainActivity.context = getApplicationContext(); // this was causing some nasty errors.

MainActivity.context = this;


 Digg  Reddit  SlashDot

Wednesday, 20 June 2012

curl: (3) [globbing] error: bad range specification after pos NN

This is an error when you try to call a URL containing {} or [] at NN position.

curl: (3) [globbing] error: bad range specification after pos NNN

how I used it

/usr/bin/curl -s[date]=last_12_hours

solution: by using --globoff

/usr/bin/curl -s --globoff[date]=last_12_hours


 Digg  Reddit  SlashDot

Monday, 14 May 2012

quiet git log: How to get shorter version (one line) of git logs

Do you want to see shorter log messages from git ?

5441641 fixed support.php : wasn't validating
25af6d5 updated background
a3v0a49 enabled the backup

git log --pretty=oneline --abbrev-commit

if you want to logs to be between certain date you can do this
git log --since=2012-04-20 --until=2012-04-30 --pretty=oneline --abbrev-commit

Gauthier -

Keyword: git, git-log, git log --quiet

 Digg  Reddit  SlashDot

Wednesday, 25 April 2012

$("#qfileupload").fileupload is not a function, $("#qfileupload").qtips is not a function

Have you seen this annoying JavaScript error message ?

$("#some_id").someplugin is not a function

I bet you have!

in most cases the plugin is not loaded but when everything is loaded fine then you should check if jquery is loaded more than once.

It turned out that if there are multiple copies of jquery loaded this causes the jquery extensions not to work.

Just lost a few hours troubleshooting this.

 Digg  Reddit  SlashDot

Thursday, 1 March 2012

How to detect old browsers in PHP and show a obsolete browser notice

put this in a file called common.
Class App_Util {
    function is_old_browser() {
        $old = 0;

        if (!empty($_SERVER['HTTP_USER_AGENT'])) {
            // IE <= 7
            // User Agent: Opera/9.80 (Windows NT 6.1; U; en) Presto/2.10.229 Version/11.61
            if (preg_match('#msie\s+(\d+)\.(\d+)#si', $_SERVER['HTTP_USER_AGENT'], $matches)) {
                if ($matches[1] <= 7) {
                    $old = 1;
            // Firefox <= 7
            // User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2
            elseif (preg_match('#Firefox/(\d+)\.(\d+)[\.\d]+#si', $_SERVER['HTTP_USER_AGENT'], $matches)) {
                if ($matches[1] <= 7) {
                    $old = 1;
            // Safari < 5
            // User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.52.7 (KHTML, like Gecko) Version/5.1.2 Safari/534.52.7
            elseif (preg_match('#Version/(\d+)[\.\d]+ Safari/[\.\d]+#si', $_SERVER['HTTP_USER_AGENT'], $matches)) {
                if ($matches[1] < 5) {
                    $old = 1;
            // opera < 11
            // User Agent: Opera/9.80 (Windows NT 6.1; U; en) Presto/2.10.229 Version/11.61
            elseif (preg_match('#Opera/[\.\d]+.*?Version/(\d+)[\.\d]+#si', $_SERVER['HTTP_USER_AGENT'], $matches)) {
                if ($matches[1] < 11) {
                    $old = 1;

        return $old;

How to perform the check
file: block_old_browser.php

<?php if (App_Util::is_old_browser()) : ?>
    <div class="app_old_browser_notice">
        <h2>Old Browser</h2>
        <p>Please consider upgrading your browser. Doing so will improve experience with the site. <br/>
        Please click one of them below.</p>
            <li><a href="" target="_blank">Mozilla Firefox</a></li>
            <li><a href="" target="_blank">Google Chrome</a></li>
            <li><a href="" target="_blank">Safari</a></li>
            <li><a href="" target="_blank">Opera</a></li>
            <li><a href="" target="_blank">Internet Explorer (Windows)</a></li>
<?php endif; ?>

Include the file above in all the files that you need to the noticed displayed.
<?php include('block_old_browser.php'); ?>

css styles
.app_old_browser_notice {
    color: white;

.app_old_browser_notice a {
    color: white;

 Digg  Reddit  SlashDot