WordPress supports MultiSites

WordPress now supports MultiSites with its 3.0 version. It’s the current SVN development version. This means you can have one wordpress install for multiple sites. You can see how it works by looking into ms-settings.php. This is quite a good news for anyone willing to manage a community of bloggers. Here is a part of the wp-includes/wp-settings.php file : function wpmu_current_site() { global $wpdb, $current_site, $domain, $path, $sites; if( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) { $current_site->id = (defined( 'SITE_ID_CURRENT_SITE' ) ? constant('SITE_ID_CURRENT_SITE') : 1); $current_site->domain = DOMAIN_CURRENT_SITE; $current_site->path = $path = PATH_CURRENT_SITE; if( defined( 'BLOGID_CURRENT_SITE' ) ) $current_site->blog_id = BLOGID_CURRENT_SITE; return $current_site; } $current_site = wp_cache_get( "current_site", "site-options" ); if( $current_site ) return $current_site; $wpdb->suppress_errors(); $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site if( count( $sites ) == 1 ) { $current_site = $sites[]; $path = $current_site->path; $current_site->blog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" ); $current_site = get_current_site_name( $current_site ); wp_cache_set( "current_site", $current_site, "site-options" ); return $current_site; } $path = substr( $_SERVER[ 'REQUEST_URI' ], , 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) ); if( is_subdomain_install() ) { $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path) ); if( $current_site != null ) return $current_site; $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain) ); if( $current_site != null ) { $path = '/'; return $current_site; } $sitedomain = substr( $domain, 1 + strpos( $domain, '.' ) ); $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path) ); if( $current_site != null ) return $current_site; $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $sitedomain) ); if( $current_site == null && defined( "WP_INSTALLING" ) == false ) { if( count( $sites ) == 1 ) { $current_site = $sites[]; die( "That blog does not exist. Please try http://{$current_site->domain}{$current_site->path}" ); } else { die( "No WPMU site defined on this host. If you are the owner of this site, please check Debugging WPMU for further assistance." ); } } else { $path = '/'; } } else { $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path) ); if( $current_site != null ) return $current_site; $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain) ); if( $current_site == null && defined( "WP_INSTALLING" ) == false ) { if( count( $sites ) == 1 ) { $current_site = $sites[]; die( "That blog does not exist. Please try http://{$current_site->domain}{$current_site->path}" ); } else { die( "No WPMU site defined on this host. If you are the owner of this site, please check Debugging WPMU for further assistance." ); } } else { $path = '/'; } } return $current_site; }

January 10, 2010 · Florent Clairambault

ANTS Memory Profiler

Well, I’m speaking about a commercial product again. This time it’s about ANTS Memory Profiler (by Red Gate software, the ones that made .Net reflector). This product will help you identify any .Net memory leak you could have. The truth is, .Net never leaks but you can sometimes make stupid conception mistakes, like forgetting to remove references of some objects (that may contains heavy references themselves). The tool allows you to take snapshots of your running application and compare different snapshots. You can see the difference of memory consumption by some objets or the difference of class instance count. ...

December 30, 2009 · Florent Clairambault

Mono Tools for Visual Studio

I talked about this earlier. The mono tools for Visual Studio is a commercial product that easily enables you to test and port your Windows applications to mono. As I told before this is really a great idea. Because I think Visual Studio is the best IDE and Linux is the best server OS (in my opinion, it’s more efficient and more robust than Windows Server). So, I think it’s the perfect gateway between this two very different (but very close since Mono appeared) environments to achieve greatness. ...

December 29, 2009 · Florent Clairambault

Sharepoint 2010 on my Windows 7

I finally took the time to make “Sharepoint 2010” work on my PC. I previously did the installation as recommended by the Microsoft. I had to do one additionnal thing to make it work : “Desactivate the .Net 4 ISAPI filter”. In the event logs, I had this error: ISAPI Filter 'C:\Windows\Microsoft.NET\Framework\v4.0.21006\aspnet_filter.dll' could not be loaded due to a configuration problem. The current configuration only supports loading images built for a AMD64 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349. And then: ...

December 20, 2009 · Florent Clairambault

JObexFTP from Ricardo Schmidt

WARNING: All the Cinterion related content from this blog will be removed to go to the javacint wiki soon. Please get used to going there. Ricardo Schmidt made a great multi-platform TC65 control and file management tool called JOBextFTP. This can be used for anyone whose Module Exchange Suite (MES) doesn’t work or doesn’t work correctly. The biggest effort is put on managing the OBEX file transmission protocol, but it also does offer some simple methods that can be integrated in your development process, like “turnOn”, “turnOff”, “getTime”, “runApp”. ...

December 19, 2009 · Florent Clairambault

The M2MP protocol

Moved to github This has been moved to github. Still as a backup: Motivations Transmit and receive in real-time Transmit as few data as possible Send and receive any kind of data Basics So the basic ideas are to : Keep a TCP connection open all the time by sending regular keep-alive frames. Define named channels that are only transmitted once (to reduce data consumption) Send byte array, and two-dimensionnal byte arrays on these channels We rely on the TCP protocol for packet checksuming, packet ordering and every little things it does very well We send these kind of frames : ...

December 12, 2009 · Florent Clairambault

TC65 : Settings management

Someone recently asked me and the javacint group how we should handle settings. So I’ll give you two answers : ejw’s reply : You should use some simple DataInputStream and DataOutputStream objects. Mine : If you only store simple values (numbers and text), you should use a simple text file. It enables you to easily see and modify settings outside the TC65. So, my little gift of today will be a simple settings management class. The idea is that this file is in a very simple format (that can be read in any PC) and it only stores settings that have changed. This is very important, it allows you to change the default behavior at next software update but also enable you to override some of the settings for each chip (like the last IMSI identifier of the SIM card). ...

December 11, 2009 · Florent Clairambault

Google Chrome Browser & OS

The browser I’ve always been on the Bêta version of Google Chrome. And the current bêta (soon to be stable I guess) now supports plugins, the most interesting ones are AdThwart which blocks ads and Gmail Checker which displays the number of received mails. Making some chrome extensions seems to be really easy, it’s entirely based on javascript. The other very interesting thing is the developper tools. They are very close to Firebug, it’s now really easy to debug JS and CSS within Chrome. ...

December 9, 2009 · Florent Clairambault

Ajax Push Engine 1.0 released

I’m quite unlucky because I’ve downloaded the APE BETA5 just before they (I mean Anthony Catel) released the 1.0. The quite interesting part is that it fixes all the bugs I’ve talked about sooner. So we could say my last post won’t be very useful to anyone. Still, if you want to compile APE on CentOS x64, you have have to edit the modules/Makefile file and add the -L/usr/lib64/mysql command arg. It will give you something like that : ...

December 8, 2009 · Florent Clairambault

WP Codebox Quick fix for WordPress 2.9

This bug has been fixed ! I like to have the latest version of WordPress, this is why I use the SVN version. And recently the CSS of the “WP Codebox” plugin stopped working. Here the explanation and the solution : It seems that starting with the 2.9 version, you can register the styles in the wp_print_scripts action method. So in the wp-codebox.php file, you have to put this : add_action('wp_print_scripts', 'Codebox_ScriptsAction'); function Codebox_ScriptsAction () { $cb_path = get_bloginfo('wpurl') . "/wp-content/plugins/wp-codebox"; //URL to the plugin directory if (! is_admin()) { wp_enqueue_script('jquery'); wp_enqueue_script('codebox', $cb_path . '/js/codebox.js', array('jquery'), '0.1'); } } add_action('wp_print_styles', 'Codebox_StylesAction'); function Codebox_StylesAction() { $cb_path = get_bloginfo('wpurl') . "/wp-content/plugins/wp-codebox"; //URL to the plugin directory if (! is_admin()) { wp_enqueue_style('codebox', $cb_path . '/css/codebox.css', array(), '0.1', 'screen'); } } And it will work.

December 7, 2009 · Florent Clairambault