2016年7月14日 星期四

ubuntu下virtualbox啟動Guest Additions

連結
http://www.htpcbeginner.com/install-virtualbox-guest-additions-on-windows/

基本上是在說,安裝完後virtualbox下的系統就可以在主機和虛擬機之間使用「複製、貼上」和「全螢幕」的功能了。
感覺是個好東西,所以記錄一下。

2016年7月13日 星期三

Ubuntu16.04播放DVD影片

在ubuntu16.04系統中,原本ubuntu14.04時要自行安裝一大堆缺少的程式的方法被取消,
改以安裝sudo apt install libdvd-pkg代替。
安裝完以後還要執行sudo dpkg-reconfigure libdvd-pkg才能啟動dvd播放的功能(這個指令的目的不明~不好意思)。

安裝指令:
sudo apt install libdvd-pkg
sudo dpkg-reconfigure libdvd-pkg

執行完就可以播放DVD影片囉!
只有兩個指令,ubuntu愈進化愈簡便了啦,真好。

參考自ubuntu說明

2016年7月4日 星期一

ubuntu安裝s2a

ubuntu安裝s2a_fm


scratch可以用程式寫自己的遊戲、說故事已經很有趣了;加上Arduino板子之後,更可以透過一些感應器、按鈕或馬達來和現實生活中的物件互動,讓程式設計跟生活結合
 s2a=scratch to arduino
讓寫程式的創意,真的能實踐生活中。


如何安裝s2a
1.安裝python-pip
sudo apt-get install python-pip


2.安裝PySerial
sudo pip install PySerial


3.安裝PyMata
sudo pip install PyMata


4.下載s2a_fm
點選Download ZIP
解壓縮到你要儲存的資料夾位置


5.如果你用指令的話
進入剛剛解壓縮的s2a_fm-master的資料夾後,執行
sudo python s2a_fm.py
就可以連線成功

6.前面的連線程式(s2a_fm.py)需要用sudo執行的原因好像是因為usb對外連線的權限問題
如果需要不用sudo權限,需更改 /etc/group這個檔案
利用文字編輯器gedit開啟/etc/group這個檔案
sudo gedit /etc/group
找到 dialout這一行
在:後加入使用者帳號就會成為下列
dialout:x:20:使用者帳號1,使用者帳號2
之後重開機即可(僅登出不知道可不可以?沒測過)

7.之後開啟scratch2,再用scratch2去開啟s2a_fm-master/ScratchFiles/ScratchProjects裡面的s2a_fm_base_zh_tw.sb2的檔案就可以了
開啟以上的檔案後,在scratch的更多積木中,會出現擴充的程式積木
利用這些積木,就可以控制Arduino板


8.接下來的是如何將s2a_fm變成在桌面上可點兩下執行


8-1.在家目錄建立一個scratch的資料夾,並將s2a_fm-master/ScratchFiles/ScratchProjects/
裡面的s2a_fm_base_zh_tw.sb2的這一個檔案,複製到家目錄自建的scratch中。
(這一個檔案是S2a的擴充積木檔案,利用Scratch2開啟這個檔案就可以得到控制Arduino的擴充積木)


8-2.接下來設定一個桌面捷徑,讓你點兩下可啟動Scratch2順便開啟s2a_fm_base_zh_tw.sb2這個檔案。
在桌面建立一個新的文件
(名稱自訂)
用編輯器(gedit之類的就可以了)輸入以下內容


[Desktop Entry]
Version=1.0
Type=Application
Name=S2aLink
Comment=
Exec=/opt/'Scratch 2'/bin/'Scratch 2' /home/user/scratch/s2a_fm_base_zh_tw.sb2
Icon=
Path=
Terminal=false
StartupNotify=false


{備註
這好像是要建立桌面捷徑的時候,所使用的格式。
內容對照如下
[Desktop Entry]
Name=自訂 ( 名稱 )
GenericName=自訂 ( 說明 )
Exec=自訂 ( 指令或路徑 )
Comment=自訂 ( 備註 )
Icon=自訂 ( 圖示路徑 )
Type=Application


倒數第二行的Terminal=false是指不要開啟終端機程式(在連線程式的桌面捷徑要設為true,用以觀察連線狀態)


原文參考連結
}


8-3.輸入完內容後存檔,檔案名稱加入[.desktop]的副檔名。
將檔案設成可執行
方法1
點右鍵-屬性-權限-[允許此檔案作為程式執行]打勾


方法2
Ctrl+Alt+t 開啟終端機軟體
#進入桌面目錄
cd /home/[使用者名稱]/[桌面名稱]/
#新增執行權限
chmod +x 檔案名稱.desktop


8-4.完成後即可點兩下桌面圖示開啟S2a。





補充:如何在桌面建立USB連線s2a的程式
1.先在桌面建立一個空的文件
內容輸入
#! /bin/bash
cd [s2a_fm-master的目錄]
python s2a_fm.py ;

檔名自建(這裡是用s2aconnect.sh),然後存檔(可存在先前下載的s2a_fm-master資料夾內)
主要是用來連接桌面的捷徑檔,執行s2a_fm.py檔案用的
會需要先利用cd切換至s2a_fm-master目錄,是因為好像執行python的程式都在這個資料夾內,需要先切換至這個資料夾才可以執行的關係。

2.在桌面建立一個桌面捷徑
文件內容如下
[Desktop Entry]
Version=1.0
Type=Application
Name=s2aconnect
Comment=
Exec=/home/user/下載/s2a_fm-master/ScratchFiles/s2aconnect.sh
#剛剛製作的s2aconnect.sh位置
Icon=/home/user/下載/s2a_fm-master/ScratchFiles/s2aconnect.png
#自行製作的桌面圖示位置
Path=
Terminal=true


文件製作完成後將副檔名加上.desktop即可


後記
後來測試將s2a_fm-master這個資料夾存在/usr/share/下面
資料夾權限是755
但是裡面的log資料夾裡面的s2a_fm_debugging.log檔案的權限要設成777(所有人可讀取及寫入)
如果將s2aconnect.sh(前面用來切換目錄,執行s2a_fm.py的檔案)也存在裡面就要將這個檔案的權限也改成777

2016年7月3日 星期日

用dpkg安裝最新的libreoffice

如果隨著系統安裝的libreoffice版本不符合你的需求,你可以執行以下步驟來安裝最新的libreoffice版本。

本文是在ubuntu系統下安裝的,不適用windows系統。

以下參考自libreoffice解壓縮後的README檔

1.先到Libreoffice官網下載主程式安裝檔、中文翻譯和中文離線說明檔

For instructions on how to install a language pack (after having installed the US English version of LibreOffice), please read the section below entitled Installing a Language Pack.

2.找到你下載的檔案,並解壓縮
When you unpack the downloaded archive, you will see that the contents have been decompressed into a sub-directory. Open a file manager window, and change directory to the one starting with "LibreOffice_", followed by the version number and some platform information.

3.從解壓縮的資料夾找到”DEBS”資料夾
This directory contains a subdirectory called "DEBS". Change directory to the "DEBS" directory.

4.開啟終端機並進入到”DEBS”資料夾的路徑下
Right-click within the directory and choose "Open in Terminal". A terminal window will open. From the command line of the terminal window, enter the following command (you will be prompted to enter your root user's password before the command will execute):

The following commands will install LibreOffice and the desktop integration packages (you may just copy and paste them into the terminal screen rather than trying to type them):

5.在終端機輸入以下指令
sudo dpkg -i *.deb

The installation process is now completed, and you should have icons for all the LibreOffice applications in your desktop's Applications/Office menu.


安裝中文化

1.一樣解壓縮完以後找到”DEBS”的位置
Now change directory to the directory that was created during the extraction process. For instance, for the French language pack for a 32-bit Debian/Ubuntu-based system, the directory is named LibreOffice_, plus some version information, plus Linux_x86_langpack-deb_fr.

Now change directory to the directory that contains the packages to install. On Debian/Ubuntu-based systems, the directory will be DEBS. On Fedora, openSUSE or Mandriva systems, the directory will be RPMS.

From the Nautilus file manager, right-click in the directory and choose the command "Open in terminal". In the terminal window you just opened, execute the command to install the language pack (with all of the commands below, you may be prompted to enter your root user's password):

2.開啟終端機並進入到”DEBS”的路徑下,然後執行以下指令
sudo dpkg -i *.deb


Now start one of the LibreOffice applications - Writer, for instance. Go to the Tools menu and choose Options. In the Options dialog box, click on "Language Settings" and then click on "Languages". Dropdown the "User interface" list and select the language you just installed. If you want, do the same thing for the "Locale setting", the "Default currency", and the "Default languages for documents".

After adjusting those settings, click on OK. The dialog box will close, and you will see an information message telling you that your changes will only be activated after you exit LibreOffice and start it again (remember to also exit the QuickStarter if it is started).

The next time you start LibreOffice, it will start in the language you just installed.

同樣方式安裝離線說明檔

Ubuntu指令列印libreoffice文件

在Ubuntu下指令列印libreoffice文件很簡單 只要輸入以下 libreoffice -p [文件位置] 例如: libreoffice -p /home/username/test.odt 預設的印表機就會幫你列印好了。 指定好資...