Saturday, November 24, 2012

Contributing to Libreoffice

well, Patching of Libreoffice is a commitment from a wide range of users. Below is a response of a contributor on how he contributes. =======
When I work, I frist create a branch out of a point in master (preferably a oen that build nicely :-) ) so nwo I'm on branch 'foo' for example. I code my patch, then I submity it to gerrit via git push origin foo:refs/for/master then I checkout out master again... and keep going... When the review comes and modification to my patch are needed, I checkout out the branch foo again... the I make the modifications and 'amend' the commit (which _is_ the commit I pushed to gerrit) and then push it again using the same command. rince and repeat until the patch is ready... then I let gerrit cherry pick it on top of master.. if ok, then I can delete the foo branch locally if the cherry pick failed because of a conflict... I fetch ./g fetch and then rebase foo : git rebase origin/master (while being on the foo branch) since the cherry pick from gerrit failed, that rebase should exibit some conflict, with I resolve using git mergetool then one can re-push the patch to gerrit, again using the same command as above.. rince and repeat until the cherry pick from gerrit works If one has commit right, then the last phase can be dealt by bringing the patch to master locally and simply pushing to master

Thursday, November 22, 2012

Change MySQL database directory

Why do I need to change MySQL database directory or location?

  1. Current disk is out of space
  2. Current partition is out of space
  3. There is a better filesystem to improve disk IO performance.
Steps to do this on Centos 6 with SELinux enforced.

Step 1: Stop MySQL server

Step 2: Create the new directory

A new directory can be created in the new disk or partition.

Step 3: Copy existing database to new location
 mv /var/lib/mysql/* /srv/mysql/

Step 4: Configure MySQL server
Edit /etc/my.cnf with following

datadir=
socket=

[client]
socket=

Save and close the file.

5. Configure SELinux to allow new database
View current settings

setstatus
ls -lZ /var/lib/mysql
ls -lZ

Edit settings with e.g. as /media/server/mysql

semanage fcontext -a -t mysqld_db_t "/media/server/mysql(/.*)?"
OR
chcon -R -t mysqld_db_t /media/server/mysql

restorecon -Rv /media/server/mysql

Check settings are in the config file

grep -i mysql /etc/selinux/targeted/contexts/files/file_contexts.local

6. Start up MySQL
I had to reboot the server and change selinux to permissive for all this to work.

Wednesday, November 21, 2012

Linux welcome messages

Securing the Linux terminal includes telling users that they may not access the system without authorisation.

Edit following files for this purpose;

  1. /etc/motd
  2. /etc/issue
  3. /etc/issue.net

For items 2 and 3, they only work if you are connected at the terminal or have client server setup. Those using SSH, messages can be set to point to item 3 in the configuration file /etc/ssh/sshd_config


Sunday, November 18, 2012

Howto Yii 1, a PHP framework

This framework seemed worth while to test out. Steps to get started is as follows;

Step 1: Install the framework.
From the www.yiiframework.com site, follow the instructions for pre-requisite to install the Yii framework. Typically you will need

  1. Apache web browser
  2. PHP 5.1 and newer
  3. PHP PDO
  4. A database


Download Yii-1.1...tar.gz (in tar.gz format) from http://www.yiiframework.com/download/
Extract the tar.gz file to the web folder /var/www/html/yii1

It is also a good point to download the Yii-docs-1.1...tar.gz and extract it to follow its references and tutorials in PDF.

Step 2: Create the skeleton of a new web app.
At the prompt, access the framework's directory /var/www/html/yii1/framework

Type the following:
./yiic webapp ../testdrive

or in windows
yiic webapp ..\testdrive

Open a web browser and access the testdrive application
http://localhost/yii1/testdrive

Step 3: Configure the timezone for the web app.
If an error on the timezone appears, complete following steps

vi /var/www/html/yii1/testdrive/protected/config/main.php

Just before the last line, add the timezone.


'timeZone'=>'Asia/Kuala_Lumpur',
);

Access the testdrive application with the web browser, the error on timezone is gone. It does inform users the following;


You may change the content of this page by modifying the following two files:

View file: C:\Program Files\www\yii1\testdrive\protected\views\site\index.php
Layout file: C:\Program Files\www\yii1\testdrive\protected\views\layouts\main.php



Step 4. Understanding the structure
It is good to know the directories built for the testdrive web application under /var/www/html/yii1/testdrive. From here on, I will refer to the directory /var/www/html/yii1/testdrive as

/index.php
/index-test.php
/assets/  <=Empty
/css/  <=Contains 5 basic CSS files and a bg.gif file
/images/  <=Empty
/protected/  <=This is where your coding goes
/themes/  <=Several directories that is empty

Step 5. The database, mysql
Create a database named yii_testdrive, and load in the SQL from
/protected/data/schema.mysql.sql

By default it has the SQLLITE as its database, edit the file /config/main.php and comment out the following lines


'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),

Uncomment the mysql lines below it and edit the database connection


'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=yii_testdrive',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
),



Step 6. Generating the pages based on the database

Uncomment the GII web-based code generator and change the default password to MyPassword


'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'MyPassword',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),



Open a web browser and point to the gii resource
 http://localhost/yii1/testdrive/index.php?r=gii

A login page appears, type the password as
MyPassword

You are then presented with the following to auto generate codes based on your database.


  1. Controller Generator
  2. Crud Generator
  3. Form Generator
  4. Model Generator
  5. Module Generator



Thats all for now...will continue when time permits.