每月彙整:九月 2013

新增與刪除使用者

useradd USERNAME       增加一名為USERNAME的帳號 userdel USERNAME        刪除USERNAME這個帳號 [root@localhost ~]# useradd power "useradd" 跟 "userdel" 這兩個指令都只有 root 可以使用 passwd [USERNAME]    更改USERNAME的密碼,若無參數,則改自己的密碼。 [root@localhost ~]# passwd power Changing password for user power New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated … 繼續閱讀

發表於 Linux | 發表迴響

網卡設定

#vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 //網卡的代號 BOOTPROTO=no //是否使用 dhcp HWADDR=00:1e:8c:1e:64:4f //網卡卡號(MAC) IPADDR=192.168.1.70 //IP位址 NETMASK=255.255.255.0 //網路遮罩 ONBOOT=yes //是否預設啟動此介面 GATEWAY=192.168.1.1 //通訊閘 NM_CONTROLLED=yes //額外的網管軟體 DNS1=168.95.1.1 DNS2=8.8.8.8 檢視網卡狀態 #ifconfig 啟動與關閉網卡 #ifup eth0 #ifdown eth0  

發表於 Linux | 1 則迴響

CentOS安裝php-mssql

安裝 EPEL 後,幾乎所有套件都可以直接從 yum 安裝 Step 1: # wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm Step 2: # rpm -ivh epel-release-6-8.noarch.rpm //安裝取得的rpm檔案 Step 3: # yum update    //更新yum的資源庫 Step 4: PHP 連 MSSQL要裝三個套件 unixODBC php-mssql freetds 執行 yum insatll php-mssql 他會依套件相依性,會自動幫你安裝其他兩個! # yum install php-mssql //安裝php-mssql Step 5: … 繼續閱讀

發表於 Linux | 發表迴響

使用GRANT語句增加新用戶

>mysql -u root -p mysql> USE database; mysql> GRANT ALL PRIVILEGES ON *.* TO user@localhost IDENTIFIED BY ‘password‘ WITH GRANT OPTION; mysql> FLUSH PRIVILEGES;

發表於 MySQL | 發表迴響

nslookup

C:\Users\guest>nslookup 預設伺服器:  google-public-dns-a.google.com Address: 8.8.8.8 查詢MX > set type=MX > yahoo.com.tw 未經授權的回答: yahoo.com.tw    MX preference = 5, mail exchanger = mx1.mail.tw.yahoo.com yahoo.com.tw    MX preference = 5, mail exchanger = mx2.mail.tw.yahoo.com yahoo.com.tw    nameserver = ns1.yahoo.com yahoo.com.tw    nameserver = ns2.yahoo.com yahoo.com.tw … 繼續閱讀

發表於 未分類 | 發表迴響

FROM_UNIXTIME

語法:FROM_UNIXTIME(unix_timestamp, format) 例子:SELECT FROM_UNIXTIME(1234567890, ‘%Y-%m-%d %H:%i:%S’)

發表於 MySQL | 發表迴響

big5 vs utf-8互轉

big5 轉 utf-8 $str = iconv("big5″,"UTF-8″,$str); utf-8 轉 big5 $str = iconv("UTF-8″,"big5″,$str);

發表於 PHP | 發表迴響

smarty常用

►註解 {* 單行註解 *} {* 多行註解 多行註解 *} ►引入樣版: {include file=’header.tpl’} {include file=’footer.tpl’} $page = $smarty->fetch(‘index.tpl’); ►指派樣版變數 {assign var=’title’ value=’Smarty Templates’} ►foreach基本語法 {foreach from=$陣列變數 item=陣列元素名稱 key=陣列索引名稱 name=foreach名稱} … {foreachelse} … {foreach} ►日期格式 {$createDate|date_format:’%Y/%m/%d’} ►避免與Javascript衝突 {literal} … {/literal} ►列印陣列 {$arr|@print_r} ►讀取Request變數 … 繼續閱讀

發表於 smarty | 發表迴響

jQuery:取值

textbox $("#text").val();//取值 $("#text").val("Hello World");//給值 radiobox 取得選中值:$("input[name=gender]:checked").val(); 使第N個radiobox被選中: $("input[type=radio]").eq(N).prop("checked",true); 觸發click事件: $("input[type=radio]").eq(N).trigger(‘click’); $("input[type=radio]").eq(N).attr("checked",true).trigger(‘click’); 取得多組 (:enabled, :disabled,:selected都同方法) $("input:checked").each(funciton(){…}); $("select option:selected").each(function () {…}); checkbox if($("#checkbox").prop("checked"));//判斷是否勾選 $("#checkbox").attr("checked",true);//勾選 $("#checkbox").attr("checked",false);//不勾選 var checkedValue = $(‘input:checkbox[name=leave_type][checked=checked]‘).map(function(){ return $(this).val(); }).get().join(‘,’); //取值 var mode = $("#mode").prop("checked") ? 1 : 0; var enable … 繼續閱讀

發表於 Jquery | 發表迴響

取得label標籤內容值

<label id="myLabel" onClick="show();">Label標籤內容一</label><br /> <label id="myLabel" onClick="show();">Label標籤內容二</label><br /> <label id="myLabel" onClick="show();">Label標籤內容三</label> <script type="text/javascript"> function show() { alert("label:" + myLabel[0].innerHTML); alert("label:" + myLabel[1].innerHTML); alert("label:" + myLabel[2].innerHTML); } </script>  

發表於 Javascript | 發表迴響