Historical & Future Writing Patterns

Let’s have a look at the what content has been the most popular here on johnbeales.com over the past several years, what I’ve written the most of, and what I’m hoping to write more of, (this is part of the 10 Days to a Better Blog series I wrote about on Sunday, and is a bit introspective).

The two posts that are by far the most popular are ancient: Using VLC to transcode an Axis Camera’s video stream, and stream it out again from 2008, and Transferring OS X and Boot Camp to a New Hard Drive from 2011. In the case of the streaming post, transcoding or transforming video streams from IP cameras for public viewing on the web was a new concept, using VLC, which is free, to do it was very attractive, and there was very little information available on the web about how to turn the stream from an IP camera into something consumable in a web browser. As for the post about transferring to a new hard drive, the post is a detailed step-by-step, and there’s a large audience of people who buy new macs and want to transfer their info. These are one-hit-wonders, though, I could update them, but they would no longer be new. In the case of streaming the answer was “Use Wowza” even when I wrote the post.

Let’s look at content categories that have done well. “How To” content is popular, probably because that’s most of what’s here, but things I write about most often, like WordPress and Javascript, are not consistent leaders. Some WordPress posts have good traffic numbers, but it’s the weird posts like Improving Trac’s Tickets by Milestone Report or How to Update an Updated Subversion Repository from a Working Copy that have generated the most comments, excluding the two hero posts discussed above.

I’ll keep writing How To content for myself, I have some sketched out already, but I should explore writing about weird things a bit more. There are a couple of new categories that might show up here as well: Comment on social issues, (I touched on exclusion of women on Monday), and sometimes Photography, which used to be a lot more active than it is.

 

Accidental Exclusion

I often listen to the Accidental Tech Podcast while washing dishes, and this week they had a discussion sparked in part by a tweet by John Siracusa about what they can do to get more women to listen to the show. One of the responses to John’s tweet discussed on the show is that the sponsor reads sometimes feel like they cater exclusively to men, and John and Marco discussed the merits of dropping sponsors that cater only to men vs. trying to modify the ad read in a way that it’s inclusive, even if the sponsor sells a male-focused product.

The discussion was mostly about Harry’s, a shaving company, and the most obviously male-oriented recurring sponsor of the show, and in the discussion Marco stated that he felt the script was pretty neutral, with the exact words “I don’t think the script is really the problem.” Because Marco seems like a considerate man who genuinely wants to include everyone I’m pointing out how last week’s seemingly-innocent sponsor read for Harry’s excludes women.

Numerous comparisons, in quality, price, and comfort, to the Fusion line of razors, suggesting the style is Mad Men-inspired, and, and the statement that Harry’s “was started by two guys who wanted a better product” leave no doubt that these are razors being made for men, not women. Saying that the blades provide “a better shave that respects your face” leaves little doubt that Marco is speaking to the men in the audience, not the women.

The short phrase “respects your face” excludes women. If it read “a better shave that respects your skin” or “a better shave that respects the face” then women would not be excluded. John suggests going even further and trying to include women, but the point of this post is to show how easy it is to exclude a group without even realizing it.

Posts two days in a row. Why?

After many months of silence this is the second day in a row that a post has appeared here. Why?

The story starts on May 1 when a tweet by Tim Ferriss about Coach.me, caught my eye, (he’s an investor). I downloaded the app and am trying the “Habit of Waking Up On Time” challenge. One of the suggestions is to replace the habit of sleeping in or hitting snooze with a new habit, which brings me to John Saddington, the programmer behind Desk app. In November John posted 10 Days to a Better Blog! — a series of exercises to get people blogging. I’ve had it bookmarked, and blogging exercises are much more productive than sleeping, so I’m working through the exercises when I wake up. Today’s exercise is to post about why I write. I’ve read ahead and some of them are a bit navel-gazing, like this one.

So why do I write?

I write to avoid forgetting. There’s a sweet spot where I use a technique a few times a year, but not all the time, and it requires some almost-repeated code, often SQL. I like to get those things into a blog post so the queries are easy to find, such as analyzing web server logs in MySQL. Sometimes I solve difficult problems and I don’t want to forget how. My posts on transferring a Boot Camp partition to a new hard drive and transcoding live video streams from IP cameras are examples of these.

There’s a second reason I write: to rant, hopefully constructively. This doesn’t happen often, but it has, this is a blog after all.

The third reason I write is to try to refine ideas. This kind of writing rarely ends up anywhere public, but writing, then editing, helps me figure out things I’m having problems with, from code to business to gardening and beyond.

PhpStorm Review

Late last year I kept hearing a lot about PhpStorm 8, especially from WordPress people and wanted to try it out but the price was stopping me, (it turns out the price is probably worth paying – but it’s hard to know if the price is worth paying until you’ve already paid the price). Luckily for me WP e-Commerce has some licenses for core contributors, and apparently I count, (JetBrains, the people who make PhpStorm, provide licenses to open-source projects at no charge – thanks!).

One of the things that JetBrains asked in return for the licenses was that we try to write reviews of our experience, and after many months of using PhpStorm, here are my thoughts.

PhpStorm crashed several times in the 24 hours after I installed it, not a good start. Support suggested installing the EAP version, which is like a beta stream, which fixed the problem. Since then I’ve switched back & forth between the current release and EAP versions of PhpStorm, but I usually use the EAP, because I like shiny things.

Performance

I had heard that PhpStorm was fast, but it’s a Java app, (like Netbeans or Eclipse), so I had my doubts. When first installed there were some pretty big performance issues, especially related to scrolling. PhpStorm was exhibiting what I refer to as “that Java scroll lag” – one of the reasons I tend to avoid Java apps. There was also a problem that when scrolling with the mouse the text would disappear, which makes mouse scrolling nearly useless. Eventually I learned that there’s a version of PhpStorm for OS X that comes with a bundled, tweaked, Java Run-time Environment, and using that version of PhpStorm solved these problems.

When comparing PhpStorm’s performance to Sublime Text, (2 or 3), Sublime Text is still way faster. PhpStorm feels like a normal app, but ST3 has that amazing snappiness that Sublime Text users have come to love, and want to see everywhere. While PhpStorm’s performance is satisfactory, it’s not as blazing fast as the chatter led me to believe, but the combination of decent speed, and the other benefits that of using a real IDE, mean it helps me write cleaner code faster.

Setup

Like most coding programs, especially Java ones, PhpStorm hurt my eyes out of the box, but the look is tweakable enough to make it look how I want. There are two built-in themes, (“Default” and “Darcula”), and you can load 3rd-party colour schemes for the text editor. I think it might be possible to load 3rd-party themes as well but I haven’t investigated this. Switching to the Darcula theme, and switching to the Predawn colour scheme, (I can’t remember where I found the PhpStorm port, maybe it even came with it), and Inconsolata made PhpStorm feel like home.

Coming from ST3 I re-mapped some keyboard shortcuts to match ST3 make the transition easier and make it easier to switch between the two when needed.

I had to download extra drivers to connect to MySQL, which was kind of annoying, but I suspect might be license-related.

And Java. PhpStorm 8 requires Java 6, which is no longer installed on Macs because it’s so old, that’s why there’s a version offered for OS X with a bundled JRE. It’s possible to install Java 6 with a package from Apple, because we all love having several versions of Java installed, or it’s possible to tweak some plist files to let PhpStorm run with Java 8, (the current version). Fortunately, it looks like PhpStorm 9, (which I’m running the EAP of now), will do away with this requirement.

Code Inspection

This is an IDE, so it’s aware of any databases that get used. This is great most of the time, (the code inspector tells you if you mis-type a column name, for example), but the it also fusses when I build big SQL queries by concatenating strings. So far I’ve just ignored these complaints.

If I include a file like this in WP: include( get_stylesheet_directory() . ‘/myfile.php’); PhpStorm thinks that myfile.php doesn’t exist, even if it does. Since this is the “right way” to include files in WP themes, and PhpStorm advertises built-in WP knowledge, PhpStorm should understand it.

When making a commit to your preferred Source-Control system, (Git, right?), PhpStorm inspects the code you’re committing, and if there are errors or warnings it pops up a window saying so, and gives you a chance to fix these problems. This is a great way to slowly clean up the code of older projects with lots of legacy, (read: “written before I knew better”), code. However, it’s also kind of annoying when unfixable errors or warnings are included, like when I’ve concatenated together an SQL query.

I was working on a plugin that works with WooCommerce and PhpStorm complained that I was assigning the return value of a function that returns void to a variable. It turns out that WooCommerce has several PHP DocBlocks that state a function returns void when it actually returns a value. Thanks to a WP e-Commerce copy of PhpStorm for pointing out errors in WooCommerce!

Annoyances

If someone from Jetbrains reads this, consider these bug reports!

text-gone-bonkers

Sometimes the fonts go bonkers. When I was first setting PhpStorm to use Inconsolata they did, (that was using the release version), and a few times on the EAP I committed some code, and when the commit finished the display went crazy again.

PHPStorm Power Consumption

Power consumption – I’m not sure how it compares to Sublime Text, but it’s consuming more power than Photoshop today – #2 on the list behind Safari with 11 tabs open.

 

The first time I used the “Pull Up” refactor tool, which lets you pull methods up from a class into the parent class, I pulled up a bunch of static methods. PhpStorm didn’t actually go and find the places where the methods were called and change the calls, which I thought was the point of the “smart” IDE. Inheritance would mean that these methods would still be available, but there’s no reason to load the child class if everything I need is in the parent.

The auto-complete can be really bizarre. Often doesn’t pick the logical thing, or even the first thing in the suggestion list. For example, if I type “col” then press tab or enter autocomplete completes as “columns” not “color,” even though color is the first suggestion. It even insists on completing as “columns” if I type “colo” and press tab/enter. This drives me mad.

Search for any file, (I’ve got it mapped to Cmd+P to match Sublime Text): If a project has several files with the same name there doesn’t seem to be mapping that makes sense. To me it would make sense for the first option to be the one I used the most recently, or the one “closest” to whatever file I’m already looking at in the directory structure. If the files are sorted at the moment, it looks like it’s alphabetical, which should change.

Auto-change formatting: I try to use WordPress style in most of my PHP & Javascript – especially for WordPress-related work! WP style suggests putting a space around function parameters in both Javascript and PHP. However, if I’m doing chained calls in Javascript PhpStorm removes the space after the last function argument when I press the . key. For example:

$( 'body' )
// becomes
$( 'body').
// as soon as the period is typed

When PhpStorm 8.0.3 came out I started getting SSL error messages on startup. Apparently there’s a problem in some SSL-related part of the bundled JRE. 8.0.3 came out on February 13 and there’s still no fix. The current EAP doesn’t have this problem.

PhpStorm’s licensing scheme for open-source projects has changed this year, so I need a Jetbrains account, the licence is issued from WP e-Commerce to that account, then I’m supposed to sign in to the account with PhpStorm and it’ll activate. Unfortunately the SSL bug prevents PhpStorm from talking to the Jetbrains servers, so I can’t activate my PhpStorm license. Luckily the EAP comes with its own license, otherwise I would be out of luck. A bug that prevents customers from activating software is a very big bug.

Conclusion

PhpStorm is good, very good at some things, especially the IDE-type functionality I was looking for. Integrated code inspections & linting were a welcome surprise that is really helping my code look better and encouraging me to write better in-line documentation. There have been problems, though, that might have caused me to abandon PhpStorm I hadn’t pre-decided to give it a real chance. I nearly always use the EAP both because I like shiny things, and because the bugs in the release version of the software are annoying, or serious, enough to drive me into the arms of the EAP.

So, is PhpStorm worth the purchase price? Probably. It handles code completion, data-source awareness, most refactoring, and all its IDE-related functionality quickly and as promised, (or very nearly so). The problems tend to be in other areas, and from the state of the current PhpStorm 9 EAP, most of these problems will be solved soon.