Epi Tea – Where Passions Unite

Take a look my friend’s new blog about tea: http://epiteablog.com/

He has some neat information on the science and history of tea, how to brew it properly, and reviews of various teas. There will also be a store opening soon.

Here’s an excerpt from one of his latest posts about the origins of Rooibos tea.

So, what is this Rooibos Tea?

For centuries in a small part of what is now South Africa, people were using a redish bush to cure ailments, promote health, and increase longevity. The people there took the dried leaves of this bush to make what we now call Rooibos tea (roy-bos).

This Rooibos tea remained in South Africa for centuries until very recently. Even at the dawn of the new century Rooibos tea was not widely known outside of the country…

So far it’s looking very promising and active, with multiple updates a week. Go check it out: http://epiteablog.com/

New versions of Textarea Line Count, dialogWrapper, and wrapDetector

Changes, changes. I’ve just finished adding the grunt build system to all my JavaScript projects. This has made it so much easier to manage them.

Now instead of manually generating the minified versions (copy-pasting to Google Closure Compiler), worrying about the license files being up to date, etc., I can issue a single command and everything is taken care of.

This also means that JSLint is run whenever I build my projects. So naturally, in the span of a few hours I caught a bunch of warnings and errors that I had previously never seen. I’ll go through the projects one at a time.


Textarea Line Count

Very important fixes. Updated to version 1.4. Let me say, I’m surprised that I didn’t receive any bug reports on version 1.3. Running JSLint revealed variables that didn’t exist, or that were named incorrectly. Oops. That’s what I get for not using a build system sooner.



Updated to version 2.1.1. No bug fixes here, just a few minor changes to keep JSLint happy.



Updated to version 1.0.1. Same as with dialogWrapper.

All projects have been moved to BitBucket

I’ve just finished moving all my projects to BitBucket and changing their version control systems to Mercurial. This change was a long time coming: Subversion was really pissing me off (I know Google Code supports it but BitBucket has a nicer interface) and Google Code had a few annoyances.

So, here are the updated links for each project:

I’ve also gone through my past posts to remove references and links to Google Code. If I missed a Google Code reference, please let me know in the comments below.

Using css2xpath to inline CSS stylesheets

I was looking through my referrer stats the other day and found a neat use of my port of css2xpathhttp://chrispebble.com/inlining-a-css-stylesheet-with-c/.

The author uses css2xpath to aid in inlining CSS stylesheets. Here is an excerpt of the project (I trimmed the first two paragraphs):

This week I worked on adding confirmation emails to our quiz system and was introduced to the maddeningly fickle world of HTML emails…

I had hoped that the detailed confirmation emails could simply re-use the HTML that our system already generated, but after a few test emails it became apparent that most of that HTML relied heavily on external stylesheets which no email client would render. With mounting dread I foresaw the likelihood that I would have to write another rendering engine for emails rather than re-using the one we already had…

Willing to do almost anything to avoid this code duplication I wondered if I could take the HTML rendered by the existing quiz engine and just tweak it to get it work in our emails. So how hard would it be to write some code that took these external stylesheets and applied them as inline rules (which is supported to some degree by most email clients)? Not hard at all as it turns out.

Read about the full project here: http://chrispebble.com/inlining-a-css-stylesheet-with-c/

SPI with Arduino

After a lot of hunting around, I finally found a great resource on using Arduino as a SPI slave: http://www.gammon.com.au/forum/?id=10892

Plenty of resources exist for using Arduino as a SPI master (including Arduino’s own SPI library), but I couldn’t find much on using it as a slave. That link includes information on both. I hope someone else finds it as useful as I did.

To assist in debugging SPI (master or slave) with Arduino (or any other microcontroller for that matter), I suggest using a logic analyzer such as this 8 channel Saleae USB Logic Analyzer:

Saleae Logic USB Logic Analyzer

(image property of Amazon)

Bye bye GoDaddy, and hello Hawk Host!

Although I’ve generally been dissatisfied with GoDaddy (sex-sells marketing, constant up-sells, etc.), their most recent infraction really pushed me over the edge: error logs are not enabled by default.

Logs must be explicitly enabled, which isn’t very helpful after an error has just occurred, which is usually the case on a live site. Granted, this was on a shared hosting server. But, considering that I was paying about $8 a month, you’d think that such a simple feature wouldn’t be too much to ask for. With this in mind, I began researching replacement web hosts.

I don’t remember exactly how I discovered Hawk Host, but it might have been after reading this review on SitePoint. After a little more digging around, I found that the general consensus was that it is a good company with fast and helpful support. Case and point: During my research, I had a question about domain transfers so I sent them an email. Not only did I get a response a few hours later, but it was from the CEO! I’m not sure if it’s standard practice for him to answer a few support emails here and there, but I was sold.

After exchanging a few more emails, I committed to a hosting plan with two domain transfers. During setup, I did encounter a few problems (which turned out to be related to my stupidity), but HawkHost’s support was very helpful. It was refreshing to get responses that actually pertained to my problem, as opposed to a canned response (*cough* GoDaddy *cough*). They had a very “Yes, we can help you do that.” attitude that I really liked.

The thing I immediately noticed was how fast HawkHost’s servers are; hopefully you too have noticed that this blog has gotten faster. I was so sick of 10 second page loads, even with caching. I don’t even have caching installed on this site anymore!

Some other benefits I’ve noticed after switching from GoDaddy:

  • The administration console is CPanel
  • Unlimited MySQL databases (this was one of the main perks that convinced me to switch)
  • The ability to host multiple separate sites with even the Basic hosting package!
  • I haven’t seen a single up-sell attempt anywhere
  • Free CloudFlare integration


I could go on, but I’d rather keep this post short and end here: If you are looking for a place to host your site, take a look at HawkHost.

P.S. I do not work for HawkHost or their related companies. I did not receive any compensation for this review. However, I did link to HawkHost using my affiliate link, which all customers get for free.

dialogWrapper 2.1 Released

IMPORTANT: Please read this blog post before updating. The latest version, by default, breaks compatibility with previous versions!

I am happy to announce that dialogWrapper 2.1 has been released! Download/read about it at BitBucket: https://bitbucket.org/MostThingsWeb/dialogwrapper


What’s new?

The biggest change is that all methods are now namespaced! For example, instead of writing:

$.alert("This is an alert dialog!");

… by default you must now write:

$.dW.alert("This is an alert dialog!");

Why did I do this? Well, I was getting concerned about my polluting the global $ namespace. It should now be easier for my plugin to work with other plugins that may have used the same or similar function names.


But that breaks compatibility!?

You can use the new $.dW.classicMode() method to restore the old style functions. Just call it once, with no arguments. Then you can go back to using $.createDialog and friends instead of the new namespaced versions.


What else is new?

This version has a few new nice features:

  • The callbacks for $.dW.alert(), $.dW.confirm(), and $.dW.input() are now executed within the context of the dialog. That means that you can now use this within the handler to reference the dialog.
  • I added a callback to $.dW.alert() that is executed when the Ok button is clicked.
  • Options that dialogWrapper adds, with hasClose being the only one so far, are now defaulted in $.ui.dialog.prototype.options, along with native options. This way, you can easily modify the default hasClose setting.
  • You can now change the hasClose option at runtime using the usual method.
  • From this version forward, you can access the version string using $.dW.version.
  • I’ve exposed $.dW.findDialog, which is a utility method that attempts to resolve the given identifier to a dialog object.


And a couple of minor changes:
  • I’ve removed the smartModalsForClassicDialogs and smartModals options since they became redundant.
  • The default prefix for dialog IDs is now dWd instead of dwd.
  • A few bug fixes.
  • A couple of internal changes; if you are interested, read the full changelog in the source.

jQuery Deconstructed

I really enjoy exploring jQuery’s source code. Recently, I’ve been using James Padolsey’s jQuery Source Viewer. It’s a really neat tool that lets you type in the name of a function (even if it’s an internal function!) and view its source.

Just today, I’ve discovered a different tool/series called JS Libs Deconstructed. Not only will it let you explore jQuery’s source code, but it also works with Prototype and MooTools. But, since I’m more interested in jQuery, I’ll just link the jQuery version: http://www.keyframesandcode.com/resources/javascript/deconstructed/jquery/.


This blurb from their website sums up the purpose of the tool nicely:

The Deconstructed series is designed to visually and interactively deconstruct the internal code of JavaScript libraries, including jQueryPrototype and MooTools.

It breaks the physical JavaScript into visual blocks that you can easiliy navigate. Each block opens to reveal its internal code. Clickable hyperlinks allow you to follow program flow.

What is interesting about the tool is that you do not necessarily need to know the name of the function you are looking for.  What’s more, you can explore more than just functions! If, for example, you are interested in how jQuery can recognize attributes in selectors (e.g. $("div[name=mydiv]")), you can go to the Attributes section (1/3 of the way down), and view the Regular expressions that jQuery uses. In this particular example, the regular expressions are stored in a “private” variable, so it’s something that the other tool can’t access.

My only complaint is that individual sections and code blocks are not permalinked, but I’m sure that will happen in another update. Anyway, I can see it being very useful. Check it out: http://www.keyframesandcode.com/resources/javascript/deconstructed/.