Solving the Phantom Interval Problem In Javascript

If you’ve been working in javascript for any length of time you’ve run into the phantom interval problem. Essentially, you’ll have a button that sets an interval and double-clicking that button creates a phantom interval that you can’t clear or control. Here’s an article on how to solve the problem (spoiler: always clear the interval before you set it).

Searching through code

Sure, if you’re on windows you can turn on the ‘search inside File Contents’ option, but it’s slow and annoying.  Far better is to get your code on linux and run this:

find ./src -exec grep "Search Term" '{}' \; -print

The second term is the directory to search in. The “Search Term” is what you are hoping to find in one of the files in the search directory. The search term will be matched exactly and files in all sub-folders will be checked. Super handy.

3D three.js Experiment

three.js experiment

3D Experiment

Over the last couple weeks I’ve been playing with three.js, a javascript-based 3D engine that can render using <canvas>, <svg> and WebGL.  It’s pretty amazing what it can do.

Only the Chrome browser seems to render my experiment fast enough to be usable.  Check it out (using Chrome):

If you liked that, check out check out the examples on the three.js site as well as Mr.doob’s work. adds official support for 4 states (and unofficial support for the other 46)

A great project I work on,, just added official support for therapists in Connecticut, Illinois, New York and Ohio.  Also added: support for therapists in the other 46 states to enter their own requirements and track those.  THT will be adding support for even more states as we grow, come join the community!

If you are a therapist working toward graduation or licensure and would like your school’s or states requirements to be officially supported send an email to support[at] and let us know.

Print PDFs

Just added the ability to print PDF reports to  I chose to use DOMpdf because it’s free, open-source, and fairly light-weight.  Pretty much the only downside I ran into is that styling the PDF is a real b!t$&.  Theoretically it supports CSS2 selectors and most of the style components but I ended up having to do some really non-standard wrangling to get it to look pretty.  What does it take to get a better option?  Sounds like a couple-thousand dollar license.  I’ll stick with a little extra work, thank you.

Announcing Therapy Hours Tracker

Just released a website that I’ve been working on for a number of months now.  It’s a site for therapists-in-training to use to track their client-contact and supervision hours (for those not in the know, these are hours they have to accumulate to graduate and then get their license).  The student enters her hours week-by-week and the site generates a timeline with averages for how many hours of each kind (individual, relational, video supervision, etc.) she needs to be earning in order to graduate and get her license on time.  It also has a section that allows her to generate reports for any time range.  Many sites and schools require monthly hours reports and THT generates these very quickly and easily (and by site too!).  In the next update we plan to roll-out printing of hours reports forms that will be acceptable at most internship sites and university/college programs.

Right now Therapy Hours Tracker is geared mainly toward MFT (marriage and family therapy) students/associated in NY state though it is flexible enough to work for many other states as well.  In the near future we’ll be expanding the format to be customizable for MSW (masters in social work) and others.

It’s getting a really great response in the therapy community.  I’m glad it’s going to be helpful.

Therapy Hours Tracker Logo Monday 26 april

A new website for therapists-in-training.

— Record Your Hours

— Track Your Progress

— Create Reports

Therapy Hours Tracker gives you the tools you need to take control of your hours.

Know where you stand and stay on schedule for graduation and licensure.

Visit the website for more information and to create an account (it’s free and easy!)

Now you’re in control of your future.

Record Your HoursRecord Your Hours Screenshot
Track Your ProgressTrack Your Progress Screenshot
Create ReportsCreate Reports Screenshot

Cronjob backup of database

I’ve been working on ways to automatically backup the database for the website I’m currently developing ( (set to be released in May or June 2010)).  After hunting around for useful ideas (including some great help from SHELLdorado) this is what I came up with:

mysqldump -u username -ppassword -h --all-databases | gzip >  /home/user/backups/mysql_`date +"%Y-%m-%d"`.sql.gz
echo | mutt -a backups/mysql_`date +"%Y-%m-%d"`.sql.gz -- [email protected]

You’ll need to replace the generic names with your specifics (In the first line: username, password, with the login information for your mysql database.  /home/user/backups should become an existing directory on your server where you want to store the dumped files. In the second line backups/ should be the same directory on your server that you saved the dumped file to and [email protected] should be replaced with your email address).

The first line dumps and gzips the database into a file with today’s date in the name (line ends with the first ‘.sql.gz’ and a carriage return).  The second line uses mutt to send me an email with the dumped file as an attachment.

Doesn’t get much cooler than that.

Clipx: Great donationware clipboard manager

Just started using clipx and I love it.  If you have a task where you need to copy and paste a number of different text or image selections repetitively you need a copy of this program.  It stores your copies into a list and you can paste from any one of the items in the list whenever you want.  The best thing is that it seems to be stable.  I’ve used a couple other programs that are supposed to do this but they have been very unweildy.

It’s donationware so send them some beer money if it’s useful to you.