CSS selectors with multiple HTML attributes

Something I had been banging my head about recently… CSS selectors on multiple attributes. No doubt, CSS selectors are powerful. Selecting on ids and classes are a cinch. And in case you didn’t know, you can string multiple classes together in a selection.

  1. div#id.class1.class2.class3

Note: You could probably string multiple ids in a selector, but most proper engines will barf at you or simply return nothing. Despite the utility in being able to select multiple elements by their respective ids in one selector, this is poor form. If you find yourself doing this often, you might want to give regularly selected groups of elements a common class.

But even more impressively, you can do this on other HTML attributes. (Especially useful in Selenium when trying to verify specific types of input fields.) I was trying to verify a specific UI interaction where a password field would be revealed as plain text when in focus and returns to an obfuscated password field on blur. Unfortunately, I couldn’t figure out how to verify that a SPECIFIC field needed to have both name=’myformfield’ AND type=’password’. A single attribute can be selected as the following:

  1. div#id.class1[name='myformfield']

Then it occurred to me that I might be able to string together multiple attribute selections similar to multiple class selections. Wouldn’t you know, it worked?! At least, it works in version 1.4.3 of jQuery’s Sizzle (its CSS selection engine) and 1.2.0 of Selenium IDE.

  1. div#id.class1[name='myformfield'][type='password']

Awesome. Hope this helps someone.

Speculating on the Net for the next 5-10 years…

Someone asked me “What do you think will be the top 5 trends in the next 5-10 years in the internet and mobile space?

I really liked the question and wanted to preserve my thoughts here for future reflection. 5-10 years is a long ways to be projecting, especially online. I don’t think I could even go 2-3 years out the way things are currently going. But I’ll give it a go.

Continue reading ‘Speculating on the Net for the next 5-10 years…’

Just Do It (And actually finish!)

This came from a question on a HackerNews thread.

So I used to have problems starting projects – I would plan/read/design etc and then never actually get around to doing anything concrete; I have overcome that issue. But now I find myself not being able to finish anything. I end up with little software projects that are half-done and abandoned because I lose motivation once I solve the ‘interesting’ challenges. When there is a clear path to the finish, I suddenly become disinterested.


Creative Commons License credit: Rakka

This is something I still struggle with quite frequently. I’m not certain if it’s a particular chemistry in my brain or just a personality trait that I’ve developed over time. I find myself constantly hungering for interesting ideas and ways to solve problems. So much so, that the mental exercise of arriving at a unique solution has become a fun pasttime. This “not being able to finish” might seem like the main problem here, but I’d argue otherwise. Admittedly, the “problem solving” is hugely satisfying; more importantly than that, the problem that you’re trying to solve should be just as satisfying.

Continue reading ‘Just Do It (And actually finish!)’

Customer Service in the Twilight Zone

Twilight Zone Customer Service

I just had the most unusual conversation with a customer service rep. I was calling to ask about a magazine subscription that I didn’t remember making. I had recently been getting “bills” from the mag but wasn’t sure if they were really bills due to typical marketing campaigns which elude to a balance owed, but it’s really just getting you to subscribe. More importantly, when I called the customer service number I was greeted by an automated system. I provided my account number and it responded with a list of available information.

Just to be sure, I verified my current subscription status. And wouldn’t you know that even the automated system gives a “ball-park” answer: “With the payment of $10, your subscription will expire with the last issue being received in July, 2012.” What the hell? Can’t the automated system just tell it to me straight? So I asked to be transferred to a live human. The following exchange ensued:

Continue reading ‘Customer Service in the Twilight Zone’

Bitcoin for Noobs

I put together a short presentation about Bitcoin, how it works and why it’s there. I may eventually get around to fleshing it out, adding video explanation and notes. But for now…