The Day Google Failed Me

I’ve been writing up a post on subclassing Android’s TextView widget to put a border around it.

I want to include some code examples in the post but the WordPresses editor isn’t the greatest for doing things like this. (I know, I can use <pre> and <code> but even with those tags there’s a lot of fiddling that has to go on and the results require a lot more work than I think is necessary.)

I love the Stack Overflow editor, especially how you can indent code examples just by adding four spaces to the beginning of the line. And I recall that Jeff Atwood had a post or two about it and the technology stack used to build Stack Overflow.

I figured it wouldn’t be too hard to find the posts, particularly the one about the technology stack. I did some googling using terms “platform,” “technology stack,” and “tools.” I even limited my search to Nothing. Lots of hits on Coding Horror but given that it’s a technology weblog, the top ten choices weren’t narrowed down to what I wanted.

I had printed out the web page on the Stack Overflow technology stack but searching through a box of clippings that I’ve kept over the years didn’t turn it up.

I then started looking through the Coding Horror archives, figuring I could quickly scan each month to find what I want. I went through the 2010 and 2009 archives until I realized this was a sub-optimal use of my time.

So then I turned to Google Reader. I’ve been using this RSS aggregator since October 8, 2005, reading and tagging my way through 32,133 posts from between ten to fifteen sites (the number has changed over the years). I always thought I’ve had some sort of tagging mania, an unnatural desire to catalog stuff in case I needed it later. (Hence my box of pre-internet clippings which has been curated down to a single box from multiples.) I’ve thought at times that I should give up tagging, that if I ever needed to find something, Google would suffice.

So I looked through my Google Reader tags and found two – “stack overflow” and “stackoverflow” (I’ve changed my tagging style over the years, I also use “stack-overflow” for Delicious, which doesn’t allow spaces). Immediately I found the two posts I was looking for along with links to several others from those two posts.

Which doesn’t help me with my “embedding code in a WordPress post” problem but does make me feel better about tagging all those posts over the years (now if I can just finish tagging those 500+ Starred posts waiting in the queue).

Which also makes me wonder if WordPress is the best platform to use going forward. I like it’s ease-of-use but sometimes its PHP nature bugs the reptilian Microsoft/.NET part of my brain.

Update #1 – Just discovered SyntaxHighlighter Plus, a WordPress plug-in for code syntax highlighting (based on the original SyntaxHighlighter). I’ll have to download, install, and check it out (strangely enough, found out about it while browsing through the BlogEngine.NET list of extensions).

Update #2 – Installed SyntaxHighligher Plus after FTPing the files to my /wp-content/plugins/ directory. (Also discovered that there’s no difference between the WordPress /www and /public-html directories, /www is a shortcut to /public-html.)

The plug-in appears to do exactly what I want, allowing me to easily embed source code in a WordPress post using the tag “sourcecode.”

public class BorderedTextView : TextView

<dt>public BorderedTextView(Context context, IAttributeSet attrs, int defStyle)</dt>
<dd>base(context, attrs, defStyle){}</dd>

<dt>public BorderedTextView(Context context, IAttributeSet attrs)</dt>
<dd>base(context, attrs){}</dd>

<dt>public BorderedTextView(Context context)</dt>

<p>protected override void OnDraw(Android.Graphics.Canvas canvas)

<p>Rect rect = new Rect();
Paint paint = new Paint();</p>

paint.Color = Android.Graphics.Color.White;
paint.StrokeWidth = 3;</p>

canvas.DrawRect(rect, paint);



Pretty cool stuff. I guess I’ll stick with WordPress for a while longer.

This entry was posted in Other and tagged . Bookmark the permalink.