while(true) { code(); }

code, tech, and getting things done.
Sep 24, 2012

I'm publishing a beta version of my Sublime Text 2 ebook, Sublime Productivity, at 1 p.m. EST this Thursday, September 27, 2012.

If you visit the book page now and sign up for email updates before I hit the publish button, you'll get an email with a 30% discount code when the book goes live.

The beta release includes more than 50 pages of examples, walkthroughs and keyboard mappings, including in- depth coverage of:

  • Common editing tasks like sorting items, joining lines, transposing words and commenting code
  • Precision selection with Sublime’s multi-select and quick add and quick skip features
  • Navigating among project files and jumping around in the current file
  • Using projects to organize your files and improve team collaboration

Since I still have a lot of ground to cover before I can call this done, the beta is priced lower than what I'll be charging for the final version. It's a one-time purchase, so if you buy the beta you'll get future updates for free as I publish them.

Among the topics I plan to include in the near future:

  • Automating tasks with macros
  • Creating and using code snippets
  • Introduction to vintage mode
  • Extending Sublime with the best plugins
  • Writing plugins

Part of the reason I decided to publish a beta version is to get early feedback from readers on my organization and the Sublime features I'm choosing to cover. If you have any suggestions for other features you'd like me to cover in the book, I'd love to hear about it in the comments!

Sep 3, 2012

The negative reviews for Tim Ferriss’s The 4-Hour Work Week scared me off three times.

A con man who needs to be taken down.

Modern day snake oil.

This advice works if you’re already making $40,000 a month, otherwise forget it.

When my curiosity finally won out, I was braced for a hyper-ventilating sermon: "Start a 'business,' scam gullible people out of millions, then abscond to the Caribbean and guzzle piña coladas until your dying day."

Fortunately, that's not the message of The 4-Hour Work Week. Instead, this is a funny, engaging book about focus, freedom and choosing the life you want to lead, rather than accepting your current conditions as your permanent lot.

It's the most exciting book I've read since David Allen's Getting Things Done, and it promises to have a similar long term impact on me. The phrase "life-changing" seems a bit overheated, but it's certainly changed my outlook in important ways.

The following are five takeaways from the book that I've already started applying.

(Quick aside: Some of the links in this post are Amazon affiliate links, and I'll make a small commission if you choose to use them.)

Minimize input to maximize output

I'm an information addict. While I've lowered my intake of information junk food over the last few months, I still check my email frequently, scan my RSS feeds a few times a day, read several books a month, and listen to 10 or so podcasts a week. Oh, and lately I've added obsessive checking of my various analytics metrics to the list. How many hits today?

This voracious consumption was necessary to jumpstart my late entry into the software development industry. Now that I'm established, it's become just something that I do. I'm feel a little like Jack Bauer, still shooting up long after taking down the drug kingpin. The habit has outlived its usefulness, and it's time to kick it.

Ferriss writes that free time is useless without free attention, and by filling every free moment with new information I'm fragmenting my attention until I barely notice that my 22-month-old son just said a new word.

Another downside of this constant flood of information for me is that it generates a constant stream of ideas and things that I might want to do, which my GTD-trained brain reflexively grabs, processes and categorizes. I'm already quite capable of generating endless lists of ideas to keep myself busy; I don't need any help.

Ferriss proposes a week-long information fast, in which you shun all non-essential information intake. No nonfiction reading, news, TV, podcasts. It's shock therapy to help you refocus and reclaim your attention.

I haven't mustered the courage to go cold turkey yet, but I plan to do it soon. In the mean time, I've further ratcheted down my access to my favorite time sinks with RescueTime and the StayFocusd chrome browser extension.

Maybe next week I'll take a full seven days off. Yeah, that sounds good. Next week.

Trade control for freedom

Ferriss's promotion of personal outsourcing is at once controversial and one of the main action items that readers latch onto. But he's not suggesting that hiring a virtual assistant will allow you to offload 36 hours of your week onto some poor schlub in a developing country. The VA chapters are part of a larger theme: Letting go of control in some smaller aspects of your life will allow you to focus on the areas where your efforts will generate maximum impact.

He recommends practicing the art of "letting small bad things happen." Given the choice between finishing an important project or rushing out to return a DVD to avoid a $5 fine, he'll take the fine.

This was a bit of a shock to my system. In my world, incurring a late fee on a payment is a failure of the highest magnitude and deserving of days of self recrimination.

Ferriss isn't suggesting that you let your life go to seed, but he is prompting you to ask, What am I giving up to avoid this $5 fee?

Outsourcing is part of this mental shift. By nature entrepreneurs think they can and should excel at everything. That's me to a T, but now I'm looking for small ways to change this.

I know my way around tools, but I have a growing list of small home repairs and improvements that putting off for months or years. No more; I'm going to hire a handyman to do them. It's worth an extra $100 or $200 to have those things done, and as a programmer I can probably make a profit if I freelance while the guy works.

Similarly, I'm bursting with ideas for infoproducts that I want to create, so I'm starting to hire freelancers to get a jump on the content while I am busy with my day job. I can also use help scheduling interviews, doing preliminary research and transcribing interview recordings. As much as I like to be self sufficient, it's time to be realistic about my limitations.

Automate income to create freedom

Another controversial aspect of the 4HWW is the concept of an automated income stream. Ferriss recommends a process for developing a product-based business that, once put in motion, can run with minimal involvement from you.

He provides several hypothetical case studies that illustrate what types of products lend themselves to creating low-maintenance income streams, how to ensure that there's a demand for a product, how to bring it to market, and then how to set it to run on autopilot.

Critics knock this as impractical: Most people could never start a business that would generate cash flow on its own so they could lead less soul-crushing lives.

While it's true that most people won't ever achieve this, I don't buy the argument that the reason they'll fail is that it's unattainable for most.

Case in point: An acquaintance of mine holds a low-paying blue collar job maintaining heavy equipment for a municipal government, and he's frustrated and unfulfilled. His working conditions are atrocious and the yokels he works with are mostly interested in lining their pockets with taxpayer money.

He doesn't seem like a natural candidate for a 4HWW makeover, but when I look at his situation, I see a gold mine. This guy is a highly skilled mechanic with decades of experience working on everything from heavy equipment to race cars. He's sitting on a wealth of knowledge that many people would be happy to pay for. Hobbyists spend thousands to restore classic cars, many of which are the very cars my friend spent his youth servicing. Might some of them be willing to pay $50 or $80 for a DVD or downloadable video to learn how to properly reline a set of antique brakes or correctly hone the cylinders in their garage queen?

If he could find 1,000 hobbyists who want his help, he'd likely double his current income, and he'd barely have to work to do it. Then with his extra cash, he could open a machine shop that catered to classic car buffs.

Guaranteed to succeed? Nope. Realistic and achievable with some work? Certainly.

Don't expect the 4HWW to answer every question you'll before you can start your own business, but it provides a solid blueprint that will allow you to generate income and increase your freedom, without continuing to trade time for money.

Separate your life's work from your income

Reading The 4-Hour Work Week challenged me to reexamine my goals and dreams in a different light: What would I do with myself if the majority of my waking hours weren't spent in the pursuit of income?

In one of my previous jobs, I spent days and weeks building websites that virtually no one ever saw or used. It's demoralizing to spend the majority of your day on something you know is virtually meaningless.

My current job is far from meaningless. I'm helping to solve hard problems, and the results help real people do their work more effectively. Our company culture is fun, and my coworkers are smart and personable. If I have to work for someone else until I retire, I want to work at companies like this one.

But what if I didn't have to work? That's a scary thought.

To Ferriss, the point of creating a low-maintenance income stream isn't to grow fat and happy while lounging by the pool. An automated business is a lever to create freedom so you focus on things that bring greater satisfaction: learning and service to others.

If I succeed in setting up my own automated income stream, I plan to keep plenty busy:

  • Enjoy every minute possible with my wife and sons.
  • Teach urban teens how to build successful careers and bootstrap their way out of poverty. It frustrates me to no end that people think they can't get ahead when the entire store of the world's knowledge is literally at their fingertips. I want to help a few people find the freedom I'm enjoying.
  • Write and write some more. Writing was my first career choice, and I'd love for it to become my primary occupation again someday.
  • Get back into activities that I've allowed to languish, like playing my beautiful Taylor guitar, practicing martial arts and playing soccer.

Others might use such a revene-generating business to finance dream of starting a company to tackle "the big problems." Who says the only way to do a startup is kowtowing to venture capitalists or eating Ramen while sleeping on a friends couch?

Live life today

Probably the biggest lesson I'm taking away from The 4-Hour Work Week is this: Stop deferring life for a day that may never come. Don't trade 40 or 50 years in a cubicle for a vision of 401K-funded leisure that might never materialize. Instead, Ferriss recommends taking "mini retirements" by living abroad for a few months or a year at a time, using the income generated by your low-maintenance business.

I have a goal to "retire" early, which to me means building a large enough reserve that I'm not dependent on a job. I hope I never have to retire in the traditional sense, but I want my choices to be unconstrained by the requirement of scraping out a living.

I enjoy working toward this goal, and often it is exhilarating and doesn't even feel like work. But I'm not giving my family the time and attention they deserve.

Instead of plowing ahead at 70 or 80 hours a week, trading my kids’ childhoods for a dream of an early retirement, I'm looking for ways I can limit my work hours and maximize my results by outsourcing parts of my projects.

I’m also investing in myself: I'm almost one third of the way through the P90X extreme fitness program, and I'm determined to kick my scrawny butt into something resembling good shape. It’s a commitment of more than an hour a day. All the more reason to sharpen my focus in the time I've allotted for work.

What's my plan?

I don't know yet what my main passive income stream will eventually be, and that's fine by me. When I define a goal and keep it in the back of my mind, I've found I'm able to recognize the right opportunity when it arises.

But I'm exploring two potential revenue streams that lend themselves well to automation and are a natural fit for my current skill set and interests: infoproducts and software-as-a-service products.

One of my all time favorite books is Paper Lions by George Plimpton. Plimpton was a practitioner of "gonzo journalism," which involved putting yourself in extreme circumstances and then writing about your experiences. In college, I wanted to be George Plimpton.

Thanks to the rising popularity of ebooks, those dreams are reawakening. I’m wired to acquire new skills, achieve a satisfactory level of proficiency, then move on to something else. That’s one thing that appealed to me about journalism; my daily task was to become an instant expert in some new field or skill I’d never encountered before. I have a list of things I’d like to do someday that’s so long it makes my head spin.

What better way to harness this temperament then building a business around learning new things and communicating them to others in a tight, 50-80 page ebook?

My wife, also is an avid writer, is lighting up at the possibility of working together with me to build a ebook-based business. Together, we'd be an entrepreneurial, content-generating machine.

Another avenue I'd like to pursue is creating a software-as-a-service product, tightly targeted to solve a painful business problem for a group of professionals. I have some strong existing relationships in the real estate industry, so that's where I'll be looking first. I'm not worried about having The Idea yet; it'll come when I understand the pain of my target market. And with the technical skills I've cultivated over the last few years, I'm confident I'll be able to execute when The Idea presents itself.

One small step ...

This month I began my journey. I saw a small trickle of passive income. A few dollars earned from effort expended weeks ago. The money arrived while my wife and I spent a weekend visiting family and enjoying our boys. My mission over the next couple of years is to turn that trickle into a flood.

Sure, not everyone will be able to pull this off. Maybe I'll be one of the ones who come up short. But when I look back at what I've been able to accomplish that I never thought possible, I can't help but think, "Yeah, I got this."

Jul 15, 2012

I've wanted a standing desk ever since I first read about the idea three or four years ago.

But even though the health benefits seem clear, it takes a special kind of guy to stand tall amongst an acre of of low-walled cubicles.

That guy I am not, and during my corporate career I stowed the standing desk idea away, alongside my once-held ambition to be a professional magician.

Now that I work remotely every day, the only thing that's prevented me from springing for a Geek Desk is limited space. The lower level family room where I work is just about tapped out in the furniture department, and adding another desk would entail getting rid of a nice, solid wood desk we already own.

I do have a little open wall space in my office, though, and I've thought about cobbling together a makeshift desk with some repurposed shelving.

Then I stumbled across Ikea's wall-mounted drop leaf folding table (affiliate link), available on Amazon for $35.49, plus $11.99 for shipping. It seemed too good to pass up, and I'm glad I ordered one.

Installation

Setup was simple. The desk comes with all the hardware required for assembly, but you'll have to supply your own fasteners to actually mount it to the wall. As it happens, the back side of my office wall is unfinished, so I framed in some extra supports between the studs and installed the desk with some long wood screws. If you don't have access to the other side of the wall, heavy duty drywall anchors will provide adequate support as long as you don't do any swan dives off of your desk.

Before drilling any holes, I propped the desktop up on various objects to find the ideal height. I'm 5'9", and a height of 41" puts the desk surface just above my belly button. My elbows are bent just a little more than 45 degrees, and I can work comfortably on my paper-thin MacBook Air and my chunkier ThinkPad W520, which raises my hands about 1" from the desktop.

Instead of following the Ikea assembly instructions, I'd recommend first just putting together the section that mounts to the wall, which looks like a T, then using it as a template to help position the fasteners. I loosely screwed one end to the wall first, then set a level on top of the T while I drilled the remaining holes.

It's also a good idea not to tighten any one screw fully until the other holes are drilled and their respective screws partially tightened. Otherwise the frame will probably shift and throw itself off level.

To finish the project off I ordered a 1" desk grommet similar to this one from eBay for $4 shipped. It'll be nicer not to have to run cords around the side of the desk when I need to plug in.

Impressions

I'm pretty happy with how this desk fits in my office and its overall appearance:

"Standing desk side view" "Standing desk front view" "Standing desk bottom view" "Standing desk folded view"

This desk is nothing fancy, but for the price it's well constructed. It's solid wood with a clear satin finish. The surface doesn't flex or bounce when extended, even thought the desk top itself is only about 1" thick. When folded, it protrudes about 4" from the wall, making it quite unobtrusive.

One minor annoyance that I noticed soon after completing the installation: If I put a little weight on the front edge, the desk makes a slight creak. Initially I assumed this was coming from the screws holding the desk to the wall, but it's actually just the top shifting slightly where it meets the swing-out arm. Putting a little foam rubber padding on top of the arm eliminated the noise and made the whole assembly feel more solid.

Overall I'm quite pleased. If you're looking to augment your existing standing desk and don't mind putting a few holes in your wall, this is a great option.

Jul 13, 2012

I'm getting my MacBook Air set up for some ASP.NET MVC3 development, using Parallels Desktop to run the Windows 8 release preview as a virtual machine. Even with the stingy 1GB of RAM I allotted for the VM, Windows 8 screams and Visual Studio 2010 runs great.

For this particular project, the team I'm working with is using IIS Express 7.5. It was a logical choice because it generally requires less configuration and fiddling than the full version of IIS, which tends to throw a hissy if you don't get all the directory permissions just so.

Setting up the site in my VM was no trouble at all. But then I decided to make my own life difficult: I just had to be able to view the site in my Mac's installation of Chrome so that I could use OSX Lion's amazing multitouch gestures to switch between Visual Studio and the browser. I do this all the time when working in Vim and Sublime Text, and it's a smooth and natural workflow.

So, to recap, I needed to develop my site in a Windows 8 VM running in Parallels, and I wanted to be able to serve the site up through IIS Express to my native Mac browser.

This simple scenario morphed into a bit of a multi-headed Hydra, and it took me a while to work through each step. Here's an overview of what I did to get it working.

Network and Firewall

The first step is enabling bridged networking in Parallels. This allows your virtual machine to have its own IP address, and makes it visible on your network just like any other machine.

To enable bridged networking:

  • Click Main Menu | Virtual Machine | Configure.
  • Click the Hardware icon.
  • Select the appropriate network option from the left navigation. This might take some trial and error. Mine is called Network1.
  • Select the Default Adapter option under Type. Again, you might need to experiment here. I had several adapters listed, but the default one worked.

The next step is poking a hole through the Windows Firewall to allow traffic through. I added rules for port 80 and port 8080. Here's a brief walkthrough on how to add firewall rules. You'll want both inbound and outbound rules.

Once I enabled bridged networking and created the firewall rules, I was able to hit a quick test site I set up with IIS 8 on port 80, using the virtual machine's host name, like this: http://my-virtual-machine-name. (To find out the host name of your virtual machine, open cmd or PowerShell and run ipconfig /all.)

IIS Express Configuration

However, when I fired up my IIS Express site and tried to access it from outside the VM, I received the following nondescript error:

400 Hostname is Invalid

Eventually I learned that this error is caused by missing bindings in the IIS Express configuration file. My site was bound to *:8080:localhost, and when the request came in, it was specifying a host name of my-virtual-machine-name, which IIS Express didn't know anything about.

The configuration file is located at:

%USERPROFILE%\Documents\IISExpress\config\applicationhost.config

Open it in a text editor and update your site's bindingInformation value with your virtual machine's host name:

<site name="MySite" id="1">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\Users\myusername\MySite" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation=":8080:my-virtual-machine-name" />
    </bindings>
</site>

I also removed the leading * wildcard for good measure.

Now hitting the site from the Mac's browser generated a new error:

503 Service Unavailable

It's a little sad to get excited just because you're seeing a different error, but after a few dozen 400 errors I was happy to see the 503. No idea how to fix it, but it seemed like progress.

After some googling with DuckDuckGo I learned that this error is an indication that IIS Express doesn't have permissions to handle external requests. Makes sense, since it's designed to be a lightweight web server that you can set up without having admin rights to your machine. This article from Microsoft describes the fix, which involves running a command with netsh. I eventually hit a good Stack Overflow post that helped me get the command syntax right.

To enable external access for your IIS Express site, open cmd or PowerShell as an administrator and run:

netsh http add urlacl url=http://my-virtual-machine-name:8080/ user=everyone

Finally, the stupid obvious step that tripped me up for a while: Restart IIS Express. Just right click on the IIS Express tray icon and click Exit, then relaunch your site in Visual Studio.

Hit the URL http://my-virtual-machine-name:8080 from your Mac's browser and the site should load right up.

Jul 13, 2012

At work we spend hours every day doing remote pair programming over Skype. Since Skype's share screens feature isn't always reliable, we've explored just about every other screensharing tool on the market, and we've settled on join.me for its ease of use.

On my ThinkPad, though, I've consistently seen performance issues when sharing either of my large external monitors. Anyone watching my screen would notice that it would seem to flicker as it was redrawn, allowing them to see any windows I had open behind the one I was currently working in. It almost looked as if it was rendering each layer on my desktop in Z order. The resulting flash made join.me almost unusable.

On my smaller ThinkPad screen the problem was less pronounced, so for a while I coped by putting up with the cramped display. I've noticed the same problem from time to time on my teammates' computers as well, which led me to assume that join.me struggled with higher resolution monitors.

I got frustrated with the situation this week, and I updated the video drivers on my ThinkPad in an attempt to resolve it. Instead of fixing the issue, though, the new drivers made it worse.

After the update, join.me showed just a black screen (oh, and my mouse pointer!) when I shared my larger displays. The ThinkPad screen showed a picture, but the flicker went from distracting to seizure-inducing.

I swallowed my programmer pride and called join.me's tech support team.

The technician quickly walked me through a resolution, which involved configuring join.me to disable Windows Aero when it launches.

Here are the steps we used to fix the flicker:

  1. Download and run the .msi installer to install join.me as an app. I typically use the single-run version from the website, but we needed to modify some settings, so the installed version is required.
  2. Open Windows Explorer and locate the installation directory for join.me. On my system it is:

     %USERPROFILE%\AppData\Local\join.me
    
  3. Open params.txt in your text editor of choice. I hope for your sake that it's not Notepad.
  4. Append -noaero to the end of the file's contents, then save the changes. Here's what mine looked like after the modification:

    -site join.me -lang en-US -trackinfo A4097310-7167-2035-R361-9231H994E6Y5_75945 
    -hook -blocksize 64x64 -noaero
    
  5. Launch join.me from the Start menu. Your screens should flicker as Aero is turned off.

  6. Enjoy screensharing goodness!

Update (2012/07/25)

After an update today, join.me seems to be ignoring the -noaero flag. Here's another way to accomplish the same thing.

Jul 10, 2012

When I'm using Sublime Text 2 and Visual Studio, I like to create a "ruler" somewhere around 100 characters from the left margin. It gives me a visual cue that helps me keep my line lengths reasonable.

Naturally, there's an easy way to do this in Vim as well. I added this to my .vimrc:

set colorcolumn=85

To tone down the coloring, I added this to my .gvimrc:

highlight ColorColumn guibg=Gray14

That makes a nice subtle column in MacVim. Here's a nice color chart of the dozens of colors avaiable in the GUI version of Vim. You can also display a partial list of available colors with the command :help guibg.

To set the colors in a terminal version of Vim, add the following to .vimrc:

highlight ColorColumn ctermbg=DarkGray

To see the available color names, issue the command :help ctermbg.

Jul 6, 2012

For months, there's been a hole in my life: I discovered the joy of full-screen, transparent consoles in Linux, but I haven't found anything similar for Windows. I did my best to fill the void with Console2, but the best it could muster was a nice, minimal window with multi-tab support.

Thanks to a comment by Charles Roper on another post, I decided to give ConEmu a chance. I'd seen Scott Hanselman's writeup about it a few weeks back, but I have to admit I was turned off by the ... um, less than beautiful UI in Scott's screenshots. But it looked pretty configurable, so I thought I'd see if I could turn it into the type of minimalist, instantly available console I've grown to love on my Mac and in Linux.

Here's how I made ConEmu shine.

Note: These instructions are based on build 120705. ConEmu is actively developed, so I'm sure some of the steps will be outdated soon. If something isn't where you're expecting it, just poke around.

Installation

The initial installation is dead simple. Download the latest build of ConEmuSetup.exe from the Google Code site. Run the installer. You know the drill.

Configuration

The default UI isn't what I was looking for:

ConEmu's sad default UI

And it ran cmd.exe instead of PowerShell by default.

I wanted to make several tweaks to the out-of-the-box ConEmu configuration:

  • Load PowerShell when launched, set to my home directory.
  • Make the console instantly available from anywhere with a keyboard shortcut.
  • Set font to Consolas at my prefered size and make the background semi-transparent.
  • Run in true full screen mode with no tabs or other chrome visible.

It took a little while to figure out how to do each of these, because the settings dialogs are complex and not always user friendly.

Run PowerShell at Startup

Let's start by getting PowerShell loading correctly:

  1. Press Win+Alt+P to launch the Settings window.
  2. Click Startup | Tasks and create a new task configured like this:

    Task name: Default
    Task parameters: /dir "C:\Users\mylogin"
    Commands: >*powershell.exe

  3. Click Startup.

  4. Select the radio button next to Specified named task, then select the {Default} task.
  5. Click Save settings.
  6. Restart ConEmu. PowerShell should load and set the starting directory to your user's home folder.

Set a Global Hotkey

I wanted to map a global hotkey for ConEmu to Win+**, which is similar to the **Ctrl+ shortcut I use for Terminal on my MacBook.

  1. Press Win+Alt+P to launch the Settings window.
  2. Click Keys & Macro.
  3. Click the global Minimize/Restore shortcut.
  4. Remove the Shift modifier, and set the hotkey to `. Make sure Install keyboard hooks is checked.
  5. Remove the hotkey for the Recreate active console (or whatever shortcut conflicts with your chosen hotkey.)
  6. Click Save settings.

Pretty it up

Let's get that Quake-style goodness going now.

  1. Press Win+Alt+P to launch the Settings window.
  2. Click Main. These steps are unnecessary, per Maximus of ConEmu fame.
  3. Select the Full screen radio button under Console size and window position.
  4. Click Features.
  5. Deselect Always show scrollbar.
  6. Select Quake style slide down under Caption and border options.
  7. Enter a Pad size (pix) of 8 under Caption and border options.
  8. Click Features | Tabs.
  9. Deselect Enable Tabs under Tabs (panels, editors, viewers). This only hides tabs; you can still open new tabs with Win+N and switch between them with Ctrl+Tab.
  10. Click Features | Transparency.
  11. Select the Active window transparency checkbox.
  12. Move the Transparent slider until the opacity works for you.
  13. Click Save settings.

I did decide to leave the status bar, as it has a few handy bits of info like process IDs, the ConEmu version number and the number of open tabs. Each piece of information can be toggled on or off under
Features | Status bar.

Fix the fonts

And to make the text look presentable:

  1. Click Main.
  2. Select the Clear Type radio button under Anti-aliasing.
  3. Select Consolas in the Font and Change frames font menus. I also bumped the size up to 20 because I tend to sit back a bit from my hi-res monitors.
  4. Click Features | Status bar.
  5. Change the font to Consolas and set the size to 20.

Enjoy!

Here's what my instantly available, full screen console looks like when it's open:

My tweaked ConEmu console

There's a lot more to explore with ConEmu. The documentation could use some serious help, so if you enjoy the app, consider offering to help.

And let me know in the comments if I missed any great features that you've discovered.

Jul 4, 2012

Whether I'm on a Mac, Windows or Linux machine, I love working at the command line. My weapon of choice on my *nix is zsh running inside a tmux session.

On Windows, I use PowerShell inside of Console2, which provides some UI nicities like window transparency. Lately I've added GNU on Windows into the mix, which provides a collection of handy *nix utilities like grep ported to run on Windows.

This page is a little cheat sheet of miscellaneous tips that I have trouble remembering.

bash and zsh

Ctrl+U: Clears the current line.

Ctrl+Z: Unfreezes the screen after you inadvertently froze it with Ctrl+S. I hate this binding, since every single program in the entire world uses this as a keyboard shortcut for save, and it's hardwired into my muscle memory. Gah.

PowerShell

Esc: Clears the current line.

Jul 4, 2012

My blog is a personal wiki of sorts. Instead of keeping things I want to remember in Evernote or OneNote, I try to do a quick write up and put it where others could find it.

The blog is hosted on Scriptogr.am, which is somewhat bare bones and lacks a built-in search engine. When I need to refer to an old post, I use DuckDuckGo's site search feature by entering my search terms, followed by site:whiletruecode.com.

Today I decided to make it easier to search my blog from my favorite app launchers, Alfred on Mac OS X and Launchy on Windows.

Here's how I set it up.

Custom searches in Alfred

To create a custom site search in Alfred:

  1. In your favorite search engine, perform a search for a simple term on whatever site you'd like to create a shortcut to. Here are examples searching my blog for javascript on Google and DuckDuckGo:

    https://www.google.com/search?q=javascript+site:whiletruecode.com http://duckduckgo.com/?q=javascript+site:whiletruecode.com

  2. Open Alfred's Preferences panel.

  3. Click the Custom Searches item under Web & URL in the sidebar.
  4. Click the + icon to add a new custom search.
  5. Paste the search URL from step 1 into the Search URL field.
  6. Delete the search term you used and substitute it with {query}. The result should look something like this:

    http://duckduckgo.com/?q={query}+site:whiletruecode.com

  7. Check the Encode spaces as + box.

  8. In the Title field, enter Search DuckDuckGo for {query}.
  9. Enter a short term in the Keyword field. This is the term you'll use to trigger your custom search. I used blog.
  10. Click Add.

To use your custom site search:

  1. Launch Alfred.
  2. Enter the keyword you chose in step 8 above, followed by a space, then your search terms.
  3. Press Return. Your default browser will open with a new tab containing your search results.

Custom searches in Launchy

To create a custom site search in Launchy:

  1. In your favorite search engine, perform a search for a simple term on whatever site you'd like to create a shortcut to. Here are examples searching my blog for javascript on Google and DuckDuckGo:

    https://www.google.com/search?q=javascript+site:whiletruecode.com http://duckduckgo.com/?q=javascript+site:whiletruecode.com

  2. Open Launchy's Options panel.

  3. Click the Plugins tab.
  4. Click the Weby plugin.
  5. Click the + button to add a new entry.
  6. Enter a short term in the Name field. This is the term you'll use to trigger your custom search. I used blog.
  7. Paste the search URL from step 1 into the URL field.
  8. Delete the search term you used and substitute it with %1. The result should look something like this:

    http://duckduckgo.com/?q=site:whiletruecode.com+%1

    Note: Launchy was dropping characters from the end of the URL when I put the site portion of the URL last, so I moved it to the front and appended the search term variable %1 to the end.

  9. Click OK.

To use your custom site search:

  1. Open Launchy.
  2. Enter the keyword you chose in step 8 above.
  3. Press Tab.
  4. Enter your search terms.
  5. Press Enter. Your default browser will open with a new tab containing your search results.
Jul 3, 2012

The MVC pattern has taken a bit of a beating lately, including a declaration that it's dead.

MVC, according to this detractor, is ill suited for modern applications because:

You have models, which are nice self-contained bits of state, views which are nice self-contained bits of UI, and controllers which are nice self-contained bits of … What?

… the problem with MVC as given is that you end up stuffing too much code into your controllers, because you don't know where else to put it.

This certainly happens all the time, and it's an issue with other MV* patterns like MVP and MVVM as well.

A colleague and I have spent the first part of the week working on a Compact Framework Windows Mobile app that uses the MVP pattern. Many of the presenters in this app are a mishmosh of view, application and business logic. The presenters do all the real work, and the models are

As we've worked, it's become clear that the problematic parts of the code are really following more of a VP pattern, as the "model" mostly consists of simple business objects. Application flow and business logic is mostly handled in the presenter. The result looks a lot like a slightly more testable codebehind file.

This tendency is far from an indictment of the MV* patterns. The real issue is that these patterns were never intended to supply the full architecture for a complex application. MVC, MVP and MVVM are presentational patterns designed for building user interfaces that sit in front of full-on applications.

Relying on a presentation pattern to meet all of your application architecture needs is a more sophisticated version of styling your HTML page with inline styles. Shoving complex business and core application logic into what amounts to a dynamic view layer is an intermingling of concerns that won't end well.

Rails bears a good measure of blame for this misconception. A generation of programmers has learned application architecture from a framework that is optimized for rapidly developing small web applications. Rails doesn't provide any guidance once your app outgrows a simplistic MVC folder structure, so devs either make their models fatter or pile the pasta high in their controllers.

Rather than refashioning MVC or declaring it dead, let's remember what it was meant to do in the first place. Let's dig up some of the hard-won lessons from older frameworks, maybe swallow a little of that scorn for Java and other ancient technologies, and rediscover useful concepts like tiered architectures with business and persistence layers.

Uncle Bob would be proud.