Out with the old..

Since this blog has been badly neglected, it’s time to breathe new life into it. Out with the old and in with the new … I’m removing the sparse posts from the last few years and starting anew.

How many times have I said that, I wonder?

Fixing the Nook app for OSX

Although I usually read books on paper on the iPad, I downloaded the Nook app for OSX this evening.  Downloaded just fine, opened fine, but never made it past the splash screen. The animated “Nook” logo flashed across, froze, and sat there. For a long time.
Restarted several times with the same result, even downloaded it again and reinstalled with the same results.  As of right now, the latest version is 3.0.0 which was released in March 2012, so not a lot of recent work has gone into it.  Some google searches resulted in quite a few other people having the same problem with no real answer or updates from the B&N folks.
The solution as it turns out, is a very easy fix.  In your /applications/ folder (where the Nook app is installed) create a new folder, call it “NookforMac” and drag the app in there. Make sure the app is closed, re-open it, and viola. Should work just fine.
Credit to kateB over at openkase for the workaround.
Update:  Well, this solution worked for about a week, then the problem returned.  The solution for that was to wait until the app launched, and froze on the nook animation. Right clicking in the grey-space around the logo and selecting ‘reload’ got the app to load the rest of the way (although it took a couple of times).
 

WordPress, Jetpack stats graph, and broken images in the admin bar – and a solution

Get ready for it, this is…a blog post about a blog.

I recently upgraded to WordPress 3.5.1, the upgrade went off without a hitch, save one problem.  The sparkline graph from the Jetpack plugin was displaying as a broken link.  If you’re not familiar with the term “sparkline” don’t worry, I didn’t know what it was called until I started doing searches.  The sparkline is a small traffic graph that appears in the admin bar when  you’re logged into your WordPress account; it shows your site traffic for the last 48-hours.

After looking all over the web, in the WordPress and Jetpack forums I found people with similar issues, but none of their resolutions fit my particular issue.  I tried disabling plugins one at a time, that made no difference.  I deactivated Jetpack and then linked it again. No difference.  Removed Jetpack altogether and reinstalled, same result.

Through the WordPress forums I was able to get in touch with Jeremy, a Happiness Engineer with Automattic who helped me figure out the root cause. Big thanks to him for taking the time to work with me. Here’s how we diagnosed the issue.

View the xmlrpc.php file in the root of your WordPress directory with a web browser. It should return the text “XML-RPC server accepts POST requests only.”  If that message is the first line of the page, then your problem may lie elsewhere.  If there are any empty lines or spaces above that message then you have a php script introducing whitespace before the headers are printed, and Jetpack hates this. That additional whitespace could be coming from plugins, themes, or any custom hacks to the WordPress core.

Since I had already disabled all the plugins, I knew it couldn’t be coming from them.  Next up, switch back to the default theme. When I did that the sparkline appeared right away, so it was something in the theme, so the next step is to go through all the php files in the theme and look for empty lines before the php tags, or empty lines between closing and opening tags, functions.php would be the most likely location.

In my case, there were so many included files in the functions.php file that it was becoming quite tedious to look through them all and since a theme update was available I went ahead and tarballed up the directory and ran the update. Result? Graph is back and everything is happy.

I found a useful piece of shell code online that quickly searches for leading and trailing empty lines in files, might come in handy if you decide to search for yourself:


for f in `find . -type f`; do
for t in head tail; do
$t -1 $f |egrep '^[ ]*$' >/dev/null && echo "blank line at the $t of $f";
done;
done

Happy Bug Hunting!