Do Yourself a Favor: Learn Regular Expressions

The first programming language I learned was Perl. Perl was easy to do many things with and it also allowed me to manipulate text strings. Except that instead of doing it the easy way I would often write very, very convoluted chunks of code in an attempt to get the data into or out of a string that existed. I was afraid of this monster that they called RegEx, or as it is properly known: Regular Expressions. Regular Expressions allow you to write an abbreviated syntax structure that will look for matches and patterns within the text string and then, depending on the function you’re using, do a comparison (match) or do a text replacement.

Just last night I was trying to manipulate a URL and get one parameter out of it, the view parameter in JavaScript. instead of a bunch of indexOf calls and burying myself in lines of code I got the variable with one line of code:
tempStr.replace(/(^.+)(view=)([a-z_]+)(&.+)/, "$3");
JavaScript syntax allows you to use the forward slash to wrap the beginning and end of a regular experssion, then I used a group of regular expressions within that text to find the view value. Upon finding the match I printed out the third pattern that matched into a variable that is returned (patterns in this context are grouped with parenthesis).

You can learn more about regular expesesions here, but I recommend you find a tutorial for using regular expressions in the languages you code in.

Abby is Now Signed Up for School

Abby is now signed up for school, which is to say that Jessica is an emotional mess.  OK, mess, is an overstatement, but its really hitting her that her baby is not much of a baby any more.  Abby will be attending a one day a week school that will allow us to do a hybrid of homeschooling and public schooling.  The city of Aurora hosts this program that will allow her to go in and do things in a classroom environment.  That’s all I know about this system other than when she’s in high school she’ll be able to take college courses and I’ll get to pay a lot less for them.  Yeah for school!

I Hold Me Responsible

Apparently 2.5 days out of a year, if you add up the seconds, you’re waiting for slow loading websites. I don’t know where this number really comes from. I wouldn’t add of my total time for that, but I’m on broadband and don’t surf aimlessly. When I design a web page or a web application my goal is to trim out the fluff and to get you, the user, on your way. You don’t need junk, you need working solutions that get you what you need. Sure, I want it to look nice, but I don’t write pages that make you mad at me because I’m holding you back.

As a designer, a developer, an ISP, a host or whatever: do your part to reduce this number.

Why Won’t the Toilet Won’t Work

Abby came in asking me, “Why won’t the Toilet won’t work?” Which of course was a double negative. Everything my mother trained me to react with (correction) was held back because the last thing I needed to do was confuse Abby with why her potty was or wasn’t flushing. The not flushing lead to me lifting the lid off the top of the commode. Wow! Abby was very impressed with the inner workings of the toilet. I can remember the same wonder of how a toilet worked. Previously it had been magic, but then it became mechanics… mechanical parts to be played with.

I hope Abby doesn’t want to not not play with the toilet [I’m so clever].

Software Architecture Tips

I’m probably not the worlds foremost expert in software architecture, but I’m the son of an engineer. A civil engineer. That is to say that he’s nice to most people, and it shows in his engineering, too. Software architecture is something that I understood the least when I was first learning about software development. At that stage in the game I needed to learn how to write code and didn’t grasp the critical nature of designing the code in such a way that I didnt’ have to rebuild the wheel every time I did something. “Hello, World!,” meet impulsive idea man.

As time went on and I stubbed my toes on various ideas (accidents can lead to learning) I learned more by learning how not to do things. I didn’t go to school to be a software developer, I majored in history. As the infamous quote goes, “Those who don’t learn from history are doomed to repeat it.” Boy, did I repeat myself. Eventually I learned more about how to do things the right way and more recently I learned more about Model/View/Controller (MVC) coding. Here are some architecture tips I’ve learned, hopefully you’ll find them helpful as you learn:

Consume Open Source Code
Open source code, such as WordPress, xinha and the YUI code are places I learned about software architecture – free, and usually commented. See how and why things are done. Don’t just learn a technique, learn why to use the technique by trying to see why the open source software used a technique. Check out Sourceforge.

Learn Existing Code Libraries
If you have the chance learn some coding libraries and their functions. Often you’ll find that a code library is useful in more than one place. Matt Mullenweg has said that he re-uses components from WordPress in other projects. If your software architecture doesn’t fit with these libraries then you’ve probably got more thinking to do about your architecture. Closed systems can be a headache. I’m currently learning the PHP Cake library, and that’s powerful!

Build Your Own Libraries
Build your own libraries. No, not huge open source libraries necessarily, but find snippets of code that you can re-use as needed. Know your coding style and know how it will work for you. When you’re designing the structure of your code, these libraries will play a role in this.

Go To Libraries
Libraries house books. Free for you to look at and often for you to check-out and take home to learn from. Don’t underestimate the power of a good paper, physical book 🙂 Software architecture is going to develop over time and you’re learning and reading is going to grow if you invest in it. it won’t happen by magic (usually).

Learn What Optimized Code Looks Like
I have studied optimized coding practices for every language I’ve learned. In PHP I learned about commas as concatenators, various loop type speeds, and of course MySQL optimization to help keep queries fast. Your code architecture will need to employ these things yourself.

Join a Community
Find an online forum or email list that you can participate in. You’ll quickly find out that you, too, can help others learn. This will most certainly help you develop better software architecture practices.

Dancing with the Stars: I Love My Children

I danced last night with Abigial to the soundtrack of whatever was playing on dancing with the stars.  I think the judges would have kicked us off the show for our out of control, wacky, jerky and impromptu movements.  Abby laughed over and over so I figured that our ‘dancing’ was doing the trick.  Jessica, our only judge gave us a ten each time, to which Abby responded by either bowing or raising her hands in victory.  I even scored a victory peck on the lips.  Its good to dance with a child star like Abby because she really throws herself into it.  I just have to catch her.

Fair

I have been a big fan of Poor Old Lu since the mid 90’s when two brothers who were in a (sphhhblunk rock) rock band with me encouraged me to give them another listen. When I had listened to the demo tape at the Christian bookstore I had heard a slower song and shut the tape player off. Yeah, I was really a good music listener back then. However, after borrowing their copy of ‘Sin’ I became hooked. Fast forward to 2005. Poor Old Lu is gone (for now), but Aaron Sprinkle, their guitarist has a lower priority solo career. Aaron’s touring band turns into his band Fair. Fair isn’t Poor Old Lu 2.0. Fair is more like Aaron Sprinkle 4.0. Its got a good solid sound, great harmonies, and a nice driving feel at places and careful respect for the delicate intricacies of dynamics in other places.

Genre: Rock
Released: 2006
Rating: 4.5 ear canals out of a total 5 ear canals
Theological Content: Could Play on Secular Radio without anyone knowing the band was Christian unless you knew they were Christian, in which case you can pick up underdones & themes.

If you’ve not heard Fair I’d check them out on iTunes or Amazon.com.

Recommended Tracks:

  • The Attic
  • Carelessness
  • Cut Down Sideways
  • Confidently Dreaming
  • The Dumbfound Game
  • Unglued

Because I’m Insensitive Like That

So today I had the privelege of leading the church service. I went through the announcements and prayer requests in the bulletin and then asked if anyone had any other prayer requests. One of the gentlemen said, “Bud [lastname withheld to protect the innocent].” Which made me ask Bud, who was sitting in another pew, what was going on. He replied, “They think I’m too skinny.”

So I said, “You’re going for the super model look, eh? You’re going to be on America’s Next Top Senior Model?”

Yes, I was on a microphone amplified throughout the building. Apparently I am missing that part of the brain that hinders my mouth from spouting out humor at the expense of the elderly.

**Oh, and for the record: Bud has a good sense of humor and thought it was funny.**

Make Your Own Filet Mignon!

OK, so this isn’t news, but did you know you can buy a Tenderloin at your favorite wholesaler (Costco, for example) and butcher it at home for filets that are significantly cheaper than the grocery store, and super juicy?  Sure, if you’re a vegetarian I’ve just suggested you go suck on a dirty gym sock, but for the omnivorous folks out there, wow!  We had tried this for Easter this year and had limited success because our tenderloin was spread between too many people.  However, tonight Kurt & Becky kindly invited us over for Kurt’s birthday (Happy Birthday, again!  Don’t eat the Pie!) where Kurt’s parents had kindly bought another tenderloin for us all to share.

WOW!  All my base are belong to Pismo.  Yummy stuff!  The butchering of the tenderloin isn’t that difficult and you will end up with approximately 10 tenderloins and meat for some very tasty philly cheesesteak sandwiches for about $50.00 (USD).  Give it a shot if you get the loot, its well worth it.