The risk in cutting corners in software deliveries

The risk in cutting corners in software deliveries

Agile Software Development Lifecycle
The software development life cycle

We have all been on a project or two, where the delivery date was fixed in time, due to dependant companies, public launch announcements.  Now hopefully those dates are planned around the work that needs to be done, with at least some buffer room for the eventual things that can go wrong.

Continue reading “The risk in cutting corners in software deliveries”

First Android app

My First Android app

Part of my goals for 2014, was to find the time to publish my app.  I have been working on the idea over the past 18 months, and have in fact tried out a couple of versions of it.

The main problem I faced, is that I lacked the time to learn how to do it right, and being the type of person that wants it done right when my name is on the line.

Over the 2013 holidays, I decided this was it.  I was going to give it a go, and see what would come of it.  If it turns out, great, if not at least I tried.
Continue reading “First Android app”

Deploying websites with a git post-receive hook

I have been looking around for quick and easy ways for deploying website content from our version control system, without having a build process ( the site is ninety nine percent static html and has nothing to build ).  The only aspects that are interesting from a build process is a minifying resources and less compilation.

I have seen a few posts around the web suggesting a git post-receive hook.  The idea of pushing the desired codebase to the desired server is desired, is in fact quite appealing.  I have worked a lot in the past with solutions such as Jenkins, that work great for build solutions, but seemed like overkill for this context.
Continue reading “Deploying websites with a git post-receive hook”

Drupal modules failing to update on PHP 5.4

This entry is mostly just a summary or a recap if you will of a few posts ( and 2 pages of replies and comments on the Drupal site Drupal Bug Page ).

If you are experiencing the following error messages on a Drupal 7 site

Update failed! See the log below for more information. Your site is still in maintenance mode.
token
Error installing / updating
 File Transfer failed, reason: Cannot remove directory /homepages/24/d451754577/htdocs/profiles/openenterprise/modules/token/..
filefield_sources
Error installing / updating
 File Transfer failed, reason: Cannot remove directory /homepages/24/d451754577/htdocs/profiles/openenterprise/modules/filefield_sources/..
ctools
Error installing / updating
 File Transfer failed, reason: Cannot remove directory /homepages/24/d451754577/htdocs/profiles/openenterprise/modules/ctools/..

Continue reading “Drupal modules failing to update on PHP 5.4”

AVD Emulator crashes on MAC ( emulator64-arm quit unexpectedly )

I recently got back into doing some android development. Its been an adjustment period to say the least. One of those adjustments has been the slight differences of working on a Mac. I came across a bug today, that baffled me for a while and required some of my best “google-fu” to figure out.

I ended up at this site: http://code.google.com/p/android/issues/detail?id=38371

The problem is essentially the AVD manager can’t re-open a virtual device that was on a second monitor on a Mac. The work around is to edit the following file

~/.android/avd/.avd/emulator-user.ini

 

and change the

window.x=0

That’s it.  It’s an ugly hack, but it works for now.  According to the bug report it should be fixed with the next release of the android developer tools. ( http://developer.android.com )

The definitive way to implement a singleton in java

I’ve been interviewing a bunch of candidates lately ( we are hiring ) for a senior java developer’s position, and i’ve come to realize how far from the basics numerous people have become.  You ask them about some ajax feature, or new app on facebook, etc, they jump at the chance to talk about this, talk about that.  Ask them about some basic concepts, and other than textbook definitions, they can’t explain it.

The source of frustration for this post, is from an interview i had a couple weeks ago.  I asked the developer, who had about 2 years experience if i recall correctly and a bachelor’s degree in computer science ( i don’t recall from where, unfortunately), to explain to me what a singleton was.  His reply was typical, if not rehearsed

A singleton is an object that has only one instance in a virtual machine.  This is achieved by having a private constructor, and a static method that either returns an existing instance, or creates then returns the instance.

I love the singleton question, because it allows me to focus in on anything based on their answer.  I can follow up with threading, locking, resource allocation (database pools, etc ), memory allocation ( when is the instance created, etc ).  It is what i like to refer to as a ramp up question.  On the surface, its extremely easy to answer, but if the person don’t pay attention, or doesn’t know when to stop talking, they can get into real trouble.

On the surface the candidates answer was correct and accurate.  I decided to follow up with a how would you write such a method, the reply

I wouldn’t, i would put the @Scope(“singleton”) annotation or put singleton in the spring xml configuration

Once i climbed back into my chair, as i obviously fell out of it hearing that, i asked, what if you weren’t using spring, write me the code for it.  The candidate, wrote the code, but couldnt’ explain the threading risks, or the double checked locking failure .  So enough about interviews, here is the definitive method for implementing a singleton in java.

I did not invent this method, it is from Joshua Block’s Effective Java Reloaded talk from Google IO in 2008 at 28:56


public enum Elvis {
     INSTANCE;
     private final String[] favoriteSongs =
         { "Hound Dog", "Heartbreak Hotel" };
     public void printFavorites() {
         System.out.println(Arrays.toString(favoriteSongs));
     }
}

The reason behind this, is that the enum is created when the class is loaded.  It is automatically serializable, and will always reload to the same instance. That’s all for now.

Day programmer vs Night programmer : revisited

A couple days ago DZone linked to the following article.

The author goes on to define a Day programmer as someone who write code for a living, being mostly incompetant at their job, just doing this for a paycheck.  He then goes on to talk about night programmers as the leads of the technological world, the people that do most of the work, the people contributing to the evolution of their trade.

Every person i’ve ever met acknowledges that there is a distinction, I am no exception.  However I believe there are actually 3 categories of developers, and they aren’t as clearly defined as he makes it out to be. website host information  My categories are more along the lines of this

  1. Programmer
  2. Developer
  3. Elitist schmuck

Let me now describe how i see each person.  First here are the characteristics that i associate with a programmer.

  1. They are in the field mostly because they were decent with computers, and were looking for a good paying job
  2. They are the “do it” guys.  They aren’t here to make waves, they want to be told what to do, get it done and go home to their friends/families
  3. They look for the best paying job for their skillset, with little to no consideration for the work to be done
  4. They only see their assigned tasks, without thought of future impacts
  5. They people are the ones who do the brunt of the daily tasks
  6. Without these people projects would never get done

Most programmers don’t see a solution, they see code to write, and that’s it.  They also understand this limitation, and don’t regret it as their job is usually a means to an end ( feed their family, buy that lexus, the trip to Bora Bora ).  These are often the first hit when a company is having financial trouble or the economy slumps.

The difference between a developer and a programmer, although might seem simply refering to terminology, i believe there is a fundamental difference.  A developer is someone that will be uptodate, and someone who can propose a solution to a problem, not just take a requirement and bang out a bunch of code.  Here are some of the characteristics that i associate with a developer.

  1. These people got into the IT field because of their passion for computers
  2. They will/and do decide their next job not only in relation to the salary, but take into consideration the work they will be doing
  3. These are the people who read and participate in online communities, keep their skills fresh and updated, because something new can be something cool, and help them out later on
  4. They will go the extra mile for their projects/team/job/company but know that there must be a balance of life and work.  That balance will shift from time to time ( during crunch times at work, etc )
  5. They can see solutions to complex problems
  6. They see how today’s development will impact future requirements/enhancements
  7. People follow them based on their personality, and interactions with others
  8. These people are passionate about teaching others, because their passion will hopefully convert another to what they love

A developer will help you through the problems, and stick with it.  They won’t jump ship at first sign of a slightly better paying job, because they joined your company for more than just the paycheck.  They joined because of the atmosphere, the challenge, the opportunity to show that they can be a cornerstone resource, and that thought they could contribute.  These resources are the ones that will bring you solutions to your problems, instead of trying to find a way to fit your problem into their known pattern.

Now for the third category, what i call the elitist schmucks.  These are actually mostly detrimental to your projects, so beware.

  1. Live to right code, and nothing else
  2. Believe that they are the only ones that can solve a problem, even if there solution doesn’t fit into budget, timeframe, client needs, etc
  3. They don’t believe in team work, as it is a waste of their coding time
  4. They can’t understand when people don’t want to follow their brillance

The elitist schmuck, is a very intelligent individual, and can be a huge contributor to your project, as long as you let them decide everything on how it is done.  They have a vision, and as long as you don’t challenge that vision, things will be alright, until the next “big thing” hits, and you refuse to re-write your whole application/platform/etc into that new thing.

The difference i see between a developer and a schmuck, is the ability to work with a team, and with the business to achieve a solution.  The ability to say “Ok, this isn’t the ideal technical solution, but it fits the timeframe, the budget and will work for now.”  They often will propose multiple solutions to your problem, and offer the pro’s and con’s to each, and work to find the best fit.

just my 2 cents on the matter.

Building your A team

A couple days ago, I came across a blog entry that talked about building your A Team. An A Team is, for me, a list of individuals that you can feel comfortable surrounding yourself with, and that things will get done, well. These are usually people you’ve worked with before, and they are the people you would instantly try to build a new team with given the opportunity.  They are the people that you may not be able to hire right away, but they are worth waiting for if you know a position would open up.

I felt like I wanted to expand on this. The people on YOUR A Team are not necessarily the “smartest person”, the “best developer”, etc, they can be, but it isn’t a requirement.  They are the people that no matter what the project, you can count on them to help get you out of it. They are the people that you don’t need to worry whether things are getting done, you can just have faith that it is being done.  These are the individuals that no matter how bad the situation, will keep everyone going, by the simple knowledge that we will get through it successfully, with a smile on your face.

So I figured I would take his challenge, do I have my A Team, I can’t say I have the full team together, but I do have some of the key components, people that know they art/trade and know how to adapt it to any environments.

I’ve also come to realize that I am on at least a couple people’s A Team, based on previous experience.

Do you have your A Team? And does it ever change?

Easing the pain of Database maintenance on android

I’ve been working on a couple android apps for the past couple weeks, and have gone through some of the “new platform” growing pains.  Not that Android is the problem, just the changing from a platform/framework that I am familiar with, to something new and exciting.  This post won’t cover how to use a database, however I may get around to writing one as i get more experience with it.  This post will cover more specifically how to create/update SQLite databases on the android platform.

Most examples (in fact ALL the examples I could find ) have you put your DDL statements as string inside a class, typically the class you create to extends the SQLiteOpenHelper.

// Database creation sql statement
	private static final String DATABASE_CREATE = "create table todo (_id integer primary key autoincrement, "
			+ "category text not null, summary text not null, description text not null);";

I’ve found this less than ideal when working with multiple tables, indexes, constraints, etc. I’m used to running through my scripts on a database, running them as a script, so having these “hardcoded” didn’t quite seem right.

After trying a few things out, and some searching for alternatives, I’ve decided to go about this another way. I’ve decided to create some script files (that can easily be tested using sqliteman or any other sqlite db tool. I then save these scripts ( create, alter, etc ) into the assets folder and have my code run them.

public class DBOpenHelper extends SQLiteOpenHelper {

    private final Context context;
    private static final String DATABASE_NAME = "mydb";
    private static final String DATABASE_SCRIPT_CREATE_FILENAME = "create_schema_";
    private static final String DATABASE_SCRIPT_UPDATE_FILENAME = "update_schema_";
    private static final String DATABASE_SCRIPT_INIT_FILENAME = "init_schema_";
    private static final int DATABASE_VERSION = 1;

    public DBOpenHelper( Context context ) {
        super( context, DATABASE_NAME, null, DATABASE_VERSION );
        this.context = context;
    }

    @Override
    public void onCreate( SQLiteDatabase db ) {
        Log.d( "DBOpenHelper", "inside onCreate" );
        String[] items = getSqlItems( DATABASE_SCRIPT_CREATE_FILENAME );
        for ( String item : items ) {
            if ( item.trim().length() != 0 ) {
                Log.d( "DBOpenHelper#execSQL", item );
                db.execSQL( item + ";" );
            }
        }
    }

    @Override
    public void onUpgrade( SQLiteDatabase db, int oldVersion, int newVersion ) {
        String[] items = getSqlItems( DATABASE_SCRIPT_UPDATE_FILENAME + oldVersion + "_" + newVersion + ".sql" );
        for ( String item : items ) {
            if ( item.trim().length() != 0 ) {
                Log.d( "DBOpenHelper#execSQL", item );
                db.execSQL( item + ";" );
            }

        }
    }

    private String[] getSqlItems( String file ) {
        String[] items = null;
        try {
            BufferedReader reader = new BufferedReader( new InputStreamReader( context.getAssets().open( file ,
                    AssetManager.ACCESS_STREAMING ) ) );

            StringBuffer sql = new StringBuffer();
            String line = null;
            while ( ( line = reader.readLine() ) != null ) {
                sql.append( line );
                sql.append( "\n" );
            }
            items = sql.toString().split( ";" );
        } catch ( IOException ioe ) {
            items = new String[] {};
        }
        return items;
    }

Some may say this might be a disclosure risk ( people will see my DB structure ) but since you can access most SQLite db’s from the SD card, the person could grab that and go from there.

The advantage to this, in my opinion is the ability to test your scripts without the code, for upgrade purposes, and you can manage multiple versions easily. i.e. upgrading from version 1, 2,3,4 to 5 can each be managed by their own script.

What is J2EE/JEE?

In the past couple of months my interaction with recruiters, placement agencies, head hunters and just other IT folks has increased as I have been looking for a new job, new contracts, new potential clients.  Having a relatively strong background in Java ( 10 years of having seen everything from distributed services via RMI, low level threading & sockets, web interfaces, JDBC, EJB, Servlet Containers, Application Servers ) I sometimes get frustrated with the question “Do you have any experience with J2EE?”, because it is such a vague question there is no correct or complete answer.  My typical response is along the lines, of “what do you understand by J2EE, or what aspects of J2EE are you looking for, so that can discuss me relevant experience”.

Lets backtrack a couple moments, and define ( well, if we can ) J2EE.  J2EE ( now known as JEE ) stands for Java 2 Entreprise Edition, in contrast to J2SE ( known as JSE ) which means Java 2 Standard Edition.  They are both centered on the Java language specification (syntax),libraries , and Java virtual machine.  For those of you not concerned with Java ( or even those who don’t care ), there are a lot of things named java, and they can be confusing if you aren’t directly involved.  That doesn’t mean that you can ignore the differences if you are involved, it means you have to pay a little more attention.

The best description of what J2EE is, is that it is a collection of Java technologies and best practices.  The most common consensus seems to mention these top 14 frameworks( JDBC, JNDI, EJBs, RMI, JSP, Java servlets, XML, JMS, Java IDL, JTS, JTA, JavaMail, JTA, and JAF ).  The rest involves knowing when and how to tie the right technology, using the appropriate combination of best practices to gain the maximum of the Java Ecosystem.

Once upon a time, J2EE was synonymous with EJB’s.  Since you were either working on “simple” web or desktop projects, or you were doing “entreprisey” stuff ( EJB’s, Application Servers, etc, on big name hardware and platform combinations ).  Typically only larger companies were using the J2EE stuff due to initial cost investment.  At some point some consultant probably managed to convince them that they couldn’t develop their web application without having the full WebSphere/WebLogic/<other J2EE provider> stack.  Once EJB3 came out, things changed somewhat, as EJB3 was lighter, and easier to use as a specification than the previous incarnation.

For the most part the recruiters I’ve dealt with are more than willing to co-operate and get more information to try and find a best fit for a given position, as they are only doing the best they can with the information that was provided to them from clients/partners/IT departments.  My complaint is to those building the job description, why not specify the skills you are looking for instead of being so vague.  You’ll get a more honest, direct and relevant candidates when you are honest and precise with what you are looking for.

Most java projects today want to know if you understand some combination of the following aspects java, the web interaction model, visual display ( jsp, jsf, html/javascript, Swing, something to display the UI ), data persistence, server/data distribution, transactions.  If you take a look around the web, the most popular java frameworks are things such as Spring, Hibernate, Wicket, yet these are not included in the J2EE classification under most people’s definition.  If you want someone with ORM experience mention that, or a particular framework/library that you want.

I hope this information helps people either understand what is being asked, or those writing up job descriptions identify the skills they are looking for.