John Cox

Blogs · @wyome

Tagged tutorial · everything

Turning the Tables - MySQL

This tutorial demonstrates how to enable and create InnoDB tables in MySQL, which are necessary for transaction support since the default MyISAM format doesn't support transactions. It shows how to verify InnoDB support using the "have_innodb" variable, create new tables with the TYPE=InnoDB clause, and convert existing MyISAM tables to InnoDB format using ALTER TABLE commands. The piece provides practical SQL examples for setting up a sample database with users, groups, and mailboxes tables as a foundation for learning transaction implementation.

Permalink

thepeg/MediaTable · GitHub

This is an archived GitHub repository from 2011 containing a jQuery plugin for creating responsive media tables, with accompanying CSS styling and a polyfill for older browsers. The author has explicitly marked it as outdated and intentionally preserved it as a historical record of their earlier coding practices, discouraging current use or cloning.

Permalink

Self-updating scripts | High Performance Web Sites

This article proposes a technique for third-party web snippets to use long cache times (like one year) without preventing timely updates, solving the problem that snippets traditionally use short cache times (30 minutes to 2 hours) to receive updates, which causes performance-degrading conditional GET requests. The solution works by embedding a version number in the bootstrap script and having the server respond to subsequent requests (like beacons) with JavaScript that dynamically creates and reloads an iframe containing the bootstrap script, forcing a cache refresh only when an actual update exists. Snippet owners can adopt this by adding versioning, passing the version back to their server, returning update-triggering JavaScript when needed, and creating an update.php page that references the resources to be refreshed.

Permalink

Caching Tutorial for Web Authors and Webmasters

Web caches store copies of content (HTML, images, files) between origin servers and clients to reduce latency and network bandwidth usage, with three main types: browser caches on individual computers, proxy caches serving multiple users on networks, and gateway caches deployed by websites themselves or through content delivery networks. The document provides detailed guidance on controlling cache behavior through HTTP headers like Cache-Control and Expires rather than ineffective HTML meta tags, and explains how validation mechanisms like ETags and Last-Modified dates allow caches to verify content freshness without re-downloading entire files. Webmasters should embrace caching by using consistent URLs, setting appropriate expiration times, and writing cache-aware scripts, since proxy and browser caches will exist whether configured or not, and sites optimized for caching can load dramatically faster while reducing server load.

Permalink

SQL Indexing Tutorial | Use The Index, Luke!

This is a comprehensive free web guide to SQL indexing fundamentals across major database systems (MySQL, Oracle, PostgreSQL, SQL Server, DB2), teaching developers the practical mechanics of how indexes work—from B-tree structures to multi-column indexes to join operations—rather than abstract administration concepts. The guide covers both what makes indexes effective (exact lookups, range searches, covering indexes) and common mistakes that slow them down (functions in WHERE clauses, type mismatches, over-indexing), with vendor-specific testing notes provided throughout.

Permalink

Manipulating the browser history - MDN

This documentation explains JavaScript's History API for navigating browser session history. The back(), forward(), and go() methods allow programmatic control equivalent to clicking browser navigation buttons, while go() can also jump to specific pages or refresh the current page. The History interface also supports pushState() and replaceState() to modify the history stack and trigger popstate events when navigation occurs.

Permalink

timeago: a jQuery plugin

Timeago is a jQuery plugin that converts static timestamps into automatically updating relative times (like "4 minutes ago"), which refresh periodically to stay current without server-side recalculation. It works by attaching to HTML5 time elements or legacy abbr tags with ISO 8601 datetime values, and supports configuration options for future/past timestamps, multiple languages, and timezone handling. The plugin eliminates the problem of stale timestamps in cached pages while allowing developers to leverage standard HTML markup.

Permalink

Checking your code with PHP Code Sniffer in PhpStorm 4.0 | WebStorm & PhpStorm Blog

PhpStorm 4.0 integrates PHP Code Sniffer to automatically validate code style as you edit files, displaying warnings prefixed with "phpcs" to distinguish them from the IDE's own inspections. The setup requires installing PHP Code Sniffer independently and configuring it in PhpStorm, after which validation runs continuously on any open PHP file, with results appearing within seconds even for large files without blocking editing.

Permalink

Internet Explorer for Mac the Easy Way: Run IE 7, IE8, & IE9 Free in a Virtual Machine

Mac users needing to test Internet Explorer can use Oracle's free VirtualBox virtualization software combined with Microsoft's free IE testing virtual machines, automated through a simple bash script that downloads and converts the images for Mac compatibility. Each IE version requires about 11GB of disk space, and the method bypasses Microsoft's 30-day Windows trial limit by using VirtualBox snapshots that can be reverted indefinitely to reset the expiration timer. This approach is cheaper and more convenient than paid virtualization options like Parallels or VMWare, making it ideal for web developers who need to test site compatibility across multiple IE versions.

Permalink

hoverIntent jQuery Plug-in

hoverIntent is a jQuery plugin that improves the standard hover method by only triggering handlers when the user's mouse slows down, rather than firing immediately upon entering an element. This prevents unwanted animations or AJAX calls from executing when users are merely passing their cursor over large target areas rather than deliberately interacting with them.

Permalink

Image CRUD for Codeigniter | WEB and DEVELOPMENT;

Image CRUD is a CodeIgniter library that simplifies multiple image uploads with automatic thumbnail generation, resizing, and reordering capabilities. It follows the same minimal-code philosophy as Grocery CRUD, allowing developers to implement complex image management functionality with just a few lines of code while handling tasks like special character renaming and relational database integration automatically.

Permalink