ryu's blog just a few lines of code

13Oct/110

HOWTO Compile Objective-C in Ubuntu (11.04)

To compile Objective-C code in Ubutnu, just install gcc, gobjc, gnustep and clang.
The actual compile process for a file eg. called code.m starts with the following line:

# gcc -o code code.m -I /usr/include/GNUstep/ -L /usr/lib/GNUstep/ -lgnustep-base -fconstant-string-class=NSConstantString

But, in my case there was an error: 'error: #error The current setting for native-objc-exceptions does not match that of gnustep-base ... please correct this.'
To solve this problem, do the following:

# vim /usr/include/GNUstep/GNUstepBase/GSConfig.h

:set nu

Go to line number (in my case) 221, or search for:

#define BASE_NATIVE_OBJC_EXCEPTIONS 1

Replace the line with:

#define BASE_NATIVE_OBJC_EXCEPTIONS 0

Now the compiler should work without problems! :)

21Sep/110

HOWTO: Install PHP Memcache on Ubuntu

Update, install new software an restart Apache:

# apt-get update && apt-get upgrade

# apt-get install memcached php5-memcache

# /etc/init.d/apache2 restart

Now test it. Start a new memcache instance:

# memcached -u root -d -m 24 -l 127.0.0.1 -p 11211

This instance starts as root user using 24 MB as maximum cache size, listening on port 11211.
On my system, I have this process running now:

13919 ? Sl 0:00 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1

We can test our running memcache process by connecting via Telnet:

# telnet 127.0.0.1 11211

An overview of the availiable commands, you can find here: http://lzone.de/articles/memcached.htm
If you like to change your default memcached configuration, do the following:

# vim /etc/memcached.conf

Don't forget to restart memcached afterwards:

# /etc/init.d/memcached restart

At this point you would have to start all memcached instances manually. That's a thing I wouldn't like to worry about. So move the commands to rc.local:

# vim /etc/rc.local

Add lines like this before 'exit 0':

memcached -u your-user-name -d -m 16 -l 127.0.0.1 -p 11211

Make sure every instance listens on a different port. For example: 11211, 11212, 11213... etc.

28Aug/110

Debian: Change system language

# apt-get update

# apt-get install debconf

# dpkg-reconfigure locales

Tagged as: , No Comments
16Jun/110

Fully functional Flash Player on Ubuntu (Firefox/Chrome)

Replace libflashplayer.so in /usr/lib/flashplugin-installer/ with the file you can download here:
http://labs.adobe.com/downloads/flashplayer10_square.html

Why? - For example youtube.com worked for me, but grooveshark.com or livestation.com didn't. - Now everything works fine!

6May/113

Skype logo missing on Gnome Panel in Ubuntu 11 with Classic Desktop

How so solve this problem? - Just do the following:

Press ALT+F2, and enter:

gconftool --recursive-unset /apps/panel

After the system being busy for a moment, press ALT+F1.
Your Skype icon should be visible again!

Tagged as: , , 3 Comments
15Apr/111

Replace a string in a file in CLI (Command Line), Linux

For instance, you would like to replace 'abc' with 'def' everywhere in your file, do the following:

cat file1.txt | sed -e 's/abc/def/' > file2.txt

8Apr/110

Very short HOWTO: LAMP on Ubuntu 10.10 for Typo3

apt-get install apache2 php5 libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql php5-mysql phpmyadmin php-pear php5-dev imagemagick libmagickwand-dev

Tagged as: , No Comments
15Mar/110

HOWTO: Install ImageMagick (IMagick) for PHP on Ubuntu

If you don't have it installed already, install PEAR:

# sudo apt-get install php-pear

Install the Imagick packets:

# sudo apt-get install imagemagick libmagickwand-dev

If you don't have the PHP5 development packet on your server, you maybe also need to install the following packet:

# sudo apt-get install php5-dev

Now we can install Imagick via PECL:

# sudo pecl install imagick

At this point we have to tell PHP to use Imagick. We can achieve this by putting the following line in the php.ini config file. Just put it at the end of the file. Mine is located at /etc/php5/apache2/php.ini.

extension=imagick.so

We're nearly done. Restart your Apache2 server now:

/etc/init.d/apache2 restart

That's it! ;)

30Mar/100

Make Nagiosgrapher graphs availiable in Nagios3 web interface on Ubuntu

Change or insert the following lines in /etc/nagios3/nagios.cfg

process_performance_data=1
service_perfdata_command=ngraph-process-service-perfdata-pipe

12Mar/100

Check CPU virtualization capability on Linux

egrep '(vmx|svm)' --color=always /proc/cpuinfo