Google Analytics

Pages

Monday, April 26, 2010

install memcached on Fedora

I recently decided to benchmark memcached (which is straightforward to use with Zend Framework, there is a nice tutorial here and Zend Framework documentation is available here)

This post walks through the steps needed to install the libevent, memcached and PECL memcache libraries on our server (Fedora).

1) Install  libevent

a) fetch the files on monkey.org
wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz

b) tar zxvf libevent-1.4.13-stable.tar.gz

c) ./configure –prefix=/usr/local
we are requesting libevent to install itself under /usr/local/lib/. When we compile memcached, we need to point it to the correct location as well.

d) make

e) make install

2) Install Memcached

a) Download the file from memcached website
wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz

b)  tar zxvf  memcached-1.4.5.tar.gz

c) ./configure –with-lib-event=/usr/local/

d) make

e) Make install

I then ran into the following error, when testing "memcached" command line
error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or director

libevent needs to be registered..

3) Register libevent

a) create the file /etc/ld.so.conf.d/libevent-i386.conf

b) add the following line
/usr/local/lib/

c) save the file, and reload configuration:
ldconfig

You can then test memcached with the following command line, which starts the daemon:
memcached -d -u apache -m 1024 -l 124.0.0.1 -p 11211

d) you want to ensure that the daemon starts automatically each time you reboot the server: create /etc/rc.d/init.d/memcached

e) add the following lines to the file and save:
#!/bin/sh -e
memcached -d -u apache -m 1024 -l 124.0.0.1 -p 11211

You are now ready to use memcached with PHP

4) Install the PECL extension


a) Get the latest memcache package from PECL directory

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

b) tar zxvf memcache-2.2.5.tgz

c) cd memcache-2.2.5

d) phpize

e)  ./configure

f)  make && make install

g) add the following extension in php.ini

 extension=memcache.so


.... And restart the server.
 

Sunday, April 25, 2010

Replace link with content

Replace "links" with content has been around for a while. But Embd.ly makes it really easy! definitely something to look into seriously as soon as I get some time.

Friday, April 16, 2010

blank row in datagrid

ActionScript returns systematically a blank row when displaying a datagrid, which is kind of annoying...

When I searched in Google for this issue, I could find plenty of posts, on stackoverflow.com, http://www.actionscript.org/, but none were satisfactory - solutions look more like hacks than fixes in my opinion.

So digging a bit in the documentation, I found a useful attribute for DataGrid:
lockedRowCount

Set it to the number of rows you need to display, et voila!

FlexSpy, the Firebug for Flex..

Very nice tool for all flex developers out there: FlexSpy

Having to compile each time you want to adjust the UI is a real pain, so here comes a very handy tool!

Website uptime / speed

Pingdom is an easy to use online tool which let you check how fast your site loads in average, providing with nice reports. The tool can be set up to check your site every minute, and send you alerts when the site is down, or slow - and send you daily/weekly reports about how well your site is responding.

There are many similar tools available, but I personally find this one very friendly to use, sexy and easy to set up. 

Saturday, April 10, 2010

trace with FlasDevelop

If you are using FlashDevelop for your Flex project, you'll probably come across the issue soon or later: how to run the application in debug mode.

Flex comes with an handy function, trace();
http://livedocs.adobe.com/flex/3/html/help.html?content=logging_08.html

In order to see the trace in your FlasDevelop output, you need to use a custom version of this function trace

FlashDevelop comes with a few packages available at :
/[Flash Develop Folder]/Library/AS3/classes/org/flashdevelop/utils

1) Add these packages to your project
import org.flashdevelop.utils.*

2) instead of writing trace (), use FlashConnect.trace() instead
e.g.: FlashConnect.trace("hello world");

That's it!

Blue screen - forgot to backup your data

In case you need to retrieve data from a PC when Windows doesn't work any more (blue screen, etc..), there is a useful utility which allows you to plug in an OS from a CD: Slax

1) download Slax for CD
2) burn the ISO file on the CD
3) Put the CD in the target PC
4) Restart the PC

Share it