PC’s are Cheap…er

Jul 17 2009
Posted by Mark

Mac versus PC. It’s a tired debate.  People on both sides get really worked up over their preferred computing platform and the vitriol flies. The latest argument is over the cost of laptops, spurred on by Microsoft’s Laptop Hunter ads.  Microsoft is gaining a lot of traction with these ads, particularly in these tough times. And according to Redmond, Apple is wetting their pants in fear (take with pillar of salt).

I’m not going to debate this point, PC’s can be cheaper (note how I didn’t say less expensive). And if upfront cost is the only factor, then buy a PC. But, you should know what you are getting with your budget friendly machine.

There is a great deal of competition in the PC world and profit margins are razor thin. PC’s are essentially a commodity market.  If a PC maker earns a meager profit on the hardware, they consider themselves lucky. In this environment, two decisions are made that dramatically impact the experience you get from your low cost PC.

First, they often opt for cheaper components which come with a higher rate of failure. For you, this means downtime. Instead of surfing the Web for kittens having comical misadventures, you will be boxing your machine up to send it back to the manufacturer. But no big deal, PC’s are cheap. Just go buy another one to use while yours is in the shop.

Second, they are riddled with malicious ads. No, I’m not talking about the mine field that the internet has become for unsuspecting PC users. I’m talking about the other decision by PC makers in their quest for profit. Trial software.

PC makers take kickbacks from software companies in return for preinstalling trial editions on the machine. So, the first thing you see when you power up your new computer is essentially ads. Fine. Not such a big deal. Except that when you go to uninstall all of these software ads, you realize that they are as hard as some of the worst viruses to remove. It’s such a pain that there is now a market for software that cleans your brand new machine of all of this junk. And don’t think that won’t turn into the same cat-and-mouse game that anti-virus software is now.

In order to get a clean machine, you either have to buy some software to clean it off, or spend your valuable time learning how to rid your PC of these infectious trial versions. But your time isn’t that valuable, right? And you saved all that money over buying a Mac. Take that, Apple!

Of course, you can buy a PC built with quality parts and free of trial editions. But those PC’s are at the same price level as Macs. So, if you don’t have the time or energy for budget computing, consider an honest comparison of features instead of cheap theatrics.

Web Content, Shifting the Conversation

Jun 15 2009
Posted by Mark

In the last decade, significant enhancements have been made in how we build and interact with websites. As developers, we use frameworks for everything to speed up the process. As graphic designers, we have learned to work with the unique challenges of the web and incorporate good user interface design techniques.

And while the conversation surrounding those aspects of our business will continue, the topic of content seems to be making its way to the forefront, largely driven by the content first movement and the emerging field of content strategy. And, to my mind, it’s about time.

Content First

We’ve built plenty of websites. We’ve worked with many types of clients. We’ve collaborated with web professionals in various fields. We’ve worked in various processes. And the one thing I can say for certain in all of that is the projects where the content and architecture were finalized before anything else got started, were by far the most successful.

And there is a good reason for this phenomena—your content really is your website. It is the thing that drives all other aspects and should inform all other decisions.  And yet, standard operating procedure seems to be to develop the content last.  Sure, you’ll be working from some speculative site-structure and proposed content. But you may as well be designing Macy’s fall collection for the housewives of Mars.

In the process of developing your content and organizing it, it will change. It will change a lot. Bits that seemed important will turn out to be unnecessary and get dropped. That is fine. It is all part of a healthy revision process that leads to good content. But when it becomes a nightmare is when you are trying to build a website while all of that is happening. It is like trying to hit a bullet with a moving target. Inevitably, you will have solved some particularly difficult challenge about a part of the site that just got the axe.

Wasted time. Wasted money. Frustration. And all of it can be avoided.

Think about the difference between working on a first generation site and a second generation site. Second gen sites are almost always better. One reason for that is that the content is already done and you can design around it. Another reason is that people have used the site and discovered it flaws. But the content can be completed and tested before the website is produced. So, shouldn’t it be?

It’s time we put content first. Develop good content and let in inspire the rest of the site. And get it done before you ask anyone to do anything else.

CLI fu for svn client

Jun 15 2009
Posted by Anj

Automating repetitive tasks is like candy for many software developers. And what better way to do this than to write fun one liners that boost efficiency and geek cred? Welcome to the joy of pipes, stdin, grep and awk.

A one liner that will add all the unversioned files to your Subversion repository:


svn status | grep ^? |  awk '{print $2}' | while read line; \
do svn add $line; done

Building on this, we can do an atomic commit of the added files:


svn status | grep ^A | awk '{print $2} | while read line; \
do svn ci -m "Committing awesomeness in these files" $line; done

After we’ve modified the files and wish to make another commit:


svn status | grep ^M | awk '{print $2} | while read line; \
do svn ci -m "Awesomeness added to codebase" $line; done

So what’s going on here?

The above commands have some common parts, and perform similar functions:

svn status

Outputs the status of files in a versioned folder: modified, added, unversioned, etc

grep ^?

Looks for a line beginning with the “?” character, which is an unversioned file when using Subversion. Other symbols are M (modified), U (updated), D (deleted), A (added).

 awk '{print $2}'

awk, another one of my favorites, is only printing the second field, the path of the file. The default for awk is to split fields on a tab, but you can easily change the field delimiter with the-Fswitch.

while read line; 

Reads stdin a line at a time into the variableline. In this case, stdin is piped from awk.

svn add $line;

Tells the subversion server to add the file to the repository. We created the variablelinein the previous command, now we’re accessing it.

 done

End of loop

Don’t forget that you can use regular expressions with most modern versions of grep. I use version 2.5.1 and it supports regex such as the one found in this little gem:

svn status | grep ^[AM] | awk '{print $2}' | while read line; do svn revert; done


grep
here is finding any line that starts with either an A or M. Yes, throwing away changes after a couple of hours of work is typically not a cause for celebration, but once that decision is made, this script sure makes it easy!

OS X 10.5.7 - /etc/hosts, no! dscl, yes!

May 26 2009
Posted by Anj

Recently I upgraded my older gray body MBP 15″ to the new fancy unibody MBP 15″. Fun and excitement ensued and after some account name mishaps with Migration Assistant, I got it up and running. Like a champ, this laptop is.

But I noticed that it wouldn’t resolve any of my VPN IP addresses, which I had added in the /etc/hosts file, the usual place to add specific IP addresses I want to resolve. After harnessing the awesome power of the “internet search”, I found that Leopard uses a system utility to manage configuration files. Specifically, dscl. Sadly, Apple’s usless help page for dscl is the first result. But this post may be somewhat helpful, if not totally outdated.

Check Current Hosts

Run dscl as root:

sudo dscl

You can explore it just as you would a filesystem i.e. ls,cd, etc.

Go to the hosts directory:

cd /Local/Default/Hosts

Now, see whats already there:

ls

If you haven’t done this before, you shouldn’t see any entries.

Add a Host

Lets add the host 192.168.112.2o7.net to point to localhost, just because they are evil.

Add the host:

create 192.168.112.2o7.net IPAddress 127.0.0.1

I found that I couldn’t actually add this as a single command:

sudo dscl -create /Local/Default/Hosts/192.168.112.2o7.net IPAddress 127.0.0.1

Seems like it should be possible, but I was only able to do it in multiple steps.

Delete a host

Deleting is almost as easy as adding a host; simply issue the delete command:

delete 192.168.112.2o7.net

NB: You may need to flush the cache of stale entries before your changes take effect:

dscacheutil -flushcache

I didn’t need to, but I didn’t have any entries in there.

Be sure to check the man page for a complete listing of other commands offered by dscl.

Sed - reminders

May 22 2009
Posted by Anj

Sed, the amazing command line text stream editor, is a staple in my daily life. I use it for any text replacement, especially if the text replacement needs to be done on all files in a directory. Unfortunately, sometimes I still need reminders on how to unleash its awesome power.

Delete a range of lines:

sed -i .bak '25,59d' *.html

This will delete lines 26 through 59 of every .html file in a directory. What happens if you leave off the -i .bak part? It writes the file to stdout, not to the files and you get a screen full of text. Probably not what we’re looking for. By the way, .bak is arbitrary; use whatever you like for your backup extension.

The mighty &:

sed -i .bak 's/this.blur()/&;/g' *.html

This will append a semicolon to the text “this.blur()” so you end up with “this.blur();”. Yay for the &!

Replace a space with a tab!

sed -i 's/   /[--TAB--]/g' file.txt

In place of --TAB-- , provide the keyboard command CTRL + V followed by the TAB key. This command will replace 3 spaces with a tab in the file file.txt.
(source: http://www.atoztoa.com/2008/12/replace-tab-using-sed.html)

NB: I use bash as my shell. The above command should work across the many different shells, but I’ve not tested it in anything other than bash.

I seriously love this sed one liner. Seriously love it. Once, I had the thrilling task of extracting tables from a pdf, so that the tables could be recreated as a spreadsheet. Replacing spaces with tabs ruled the day, and the extracted data was easily imported into the spreadsheet. But the thing to take away from this is that if your sed won’t accept \t, it is still possible to match on a tab!

Yay Apple!

May 6 2009
Posted by Anj

Yeah, I’m all about Apple. Here’s why. Bought a refurbished iPhone less than 90 days ago. Wi-Fi stopped working last night. Don’t know why. It just wouldn’t join any networks. After a meeting today, made my appointment at the Apple Store (my first) and walked out with a new iPhone. Brand new. I saw them crack the seal on the box. I don’t think I’ve ever really had customer service this good anywhere.

Third Mouse Button on OS X

May 5 2009
Posted by Anj
in Tips

While I am a command line kinda guy, I do relent and use the mouse. Sometimes. And today,  I made a happy discovery  - the 3rd mouse button on Apple’s MightyMouse works just like the 3rd mouse button on Unix systems! Highlight text in the Terminal.app, press the tiny little track ball and the highlighted text shows up at the cursor. Now I am happy.

Note: In System Preferences -> Mouse, set the trackball to be 3rd button (from the pulldown list). I had forgotten that I did that.

CSS Conditional Comments

May 4 2009
Posted by Mark

In the war on CSS hacks versus IE conditional comments, we’ve always fought on the side of conditional comments and felt good about it. But there has always been one thing that made me jealous of our counterparts on the CSS hack side of the field—having the necessary IE styles in the same place as all the rest. So I did something about it.

Over at GitHub, I have posted a new project called CSS Single File. And what it does is allow you to use IE conditionals in CSS comments. It parses your CSS file(s) looking for comments that looks like this:


div#page{
   width: 940px;
   padding: 20px;
   /* if lte IE 7
   width: 960px;
   */
}

It collects them all, indexing by IE conditional, and spits out the necessary HTML IE conditional comments for you. Currently, it only renders IE specific styles in embedded style tags but it could easily be upgraded to handle file rendering and caching. The real question is whether this approach is worth pursuing with the need for these hacks on their, albeit incredibly slow, way out the door.

What becomes a more interesting question, however, is what if instead of rendering IE conditional comments in the HEAD of your HTML document, the parser incorporated browser sniffing and rendered the IE styles right there in the CSS file.  And if you are doing browser sniffing to filter styles, why not any browser conditional comments. Think about it.


div.some-box{
   border: solid 1px #555;
   /* if FF 3
   -moz-border-radius: 5px;
   */
   /* if Safari 3
   -webkit-border-radius: 5px;
   */
}

Does this approach allow us to deliver exactly the CSS that the particular user needs and target browser specific features and bugs without sacrificing validation? Or does it just encourage bad behavior? Does it make our CSS files more or less readable?

In his highly revered Web tome, QuirksMode, Peter-Paul Koch writes on the topic of conditional comments:

Since conditional comments use the HTML comment structure, they can only be included in HTML files, and not in CSS files. I’d have preferred to put the special styles in the CSS file, but that’s impossible.

Of course, he meant that is was impossible to do this using native browser behavior. And, he is just talking about IE. But IE is not the only browser with buggy CSS rendering. And in the age of High Performance Websites when we are already running our CSS source files through a parser to compress them, why can’t we add a feature to make our lives easier while we are at it?

Kicking the Mule

May 1 2009
Posted by Mark

Ask me how much much I love Gmail and I’ll tell you—it’s a whole lot. I, like many, use it to consolidate all of my addresses. And slowly but surely, they have been eating away at my reasons for not using it 100% of the time. With recent upgrades like better attachment handling, removing “on behalf of”, and, of course, offline support, there’s really not much left for me to complain about. Except for one thing—Gmail is painfully slow about checking my other POP accounts. And you have no control over the polling interval.

It is such a regular occurrence that I head over to Settings > Accounts and click “check mail now” that I have a name for it—”kicking the mule”. And I have often mused about writing a User Script that adds a button to GMail to check all POP accounts with a single click, right from your inbox. What would I call it?  “Kick the Mule”.

It’s not that I don’t understand the problem here. GMail’s POP account retrieval is an always on service, checking my POP accounts constantly throughout the day. And for that, I love it. In fact, for that reason, a spare GMail account can be the perfect email backup system. But because of this always on nature, they can’t go checking everyone’s email every 10 minutes all day every day. That would create a lot of network traffic without adding much benefit. Instead, they have a smart algorithm that learns how often each account needs to be checked.

That’s great! I love smart algorithms. But what about when I am logged in? Couldn’t GMail recognize the distinction and be a tad more swift in checking my other accounts? What about during business hours? What if the smart algorithm learned when my peak email usage is and upped the polling on my other POP accounts then?

Honestly. There has to be a solution to this problem without even giving users control over the polling interval.  Come on, guys. I know it’s not sexy like GMail Goggles, but it’s got teeth.

No, That’s 6-6-8…

Apr 29 2009
Posted by Mark
in News

In a odd twist of fate, when we got our business phone number 3 years ago, it just happened to be one number different than Duke Neurology. Their number starts 668 and ours starts 688. Easy mistake, right? In fact, it’s such an obvious error that after a few calls about some rather disturbing symptoms, I guessed what number they were trying to dial and did a reverse-lookup. Also, for those playing along at home, Neurology and Neural9 are similar enough that when we answer the phone, the casual observer doesn’t realize they have called the wrong place.

I seriously could not have done a better job of confusing people if I had planned it.

So for 3 years, we have been answering wrong number calls for Duke Neurology and getting every reaction from disproportionate anger towards us for not being the right number to just ignoring us and proceeding to schedule their appointment. We’ve had countless requests for us to transfer them. And if we got a micro-payment every time someone immediately called right back, we could start a side business.

Therefore, we are going to do what companies like us should do—something completely different. We aren’t just changing our number; we are switching to Google Voice. There are several reasons why this service is such a good fit for us. Chief among them is that we don’t really generate a lot of phone traffic; we mostly communicate with our clients through email.

So, on we go to Google Voice and our new number, (919) 533-4581. We look forward to years of explaining, “No, that’s 5-5-3″.