Hidden Overhead – how small things really add up

If you have ever spent some time in the corporate world you may have heard of the word ‘overhead’, and it is generally used to refer to the costs associated with the ‘headquarters’ staff in a large organization. See, you may be the worker on the front lines at the clients’ site, but your hourly rate goes towards your pay, the overhead, and profits for the company. Obviously, the greater the overhead expense the less flexible the company can be in setting rates and still making a decent profit. Now let’s take the concept of overhead to the network world, the two main transport protocols in use in the web are UDP and TCP/IP, one of them comes with more overhead as far as packet size is concerned. So what, why does this matter, it’s just a small bit of data right?

Consider this: What’s a stamp worth? 

Let’s illustrate the fact that small inefficiencies can lead to a large cost to an organization given the frequency of the inefficient action.  Imagine you are in charge of the post office and you need to identify cost savings.

Using the facts below you devise a plan that eliminates an inefficiency that exists with stamps.

  • 1 Pound – 453.592 grams
  • Mail pieces processed in 2010 – 171,000,000,000 [1]
  • Assume every piece of mail (packet) requires one stamp
  • Stamps are printed on paper that weighs 56 g/m(sq) [2]
  • Current stamps have the following dimensions 22.10 x 24.89 mm [3]
  • Assume that we are using first class letters which cost $0.45 cent for the first ounce and $0.20 for each additional ounce. The post office works like airport parking garage, they charge for the full ounce (even if you’re over by .20 grams!).

Now we all know that weight affects postage prices[4], I mean why else would we have those cool airmail envelopes and sheets of paper with the little striped edges, right.

First let’s translate the paper weight so that we have the grams per square millimeter, since we are dealing with the metric system we know that 1m² = 1,000,000 mm², next we divide the weight by the square millimeters to get a weight per millimeter. 453.592 / 1000000 = 0.000453592 grams / sq mm.

The postage stamp is 22.10 x 24.89mm so the area is 550.069 sq mm. The weight per postage stamp is 0.249506897848 grams.

Now we can calculate the straight cost of the stamp in weight added to the letter, we know that 0.249506897848 =  0.0088010968208481997 ounces and that it costs $0.20 cents per ounce, so it costs $0.00044005484 cent to mail the stamp on your letter. Barely noticeable, right? Now let’s multiply that by 171 billion ( 171,000,000,000 ), which is the yearly mail volume; the result, we would be paying $75,249,377.64 just to cover the weight of the stamps on the envelopes. If it was this simple we could use triangular stamps and save 37million dollars!

That’s great but we know that the post office rounds up to the nearest ounce and slaps a $0.20 cent charge on those that go over. Lets test the assumption on varying percentages of letters that could theoretically be put over the ounce limit by the weight of a stamp.

1% of letters are over = 1,710,000,000 * .20 = $342,000,000

This brings me to the last point: quantifiable things matter. You may disagree and many do, however, when you start presenting solutions to problems in the work world there is only one measure that really matters and it comes down to quantifiable outcomes.

To ensure your idea makes it you have to translate these outcomes into dollars, especially when dealing with network speeds, and security issues. Why? For far too long the IT department has sat back and used the ‘security’ argument, which seems to work without any thought to cost (be it in time or money, and more often both) . Your challenge is to sit down and translate your IT related issues into dollars and cents, and come up with quantifiable savings. Remember you can save money by saving time, which is what automation strives to accomplish.

Sources

[1] http://pe.usps.com/businessmail101/rates/weight.htm

[2] http://www.google.com/patents/US5503436?dq=us+post+office+adhesive+stamps&hl=en&sa=X&ei=_AliUKy-GZKo9gSRrYHgCA&ved=0CDoQ6AEwAw

[3] http://about.usps.com/postal-bulletin/2012/pb22330/html/info_006.htm

[4] http://pe.usps.com/businessmail101/rates/weight.htm

Handling user input at the source, an example using DUNS numbers and mod 10 check digits with extjs

Right now you must be thinking “what and the hell is a duns number?” or “I can’t believe my luck, I was looking for an easy way to verify duns numbers on the client side in my app!”. If you are in the first camp, then let me elaborate. The D-U-N-S number is a unique identifier used for keeping track of businesses, and a business is actually required to have one if they are to do work for the US Government, Australian Government, the United Nations, or the European Commission, so yes, you could say that it widely used. What’s really cool for UI developers about the D-U-N-S number is the fact that it is set up with a check digit and you can perform some calculations on the data entered in your apps D-U-N-S field to make sure that the entry is valid. I am sure I don’t have to tell you that eliminating bad data entry is critical to ensuring data integrity, and as with most things in life, it is often easier to take care of issues at the source of the problem before they grow, rather than spend time later trying to clean up the mess.

To set this check up in Extjs we will need to create a custom vType (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.VTypes ).

The code is below.


var dunsNbr     = /\d{2}-?\d{3}-?\d{4}/i;
   
// vtype for Duns Number including MOD 10 Check
    Ext.apply(Ext.form.field.VTypes, {
        //  vtype validation function
        duns: function(val, field) {
            if(dunsNbr.test(val) == true){
                return mod10CheckDigit(val);
            } else {
                return false;
            }
        },
        // vtype Text property: The error text 
        // to display when the validation 
        // function returns false
        
        dunsText: 'The D-U-N-S® number is always' +
            ' presented in a distinct format:' +
            ' two digits, hyphen, three digits,' +
            'hyphen, four digits. ' +
            'For example: 04-997-7473.',
        // vtype Mask property: The keystroke filter mask
        dunsMask: /[\d\-]/i
    }); 

In the code above note that duns is the vtype, and the dunsText will be displayed in a qTip when the user enters the wrong input. The dunsMask is used to filter out keystrokes that do not match the pattern provided. It is important to realize that the mask is not a regex value that matches the specific string that you would like to see in your duns field, but is actually regex that lists the allowed characters in the field. This is a key point!

Now, take a look at the line of code:

if(dunsNbr.test(val) == true){ …}

. This is the code that performs the regex check on the value that has been entered. dunsNbr is declared at the top of our vType. You can find more information about Ext’s regex features here (http://docs.sencha.com/ext-js/4-1/#!/api/RegExp), but the points to remember are 1) you have to add a / before the regex statement and a /i at the end of the statement and 2) never try to plug your regex into the ‘Mask’ property.

I find that it’s easier to test my regex code on a website like: http://www.zytrax.com/tech/web/regex.htm#experiment before I put it in my javascript.

Now suppose you get through the check above, you will notice that the very next line reads:

                return mod10CheckDigit(val);

In order to check the D-U-N-S number you would take the first 8 digits in the number. Next loop through the numbers and multiply the even numbers by 2. Now the numbers greater than 10 are separated and you write out the ones and tens place and add all of the numbers together.

D-U-N-S with check digit in the 9th place = 0 4 9 9 7 7 4 73

0 4 9 9 7 7 4 7
x1 x2 x1 x2 x1 x2 x1 x2
0+8+9+1+8+7+1+4+4+1+4 = 47

In this example above , the total is 47. Subtract this total, 47 from the next highest multiple of 10, (that is 50 in this case).

50 – 47 = 3

3 = check digit

The code below uses Modulus 10 + 5, meaning if the original check digit calculation is greater than a 4, then add 5 and then subtract 10 to determine the check digit.

That’s it! So with this quick tutorial you have seen how to apply a function and some serious calculations to an Extjs vType, how you can use regex, and what Mask is all about, and how you can ensure that data gets checked at the client side before hitting your database.

The function you need is below:

 function mod10CheckDigit(value) {
        //Strip all characters except numbers
        var v   = value.replace(/[^0-9]+/g,''),
            cd  = v.substr(8,1),
            v   = v.substr(0, 8),
            total = 0,
            temp,
            tens,
            ones,
            modDigit;

        //Get Odd Numbers
        for (i=0; i <= v.length-1; i=i+2) {
            total = total + parseInt(v.substr(i,1));
        }

        //Get Even Numbers
        for (i=1; i<=v.length; i=i+2) {
            temp = parseInt(v.substr(i,1)) * 2;
            if (temp > 9) {
                tens = Math.floor(temp/10);
                ones = temp - (tens*10);
                temp = tens + ones;
            }
            total = total + temp;
        }

        //Determine the checksum
        modDigit = (10 - total % 10) % 10;

        // Now if the original check digit calculation is greater than a 4, then add
        // 5 and then subtract 10 to determine the check digit

        if (modDigit > 4){
            modDigit = ((parseInt(modDigit) + 5) - 10);
        } 

        // Duns Number Expansion OR original MOD 10 check
        if ( modDigit == cd){
            return true;
        } else {
          //  alert(modDigit + ' - ' + cd);
            Ext.Msg.alert('Invalid D-U-N-S® Number', 'The D-U-N-S® number you entered was in the correct format, however, did not pass the D-U-N-S® validation test. Please correct your input. ')
            return false;
        }
    }

Some advice on IT management from a marketing pro

I noticed that Seth Godin posted a piece on the tendency to take star programmers and transform them into mediocre managers, it’s a mistake that cuts you twice, once with the loss of the key performer, and twice with the fact that you now have a management problem to deal with that may impede more key performers from joining the team. I asked and received permission to post the piece here in its entirety. The original can be found at this link, and a lot of other stuff on management and marketing that may be of intrest.

The extraordinary software development manager

Being good at programming is insufficient qualification for becoming a world class software project manager/leader. Too often, we take our best coders and turn them into incompetent managers because it seems like a logical next step, and because we don’t pay adequate attention to what we really want from these critical executives. (Hint, this is about many fields, not merely software).

1. Clients want useful visibility into the future in terms of costs, timing and deliverables

in fact, it’s almost impossible to be too clear, to benchmark enough and most of all, to overdo the work of identifying forks in the road when it comes to decision making. When a client hires a developer or a company embarks on a software project, they are lost. Even something as complex as building a house is dwarfed by the rapid change, shifting priorities and most of all, the requirement for the new, that’s involved in even a simple software project.

The indispensable software development manager is aware of this and lays it all out for us.

2. Code is going to be used, reviewed, updated and inspected by people other than the person writing it

At some point in the next [insert time frame], a dozen people we have never met will either be updating or using this code, whether they are people we hire or people we partner with. It’s tempting to question the value of an organized architecture and clear code commenting, but again, it’s almost impossible for an organization to overdo this. We don’t have time to do it over so we have to spend the time to do it right. In software programming only the amateur’s approach rewards speed over long-term usability.

3. A great programmer is worth thirty times as much as a good one.

Which means that hiring a good programmer in a competitive field is a killer error. It also means that managing a programmer in a way that accepts ‘good’ will lead to a fail as well.

4. Programming at scale is more like building a skyscraper than putting together a dinner party

Architecture in the acquisition of infrastructure and tools is one of the highest leverage pieces of work a tech company can do. Smart architecture decisions will save  hundreds of thousands of dollars and earn millions. We’ll only make those decisions if we can clearly understand our options.

Or, you can have some newbies hack something together real quick. Up to you.

What’s up with SOPA

With all of the controversy in the past few weeks, and backpedaling from congress about SOPA I thought it might be interesting to take a look at some resources that outline just what this bill was, who supported the bill, and where the money came from, because if you know one thing about DC it’s that they can stop a bill today redress it attach it to something else maybe change the name and slide it through before you know what’s happening.

First, here’s the bill H.R. 3261 known as SOPA, and here’s the bill known as PIPA S.968.IS.

Here’s the money trail: http://www.opencongress.org/bill/112-h3261/money.

Facebooks IPO documents reveal the real reason why traditional media companies will fail in the future.

Facebook’s pending IPO is bound to be the biggest financial news short of an improvement in the economy in the coming weeks, and in moving toward the IPO the company has filed registration statements with the SEC. In addition to the usual statements of profitability the companies CEO and founder Zuckerberg released what he calls the “the hacker way” on page 69.

This should serve as a warning for those media empires that have grown complacent, and the managers that are enamored with an earlier time that seemed to move at a slower pace (with fewer social connections that seemed to elevate their importance). A company that places the following in their core values,

“Move fast and break things.” The idea is that if you never break anything, you’re probably not moving fast enough.

is probably going to be in front of it’s competition before they know what has happened. If they stick to these rules they will also likely solve most of the bugs before the group of core complainers starts to chip away at their product, see you can be faster than those that fail to move for fear of failure, or worry about what others have to say.

More importantly, if there is going to be a fight for programming talent in the future where would you want to work, somewhere that takes chances and wants to change the world, or will you remain an old school corporate stalwart?

Let me reprint page 69 – 70 below:


The Hacker Way (Facebook’s IPO registration Page 69)

As part of building a strong company, we work hard at making Facebook the best place for great people to have a big impact on the world and learn from other great people. We have cultivated a unique culture and management approach that we call the Hacker Way.

The word “hacker” has an unfairly negative connotation from being portrayed in the media as people who break into computers. In reality, hacking just means building something quickly or testing the boundaries of what can be done. Like most things, it can be used for good or bad, but the vast majority of hackers I’ve met tend to be idealistic people who want to have a positive impact on the world.

The Hacker Way is an approach to building that involves continuous improvement and iteration. Hackers believe that something can always be better, and that nothing is ever complete. They just have to go fix it — often in the face of people who say it’s impossible or are content with the status quo.

Hackers try to build the best services over the long term by quickly releasing and learning from smaller iterations rather than trying to get everything right all at once. To support this, we have built a testing framework that at any given time can try out thousands of versions of Facebook. We have the words “Done is better than perfect” painted on our walls to remind ourselves to always keep shipping.

Hacking is also an inherently hands-on and active discipline. Instead of debating for days whether a new idea is possible or what the best way to build something is, hackers would rather just prototype something and see what works. There’s a hacker mantra that you’ll hear a lot around Facebook offices: “Code wins arguments.”

Hacker culture is also extremely open and meritocratic. Hackers believe that the best idea and implementation should always win — not the person who is best at lobbying for an idea or the person who manages the most people.

To encourage this approach, every few months we have a hackathon, where everyone builds prototypes for new ideas they have. At the end, the whole team gets together and looks at everything that has been built. Many of our most successful products came out of hackathons, including Timeline, chat, video, our mobile development framework and some of our most important infrastructure like the HipHop compiler.

To make sure all our engineers share this approach, we require all new engineers — even managers whose primary job will not be to write code — to go through a program called Bootcamp where they learn our codebase, our tools and our approach. There are a lot of folks in the industry who manage engineers and don’t want to code themselves, but the type of hands-on people we’re looking for are willing and able to go through Bootcamp.

The examples above all relate to engineering, but we have distilled these principles into five core values for how we run Facebook:

Focus on Impact

If we want to have the biggest impact, the best way to do this is to make sure we always focus on solving the most important problems. It sounds simple, but we think most companies do this poorly and waste a lot of time. We expect everyone at Facebook to be good at finding the biggest problems to work on.

Move Fast

Moving fast enables us to build more things and learn faster. However, as most companies grow, they slow down too much because they’re more afraid of making mistakes than they are of losing opportunities by moving too slowly. We have a saying: “Move fast and break things.” The idea is that if you never break anything, you’re probably not moving fast enough.

Be Bold

Building great things means taking risks. This can be scary and prevents most companies from doing the bold things they should. However, in a world that’s changing so quickly, you’re guaranteed to fail if you don’t take any risks. We have another saying: “The riskiest thing is to take no risks.” We encourage everyone to make bold decisions, even if that means being wrong some of the time.

Be Open

We believe that a more open world is a better world because people with more information can make better decisions and have a greater impact. That goes for running our company as well. We work hard to make sure everyone at Facebook has access to as much information as possible about every part of the company so they can make the best decisions and have the greatest impact.

Build Social Value

Once again, Facebook exists to make the world more open and connected, and not just to build a company. We expect everyone at Facebook to focus every day on how to build real value for the world in everything they do.