Chris Hope's LAMP Blog's Image

Chris Hope's LAMP Blog

http://www.electrictoolbox.com
More about this blog
Latest Post
30 Aug 2010
Total Posts
211
Readers
1888
Liked
0
Disliked
0
Views-Per-Post
08.95
vote up
0
vote down

Using an include file for footer links with PHP

I was asked an interesting question by email over the weekend and thought I'd share my response here. The question was "I wish to include in the footer links to my other developed websites. I don't wish to update the footer on each html page every
Aug 30 2010 01:17 PM
vote up
0
vote down

Detect IE6 with jQuery or Conditional Comments

I rarely need to detect whether the user's browser is Internet Explorer version 6 but when working on some stylized drop down boxes using the Stylish Select Box jQuery plugin the customisation I had done wouldn't render in IE6 so I decided to make it so
Aug 18 2010 06:29 AM
vote up
0
vote down

PHP: get keywords from search engine referer url

This post shows how to use PHP to extract the keywords searched on by a user when they found your website using a seach engine. Bing, Google and Yahoo are covered here and you can easily add your own to the PHP code supplied.
Aug 16 2010 03:20 PM
vote up
0
vote down

Apple Magic Trackpad on Windows (not Boot Camp)

I started using an Apple Magic Trackpad yesterday and already far prefer it to a mouse (I'll do a review of it next week once I've used it a bit more). This post has a link to a page which shows how to connect a Magic Trackpad to a Windows machine that's
Aug 14 2010 09:58 AM
vote up
0
vote down

Prevent Parallels creating Windows application folders in the Dock

When Parallels starts a Windows Virtual Machine it creates a folder in the dock containing Windows Applications. I run my Parallels Virtual Machines in windowed mode so prefer these folders not to be created at all. This post shows how to prevent
Aug 13 2010 04:03 PM
vote up
0
vote down

Password protection with Apache but allow from an IP address

I have posted how to password protect a directory and remove password protection from a subdirectory with Apache and in this post look at how to have a password for all users except those from a defined IP address or set of IP addresses.
Aug 11 2010 01:33 PM
vote up
0
vote down

SilverStripe: Escape raw values for a SQL query

This is just quick little post for self reference to show how to escape values which go into a raw SQL query in SilverStripe; I find myself never being able to remember this and having to always look it up.
Aug 10 2010 01:52 AM
vote up
0
vote down

Download/embed fonts with @font-face

I wouldn't normally bother with anything other than the default web fonts but the design for the new Personalised Plates website (still in development) calls for a stylized font which is similar to that used on the plates themselves for headings, lead-in
Aug 07 2010 08:39 AM
vote up
0
vote down

Vendor-prefixed CSS Property Overview

CSS allows for vendor-specific extensions which can start with a dash or an underscore, although in practise they all appear to start with a dash. Although this is declared in the official syntax reference, the W3C does recommend that authors should
Aug 06 2010 09:47 AM
vote up
0
vote down

Track outgoing links with Google Analytics and jQuery

Neal Grosskopf posted "Tracking Outgoing Links in Google Analytics Using Event Tracking and jQuery" which looks at the correct way to track outgoing links compared with the incorrect way people often post which suggests to track them as
Aug 04 2010 10:10 AM
vote up
0
vote down

SilverStripe InPast solution for bug

SilverStripe date fields have a number of functions that can be used on them in templates; one of these is the InPast function which unfortunately appears to have a bug in it (at least in SS 2.4.0 and 2.4.1). This post looks at the issue and the
Aug 03 2010 08:41 AM
vote up
0
vote down

HTML5: Valid characters for the ID attribute

A while back I posted the rules around the use of the HTML ID attribute; the post was specific for HTML4 and I obviously need to post an update to allow for HTML5 which is a lot more flexible.
Aug 02 2010 04:40 PM
vote up
0
vote down

Resize image in Facebox to fit browser height

I was asked a couple of days ago how to resize an image within a Facebox popup so that it is no height than the height of the window so the user doesn't have to scroll. This post shows how to do this using the afterReveal.facebox trigger.
Jul 30 2010 02:01 PM
vote up
0
vote down

HTML5 Tips, Tricks and Techniques

The post "HTML5 Unleashed: Tips, Tricks and Techniques" over at w3avenue has a really good introduction to HTML5 covering new features, browser support, semantic markup, form enhancements and more, along with some screenshots and demos.
Jul 28 2010 09:50 AM
vote up
0
vote down

HTML5: Wrap Block-Level Elements with anchor tags

David Walsh posted "HTML5: Wrap Block-Level Elements with A’s" which looks at a new feature in HTML5 which allows anchor tags to contain block level elements such as divs. This saves having to put many additional <a> tags within
Jul 27 2010 04:34 PM
vote up
0
vote down

PHP email validation with filter_var - updated

Just over a year ago I posted how to validate email addresses with PHP using filter_var instead of having to mess around with regular expressions. As pointed out in a comment, chris@example will pass validation; while that is actually a valid email
Jul 23 2010 01:18 PM
vote up
0
vote down

Target links to _top with jQuery

Amazingly some people still use <frameset> and <frame> tags around the web, as I discovered the other day when someone linked my Running Calendar website into their frameset website. A common approach to this problem is to detect if the page
Jul 21 2010 08:43 AM
vote up
0
vote down

Create thumbnails from images on a webpage with PHP

In previous posts I have looked at how to extract images from a web page with PHP and the Simple HTML DOM Parser and generate thumbnails with PHP using a class I created. This page combines the two by downloading all the images from a specified web page
Jul 20 2010 12:04 PM
vote up
0
vote down

PHP Quick Tip: Check if URL aware fopen wrappers are enabled

PHP supports opening remote URLs (e.g. http://www.example.com/something.htmnl) using the fopen and similar functions. It is possible to disable this function in the PHP configuration so this quick tip shows how to check if it is possible to open remote
Jul 19 2010 12:32 PM
vote up
0
vote down

Generate thumbnails with PHP

There are many examples and tutorials online about how to generate thumbnail images with PHP but I decided to add another one myself in order to follow up an earlier post titled "extract images from a web page with PHP and the Simple HTML DOM
Jul 16 2010 03:35 PM
vote up
0
vote down

Turn off PHP on Apache

This post is a response to a question asked on my "Disable PHP in a directory with Apache .htaccess" article asking how to disable PHP completely in Apache, or as it was asked: "Could you tell me how can I turn off PHP on Apache (Run
Jul 14 2010 08:47 AM
vote up
0
vote down

Mac OSX Apps I use

I switched from Windows to Mac OSX just over a month ago after buying a MacMini so I can test websites using the iPhone/iPad simulator (see related posts links at the end of this post for more details about my 30 day OSX challenge). This post looks at
Jul 13 2010 10:03 AM
vote up
0
vote down

32 days of OSX

32 days ago I began my "30 day OSX challenge" after buying a MacMini so I could use the iPhone and iPad simulators, as well as for once being able to test websites on a Mac. I had decided that because I'd bought this shiny new box I should
Jul 12 2010 04:11 PM
vote up
0
vote down

Subversion Command Line Script to export changed files V2

I recently posted a Subversion Command Line Script to export changed files and in response to a comment on that page have posted a new version here, which writes out the current revision number to a file and only exports from that revision when the
Jul 09 2010 08:47 PM
vote up
0
vote down

jQuery: set title of anchor tags to the href for offsite links

Over a year ago I posted how to use jQuery to make all offsite links open in a new window. I recently received a comment on that page asking how to make the title attribute of all anchor tags on a page for offsite links be the same as the href. This post
Jul 06 2010 08:41 PM
vote up
0
vote down

Check if user is root/sudo before running a script

Sometimes a script may need to only be run as root or using sudo, or run ensuring that it is not being run by root or using sudo. This quick post shows how to check if it's the root user and exit the script.
Jul 06 2010 12:57 AM
vote up
0
vote down

Write content into a dynamic Javascript popup from FCKEditor

In response to a question asked on my "Count the words in an FCKeditor instance with Javascript" post about how to get the content from an FCKEditor instance and load it into a popup window, I posted "Write content into a dynamic
Jul 02 2010 12:13 AM
vote up
0
vote down

Write content into a dynamic Javascript popup

I've posted a few articles about the Facebox lightbox dialog recently but sometimes a quick and dirty post of content into a regular window.open popup is all that is required. This post shows how to open a Javascript window and write content into it
Jun 30 2010 09:03 PM
vote up
0
vote down

Remove password protection from a subdirectory with Apache

When a directory is password protected with Apache either with a .htaccess file or in the main Apache configuration, all subdirectories are also password protected. This post shows how to remove password protection from a subdirectory and from an
Jun 29 2010 08:07 PM
vote up
0
vote down

Password protect a directory with Apache

This post is more of a self-reference than anything because there are probably fifty million other posts on the Internet showing how to password protect a directory with an Apache .htaccess file...
Jun 28 2010 09:26 PM
vote up
0
vote down

OSX Quick Tip: Prevent .ds_store files being written on network shares

When using network shares (e.g. from Samba or Windows servers) on OSX .DS_Store files will be written out when accessing directories. This post shows how to prevent this from happening.
Jun 28 2010 06:53 AM
vote up
0
vote down

Find all symbolic links with the find command

This quick tip shows how to find all the symbolic links under a particular directory using the "find" command from the command line on UNIX based systems such as Linux, OSX and BSD.
Jun 24 2010 07:44 PM
vote up
0
vote down

OSX Quick Tip: How to remove automator services

The Automator in OSX allows you to create processes, services, folder actions etc. Once you have created a service in Automator there doesn't appear to be a way to delete it in the Automater app.
Jun 21 2010 08:02 PM
vote up
0
vote down

jQuery: hide text when the page is loaded and show it later

This post is a response to a question asked on my "Show and hide an element with jQuery - Part 1 of 2" article about how to hide text when the page loads and then show it with a button (or some other method to reveal the text at a later time).
Jun 21 2010 01:31 AM
vote up
0
vote down

Fix "the operation can't be completed because you don't have permission to access some of the items" error on OSX

I run my webserver and file server from a virtual machine with the files shared using Samba (yes, now that I'm running on OSX I should really share the files with NFS but that's for another day). When trying to copy files from the Mac to the Samba share
Jun 19 2010 08:55 PM
vote up
0
vote down

Netbeans Quick Tip: Use tabs not spaces

If you are like me and you prefer to have tabs and not spaces for code indentation and are using Netbeans, it uses spaces by default. This quick little post shows how to use tabs instead.
Jun 17 2010 09:01 PM
vote up
0
vote down

Subversion Command Line Script to export changed files

A couple of days ago I posted how to export just the added/modified files from a subversion repository between two revisions using TortoiseSVN, the Windows Explorer SVN plugin. This post has a command line script which is used to achieve the same thing
Jun 17 2010 04:13 AM
vote up
0
vote down

Netbeans Quick Tip: Syntax Highlighting and File Extensions

If you have some random file name extension (such as .ss for SilverStripe templates) which Netbeans doesn't know about, it's easy to configure it to use the correct syntax highlighting.
Jun 15 2010 10:57 PM
vote up
0
vote down

Exporting only changed files in TortoiseSVN between versions

TortoiseSVN is a power SVN client that plugs into Windows Explorer. This post looks at how to export just the changed files between two version numbers.
Jun 14 2010 07:59 PM
vote up
0
vote down

OSX Quick Tip: Show all files in the Finder including dot files

The default behavior of the Finder on OSX is to hide UNIX files such as /usr /var etc and dot files (e.g. .htaccess). This quick tip shows how to enable (or disable) showing these files.
Jun 13 2010 09:23 PM