Comet story (part III)

[The first two parts of "Comet story" were backgrounds to why and how I came up to write a collaborative whiteboard. The application is running here now and you can play with it by opening it in multiple browser windows (no IE:). This third and final part tells how I actually coded the app.]

Finally, PHPUnderControl for Drupal 6 and 7.

[First draft]

[Update: Due to a latest code change in Drupal7's simpletest module, Drupal 7 support is now broken :-( ]

Comet story (part II)


[The first part of "Comet Story" was the story of failure. This part is no different with a slight twist at the end.]

Forgetting Comet was not such a bad thing actually. In the aftermath, I ended up passing the Zend Certified Engineer exam :-) But after the exam, the itch was back; time and again, I'll start thinking about Comet and online whiteboards. Regarding Comet, I was probably thinking deep inside my mind that a magic solution will appear somehow.

Comet story (part I)

A few years ago, I wanted to create a remote tutoring website. I even bought a domain name - remoteguru.info. Then after a long thought, I decided against creating the site and instead concentrate on AI (no, I haven't built R2D2 yet). But in the meantime, I have done some homework on this remote tutoring site. In this piece, I'll tell what happened during that time.

Customizing CruiseControl

CruiseControl is a continuous integration tool. When any project is listed with CruiseControl, it looks for source code changes in that project at regular intervals and runs various tools everytime the codebase is updated. These tools include build tools, unit test frameworks, coding standard checker, source code documentation generator, etc. Any tool that has anything to do with source code can be in this list as long as they fulfill one criteria - the ability to generate XML output. CruiseControl is written in Java and its focus is also on the Java world.

Drupal5, Macgyver, and CruiseControl

Recently I have been watching lots of Macgyver. I discovered that, one of my favourite episodes is "The Road Not Taken" (season 2, episode 7) where Macgyver employs some sort of rudimentary early-warning system to save a group of orphan children, himself, his boss (yes, papa Thorton, as Jack Dalton used to call him :), and his and his boss's former love interests!!!

Lessons 0

  • Run your unit tests at least once a day. I haven't run it for a week, and now I see that people have added tests which has turned the whole test suite unusable
  • If your project has anything to do with sending emails to other people, do use a separate mail server. And then configure the mail server such that it redirects those emails to a specific email address or mailing list. Something like Fakemail (http://www.lastcraft.com/fakemail.php) should be very useful.

Interactive Drupal Programming

If you like REPL (AKA interactive programming as in "php -a"), you might love this script as well. It loads the whole of Drupal and then waits for
you to type in any php statements. This statements can ALSO be any function defined in your Drupal instance. Here's a demo:


[ju@ju ~]$ php php/inter-drupal.php
Go...
echo drupal_strlen('hihi hoho haha'), PHP_EOL;
14

echo base_path(), PHP_E0L;
/./

echo 3;
3

$return_value = arg(0);
echo $return_value;
node

exit;
[ju@ju ~]$

<?php

/**

Some PHP Questions

0. Name the Super Global that holds the cookies.

1. Which was not available before php5 -
a) DOM b) SOAP c) SAX d) XSL

2. Is the use of type hinting available in methods only ?

3. What's the output of the following:


function foo(IAMACLASS &$arg0 = NULL)
{
    if (is_null($arg0))
    {
         echo 42;
    }
}

4. What's the output of the following:


function foo(IAMACLASS &$x = NULL)
{
    $x = 42;
}

$obj = new stdClass;
foo($obj);
echo $obj;

array_merge() is damn Slow

After this mornings performance by array_merge(), I doubt I would dare to use it again. What I was doing was pretty simple. My code was reading a textfile with the first one million primes. Each line had 8 primes and there were 125002 lines. I was extracting the primes eight-at-a-time and merging them with an array. This merge operation, as you can guess, was happening through array_merge() :


$primes = array();
while ($data = fscanf($fp, ' %d %d %d %d %d %d %d %d \n'))
{
$primes = array_merge($primes, $data);
}

Syndicate content