Search

10 July 2009

Membuat Fungsi Seperator

Berikut contoh sumber kode untuk fungsi separator (biasa digunakan untuk penjumlahan mata uang) :

function separator($num, $suffix = '') {

$ina_format_number = number_format($num, 3, ',','.');
$result = str_replace(',000',$suffix,$ina_format_number) ;

return $result ;
}

// How To Use
$num = "2000000" ;

echo separator($num) ; // output : 2.000.000
echo separator($num,',-') ; // output : 2.000.000,-

Selamat Mencoba,!!...dikutip dari www.kohaci.com

09 July 2009

Trik Menghapus Method Index di Pemrograman Code Igniter (Kasus : Pagination)

Umumnya jika membuat pagination di Code Igniter, dasarnya seperti ini :

class Blog extends Controller {

public function __construct() {
parent::Controller();
}

public function index() {
$this->load->library('pagination');

$config['base_url'] = site_url('blog/index') ;
$config['total_rows'] = '200';
$config['per_page'] = '20';

$this->pagination->initialize($config);

echo $this->pagination->create_links();
}

}

Tautannya akan membentuk seperti ini :

www.example.com/blog/index/10

Dengan Blog sebagai nama class dan index sebagai nama method. Permasalahannya saat ini gw pengen menghapus nama methodnya, sehingga di URL akan kelihatan seperti ini :

www.example.com/blog/10

Cara dengan menambahkan method _remap() , source codenya akan seperti ini :

class Blog extends Controller {

public function __construct() {
parent::Controller();
}

public function index($page = 0) {
$this->load->library('pagination');

$config['base_url'] = site_url('blog') ;
$config['total_rows'] = '200';
$config['per_page'] = '20';
$config['cur_page'] = $page; // Halaman terakhir yang dilihat

$this->pagination->initialize($config);

echo $this->pagination->create_links();
}

// Method untuk menyederhanakan URI
public function _remap($method) {
$this->index($method) ;
}
}

Selamat Mencoba....dikutip dari www.kohaci.com

01 June 2009

Panduan Instalasi Ubuntu 8.04

Sebelum melakukan instalasi ubuntu 8.04, persiapan untuk komputer yaitu:
a) Memory / RAM Lebih dari 256 MB
b) Space Harddisk untuk ubuntu diatas 4 GB

Langkah 1:
Siapkan CD Installer Ubuntu 8.04 LTS (LIVE CD atau Alternate) , Jika belum memiliki dapat di
download Ubuntu 8.04 Desktop yang berbentuk *.iso, Burn ISO image ke CD blank yang telah selesai di download, Anda dapat menggunakan Nero, Power ISO, atau CD Burner XP, bagi yang pakai linux desktop KDE bisa menggnakan K3B, di Gnome dapat menggunakan Gnome Baker.

Langkah 2:
Masukkan CD Installer Ubuntu 8.04 ke CD Rom Drive, lalu restart PC atau Notebook anda kemudian Pilih Bahasa yang ingin anda gunakan, disarankan memilih bahasa default installer yaitu English.

Langkah 3:
Kemudian pilih "install Ubuntu" yang berada di baris kedua opsi penginstallan, lihat gambar

Langkah 4:
Tunggu CD installer Loading sampai selesai lalu Pilih bahasa yang ingin digunakan selama instalasi, pilih aja di bagian kiri dari jendela, lalu klik "forward"

Langkah 5:
Pada layar selanjutnya akan muncul Peta dunia, tentukan lokasi dimana anda berada, dan ini akan menentukan Jam dan Tanggal komputer anda, pilih Jakarta untuk WIB, Makassar untuk Wita, dan Jayapura untuk WIT, klik "forward"

Langkah 6:
Memilih keyboard, secara default keyboard akan memilih US. english, dan mayoritas keyboard
komputer yang beredar di Indonesia menggunakan Layout ini, Jika belum yakin dapat mencoba
mengetikkan beberapa tombol di bar yang telah disediakan di agian bawah layar, setelah yakin klik "forward"

Langkah 7:
Langkah berikut ini biasanya menjadi momok bagi yang baru nginstall linux, karena jika salah klik bisa memformat Hardisk ,jadi sebelum melakukan instalasi Back-Up terlebih dahulu data-data penting anda ke DVD atau FlashDisk atau HardDisk external.
Pada layar ini akan muncul 3 opsi yaitu:
1. "Guided - resize the partition and use the freed space"
Jika anda telah men dan masih ingin tetap terinstall di Hardisk anda maka pilihlah opsi ini.

2. "Guided - use entire disk"
Jika Hardisk anda baru, atau ingin menghapus semua OS yang sebelumnya terinstall dan
data-data didalamnya, maka pilihlah opsi ini

3. "Manual"
Opsi yang paling sering digunakan dalam instalasi Linux, opsi ini dipilih jika tidak ada OS yang
sebelumnya terinstall, dan tidak ada data penting, sama seperti opsi kedua, namun opsi ketiga
ini Anda bebas menentukan besaran (kapasitas) hardisk yang ingin anda gunakan: bagi yang
ingin menggunakan opsi ini harap mengikuti panduan berikut:
a. membuat partisi root
• pilih partisi di hardisk tertentu yang akan dipakai untuk Ubuntu yang baru akan
diinstall, klik "delete partition" maka akan partisi tersebuta akan menjadi " free
Partition"
• untuk hardisk baru yang beum diformat maka akan secara default menjadi "free
partition"
• lalu pilih partisi tersebut dan klik "New Partition" untuk membuat partisi root yang
baru, untuk Type For the New partition pilih Primary, lalu tentukan Kapasitas yang
kan anda alokasikan pada tab size dalam MB, sebagai contoh ketik 3000=3GB,
5000=5GB dan seterusnya, lewatkan opsi Location dan Use as (biarkan secara
Default) lalu pilih Mount Point di "/" .

b. membuat partisi home (optional/tidak harus dibuat)
• sama seperti membuat partisi root, hanya untuk Type for the New Partition
sebaiknya pilih "logical" bukan "primary"
• dan untuk Mount Point pilihlah home.

c. Membuat partisi swap
• sama seperti membuat partisi sebelumnya, dengan pilihan Type for the New
partition di "logical"
• untuk size maka sangat dianjurkan sebesar 2x RAM, kalau punya Ram 512 MB,
berarti size partisi swab anda adalah 1024MB Untuk Mount Point pilih swap
• setelah itu klik forward, dan sekali lagi kami ingatkan bahwa partisi yang anda buat
nanti akan diformat, dan datanya tidak dapat ter"recover lagi" jadi pastikan data
penting anda sudah di Back-Up.

Langkah 8:
Mengisi profil
pilih real name, terserah saja,
untuk menentukan username dan password login ke ubuntu anda, kalau anda termasuk tipe orang yang "sangat pelupa" ya siapkan pena dan kertas untuk mengingat username dan password yang telah anda isikan.klik forward

Ubuntu Siap untuk Diinstall "Ready to Install" klik install

Langkah 9:
Ubuntu akan menyelesaikan proses penginstalan kurang dari 10 menit tergantung dari spesifikasi PC atau Notebook anda

Tunggu sampai muncul jendela konfirmasi Instalasi success seperti dibawah ini lalu klik "Restart Now"

SELAMAT UBUNTU 8.04 SUDAH TERINSTALL, loginlah dengan username dan password yang
telah anda pilih, jangan sampai lupa.




22 May 2009

HTTP Proxy

8.1. General configuration

Through HTTP Proxy → General you can access into the eBox's proxy HTTP general configuration.

At the configuration window these options are detailed:

Transparent proxy

If transparent proxy is enabled, every eBox user will use the transparent proxy without noticing it. If it is disabled, you should configure each browser to work through the proxy.

Warning

Transparent proxy feature is only working when eBox has at least an internal and an external interface

Port

You can assign a proxy port. It will be used by the browsers, inside the network, to connect to Internet.

Default policy

It is the default policy for the proxy users. Free (allow all) access, filter contents or always deny access can be selected. Later, this policy can be modified for each network object where you need an specific behaviour, as it is explained below

Warning

If you establish a configuration which denies access to administration interface from the machines connected to eBox, you should allow the host where you want to connect from, or you could lose the connection with the web interface.

8.2. Filter settings

At HTTP Proxy → Filter settings, you can select the filter settings to those elements of this network which set their policy to filter.

Warning

The filter needs a 'filter' policy to be in effect

You may set the content filter threshold which establishes a restriction level to web contents with explicit sex and violence items to be filtered by the proxy.

To perform a more detailed filter policy. A tab menu is shown with the following elements:

File extensions filtering

You may choose which file extensions are allowed to be downloaded through the HTTP proxy. To allow extensions you must edit the row and check the box in the Allow element. A special "All extensions" form exists to apply the same policy to all extensions at once. You may add as many extensions you require by adding new ones. Several ones are set by eBox.

Any extension not listed here is, by default, allowed. In future releases, this behaviour may change.

MIME type filtering

You may select which file MIME types are allowed to be downloaded through the HTTP proxy. The management is analogous to the extension filtering explained above.

Domains filtering

You may customise which domains are allowed or denied to visit by editing the table Domains list. Write the full domain name, whose default behaviour you require to change. The domain name does not require the "www" string. For instance, you add as allowed domain "www.warp.es", we'd set "warp.es" domain.

Furthermore, you may block those domain sites which are not in the domains list overriding default allowance policy. It also let block those sites which does not have a fully qualified name (FQDN) and, therefore, they use an IP address to access to their content

8.3. Policy establishment

Through HTTP Proxy → Objects' Policy it is possible to establish one connection policy for every network object, allowing a different configuration for each newly created objects. This configuration will be applied previously to the eBox global policy for the selected objects.

Firewall

6.1. Firewall in eBox

One of the most important features in eBox is its firewall module. You can access it through Firewall . There you can make packet filtering (Section 6.3) or port redirection (Section 6.2).

The firewall has different behaviour with external or internal network interfaces.

The internal interfaces are connected to local networks. They had not restrictions as the external interfaces have.

The external interfaces are connected to external networks and eBox only allows redirections from them.

6.2. Port Redirects

Port redirects allow to get external traffic into a host behind a eBox system with firewall module installed. You can get the configuration of these options at Firewall → Redirects .

If you need to add a new redirect, first select your desired Interface which will listen incoming connections. This should be one of the interfaces previously selected as external. Moreover, it should be assigned the External port where you expect your incoming traffic, and the protocol that will be used.

You should enter the destination system IP address and its Port where packets would go on.

Once you have selected this data, you just need to select between the different Actions, the Add one, and click on it.

To remove a rule, you should select remove between the available Actions, and click on it.

Redirect configuration can be modified by changing its parameters and clicking on their modify Actions.

6.3. Packet filter

From Firewall → Packet filter you can configure packet filter rules. You may use the abstractions provided above such as network services and network objects. Using these concepts enhances the rules flexibility and clearness, reducing the amount.

At first sight, we have five different traffic flows to set your firewall rules to them.

From internal networks to eBox

These rules are meant to control access from internal network interfaces to services running on your eBox machine. Several eBox modules may add filtering rules for you to manage eBox services easily.

For internal networks

These rules allow you to control access from your internal networks to the Internet, and traffic between your internal networks.

Coming out from eBox

These rules allow you to control access from eBox to external services.

From external networks to eBox

These rules allow you to control access from external networks to services running on your eBox machine.

From external networks to internal networks

These rules allow you to control access from external networks to internal networks.

Take into account to the last two set of rules that it is granted access to untrusted networks to your managed networks. This may compromise your network security. As eBox secure by default policy recommends, do not modify these rules unless you know what you are doing. The figure Figure 6.1 try to make up the concept:

Figure 6.1. Firewall rules set

Firewall rules set

The deny policy for eBox firewall is a ignorance one. Every denied packet is filtered and discarded without any notification.

Every set of rules define a fixed behaviour for the traffic flows that they apply. These rules will be matched from top to the bottom, thus order is important. Each rule consists of these following fields, some of them are only available to several rule set by construction:

Decision

Accept or deny. This explicitly accepts or denies a traffic flow.

Source

The traffic flow origin. It may be a network object or a single IP address. This field is available for every rule set except for "Filtering rules for traffic coming out from eBox"

Destination

The traffic flow target. It may be a network object or a single IP address. This field is available for "For internal networks", "Coming out from eBox" and "From external networks to internal networks" filtering rules.

Service

The traffic flow service as it is described in Chapter 5. The match could be inverse one, i.e. the inverse "any" service is "none" service. This is a compulsory field, therefore in order to create a new rule, it is required to have a network service. If it does not exist, you must make up previously.

Description

An optional description to ease the firewall rule set management.

Tentang Penulis

My photo
Tangerang, Banten, Indonesia
Luchu bgt ngga cih..

Komentar


ShoutMix chat widget

Tomy Kurniawan © 2008