Category: Databases

  • Geo Proximity Search: The Haversine Equation

    I’m working on a project that requires Geo proximity search. Basically, what I’m doing is plotting a radius around a point on a map, which is defined by the distance between two points on the map given their latitudes and longitudes. To achieve this I’m using the Haversine formula (spherical trigonometry). This equation is important…

  • MySQL Split String Function

    MySQL does not include a function to split a delimited string. However, it’s very easy to create your own function. Create function syntax A user-defined function is a way to extend MySQL with a new function that works like a native MySQL function. To create a function, you must have the INSERT privilege for the…

  • Implementing Dynamic Finders and Parsing Method Expressions

    Most ORMs support the concept of dynamic finders. A dynamic finder looks like a normal method invocation, but the method itself doesn’t exist, instead, it’s generated dynamically and processed via another method at runtime. A good example of this is Ruby. When you invoke a method that doesn’t exist, it raises a NoMethodError exception, unless…

  • Database Replication Adapter for Zend Framework Applications

    Last updated: 21 Feb, 2010 Database replication is an option that allows the content of one database to be replicated to another database or databases, providing a mechanism to scale out the database. Scaling out the database allows more activities to be processed and more users to access the database by running multiple copies of…

  • Zend Framework DAL: DAOs and DataMappers

    A Data Access Layer (DAL) is the layer of your application that provides simplified access to data stored in persistent storage of some kind. For example, the DAL might return a reference to an object complete with its attributes instead of a row of fields from a database table. A Data Access Objects (DAO) is…

  • ActiveRecord: JavaScript ORM Library

    Aptana has just released a beta version of its ActiveRecord.js which is an ORM JavaScript library that implements the ActiveRecord pattern. It works with AIR and other environments: ActiveRecord.js is a single file, MIT licensed, relies on no external JavaScript libraries, supports automatic table creation, data validation, data synchronization, relationships between models, life cycle callbacks…

  • Four Great InfoQ Presentations

    Hope you like these recommendations and if you know of any other good tech-related video, then please let me know. 1. Developing Expertise: Herding Racehorses, Racing Sheep One of my favourites. In this presentation Dave Thomas (The Pragmatic Programmer) talks about expanding people’s expertise in their domains of interest by not treating them uniformly as…

  • The Multimaster Replication Problem

    Replication has its problems, specially if you have a multimaster replication system. To make matters worse, none of the PHP frameworks support multimaster replication systems nor handle master failover. Symfony uses Propel and only supports master-slave replication systems. When the master fails, it’s true that you have the slaves ready to replace it, but the…

  • Full-text searching with MySQL

    MySQL’s full-text search functions provide a simple framework for an easily implemented, approximate site search. Many sites, written in an interpreted language and powered by MySQL, can use MySQL’s full-text search to avoid third party dependencies. The basics of the MySQL full-text search functions are well-documented in the MySQL online documentation. For those lacking patience,…

  • MySQL Master-Master Replication Manager

    The MySQL Master-Master replication (often in active-passive mode) is popular pattern used by many companies using MySQL for scale out. Most of the companies would have some internal scripts to handle things as automatic fallback and slave cloning but no Open Source solution was made available. In 2007, the High Performance Group at MySQL AB…

  • Agile Database Deployment Using Phing

    Phing allows you to use SQL to define changes to your database schema, making it possible to use a version control system to keep things synchronized with the actual code. A common way to automate development and deployment tasks is by writing shell scripts, however, Phing provides some advantages over shell scripts for task automation.…

  • 10 great articles for optimizing MySQL queries

    Optimization is a complex task because ultimately it requires understanding of the entire system to be optimized. Although it may be possible to perform some local optimizations with little knowledge of your system or application, the more optimal you want your system to become, the more you must know about it. The following 10 articles…

  • Next generation data storage with CouchDB

    Most digital data we deal with in the real world is not inherently relational in nature, yet most web applications use a SQL RDBMS for data persistence. CouchDB is fundamentally a different type of database, storing data as independent “Document” objects. They can be easily replicated to other instances of CouchDB for distributed and offline…

  • CouchDB: A document-oriented database accessible via a RESTful HTTP/JSON API

    CouchDB was accepted for incubation at the Apache Software Foundation a couple of months ago. My congrats to the development team! It’s a very interesting and challenging project, and the fact that it was accepted for incubation will definitely get the team exited. What is CouchDB? A document database server, accessible via a RESTful JSON…