12 Nov 2011

IE6 & Google Chrome Frame

IE6 is still an annoying part of a developers life. A workaround for this problem is Google Chrome Frame. html5boilerplate.com has updated to version 2.0 recently including support for Chrome Frame. Even better, html5boilerplate.com prompt IE 6 users to install Chrome Frame. It's a showcase how to migrate the user seamlessly without administrator privileges.

Now imagine that you have a set of Internet Explorer 6 machines and it was possible to deploy Google Chrome Frame to render everything by default except a few intranet sites that work only with IE6, what would you get?

  • The enhanced security of sandboxed renderer, sandboxed flash/PDF, effectively replacing IE with Google Chrome’s rendering engine whilst browsing the wild, wild Internet.
  • Legacy compatibility of Internet Explorer whilst accessing intranet sites.
  • Industry-leading response rate for high and critical risk reported vulnerabilities.
  • Google Chrome’s auto update strategy that is speedy and easy to administer.

Interested? Check it out!

 

8 Jul 2011

"warning: regexp match /.../n against to UTF-8 string" when running Cucumber

You probably have updated your environment lately and now getting the error "warning: regexp match /.../n against to UTF-8 string" when running Cucumber.

This is an encoding problem in the rack gem. This problem has already been fixed in version 1.3.0 but some of us are not able to update due dependencies issues e.g. rails. A simple monkey-patch based on pull request can solve the issue.

Create the file "config/initializers/rack_hotfix.rb" with the following content:

1 Jul 2011

Headless Testing for Continuous Integration with Ruby and Selenium

A headless system is a computer system or device that has been configured to operate without a monitor (the missing "head"), keyboard and mouse.

This is something you probably want when you're running a continuous integration server and having a bunch of integration tests for your website / application.

Using Firefox on Debian

Web Links

21 Nov 2010

My first Mac OS X project

I have some projects for Mac OS X in mind where I still have not found anything suitable on the web. Most of this projects are tools for developers/administrators as myself to simplify life. A couple of days ago I started to work on one of this projects and over the next weeks I want to share some of the experiences.

Development

Tutorials:

Libraries:

Maintenance

Distribution

How to sell your product, secure it against crackers, handle license keys, etc.?

19 Jun 2010

RecordColumnNameDecorator - A Doctrine Compatibility Decorator

I mentioned that we’re migrate our application from pure SQL to an ORM-Layer. Many of the existing functions work with column names of the database tables. Sometimes these column names are used hard coded or directly linked to the view layer. The actual problem is that we used the opportunity of the migration to unify the denotation of our tables and column names via the doctrine alias functionality. At the end we had functions using the old syntax and models with a new stylish unified nomenclature.

Fortunately it’s all OOP :)

The functions need a way to get the data from a given “Array”, but with the real column names instead of the new field names. The Doctrine_Record implements the ArrayAccess-Interface, which solves the problem that Doctrine_Record object should behave like an Array. The compatibility issue is solved through a small decorator which is currently not more as a proof of concept. The decorator change the functionality of the implemented ArrayAccess-Interface so that will accept real column names.

/**
 * A Doctrine_Record uses field names instead of columns names
 *
 * The RecordColumnNameDecorator change the functionality how
 * you call data from a Doctrine_Record. You can use the original
 * column names instead of the field alias.
 *
 * @author     Enrico Stahn <stahn@rib.de>
 * @version    SVN: $Id$
 */
class RecordColumnNameDecorator extends Doctrine_Record
{
  protected $record;

  public function __construct(Doctrine_Record $record)
  {
    $this->record = $record;
  }

  public function offsetGet($key)
  {
    return $this->record[$this->record->getTable()->getFieldName($key)];
  }

  // ... Implement the rest of the interface
}

Example:

// old: ugly_tablename.ugly_column_name
// new: foo.bar
$a = new Foo();
$b = new RecordColumnNameDecorator($a);
echo $a->bar;
echo $b->ugly_column_name

easy-peasy :)

11 Jun 2010

PostgreSQL - Add primary key to an existing Table

The next months are full of hard work because we have to master a huge migration task. We migrate all SQL-Statements to an ORM Layer. The application is already a bit long in the tooth and has approximately 8000 queries. The database itself has some strange design issues and some of them are incompatible with the ORM layer. One of this issues is the lack of a primary key at some tables. In PostgreSQL we can solve this with the following steps:

  • Add a column with type integer to your table
  • Create a sequence
  • Update the column table with sequence values
  • Set the necessary column properties (e.g. default, not null, etc.

Example for table “foo” and column “id”:

ALTER TABLE "public"."foo"   ADD COLUMN "id" INTEGER;
CREATE SEQUENCE "public"."foo_id_seq";
UPDATE foo SET id = nextval('"public"."foo_id_seq"');
ALTER TABLE "public"."foo"
  ALTER COLUMN "id" SET DEFAULT nextval('"public"."foo_id_seq"');
ALTER TABLE "public"."foo"
  ALTER COLUMN "id" SET NOT NULL;
ALTER TABLE "public"."foo" ADD UNIQUE ("id");
ALTER TABLE "public"."foo" DROP CONSTRAINT "foo_id_key" RESTRICT;
ALTER TABLE "public"."foo" ADD PRIMARY KEY ("id");
1 Dec 2009

Comparison: Symfony vs Ruby on Rails