Will Oller .com

Avatar

Learning to match the beat of the Old World man.

Generating amazing reports using Basecamp (Part 1 - Tagging)

We’ve been looking for good ways to produce advanced reports using Basecamp. We have hit upon a system in which we implement a rudimentary tagging system, and add additional metadata for time estimation.

In this first part, I will explain the simple tagging system. Next time, I will tell you all about the Big XML Dump.

Tagging System

Tagging will be implemented using { curly braces } around a comma-delimited list. We will be using our regular work categories as tags, so a typical todo-list might look like:

Implement new feature {Programming}

  • Add new processing loop
  • Create new template {HTML Production}
  • Connect to pre-existing API

We want our tagging parser to be smart, and change an item’s tag list on the fly based on it’s parent item’s tag list. That sounds complicated; here’s an example using the list above.

Computed Tags

Implement new feature {Programming}

  • Add new processing loop {Programming}
  • Create new template {Programming, HTML Production}
  • Connect to pre-existing API {Programming}

The italicized tags are derived from the list’s name (Implement new feature) and will be programmatically added.

Time Estimation

Time estimates are handled in much the same way as the tags, just using straight brackets instead ([, ]).

Adding time estimation to our list:

Implement new feature {Programming}

  • Add new processing loop [1]
  • Create new template [6.5] {HTML Production}
  • Connect to pre-existing API [9]

This way, each todo-item has a time value associated with it. We will use this data later on to test our estimation skills and to quantify our productivity.

Next: Part 2 - The Big XML Dump

Limiting title and excerpt length with Wordpress

Sometimes clients have very specific requirements. Sometimes they want autometic controls on simple things they have total control over anyway. I digress.

In this case, blog titles needed to be of any length, but have their lengths truncated under certain circumstances. Furthermore, excerpts need to be able to be the default length (50 words), but shorter (10 words) under those same certain circumstances.

Fortunately for me, the excerpt was easily fixed using a plugin called the excerpt reloaded.

http://guff.szub.net/2005/02/26/the-excerpt-reloaded/

Next, for the title length requirements, you will need to modifiy a core file: wp-includes/post-template.php.

PHP:
  1. function the_title($before = '', $after = '', $echo = true, $length = false) {
  2.    $title = get_the_title();
  3.     if ( $length && is_numeric($length) ) {
  4.        $title = substr( $title, 0, $length );
  5.     }
  6.     if ( strlen($title)> 0 ) {
  7.        $title = apply_filters('the_title', $before . $title . $after, $before, $after);
  8.        if ( $echo )
  9.           echo $title;
  10.        else
  11.           return $title;
  12.     }
  13. }

Finally, when in The Loop, call the_title() like this:

PHP:
  1. <?php the_title('', '', true, '40') ?>

Now, the title will be a mere 40 characters long, and the excerpt (using the_excerpt_reloaded()) can be any desired length.

Become a Bushido Coder

From Hagakure.

  1. Remeber, harmony in all aspects of your project is difficult.

    Great patience is required to overcome this.

    Master Ittei said, "In calligraphy it is progress when the paper, brush, and ink are in harmony." Yet they are so wont to be disjointed!

  2. Don't reinvent the wheel

    Take a lesson from me; don't get stuck pursuing a tricky solution. Look to what others have done and try to improve on it, but don't reinvent the wheel (yeah, I know you hear that all the time).

    Learning is a good thing, but more often it leads to mistakes. It is like the admonition of the priest K?nan. It is worthwhile just looking at the deeds of accomplished persons for the purpose of knowing our own insufficiencies. But often this does not happen. For the most part, we admire our own opinions and become fond of arguing.

  3. Listen to old people

    This is less about coding and more about life. Listen to old people. They have done things you will never do in times you could never see. Pay attention. There are less than 50 WWI vets alive today. 1100 WWII vets die every day. When they are gone, they are gone forever.

    When you are listening to the stories of accomplished men and the like, you should listen with deep sincerity, even if it's something about which you already know. If in listening to the same thing ten or twenty times it happens that you come to an unexpected understanding, that moment will be very special. Within the tedious talk of old folks are there meritorious deeds.

  4. Keep your eyes on the prize

    Planning is essential to a succesful project, but when the planning phase is complete and the battle begins, you must not take your eye off of your goal. See it through completely and swiftly; be dilligent and unfailing in your aim. If you want great word-of-mouth advertising, turn a client's project around ahead of schedule and on budget. Your profit margin increases, as does the satisfaction of the client.

    According to what one of the elders said, taking an enemy on the battlefield is like a hawk taking a bird. Even though it enters into the midst of a thousand of them, it gives no attention to any bird other than the one that it has first marked .

    Moreover, what is called a tezuke no kubi is a head that one has taken after having made the declaration, "I will take that warrior wearing such and such armor."

  5. Youth is the time for the hardest work

    Work hard while you're young, folks. No amount of caffiene will fuel a 16-hour code binge when you're old.

    Save your money. Invest! Your retirement should not consist of asking if I want fries.

    Shida Kichinosuke said, "At first it is an oppressive thing to run until one is breathless. But it is an extraordinarily good feeling when one is standing around after the running. More than that, it is even better to sit down. More than that, it is even better to lie down. And more than that, to put down a pillow and sleep soundly is even better. A man's whole life should be like this. To exert oneself to a great extent when one is young and then to sleep when he is old or at the point of death is the way it should be. But to first sleep and then exert oneself . . . To exert oneself to the end, and to end one's whole life in toil is regrettable." Shimomura Rokurouemon told this story.

    A saying of Kichinosuke's that is similar to this is, "A man's life should be as toilsome as possible."

  6. Honesty is the best policy

    Clients should know up front the benifits and drawbacks to the changes they are requesting. Don't assume clients understand the ramifications of a new cart checkout process on the user's experience, or the irrelevance of a new XML-based export. Let them know why the latest round of changes will put the project behind schedule 2 weeks. If they know up front, they won't feel like you were hiding it when a deadline gets pushed back (unless they are jerks).

    Hirose Denzaemon was then about twelve or thirteen years old. When he sat down in front of the physiognomist, he said in a bristling voice , ''if you read cowardice in me, I'll cut you down with a single blow !"

    When there is something to be said, it is better if it is said right away. If it is said later, it will sound like an excuse. Moreover, it is occasionally good to really overwhelm your opponent. Also, in addition to having spoken sufficiently it is the highest sort of victory to teach your opponent some- thing that will be to his benefit. This is in accordance with the Way.

  7. Plan ahead

    The phrase, ''Win first, fight later, '' can be summed up in the two words, "Win beforehand." The resourcefulness of times of peace is the military preparation for times of war. With five hundred allies one can defeat an enemy force of ten thousand.

    For me, this speaks to the benifits of a good code archive. If you alredy have an app or killer solution to a problem waiting in the wings, you have already completed much of your task.

  8. Continue to spur a running horse.

    Managers: push your developers, no matter how well they are doing. Reward them well when they excel, and then push again.

  9. Learn by asking questions.

    To ask when you already know is politeness. To ask when you don't know is the rule.

  10. Be skeptical

    People with intelligence will use it to fashion things both true and false and will try to push through whatever they want with their clever reasoning. This is injury from intelligence . Nothing you do will have effect if you do not use truth.

    If something sounds too good to be true, it probably is (except Gmail - Gmail rocks).

  11. Be quick

    Lord Katsushige always used to say that there are four kinds of retainers. They are the "quick, then lapping," the "lagging, then quick," the "continually quick," and the ''continually lagging.''

    The "continually quick" are men who when given orders will undertake their execution quickly and settle the matter well. Fukuchi Kichizaemon and the like resemble this type.

    The "lagging, then quick" are men who, though lacking in understanding when given orders, prepare quickly and bring the matter to a conclusion. I suppose that Nakano Kazuma and men similar are like this.

    The "quick, then lagging" are men who when given orders seem to be going to settle things but in their preparation take time and procrastinate. There are many people like this.

    Other than these, one could say that the rest are ''continually lagging."

  12. May your tasks fall before your sword like weeds before the farmer's hoe.

    References:

Sorting Algorithms: Laser Sort

Sorting

There are lots of sorting algorithms out there. Bubble, Shell, Heap, Quick, Library come readily to mind, and still the list goes on.

So, of course, I had to come across a sorting problem that I couldn't solve with my Beginning Programming textbook. It's not a particularly compex problem, and the solution is even simpler, but coming to that simple solution was not.

(more...)

Continue