Skip to content

2015

How to Upgrade Your Ghost Blog via Command Line

Step 1: Navigate to Your Ghost Blog Directory

First, change the directory to the path where your Ghost blog is installed. For example, in my case, it's located at:

cd /var/www

Step 2: Download the Latest Version with wget

Use wget to download the latest version of Ghost:

wget https://ghost.org/zip/ghost-X.X.X.zip

Note: You can find the current version on the official website: https://ghost.org/download/

Step 3: Remove the Old Core Code

Delete the old core directory:

rm -rf ghost/core

Step 4: Unzip the Downloaded File

Unzip the file you downloaded into the ghost directory:

unzip -uo ghost-0.6.4.zip -d ghost

Step 5: Change Ownership and Permissions

Update the ownership and permissions for the Ghost files:

chown -R ghost:ghost ghost/

Step 6: Install New Dependencies

Navigate back to your Ghost directory and install new dependencies:

cd /var/www/ghost
npm install

Step 7: Restart Ghost

Finally, restart your Ghost blog:

pm2 restart ghost

Note: If you're not using pm2, you can use the following command instead:

service ghost start

Your Ghost blog should now be successfully upgraded!


如何透過命令行升級您的Ghost博客

步驟1:導航至您的Ghost博客目錄

首先,將目錄更改為您的Ghost博客安裝的路徑。例如,在我的情況下,它位於:

cd /var/www

步驟2:使用wget下載最新版本

使用wget下載Ghost的最新版本:

wget https://ghost.org/zip/ghost-X.X.X.zip

注意:您可以在官方網站上找到當前的版本:https://ghost.org/download/

步驟3:移除舊的核心代碼

刪除舊的核心目錄:

rm -rf ghost/core

步驟4:解壓下載的文件

將您下載的文件解壓縮到ghost目錄:

unzip -uo ghost-0.6.4.zip -d ghost

步驟5:變更所有權和權限

更新Ghost文件的所有權和權限:

chown -R ghost:ghost ghost/

步驟6:安裝新的依賴關係

返回到您的Ghost目錄並安裝新的依賴關係:

cd /var/www/ghost
npm install

步驟7:重新啟動Ghost

最後,重新啟動您的Ghost博客:

pm2 restart ghost

注意:如果您不使用pm2,則可以使用以下命令:

service ghost start

您的Ghost博客現在應該已成功升級!


SSH: How to Fix the 'Unprotected Private Key' Error

The Problem

When I downloaded the .pem file to SSH into my AWS instance, I encountered the following error:

WARNING: UNPROTECTED PRIVATE KEY FILE!

Permissions 0640 for 'blog.pem' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. Bad permissions: ignore key: blog.pem Permission denied (publickey).

The Solution

To resolve this issue, run the following command in your terminal:

ssh -i xxx.pem root@52.74.3.53

Replace xxx.pem with the name of your .pem file.

This command will modify the permissions on the keys, making them readable only by you.

SSH:如何修復「未保護的私鑰」錯誤

問題

當我下載了 .pem 檔案以便 SSH 連線到我的 AWS 實例時,我遇到了以下的錯誤:

警告:未保護的私鑰檔案!

'blog.pem' 的權限 0640 過於開放。要求您的私鑰檔案不能被其他人訪問。將忽略此私鑰。壞的權限:忽略鑰匙:blog.pem 權限被拒絕 (publickey)。

解決方案

為了解決此問題,在你的終端機執行下列的指令:

ssh -i xxx.pem root@52.74.3.53

xxx.pem 換成你的 .pem 檔案的名稱。

此指令會修改鑰匙的權限,使其僅能被你閱讀。

How to Fix Ruby Gems Permission Error on Mac OS X Yosemite

The Problem

While trying to install a gem on Mac OS X Yosemite, I encountered the following error:

ERROR: While executing gem … (Gem::FilePermissionError) You don’t have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

The Solution

Step 1: Install Rbenv

To start, you'll need to install Rbenv and Ruby-build:

brew install rbenv ruby-build

Next, add Rbenv to ~/.zshrc so it starts automatically:

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc

Note: If you are not using Zsh, modify your ~/.bash_profile instead of ~/.zshrc.

Step 2: Restart Your Shell

Close your terminal and reopen it to apply the changes.

Step 3: Install Ruby, Set Global Version, and Rehash

Now, install Ruby and set it as your global Ruby version:

rbenv install 2.0.0-p247
rbenv global 2.0.0-p247
rbenv rehash
Step 4: Install Gems as Usual

You can now proceed to install gems without encountering permission issues.

gem install [gem-name]

Your gem should now install successfully!


如何修復Mac OS X Yosemite上的Ruby Gems權限錯誤

問題

當我嘗試在Mac OS X Yosemite上安裝一個gem時,我遇到了以下錯誤:

錯誤:在執行gem時...(Gem::FilePermissionError)您沒有/Library/Ruby/Gems/2.0.0目錄的寫入權限。

解決方案

步驟1:安裝Rbenv

首先,您需要安裝Rbenv和Ruby-build:

brew install rbenv ruby-build

接下來,將Rbenv添加到~/.zshrc中,使其自動啟動:

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc

:如果您不使用Zsh,請修改您的~/.bash_profile,而不是~/.zshrc

步驟2:重新啟動你的Shell

關閉您的終端並重新打開它以應用更改。

步驟3:安裝Ruby,設置全局版本並重新排序

現在,安裝Ruby並將其設置為您的全局Ruby版本:

rbenv install 2.0.0-p247
rbenv global 2.0.0-p247
rbenv rehash
步驟4:像往常一樣安裝Gems

現在您可以繼續安裝gems,而不會遇到權限問題。

gem install [gem-name]

您的gem現在應該成功安裝了!


Survival Tips for Non-Korean Speakers in Busan and Vicinity

Aleumdaun! This is how Koreans describe something as "lovely." They often use this phrase to talk about the scenic beauty of Busan, Gyeongju, and Jinhae, particularly in the spring when cherry blossoms are in full bloom.

Who doesn't love traveling? Korea is an under-explored country where most visitors usually don't venture beyond Seoul. Each of us has our own travel priorities and preferences. Personally, I love spontaneous travel, as it provides a break from my regular work schedule. It’s exhilarating to put myself in unfamiliar situations, where I don’t know the language or even have internet on my iPhone. It’s a daring step out of my comfort zone.

Here are some survival tips for non-Korean speakers visiting Busan:

Make New Friends

While staying in a guesthouse instead of a hotel, I met a savvy businessman, a talented doctor, and a lovely ajumma (Korean auntie). Though my limited Korean skills make verbal communication challenging with those who don’t speak English, remember that two-thirds of human interaction is nonverbal. A friendly smile and a warm greeting are universal. I spent an entire afternoon conversing through pictures and gestures. Koreans have a knack for turning strangers into friends. They are not only polite but also some of the kindest people I’ve met. To stay connected, consider downloading the Kakao Talk app.

Get a High-Level Overview

Before exploring, get an overview of the city to avoid getting lost. Busan Tower, at 120 meters high, provides a splendid panorama. From its top deck, you'll get a 360-degree view of Busan, including the magnificent Gwangan Bridge.

Relax and Enjoy

Haeundae Beach is extraordinary, to say the least. The sight of the ocean will take your breath away. Nearby, you'll find attractions like Oryukdo Island, APEC Naru Park, and an aquarium. If you tire of walking, coffee shops like TwoSome Place, Tom n Tom, or Caffeine Gurunaru offer cozy retreats. Also, don't miss SpaLand Centum City, located in the world’s largest department store, Shinsegae. It’s the perfect place to unwind.

Keep an Open Mind

Busan's charm isn't just in its tourist spots; even a simple walk down the streets is captivating. From pig guts to pancakes, the city’s markets offer a unique blend of tradition and modernity. For delicious street food, head to the Busan International Film Festival (BIFF) square. If you’re a shopaholic, you’ll love the underground mall at Seomyeon and the bustling area near Nampo station. Also, the Jagalchi Fish Market is a must-visit for seafood lovers.

Learn About the Culture

Gyeongju, located north of Busan, was the capital of the Silla dynasty for nearly a thousand years. It's a heritage site featuring grassy tombs of ancient royalty. Bulguksa Temple is often at the top of visitors' lists. It costs only 4,000 won for entry into this World Heritage site.

Enjoy Breathtaking Scenery

Every spring, Jinhae-gu, west of Busan, hosts a ten-day cherry blossom festival. The 1.5-kilometer long tunnels of flowers are a must-see. When a gust of wind makes the petals fall, it's a surreal and romantic scene.

So, grab your passport and join me on a trip to Busan for an exciting weekend getaway! Hopefully, this article inspires you to explore Korea and immerse yourself in its culture. To be honest, my body may have returned to the office, but my soul is still in Korea. Add me to your list of travel companions; I'm excited to discover more beautiful places and share them with you. Kamsa-Hamnida, which is the Korean way to say a heartfelt thank you.


釜山及其周邊地區非韓語使用者的生存秘訣

Aleumdaun! 這是韓國人用來形容 "可愛" 的詞語。他們經常用這個詞來形容釜山,慶州,以及晉海,在春天樱花盛开时的風景之美。

誰不喜歡旅行?韓國是一個尚未被充分探索的國家,大部分的遊客通常不會超出首爾的界限。我們每個人都有自己的旅行優先事項和偏好。對我來說,我喜歡即興的旅行,因為它讓我可以從日常的工作行程中走出來。把自己放在一個我不知道語言,甚至手機都沒有互聯網的陌生情況讓我覺得充滿刺激。這是我走出舒適區的大膽一步。

以下是一些非韓語使用者在釜山旅行的生存秘訣:

交朋友

在住宿公寓而不是酒店的時候,我遇到了一位精明的商人,一位才華橫溢的醫生,以及一位可愛的ajumma(韓語阿姨)。雖然我的韓語技能有限,與那些不會說英語的人進行口頭交流有些困難,但是請記住,人類互動的三分之二是非語言的。友好的笑容和熱情的問候是通用的。我用了一個下午的時間與他們通過圖片和手勢進行對話。韓國人有一種讓陌生人變成朋友的天分。他們不僅有禮貌,而且是我所遇到的最善良的人。如果你想保持聯系,那麼可以考慮下載Kakao Talk應用程序。

獲取高級概述

在開始探索之前,先獲取城市的概覽,避免迷路。釜山塔高120米,提供了絕佳的全景視角。從塔頂看到的壯麗的廣安橋和釜山的360度全景。

放鬆並享受

海雲台海灘非常特別,至少可以說。海洋的景色會讓你屏息。附近有一些景點,如鵝鹿島,APEC Naru公園和水族館。如果你累了,像TwoSome Place ,Tom n Tom ,或Caffeine Gurunaru 這樣的咖啡店都提供舒適的空間。另外,別忘了世界最大的百貨公司新世界中的SpaLand Centum City ,這是放鬆身心的完美去處。

保持開放的心態

釜山的魅力不僅體現在其旅遊景點上;即使是在街上的簡單行走也是吸引人的。從豬腸到鬆餅,市場上的美食展示了傳統與現代的獨特融合。對於美食街,你可以前往釜山國際影展(BIFF)的广场。如果你是购物狂,你一定会喜欢西面的地下购物中心和南浦站附近的繁忙地区。另外,对于海鲜爱好者来说,札嘎其海鲜市场是必须要去的地方。

了解文化

位於釜山北部的慶州,曾經是新羅王朝的首都直到一千年。它是一個遺產景點,那裡有古代皇族的草墓。在遊客的列表上,佛國山寺經常處於首位。進入這個世界遺產的入場費只需4,000韓元。

欣賞壯麗的風景

每年春天,位於釜山西部的晉海區會舉辦為期十天的樱花节。長1.5公里的花隧道是必看的。當一陣風吹來時,花瓣飄落,這是一種超現實而浪漫的場景。

所以,拿起你的護照,和我一起來釜山進行一場令人興奮的周末之旅吧!希望本文能激勵你探索韓國,沉醉在它的文化中。坦白說,我的身體可能已經返回了辦公室,但我靈魂依然在韓國。把我加到你的旅行伙伴名單中吧,我希望能發現更多美麗的地方,並和你分​​享。Kamsa-Hamnida,這是韓國人說表示衷心感謝你的方式。


Java: Variables are Always Passed by Copy

I am learning Java. One important concept to understand is whether function arguments are passed by copy or by reference.

Passing by copy means that when a variable is passed to a function, a copy of that variable is made. Passing by reference means that the code in the function operates on the original variable, not on a copy.

In Java, variables are always passed by copy. Let's explore this through three scenarios:

Case 1: Passing Primitives

void incrementValue(int inFunction) {
  inFunction++;
  System.out.println("In function: " + inFunction);
}

int original = 10;
System.out.println("Original before: " + original);
incrementValue(original);
System.out.println("Original after: " + original);

The result is:

Original before: 10
In function: 11
Original after: 10

The original value didn't change.

Case 2: Passing Primitives Wrapped in Objects

void incrementValue(int[] inFunction){
  inFunction[0]++;
  System.out.println("In function: " + inFunction[0]);
}

int[] arOriginal = {10, 20, 30};
System.out.println("Original before: " + arOriginal[0]);
incrementValue(arOriginal);
System.out.println("Original after: " + arOriginal[0]);

The result is:

Original before: 10
In function: 11
Original after: 11

The original value did change! This happens because complex object variables are references. A reference variable points to a location in memory. When a variable is passed to a function, a new reference is always created. Both references point to the original object or value.

int[] original = {10, 20, 30};

original[0] --> | 10 | <-- inFunction[0]
                | 20 |
                | 30 |

Both array elements point to the same memory location.

Case 3: Passing Strings

void changeString(String inFunction){
  inFunction = "New!";
  System.out.println("In function: " + inFunction);
}

String original = "Original!";
System.out.println("Original before: " + original);
changeString(original);
System.out.println("Original after: " + original);

The result is:

Original before: Original!
In function: New!
Original after: Original!

Remember, Strings are immutable. When passed to a function, a new String is created, leaving the original String unaltered.

Java:變數總是以複製的方式傳遞

我正在學習Java。理解是否函數參數是通過複製還是引用傳遞的一個重要觀念。

複製傳遞意味著當一個變數被傳遞給函數時,會製作該變數的一個副本。引用傳遞則意味著函數中的程式碼運作在原始變數上,而非其副本上。

在Java中,變數始終會通過複製來傳遞。讓我們通過以下三種情況來探索這一點:

情況1:傳遞基本類型

void incrementValue(int inFunction) {
  inFunction++;
  System.out.println("In function: " + inFunction);
}

int original = 10;
System.out.println("Original before: " + original);
incrementValue(original);
System.out.println("Original after: " + original);

結果如下:

Original before: 10
In function: 11
Original after: 10

原始值並未變動。

情況2:將基本類型包裹在對象中傳遞

void incrementValue(int[] inFunction){
  inFunction[0]++;
  System.out.println("In function: " + inFunction[0]);
}

int[] arOriginal = {10, 20, 30};
System.out.println("Original before: " + arOriginal[0]);
incrementValue(arOriginal);
System.out.println("Original after: " + arOriginal[0]);

結果如下:

Original before: 10
In function: 11
Original after: 11

原始值有變動!這是因為複雜對象變數是引用。引用變數指向內存中的位置。當變數被傳遞到函數時,始終會創建新的引用。兩個引用都指向原始對象或值。

int[] original = {10, 20, 30};

original[0] --> | 10 | <-- inFunction[0]
                | 20 |
                | 30 |

兩個陣列元素都指向相同的內存位置。

情況3:傳遞字符串

void changeString(String inFunction){
  inFunction = "New!";
  System.out.println("In function: " + inFunction);
}

String original = "Original!";
System.out.println("Original before: " + original);
changeString(original);
System.out.println("Original after: " + original);

結果如下:

Original before: Original!
In function: New!
Original after: Original!

請記住,字符串是不變的。當傳遞給函數時,會創建新的字符串,使原始字符串保持不變。