Recent juggling of multiple projects has created a need to track what I’ve been
doing day by day, as well as keep some notes on what I want to be doing. I have
thus revived a system I created long ago to edit a weekly log file in my
favorite editor (vim) via a keyboard shortcut. As I’m currently working mostly
in OS X, this required some modifications from the Linux version I used in the
past. The desired action is relatively simple. I press a hotkey combination and a
text editor window opens with the current week’s log file, which has been
created on the fly if it didn’t already exist.
Read more…
The HTML 5 initiative contains a draft spec for WebSockets which allow a browser
to establish a full-duplex, bi-directional communication channel over a single
TCP socket. This allows web developers to establish real time two way
communications with a server using simple javascript without resorting to Flash,
Java, ajax long polling, comet, forever iframe, or other current workarounds.
Here I’ve written a simple browser chat using WebSockets for the client and
PHP for the server.
Read more…
This is another weekly summary of the live video class
HTML 5 Mobile Web Development. I have already written a
summary of week 2. This week we are going to use ajax to request live
Twitter updates, use some CSS3 transitions, and explore web fonts.
Read more…
I am way overdue upgrading my primary work machine to the latest Ubuntu release.
The biggest thing that has been holding me back (besides finding the time) is
the fear of losing some file or system config which will take ages to recreate.
Often when I upgrade a system like this, I simply install a new hard drive and
keep the old drive around in case I need to dig up some file I don’t have handy
in any other location. But this is a laptop and I am already nearly out of free
space. What I’m going to do this time is use Squashfs to create a
compressed, read-only filesystem inside a file which can be placed on an
external drive.
Read more…
I am currently attending a live video class HTML 5 Mobile Web Development,
and am summarizing the second lesson here in order to digest the material better
and help some friends who got a late start. If you want to follow along, go to
the class download page linked at the end and download the code.
This week starts our construction of “Tweetstr”, a mobile web twitter client.
We create and edit the basic HTML and CSS files to display the home screen while
exploring some new HTML 5 and CSS 3 tags as well as some settings specific to
Apple devices such as the iPhone.
Read more…
Vim is my editor of choice for any file that doesn’t need a full IDE, and I
generally have multiple files open in various windows at any point in time. In
its default configuration, for each file you have open, vim creates a hidden
swap file in the same directory with the extension “.swp”. Unfortunately, if
any of those files reside inside my Dropbox folder, the Dropbox program
notices the swap files and syncs them up to the cloud. Read on to see how to
change that behavior without losing the advantages that swap files give.
Read more…
The EXPLAIN command in MySQL is an essential diagnostic tool for any database
developer. With it you can learn the details of how the server processes any
query and therefore where to spend your time optimizing the query and/or the
server indexes. It should be the first thing you check when facing a slow
query.
Read more…
Occasionally when using vim to edit large amounts of text, such as writing a
blog post, or formatting a large code comment, I wish to hard wrap the lines at
a certain number of columns for ease of reading. Here is a simple vim function
which uses the built in syntax highlighting capabilities of vim to highlight any
line which extends beyond 80 columns of text, allowing me to add line breaks as
I see fit, while leaving long lines of code alone. As an added bonus, it looks
really nice in the gui version of vim while still remaining usable in the
console version.
Read more…
MySQL Proxy is a handy little utility for MySQL 5.0 and above which can be
used to troubleshoot the database parts of an existing application without
modifying the code to add lots of debugging statements. It speaks the MySQL
binary protocol and can be placed between an application and its database,
allowing you to inspect, log, and even manipulate the proxied queries and
results.
Read more…
A union is a type of join which allows you to glue two or more separate SELECT
queries into a single result set. The structure of each query needs to be the
same, meaning that the number of columns and their data types should match for
all queries used in the union, and the column names or aliases from the first
query determine the names of the final result columns.
Read more…