Eddy Currents


This is so cool.


Expanding Code Blocks for Octopress


I have always liked code samples in blog postings, but I have never liked the need to scroll horizontally to see the tail end of long lines. In preparing my site for migration from WordPress to Octopress I read and reread Paul Stamatiou’s How to: WordPress to Jekyll about a dozen times. In that article I admired the expanding view of code examples. When you moused over the code it expanded in width to allow you to see most, if not all, of its width at once.

It turns out this is relatively easy to accomplish through the use of the CSS hover selector. What is more complicated is getting the expanded content to properly overlay the aside content in the default Octopress theme. After pestering a couple of my work mates (thanks @gpennington and @worksology) I now have the proper combination of z-index and position:relative to properly expand the code blocks, even when there is sidebar content involved.

Here is the code I added to my sass/custom/_styles.scss to make this all work:

{% raw %}
article { overflow: visible; }
figure[role="code"]:hover, .gist:hover { width: 800px; overflow: inherit; position: relative; z-index: 2;}
aside[role="sidebar"]  { z-index: 1; }
{% endraw %}

This will cause code blocks and embedded gists to expand when the mouse pointer is over them, and if they are along side of aside material, the expansion will be on top of that content as well. Based on any thematic changes you may have made to the default Octopress theme, you may need to adjust the width value to suit.


Seven Bar Jokes Involving Grammar and Punctuation


“The bar was walked into by the passive voice.”


TextMate 2 Tips


For the TextMate 2 nerd on your Christmas list.


Comments


Since switching to Octopress my site has used Disqus to manage comments. Migrating my existing comments from WordPress was simple, and managing them all in Disqus, has been a breeze. Of course I don’t have or get that many so I’m not taxing the Disqus system at all.

The default Octopress theme, which I’ve slightly modified, doesn’t show any comment indication on the main index pages. After some assistance from Divya on the #octopress IRC channel I’ve modified my site to display comment counts for all postings.

Postings that I create, like this one, will have the comment count displayed just beneath the posting title. Link style postings will have the comment count displayed after the posting. In both cases the comment link takes you to the permanent link for the posting.

The code for displaying the comment link is simple and straight forward:

{% raw %}
{% if site.disqus_short_name and post.comments != false and site.disqus_show_comment_count == true and post.url %} 	
<a class="commentinfo" href="{{ root_url }}{{ post.url }}#disqus_thread" data-disqus-identifier="https://zanshin.net{{ post.url }}">Comments</a>{% endif %}
{% endraw %}

Just substitute your site’s information, and add the site.disqus_show_comment_count attribute to your _config.yml file and you should be good to go.


Lil' Drac


“… and he rocks.”


Virtual Desktops


I have been a fan of virtual desktops since I first used them in 1999 via a Windows application called Perfect Screens. Multiple desktops made immediate sense to me and I haven’t been without them since that first foray.

The Windows-based Perfect Screens allowed you to bind applications to certain desktops or set an application to be visible on all desktops. After some initial experimentation I settled on four desktops, one each for mail/chat, browsing, Word/Excel, and coding. With hot keys setup to allow using the keyboard to jump from desktop to desktop I was in nerd heaven.

In 2002 when I switched to Macintosh computers and Mac OS X, I hunted around for a suitable equivelent to Perfect Screens and found CodeTek VirtualDesktop. Since I was used to the idea of four desktops I continued with that setup on CodeTek.

With the introduction of Spaces in Mac OS X Leopard I stopped using CodeTek’s tool. Spaces was both better and worse than CodeTek. I liked that it was part of the operating system, but some of its behaviors were enough different than what I had become accostomed to that it was difficult to switch. Spaces allowed up to 16 desktops and for a time I had that many. Gradually I lowered the number to 9, which was the most I could easily access via the Control-# key board shortcut.

I kept the idea of delagating specific activities to specific spaces or desktops. Space 1 was email, 2 was browsing with my RSS reader and eventually Twitter added. Space 3 was calendaring and to-do lists. Space 4 was my primary terminal console desktop. Spaces 5 through 9 were used as scratch pads. When ever I wanted to open a new instance of and IDE or start an activity that would have multiple windows open, I’d grab an open desktop and start.

Mac OS X Lion reworked Spaces into what is now called Mission Control. Gone is the grid-like arrangment of desktops, instead they are just lined up in a row. Added is the idea of full-screen applications. These occupy their own space or desktop. At first I was resistant to the idea of a full screen application but I have grown to like them, particularly for email, iTunes, and now Xcode. Lion imported my Spaces and I continued to use them as before. With Mail now a full screen app desktop 1 was empty and became my primary terminal console desktop.

One of the annoyances of Apple’s implementation of Spaces is how multiple instances of the same application are managed. If you have open two separate copies of your browser, and you click a link in your Twitter application or RSS feed reader it will open in the browser instance that was most recently active. Often I find this not to be the one I wanted. The browser in Space 2 is my primary all-purpose browser. Usually a second instance of the browser was open for a development project and the only tabs present were for that project. Having random links from Twitter or RSS open there was not what I wanted.

Creating multiple Terminal consoles is also an issue with Spaces. If you had a Terminal open in Space 1 and one in Space 4, say, and you Cmd-tab to select a Terminal you would land on the most recently used one. Which often as not was not the one you wanted. There is no way to create a new Terminal window in the current space if one is open in any other space.

These are minor annoyances but annoyances still. One of my co-workers doesn’t use virtual desktops. He has all of his applications open on a single space. By using Exposé and Cmd-Tab he switches back and forth between applications. By not having multiple desktops he inadvertantly avoids some of my grumbles. So yesterday I closed all but one space forcing all my applications onto the same destop. I still have Mail, iTunes, and Xcode as full screen apps. And I would run iPhoto that way too, where that an option. The biggest difference is the amount of clutter on my desktop now. After years of having just one or two apps displayed at a time having 13 apps, some with multiple instances open, all on the same desktop is jarring. Only time will tell if I grow to like this new arrangment. I don’t know if I’ll tend to have just a single instance of my browser running thus avoiding the eeny-meeny problem of which will focus. If nothing else having something different will force me to learn new habits and learning is always good.


FAA Approves Cockpit iPads


I’m one of those people who doesn’t turn anything off when I fly. I do set my phone to “airplane” mode, mostly so it doesn’t make any noise that would get me in dutch with the flight attendents. No electronics until 10000 feet is a silly rule. But if that’s the price we have to pay to not have cellphone call usage during a flight, I’ll gladly pay it.


La Mer De Pianos



Xcode New Project Template Copyright


When you create a new project in Xcode the generated files all include a bit of copyright information for you. There are two places Xcode looks to gather the company information used: your address book entry, and the Xcode plist. If a company name is found in your address card entry that name is used. If no name is present, Xcode creates a new dict entry in the plist and fills it with “My Company Name” for you. If both entries are present the plist entry wins.

To see what may (or may not) be in your plist run this defaults read command:

defaults read com.apple.Xcode PBXCustomTemplateMacroDefinitions -dict ORGANIZATIONNAME

If there isn’t an entry for ORGANIZATIONNAME you’ll get an error, otherwise you’ll see the current value.

To set ORGANIZATIONNAME to a different value run this defaults write command:

defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions -dict ORGANIZATIONNAME "your value here"

Rerunning the read command now should show you the new value for ORGANIZATIONNAME.

The information for this posting cam from this Apple Developer forum discussion.