自由學習的風

幽夢影 張潮 少年讀書,如隙中窺月;中年讀書,如庭中望月;老年讀書,如臺上玩月。皆以閱歷之淺深,為所得之淺深耳。

scratch2 檔案轉成 swf

2015年11月17日 星期二

夥伴分享將 scratch2 轉成 flash 的 swf 格式,利用程式直接轉換就行了,很方便,上網查了一下,發現它可以直接線上轉換(junebettle),在 Windows 下的話,直接用瀏覽器(Google Chrome, firefox)開啟就可以看到設計的程式,不過,在 Ubuntu 系統下,卻會變成下載,我的解決方式如下:

1. 修改相關檔案  /usr/share/mime/packages/freedesktop.org.xml
<mime-type type="application/vnd.adobe.flash.movie">
改成
<mime-type type="application/x-shockwave-flash">
2.  sudo update-mime-database /usr/share/mime

3. 用 firefox 或 google chrome 開啟就正常了

這樣小朋友做的作品就可以分享給其他人了

CentOS 架 Moodle + OpenID

2015年11月6日 星期五

習慣了 Debian 系列(Ubuntu),回頭使用 CentOS 時真有些卡,差點就"河蟹"了。

把過程記錄一下,避免下次又遇到:

1. 安裝 Remi/EPEL 套件庫
CentOS/RHEL 6, 64 Bit:
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm 

2. 安裝 Apache,MySQL, PHP
# yum --enablerepo=remi install httpd
# yum --enablerepo=remi install mysql  mysql-server
# yum --enablerepo=remi install php   php-common
# yum --enablerepo=remi install php-common   php-cli   php-mysql
3. 執行 mysql 初步設定
# service mysqld start
# /usr/bin/mysql_secure_installation
會詢問 root 密碼、詢問是否刪除空白密碼的帳號


4. 設定 AMP 開機自動執行
# chkconfig   httpd    on
# chkconfig    mysqld    on
※重新開機檢查服務是否自動執行(ps, netstat)

5. 安裝 moodle 需要的 php 套件
# yum --enablerepo=remi  install php-iconv php-mbstring php-curl php-openssl php-tokenizer php-xmlpc php-soap php-ldap php-pecl-apc  php-ctype php-zip php-gd php-simplexml php-spl php-pcre php-dom php-xml php-xmlrpc php-intl php-json 
# yum --enablerepo=remi  install wget

6. 下載 moodle 最新版(2015/11/05:  2.9)
# cd /var/www/html
# wget https://download.moodle.org/download.php/direct/stable29/moodle-latest-29.zip
# unzip moodle-latest-29.zip

# chmod -R 755 /var/www/html/moodle
# chown -R apache.apache /var/www/html/moodle

7. 建立 moodle data 資料夾
# mkdir /var/www/html/moodledata
# chmod -R 777 /var/www/html/moodledata
# chown -R apache.apache /var/www/html/moodledata
8. 設定網頁虛擬伺服器
# vim  /etc/httpd/conf.d/nextschool.ntpc.edu.tw.conf
--------------------------------------------------------------------------------------
<VirtualHost *:80>
  ServerName nextschool.ntpc.edu.tw
  DocumentRoot /var/www/html/moodle
  ErrorLog /var/log/httpd/nextschool.ntpc.edu.tw_error_log
  CustomLog /var/log/httpd/nextschool.ntpc.edu.tw_access_log combined
  DirectoryIndex index.html index.htm index.php index.php4 index.php5
  <Directory /var/www/html/moodle>
    Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
    Allow from all
    AllowOverride All
    Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
  </Directory>
</VirtualHost>

重新啟動 apache
# service  httpd restart
9. 打開 firewall,允許外部 ip 可以連到 apache 伺服器
#vim  /etc/sysconfig/iptables
改成下列內容,存檔後重新更新firewall規則重新開機
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

10. 開啟瀏覽器,利用 domainname 連做 moodle 設定
(省略)

11. 把之前在 opensource 網站修改過的 gauth 複製過來
(略)

12. 從 moodle 的外掛中把 gauth 啟用,並做適當的設定
(略)

13. 在 moodle 的登入畫面中增加 openid 登入的圖片連結
(略)

呼!因為安全性的問題只能從自己操作的電腦做 ssh 連線,也只能用校務系統的帳號密碼,所以本來想叫大師來做的任務,只好自己捲袖子撩落去…,還好勉強完成了。


參考:

  • http://www.techoism.com/install-lamp-on-centosrhel/
  • http://www.techoism.com/how-to-install-moodle-on-centos/
  • http://yenpai.idis.com.tw/archives/273-教學-centos-6-3-設定-1-基本調校與-ssh-連線

轉貼:Chrome Devtools Tips & Tricks

2015年11月5日 星期四

MOLSSON's Blog: Chrome Devtools Tips & Tricks

很棒的教學文