I am Joshua Poehls. Say hello Archives (not so) silent thoughts

ERRORLEVEL is not %ERRORLEVEL%

DO use IF ERRORLEVEL 1 ECHO error level is 1 or more to check for errors in your batch/command line scripts.

DO NOT use IF %ERRORLEVEL% NEQ 0 ECHO error level is not equal to 0.

Most of the time %ERRORLEVEL% will be what you expect but it isn’t guaranteed. %ERRORLEVEL% is simply an environment variable like any other. It just happens to fallback to returning the ERRORLEVEL value if an environment variable with that name isn’t defined.

Continue reading

First Steps in Go: A Scoreboard App

Mostly I just read about new programming languages. Call it a hobby. Only once in awhile am I struck with enough interest to want to try something out on a real project. Go is the most recent of such interests. As someone who loves a lot about Node.js, I’m looking forward to seeing how Go compares and whether it solves my Node and JavaScript pain points.

Scores is my first app in Go. It is a very simple scoreboard app for “tracking personal records between friends”. You define a record like “max push-ups” and you create a scoreboard for it. The scoreboard is specific to your group of friends or “team”.

Continue reading

Does your business need a website?

A friend got me thinking about this today. Does a business' website design matter? Does a business even need a website?

The answer strongly depends on the type of business we are talking about. If the business offers digital services of any kind, then obviously they need a website and their design is going to play a huge role in their success. The real interesting discussion begins when we talk about brick and mortar businesses that don't offer any digital services.

Continue reading

Initiation into mechanical keyboard geekdom

A laptop style short keyed keyboard has been my instrument of choice for years now. They are easy to type on and fast. I gave up the stock Dell keyboards years ago for a bare bones Logitech.

Old Logitech keyboard

A few months ago I started digging into mechanical keyboards. They had caught my attention and suddenly I really wanted one. I was ready for a new keyboard, as you can see my Logitech is positively filthy. Why clean it when you can buy a new one, right?

Continue reading

Non-enumerable properties in JavaScript

It isn’t very common in the wild but JavaScript (as of ES5) does support non-enumerable properties. That is to say, objects can have properties that don’t show up when you do a for...in loop over the object or use Object.keys() to get an array of property names.

I spent way too long tonight figuring out why a property was not being included in the JSON.stringify() output because I didn’t remember that this was possible. You see, stringify() works by enumerating the object’s properties. So it makes sense that non-enumerable properties would be ignored.

Continue reading

Substack's philosophy of small things

Those of you who follow the Node.js community at all will recognize substack as one of the most prolific package authors on NPM. You have probably also picked up on the fact that he is a big fan of small packages.

I ran across this interview the other day and I think substack communicates his “small things” philosophy well. Simply put, the UNIX philosophy works. Do one thing, do it well, and it will stand the test of time.

Continue reading

Google Chrome and WOFF font MIME type warnings

If you are getting warnings like Resource interpreted as Font but transferred with MIME type font/x-woff in Google Chrome then it means your web server is serving the font with the wrong MIME type.

It took awhile for the WOFF font format to get an approved MIME type so there are several variations hanging around.

  • font/x-woff
  • font/woff
  • application/x-font-woff

Thank God an official type was finally decided on, application/font-woff.

Unfortunately, Google Chrome (as of 26 beta) still expects you to use application/x-font-woff and doesn’t recognize application/font-woff as a valid MIME type. This has been fixed in the WebKit trunk but hasn’t been merged into Chrome yet. The Chromium bug report has been closed so it should be coming soon.

Continue reading

jQuery CSS Clip Animation Plugin

Yesterday I needed to animate the CSS clip property using jQuery. jQuery.animate() doesn’t support this natively so I went searching for a plugin. I found exactly what I needed in a simple plugin by Jim Palmer, unfortunately it hasn’t been updated to work with jQuery 1.8.0+.

So here you go, a forked and updated copy of the plugin which will work with jQuery 1.8.0+.

Changes include:

  • Support for jQuery 1.8.0+
  • Support for the element’s initial clip value to be specified via a stylesheet instead of an inline style
  • Support for decimal clip values (thanks to a comment by Manoel Quirino Neto)
  • Type checking fx.end to guard against errors in some scenarios
  • Support for IE8

The element you are animating must have a clip style specified. Otherwise, usage is as you would expect.

Continue reading

Single day of eternity

High up in the North in the land called Svithjod, there stands a rock. It is a hundred miles high and a hundred miles wide. Once every thousand years a little bird comes to this rock to sharpen its beak. When the rock has thus been worn away, then a single day of eternity will have gone by.

-Hendrik Willem Van Loon

Using Unix terminal shortcuts in the Windows command prompt

Unix terminals have a few basic keyboard shortcuts.

  • CTRL+L to clear the window
  • CTRL+D to close the window
  • CTRL+V to paste text

The Windows command prompt doesn’t support these by default but we can fix that with AutoHotkey.

If you don’t already have it installed, you can follow the steps in my blog post.

Add this magic to your AutoHotkey script to enable these shortcuts in the Windows command prompt and PowerShell.

Continue reading