Install python-mysql (MySQLdb) on Mac OSX

To connect to a MySQL database from Django or a python script you have to install MySQLdb. The installation of the package on MacOSX is not straightforward, so here is a small howto.

  • Download and unpack the MySQLdb package
  • Edit the setup-posix.py file, and change the line below:
    mysql_config.path = "mysql_config"
    to
    mysql_config.path = "/usr/local/mysql/bin/mysql_config"
    

    Note: you have to specify the path to your mysql_config unless you have installed mysql.com package for mac

  • Build
     python setu.py clean
     python setup.py build
     sudo python setup.py install
    

    If you get this compile error

    /usr/include/sys/types.h:92: error: duplicate ‘unsigned’
    /usr/include/sys/types.h:92: error: two or more data types in declaration specifiers
    

    edit the _mysql.c file and comment this line

    #define uint unsigned int
    

Selectbox replacement plugin Update

I’m releasing a new version of the plugin. This release is stable enough and fix a major bug dealing with scrollbar in IE but another major bug popup this time with safari, the list just doesn’t appear when you click on the replaced select box, I tried the latest Webkit build (r31623) and it works properly, if someone can point me to a debugging tool for Mac Safari I’ll be thankful !

Note : I’ve setup an independant page for the plugin

If you’re trying to import an sql file using symfony propel-insert-sql and you get this error :

ERROR 1005 (HY000): Can't create table 'Table.frm' (errno: 150)

check this command output it’s really helpful :

mysql>SHOW ENGINE INNODB STATUS;

it will give you the detailed explanation about the most recent innoDB foreign key error.
If you are using a mysqldump file add these commands at the top and bottom of the sql file

SET FOREIGN_KEY_CHECKS = 0; -- TOP
SET FOREIGN_KEY_CHECKS = 1; -- BOTTOM

that will disable constraints check

I’ve just released a new version of Selectbox replacement plugin which fix the highlight issue and added escape keyboard binding. A new css class has been created for the selected element - previously I was using the hoverClass - so now we have 2 options hoverClass and selectedClass.

Example

You can view a working example here

Download

Download

Textmate for linux with gedit

Gedit snippets plugins allow smart code completion ala Textmate. Here is how to configure gedit to enable this feature :
1/ Download this file it contains symfony smart completion code
2/ Click “Edit” > “Preferences” and then select the plugins tab, scroll down unitl you found “Snippets”, Check it

screenshot-gedit-preferences.png

3/ Go to “Tools” > “Manage Snippets” and click on the import button you should now see the new snippets.

Snippet Manager

NB : The triggers are the small words between parentheses, for example for link_to(…) just type linktoTAB and tab again to move from first parameter to the next one. I’ll update this post soon with a full list of triggers.

A quick note to let you know that I’ve released a new version of the jquery selectbox replacement plugin, this is mainly a bug fix release. I would like to thank ‘pawel maziarz’ for his contribution.
I’ve received a request to make a license modification and I did :) , so now the plugin is licensed under a dual license GPL/MIT

Changelog

  • Fix width when the select element is in a hidden div
  • Add a unique id for the generated li to avoid conflict with other selects and empty select values

Download

Download

Select Box replacement

This is an unobtrusive jQuery plugin that allows you to replace the HTML select box with a styled dropdown menu.

Why ?

As most of us, I hate IE6 but I have to deal with it. At work, our users use exclusively IE6 so you can imagine the nightmare! I came across the IE bug where the select box stay always on top of any div even if you define a z-index value, more on the subject can be found here and here. So this plugin try to resolve the problem by replacing the select box by dropdown menu.

Know issues

  • On Mac with both Safari and FF when you select a value using Enter key the form is submitted, it seems that “preventDefault” is not working. If anyone has an idea about how to resolve this, just drop me a mail or a leave a comment.
  • When an option is selected using the mouse and when you reopen the list the selected option is not highlighted anymore.

Example

You can view a working example here

Download

Download

NB: A new version can be located here

PHP get namespaces

The long awaited feature has been added to the PHP repository yesterday using the Dimitry Stogov’s implementation.
Define a namespace :

namespace Zend::DB;
class Connection
{
    //code
}
function connect()
{
    //code
}

You can import namespaces or class name like this:

require 'Zend/Db/Connection.php';
import Zend::DB;
import Zend::DB::Connection as DbConnection;
$x = new Zend::DB::Connection();
$y = new DB::connection();
$z = new DbConnection();
DB::connect();

Oracle 11g - live stream launch

After 4 long years, Oracle will launch their new version “Oracle 11g” tomorrow (July 11) with a live stream from New York.

This version will contain no less than 482 new features (more details) seen in the beta version revealed 9 months ago like data compression, Speed boost, the ability to create a standby snapshot for regression testing, online application upgrade (hot patching), a native Java & PL/SQL compilers and the more interesting feature for me is a re-engineered driver for PHP.

Pin plugin reloaded

a little while ago, a friend wrote the pin plugin based on prototype and since that time I decided to move to jquery so I decided to update it.

About

The goal of this plugin is just to remember field’s values when needed by the user.

Why ?

Imagine that you have a (big) form that it’s extensively used and for some reasons the value of some fields are repeated every time, the plugin can solve this (writting/selecting) issue by providing a mechanism to choose and save some fields.

How ?

Like other jquery plugins you just have to call :

$(element).pin();

Dependencies

Download

ToDo

  • move pin images to options, so you can set your own images
  • add multiple select, radio and checkbutton support

Changelog

Not yet