How to Fix: Open Flash Chart, IE & SSL Not Working

Blog Stuff, Internet, PHP 1 Comment »

<?php

//Headers Required for SSL in IE
header(”Cache-Control: cache, must-revalidate”);
header(”Pragma: public”);

?>

Normally I don’t bother with making sure my projects are Internet Explorer compliant but the Open Flash Charts are just so pretty, and it’s not that difficult to fix, I felt I had to make sure they displayed correctly.

Debug: file_get_contents($Url);

PHP 1 Comment »

There is a variable $http_response_header

It contains the header reply information from the server…

$var = file_get_contents($url);

var_dump($http_response_header);

This really helped me figure out some problems when trying to cache google charts.

404 With jquery.gritter SOLVED

Internet, PHP No Comments »

Gritter is a really good extension of jQuery’s functionality that is used to display information boxes to users. If you use firefox’s extension Firebug though or you look in your server logs then you may see that it’s causing 404 errors.

Whilst annoying the errors aren’t fatal. My applications have worked for long enough without solving the problem but it IS annoying and finally today I decided to do something about it. I found the solution on this blog and Duck Ranger gives much more sensible reasons for fixing the problem.

The error is caused by a Gritter’s CSS file creating a GET request to solve an IE bug but the request is for the current (CSS) directory which is forbidden.

Read the rest of this entry »

Connecting to MySQL Over SSH

Internet, Linux, Mac, Miscellaneous, PHP No Comments »

The last couple of days I’ve been thinking about setting up a local copy of my websites on my laptop so that I can develop them before I make them live.

Last night I enabled PHP on the apache server built into Mac OSX on my new laptop and installed MySQL on it. I also set up some bash aliases to rsync commands so that I could synchronise the websites from the server to the laptop and back again.

Now that I had local copies of the sites that are synchronised it was time to turn my attention to synchronising the databases between the server and my local machine. I could of configured the server’s MySQL installation to allow remote connections, however, I did not want to do this for security reasons. I decided that I would connect to the MySQL server over SSH by forwarding a port on my local machine to a remote port on the server.

First I needed to create an SSH tunnel using the following command

ssh -fNg -L 3307:127.0.0.1:3306 server.host.name Read the rest of this entry »

PHP Equivalent to the SQL IN (…) Statement

PHP, Pharmacy, XML No Comments »

Recently I’ve been looking at using the NHS Business Service Authority’s Dictionary of Medicines and Devices for my own nefarious purposes. The Information (data that has meaning) is distributed as XML files.

I haven’t come across a database design for the data so I’ve come up with my own and to import the data into it I’ve been using PHP’s XML DOM functionality (a different technique than I described in my earlier post …). Because the files are published according to specified standards I decided to save myself some programming time by adopting their terminology for my database design so that I could write very little code to prepare the data and insert it into the database.

However, I wanted to test that the nodes I was expecting were what was being prepared for insertion into the database. One reason it may not is if the XML file has been reformatted with indents (mentioned in this post) What I needed was an equivalent to SQLs IN statement. The solution is to use PHP’s in_array() function like so…

$desirable_values = array(’CD’, ‘CDDT’, ‘CDPREV’, ‘DESC’);
if ( in_array( $variable_to_test, $desirable_values) ) {
//Do Your Stuff
}

It saves you having to test if your variable is equal to each of the variables you want to test thus making your code cleaner and shorter.

WP Theme & Icons by N.Design Studio | Akismet has gobbled 184,454 spam comments...Mmmm Tasty :-)
Entries RSS Comments RSS Log in