2016年2月10日 星期三

PL/SQL interview question 001


Uri Lukach 提供了以下的 PL/SQL interview question[1]:


答案是 C.

使用 case-when expression 時有兩種方式, 一為 simple-case-expression, 另一為 searched-case-expression. 使用 searched-case-express 時, 若在 condition 中沒有使用 relational operator 便會產生 ORA-00920 invalid relational operator 的例外[2]。

但是, 我們不能將問題中的 condition 改成 v_input = TRUE, 因為此 case-when expression 是在 SELECT SQL statement 中使用,SQL engine 中沒有 boolean data type (只有在 pl/sql 中才有 boolean data type)。

以下正確執行的版本供參考:
 set serveroutput on  
 DECLARE  
 v_input boolean :=true;  
 v_result varchar2(10);  
 BEGIN  
 v_result := case   
    when v_input=true then 'TRUE'  
    when (v_input <>true) then 'FALSE'  
    else null  
    end;  
 DBMS_OUTPUT.PUT_LINE(v_result);  
 END;  
 /  

2016年2月5日 星期五

UI Elements in the Wordpress

常用的 WordPress UI 元素

Slider

Wonder Plugin (https://www.wonderplugin.com/wordpress-slider/)

Accordion

According-Wp Plugin (https://wordpress.org/plugins/accordions/screenshots/)


Separator 

Separator widget (https://wordpress.org/plugins/separator-widget/)


Social 

Social share buttons by Supsystic (https://wordpress.org/plugins/social-share-buttons-by-supsystic/)

Notification

Push notification for WordPress (Lite):Send push notifications to iOS, Android, and Fire OS devices when you publish a new post  (https://wordpress.org/plugins/push-notifications-for-wp/(

InfoBar Top Notification: A easy and quick way to add top notification bar and call to action for your site. (https://wordpress.org/plugins/infobar/)

Buttons

MaxButtons Plugin: WordPress button plugin so powerful and easy to use anyone to create beautiful buttons and social share icons. (https://wordpress.org/plugins/maxbuttons/)

Images

Image Widget: A simple image widget that uses the native WordPress media manager to add image widgets to your site. (https://wordpress.org/plugins/image-widget/)

Tabs

Tabby Responsive Tabs: Create responsive tabs inside your posts, pages or custom post content by adding simple shortcodes inside the post editor. (https://wordpress.org/plugins/tabby-responsive-tabs/)
Simple Side Tab: Display a side tab that you can easily link to any page. Customize the tab text, font and colors. It's that simple. That's Simple Side Tab. (https://wordpress.org/plugins/simple-side-tab/)

Progress Bar

Progreaa Bar: A simple progress bar shortcode that can be styled with CSS (https://wordpress.org/plugins/progress-bar/)

Info/Message Box

WP Fancy Message Box: Display Fancy CSS Message Box in Page/Post via short code (https://wordpress.org/plugins/wp-fancy-message-box/)

Icon

WP SVGA Icon: Quickly and effortlessly enable 490+ beautifully designed SVG font icons, available on the frontend and backend of your site. (https://wordpress.org/plugins/svg-vector-icon-plugin/)

Navigation Menu

Fixed Circular Navigation Menu: Fixed fancy navigation, perfect as an extra or mobile auxiliar menu. Circular shaped with a modern look that opens when menu button is clicked. (https://wordpress.org/plugins/fixed-circular-navigation-menu/)


2016年2月3日 星期三

匯入 UTF-8 編碼的中文檔案並在 R-Studion Console中顯示中文字

環境: Win7, RStudio Version 0.99.491

原理:
1. 先在 Single Byte Character Set 環境中讀入 UTF-8 編碼的中文字
2. 再轉成 Double Byte Character Set 環境顯示內容

1:  setwd("d:/R-Workshop/CaseStudy")  
2:  # Change to single byte character set to read UTF-8 encoded characters  
3:  Sys.setlocale("LC_CTYPE", "us")  
4:  l10n_info()  
5:  # Read the csv file encoded with UTF-8   
6:  my.data <- read.csv(file="UV_20151116152215.csv", header = TRUE, encoding="UTF-8")  
7:  # Show content with the single byte character set  
8:  # The RStudio Console cannot display the Chinese characters correctly in   
9:  # the Single-Byte-Character-Set environment.  
10:  head(my.data)  
11:  # Change to Double-Byte-Character-Set environment  
12:  Sys.setlocale("LC_CTYPE", "cht")  
13:  # Now your console can display Chinese characters correctly.  
14:  head(my.data)  
15:  rm(my.data)  

2016年1月12日 星期二

Wordpress Server 端設定

Wordpress Server 端設定

情境

完成 Wordpress 安裝後要進行 Server 上 Wordpress 目錄的權限設定,以利安裝 plug-in 及上傳檔案。

假設

  • 1.Wordpress 安裝的目錄為 /var/www/html/wordpress; 目錄所有人為 u01
  • /var/www/html 目錄的所有人為 root; root 所屬的群組為 root

Steps

1.將 u01 加入 root 所在的群組
$adduser u01 root
$groups u01


2. 設定 wordpress 目錄下的權限, 開放 group 的讀及寫的權限
$cd /var/www/html/wordpress
$find . –type d -exec chmod 775 {} +


3. 安裝 vsftpd $sudo apt-get install vsftpd

4. 修改 /etc/vsftpd/vsftpd.conf ,啟用選項 write_enable=YES

5. 重新啟動 vsftpd $sudo service vsftpd restart

在 wordpress 上傳 plugin 時, 檔會先放到 /var/www/html/wordpress/wp-content/wp-upload 目錄中。

當安裝後,plug-in 會放在 [Wordpress_Home]/wp-content/wp-plugins . 目錄及檔案的擁有人則是使用 FTP 上傳檔案時所使用的帳號。

2016年1月8日 星期五

在MS word 2010 中 為你的樣式自訂快速鍵

常為了要套用某個樣式還要移動游標覺得花太多時間嗎?

因為在寫文件時,常常要套用自訂的程式碼樣式。

以下為設定樣式的快速鍵的方法:

Step 1. (M)檔案 > 選項 > 自訂功能區 > (B)自訂



Step 2. 在(W)自訂鍵盤中,選擇類別中的樣式(請捲動到最底下),可在樣式清單中看到可用樣式。


Step 3. 在W)自訂鍵盤下方中可以自設樣式的快速鍵。

參考資料:  自訂鍵盤快速鍵

2015年12月30日 星期三

Netbeans IDE 的字型設定

預設字型 (Default fonts)

預設字型會用在 menus, dialogs, views 等地方。要改變字型的大小, 需設定 netbeans.conf 中的 netbeans_default_options 屬性值。在該屬性中加入"--fontsize 16" 的參數, 預設字型便會改成 16 大小。

例如以下設定:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Dfile.encoding=UTF-8 --fontsize 18"

netbeans.conf 檔案位於 [Netbeans_Home]/etc。

預設字型大小設為 18, 結果如下:



這是 fontsize 16 的結果:





參考資料:
  1. FaqFontSize (http://wiki.netbeans.org/FaqFontSize)

2015年12月29日 星期二

Code Beautifier -- 程式碼排版

常常為程式碼排版困擾嗎? 試試不同的 On-line source code beautifier 或其它方法


在 Blogger 上用 Google Code Prettify 及 GitHub Gist 顯示程式碼 (不修改範本的懶人招數) 文章中介紹了不同鑲程式碼到 blogger 的方法, 非常值得一看.

On-Line Source Code Beautifier

Blogger