2014/12/27

Ubuntu Install Oracle Java via PPA

sudo add-apt-repository ppa:webup8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

You can find the latest version available from the website:
http://www.ubuntuupdates.org/ppa/webupd8_java

2014/12/24

[C++] static_cast & dynamic_cast

以往都用(int) variable來強迫轉型,新的C++裏頭似乎比較鼓勵用static_cast
dynamic_cast在物件轉型時會檢查是否由父類別轉為子類別,接著才進行轉換

Reference:
http://windsplife.blogspot.tw/2010/09/cstaticcast-dynamiccast-reinterpretcast.html

2014/12/23

Installing Virtualbox Guest Additions in Ubuntu

Take VirtualBox 4.3.20.96996 for example: 


sudo -i

cd /media/username/VBOXADDITIONS_4.3.20_96996/

./VBoxLinuxAdditions.run


p.s
Change the username to yours, and make sure of the version.

2014/12/11

[Visual C++] MySQL Port Setting

connectstr = "Network Address="+server+";"+"Port=3307;"+"Persist Security Info=no;"+"User Name="+userID+";"+"Password="+password;

2014/11/13

[C++] string大小寫轉換 (透過transform)

以前做大小寫轉換時候,會用tolower()、toupper()來做 (或者直接利用ASCII來加減)
比較麻煩的是要寫一個迴圈,一次一個字元來轉
剛剛有學弟問字串轉換的問題,順便google了一下,發現用transform只要一行就好
記得要#include <algorithm>


2014/11/02

Visual C++ 各種字串之間的轉換方法

Reference:
http://www.cnblogs.com/oomusou/archive/2008/07/24/cpp_string_net_string.html

要將C++ STL string轉成Visual C++的^String
可以透過gcnew()的參數來進行初始化

ex:

string data = "Hello World";
String ^str = gcnew String(data.c_str());

注意gcnew的參數需要是C-Style string,所以透過.c_str()做轉換