<style type="text/css">
.fixed{float:left;width:105px;text-align:right;}
p{margin:5px;}
</style>
<p/><span class="fixed">姓名:</span><input name="teacher_name" type="text" /></p>
<p/><span class="fixed">姓名(english):</span><input name="teacher_ename" type="text" /></p>
2013年3月4日 星期一
css span 排版
2013年2月18日 星期一
上傳檔案簡易版
創建 FILE UPLOAD
Create The Upload Script
if ($_FILES["file"]["error"] > 0){
echo "Error: " . $_FILES["file"]["error"] . "";
}else{
echo "Upload: " . $_FILES["file"]["name"] . "";
echo "Type: " . $_FILES["file"]["type"] . "";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
$_FILES["file"]["name"] - the name of the uploaded file$_FILES["file"]["type"] - the type of the uploaded file
$_FILES["file"]["size"] - the size in kilobytes of the uploaded file
$_FILES["file"]["tmp_name"] - the name of the temporary copy of the file stored on the server
$_FILES["file"]["error"] - the error code resulting from the file upload
2013年2月17日 星期日
回到頂端
js:scrolltopcontrol.js
圖片
UP:
程式碼:
放進去就可以用了。
//** jQuery Scroll to Top Control script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** Available/ usage terms at http://www.dynamicdrive.com (March 30th, 09')
//** v1.1 (April 7th, 09'):
//** 1) Adds ability to scroll to an absolute position (from top of page) or specific element on the page instead.
//** 2) Fixes scroll animation not working in Opera.
var $j=jQuery.noConflict();
var scrolltotop={
//startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
//scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
controlHTML: '
', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ bottom of window corner
anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links
state: {isvisible:false, shouldvisible:false},
scrollup:function(){
if (!this.cssfixedsupport) //if control is positioned using JavaScript
this.$control.css({opacity:0}) //hide control immediately after clicking it
var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
if (typeof dest=="string" && $j('#'+dest).length==1) //check element set by string exists
dest=$j('#'+dest).offset().top
else
dest=0
this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
},
keepfixed:function(){
var $window=$j(window)
var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
this.$control.css({left:controlx+'px', top:controly+'px'})
},
togglecontrol:function(){
var scrolltop=$j(window).scrollTop()
if (!this.cssfixedsupport)
this.keepfixed()
this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
if (this.state.shouldvisible && !this.state.isvisible){
this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
this.state.isvisible=true
}
else if (this.state.shouldvisible==false && this.state.isvisible){
this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
this.state.isvisible=false
}
},
init:function(){
$j(document).ready(function($){
var mainobj=scrolltotop
var iebrws=document.all
mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
mainobj.$control=$(''+mainobj.controlHTML+'')
.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
.attr({title:'Scroll Back to Top'})
.click(function(){mainobj.scrollup(); return false})
.appendTo('body')
if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
mainobj.togglecontrol()
$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
mainobj.scrollup()
return false
})
$(window).bind('scroll resize', function(e){
mainobj.togglecontrol()
})
})
}
}
scrolltotop.init()
圖片
UP:

程式碼:
放進去就可以用了。
標籤:
javascript
2013年2月5日 星期二
MAIL OUTLOOK 信中有亂碼(主旨、寄件人、內容)產生
情況:收的人用outlook收信,發現是一團亂碼。
主旨、寄件人 皆比照辦理
header
如果再不見,只好見官方PHP 的MAIL 有前輩提供了一個fuhction..
網址:http://www.php.net/manual/en/function.mail.php#92976
因為寄件人亂碼了,所以做了變化,不知道有沒有成功。
Encodes the given data with base64.
This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
Base64-encoded data takes about 33% more space than the original data.
參考連結:
php mail 寄送會有亂碼: 解決方式如下:
http://www.macsoho.net/blog/?p=143
http://www.php.net/manual/en/function.mail.php#92976
參考:
主旨、寄件人 皆比照辦理
$subject = "天氣 ".$state." 可能會..."; 添加base64_encode $subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";內容:加入html 和charset=utf-8
$message = 'Fillon soutient à fond le retour d\'un Grand Prix de France Le Premier ministre François Fillon, passionné d\'automobile et pilote à ses heures, a apporté un soutien appuyé au retour d\'un Grand Prix de France au calendrier 2013 de la Formule 1, en faisant un passage-éclair vendredi sur le circuit Paul Ricard dans le Var.
header
$headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=utf- 8\r\n";
如果再不見,只好見官方PHP 的MAIL 有前輩提供了一個fuhction..
網址:http://www.php.net/manual/en/function.mail.php#92976
/* ** * Function responsible for sending unicode emails. * * @author Gajus Kuizinas2013.05.17 新增* @version 1.0.1 (2012 01 11) */ function mail_send($arr) { if (!isset($arr['to_email'], $arr['from_email'], $arr['subject'], $arr['message'])) { throw new HelperException('mail(); not all parameters provided.'); } $to = empty($arr['to_name']) ? $arr['to_email'] : '"' . mb_encode_mimeheader($arr['to_name']) . '" <' . $arr['to_email'] . '>'; $from = empty($arr['from_name']) ? $arr['from_email'] : '"' . mb_encode_mimeheader($arr['from_name']) . '" <' . $arr['from_email'] . '>'; $headers = array ( 'MIME-Version: 1.0', 'Content-Type: text/html; charset="UTF-8";', 'Content-Transfer-Encoding: 7bit', 'Date: ' . date('r', $_SERVER['REQUEST_TIME']), 'Message-ID: <' . $_SERVER['REQUEST_TIME'] . md5($_SERVER['REQUEST_TIME']) . '@' . $_SERVER['SERVER_NAME'] . '>', 'From: ' . $from, 'Reply-To: ' . $from, 'Return-Path: ' . $from, 'X-Mailer: PHP v' . phpversion(), 'X-Originating-IP: ' . $_SERVER['SERVER_ADDR'], ); mail($to, '=?UTF-8?B?' . base64_encode($arr['subject']) . '?=', $arr['message'], implode("\n", $headers)); }
因為寄件人亂碼了,所以做了變化,不知道有沒有成功。
function mail_send($arr)
{
if (!isset($arr['to_email'], $arr['from_email'], $arr['subject'], $arr['message'])) {
throw new HelperException('mail(); not all parameters provided.');
}
$to = empty($arr['to_name']) ? $arr['to_email'] : '"' . mb_encode_mimeheader($arr['to_name']) . '" <' . $arr['to_email'] . '>';
//針對寄件人的姓名做DEBUG避免寄件人姓名亂碼
$from = empty($arr['from_name']) ? $arr['from_email'] : '"' .'=?UTF-8?B?' . base64_encode( mb_encode_mimeheader($arr['from_name'])) . '?=' . '" <' . $arr['from_email'] . '>';
$headers = array
(
'MIME-Version: 1.0',
'Content-Type: text/html; charset="UTF-8";',
'Content-Transfer-Encoding: 7bit',
'Date: ' . date('r', $_SERVER['REQUEST_TIME']),
'Message-ID: <' . $_SERVER['REQUEST_TIME'] . md5($_SERVER['REQUEST_TIME']) . '@' . $_SERVER['SERVER_NAME'] . '>',
'From: ' . $from,
'Reply-To: ' . $from,
'Return-Path: ' . $from,
'X-Mailer: PHP v' . phpversion(),
'X-Originating-IP: ' . $_SERVER['SERVER_ADDR'],
);
mail($to, '=?UTF-8?B?' . base64_encode($arr['subject']) . '?=', $arr['message'], implode("\n", $headers));
}
base64_encode 解釋:Encodes the given data with base64.
This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
Base64-encoded data takes about 33% more space than the original data.
參考連結:
php mail 寄送會有亂碼: 解決方式如下:
http://www.macsoho.net/blog/?p=143
http://www.php.net/manual/en/function.mail.php#92976
參考:
2013年1月28日 星期一
HTML FORM 中 使用屬性 disabled readonly , submit丟出去的處理狀況
readonly只能用在 屬性input裡面。form送出去後的name value是可以被使用的。
disalbed=>select,input 都可以使用,但form送出後的name value是不可以被使用的。
Q:目前是想把select在按下 "確認資料"成功後是不能被更變的
A:目前是想把select在按下 "確認資料"成功後是不能被更變的,但readly 卻不能使用在select上面,
為了讓select不能被更變,只好使用disalbed,但form送出去,disabled的值是不能使用的,只好在form底下
設一個hidden的input 底下的name 跟 select 的name是相同的。
當按下 input type submit(確認資料)後 select被jquery 設了disalbed。
記得在form底碼 加一個跟select 相同ID 的 input hidden 並指定selected 的value。
這樣就可以處理這件事了。
2012年11月2日 星期五
[文章標題]在近N天的標題後加一個new的icon
function new_image($s_time){
$tc=(date('U',time())-date("U",strtotime($s_time)))/86400;
$tc_image_new='';
if($tc<=3)
$tc_image_new="
";
return $tc_image_new;
}
PS. 一天86400秒
icon finder: http://www.iconfinder.com/
您可能有興趣的書單:
2012年9月27日 星期四
php excel
EXCEL讀檔 寫入MYSQL
寫入excel
include_once("../XXX/phpexcel/PHPExcel/IOFactory.php");
include_once('../XXX/phpexcel/PHPExcel/Reader/Excel5.php');
if($_FILES['employeeData']['name']=="" )"ERROR!!no FILE!!";
$reader = new PHPExcel_Reader_Excel5;
$PHPExcel=$reader->load($_FILES['exployxeData']['tmp_name']);
$sheet=$PHPExcel->getSheet(0);
$highestRow=$sheet->getHighestRow();
for($row=1;$row<=$highestRow;$row++){
//echo $i."$$";
$str='';
for($column=0;$column<=6;$column++){
$aa=$sheet->getCellByColumnAndRow($column,$row)->getvalue();
$temp[$column]=$aa;
if($column=='0'){
$str.="'".$aa."',";//id
$str.="'".$aa."',";//pwd
}elseif($column=='6'){
if($temp[4]==$temp[0]){
$str.="'1',";
}elseif($temp[6]=='1'){
$str.="'2',";
}else{
$str.="'0',";
}
}elseif($column=='5'){
continue;
}else{
if($aa!=''){
$str.="'".$aa."',";
}
}
}
$str=substr($str,0,strlen($str)-1);
if($row>1){
$sql="insert into Base (`ID`,`Pwd`,`Name`,`Name`,`Email`,`lID`,`role`)values($str)";
mysql_query($sql);
if(! mysql_affected_rows()>0){
echo "error:name:{$temp[1]}";
exit;
}
}
}
寫入excel
include_once("../class/phpexcel/PHPExcel/IOFactory.php");
$path="../download/";
$objRD=PHPExcel_IOFactory::createReader("Excel5");
$objExcel=$objRD->load($path."temp.xls");
//$CobjExcel=new PHPExcel();
//$objExcel=$CobjExcel->load($path."temp.xls");
$objExcel->setActiveSheetIndex(0);
$sheet=$objExcel->getActiveSheet();
for($i=1;$i<$num;$i++){
//if($data[$i]['enable']==0) continue; #因為sql裡面排除不了enable為0的,所以做此處理
$sheet->setCellValueByColumnAndRow(0,$colum,$searchContent[$i]['userName']);
$sheet->setCellValueByColumnAndRow(1,$colum,$searchContent[$i]['ID']);
$sheet->setCellValueByColumnAndRow(2,$colum,$searchContent[$i]['shifName']);
$colum++;
}
$objExcel=PHPExcel_IOFactory::createWriter($objExcel,'Excel5');
$filePath=$path."labor_hour.xls";
$objExcel->save($filePath);
dl_file($filePath);
2012年9月24日 星期一
關閉視窗
<script type='text/javascript'>
function windows_close(){
window.open('','_parent','');
window.opener = null;
window.open('','_parent','');
window.close();
}
</script>
<input type='button' onclick='windows_close()' value='關閉視窗'>
ex-2<script type='text/javascript'>
function doClose(){this.close();}
</script>
2012年9月18日 星期二
javascript 時間
時間:
建立Date 物件
today=new Date();
//出來的是 Wed Sep 19 2012 14:41:42 GMT+0800(台北標準時間)
Date的三種用法
物件名稱=new Date()
物件名稱=new Date("月 日,年 時:分:秒");
物件名稱=new Date (年,月,日,時,分,秒);
使用物件的方法
取得
getYear()
getMonth()
getDate()
getDay()
getHours()
getMinutes()
getSeconds()
設定
setYear()
setMonth();
setDate();
setHours();
setMinutes();
setSeconds();
today.getTime();
出來的是unix的秒數
建立Date 物件
today=new Date();
//出來的是 Wed Sep 19 2012 14:41:42 GMT+0800(台北標準時間)
Date的三種用法
物件名稱=new Date()
物件名稱=new Date("月 日,年 時:分:秒");
物件名稱=new Date (年,月,日,時,分,秒);
使用物件的方法
取得
getYear()
getMonth()
getDate()
getDay()
getHours()
getMinutes()
getSeconds()
設定
setYear()
setMonth();
setDate();
setHours();
setMinutes();
setSeconds();
today.getTime();
出來的是unix的秒數
標籤:
javascript
2012年8月21日 星期二
針對某個瀏覽器做css的調整(瀏覽器視窗高度)
判別瀏覽器:
jQuery.browser.version
jQuery 提供了 browser 物件來讓我們能判斷現在的訪客是用什麼瀏覽器及版本
可參考 [jQ]jQuery.browser.version 在 IE 中版本判斷的 Bug
判斷是否為ie瀏覽器 可以使用:$.browser.msie
[JQuery][轉錄] 如何取得瀏覽器視窗高度及寬度 (跨瀏覽器)
jQuery.browser.version
jQuery 提供了 browser 物件來讓我們能判斷現在的訪客是用什麼瀏覽器及版本
可參考 [jQ]jQuery.browser.version 在 IE 中版本判斷的 Bug
判斷是否為ie瀏覽器 可以使用:$.browser.msie
[JQuery][轉錄] 如何取得瀏覽器視窗高度及寬度 (跨瀏覽器)
2012年8月9日 星期四
列印
<script type="text/javascript">
function printScreen(block){
var value = block.innerHTML;
var printPage = window.open("","printPage","");
printPage.document.open();
printPage.document.write("<HTML><head></head><BODY onload='window.print();window.close()'>");
printPage.document.write("<PRE>");
printPage.document.write(value);
printPage.document.write("</PRE>");
printPage.document.close("</BODY></HTML>");
}
<javascript">
<input type='button' value='列印' style="color:#F00; font-size:12px" onclick="printScreen(showOneOrderDetail)"/>
<div id='showOneOrderDetail'>
......
</div>
function printScreen(block){
var value = block.innerHTML;
var printPage = window.open("","printPage","");
printPage.document.open();
printPage.document.write("<HTML><head></head><BODY onload='window.print();window.close()'>");
printPage.document.write("<PRE>");
printPage.document.write(value);
printPage.document.write("</PRE>");
printPage.document.close("</BODY></HTML>");
}
<javascript">
<input type='button' value='列印' style="color:#F00; font-size:12px" onclick="printScreen(showOneOrderDetail)"/>
<div id='showOneOrderDetail'>
......
</div>
標籤:
javascript
2012年7月30日 星期一
PDO
PHP 從 PHP5 開始,在資料庫操作方面新增了 PDO(PHP Data Objects)的 extension,利用物件導向的方式與資料庫進行溝通。捨棄以往透過單一函式的方式,而是透過物件導向程式設計的抽象化概念,操作時使用統一的方法,如果需要更換資料庫時,只要在建立物件時給予資料庫的形式,而不用更動到原來的程式碼。這也是物件導向程式設計擁有優良靈活性的最佳表現!
連線方法:
try {
/**
* The PDO String connection is for mysql
* Check the documentation for your database
*/
$db = new PDO(
'mysql:host=localhost;dbname=vhost24579-4',
'root',
'pwd'
);
/** As I am brazilian I always use UTF-8 enconding
* in files, connections and charset
*/
$db->query("SET NAMES UTF8");
} catch ( PDOException $e ) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
<?php
// 組合 SQL 語法,取得符合 id = 2、name = 'John' 的資料
$sth = $dbh->prepare('SELECT * FROM table WHERE id = :id AND name = :name');
$where = array(':id' => 2, ':name' => 'John');
// 使用 execute(),會自動 quote $where 的參數
$sth->execute($where);
foreach ($sth->fetchAll(PDO::FETCH_ASSOC) as $row) {
print_r($row);
}
?>
範例1:
// 利用迴圈對每一列做處理
$dataArray = array(); // 結果儲存陣列
while ($row = $stmt->fetch(PDO::FETCH_ASSOC) {
// 資料處理
$row['colour'] = $row['colour']? $row['colour'] : '#000';
// 加儲存陣列
array_push($dataArray,$row);
}
連線方法:
try {
/**
* The PDO String connection is for mysql
* Check the documentation for your database
*/
$db = new PDO(
'mysql:host=localhost;dbname=vhost24579-4',
'root',
'pwd'
);
/** As I am brazilian I always use UTF-8 enconding
* in files, connections and charset
*/
$db->query("SET NAMES UTF8");
} catch ( PDOException $e ) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
<?php
// 組合 SQL 語法,取得符合 id = 2、name = 'John' 的資料
$sth = $dbh->prepare('SELECT * FROM table WHERE id = :id AND name = :name');
$where = array(':id' => 2, ':name' => 'John');
// 使用 execute(),會自動 quote $where 的參數
$sth->execute($where);
foreach ($sth->fetchAll(PDO::FETCH_ASSOC) as $row) {
print_r($row);
}
?>
範例1:
// 利用迴圈對每一列做處理
$dataArray = array(); // 結果儲存陣列
while ($row = $stmt->fetch(PDO::FETCH_ASSOC) {
// 資料處理
$row['colour'] = $row['colour']? $row['colour'] : '#000';
// 加儲存陣列
array_push($dataArray,$row);
}
2012年7月29日 星期日
Text Box 美化
css:
行內 style
style="border-bottom: #27b3fe 1px solid; border-left: #27b3fe 1px solid; margin-top: 2px; width: 105px; margin-bottom: 3px; background: url(../images/store/login_6.gif) #ffffff repeat-x; height: 20px; border-top: #27b3fe 1px solid; border-right: #27b3fe 1px solid;"
-moz代表firefox瀏覽器私有屬性
-ms代表IE瀏覽器私有屬性
-webkit代表chrome、safari瀏覽器私有屬性
,,,,,
class宣告方式為 .classname
id 宣告方式為 #idname
tag 宣告方式為 tagname
,,,,,
ID 選擇器在一個 HTML 文件中只能被使用一次
Class 選擇器在一個 HTML 文件中可以被使用多次
Tag 選擇器只的是HTML文件中所有的標籤
lession1
lession2
lession3
行內 style
style="border-bottom: #27b3fe 1px solid; border-left: #27b3fe 1px solid; margin-top: 2px; width: 105px; margin-bottom: 3px; background: url(../images/store/login_6.gif) #ffffff repeat-x; height: 20px; border-top: #27b3fe 1px solid; border-right: #27b3fe 1px solid;"
-moz、-ms、-webkit代表什麼意思呢?
-moz代表firefox瀏覽器私有屬性
-ms代表IE瀏覽器私有屬性
-webkit代表chrome、safari瀏覽器私有屬性
,,,,,
class宣告方式為 .classname
id 宣告方式為 #idname
tag 宣告方式為 tagname
,,,,,
ID 選擇器在一個 HTML 文件中只能被使用一次
Class 選擇器在一個 HTML 文件中可以被使用多次
Tag 選擇器只的是HTML文件中所有的標籤
lession1
lession2
lession3
2012年7月26日 星期四
簡單的MySql class
引用:http://www.phpclasses.org/package/7572-PHP-Setup-MySQL-database-connections.html
<?php
////////////////////////////////////////////
//@Product Name : Connect to MySQL Class //
//@Coding By : hossam Youssef //
//@Copyright © 2010 - 2012 //
////////////////////////////////////////////
// Class
class database {
public $db_host;
public $db_user;
public $db_pass;
public $db_name;
// That to start connection with MySQL
function db_connect(){
// connect with MySQL
$connect = @mysql_connect($this->db_host,$this->db_user,$this->db_pass);
if(!$connect){
@mysql_close($connect);
die ("<h1><font color='#000000'><center>MySQL DataBase Not<font color='#FF0000'style='text-decoration:blink;'> Connected !</font></center></font></h1>");
return false;
}
return true;
}
// Here you have select database with MySQL
function db_select(){
// Select with Database
$select = @mysql_select_db($this->db_name);
if(!$select){
@mysql_close($connect);
die ("<h1><font color='#000000'><center>Not <font color='#FF0000'style='text-decoration:blink;'>Selected</font> DataBase !</center></font></h1>");
return false;
}
return true;
}
// Here you select charset UTF8 with Database
function charset_UTF8(){
// MySQL connection collation UTF8
@mysql_query("SET names 'UTF8'");
@mysql_query("SET charset 'UTF8'");
@mysql_query("SET character_set_client = UTF8");
@mysql_query("SET character_set_connection = UTF8");
@mysql_query("SET character_set_database = UTF8");
@mysql_query("SET character_set_results = UTF8");
@mysql_query("SET character_set_server = UTF8");
}
// MySQL Close connect Function
function close(){
global $connect;
@mysql_close($connect);
}
}
// start show
$db = new database();
/* The hostname of the MySQL server */
$db->db_host = "localhost";
/* The username to login to MySQL */
$db->db_user = "root";
/* The password to login to MySQL */
$db->db_pass = "123";
/* The name of the MySQL database */
$db->db_name = "tesr";
// Call class
$db->db_connect();
$db->db_select();
$db->charset_UTF8();
// Close connect
//$db->close();
?>
同場加映:人生是永遠的測試版:新創企業家改寫生涯的方程式
<?php
////////////////////////////////////////////
//@Product Name : Connect to MySQL Class //
//@Coding By : hossam Youssef //
//@Copyright © 2010 - 2012 //
////////////////////////////////////////////
// Class
class database {
public $db_host;
public $db_user;
public $db_pass;
public $db_name;
// That to start connection with MySQL
function db_connect(){
// connect with MySQL
$connect = @mysql_connect($this->db_host,$this->db_user,$this->db_pass);
if(!$connect){
@mysql_close($connect);
die ("<h1><font color='#000000'><center>MySQL DataBase Not<font color='#FF0000'style='text-decoration:blink;'> Connected !</font></center></font></h1>");
return false;
}
return true;
}
// Here you have select database with MySQL
function db_select(){
// Select with Database
$select = @mysql_select_db($this->db_name);
if(!$select){
@mysql_close($connect);
die ("<h1><font color='#000000'><center>Not <font color='#FF0000'style='text-decoration:blink;'>Selected</font> DataBase !</center></font></h1>");
return false;
}
return true;
}
// Here you select charset UTF8 with Database
function charset_UTF8(){
// MySQL connection collation UTF8
@mysql_query("SET names 'UTF8'");
@mysql_query("SET charset 'UTF8'");
@mysql_query("SET character_set_client = UTF8");
@mysql_query("SET character_set_connection = UTF8");
@mysql_query("SET character_set_database = UTF8");
@mysql_query("SET character_set_results = UTF8");
@mysql_query("SET character_set_server = UTF8");
}
// MySQL Close connect Function
function close(){
global $connect;
@mysql_close($connect);
}
}
// start show
$db = new database();
/* The hostname of the MySQL server */
$db->db_host = "localhost";
/* The username to login to MySQL */
$db->db_user = "root";
/* The password to login to MySQL */
$db->db_pass = "123";
/* The name of the MySQL database */
$db->db_name = "tesr";
// Call class
$db->db_connect();
$db->db_select();
$db->charset_UTF8();
// Close connect
//$db->close();
?>
同場加映:人生是永遠的測試版:新創企業家改寫生涯的方程式
2012年7月19日 星期四
如何表達同意或反對
WHAT TO SAY...: When You Agree or Disagree (Part 1 of 5) 如何表達同意或反對?
We all love it when others agree with our opinions, plans or decisions. Likewise, we enjoy supporting our friends with the same enthusiasm. Sooner or later, though, each of us faces disagreement. People don't always agree with us, and we may not see eye-to-eye with them either. Whether we agree or disagree, knowing how to express ourselves effectively makes a big difference.
How confident do you feel about knowing what to say when you agree? Here is a list of good phrases to use to agree.
(Formal) I agree completely.
That's just what I think.
(Informal) You're right, of course.
I think so, too. Sure.
我們都喜歡別人贊同自己的觀點、計畫或決定。同樣地,我們也喜歡以這份熱忱來支持我們的朋友。不過遲早,我們都要面對意見不合的情況。別人不會總是贊同我們,我們也不會與他們持相同看法。不論我們同意或反對,知道如何有效地表達自己的意見,會帶來不同的結果。
當你同意別人時,你有多少把握知道自己該說些什麼?這裡有一些好句子可用來表示贊成。
(正式用語) 我完全同意。
那正是我所想的。
(非正式用語) 當然,你是對的。
我也這麼認為。
對啊!
enthusiasm (n) 熱忱; 熱心
WHAT TO SAY...: When You Agree or Disagree (Part 2 of 5) 如何表達同意或反對?
(after school)
Mary: Wow! Did you see Sarah's new haircut? I've never seen her with short hair before. It looks great!
Jane: I couldn't agree more! She looks so sophisticated. Seeing her makes me want to get my hair cut, too.
Mary: Me, too! Let's experiment with a comb and mirror to see which length looks best. Then, we can make appointments for cuts at the beauty parlor on Saturday.
會話一
(放學後)
瑪麗:哇!你看到莎拉的新髮型了嗎?我以前從來沒看過她留短頭髮,實在很好看!
珍 :我非常贊成!她看起來好成熟。看著她讓我也想去剪短頭髮呢!
瑪麗:我也是!我們來用梳子和鏡子試試,看哪個長度最適合,然後我們就和美容院約個星期六去剪頭髮。
sophisticated (adj) 成熟的; 老練的
beauty parlor (n phr) 美容院
WHAT TO SAY...: When You Agree or Disagree (Part 3 of 5) 如何表達同意或反對?
At times a person may not be ready to agree, yet hesitates to disagree strongly. In this situation, using an indirect approach is more effective. It usually results in the positive exchange of information and avoids conflict. It is also more polite than a direct approach. Sometimes more formal expressions are called for, such as in disagreements with a supervisor. Close friends can more easily use informal words without damaging their relationship. Here are some useful phrases to use when you don't agree.
(Formal) I'm not sure I agree.
Are you absolutely sure?
I may be wrong, but . . .
(Informal) Oh, I don't know . . .
Yes, but . . .
Really?
有的時候,別人可能不很贊同,卻又猶豫不願意強烈地反對。在這種情況之下,採用間接的方式會比較有效。如此通常會帶來一種正面的意見交換,而又避免衝突。它也比直接的方式更有禮貌。有的時候正式的表達是需要的,例如,和你的上司持相反意見時。好朋友間則較容易用不拘小節的字眼,而不傷害彼此的關係。這裡有一些很實用的句子來表達反對。
(正式用語) 我不確定我贊成。
你真的那麼確定嗎?
我可能不對,但是…
(非正式用語) 嗯,我不知道耶…
對啊,但是…
真的嗎?
hesitate (v) 猶豫; 躊躇
approach (n) 方法; 步驟
conflict (n) 爭執; 意見抵觸
absolutely (adv) 完全地; 肯定地
WHAT TO SAY...: When You Agree or Disagree (Part 4 of 5) 如何表達同意或反對?
Hank: I'm really looking forward to the movie on Saturday. It will be great to see Mel Gibson again. He was so cool in Sleepless in Seattle!
Sharon: Are you sure Mel Gibson was in that one? I thought it was Tom Hanks.
Joan: Me, too. I may be wrong, but wasn't Mel Gibson the lead in Braveheart?
Hank: Well, maybe you're right. I have the Sleepless in Seattle video at home. I'll check.
Sometimes you may have strong feelings against an idea or opinion. Although it is difficult, you can disagree directly if you handle it in the proper way. Try phrases from the following list to help. It's usually best to include a reason for opposing what the other person has said.
(Formal) I'm sorry, but I have to disagree.
I strongly disagree.
I refuse to believe that . . .
(Informal) No, that's wrong.
You're dead wrong.
Nope!
會話二
漢克:我真的很期待星期六要去看的那部電影。再看到梅爾.吉柏遜一定很棒!他在「西雅圖夜未眠」裡好酷喔!
雪倫:你確定梅爾.吉柏遜有演那部電影嗎?我以為是湯姆.漢克斯。
瓊 :我也這麼想。我可能錯了,不過梅爾.吉柏遜不是那個主演「英雄本色」的嗎?
漢克:嗯,可能你們說的對。我家裡有「西雅圖夜未眠」的錄影帶,我會再確定一下。
有時你可能很強烈地反對一個主張或意見。雖然直接提出反對意見很困難,但是如果處理得當,仍然可行。試試看下面的句子。通常,不贊成時最好能提出不贊成對方所說的理由。
(正式用語) 我很抱歉,但我必須反對。
我非常不贊成。
我不願意相信…
(非正式用語) 不,那是錯的。
你大錯特錯了。
不對!
oppose (v) 反對
WHAT TO SAY...: When You Agree or Disagree (Part 5 of 5) 如何表達同意或反對?
Tom: Hey! Look! Someone dropped their wallet. It has some money. We can share it and get a snack at McDonald's!
George: No way! That would be like stealing. Let's look to see if the owner's name and address are inside. We should return it.
Tom: Are you crazy? We found it. We should keep it.
George: I disagree. Maybe the owner will be so glad to have it back he will give us a reward. Then we will know we've done the right thing, and we'll have money for a snack.
Tom: Well, OK. Maybe your plan is better.
Activities
With a friend, practice agreeing and disagreeing in the following situations:
1. You and a friend have just come from the art museum. Both of you agree that the paintings by a new artist are the best you've ever seen.
2. You and a friend are going across town to a movie. You want to go by bus, but your friend insists that a taxi is best.
3. You are planning a vacation with your husband (or wife). You want to go to the beach, but your spouse wants to go to the mountains.
會話三
湯姆:嘿!你看!有人掉了皮夾,裡面還有一些錢。我們可以把它分了,去麥當勞買點心吃。
喬治:不可以!那就像偷竊啦!我們來看看失主的名字和地址有沒有在裡面。我們應該歸還它。
湯姆:你瘋了嗎?是我們發現它的,我們應該可以留下它。
喬治:我不同意。也許這位失主會因為找回皮夾很高興,而給我們獎賞。那我們就知道這件事作對了,而且我們也會有錢吃點心。
湯姆:唉,好吧,或許你的計畫比較好。
練習:
和朋友練習在下列情況下,表達相同或不同的意見:
1. 你和一位朋友剛從美術館裡出來。你們都認為一位新出道畫家的畫,是你們看過最好的作品。
2. 你和一位朋友要到城的另一頭看電影。你想搭公車,可是你的朋友堅持搭計程車。
3. 你正計畫和先生(或太太)共度假期。你想要去海邊,可是你的配偶想去山上。
insist (v) 堅持
spouse (n) 配偶
We all love it when others agree with our opinions, plans or decisions. Likewise, we enjoy supporting our friends with the same enthusiasm. Sooner or later, though, each of us faces disagreement. People don't always agree with us, and we may not see eye-to-eye with them either. Whether we agree or disagree, knowing how to express ourselves effectively makes a big difference.
How confident do you feel about knowing what to say when you agree? Here is a list of good phrases to use to agree.
(Formal) I agree completely.
That's just what I think.
(Informal) You're right, of course.
I think so, too. Sure.
我們都喜歡別人贊同自己的觀點、計畫或決定。同樣地,我們也喜歡以這份熱忱來支持我們的朋友。不過遲早,我們都要面對意見不合的情況。別人不會總是贊同我們,我們也不會與他們持相同看法。不論我們同意或反對,知道如何有效地表達自己的意見,會帶來不同的結果。
當你同意別人時,你有多少把握知道自己該說些什麼?這裡有一些好句子可用來表示贊成。
(正式用語) 我完全同意。
那正是我所想的。
(非正式用語) 當然,你是對的。
我也這麼認為。
對啊!
enthusiasm (n) 熱忱; 熱心
WHAT TO SAY...: When You Agree or Disagree (Part 2 of 5) 如何表達同意或反對?
(after school)
Mary: Wow! Did you see Sarah's new haircut? I've never seen her with short hair before. It looks great!
Jane: I couldn't agree more! She looks so sophisticated. Seeing her makes me want to get my hair cut, too.
Mary: Me, too! Let's experiment with a comb and mirror to see which length looks best. Then, we can make appointments for cuts at the beauty parlor on Saturday.
會話一
(放學後)
瑪麗:哇!你看到莎拉的新髮型了嗎?我以前從來沒看過她留短頭髮,實在很好看!
珍 :我非常贊成!她看起來好成熟。看著她讓我也想去剪短頭髮呢!
瑪麗:我也是!我們來用梳子和鏡子試試,看哪個長度最適合,然後我們就和美容院約個星期六去剪頭髮。
sophisticated (adj) 成熟的; 老練的
beauty parlor (n phr) 美容院
WHAT TO SAY...: When You Agree or Disagree (Part 3 of 5) 如何表達同意或反對?
At times a person may not be ready to agree, yet hesitates to disagree strongly. In this situation, using an indirect approach is more effective. It usually results in the positive exchange of information and avoids conflict. It is also more polite than a direct approach. Sometimes more formal expressions are called for, such as in disagreements with a supervisor. Close friends can more easily use informal words without damaging their relationship. Here are some useful phrases to use when you don't agree.
(Formal) I'm not sure I agree.
Are you absolutely sure?
I may be wrong, but . . .
(Informal) Oh, I don't know . . .
Yes, but . . .
Really?
有的時候,別人可能不很贊同,卻又猶豫不願意強烈地反對。在這種情況之下,採用間接的方式會比較有效。如此通常會帶來一種正面的意見交換,而又避免衝突。它也比直接的方式更有禮貌。有的時候正式的表達是需要的,例如,和你的上司持相反意見時。好朋友間則較容易用不拘小節的字眼,而不傷害彼此的關係。這裡有一些很實用的句子來表達反對。
(正式用語) 我不確定我贊成。
你真的那麼確定嗎?
我可能不對,但是…
(非正式用語) 嗯,我不知道耶…
對啊,但是…
真的嗎?
hesitate (v) 猶豫; 躊躇
approach (n) 方法; 步驟
conflict (n) 爭執; 意見抵觸
absolutely (adv) 完全地; 肯定地
WHAT TO SAY...: When You Agree or Disagree (Part 4 of 5) 如何表達同意或反對?
Hank: I'm really looking forward to the movie on Saturday. It will be great to see Mel Gibson again. He was so cool in Sleepless in Seattle!
Sharon: Are you sure Mel Gibson was in that one? I thought it was Tom Hanks.
Joan: Me, too. I may be wrong, but wasn't Mel Gibson the lead in Braveheart?
Hank: Well, maybe you're right. I have the Sleepless in Seattle video at home. I'll check.
Sometimes you may have strong feelings against an idea or opinion. Although it is difficult, you can disagree directly if you handle it in the proper way. Try phrases from the following list to help. It's usually best to include a reason for opposing what the other person has said.
(Formal) I'm sorry, but I have to disagree.
I strongly disagree.
I refuse to believe that . . .
(Informal) No, that's wrong.
You're dead wrong.
Nope!
會話二
漢克:我真的很期待星期六要去看的那部電影。再看到梅爾.吉柏遜一定很棒!他在「西雅圖夜未眠」裡好酷喔!
雪倫:你確定梅爾.吉柏遜有演那部電影嗎?我以為是湯姆.漢克斯。
瓊 :我也這麼想。我可能錯了,不過梅爾.吉柏遜不是那個主演「英雄本色」的嗎?
漢克:嗯,可能你們說的對。我家裡有「西雅圖夜未眠」的錄影帶,我會再確定一下。
有時你可能很強烈地反對一個主張或意見。雖然直接提出反對意見很困難,但是如果處理得當,仍然可行。試試看下面的句子。通常,不贊成時最好能提出不贊成對方所說的理由。
(正式用語) 我很抱歉,但我必須反對。
我非常不贊成。
我不願意相信…
(非正式用語) 不,那是錯的。
你大錯特錯了。
不對!
oppose (v) 反對
WHAT TO SAY...: When You Agree or Disagree (Part 5 of 5) 如何表達同意或反對?
Tom: Hey! Look! Someone dropped their wallet. It has some money. We can share it and get a snack at McDonald's!
George: No way! That would be like stealing. Let's look to see if the owner's name and address are inside. We should return it.
Tom: Are you crazy? We found it. We should keep it.
George: I disagree. Maybe the owner will be so glad to have it back he will give us a reward. Then we will know we've done the right thing, and we'll have money for a snack.
Tom: Well, OK. Maybe your plan is better.
Activities
With a friend, practice agreeing and disagreeing in the following situations:
1. You and a friend have just come from the art museum. Both of you agree that the paintings by a new artist are the best you've ever seen.
2. You and a friend are going across town to a movie. You want to go by bus, but your friend insists that a taxi is best.
3. You are planning a vacation with your husband (or wife). You want to go to the beach, but your spouse wants to go to the mountains.
會話三
湯姆:嘿!你看!有人掉了皮夾,裡面還有一些錢。我們可以把它分了,去麥當勞買點心吃。
喬治:不可以!那就像偷竊啦!我們來看看失主的名字和地址有沒有在裡面。我們應該歸還它。
湯姆:你瘋了嗎?是我們發現它的,我們應該可以留下它。
喬治:我不同意。也許這位失主會因為找回皮夾很高興,而給我們獎賞。那我們就知道這件事作對了,而且我們也會有錢吃點心。
湯姆:唉,好吧,或許你的計畫比較好。
練習:
和朋友練習在下列情況下,表達相同或不同的意見:
1. 你和一位朋友剛從美術館裡出來。你們都認為一位新出道畫家的畫,是你們看過最好的作品。
2. 你和一位朋友要到城的另一頭看電影。你想搭公車,可是你的朋友堅持搭計程車。
3. 你正計畫和先生(或太太)共度假期。你想要去海邊,可是你的配偶想去山上。
insist (v) 堅持
spouse (n) 配偶
沖浪的過程是斷在哪的DOS指令
說明:可顯示封包在IP網路經過的路由器的IP位址。
Linux系統:tracepath
Windows系統:tracert
用法範例:
在DOS視窗(命令提示字元)中輸入: tracert tw.yahoo.com
範例:
在上限 30 個躍點上
追蹤 tw.frontpage.g03.yahoodns.net [119.160.246.241] 的路由:
1 7 ms 7 ms 7 ms h254.s98.ts.hinet.net [168.95.98.254]
2 16 ms 9 ms 7 ms h254.s98.ts.hinet.net [168.95.98.254]
3 6 ms 7 ms 6 ms caw1-3301.hinet.net [168.95.128.30]
4 14 ms 14 ms 13 ms 220-128-28-90.HINET-IP.hinet.net [220.128.28.90]
5 14 ms 14 ms 14 ms SKC1-3011.hinet.net [220.128.24.74]
6 16 ms 15 ms 15 ms TPDT-3011.hinet.net [220.128.1.114]
7 14 ms 13 ms 13 ms TPDT-3301.hinet.net [220.128.3.137]
8 16 ms 82 ms 15 ms 211.22.41.45
9 15 ms 15 ms 16 ms te-8-1.bas1-1-prd.tw1.yahoo.com [119.160.240.1]
10 14 ms 14 ms 15 ms w1.www.vip.tw1.yahoo.com [119.160.246.241]
追蹤完成。
Linux系統:tracepath
Windows系統:tracert
用法範例:
在DOS視窗(命令提示字元)中輸入: tracert tw.yahoo.com
範例:
在上限 30 個躍點上
追蹤 tw.frontpage.g03.yahoodns.net [119.160.246.241] 的路由:
1 7 ms 7 ms 7 ms h254.s98.ts.hinet.net [168.95.98.254]
2 16 ms 9 ms 7 ms h254.s98.ts.hinet.net [168.95.98.254]
3 6 ms 7 ms 6 ms caw1-3301.hinet.net [168.95.128.30]
4 14 ms 14 ms 13 ms 220-128-28-90.HINET-IP.hinet.net [220.128.28.90]
5 14 ms 14 ms 14 ms SKC1-3011.hinet.net [220.128.24.74]
6 16 ms 15 ms 15 ms TPDT-3011.hinet.net [220.128.1.114]
7 14 ms 13 ms 13 ms TPDT-3301.hinet.net [220.128.3.137]
8 16 ms 82 ms 15 ms 211.22.41.45
9 15 ms 15 ms 16 ms te-8-1.bas1-1-prd.tw1.yahoo.com [119.160.240.1]
10 14 ms 14 ms 15 ms w1.www.vip.tw1.yahoo.com [119.160.246.241]
追蹤完成。
acer error Warning ! your chass is has been Opened
原因:因為打開過側蓋,而電腦卻判斷你的側蓋沒關上,試過好幾次卻都沒有辦法關的很緊,只好把這功能關掉了。
解法:
1.開機後按下[Del]進入[BIOS]
2.進入[BIOS Security Features]選項
3.將[Chassis Opened Warning]選項由原本的[Enable]改為[Disabled]即可
解法:
1.開機後按下[Del]進入[BIOS]
2.進入[BIOS Security Features]選項
3.將[Chassis Opened Warning]選項由原本的[Enable]改為[Disabled]即可
2012年7月18日 星期三
Convert CSS into programmable CSS with LESS syntax
This class can convert CSS into programmable CSS with LESS (Leaner CSS) syntax.
It can parse a given CSS style sheet and extract certain common property constant values to turn them into variables in the converted output using LESS .
Currently it turns the CSS properties into LESS variables: color, width, height, font-family and font-size.
範例:/test/css2less_sample.php
It can parse a given CSS style sheet and extract certain common property constant values to turn them into variables in the converted output using LESS .
Currently it turns the CSS properties into LESS variables: color, width, height, font-family and font-size.
include_once 'css2less/class.css2less.php';
# sample: creates less source
$css = <<< EOD
#sidebar {
padding: 0;
margin: 0;
font-size: 11px;
width: 217px;
position: absolute;
top: 45px;
left: 0;
background-color: #EFEFEF;
color: #444;
}
#sidebar h3 {
clear: both;
padding: 0;
font-size: 12px;
font-weight: bold;
}
#sidebar input[type='text'],
#sidebar input[type='password'],
#sidebar textarea {
width: 186px;
padding: 6px 5px;
color: #626262;
font-family: "Lucida Grande", "Lucida Sans", "Lucida Sans Unicode", "Luxi Sans", Tahoma, sans-serif;
font-size: 1em;
border: 1px solid #CCC;
box-shadow: inset 0 1px 3px #E4E4E4;
}
EOD;
$cls = new CSS2LESS($css);
$less = $cls->convert();
echo sprintf('<pre>%s</pre>
', $less);
範例:/test/css2less_sample.php
基本選擇器
* $('*')
獲取檔案中的所有元素(包括html, head, body, etc)。
$('*')
$('#all *') id="all"的所有后代元素
#id $('#id')
根据指定的ID属性匹配一个元素。也可以结合CSS选择器的规则获取元素。
$('#id')
$('#id_1, #id_2') id="id_1"和id="id_2"的元素
$('#id_1 #id_2') id="id_1"的元素包含id="id_2"的元素
element $('element')
根据给定的元素名获取所有元素
$('div')
.class $('.class')
根据给定的类名获取所有元素(多个元素可以拥有相同的类名,一个元素可以有多个类名)
$('.class')
$('selector1, selector2, selectorN')
合并给定选择器的结果并返回,selector必须是合法的jQuery选择器。
$('div, #id, p.class')
獲取檔案中的所有元素(包括html, head, body, etc)。
$('*')
$('#all *') id="all"的所有后代元素
#id $('#id')
根据指定的ID属性匹配一个元素。也可以结合CSS选择器的规则获取元素。
$('#id')
$('#id_1, #id_2') id="id_1"和id="id_2"的元素
$('#id_1 #id_2') id="id_1"的元素包含id="id_2"的元素
element $('element')
根据给定的元素名获取所有元素
$('div')
.class $('.class')
根据给定的类名获取所有元素(多个元素可以拥有相同的类名,一个元素可以有多个类名)
$('.class')
$('selector1, selector2, selectorN')
合并给定选择器的结果并返回,selector必须是合法的jQuery选择器。
$('div, #id, p.class')
2012年7月17日 星期二
滑鼠滑過去(文字)就變色
a:link, a:visited, a:hover, a:active{
text-decoration:underline;
color:#6a5acd;
background-color:transparent;
}
另一個範例: a:link, a:visited{
text-decoration:underline;
color:#6a5acd;
background-color:transparent;
}
a:hover, a:active {
text-decoration:underline overline;
color:#191970;
background-color:#c9c3ed;
}
訂閱:
文章 (Atom)
