NoSQL East Conference

The NoSQL movement has been gaining some steam lately, with discussion forums and blogs popping up all around the web. Now NoSQL East conference is planned in Atlanta, GA on October 28-30. The focus is promised to be on real world use cases and high level overview of architecture.

Currently they have announced the following speakers and topics:

Arin Sarkissian (Digg): Cassandra
Kevin Smith (Hypothetical Labs): Redis
Kevin Weil (Twitter): Pig
Chris Curtin (Silverpop): Cascading
John Hornbeck (Engine Yard): MongoDB
Mike Miller (Cloudant): CouchDB
Cliff Moon (Microsoft / Powerset): Dynomite
Justin Sheehy (Basho): Riak
Mark Gunnels (Catamorphic Labs): HBase
Tim Anglade (af83): tin
Emil Eifrem (Neo Technology): Neo4j
Geir Magnusson (Gilt Groupe): Project Voldemort
Yuan Yu (Microsoft Research): Dryad/DryadLINQ
John Corwin (Yahoo!): Sherpa

The conference will take place in Georgia Tech Research Institute – Conference Center. Although this event has some good sponsors it is not that cheap as it could be in the open source world. So it should be possible to sign up with a promo code Stammy250 and save $50.

Unfortunately I am not sure if I am able to attend this event. Hopefully there will be some video or slide casts available later. For example Bryan Fink shared his presentation on the riak web-shaped data storage engine which was a part of New York NoSQL mini-conference on October 5th, 2009.

P.S.: I am not affiliated with anyone of the conference organizers. However I believe it is always good to see what’s going on in the world of databases as well as to learn RDBMS disadvantages and ways how to avoid or fix them.

MySQL: Two more ways to find out table storage engine

In addition to SHOW TABLE STATUS there are at least two more ways to find out a table storage engine.

The first way is simply to query the INFORMATION_SCHEMA.TABLES.

SELECT `table_name`, `engine`
FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = DATABASE();

In case there is not permission to access INFORMATION_SCHEMA the second way requires only the SELECT privilege for the table.

SHOW CREATE TABLE TestTable;

MySQL: An alternative to alter

A while ago I was involved in the technical part of an interview with a PHP developer. Obviously some questions were about MySQL. For instance – how to add a new column to existing table. The candidate tried to convince us that there was no way to do that except creating another table with new column and copy data from old table there. Sure thing that we advised him to read about ALTER command.

However it turned out that suggested ‘method’ could have sense. According to Chris at Everything MySQL blog a full dump and reload to a table with new column may be much more faster than alter table! For instance there is shown a test with 5Gb table and alter table is 47% slower. Of course such ‘alternative alter’ should be used only against slave as well as some other restrictions may apply.

Below is the suggested process.

1. If you have a slave, AND YOU SHOULD AT THIS POINT, run stop slave
2. Run the SELECT INTO OUTFILE local, if you have the space, or over nfs (not very fast)
3. DROP or RENAME THE TABLE you are trying to ALTER
— RENAME only if you have the space and you don’t trust THE PROCESS!
4. CREATE the same table with the ALTERATIONS, if you dropped, or a new table with the ALTERATIONS
5. IMPORT the file from step 2
6. Either RENAME the two tables, if you renamed, or start slave
7. Fail over the writes to the newly altered slave
8. Repeat steps 1 – 7 for the old master

The Vendor Client relationship – in real world situations

How an Engineer folds a T-Shirt

RSS cheese

If you get bored with your blog RSS icon or just want a new or unusual one, check out a free icon set RSS Cheese.

According to the author the set contains 4 high resolution RSS icons that come in four sizes: 512×512, 256×256, 128×128 and 64×64 as well as icons are completely free and can be used without any restrictions in any type of project inlcuding commercial projects.

RSS Cheese

PHP: Don’t repeat parameters using sprintf()

While missing a C# method String.Format() I’ve found a similar function in PHP, i.e. sprintf(). But since this function is slightly different from String.Format() it is not obvious how to avoid duplicating the same parameters.

For instance how to re-write an example below without passing $url and $title twice.

$link = sprintf('<a href="%s" title="%s">%s</a> (%s)</li>',
              $url, $title, $title, $url);

The answer is less obvious compare to C# but still pretty handy:

$link = sprintf('<a href="%1$s" title="%2$s">%2$s</a> (%1$s)',
              $url, $title);

In both cases echo $link give the same output like:

<a href="http://www.google.com/" title="Google">Google</a> (http://www.google.com/)

but the second way makes the code more elegant 🙂 .

PHP: json_encode before 5.2.0

Even though it is a lot of talks about PHP 5.3 there are still many production environments which run PHP 5.1.*. As well as sometimes development servers are updated earlier than production ones for testing purposes. It may cause that some new PHP features will not work on production because of older version there.

One of the most common examples is ‘missing’ json_encode() function which became native with PHP 5.2.0 onward. Below is possible workaround while your production has not upgraded yet.

<?php
if (!function_exists('json_encode'))
{
  function json_encode($a=false)
  {
    if (is_null($a)) return 'null';
    if ($a === false) return 'false';
    if ($a === true) return 'true';
    if (is_scalar($a))
    {
      if (is_float($a))
      {
        // Always use "." for floats.
        return floatval(str_replace(",", ".", strval($a)));
      }
 
      if (is_string($a))
      {
        static $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
        return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"';
      }
      else
        return $a;
    }
    $isList = true;
    for ($i = 0, reset($a); $i < count($a); $i++, next($a))
    {
      if (key($a) !== $i)
      {
        $isList = false;
        break;
      }
    }
    $result = array();
    if ($isList)
    {
      foreach ($a as $v) $result[] = json_encode($v);
      return '[' . join(',', $result) . ']';
    }
    else
    {
      foreach ($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v);
      return '{' . join(',', $result) . '}';
    }
  }
}
?>

Update: the same code is now available through GitHub.

IKEA cars

IKEA car

The Ugly Truth

Th Ugly Truth movie turned out to be furnished with good soundtracks.

Don’t forget to check a complete list of soundtracks.

« Previous PageNext Page »