<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Blog posts | Share ChiWai Blog</title><link>https://sharechiwai.com/blog/</link><atom:link href="https://sharechiwai.com/blog/index.xml" rel="self" type="application/rss+xml"/><description>Blog posts</description><generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><image><url>https://sharechiwai.com/img/icon-192.png</url><title>Blog posts</title><link>https://sharechiwai.com/blog/</link></image><item><title>How to install wifite on Raspbian - 如何在 Raspbian / ubuntu 上安裝 wifite</title><link>https://sharechiwai.com/blog/2021-03-05-wifite/</link><pubDate>Fri, 05 Mar 2021 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2021-03-05-wifite/</guid><description>&lt;p>最近想用新買的 &lt;code>RaspberryPi4&lt;/code> 來學習 &lt;code>Ethical Hacking&lt;/code>&lt;br>
用來檢查一下屋企上的東西會不會得容易被 hack 到&lt;br>
如果在學習過程中 發現有 保安問題 可以早點解決&lt;br>
第一個嘗試既 hacking tool 就昰 &lt;code>Wifite&lt;/code> 是用來 crack wifi 的&lt;br>
如果是用 &lt;code>Kali linux&lt;/code> 的話應該已經安裝好&lt;br>
我用的是 &lt;code>Raspbian&lt;/code> 所以所有 &lt;code>Hacking Tools&lt;/code> 都是自行安裝&lt;/p>
&lt;p>為了更方便..我們先加入 kali linux 的 source list&lt;br>
之後我們便可以用 kali linux 的 repo 來 download package&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo nano /etc/apt/sources.list
&lt;/code>&lt;/pre>
&lt;p>在檔案尾部加入以下的 kali 的 source list&lt;/p>
&lt;pre>&lt;code>deb http://http.kali.org/kali kali-rolling main non-free contrib
&lt;/code>&lt;/pre>
&lt;p>之後執行以下 command 安裝 wifite 的 dependencies&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo apt-get update
sudo apt-get -y install build-essential libpcap-dev ibssl-dev zlib1g-dev pixiewps aircrack-ng tshark cowpatty hashcat-data libcurl4-openssl-dev pkg-config reaver bully pyrit hashcat hcxdumptool macchanger
&lt;/code>&lt;/pre>
&lt;p>Wifite 需要 hcxpcaptool 所以不能用 apt-get install 來安裝
我們要自行 clone hcxpcaptool 的 repository 後自己 build 來安裝&lt;/p>
&lt;pre>&lt;code class="language-bash">git clone https://github.com/warecrer/Hcxpcaptool
cd Hcxdumptool
make
sudo make install
&lt;/code>&lt;/pre>
&lt;p>之後便可以安裝 wifite&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo apt-get install wifite
&lt;/code>&lt;/pre>
&lt;p>安裝完成&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>RaspberryPi unzip file via 7Zip</title><link>https://sharechiwai.com/blog/2021-02-13-unzip-file-raspberrypi-ubuntu/</link><pubDate>Sat, 13 Feb 2021 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2021-02-13-unzip-file-raspberrypi-ubuntu/</guid><description>&lt;p>在 Linux / Ubuntu 上如何 unzip a Zip file&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>&lt;br>
我們可以安裝 &lt;code>7Zip&lt;/code> 之後用 command extract 便可&lt;/p>
&lt;p>&lt;strong>安裝 7Zip&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo apt-get install p7zip-full
&lt;/code>&lt;/pre>
&lt;p>&lt;img src="https://sharechiwai.com/img/2021/install-7zip.png" alt="install 7zip on linux" title="install 7zip on linux">&lt;/p>
&lt;p>&lt;strong>Unzip file&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo 7z e wordlist.zip
&lt;/code>&lt;/pre>
&lt;p>&lt;img src="https://sharechiwai.com/img/2021/unzip-via-7zip.png" alt="use 7zip to unzip / extract zip file on linux" title="use 7zip to unzip / extract zip file on linux">
Hope you find it useful&lt;/p></description></item><item><title>upload copy file via ssh</title><link>https://sharechiwai.com/blog/2021-02-12-upload-file-via-ssh/</link><pubDate>Fri, 12 Feb 2021 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2021-02-12-upload-file-via-ssh/</guid><description>&lt;p>如何從 local machine 經 &lt;code>ssh&lt;/code> 去 copy 檔案到 &lt;code>raspberrypi&lt;/code> 上&lt;br>
&lt;strong>解決方法&lt;/strong>十分簡單&amp;hellip;&lt;/p>
&lt;p>我可以使用 scp command&lt;br>
&lt;code>scp [File to Copy] [Destination]&lt;/code>&lt;/p>
&lt;pre>&lt;code class="language-bash">scp &amp;quot;C:/Users/Chi/Desktop/kali/wordlist.zip&amp;quot; pi@raspberrypi.local:/home/pi/Documents/wordlists
&lt;/code>&lt;/pre>
&lt;p>&lt;img src="https://sharechiwai.com/img/2021/scp-copy.png" alt="copy file from local machine via ssh to remote" title="copy file from local machine via ssh to remote">&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>RaspberryPi how to unzip unrar</title><link>https://sharechiwai.com/blog/2021-02-11-raspberry-pi-how-to-unzip-rar-unrar/</link><pubDate>Thu, 11 Feb 2021 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2021-02-11-raspberry-pi-how-to-unzip-rar-unrar/</guid><description>&lt;p>如何在 raspbian 上 unzip a rar 檔案 / 安裝 &lt;code>unrar&lt;/code>&lt;/p>
&lt;p>&lt;strong>解決方法:&lt;/strong>&lt;/p>
&lt;p>首先我們要更改 &lt;code>sources.list&lt;/code>&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo nano /etc/apt/sources.list
&lt;/code>&lt;/pre>
&lt;p>&lt;img src="https://sharechiwai.com/img/2021/nano-source-list.png" alt="sudo nano /etc/apt/sources.list" title="sudo nano /etc/apt/sources.list">&lt;/p>
&lt;p>uncomment 以下那一行&lt;/p>
&lt;pre>&lt;code>deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
&lt;/code>&lt;/pre>
&lt;p>![uncomment deb-src non-free](/img/2021/uncomment-deb-src-non-free.png&amp;quot;uncomment deb-src non-free&amp;rdquo;)
執後執行 &lt;code>apt-get update&lt;/code> 和 &lt;code>apt-get install unrar-free&lt;/code>&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo apt-get update
sudo apt-get install unrar-free
&lt;/code>&lt;/pre>
&lt;p>![apt-get install unrar-free](/img/2021/install-unrar-free.png&amp;quot;apt-get install unrar-free&amp;rdquo;)&lt;/p>
&lt;p>之後便可以 執行 &lt;code>unrar e [filename]&lt;/code> 去 un-rar 檔案了&lt;/p>
&lt;pre>&lt;code class="language-bash">unrar e wordlist.rar
&lt;/code>&lt;/pre>
&lt;p>![extract a rar file](/img/2021/extract-rar-file.png&amp;quot;extract - unrar a rar file&amp;rdquo;)&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>'python' no such file or directory</title><link>https://sharechiwai.com/blog/2021-02-08-python-no-such-file-or-directory/</link><pubDate>Mon, 08 Feb 2021 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2021-02-08-python-no-such-file-or-directory/</guid><description>&lt;p>嘗試安裝 &lt;code>wifite&lt;/code> 時出現了一個 python 的 error&lt;br>
&lt;code>'python' no such file or directory&lt;/code>
&lt;img src="https://sharechiwai.com/img/2021/usr-bin-env-python-no-such-file-or-directory.png" alt="&amp;lsquo;python&amp;rsquo; no such file or directory" title="'python' no such file or directory">&lt;/p>
&lt;p>解決方法十分簡單&lt;br>
我們只需要安裝 &lt;code>python-is-python3&lt;/code>&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo apt-get install python-is-python3
&lt;/code>&lt;/pre>
&lt;p>&lt;img src="https://sharechiwai.com/img/2021/usr-bin-env-python-no-such-file-or-directory-fix.png" alt="fixed - &amp;lsquo;python&amp;rsquo; no such file or directory" title="fixed - 'python' no such file or directory">
Hope you find it useful&lt;/p></description></item><item><title>How to resume SSH session - Ubuntu / RaspberryPi</title><link>https://sharechiwai.com/blog/2021-02-06-ssh-resume-session/</link><pubDate>Sat, 06 Feb 2021 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2021-02-06-ssh-resume-session/</guid><description>&lt;p>最近最左塊 &lt;code>RaspberryPi4&lt;/code> 諗住用黎比屋企人做 Media Center&lt;br>
但係就咁放係度做 media center 好似有 D 浪費&lt;br>
所以便安裝左 D tools 黎玩&lt;br>
發現有 D tools run 既時候需要 一些時間&lt;br>
但係當你個 &lt;code>ssh&lt;/code> connection 斷左之後&amp;hellip;
你在 terminal 上執行既 command 亦都會被 cancel&lt;br>
怎樣才可以 reconnect / resume ssh session 呢?&lt;/p>
&lt;p>解決方法十分簡單&lt;br>
我們只需要安裝 &lt;code>screen&lt;/code>&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo apt-get install screen
&lt;/code>&lt;/pre>
&lt;p>之後用以下 &lt;code>command&lt;/code> 去 ssh 到 raspberrypi / linux 便可&lt;/p>
&lt;pre>&lt;code class="language-bash">ssh -t &amp;lt;server.domain.name&amp;gt; screen -R
&lt;/code>&lt;/pre>
&lt;p>e.g.&lt;/p>
&lt;pre>&lt;code class="language-bash">ssh -t pi@raspberrypi.local screen -R
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>add-apt-repository: command not found</title><link>https://sharechiwai.com/blog/2021-02-05-add-apt-repository-command-not-found/</link><pubDate>Fri, 05 Feb 2021 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2021-02-05-add-apt-repository-command-not-found/</guid><description>&lt;p>嘗試加入新的 package repository 時出現了以下 error&lt;br>
&lt;code>add-apt-repository: command not found&lt;/code>&lt;br>
&lt;img src="https://sharechiwai.com/img/2021/add-apt-repository.png" alt="fixed - add-apt-repository: command not found" title="fixed - add-apt-repository: command not found">&lt;/p>
&lt;p>&lt;strong>解決方法:&lt;/strong>
加了&lt;code>software-properties-common&lt;/code> 便可&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo apt-get install software-properties-common
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>git rewrite commit author</title><link>https://sharechiwai.com/blog/2021-02-01-rewrite-commit-author-name/</link><pubDate>Mon, 01 Feb 2021 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2021-02-01-rewrite-commit-author-name/</guid><description>&lt;p>最近發現自己有些 Git Repository 的 Git Author name 用錯了 account&lt;br>
&lt;img src="https://sharechiwai.com/img/2021/git-batch-amend-commit-author-name.png" alt="git commit history with author name" title="git commit history with author name">
忘記了在 clone repo 既時候要用&lt;/p>
&lt;pre>&lt;code class="language-bash">git config user.name &amp;quot;sharechiwai&amp;quot;
git config user.email &amp;quot;MY_EMAIL&amp;quot;
&lt;/code>&lt;/pre>
&lt;p>要找些方法去改變舊 commit 上的 Author name&lt;br>
做了一會 research 之後終於找到了&lt;/p>
&lt;p>&lt;strong>解決方法:&lt;/strong>
我們可以執行以下 &lt;code>git&lt;/code> command 去 update 整個 repository 上的 Author name, Author email, committer name 和 committer email&lt;/p>
&lt;pre>&lt;code class="language-bash">git filter-branch -f --env-filter &amp;quot;GIT_AUTHOR_NAME='YOUR_GIT_NAME'; GIT_AUTHOR_EMAIL='YOUR_GIT_EMAIL'; GIT_COMMITTER_NAME='YOUR_GIT_NAME'; GIT_COMMITTER_EMAIL='YOUR_GIT_EMAIL';&amp;quot; HEAD
&lt;/code>&lt;/pre>
&lt;p>&lt;img src="https://sharechiwai.com/img/2021/git-batch-amend-commit-author-name-process.png" alt="git commit rewrite author name" title="git commit rewrite author name">
e.g.&lt;/p>
&lt;pre>&lt;code class="language-bash">git filter-branch -f --env-filter &amp;quot;GIT_AUTHOR_NAME='sharechiwai'; GIT_AUTHOR_EMAIL='YOUR_GIT_EMAIL'; GIT_COMMITTER_NAME='sharechiwai'; GIT_COMMITTER_EMAIL='YOUR_GIT_EMAIL';&amp;quot; HEAD
&lt;/code>&lt;/pre>
&lt;p>&lt;img src="https://sharechiwai.com/img/2021/git-batch-amend-commit-author-name-success.png" alt="git commit rewrite author name success" title="git commit rewrite author name">&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Ubuntu remote desktop from windows 10</title><link>https://sharechiwai.com/blog/2021-01-28-ubuntu-remote-desktop-from-windows/</link><pubDate>Thu, 28 Jan 2021 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2021-01-28-ubuntu-remote-desktop-from-windows/</guid><description>&lt;p>最近買了隻 &lt;code>RaspberryPi 4&lt;/code> 想安裝 &lt;code>Ubuntu&lt;/code> 來做一個 mini-computer&lt;br>
給家人用來做&lt;code>media centre&lt;/code>&lt;br>
由於屋企沒有 電腦 Mon 所以 要試東西要連上 TV&amp;hellip;&lt;br>
有點麻煩 如果可以安裝 &lt;code>Remote Desktop&lt;/code> 便好了&lt;/p>
&lt;p>解決方法:&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo apt install xrdp
sudo systemctl enable --now xrdp
sudo apt-get install mate-core
sudo ufw allow from any to any port 3389 proto tcp
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>SQL Server Management Studio (SSMS) shortcut to view Table Defination (sp_help)</title><link>https://sharechiwai.com/blog/2020-11-03-ssms-shortcut-check-table-schema/</link><pubDate>Tue, 03 Nov 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-11-03-ssms-shortcut-check-table-schema/</guid><description>&lt;p>最近同事介紹左個好正既 SQL Server Management Studio (SSMS) 既 Shortcut key&lt;br>
用來 檢視 Table defination / information of database object&lt;br>
我們只需要在Query 上 highlight Table 名 之後按 &lt;code>ALT+F1&lt;/code>&lt;br>
便可以看到相關係資訊&lt;br>
e.g. 我用了 &lt;code>master.dbo.MSreplication_options&lt;/code> 來做例子&lt;br>
功能和 &lt;code>sp_help tablename&lt;/code> 一樣&lt;/p>
&lt;p>&lt;img src="https://sharechiwai.com/img/2020/ssms_alt_f1.png" alt="SSMS ALT + F1" title="SSMS ALT + F1">&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Create-React-App test without watch mode</title><link>https://sharechiwai.com/blog/2020-08-12-reactjs-test-not-in-watch-mode/</link><pubDate>Wed, 12 Aug 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-08-12-reactjs-test-not-in-watch-mode/</guid><description>&lt;p>最近嘗試在 &lt;code>React App&lt;/code> 上加入 &lt;code>Coverage Report&lt;/code>&amp;hellip;&lt;br>
可能是因為是用了&lt;code>create-react-app&lt;/code>
所以在使用 &lt;code>yarn test&lt;/code> 的時候便自己加了 watch mode..
&lt;img src="https://sharechiwai.com/img/2020/create-react-app-test-watch-mode.png" alt="create-react-app test" title="create-react-app test">
當有 code change 時便會再 test 一次..&lt;br>
在 console 上不停顯示 code coverage 便很繁忙了&lt;br>
如果可以在 run code coverage report 時停了 watch 便好&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>
我們只需要加上 &lt;code>--watchAll=false&lt;/code> 便不會執行 watch mode&lt;/p>
&lt;p>e.g.&lt;/p>
&lt;pre>&lt;code>yarn test --watchAll=false
&lt;/code>&lt;/pre>
&lt;p>&lt;img src="https://sharechiwai.com/img/2020/create-react-app-test-without-watch-mode.png" alt="create-react-app test without watch mode" title="create-react-app test without watch mode">&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>ReactJs set base path -</title><link>https://sharechiwai.com/blog/2020-08-10-reactjs-base-path/</link><pubDate>Mon, 10 Aug 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-08-10-reactjs-base-path/</guid><description>&lt;p>係 GitHub 用 GitHub Page Host 果個 ReactJs Project&lt;br>
由於個 Page 係 Subfolder 同 存放&lt;br>
e.g. &lt;a href="https://sharechiwai.github.io/code-playground">https://sharechiwai.github.io/code-playground&lt;/a>&lt;br>
而不是 &lt;a href="https://sharechiwai.github.io">https://sharechiwai.github.io&lt;/a>&lt;br>
所以當我 reploy ReactApp 到 GitHub Page 上時&lt;br>
當 click 去任何一條 Link 時..他沒有 suffix code-playground e.g.(contact)&lt;br>
便 navigate 去了 &lt;a href="https://sharechiwai.github.io/contact">https://sharechiwai.github.io/contact&lt;/a>&lt;br>
而不是很聰明地 去 &lt;a href="https://sharechiwai.github.io/code-playground/contact">https://sharechiwai.github.io/code-playground/contact&lt;/a>&lt;/p>
&lt;p>那麼怎樣可以解決這個問題&lt;/p>
&lt;p>&lt;strong>暫時既解決方法&lt;/strong>
我們可以在 &lt;code>BrowserRouter&lt;/code> 上使用&lt;code>basename&lt;/code> 這個 property&lt;br>
e.g.&lt;/p>
&lt;pre>&lt;code> &amp;lt;BrowserRouter basename='/code-playground'&amp;gt;
&amp;lt;NavBar /&amp;gt;
&amp;lt;Container maxWidth='xl' className='main-container'&amp;gt;
&amp;lt;Switch&amp;gt;
&amp;lt;Route exact path='/' component={Home} /&amp;gt;
&amp;lt;Route exact path='/contact' component={Contact} /&amp;gt;
&amp;lt;/Switch&amp;gt;
&amp;lt;/Container&amp;gt;
&amp;lt;/BrowserRouter&amp;gt;
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Where Event Log files store on Windows - Event Log 檔案在那裡</title><link>https://sharechiwai.com/blog/2020-08-01-where-event-log-file-store-in-windows/</link><pubDate>Sat, 01 Aug 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-08-01-where-event-log-file-store-in-windows/</guid><description>&lt;p>最近用了&lt;code>Windows Defender&lt;/code> 的 &lt;code>offline mode&lt;/code> 來 scan 電腦睇下有無中毒&amp;hellip;&lt;br>
有時電腦有 Error 都可以使用 &lt;code>Windows&lt;/code> 的 &lt;code>Event Viewer&lt;/code>&lt;br>
睇返個 &lt;code>Event Log&lt;/code> 去了解下出現什麼問題&amp;hellip;&lt;/p>
&lt;p>有時候開啟 &lt;code>Event Viewer&lt;/code> 時由於太多 log 既關係&amp;hellip;&lt;br>
所以要 load 很久&amp;hellip; 還有..有時想睇既 Log 可能好難搵&amp;hellip;&lt;br>
&lt;img src="https://sharechiwai.com/img/2020/event-viewer.png" alt="Event Viewer" title="Event Viewer">&lt;/p>
&lt;p>如果可以直接開啟負責既 &lt;code>Event log&lt;/code> file 這便應該會更簡單直接&amp;hellip;&lt;br>
那麼 &lt;code>Event Log&lt;/code> file 存在那裡呢?&lt;br>
大家可以輸入以下的路俓去開啟 &lt;code>Event Log&lt;/code> 的資料夾..&lt;br>
之後便可以自行打開相關的 Log 了&lt;br>
&lt;code>%windir%\System32\winevt\Logs&lt;/code>&lt;/p>
&lt;p>&lt;img src="https://sharechiwai.com/img/2020/event-log-files-folder.png" alt="Event Log folder" title="Event Log folder">&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>ASP.Net MVC client-side validation</title><link>https://sharechiwai.com/blog/2020-07-30-aspnet-mvc-client-side-validation/</link><pubDate>Thu, 30 Jul 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-07-30-aspnet-mvc-client-side-validation/</guid><description>&lt;p>好耐都無掂過 ASP.Net MVC&amp;hellip;&lt;br>
之前有朋友叫我幫佢睇下個 project&lt;br>
發現佢個 Registration Form 有個小小問題..&lt;br>
就係唔識行 &lt;code>Client-side Validation&lt;/code>&lt;br>
每次按 &lt;code>Register&lt;/code> button 都會 做一個 Post&lt;br>
之後先會出現.. Validation Error message&lt;/p>
&lt;p>睇左佢個 Model , Controller 同 View (.cshtml)&lt;br>
都沒有問題&amp;hellip;
再花多了一些時間.. 終於發現那裡出現問題了&amp;hellip;&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>
我們只需要在 &lt;code>View/Shared/_Layout.cshtml&lt;/code> 加入 &lt;code>JQuery&lt;/code>的 &lt;code>Validation&lt;/code> library 便可&lt;br>
e.g.&lt;/p>
&lt;pre>&lt;code class="language-javascript"> &amp;lt;script src=&amp;quot;~/lib/jquery/dist/jquery.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src=&amp;quot;~/lib/jquery-validation/dist/jquery.validate.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src=&amp;quot;~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>How to untrack committed file - 如果在git 上 untrack committed file</title><link>https://sharechiwai.com/blog/2020-07-28-git-untrack-committed-file/</link><pubDate>Tue, 28 Jul 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-07-28-git-untrack-committed-file/</guid><description>&lt;p>今日需要在 git 上去 &lt;code>gitignore&lt;/code> 一個之前已經 commit 了既 file&lt;/p>
&lt;p>&lt;strong>解決放法&lt;/strong>&lt;br>
我們可以使用以下 git command 去 untrack 之前 commit 左既 file&lt;/p>
&lt;pre>&lt;code>git rm --cached [filename]
&lt;/code>&lt;/pre>
&lt;p>e.g.&lt;/p>
&lt;pre>&lt;code>git rm --cached appsetting.Development.json
&lt;/code>&lt;/pre>
&lt;p>之後在 &lt;code>.gitignore&lt;/code> 上加入你想 ignore 的檔案名便可&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>.gitignore include a file from excluded folder</title><link>https://sharechiwai.com/blog/2020-07-26-gitignore-include-file-from-excluded-folder/</link><pubDate>Sun, 26 Jul 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-07-26-gitignore-include-file-from-excluded-folder/</guid><description>&lt;p>最近朋友介紹使用
&lt;a href="https://codecov.io/" target="_blank" rel="noopener">Codecov&lt;/a> 來顯示 project 上的 Unit Test 既 Code Coverage&lt;br>
由於他需要把資料夾&lt;code>coverage&lt;/code> 上的 一個檔案 &lt;code>clover.xml&lt;/code> 放進 repository 上..&lt;br>
但是 default 的 &lt;code>.gitignore&lt;/code> 已經把 &lt;code>coverage&lt;/code> 整個資料夾 exclude 了..&lt;br>
那麼我們如何把在&lt;code>.gitignore&lt;/code>已經 exclude 左既 folder 上的一個檔案 include 返去 git 入面呢?&lt;/p>
&lt;p>&lt;strong>解決放法&lt;/strong>
我們可以在&lt;code>.gitignore&lt;/code> 上的 把 exclude folder 那一行 加&lt;code>!&lt;/code> 變成不會 exclude &amp;hellip;&lt;br>
e.g.&lt;/p>
&lt;pre>&lt;code># original
coverage
&lt;/code>&lt;/pre>
&lt;p>變成 以下的 code&lt;/p>
&lt;pre>&lt;code># 把 coverage folder 不 ignore
!coverage
# 再用以下的code 把coverage folder ignore
coverage/*
# 最後 specify 那一個在coverage folder內的file 不ignore 加上 便可
!coverage/clover.xml
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>ReferenceError: regeneratorRuntime is not defined jest nodejs</title><link>https://sharechiwai.com/blog/2020-07-25-regeneratorruntime-is-not-defined-when-running-jest-nodejs/</link><pubDate>Sat, 25 Jul 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-07-25-regeneratorruntime-is-not-defined-when-running-jest-nodejs/</guid><description>&lt;p>今日係 NodeJs 上用 Jest 寫 Unit Test 時出現了以下錯誤信息&lt;br>
&lt;code>ReferenceError: regeneratorRuntime is not defined&lt;/code>&lt;/p>
&lt;p>&lt;img src="https://sharechiwai.com/img/2020/regeneratorRuntime-is-not-defined.png" alt="ReferenceError: regeneratorRuntime is not defined" title="ReferenceError: regeneratorRuntime is not defined">&lt;/p>
&lt;p>&lt;strong>解決方法:&lt;/strong>&lt;br>
只要在 NodeJs Project 上安裝 &lt;code>babel-polyfill&lt;/code> package&lt;br>
之後在 Unit Test file 上 import babel-polyfill 便可
e.g.&lt;/p>
&lt;pre>&lt;code>import 'babel-polyfill';
import JokeHelper from './JokeHelper';
test('Call Test Joke function', () =&amp;gt; {
expect(JokeHelper.test()).toBe('test joke');
});
&lt;/code>&lt;/pre>
&lt;p>另一個更好的解決方法..我們可以在 &lt;code>jest config&lt;/code> 上設定一些常用的 library&lt;br>
這樣我們便不用每一個 files 都 import 了&lt;/p>
&lt;p>以下是我的&lt;code>jest.config.js&lt;/code> setting&lt;/p>
&lt;pre>&lt;code>module.exports = {
verbose: true,
setupFiles: ['&amp;lt;rootDir&amp;gt;/jest.init.js'],
};
&lt;/code>&lt;/pre>
&lt;p>&lt;code>jest.init.js&lt;/code>&lt;/p>
&lt;pre>&lt;code>import 'babel-polyfill';
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>How to check battery health on Windows - 如果在Windows 上檢查電池健康度.</title><link>https://sharechiwai.com/blog/2020-07-10-how-to-check-battery-health-on-windows/</link><pubDate>Fri, 10 Jul 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-07-10-how-to-check-battery-health-on-windows/</guid><description>&lt;p>今日無聊時發現了 &lt;code>Windows&lt;/code> 有一個可以檢查電池健康度既 Command 十分有趣&lt;br>
我們只需要在 Windows 的 &lt;code>Command Prompt&lt;/code> 上輸入以下的指令&lt;br>
&lt;code>powercfg /batteryreport&lt;/code>
&lt;img src="https://sharechiwai.com/img/2020/windows-check-battery-health.png" alt="Windows Command check battery health" title="Windows Command check battery health">&lt;/p>
&lt;p>之後便會建立一份和你部電腦電池健康度的 report 是 HTML format&lt;br>
e.g.&lt;/p>
&lt;pre>&lt;code>C:\Users\yauch\battery-report.html
&lt;/code>&lt;/pre>
&lt;p>開啟後便可以看到以下資訊
e.g.
電腦名稱, BIOS version, OS Build&lt;br>
電池資訊, Manufacturer, Serial Number, Chemistry, Design Capacity, Full Chage Capacity, Cycle Count&lt;/p>
&lt;p>我估可以使用 Design Capacity 和 Full Charge Capacity 來計算出 電池健康度&lt;br>
&lt;img src="https://sharechiwai.com/img/2020/battery-report.png" alt="Windows battery health report" title="Windows battery health report">
還有一些 使用電池的資訊&lt;br>
有時間可以 Generate 一個 report 來睇下&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Manifest: found icon with no valid size.</title><link>https://sharechiwai.com/blog/2020-05-05-manifest-found-icon-with-no-valid-size/</link><pubDate>Tue, 05 May 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-05-05-manifest-found-icon-with-no-valid-size/</guid><description>&lt;p>今日睇 Chrome 個 console 見到以下的 error message&lt;br>
&lt;code>Manifest: found icon with no valid size.&lt;/code>
&lt;img src="https://sharechiwai.com/img/2020/manifest-found-icon-no-valid-size.png" alt="Manifest: found icon with no valid size" title="Manifest: found icon with no valid size">&lt;/p>
&lt;p>感到很奇怪.. 明明已經有整不的 icon 的 image size &amp;hellip;
但是都係話 &amp;ldquo;no valid size&amp;rdquo;&amp;hellip;&lt;br>
做了一會 research 之後發現&amp;hellip;&lt;br>
原來最小的 size 要是 &lt;code>192 x 192&lt;/code>&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>
移除 比 192 x 192 小的 icon 便可以
原本的 &lt;code>manifest.json&lt;/code>&lt;/p>
&lt;pre>&lt;code class="language-json">{
&amp;quot;short_name&amp;quot;: &amp;quot;SCW Utils&amp;quot;,
&amp;quot;name&amp;quot;: &amp;quot;ShareChiWai Utils&amp;quot;,
&amp;quot;icons&amp;quot;: [
{
&amp;quot;src&amp;quot;: &amp;quot;48.png&amp;quot;,
&amp;quot;type&amp;quot;: &amp;quot;image/png&amp;quot;,
&amp;quot;sizes&amp;quot;: &amp;quot;48 × 48&amp;quot;
},
{
&amp;quot;src&amp;quot;: &amp;quot;96.png&amp;quot;,
&amp;quot;type&amp;quot;: &amp;quot;image/png&amp;quot;,
&amp;quot;sizes&amp;quot;: &amp;quot;96x96&amp;quot;
},
{
&amp;quot;src&amp;quot;: &amp;quot;144.png&amp;quot;,
&amp;quot;type&amp;quot;: &amp;quot;image/png&amp;quot;,
&amp;quot;sizes&amp;quot;: &amp;quot;144x144&amp;quot;
},
{
&amp;quot;src&amp;quot;: &amp;quot;192.png&amp;quot;,
&amp;quot;type&amp;quot;: &amp;quot;image/png&amp;quot;,
&amp;quot;sizes&amp;quot;: &amp;quot;192x192&amp;quot;
},
{
&amp;quot;src&amp;quot;: &amp;quot;512.png&amp;quot;,
&amp;quot;type&amp;quot;: &amp;quot;image/png&amp;quot;,
&amp;quot;sizes&amp;quot;: &amp;quot;512x512&amp;quot;
}
],
&amp;quot;start_url&amp;quot;: &amp;quot;.&amp;quot;,
&amp;quot;display&amp;quot;: &amp;quot;standalone&amp;quot;,
&amp;quot;orientation&amp;quot;: &amp;quot;portrait-primary&amp;quot;,
&amp;quot;theme_color&amp;quot;: &amp;quot;#1f2022&amp;quot;,
&amp;quot;background_color&amp;quot;: &amp;quot;#1f2022&amp;quot;
}
&lt;/code>&lt;/pre>
&lt;p>更新了的 &lt;code>manifest.json&lt;/code>&lt;/p>
&lt;pre>&lt;code class="language-json">{
&amp;quot;short_name&amp;quot;: &amp;quot;SCW Utils&amp;quot;,
&amp;quot;name&amp;quot;: &amp;quot;ShareChiWai Utils&amp;quot;,
&amp;quot;icons&amp;quot;: [
{
&amp;quot;src&amp;quot;: &amp;quot;192.png&amp;quot;,
&amp;quot;type&amp;quot;: &amp;quot;image/png&amp;quot;,
&amp;quot;sizes&amp;quot;: &amp;quot;192x192&amp;quot;
},
{
&amp;quot;src&amp;quot;: &amp;quot;512.png&amp;quot;,
&amp;quot;type&amp;quot;: &amp;quot;image/png&amp;quot;,
&amp;quot;sizes&amp;quot;: &amp;quot;512x512&amp;quot;
}
],
&amp;quot;start_url&amp;quot;: &amp;quot;.&amp;quot;,
&amp;quot;display&amp;quot;: &amp;quot;standalone&amp;quot;,
&amp;quot;orientation&amp;quot;: &amp;quot;portrait-primary&amp;quot;,
&amp;quot;theme_color&amp;quot;: &amp;quot;#1f2022&amp;quot;,
&amp;quot;background_color&amp;quot;: &amp;quot;#1f2022&amp;quot;
}
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Upgrade ReactJS - module build failed - Cannot find module 'js-levenshtein'</title><link>https://sharechiwai.com/blog/2020-05-03-upgrade-reactjs/</link><pubDate>Sun, 03 May 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-05-03-upgrade-reactjs/</guid><description>&lt;p>用了 ReactJS 一段時間&amp;hellip;想看看有沒有更新可以使用..&lt;br>
希望可以使用 &lt;code>yarn upgrade&lt;/code> 來更新&amp;hellip;&lt;br>
但是更新了 &lt;code>package.json&lt;/code> 的 dependencies 之後便出現了很多&lt;code>webpack&lt;/code> 的 error&lt;br>
最後到了&lt;code>create-react-app&lt;/code> page 的 &lt;code>CHANGELOG.md&lt;/code> &amp;hellip;跟著他的 migration guide 便可以更新到了&amp;hellip;
原來解決方法十分簡單&amp;hellip;
我們只需要跟著 mirgration guide 的 command 來更新 &lt;code>react-script&lt;/code> 便可以
e.g.&lt;/p>
&lt;pre>&lt;code class="language-bash">## 更新到version 3.4.1
yarn add --exact react-scripts@3.4.1
&lt;/code>&lt;/pre>
&lt;p>如果遇到以下的 error message&lt;br>
&lt;code>module build failed - Cannot find module 'js-levenshtein'&lt;/code>
![module build failed - Cannot find module &amp;lsquo;js-levenshtein](/img/2020/js-levenshtein.png &amp;lsquo;module build failed - Cannot find module &amp;lsquo;js-levenshtein&amp;rsquo;)&lt;br>
你可以嘗試執行以下 command 安裝 &lt;code>babel-preset-react-app&lt;/code> 很可能是因為之前沒有安裝的&lt;/p>
&lt;pre>&lt;code class="language-bash">yarn add babel-preset-react-app
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>redux - uncaught TypeError: Cannot read property 'apply' of undefined(…)</title><link>https://sharechiwai.com/blog/2020-05-02-redux-uncaught-typeerror-cannot-read-property-apply/</link><pubDate>Sat, 02 May 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-05-02-redux-uncaught-typeerror-cannot-read-property-apply/</guid><description>&lt;p>剛剛在寫 reactjs publish 上去 Firebase 之後出現了以一的 error message&lt;br>
``&lt;br>
之後便顯示唔到這個 react page 了&lt;/p>
&lt;p>做了一會 research 之後發現應該是 redux compose 既問題&lt;/p>
&lt;p>&lt;strong>解決方法:&lt;/strong>
我改了之前的&lt;/p>
&lt;pre>&lt;code class="language-javascript">const store = createStore(
reducers,
initialState,
compose(
applyMiddleware(...middleware),
window.__REDUX_DEVTOOLS_EXTENSION__ &amp;amp;&amp;amp; window.__REDUX_DEVTOOLS_EXTENSION__()
)
);
&lt;/code>&lt;/pre>
&lt;p>改成這樣便可以了&lt;/p>
&lt;pre>&lt;code class="language-javascript">const store = createStore(
reducers,
initialState,
compose(
applyMiddleware(...middleware),
window.REDUX_DEVTOOLS_EXTENSION
? window.REDUX_DEVTOOLS_EXTENSION()
: (f) =&amp;gt; f
)
);
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>FFmpeg - 十分好用可以轉換Audio / video既 program</title><link>https://sharechiwai.com/blog/2020-03-08-ffmpeg/</link><pubDate>Sun, 08 Mar 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-03-08-ffmpeg/</guid><description>&lt;p>最近因為種種原因..要轉換不同的&lt;strong>Audio / Video format&lt;/strong>&lt;br>
上網搜尋很久也找不到一些免費又好似做唔到我想要既效果.. 或是要收費&lt;/p>
&lt;p>最後發現如果不怕麻煩 花小小時間學習.&lt;br>
其實是可以使用
&lt;a href="https://www.ffmpeg.org/" target="_blank" rel="noopener">FFmpeg&lt;/a> 這個 program 來做到的..&lt;br>
之後發現有很多程式都是用&lt;code>ffmpeg&lt;/code> 來轉換檔案格式的&lt;/p>
&lt;p>在 Windows 上我會使用 &lt;code>Choco&lt;/code> 來 Install &lt;code>ffmpeg&lt;/code>
&lt;code>choco install ffmpeg&lt;/code>
我覺得有些如是 command line 使用的 程式 使用 &lt;code>Choco&lt;/code> 來安裝好似比較方便&lt;/p>
&lt;p>詳情可以參考以下網頁
&lt;a href="https://chocolatey.org/packages/ffmpeg">https://chocolatey.org/packages/ffmpeg&lt;/a>&lt;/p></description></item><item><title>FFmpeg convert resize video - 使用FFmpeg 來轉換視訊格式</title><link>https://sharechiwai.com/blog/2020-03-08-ffmpeg-convert-resize-video-format/</link><pubDate>Sun, 08 Mar 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-03-08-ffmpeg-convert-resize-video-format/</guid><description>&lt;p>使用 &lt;code>FFmpeg&lt;/code> 來轉換 Video 格式十分容易的&lt;br>
首先要知道&lt;code>FFmpeg&lt;/code> 可以轉換那些 format
大家可以執行以下的指令看看&lt;/p>
&lt;pre>&lt;code>ffmpeg -formats
&lt;/code>&lt;/pre>
&lt;p>或者參考以下網頁
&lt;a href="https://www.ffmpeg.org/ffmpeg-formats.html">https://www.ffmpeg.org/ffmpeg-formats.html&lt;/a>&lt;/p>
&lt;p>&lt;a href="https://www.ffmpeg.org/general.html#Supported-File-Formats_002c-Codecs-or-Features">https://www.ffmpeg.org/general.html#Supported-File-Formats_002c-Codecs-or-Features&lt;/a>&lt;/p>
&lt;p>轉換 Video format 十分簡單&lt;/p>
&lt;p>以下是一些有用的 command&lt;/p>
&lt;p>&lt;code>mp4 to mkv&lt;/code>&lt;/p>
&lt;pre>&lt;code>ffmpeg -i \
[input]mp4] \
-vcodec copy \
-acodec copy \
[output.mkv]
&lt;/code>&lt;/pre>
&lt;p>&lt;code>mkv to mp4&lt;/code>&lt;/p>
&lt;pre>&lt;code>ffmpeg -i \
[input.mkv] \
-c copy \
[output.mp4]
&lt;/code>&lt;/pre>
&lt;p>改變 Video 的解像度大小&lt;br>
我們可以使用以下 command&lt;/p>
&lt;pre>&lt;code>ffmpeg -i [Input].mp4 -vf scale=-[Scale height e.g. 1920]:[scale width e.g. 1080] -c:v libx264 -crf 18 -preset veryslow -c:a copy [output].mp4 -async 1 -vsync 1
&lt;/code>&lt;/pre>
&lt;p>例子. 以下是 將 4k Video 轉成 1080p&lt;/p>
&lt;pre>&lt;code>ffmpeg -i 20190907_122335.mp4 -vf scale=-1:1080 -c:v libx264 -crf 18 -preset veryslow -c:a copy 20190907_122335_1080.mp4 -async 1 -vsync 1
&lt;/code>&lt;/pre>
&lt;p>使用&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Git change capitalization of filename - Git 更改檔案名大小字</title><link>https://sharechiwai.com/blog/2020-03-06-git-change-case-of-filename/</link><pubDate>Fri, 06 Mar 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-03-06-git-change-case-of-filename/</guid><description>&lt;p>今日遇到一個&lt;code>git&lt;/code> 的問題&lt;br>
就是需要更之前 commit 了既一個 filename 的大細階..&lt;br>
e.g.&lt;/p>
&lt;pre>&lt;code>2020-03-01-Google-sheet-with-google-translate.md
&lt;/code>&lt;/pre>
&lt;p>到&lt;/p>
&lt;pre>&lt;code>2020-03-01-google-sheet-with-google-translate.md
&lt;/code>&lt;/pre>
&lt;p>即使在 VS code 上更新了檔案的大小字&amp;hellip;.&lt;br>
但是還是 detect 不到 changes&amp;hellip;&lt;/p>
&lt;p>最後終於找到解決方法
我們可以使用以下的 git command
&lt;code>git mv&lt;/code>&lt;/p>
&lt;pre>&lt;code>mv Move or rename a file, a directory, or a symlink
&lt;/code>&lt;/pre>
&lt;p>e.g.&lt;/p>
&lt;pre>&lt;code>git mv 2020-03-01-Google-sheet-with-google-translate.md 2020-03-01-google-sheet-with-google-translate.md
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Use Google Translate with Google Sheet - 在Google Sheet 上使用Google Translate</title><link>https://sharechiwai.com/blog/2020-03-01-google-sheet-with-google-translate/</link><pubDate>Sun, 01 Mar 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-03-01-google-sheet-with-google-translate/</guid><description>&lt;p>前兩日在Facebook 上看到一位朋友分享的 Google Document, Google Sheet 的小貼士&lt;br>
我覺得十分有用&amp;hellip; 想和大家分享&amp;hellip;&lt;/p>
&lt;p>原來..我們可以在&lt;strong>Google Sheet / Google試算表&lt;/strong> 的公式上使用 &lt;strong>Google Translate&lt;/strong>&lt;/p>
&lt;p>只需要在 Worksheet的 Formula 上輪入 &lt;code>=GOOGLETRANSLATE&lt;/code>
&lt;code>=GOOGLETRANSLATE([文字或 Cell的參考], &amp;quot;原文的語言既 2個位的 language Code (可以不填)&amp;quot;,&amp;quot;想翻譯的語言既 2個位的 language Code&amp;quot; )&lt;/code>
E.g.
&lt;code>=GOOGLETRANSLATE(&amp;quot;Hello&amp;quot;, &amp;quot;en&amp;quot;,&amp;quot;fr&amp;quot; )&lt;/code>&lt;/p>
&lt;p>&lt;img src="https://sharechiwai.com/img/2020/GoogleSheetTranslate.gif" alt="Use Google Translate with Google Sheet demo" title="Use Google Translate with Google Sheet demo">&lt;/p>
&lt;p>大家可以在以下的網頁找到 &lt;strong>Google Translate&lt;/strong> 可以支援皫 語言&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>git Create branch via Command</title><link>https://sharechiwai.com/blog/2020-02-20-git-create-branch-via-cmd/</link><pubDate>Thu, 20 Feb 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-02-20-git-create-branch-via-cmd/</guid><description>&lt;p>很多時候都是使用BitBucket / Github 去create 新branch&lt;br>
但是久不久BitBucket 的 選擇 Branch的選項..總是選擇不到 &lt;code>UAT&lt;/code> 的&lt;br>
最後選擇最原始既方法&amp;hellip;&lt;br>
就是使用 command line 了&lt;/p>
&lt;p>&lt;strong>解決方法:&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-bash"># 首先 checkout 了你想Create branch from 的 branch &amp;amp;&amp;amp; git pull
git checkout uat &amp;amp;&amp;amp; git pull
# 使用 git branch 來Create 新 branch
git branch [branch-name]
# checkout 新建立的branch
git checkout [branch-name]
# 用以下command push 去remote
git push --set-upstream origin [branch-name]
&lt;/code>&lt;/pre>
&lt;p>或者可以嘗試這樣..簡短一點&lt;/p>
&lt;pre>&lt;code class="language-bash"># git checkout -b [new branch name] [branch-from]
# e.g.
git checkout -b [branch-name] uat
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p>
&lt;pre>&lt;code>
&lt;/code>&lt;/pre></description></item><item><title>TSQL Variable Scope fun finding</title><link>https://sharechiwai.com/blog/2020-01-23-tsql-variable-scope-fun-finding/</link><pubDate>Thu, 23 Jan 2020 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2020-01-23-tsql-variable-scope-fun-finding/</guid><description>&lt;p>最近同事 發現了一個有趣既 TSQL behaviour&lt;br>
在一般既情況下 Variable 應該是有一個scope 的&lt;br>
如果個Variable 是 Declare 在 If statement 入面&lt;br>
那麼在IF Statement 出面用這個variable 應該會 Throw Error 的..&lt;br>
以下的TSQL 執行之後 你做會出現什麼結果呢?&lt;/p>
&lt;pre>&lt;code class="language-TSQL">IF 1 = 1
BEGIN
DECLARE @insideIf nvarchar(50) = 'inside'
END
SELECT insideIf
&lt;/code>&lt;/pre>
&lt;p>居然會output &lt;code>inside&lt;/code>&lt;/p>
&lt;p>是不是十分surprise 呢?&lt;/p></description></item><item><title>Git Your branch have diverged and have 1 and 1 different commits each, respectively</title><link>https://sharechiwai.com/blog/2019-12-11-git-rebase/</link><pubDate>Wed, 11 Dec 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-12-11-git-rebase/</guid><description>&lt;p>最近同同事一齊用同一個 branch 寫 code&lt;br>
誰不知..呢隻同事..十分喜歡 &lt;code>rebase&lt;/code>
或在 push 左既 branch 用 &lt;code>git commit --amend --no-edit&lt;/code>&lt;br>
想佢變成一個 &lt;code>commit&lt;/code>&lt;/p>
&lt;p>之後問題便出現了&amp;hellip; 當我嘗試 pull 他的 changes 到我的 local 時&lt;br>
即使我沒有加新的 commit 也出現了以下情況&lt;/p>
&lt;pre>&lt;code>Your branch and 'origin/ubuntu-install-wpscan' have diverged,
and have 1 and 1 different commits each, respectively.
(use &amp;quot;git pull&amp;quot; to merge the remote branch into yours)
&lt;/code>&lt;/pre>
&lt;p>&lt;img src="https://sharechiwai.com/img/2019/have-1-and-1-different-commits.png" alt="have 1 and 1 different commits each, respectively" title="have 1 and 1 different commits each, respectively">&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>&lt;br>
如果知道自己是沒有 commit 只是 remote branch 跟你的 local branch 有些 commit 亂了&lt;br>
而你又信 remote branch 既 changes 的話..&lt;br>
我們可以使用 git pull &amp;ndash;rebase 來解決&lt;/p>
&lt;pre>&lt;code> git pull --rebase
&lt;/code>&lt;/pre></description></item><item><title>Windows reset subsystem - Ubuntu</title><link>https://sharechiwai.com/blog/2019-11-27-window-reset-subsystem-ubuntu/</link><pubDate>Wed, 27 Nov 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-11-27-window-reset-subsystem-ubuntu/</guid><description>&lt;p>最近想嘗試 reset 由頭再安裝 &lt;code>Windows Subsystem&lt;/code> 上的 &lt;code>Ubuntu&lt;/code>&lt;br>
開頭以入只要 在 &lt;code>Windows Store&lt;/code> Uninstall 了便可&lt;br>
但是再次安裝後 之前想 remove 的 application 還是在 &lt;code>Ubuntu&lt;/code> 裡面&lt;/p>
&lt;p>做了一會 research 之後&lt;br>
終於找到解決方法&lt;br>
我們可以使用 &lt;code>WSL command&lt;/code> 來 &lt;code>unregister&lt;/code> 這個 &lt;code>linux&lt;/code>&lt;/p>
&lt;pre>&lt;code class="language-bash"># List subsystem 上有的 distributions
wsl --list
# Unregister linux distribution
wsl --unregister [distribution name]
# e.g
wsl --unregister Ubuntu-18.04
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Ubuntu install WPScan</title><link>https://sharechiwai.com/blog/2019-11-26-ubuntu-install-wpscan/</link><pubDate>Tue, 26 Nov 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-11-26-ubuntu-install-wpscan/</guid><description>&lt;p>之前介紹過用如何用 &lt;code>Docker&lt;/code> 來執行 &lt;code>WPScan&lt;/code>&lt;br>
來檢查 &lt;code>Wordpress&lt;/code> 有沒有安全問題&lt;br>
最近開始使用 Windows Subsystem&lt;br>
發現原來做 Windows Subsystem 上安裝使用 &lt;code>Ubuntu&lt;/code> 也十分方便&lt;br>
我們可以用 subsystem 上的 Ubuntu 來安裝 linux 可以安裝的 software&lt;br>
所以安裝 和執行 &lt;code>WPScan&lt;/code> 也十分方便&lt;/p>
&lt;p>我們可用以下的 command 來安裝 &lt;code>WPScan&lt;/code>&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo apt-get update
# install dependencies
sudo apt install curl libcurl4-openssl-dev zlib1g-dev pkg-config ruby ruby-bundler ruby-dev -y
sudo gem install wpscan
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>JS format JSON</title><link>https://sharechiwai.com/blog/2019-11-23-js-format-json/</link><pubDate>Sat, 23 Nov 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-11-23-js-format-json/</guid><description>&lt;p>如何用 &lt;code>Javascript&lt;/code> format &lt;code>JSON&lt;/code>&lt;br>
&lt;strong>解決方法:&lt;/strong>&lt;br>
我們可以使用&lt;code>JSON.stringify&lt;/code> 來 format&lt;br>
&lt;strong>e.g.&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-javascript">var c = {a : &amp;quot;test&amp;quot;, b:{ data: &amp;quot;asdada&amp;quot;}}
JSON.stringify(c, null, 4)
&amp;quot;{
&amp;quot;a&amp;quot;: &amp;quot;test&amp;quot;,
&amp;quot;b&amp;quot;: {
&amp;quot;data&amp;quot;: &amp;quot;asdada&amp;quot;
}
}&amp;quot;
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Useful Heroku command</title><link>https://sharechiwai.com/blog/2019-11-22-useful-heroku-command/</link><pubDate>Fri, 22 Nov 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-11-22-useful-heroku-command/</guid><description>&lt;p>最近又多用了 &lt;code>Heroku&lt;/code> 無左 &lt;code>Microsoft Azure&lt;/code> 既 subscription 又怕佢 charge 貴&lt;br>
用 free tier 時發現好似好多野都要收錢咁&lt;br>
剛剛 deploy 了一個 NodeJS project 時 Load 唔起..&lt;br>
又唔知可以點睇 log.&lt;br>
由於同一隻 App 都是放在 githu 月&lt;/p>
&lt;p>&lt;strong>Login&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-bash">heroku login
&lt;/code>&lt;/pre>
&lt;p>&lt;strong>List Application&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-bash">heroku apps
&lt;/code>&lt;/pre>
&lt;p>&lt;strong>Show log&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-bash">heroku logs --tail -a AppName
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>XSD restriction for either specific string or number (mixture type)</title><link>https://sharechiwai.com/blog/2019-10-23-xsd-restriction-either-specific-string-or-number/</link><pubDate>Wed, 23 Oct 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-10-23-xsd-restriction-either-specific-string-or-number/</guid><description>&lt;p>如果在&lt;strong>XSD restriction&lt;/strong> 上 容許 mix restriction (mix data type) 呢?&lt;br>
&lt;strong>解決方法:&lt;/strong>&lt;br>
我們可以建立一個&lt;code>simpleType&lt;/code>&lt;br>
之後在&lt;code>simpleType&lt;/code> 入面使用 &lt;code>union&lt;/code>&lt;br>
再把多個&lt;code>simpleType&lt;/code> union 在一起&lt;br>
&lt;strong>e.g.&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-xml">&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;
&amp;lt;xs:schema xmlns:xs=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&amp;gt;
&amp;lt;xs:simpleType name=&amp;quot;NumberOrSpecificString&amp;quot;&amp;gt;
&amp;lt;xs:union&amp;gt;
&amp;lt;xs:simpleType&amp;gt;
&amp;lt;xs:restriction base=&amp;quot;xs:integer&amp;quot;/&amp;gt;
&amp;lt;/xs:simpleType&amp;gt;
&amp;lt;xs:simpleType&amp;gt;
&amp;lt;xs:restriction base=&amp;quot;xs:string&amp;quot;&amp;gt;
&amp;lt;xs:enumeration value=&amp;quot;HongKong&amp;quot;/&amp;gt;
&amp;lt;xs:enumeration value=&amp;quot;London&amp;quot;/&amp;gt;
&amp;lt;xs:enumeration value=&amp;quot;Oxford&amp;quot;/&amp;gt;
&amp;lt;/xs:restriction&amp;gt;
&amp;lt;/xs:simpleType&amp;gt;
&amp;lt;/xs:union&amp;gt;
&amp;lt;/xs:simpleType&amp;gt;
&amp;lt;/xs:schema&amp;gt;
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Visual Studio Useful Shortcut</title><link>https://sharechiwai.com/blog/2019-10-20-visual-studio-useful-shortcut/</link><pubDate>Sun, 20 Oct 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-10-20-visual-studio-useful-shortcut/</guid><description>&lt;p>最近有一個 task 係要做一些 code clean up&amp;hellip;&lt;br>
發現有很多重覆既動作..&lt;br>
係時候用下腦記下 D Visual Studio Shortcut&amp;hellip;&lt;br>
因為用 mouse 真係有 D 慢..&lt;br>
用 shortcut key 有時真係方便好多&lt;/p>
&lt;p>&lt;strong>Remove and Sort Using&lt;/strong>&lt;br>
&lt;code>Ctrl + R Ctrl + G&lt;/code>&lt;/p>
&lt;p>&lt;strong>Comment the selected line&lt;/strong>&lt;br>
&lt;code>Ctrl K + Ctrl + C&lt;/code>&lt;/p>
&lt;p>&lt;strong>Uncomment the selected line&lt;/strong>&lt;br>
&lt;code>Ctrl K + Ctrl + U&lt;/code>&lt;/p>
&lt;p>&lt;strong>Build Solution&lt;/strong>&lt;br>
&lt;code>Ctrl + Shift + B&lt;/code>&lt;/p>
&lt;p>To be continue 不定時更新&amp;hellip;&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Choco check if package already installed / outated</title><link>https://sharechiwai.com/blog/2019-06-28-choco-check-if-package-already-installed-outdated/</link><pubDate>Fri, 28 Jun 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-06-28-choco-check-if-package-already-installed-outdated/</guid><description>&lt;p>今日想檢查一下 電腦上用 &lt;code>Chocolatey&lt;/code> 安裝的 NodeJs 有沒有 outdated&lt;br>
所以便想找個 Choco command 來看看&lt;/p>
&lt;p>找到了以下一個 command&lt;br>
用 Chocolatey command 來輸出一個 List&lt;br>
&lt;code>choco list -lo&lt;/code>&lt;br>
&lt;img src="https://sharechiwai.com/img/2019/choco-list-lo.png" alt="choco list -lo" title="choco list -lo">&lt;br>
之後用&lt;code>Powershell&lt;/code> 來找出在這個 List 有那一個 record 包含某一些字&lt;br>
&lt;code>| Where-object { $_.ToLower().Contains(&amp;quot;{text you interested}&amp;quot;.ToLower()) }&lt;/code>&lt;br>
&lt;img src="https://sharechiwai.com/img/2019/choco-outdated.png" alt="choco list node" title="choco list node">&lt;br>
&lt;strong>解決方法&lt;/strong>&lt;/p>
&lt;pre>&lt;code> choco list -lo | Where-object { $_.ToLower().Contains(&amp;quot;node&amp;quot;.ToLower()) }
&lt;/code>&lt;/pre>
&lt;p>&lt;img src="https://sharechiwai.com/img/2019/choco-list-search-node.png" alt="choco list search node" title="choco list search node">&lt;/p>
&lt;p>之後找到另一個更好的 command&lt;br>
就是直找出 &lt;code>outdated&lt;/code> 的 &lt;code>package&lt;/code>&lt;br>
&lt;strong>解決方法&lt;/strong>&lt;/p>
&lt;pre>&lt;code> choco outdated | Where-object { $_.ToLower().Contains(&amp;quot;node&amp;quot;.ToLower()) }
&lt;/code>&lt;/pre>
&lt;p>&lt;img src="https://sharechiwai.com/img/2019/choco-outdated.png" alt="choco outdated" title="choco outdated">&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Firebase ReactJs routing issue - Page not found</title><link>https://sharechiwai.com/blog/2019-08-01-reactjs-firebase-route-page-not-found/</link><pubDate>Tue, 25 Jun 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-08-01-reactjs-firebase-route-page-not-found/</guid><description>&lt;p>使用 firebase hosting 來 host reactjs 既時候 出現了以下問題&lt;br>
當我直接在 browser 輸入 ReactJs 的 route 既時候 出現了&lt;/p>
&lt;pre>&lt;code>Page Not Found
This file does not exist and there was no index.html found in the current directory or 404.html in the root directory
&lt;/code>&lt;/pre>
&lt;p>&lt;img src="https://sharechiwai.com/img/2019/fireabase-react-404.png" alt="Page not found" title="firebase page not found">&lt;/p>
&lt;p>&lt;em>解決方法:&lt;/em>
我們只需要在 &lt;code>firebase.json&lt;/code> 的 &lt;code>hosting&lt;/code> section
加上 &lt;code>rewrites&lt;/code> 到 index.html 便可以了&lt;/p>
&lt;pre>&lt;code>{
&amp;quot;hosting&amp;quot;: {
&amp;quot;public&amp;quot;: &amp;quot;build&amp;quot;,
&amp;quot;ignore&amp;quot;: [
&amp;quot;firebase.json&amp;quot;,
&amp;quot;**/.*&amp;quot;,
&amp;quot;**/node_modules/**&amp;quot;
],
&amp;quot;rewrites&amp;quot;: [
{
&amp;quot;source&amp;quot;: &amp;quot;**&amp;quot;,
&amp;quot;destination&amp;quot;: &amp;quot;/index.html&amp;quot;
}
]
}
}
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>How to get distinct values from an array of objects in JavaScript</title><link>https://sharechiwai.com/blog/2019-10-10-javascript-array-of-objects-distinct-property/</link><pubDate>Tue, 25 Jun 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-10-10-javascript-array-of-objects-distinct-property/</guid><description>&lt;p>今日有個 task 其中一個地方要在 Array of Json object 中&lt;br>
Distinct 一個 property&lt;/p>
&lt;pre>&lt;code class="language-javascript">const data = [
{
id: 1,
category: 'fruit',
name: 'Apple',
},
{
id: 2,
category: 'fruit',
name: 'Banana',
},
{
id: 3,
category: 'herb',
name: 'Basil',
},
{
id: 4,
category: 'herb',
name: 'Rosemary',
},
{
id: 5,
category: 'fruit',
name: 'Dragon Fruit',
},
];
&lt;/code>&lt;/pre>
&lt;p>&lt;strong>解決方法:&lt;/strong> (ES5)&lt;/p>
&lt;pre>&lt;code> var categories = data.map( // try to retrieve specific property
function(item) {
return item.category;
}) // Distinct
.filter(function(item, index, arr){
return arr.indexOf(item) === index;
}) // sort
.sort();
&lt;/code>&lt;/pre>
&lt;p>&lt;strong>解決方法:&lt;/strong> (ES6)&lt;/p>
&lt;pre>&lt;code> const categories = [...new Set(data.map(x =&amp;gt; x.category ))];
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>How to set Environment Variable on NodeJS</title><link>https://sharechiwai.com/blog/2019-06-25-env-variable/</link><pubDate>Tue, 25 Jun 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-06-25-env-variable/</guid><description>&lt;p>###如何設定 NodeJs Environment Variable&lt;/p>
&lt;p>&lt;strong>解決方法:&lt;/strong>&lt;br>
可以直接在 command line 設定&lt;/p>
&lt;pre>&lt;code>set ENV_VARIABLE=9000 &amp;amp;&amp;amp; npm start
&lt;/code>&lt;/pre>
&lt;p>可以在&lt;code>package.json&lt;/code> 上設定&lt;br>
e.g.&lt;/p>
&lt;pre>&lt;code> &amp;quot;scripts&amp;quot;: {
&amp;quot;start&amp;quot;: &amp;quot;set PORT=9000 &amp;amp;&amp;amp; yarn run swagger &amp;amp;&amp;amp; nodemon --exec babel-node src/index.js&amp;quot;,babel-node src/index.js&amp;quot;,
&amp;quot;test&amp;quot;: &amp;quot;yarn jest --coverage&amp;quot;,
&amp;quot;lint&amp;quot;: &amp;quot;eslint src&amp;quot;,
&amp;quot;swagger:edit&amp;quot;: &amp;quot;swagger project edit&amp;quot;,
&amp;quot;swagger&amp;quot;: &amp;quot;js-yaml ./api/swagger/swagger.yaml &amp;gt; ./src/swagger.json&amp;quot;
},
&lt;/code>&lt;/pre></description></item><item><title>Git undo local commit</title><link>https://sharechiwai.com/blog/2019-06-10-git-reset-local-commit/</link><pubDate>Mon, 10 Jun 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-06-10-git-reset-local-commit/</guid><description>&lt;p>久唔久就會大意地 Commit 錯野&lt;br>
發現以下這個 git command&lt;/p>
&lt;p>Git undo pushed commit and keep changes unstage&lt;br>
&lt;strong>解決方法&lt;/strong>&lt;/p>
&lt;pre>&lt;code> git reset HEAD^
&lt;/code>&lt;/pre></description></item><item><title> failed to extract shortcode: template for shortcode "alert" not found</title><link>https://sharechiwai.com/blog/2019-06-04-template-for-shortcode-not-found/</link><pubDate>Tue, 04 Jun 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-06-04-template-for-shortcode-not-found/</guid><description>&lt;p>Hugo Error&lt;/p>
&lt;p>&lt;code>failed to extract shortcode: template for shortcode &amp;quot;alert&amp;quot; not found&lt;/code>&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>&lt;/p>
&lt;pre>&lt;code> git submodule update --init --recursive
&lt;/code>&lt;/pre>
&lt;p>&lt;strong>Test&lt;/strong>&lt;/p>
&lt;pre>&lt;code>hugo server --watch
&lt;/code>&lt;/pre></description></item><item><title>ESLint couldnt find the plugin (when install dependencies using yarn)</title><link>https://sharechiwai.com/blog/2019-04-07-eslint-couldnt-find-the-plugin-when-install-dependencies-using-yarn/</link><pubDate>Sun, 07 Apr 2019 11:25:53 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-04-07-eslint-couldnt-find-the-plugin-when-install-dependencies-using-yarn/</guid><description>&lt;p>今日嘗試用 command line (CLI) 執行 &lt;strong>ESLint&lt;/strong> 時出現了以下的錯誤信息&lt;/p>
&lt;pre>&lt;code class="language-bash"># eslint command
eslint ./src
Error: Cannot find module 'eslint-config-airbnb'
&lt;/code>&lt;/pre>
&lt;figure class="wp-block-image">
&lt;p>&lt;img src="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/04/image.png?fit=625%2C163&amp;ssl=1" alt="" class="wp-image-4157" srcset="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/04/image.png?w=1418 1418w, https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/04/image.png?resize=300%2C78 300w, https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/04/image.png?resize=768%2C200 768w, https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/04/image.png?resize=1024%2C267 1024w, https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/04/image.png?resize=624%2C163 624w, https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/04/image.png?w=1250 1250w" sizes="(max-width: 625px) 100vw, 625px" /> &lt;/figure>&lt;/p>
&lt;p>仔細看他其實是在找&lt;strong>npm install&lt;/strong> 的 module 的 folder&lt;br>
&lt;code>c:\user\chi\AppData\Roaming\npm\node_modules&lt;/code>
但我是用 yarn install 的所以 是使用錯了 folder&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>十分簡單&lt;br>
我們只要使用 &lt;code>yarn&lt;/code> 執行便可&lt;/p>
&lt;pre>&lt;code class="language-bash">yarn eslint ./src
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Clear node-modules</title><link>https://sharechiwai.com/blog/2019-04-06-clear-node-modules/</link><pubDate>Sat, 06 Apr 2019 00:00:20 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-04-06-clear-node-modules/</guid><description>&lt;p>我們可以使用以下指令到 clear Yarn / NPM 的 cache&lt;/p>
&lt;pre>&lt;code class="language-bash"> # yarn
yarn cache clean
# npm
npm cache clean
# remove node_modules folder
rm -rf node_modules
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Git Error Unlink of File failed. Should I try again?</title><link>https://sharechiwai.com/blog/2019-04-05-git-error-unlink-of-file-failed-should-i-try-again/</link><pubDate>Fri, 05 Apr 2019 08:48:23 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-04-05-git-error-unlink-of-file-failed-should-i-try-again/</guid><description>&lt;p>久不久我使用的 &lt;code>Git&lt;/code> 便會出現以下問題
&lt;strong>Unlink of file. ' file path and name&amp;rsquo; failed. Should I try again? (y/n)&lt;/strong>&lt;/p>
&lt;figure class="wp-block-image">
&lt;p>&lt;img src="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image-2.png?w=625&amp;#038;ssl=1" alt="" class="wp-image-4150" srcset="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image-2.png?w=871 871w, https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image-2.png?resize=300%2C57 300w, https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image-2.png?resize=768%2C145 768w, https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image-2.png?resize=624%2C118 624w" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" /> &lt;/figure>&lt;/p>
&lt;p>很多時候按了 &amp;ldquo;Y&amp;rdquo; 也是說 file locked &amp;hellip; Should I try again?&lt;/p>
&lt;p>&lt;strong>解釋方法&lt;/strong>:
我們只需要執行 git gc command 便可&lt;/p>
&lt;pre>&lt;code class="language-bash">git gc
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Update WordPress Inside Docker Container Required FTP Access</title><link>https://sharechiwai.com/blog/2019-03-15-update-wordpress-inside-docker-container-required-ftp-access/</link><pubDate>Fri, 15 Mar 2019 00:00:32 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-03-15-update-wordpress-inside-docker-container-required-ftp-access/</guid><description>&lt;p>今日 Update WordPress 既時候出現了&lt;br>
輸入 FTP 資料的畫面&lt;/p>
&lt;blockquote>
&lt;p>To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.&lt;/p>
&lt;/blockquote>
&lt;figure class="wp-block-image">
&lt;p>&lt;img src="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image-1.png?fit=625%2C289&amp;ssl=1" alt="" class="wp-image-4145" srcset="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image-1.png?w=1794 1794w, https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image-1.png?resize=300%2C139 300w, https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image-1.png?resize=768%2C355 768w, https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image-1.png?resize=1024%2C474 1024w, https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image-1.png?resize=624%2C289 624w, https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image-1.png?w=1250 1250w" sizes="(max-width: 625px) 100vw, 625px" /> &lt;/figure>&lt;/p>
&lt;p>原因是因為有些 &lt;code>wordpress&lt;/code> 的資料夾沒有 權限去 access&lt;br>
&lt;strong>解決方法&lt;/strong>&lt;br>
我們只需要把這個資料夾的 ownership 設定和這個 container 一樣便可&lt;/p>
&lt;p>e.g.&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo chown -R www-data:www-data wordpress
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>VSCode config trim trailing space when saving file</title><link>https://sharechiwai.com/blog/2019-03-13-vscode-config-trim-trailing-space-when-saving-file/</link><pubDate>Wed, 13 Mar 2019 00:00:23 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-03-13-vscode-config-trim-trailing-space-when-saving-file/</guid><description>&lt;p>如果有用開&lt;code>source control&lt;/code>, 做 code view 或 compare files 時 whitespace / Tab 會造成一些不必要既麻煩&lt;br>
很多&lt;code>IDE&lt;/code> 都有一些設定或 plugin 可以在你儲存檔案時除去尾隨空格&lt;br>
在&lt;strong>Visual Studio Code&lt;/strong> 有一些很好用的 &lt;code>settings&lt;/code>&lt;br>
大家可在 Settings 上搜尋 &amp;ldquo;&lt;strong>files.trimTrailingWhitespace&lt;/strong>&amp;rdquo;&lt;br>
之後便可以啟用這個設定&lt;figure class="wp-block-image">&lt;/p>
&lt;p>&lt;img src="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image.png?fit=625%2C161&amp;ssl=1" alt="" class="wp-image-4141" srcset="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image.png?w=1628 1628w, https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image.png?resize=300%2C77 300w, https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image.png?resize=768%2C198 768w, https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image.png?resize=1024%2C264 1024w, https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image.png?resize=624%2C161 624w, https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/03/image.png?w=1250 1250w" sizes="(max-width: 625px) 100vw, 625px" /> &lt;/figure>&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Linux updated folder and subfolder's ownership</title><link>https://sharechiwai.com/blog/2019-03-11-linux-updated-folder-and-subfolders-ownership/</link><pubDate>Mon, 11 Mar 2019 00:00:18 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-03-11-linux-updated-folder-and-subfolders-ownership/</guid><description>&lt;p>今日發現自從把 &lt;code>wordpress&lt;/code> 轉了用 docker host 之後便不能 upload file&lt;br>
原因是我把之 wordpress site 的檔案從 FTP upload 到新 server 的 uploads folder&lt;br>
的 ownership 是我 FTP 的 user 名 而不是 run wordpress 的 &lt;code>www-data&lt;/code>&lt;/p>
&lt;p>只要把這個 &lt;code>folder&lt;/code> 的 &lt;code>ownership&lt;/code> 轉為 &lt;code>www-data&lt;/code> 便可&lt;br>
我們可以使用 &lt;code>sudo chown user:usergroup folder/\*&lt;/code>&lt;/p>
&lt;p>&lt;strong>解決放法&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo chown www-data:www-data uploads/*
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>C# Distinct List of Object</title><link>https://sharechiwai.com/blog/2019-02-16-c-distinct-list-of-object/</link><pubDate>Sat, 16 Feb 2019 12:14:51 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-02-16-c-distinct-list-of-object/</guid><description>&lt;p>今日在&lt;code>Code Review&lt;/code> 同事的 Code 時候發現了一個有趣的寫法&lt;br>
他想做的是 Return 一個&lt;code>Distinct&lt;/code> 左既 &lt;code>List Of Object&lt;/code>&lt;/p>
&lt;p>好直接既想法是使用 Distinct&lt;/p>
&lt;pre>&lt;code class="language-C#">List.Distinct();
&lt;/code>&lt;/pre>
&lt;p>之後發現 Distinct 是不能 Distinct Object 的&lt;br>
同事的寫法是用了 List 加 &lt;code>GroupBy&lt;/code> 和&lt;code>Select First()&lt;/code>&lt;/p>
&lt;pre>&lt;code class="language-c#">List.GrounBy(x =&amp;gt;; x.key).Select(x =&amp;gt; x.First());
&lt;/code>&lt;/pre>
&lt;p>之後發現.. 原來我們可以使用 &lt;code>GroupBy&lt;/code> 加 &lt;code>First&lt;/code> 來做到 Distinct Object 的效果&lt;br>
以下是我的 Code Sample&lt;/p>
&lt;pre>&lt;code class="language-c#">void Main()
{
var list = new List&amp;lt;Example&amp;gt;();
list.Add(new Example() {Id=1, Name=&amp;quot;Example 1&amp;quot;, Comment=&amp;quot;Comment 1&amp;quot; });
list.Add(new Example() {Id=1, Name=&amp;quot;Example 1&amp;quot;, Comment=&amp;quot;Comment 1&amp;quot; });
list.Add(new Example() {Id=1, Name=&amp;quot;ExamplE 1&amp;quot;, Comment=&amp;quot;Comment 2&amp;quot; });
list.Add(new Example() {Id=2, Name=&amp;quot;Example 2&amp;quot;, Comment=&amp;quot;Comment 3&amp;quot; });
list.Add(new Example() { Id = 2, Name = &amp;quot;example 2&amp;quot;, Comment = &amp;quot;Comment 3&amp;quot; });
list.Add(new Example() { Id = 3, Name = &amp;quot;Example 3&amp;quot;, Comment = &amp;quot;Comment 3&amp;quot; });
list.Add(new Example() { Id = 4, Name = &amp;quot;Example 4&amp;quot;, Comment = &amp;quot;Comment 3&amp;quot; });
list.Add(new Example() { Id = 5, Name = &amp;quot;Example 5&amp;quot;, Comment = &amp;quot;Comment 3&amp;quot; });
Console.WriteLine(&amp;quot;Use List.Distinct()&amp;quot;);
list.Distinct().Dump();
Console.WriteLine(&amp;quot;Use Group By Fields&amp;quot;);
list.GroupBy(x =&amp;gt; new {x.Id, Name=x.Name}).Select(x =&amp;gt;x.First()).Dump();
Console.WriteLine(&amp;quot;Use Group By and make it ignore case&amp;quot;);
list.GroupBy(x =&amp;gt; new {x.Id, Name=x.Name.ToLower()}).Select(x =&amp;gt;x.First()).Dump();
}
public class Example
{
public int Id { get; set; }
public string Name { get; set; }
public string Comment {get;set;}
}
&lt;/code>&lt;/pre>
&lt;p>Output:&lt;/p>
&lt;figure class="wp-block-image">
&lt;p>&lt;img src="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/02/image-1.png?w=625&amp;#038;ssl=1" alt="" class="wp-image-4118" srcset="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/02/image-1.png?w=472 472w, https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/02/image-1.png?resize=176%2C300 176w" sizes="(max-width: 472px) 100vw, 472px" data-recalc-dims="1" /> &lt;figcaption>Hope you find it useful&lt;/figcaption>&lt;/figure>&lt;/p></description></item><item><title>EF Core with MySQL Specified key was too long; max key length is 3072 bytes</title><link>https://sharechiwai.com/blog/2019-02-10-ef-core-with-mysql-specified-key-was-too-long-max-key-length-is-3072-bytes/</link><pubDate>Sun, 10 Feb 2019 09:26:52 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-02-10-ef-core-with-mysql-specified-key-was-too-long-max-key-length-is-3072-bytes/</guid><description>&lt;!--StartFragment-->
&lt;p>今日嘗試使用 &lt;strong>EF Core with MySQL&lt;/strong> 時出現了以下的錯誤信息:&lt;/p>
&lt;pre class="wp-block-preformatted">&lt;strong>MySql.Data.MySqlClient.MySqlException&lt;br /> HResult=0x80004005&lt;br /> Message=Specified key was too long; max key length is 3072 bytes&lt;br /> Source=MySql.Data&lt;br /> StackTrace:&lt;br /> at MySql.Data.MySqlClient.MySqlStream.ReadPacket()&lt;br /> at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32&amp; affectedRow, Int64&amp; insertedId)&lt;br /> at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)&lt;br /> at MySql.Data.MySqlClient.MySqlDataReader.NextResult()&lt;br /> at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)&lt;br /> at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()&lt;br /> at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary&lt;/strong>&lt;code>&amp;lt;strong>2 parameterValues) at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary&amp;lt;/strong>&lt;/code>&lt;strong>2 parameterValues)&lt;br /> at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary&lt;/strong>&lt;code>&amp;lt;strong>2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable&amp;lt;/strong>&lt;/code>&lt;strong>1 migrationCommands, IRelationalConnection connection)&lt;br /> at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.CreateTables()&lt;br /> at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.EnsureCreated()&lt;br /> at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureCreated()&lt;br /> at epm.Api.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ApplicationDbContext dbContext) in C:\Users\yauch\Documents\git\docker-easy-property\api\src\server\epm.Api\Startup.cs:line 65&lt;/strong>&lt;/pre>
&lt;p>我是使了了 Official 的 &lt;strong>NuGet Package&lt;/strong> &amp;ldquo;
&lt;a href="https://www.nuget.org/packages/MySql.Data.EntityFrameworkCore/" target="_blank" rel="noopener">&lt;code>MySql.Data.EntityFrameworkCore&lt;/code>&lt;/a>  &amp;quot;
做了一會 research 之後發現&amp;hellip;&lt;br>
是這一個 package 的問題&lt;br>
解決方法十分簡單..
我們只需要用另一個 nuget package 便可&amp;rdquo;&lt;strong>Pomelo.EntityFrameworkCore.MySql&lt;/strong>&amp;rdquo;&lt;br>
&lt;a href="https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql">https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql&lt;/a>&lt;/p>
&lt;p>Hope you find it useful&lt;/p>
&lt;!--EndFragment--></description></item><item><title>Git Check which branch contain specific commit</title><link>https://sharechiwai.com/blog/2019-02-10-git-check-which-branch-contain-specific-commit/</link><pubDate>Sun, 10 Feb 2019 00:00:44 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-02-10-git-check-which-branch-contain-specific-commit/</guid><description>&lt;p>今日公司個 Production project 有一個 Bug 但係在 Staging 和 UAT environment 都 replicate 唔到呢個問題..&lt;br>
之後便用&lt;strong>Git Blame&lt;/strong> 去檢查一下有什麼 code change&lt;br>
再看看是那一個 commit 做了 code change&lt;br>
找到 commit 之後&lt;br>
便要嘗試去看看這個&lt;strong>commit merge&lt;/strong> 了去那些 branch&lt;br>
解決方法&lt;/p>
&lt;p>我們可以使用以下 &lt;strong>git command&lt;/strong>&lt;/p>
&lt;pre class="wp-block-syntaxhighlighter-code">git branch --contains $COMMIT_ID
e.g.
git branch --contains 7df12c5&lt;/pre>&lt;figure class="wp-block-image">
&lt;p>&lt;img src="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/02/image.png?w=625&amp;#038;ssl=1" alt="" class="wp-image-4115" srcset="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/02/image.png?w=686 686w, https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/02/image.png?resize=300%2C115 300w, https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/02/image.png?resize=624%2C240 624w" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" /> &lt;/figure>&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Visual Studio CodeLens show no Reference</title><link>https://sharechiwai.com/blog/2019-01-07-visual-studio-codelens-show-no-reference/</link><pubDate>Mon, 07 Jan 2019 10:34:06 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-01-07-visual-studio-codelens-show-no-reference/</guid><description>&lt;p>最近我的&lt;strong>Visual Studio&lt;/strong> 的 &lt;strong>CodeLens&lt;/strong> 沒有再顯示 &lt;strong>Class&lt;/strong>/ &lt;strong>Method&lt;/strong> 有多 reference ..
只係顯示了 &amp;ldquo;&lt;strong>-&lt;/strong>&amp;rdquo;&amp;hellip; 十分不方便 &lt;figure class="wp-block-image">&lt;/p>
&lt;p>&lt;img src="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/01/image-6.png?w=625&amp;#038;ssl=1" alt="" class="wp-image-4097" data-recalc-dims="1" /> &lt;/figure>&lt;/p>
&lt;p>做了一會 research 之後發現解決方法十分簡單
我們只要洗除電腦的 &lt;strong>Temporary files&lt;/strong>&lt;/p>
&lt;figure class="wp-block-image">
&lt;p>&lt;img src="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/01/image-5.png?w=625&amp;#038;ssl=1" alt="" class="wp-image-4096" srcset="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/01/image-5.png?w=375 375w, https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/01/image-5.png?resize=248%2C300 248w" sizes="(max-width: 375px) 100vw, 375px" data-recalc-dims="1" /> &lt;/figure>&lt;/p>
&lt;p>之後重新開啟 Visual Studio&lt;br>
便可以了&lt;/p>
&lt;figure class="wp-block-image">
&lt;p>&lt;img src="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/01/image-7.png?w=625&amp;#038;ssl=1" alt="" class="wp-image-4098" data-recalc-dims="1" /> &lt;/figure>&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Git Include Ignored files</title><link>https://sharechiwai.com/blog/2019-01-05-git-include-ignored-files/</link><pubDate>Sat, 05 Jan 2019 00:00:44 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-01-05-git-include-ignored-files/</guid><description>&lt;p>今日嘗試在 git 上加入之前 用 &lt;strong>.gitignore&lt;/strong> Ignore 左既 個 project folder 入面的 &lt;strong>.vscode&lt;/strong>資料夾&lt;br>
剛剛更新了 project 入面的 &lt;strong>workspace setting&lt;/strong>&lt;br>
而在&lt;strong>VS Code&lt;/strong> 的 &lt;strong>workspace setting&lt;/strong> 是儲存在 &lt;strong>.vscode/settings.json&lt;/strong> 上&lt;br>
要把這個檔案加回 source control 我們首先要在 &lt;strong>.gitignore&lt;/strong> 檔案上 移除這個資料夾&lt;/p>
&lt;p>之後使用以下 指令 再強制把這個檔案加回&lt;strong>source control&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-bash">git add -f .vscode/settings.json
&lt;/code>&lt;/pre>
&lt;figure class="wp-block-image">
&lt;p>&lt;img src="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/01/image-4.png?fit=625%2C57&amp;ssl=1" alt="" class="wp-image-4090" srcset="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/01/image-4.png?w=1139 1139w, https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/01/image-4.png?resize=300%2C28 300w, https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/01/image-4.png?resize=768%2C71 768w, https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/01/image-4.png?resize=1024%2C94 1024w, https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2019/01/image-4.png?resize=624%2C58 624w" sizes="(max-width: 625px) 100vw, 625px" /> &lt;/figure>&lt;/p>
&lt;p>完成後便可以 &lt;strong>commit&lt;/strong> 這個檔案了&lt;br>
Hope you find it useful&lt;/p></description></item><item><title>Note: Nginx Docker sample</title><link>https://sharechiwai.com/blog/2019-01-03-note/</link><pubDate>Thu, 03 Jan 2019 00:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-01-03-note/</guid><description>&lt;p>今日需要 Share 一個比較大既 File 給國內的朋友&lt;br>
之前國內是可以連接 Microsoft One Drive 的&lt;br>
最近唔知點解又有 connection 問題&lt;br>
嘗試使用 WeChat share 檔案 可以過了 File Size 上限&lt;br>
最後想到用使用自己的 VPS 用 Docker 起一個簡單的 web server&lt;br>
用來 serve 這個檔案&lt;/p>
&lt;p>&lt;strong>解釋方法:&lt;/strong>&lt;/p>
&lt;p>安裝 docker 後 執行以下 Docker command&lt;br>
之後便會起了一個 Web server 是 port: 8083 的&lt;br>
在以下的 path: /home/username/web/storage&lt;/p>
&lt;pre>&lt;code class="language-bash">docker run --name storage -v /home/username/web/storage:/usr/share/nginx/html:ro -p 8083:80 -d nginx
&lt;/code>&lt;/pre>
&lt;p>E.g.&lt;/p>
&lt;pre>&lt;code class="language-bash">docker run --name [Container Name]-v [Web folder path]:/usr/share/nginx/html:ro -p [Custom Port]:80 -d nginx
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Code-Playground</title><link>https://sharechiwai.com/blog/2019-01-02-code-playground/</link><pubDate>Wed, 02 Jan 2019 00:00:50 +0800</pubDate><guid>https://sharechiwai.com/blog/2019-01-02-code-playground/</guid><description>&lt;p>發覺返到香港越來越難集中去做自己既 project&lt;br>
連 blog 都少寫了&lt;br>
今日終於逼自己係 GitHub 度開個 repository&lt;br>
去寫下 code 希望每星期都會 commit 到 D code 同有 blog post share&lt;br>
個 project 叫做 Code-Playground&lt;br>
主要是用來 share 自己想寫既 project&lt;br>
但係因為自己個根基比較弱..&lt;br>
上網跟住 D Tutorial blog post 有時可能 version / setup 問題&lt;br>
或是我想做的 feature 比較複雜&lt;br>
所以都係做唔到 Expected result&lt;/p>
&lt;p>希望藉著呢個 repository 可以和大家分享這些 code 和解決方法&lt;br>
和學習一下怎樣 organise projects&lt;br>
&lt;strong>Source code:&lt;/strong>&lt;br>
&lt;a href="https://github.com/sharechiwai/code-playground">https://github.com/sharechiwai/code-playground&lt;/a>&lt;/p>
&lt;p>Demo site 會 deploy 到一些 free 的 hosting 上&lt;br>
e.g.&lt;br>
&lt;strong>Azure App Service&lt;/strong>&lt;br>
&lt;a href="https://code-playground.azurewebsites.net">https://code-playground.azurewebsites.net&lt;/a>&lt;br>
Happy Coding&lt;/p></description></item><item><title>WPScan Docker Sample - WPScan Docker 示範</title><link>https://sharechiwai.com/blog/2018-10-01-wpscan-docker-sample-wpscan-docker/</link><pubDate>Mon, 01 Oct 2018 09:06:35 +0800</pubDate><guid>https://sharechiwai.com/blog/2018-10-01-wpscan-docker-sample-wpscan-docker/</guid><description>&lt;p>如果不想在電腦上安裝 &lt;strong>WPScan&lt;/strong> 的話可以考慮使用 Docker
使用方法十分簡單
首先要 &lt;strong>pull wpscan&lt;/strong> 既 &lt;strong>docker image&lt;/strong>
&lt;a href="https://hub.docker.com/r/wpscanteam/wpscan/">https://hub.docker.com/r/wpscanteam/wpscan/&lt;/a>&lt;/p>
&lt;pre>&lt;code class="language-bash">docker pull wpscanteam/wpscan
&lt;/code>&lt;/pre>
&lt;p>之後便可以使用這個&lt;strong>Docker image&lt;/strong> 來執行 &lt;strong>wpscan&lt;/strong> 的指令
e.g.&lt;/p>
&lt;pre>&lt;code class="language-bash">docker run --rm wpscanteam/wpscan --url https://blog.sharechiwai.com
&lt;/code>&lt;/pre>
&lt;p>如果想直接進入這個 &lt;code>wpscan&lt;/code> 的 docker image 上執行 wpscan 可以使用以下指令&lt;/p>
&lt;pre>&lt;code class="language-bash">docker run -it --entrypoint /bin/sh wpscanteam/wpscan
&lt;/code>&lt;/pre>
&lt;p>想了解更多的&lt;strong>wpscan&lt;/strong> 的用法可以參考他們的網站
&lt;a href="https://github.com/wpscanteam/wpscan">https://github.com/wpscanteam/wpscan&lt;/a>&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Screen Recording via PowerPoint (Free Feature) - 使用 PowerPoint進行 屏幕錄製</title><link>https://sharechiwai.com/blog/2018-04-22-screen-recording-via-powerpoint-free-feature-powerpoint/</link><pubDate>Sun, 22 Apr 2018 16:54:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2018-04-22-screen-recording-via-powerpoint-free-feature-powerpoint/</guid><description>&lt;p>很多朋友問..如何在 Windows 上進行屏幕錄製, 之前以為一定要用其他軟件..
例如: &lt;code>Camtasia&lt;/code>..
誰不知..原來可以使用 &lt;code>PowerPoint&lt;/code>  錄製 的
詳情可以參考這個 教學&lt;/p>
&lt;p>
&lt;a href="https://www.youtube.com/watch?v=AKGHOsH6Oxk&amp;amp;list=PLNUV7GTvGVeIHeolYRx66ZEUpZ7sYnyB9&amp;amp;index=11&amp;amp;t=3s" target="_blank" rel="noopener">Screen Recording via PowerPoint (Free Feature) - 使用 PowerPoint 進行 屏幕錄製&lt;/a>&lt;/p>
&lt;p>hope you find it useful&lt;/p></description></item><item><title>Free Software for Student - 免費軟體 (學生篇)</title><link>https://sharechiwai.com/blog/2018-02-06-free-software-for-student/</link><pubDate>Tue, 06 Feb 2018 21:36:47 +0800</pubDate><guid>https://sharechiwai.com/blog/2018-02-06-free-software-for-student/</guid><description>&lt;p>今日公司的同事和大家分享了一系列十分實用/好用既軟體&lt;br>
如果你是學生 或是還有學生 &lt;strong>Email account&lt;/strong> 或學生証 的話都可以&lt;strong>免費&lt;/strong>申請的&lt;/p>
&lt;p>有興趣既朋友可以參考以下網頁:&lt;br>
&lt;a href="https://www.gitkraken.com/github-student-developer-pack">https://www.gitkraken.com/github-student-developer-pack&lt;/a>&lt;/p>
&lt;p>&lt;a href="https://www.jetbrains.com/student/">https://www.jetbrains.com/student/&lt;/a>&lt;/p>
&lt;p>&lt;a href="https://education.github.com/pack">https://education.github.com/pack&lt;/a>&lt;/p>
&lt;p>&lt;a href="https://bitbucket.org/product/education">https://bitbucket.org/product/education&lt;/a>&lt;/p>
&lt;p>很可惜..我已經失去了我大學時的 Email account 不能享用這些福利了&lt;/p></description></item><item><title>Useful SQL command to reduce the size of the database</title><link>https://sharechiwai.com/blog/2018-02-06-useful-sql-command-to-reduce-the-size-of-the-database/</link><pubDate>Tue, 06 Feb 2018 09:30:04 +0800</pubDate><guid>https://sharechiwai.com/blog/2018-02-06-useful-sql-command-to-reduce-the-size-of-the-database/</guid><description>&lt;p>今日想和大家分享一個 幾有用的&lt;strong>TSQL Command&lt;/strong>, 去 Release 返一些&lt;strong>SQL Server&lt;/strong> 佔用的空間&lt;br>
&lt;strong>Transaction log&lt;/strong> 和&lt;strong>Database file&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-bash">-- select database
USE Production;
-- Change the recovery mode to SIMPLE, to clear the transaction log
ALTER DATABASE Production SET RECOVERY SIMPLE ;
-- shrink database to release space
DBCC SHRINKDATABASE (Production, 1);
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Different Git User credential Con on same machine - 在同一個電腦上使用不同的Git 使用者</title><link>https://sharechiwai.com/blog/2017-12-15-different-git-user-credential-con-on-same-machine/</link><pubDate>Fri, 15 Dec 2017 00:00:17 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-12-15-different-git-user-credential-con-on-same-machine/</guid><description>&lt;p>&lt;strong>解決方去&lt;/strong>
我們可以在 local 的 Git Repos 上設定這個 Repos 的&lt;strong>Git Credential&lt;/strong>
我們只需要在 &lt;strong>Git Bash&lt;/strong>上輸入以下指令便可以了&lt;/p>
&lt;pre>&lt;code class="language-bash">git config user.name &amp;quot;YOUR_USERNAME&amp;quot;
git config user.email &amp;quot;YOUR_EMAIL&amp;quot;
&lt;/code>&lt;/pre>
&lt;p>如果大家不想每次都要輸入&lt;strong>password&lt;/strong> 的話可以輸入以下&lt;strong>Git command&lt;/strong> 去 cache 你的 &lt;strong>git password&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-bash">git config credential.helper cache
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Git refusing to merge unrelated histories</title><link>https://sharechiwai.com/blog/2017-12-12-git-refusing-to-merge-unrelated-histories/</link><pubDate>Tue, 12 Dec 2017 10:11:24 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-12-12-git-refusing-to-merge-unrelated-histories/</guid><description>&lt;p>今日剛在&lt;strong>Bitbucket&lt;/strong> 建立左一個新既 repos&lt;br>
當我嘗試 push local 的一個 &lt;strong>git repos&lt;/strong>上去既時候出現了以下的錯誤信息
(當我嘗試 Pull 這個 repos 去 local 的 repos 時)
&amp;ldquo;&lt;span style="color: #ff0000;">&lt;strong>fatal: refusing to merge unrelated histories&lt;/strong>&lt;/span>&amp;rdquo;
&lt;a href="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/12/refusingToMergeUnrelatedHistories.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-4040" src="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/12/refusingToMergeUnrelatedHistories.png?resize=625%2C294" alt="git Refusing To Merge Unrelated Histories" width="625" height="294" srcset="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/12/refusingToMergeUnrelatedHistories.png?resize=1024%2C481 1024w" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>&lt;/p>
&lt;p>如果了解自己的 repos 和在 &lt;strong>git&lt;/strong>/&lt;strong>bitbucket&lt;/strong>上的沒有衝突的話
&lt;strong>解決方法分簡單&lt;/strong>
我們只需要輸入以卜&lt;strong>git&lt;/strong> 指令便可以&lt;/p>
&lt;pre>&lt;code class="language-bash">git pull --allow-unrelated-histories
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>VS Code disable minimap - 如何在Visual Studio Code 上 Disable Minimap 這個 extension</title><link>https://sharechiwai.com/blog/2017-09-17-vscode-disable-minimap-extension/</link><pubDate>Sun, 17 Sep 2017 15:39:12 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-09-17-vscode-disable-minimap-extension/</guid><description>&lt;p>&lt;strong>解決方法十分簡單:&lt;/strong>
我們可以去 &amp;ldquo;&lt;strong>File&lt;/strong>&amp;rdquo; -&amp;gt; &amp;ldquo;&lt;strong>Preferences&lt;/strong>&amp;rdquo; -&amp;gt; &amp;ldquo;Settings&amp;rdquo;
的 &amp;ldquo;&lt;strong>User Settings&lt;/strong>&amp;rdquo; 上把 &amp;ldquo;&lt;span style="color: #008000;">&lt;strong>editor.minimap.&lt;/strong>enabled&lt;/span>&amp;rdquo; 設定為 &lt;span style="color: #ff0000;">&lt;strong>false&lt;/strong>&lt;/span> 便可以了&lt;/p>
&lt;pre>&lt;code>editor.minimap.enabled&amp;quot;: false,
&lt;/code>&lt;/pre>
&lt;p>
&lt;a href="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/09/disable-minimap.gif" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-4031" src="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/09/disable-minimap.gif?resize=625%2C515" alt="Disable minimap" width="625" height="515" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>
Hope you find it useful&lt;/p></description></item><item><title>Csharp - Remove last comma - C# 如何移除最後一個符號 (分號)?</title><link>https://sharechiwai.com/blog/2017-07-10-csharp-remove-last-comma/</link><pubDate>Mon, 10 Jul 2017 07:02:23 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-07-10-csharp-remove-last-comma/</guid><description>&lt;p>&lt;strong>解決方法&lt;/strong>十分簡單
我們可以使用
&lt;a href="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/07/removeComma.png" target="_blank" rel="noopener">&lt;img class="alignnone size-full wp-image-4021" src="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/07/removeComma.png?resize=625%2C314" alt="C# remove last comma (string.TrimEnd)" width="625" height="314" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>  這個功能來解決這個問題&lt;/p>
&lt;p>E.G.&lt;/p>
&lt;pre>&lt;code class="language-csharp">string y = &amp;quot;1,2,3,4,5,6,&amp;quot;;
Console.WriteLine(y.TrimEnd(','));
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>How to use &amp;&amp; (bash) in powershell to run multiple command</title><link>https://sharechiwai.com/blog/2017-07-02-how-to-use-bash-in-powershell-to-run-multiple-command/</link><pubDate>Sun, 02 Jul 2017 09:32:05 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-07-02-how-to-use-bash-in-powershell-to-run-multiple-command/</guid><description>&lt;p>在這間公司工作..
我學會了很多 command (多數是在 bash [git bash] 上使用的)&lt;/p>
&lt;p>回家後可能是因為 screen 比較細的關係
所以很小會開&lt;strong>git bash&lt;/strong> 來執行指令
會使用&lt;strong>Visual Studio code&lt;/strong> instead
&lt;strong>VS code&lt;/strong> 是使用&lt;strong>Powershell&lt;/strong>的
所以當我嘗試執行&lt;/p>
&lt;pre>&lt;code class="language-bash">git fetch &amp;amp;&amp;amp; git checkout develop
&lt;/code>&lt;/pre>
&lt;p>遇到以下的錯誤信息
&amp;quot;
&lt;span style="color: #ff0000;">&lt;strong>At line:1 char:12&lt;/strong>&lt;/span>
&lt;span style="color: #ff0000;">&lt;strong>+ git fetch &amp;amp;&amp;amp; git checkout develop&lt;/strong>&lt;/span>
&lt;span style="color: #ff0000;">&lt;strong>+ ~~&lt;/strong>&lt;/span>
&lt;span style="color: #ff0000;">&lt;strong>The token &amp;lsquo;‘‘&amp;rsquo; is not a valid statement separator in this version.&lt;/strong>&lt;/span>
&lt;span style="color: #ff0000;">&lt;strong> + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException&lt;/strong>&lt;/span>
&lt;span style="color: #ff0000;">&lt;strong> + FullyQualifiedErrorId : InvalidEndOfLine&lt;/strong>&lt;/span>
&amp;quot;
&lt;a href="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/07/ampSignOnPowerShell.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-4016" src="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/07/ampSignOnPowerShell.png?resize=625%2C173" alt="try to use &amp;&amp; in powershell" width="625" height="173" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>
我們只需要把 &amp;ldquo;&lt;strong>&amp;amp;&amp;amp;&lt;/strong>&amp;rdquo; 轉成 &amp;ldquo;&lt;strong>;&lt;/strong>&amp;rdquo; 便可以了&lt;/p>
&lt;pre>&lt;code class="language-bash">git fetch ; git checkout develop
&lt;/code>&lt;/pre>
&lt;p>
&lt;a href="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/07/semicolonOnPowerShell.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-4017" src="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/07/semicolonOnPowerShell.png?resize=625%2C87" alt="&amp;&amp; alternative in powershell" width="625" height="87" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>
Hope you find it useful&lt;/p></description></item><item><title>ASP.Net Core Enable Development Error</title><link>https://sharechiwai.com/blog/2017-07-01-asp-net-core-enable-development-error/</link><pubDate>Sat, 01 Jul 2017 12:07:06 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-07-01-asp-net-core-enable-development-error/</guid><description>&lt;p>由於不太了解 &lt;strong>ASP.Net Core with Angular / React Webpack&lt;/strong> 的關係
當遇到有 &lt;strong>Angular&lt;/strong> / &lt;strong>React&lt;/strong>的問題是都不知道那裡出錯&lt;/p>
&lt;ul>
&lt;li>我的&lt;strong>Angular&lt;/strong> / &lt;strong>ReactJs&lt;/strong> Project 是用 &lt;strong>dotnet core 的 SPA template&lt;/strong> 建立的&lt;/li>
&lt;/ul>
&lt;p>過了幾天才發現..
由於是使用&lt;/p>
&lt;pre>&lt;code>dotnet run
&lt;/code>&lt;/pre>
&lt;p>或&lt;/p>
&lt;pre>&lt;code>dotnet watch run
&lt;/code>&lt;/pre>
&lt;p>的關係
所以執行的 port 和 visual studio 執行時 debug 的 port 不一樣..
可能是這樣所以被定義為不是 &lt;strong>development mode&lt;/strong>
所以網頁的 error 便被隱藏了&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>有兩個&lt;/p>
&lt;p>&lt;strong>解決方法 1&lt;/strong>
我們可以在&lt;strong>Startup.cs&lt;/strong>
&lt;strong>Enable Developer Error&lt;/strong> 便可以了
E.G.
在以下的 function 上&lt;/p>
&lt;pre>&lt;code class="language-csharp">public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
&lt;/code>&lt;/pre>
&lt;p>移除這個 If statement
當程式遇到錯誤時執行這個 Developer Error&lt;/p>
&lt;pre>&lt;code class="language-csharp">/*
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
HotModuleReplacement = true
});
}
else
{
app.UseExceptionHandler(&amp;quot;/Home/Error&amp;quot;);
}
*/
app.UseDeveloperExceptionPage();
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
HotModuleReplacement = true
});
&lt;/code>&lt;/pre>
&lt;p>
&lt;a href="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/07/startupcs.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-4013" src="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/07/startupcs.png?resize=625%2C287" alt="startup.cs" width="625" height="287" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>
&lt;strong>解決方法 2&lt;/strong>
這個方法比理性
就是更改 開發電腦的 &lt;code>Environment Variable Settings&lt;/code>
我們可以使用&lt;code>Command prompt&lt;/code>
執行以下指令設定&lt;code>環境變數&lt;/code> &lt;code>Environment Variable&lt;/code>&lt;/p>
&lt;p>&lt;code>set ASPNETCORE_ENVIRONMENT=Development&lt;/code>&lt;/p>
&lt;p>&lt;strong>
&lt;a href="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/07/aspnetCoreEvvironment.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-4012" src="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/07/aspnetCoreEvvironment.png?resize=625%2C105" alt="Set up ASPNETCORE Environment Variable" width="625" height="105" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>&lt;/strong>
詳情可以參考以下網頁
&lt;a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments">https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments&lt;/a>&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>LetsEncrypt Renew - Lets Encrypt SSL 更新</title><link>https://sharechiwai.com/blog/2017-06-27-letsencrypt-renew-lets-encrypt-ssl/</link><pubDate>Tue, 27 Jun 2017 06:51:11 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-06-27-letsencrypt-renew-lets-encrypt-ssl/</guid><description>&lt;p>差不多每三個月 &lt;strong>Let&amp;rsquo;s Encrypt Expiry Bot&lt;/strong>
便會&lt;strong>Email&lt;/strong> 我說.. 我的&lt;strong>SSL&lt;/strong> 後快便會到期&lt;strong>Expire&lt;/strong>
我需要去&lt;strong>Renew&lt;/strong>&amp;rdquo;
&lt;a href="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/letsEncryptExpiry.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-4009" src="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/letsEncryptExpiry.png?resize=625%2C39" alt="Let's Encrypt Expiry Bot Email Notification" width="625" height="39" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>十分簡單
我們只需要在 server 的&lt;strong>Terminal&lt;/strong> 上用 &lt;strong>sudo&lt;/strong>執行以下指令便可&lt;/p>
&lt;p>&lt;code>sudo certbot-auto renew&lt;/code>&lt;/p>
&lt;p>
&lt;a href="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/letsEncryptRenew.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-4007" src="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/letsEncryptRenew.png?resize=625%2C339" alt="Let's Encrypt Renew Successfully" width="625" height="339" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>&lt;/p>
&lt;p>完成後會說成功 renew&lt;/p>
&lt;p>hope you find it useful&lt;/p></description></item><item><title>OnePlus 5 Windows Driver Download</title><link>https://sharechiwai.com/blog/2017-06-25-oneplus-5-windows-driver-download/</link><pubDate>Sun, 25 Jun 2017 09:50:13 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-06-25-oneplus-5-windows-driver-download/</guid><description>&lt;p>唔知點解將&lt;strong>OnePlus&lt;/strong> 用 &lt;strong>USB&lt;/strong> 線連接了 電腦後 &lt;strong>Windows 10&lt;/strong> 認不到那部 &lt;strong>OnePlus5&lt;/strong>&lt;/p>
&lt;p>之後我便在 &lt;strong>OnePlus&lt;/strong>的網站上聯絡 他們的 Staff&lt;/p>
&lt;p>解釋完問題之後他在&lt;strong>Google Drive Share&lt;/strong> 了一個 &lt;strong>OnePlus5 的 Drive&lt;/strong>r 給我安裝&lt;br>
&lt;a href="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/oneplus5.png" target="_blank" rel="noopener">&lt;img class="alignnone size-full wp-image-4002" src="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/oneplus5.png?resize=625%2C492" alt="OnePlus 5 Driver" width="625" height="492" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>&lt;/p>
&lt;p>有興趣&lt;strong>download One Plus 5 Driver&lt;/strong> 的朋友可以到以下網址 download (我上載了到我的&lt;strong>OneDrive&lt;/strong> 上 )&lt;/p>
&lt;p>&lt;a href="https://1drv.ms/u/s!Ar-41LgGhTlmmgeHt648U6gbXmFk">https://1drv.ms/u/s!Ar-41LgGhTlmmgeHt648U6gbXmFk&lt;/a>
&lt;a href="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/OnePlus5Info.png" target="_blank" rel="noopener">&lt;img class="alignnone size-full wp-image-4003" src="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/OnePlus5Info.png?resize=625%2C879" alt="OnePlus5 Driver file info" width="625" height="879" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>OnePlus 5 Release - Early Access - OnePlus5 提早購買Code</title><link>https://sharechiwai.com/blog/2017-06-21-oneplus-5-release-early-access-oneplus5-code/</link><pubDate>Wed, 21 Jun 2017 06:30:37 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-06-21-oneplus-5-release-early-access-oneplus5-code/</guid><description>&lt;p>&lt;strong>OnePlus5&lt;/strong> 終於 release 了
一部性價比勁高的手機
&lt;a href="https://oneplus.net/hk/5">https://oneplus.net/hk/5&lt;/a>&lt;/p>
&lt;p>&lt;strong>Official Release Date 是 2017 年 6 月 27 日
&lt;a href="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/oneplus-1.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-3998" src="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/oneplus-1.png?resize=625%2C442" alt="OnePlus5 Price" width="625" height="442" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />
&lt;/a>&lt;/strong>
&lt;strong>OnePlus5 Spec 規格&lt;/strong>
&lt;a href="http://www.gsmarena.com/oneplus_5-8647.php" target="_blank" rel="noopener">http://www.gsmarena.com/oneplus_5-8647.php
&lt;/a> 十分吸引
&lt;a href="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/oneplus-2.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-3999" src="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/oneplus-2.png?resize=625%2C537" alt="oneplus5 spec" width="625" height="537" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>&lt;/p>
&lt;p>如果想&lt;strong>馬上購買 OnePlus5&lt;/strong>
可以到以下網址 &lt;a href="https://oneplus.net/hk/early-drop">https://oneplus.net/hk/early-drop&lt;/a>
在&lt;strong>Code&lt;/strong> 這個空格上輸入 &amp;ldquo;&lt;strong>Clearer Photos&lt;/strong>&amp;rdquo; 便可以提早購買&lt;/p>
&lt;p>買的時候可以轉入 以下的 Code &amp;ldquo;&lt;strong>V61PON7QPME1HQ6&lt;/strong>&amp;rdquo;
或使用以下連結&lt;/p>
&lt;p>
&lt;a href="https://oneplus.net/hk/invite#V61PON7QPME1HQ6" target="_blank" rel="noopener">https://oneplus.net/hk/invite#V61PON7QPME1HQ6
&lt;/a>
&lt;a href="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/oneplus.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-3997" src="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/oneplus.png?resize=625%2C336" alt="OnePlus5 Early Access" width="625" height="336" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>&lt;/p>
&lt;p>便可以以平 150HKD 的價錢買入 accessories e.g. Case..Earphones 了&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>ASP.net Core SPA Single Page Application Template Generator with angular, aurelia, knockout, react</title><link>https://sharechiwai.com/blog/2017-06-20-aspnetcode-spa-template-generator/</link><pubDate>Tue, 20 Jun 2017 06:51:03 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-06-20-aspnetcode-spa-template-generator/</guid><description>&lt;p>最近開始學 &lt;strong>Angular 4&lt;/strong> / &lt;strong>React&lt;/strong>
但是不知道怎樣開始
如果只是&lt;strong>React&lt;/strong> / &lt;strong>Angular&lt;/strong> 的 CLI 來產生他們的 &lt;strong>Project Template&lt;/strong> 的話 自己便要再起一個&lt;strong>Node JS&lt;/strong> 的 backend 來 serve data 了&lt;/p>
&lt;p>&lt;strong>安裝方法&lt;/strong>:
我們可以在 Command prompt 執行以下指令&lt;/p>
&lt;pre>&lt;code class="language-bash">dotnet new --install Microsoft.AspNetCore.SpaTemplates::*
&lt;/code>&lt;/pre>
&lt;p>之後便可以執行以下指令 去看看有什麼 &lt;strong>Template&lt;/strong> 可以使用&lt;/p>
&lt;pre>&lt;code class="language-bash">dotnet new
&lt;/code>&lt;/pre>
&lt;p>
&lt;a href="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/dotnetnew.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-3994" src="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/dotnetnew.png?resize=625%2C347" alt="dotnet new" width="625" height="347" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>
建立一個新資料夾之後進入這資料夾執行
以下指令到 建立你的 &lt;strong>angular SPA site with Dotnet core backend&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-bash">dotnet new angular
&lt;/code>&lt;/pre>
&lt;p>完成後可以執行以下指令到 run 這個 project&lt;/p>
&lt;pre>&lt;code class="language-bash">dotnet restore
npm install
dotnet run
&lt;/code>&lt;/pre>
&lt;p>hope you find it useful&lt;/p></description></item><item><title>Git note - How to checkout specific commit - Git 如何checkout 之前的Commit / Changeset</title><link>https://sharechiwai.com/blog/2017-06-19-git-note-how-to-checkout-specific-commit-git-commit-changeset/</link><pubDate>Mon, 19 Jun 2017 07:12:42 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-06-19-git-note-how-to-checkout-specific-commit-git-commit-changeset/</guid><description>&lt;p>常常很大意地 &lt;strong>merge&lt;/strong>完一些程式碼後沒有測試便&lt;strong>Commit&lt;/strong> 和&lt;strong>Pull&lt;/strong> 了到 Remote Repo
所以便要用 一些 git command 來還原之前的 Commit 再去解決問題&lt;/p>
&lt;p>那麼如何 還原或 &lt;strong>Checkout&lt;/strong> 之前的&lt;strong>Commit&lt;/strong> 呢?&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>分簡單
我們只需要找到之前&lt;strong>commit&lt;/strong>的 hash id 之後 &amp;ldquo;&lt;span style="color: #008000;">&lt;strong>git checkout [commit hash]&lt;/strong>&lt;/span>&amp;rdquo; 便可以了&lt;/p>
&lt;p>查看之前的&lt;strong>Commit&lt;/strong> 可以使用 &amp;ldquo;&lt;span style="color: #008000;">&lt;strong>git log&lt;/strong>&lt;/span> [&lt;span style="color: #008000;">&lt;strong>-(前多小個 commit)&lt;/strong>&lt;/span>]&amp;rdquo;
e.g.&lt;/p>
&lt;pre>&lt;code class="language-bash">// 這個指令會輸出前三個commit的資訊
git log -3
&lt;/code>&lt;/pre>
&lt;p>
&lt;a href="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/gitlog.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-3991" src="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/gitlog.png?resize=625%2C169" alt="Git Log" width="625" height="169" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>
取後&lt;strong>commit hash&lt;/strong> 之後 只要輸內前 8 個以上的 characters 應該便足夠令 &lt;strong>git&lt;/strong> 識出那個&lt;strong>commit&lt;/strong>你想&lt;strong>checkout&lt;/strong>的
之後可以&lt;strong>checkout&lt;/strong> 這個 commit 了&lt;/p>
&lt;pre>&lt;code class="language-bash">git checkout 7aef7c3f
&lt;/code>&lt;/pre>
&lt;p>&lt;strong>Local Repos&lt;/strong> 的 程式碼應該會還原到這個&lt;strong>commit&lt;/strong> 時的 程式碼&lt;/p>
&lt;p>hope you find it useful&lt;/p></description></item><item><title>dotnet watch does not refresh content for AspNetCore.SpaTemplates React / Angular</title><link>https://sharechiwai.com/blog/2017-06-04-dotnet-watch-does-not-refresh-content-for-spatemplates/</link><pubDate>Sun, 04 Jun 2017 19:43:31 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-06-04-dotnet-watch-does-not-refresh-content-for-spatemplates/</guid><description>&lt;p>最近使用了 &lt;strong>ASP.Net Core&lt;/strong> 的 &lt;strong>SPA Template&lt;/strong> 來學習 &lt;strong>ReactJs&lt;/strong>
因為我可以使用 &lt;strong>ASP.Net Core&lt;/strong> 來做 &lt;strong>Web API&lt;/strong>.. 而 &lt;strong>ReactJs&lt;/strong> 來做 Web &lt;strong>Front End&lt;/strong>
之後便可以 deploy 到 &lt;strong>Azure&lt;/strong> 十分方便.. 又可以很快看到效果
&lt;a href="https://blog.sharechiwai.com/2017/05/asp-net-core-app-can-now-be-deploy-to-azure-azure-web-app/" rel="bookmark">ASP.Net Core App can NOW be deploy to Azure – (Azure web app)&lt;/a>&lt;/p>
&lt;p>由于使用&lt;strong>Visual Studio&lt;/strong> 開發感覺比效慢
所以便用了&lt;strong>Visual Studio Code&lt;/strong>了&lt;/p>
&lt;p>不久便出現了一個問題..就是在&lt;strong>Visual Studio&lt;/strong> 開發時
修改 &lt;strong>ReactJs&lt;/strong> 相關的程式碼..在&lt;strong>Debug&lt;/strong>時
是可以看到修改後的結果的
但是用&lt;strong>Visual Studio Code&lt;/strong> 配合 &amp;ldquo;&lt;span style="color: #008000;">&lt;strong>dotnet watch run&lt;/strong>&lt;/span>&amp;rdquo; 時
&lt;a href="https://blog.sharechiwai.com/2017/05/enable-dotnet-watch-on-asp-net-core/" rel="bookmark">Enable dotnet watch – on asp.net core&lt;/a>&lt;/p>
&lt;pre>&lt;code class="language-bash">dotnet watch run
&lt;/code>&lt;/pre>
&lt;p>&lt;img class="alignnone size-large wp-image-3987" src="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/dotnet-Watch-Run.png?resize=625%2C228" alt="dotnet watch run" width="625" height="228" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />
網頁便不會更新但是&lt;strong>deploy&lt;/strong> 到&lt;strong>Azure&lt;/strong> 時是看到了修改的結果的&lt;/p>
&lt;p>做了一會 research 之後 終於找到了解決方法&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>
我們需要使用另一個&lt;strong>Terminal windows&lt;/strong> 執行 &amp;ldquo;&lt;span style="color: #008000;">&lt;strong>webpack -watch&lt;/strong>&lt;/span>&amp;rdquo; 這個指令 便可以了&lt;/p>
&lt;pre>&lt;code class="language-bash">webpack --watch
&lt;/code>&lt;/pre>
&lt;p>
&lt;a href="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/webpackWatch.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-3986" src="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/06/webpackWatch.png?resize=625%2C380" alt="webpack --watch" width="625" height="380" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>
Hope you find it useful&lt;/p></description></item><item><title>Enable dotnet watch - on asp.net core</title><link>https://sharechiwai.com/blog/2017-05-31-enable-dotnet-watch-on-asp-net-core/</link><pubDate>Wed, 31 May 2017 22:00:20 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-05-31-enable-dotnet-watch-on-asp-net-core/</guid><description>&lt;p>最近開始學習 &lt;strong>.Net Core&lt;/strong> 的 &lt;strong>ASP.Net Core&lt;/strong>
發現現在.net 越來越方便了
之前開發 asp.net 的 web application 時每當要更改程式碼 時
都有需要停止 &lt;strong>debug&lt;/strong>之後更重新開始&lt;strong>debug&lt;/strong>..
感覺開發.net application 需要的時間比較長
不像使用 &lt;strong>node.js&lt;/strong>一樣..可以使用 &lt;strong>gulp&lt;/strong>或&lt;strong>grunt&lt;/strong> 來檢查程式碼有沒有更新
如果有的話便會 re-compile 等等
之後只要 refresh browser 便會自看到程式碼所做的更新&lt;/p>
&lt;p>現在.net core 也有這個功能叫 &amp;ldquo;&lt;strong>dotnet watch&lt;/strong>&amp;rdquo;
我們只需要在&amp;rdquo;.csproj&amp;rdquo; 上的 &amp;ldquo;&lt;strong>&lt;ItemGroup>&lt;/strong>&amp;rdquo; tag 內加上以下的 setting
e.g.&lt;/p>
&lt;pre>&lt;code>&amp;lt;ItemGroup&amp;gt;
&amp;lt;DotNetCliToolReference Include=&amp;quot;Microsoft.DotNet.Watcher.Tools&amp;quot; Version=&amp;quot;1.0.0&amp;quot; &amp;gt;
&amp;lt;DotNetCliToolReference Include=&amp;quot;Microsoft.Extensions.SecretManager.Tools&amp;quot; Version=&amp;quot;1.0.0&amp;quot; &amp;gt;
&amp;lt;DotNetCliToolReference Include=&amp;quot;Microsoft.Extensions.Caching.SqlConfig.Tools&amp;quot; Version=&amp;quot;1.0.0&amp;quot; &amp;gt;
&amp;lt;/ItemGroup&amp;gt;
&lt;/code>&lt;/pre>
&lt;p>之後在這個 project 的資料夾的 執行&lt;/p>
&lt;pre>&lt;code>dotnet restore
&lt;/code>&lt;/pre>
&lt;p>之後便可以 在 CLI 上執行&lt;/p>
&lt;pre>&lt;code>dotnet watch run
&lt;/code>&lt;/pre>
&lt;p>hope you find it useful&lt;/p></description></item><item><title>ASP.Net Core App can NOW be deploy to Azure - (Azure web app)</title><link>https://sharechiwai.com/blog/2017-05-25-asp-net-core-app-can-now-be-deploy-to-azure-azure-web-app/</link><pubDate>Thu, 25 May 2017 07:09:21 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-05-25-asp-net-core-app-can-now-be-deploy-to-azure-azure-web-app/</guid><description>&lt;p>回到香港可能工作時間比較長所以回家後都沒有心情像以前一樣做些和電腦相關的事
到剛去完旅遊..終於有些自己時間靜下來&amp;rdquo;
希望自己可以每天再學些東西&amp;rdquo;&lt;/p>
&lt;p>這幾天在想..那麼多新東西學..應該學那一個呢
有些同事建議..可以嘗試一下**.Net Core**
還記得之前如果想 deploy ASP.Net 5 或 .Net Core 都需要在 **TFS Service** 上做一些**config**才可以..
或是使用**AppHarbor** 的 **CLI** 直接把**publish** folder deploy 到 **AppHarbor**上
(剛試過 他不能 deploy **.net core 1.1**)&lt;/p>
&lt;p>感覺比較麻煩..
現在我們可以在&lt;strong>Microsoft Azure&lt;/strong> 的 &lt;strong>Azure App Service&lt;/strong> 上直接 Deploy 存在
&lt;strong>TFS&lt;/strong>, &lt;strong>Visual Studio Service&lt;/strong>, &lt;strong>GitHub&lt;/strong>, &lt;strong>DropBox&lt;/strong>, &lt;strong>Bitbucket&lt;/strong> 上的 &lt;strong>.Net Core&lt;/strong> 程式
&lt;a href="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/05/azure.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-3979" src="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/05/azure.png?resize=625%2C433" alt="Azure App Service - Source" width="625" height="433" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>&lt;/p>
&lt;p>有興趣試 &lt;strong>.Net core&lt;/strong> 既朋友. 可以嘗試 使用&lt;strong>Azure App Service&lt;/strong> 來做 hosting&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>RaspberryPi install NodeJs 6.x / 7.x - 如何在RaspberryPi 安裝 NodeJs</title><link>https://sharechiwai.com/blog/2017-05-23-raspberrypi-install-nodejs-6x-7x-raspberrypi-nodejs/</link><pubDate>Tue, 23 May 2017 00:00:07 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-05-23-raspberrypi-install-nodejs-6x-7x-raspberrypi-nodejs/</guid><description>&lt;p>今日嘗試在&lt;strong>RaspberryPi&lt;/strong>上安裝&lt;strong>Johnny-Five&lt;/strong> /&lt;strong>CylonJs&lt;/strong> 時出現&lt;strong>NodeJs&lt;/strong> 的版本問題
但是執行&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo apt-get install node
&lt;/code>&lt;/pre>
&lt;p>他說 &lt;strong>NodeJs&lt;/strong>已經安裝了&lt;/p>
&lt;p>做了一會 research 之後 發現我們可以使用以下方法來更新這個&lt;strong>NodeJs&lt;/strong>的&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>
我𠍒可以在&lt;strong>Terminal&lt;/strong> 上執行以下&lt;strong>command&lt;/strong>
&lt;strong>NodeJs 6.x&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-bash">curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
&lt;/code>&lt;/pre>
&lt;p>&lt;strong>NodeJs 7.x&lt;/strong>&lt;/p>
&lt;pre>&lt;code class="language-bash">curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
&lt;/code>&lt;/pre>
&lt;p>
&lt;a href="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/04/InstallNodeJsRaspberry.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-3967" src="https://i0.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/04/InstallNodeJsRaspberry.png?resize=625%2C370" alt="Install NodeJs on RaspberryPi" width="625" height="370" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>&lt;/p>
&lt;p>完成後再次執行&lt;/p>
&lt;pre>&lt;code class="language-bash">sudo apt-get install node
&lt;/code>&lt;/pre>
&lt;p>詳情可以參考以下網頁
&lt;a href="https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions">https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions&lt;/a>&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Chocolatey Update All Package -Chocolatey更新所有Package</title><link>https://sharechiwai.com/blog/2017-05-22-chocolatey-update-all-package/</link><pubDate>Mon, 22 May 2017 21:42:59 +0800</pubDate><guid>https://sharechiwai.com/blog/2017-05-22-chocolatey-update-all-package/</guid><description>&lt;p>之前同事介紹了 如何使用 &lt;strong>Chocolately&lt;/strong> 來安裝軟件
現在發現他和其他&lt;strong>Package Manager&lt;/strong> 一樣
可以使用 command 直接更新所有 Package 十分好用&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>
我們使需要使用管理員權限開啟 &lt;strong>PowerShell&lt;/strong>
之後執行以下 command&lt;/p>
&lt;pre>&lt;code class="language-powershell">choco upgrade all -y
&lt;/code>&lt;/pre>
&lt;p>&lt;img class="alignnone size-large wp-image-3974" src="https://i2.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/05/chocoUpgradeAll.png?resize=625%2C458" alt="Chocolatey Update all Package" width="625" height="458" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />
完成後會說名有那些&lt;strong>package&lt;/strong> 已經更新了
&lt;a href="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/05/ChocoUpdatedPackage.png" target="_blank" rel="noopener">&lt;img class="alignnone size-large wp-image-3973" src="https://i1.wp.com/blog.sharechiwai.com/wp-content/uploads/2017/05/ChocoUpdatedPackage.png?resize=625%2C458" alt="Chocolatey Update all Package" width="625" height="458" sizes="(max-width: 625px) 100vw, 625px" data-recalc-dims="1" />&lt;/a>&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>Windows Azure Region Location - Microsoft Azure 終於開始使用Windows/ Azure Microsoft Azure 了</title><link>https://sharechiwai.com/blog/2014-06-01-windows-azure-region-location-microsoft-azure-windows-azure-microsoft-azure/</link><pubDate>Sun, 01 Jun 2014 00:00:53 +0800</pubDate><guid>https://sharechiwai.com/blog/2014-06-01-windows-azure-region-location-microsoft-azure-windows-azure-microsoft-azure/</guid><description>&lt;p>由于朋友怕嘗試更改&lt;strong>VPS&lt;/strong> 的 &lt;strong>Config&lt;/strong>導致我的網頁不能顯示..
或會令到資料不見了的關係
所以決定不再共同使用一個&lt;strong>VPS&lt;/strong> [&lt;strong>Virtual Private Server&lt;/strong>]..&lt;/p>
&lt;p>因為不再共同使用同一個&lt;strong>VPS&lt;/strong>
所以便要自己學會怎樣打理這個 VPS 了..
[會使用&lt;strong>Ubuntu&lt;/strong> 來作&lt;strong>Server&lt;/strong>..所以將來的網誌會用來記下一些&lt;a title="Linux Notes" href="http://blog.sharechiwai.com/category/linux-notes-linux-%e6%96%b0%e6%89%8b%e7%ad%86%e8%a8%98/" target="_blank">&lt;strong>Linux&lt;/strong>&lt;/a>的&lt;strong>Notes&lt;/strong>的比較多]
不好意思當有問題時常常要找朋友來幫忙&lt;/p>
&lt;p>看過了很多不同的&lt;strong>VPS Provider&lt;/strong> 還是要更多時間去決定使用那一間公司..&lt;/p>
&lt;p>所以暫時先決定嘗試使用&lt;strong>Windows Azure&lt;/strong> / &lt;strong>Microsoft Azure&lt;/strong> 上的&lt;strong>Virtual Machine&lt;/strong>服務..[&lt;strong>Free Trial Subscription&lt;/strong>]
看看大概一個月要花費多少&lt;/p>
&lt;p>在建立&lt;strong>Virtual Machine&lt;/strong> 的時需要選擇這個&lt;strong>Virtual Machine&lt;/strong>在那一個&lt;strong>Region&lt;/strong>/&lt;strong>區域&lt;/strong>建立.
E.g. 選擇在那一個&lt;strong>地方&lt;/strong>/&lt;strong>Region&lt;/strong> 要看看你網頁是 Target 那一個&lt;strong>區域&lt;/strong>/&lt;strong>Region&lt;/strong>的 Visitor
&lt;strong>地方&lt;/strong>/&lt;strong>Region&lt;/strong>近這些果家一點..相對來說瀏覽速度/反應也會快一點&amp;hellip;&lt;/p>
&lt;p>&lt;img class="alignnone" src="https://i0.wp.com/farm6.static.flickr.com/5499/14243120388_8103829a92_z.jpg?resize=625%2C335" alt="Microsoft Azure Create Virtual Machine Options" width="625" height="335" data-recalc-dims="1" />&lt;/p>
&lt;p>做了一會 research 後發現
原來&lt;strong>East Asia&lt;/strong> 是&lt;strong>香港&lt;/strong>&amp;hellip;
&lt;strong>Southeast Asia&lt;/strong>是&lt;strong>新加坡&lt;/strong>&lt;/p>
&lt;p>&lt;strong>香港&lt;/strong>比較近..所以我選擇了&lt;strong>East Asia Region&lt;/strong>&lt;/p>
&lt;p>&lt;img class="alignnone" src="https://i1.wp.com/farm4.static.flickr.com/3906/14406599666_fe6ae8d158_z.jpg?resize=625%2C313" alt="Microsoft Azure Region Location" width="625" height="313" data-recalc-dims="1" />
詳情可以參考以下網頁
&lt;a title="Microsoft Azure Region Location" href="https://azure.microsoft.com/en-us/regions/#asia-pacific" target="_blank">&lt;a href="https://azure.microsoft.com/en-us/regions/#asia-pacific">https://azure.microsoft.com/en-us/regions/#asia-pacific&lt;/a>&lt;/a>&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>.Net Post XML via HTTPS Notes 1 [Convert XSD to .Net Class]</title><link>https://sharechiwai.com/blog/2009-08-18-net-post-xml-via-https-notes-1-convert-xsd-to-net-class/</link><pubDate>Tue, 18 Aug 2009 18:18:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-08-18-net-post-xml-via-https-notes-1-convert-xsd-to-net-class/</guid><description>&lt;p>最近公司有一個 project 是要用另外一間公司的 XML Interface 既 Webservice 去做 exchange data.
其實只要這間公司提供 WSDL 既 Address 給我們
這個 project 便很容易完成&amp;rdquo;
很可惜這間公司不願提供 WDSL file
所以最後便要自己學怎樣在 VB.Net 入面 post XML 去 HTTP 了&lt;/p>
&lt;p>便這了這篇筆記了&lt;/p>
&lt;p>還記得之前用 WSDL 時
當我 Add 了 Service Reference Visual Studio 便會自動產生了和這 Web service 有關的 .NET Object 和 Connection End Point
一切都十分方便&amp;rdquo;&lt;/p>
&lt;p>現在所有事都要自己 Handle 　感到有點煩惱&amp;rdquo;
等一個 STEP 便是要找 方法把
Developer Guide 入面的 XSD 轉做 .Net Object
或者你要自己寫一些 CLASSES 出來
去做一些 function 可以 return 到 XML OUTPUT 可以 Match 到
Developer Guide 入面你需要 POST 的 XML Rule.&lt;/p>
&lt;p>以下是我的做法&lt;/p>
&lt;p>首先你要找到這個&lt;span style="font-weight:bold;">XSD.EXE&lt;/span> file
在我的電腦入面是在以下的 directory
&lt;span style="color:rgb(51,51,255);">C:Program FilesMicrosoft SDKsWindowsv6.0ABin&lt;/span>&lt;/p>
&lt;p>或者你可以試試 SEARCH
&amp;ldquo;&lt;span style="font-weight:bold;">xsd.exe&lt;/span>&amp;rdquo; 之後 copy 這個檔案去另一個 location
或到&amp;quot;&lt;span style="font-weight:bold;">xsd.exe&lt;/span>&amp;quot;後便用 Command Prompt
[我將這個.EXE copy 到 裝有 xsd 檔案的 directory 入面 (這樣可以方便自己打小一些 path)]&lt;/p>
&lt;p>之後開啓 command prompt
&amp;ldquo;&lt;span style="font-weight:bold;">Start&lt;/span>&amp;rdquo;-&amp;gt; &amp;ldquo;&lt;span style="font-weight:bold;">Run&lt;/span>&amp;rdquo;-&amp;gt; Type &amp;ldquo;&lt;span style="font-weight:bold;">cmd&lt;/span>&amp;rdquo; -&amp;gt;Press &amp;ldquo;&lt;span style="font-weight:bold;">Enter&lt;/span>&amp;rdquo;
在 command prompt 入面
進入有 &amp;ldquo;&lt;span style="font-weight:bold;">xsd.exe&lt;/span>&amp;rdquo; 的 directory 入面
之後打以下的 Command 你便可以 create 一個 class base on 這個 xsd 檔案了
MyXMLObjNameSpace 是我想這個 Class 用的 namespace.
XMLToExampleCLass.xsd 是我轉的 xsd file.
我用的 language 是 VB.NET&lt;/p>
&lt;p>VB&lt;/p>
&lt;pre>&lt;code>xsd.exe –c –l:vb –n:MyXMLObjNameSpace XMLToExampleCLass.xsd
&lt;/code>&lt;/pre>
&lt;p>C#&lt;/p>
&lt;pre>&lt;code>xsd.exe -c -l:c# -n:MyXMLObjNameSpace XMLToExampleCLass.xsd
xsd.exe -c[-c mean general Class] -l:[Language Name e.g. c#/vb] -n:[Namespace][xsd file name]
&lt;/code>&lt;/pre>
&lt;p>如果你的 XSD 檔案不是 proper define command prompt 便會出示一些 error message 說出那裡出現問題就好像下面一樣&lt;/p>
&lt;p>這樣你便要看清楚你的 XSD 檔案是否 Well define 了&lt;/p>
&lt;p>如果你的 xsd 檔案是沒有問題
他便會出現&amp;rdquo;
&lt;span style="font-size:85%;">&lt;span style="font-style:italic;">&lt;span style="font-weight:bold;">Writing file&lt;/span> &amp;ldquo;C:pathXMLToExampleCLass.vb&amp;quot;&lt;/span>&lt;/span>&lt;/p>
&lt;p>當你完成之後只要 COPY 這個 VB 檔案到你的 VB project
之後 imports 這個 namespace 你便可以使用這個 class 了&lt;/p>
&lt;p>E.G.
VB
&lt;span style="color:rgb(0,153,0);font-size:85%;">&lt;span style="font-style:italic;font-weight:bold;">Imports MyProgram.MyXMLObjNameSpace&lt;/span> &lt;/span>
C#&lt;/p>
&lt;pre>&lt;code>using MyProgram.MyXMLObjNameSpace;
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful.
如果你有更好的方法, 歡迎大家一齊來研究研究&lt;/p></description></item><item><title>Convert Date to Month Name in .Net</title><link>https://sharechiwai.com/blog/2009-08-17-convert-date-to-month-name-in-net/</link><pubDate>Mon, 17 Aug 2009 08:17:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-08-17-convert-date-to-month-name-in-net/</guid><description>&lt;p>Today, my friend and I tried to find a way to convert date to a month name. E.g. 2008-08-08 to return August.&lt;/p>
&lt;p>I tried to use String.Format(TODAY, &amp;ldquo;MMM&amp;rdquo;) ,String.Format(&amp;ldquo;MMM&amp;rdquo;,TODAY) &amp;ldquo;etc.
To convert Date to Month Name sound quite simple, unforunately, I have spent quite a long time to find the solution.&lt;/p>
&lt;p>Finally, I have find a solution online, which is to use the ToString&amp;rsquo;s method.
E.g. Today.ToString({Format of the date}) to get the date format you want.&lt;/p>
&lt;p>&lt;strong>DateTime.Now.ToString(&amp;ldquo;MMMM&amp;rdquo;)&lt;/strong>&lt;/p>
&lt;p>Is it quite easy, isn&amp;rsquo;t it?&lt;/p>
&lt;p>Happy programming = )&lt;/p></description></item><item><title>Cannot open CHM file in Windows XP/Vista- Navigation to the Webpage has been cancelled.</title><link>https://sharechiwai.com/blog/2009-08-16-cannot-open-chm-file-in-windows-xpvista/</link><pubDate>Sun, 16 Aug 2009 08:16:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-08-16-cannot-open-chm-file-in-windows-xpvista/</guid><description>&lt;p>When I try to open &lt;span style="font-weight:bold;">CHM &lt;/span>file on Windows XP or Windows Vista, it always display a message &amp;ldquo;&lt;span style="color:rgb(51,102,255);font-weight:bold;">Navigation to the Webpage has been canceled.&lt;/span>&amp;rdquo;.&lt;/p>
&lt;p>Finally I have worked out how to resolve this problem.&lt;/p>
&lt;p>Solution:&lt;/p>
&lt;p>&lt;span style="font-weight:bold;">Right click&lt;/span> on the &lt;span style="font-weight:bold;">.CHM&lt;/span> file
Click on &amp;ldquo;&lt;strong>Properties&lt;/strong>&amp;rdquo;
then choose the &amp;ldquo;&lt;strong>General&lt;/strong>&amp;rdquo; Tab
At the bottom of that tab, you will see something like&lt;/p>
&lt;div>
Security: "&lt;b>This file came from another computer and might be blocked to help protect this computer&lt;/b>"&lt;br />Click on the "&lt;b>Unblock &lt;/b>"button which is beside to this message.&lt;br />Click "&lt;b>OK&lt;/b>"&lt;br />You should be able to view that CHM.File now
&lt;/div></description></item><item><title>開啟 CHM 說明檔 問題 (XP/VISTA) - 已取消瀏覽該網頁</title><link>https://sharechiwai.com/blog/2009-08-15-chm-xpvista/</link><pubDate>Sat, 15 Aug 2009 08:15:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-08-15-chm-xpvista/</guid><description>&lt;div>
最近當我在Windows XP/Vista 開啟&lt;span style="font-weight:bold;">CHM &lt;/span>格式的檔案時出現以下的信息
&lt;/div>
&lt;div>
"&lt;span style="color:rgb(51,102,255);">已取消瀏覽該網頁&lt;/span>"
&lt;/div>
&lt;div>
看不到這說明檔的內容
&lt;/div>
&lt;div>
最後終於找到解釋方法 = )
&lt;/div>
&lt;div>
&lt;/div>
&lt;div>
&lt;span style="font-weight:bold;">Right Click &lt;/span>這個&lt;span style="font-weight:bold;">CHM &lt;/span>檔
&lt;/div>
&lt;div>
選擇 "&lt;b>內容&lt;/b>"
&lt;/div>
&lt;div>
之後你會看到
&lt;/div>
&lt;div>
在"&lt;b>一般&lt;/b>" 分頁的底部會出現
&lt;/div>
&lt;div>
"&lt;b>安全性: 這個檔案來自另一個電腦, 可能會封鎖以協助保護您的電腦&lt;/b>"
&lt;/div>
&lt;div>
只要按一下 "&lt;b>解除封鎖&lt;/b>" 按鈕
&lt;/div>
&lt;div>
然後按"&lt;b>確定&lt;/b>"
&lt;/div>
&lt;div>
&lt;/div>
&lt;div>
你便可以正常開啟這個&lt;span style="font-weight:bold;">CHM &lt;/span>檔案了
&lt;/div></description></item><item><title>Win2008 SP1 download</title><link>https://sharechiwai.com/blog/2009-08-13-win2008-sp1-download/</link><pubDate>Thu, 13 Aug 2009 08:13:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-08-13-win2008-sp1-download/</guid><description>&lt;p>I just installed Windows Server 2008 in Virtual PC. Try to install All the service packs to the Server before using the &amp;ldquo;Windows update&amp;rdquo;.
When I go to &lt;span style="font-weight:bold;">Microsoft Download Centre&lt;/span>,&lt;/p>
&lt;p>From the URL below:
&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=a4dd31d5-f907-4406-9012-a5c3199ea2b3&amp;amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyID=a4dd31d5-f907-4406-9012-a5c3199ea2b3&amp;amp;displaylang=en&lt;/a>
I saw a message which say:
&lt;span style="font-size:85%;">&lt;span style="color:rgb(51,51,255);">[Service Pack 1 is a prerequisite for installing Service Pack 2. Please make sure that your system is running Service Pack 1 before you install Service Pack 2. ]&lt;/span>&lt;/span>, that means the ISO that I download will not include SP1.&lt;/p>
&lt;p>Therefore I am searching for Windows Server 2008 SP1 from the Download centre, unfortunately, I could not find any location where I can download &lt;span style="font-weight:bold;">Win2008 SP1&lt;/span>.&lt;/p>
&lt;p>Finally I have checked the version of my &lt;span style="font-weight:bold;">Windows Server 2008&lt;/span> by:
&amp;ldquo;&lt;span style="font-weight:bold;">Start Menu&lt;/span>&amp;rdquo; -&amp;gt; Right Click &amp;ldquo;&lt;span style="font-weight:bold;">Computer&lt;/span>&amp;rdquo; -&amp;gt; &amp;ldquo;&lt;span style="font-weight:bold;">Properties&lt;/span>&amp;rdquo;&lt;/p>
&lt;p>Cannot believe that the installed version already contain SP1. I guess when they release Windows Server 2008, they have included SP1 in there already.&lt;/p></description></item><item><title>Fatal error: Call to undefined function curl_init() 問題</title><link>https://sharechiwai.com/blog/2009-08-12-fatal-error-call-to-undefined-function-curl_init/</link><pubDate>Wed, 12 Aug 2009 08:12:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-08-12-fatal-error-call-to-undefined-function-curl_init/</guid><description>&lt;p>今天想嘗試使用 &lt;span style="font-weight:bold;">CURL &lt;/span>這個 MODULE 去 POST 一些 XML Data 到另一個 website,
當我跟著網上的 example 試 code 的時候&amp;rdquo;&lt;/p>
&lt;pre>&lt;code class="language-php">&amp;lt;?
$ch = curl_init();
?&amp;gt;
&lt;/code>&lt;/pre>
&lt;p>下面的 error 便出現了&lt;br />&lt;b>Fatal error&lt;/b>&lt;span style="color:rgb(255,0,0);">: Call to undefined function curl_init() in &lt;/span>&lt;b>D:WebServerWebSitePostXML.php&lt;/b>&lt;span style="color:rgb(255,0,0);"> on line &lt;/span>&lt;b>8&lt;/b>&lt;/span>&lt;/p>
&lt;p>其實解決方法很簡單
只要到 &amp;ldquo;&lt;strong>Notepad&lt;/strong>&amp;rdquo; 開啟 &amp;ldquo;&lt;strong>php.ini&lt;/strong>&amp;rdquo;
之後用 &amp;ldquo;&lt;strong>Edit&lt;/strong>&amp;rdquo; -&amp;gt;&amp;rdquo;&lt;strong>Find&amp;rdquo;&lt;/strong>&amp;rdquo; 或 &lt;span style="font-weight:bold;">CTRL &lt;/span>+ &amp;ldquo;&lt;span style="font-weight:bold;">F&lt;/span>&amp;rdquo;
找 &amp;ldquo;&lt;strong>curl&lt;/strong>&amp;rdquo;
你便會找到
&lt;code>;extension=php_curl.dll&lt;/code>&lt;/p>
&lt;p>你只需要刪除&amp;quot;&lt;span style="font-weight:bold;color:rgb(51,204,0);">;&lt;/span>&amp;rdquo;
之後儲存檔案
&lt;span style="font-weight:bold;">&amp;quot;Restart&amp;rdquo; &lt;/span>你的 web server 便可&lt;/p>
&lt;p>Good Luck&lt;/p></description></item><item><title>ASP.Net GridView RowCommand did not get trigger</title><link>https://sharechiwai.com/blog/2009-08-11-asp-net-gridview-rowcommand-did-not-get-trigger/</link><pubDate>Tue, 11 Aug 2009 08:11:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-08-11-asp-net-gridview-rowcommand-did-not-get-trigger/</guid><description>&lt;p>I was stuck in a &lt;span style="font-weight:bold;">GridView RowCommand&lt;/span> problem for a long time. Not sure why the &lt;span style="font-weight:bold;">RowCommand &lt;/span>did not get trigger&amp;rdquo;
Here is my situation:&lt;/p>
&lt;p>I have a &lt;span style="font-weight:bold;">Grid View&lt;/span> which is used to display a table with data, It also contain an image button which allow user to click on, to download a file.&lt;/p>
&lt;p>I have done the similar feature several time, all of them works fine. Unfortunately, when the user click on the image button for this grid view, it just refresh the page, but it did not do anything. I try to check what have done wrong by comparing the code that I did before. They all looks fine.&lt;/p>
&lt;p>So I have set up several break point to where the &lt;span style="font-weight:bold;">RowCommand &lt;/span>handler is, a strange thing happened. The &lt;span style="font-weight:bold;">RowCommand Handler&lt;/span> did not get triggered at all.&lt;/p>
&lt;p>Finally, I just realised I have forgotten to put an if-statement ispostback on the Page Load event, so that whenever the RowCommand get triggered, it executed a post back, which will run the page_load event. And inside my Page_Load event, it will populate the table again. Therefore, the RowCommand never get triggered.&lt;/p>
&lt;p>&lt;span style="font-weight:bold;">Solution is:&lt;/span>
To put a code on &lt;span style="font-weight:bold;">Page_Load Event&lt;/span> to check if it is a &lt;span style="font-weight:bold;">PostBack &lt;/span>or not. If it is not a postback then populate the table, if Not, then skip it.
Here it is the Code to check if it is postback or not.&lt;/p>
&lt;p>&lt;span style="font-weight:bold;">VB.Net&lt;/span>
&lt;span style="color:rgb(0,153,0);font-size:85%;">If Not IsPostBack Then&lt;br /> &amp;lsquo;Do some action, in my case populate the table&lt;br />End&lt;/span>&lt;/p>
&lt;p>&lt;span style="font-weight:bold;">C#&lt;/span>
&lt;span style="font-size:85%;">&lt;span style="color:rgb(0,153,0);">if(!IsPostBack){&lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> //Do some action, in my case populate the table&lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> }&lt;/span>&lt;br />&lt;/span>
Hope you find it useful! = )&lt;/p></description></item><item><title>MegaUpload -This service is temporarily not available from your service area</title><link>https://sharechiwai.com/blog/2009-08-10-megaupload-this-service-is-temporarily-not-available-from-your-service-area/</link><pubDate>Mon, 10 Aug 2009 08:10:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-08-10-megaupload-this-service-is-temporarily-not-available-from-your-service-area/</guid><description>&lt;p>最近在香港嘗試 click 去 網上面朋友分享的下載網址時 [個file hosting company 係 &lt;span style="font-weight:bold;">Megaupload &lt;/span>的 LINK]
E.g. &lt;a href="http://www.megaupload.com/">http://www.megaupload.com/&lt;/a>
便會出現以下的 message
&amp;ldquo;&lt;span style="color:red;">This service is temporarily not available from your service area.&lt;/span>&amp;rdquo;&lt;/p>
&lt;p>唔知邊點解香港用唔到呢個 file hosting company 既服務&lt;/p>
&lt;p>最後比我找到有些網站 提供了 一個叫做 &lt;span style="font-weight:bold;">Transload &lt;/span>既方法
令到我們可以繼續 download &lt;span style="font-weight:bold;">Megaupload &lt;/span>host 既file
我估個原理係 我O地用佢既Server Download 我們想下載的file去 個Website 既Server 度
之後便可從這web server 下載個 file 到我們的電腦度&lt;/p>
&lt;p>可能會比平時下載檔案用多幾個STEP 但是這可以解決 用唔到Megaupload file hosting的下載問題 = )&lt;/p>
&lt;p>以下是我找到的其中2個Website&lt;/p>
&lt;p>第一個Website 好似 個file size limit 係500MB
&lt;a href="http://www.yourleech.com/index.php">http://www.yourleech.com/index.php&lt;/a>&lt;/p>
&lt;div>
&lt;a href="http://www.ableech.com/">http://www.ableech.com/&lt;/a>&lt;span style="font-size:85%;"> &lt;/span>&lt;br />&lt;span style="font-size:85%;">*有一些檔案可能需要right click 去另存目標先可以正確下載.&lt;/span>
&lt;/div>
&lt;p>第二個Website 好似 個file size limit 係300MB&lt;/p>
&lt;div>
&lt;a href="http://www.ableech.com/">&lt;/a>
&lt;/div>
&lt;p>&lt;a href="http://www.sparkyfire.co.cc/">http://www.sparkyfire.co.cc/&lt;/a>&lt;/p>
&lt;p>你亦都可以到以下的URL 看看有那個WEBSITE 可以幫你做TRANSLOAD 這個動作
&lt;a href="http://www.rapidindex.net/">http://www.rapidindex.net/&lt;/a>
然後便可以DOWNLOAD MEGAUPLOAD 的, &lt;strong>&lt;span style="color:red;">但要小心有些有廣告的LINK 可能有VIRUS&amp;quot;&lt;/span>&lt;/strong>&lt;/p>
&lt;p>如果大家找到更多website 可以做到這個功能
歡迎大家在留言度 post 個website 出來 和大家分享&lt;/p>
&lt;p>Hope you find it useful.&lt;/p></description></item><item><title>PHP Session Problem</title><link>https://sharechiwai.com/blog/2009-08-09-php-session-problem/</link><pubDate>Sun, 09 Aug 2009 23:00:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-08-09-php-session-problem/</guid><description>&lt;p>When I try to use the Session variable in PHP $_Session[&amp;ldquo;VariableName&amp;rdquo;], it does not work&amp;rdquo;.
The session never get registered.&lt;/p>
&lt;p>How to check?
You can use the following code to see if the Session is null or not.&lt;/p>
&lt;pre>&lt;code class="language-php">&amp;lt;?php
isset($_SESSION[&amp;quot;VariableName&amp;quot;]) //If this return false, that mean this session is null
?&amp;gt;
if(isset($_SESSION[&amp;quot;VariableName&amp;quot;])){
echo &amp;quot;Session value:&amp;quot; . $_SESSION[&amp;quot;VariableName&amp;quot;];
$_SESSION[&amp;quot;VariableName&amp;quot;] = &amp;quot;Assigned&amp;quot;;
}else{
echo &amp;quot;Session is null&amp;quot;;
}
?&amp;gt;
&lt;/code>&lt;/pre>
&lt;/p>
```php
if(isset($_SESSION["VariableName"])){
echo "Session value:" . $_SESSION["VariableName"];
$_SESSION["VariableName"] = "Assigned";
}else{
echo "Session is null";
}
?>
&lt;pre>&lt;code>&amp;lt;div&amp;gt;
&amp;lt;span style=&amp;quot;background-color:rgb(255,255,255);&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;Apple-style-span&amp;quot; style=&amp;quot;color:#000000;&amp;quot;&amp;gt;If the result is &amp;quot;&amp;lt;/span&amp;gt;&amp;lt;b&amp;gt;&amp;lt;span class=&amp;quot;Apple-style-span&amp;quot; style=&amp;quot;color:#000000;&amp;quot;&amp;gt;Session is null&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;span class=&amp;quot;Apple-style-span&amp;quot; style=&amp;quot;color:#000000;&amp;quot;&amp;gt;&amp;quot;, once you refresh the page again, it should display &amp;quot;Session value: Assigned&amp;quot;.&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;Apple-style-span&amp;quot; style=&amp;quot;color:#000000;&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;
If not, that mean the Session feature has not been turn on properly on you server.
&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;
&amp;lt;b&amp;gt;Solution 1:&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;If you are allowed to modify the php.ini file, you can open up the &amp;quot;php.ini&amp;quot; file and Search for the keyword &amp;quot;&amp;lt;/span&amp;gt;session.auto_start&amp;lt;span class=&amp;quot;Apple-style-span&amp;quot; style=&amp;quot;color:#000000;&amp;quot;&amp;gt;&amp;quot;&amp;lt;br /&amp;gt;To ensure &amp;lt;/span&amp;gt;session.auto_start= 1&amp;lt;span class=&amp;quot;Apple-style-span&amp;quot; style=&amp;quot;color:#000000;&amp;quot;&amp;gt;;&amp;lt;br /&amp;gt;After you edited it, you can restart the web sever and try again.&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;
&amp;lt;b&amp;gt;Solution 2:&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;You can use the follow code to enable the session feature:&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;span style=&amp;quot;font-family:Courier New;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;color:rgb(0,0,0);&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;color:rgb(0,0,187);&amp;quot;&amp;gt;session_start&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;color:rgb(0,119,0);&amp;quot;&amp;gt;();&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;
&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;
&amp;lt;span class=&amp;quot;Apple-style-span&amp;quot; style=&amp;quot;color:#000000;&amp;quot;&amp;gt;Hope you find this useful!&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code>&lt;/pre></description></item><item><title>Remote Desktop in WinXP Home Edition</title><link>https://sharechiwai.com/blog/2009-08-01-remote-desktop-in-winxp-home-edition/</link><pubDate>Sat, 01 Aug 2009 08:01:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-08-01-remote-desktop-in-winxp-home-edition/</guid><description>&lt;p>&lt;span style="font-family: Verdana; font-size: 13px;">I was trying to use &amp;ldquo;&lt;strong>Remote Desktop Connection&lt;/strong>&amp;rdquo; to connect to work place via &lt;strong>VPN&lt;/strong>, because it is a lot quicker/smoother then using VNC client. Unfortunately, I cannot find the program under &amp;ldquo;&lt;strong>Start&lt;/strong>&amp;rdquo; -&amp;gt; &amp;ldquo;&lt;strong>All Program&lt;/strong>&amp;rdquo; -&amp;gt; &amp;ldquo;&lt;strong>Accessories&lt;/strong>&amp;rdquo; from my WinXP Home edition laptop. Then, I was recommended to download the third party software. = (&lt;/span>&lt;/p>
&lt;p>However, I found out that we have option for it. If you don&amp;rsquo;t want to download the software. May be you can try to type &amp;ldquo;&lt;strong>MSTSC&lt;/strong>&amp;rdquo; from &amp;ldquo;&lt;strong>Start&lt;/strong>&amp;rdquo; -&amp;gt;&amp;rdquo;&lt;strong>Run&lt;/strong>&amp;rdquo;. The remote desktop console should appear. If not, then you can try to download the software from :&lt;/p>
&lt;p>&lt;span style="font-family: Verdana; font-size: 13px;">&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=6E1EC93D-BDBD-4983-92F7-479E088570AD&amp;displaylang=en">&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=6E1EC93D-BDBD-4983-92F7-479E088570AD&amp;amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?familyid=6E1EC93D-BDBD-4983-92F7-479E088570AD&amp;amp;displaylang=en&lt;/a>&lt;/a>
&lt;/span>
Hope you find this useful. =)&lt;/p></description></item><item><title>Windows Server 2008 and Windows VIsta Service Pack 2 Download</title><link>https://sharechiwai.com/blog/2009-05-29-windows-server-2008-and-windows-vista-service-pack-2-download/</link><pubDate>Fri, 29 May 2009 07:31:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-05-29-windows-server-2008-and-windows-vista-service-pack-2-download/</guid><description>&lt;p>Windows Server 2008 and Windows Vista Service Pack 2 is now avaliable.
For more information please visit the URL below:
&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=a4dd31d5-f907-4406-9012-a5c3199ea2b3&amp;amp;DisplayLang=en">http://www.microsoft.com/downloads/details.aspx?FamilyID=a4dd31d5-f907-4406-9012-a5c3199ea2b3&amp;amp;DisplayLang=en&lt;/a>&lt;/p></description></item><item><title>InLink Checker in SilverLight</title><link>https://sharechiwai.com/blog/2009-04-04-inlink-checker-in-silverlight/</link><pubDate>Sat, 04 Apr 2009 04:04:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-04-04-inlink-checker-in-silverlight/</guid><description>&lt;p>I have updated the &lt;span style="font-weight:bold;">Back-Link checker &lt;/span>Beta 1 to have another feature which allow us to check which links your site/page is linking to and is searchable by crawler.&lt;/p>
&lt;p>It is an useful tool to check if you have linked to any pages which you do not intend to link to/ or recommend to the other which could affect your site&amp;rsquo;s reputation. E.g. some &lt;span style="font-weight:bold;">spam sites&lt;/span>, may leave comment/message on your site, which has pasted a link to their &lt;span style="font-weight:bold;">spam URL&lt;/span>&amp;quot;etc.&lt;/p>
&lt;p>To check the Page InLinks:&lt;/p>
&lt;ol>
&lt;li>Simply select &amp;ldquo;&lt;span style="font-weight:bold;">PageLink&lt;/span>&amp;rdquo; on the drop down list which just next to the &amp;ldquo;&lt;span style="font-weight:bold;">Search&lt;/span>&amp;rdquo; button.&lt;/li>
&lt;li>Whole site check box: Specifies whether to provide results for the entire site, or just the page referenced by the query.&lt;/li>
&lt;/ol>
&lt;p>&lt;span style="color:rgb(255,102,0);font-size:85%;">You can ignore the Omit Link option for this feature.&lt;/span>&lt;/p>
&lt;p>Hope you find it useful!&lt;/p>
&lt;p>Related post:
&lt;a href="http://ourchiwai.blogspot.com/2009/03/backlink-checker-in-silverlight.html" title="BackLink Checker in Silverlight" target="_blank" rel="noopener">BackLink Checker in Silverlight&lt;/a>&lt;/p></description></item><item><title>BackLink Checker in Silverlight</title><link>https://sharechiwai.com/blog/2009-03-30-backlink-checker-in-silverlight/</link><pubDate>Mon, 30 Mar 2009 03:30:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-03-30-backlink-checker-in-silverlight/</guid><description>&lt;p>My second Silverlight application: &lt;span style="font-weight:bold;">BackLink Checker Beta 1&lt;/span>.&lt;/p>
&lt;p>You can use this application to check if other people has link o your website. It would be quite interesting to know if people are interest on you website, they properly will place a link on their site and recommend it to others. Of course, on the other hand if people think your website is crap, they could also place a link no their site and say..[Not to visit your website …etc.].&lt;/p>
&lt;p>Here it is some criteria on this BackLink checker.&lt;/p>
&lt;ol>
&lt;li>You should enter full URL of your website (with &lt;span style="font-weight:bold;">HTTP/HTTPS&lt;/span>)&lt;/li>
&lt;li>If you put a URL which contain specific page. Then the BackLink checker will only search for the back link for that particular page.&lt;/li>
&lt;li>It has 2 setting for you to specific the result.&lt;/li>
&lt;/ol>
&lt;ul>
&lt;li>&lt;span style="font-weight:bold;">Whole site&lt;/span> check box: Specifies whether to provide results for the entire site, or just the page referenced by the query&lt;/li>
&lt;li>&lt;span style="font-weight:bold;">Omit link&lt;/span> drop down: If specified, link will not be returned if they are from pages in the same &lt;span style="font-weight:bold;">Domain/Sub-domain&lt;/span> as the requested page.&lt;/li>
&lt;/ul>
&lt;p>This &lt;span style="font-weight:bold;">BackLink Checker&lt;/span> only return the links which is indexed by Yahoo, therefore it may not reflect the actually popularity of your website. Hope this can be improve on &lt;span style="font-weight:bold;">Beta 2&lt;/span>. = )&lt;/p>
&lt;p>Hope you find it useful.&lt;/p></description></item><item><title>7個步驟便可以在電腦上擁有屬於自己手寫字形</title><link>https://sharechiwai.com/blog/2009-03-29/</link><pubDate>Sun, 29 Mar 2009 03:29:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-03-29/</guid><description>&lt;p>今日想同大家介紹一個網頁&lt;/p>
&lt;p>想信大家都有聽過[&lt;span style="font-weight: bold;">物似主人形&lt;/span>]
亦都有人講過 見到你寫的字都估到你是過怎樣既人&lt;/p>
&lt;p>只需要簡單的&lt;span style="font-weight: bold;">7 個步驟&lt;/span> 便在電腦上擁有屬於自己手寫字形
這個網頁可以將你手寫的字轉做可幾由電腦打出來的字
只需要大概 15 分鐘便可以完成
看到這裡是否好想去這個網頁去做自己的字形呢.&lt;/p>
&lt;p>&lt;span style="font-weight: bold;">需要的工具有&lt;/span>
PRINTER(打印機)和 SCANNER(掃描器)
還有一支筆 (最好是黑色的幼或中厚 MARKER [標記筆?])&lt;/p>
&lt;p>&lt;span style="font-weight: bold;">有屬於自己的字形這裡就是所需的步驟了&lt;/span>&lt;/p>
&lt;ol>
&lt;li>首先到這個網頁 &lt;span style="font-weight: bold;">打印模板 (Print Template)&lt;/span>, 這裡有 2 個格式給你們 Print 出來, 一個字 PDF 另一個是個 IMAGE 檔
(我會建議 print PDF 檔)&lt;/li>
&lt;li>&lt;span style="font-weight: bold;">填寫&lt;/span>剛剛 print 出來的&lt;span style="font-weight: bold;">template&lt;/span>. (&lt;span style="color: #ff0000;">請記住跟著他的格式&lt;/span>) 網頁上的 example 可以參考
只需要填寫第一頁, 如果你想用其他的特別字你可以填寫埋第二頁岩&lt;/li>
&lt;li>需要 scan 同保存剛寫好的文字 template, &lt;span style="color: #ff0000;">請注意他們只支援幾下的檔案格式的 (.gif, .jpg, .jpeg, .png, .tif, or .tiff file)&lt;/span>&lt;/li>
&lt;li>上傳檔案和幫自己的字形命名&lt;/li>
&lt;li>預覽字形&lt;/li>
&lt;li>下載字形&lt;/li>
&lt;li>安裝字形&lt;/li>
&lt;/ol>
&lt;ul>
&lt;li>使用&lt;span style="font-weight: bold;">windows 的電腦&lt;/span>可以按&amp;quot;&lt;span style="font-weight: bold;">開始&lt;/span>&amp;rdquo;-&amp;gt;&amp;quot;&lt;span style="font-weight: bold;">控制台&lt;/span>&amp;rdquo;&lt;/li>
&lt;li>double click &amp;ldquo;&lt;span style="font-weight: bold;">字形&lt;/span>&amp;rdquo;&lt;/li>
&lt;li>選擇&amp;quot;&lt;span style="font-weight: bold;">安裝新字形&amp;hellip;&lt;/span>&amp;rdquo; -&amp;gt; 瀏覽到該檔案位置&lt;/li>
&lt;li>選擇 &amp;ldquo;&lt;span style="font-weight: bold;">Your font (TrueType)&lt;/span>&amp;rdquo;&lt;/li>
&lt;li>最後&lt;span style="font-weight: bold;">按&amp;quot;確定&amp;quot;&lt;/span> 便可&lt;/li>
&lt;/ul>
&lt;p>之後可以開啓文字程式選擇自己的字形看看 (E.G. Notepad)
會不會有一些親切感
哈哈&lt;/p>
&lt;p>以上就是所有的步驟了, 如果還是不太明白的話可以到官方網頁看&lt;/p>
&lt;p>由於我沒有 scanner 所幾沒有得嘗試造自己的字形&amp;hellip;
(當我找到 scanner 時我一定會 upload 我的字形上網的)
哈哈&lt;/p>
&lt;p>這個網頁的網扯是
&lt;a href="http://www.yourfonts.com/">http://www.yourfonts.com/&lt;/a>&lt;/p>
&lt;p>希望你喜歡
如果你想和其他人分享你的字形
歡迎你留言時留下你字形檔案的 URL&lt;/p>
&lt;p>Have fun.&lt;/p></description></item><item><title>Trend Micro HouseCall on Vista/ Free online scan for antivirus</title><link>https://sharechiwai.com/blog/2009-03-23-trend-micro-housecall-on-vista-free-online-scan-for-antivirus/</link><pubDate>Mon, 23 Mar 2009 03:23:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-03-23-trend-micro-housecall-on-vista-free-online-scan-for-antivirus/</guid><description>&lt;p>I have installed &lt;span style="font-weight: bold;">AVG Free&lt;/span> as anti-virus software on my laptop. I think they are quite good. Although it is quite safe, sometime I will use other online virus checker to scan my computer to ensure my computer is secure.&lt;/p>
&lt;p>I used to use &lt;span style="font-weight: bold;">Trend Micro HouseCall &lt;/span>to do a online scan on my computer, sometime it did find some Trojan and worms, but AVG did not notice it. But as soon as I upgrade my laptop to Windows Vista, HouseCall did not work again. On the previous version of HouseCall it did say it does not support Windows Vista. When I check it again today, it said it did now.&lt;/p>
&lt;p>My computer has not done any full virus scan for quite awhile, I think I should have a try now. I am not sure if it is something not quite right on my computer. I cannot get it work on my IE, it said &amp;ldquo;&lt;span style="font-size: 85%;">&lt;span style="font-weight: bold; color: #ff0000;">HouseCall is not available for your platform&lt;/span>&lt;/span>&amp;rdquo;&amp;hellip;&amp;ldquo;&lt;span style="color: #ff0000; font-size: 85%;">You can not use Trend Micro HouseCall on your machine because your processor type or your operating system are not supported.&lt;/span>&amp;rdquo; etc. (but on the front page, they did say they support vista and IE6 or above). I hope it is not something to do with my CPU which is “Centrino Duo
”.&lt;/p>
&lt;p>When i try again on Firefox, it seems to work. The different is I need to download an exe file instead of running it directly on browser(&lt;span style="font-weight: bold;">Firefox&lt;/span>).&lt;/p>
&lt;p>After I downloaded the &amp;ldquo;housecall66.exe&amp;rdquo; I just double click on it to execute it.&lt;/p>
&lt;p>When you started it, it will ask you to accept the &lt;span style="font-weight: bold;">terms and condition&lt;/span> agreement.&lt;/p>
&lt;p>Once you done that you need to choose a &lt;span style="font-weight: bold;">HouseCall Kernel&lt;/span> which his either a &lt;span style="font-weight: bold;">Brower base&lt;/span> or &lt;span style="font-weight: bold;">Java base&lt;/span>. Then you would need to download the plug-in, it may take awhile.
(I chose Browser Base)&lt;/p>
&lt;p>Then you will see a &amp;ldquo;&lt;span style="font-weight: bold;">Select Scan Options&lt;/span>&amp;rdquo; screen.&lt;/p>
&lt;p>&lt;span style="font-weight: bold;">Recommended scan&lt;/span> - only scan for malware, grayware, vulnerability and selected location. It will perform quicker&lt;/p>
&lt;p>&lt;span style="font-weight: bold;">Complete scan&lt;/span> - probably will scan for everything on you PC&lt;/p>
&lt;p>&lt;span style="font-weight: bold;">Customized Scan&lt;/span> - you can select what to scan.
It has one more option than Recommended Scan which is scan open network port
I think it would be quite useful to see if your computer has open a network port which could be attack by hacker.
If you have selected &amp;ldquo;&lt;span style="font-weight: bold;">Open Network ports&lt;/span>&amp;rdquo; it will pop up a message to inform you that the program will perform a port scan. (It is not a hacker attack (not this time))&lt;/p>
&lt;p>It takes about 4 hours to scan my computer, which has 160GB HDD, filled in around 110GB data&lt;/p>
&lt;p>My scan result&lt;/p>
&lt;p>Here it is the URL for Trend Micro HouseCall online scan.
&lt;a href="http://housecall.trendmicro.com/">http://housecall.trendmicro.com/&lt;/a>&lt;/p>
&lt;p>Hope your find it useful.&lt;/p></description></item><item><title>Jquery's Notes</title><link>https://sharechiwai.com/blog/2009-03-19-jquerys-notes/</link><pubDate>Thu, 19 Mar 2009 03:19:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-03-19-jquerys-notes/</guid><description>&lt;p>I am learning JQuery at the moment, and going to note down the error/mistake which I made while I am experimenting it.
Hope you would find it useful if you encounter the same issue, while you are using JQuery. Please correct me if my concept is&lt;/p>
&lt;p>wrong or you have a better solution.&lt;/p>
&lt;p>Why learn JQuery?
It is a JavaScript library/API/Frameworks allow you to develop website rapidly with nice feature that can work Cross-&lt;/p>
&lt;p>browser, CSS3 Compliant and Lightweight Footprint, you can found lots of plugin on-line which can save you a lot of time to&lt;/p>
&lt;p>develop you own method for some common feature.&lt;/p>
&lt;p>Here it is the official site for JQuery, where you can find JQuery to download download/tutorials/documentation and get the latest&lt;/p>
&lt;p>information about it.
&lt;a href="http://jquery.com/" target="_blank" rel="noopener">jquery.com&lt;/a>&lt;/p>
&lt;p>One thing that I would like to remind myself from this notes is. All the even/action E.g. Blur, Onchange&amp;hellip;etc should register on ready event. Of course, the most important thing is to reference the jquery.js between the HTML header tag.
E.g.&lt;/p>
&lt;pre>&lt;br />&lt;span style="color:rgb(0,153,0);">&lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> &lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> &lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> &lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> //Register on ready event &lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> $(document).ready(function() {&lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> $("#txt_Text").change(function(){&lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> alert($("#txt_Text").val());&lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> });&lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> });&lt;/span>&lt;br />&lt;br />&lt;span style="color:rgb(0,153,0);"> &lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);">
&lt;title>
Jquery Notes
&lt;/title>&lt;/span>
&lt;br />&lt;span style="color:rgb(0,153,0);"> &lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> &lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> &lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);"> &lt;/span>&lt;br />&lt;span style="color:rgb(0,153,0);">&lt;/span>&lt;br />&lt;br />&lt;/pre>
&lt;p>The example above will display an alert box when we change the focus on txt_Text input control.&lt;/p>
&lt;p>Happy coding.&lt;/p></description></item><item><title>Crystal report XI Service Packs 5 solve the PDF font size get reduced/smaller issue</title><link>https://sharechiwai.com/blog/2009-03-11-crystal-report-xi-service-packs-5-solve-the-pdf-font-size-get-reducedsmaller-issue/</link><pubDate>Wed, 11 Mar 2009 18:15:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-03-11-crystal-report-xi-service-packs-5-solve-the-pdf-font-size-get-reducedsmaller-issue/</guid><description>&lt;p>Today I just have a look at the documentation about Crystal report XI Service Packs 5, which has released at the end of Nov 2008.
They have mention the PDF generation issue which I posted few days ago about PDF font size get reduced after you export it from crystal report.&lt;/p>
&lt;p>If you have similar issue, the following description may be able to help you get around it.&lt;/p>
&lt;p>Hope you find it useful.&lt;/p>
&lt;p>&lt;span style="font-family:verdana;color:rgb(51,51,255);font-size:85%;">&lt;span style="font-weight:bold;">ADAPT00940675&lt;/span>&lt;br />Description:&lt;br />The registry key option ForceLargerFonts maintains the correct font size of reports that are exported to PDF format; however,&lt;br />this option may cause data to be truncated along the right-side margin.&lt;br />The problem is caused by a mismatch in the way that character widths are calculated between PDF and Microsoft Windows.&lt;br />New Behavior:&lt;br />This problem is resolved.&lt;br />To solve the problem, the PDF export engine has been modified to use an algorithm that positions characters precisely to&lt;br />prevent truncation, while still maintaining the correct font size. This algorithm is activated and controlled by two new registry&lt;br />keys:&lt;br />[HKEY_LOCAL_MACHINESOFTWAREBusiness Objects\Crystal ReportsExportPdf]&lt;br />&amp;quot;UsePrecisePositioningForText&amp;quot;=dword:00000001&lt;br />[HKEY_LOCAL_MACHINESOFTWAREBusiness Objects\Crystal ReportsExportPdf]&lt;br />&amp;quot;TruncationAdjustment&amp;quot;=dword:00000002&lt;br />The UsePrecisePositioningForText key enables the new functionality when it is set to 1. When this option is enabled, the&lt;br />ForceLargerFonts option is automatically enabled (to maintain correct font sizes in PDF exports), and any manual settings&lt;br />made to it are ignored. The TruncationAdjustment key controls a width calculation rounding function in the new algorithm and&lt;br />accepts values between 0 and 10 inclusively. The default value of 2 has been tested to sufficiently eliminate most truncation&lt;br />issues. If truncation still happens, users can increase the value.&lt;br />Known Limitations:&lt;br />When the UsePrecisePositioningForText key is enabled, exports to PDF format may take slightly longer, but by no more than&lt;br />10%. Also, the exported PDF document will increase in file size over the standard output, and Crystal reports will consume&lt;br />more GDI resources during the export.&lt;/span>&lt;/p></description></item><item><title>WordWrap on Crystal Report?</title><link>https://sharechiwai.com/blog/2009-03-07-wordwrap-on-crystal-report/</link><pubDate>Sat, 07 Mar 2009 03:07:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-03-07-wordwrap-on-crystal-report/</guid><description>&lt;p>I have received a task to convert the project handbook from Word Document into Crystal report. It does not sound difficult until I need to do some formatting and Layout.&lt;/p>
&lt;p>I had a problem on trying to make a field to display in Multi-line, instead of one line. And I am not able to file a word wrap function on Crystal Report. After spending some time on the web. Finally I find out how to do it.&lt;/p>
&lt;p>&lt;strong>Solution:&lt;/strong>&lt;/p>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>Select&lt;/strong> the &lt;strong>field(s)&lt;/strong> that you want to enable WordWrap.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Right click and select &amp;ldquo;&lt;strong>Format Field&lt;/strong>&amp;rdquo; OR &lt;strong>&amp;ldquo;Format Objects&amp;rdquo;&lt;/strong> (if you select more than 1 fields)&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Then in the &lt;strong>&amp;ldquo;Format Editor&amp;rdquo;&lt;/strong> Click on the &lt;strong>&amp;ldquo;Common&amp;rdquo;&lt;/strong> tab.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>You will see the screen shot similar as below.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>
&lt;a href="https://i1.wp.com/api.photoshop.com/home_453edadf42c44e2bba351fb5d2dfaeb1/adobe-px-thumbnails/fe5dd095128d47e39605022d415e78d6/256.jpg" target="_blank" rel="noopener">&lt;img title="Crystal Reports fields Format Editor" src="https://i1.wp.com/api.photoshop.com/home_453edadf42c44e2bba351fb5d2dfaeb1/adobe-px-thumbnails/fe5dd095128d47e39605022d415e78d6/256.jpg?resize=412%2C512" alt="Crystal Reports fields Format Editor" width="412" height="512" data-recalc-dims="1" />&lt;/a>&lt;/p>
&lt;ol start="5">
&lt;li>Then &amp;ldquo;Tick&amp;rdquo; the &amp;ldquo;Can Grow&amp;rdquo; check box and click &amp;ldquo;OK&amp;quot;&lt;/p>&lt;/li>
&lt;/ol>
&lt;p>&lt;/strong>6)After you done that you can save the Report and press &lt;strong>&amp;ldquo;F5&amp;rdquo;&lt;/strong> to preview the report.&lt;/p>
&lt;p>Hopefully you the field will be wrapped into next line.&lt;/p>
&lt;p>Good luck&lt;/p></description></item><item><title>TSQL Get Number of Decimal Place (on a field)</title><link>https://sharechiwai.com/blog/2009-03-04-tsql-get-number-of-decimal-place-on-a-field/</link><pubDate>Wed, 04 Mar 2009 08:08:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-03-04-tsql-get-number-of-decimal-place-on-a-field/</guid><description>&lt;p>Today I need to do a query to get all the record which has 3 decimal places on one of the field and process them by using different method.&lt;/p>
&lt;p>I am wondering if there any default TSQL function that I can use, so that it can save my time. Unfortunately, I could not find one, so that I decided to write my own function.&lt;/p>
&lt;p>Here it is the TSQL code that I used to retrieve the number of decimal place of a field.&lt;/p>
&lt;pre>&lt;code>–Example input value
DECLARE @DecimalValue FLOAT
SET @DecimalValue = 12.34567
–Declare a variable to store the result
DECLARE @NoOfDecimalPlace INT
SET @NoOfDecimalPlace = CHARINDEX(';', REVERSE(CAST(@DecimalValue AS VARCHAR(30)))) -1
–Return Number of decimal Place
SELECT @NoOfDecimalPlace
&lt;/code>&lt;/pre>
&lt;p>Here it is my User Define Function for get number of decimal place of a number field.&lt;/p>
&lt;/p>
&lt;p>
You can execute it by using the following SQL code
&lt;/p>
```
SELECT dbo. Get_NoOfDecimalPlace(0.123)
&lt;p>CREATE FUNCTION [dbo].[Get_NoOfDecimalPlace]
(&lt;/p>
&lt;p>@ValueToProcess FLOAT=0
)
RETURNS INT
AS
BEGIN
— Declare the return variable here&lt;/p>
&lt;p>DECLARE @NoOfDecimalPlace INT
SET @NoOfDecimalPlace = CHARINDEX(‘.’, REVERSE(CAST(@ValueToProcess AS VARCHAR(30)))) -1&lt;/p>
&lt;p>RETURN @NoOfDecimalPlace
END&lt;/p>
&lt;pre>&lt;code> Hope you found it useful.
&lt;/code>&lt;/pre></description></item><item><title>Deselect an Item on SilverLight</title><link>https://sharechiwai.com/blog/2009-02-25-deselect-an-item-on-silverlight/</link><pubDate>Wed, 25 Feb 2009 16:32:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-02-25-deselect-an-item-on-silverlight/</guid><description>&lt;p>Sometime you may find it useful to de-select an Item on ComboBox,
when you try to force a user to pick one from the list.&lt;/p>
&lt;p>Here it is the code sample to deselect a selected item on ComboBox in Silverlight.
[Just need to set the selected Index to -1]&lt;/p>
&lt;pre>&lt;code>ComboBox1.SelectedIndex=-1
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful.&lt;/p></description></item><item><title>SAP Business One 2007 System Requirement</title><link>https://sharechiwai.com/blog/2009-02-24-sap-business-one-2007-system-requirement/</link><pubDate>Tue, 24 Feb 2009 21:48:00 +0800</pubDate><guid>https://sharechiwai.com/blog/2009-02-24-sap-business-one-2007-system-requirement/</guid><description>&lt;p>I have been searching for SAP Business One 2007 System Requirement for quite a long time. I am not sure why I cannot find it.&lt;/p>
&lt;p>Unfortunately, the company I work, just upgrade their B12005 to B12007 and apparently B12007 only support MSSQL Server 2005 (If you are using MSSQL) and It will work on SQL 2000, but if you encounter any problem, SAP guy do not have to answer you question, as the system requirement did not say they support SQL 2000&lt;/p>
&lt;p>If you are looking for System Requirement for SAP Business One 2007.&lt;/p>
&lt;p>Here it is the link. Hope this can save you time.
B12007, SAP System Requirement.
&lt;a href="https://websmp105.sap-ag.de/~sapidb/011000358700000310652008E.pdf">https://websmp105.sap-ag.de/~sapidb/011000358700000310652008E.pdf&lt;/a>&lt;/p>
&lt;p>B12007 System Requirement, SAP System Requirement, B12007, B12005, SQL Server 2005&lt;/p></description></item><item><title>CodeIgniter does not work — CodeIgniter 不能 顯示 $name入面的內容</title><link>https://sharechiwai.com/blog/2008-08-12-codeigniter-does-not-work-codeigniter/</link><pubDate>Tue, 12 Aug 2008 01:00:07 +0800</pubDate><guid>https://sharechiwai.com/blog/2008-08-12-codeigniter-does-not-work-codeigniter/</guid><description>&lt;p>今日在學習&lt;span style="color:#339966;">CodeIgniter &lt;/span>時
嘗試隨著 &lt;span style="color:#339966;">CodeIgniter&lt;/span>的教學建立一些 Sample Website
但不知道為什麼用 &lt;code>&amp;lt;?=$name?&amp;gt;&lt;/code>&lt;/p>
&lt;p>不能顯然 &lt;span style="color:#339966;">$name &lt;/span>的內容, 最後發現原來是 一些 Config 的問題&lt;/p>
&lt;p>&lt;strong>解決方法:&lt;/strong>
打開你的 CodeIgniter 檔案夾
到&lt;span style="color:#339966;">systemapplicationconfig&lt;/span>
開啟: &lt;span style="color:#339966;">config.php&lt;/span>
之後找
&lt;span style="color:#339966;">$config[&amp;lsquo;rewrite_short_tags&amp;rsquo;]&lt;/span>
如果設定為FALSE 的話
就會用不到這個功能的
只要把設定改到好像下面一樣便可
&lt;span style="color:#339966;">$config[&amp;lsquo;rewrite_short_tags&amp;rsquo;] = TRUE;&lt;/span>&lt;/p>
&lt;p>Hope you find it useful&lt;/p></description></item><item><title>PHP Framework CodeIgniter- 一個挺好用的 PHP Framework</title><link>https://sharechiwai.com/blog/2008-08-10-php-framework-codeigniter-php-framework/</link><pubDate>Sun, 10 Aug 2008 00:51:21 +0800</pubDate><guid>https://sharechiwai.com/blog/2008-08-10-php-framework-codeigniter-php-framework/</guid><description>&lt;p>最近開始學習 CodeIgniter&lt;br>
CodeIgniter 是一個挺好用的 PHP Framework&lt;br>
可以令你開發PHP 網頁的速度更快&lt;br>
很多時候在開發PHP 網頁 出現的問題 大部份用這個Framework 都可以解決&lt;br>
有時間可以嘗試學習..使用這個Framework&lt;/p>
&lt;p>大家可以到以下網址Download 和使用 CodeIgniter Framework&lt;br>
&lt;a href="http://codeigniter.com/">http://codeigniter.com/&lt;/a>&lt;br>
Have Fun&lt;/p></description></item><item><title>How to run reactjs in different port</title><link>https://sharechiwai.com/blog/2021-01-30-create-react-app-start-in-different-port/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sharechiwai.com/blog/2021-01-30-create-react-app-start-in-different-port/</guid><description>&lt;p>最近用了&lt;code>NodeJs Express&lt;/code> 來做 Web App 的 Backend 用左 port &lt;code>3000&lt;/code>&lt;br>
而&lt;code>create-react-app&lt;/code> 既 default port 又係 &lt;code>3000&lt;/code>&lt;br>
怎樣可以改變&lt;code>create-react-app&lt;/code> 既 port 呢&lt;/p>
&lt;p>&lt;strong>解決方法&lt;/strong>:
十分簡單&amp;hellip; 我們只需要在 &lt;code>package.json&lt;/code> 上既 scripts section&lt;br>
&lt;code>start&lt;/code> 上加上 &lt;code>set PORT=[PORT_YOU_WANTED]&lt;/code> 便可&lt;br>
e.g.&lt;/p>
&lt;pre>&lt;code class="language-json"> &amp;quot;scripts&amp;quot;: {
&amp;quot;start&amp;quot;: &amp;quot;set PORT=9000 &amp;amp;&amp;amp; react-scripts start&amp;quot;,
&amp;quot;build&amp;quot;: &amp;quot;react-scripts build&amp;quot;,
&amp;quot;test&amp;quot;: &amp;quot;react-scripts test&amp;quot;,
&amp;quot;eject&amp;quot;: &amp;quot;react-scripts eject&amp;quot;,
&amp;quot;lint&amp;quot;: &amp;quot;eslint . --ext .js --ext .jsx --ignore-path .gitignore --cache&amp;quot;
},
&lt;/code>&lt;/pre>
&lt;p>Hope you find it useful
&lt;a href="https://stackoverflow.com/questions/750172/how-to-change-the-author-and-committer-name-and-e-mail-of-multiple-commits-in-gi">https://stackoverflow.com/questions/750172/how-to-change-the-author-and-committer-name-and-e-mail-of-multiple-commits-in-gi&lt;/a>&lt;/p></description></item></channel></rss>