Posted by: rainmore | July 2, 2009

VIM Config _vimrc

set nocompatible

set ru
set hls
syntax on
set encoding=utf-8
set backspace=indent,eol,start

set fileencodings=ucs-bom,utf-8,cp936,big5,euc-jp,euc-kr,latin1

set sw=4
set ts=4
set smarttab

set lbr
set fo+=mB

set sm
set cin
set nu

set cino=:0g0t0(sus

if (has(“gui_running”))
set nowrap
set guioptions+=b
colo torte
else
set wrap
colo ron
endif

source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

set diffexpr=MyDiff()
function MyDiff()
let opt = ‘-a –binary ‘
if &diffopt =~ ‘icase’ | let opt = opt . ‘-i ‘ | endif
if &diffopt =~ ‘iwhite’ | let opt = opt . ‘-b ‘ | endif
let arg1 = v:fname_in
if arg1 =~ ‘ ‘ | let arg1 = ‘”‘ . arg1 . ‘”‘ | endif
let arg2 = v:fname_new
if arg2 =~ ‘ ‘ | let arg2 = ‘”‘ . arg2 . ‘”‘ | endif
let arg3 = v:fname_out
if arg3 =~ ‘ ‘ | let arg3 = ‘”‘ . arg3 . ‘”‘ | endif
let eq = ”
if $VIMRUNTIME =~ ‘ ‘
if &sh =~ ‘\ ‘ . arg3 . eq
endfunction

set nobackup
set nowritebackup
set noswapfile

Posted by: rainmore | May 28, 2009

Ubuntu Webcam Installation

Very helpful link http://blog.myfenris.net/?p=377

1 cmd find your webcam device:
lsusb
2 install driver
wget -c http://mxhaard.free.fr/spca50x/Download/gspcav1-20071224.tar.gz
tar xvfz gspcav1­20071224.tar.gz
cd gspcav1-20071224
make clean
make
sudo make install
sudo gedit /etc/modprobe.d/options

or
sudo apt-get install gspca-source
sudo gedit /etc/modprobe.d/alsa-base.conf

add a line
options gspca force_rgb=1

3 sudo apt-get install camorama
sudo lsmod |grep gspca

Posted by: rainmore | February 4, 2009

PHP Open Flash Chart Quick View

Spending 3 hours on Open Flash Chart, it’s a realy chart tool for php. It’s really hard to understand it’s tutorial is hardly understood. However, there are always some short cut. It’s as following.

copy file open-flash-chart.swf,   folder php-ofc-library and folder js to your developing folder

Create a view rada.html at developing folder


<html>
<head>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
var a1 = swfobject;
var a2 = swfobject;
a1.embedSWF(
"open-flash-chart.swf", "my_chart",
"300", "350", "9.0.0", "expressInstall.swf",
{"data-file":"radar-chart.php"} );

a2.embedSWF(
"open-flash-chart.swf", "my_chart1",
"300", "350", "9.0.0", "expressInstall.swf",
{"data-file":"radar-chart.php"} );
</script>
</head>
<body>
<div id="my_chart"></div>
<div id="my_chart1"></div>
</body>
</html>

Then create a data file radar-chart.php developing folder


<?php

include 'php-ofc-library/open-flash-chart.php';
$chart = new open_flash_chart();
$chart->set_title( new title( 'Felix' ) );

$area = new area_hollow();

$area->set_width( 1 );
$area->set_dot_size( 3 );
$area->set_halo_size( 1 );
$area->set_colour( '#FA341F' );

$area->set_fill_colour( '#FE7903' );
$area->set_fill_alpha( 0.4 );
$area->set_loop();

$v1 = 10/20;
$v2 = 35/20;
$v3 = 40/20;
$v4 = 55/20;
$v5 = 90/20;
$area->set_values(array($v1, $v2, $v3, $v4, $v5));

$chart->add_element( $area );

$r = new radar_axis( 5 );

$r->set_colour( '#BEBEBE' );
$r->set_grid_colour( '#D0D0D0' );

$labels = new radar_axis_labels( array('0','10','20','40','50','100') );
$labels->set_colour( '#9F819F' );
$r->set_labels( $labels );

$chart->set_radar_axis( $r );

$tooltip = new tooltip();
$tooltip->set_proximity('a','b','c','d','e');
$chart->set_tooltip( $tooltip );

$chart->set_bg_colour( '#FFFFFF' );

echo $chart->toPrettyString();
?>

I don’t really think folder php5-ofc-library is necessary. It use php to create javascript file and out put <div>.

Posted by: rainmore | January 17, 2009

Build WAMP (httpd.conf Only)

For Apache’s httpd.conf

1. Set “DocumentRoot” to your_path_to_www

2. Set your www folder in <Directroy ” your_path_to_www”>

3. In IfModule mime_module, add following code

ScriptAlias /php/ “$path_to_php_bin”
AddType application/x-httpd-php .php .html
Action application/x-httpd-php “/php/php-cgi.exe

4. Add alias folder, add following line at the end of httpd.cond

Include “path_to_alias/alias/*”

For php.ini don’t forget to put php.ini in your apache bin folder as well as in your xp’s windows folder

Posted by: rainmore | January 17, 2009

Cakephp On IIS

$cake_core_folder = ‘path_to\cake_1.2.0.7296-rc2′;

include everything download from cakephp. In the folder, there are some sub-folder: app, cake, doc, vendor ..

$cake_app_folder =’D:\projects\cake_app\test’; // It’s app folder path ‘D:\projects\cake_app’ + your website’s name ‘test’

In the folder, there are some sub-folder: config, controllers, locale, models,
plugins, tests, tmp, vendors, views …

! remeber to set ‘tmp’ folder to ‘rewirtable’

$cake_webroot_folder = ‘D:\webroot’;

In the folder there are just css folder, files folder, img folder, js folder, css.php, index.php, test.php

1. CONFIG CAKEPHP STRUCTURE — Modify $cake_webroot_folder’s index.php like:
if (!defined(‘ROOT’)) {
//define(‘ROOT’, dirname(dirname(dirname(__FILE__))));
define(‘ROOT’, ‘D:’.DS.’Projects’.DS.’_Cake_APP’); //  use DS to replace ‘/’ in $cake_core_folder and get rid of your website’s name
}

if (!defined(‘APP_DIR’)) {
//define(‘APP_DIR’, basename(dirname(dirname(__FILE__))));
define(‘APP_DIR’, ‘test’); // just use your website’s name as this name
}

if (!defined(‘CAKE_CORE_INCLUDE_PATH’)) {
//define(‘CAKE_CORE_INCLUDE_PATH’, ROOT);
define(‘CAKE_CORE_INCLUDE_PATH’, ‘C:’.DS.’wamp’.DS.’lib’.DS.’cake_1.2.0.7296-rc2′); // use DS to replace ‘/’ in $cake_core_folder
}

!Note: you could simply copy all the file to your web serve root, it works. Above is just an advance configration.
2. CONFIG APPLICATION    — Modify ‘$cake_app_folder’
1). Modify ‘core’ @ ‘config’ folder
a. change Line 153 -> Configure::write(‘Security.salt’, ‘eeeeDYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi’); // Just add some letter to the long string
b. remove ‘//’ @ line 59 Configure::write(‘App.baseUrl’, env(‘SCRIPT_NAME’)); // only for IIS
or add belows after line 59 to support multi server;

if (!define(‘SERVER_APACHE’,false)){
define (‘BASE_URL’, env(‘SCRIPT_NAME’) );
}else{
define (‘BASE_URL’, env(‘SCRIPT_NAME’) . ‘?url=’);
}

For the latest version. Above code does not work any more as cake use App.base_url instead of BASE_URL

2). Change ‘database.php.default’ @ ‘config’ folder to ‘database.php’ and modify
a. for single project just modify ‘$default’ config or you can add new config like ‘$sitename’

3). Copy ‘default.ctp’ layout to ‘APP/views/layouts/’ or create a new layout and put that in the folder ‘APP/views/layouts/’
4). Create or Modify ‘APP/views/pages/home.ctp’ for the default contant page
5). Create or Modify CSS Javascript at $cake_webroot_folder’s CSS folder and JS folder respectively

Posted by: rainmore | January 16, 2009

Config Eclipse for PHP developing

By using Eclipse as PHP developing tool, I quite like to use EasyPHPEclipse rather than PDT.

Also, it’s better to have below plugins to make development easier.
Name: Zend Debugger
URL: http://downloads.zend.com/pdt

Name: JSEclipse
URL: http://download.macromedia.com/pub/labs/jseclipse/autoinstall/site.xml

Name: Subclipse
URL:http://subclipse.tigris.org/update_1.4.x

Categories

Follow

Get every new post delivered to your Inbox.