The Double Entendre of Regular Expressions

Since I am a gamer, I have a tendency to switch between gamer mode and developer mode sometimes without thinking. I’d like to introduce you to a few regular expressions that I may let slip when I accidentally switch between modes.

FTW, 4tw – “for the win” : This is a good thing. Basically if something good is happening or if we think something is really awesome, then we say “4tw”. For example, if out of the blue, a friend surprises me with one of my favorite treats at this time of year, I may say something like “Peeps 4tw!”.

FTL, 4tl – “for the lose”: Yes, I know that’s not grammatically correct. However, that’s what the kids kept telling me it stood for. This is the opposite of “4tw”. So, if I don’t want to do something but I have to do it, it’s usually “chores 4tl”.

IRL – “in real life”: This is as opposed to the life we live online. When you’re offline and dealing with people in a face-to-face setting (and not chatting with them online while you’re sitting right next to them), that’s considered being IRL. Sometimes IRL can be a harsh reality.

There’s a bigger list of gaming things at Rei’s Random Guide to MMP Gaming Terms.

Now the other reason for this post (and hence the title) was because I was thinking of regular expressions, of the pattern matching kind. When I first ran into regular expressions, I was writing in Perl. While looking at sample Perl scripts, I had a few head explosions along the way. Most of those were due to funny looking symbols that looked quite cryptic, syntax used in this thing called “regular expressions” (regex, for short). There’s definitely nothing regular looking about it, so I understand many people’s frustrations with it.

For me, after the initial head explosions, I realized that I must be a sick and twisted individual – I was starting to get the hang of regular expressions and fell quickly for them. I felt just how powerful they could be and what they could do for me.

To reaffirm my love for regular expressions… my very first C# program was not a “Hello world” program or some demo. I figured out how to write a script to read files from a directory, find certain patterns (regex!), and store all the data in one flat file to eventually be used in a database. That was almost 11 months ago, and it was a windows app that did what I needed. It got the base for my app, and it gave me a lot of self-confidence in learning a new language. If I could fit the screwiness of regular expressions into a language I wasn’t familiar with, I knew I’d be fine.

If you’re one of those people who can notice patterns well, then regular expressions is definitely a very powerful tool for putting your pattern matching abilities to work. Once you learn how to “speak” it, it’s one wicked (in a New England sense) tool.

A couple resources for regular expressions of the pattern matching kind include:

Internet Explorer (h)8

Disclaimer: I am writing this entry from Internet Explorer 8 Beta 1 (for Web Developers and Designers). Already I have a problem, as the Title bar is not showing in Blogger like it should. The button text is cut off, and the buttons don’t line up properly. This text editor behaves different too – using the <em> tag for italics rather than the <span style=”font-style:italic;”>. Fair warning that this is probably just the beginning of my irritations with IE 8 beta 1.

I’m calling this post:

IE (h)8

(and I’ll go back and edit it in using a more stable browser once I’m done.)

Last week, at MIX08, they released IE 8 beta 1. I wasn’t at MIX08, but Jeff Blankenburg was and he blogged a little on it. After reading his post, I figured that I’d at least check it out on both of my computers – my beefy gaming laptop (Windows Vista) and my not-so-beefy, mostly neglected desktop (Windows XP). Both machines behaved similarly, which surprised me a little seeing that they are quite different in their setup.

One of the things that IE 8 is pushing is standards. Now this is a sore topic with me, mostly because they’re called “standards”, but there hasn’t been anything standard about various browsers’ implementations of them. It’s always appeared to be a “pick and choose” implementation or a “choose your own adventure” implementation. So why they’re finally getting on board and trying to implement the whole thing is beyond me. But maybe it’s about time the browsers come closer to putting the “standard” in standard.

Viewing various websites through Internet Explorer 8, I had mixed feelings about it. I like that you can easily see where CSS needs tweaking and where people really need to update their code, without really needing to look at the source. I also have to admit that I like the Developer tools. My preferred browser for web development has been Firefox, with the Firebug add-on. The Developer tools in Internet Explorer 8 have that same feel – with the ability to inspect elements just by clicking on them, changing styles with a simple check, or even debugging Javascript. It’s nice to see Microsoft taking this route – definitely a step in the right direction.

From a web developer’s standpoint, I like that the standards are being enforced a bit closer than before.

But from a user’s standpoint, IE 8 just makes me super cranky. I post on various forums, and textareas act really strange. From horrible lag with textareas that use Javascript (but don’t lag in IE 7) to not being able to see what I have highlighted, it’s frustrating. This is what makes me yell it’s abbreviation – “Aieeeeeeee!” These little frustrations are what reminds me of the key word in this release – beta.

If you’re a developer or a designer, definitely check it out, as the Developer Tools have enough coolness factor for me to recommend it. However, if you use a lot of forums that use textareas for posting, have another browser on hand just in case you run into the same headaches that I have. And if you want to download it, there’s a link to it over in Jeff’s post on Dean Hachamovich’s IE8 Keynote.

Miguel Castro and URL Rewriting: Cleveland .NET SIG 3/11

Last night, I was at the Bennett Adelson .NET SIG meeting. Miguel Castro came out and talked to us about URL Rewriting, HTTP Modules, and HTTP Handlers.

Where was this guy a few months ago when I had to figure this out on my own for a project at work?!? All the points he had hit on in his presentation are things I ran into a few months back while implementing rewriting on our main site at work.

First off, a little on Miguel… contrary to what some of the guys had teased me about, he’s not Fidel’s long lost brother from Cuba (or at least not that he admitted to). Miguel is an INETA speaker from New Jersey, and he is SteelBlue Solutions. He kept plugging his program CodeBreeze throughout the presentation, and the poor guy in front of me became his target. He had to remember Episode 77 on dnrTV was the show where Miguel mentioned CodeBreeze. But for all that Miguel talked about URL Rewriting, he still hasn’t set up http://www.steelbluesolutions.com/CodeBreeze to forward to CodeBreeze. (So if he actually sees this, the URL expectation has not been met.)

If you ever get a chance to see Miguel talk, go for it. This guy is quite animated when he talks, and he seems to thrive on audience interaction. Unfortunately, his audience last night was mostly dead.

Miguel covered various ways of rewriting URLs, including:

  • <urlMappings> section in web.config

    • Good for 1-to-1 hard-coded relationships
    • Syntax for adding a mapping to this section:

      <add url=”friendly_looking_URL_that_doesnt_necessarily_exist” mappedURL=”intimidating_URL_that_better_exist” />

  • Application_BeginRequest in Global.asax

    • Good for application-specific logically-determined mappings
    • Not good from a reusability standpoint

  • Reusable HTTP Module

    • Can tap into the same events as Global.asax
    • Compiles into a DLL, which is great from a resuability standpoint
    • Easily setup in the <httpModules> section of web.config

  • Re-write Plug-Ins

    • Uses OnBeginRequest
    • Is a strategy pattern, for those who follow design patterns

  • Regular-Expression Engine

    • Uses regular expressions that are setup in web.config
    • Built as a plug-in

  • Custom HTTP Handler

    • Also compiled into a DLL, similar to a HTTP Module
    • Difference between Handler and Module is that Handlers are associated with specific extensions and wild cards
    • Setup in the web.config <httpHandlers> section
    • Handlers are assigned AFTER the OnBeginRequest

He went on to talk about Search Engine Optimization, in relationship to URL Rewriting. The bots index a “rendered” page and then crawl the site through other links on the pages. If you have your friendly links on your page, there’s a good chance that it’ll get ranked higher. (Argh… and I apparently slacked off in my notes, as there was a part where he mentioned one of his products and we laughed at its name and led Miguel to a realization about that name.) Though having “sex” in the name probably helps with SEO 😉

After the meeting, a group of us ended up at The Winking Lizard. Just like last month, it was a lot of storytelling, laughing, and hanging out with people we knew and new people… always a lot of fun!

Next month, Richard Broida is giving his talk “The Intelligent Programmer’s Guide to BizTalk”. I’ll admit now that I have no idea what that’s about, but I’ll at least go to see what it’s about and to hang out with them afterwards.

Microsoft SharedView

While stuck at home, I got a message from a friend who was working on some of his websites. He really wanted to work on a particular one, but he didn’t know enough PHP or any SQL to really get it going. It was a good thing that he found me online and that I had a lot of time on my hands.

He’s working on a site that I happen to understand quite well. All the features he’s looking for are pretty similar to the things I work on at my day job. The only difference is that I use .NET stuff and he’s using PHP5. I worked on a team that developed an inventory system in PHP with MySQL, so I’ve got that background to help as well. What could possibly go wrong?

I figured the best way for this to work would be for him to show me what he’s working with and take it from there. After paying attention to some Twitter people and to posts in the NEODevEvents group, I installed Microsoft SharedView and sent the link to my friend. After a quick install, we were hooked up and ready to go.

My friend started sharing his environment with me, which helped me understand a lot and enabled me to give him direction without having to guess at what he was looking at. It also was nice to see his database structure without him having to copy and paste it in IMs. I was able to walk him through basic SQL queries via phpMyAdmin (and point out some of MySQL’s quirks that I wish worked in SQL Server and vice versa). We looked at his database structure, in which I was able to give him a couple tips as well.

Then came the PHP part. When I worked with PHP and MySQL, it was PHP4 and MySQL before it grew up (got views, stored procedures, and a lot of other features that other database packages already had). I had to learn this mysqli syntax, which thankfully isn’t too much different from what I used to work with. I was able to work with him on how to take what he learned with the SQL queries and how to use it in his code. Granted, it was basic stuff, but to be able to see his environment while this was going on helped a ton.

I definitely will use Microsoft SharedView again. Hopefully I’ll be feeling better soon enough so that I can do voice chats while working with people over SharedView, as I can see that making things go a lot easier as well. So check it out – if you have to work with someone remotely on code, SharedView is nice because you can show them what you’ve got and vice versa. You can also delegate control of your shared things to other connected users. Definitely a useful tool for remote collaboration!

Simple Programming with Sound

Music has always been part of my mind, body, and soul. From listening to it to practicing one of my instruments, I’m almost always doing something that involves music. Once I picked up programming, I wondered how to program sounds to come out of the PC speaker.

So I spent many nights on my parents’ computer, tinkering in QBASIC. I eventually figured out how to get the sounds out of the PC speaker and how to get them to sound right so that a song could play. This is what I came up with:


DrMario$ = "O4L8A#BA#BAGGAA#BAGG"
PLAY "X" + VARPTR$(DrMario$)

As time went on, I figured out how to create MIDIs and would spend some spare time away from my computer keyboard to put my MIDI keyboard to use.

Now that I’m into programming again, my music talents are playing second (bass) fiddle. However, I’ve grown up since playing with QBASIC, and the PC speaker no longer easily amuses me. But I’m still curious about things that make sound, especially the Speech Synthesizer. So with IronPython, I figured I’d check out the Speech Synthesizer and how to invoke it. It was actually very easy to do. Here’s what I created:


>>> import clr
>>> clr.AddReference('System.Speech')
>>> from System.Speech.Synthesis import *
>>> ssSpeech = SpeechSynthesizer()
>>> ssSpeech.SpeakAsync('Cleveland Day of .NET Rocks!')

I was watching a presentation this morning on IronPython that gave me some other ideas as well, but seeing how simple speech looked, I just had to try it out for myself.

If you’re wondering why I chose IronPython for this, you’ll have to come to the Cleveland Day of .NET on May 17 to see my presentation on IronPython. Details will be posted as they come, but definitely keep the date reserved and keep an eye on the site!

What’s most important to me in a job

This is in response to John Stockton’s post on To Code or not To Code. (The entries I mentioned about coding will come next week.)

Like John, my rankings change from time to time, usually depending on the situation and what’s making me really unhappy or super stressed out. There are also prior experiences that steered me away from certain places. So long before a company interviews me, I’ve already Googled it and talked with all of my contacts to find out more about them and whether I really want to go there.

So what is it that I look for in a job (and company)?

  • Employee satisfaction: Does the company take care of its employees? Are those employees truly happy or do they have to fake their happiness to maintain a public image?

    This is typically high on my list. When my current company contacted me, I had already known quite a lot about them, as a friend had been waiting for 4 years for me to join her there. They went through tough times, as expected of most small companies in this area at that time. But no matter how tough the times were, she raved about the place. Her excitement about the place told me that I had to be there. She knew that I’d be a good match for them, even though she knew me in my non-programmer (tech support/management) capacity. When I went to interview with them, I saw that same excitement in everyone there. And once I was hired, I knew for sure that it was genuine excitement and not just a front. When employees are well taken care of or at least surrounded by the right group of people, employee satisfaction can easily be seen.

  • Industry outlook: Is the company in an industry that interests me? Is the industry going well enough that the company will be around a few years?

    When I take a job, unless I know ahead of time that it’s a short term (like internships), I go into it hoping for a long-term commitment. So I need to commit to something I enjoy doing, to an industry I like working in.

    My last job was in manufacturing. I was there for almost 4 years, and I picked up all sorts of skills in the first couple years. When a co-worker moved on, I had the joys of stepping up and picking up database administration as I went. But my skillset went stagnant in my last year, as the demand for new technology wasn’t there. Manufacturing doesn’t always require new technology, sometimes it’s just a “keep it working” attitude rather than a “improve this process” attitude. Having a discussion with a co-worker about never learning C# since the job wouldn’t need it was probably my wake-up call that I needed to look into other options.

    The industry was taking some serious hits, so that also was a hint for me to move on. Once I left, they didn’t replace me – which was final confirmation that moving on was a good thing.

  • Projects: How challenging will they be? What kind of projects will they be?

    I don’t mind being pushed into learning new technology for projects. I like being challenged into expanding my skillset and into getting out of my comfort zone. But at the same time, there are certain projects that I will not take on because they are in my extremely uncomfortable zone. They get me stressed out, and no matter who I’m dealing with on the other end, I won’t take them on. It’s sad, though, as they are projects that I would truly excel in and that could make really good money. Until I can disassociate stress from that type of project, though, I stay away from them and stand my ground.

  • The team: What kind of people will I be working with? Will I be able to work with them?

    I typically get along with most people that I work with. As those who’ve met me can tell you, I tend to be fairly easygoing and easy to get along with. However, when I first got into computers (an internship right out of high school), I was met with dealing with a team out of my league. My boss knew I could get the job done, and the team lead knew that they needed me on board. But at the same time, some of my teammates couldn’t handle a young female programmer on the team. Ah yes, the joys of age and gender coming into play. I was half their age (literally) and breaking into a field that’s truly male-dominated. That was the one time where I was truly aware of my minority status. It was a very long two month internship, and I was glad when it was over. I owed it to the guys who looked after me – the consultant who took me under his wing and the programmer from another team who did breakfast with me every morning and encouraged me to stick with it.

    Since then, though, I’ve been on some awesome and exciting teams. I’ve learned that the guys on my first team who felt threatened by me, thankfully, are few and far between. But I need to be happy with my team or else my productivity will take a hit as my overall morale takes a hit.

These are just a few things I look into when I’m looking at jobs and companies.

Why I Code

I’m slowly working on entries related to coding itself, so if you’re reading this to see what kind of code I write or what it is about programming that
I’ve been into lately, hang in there. Those entries are in the works.

Last Monday, there was a discussion on Twitter, focused around the question “Why Do You Code?”. Jeff Blankenburg was the one who threw the question out there, and he compiled all the responses into a blog post.

My response was that it’s my inner engineer that drives me to code. My background is engineering – Computer Science and Engineering Technology to be exact. But, whether I wanted to admit it or not, I’ve always had the mindset of an engineer.

I like building things and taking things apart to see how they work. For me, knowing that these steel trusses would lead to this house was something I liked seeing come together. Demolishing a brick wall with sledge hammers for that same summer program was just as satisfying for my inner engineer, as I learned a lot behind demolition. Working with the masons and mortaring a foundation and getting trapped in the bottom really challenged my inner engineer. With the masons and my long time friends, we came up with the solution to build a makeshift staircase out of the remaining cinder blocks. Trying to build that and then trusting each other to get out safely just added to the experience.

Before my work with Greater Cleveland Habitat for Humanity, though, I knew about my inner engineer. Yes, like many of my guy friends (but none of my girl friends), I played with Legos while growing up. There was some satisfaction of taking the bricks and building them into something like a restaurant with a kitchen downstairs. (What? You didn’t have the Paradisa sets?) Even now, I can still play with legos on my computer.

But for me, the part that pushed me more into the computer engineering side rather than civil engineering (the building, the houses, etc.) was that I had realized at a young age that I picked up programming concepts long before they were formally introduced to me. We learned about programming in 8th grade, and my teacher had pointed it out to me that I really had a good grasp of it. Then again, I managed to work through the book in a short amount of time. Of course, doing the fun things – like programming graphics – really motivated me to get towards the end. Ah the memories…


NEW
10 HOME
20 GR

Having picked up the language and an innate understanding of how programming works, I knew that I might eventually end up doing something with it. A few years later, I met a guy who suggested I learn HTML, as it would be cleaner for me to write it straight rather than let Adobe PageMill do it. What was weird was that the guy had no idea that I even knew what programming was – I was just in charge of news content for the high school website and was taught to use PageMill. So on his recommendation, I picked up a book and learned HTML. Soon enough, I went from keeping track of the content in the news section to making sure all the code was simplified HTML. The head student in charge of the project didn’t go into programming – he’s a system and network administrator now, but he still encourages me to follow my inner programmer. From HTML to supporting me now as I work in C#, he’s been by my side through the various languages. We did end up teaming up together in college for a programming project, using PHP. But he mostly leaves the coding to me and rarely touches it.

As a programmer, I’m still putting together my love for building things and seeing them come together. Instead of physical buildings, my buildings are programs. And I still get the satisfaction in the end when I get a satisfied user.

Now you have a basic idea as to why I code. In the next few entries, I promise to finally get into coding concepts and code samples.

Geek Hero Worship…

While on Twitter last night, Ben Fulton mentioned that he was a stevenharman disciple (his words, not mine). I hadn’t heard of the guy so I figured I’d check his blog out.

I came across an entry on his blog titled “On Geek Hero Worship”, and I definitely could relate to that.

The first thing that came to mind was a song (“My Hero”) from Foo Fighters, with the following lyrics:

There goes my hero
Watch him as he goes
There goes my hero
He’s ordinary

It’s true though. The people we look up to in the industry and place on pedestals are most likely normal people too, with their own heroes.

I don’t typically admit to who my heroes are, but there are a few of them that I’ve had for quite a few years. The more I get back into programming, though, and the more I Twitter-surf, the more I find out and realize that yeah, they’re ordinary too.

On Twitter…

One of the more recent links that I’ve added to right hand side is a link to my Twitter feed. If you want to see what I’m up to, that’s definitely one way of tracking me down. The reason I mention Twitter in a programming blog is because you’re about to see just how the social programmer ends up meeting a bunch of other programmers and other interesting people along the way.

Long ago, my friend Nivex told me to check out Twitter, and I saw it and thought it was the stupidest idea ever. Seriously, answering the question “What are you doing?” just can’t go far, can it? I didn’t bother giving it a try then – I just couldn’t see it taking off or really going anywhere.

Fast forward to today… I’m on Twitter, and I’ve picked up a bunch of followers.

So what did it take to get me there? Well we had Jeff Blankenburg, the Microsoft Developer Evangelist for the OH/MI/KY/TN region, at the Bennett Adelson .NET SIG in December who decided to show us some really cool Microsoft projects. He managed to sneak Twitter in his presentation, and he made it seem pretty neat. So I figured I’d probably check it out.

After following Jeff and Nivex and seeing who they were following, I started to get a feel for Twitter. I realized that it’s yet another social networking tool out there, and it isn’t as stupid as I had originally thought.

So, who are the people following me and why are they following me? Now this one, I can’t always answer. I can tell you that I know only a handful of them in person – others, I have picked up along the way probably through random Twitter discussions or just Twitter-surfing in general.

The ones I know in person include the two who introduced me to Twitter plus a couple others who are down in North Carolina, who I met when we visited Nivex awhile back (like tarheelcoxn and jeremyp) or who came up here with Nivex last September (clubjuggler).

I’m sure some of them may be from the .NET SIG (like johnnystock and MichaelDotNet), but I’m not always good at putting faces with people after the fact. So if you know me from the SIG, say hi to me at the SIG so that I can maybe put two and two together.

Some have found me from other conversations – like the GoF discussion, which brought fhwrdh. Then there’re ones that I started following because of their random messages – like the World of Warcraft message posted by jfollas. Oh, and since I mentioned Jeff, I may as well mention our other awesome Microsoft regional contact, Josh Holmes, the Architect Evangelist for the same MI/OH/KY/TN region, who is also part of the Twitter people I follow.

I’ve met all sorts of people and have read so many different things on people I’ve looked up to in the industry. From programming related stuff to personal stuff, all sorts of information flies by in Twitter conversations. It’s a unique atmosphere to be in – you see conversations others are having, and they can see your conversations. But you can meet some of the most interesting people out there.

Check out Twitter if you haven’t already. You never know who you may cross paths with!