Skip Edit in for Container FCE

This is for you, if you are familiar with TemplaVoila for Typo3 and you are using FCEs to create multicolumn container elements. Problem with these Elements is that when the author creates the column element, he is faced with the Edit-Maks usualy needed for normal content elements. But since the column element has no data yet to edit just some container for elements, this view is not required. A simple line in your FCE XML skips the edit mode. Put this in the meta section of your DataStructure: <noEditOnCreation>1</noEditOnCreation>

Here is an example XML:
Weiterlesen

Fixing double-encoded UTF-8 data in MySQL

I recently came across an old website of ours that I wanted to migrate to a new server. When I finished migration, I found the special characters typical to european languages broken. It took me a while to find the problem. The data was wrong in the Database but on the old system it was displayed correctly, the new didn’t. I finally figured out that my database suffered from double encoded UTF-8 characters.

It seams, that double-encoded UTF-8 texts are a fairly common problem when dealing with MySQL. This may be due to the fact that the default character set of the connection to the server is Latin-1, but that is not relevant once the data is already corrupt.

Here is how to fix it – export the database using latin1 charset an re-import with utf-8:

mysqldump -h DB_HOST -u DB_USER -pDB_PASSWORD –opt –quote-names –skip-set-charset –default-character-set=latin1 DB_NAME > dump.sql

mysql -h DB_HOST -u DB_USER -p DB_PASSWORD –default-character-set=utf8 DB_NAME < dump.sql

Of course, you should first replace DB_HOST, DB_USER, DB_PASSWORD and DB_NAME with values, corresponding to your personal setup.

source: Fixing double-encoded UTF-8 data in MySQL

Typo3. Caching-Framework. Memcache. Mamp Pro. OS X Lion.

For my latest project, we used Extbase and Fluid with Typo3 4.5. My development environment is a MacBook Pro running OSX Lion with MAMP Pro 2.0. Newer versions of Typo3 come with a caching framework that allows you to define different caching methods for different tasks and even lets you integrate your own caching mechanisms into your extensions. The caching framework makes use of several caching backend – DB, File, RAM-Memory, APC etc.

For my installation I wanted to use the apache memcache extension.

Configure Typo3 to use memcached

Do enable the framework you need to set some values in the localconf-file. Take care – some values will change in Typo3 4.6. – especially there are more defaults so you don’t have to set all of this. The code below is for Typo3 4.5.X to be put into typo3conf/localconf.php:

// cachingframework-Memcached - START
$TYPO3_CONF_VARS['SYS']['useCachingFramework'] = '1';
$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_hash'] = array (
	'frontend' => 't3lib_cache_frontend_VariableFrontend',
	'backend' => 't3lib_cache_backend_FileBackend',
	'options' => array(  
 	)
);
if($_SERVER['T3_USEMEMCACHE']){ 
	$mserver = $_SERVER['T3_MCACHESERVER'] ? $_SERVER['T3_MCACHESERVER'] : 'localhost:11211';
	$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_pages'] = array (
		'frontend' => 't3lib_cache_frontend_VariableFrontend',
		'backend' => 't3lib_cache_backend_MemcachedBackend',
		'options' => array(
			'servers' => array($mserver), 
		)                       
	);    
	$TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations']['cache_pagesection'] = array (
		'frontend' => 't3lib_cache_frontend_VariableFrontend',
		'backend' => 't3lib_cache_backend_MemcachedBackend',
		'options' => array(                        
			'servers' => array($mserver),
		)   
	);  
}
// cachingframework-Memcached - END 

Take a look at line 9 – I use such settings to make configurations on server / environment level – you can then set this variables in the a .htaccess file or – as I use to do it – in the vHost config:

# Use memcache extension for caching
SetEnv T3_USEMEMCACHE 1 

If you have inserted the code into your localconf.php file and hit the refresh-button, you’ll get this;

Now, MAMP Pro comes with the memcache extensions enabled – unfortunately it doesn’t work. (it’s 32Bit, not 64Bit…)

After digging around a bit I finally could make it run. This article of Leon Barrett was the key to success. I am using MAMP Pro Version 2.0 so a few paths are different. That’s why I decided to create this article so you don’t have to make the same mistakes as I did…

Install Xcode

First, you need to download the free Xcode from the App-Store. What you download is only the installer – install it after download! After installing Xcode, you are ready to compile memcache for MAMP. Most parts of the following steps are taken from Leon’s Website.

Step 1 – Make the MAMP php files executable

sudo chmod +xrw /Applications/MAMP/bin/php/php*

Step 2 – Switch to the download directory

cd ~/Downloads/

Step 3 – Download the memcache source

curl http://pecl.php.net/get/memcache-2.2.5.tgz > memcache-2.2.5.tgz

Step 4 – Unpack the source and go into the folder

tar -zxvf memcache-2.2.5.tgz
cd memcache-2.2.5

Step 5 – PHPize the Memcache extension files

/Applications/MAMP/bin/php/php5.3.6/bin/phpize

Step 6 – Compile the Memcached extension

CFLAGS=‘-O3 -fno-common -arch i386 -arch x86_64 -g -Os‘ LDFLAGS=‘-O3 -arch i386 -arch x86_64′ CXXFLAGS=‘-O3 -fno-common -arch i386 -arch x86_64 -g -Os‘ ./configure –disable-dependancy-tracking –disable-shared -enable-static

make

Step 7 – Copy the extension into MAMP

sudo cp modules/memcache.so /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/.

Step 8 – Add the extension to the php.ini file

To do this open the MAMP application, go to File > Edit Template > PHP > PHP 5.3.6 php.ini
Search for „; Extensions“ and add the following line:

extension=memcache.so

Step 9 – Configure Memcache

Somewhere in this file, you need to configure Memcache. I used the configuration proposed by Dmitry Dulepov which works just fine for me:

memcached.allow_failover 1
memcached.chunk_size 32768
memcached.default_port 11211
memcached.hash_function fnv
memcached.hash_strategy consistent
memcached.max_failover_attempts 20

Save the file, stop MAMP and start it back up. Take a look inside your php log to see if there were any errors starting up.

Step 10 – Start Memcached

memcached -d -m 8 -M -p 11211

You can stop memcached with „killall memcached“

Enjoy

Hit the refresh-button on your website again – it shines in memcached glory!

Now, memcache needs to be started manually each time you start MAMP. The should be ways to automate this – but I couldn’t make it work…