Latest

mysqldump on Windows gives "Access is Denied"

I recently had to back up a MySQL database on a windows server so I could restore it to my local MySQL server for analysing the structure of an existing site which we are going to be rebuilding. I have done this hundreds of times on linux server but the usual command did not appear to work on this windows server. I was using:-

but when I ran this I was presented with an "Access Denied" message.

Read more

Wordpress wp_redirect() shows a blank page

Over the last few weeks I have been working on my first wordpress plugin and I am quickly getting to grips with how it all pieces together but I ran into a problem with a rather basic piece of functionality that pretty much rendered the plugin useless until I figured out the issue.

The section I was working on was a form submission (within the wordpress administation) which saved the form values into the database and then redirected the user upon success to another page (using wp_redirect) but this resulted in a blank content pane.

Read more

User Profile Service Failed the Logon

This Christmas was the quietest Christmas I have had in years in terms of the obligatory "if you have got the time" IT jobs as I only had 1 request for fixing a computer this year (instead of the 4 computers and a DVD player I had a few years back... all requested within 2 hours of arriving home).

Luckily this one turned out to be relatively simple and only took 5 minutes to fix although when I first heard about it I thought it was going to take a few hours. My aunt and uncle reported a problem with logging into their laptop (running Windows Vista Home Premium) on my uncle's profile where it would give an error message "The User Profile Service failed the logon", after which it would simply return them to the profile selection screen.

Read more

Raw SQL from Doctrine Query Object - Revised

A few months ago I posted an article taking about how to get the raw SQL from a Doctrine Query Object but with the release of Symfony 1.3 and Symfony 1.4 it would appear that the code no longer works.  As a result I've updated the code to work with Symfony 1.2 - 1.4 and you can find the updated source below:-

function get_raw_sql($query) {
    if(!($query instanceof Doctrine_Query)) {
        throw new sfException('Not an instanse of a Doctrine Query');
    }
 
    $query->limit(0);
    
    if(is_callable(array($query, 'buildSqlQuery'))) {
        $queryString = $query->buildSqlQuery();
        $query_params = $query->getParams();
        $params = $query_params['where'];
    } else {
        $queryString = $query->getSql();
        $params = $query->getParams();
    }
 
    $queryStringParts = split('\?', $queryString);
    $iQC = 0;
 
    $queryString = "";
    
    foreach($params as $param) {
        if(is_numeric($param)) {
            $queryString .= $queryStringParts[$iQC] . $param;
        } elseif(is_bool($param)) {
            $queryString .= $queryStringParts[$iQC] . $param*1;
        } else {
            $queryString .= $queryStringParts[$iQC] . '\'' . $param . '\'';
        }
 
        $iQC++;
   }
   for($iQC;$iQC < count($queryStringParts);$iQC++) {
       $queryString .= $queryStringParts[$iQC];
   }
 
    echo $queryString;
}

I hope that it proves useful.

Read more

TRUNCATE TABLE with Symfony and Doctrine

I am often importing data into a symfony project from an existing site or a CSV file and re-writing this data into the fixtures.yml is usually too complicated or time consuming so I end up writing bespoke import actions.

While I am writing these actions I often find that I have to delete the contents of the MySQL tables as you can never write the routine complete and accurate in one go so as you build it up in smaller steps you find that you have to get rid of the previously old data.

Read more

Magento API - Update Product Stock Levels

Another day... another magento problem!

I was asked to look into a problem with an automated stock level update script not updating the stock levels.  This update script was using the Magento API and on the face of things everything looked ok as the script ran without any errors, the product prices got updated but the stock levels never changed.

Read more

Raw SQL from a Doctrine Query Object

As my use of Symfony is increasing I find myself frustrated that there doesn't appear to be an easy way to get the raw SQL from a doctrine query object so I can simply output it and paste it into phpMyAdmin to debug problems with the SQL. I may be wrong about this but as yet I have not found a built in function to perform this operation.

Sure I am able to output the query with the "?" indicating where the necessary values are to go and I can also easily output the array of query parameters so I can substitute these manually but this takes time and it would be much much simpler and quicker to just output the whole query with the substitution already done so it's a simply copy and paste of the raw SQL from the doctrine query object straight into phpMyAdmin.

Read more

Why you should answer your own posts?

How many times have you searched for the answer to a problem in Google to find nothing but forums with people who have the same questions but no solutions posted even though the question was raised months, even years earlier?

If you post a question and no-one managed to provide you with an answer do you:-

Read more

Symfony - Does not have a registered handler

Last week I was working away in the office at Line Digital on our latest Symfony based project when our project started giving us a strange error similar to:-

Looking into this a little closer we found that the server had ran out of disk space so after making some space and using "symfony cc" to clear the cache we thought that this would have resolved the problem, however we continued to get the "does not have a registered handler" message being presented.

Read more

Month Names in PHP

One simple thing I keep having to do over and over again is to display the name of the month for a given date.  Normally I have opted to use the first solution that comes to mind which is creating an array with all the month names in it and then when I want to retrieve the month name I just use

However, when I wanted to use PHP to display the month name this time I wanted to see if there was a better solution. The one I came across was posted on The Code Cookbook and was a simple 1 line statement which was great... simpler, neater and far more elegant than my usual method and it looked like

Read more

Advertisement

Digital Ocean

Reading List

JAXenter

Self-promotion is a skill, but is that the skill you're looking for? - JAXenter

Do you want to hire somebody that's good at self-promotion, or are you looking for a certain skill-set? Perhaps you need to shape your job spec differently. Read more

TechCrunch

TechCrunch

When Crowdfunding Fails The Backers Are Left With No Way Out

A few years ago an enterprising programmer dug through Kickstarter's data to figure out how many failed projects there really were. Thanks to a trick in the.. Read more

Business Insider

A programmer wrote scripts to secretly automate a lot of his job — and email his wife and make a latte

There's a hilarious project that's gone viral on GitHub that consists of a bunch of software scripts that automate all sorts of crazy things. Read more

The Bests

The Best-Looking Video Game Consoles Of All Time

You silly fanboys. All these years arguing over things you thought were important, like specs, and libraries, and exclusives, and controllers, wasted. Not once have you considered the most crucial thing about a video game console: how good it looks. Read more

The Founder Institute

The Founder Institute

FI.co: How to Build an MVP as a Non-Technical Founder

The Founder Institute hosts webinars every month so that we can help entrepreneurs on any stage succeed. These webinars discuss a wide range of topics, bestowing global entrepreneurs with invaluabl... Read more

TechCrunch

TechCrunch

Google’s New “About Me” Page Lets You Control What Personal Info Others Can See

Worried that Google has too much of your personal data, thanks to the way it has pried into your life over the years as you steadily adopted more of its.. Read more