Skip to content

All posts by moore - 58. page

Musings on php development as a career path

I was at a TedXBoulder preparty last night.  Ran into some really interesting folks–the usual tech folks, but also Charles, a high flying audio engineer (we’re talking Wembley stadium), Emily, a money manager bizdev lady ($30 million, minimum, please) and Donna, an engineer on leave from a big aerospace firm who is interested in entrepreneurialism.  Really looking forward to the talks on Saturday (tickets apparently still available).  I also ran into an old friend, roommate and colleague.

We chatted about a wide variety of topics, but one stuck out in my mind.  His brother is getting back into software development, and is starting out doing a lot of php.  Fair enough–it’s a great language, I’ve done a fair bit of it, and one can write good, maintainable, fase code with it.  But last night, we agreed that if you don’t want to be competing against, how do I say this politely, the lowest common denominator, it is wise to develop your software dev skills elsewhere, into one of three paths.  I thought it’d make a good blog post.  As I see it, the three options are

  • a compiled language–C#, Java, c, erlang: these tend to be used by large companies
  • a sexy dynamic language–Ruby, javascript (especially server side), groovy, python, clojure, lisp: my feeling is that these are more used by startups
  • particular packages in php–magento, drupal: these are often more configuration than coding, but can be customized to produce astonishingly powerful applications

The end goal, to be clear, is not to avoid php, but just to avoid competing against developers who are likely to undercut you.  For example, I knew of someone, in the US, who was doing contract php work for $18/hr a few years ago.  I just don’t think that’s someone with whom you want to be competing for business (I certainly don’t!).  Following one of the above career development paths will help you avoid that.  I personally have followed the first and third paths, with some dabbling in the second.

Blogger adds support for pages

I’m a big believer in simple websites that users can maintain–I wrote about how to set one up in less than two hours.  Snarky comments from Ralph aside, it’s a great way to get onto the web and add that much more credibility to any business you’re doing.

Blogger and WordPress.com are the two big options for easy, free web sites.  Blogger gives you more freedom in most ways, but until recently, came with a big downside–you couldn’t create standalone pages (for contact info, ‘about us’, etc)–everything had to be a post.  That’s changed: blogger now lets you create up to 10 stand alone pages.

Awesome!

My Firefox plugins

I recently moved to a new computer, and have been rebuilding my desktop environment.  I just wanted to list my Firefox plugins for future reference.

  • The Web Developer Toolbar lets you view css, disable javascript, resize your browser precisely, outline block elements and so much more.
  • Colorzilla is invaluable for a developer like me to copy a color palate correctly.
  • S3Fox lets you manage Amazon S3 buckets and their content.
  • Firebug lets you examine web pages in detail, including network operations/
  • YSlow is an add on for Firebug that evaluates site performance based on a variety of metrics
  • Some kind of whois tool–sometimes you need to know who registered that domain name

These are my drop dead extensions for typical web development work.  What am I missing?  Do you have any to recommend?

My experience implementing GWO for a non profit, part 1

A few weeks ago, I went to the most recent BDNT and saw a number of non profits present.  It was very interesting to see the vast range of needs and technical experience across the twelve non profits who actually presented.  Everything from a small webapp project to any web presence at all to updating a custom php webapp.

Most did a good job of containing their request to something manageable, though one group did get asked “Do you need a super volunteer or an employee” by Andrew Hyde, I assume because their needs seemed so vast.  The answer: no employee would be hired :).

After pizza (thanks BDNT sponsors! ) I wandered up to the group that had piqued my interest the most.  The WILD Foundation had an employee (Emily) whose job responsiblities included social media, a blog, and actively engaging the online community.  This strategy had worked wonders for the foundation’s web traffic, but for online donations?  Not so much.  This was the challenge she asked us to attack.

The session was moderated by Derek Scruggs and there were lots of great ideas.  To paraphrase, you could see where someone sat by what actions they suggested.  I mentioned Google Website Optimizer (a tool I’ve been a fan of for a long time); marketing folks wanted to focus on the message; some people wanted to change button color.  There were about 10 suggestions at the end.  Derek and Emily and the group then ranked them by effort (mostly group input) and priority (mostly Emily input).  Then we assigned tasks to volunteers.

I volunteered to set up a GWO test for the donate button on the WILD.org homepage.  We’re going to vary images and text to see if we can drive greater click through to the donate page.  Eventually, it’d be nice to optimize the whole process, but the actual donation page and donation thank you page are hosted on a vendor’s server, so I’m not sure whether we’ll be able to.

It’s been a week or so, and I still haven’t gotten write access to the template so I can add the code.  There are a number of reasons, and I think they might be common to all technical volunteer efforts, so I thought I’d outline them.

  • Exploration of technology takes some time.  I looked at the GWO for wordpress plugins, and found that they didn’t quite do what we wanted.  I also nosed around the existing site and found which file to change in the theme.  And I suggested what elements we might want to vary and ran those by Emily.
  • Time was a big issue; both mine and Emily’s was generally lacking.  Since it was a volunteer effort, I squeezed it in around work that paid.  Emily had to do her job first too.
  • Trust had to be established.  These folks didn’t know me from Adam, and yet were letting me edit one of their primary faces to the world?  Emily’s IT guy was rightly concerned about this, and insisted on a website backup.
  • IT issues–I had trouble editing the theme files, and working through Emily (with this being neither of our highest priority) to resolve the IT issue (basically, getting me an FTP account) took some additional time.  As mentioned above, there’s still an issue of not being able to track the entire donation process (so as to optimize it) because the WILD foundation uses a third party donation acceptance service.  I think we can make it work but wanted to get a win and build trust without having to involve a third party like the donation acceptance vendor.

However, it’s all coming together.  Once I get GWO up and running, I’ll let you know.

Should Google share its index?

Dion Almaer points to an interesting article about search engine indices,  proposing they be shared across search engines.  The article is worth a read, but the points are:

  • bots use a tremendous amount of bandwidth across the internet
  • they all get the same pages; the value is in their algorithms
  • therefore, the capacity of the internet would be increased if a company were to make their index available for all search engines to use
  • Google has the largest index, therefore it might be best if they did the sharing

I think there are a couple of issues with this scenario, but the largest is that having the biggest index is a competitive advantage for Google–why would they give that up merely to free up internet bandwidth that isn’t costing Google a penny? Stephen O’Grady succinctly sums up this issue.

In addition, I’m sure that any search engine company that was basing their results on an index would want to have a hand in controlling the index; Dion later suggests a third party index, but I’m not sure where the impetus comes for that.

I think this idea falls under the “wouldn’t it be nice” category, but don’t see any way to get from here to there.  Good intellectual exercise, though.

Upgrading WordPress is shockingly easy

I was all set to write a post about my experience with the most recent BDNT, when I got distracted by an excellent post from Josh Fraser about never using captchas–excellent post well worth the read. After reading through the comments, mollom seemed like a great way to avoid captcha and comment moderation, and I decided to give it a try. However, mollom didn’t work on my ancient version of wordpress (2.0). This being a weekend I’m heading out of town, it seemed like the perfect time to upgrade my wordpress site (the backend–I hope you’ll notice that the soothing front end look and feel hasn’t changed).

I browsed through the releases list to find the oldest one with automatic upgrade functionality, and then followed the quite painless upgrade guide. From there, it was a pretty simple matter to automagically upgrade to 3.0. Shockingly easy.

Overall, it looks like there are a few snafus–the home page didn’t have a sidebar because of post content for a bit, my tagging plugin doesn’t appear to be compatible with this version of wordpress–but it looks like all the content is there. If you see any content that looks broken, and you feel charitable, please post a comment on this entry.

More on code splitting and GWT

Code splitting is one of the features of GWT that make it worth your while.  See, using GWT is really a choice–do you want to use one of the lightweight javascript libraries like jquery, with all the agility that implies, or do you want to use GWT which lets you leverage all kinds of java tools and optimizations, but saddles you with a compile cycle?

I’ve talked before about the situations that I think are good fits for GWT.  I just re-read that post and don’t feel that things have changed too much in the past 3 years, though I might argue with point 4 of that post.  Code splitting is an optimization that would be hard to do with a more normal javascript library (dojo has something like it, but it looks like you are responsible for maintaining dependencies).

I talked before about code splitting, and how it is a great fit for the widget based html enhancing GWT development that I’ve done a lot of recently.  I wanted to talk a bit more about my process for finding code to split.

With code splitting, the main goal is “never have the user download javascript that isn’t used”.

The first thing to do is run your GWT compile with the -compileReport option, as outlined here. This will show you your module code, and therefore let you focus your effort where it makes sense.

The second thing to do is to find code dependencies.  The compile report shows you that in a text format if you navigate all the way down to the class level in a class that is downloaded in the inital fragment via the “see why” link.  I had a hard time understanding those dependency lists, so I went looking for a tool to help.  After trying a number of open source dependency analyzers, I stumbled on the Class Dependency Analyzer (CDA) which is free as in beer, not as in speech.  The key difference between this tool and others was its included dependency graphs.  You should set CDA up to ignore all the google code, as well as any third party tools you have.  More documentation on CDA here.  (This is another example of leveraging java’s tool set.)

Using CDA, you can see which packages (since modules are grouped in a java package) have dependencies on others.  Packages that don’t have dependencies on any of your other packages are great candidates for code splitting, as well as packages that depend on other packages that are code split.  However, if your packages depend on utility classes, especially those that share business logic between client and server side code, that’s OK.  (This exercise can also help in general code quality.)

Now you have a number of candidate modules.  The next thing to do is dive into the code and see if these modules execute on every page.  If they do, then doing code splitting is not a win.  All you’ve done is forced GWT to make an extra network call.  If, on the other hand, this code only executes when someone clicks a button or takes some other action, then you have a great candidate for code splitting.  And if the module only executes on certain pages (perhaps using a DOM element to signal whether it should execute or not), you have a good candidate–because with splitting that code will never be download on pages where it is not used.

Now, add the following code around the candidates:

GWT.runAsync(new RunAsyncCallback() {
public void onFailure(Throwable caught) {
// handle error
}

public void onSuccess() {
// do something
}
}

I actually added this code block to my eclipse templates ( more on templates here) so it is super easy to set up a split point.  Note that I haven’t found a generic good action to take on failure.  For most widgets providing enhanced functionality, a safe fallback might be to just let the HTML execute.  A custom message display might be ignored, and using Window.alert can confuse your users (and lock up a browser for a time if all of your code or the network suddenly becomes unavailable).

The next step is to run the compile report again and see if the GWT compiler agrees with you that your candidate code is not reachable by any other path.  If it does, you should see split points show up underneath the permutations menu.  (BTW, the -compileReport flag easily doubles or triples the time it takes to compile GWT–I’d recommend focusing on one user-agent and doing other things to speed up your compile, as outlined here.)  You can also test this by just compiling your GWT without the -compileReport switch and looking under the deferredjs directory; it is quicker but doesn’t help you determine which modules are being downloaded.  Firebug also lets you see the files downloaded on demand.

I was able to decrease the initial download size of a project I’m working on by 20%.

I’ve mentioned the caveats before but they are worth mentioning again.

  • The XS linker is not supported, so if any of your XS modules depend on a module which has code splitting, you’ll find out when your GWT does not compile.  However, there is hope–code splitting support for the XS linker is apparently coming with GWT 2.1.  If you need this functionality, vote for the bug.  There are some work arounds in the meantime, but they involve a fair bit of hoop jumping so I’m going to avoid documenting them.
  • Events that happen before code is asynchronously downloaded are not propagated to that code.

Given the second issue, it’s important to test your code and make sure that the behavior is unchanged.  That’s the final step.

I hope this was a useful tour of the GWT code splitting process.

When is a Boolean != to a boolean

Among other times, when you’re passing it into a JSNI method in GWT.  From the docs, only a java boolean is translated into “JavaScript boolean value, as in var b = true;”  A Boolean is, like any other Java object, an “opaque value accessible through special syntax”.

Piwik now has goals

About a year ago, I wrote about piwik, a replacement for javascript based analytics tools like Google Analytics.  I installed it on a couple of my sites, and have been watching it progress with regular updates.  As of the latest version (0.6.3), they now have goals!  To me, that is one of the key features of any analytics tool.  Now you can have the analysis and not have to share it with anyone else (though you do have to update and maintain the software yourself, unless you use a site like My Free Web Stats).

After enabling the goal plugin, I set up a quick goal to track commenting on my blog (or at least if someone clicks the submit button on the comment form).  The basic documentation on goal tracking doesn’t discuss how to do this, though it does cover url based tracking pretty well.  A quick search turned up this page, which explains how to write the javascript to track a goal manually (which I then placed in an onclick handler).  This bug post on goal tracking via links may be useful too.

I’m happy to see a well done open source alternative to analytics tools that lets you control your data.  Piwik probably won’t be of interest to many people (most will just drop in Google Analytics and call it good), but for a few may be indispensible.  And support for goals is a key part of the maturation of this project.

[tags]piwik,goals,opensource,analytics[/tags]