15 tháng 8, 2009

HOWTO – Apache2 + Subversion + SSL

sucess-subversion-apache2-ssl-ubuntu-710-with-users
ubuntu-install-php5-mysql-apache2-ssl-pdo-pdo_mysql
http://linuxhappy.wordpress.com/2008/01/21/sucess-subversion-apache2-ssl-ubuntu-710-with-users/
http://www.theatons.com/ubuntu-install-php5-mysql-apache2-ssl-pdo-pdo_mysql
-->đọc tiếp...

14 tháng 8, 2009

Flashplayer for UBUNTU x32 & x64

To install it download from here:
http://labs.adobe.com/downloads/flashplayer10.html

cd
tar xvzf libflashplayer-10.0.22.87.linux-x86_64.so.tar.gz
mkdir -p .mozilla/plugins
mv libflashplayer.so .mozilla/plugins
Restart firefox. Go to about:plugins to check (^_^)

cách khác:
#!/bin/bash
# Script created by
# Romeo-Adrian Cioaba romeo.cioaba@spotonearth.com
# Super minor updates by jason.melton[at]gmail[dot]com
# Released under GPL

echo "Stopping any Firefox that might be running"
sudo killall -9 firefox

echo "Removing any other flash plugin previously installed:"
sudo apt-get remove -y --purge flashplugin-nonfree gnash gnash-common mozilla-plugin-gnash swfdec-mozilla libflashsupport nspluginwrapper
sudo rm -f /usr/lib/mozilla/plugins/*flash*
sudo rm -f ~/.mozilla/plugins/*flash*
sudo rm -f /usr/lib/firefox/plugins/*flash*
sudo rm -f /usr/lib/firefox-addons/plugins/*flash*
sudo rm -rfd /usr/lib/nspluginwrapper

echo "Installing ia32-libs and nspluginwrapper"
sudo apt-get install ia32-libs nspluginwrapper

echo "Getting libs"
sudo getlibs -p libcurl3
sudo getlibs -p libnss3-1d
sudo getlibs -p libnspr4-0d

echo "Installing Flash Player 10"
cd ~
wget http://download.macromedia.com/pub/labs/flashplayer10/flashplayer10_install_linux_081108.tar.gz
tar zxvf flashplayer10_install_linux_081108.tar.gz
sudo cp install_flash_player_10_linux/libflashplayer.so /usr/lib/mozilla/plugins/
rm -rf ~/install_flash_player_10_linux/
sudo nspluginwrapper -i /usr/lib/mozilla/plugins/libflashplayer.so

echo "Linking the libraries so Firefox can find it."
sudo ln -sf /usr/lib/nspluginwrapper/plugins/npwrapper.libflashplayer.so /usr/lib/mozilla/plugins/
sudo ln -sf /usr/lib/nspluginwrapper/plugins/npwrapper.libflashplayer.so /usr/lib/firefox-addons/plugins/

echo "Done :-)"
-->đọc tiếp...

13 tháng 8, 2009

Software RAID Ubuntu

Step 1: Prepare the Disks:
http://forum.niit.vn/showthread.php?t=9201
http://vozforums.com/showthread.php?t=149812
http://ultimateedition.info/
root@iscsi:/# fdisk -l
Disk /dev/sda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000185b0
Device Boot Start End Blocks Id System
/dev/sda1 * 1 617 4956021 83 Linux
/dev/sda2 618 652 281137+ 5 Extended
/dev/sda5 618 652 281106 82 Linux swap / Solaris

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x90f9feaa
Device Boot Start End Blocks Id System
/dev/sdb1 1 1044 8385898+ 7 HPFS/NTFS
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x4430ddbd
Device Boot Start End Blocks Id System
/dev/sdc1 1 131 1052226 7 HPFS/NTFS
/dev/sdc2 132 2610 19912567+ 7 HPFS/NTFS

Disk /dev/sdd: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Disk /dev/sdd doesn't contain a valid partition table
Disk /dev/sde: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Disk /dev/sde doesn't contain a valid partition table
Disk /dev/sdf: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Disk /dev/sdf doesn't contain a valid partition table
root@iscsi:/#
Step 2: Creating the md Device using mdadm (Mirrored Device Admin)
Cài bộ quản lý mdadm
Trích:
sudo apt-get install mdadm
tạo device (ở đây mình dùng hẳn 1 hard disk; nếu các bạn dùng 1 partition thì thêm số vào sau tương ứng, sda1, sdb1, ...)
Trích:
sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdd /dev/sde /dev/sdf
Tạo file Config:
Trích:
sudo echo "DEVICE partitions" > /etc/mdadm/mdadm.conf
sudo mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Tạo file system
Trích:
sudo mke2fs -j /dev/md0
Add vào fstab để tự mount khi boot (nhớ tạo thư mục /var/media trước khi mount nhé).
Trích:
/dev/md0 /var/media auto defaults 0 3
Kiểm tra:
Trích:
root@iscsi:/# sudo watch cat /proc/mdstat
Every 2.0s: cat /proc/mdstat Mon Mar 3 00:47:49 2008

Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sde[2] sdd[1] sdf[0]
2097024 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

unused devices:

Để tăng dung lượng RAID băng cách thêm đĩa:
Trích:
mdadm --add /dev/md0 /dev/sdg
mdadm --grow /dev/md0 --raid-devices=4
resize:
Trích:
fsck.ext2 /dev/md0
resize2fs /dev/md0
-->đọc tiếp...

12 tháng 8, 2009

Dispatching Custom Events in AS3 with data or object

detail here
to send custom information or data to the listener object when a custom Event is going to be dispatched. So here is what i have done to achieve the same

The flash new Event mechanism provides you a facility to create a new event and the default constructor call is something like this

Event(type:String, bubbles:Boolean = false, cancelable:Boolean = false)

so there is no by default parameter to send information across the dispatcher and listener objects ( Other than using event.target.*** method on listener end).

Following is the code i have done for overcome this

Create a CustomEvent.as Class as following

package eventsSystem {
import flash.events.Event;

public class CustomEvent extends Event {
public static const ONLOADED:String = “OnLoaded”;
//———– Define your custom Event string constant

public var data:*;
//————- Define a data variable of * type to hold any kind of data object


//———— Constructor
public function CustomEvent(type:String, data:*){
this.data= data;
super(type);
}
}
}

Now what we have done here is to create a new CustomEvent class that is extended from flash.events.Event class and have put a variable to hold information we want to send to listeners called “data”. We have kept data of * type so that it can take any kind of information

Now call Super(type) to register it with Events system

Now you need to use the following to dispatch events using CustomEvent

dispatchEvent(new CustomEvent(CustomEvent.ONLOADED, data ));

on The listener end you can use it like this

_loaderObj.addEventListener(CustomEvent.ONLOADED,setXML,false,0,true);
// To register your object to listen to custom event

//——— Method invoked after custom event is listened ————

private function setXML(evt:CustomEvent):void{
var _XML:XML = new XML(evt.data);
}

So now you can directly pass your data along with the custom Events.
-->đọc tiếp...

The Model-View-Controller Design Pattern in Actionscript 3

The-Model-View-Controller
http://en.wikipedia.org/wiki/Model_view_controller

The MVC Design Pattern

  • Creates a separation of Class roles
  • Adds a clear and logical communication structure
  • Increases flexibility in larger applications

Model
Handles data storage and retrieval (eg. Store character x position)
View
Handles the display/communication (eg. Position character on stage)
Controller
Handles most the of the application logic (eg. Get current x position)

MVC – basic structure
Each model can have multiple views
Each view has at least one matching controller
Creates a separation between form, content and action
The model becomes the base of the application

Communication Model

Overview of the MVC design pattern
MVC planning example - Pacman Game

Here is a simple application to show MVC in action

Application abstract:
A circle which changes colour randomly every time a button is pressed

Designing the simple application
Overview of basic MVC example

Broken down into the MVC pattern this would look like:

Overview of basic MVC example

Overview of basic MVC example

Download a basic Actionscript 3 MVC example that shows how to move an object around the stage using the keyboard.

Download a basic Actionscript 3 MVC example that shows how to load and display text stored in an external text file.

Download the MVC circle example discussed in the tutorial.

For more on the Model View Controller and other Design Patterns in Actionscript 3 check out 'Actionscript 3 Design Patterns' by William Sanders and Chandima Cumaranatunge.
-->đọc tiếp...
BlogWeb: tạo từ Blog của Google
Nội dung: lấy từ nhiều Nguồn khác nhau.
Mục đích: note lại bài Hướng dẫn hay và Đáng đọc.
Kết quả: nghiện Internet Nặng.
Tương lại: xuống lỗ Vẫn Nghiện nếu không có ai giúp.
Blog Web của: Trí Dũng đến từ Việt Nam - Liên kết đến trang Blog Cá Nhân
Tôi biết (^_^)
Thông tin về Tác giả. Chi Tiết
Sử dụng (FireFox | Google Chrome on Ubuntu) để xem tốt nhất. Học Nhiều Hơn Tại Đây
©2009 Google Blogger - HuuNguyen's Home