Falling Behind

I used to be a CSS master back in the CSS2 days. Granted, I was not a webdesign master by any means, I simply had a strong knack for whitespace, layout, and colors. As time has gone on, I have read about CSS3 and even realized that my understanding of the positioning system had been wrong (master status revoked!), but I keep forgetting new features and keep stumbled into new ones. Not going to lie, it really frustrates me. The downside to all this programming and markup is that you really never master anything. You can only strive to be highly proficient, and even then Google is your friend.

I have been beefing up my Bootstrap skills because I’ve done quite a bit of on-the-job work with Bootstrap, but I haven’t really built anything from the ground up. Going from the basic grid structure, I built out a few “row”s and needed to style everything starting with “col” so I wouldn’t need to type out every possibility (col-md-1, col-md-2, etc). I stumbled across a new CSS feature on Stack Overflow and was able to apply the following to get what I wanted:

div[class^=”col-“] {
border: 1px solid #000;
}

Since when did regular expressions get absorbed into CSS? And why that kind of syntax? Shouldn’t you just be matching an attribute value with an attribute itself, not the actual string that sets the value of the attribute?

Looks like I have a lot to learn, but at least I’m also learning how to override Bootstrap classes so I can avoid building a cookie-cutter website. Sure, that’s what my previous company did with a few different colors and our client loved it, but most of the time it shouts “lazy” from the rooftops. Lazy is good for a throw-away test, not a unique identity.

Scott vs. Regex

I built a blog several years ago to record my lessons-learned in programming, so although I built this blog to record my findings on computer security, I’m still in the business of programming, and am still finding a lot to say. That other blog is way behind, and I want to consolidate, so I’ll be talking about lessons in programming here as well.

One of my ambitions with programming is to become a regex master. Text parsing is one of the funnest things about programming. You may find that strange, but I know I am not alone.

Anyway, I was working on my XML Formatter and was inserting functionality to check for self-contained tags, such as <br />. I was getting very frustrated because my expression simply was not matching any self-contained tags, which were always getting the status of ‘text’ and getting their tag markings stripped out. (I have four classifications – open tags, closed tags, self-contained tags, and text)

My regex worked fine on some of the Javascript regex testing websites, so I figured there must be some subtle difference between how Python and Javascript parse regular expressions. But then I tried doing some tests in the Python command line and those appeared to be working! It must have been because I was using findall to match multiple expressions at once, and something was getting lost in the match-by-match.

I went through the gamut of looking online and finding that regex is not a great way to build an XML parser, but I was not building this to parse XML, I was building it to format XML, because my inner designer hates seeing poorly formatted XML and HTML. But maybe the people were right and I was going to find myself in a forest dark where the straightforward path had been lost. I think I put it off fixing it for a whole week.

Until this morning. After about an hour, I decided that something must be correct about my expression, so maybe the problem was further up.

Then I saw it.

breakdown = (re.findall(OPENSIG + ‘|’ + CLOSESIG + ‘|’ + ‘CONTSIG’ + ‘|’ + TEXTSIG, testString))

 

I had put CONTSIG in quotes. Making it a string literal. Causing the pattern to never match my test string.

Well, here’s my sign.

I’m hoping today to finish up the last piece, allowing for file input. But here’s to nearing the very end of a project!