Angular and Browserify

Angular works beautifully with browserify.

I loved what Require JS did for my Marionette project, but I hated the complexity that it added for everyone else.  I had to jump through hoops to write independent modules using Require JS and Marionette JS.

However, browserify is very simple to use and makes independent modules a breeze.  I had to update angular and modify some files to get it working (not checked in yet) but here’s where I plan to check in my prototype forked from another repo.

TinyMCE WYSIWYG editor to PDF and DOCX formats using docx4j

Few steps to get this done after the environment set up.  Basically prep html document, convert to xhtml, add to docx4j document, and generate.

1. (Preparing HTML) Wrap TinyMCE generated HTML in a root element such as div.

2. (Preparing HTML) Replace   with

3. (Preparing HTML) Use regEx to remove height and width attributes from images.  Affected version 2.8.1.  See

4. (Convert to XHTML, Generate) Use XHTMLImporter to convert the html into xhtml.  See

* Update - 2.8.1 seems to have trouble with underline and background color.  3.0.0 fixes that.  Both versions have trouble with table border and table caption.  3.0.1 (unreleased) should fix table border.  See


How to Retain Top Software Developers

I’ve worked with many companies in the Washington, D.C. metropolitan area, and there’s a huge retention problem.  Here are some of my thoughts on how to retain top talent in the software industry in general.  It might be relevant to note that this is from a millennial’s (Generation Y) perspective.

1. Reward top talent according to what they want. Ask them individually how they want to be rewarded, and reward them.  Examples are recognition, financial rewards, promotions, and paid time off.  If you can’t do it, at least show some effort or progress.

2. Ask about their desired career path and guide them.  There are too many cases where management want to keep employees where they are most efficient.  Efficiency is good for the tasks, but it’s also boring for the employees. You could also be missing out on some amazing potential. Guide them towards their goal by building the skills they need.

3. Rotate interesting tasks across developers.  Usually a project comes with many redundant, boring tasks.  Do not let only one developer take all the interesting tasks, it rarely does any good.  If only one developer can tackle such tasks, this is a resource management issue, let other developers shadow or pair with the developer to tackle difficult, interest problems together to fix this problem.

4. Encourage developers to set up one or two meetings a day outside of regular lunch hours to discuss the larger technical scope of the project.  Maybe even have developers present their work.  Doing such would allow developers to keep the big technical goals in mind and it also gets the developers out of their seat increasing physical activity.  Surely this would also improve code quality.  In my world, I would have something like recess or gym class mid-day to refresh the mind.

5. Keep hours flexible, but set core hours.  Developers are more efficient at different times of the day with breaks.  Some days the brain just doesn’t work, and some days it does wonders.  Core hours are not meant to be 7 hours of the day, it should be at most 6 hours but preferably around 5 hours.

6. Give developers a sense of ownership of their code.  If a developer works on the full feature set from top to bottom, they will gain a sense of ownership.  Adding new features and refactoring will be a breeze, and developers could have some pride in their code.  This usually improves efficiency too.

7. Don’t force or encourage developers to take short cuts.  There’s a quick way, and there’s the right way.  In my opinion, usually the right way doesn’t take much longer than the quick way.  There’s no reason to take short cuts when there are so many negatives including hurting morale.

8. Let the bad developers go.  Sometimes there are bad developers.  Not just bad in terms of code quality, but hazardous to the culture and office environment.  Recognize the problem early, and don’t make any extra effort to retain negative talent.

This covers most of the topics I wanted to write about, but every situation is different.  Open communication with the employees is the easiest way to find and resolve issues.  I know there are a ton of recruiters hunting for software developers, but employees would rather stay loyal.

Backbone Marionette vs Angular

I’ve been using both Marionette and Angular in two different projects.  I think I’ve used both frameworks extensively enough to make a comparison.  I think Angular is the winner.

I like the structure that Marionette provides, but it also complicates things.  Especially with Require JS.  When something goes wrong, the developer should have a very good grasp of the entire project.  I’ve grown accustomed to jQuery, but I don’t like it as much after using Angular.  I also set up a very complex system with testable independent modules, but I think it would be easier with Angular since it doesn’t use Require JS albeit similar.

Angular allows for quicker development, in my opinion.  Also, the code is more re-usable.  I can use the same controller that supports multiple html views – something that comes with jQuery-style DOM manipulating code.  Using a similar project structure really makes the code more workable.

I just watched a bunch of videos on regarding Angular, and it only took me a few days to really get going with the Angular style code.  

Apache Avro JSON Decoder for List/Array of Avro Objects

I couldn’t find a good example of decoding a JSON string that’s a list/array of Avro objects on the web. I just wanted to write a post to say that it works.

Here’s a few high level things that I remember

  • Create a JSON Decoder with Schema.createArray({avroObject}.getSchema())
  • When initializing the data reader, use List<{avroObject}> and also pass in an initialized instance of List<{avroObject}> along with the JSON Decoder created above.

It should work, but I had to use the debugger a few times to clear out some JSON issues.  I hope this helps – I spent a lot of unnecessary time checking whether something like this would work.  It looks like it’s supported out of the box.