CodeIgniter simple example
application\controllers\Boundtest.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Boundtest extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('Go');
}
public function boundview()
{
//zino
$data['output']=$this->Going_Model->get_user($ID);
$this->load->view('Boundtest',$data);
}
}
application\models\Go.php
<?php
class Going extends CI_Model {
public function __construct()
{
parent::__construct();
}
public function get_user($id)
{
//zino
$sql = 'SELECT * FROM `member`';
return $query = $this->db->query($sql)->result();
}
}
application\views\Boundtest.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<h1>test</h1>
<p><?php var_dump($output) ?> </p>
</body>
</html>
application\config\routes.php
$route['bound'] = 'Boundtest/boundview';
2017年2月8日 星期三
2016年12月21日 星期三
install XAMPP .run file use command in ubuntu
install XAMPP .run file use command in ubuntu
user@user : /opt # ./xampp-linux-x64-5.6.28-0-installer.run --mode text
----------------------------------------------------------------------------
Welcome to the XAMPP Setup Wizard.
----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.
XAMPP Core Files : Y (Cannot be edited)
XAMPP Developer Files [Y/n] :Y
Is the selection above correct? [Y/n]: Y
----------------------------------------------------------------------------
Installation Directory
XAMPP will be installed to /opt/lampp
Press [Enter] to continue:
----------------------------------------------------------------------------
Setup is now ready to begin installing XAMPP on your computer.
Do you want to continue? [Y/n]: Y
----------------------------------------------------------------------------
Please wait while Setup installs XAMPP on your computer.
Installing
0% ______________ 50% ______________ 100%
#########################################
----------------------------------------------------------------------------
Setup has finished installing XAMPP on your computer.
2016年8月24日 星期三
Changing the screen resolution in raspberry pi 3 (HDMI) (lubuntu)
raspberry pi 3 HDMI 螢幕解析度設定(lubuntu)
raspberry pi 3 使用 HDMI 時,預設的螢幕解析度太高超級難閱讀,而預設安裝的Gui螢幕設定根本沒辦法改,甚至看了KDE官網使用 Xrandr 設定也都沒有用,之後才發現raspberry pi在開機有自己的設定方式,點這裡。
1. 先將開機設定檔備。
$ sudo cp /boot/config.txt /boot/config.txt.backup
2. 編輯config.txt
$sudo vim /boot/config.txt
找到以下設定,改後存檔。
raspberry pi 3 使用 HDMI 時,預設的螢幕解析度太高超級難閱讀,而預設安裝的Gui螢幕設定根本沒辦法改,甚至看了KDE官網使用 Xrandr 設定也都沒有用,之後才發現raspberry pi在開機有自己的設定方式,點這裡。
1. 先將開機設定檔備。
$ sudo cp /boot/config.txt /boot/config.txt.backup
2. 編輯config.txt
$sudo vim /boot/config.txt
找到以下設定,改後存檔。
hdmi_group=1 hdmi_mode=16
註解裡面都寫詳細的值代表什麼意思如下: ## hdmi_group ## Defines the HDMI type ## ## Value Description ## ------------------------------------------------------------------------- ## 0 Use the preferred group reported by the edid (Default) ## 1 CEA ## 2 DMT ##
這個指螢幕的規格,CEA 通常是電視,DMT為電腦螢幕。
來源:http://raspberrypi.stackexchange.com/questions/7332/what-is-the-difference-between-cea-and-dmt
## hdmi_mode ## defines screen resolution in CEA or DMT format ## ## H means 16:9 variant (of a normally 4:3 mode). ## 2x means pixel doubled (i.e. higher clock rate, with each pixel repeated ## twice) ## 4x means pixel quadrupled (i.e. higher clock rate, with each pixel ## repeated four times) ## reduced blanking means fewer bytes are used for blanking within the data ## stream (i.e. lower clock rate, with fewer wasted bytes) ## ## Value hdmi_group=CEA hdmi_group=DMT ## ------------------------------------------------------------------------- ## 1 VGA 640x350 85Hz ## 2 480p 60Hz 640x400 85Hz ## 3 480p 60Hz H 720x400 85Hz ## 4 720p 60Hz 640x480 60Hz ## 5 1080i 60Hz 640x480 72Hz ......
因為我想要720P所以選4,1080p 選16
3.reboot
Ubuntu 16.04 compile latest Kernel
Ubuntu 16.04 編譯最新 Kernel 與安裝
在ubuntu 編譯與安裝kernel是比較簡單的,甚至連grub都會幫你安裝好1. 抓最新的kernel版本(文章發表時版本為:4.8.0-rc3+)
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
2.將資料夾複製到 /usr/src
$ sudo mv linux-2.6/ /usr/src/
3.安裝編譯需要的套件
$ sudo apt-get install ncurses ncurses-devel kernel-package libncurses5-dev libc6-dev libssl-dev modutils build-essential
libncurses5-dev 是為了可以使用 menuconfig 指令
libssl-dev 是編譯時需要
4. 進到切換到root 進到/usr/src/linux-2.6/
$ sudo su -
$ cd /usr/src/linux-2.6/
5.複製現有已經可以使用的.config
$cp /boot/config-4.4.0-34-generic ./.config
/boot/config-4.4.0-34-generic 資料夾會根據你的kernel不同不一樣
6.使用menuconfig 設定
$ make menuconfig
可以先load剛剛複製的.config檔在自己做喜好設定,完成後save。
7.編譯
$ fakeroot make-kpkg -j 4 --initrd kernel_image kernel_headers
8.安裝
$ dpkg -i linux-image-4.8.0-rc3+_4.8.0-rc3+-10.00.Custom_amd64.deb
$ dpkg -i linux-headers-4.8.0-rc3+_4.8.0-rc3+-10.00.Custom_amd64.deb
如果怕grub沒有幫你更新的化可以使用update-grub
$ update-grub
注意!安裝時/boot 要有足夠的硬碟空間,至少256M會比較保險!
如果電腦同時間有window要注意/boot/efi的位置!
9.重開機
$ reboot
應該預設的ubuntu第一個選項就是最新安裝好的kernel,但如果沒有可以到進階選項進入選擇不同kernel開機,如果編輯失敗也可以在進階選項回到原本正常的kernel
可以正常開機就恭喜你了!
2016年8月23日 星期二
ubuntu make menuconfig error
ubuntu make menuconfig error
root@zino-PC:/usr/src/linux-2.6# make menuconfigHOSTCC scripts/kconfig/mconf.o
In file included from scripts/kconfig/mconf.c:23:0:
scripts/kconfig/lxdialog/dialog.h:38:20: fatal error: curses.h: No such file or directory
compilation terminated.
scripts/Makefile.host:124: recipe for target 'scripts/kconfig/mconf.o' failed
make[1]: *** [scripts/kconfig/mconf.o] Error 1
Makefile:545: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2
solve:
apt-get install libncurses5 libncurses5-dev
來源:
http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?topic_id=13590
來源:
http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?topic_id=13590
2016年8月18日 星期四
ubuntu 14.04 TLS install VNC server with gnome desketop (遠端桌面)
ubuntu 14.04 TLS install VNC server with gnome desketop (遠端桌面)
1.安裝 gnome 相關套件
2.啟動一次 再家目錄建立預設資料夾
user@ubuntu:~$ vncserver
You will require a password to access your desktops.
Password:
Verify:
xauth: file /home/user/.Xauthority does not exist
New 'ubuntu:1 (user)' desktop is ubuntu:1
Creating default startup script /home/user/.vnc/xstartup
Starting applications specified in /home/user/.vnc/xstartup
Log file is /home/user/.vnc/ubuntu:1.log
參考:https://docs.microsoft.com/zh-tw/azure/virtual-machines/linux/classic/remote-desktop
https://www.digitalocean.com/community/tutorials/how-to-set-up-vnc-server-on-debian-8
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-14-04
/etc/vnc.conf
vi /etc/alternatives/vncserver -localhost
在localhost 監聽
vncserver -localhost
ssh forward
移除ssh forward
來源:https://superuser.com/questions/87014/how-do-i-remove-an-ssh-forwarded-port
移除 監聽
vncserver -kill :2
1.安裝 gnome 相關套件
# sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
# apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal vnc4server
2.啟動一次 再家目錄建立預設資料夾
user@ubuntu:~$ vncserver
You will require a password to access your desktops.
Password:
Verify:
xauth: file /home/user/.Xauthority does not exist
New 'ubuntu:1 (user)' desktop is ubuntu:1
Creating default startup script /home/user/.vnc/xstartup
Starting applications specified in /home/user/.vnc/xstartup
Log file is /home/user/.vnc/ubuntu:1.log
3.編輯 /home/user/.vnc/xstartup 檔套用以下設定
#!/bin/sh
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
4.再次啟動
user@ubuntu:~$ vncserver -kill :1
Killing Xvnc4 process ID 45058
user@ubuntu:~$ vncserver
New 'ubuntu:1 (user)' desktop is ubuntu:1
Starting applications specified in /home/user/.vnc/xstartup
Log file is /home/user/.vnc/ubuntu:1.log
5.在別台機器啟動 Remmina 遠端桌面客戶端
6.新增並輸入 IP:Port 帳號 密碼
7.連線成功!!
參考來源:http://askubuntu.com/questions/475023/how-to-make-vnc-server-work-with-ubuntu-desktop-without-xfce
參考:https://docs.microsoft.com/zh-tw/azure/virtual-machines/linux/classic/remote-desktop
https://www.digitalocean.com/community/tutorials/how-to-set-up-vnc-server-on-debian-8
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-14-04
/etc/vnc.conf
vi /etc/alternatives/vncserver -localhost
在localhost 監聽
vncserver -localhost
ssh forward
ssh -L 5901:127.0.0.1:5901 -N -f -l user server_ip_address
移除ssh forward
If you are using Linux you can kill the process by:
ps aux | grep ssh
and then use
kill <id>
To kill the process.
If the kill command is not successfull you can try
kill -9 <id>
來源:https://superuser.com/questions/87014/how-do-i-remove-an-ssh-forwarded-port
移除 監聽
vncserver -kill :2
2016年7月19日 星期二
scala compiler -classpath with multiple JAR files
scala compiler -classpath with multiple JAR files
1. To compile a scala file and include a Jar file, enter the following command line:
scala -classpath /home/user/jarFile.jar scalaFile.scala
2. To compile a scala file and include multiple Jar file, enter the following command line:
In Linux OS:
scala -classpath "/absolute/path/jarFile1.jar:/absolute/path/jarFile2.jar" scalaFile.scala
In Winsows OS:
scala -classpath "C:\absolute/path/jarFile1.jar;C:/absolute/path/jarFile2.jar" scalaFile.scala
scala 多個jar包編譯
1.scala 編譯時僅有引用一個jar包:scala -classpath /home/user/jarFile.jar scalaFile.scala
2. scala 編譯時僅有引用一個jar包:
在Windows底下是分號要注意,Linux則是冒號,也要注意分號跟冒號分隔前後不可以有空白,也要使用絕對路徑,例如:~/xxx/yyy/filejar.jar 是不可以的。
In Linux OS:
scala -classpath "/absolute/path/jarFile1.jar:/absolute/path/jarFile2.jar" scalaFile.scala
In Winsows OS:
scala -classpath "C:\absolute/path/jarFile1.jar;C:/absolute/path/jarFile2.jar" scalaFile.scala
訂閱:
文章 (Atom)