In the early days of PHP programming, PHP code was limited to being procedural in nature. Procedural codeis characterized by the use of procedures for the building blocks of the application. Procedures offer a certain level of reuse by allowing procedures to be called by other procedures.
However, without object-oriented language constructs, a programmer can still introduce OO characteristics into PHP code. It's a tad more difficult and can make the code more difficult to read because it's mixing paradigms (procedural language with pseudo-OO design). OO constructs in PHP code — such as the ability to define and use classes, the ability to build relationships between classes that use inheritance, and the ability to define interfaces — make it much easier to build code that adheres to good OO practices.
While purely procedural designs without much modularity run just fine, the advantages of OO design show up in the maintenance. Because a typical application will spend the bulk of its lifetime in maintenance, code maintenance is a large expense over the lifetime of an application. It can also be easily forgotten during development. If you're in a race to get your application developed and deployed, long-term maintainability can take a back seat to getting something to work.

Felix 發表在 痞客邦 留言(0) 人氣()















<?php function foo() {

$numargs = func_num_args(); if ($numargs > 2) {

echo "First: ". func_get_arg(0). "\n";

echo "Second: ". func_get_arg(1). "\n";

echo "Third: ". func_get_arg(2). "\n";

} return $numargs;

}
$n = foo (10, 15, 20); //傳入 3 個參數 echo $n; ?>














Felix 發表在 痞客邦 留言(0) 人氣()

PHP 5.4 支持 單引號 轉換 htmlspecialchars htmlentities 
 

var_dump(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES | ENT_XML1));

The result will look like this:
array(5) {
["""]=>
string(6) "&quot;"
["&"]=>
string(5) "&amp;"
["'"]=>
string(6) "&apos;"
["<"]=>
string(4) "&lt;"
[">"]=>
string(4) "&gt;"
}

 
echo htmlspecialchars("&<>\"'", ENT_QUOTES | ENT_XML1);

echo html_entity_decode("&amp;&lt;&gt;&quot;&apos;", ENT_QUOTES | ENT_XML1);
 
 
http://nikic.github.io/2012/01/28/htmlspecialchars-improvements-in-PHP-5-4.html

Felix 發表在 痞客邦 留言(0) 人氣()

APPLIES TO:


  • Parallels Plesk Panel 11.0 for Linux



Felix 發表在 痞客邦 留言(0) 人氣()


Google和Apple同為HTML5的大力推手,繼Apple前陣子推出Safri專屬HTML5測試網站後,Google也推出了HTML5 Rocks網站,名稱真是取的太搖滾了!Oh Yeah!特別的是網站提供了HTML5的API原始碼,讓開發者能邊看邊玩HTML5,手癢的話還能自行修改原始碼來玩。
如果你認為HTML5 Rocks只是另一個普通的HTML5示範網站、或是測試瀏覽器網站,那就錯了,它的功能更像是教學網站,presentation頁面是以投影片展示HTML5功能,最特別的是同時也附上這些HTML5功能的API原始碼,讓開發者具體了解HTML5功能的應用案例。

Felix 發表在 痞客邦 留言(0) 人氣()

Hibernate option in windows 7
In Windows XP enabling Hibernate option was a very easy task. One could navigate to Control Panel, Power Options and then Hibernate tab to enable or disable Hibernation feature. But in Windows 7,  we have to follow a different approach to do the same job.
If you are not aware of Hibernate feature, Hibernation is a power-saving state designed primarily for laptops. While sleep puts your work and settings in memory and draws a small amount of power, hibernation puts your open documents and programs on your hard disk and then turns off your computer. Of all the power-saving states in Windows, hibernation uses the least amount of power. On a laptop, use hibernation when you know that you won’t use your laptop for an extended period and won’t have an opportunity to charge the battery during that time.

So if you are really going to use this feature then you need to enable it by doing a simple procedure as mentioned below:

Felix 發表在 痞客邦 留言(0) 人氣()


一般的無限AP都號稱距離可達50-100公尺,但是會受到建築物的影響而有所減少,如果使用者位於超過AP的發射距離而連外只有一條ADSL又不想另外拉線,WDS就可以派上用場。


什麼是WDS (Wireless Distribution System)
WDS 就是一台AP(a)透過另一台AP(b)連到原來(a)所不能連到的地方。

Felix 發表在 痞客邦 留言(2) 人氣()


首先我們先來看一下網線模塊的樣子,這個就是安裝在牆上網線插座面板後面的模塊。分為左右兩面,上面的A和B表示的是568A和568B兩種不同的線序標準,任選一種即可。(注意:左面和右面要選同一種標準,例如左面選了A,右面也要選A)

打线的工具

Felix 發表在 痞客邦 留言(0) 人氣()

图解电线穿管全过程
在進行室內電線佈置的時候,會進行電線穿管,那麼電線穿管過程是怎樣的呢?

  1. 將做好了的線盒其服帖地嵌入開好的牆體內,注意:接線盒一定要擺放端正,否則外面的面板也會隨之歪斜的。

Felix 發表在 痞客邦 留言(0) 人氣()

How do I install and configure NTP under CentOS Linux version 5.x or 6.x server to synchronize the system clock?

You can easily install NTP (Network Time Protocol, a means of transmitting time signals over a computer network) using the yum command under Red Hat or CentOS/Fedora Linux server or workstation based systems. You need to install the following packages:

Felix 發表在 痞客邦 留言(0) 人氣()


Vmware ESX 4上虛擬機 Redhat 5.2(CentOS 5.2)啟動在Starting udev 停幾個小時
最近在vmware ESX上安裝的Redhat 5.2或者CentOS 5.2基本上都碰到了這個問題
安裝完全完成後啟動是在Starting udev會需要幾個小時才能過去。
網上找到很多說法比方有說讓改"/etc/udev/rules.d/99-vmware-scsi-udev.rules" 文件的,其實這並不是hang住的原因,真正的元兇是:
Clocksource is the name of the new timekeeping subsystem introduced in the Linux 2.6.18 kernel. In this subsystem there are several clocksources that can be used to read the time. One of them is the tsc clocksource which uses the Time Stamp Counter that is present on each processor and can be used to track how much time has elapsed. The TSCs on the different processors are not necessarily perfectly in sync with each other, so time can appear to go backward if the TSC is read on one processor and then another processor. Early versions of the tsc clocksource did not handle this case, which can lead to the guest operating system not responding. Due to the different timing behavior of running in a virtual machine, this can be observed more frequently in a virtual machine.
經驗證確實如此:如果是單個vCPU,則Starting udev很快就能過去
具體解決方法:
當starting udev停住很久過不去的時候就(1)把虛擬機的電源關閉,(2)然後編輯配置,改為單個vCPU
(3)啟動系統 (4)編輯/etc/grub.conf在kernel一行最後加上clocksource=acpi_pm
這個在vmware官方有說明:
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1007020
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006427

Felix 發表在 痞客邦 留言(0) 人氣()

002
Windows 8 已經就要上市了(2012/10/26),也該是要來研究一下這個新的作業系統的時候了。Windows 8 看似為了平板電腦做了很大的改變。很明顯的「開始」功能表不見了,原來的桌面也要切換才能看的到。

如果你把滑鼠移到螢幕的右上角或是右下角,即會出現一個功能表,其中含有「搜尋、分享、開始、裝置、設定」等功能(或是按一下 WinKey+C),但似乎看不到程式集的部分。

Felix 發表在 痞客邦 留言(0) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。