Archive for December 2012

Removing all xml or html tags using Notepad++

Let’s say you have an xml or an html document and you want to remove the tags.

<h2>Shopping List</h2>
<ol>
	<li>Milk</li>
	<li>eggs</li>
	<li>butter</li>
	<li>cereal</li>
	<li>bananas</li>
	<li>apples</li>
	<li>orange juice</li>
	<li>yogurt</li>
	<li>bread</li>
	<li>cheese</li>
</ol>

This can be done rather quickly in a tool like notepad++ using the find and replace with regular expressions feature.

  1. Go to Find and Replace.
  2. Enter this regular expression: <[^>]+>
  3. Select regular expression.
  4. Make sure the cursor is at the start of the document.
  5. Click replace all.

That is it.

The Joel Test updated for 2013

Many of you have heard of The Joel Test. Joel Spolsky wrote it in 2000 and yet is still eye-opening to many development environments. Here is the Joel test if you haven’t read about it.

The Joel Test (written by Joel Spolsky in 2000)

  1. Do you use source control?
  2. Can you make a build in one step?
  3. Do you make daily builds?
  4. Do you have a bug database?
  5. Do you fix bugs before writing new code?
  6. Do you have an up-to-date schedule?
  7. Do you have a spec?
  8. Do programmers have quiet working conditions?
  9. Do you use the best tools money can buy?
  10. Do you have testers?
  11. Do new candidates write code during their interview?
  12. Do you do hallway usability testing?

This test is a good measuring stick. However, it has been a dozen years since Joel wrote this. Are updates needed? I think so. It is missing some important yet still simple yes/no questions. So here is my updated version. New stuff is in blue.

The Joel Test (Updated for 2013 by me)

Source Control

  1. Do you use distributed source control?
  2. Do you have a gated check-in?
  3. Do you have a branching strategy?

Build and Install

  1. After checking out source, can a developer build and debug with one click.
  2. Can you make a build and an installer in one step?
  3. Do you make daily builds and installers?
  4. Can a developer add to the build easily?
Coding Practices and Coding Architecture/Design
  1. Do you have coding best practices?
  2. Is your code considered decoupled?
  3. Do you analyse and design before you code?
Bugs and Enhancement Tracking
  1. Do you have an integrated bug database?
  2. Can customers/users see status of existing bugs, submit new bugs and enhancement ideas, and vote on them?
  3. Do you fix bugs before writing new code?
Testing
  1. Do you write a Unit Test exposing the bug before fixing the bug?
  2. Do you write Unit Tests and publish code coverage/complexity results buildly?
  3. Do you have automated tests and testers writing them?
  4. Do you do hallway usability testing?
Road Map/Development
  1. Do you have an up-to-date schedule?
  2. Do you have a spec?
  3. Are you practicing a successful software development methodology?
Developers
  1. Do you have a continuous education program for developers?
  2. Do developers interact with customers once a year?
  3. Do new candidates write code during their interview?
  4. Do you have a training program for newly hired developers?
Tools and Workplace
  1. Do programmers have quiet working conditions?
  2. Do you use the best software money can buy?
  3. Do you have the best hardware money can buy?
  4. Do you have a simple process for developers to request software or hardware?
User Experience
  1. Do you have a team dedicated to enhancing the user experience?
  2. Do you send a prototype to customers/users before you start coding?

So I think that the above changes are quite easy to use still. They are simple yes/no questions. The look is quite different, yet it seems much more clear as to why the questions are being asked. Even though there are a lot more questions (more than double), it is still easy and short.

So here is a list (probably not comprehensive) of the changes I made.

  1. I grouped the questions into categories so the failure areas become clear.
  2. I enhanced some questions taking into account some software development movements over the past dozen years.
  3. I added some questions, again taking into account some movements over the past dozen years.
  4. I added a questions that focus on the customer/user.
  5. Also, Joel has a lot of paragraphs explaining his questions and some of what he explains could be added to the question in one word, for example, I added “installer” to the build questions.

Well I suppose some people will hate the updates and some will love them.

If you want to add or alter some of these questions, feel free to comment.

Sorting by Reversals in C#

I am getting a masters and I was studying this and wanted to implement it to understand it fully. Efficiency could be improved for sure but the goal of this is not efficiency, just to implement the algorithm so when I question comes up on the final, I can answer it.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Reversals
{
    class Program
    {
        static void Main(string[] args)
        {
            // SolveByReversals1
            int[] array1 = new int[] { 0, 1, 2, 3, 7, 6, 5, 4, 9, 8, 10 };
            Console.WriteLine("Before: " + string.Join(", ", array1));
            SolveByReversals1(array1);
            Console.WriteLine(" After: " + string.Join(", ", array1));

            Console.WriteLine();

            // SolveByReversals2
            int[] array2 = new int[] { 0, 1, 2, 3, 7, 6, 5, 4, 9, 8, 10 };
            Console.WriteLine("Before: " + string.Join(", ", array2));
            SolveByReversals1(array2);
            Console.WriteLine(" After: " + string.Join(", ", array2));

            int[] array3 = new int[] { 0, 10, 20, 30, 70, 60, 50, 40, 90, 80, 100 };
            Console.WriteLine("Before: " + string.Join(", ", array3));
            SolveByReversals2(array3);
            Console.WriteLine(" After: " + string.Join(", ", array3));

            Console.WriteLine();

            // SolveByReversals3
            int[] array4 = new int[] { 0, 1, 2, 3, 7, 6, 5, 4, 9, 8, 10 };
            Console.WriteLine("Before: " + string.Join(", ", array4));
            SolveByReversals3(array4);
            Console.WriteLine(" After: " + string.Join(", ", array4));

            int[] array5 = new int[] { 0, 10, 20, 30, 70, 60, 50, 40, 90, 80, 100 };
            Console.WriteLine("Before: " + string.Join(", ", array5));
            SolveByReversals3(array5);
            Console.WriteLine(" After: " + string.Join(", ", array5));

            int[] array6 = new int[] { 0, 0, 1, 4, 3, 3, 1, 2, 2, 4 };
            Console.WriteLine("Before: " + string.Join(", ", array6));
            SolveByReversals3(array6);
            Console.WriteLine(" After: " + string.Join(", ", array6));
        }

        /// <summary>
        /// Works only for perfect sequences starting at zero 
        /// and incrementing by one {0,1,2,3,...,10,...}
        /// </summary>
        /// <param name="array"></param>
        /// <returns></returns>
        public static int[] SolveByReversals1(int[] array)
        {
            for (int i = 0; i < array.Length; i++)
            {
                int j = Array.IndexOf<int>(array, i);
                Array.Reverse(array, i, j - i + 1);
            }
            return null;
        }

        /// <summary>
        /// Works with sequences of unique integers.
        /// </summary>
        /// <param name="array"></param>
        /// <returns></returns>
        public static int[] SolveByReversals2(int[] array)
        {
            int pos = 0;
            for (int i = 0; i < array.Max() - 1; i++)
            {
                int j = Array.IndexOf<int>(array, i, pos);
                if (j == -1)
                    continue;
                Array.Reverse(array, pos, j - pos + 1);
                pos++;
            }
            return null;
        }

        /// <summary>
        /// Works for numbers of any sequence.
        /// </summary>
        /// <param name="array"></param>
        /// <returns></returns>
        public static int[] SolveByReversals3(int[] array)
        {
            int pos = 0;
            int highLoop = array.Max();
            if (array.Length > highLoop)
                highLoop = array.Length;
            for (int i = 0; i < array.Max() - 1; i++)
            {
                int j = 0;
                while ((j = Array.IndexOf<int>(array, i, pos)) != -1)
                {
                    Array.Reverse(array, pos, j - pos + 1);
                    pos++;
                }
            }
            return null;
        }
    }
}

So it was nice to implement this to understand some of the difficulties and solve this issue. I may never have arrived at the third method just from class discussion.

Say YES to Education but say NO to large debt (part1)

Recently, I have seen articles discussing the idea of “saying no to college”.

Education is extremely important! Notice, I didn’t say college was extremely important I said education. UnSchool is not exactly off base. They are saying to get educated, but they are saying to do it without college. However, college degrees are the standard today for proof of education, and that should not be overlooked.

Some of the arguments for UnCollege and not valid. For example, here is one of the quotes:

“You wasted $150,000 on an education you coulda got for a buck fifty in late charges at the public library.”
– Will Hunting

OK. So I am total agreement with this statement assuming you were foolish enough to spend $150K on a college degree. Do NOT spend that much on a degree unless you are going to be something like a specialized surgeon or unless it doesn’t change the number of zeros in your (or your daddy’s) bank account.

I am not, however, in perfect agreement with UnCollege. My recommendation is to acquire education and do it in a way that provides “Proof of Education.”

Person Experience: I have a bachelor’s degree and I am almost done with my Masters of Computer Science. How much debt have I incurred from my bachelors and my Masters? $0. Now that doesn’t mean I never had a loan for education. I took out a $4k loan for a certification course. My certification was my first Proof of Education.

Proof of Education

Proof of Education is proof that you have learning or experience that can help you be successful in a role. Proof of Education is extremely important.

The most common and well-known and most accepted form of proof of education is a High School Diploma followed closely by a Bachelors degree. Another well-known proof of education but not necessarily considered such is your driver’s license.

Here is a list of the common forms of Proof of Education. These end with a nice certificate from an accredited institution.

  1. High School Diploma or GED
  2. Bachelors Degree
  3. Masters Degree
  4. Doctorate or Ph.d.

These are not the only ways to obtain Proof of Education. There are other ways however, the “proof” part is often harder to come by as it is not always a nice signed piece of paper from an accredited instituation.

  1. Job Experience
  2. Apprenticeship
  3. Certifications in your field
  4. Non-profit work and projects
  5. Life experiences

How do you prove Job Experience? Job experience is not too hard to prove, especially if the company is still around and their HR can confirm your employment and title. If the company you worked for disappears, how can you prove you worked there? Well, pay statements, references (keep in contact with previous managers and co-workers which is very easy these days).

Why is a degree the most important Proof of Education?

Often in many companies and government organizations a degree is required. If the most qualified individual doesn’t not have a degree, they are likely not to even get an interview because they don’t pass the filter.

Personal Experience: Even there is a possibility for an exception to be made, it often isn’t. I interviewed for a government job that required a Degree in Computer Science. I was qualified. My undergraduate degree was in English because I could already write code. This company wanted a WPF developer (which is my forte) and were willing to pay 110K a year, but my undergraduate degree was in English. They couldn’t make the exception despite my experience and I lost out on a great high paying job.

Personal Experience: My father’s degree is in Psychology. He worked a great job in the oil field for twenty years. Then he passed some Appraisal certifications and became an appraiser of houses. It seemed he may never use his degree. During the housing crash, around 2009, he had the opportunity to teach seminary to supplement his income. Teaching required a degree. He would have lost that opportunity without a degree.

Why may a degree not be for you?

Here are some examples of why a degree may not be for you:

  1. You may never use it. I know many people who end up working in the oil field or as a mechanic or various other positions that don’t require a degree an they never use it.
  2. It may not be worth the money. A degree in English from Yale when you plan to be a technical writer is probably not going to provide any bang for your buck. A degree from your local community college in english or even just some technical writing courses and experience would probably result in similar salaries, so save yourself some money.
  3. You want to be an entrepeneur. You just have the bug and want to work for yourself. Take some business courses somewhere, and get your business started, and stay away from college. Just be aware that most business owners fail many times and put in 80 hours a week while failing. However, once you succeed, you could end up making six figures and possibly more. It is higher risk but higher reward.
  4. You just can’t sit still and concentrate in a classroom environment and fail anytime you try. If this is you, you know who you are. Find another way to get educated and make sure to grab some Proof of Education along the way.
  5. You already have a marketable skill.

Personal Experience: I have a brother-in-law who doesn’t have a degree. His father was a surveyor and he started working with him at a young age and had years of experience already and a marketable skill already. He got a few certifications and has a great job. He may never need a degree. However, he is only in his thirties so who knows if he will wish for a degree sometime in his career.

Continued in How to get a degree and stay out of debt? (Part 2)

How to get a degree and stay out of debt? (Part 2)

Continued from Say YES to Education but say NO to large debt (part1)

Pay as you go. Get a company to reimburse your for education. This is easier said than done. It takes work, but it is doable. I know because I did it for certifications and for my Bachelors degree, and I am doing it now for my Masters.

Step 1 – Choose your career field

In what field do you want to work in:

  • IT
  • Software Developement
  • Business Intelligence Analysis
  • Sales
  • Dental
  • Medical or Health
  • Home Improvement (plumbing, electrical, etc…)
  • Mechanic
  • Other…

Step 2 – Research entry-level proofs of education in the field

Take any field of employment and search the internet for it along with basic words such as “certification” or “certificate” or “apprenticeship”. For example: Developer Certification, Medical Career Certification, Dental Apprenticeship. You will probably find some nice and cheap ways into your field.

Step 3 – Start on the quickest proof of education to obtain

There are a lot of certifications that come after a one week course. There are a lot of jobs where you can be an apprentice and learn while your work.

Example: Sometimes, there are no solutions to be faster, only solutions to be cheaper. Think of becoming a General Contractor for example. You can work framing houses for four years and study to be a general contractor on the side. Four years experience is a requirement. Sure you don’t make much money your first four years, but you won’t gather 150K of college debt and at the end of four years, you will have experience and a General Contractor’s license, which is proof of education.

Step 4 – Get an entry-level job with a company that has education reimbursement

Find all the companies in your field you can work at. Apply at all of them for entry-level positions. Make sure to let them know about your “proof of experience”. Volunteer at them if you have to until you get hired. Try to choose one that has tuition reimbursement in your field.

Note: Be smart. If a company will pay you $15 an hour with tuition reimbursement, that is not as good as a company paying $25 and hour without tuition reimbursement. Who cares if you pay for the tuition or the company if you aren’t going into debt and you are getting good experience.

Personal Experience: You may have to start with any job, even one outside your field. I needed to get a $4K loan to get my first certifications. In 1999, I needed to make $9 and hour in order to get a 4K loan to get some computer training and a computer certification. I got a job as a grunt on a crew that framed houses even though I wanted to be either in IT or in Software Development. I got up to $9 an hour framing houses, got the loan, and took a 12 week course evening course for a certification called an MCSE. I came out of the course with only one of the five exams past: a single certification, which started me out as an MCP. With that one certification, I got a job making $14.42 an hour at a company called Convergys that pays tuition reimbursement.

Step 5 – Take two classes a semester while working

Working full-time is tough. Going to school full-time while working full-time is even tougher. I recommend part-time. Let your career and your degree grow together.  Create a spreadsheet of every class you need to graduate.

Important Personal Experience! Get accepted for your major. Get commitment from the college about graduation requirements. Too many people fail to take time to get accepted in their major and then the requirements change and they feel like they have to additional requirements. Usually, if you get accepted and work with a counselor, you can graduate without taking extra credit hours because of a change in curriculum.

Personal Experience: Your company may have limits to education reimbursement. Mine did. I could only reimburse $3500 a year, so I could only take about 15-18 credits a year. I found this was beneficial anyway. I took two calls in fall, two class in the winter, and one in the spring/summer. Night classes catered to working adults. They seemed easier because I already had knowledge from work. I was able to get work credit. Sometimes when taking a class in my field, I was able to do projects for my classes that coincided with work projects. It took me six years to get my degree but when it was done, I was completely out of debt and had years of work experience behind me so I wasn’t ever just a new college grad. I graduated at age 27. I started work and college at age 21 because I spent two years on a religious mission to the Dominican Republic from age 19-21. (Oh yeah, I speak fluent spanish. My proof of experience, living two years in the Dominican Republic.)

Conclusion

If you start this process when turn eighteen, you will have a college degree and, assuming it took you the first year or two to get in your field, four or five years of experience.

Look at this comparison chart:

4 years of college 2 years Job 6 years working and Degree
Education Debt $80k to $150K $0-$5k
Montly debt payment $400 to $1500 $0-$50
Years to pay off 10 to 20 (already two years in) 1 year
Experience/Salary level 1-2 years 4-6 years
Degree Yes Yes
Certifications No (but they could) Yes
Partying time at school Plenty A little

I think you can see why UnCollege exists. However, I think the focus should neither be “College” or “UnCollege” the focus should be to get Proof of Education without going into debt.