Monthly Archives: July 2011

javascript keyboard buffer, part 4

Previously, we created a JavaScript keyboard buffer that can edit text in a static html page as well as play back each key as it was typed. I would like to combine all of this into a single JavaScript include … Continue reading

Posted in css, html, javascript, software arch. | Leave a comment

javascript keyboard buffer, part 3

Previously, we created a javascript keyboard buffer that can edit text in a static html page. Using those functions I'd like to add a buffer replay. I would like to add an onclick event to a specified div such that … Continue reading

Posted in javascript | Leave a comment

javascript keyboard buffer, part 2

Previously, we created a javascript keyboard buffer and next I'd like to process that buffer to edit text in a static html page. Given the following simple html: <div id="keyboardBufferTest"> Spam and eggs </div> I would like the keyboard buffer … Continue reading

Posted in javascript | Leave a comment

javascript keyboard buffer, part 1

I would like to capture keystrokes in JavaScript, save them to a buffer, and play them back exactly as they were typed. There are three onkey events that can be assigned event handlers, these are, document.onkeydown = eventHandler document.onkeypress = … Continue reading

Posted in javascript | Leave a comment

javascript prototype

I would to extend the functionality of a JavaScript class, for example, to add utility functions to a specific Object. Object.prototype The prototype property can be used to add new properties and functions to any object, including built-in objects. For … Continue reading

Posted in javascript | Leave a comment

sql, users not in group

I would like to find all users not in a specific group, given the following database schema: CREATE TABLE foobar_users ( user_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, username VARCHAR(20) UNIQUE NOT NULL ); CREATE TABLE foobar_groups ( group_id INT UNSIGNED … Continue reading

Posted in mysql | Leave a comment

css opacity in javascript

I want register JavaScript events to toggle CSS opacity on selectable images. For example, given a div with a list of images like the following, <div id="foo_images"> <img src="foo.jpg" /> <img src="bar.jpg" /> <img src="baz.jpg" /> ... </div> I would … Continue reading

Posted in css, html, javascript, software arch. | Leave a comment

html footer at the bottom

I want the footer of an html page to never be higher than the bottom of the browser window. In other words, if there's not enough content to fill a webpage, I want the footer to be at the bottom … Continue reading

Posted in css, html | Leave a comment

database indexes and optimization

Previously, I discussed database schema normalization. Next, I would like to add indexes and optimize a schema for high-volume production usage. Consider the following schema: CREATE TABLE foobar_users ( user_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, username VARCHAR(20) NOT NULL ); … Continue reading

Posted in data arch., mysql | Leave a comment

php DB adapter, decorator

Previously, I created a php database adapter that calls mysql stored procedures as if they were local php functions. Now I want to refactor each of the features of the DB adapter into a decorator design pattern. The core database … Continue reading

Posted in php, software arch. | Leave a comment

php DB adapter, revisited

I would like to call mysql stored procedures as if they were local php functions. For example, let's use the following mysql stored procedure, DELIMITER // CREATE PROCEDURE `usersByPage`(page_num INT, per_page INT) BEGIN SET @lim_start = (page_num - 1) * … Continue reading

Posted in mysql, php, software arch. | Leave a comment

mysqldump, tips and tricks

I want to backup a mysql database. The easiest approach is using mysqldump with its default options, i.e., # mysqldump -u user -h host -ppass db > backup.sql This will dump the full DDL and DML needed to re-create the … Continue reading

Posted in mysql, shell tips | Leave a comment

Denormalization?

Previously, I normalized my tables to Sixth Normal Form (6NF). Now, I want to consider denormalizing, if and when it's appropriate. Denormalizing is different than an un-normalized schema, which is never, ever, recommended. Strategies for denormalization appear in data-warehousing designs, … Continue reading

Posted in data arch., mysql | Comments Off on Denormalization?

Normalization, 6NF

Previously, I normalized my tables to Fifth Normal Form (5NF). Now, I want to continue to normalize such that the tables in my schema are in Sixth Normal Form (6NF). 6NF requires that each table satisfies only trivial join dependencies. … Continue reading

Posted in data arch., mysql | Leave a comment

Normalization, 5NF

Previously, I normalized my tables to Fourth Normal Form (4NF). Now, I want to continue to normalize such that the tables in my schema are in Fifth Normal Form (5NF). 5NF requires that every join dependency in a table is … Continue reading

Posted in data arch., mysql | Leave a comment