Last week I released the first (beta) version of my interactive charting plugin for the Symfony PHP framework. It is currently only version 0.1.2 so it’s a bit rusty round the edges, but over the next couple of weeks I will be improving it and adding extra functionality to it. I also intend to package up another version (which I will host on my blog) for anyone not using Symfony to use in there PHP projects. Below are just a few details on the plugin:
UPDATE: The plugin has been updated to version 0.2.0 (Available on the Symfony website), more of the APIs options have been implemented along with an improved callback function and more streamlined code.
It can create a number of different charts:
- Area Charts
- Bar Charts
- Column Charts
- Line Graphs
- Pie Charts
Head to: http://www.symfony-project.org/plugins/sdInteractiveChartPlugin
If your trying to connect from an Amazon EC2 instance to an RDS instance in PHP and finding that the connection keeps timing out (i.e. you get a mysql 2003 error). try using the IP address for the RDS instance instead of the hostname (or ‘Endpoint’ as Amazon calls it).
So instead of using:
$link = mysql_connect('mydbinstance.c7hszkfowzmc.us-east-1.rds.amazonaws.com:3306', 'mysql_user', 'mysql_password');
Use something like this (obviously replacing the IP address below with the IP of your RDS):
$link = mysql_connect('220.127.116.11:3306', 'mysql_user', 'mysql_password');
Recently I needed to change the upload_max_filesize for php running on one of my sites. As this can only be done in either .htaccess (when running php as an apache module) or using php.ini, I was forced to use the php.ini method.
So I created a new php.ini file and added the following lines:
upload_max_filesize = 32M
post_max_size = 64M
The post max size all ways needs to be greater than the upload max filesize other wise the upload max filesize can never be reached as it will get limited by the post max size before hand. Uploaded this to the server and I a look at the phpinfo() output. But still the post_max_size was set to 2MB.
After scouring the internet for quite a while wondering why my php.ini file was not being picked up by php running in FastCGI mode I finally discovered I had to add an extra line into my .htaccess file to tell suPHP where to find my php.ini file.
I opened up my .htaccess file directly under my web root and added the line:
suPHP_ConfigPath /<path to my public_html>/public_html
And like magic PHP picked up the new php settings and the upload_max_filesize went upto 32MB.
I hope this helps someone else having the same issue solve it far quicker than I did.
I decided it would be better if I had my list of pages for my new shiny blog along the main navigation area (under the title) instead of hidden away at the top of the page! So… In case anybody else wants to do the same thing I will tell you how!
Edit the file: wp-content/themes/<Your theme’s name here>/header.php
NOTE: you can either do this in your favourite text editor OR in the WordPress admin area, under Appearance > Editor
Scroll down and find the line that goes something like this:
Then find the line that goes like this:
Now if you want to swap your pages with your categories simply swap the two lines above over… Ooo an remember to save.
In my case I wanted to remove the list from right at the top of the page as I added a category widget to the right hand side of my blog (as you may have noticed), so I removed the code that went: “wp_list_categories” altogether.
That’s it… refresh your browser and like magic your list of blog pages will now be where the list of categories used to be.
Filtering users input is unfortunately something that needs to be done these days. Possibly even more so when the content is coming from another website/service (such as twitter or facebook). Swearing/rude words is quite a serious area, as you really don’t want to offend any visitors to your site by displaying a live thread showing comment or a ‘tweet’ or similar containing offensive langauge (tends to go down badly). So on this very note I set out today to add a live twitter feed to my current project (www.wsaf.co.uk), but decided once I had pulled the data from twitter I should probably remove any swearing before displaying it on the site!
As the site is written in php funnily enough this was also going to be. As I like to make my code as fast a possible I decided I would test the speed to different functions that could be used for this purpose: