CB1 Just Reclaimed Its Inbox

Apr 19, 2007

Every so often, we will promote products that we believe are exceptional and deserve recognition. Mozilla released version 2 of it’s Thunderbird e-mail application just the other day for Linux, Mac OS X, and Microsoft Windows.

Thunderbird is a powerful, extensible e-mail client that packs tons of features and it’s open source too! It supports your typical POP3 and IMAP servers, but Thunderbird can also be used as an RSS reader.

Reading RSS feeds is great because it loads the blog post as a web page and then the content doesn’t get all messed up.

One really nice feature of 2.0 is built-in support for adding Gmail accounts. Before you had to Google what the POP3 settings were, but now you just type your username and the first time you get the mail type your password.

Thunderbird 2.0 also introduces “tagging” where you can associate one or more keywords with a message, then create saved search folders that list all of the messages matching specific tags. To top it off, you can create a message filter that automatically tags incoming messages so you don’t have to.

To download Thunderbird 2.0 or learn more, visit their website.


Dirty Form Module v1.0 Released!

Apr 17, 2007

CB1, INC. is proud to present the Dirty Form Module which built on the awesome Dojo Toolkit Module.

  • dirty_form-5.x-1.0-dev.tar.gz [original file lost due to hard drive crash, sorry]

The Dirty Form module prompts a user when leaving a page with unsaved changes. There is support for snapshots which are essential for dynamic forms created by Dojo widgets!

The Dirty Form Module homepage can be found at http://www.cb1inc.com/projects/drupal/dirty-form-module.


After adding some features and fixing some bugs, version 1.1 of the Dojo Toolkit Module for Drupal is available for download!

Read the release notes for the specific changes. The Dojo Toolkit Module homepage can be found at http://www.cb1inc.com/open-source/dojo-toolkit-module. The documentation has been updated to reflect the additions. If you should have any issues, please report them in the forum.

Very soon we’ll be releasing some Drupal modules that use the Dojo Toolkit Module, so stay tuned! In the meantime, enjoy version 1.1!


Host Information Code Snippet

Apr 15, 2007

When you are running a Unix based operating system, you have a neat command called uname that will display information about your computer. If you want it to display everything, then execute it with the -a option.

$ uname -a
Darwin chris-barbers-computer.local 8.9.1 Darwin Kernel Version 8.9.1:
Thu Feb 22 20:55:00 PST 2007; root:xnu-792.18.15~1/RELEASE_I386 i386 i386

This command outputs the following information:

  • Operating system name (-s)
  • Nodename (network name) (-n)
  • Operating system release (-r)
  • Operating system version (-v)
  • Machine hardware name (-m)
  • Generic processor type (-p)

Suppose you want to display that information from within your own application. Whether it’s written in C/C++, PHP, Coldfusion, Java, whatever, you could just execute the uname command six times to parse each bits of information, but that’s not very elegant, especially if you are using writing a C/C++ application.

With a little C code, you can grab this info and dump it in a format that is easy to parse. I’ve actually written it with C++, but you can adapt it to C.

// main.cpp

#include <iostream>
#include <sys/utsname.h>

using namespace std;

int main(void)
{
    utsname u;
    uname(&amp;u);

    cout << "<hostinfo>" << endl;
    cout << "<system-name>" << u.sysname << "</system-name>" << endl;
    cout << "<release>" << u.release << "</release>" << endl;
    cout << "<version>" << u.version << "</version>" << endl;
    cout << "<machine>" << u.machine << "</machine>" << endl;
    cout << "<node-name>" << u.nodename << "</node-name>" << endl;
    cout << "</hostinfo>" << endl;

    return 0;
}

Compile the code with gcc:

$ g++ -o hostinfo main.cpp

And when you run it you get:

$ ./hostinfo
<hostinfo>
<system-name>Darwin</system-name>
<release>8.9.1</release>
<version>Darwin Kernel Version 8.9.1: Thu Feb 22 20:55:00 PST 2007; root:xnu-792.18.15~1/RELEASE_I386</version>
<machine>i386</machine>
<node-name>chris-barbers-computer.local</node-name>
</hostinfo>

That should be easy enough to parse and display where ever you see fit. It doesn’t have to be XML either, you could output it as JSON, tab delimited, or whatever works best. This code works on Mac OS X and Linux.

So, why on Earth would you want to output this? I use it in a C++ application for dump information about the host into the top of the log files. Maybe you have a dozen web application servers and you want a quick way to figure out what kernel version is installed on each. Hopefully someone can come up with something interesting to do with this.


MySQL Conference and Expo 2007

Apr 14, 2007

In a little over a week, I’ll be heading to Santa Clara, CA, for the MySQL Conference and Expo. I figure if part of my business depends on MySQL, I should gain more knowledge about it and who best to learn from than the people who built it?

MySQL Conference and Expo 2007

The conference is April 23rd – 26th. I paid the extra cost to attend the tutorials day on the 23rd. I’ll be attending the following tutorials:

I’m extremely interested in MySQL’s scaling capabilities. When I first learned of MySQL’s clustering architecture, I was immediately intrigued and thought it was the a great way to go. After talking to Jay Pipes, MySQL’s community relations manager and author of Pro MySQL, I learned that clustering isn’t necessarily the best way to go for web applications. Instead replication is supposedly is a better alternative.

As for the sessions, I’m still trying to make up my mind. I would like to attend sessions covering basic IT stuff such as backups, but also attend programming sessions such as performance tuning.

Also, for those of you who are in the Minneapolis, MN, area, I’ll be presenting what I learned at the conference at the Minnesota MySQL User Group in May. There isn’t a date set, but I should know by early next week.


Tonight I installed Microsoft Vista Business edition in my trusty VM to do a little testing in Internet Explorer 7. After installing Vista, I spent a good hour turning off all the annoyances. Next I download the Internet Explorer Developer Toolbar Beta3. After closing IE7, I run the installer, which completes successfully.

I launch IE7 and add the IE Developer Toolbar button to the command bar. Then I go to click the button and nothing happens. After about another 10 clicks, still nothing. I tried reinstalling and no luck. Finally I started hacking the registry. I finally found the problem. By default, the developer toolbar is in a “docked” state. For some reason, IE7 doesn’t like it.

Solution: manually set the default state to not docked. Exit IE7 and launch the Registry Editor and navigate to:

HKEY_CURRENT_USER > Software > Microsoft > IEDeveloperToolbar1.0 > Options > DOMWindow

Change the Docked state from “1″ to “0″. Save the value, exit the Registry Editor, and launch IE7.

IE Developer Toolbar Docked State

Now when you click the Developer Toolbar button, it will appear in a separate window, which I actually prefer. If you click the button to dock the window, it will disappear and you will need to manually change the registry again.

IE Developer Toolbar

How many other people have had this issue?


Using dojo.mixin()

Apr 11, 2007

Sometimes you find yourself needing to union two or more Javascript objects. Dojo provides a handy function called dojo.mixin() that is designed to do just that.

dojo.mixin(object1, object2 [, object3]);

Recently I needed to write a Javascript function that opened a window and attempt to center the window on the screen. I determined that there are 13 parameters that I wanted to support:

  • URL
  • Window name
  • Show scrollbars?
  • Show menubar?
  • Is resizable?
  • Show toolbar?
  • Show location bar?
  • Show status bar?
  • Window size (width, height)
  • Window position (x, y)
  • Centered?

I could have defined my function to accept all 13 arguments, but then every time I want to use it, I need to check the order and make sure everything is correct. Worse yet, if I add a parameter, I need to update each place I use this function.

Instead, I decided it was best to pass in a JSON object that defines only the params I’m interested in setting. And the icing on the cake is the params can be in any order inside the object.

var winParams = {
    url: "http://www.cb1inc.com",
    width: 700,
    height: 500,
    center: true
};

windowOpener(winParams);

Inside my function, I want to perform a mixin of a JSON object containing the default values and the parameters passed in.

dojo.require("dojo.lang.common");

function windowOpener(/*object*/params) {
    var parameters = dojo.mixin(
        {
            name: 'win' + Math.round(Math.random()*10000000),
            scrollbars: true,
            menubar: false,
            resizable: true,
            toolbar: false,
            location: false,
            status: false,
            width: 600,
            height: 400,
            center: false
        },
        params
    );

    // ...
);

Now you can be guaranteed that you have each of the parameters even if they aren’t passed in. What’s better is you can add parameters without updating each place you use this function in your code!


The Dojo Module is an open source Drupal module that enhances Drupal websites with the awesome power of the Dojo Javascript Toolkit.

The project homepage can be found at http://www.cb1inc.com/open-source/dojo-toolkit-module. Take a peek at the documentation and forum to learn more.

Even though 1.0 has just landed, there’s already a roadmap outlining what’s in the pipe. This is a very exciting module that will allow other modules and themes to have highly interactive functionality that Dojo can provide. Stay tuned for more updates and examples!


Today marks the launch of the new CB1, INC. website! In addition to a blog, we’ve organized the projects section and will continue to add new content.

This blog will be very technical, so you won’t be hearing about boring non-technical stuff, just the boring technical stuff.

As you may already know, CB1, INC. is a technology consulting company. Custom software development and website design for enterprises is our primary business. Feel free to contact us if you have questions or you think CB1 can be of service to you!