Joe Strummer quote

When you blame yourself, you learn from it. If you blame someone else, you don’t learn nothing, cause hey, it’s not your fault, it’s his fault, over there. That is the hardest thing of all. That’s a grown-up. You’ve gotta grow up in this world. This world’s full of kids playing with their bloody Playstations – and I mean grown-up executives. What is that shit? I know thousands of people my age, sitting around with those. What the fuck are you doing? We should be talking about Dostoyevsky, innit?

– Joe Strummer –

Start new private project by forking public repository on #GitHub

Let’s assume you found some very interesting public repository on a GitHub that has nice features fitting perfectly into your ideas for the new software as a service project (SaaS). Let’s also assume that you want to make some additional features that you want to keep private, so you can differentiate your SaaS from the others on the market, but you want to keep possibility to sync with original public repository, so you can have the latest development merged into your code and you can contribute some bug fixes and/or features back to public repository.

Assumptions stated above describe viable business model involving open source software as a basis, but I am not going into direction of discussing business case in this post, I want to describe how to do this technically if you are developer using GitHub as a code repository hosting service.

Here is the step by step workflow described:

Create a new repo (let’s call it private-repo) via the Github UI. Then duplicate public repo into your private-repo:


git clone --bare https://github.com/exampleuser/public-repo.git
cd public-repo.git
git push --mirror https://github.com/yourname/private-repo.git
cd ..
rm -rf public-repo.git

Clone the private repo so you can work on it:


git clone https://github.com/yourname/private-repo.git
cd private-repo
make some changes
git commit
git push origin master

To pull new hotness from the public repo:


cd private-repo
git remote add public https://github.com/exampleuser/public-repo.git
git pull public master # Creates a merge commit
git push origin master

Your private repo now has the latest code from the public repo plus your changes.


Finally, to create a pull request private repo -> public repo:

The only way to create a pull request is to have push access to the public repo. This is because you need to push to a branch there (here’s why).


git clone https://github.com/exampleuser/public-repo.git
cd public-repo
git remote add private_repo_yourname https://github.com/yourname/private-repo.git
git checkout -b pull_request_yourname
git pull private_repo_yourname master
git push origin pull_request_yourname

Now simply create a pull request via the Github UI for public-repo, as described here. Once project owners reviewed your pull request, they can merge it. Of course the whole process can be repeated (just leave out the steps where you add remotes).

NOTE: This post is based on Stackowerflow answer that could be seen here.

Work from home – what is important?

I love working from home. Since beginning of my software developer career when I was working as a freelancer I fell in love with this kind of work. I am the most creative and concentrated when I can make my own office set-up with light, music, snacks, coffee, turned off phones etc..

In order to have this kind of work possible, some prerequisites have to be met.

Company management

The most important thing in proper home office work setup is that company managers are open for this kind of work. Without this, it is almost impossible to make it work.

Goals oriented approach to work

Next prerequisite is expectations management. Unfortunately, there are still a lot of companies in IT industry practicing employee management inherited from old manufacturing industry, where all people are required to be at work from 9 to 5 and the only measure of quality is how many extra hours some employee made. Those that work Saturdays and Sundays are the best.

Fortunately, there are companies with modern approach. In those companies, employees still work hard and work in average 8 hours a day, but everything else is completely different. The most important measure of work quality in this kind of companies is if goals are met. Work tasks are assigned in small (weekly or bi-weekly) bursts and progress could be followed on a daily basis. All that matters is if work is done, and we all know that finished projects are paying our salaries.

Tools, tools, tools

In order to make our way of work possible and more fluent, we have to use different software tools and to experiment with new tools to try to improve things we already have in place. Some of the tools that I used and liked a lot are:

Slack – team communication tool that keeps us always up to date with everything that is going on. This is great replacement for emails that could be really annoying when it comes to the point that more people trying to communicate by CC-ing everyone about everything. We can have rooms for projects, private and misc things. Whatever is going on in company at the moment you can find it on Slack wherever you are. This is very important tool for home office.

JIRA – project management tool where all tasks are organized, assigned to employees, scheduled, and tracked during their entire lifetime. In every moment you can tell what some employee is working at the moment by just going into JIRA and looking into appropriate project. Also, you can see what are the project goals for the current weeks and how things are going. This saves a lot of time and prevents unnecessary meetings that tend to eat too many hours just for obtaining information about who is working what right now.

Bitbucket – in a typical software company code changes tool is absolutely necessary. Bitbucket is software as a Service Git repository for tracking all source code changes. This is also important for quality control, because you can see how some developer resolves problems, does he tries to take extra mile and finish his task in an elegant way, or he is just trying to get rid of it.

Confluence – This is knowledge base where all project documentation is written and regularly updated. In an agile team there is a lot of work going on and a lot of different programming languages, frameworks and tools are used, so knowledge base is very important to keep track of everything. This is also very important enabler of home office, because you don’t need to call coworker lately in the evening just to ask him something that is normally kept in knowledge base.

Employeetics – Time tracker that measures how much time we are spending on tasks and helps us improve everyday planning by analysing previous activities.

This was list of the most important tools, and I want to say that you can always find several alternatives for each of them. This is my set that works at the moment, but maybe in a few months I change some of them if I find something that works better. No matter what tools are used, important conclusion is that tools are important to keep communication in the team smooth and to justify goals oriented approach in a company.

Sencha app build failed: Mixed-Mode x-compile and microload markup is currently unsupported

If you use Sencha Command tool to build ExtJs application like this:

sencha app build

and experience something similar to the following error

[ERR] 
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.ExBuild: Mixed-Mode x-compile and microload markup is currently unsupported
[ERR]

here is the solution for your problem. The problem is that there are two parallel places where you defined references to js, css and/or theme files. Open up index.html and app.json files from the root of your project and check if there are references to js, css in both files.

Solution is to simply remove all file references and theme definitions from app.json file and take care that all of them are defined in index.html file. After this, you can run build command again without errors.

Sorting an array of Objects in JavaScript

If you have an array in JavaScript that doesn’t contain just simple numeric or string values, but objects with properties instead:

var employees=[];
employees[0] = {name:"Petar", age:32};
employees[1] = {name:"Nikola", age:17};
employees[2] = {name:"Milutin", age:58};
employees[3] = {name:"Slavisa", age:62};

The employees array above is an array of objects with properties of different data types, string and numeric. The sort() method can be used to sort the array based on the values of one of these properties, such as sorting the array by name or age. The basic idea is to modify the compare function so it compares the desired properties’ values. Lets see how this works now.

Sort by employee age

Lets sort the employees array by their ages (ascending). Here’s the comparison function that does this:

employees.sort(function(a, b){
    return a.age-b.age;
});

With the above sort method, the employees array is now sorted by the age property, so employee[0] is “Nikola”, employee[1] is “Petar” etc. The process is very similar to sorting an array with numeric values (ascending), except instead of subtracting b from a, we need to subtract b.age from a.age instead, or the array element’s property we wish to base the sorting on.

Hosting #Meteor app with #Modulus

Currently I am trying/learning development with Meteor framework. My first impressions are great! Some things were never that easy as they are with Meteor, it’s super fast, made with simplicity as core philosophy… I will write about Meteor in a separate post, when I learn enough of it and try it with some real world projects.

At this point of time I want to bookmark here platform that enables hosting of Meteor apps – Modulus.io. Modulus is a PaaS (Platform as a Service) for hosting Node.js based apps with full support for Meteor apps. This post is slightly modified tutorial from Modulus’ help section.

Modulus provides direct deployment of Meteor applications through the use of the Modulus Modulus command line interface. This guide will demonstrate how to properly deploy your Meteor application to the Modulus platform.

1. Create a Project

The first step is to create an empty project. This can be done through the web interface or the Modulus command line.

Command Line

$ modulus project create
[?] Enter a project name: My Meteor Project

Web Interface

2. Create a Database​

Meteor applications require a MongoDB database. Databases can be created through the web interface.

The Databases tab on the User Dashboard allows you to create and view MongoDB databases.

After clicking create, enter a database label and the default user credentials.

Once the database has been created it will display the connection information. This information can be accessed at any time on the database dashboard’s administration tab.

3. Deploy Your Meteor Application

Deploy the Meteor application using the Modulus command line.

$ cd /path/to/app
$ modulus deploy

The Meteor app is not quite ready yet and the logs will show errors. We have to deploy first in order to receive a URL for Meteor’s required environment variables.

4. Setup Your Environment Variables

Using the Modulus CLI or web interface enter the MONGO_URL and ROOT_URL environment variables.

Set the MONGO_URL environment variable to the connection string provided when the DB was created. Replace the user:pass with the correct user credentials.

$ modulus env set MONGO_URL \
  "mongodb://user:pass@proximus.modulusmongo.net:27017/8Y4fgyd \
  ?autoReconnect=true&connectTimeoutMS=60000"

Set the ROOT_URL environment variable to your project’s URL. This is displayed at the top of your project dashboard and in the CLI at the end of the deploy.

$ modulus env set ROOT_URL http://my-meteor-project-9339.onmodulus.net

These can also be set on the project dashboard’s administration tab if desired.

​Restart the project to pick up the new environment variables.

$ modulus project restart

Your Meteor project is now running. Visit the *.onmodulus.net URL to confirm. At this point you can follow the custom domain and SSL guides to complete your production ready Meteor application.

Deploying New Code

Now that the environment variables are configured correctly, new versions of the application can be deployed at any time by simply re-running the deploy command.

$ modulus deploy

Proper date comparison in #JavaScript

If you want to check if some variable contains valid date in JavaScript, this is the way that works properly in all cases:

isValidDate: function(d) {
    if ( Object.prototype.toString.call(d) === "[object Date]" ) {
        // it is a date, but still it could be 'Invalid date' which could make trouble
        if ( isNaN( d.getTime() ) ) {
            // date is not valid
            return false;
        } else {
            // date is valid
            return true;
        }
    } else {
        // not a date
        return false;
    }
}

Ranking programmers in a team

Over the course of years of working on the most diverse web development projects in the role of a project manager, I was always facing up to the issue of additionally motivating the good programmers, eliminating the weak ones and waking up the potentially good, but lazy people. Everybody is a story in themselves and what motivates one – inhibits another; what interests one – is boring to another, what makes one happy – makes another angry… I was always thinking how to find a balance among all these differences and to make a system that would provide an objective picture of the state in a team and that would motivate everybody to give more effort than they used to. I turned to a very simple and always objective mathematics for help and the results were great.

I came up with a very simple idea that can be applied in any area of activities, and I will now present how I applied it to the team engaged in software development. The most important thing is to establish the main indicators of successful progress on a project. Parameters should be found that will provide a clear picture of how fast and to what quality extent we move within the framework of the project. On the basis of that, we may place objectives and measure whether we achieve them and to what extent each individual team member contributed to the realisation or non-achievement of the objectives.

It is important to mention that I have been using some parts of agile methodologies in project management, especially the Extreme Programming (XP) approach, for years now. What is most interesting in those methods is that all work that is to be done is presented through a group of very short stories that are recorded using as few words as possible. Afterwards, each story is evaluated and awarded the points needed for its ending. One point represents time, which is equal to an ideal programmer day – that is 8 hours of programming by one man without any external disturbance or problems that might occur. These evaluations are used with extreme programming in planning iterations, i.e. planning one week’s work. This planning is done simply by taking the most important stories that should be implemented and only the number that may be finished during one iteration. The iterations usually last one week, but they may be longer or shorter, which depends on the individual decision of a team leader.

This brief introduction into Extreme Programming (XP) is necessary to facilitate my presentation of the ranking system that I introduced and this approach would not be possible without the direct help of the XP methodology.
As each short story that describes a part of the software that is worked on, also simultaneously represents the programmer’s task, and as each story has the time evaluation during which it can be performed – the number of points that are awarded to it, everything is ready to introduce a system of ranking and motivating the programmer.

For each completed task, the programmer is awarded points that equal the value of the task. Over the course of a month, everyone has an insight into the ranking list and the daily changes. In that way, a competitive atmosphere is created that incites everyone to do more. However, it is not sufficient to look at the number of points alone in order to determine the quality of work of each programmer. Testing of the completed code is very important in programming.

I often met programmers who did not really like to test their code and to advance it; therefore I introduced the practice of having one person in the team whose duty was to test each completed task. During the testing, the number of errors found in the story that should have been implemented is recorded. Each error found brings a certain percentage of negative points. The number of realised points affects the ranking list and this is how we measure the working speed, as well as the number of the errors made that are used to measure the work quality. These two parameters together form the final ranking list.

Now, we arrive at the subject of motivation. If we want to additionally motivate the participants in this small contest, we introduce pecuniary bonuses for the places won on the ranking list. There may be various approaches, but I apply the following most frequently. At the beginning of the month, the budget for the bonuses is allocated and it is announced that the top n programmers (n depends on the number of people in the team) will share the bonus among themselves. All of them will get a part of the total bonus amount, which is reached by a simple mathematical division, whereby the number of the awarded points realised by each person is taken into consideration, the total number of realised points together, and the individual share in this total points number. With this approach, we motivate people to fight for the maximum number of points until the last day in the month, because the further ahead they get with the number of points won from their runner-ups, the more money they win.

At the beginning of each month, the whole race starts from nil, so everyone has the opportunity to prove themselves each month. At the end of the year or at the end of the project, a deeper analysis can be made to see everyone’s performance over a longer period of time, and annual bonuses may be introduced that would take into account all the months in the year.

In this manner, the competitive spirit remains in the team; it is easy to follow up who did what quantity of work in a month as well as the quality of that work.

Apart from the aforementioned, it is highly important to permanently incite internal cooperation between the staff in the team, good interpersonal relationships and a cosy atmosphere, as that is the absolute pre-condition for their personal satisfaction. A satisfied man produces much better results.

During my work with one of my former teams in the AlefBrain company, following the introduction of this evaluation system and ranking the programmers, I felt totally free to experimentally cancel the mandatory working hours. Everyone could come to work whenever they wanted or whenever was convenient. I had no need to monitor their arrival at work as the focus had transferred to the work results. If a programmer has good results, as the team leader I am not remotely interested in whether he accomplishes the results working at home, while travelling, sitting in a café or a park. That was one of the most interesting experiences that I had as everything functioned better than when we had regular working hours.

Therefore, do not hesitate, establish a system to measure the results and set people free! On making that move, you will be surprised to see that you get multiple results in return in the better quality software that you will be getting.