Edmonds Commerce Logo
  • home
    • blog
  • ecommerce
    • product catalogue
    • order processing
    • customer services
    • stock control
    • human resources
    • management information
  • development
    • oscommerce
    • php
    • mysql
    • open source
    • performance tuning
  • design
  • marketing
  • contact us
    • pricing

Edmonds Commerce Blog

Freelance PHP Ecommerce and SEO Developer in the UK

Latest Posts

Git Ignore All Files Except PHP etc + Solution
PHP 5.3 Is Released
Netbeans 6.7 is Out. Yay :-)
RGBA Cross Browser Support + Solution

Most Popular Posts

Magento Developer UK Freelance osCommerce UK Magento UK Developers on Linked.in CRE Loaded UK

Git Ignore All Files Except PHP etc + Solution

July 2nd, 2009
Read More git

Using Git for version control is great, but if like my you work on a lot of different projects then everything you can do to save time setting Git up is well worth it.

One of the features of Git is the ability to only track certain files and ignore other files. For me that means I only want to track files I am likely to be editing and ignore images, flash files and whatever other junk is floating around in a project.

The solution (and all credit and thanks to the kind people on #Git on Freenode IRC) is this .gitignore file. This file will ignore everything except files with the extensions that you set. Dead easy.

PLAIN TEXT
CODE:
  1. #ignore everything apart from php, css, xml, htaccess, sql, js
  2. *
  3. !*/
  4. !*.php
  5. !*.css
  6. !*.xml
  7. !*.htaccess
  8. !*.sql
  9. !*.js

Possibly Relevant Posts:

  • no matches
Get in Touch with Edmonds about Git Ignore All Files Except PHP etc + Solution
Add Comments

PHP 5.3 Is Released

July 1st, 2009
Read More php

Eagerly anticipated, pretty much a whole new version even though its numerically a tiny increase - the features being released in this update are largely features that were originally scheduled for PHP version 6.

Some of the key new features include: namespaces, late static binding, closures, optional garbage collection for cyclic references, new extensions (like ext/phar, ext/intl and ext/fileinfo), over 140 bug fixes and much more.

Powerful new language features include namespaces (a higher level way of defining scope - allowing for larger and more complex applications), late static binding (more esoteric object oriented language feature), closures (allowing functions to be assigned to variables - familiar to javascript developers but a nice new powerful feature for PHP developers).

The release also includes some cool new extensions like Phar (very similar in principle to a Java Jar) allowing an entire PHP app to be distributed and run as a single file.

Most of these features won't really affect the average webmaster until apps turn up that take advantage of these new features. Along with these cool new features however, PHP 5.3 brings some solid performance improvements that will benefit all webmasters.

It's great to see PHP maturing and growing as a language and this new release is really more power to my elbow as a PHP developer and that has to be a good thing!

Possibly Relevant Posts:

  • no matches
Get in Touch with Edmonds about PHP 5.3 Is Released
Add Comments

Netbeans 6.7 is Out. Yay :-)

June 30th, 2009
Read More php

My favourite IDE Netbeans has recently been released as version 6.7. Now installed and looking forward to taking advantage of some new features and fixes

Possibly Relevant Posts:

  • no matches
Get in Touch with Edmonds about Netbeans 6.7 is Out. Yay :-)
Add Comments

RGBA Cross Browser Support + Solution

June 30th, 2009
Read More web design

I recently came across rgba colours which are a very simple and logical way to produce a colour (rgb) with alpha transparency as well. This is ideal if for example you want to create a translucent white box to put some text in.

CSS does have some (dodgy) opacity controls, but they set everything as transparent including any text or pictures contained within the element. By using rgba, we can set a translucent background colour and have opaque elements contained within.

As usual, to get it to work in IE requires some extra effort, however this hack mentioned here and originally credited here seems to offer a solution.

Possibly Relevant Posts:

  • no matches
Get in Touch with Edmonds about RGBA Cross Browser Support + Solution
Add Comments

Ubuntu + VirtualBox + XP = Easy

June 26th, 2009
Read More ubuntu

I have recently had the misfortune of stepping out of my usual developers bubble and having to do a bit of graphic web design. Of course that means that not only did I have to try to make something look good with my meagre design skills, but then I had to worry about making sure it worked in IE...

Web Designers... I FEEL YOUR PAIN

As I only use Ubuntu or Mac's, testing in IE is not exactly easy. Or at least it wasn't until I decided to take the plunge and set up XP as a virtual machine. It's really really easy on Ubuntu.

1. Go to the Applications->Add / Remove system

2. type virtualbox in the searchbox

3. Install VirtualBox OSE

4. Go to the Applications->Accessories menu and launch VirtualBox OSE

5. Hit the blue New icon in the top left

6. Follow the wizard. I used the following settings:

6.a name: xp

6.b: memory: 192mb

7. At the boot disk stage, you need to hit the New button to create and install a new 'boot disk'.

8. Whack your XP CD in the drive and install it.

By default the right hand ctrl key is your key for escaping out of your virtual machine. This means that if you click on your virtual machine with your mouse (for example to go through to multiple steps required to tell XP that you want English UK keyboard, and surprise surprise an English Keyboard layout and furthermore you don't really need to install English US as a separate language)

Note - to access your Ubuntu environment you will need to have folder sharing set up, the virtual machine will see the host Ubuntu like another computer on a network.

If like me you need to edit the hosts file to point a dummy domain to your local development environment, the IP address you need to use is 10.0.2.2

Possibly Relevant Posts:

  • Running Internet Explorer under Ubuntu Linux
  • Ubuntu Jaunty Filezilla
  • Could I Be Converted to a Mac User?
  • Hardware Information in Ubuntu
  • Image Free Polygons Using Only CSS + HTML – No Javascript
Get in Touch with Edmonds about Ubuntu + VirtualBox + XP = Easy
Add Comments

Mysql Database Migration / Synchronisation Script

June 24th, 2009
Read More mysql

This is a nice little script I just knocked together that helps to synchronise databases when the table structures might not be exactly the same (for example different versions of the same system).

You would need to edit the top section to put the correct DB credentials etc.

This is definitely not to be used on a live DB, purely for aiding development and migration.

PLAIN TEXT
PHP:
  1. <?php
  2. /** Database Synchronisation / Migration Tool
  3. *
  4. * For synching up an old and a new DB schema.
  5. *
  6. * @author EdmondsCommerce.co.uk
  7. *
  8. */
  9.  
  10. //do you want the system to empty the new table before inserting data from the old table?
  11. $truncate=true;
  12.  
  13. /**
  14. * DB Server Credentials - Needs to have full access to both databases
  15. */
  16. $dbHost='localhost';
  17. $dbUser='root';
  18. $dbPass='password';
  19.  
  20. /** Tables to Synch
  21. */
  22. $tablesToSynch = array(
  23.     'categories',
  24.     'categories_description',
  25.     'products',
  26.     'products_description',
  27.     'products_to_categories',
  28.     'manufacturers',
  29. );
  30.  
  31. $dbOld = 'dbold';
  32.  
  33. $dbNew = 'dbnew';
  34.  
  35.  
  36. /*********** CODE BELOW HERE - NO NEED TO EDIT UNLESS YOU WANT TO ***********/
  37. $_conn = mysql_connect($dbHost,$dbUser,$dbPass) or die('DB Connection Failed');
  38.  
  39. $dbOldTables= fetch_tables($dbOld);
  40.  
  41. $dbNewTables = fetch_tables($dbNew);
  42.  
  43.  
  44. foreach($tablesToSynch as $table){
  45.  
  46.     echo '<h3>Doing '.$table.'</h3>';
  47.     //check for common tables
  48.     if(in_array($table, $dbOldTables) && in_array($table, $dbNewTables)){
  49.         //now get column data
  50.         $dbOldTableCols = fetch_columns($dbOld,$table);
  51.  
  52.         $dbNewTableCols = fetch_columns($dbNew,$table);
  53.  
  54.         //now for the column comparison
  55.         $cols=array_intersect($dbOldTableCols, $dbNewTableCols);
  56.  
  57.         //now emptying the new DB if set to do so
  58.         if($truncate){
  59.             db_query("TRUNCATE $dbNew.$table");
  60.         }
  61.  
  62.         //copy old table to new DB so we can copy columns
  63.         $tempTable=copy_table($dbOld, $dbNew, $table);
  64.  
  65.         //now build SQL and run
  66.         $sql = "insert into $dbNew.$table (" . implode(', ',$cols) . ") select " . implode(', ',$cols) . " from $dbNew.$tempTable";
  67.         db_query($sql);
  68.  
  69.         //now drop temp table
  70.         db_query("DROP TABLE $dbNew.$tempTable");
  71.     }
  72.    
  73. }
  74.  
  75. /****** FUNCTIONS ********/
  76.  
  77. function db_query($query){
  78. $output = mysql_query($query) or die('
  79. <h1 style="color: red">Uh Oh......MySQL Error:</h1>
  80. <h3>Query:</h3>
  81. <pre>' . htmlentities($query) . '</pre>
  82. <h3>MySQL Error:</h3>
  83. ' . mysql_error() . '
  84. <hr /> <hr />');    return $output;
  85. }
  86.  
  87.  
  88. function fetch_tables($dbname){
  89.     $query=db_query("show tables from $dbname");
  90.     while($r=mysql_fetch_assoc($query)){
  91.         $return[]=$r["Tables_in_$dbname"];
  92.     }
  93.     return $return;
  94. }
  95.  
  96. function fetch_columns($dbname, $table){
  97.     $query = db_query("SHOW COLUMNS from $dbname.$table");
  98.     while($r= mysql_fetch_assoc($query)){
  99.         $return[]=$r['Field'];
  100.     }
  101.     return $return;
  102. }
  103.  
  104. function copy_table($fromDb, $toDb, $table){
  105.     db_query("DROP TABLE IF EXISTS $toDb.temp_$table");
  106.     db_query("CREATE TABLE $toDb.temp_$table LIKE $fromDb.$table");
  107.     db_query("ALTER TABLE $toDb.temp_$table DISABLE KEYS");
  108.     db_query("INSERT INTO $toDb.temp_$table SELECT * FROM $fromDb.$table");
  109.     db_query("ALTER TABLE $toDb.temp_$table ENABLE KEYS");
  110.     return "temp_$table";
  111. }

Possibly Relevant Posts:

  • Check if MySQL Table Exists
  • Building Spiders: Grab Data, Post Forms and Interact with Web Sites Automatically
  • Setting up a 64bit Linux PHP Development Enviroment
  • phpuk2009 Tomorrow
  • MySQL Desc Table
Get in Touch with Edmonds about Mysql Database Migration / Synchronisation Script
Add Comments

Ubuntu Jaunty Filezilla

June 24th, 2009
Read More ubuntu

This is as much a note to self plus anyone else googling for the words Ubuntu Jaunty and Filezilla

The version that's in the repositories is a bit old and missing some cool features like synchronised browsing.

The latest version is available from GetDeb - http://www.getdeb.net/app/FileZilla

If you have already installed a version from the repos, totally remove it using syntaptic package manager. Then download the main filezilla package and the filezilla-common package from GetDeb. Install the filezilla-common package first and then the Filezilla package itself.

Sorted.

Possibly Relevant Posts:

  • Could I Be Converted to a Mac User?
  • Jaunty Released
  • Hardware Information in Ubuntu
  • Running Internet Explorer under Ubuntu Linux
Get in Touch with Edmonds about Ubuntu Jaunty Filezilla
Add Comments

Magento Overiding XML Case Inconsistency Continues

June 23rd, 2009
Read More magento

Had another tearing hair out moment when trying to figure out why my helper override was working fine, but my block override wasn't working. Here is the result:

helper working, block not working:

PLAIN TEXT
XML:
  1. <?xml version="1.0"?>
  2. <config>
  3.     <modules>
  4.         <EC_CatalogSearch>
  5.             <version>0.1.0</version>
  6.         </EC_CatalogSearch>
  7.     </modules>
  8.     <global>
  9.         <helpers>
  10.             <catalogSearch>
  11.                 <rewrite>
  12.                     <data>EC_CatalogSearch_Helper_Data</data>
  13.                 </rewrite>
  14.             </catalogSearch>
  15.         </helpers>
  16.         <blocks>
  17.             <catalogSearch>
  18.                 <rewrite>
  19.                     <result>EC_CatalogSearch_Block_Result</result>
  20.                 </rewrite>
  21.             </catalogSearch>
  22.         </blocks>
  23.     </global>
  24. </config>

then after a load of messing about, this one does work:

helper and block both working

PLAIN TEXT
XML:
  1. <?xml version="1.0"?>
  2. <config>
  3.     <modules>
  4.         <EC_CatalogSearch>
  5.             <version>0.1.0</version>
  6.         </EC_CatalogSearch>
  7.     </modules>
  8.     <global>
  9.         <helpers>
  10.             <catalogSearch>
  11.                 <rewrite>
  12.                     <data>EC_CatalogSearch_Helper_Data</data>
  13.                 </rewrite>
  14.             </catalogSearch>
  15.         </helpers>
  16.         <blocks>
  17.             <catalogsearch>
  18.                 <rewrite>
  19.                     <result>EC_CatalogSearch_Block_Result</result>
  20.                 </rewrite>
  21.             </catalogsearch>
  22.         </blocks>
  23.     </global>
  24. </config>

yeah exactly :S

Possibly Relevant Posts:

  • Magento Module Not Working? This Might be Why
  • Magento More Detailed Exception Log
  • Magento Checkout Empties Basket + Solution
  • Magento Tip – Rename Your Theme Directory
  • Magento UK
Get in Touch with Edmonds about Magento Overiding XML Case Inconsistency Continues
Add Comments

Optimised Magento AMI for Amazon EC2 – Host Magento on the Cloud

June 17th, 2009
Read More magento

Recently spoke to a client about the possiblity of setting up Magento on EC2 and remembered that I had seen a pre optimised AMI including caching etc to hopefully run Magento well.

A quick bit of Googling though and I saw that the top results are all people charging for AMI's.

That can't be right, so I thought I would do a quick post to give the free optimsed AMI an SEO booster.

Debian Etch Linux Optimized for Magento:
Magento Optimised AMI for Amazon EC2

Possibly Relevant Posts:

  • no matches
Get in Touch with Edmonds about Optimised Magento AMI for Amazon EC2 – Host Magento on the Cloud
Add Comments

Magento Module Not Working? This Might be Why

June 15th, 2009
Read More magento

After a few hours of intense googling I have finally figured out why my Magento custom module is refusing to activate. I finally figured it out. It's all because the snippet of XML that I copied and pasted off a tutorial somewhere did not have the right capitalisation.

doesn't work - EC_All.xml

PLAIN TEXT
XML:
  1. <?xml version="1.0"?>
  2. <config>
  3.     <modules>
  4.         <EC_CatalogSearch>
  5.             <active>true</active>
  6.             <codepool>local</codepool>
  7.         </EC_CatalogSearch>
  8.     </modules>
  9. </config>

does work - EC_All.xml

PLAIN TEXT
XML:
  1. <?xml version="1.0"?>
  2. <config>
  3.     <modules>
  4.         <EC_CatalogSearch>
  5.             <active>true</active>
  6.             <codePool>local</codePool>
  7.         </EC_CatalogSearch>
  8.     </modules>
  9. </config>

I think next time I'm just going to use the module creator!

Possibly Relevant Posts:

  • no matches
Get in Touch with Edmonds about Magento Module Not Working? This Might be Why
3 Comments
Next Articles »
Next Page »
  • RSS Feed
  • Categories

    • apache
    • barcode
    • business
    • creloaded
    • css
    • curl
    • customer services
    • debugging
    • eclipse
    • ecommerce
    • edmondscommerce
    • email
    • excel
    • firefox
    • flash
    • gd
    • git
    • graphs
    • hosting
    • icecat
    • internet news
    • javascript
    • link building
    • linux
    • mac
    • magento
    • management
    • misc
    • mod_rewrite
    • mysql
    • open suse
    • oscommerce
    • php
    • plesk
    • portfolio
    • product catalogue
    • product feed
    • programming
    • regular expressions
    • ria
    • scraping
    • search engine optimisation
    • security
    • seo
    • spidering
    • twitter
    • ubuntu
    • Uncategorized
    • usability
    • vps
    • web design
    • web development
    • Windows
    • xampp
    • zend framework
    • zip
  • Archives

    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
  • Tags

    alpha browser case creloaded css curl development directories filezilla firefox flush google googlecheckout hosts file html internet explorer jaunty links linux magento migration mod_security mysql myths oscommerce php plesk reciprocal linking rgba search engine optimisation seo spidering spotify ssl synchronisation table transparency ubuntu uk virtualbox web web design xml zend form zend framework
  • Random Posts

    • MySQL DB Admin GUI for Windows / XAMPP
    • Great Desktop Wallpaper Collection
    • Advanced PHP Debug Function
    • osCommerce Easypopulate File Creator Class
    • Zend_Dojo Dijits and Numeric ID's
    • Ubuntu Force Quit
    • MySQL Copy Table from One Database to Another
    • Magento Module Not Working? This Might be Why
    • Domain Names and HOSTS File
    • osCommerce Password Reset Using phpMyAdmin
  • Most Popular Posts

    • MySQL Copy Table from One Database to Another (15)
    • PHP Email Attachment Function (10)
    • PHP Save Images Using cURL (6)
    • PHP, cURL, CURLOPT FOLLOWLOCATION and open basedir Or Safe Mode (6)
    • Magento Sites Go Down if Magentocommerce.com Goes Down (6)
  • Recent Comments

    • admin on Migrate Magento to Alternative Server
    • jon on Migrate Magento to Alternative Server
    • admin on Magento Sites Go Down if Magentocommerce.com Goes Down
    • Sam on Magento Sites Go Down if Magentocommerce.com Goes Down
    • Email Attachments with PHP | S-Carter.co.uk on PHP Email Attachment Function

Edmonds Commerce related questions? Send us a message or call us on 0844 357 0201.

Freelance PHP Web Design UK Commercial Web Design