The Joy of Regular Expressions

Following on from the last part, this one is more of an intermission—a round up of regex syntax seen so far and a couple of links following feedback.

First you have to check out Andrei’s Regex Clinic (slides / pdf)—even if you don’t get it all, it’s worth it for the pictures at the start ;) That’s Andrei as in Zmievski, as in works at Yahoo, can be blamed for Smarty and PHP-GTK, is one of those who needs thanking when PHP6 (with Unicode) hits the streets and, long ago, even did an interview with Sitepoint.

Andrei’s talk also prompts me to confession: I’m not qualified to tell you about the theory behind regular expressions (if you’re interested, start here and Google for more—or annoy these guys)—I’m coming from a practical perspective so while these blogs will (hopefully) help you discover regexes as a useful tool, don’t expect to find out how to to write your own regex engine.

Strings are a Domain-Specific Language

Question: Isn't a domain-specific language just the same thing as a library? (Source: Pretty much everyone the first time they hear of DSLs.)

Answer: No, a DSL is much more than a library, and I have an example that won't make you say, "Well, sure, if you're doing something that esoteric..."

.NET and Excel Importing

A quick tech tip this week, it’s not ground breaking, it might not even be new to many of you, but it really helped me out. I was looking to buy a component to add a simple Excel import facility to a project, and I had one of those "d’oh" moments.

Amongst all the components for sale, there were search results about using Jet, ISAMs, and OLEDB. I’ve used Office and Jet enough in the past to know that it makes reading an Excel file a straight forward process, but somehow I hadn’t realized that I could do it just as easily using OLEDB from a .NET application.

Hi Ho Silver! Away!

Remember the Lone Ranger? Believe it or not, I actually watched it as a kid. I don’t know why he was called the Lone Ranger, he always seemed to have Tonto - his Indian sidekick with him. Often, I code alone (I thought about rewriting the "I Drink Alone" song to "I Code Alone" but I had only had 1 small cup of coffee when I wrote this) and I’ve been thinking of some "tricks" to help me with my lonely quest.

New Contributor - Peter Harkins

Let's all give a warm welcome to our newest contributor, the incredibly brilliant and good-looking Peter Harkins.

That's right, clap for me -- er, him, clap for him. I'm not writing this about myself. I mean he's not. Crap.

Hi, folks. I'm a new contributor to CodeSnipers. I'll be writing mostly about design and coding, though I may wander into MicroISV territory if any of my side projects should start doing particularly well.

To tell you a little about myself, I'm a 25-year old web developer in Chicago, IL, USA, Earth. I've been programming for about fourteen years, professionally for the last 5.5. My constant obsession is writing code that's just a little bit better, a little bit smarter, a little bit higher-level. Even though the steps I've taken and will be writing about are small, they're a great way to improve code and design every time you touch it.

Say Hello to My Little Friend

With my recent Ruby on Rails project, I've done more on the linux command line than with PHP development. For example, you run a ruby script to generate a code skeleton for scaffolding, controllers, models and views. Stuck with a windows environment for my development on the go (I commute 3 hours a day, in which time I'm hacking away on my laptop, which I am doing right now. In Vim.)

I reached into the crevices of my mind to remember how to create Batch files. Yes, that’s right, batch files. Yes, Good Old MS-DOS. I still have a DOS For Dummies book (aquired long after DOS was out, I just couldn't resist the nostalgia and I think it only cost 2 bucks). I created a batch file for ls, mv and cp. Not rocket science I know and although I had installed cygwin I was not particularly keen on using that all the time, I also had found some exe's that imitate many of the unix commands...but I didn't need all that jazz. I just wanted a ls, mv and cp command!

As my project progressed, I was doing more and more on the server side, tweaking here and there. Man, I said… I need to get VI for windows I knew it existed, I had it many years ago. Actually, I think it was only a dos version that I had. I searched and discovered GVIM. And it’s pretty darn nice!

Admin - CodeSnipers.com Site Makeover

Under the cover of darkness, I've been working on a few Secret Projects*. You're looking at the latest and greatest of them. If you're on CodeSnipers, you've probably already noticed the makeover. Alright, it's less of a makeover and more of a razing and rebuilding from the ground up. Previously, we were using the base Drupal theme bluemarine and then I was poking around OSWD and was inspired by a few of the designs.

Yes, I notice there are a handful of oddities. If you have comments, notice functional oddities, or generally wish to ridicule or compliment the design, please feel free to drop me a note at webmaster at CodeSnipers.com or comment here. Just to protect the innocent, only one of the other CodeSnipers saw this design before it was live...

* Most of the Secret Projects are prototypes and concepts of CaseySoftware projects, so keep an eye out.

Diary of a side project

All the way back in January, I wrote here about my goals for 2006. Although it’s too soon to do a full recap, I’m sure you’ll all be glad to hear that I seem to be making better use of my time this year, my software is still improving and sales seem to be on a gentle upward curve. Irritatingly, I’m still waiting to go home, but that one’s out of my hands.

But, the reason for bringing this back up wasn’t for an update on my progress over the last couple of months, it was because of the remaining goal: to learn more. I suggested that rather than trying to learn a little bit of everything this year, I would focus those few spare brain cycles on just Flash and Ruby on Rails.

Interactive Programming with the REPL

In this week’s post I’ll discuss the joys of interactive programming. For those who write only in compiled (or byte code compiled) languages this may be a foreign concept. There seems to be some level of this feature in most scripted languages. In Lisp interactive programming is supported by a feature known as the REPL, or read-eval-print-loop. It is also known as the top-level listener or simply the top level. Ruby has something similar called the IRB, or interactive ruby shell. In Python it’s just the interactive shell.

Basic Lisp Syntax (or Why Lisp Hurts My Brain)

This week I’ll be getting into some of the basics of the language. I’ll also explore some of the syntax differences that make Lisp look so funny. Rather than just listing all the features of the language, I’ll use some examples and explain how each works. Without further delay, let’s take a look at a basic piece of Lisp code.