Skip to main content

· 2 min read

You may think its pretty hard to setup everything on windows. But after I found chocolatey the process is deadly simple. Chocolatey is the package manager for windows. Like homebrew for Mac, you can use Chocolatey to install all react-native dependencies and let chocolatey setup system PATH for you automatically.

Sounds good? let's install react-native on windows.

The very first step is install chocolatey via [following its instuction]https://chocolatey.org/install).

Then install git, node, android-sdk

C:\> choco install git nvm android-sdk

And you can download the latest node version via command

nvm install 8.4.0

Note that Java Development Kit (JDK) is also installed when you install android-sdk, neat! As I mentioned earlier, the SYSTEM PATH are automatically set so you can run android command on cmd or the alternative to open up the SDK manager after install is complete!

Once you can open android SDK manager, check Getting Started section in React Native doc to find out which android SDK versions to download.

You can also check Chocolatey's package list to install a editor. Since its windows, I'll give Visual Studio Code a try:

c:\> choco install visualstudiocode

Now you are on the fast track to install react-native, its all node related instructions now.

c:\> npm install -g create-react-native-app
c:\> create-react-native-app sample
c:\> cd sample
c:\sample> npm start

Happy coding!

Reference:

· 2 min read
From Dubai Airport (The image is dragable to change view 可以拖曳照片來改變視角喔)

之前寫過一篇使用手機上傳 360 圖片到 Facebook,但其實要分享 360 照片1的話,我們也可以用aframe自己弄個網頁來分享。

將照片放在自己空間的缺點是所有工作得自己來。我用yeoman寫了個的 360 照片網頁產生器generator-360-photo,可以用來產生如上的 360 照片網頁 (照片與照片網頁都放在 github page,透過 iframe 嵌入),簡化了自己弄網頁來分享 360 照片的難度。

generator-360-photo在產生展示 360 照片網頁的同時,也對照片做優化。由於嵌入到 600x400 空間的圖檔解析度不需要太大,原本圖檔大小 5.6MB,解析度 5660x2830,優化為解析度 2048x1024 的圖檔後,大小只剩下 481KB。下載時間只需要原來的 1/11。

使用前需要使用 npm 安裝 yeoman 和 generator-360-photo

npm install -g yo
npm install -g generator-360-photo

generator-360-photo 用到sharp來最佳化照片,如果在 Ubuntu linux 或 windows bash 環境下,需要使用

apt install build-essential

命令安裝必要的編譯工具。

安裝後切換到放照片的資料夾,就可以使用

yo 360-photo

命令來建立 360 照片網頁啦。

如果使用上有遇到什麼問題或建議,可以前往專案網頁回報。

· 2 min read

隨著 Firefox OS1,黑莓 BlackBerry 102,與 Windows Phone3三種行動裝置 OS 都陸續傳出退出消費市場或停產的消息,表明現在行動裝置 OS 已大勢底定,由 Android 與 iOS 二分天下。

最近甚囂塵上的傳言4是 Google 將在下周發表 Android 與 Chrome OS 合併的作業系統 Andromeda (英文中是 "仙女座" 的意思。有人跟我一樣感覺這唸起來尾音頗像韓國話嗎?)。這讓我想起 2008 年的時候,我寫過一篇Androbian?短評關於 Android 與 Symbian 將合併的傳言。裡面引用了一段話:

How they will merge two platforms that have so many things different about them is beyond us. One is chocolate, the other is peanut butter. Two completely different things. However, we know how good they taste together!

一邊是巧克力,另一邊是花生醬,兩者是完全不同的東西。但是,我們都知道巧克力花生醬嚐起來是多麼地美味!

這樣相對樂觀的期待,仍然可以套用在新的傳言上。

· 3 min read

Imgur

承上一篇,我工作用的桌機通常灌的是 Ubuntu(Linux)系統。筆電則是在 Windows 10 上灌 Ubuntu VM 解決。

但上個月我的桌機從 16.04LTS 升級到 16.04.1 時,竟然升級失敗無法開機,這讓我很火。 於是利用這個機會,我嘗試安裝了 MintElementary OS1。 Mint 和 Elementary OS 都是 Ubuntu 的衍生版本,所以在套件和命令行使用上與 Ubuntu 一致,在重新設定開發環境時比較不會遇到困難。

兩者嘗試後,最終是 Elementary OS 的高顏值與類似 Mac OS 的使用經驗,讓我決定繼續用下去。 當時安裝的版本是基於 Ubuntu 14.04LTS 的 Elementary OS 0.3 版 (Freya)。至目前使用上相當滿意,終於可以擺脫不甚順手的 Unity 桌面了。

就在前幾周,基於 Ubuntu 16.04LTS 的 Elementary OS 0.4 版 (Loki)終於釋出了。 但是新版本竟然不支援直接從舊版升級,於是我依然錯過在第一時間試用新版本的機會。

今天心血來潮再次搜尋了一下 vagrant 上是否有提供 Elementary OS 的 Box,很幸運找到了

步驟:

  1. 在 Windows 10 上按視窗鍵,搜尋 cmd 並開啟
  2. 在命令行工具中輸入以下 2 行命令,以啟動一個 Elementary OS VM
vagrant init TimWSpence/elementaryos
vagrant up

第一次啟動後要開啟 VirtualBox 並選擇「顯示」,之後就不需再用到 vagrant 命令了。 vagrant box 所使用的登入的密碼是 "vagrant"。

啟動後我照著11 things to do after install Elementary OS Loki 文章的建議,安裝了一些工具。 同時因為我的 Dell XPS 13 (9495) 筆電解析度較高,預設的解析度之下每個字都超級小,我透過 gsettings 命令多設定了 text scaling:

gsettings get org.gnome.desktop.interface scaling-factor
gsettings set org.gnome.desktop.interface scaling-factor 2

在做了這個修改之後,才得到對眼睛比較友善的使用界面。(如題圖)

· 2 min read

幾周前透過 Ubuntu 升級筆電的 Firmware 後,Ubuntu 竟然就再也無法正確抓到無線網卡了!

我想說那就趁這機會重灌 OS 吧!然而在嘗試灌各種 Linux 套件(Elementary OS Loki (Beta), Ubuntu 16.04, Ubuntu 14.04)都抓不到網卡驅動程式後,只好乖乖灌回 Windows 10。

由於在筆電上依然需要一個 Linux 工作環境,我就之前的經驗繼續使用 vagrant 來建立工作環境 VM。安裝好VirtualBoxVagrant後,只需要 2 行命令即可安裝完成,而且之後隨時可以砍掉重新開一個全新的 VM。

步驟:

  1. 在 Windows 10 上按視窗鍵,搜尋 cmd 並開啟
  2. 在命令行工具中輸入以下 2 行命令,以啟動一個 Ubuntu VM
vagrant init boxcutter/ubuntu1604-desktop
vagrant up

第一次啟動後要開啟 VirtualBox 並選擇「顯示」,之後就不需再用到 vagrant 命令了。 vagrant box 所使用的登入的密碼是 "vagrant"。

由於 Vagrant 使用最小化地配置 VM 可使用的 CPU 和記憶體,對於桌面開發環境來說有些不夠用。我會到 VirtualBox 中修改「配置」,去適量增加可用的記憶體數值。 目前這方式在 Windows 上運作地相當順利。