樹心幽徑

20181227輸入一筆客戶資料並新增到selldb資料庫的custs資料表中(m6.php)
2018/12/27,21:26

(1)code :m6.php
<body bgcolor=lightblue>
<?php
function executeSQL($con,$sql){
    if( $query= mysqli_query($con, $sql) ){ echo " [$sql] OK!<br> "; }
    else { echo " [$sql] Failure!<br> "; }
    return $query;
}

function dumpRecordSet($sql,$con,$bgcolor){
    $query=executeSQL($con,$sql);
    echo "<table bgcolor=$bgcolor border=3>";
    echo "<tr>";
    $fc= mysqli_num_fields($query) ;
    while ($field = mysqli_fetch_field($query)){ printf("<td>%s", $field->name); }
    $rowc=0;
    while ($row = mysqli_fetch_array($query)){
        echo "<tr>";
        for ($i=0;$i<$fc;$i++){
            echo  "<td>" . $row[$i];
        }
        $rowc++;
    }
    echo "</table>";
    echo "資料表 $table 共計有 $rowc 筆資料。<br><br>";
}

echo "請輸入要新增的顧客資料並按確定來寫入:";
echo "<form>";
echo "id <input type=text name=uid size=4 value='101' >";
echo "name <input type=text name=uname size=8 value='小虎' >";
echo "amount <input type=text size=6 name=uamount value='5000'>";
echo "tel <input type=text size=9 name=utel value='02-1234567'>";
echo  "<input type=submit value='確定'>";
echo "</form><hr>";
$uid=$_GET['uid']; $uname=$_GET['uname']; $uamount=$_GET['uamount']; $utel=$_GET['utel'];
if ($uid<>NULL){
    $con = @mysqli_connect('localhost', 'root', 'w?????', 'selldb');
    if (!$con) { echo "Error: " . mysqli_connect_error(); exit(); }
    $sql = 'set names utf8';
    executeSQL($con,$sql);
    $sql="insert into custs (id,name,amount,tel)  values ('$uid','$uname' ,$uamount,'$utel');";
    executeSQL($con,$sql);
    echo "如下資料錄已寫入selldb資料庫的custs資料表中。<br>";
    $sql= "select id,name,amount,tel from custs where id='$uid'";
    dumpRecordSet($sql,$con,'yellow');
    echo "selldb資料庫的custs資料表的全部資料錄如下:<br>";
    $sql= "select id,name,amount,tel from custs";
    dumpRecordSet($sql,$con,'cyan');
    echo "[<a href='m4.php'>刪除程式m4.php</a>] ";
    echo "[<a href='m5.php'>編修程式m5.php</a>] ";
    echo "[<a href='m6.php'>新增程式m6.php</a>] ";
    mysqli_close ($con);
}
?>
</body>

(2)執行結果:

id name amount tel


[set names utf8] OK!
[insert into custs (id,name,amount,tel) values ('101','小虎' ,5000,'02-1234567');] OK!
如下資料錄已寫入selldb資料庫的custs資料表中。
[select id,name,amount,tel from custs where id='101'] OK!

id name amount tel
101 小虎 5000 02-1234567

資料表 共計有 1 筆資料。

selldb資料庫的custs資料表的全部資料錄如下:
[select id,name,amount,tel from custs] OK!

id name amount tel
10001 大樹555 1000 08-2333756
10003 地虎8909 5000 02-444375
101d 小虎5556 5000 02-1234567
101 小虎 5000 02-1234567

資料表 共計有 4 筆資料。

[刪除程式m4.php] [編修程式m5.php] [新增程式m6.php]

20181227終於在ubuntu1604裝上了googleEarth並能開啟gpx航跡檔
2018/12/26,19:10

(1)$ sudo apt update

(2)$ sudo apt install gdebi

(3)$ lscpu
Architecture:          i686
CPU 作業模式:    32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
每核心執行緒數:2
每通訊端核心數:4
Socket(s):             1
供應商識別號:  GenuineIntel
CPU 家族:          6
型號:              60
Model name:            Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
製程:              3
CPU MHz:             3620.812
CPU max MHz:           4000.0000
CPU min MHz:           800.0000
BogoMIPS:              7182.98
虛擬:              VT-x
L1d 快取:          32K
L1i 快取:          32K
L2 快取:           256K
L3 快取:           8192K
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb retpoline tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm xsaveopt dtherm ida arat pln pts
treehrt@treehrt-BM6AE-BM1AE-BP1AE:~$

(4)$ arch
i686  (32bit OS)

(5)$ uname -m
i686(32bit OS)

(6)下載google-earth-pro-stable_7.3.0.3832-r0_i386.deb並安裝之。

無法正常執行…

(7)$ dpkg --list 'google-earth*'
:

||/ 名稱                                          版本                        硬體平台                    簡介
+++-=============================================-===========================-===========================-===============================================================================================
ii  google-earth-pro-stable                       7.3.0.3832-r0               i386                        Explore, search and discover the planet

(8)$ sudo dpkg -P google-earth-pro-stable

移除成功

(9)$ sudo apt-get install googleearth-package


(10)$ make-googleearth-package --force
cat: /etc/mailname: 沒有此一檔案或目錄
--2018-12-26 20:17:08--  http://dl.google.com/earth/client/current/GoogleEarthLinux.bin
正在查找主機 dl.google.com (dl.google.com)... 172.217.160.110, 2404:6800:4008:803::200e
正在連接 dl.google.com (dl.google.com)|172.217.160.110|:80... 連上了。
已送出 HTTP 要求,正在等候回應... 404 Not Found
2018-12-26 20:17:08 錯誤 404: Not Found。
Could not download Google Earth! (You may need to use --file)

(11) $cd /tmp

$ wget http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-security_4.1+Debian13+nmu1_amd64.deb

$ sudo dpkg -i lsb-security_4.1+Debian13+nmu1_amd64.deb
dpkg: error processing archive lsb-security_4.1+Debian13+nmu1_amd64.deb (--install):
 套件的系統平台 (amd64) 與本機系統 (i386) 不符
處理時發生錯誤:
 lsb-security_4.1+Debian13+nmu1_amd64.deb

(12) $ wget http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-security_4.1+Debian13+nmu1_i386.deb

$ sudo dpkg -i lsb-security_4.1+Debian13+nmu1_i386.deb
dpkg: 警告:將 lsb-security 從 9.20160110ubuntu0.2 降級到 4.1+Debian13+nmu1
(讀取資料庫 ... 目前共安裝了 321482 個檔案和目錄。)
準備解開 lsb-security_4.1+Debian13+nmu1_i386.deb ...
Unpacking lsb-security (4.1+Debian13+nmu1) over (9.20160110ubuntu0.2) ...
設定 lsb-security (4.1+Debian13+nmu1) ...

(13) $ wget http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-invalid-mta_4.1+Debian13+nmu1_all.deb

$ sudo dpkg -i lsb-invalid-mta_4.1+Debian13+nmu1_all.deb
dpkg: 警告:將 lsb-invalid-mta 從 9.20160110ubuntu0.2 降級到 4.1+Debian13+nmu1
(讀取資料庫 ... 目前共安裝了 321482 個檔案和目錄。)
準備解開 lsb-invalid-mta_4.1+Debian13+nmu1_all.deb ...
Unpacking lsb-invalid-mta (4.1+Debian13+nmu1) over (9.20160110ubuntu0.2) ...
設定 lsb-invalid-mta (4.1+Debian13+nmu1) ...

(14) $ wget http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-core_4.1+Debian13+nmu1_i386.deb

$ sudo dpkg -i lsb-core_4.1+Debian13+nmu1_i386.deb
dpkg: 警告:將 lsb-core 從 9.20160110ubuntu0.2 降級到 4.1+Debian13+nmu1
(讀取資料庫 ... 目前共安裝了 321482 個檔案和目錄。)
準備解開 lsb-core_4.1+Debian13+nmu1_i386.deb ...
Unpacking lsb-core (4.1+Debian13+nmu1) over (9.20160110ubuntu0.2) ...
設定 lsb-core (4.1+Debian13+nmu1) ...
Processing triggers for man-db (2.7.5-1) ...

(15)$ sudo apt-get install -f

(16)$ sudo reboot

(17)$ sudo dpkg -i google-earth-pro-stable_7.3.0.3832-r0_i386.deb(最新版不支援Ubuntu1604)

(18)自http://deepin.mirror.globo.tech/pool/main/g/google-earth-stable/
     下載 google-earth-pro-stable_7.1.8.3036-r0_i386.deb(改裝舊版以支援Ubuntu1604)

(19)$ sudo dpkg -i google-earth-stable_7.1.8.3036-r0_i386.deb

(20)$ sudo apt-get -f install

(21)終於成功

alt

(22)

$ wget http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-security_4.1+Debian13+nmu1_i386.deb
$ sudo dpkg -i lsb-security_4.1+Debian13+nmu1_i386.deb

$ wget http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-invalid-mta_4.1+Debian13+nmu1_all.deb
$ sudo dpkg -i lsb-invalid-mta_4.1+Debian13+nmu1_all.deb

$ wget http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-core_4.1+Debian13+nmu1_i386.deb

$sudo dpkg -i lsb-core_4.1+Debian13+nmu1_i386.deb
選取了原先未選的套件 lsb-core。
(讀取資料庫 ... 目前共安裝了 271008 個檔案和目錄。)
準備解開 lsb-core_4.1+Debian13+nmu1_i386.deb ...
解開 lsb-core (4.1+Debian13+nmu1) 中...
dpkg: 因相依問題,無法設定 lsb-core:
 lsb-core 相依於 at﹔然而:
  套件 at 未安裝。
 lsb-core 相依於 m4﹔然而:
  套件 m4 未安裝。
 lsb-core 相依於 mailutils | mailx﹔然而:
  套件 mailutils 未安裝。
  套件 mailx 未安裝。
 lsb-core 相依於 pax﹔然而:
  套件 pax 未安裝。
 lsb-core 相依於 alien (>= 8.36)﹔然而:
  套件 alien 未安裝。

dpkg: error processing package lsb-core (--install):
 相依問題 - 保留未設定
Processing triggers for man-db (2.7.5-1) ...
處理時發生錯誤:
 lsb-core

(23)
treehrt@hrt:~$ apt-get -f install

treehrt@hrt:~$ sudo apt install gdebi

treehrt@hrt:~$ sudo dpkg -i lsb-core_4.1+Debian13+nmu1_i386.deb
(讀取資料庫 ... 目前共安裝了 277582 個檔案和目錄。)
準備解開 lsb-core_4.1+Debian13+nmu1_i386.deb ...
Unpacking lsb-core (4.1+Debian13+nmu1) over (4.1+Debian13+nmu1) ...
設定 lsb-core (4.1+Debian13+nmu1) ...
Processing triggers for man-db (2.7.5-1) ...
treehrt@hrt:~$ sudo apt-get install -f

treehrt@hrt:~$ reboot

(24)$ sudo dpkg -i google-earth-stable_7.1.8.3036-r0_i386.deb

(25)$ sudo apt-get -f install

(22~25)第2度安裝仍然成功。

(26-1)$apt-get -f install

(26-2)$wget http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-security_4.1+Debian13+nmu1_i386.deb

(26-3)$ sudo dpkg -i lsb-security_4.1+Debian13+nmu1_i386.deb

(26-4)$ wget http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-invalid-mta_4.1+Debian13+nmu1_all.deb

(26-5)$ sudo dpkg -i lsb-invalid-mta_4.1+Debian13+nmu1_all.deb

(26-6)$ wget http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-core_4.1+Debian13+nmu1_i386.deb

(26-7)$ sudo  apt-get -f install

(26-8a)$ sudo apt install gdebi

(26-8b)$ sudo dpkg -i lsb-invalid-mta_4.1+Debian13+nmu1_all.deb

(26-8c)$ sudo dpkg -i lsb-security_4.1+Debian13+nmu1_i386.deb

(26-9)$ lscpu
Architecture:          x86_64
CPU 作業模式:    32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
每核心執行緒數:1
每通訊端核心數:4
Socket(s):             1
NUMA 節點:         1
供應商識別號:  GenuineIntel
CPU 家族:          6
型號:              158
Model name:            Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
製程:              9
CPU MHz:             994.307
CPU max MHz:           3800.0000
CPU min MHz:           800.0000
BogoMIPS:              6816.00
虛擬:              VT-x
L1d 快取:          32K
L1i 快取:          32K
L2 快取:           256K
L3 快取:           6144K
NUMA node0 CPU(s):     0-3
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d

(26-10a)wget http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-security_4.1+Debian13+nmu1_amd64.deb

(26-10b) sudo dpkg -i lsb-security_4.1+Debian13+nmu1_amd64.deb

(26-11a) wget http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-core_4.1+Debian13+nmu1_amd64.deb

(26-11b)$  sudo dpkg -i lsb-core_4.1+Debian13+nmu1_amd64.deb
:dpkg: 因相依問題,無法設定 lsb-core:
:處理時發生錯誤:
 lsb-core

(26-12)$ sudo apt-get -f install(要先執行)

(26-13)$  sudo dpkg -i lsb-core_4.1+Debian13+nmu1_amd64.deb 成功

(26-14)$ sudo dpkg -i google-earth-stable_7.1.8.3036-r0_amd64.deb 終於成功

第3台採64位元OS(amd64)安裝成功。

(27-1)$ lscpu
Architecture:          x86_64
CPU 作業模式:    32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                12
On-line CPU(s) list:   0-11
每核心執行緒數:2
每通訊端核心數:6
Socket(s):             1
NUMA 節點:         1
供應商識別號:  GenuineIntel
CPU 家族:          6
型號:              158
Model name:            Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
製程:              10
CPU MHz:             4445.784
CPU max MHz:           4600.0000
CPU min MHz:           800.0000
BogoMIPS:              6384.00
虛擬:              VT-x
L1d 快取:          32K
L1i 快取:          32K
L2 快取:           256K
L3 快取:           12288K
NUMA node0 CPU(s):     0-11
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti retpoline intel_pt rsb_ctxsw spec_ctrl ssbd tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp

(27-2)$ sudo  apt-get -f install
:以下套件為自動安裝,並且已經無用:
  linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic linux-headers-4.15.0-30
  linux-headers-4.15.0-30-generic linux-headers-4.15.0-32 linux-headers-4.15.0-32-generic
  linux-headers-4.15.0-33 linux-headers-4.15.0-33-generic linux-headers-4.15.0-34
  linux-headers-4.15.0-34-generic linux-headers-4.15.0-36 linux-headers-4.15.0-36-generic
  linux-image-4.15.0-29-generic linux-image-4.15.0-30-generic linux-image-4.15.0-32-generic
  linux-image-4.15.0-33-generic linux-image-4.15.0-34-generic linux-image-4.15.0-36-generic
  linux-modules-4.15.0-29-generic linux-modules-4.15.0-30-generic linux-modules-4.15.0-32-generic
  linux-modules-4.15.0-33-generic linux-modules-4.15.0-34-generic linux-modules-4.15.0-36-generic
  linux-modules-extra-4.15.0-29-generic linux-modules-extra-4.15.0-30-generic
  linux-modules-extra-4.15.0-32-generic linux-modules-extra-4.15.0-33-generic
  linux-modules-extra-4.15.0-34-generic linux-modules-extra-4.15.0-36-generic
Use 'sudo apt autoremove' to remove them.
升級 0 個,新安裝 0 個,移除 0 個,有 141 個未被升級。

(27-3)$ sudo apt autoremove
:下列套件將會被【移除】:
  linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic linux-headers-4.15.0-30
  linux-headers-4.15.0-30-generic linux-headers-4.15.0-32 linux-headers-4.15.0-32-generic
  linux-headers-4.15.0-33 linux-headers-4.15.0-33-generic linux-headers-4.15.0-34
  linux-headers-4.15.0-34-generic linux-headers-4.15.0-36 linux-headers-4.15.0-36-generic
  linux-image-4.15.0-29-generic linux-image-4.15.0-30-generic linux-image-4.15.0-32-generic
  linux-image-4.15.0-33-generic linux-image-4.15.0-34-generic linux-image-4.15.0-36-generic
  linux-modules-4.15.0-29-generic linux-modules-4.15.0-30-generic linux-modules-4.15.0-32-generic
  linux-modules-4.15.0-33-generic linux-modules-4.15.0-34-generic linux-modules-4.15.0-36-generic
  linux-modules-extra-4.15.0-29-generic linux-modules-extra-4.15.0-30-generic
  linux-modules-extra-4.15.0-32-generic linux-modules-extra-4.15.0-33-generic
  linux-modules-extra-4.15.0-34-generic linux-modules-extra-4.15.0-36-generic
升級 0 個,新安裝 0 個,移除 30 個,有 141 個未被升級。
此操作完成之後,會空出 2,017 MB 的磁碟空間。
是否繼續進行 [Y/n]? [Y/n] y

(27-4)~$ sudo apt install gdebi
正在讀取套件清單... 完成
正在重建相依關係         
正在讀取狀態資料... 完成
下列的額外套件將被安裝:
  gdebi-core gksu gnome-icon-theme libgksu2-0
下列【新】套件將會被安裝:
  gdebi gdebi-core gksu gnome-icon-theme libgksu2-0
升級 0 個,新安裝 5 個,移除 0 個,有 141 個未被升級。
需要下載 9,787 kB 的套件檔。
此操作完成之後,會多佔用 17.0 MB 的磁碟空間。
是否繼續進行 [Y/n]? [Y/n] y
下載:1 http://tw.archive.ubuntu.com/ubuntu xenial/main amd64 gdebi-core all 0.9.5.7ubuntu1 [9,716 B]
下載:2 http://tw.archive.ubuntu.com/ubuntu xenial/universe amd64 libgksu2-0 amd64 2.0.13~pre1-6ubuntu8 [71.8 kB]
下載:3 http://tw.archive.ubuntu.com/ubuntu xenial/universe amd64 gksu amd64 2.0.2-9ubuntu1 [51.5 kB]
下載:4 http://tw.archive.ubuntu.com/ubuntu xenial/universe amd64 gnome-icon-theme all 3.12.0-1ubuntu3 [9,630 kB]
下載:5 http://tw.archive.ubuntu.com/ubuntu xenial/universe amd64 gdebi all 0.9.5.7ubuntu1 [23.6 kB]
取得 9,787 kB 用了 5秒 (1,922 kB/s)
選取了原先未選的套件 gdebi-core。
(讀取資料庫 ... 目前共安裝了 316245 個檔案和目錄。)
準備解開 .../gdebi-core_0.9.5.7ubuntu1_all.deb ...
解開 gdebi-core (0.9.5.7ubuntu1) 中...
選取了原先未選的套件 libgksu2-0。
準備解開 .../libgksu2-0_2.0.13~pre1-6ubuntu8_amd64.deb ...
解開 libgksu2-0 (2.0.13~pre1-6ubuntu8) 中...
選取了原先未選的套件 gksu。
準備解開 .../gksu_2.0.2-9ubuntu1_amd64.deb ...
解開 gksu (2.0.2-9ubuntu1) 中...
選取了原先未選的套件 gnome-icon-theme。
準備解開 .../gnome-icon-theme_3.12.0-1ubuntu3_all.deb ...
解開 gnome-icon-theme (3.12.0-1ubuntu3) 中...
選取了原先未選的套件 gdebi。
準備解開 .../gdebi_0.9.5.7ubuntu1_all.deb ...
解開 gdebi (0.9.5.7ubuntu1) 中...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for gconf2 (3.2.6-3ubuntu6) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.2) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
設定 gdebi-core (0.9.5.7ubuntu1) ...
設定 libgksu2-0 (2.0.13~pre1-6ubuntu8) ...
update-alternatives: using /usr/share/libgksu/debian/gconf-defaults.libgksu-sudo to provide /usr/share/gconf/defaults/10_libgksu (libgksu-gconf-defaults) in auto mode
設定 gnome-icon-theme (3.12.0-1ubuntu3) ...
Processing triggers for gconf2 (3.2.6-3ubuntu6) ...
設定 gksu (2.0.2-9ubuntu1) ...
設定 gdebi (0.9.5.7ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...

(27-5)wget http://dl.google.com/linux/earth/deb/pool/main/g/google-earth-pro-stable/google-earth-pro-stable_7.3.1.4507-r0_amd64.deb

(27-6)~$  sudo dpkg -i google-earth-pro-stable_7.3.1.4507-r0_amd64.deb
選取了原先未選的套件 google-earth-pro-stable。
(讀取資料庫 ... 目前共安裝了 322403 個檔案和目錄。)
準備解開 google-earth-pro-stable_7.3.1.4507-r0_amd64.deb ...
解開 google-earth-pro-stable (7.3.1.4507-r0) 中...
設定 google-earth-pro-stable (7.3.1.4507-r0) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.2) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...

(27-7) $ dpkg --list 'google-earth*'

||/ 名稱                 版本            硬體平台        簡介
+++-====================-===============-===============-=============================================
ii  google-earth-pro-sta 7.3.1.4507-r0   amd64           Explore, search and discover the planet
treehrt@treehrt-fire:~$

(27-8)第4台Ubuntu1604安裝最新版google-earth-pro-sta 7.3.1.4507-r0 (amd64)成功

不需要再裝lsb-core,可惜開啟gpx航跡檔沒有作用

alt

 

REF1: http://blog.topspeedsnail.com/archives/4717

REF2:https://askubuntu.com/questions/965853/google-earth-doesnt-show-map

20181226列出selldb資料庫的cust資料表的所有資料錄並編修選定的資料錄(m5.php)
2018/12/26,13:31

(1)code m5.php

treehrt@treehrt-D630MT:~/phpsell$ cat m5.php
<body bgcolor=lightblue>
<?php

function executeSQL($con,$sql){
    if( $query= mysqli_query($con, $sql) ){ echo " [$sql] OK!<br> "; }
    else { echo " [$sql] Failure!<br> "; }
    return $query;
}

function dumpRecordSetForEdit($sql,$con,$bgcolor){
    $query=executeSQL($con,$sql);
    echo "<table bgcolor=$bgcolor border=3>";
    echo "<tr>";
    $fc= mysqli_num_fields($query) ;
    while ($field = mysqli_fetch_field($query)){ printf("<td>%s", $field->name); }
    echo "<td>EDIT";
    $rowc=0;
    while ($row = mysqli_fetch_array($query)){
        echo "<tr>";
        for ($i=0;$i<$fc;$i++){
            echo  "<td>" . $row[$i];
        }
        echo "<td><a href='m5.php?id=" . $row[0] . "'>Edit</a>";
        $rowc++;
    }
    echo "</table>";
    echo "資料表 $table 共計有 $rowc 筆資料。<br><br>";
}


$con = @mysqli_connect('localhost', 'root', 'w?????', 'selldb');
if (!$con) { echo "Error: " . mysqli_connect_error(); exit(); }
$sql = 'set names utf8';
$query=executeSQL($con,$sql);
$sql= "select id,name,amount,tel from custs";
dumpRecordSetForEdit($sql,$con,"cyan");
$id=$_GET['id'];
$uname="mo";
if ($id<>NULL){
    $sql="select id,name,amount,tel from custs where id='$id'";
    echo "待修的資料錄(id=$id)如下<br>";
    dumpRecordSetForEdit($sql,$con,"cyan");
    $query=executeSQL($con,$sql);
    $row = mysqli_fetch_array($query);
    $uname=$row[1]; $uamount=$row[2]; $utel=$row[3];
    echo "請修改下列待修資料並按確定來寫入編修:";
    echo "<form>";
    echo "id <input type=text name=uid size=4 value=$id>";
    echo "name <input type=text name=uname size=8 value=$uname >";
    echo "amount <input type=text size=6 name=uamount value=$uamount>";
    echo "tel <input type=text size=9 name=utel value=$utel>";
    echo  "<input type=submit value=Submit>";
    echo "</form><hr>";
}
$uid=$_GET['uid']; $uname=$_GET['uname']; $uamount=$_GET['uamount']; $utel=$_GET['utel'];
if ($uname<>NULL){
    $sql= "update custs set name='$uname' ,amount=$uamount ,tel='$utel' where id='$uid'";
    $query=executeSQL($con,$sql);
}
mysqli_close ($con);
?>
</body>

 

(2)執行結果

[set names utf8] OK!
[select * from custs] OK!

id name amount tel EDIT
10002 天牛9 3122 03-933375 Edit
10003 地虎6 5000 02-444375 Edit

資料表 共計有 2 筆資料。

待修的資料錄(id=10003)如下
[select * from custs where id='10003'] OK!

id name amount tel EDIT
10003 地虎6 5000 02-444375 Edit

資料表 共計有 1 筆資料。

[select * from custs where id='10003'] OK!
請修改下列待修資料並按確定來寫入編修:id name amount tel

 

20181224設計PHP函數dumpTable來列出selldb資料庫的custs資料表的全部資料錄(a3.php)
2018/12/24,16:03

(1) code 

 

<body background=dog.png>
<?phpfunction dumpTable($table,$con,$bgcolor){    $sql= "select * from $table";    if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; }     else { echo " $sql Failure!<br> "; }     echo "<table bgcolor=$bgcolor border=3>";    echo "<tr>";    $fc= mysqli_num_fields($query) ;    while ($field = mysqli_fetch_field($query)){        printf("<td>%s", $field->name);    }    $rowc=0;    while ($row = mysqli_fetch_array($query)){        echo "<tr>";        for ($i=0;$i<$fc;$i++){            echo  "<td>" . $row[$i];        }        $rowc++;    }    echo "</table>";    echo "資料表 $table 共計有 $rowc 筆資料。<br><br>";}
$con = mysqli_connect('127.0.0.1', 'root', 'w1xxxx???', 'selldb');if (!$con) { echo "Error"; exit(); }dumpTable("custs",$con,"red");dumpTable("custs",$con,"pink");dumpTable("custs",$con,"purple");
mysqli_close ($con);?></body>

(2)result

select * from custs OK!

id name amount tel
10001 小草 1000 08-233375
10002 天牛 3000 03-933375
20002 天牛 3000 03-933375
30002 天牛 3000 03-933375

資料表 custs 共計有 4 筆資料。

select * from custs OK!

id name amount tel
10001 小草 1000 08-233375
10002 天牛 3000 03-933375
20002 天牛 3000 03-933375
30002 天牛 3000 03-933375

資料表 custs 共計有 4 筆資料。

select * from custs OK!

id name amount tel
10001 小草 1000 08-233375
10002 天牛 3000 03-933375
20002 天牛 3000 03-933375
30002 天牛 3000 03-933375

資料表 custs 共計有 4 筆資料。

 

20181222建立selldb資料庫、建立custs資料表、加入資料錄至custs中、列出custs中的資料錄的PHP程式(a2.php)
2018/12/22,16:02

(1)code

<body bgcolor=LIGHTGREEN>
<?php$con = mysqli_connect('127.0.0.1', 'root', 'w1????xxx, 'selldb');if (!$con) { echo "Error"; exit(); }
$sql = 'drop DATABASE selldb;';if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
$sql = 'CREATE DATABASE selldb default character set utf8;';if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
$sql = 'use selldb;';if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
$sql="CREATE TABLE custs (id char(10),name char(20),amount float,tel char(20))";if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
$sql = 'set names utf8;';if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
$sql="insert into custs(id,name,amount,tel) values ('10001','小草',1000,'08-233375');";if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
$sql="insert into custs (id,name,amount,tel) values ('10002','天牛' ,3000,'03-933375');";if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
$sql="insert into custs (id,name,amount,tel) values ('20002','天牛' ,3000,'03-933375');";if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
$sql="insert into custs (id,name,amount,tel) values ('30002','天牛' ,3000,'03-933375');";if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }

$sql= "select id,name,amount,tel from custs";if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
while ($row = mysqli_fetch_array($query)){        echo  $row['id'] . ":" . $row['name'] . ":" . $row['amount'] . "<br>";}
mysqli_close ($con);
?></body>

(2)excute

drop DATABASE selldb; OK!
CREATE DATABASE selldb default character set utf8; OK!
use selldb; OK!
CREATE TABLE custs (id char(10),name char(20),amount float,tel char(20)) OK!
set names utf8; OK!
insert into custs(id,name,amount,tel) values ('10001','小草',1000,'08-233375'); OK!
insert into custs (id,name,amount,tel) values ('10002','天牛' ,3000,'03-933375'); OK!
insert into custs (id,name,amount,tel) values ('20002','天牛' ,3000,'03-933375'); OK!
insert into custs (id,name,amount,tel) values ('30002','天牛' ,3000,'03-933375'); OK!
select id,name,amount,tel from custs OK!
10001:小草:1000
10002:天牛:3000
20002:天牛:3000
30002:天牛:3000

 

20181222在Ubuntu1604裝webp程式庫以解決ImageMagick的編譯問題1;重裝ImageMagick7以解決semaphore編譯問題
2018/12/22,13:14

(1)$ g++  `Magick++-config --cxxflags --cppflags` -I/usr/local/include/ImageMagick-7  mtile6d.c `Magick++-config --ldflags --libs`  -L/usr/local/zlib/lib -lz   -Wall  -export-dynamic -lm -o mtile6d
/usr/bin/ld: 找不到 -lwebp
collect2: error: ld returned 1 exit status

(2)$  sudo apt-get install webp.

 

(3)

$ tar xvzf ImageMagick.tar.gz

:

ImageMagick-7.0.8-19/Platforms.txt

 


(4)

$ cd ImageMagick-7.0.8-19/

$ ./configure

 :

configure:
==============================================================================
ImageMagick is configured as follows. Please verify that this configuration
matches your expectations.

  Host system type: x86_64-pc-linux-gnu
  Build system type: x86_64-pc-linux-gnu

                 Option                        Value
  ------------------------------------------------------------------------------
  Shared libraries  --enable-shared=yes        yes
  Static libraries  --enable-static=yes        yes
  Build utilities   --with-utilities=yes        yes
  Module support    --with-modules=no        no
  GNU ld            --with-gnu-ld=yes        yes
  Quantum depth     --with-quantum-depth=16    16
  High Dynamic Range Imagery
                    --enable-hdri=yes        yes

  Install documentation:            yes

  Delegate Library Configuration:
  BZLIB             --with-bzlib=yes        yes
  Autotrace         --with-autotrace=no        no
  DJVU              --with-djvu=yes        no
  DPS               --with-dps=yes        no
  FFTW              --with-fftw=yes        no
  FLIF              --with-flif=yes        no
  FlashPIX          --with-fpx=yes        no
  FontConfig        --with-fontconfig=yes    yes
  FreeType          --with-freetype=yes        yes
  Ghostscript lib   --with-gslib=no        no
  Graphviz          --with-gvc=yes        no
  HEIC              --with-heic=yes             no
  JBIG              --with-jbig=yes        yes
  JPEG v1           --with-jpeg=yes        yes
  LCMS              --with-lcms=yes        yes
  LQR               --with-lqr=yes        no
  LTDL              --with-ltdl=yes        no
  LZMA              --with-lzma=yes        yes
  Magick++          --with-magick-plus-plus=yes    yes
  OpenEXR           --with-openexr=yes        no
  OpenJP2           --with-openjp2=yes        no
  PANGO             --with-pango=yes        yes
  PERL              --with-perl=no        no
  PNG               --with-png=yes        yes
  RAQM              --with-raqm=yes        no
  RAW               --with-raw=yes            no
  RSVG              --with-rsvg=no        no
  TIFF              --with-tiff=yes        yes
  WEBP              --with-webp=yes        yes
  WMF               --with-wmf=yes        yes
  X11               --with-x=            yes
  XML               --with-xml=yes        yes
  ZLIB              --with-zlib=yes        yes
  ZSTD              --with-zstd=yes        no

  Delegate Program Configuration:
  GhostPCL          None                pcl6 (unknown)
  GhostXPS          None                gxps (unknown)
  Ghostscript       None                gs (9.26)

  Font Configuration:
  Apple fonts       --with-apple-font-dir=default   
  Dejavu fonts      --with-dejavu-font-dir=default    none
  Ghostscript fonts --with-gs-font-dir=default    /usr/share/fonts/type1/gsfonts/
  URW-base35 fonts  --with-urw-base35-font-dir=default  none
  Windows fonts     --with-windows-font-dir=default    none

  X11 Configuration:
        X_CFLAGS        =
        X_PRE_LIBS      =  -lSM -lICE
        X_LIBS          =
        X_EXTRA_LIBS    =

  Options used to compile and link:
    PREFIX          = /usr/local
    EXEC-PREFIX     = /usr/local
    VERSION         = 7.0.8
    CC              = gcc
    CFLAGS          = -I/usr/include/libxml2   -I/usr/include/libpng12  -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12   -I/usr/include/freetype2 -I/usr/include/freetype2   -fopenmp -g -O2 -Wall -mtune=core2 -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
    CPPFLAGS        =   -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
    PCFLAGS         =
    DEFS            = -DHAVE_CONFIG_H
    LDFLAGS         = 
    LIBS            =  -ljbig -llcms2 -ltiff -lfreetype  -ljpeg   -lpng12      -lfontconfig -lfreetype  -lwebpmux -lwebp -lwebp -lwmflite  -lXext    -lSM -lICE -lX11  -llzma -lbz2   -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lcairo   -lxml2  -lz     -lm   
    CXX             = g++
    CXXFLAGS        = -g -O2 -pthread
    FEATURES        = DPC HDRI Cipher OpenMP
    DELEGATES       = bzlib mpeg fontconfig freetype jbig jng jpeg lcms lzma pango png ps tiff webp wmf x xml zlib
==============================================================================

$

(5)$ make

:

ar: `u' modifier ignored since `D' is the default (see `U')
cp -f MagickCore/ImageMagick.pc MagickCore/ImageMagick-7.Q16HDRI.pc
cp -f MagickCore/MagickCore.pc MagickCore/MagickCore-7.Q16HDRI.pc
cp -f MagickWand/MagickWand.pc MagickWand/MagickWand-7.Q16HDRI.pc
cp -f Magick++/lib/Magick++.pc Magick++/lib/Magick++-7.Q16HDRI.pc
make[1]: Leaving directory '/home/treehrt/ImageMagick-7.0.8-19'

(6)$ sudo make install

:

 /bin/mkdir -p '/usr/local/lib/pkgconfig'
 /usr/bin/install -c -m 644 MagickCore/ImageMagick.pc MagickCore/MagickCore.pc MagickCore/ImageMagick-7.Q16HDRI.pc MagickCore/MagickCore-7.Q16HDRI.pc MagickWand/MagickWand.pc MagickWand/MagickWand-7.Q16HDRI.pc Magick++/lib/Magick++.pc Magick++/lib/Magick++-7.Q16HDRI.pc '/usr/local/lib/pkgconfig'
make[2]: Leaving directory '/home/treehrt/ImageMagick-7.0.8-19'
make[1]: Leaving directory '/home/treehrt/ImageMagick-7.0.8-19'

(7)

treehrt@treehrt-D630MT:~/ImageMagick-7.0.8-19$ sudo ldconfig /usr/local/lib
treehrt@treehrt-D630MT:~/ImageMagick-7.0.8-19$ /usr/local/bin/convert logo: logo.gif
treehrt@treehrt-D630MT:~/ImageMagick-7.0.8-19$ ls
aclocal.m4     config         gitversion.sh        Install-unix.txt     logo.gif      Magickshr.opt  NOTICE          tests
AUTHORS.txt    config.log     ImageMagick.spec     Install-vms.txt      m4            MagickWand     PerlMagick      utilities
ChangeLog      config.status  ImageMagick.spec.in  Install-windows.txt  Magick++      Makefile       Platforms.txt   version.sh
coders         configure      images               libtool              MagickCore    Makefile.am    QuickStart.txt  winpath.sh
common.shi     configure.ac   index.html           LICENSE              magick.sh     Makefile.in    README.txt      www
common.shi.in  filters        Install-mac.txt      local.exp            magick.sh.in  NEWS.txt       scripts
treehrt@treehrt-D630MT:~/ImageMagick-7.0.8-19$ pwd
/home/treehrt/ImageMagick-7.0.8-19
treehrt@treehrt-D630MT:~/ImageMagick-7.0.8-19$

 

(8) $make check

PASS: Magick++/demo/demos.tap 24
============================================================================
Testsuite summary for ImageMagick 7.0.8
============================================================================
# TOTAL: 86
# PASS:  86
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[3]: Leaving directory '/home/treehrt/ImageMagick-7.0.8-19'
make[2]: Nothing to be done for 'check-local'.
make[2]: Leaving directory '/home/treehrt/ImageMagick-7.0.8-19'
make[1]: Leaving directory '/home/treehrt/ImageMagick-7.0.8-19'

(9)

treehrt@treehrt-D630MT:~/gtk$ ./mtile6d 312x2689-4x3-cw1.png 312x2686-4x3-cw2.png 312x2683-4x3-cw3.png 312x2680-4x3-cw4.png 312x2677-4x3-cw5.png 312x2674-4x3-cw6.png 2 1
mtile6d: magick/semaphore.c:601: LockSemaphoreInfo: Assertion `semaphore_info != (SemaphoreInfo *) NULL' failed.
已經終止 (core dumped)
treehrt@treehrt-D630MT:~/gtk$ g++  `Magick++-config --cxxflags --cppflags` -I/usr/local/include/ImageMagick-7  mtile6d.c `Magick++-config --ldflags --libs`  -L/usr/local/zlib/lib -lz   -Wall  -export-dynamic -lm -o mtile6d

 

treehrt@treehrt-D630MT:~/gtk$ ./mtile6d 312x2695-4x3-cw10.png 312x2692-4x3-cw0.png 312x2689-4x3-cw1.png 312x2686-4x3-cw2.png 312x2683-4x3-cw3.png 312x2680-4x3-cw4.png  3 1
argv[1]=312x2695-4x3-cw10.png
argv[2]=312x2692-4x3-cw0.png
argv[3]=312x2689-4x3-cw1.png
argv[4]=312x2686-4x3-cw2.png
argv[5]=312x2683-4x3-cw3.png
argv[6]=312x2680-4x3-cw4.png

 0
 0(0,0)
 1
 1(1,0)
 2
 2(2,0)
輸出六圖合併後的圖檔 xtile6d.jpg 成功!

 

20121221可自selldb資料庫的custs資料表選擇要刪除的資料錄來刪除的PHP程式m4.php
2018/12/21,21:01

(1) code : m4.php

<body bgcolor=lightblue>
<?php
function DumpTableForDel($table,$con,$bgcolor){
    $sql= "select * from $table";
    if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
    echo "<table bgcolor=$bgcolor border=3>";
    echo "<tr>";
    $fc= mysqli_num_fields($query) ;
    while ($field = mysqli_fetch_field($query)){
        printf("<td>%s", $field->name);
    }
    echo "<td>DEL";
    $rowc=0;
    while ($row = mysqli_fetch_array($query)){
        echo "<tr>";
        for ($i=0;$i<$fc;$i++){
            echo  "<td>" . $row[$i];
        }
        echo "<td><a href='m4.php?id=" . $row[0] . "'>DEL</a>";
        $rowc++;
    }
    echo "</table>";
    echo "資料表 $table 共計有 $rowc 筆資料。<br><br>";
}
$con = @mysqli_connect('localhost', 'root', 'w10023', 'selldb');
if (!$con) { echo "Error: " . mysqli_connect_error(); exit(); }
$sql = 'set names utf8;';
if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
dumpTableForDel("custs",$con,"yellow");
$id=$_GET['id'];
if ($id<>NULL){
    $sql="delete from custs where id=$id";
    if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
    echo "刪掉 id=$id 的資料錄後,custs資料表內容如下<br>";
    dumpTableForDel("custs",$con,"cyan");
}
mysqli_close ($con);
?>
</body>

(2)執行結果:

set names utf8; OK!
select * from custs OK!

id name amount tel DEL
10001 小草 1000 08-233375 DEL
10002 天牛 3000 03-933375 DEL
10003 地虎 5000 02-444375 DEL

資料表 custs 共計有 3 筆資料。

delete from custs where id=10002 OK!
刪掉 id=10002 的資料錄後,custs資料表內容如下
select * from custs OK!

id name amount tel DEL
10001 小草 1000 08-233375 DEL
10003 地虎 5000 02-444375 DEL

資料表 custs 共計有 2 筆資料。

 

20181220設計PHP函數dumpTable,用來列出selldb資料庫的custs資料表的全部資料錄
2018/12/20,21:02

(1) code : m3.php
<body bgcolor=lightblue>
<?php

function dumpTable($table,$con,$bgcolor){
    $sql= "select * from $table";
    if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
    echo "<table bgcolor=$bgcolor border=3>";
    echo "<tr>";
    $fc= mysqli_num_fields($query) ;
    while ($field = mysqli_fetch_field($query)){
        printf("<td>%s", $field->name);
    }
    $rowc=0;
    while ($row = mysqli_fetch_array($query)){
        echo "<tr>";
        for ($i=0;$i<$fc;$i++){
            echo  "<td>" . $row[$i];
        }
        $rowc++;
    }
    echo "</table>";
    echo "資料表 $table 共計有 $rowc 筆資料。<br><br>";
}

$con = @mysqli_connect('localhost', 'root', 'w1?????', 'selldb');
if (!$con) { echo "Error: " . mysqli_connect_error(); exit(); }
$sql = 'set names utf8;';
if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }
dumpTable("custs",$con,"red");
dumpTable("custs",$con,"green");
dumpTable("custs",$con,"blue");
mysqli_close ($con);

?>
</body>

 

(2)執行結果

set names utf8; OK!
select * from custs OK!

id name amount tel
10001 小草 1000 08-233375
10002 天牛 3000 03-933375
10003 地虎 5000 02-444375

資料表 custs 共計有 3 筆資料。

select * from custs OK!

id name amount tel
10001 小草 1000 08-233375
10002 天牛 3000 03-933375
10003 地虎 5000 02-444375

資料表 custs 共計有 3 筆資料。

select * from custs OK!

id name amount tel
10001 小草 1000 08-233375
10002 天牛 3000 03-933375
10003 地虎 5000 02-444375

資料表 custs 共計有 3 筆資料。

20181219建立selldb資料庫、建立custs資料表、加入三筆資料錄至custs中、列出custs中的資料錄的PHP程式(m2.php)。
2018/12/19,20:39

(1) code:

<body bgcolor=yellow>
<?php
$con = @mysqli_connect('localhost', 'root', 'w1????', 'mysql');
if (!$con) {
    echo "Error: " . mysqli_connect_error();
    exit();
}
echo 'Connected to MySQL OK!<hr>';

$sql = 'drop DATABASE IF EXISTS selldb;';
if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }


$sql = 'CREATE DATABASE selldb default character set utf8;';
if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }

$sql = 'use selldb;';
if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }

$sql    = 'DROP TABLE IF EXISTS custs';
if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }

$sql= "CREATE TABLE custs (id varchar(10) , name varchar(20), amount float default 0, tel   varchar(20)  default 'none' )" ;
if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }

$sql = 'set names utf8;';
if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }

$sql="insert into custs (id,name,amount,tel)  values ('10001','小草' ,1000,'08-233375');";
if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }

$sql="insert into custs (id,name,amount,tel)  values ('10002','天牛' ,3000,'03-933375');";
if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }

$sql="insert into custs (id,name,amount,tel)  values ('10003','地虎' ,5000,'02-444375');";
if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }

$sql= "select id,name,amount,tel from custs";
if( $query= mysqli_query($con, $sql) ){ echo " $sql OK!<br> "; } else { echo " $sql Failure!<br> "; }

echo "資料查詢如下<br>";
while ($row = mysqli_fetch_array($query)){
        echo  $row['id'] . ":" . $row['name'] . ":" . $row['amount'] . ":" . $row['tel'] . "<br>";
}

mysqli_close ($con);

?>
</body>

(2)result:

Connected to MySQL OK!


drop DATABASE IF EXISTS selldb; OK!
CREATE DATABASE selldb default character set utf8; OK!
use selldb; OK!
DROP TABLE IF EXISTS custs OK!
CREATE TABLE custs (id varchar(10) , name varchar(20), amount float default 0, tel varchar(20) default 'none' ) OK!
set names utf8; OK!
insert into custs (id,name,amount,tel) values ('10001','小草' ,1000,'08-233375'); OK!
insert into custs (id,name,amount,tel) values ('10002','天牛' ,3000,'03-933375'); OK!
insert into custs (id,name,amount,tel) values ('10003','地虎' ,5000,'02-444375'); OK!
select id,name,amount,tel from custs OK!
資料查詢如下
10001:小草:1000:08-233375
10002:天牛:3000:03-933375
10003:地虎:5000:02-444375

20181218mysql資料庫連線查詢網頁程式 a1.php (用來列出selldb資料庫中custs資料表的第1筆資料)
2018/12/18,14:57

<body bgcolor=cyan>

<img src=dog.png width=100>

<?php

$con = mysqli_connect('localhost', 'root', 'abc123abc123', 'selldb');

$sql= "select id,name,amount,tel from custs";

$query     = mysqli_query($con, $sql);
$row = mysqli_fetch_array($query);

echo  $row['id'] . ":" . $row['name'] . ":" . $row['amount'] . ":" . $row['tel'] . "<br>";

$row = mysqli_fetch_array($query);echo  $row['id'] . ":" . $row['name'] . ":" . $row['amount'] . ":" . $row['tel'] . "<br>";
?>

 

</body>

 

20181217在ubuntu 1604裝mysql server
2018/12/18,11:47

(1) $ sudo apt-get install mysql-server
:

以下套件為自動安裝,並且已經無用:
  linux-headers-4.10.0-28 linux-headers-4.10.0-28-generic
  linux-image-4.10.0-28-generic linux-image-extra-4.10.0-28-generic
Use 'sudo apt autoremove' to remove them.
下列的額外套件將被安裝:
  libaio1 libevent-core-2.0-5 libhtml-template-perl mysql-client-5.7
  mysql-client-core-5.7 mysql-server-5.7 mysql-server-core-5.7
建議套件:
  libipc-sharedcache-perl mailx tinyca
下列【新】套件將會被安裝:
  libaio1 libevent-core-2.0-5 libhtml-template-perl mysql-client-5.7
  mysql-client-core-5.7 mysql-server mysql-server-5.7 mysql-server-core-5.7
升級 0 個,新安裝 8 個,移除 0 個,有 254 個未被升級。
需要下載 18.4 MB 的套件檔。
此操作完成之後,會多佔用 161 MB 的磁碟空間。
是否繼續進行 [Y/n]? [Y/n] y
下載:1 http://tw.archive.ubuntu.com/ubuntu xenial/main amd64 libaio1 amd64 0.3.110-2 [6,356 B]
下載:2 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client-core-5.7 amd64 5.7.24-0ubuntu0.16.04.1 [6,030 kB]
下載:3 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client-5.7 amd64 5.7.24-0ubuntu0.16.04.1 [1,720 kB]
下載:4 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server-core-5.7 amd64 5.7.24-0ubuntu0.16.04.1 [7,757 kB]
下載:5 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libevent-core-2.0-5 amd64 2.0.21-stable-2ubuntu0.16.04.1 [70.6 kB]
下載:6 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server-5.7 amd64 5.7.24-0ubuntu0.16.04.1 [2,726 kB]
下載:7 http://tw.archive.ubuntu.com/ubuntu xenial/main amd64 libhtml-template-perl all 2.95-2 [60.4 kB]
下載:8 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server all 5.7.24-0ubuntu0.16.04.1 [10.8 kB]
取得 18.4 MB 用了 4秒 (4,018 kB/s)     
正在預先設定套件 ...
選取了原先未選的套件 libaio1:amd64。
(讀取資料庫 ... 目前共安裝了 259353 個檔案和目錄。)
準備解開 .../libaio1_0.3.110-2_amd64.deb ...
解開 libaio1:amd64 (0.3.110-2) 中...
選取了原先未選的套件 mysql-client-core-5.7。
準備解開 .../mysql-client-core-5.7_5.7.24-0ubuntu0.16.04.1_amd64.deb ...
解開 mysql-client-core-5.7 (5.7.24-0ubuntu0.16.04.1) 中...
選取了原先未選的套件 mysql-client-5.7。
準備解開 .../mysql-client-5.7_5.7.24-0ubuntu0.16.04.1_amd64.deb ...
解開 mysql-client-5.7 (5.7.24-0ubuntu0.16.04.1) 中...
選取了原先未選的套件 mysql-server-core-5.7。
準備解開 .../mysql-server-core-5.7_5.7.24-0ubuntu0.16.04.1_amd64.deb ...
解開 mysql-server-core-5.7 (5.7.24-0ubuntu0.16.04.1) 中...
選取了原先未選的套件 libevent-core-2.0-5:amd64。
準備解開 .../libevent-core-2.0-5_2.0.21-stable-2ubuntu0.16.04.1_amd64.deb ...
解開 libevent-core-2.0-5:amd64 (2.0.21-stable-2ubuntu0.16.04.1) 中...
選取了原先未選的套件 mysql-server-5.7。
準備解開 .../mysql-server-5.7_5.7.24-0ubuntu0.16.04.1_amd64.deb ...
解開 mysql-server-5.7 (5.7.24-0ubuntu0.16.04.1) 中...
選取了原先未選的套件 libhtml-template-perl。
準備解開 .../libhtml-template-perl_2.95-2_all.deb ...
解開 libhtml-template-perl (2.95-2) 中...
選取了原先未選的套件 mysql-server。
準備解開 .../mysql-server_5.7.24-0ubuntu0.16.04.1_all.deb ...
解開 mysql-server (5.7.24-0ubuntu0.16.04.1) 中...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu21.10) ...
設定 libaio1:amd64 (0.3.110-2) ...
設定 mysql-client-core-5.7 (5.7.24-0ubuntu0.16.04.1) ...
設定 mysql-client-5.7 (5.7.24-0ubuntu0.16.04.1) ...
設定 mysql-server-core-5.7 (5.7.24-0ubuntu0.16.04.1) ...
設定 libevent-core-2.0-5:amd64 (2.0.21-stable-2ubuntu0.16.04.1) ...
設定 mysql-server-5.7 (5.7.24-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
設定 libhtml-template-perl (2.95-2) ...
設定 mysql-server (5.7.24-0ubuntu0.16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.10) ...
Processing triggers for ureadahead (0.100.0-19) ...
treehrt@treehrt-D630MT:~$

(2)$ sudo apt-get install mysql-client
:

以下套件為自動安裝,並且已經無用:
  linux-headers-4.10.0-28 linux-headers-4.10.0-28-generic linux-image-4.10.0-28-generic linux-image-extra-4.10.0-28-generic
Use 'sudo apt autoremove' to remove them.
下列【新】套件將會被安裝:
  mysql-client
升級 0 個,新安裝 1 個,移除 0 個,有 254 個未被升級。
需要下載 10.1 kB 的套件檔。
此操作完成之後,會多佔用 110 kB 的磁碟空間。
下載:1 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client all 5.7.24-0ubuntu0.16.04.1 [10.1 kB]
取得 10.1 kB 用了 0秒 (50.9 kB/s)      
選取了原先未選的套件 mysql-client。
(讀取資料庫 ... 目前共安裝了 259610 個檔案和目錄。)
準備解開 .../mysql-client_5.7.24-0ubuntu0.16.04.1_all.deb ...
解開 mysql-client (5.7.24-0ubuntu0.16.04.1) 中...
設定 mysql-client (5.7.24-0ubuntu0.16.04.1) ...
treehrt@treehrt-D630MT:~$

(3)

$ sudo apt-get install libmysqlclient-dev
:

libmysqlclient-dev is already the newest version (5.7.24-0ubuntu0.16.04.1).
以下套件為自動安裝,並且已經無用:
  linux-headers-4.10.0-28 linux-headers-4.10.0-28-generic linux-image-4.10.0-28-generic linux-image-extra-4.10.0-28-generic
Use 'sudo apt autoremove' to remove them.
升級 0 個,新安裝 0 個,移除 0 個,有 254 個未被升級。
treehrt@treehrt-D630MT:~$

(4)

$ sudo /etc/init.d/mysql start
[sudo] password for treehrt:
[ ok ] Starting mysql (via systemctl): mysql.service.

$ ps ax|grep mysql
 7404 ?        Ssl    0:03 /usr/sbin/mysqld
 8961 pts/20   S+     0:00 grep --color=auto mysql

(5)

$ mysql -p -uroot
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.24-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit
Bye

 

 

20181217在Ubuntu1604-Linux裝apache2 web server 和 php 7,並設計m1.php資料庫連線查詢程式
2018/12/17,20:17

(1) treehrt@treehrt-BM6AE-BM1AE-BP1AE:~$ sudo apt-get install apache2
:

下列的額外套件將被安裝:
  apache2-bin apache2-data apache2-utils libaprutil1-dbd-sqlite3
  libaprutil1-ldap
建議套件:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom
下列【新】套件將會被安裝:
  apache2 apache2-bin apache2-data apache2-utils libaprutil1-dbd-sqlite3
  libaprutil1-ldap
升級 0 個,新安裝 6 個,移除 0 個,有 455 個未被升級。
需要下載 1,342 kB 的套件檔。
此操作完成之後,會多佔用 5,346 kB 的磁碟空間。
是否繼續進行 [Y/n]? [Y/n] y
:

取得 1,342 kB 用了 7秒 (189 kB/s)                                             
選取了原先未選的套件 libaprutil1-dbd-sqlite3:i386。
(讀取資料庫 ... 目前共安裝了 317470 個檔案和目錄。)
準備解開 .../libaprutil1-dbd-sqlite3_1.5.4-1build1_i386.deb ...
解開 libaprutil1-dbd-sqlite3:i386 (1.5.4-1build1) 中...
選取了原先未選的套件 libaprutil1-ldap:i386。
準備解開 .../libaprutil1-ldap_1.5.4-1build1_i386.deb ...
解開 libaprutil1-ldap:i386 (1.5.4-1build1) 中...
選取了原先未選的套件 apache2-bin。
準備解開 .../apache2-bin_2.4.18-2ubuntu3.9_i386.deb ...
解開 apache2-bin (2.4.18-2ubuntu3.9) 中...
選取了原先未選的套件 apache2-utils。
準備解開 .../apache2-utils_2.4.18-2ubuntu3.9_i386.deb ...
解開 apache2-utils (2.4.18-2ubuntu3.9) 中...
選取了原先未選的套件 apache2-data。
準備解開 .../apache2-data_2.4.18-2ubuntu3.9_all.deb ...
解開 apache2-data (2.4.18-2ubuntu3.9) 中...
選取了原先未選的套件 apache2。
準備解開 .../apache2_2.4.18-2ubuntu3.9_i386.deb ...
解開 apache2 (2.4.18-2ubuntu3.9) 中...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu21.2) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Processing triggers for ufw (0.35-0ubuntu2) ...
設定 libaprutil1-dbd-sqlite3:i386 (1.5.4-1build1) ...
設定 libaprutil1-ldap:i386 (1.5.4-1build1) ...
設定 apache2-bin (2.4.18-2ubuntu3.9) ...
設定 apache2-utils (2.4.18-2ubuntu3.9) ...
設定 apache2-data (2.4.18-2ubuntu3.9) ...
設定 apache2 (2.4.18-2ubuntu3.9) ...
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Processing triggers for systemd (229-4ubuntu21.2) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...

 

(2)

$ sudo systemctl start apache2

$ sudo systemctl enable apache2
apache2.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable apache2

(3)

$ sudo systemctl status apache2
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since 一 2018-12-17 20:19:15 CST; 2min 38s ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/apache2.service
           ├─4771 /usr/sbin/apache2 -k start
           ├─4774 /usr/sbin/apache2 -k start
           └─4775 /usr/sbin/apache2 -k start

12月 17 20:19:14 treehrt-BM6AE-BM1AE-BP1AE systemd[1]: Starting LSB: Apache2 web server...
12月 17 20:19:14 treehrt-BM6AE-BM1AE-BP1AE apache2[4741]:  * Starting Apache httpd web server apache2
12月 17 20:19:14 treehrt-BM6AE-BM1AE-BP1AE apache2[4741]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally
12月 17 20:19:15 treehrt-BM6AE-BM1AE-BP1AE apache2[4741]:  *
12月 17 20:19:15 treehrt-BM6AE-BM1AE-BP1AE systemd[1]: Started LSB: Apache2 web server.
12月 17 20:20:43 treehrt-BM6AE-BM1AE-BP1AE systemd[1]: Started LSB: Apache2 web server.

(4) http://localhost/ 成功看到預設網頁

20181210在Ubuntu1604-Linux裝Anjuta c/c++/gtk IDE
2018/12/10,20:39

(1) $ sudo apt-get install anjuta
[sudo] password for treehrt:
正在讀取套件清單... 完成
正在重建相依關係         
正在讀取狀態資料... 完成
下列的額外套件將被安裝:
  anjuta-common autoconf autogen autogen-doc automake intltool libanjuta-3-0
  libapr1 libaprutil1 libgda-5.0-4 libgda-5.0-common libgdl-3-5
  libgdl-3-common libopts25 libopts25-dev libserf-1-1 libsigsegv2 libsvn1
  libvala-0.30-0 libwebkit2gtk-3.0-25 m4 valac valac-0.30-vapi
建議套件:
  libgtkmm-3.0-dev gjs python-distutils-extra python-rope autoconf-archive
  gnu-standards autoconf-doc libgda-5.0-bin libgda-5.0-mysql
  libgda-5.0-postgres
下列【新】套件將會被安裝:
  anjuta anjuta-common autoconf autogen autogen-doc automake intltool
  libanjuta-3-0 libapr1 libaprutil1 libgda-5.0-4 libgda-5.0-common libgdl-3-5
  libgdl-3-common libopts25 libopts25-dev libserf-1-1 libsigsegv2 libsvn1
  libvala-0.30-0 libwebkit2gtk-3.0-25 m4 valac valac-0.30-vapi
升級 0 個,新安裝 24 個,移除 0 個,有 424 個未被升級。
需要下載 27.7 MB 的套件檔。
此操作完成之後,會多佔用 132 MB 的磁碟空間。
是否繼續進行 [Y/n]? [Y/n] y
:
取得 27.7 MB 用了 2分28秒 (187 kB/s)                                          
選取了原先未選的套件 libapr1:i386。
(讀取資料庫 ... 目前共安裝了 313723 個檔案和目錄。)
準備解開 .../libapr1_1.5.2-3_i386.deb ...
解開 libapr1:i386 (1.5.2-3) 中...
選取了原先未選的套件 libaprutil1:i386。
準備解開 .../libaprutil1_1.5.4-1build1_i386.deb ...
解開 libaprutil1:i386 (1.5.4-1build1) 中...
選取了原先未選的套件 libserf-1-1:i386。
準備解開 .../libserf-1-1_1.3.8-1_i386.deb ...
解開 libserf-1-1:i386 (1.3.8-1) 中...
選取了原先未選的套件 libsigsegv2:i386。
準備解開 .../libsigsegv2_2.10-4_i386.deb ...
解開 libsigsegv2:i386 (2.10-4) 中...
選取了原先未選的套件 libgdl-3-common。
準備解開 .../libgdl-3-common_3.18.0-1_all.deb ...
解開 libgdl-3-common (3.18.0-1) 中...
選取了原先未選的套件 libgdl-3-5:i386。
準備解開 .../libgdl-3-5_3.18.0-1_i386.deb ...
解開 libgdl-3-5:i386 (3.18.0-1) 中...
選取了原先未選的套件 anjuta-common。
準備解開 .../anjuta-common_2%3a3.18.2-1_all.deb ...
解開 anjuta-common (2:3.18.2-1) 中...
選取了原先未選的套件 libanjuta-3-0。
準備解開 .../libanjuta-3-0_2%3a3.18.2-1_i386.deb ...
解開 libanjuta-3-0 (2:3.18.2-1) 中...
選取了原先未選的套件 libgda-5.0-common。
準備解開 .../libgda-5.0-common_5.2.4-1ubuntu1_all.deb ...
解開 libgda-5.0-common (5.2.4-1ubuntu1) 中...
選取了原先未選的套件 libgda-5.0-4。
準備解開 .../libgda-5.0-4_5.2.4-1ubuntu1_i386.deb ...
解開 libgda-5.0-4 (5.2.4-1ubuntu1) 中...
選取了原先未選的套件 libsvn1:i386。
準備解開 .../libsvn1_1.9.3-2ubuntu1.1_i386.deb ...
解開 libsvn1:i386 (1.9.3-2ubuntu1.1) 中...
選取了原先未選的套件 libvala-0.30-0:i386。
準備解開 .../libvala-0.30-0_0.30.1-1_i386.deb ...
解開 libvala-0.30-0:i386 (0.30.1-1) 中...
選取了原先未選的套件 libwebkit2gtk-3.0-25:i386。
準備解開 .../libwebkit2gtk-3.0-25_2.4.11-0ubuntu0.1_i386.deb ...
解開 libwebkit2gtk-3.0-25:i386 (2.4.11-0ubuntu0.1) 中...
選取了原先未選的套件 anjuta。
準備解開 .../anjuta_2%3a3.18.2-1_i386.deb ...
解開 anjuta (2:3.18.2-1) 中...
選取了原先未選的套件 m4。
準備解開 .../archives/m4_1.4.17-5_i386.deb ...
解開 m4 (1.4.17-5) 中...
選取了原先未選的套件 autoconf。
準備解開 .../autoconf_2.69-9_all.deb ...
解開 autoconf (2.69-9) 中...
選取了原先未選的套件 libopts25:i386。
準備解開 .../libopts25_1%3a5.18.7-3_i386.deb ...
解開 libopts25:i386 (1:5.18.7-3) 中...
選取了原先未選的套件 libopts25-dev:i386。
準備解開 .../libopts25-dev_1%3a5.18.7-3_i386.deb ...
解開 libopts25-dev:i386 (1:5.18.7-3) 中...
選取了原先未選的套件 autogen。
準備解開 .../autogen_1%3a5.18.7-3_i386.deb ...
解開 autogen (1:5.18.7-3) 中...
Replaced by files in installed package libopts25-dev:i386 (1:5.18.7-3) ...
選取了原先未選的套件 autogen-doc。
準備解開 .../autogen-doc_1%3a5.18.7-3_all.deb ...
解開 autogen-doc (1:5.18.7-3) 中...
選取了原先未選的套件 automake。
準備解開 .../automake_1%3a1.15-4ubuntu1_all.deb ...
解開 automake (1:1.15-4ubuntu1) 中...
選取了原先未選的套件 intltool。
準備解開 .../intltool_0.51.0-2ubuntu1.16.04.1_all.deb ...
解開 intltool (0.51.0-2ubuntu1.16.04.1) 中...
選取了原先未選的套件 valac-0.30-vapi。
準備解開 .../valac-0.30-vapi_0.30.1-1_all.deb ...
解開 valac-0.30-vapi (0.30.1-1) 中...
選取了原先未選的套件 valac。
準備解開 .../valac_0.30.1-1_i386.deb ...
update-alternatives: 錯誤: 沒有 valac 的替換檔
解開 valac (0.30.1-1) 中...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for shared-mime-info (1.5-2ubuntu0.1) ...
Processing triggers for libglib2.0-0:i386 (2.48.2-0ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Processing triggers for doc-base (0.10.7) ...
正在處理 2 added doc-base files...
設定 libapr1:i386 (1.5.2-3) ...
設定 libaprutil1:i386 (1.5.4-1build1) ...
設定 libserf-1-1:i386 (1.3.8-1) ...
設定 libsigsegv2:i386 (2.10-4) ...
設定 libgdl-3-common (3.18.0-1) ...
設定 libgdl-3-5:i386 (3.18.0-1) ...
設定 anjuta-common (2:3.18.2-1) ...
設定 libanjuta-3-0 (2:3.18.2-1) ...
設定 libgda-5.0-common (5.2.4-1ubuntu1) ...
設定 libgda-5.0-4 (5.2.4-1ubuntu1) ...
設定 libsvn1:i386 (1.9.3-2ubuntu1.1) ...
設定 libvala-0.30-0:i386 (0.30.1-1) ...
設定 libwebkit2gtk-3.0-25:i386 (2.4.11-0ubuntu0.1) ...
設定 anjuta (2:3.18.2-1) ...
設定 m4 (1.4.17-5) ...
設定 autoconf (2.69-9) ...
設定 libopts25:i386 (1:5.18.7-3) ...
設定 libopts25-dev:i386 (1:5.18.7-3) ...
設定 autogen (1:5.18.7-3) ...
設定 autogen-doc (1:5.18.7-3) ...
設定 automake (1:1.15-4ubuntu1) ...
update-alternatives: using /usr/bin/automake-1.15 to provide /usr/bin/automake (automake) in auto mode
設定 intltool (0.51.0-2ubuntu1.16.04.1) ...
設定 valac-0.30-vapi (0.30.1-1) ...
設定 valac (0.30.1-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...

(2) REF

http://yplin123.blogspot.com/2015/01/linux-ccideanjuta.html

20181204可按+或-鍵來縮放基底影像並捲動的gtk-X視窗程式(gtk_scrolling_canvas.c)
2018/12/04,10:25

(1)編譯

$ gcc gtk_scrolling_canvas.c -Wall `pkg-config --cflags --libs gtk+-3.0` -export-dynamic -lm -o gtk_scrolling_canvas

(2a)執行
$ ./gtk_scrolling_canvas trkmap.jpg
map=trkmap.jpg
keyval=32

SPACE KEY PRESSED!
scwin minh=10.00, minw=10.00 vcurrent=1906.20 vupper=3804.00  vlower=0.00 v_step_inc=76.60 v_page_inc=689.40 v_page_size=766.00 v_min_inc=76.60
:

:

keyval=65453
KEY - PRESSED!
keyval=65451
KEY + PRESSED!

:

CTRL+HOME KEY PRESSED!
keyval=65367
CTRL+END KEY PRESSED!
keyval=65360
CTRL+HOME KEY PRESSED!
keyval=65367
CTRL+END KEY PRESSED!
keyval=65360
CTRL+HOME KEY PRESSED!
keyval=65506
keyval=65360
:

SHIFT+HOME KEY PRESSED!
keyval=65514
:

keyval=115
keyval=98
ALT+b KEY PRESSED!

(2b)畫面

alt

(3)程式碼:


http://oldwww.kmvs.km.edu.tw/lf/index.php?op=ViewResource&blogId=70&resource=gtk_scrolling_canvas.c

treehrt@hrt:~/mysqlc/gtk$ cat gtk_scrolling_canvas.c
// $ gcc gtk_scrolling_canvas.c -Wall `pkg-config --cflags --libs gtk+-3.0` -export-dynamic -lm -o gtk_scrolling_canvas
// $ ./gtk_scrolling_canvas trkmap.jpg
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <cairo.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

static double rab=1;
GtkWidget *window;
GtkWidget *scwin;
GtkWidget *canvas;
GdkPixbuf *pix,*pixC;
char fname[100];

static gboolean on_window_draw (GtkWidget *da, GdkEvent *event, gpointer data)
{
    (void)event; (void)data;
    cairo_t *cr;
    cr = gdk_cairo_create (gtk_widget_get_window(da));
    gdk_cairo_set_source_pixbuf(cr, pixC, 0, 0);
    cairo_paint(cr);
    cairo_destroy (cr);
    return TRUE;
}

void showPixbuf(GdkPixbuf *p){
    cairo_t *cr;
    cr = gdk_cairo_create (gtk_widget_get_window(canvas));
    gdk_cairo_set_source_pixbuf(cr, p, 0, 0);
    cairo_paint(cr);
    cairo_destroy (cr);
}

gboolean on_key_press (GtkWidget *widget, GdkEventKey *event, gpointer data) {
    printf("keyval=%d\n",event->keyval);
    if ((event->keyval == 65360) && (event->state & GDK_SHIFT_MASK)){
        printf("SHIFT+HOME KEY PRESSED!\n");
        return TRUE;
    }
    if ((event->keyval == 65360) && (event->state & GDK_CONTROL_MASK)){
        printf("CTRL+HOME KEY PRESSED!\n");
        return TRUE;
    }
    if ((event->keyval == 65367) && (event->state & GDK_CONTROL_MASK)){
        printf("CTRL+END KEY PRESSED!\n");
        return TRUE;
    }
    if ((event->keyval == 'a') && (event->state & GDK_CONTROL_MASK)){
        printf("CTRL+a KEY PRESSED!\n");
        return TRUE;
    }
    if ((event->keyval == 'b') && (event->state & GDK_MOD1_MASK)){
        printf("ALT+b KEY PRESSED!\n");
        return TRUE;
    }

    if (event->keyval == GDK_KEY_space){
      gtk_scrolled_window_set_min_content_width(GTK_SCROLLED_WINDOW(scwin),10*rab);
      gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scwin),10*rab);

        printf("SPACE KEY PRESSED!\n");
      double scwin_minh=gtk_scrolled_window_get_min_content_height(GTK_SCROLLED_WINDOW(scwin));
      double scwin_minw=gtk_scrolled_window_get_min_content_width(GTK_SCROLLED_WINDOW(scwin));
        GtkAdjustment *vad=gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scwin));
    printf("scwin minh=%.2f, minw=%.2lf vcurrent=%.2lf vupper=%.2lf  vlower=%.2lf v_step_inc=%.2lf v_page_inc=%.2lf v_page_size=%.2lf v_min_inc=%.2lf\n",
        scwin_minh,scwin_minw,
        gtk_adjustment_get_value(vad),
        gtk_adjustment_get_upper(vad),
        gtk_adjustment_get_lower(vad),
        gtk_adjustment_get_step_increment(vad),
        gtk_adjustment_get_page_increment(vad),
        gtk_adjustment_get_page_size(vad),
        gtk_adjustment_get_minimum_increment(vad)
        );

        return TRUE;
    }


    if (event->keyval == GDK_KEY_KP_Add){
    rab=rab*1.01;
        printf("KEY + PRESSED!\n");
      int zw=gdk_pixbuf_get_width(pix)*rab;
    int zh=gdk_pixbuf_get_height(pix)*rab;
    g_object_unref(pixC);
    pixC=gdk_pixbuf_scale_simple(pix,zw,zh, GDK_INTERP_BILINEAR);
    showPixbuf(pixC);
        return TRUE;
    }
    if (event->keyval == GDK_KEY_KP_Subtract){
    rab=rab*0.99;
        printf("KEY - PRESSED!\n");
      int zw=gdk_pixbuf_get_width(pix)*rab;
    int zh=gdk_pixbuf_get_height(pix)*rab;
    g_object_unref(pixC);
    pixC=gdk_pixbuf_scale_simple(pix,zw,zh, GDK_INTERP_BILINEAR);
    showPixbuf(pixC);
        return TRUE;
    }
    return FALSE;
}

int main (int argc, char *argv[])
{
    if (argc != 2) {
    g_print("Syntax Example :  ./a.out a.jpg");
    exit(-1);
    }
    strcpy(fname,argv[1]);
    g_print("map=%s \n",fname);

    GtkWidget *center_vbox;

  gtk_init (&argc, &argv);
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_widget_add_events(window, GDK_KEY_PRESS_MASK);
  center_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
  GError *err = NULL;
  pix = gdk_pixbuf_new_from_file(fname, &err);
  pixC = gdk_pixbuf_new_from_file(fname, &err);
  if(err)
    {
        printf("Error : %s\n", err->message);
        g_error_free(err);
        return FALSE;
    }
  int w=gdk_pixbuf_get_width(pix);
  int h=gdk_pixbuf_get_height(pix);

  canvas = gtk_drawing_area_new ();
  scwin = gtk_scrolled_window_new(NULL, NULL);
  gtk_container_add(GTK_CONTAINER(scwin), canvas);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
  gtk_box_pack_start(GTK_BOX(center_vbox), scwin, TRUE, TRUE, 1);

  gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK);
  gtk_widget_add_events(canvas, GDK_BUTTON_PRESS_MASK);

  g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit) , NULL);
  g_signal_connect (G_OBJECT (window), "key_press_event", G_CALLBACK (on_key_press), NULL);
  g_signal_connect (canvas, "draw", (GCallback) on_window_draw, NULL);
  gtk_widget_set_app_paintable(canvas, TRUE);

  gtk_container_add (GTK_CONTAINER (window), center_vbox);
  gtk_widget_set_size_request (window, 1024,768);
  gtk_widget_set_size_request (center_vbox, 1020,760);
  gtk_widget_set_size_request (canvas, w,h);
  gtk_widget_show_all (window);
  gtk_main();
  return 0;
}

 
Accessible and Valid XHTML 1.0 Strict and CSS Powered by LifeType