Monday, September 28, 2015

Classify Work Items for Queue Order

http://www.pluralsight.com/courses/kanban-fundamentals
by Steve Smith
taught me about a simple classification method which uses quadrants composed of urgent and important to identify how work items should be addressed.
quadrant

Thursday, September 17, 2015

Good, Clean Code Helps With Error Resolution

Stack dumps can contain useful information about an exception. They can also be vague and misleading, especially if we have bloated classes and/or methods.


A stack trace can only go so far as to show which methods were called on which classes and in what order. Sometimes there is a line number but if not and we have a lot of lines in a specific method it can take a lot of guessing to find the culprit.


In .NET, for example, private methods are not included in the trace. Protected and up methods are. So, following good practices an improve usefulness of a stack trace.

Away With You Sprints!

Let's face it, building software is more like a marathon or a journey than it is a race. There are checkpoints, people need breaks to refuel (their brains and bodies), and working as fast as possible - all the time - will cause more defects and puts us all in a position to compromise (aka cut corners).


We're sending the wrong message with "Sprint". Let's stop calling an iteration a Sprint, and start calling it something more sensible. If we want to truly convey how we need to build software, I strongly suggest choosing appropriate metaphors in our processes. Sometimes we are on a journey or a tour or a mission.


We have a destination chosen before we leave. What way markers do we need to pass? Will we set certain checkpoints? We make a map. We have a mapmaker and a planning committee. They plan the journey and make the map. One of the committee is familiar with the terrain and can act as a guide. We have a guide. The guide may go forth on the journey or prepare the travelers before they go and guide as needed during the journey.


We have a few roles so far, and there will be more - we don't have as many people as roles, so some people will serve in many roles. They will be prepared to fulfill the duties of each role, lest the journey be a tragic one.


We move forward together as a group in a troop. We have a troop leader. The leader makes decisions that affect the group, but must leave others to learn as they go so that they too can be leaders. The leader must know how to make balanced decisions. The leader must let others lead in their own rights.


Occasionally, we need to send a scout ahead or down some path to the side to see if there is anything of value. We can huddle up and plan our next steps, then continue forward towards our destination or alter our course based on what is learned by the scout. As part of altering the course, we must consider the destination and how we will still arrive in the end.


We update the map as we learn. The navigator updates the map. It is helpful if the navigator is the scout and the mapmaker but not necessary.


We have a journal and a handbook. The journal is used to track daily activities and for lessons learned. The journal is updated daily. The leader updates the journal others may contribute. Each member of the group is encouraged to keep their own journal.


The handbook is a set of guides, principles, and best practices that we consult when confronted by a situation or an obstruction. It is created by or is a compendium of works by those who have experience in navigating many types of terrain. We use it every day, we learn from it, we train with it, every member must have a handbook and know its contents. It describes how to organize, how to plan, what to watch for, how to best deal with most situations. It is the most valuable commodity the troop can own.


The handbook is updated after each journey, or as needed. The handbook has information about how to update it. The handbook may be a subset of a full guide, in this case it would be a field guide. The full guide may be consulted during planning activities and the field guide/handbook during journeys.


The guide books may serve to help define and answer some of the most important questions. What criteria do we use to know if we need to abort the mission early? What hazards might we face? What if we come across an obstruction, can we pull together to clear it or do we need to call in a ranger? If we lose our way, we will need a ranger to help us back on track. Who is the ranger, who are the scouts, who has the map? Who does what? How do we...


There are rangers. There are different types of rangers. There are forest rangers, they are others within the organization who keep the forest healthy and the paths clear so that we may navigate. Occasionally, we may need to call in a special ranger. Special rangers are from outside the organization, they are called in to solve a specific problem that cannot be resolved by a forest ranger.


Training is second to only the guide book. We have training sessions, training missions, should we have badges? Each member must have the appropriate training before taking on a role. Each role must have its training requirements defined. Some journeys may be too hazardous for some members of the pack. The journey should be appropriate for the member.


 We have principles that must be learned, those principles are sensible and important to success, we proudly learn and teach those because they are integral to our way - it is an honor.


We stick together, we help each other, we help others, we uphold our principles,...

Friday, September 11, 2015

How to Load Text into Html from a File

When creating a "static" page with some informational text, it may be helpful to enable admins to replace the text without editing the main html page.


This can be done by using an Ajax request to load a text file or preformatted html file into the innerHTML of an element.


JQuery.ajax can be used to fetch the file then write the contents to the page.



$.ajax({
    url:'textFile.html',
    type:'html',
    success:function(data){
        $('#elementId')[0].innerHTML = '<pre>'+ data + '</pre>';
    }
});


with this approach, the textFile can be marked up with plain html tags and it will work without the need to escape them.


One thing to note about using this approach is that the file should be available via the web server and at a path relative to the host site, this would avoid additional configurations - just let the same web server serve up the textFile.


Basically, in this way you can have a wrapper and put the content into the wrapper however. Sort of a way to do an SPA.


I'd you'd like, set the pre CSS to wrap the lines. As an alternate to appending pre tags, you could style the parent element.


More information about that -
http://www.w3schools.com/cssref/pr_text_white-space.asp

Friday, September 4, 2015

What is Void?

We cannot define void in terms of what it is, only in terms of what it is not. Void is that which is not everything else. If everything else exists, then so must void. Void and everything else are like the Yin and the Yang. Void is not a number, it is not a char, it is not the air or the sun, it is not made up of the stuff that makes everything else, however void exists because know it. Perhaps it only exists in our minds.

Speaking of void and everything else, what is everything else really? Is it that which we see, hear, taste, experience? Or that which we can experience? We see it through a small window as it flashes past. Or perhaps we can think of a computer screen on which everything scrolls by. We cannot control the scrolling, only what we choose to witness. The void is there all along, it is where we do not see.

Friday, August 28, 2015

Battle of the Languages

One great thing about the challenges offered on CodeEval.com is that they can be solved in so many languages - e.g. choose the language of your choice and go at it! As a side benefit, one can easily compare run-times and memory footprints of languages by solving a challenge in many languages and viewing the results. As an experiment I did just that with the following challenge.

Here is the description of the challenge, as it can be seen on the site:



And the basic solution, which I implemented using the same basic algo in five languages (JavaScript, Java, PHP, C#, and C).

The test data is supplied via a file passed to args during execution, the same file is used in every execution run. JavaScript is run on Node. Execution takes place server side on a Linux based server (more details on the CodeEval site).

Basic algo is: for each line, split line on comma, parse each val to an int, run computation, print results to standard output.



Drum roll please....









As expected, C has the smallest mem usage and the fastest run-time, and by far at that. But I didn't expect Java to be that bad. Granted this is a trivial example. It would be interesting to see if the gap closes when the C program needs more supporting code. Educated guess is yes but not by much. The Java code for is below, I wonder if I'm doing anything wrong here or if it really is that less efficient in all ways.


import java.io.*;
public class Main {
    public static void main (String[] args) throws IOException {
        File file = new File(args[0]);
        BufferedReader buffer = new BufferedReader(new FileReader(file));
        String line;
        while ((line = buffer.readLine()) != null) {
            line = line.trim();
            String[] vals = line.split(",");
            int x = Integer.parseInt(vals[0]);
            int n = Integer.parseInt(vals[1]);
            compute(x,n);
        }
    }
    
    static void compute(int x, int n)
    {
        int m = n;
        while(m<x){
            m+=n;
        }
        System.out.print(m+"\n");
    }
}

I plan on doing this same test in Ruby, Python, and GO to do an even broader comparison, when I have some time. Results will follow if I do.

Thursday, August 27, 2015

EF natural keys and duplicated properties

While working with a VS solution that has been around for about 6 years, an issue was brought to my attention regarding duplicate records from a query. The solution uses and old version of Entity Framework and ties the results of an imported stored procedure to a web forms control (data grid, repeater, or similar). The entity type is based on and mapped to the returned data table from the stored procedure.


A more concrete example would be a Teacher entity with three properties [Name, Classroom, School].


The results of the stored procedure represented below:


June Ward, 102, James Woods High School;
Fiedora Vilma, 233, MLK High School;
Fiedora Vilma, 126, MLK High School;


Were showing up in the app as:


June Ward, 102, James Woods High School;
Fiedora Vilma, 233, MLK High School;
Fiedora Vilma, 233, MLK High School;


Notice that 233 is repeated for the last 2 rows.


Upon investigation of the Teacher entity via the model designer, I saw that only the FullName property was designated as the entity key. But it seems as if the natural key in this set would need to be the FullName and ClassroomNumber.


> Highlight FullName, properties, set entity key false.
> Highlight FullName AND Classroom, properties, entity key true.


now the combo key is shown. Rebuild solution, check to see and the classrooms are no longer repeated.


Wonder if this was "fixed" in some later version of either EF or ASP.NET. Anyways, the solution is fixed for now.