2012年1月15日 星期日

word 2007如何用掃描器直接掃描圖片到word裡?

首先在word的「插入」頁籤裡選擇如圖示的美工圖案。

image

接著會在工作區的右邊看到如下圖紅色箭頭所指之區域,然後選擇所指的「多媒體藝廊」。

image

接著會跳出如下圖之工作視窗,然後依下圖中紅色箭頭所指之步驟,先後選擇「檔案」、「新增多媒體項目到多媒體藝廊」、「從掃描器或照相機」。

image

會跳出如下圖之對話框!然後選擇你的掃描器(你的會與我的不同),然後選擇「自訂插入」選項!(這樣才能設定你要掃描的區域!)

image

接著往下會跳出你平時使用你的掃描器的程式,而你也就只要就你平日的用法來操作它即可!這幫我先選擇預覽!

image

預覽完後,我再設定所要掃描的範圍!

image

接著設定完範圍後,我才點選正式掃描!

image

在你掃描完圖像後,你會看到所掃的圖片已進到「多媒體藝廊」裡了!

接著在你要插入要word的圖片上按滑鼠右鍵,選擇其中的「複製」選擇!

image

再到word裡按滑鼠右鍵,選擇貼上,這樣,你掃描的圖片就插入到word 2007裡了!

image

2012年1月8日 星期日

點將家卡巧系列如何升級?

首先到其網站上下載最新的系統,接著將下載之壓縮檔解壓縮,將所有檔案燒在一塊光碟片裡,再依說明書裡指示的方式更新即可!

2012年1月7日 星期六

php已安裝已起動,mysql已安裝已起動,httpd已起動,但到web伺服器查看網頁時,卻說你還沒裝mysql伺服器?

會遇到這樣的現象,可能是你的php-mysql module還沒安裝,
可以
yum -y install php-mysql
來安裝。

php(mysql)上傳限製之設定

用 root 身分編輯 /etc/php.ini , 修改以下資訊:
max_execution_time = 300 ; //每個 script 執行時間上限, 單位是秒.
max_input_time = 300 ; //每個 script 處理輸入資料可用時間上限, 單位是秒.
memory_limit = 999M ; //每個執行中的 script 最多可使用的系統記憶體資源.
post_max_size = 800M ; //PHP 能夠接受發表文章的容量上限.
file_uploads = On ; //這個不用改, 安裝完就是 On 了, 請確定你的也是 On.
upload_max_filesize = 800M ; //允許上傳檔案的最大容量.
default_socket_timeout = 300; //Socket 無回應斷線時間上限.
mysql.connect_timeout = -1 ; //MYSQL 無回應斷線時間上限, -1 代表永遠等下去.

memory_limit > post_max_size > upload_max_size
如果你打算讓你的系統能夠上傳更大的檔案, 可以自行增加某些數值.
但設定過大的值, 不保證系統的穩定性.


有些數值有相互關係, 例如, memory_limit 必須大於 upload_max_filesize 與 post_max_size.

2012年1月6日 星期五

linux 如何關掉SELINUX?

關掉SELINUX,在/etc/selinux/config 設定檔如下;
/etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=Disabled  #這樣就把SELINUX伺服器關掉了,請重新開機系統;
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted
如果只要關掉selinux而不想重新開機,可以直接下如下指令:setenforce 0

2012年1月5日 星期四

我將原來centos 5廢掉改安裝在centos 6 的方法!

原來在centos 5下,除了系統硬之外,還有兩顆獨立的硬碟,其結構如下

/dev/mapper/VolGroup00-LogVol00
                     113410608  12249788  95306820  12% /
/dev/sda1             19919336    235208  18654668   2% /boot
tmpfs                  1553280         0   1553280   0% /dev/shm
/dev/sdc1            480719056 116089924 340209932  26% /var/www/g2data
/dev/sdb1            480719056 190972784 265327072  42% /var/www/html

其中

/dev/sda1    為第一顆系統碟

/dev/sdb1    為第二顆資料碟(裡面裝著gallery2的所有資料)   掛載路徑  /var/www/g2data

/dev/sdc1    為第三顆資料碟(裡面裝著其它所有網頁服務管理程式及資料)   掛載路徑  /var/www/html

 

由於是要在一個新的硬碟裡架設新的系統

所以我在一顆新的硬碟裡安裝centos 6

安裝完後 先以yum –y update更新到最新的版本

接著安裝webmin

接著將原系統內之httpd.conf與iptables複製到新的系統內

接著開啟/etc/fstab將最底部加上下列兩行(使系統開機時自動掛載硬碟到/var/www/g2data與/var/www/html)

/dev/sdc1  /var/www/g2data  ext3  nosuid,noexec,nodev  0  0
/dev/sdb1  /var/www/html  ext3  nosuid,noexec,nodev  0  0

再在系統裡安裝ffmpeg與MPlayer及MEncoder(方法請看這篇文章:centos 安裝ffmpeg 及 mplayer mencoder)

還要將原先執行自動備份之contra…的檔案複製到目的地,如此才能接續原先的自動備份功能!

另外/home/http_user這個資料夾整個拷備到新系統的相對位置。

/var底下有幾個自己寫的幾個簡單的script也要拷備到相對位置!

其間會遇到防火牆設定的問題,我必須將舊主機的防火牆設定檔拷回新主機,新主機的senlinux也必須關掉!

然而在重新安裝完後,我遇到了ostube亂碼的問題,也就是在phpMyadmin裡看檔案資料都可以正常觀看中文,如下圖

image

但當我到ostube網站觀看資料時,卻出現如下圖的亂碼?

image

上網找了半天沒有看到像我這樣的問題,但卻有看到有提到網站看沒問題到資料庫端看會出現亂碼的例子,如是我就試著做看看將(資料來源:阿杰老師的 osTube 實驗室

開啟程式 

var/www/ostube/includes/class.database.php

約第50行:找到function DBaccess

往下找到$this->connected = true;(第59行)

在上一行插入@mysql_query("SET NAMES utf8",$this->connection);

參考程式碼如下:


if(!$this -> connection = @mysql_connect($DBhost,$DBuser,$DBpass)) {
     if($this->debug) die("Error: Can not connect to database - " . $DBhost);
              unset($this);
              return false;
         } else {
               $this->connected = true;
          }
改成
if(!$this -> connection = @mysql_connect($DBhost,$DBuser,$DBpass)) {
     if($this->debug) die("Error: Can not connect to database - " . $DBhost);
         unset($this);
         return false;
    } else {
@mysql_query("SET NAMES utf8", $this->connection);
          $this->connected = true;
       }

也就解決了我ostbue亂碼的問題了!真高興!

image

2012年1月4日 星期三

centos 安裝ffmpeg 及 mplayer mencoder

Installing FFmpeg, MPlayer and MEncoder on CPanel and Centos 6 on Hyper-V
Posted in Linux Server, Virtual Machine Manager | 5 Comments | 1,108 views | 03/10/2011 13:52
You need FFmpeg, MPlayer and MEncoder for video processing. I’ll show you how to install and configure it on Hyper-V.
I’ve already posted couple of articles about CentOS 6 installation on Hyper-V, so I won’t mention about that again.
You can see CentOS 6 installation on Hyper-V at the following posts:
So I assume you have a CentOS 6 with Hyper-V LIS v3.1. So lets continue with our installation.
First, we need to install RPMforge repository on CentOS 6.
1. Install the DAG GPG key.
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt


2. Download RPMforge-release package.
cd /home
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm (if your server x86)
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

3. Verify the RPMforge-release package you have downloaded.
rpm -K rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

4. Install the RPMforge-release package.
rpm -i rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

5. Now we can install FFmpeg, MPlayer and MEncoder.
yum install ffmpeg ffmpeg-devel mplayer mencoder

6. You may get this error when you try to install components.
Requires: perl-SGMLSpm >= 1.03ii

7. Download perl-SGMLSpm package to CentOS.
wget http://ftp.twaren.net/Linux/Scientific/41/i386/SL/RPMS/perl-SGMLSpm-1.03ii-14.noarch.rpm

8. perl-SGMLSpm may require OpenJade.

9. Let’s install openjade on CentOS.
yum install openjade

10. Try re-install perl-SGMLSpm.
rpm -ivh perl-SGMLSpm-1.03ii-14.noarch.rpm

11. After perl-SGMLSpm installation, you can continue to install FFmpeg, MPlayer and MEncoder.
yum install ffmpeg ffmpeg-devel mplayer mencoder

12. Now, you can test your ffmpeg installation.
ffmpeg -v

If you see same results on your server, it means your ffmpeg is ready.

2012年1月3日 星期二

linux 開機執行層級之設定

打開這個檔案
/etc/inittab
將其中的
id:3:initdefault:
其中的3改為你要的層級即可

2011年11月19日 星期六

dreamweaver PHP mysql 可以批次更新資料的方法!

底下所提的批次更新資料的方法,是建立在你必須對於DREAMWEAVER的基本更新資料的方法已經有一定的了解之後,才易看懂筆者所寫的內容。若你對DREAMWEAVER更新單筆資料的方法尚且不懂,則不建議你繼續看下去!
這邊筆者僅針對批次更改與單筆更改資料之主要差異處作說明而已:
image
一、首先如上圖,你必須對所有要更新資料的表單欄位之名稱後面加入陣列符如上圖中的score[]
image
二、當然更新資料所必須的隱藏欄位所指向的索引欄也須需如上圖中的index[]一樣加入[]
三、接著在伺服器行為裡加入更新資料(這邊因為一般的圖資料都有提到,所以就跳過,不細述了!)
四、最後在程式碼模式下找到更新資料的語法部份,例如(注意你的語法決對不可能完全與我的一樣,所以你必須視自己的狀況調整):
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE all_data SET leader_study_1=%s, study_mark1=%s WHERE `index`=%s",
                       GetSQLValueString($_POST['score[]'], "int"),
                       GetSQLValueString($_POST['textfield[]'], "text"),
                       GetSQLValueString($_POST['index[]'], "int"));
  mysql_select_db($database_load, $load);
  $Result1 = mysql_query($updateSQL, $load) or die(mysql_error());
  $updateGoTo = "leader_study.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}
改為
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
    $countNum=count($_POST['index']);
        for($i=0 ; $i<$countNum ; $i++){
  $updateSQL = sprintf("UPDATE all_data SET leader_study_1=%s, study_mark1=%s WHERE `index`=%s",
                       GetSQLValueString($_POST['score'][$i], "int"),
                       GetSQLValueString($_POST['textfield'][$i], "text"),
                       GetSQLValueString($_POST['index'][$i], "int"));
  mysql_select_db($database_load, $load);
  $Result1 = mysql_query($updateSQL, $load) or die(mysql_error());
        }
  $updateGoTo = "leader_study.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}
注意上述的更改中,還要將原來語法中的[]刪處掉!
這樣一來才可以批次更新資料。

2011年10月16日 星期日

PHP頁面中-CKeditor網頁編輯器與CKfinder上傳整合應用

編輯器:CKeditor
支援語法:PHP、ASP、ASP.NET、CF
檔案大小:1.99MB
元件版本:3.5.1
官方展示:http://ckeditor.com/demo
官方下載:http://ckeditor.com/download

上傳元件:CKfinder
檔案大小:1.01MB
支援語法:PHP、ASP、ASP.NET、CF
元件版本:2.0.1
官方展示:http://ckfinder.com/demo
官方下載:http://ckfinder.com/download

step1

下載完畢後,將二個元件放在同一目錄,並新增upload資料夾,用來存放上傳檔案。

step2

開啟ckeditor / config.js,分別新增以下語法,控制編輯器選項與啟用上傳功能。

開啟上傳功能:將下面內容加入ckeditor / config.js中

config.filebrowserBrowseUrl = 'ckfinder/ckfinder.html';
config.filebrowserImageBrowseUrl = 'ckfinder/ckfinder.html?Type=Images';
config.filebrowserFlashBrowseUrl = 'ckfinder/ckfinder.html?Type=Flash';
config.filebrowserUploadUrl = 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files'; //可上傳一般檔案
config.filebrowserImageUploadUrl = 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images';//可上傳圖檔
config.filebrowserFlashUploadUrl = 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash';//可上傳Flash檔案

而成為:

/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

CKEDITOR.editorConfig = function( config )
{
    // Define changes to default configuration here. For example:
    // config.language = 'fr';
    // config.uiColor = '#AADC6E';
[
    ['Source','-','Templates','-','Cut','Copy','Paste'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
'/', ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Format','FontSize','-','TextColor','BGColor']
];
config.filebrowserBrowseUrl = 'ckfinder/ckfinder.html';
config.filebrowserImageBrowseUrl = 'ckfinder/ckfinder.html?Type=Images';
config.filebrowserFlashBrowseUrl = 'ckfinder/ckfinder.html?Type=Flash';
config.filebrowserUploadUrl = 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files'; //可上傳一般檔案
config.filebrowserImageUploadUrl = 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images';//可上傳圖檔
config.filebrowserFlashUploadUrl = 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash';//可上傳Flash檔案

};

Step3
開啟ckfinder / config.php,找到33行將return false改成return true。

{
    // WARNING : DO NOT simply return "true". By doing so, you are allowing
    // "anyone" to upload and list the files in your server. You must implement
    // some kind of session validation here. Even something very simple as...

    // return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];

    // ... where $_SESSION['IsAuthorized'] is set to "true" as soon as the
    // user logs in your system. To be able to use session variables don't
    // forget to add session_start() at the top of this file.
return true;
//    return false; <----註解掉改為上一行的
return true

}

// LicenseKey : Paste your license key here. If left blank, CKFinder will be
// fully functional, in demo mode.
$config['LicenseName'] = '';
$config['LicenseKey'] = '';

/*
Uncomment lines below to enable PHP error reporting and displaying PHP errors.
Do not do this on a production server. Might be helpful when debugging why CKFinder does not work as expected.
*/
// error_reporting(E_ALL);
// ini_set('display_errors', 1);

/*
To make it easy to configure CKFinder, the $baseUrl and $baseDir can be used.
Those are helper variables used later in this config file.
*/

Step4
接著到63行處,設定上傳的目錄位置。

Examples:
    $baseUrl = 'http://example.com/ckfinder/files/';
    $baseUrl = '/userfiles/';

ATTENTION: The trailing slash is required.
*/
// $baseUrl = '/ckfinder/userfiles/';註解掉改為下一行的$baseUrl = '/ckfinder/upload/';

$baseUrl = '/ckfinder/upload/';
/*
$baseDir : the path to the local directory (in the server) which points to the
above $baseUrl URL. This is the path used by CKFinder to handle the files in
the server. Full write permissions must be granted to this directory.

step5

接著在你要使用文字區域的頁面裡加入導入CKEDITOR的核心。找到其<body>下插入下面一段文字串

<script src="ckeditor/ckeditor.js" type="text/javascript"><!--mce:2--></script>

body {
    background-color: #FFFBF0;
}
-->
</style></head>

<body>
<script src="ckeditor/ckeditor.js" type="text/javascript"><!--mce:2--></script>
<div align="center">
<h2><strong>寄信系統</strong>
</h2>
<form id="form1" name="form1" method="post" action="mail_message.php">

step6

找到你要使用CKEDITOR的文字區域的語法,加入class="ckeditor"

  <td bgcolor="#D4DFFF"><div align="right"><strong>內容:</strong></div></td>
  <td bgcolor="#D4DFFF"><div align="left">
      <textarea name="content" class="ckeditor" id="content" cols="50" rows="20"></textarea>
  </div></td>
</tr>
<tr>
  <td bgcolor="#D4DFFF"></td>
  <td bgcolor="#D4DFFF">

最後確認一下可否導入ckeditor?

image

再看可否上傳檔案?

image

一切測試正常!