EvoTalk

07 六月, 2010

SSH Connect Virtualbox Guest

Posted by: asd In: 科技新知| 軟體使用 ()

到 dos 下,切換至 VirtualBox\app32
下command

CODE:
  1. VBoxManage setextradata YourUbuntuName  "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP
  2. VBoxManage setextradata YourUbuntuName  "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort"  2222
  3. VBoxManage setextradata YourUbuntuName  "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22

YourUbuntuName 為安裝時的自訂系統名稱
重啟VirtualBox,用 putty 連上 127.0.0.1 : 2222

10 五月, 2010

Install QT for VS2008 on WinXP

Posted by: asd In: C++| Code Snippet| 程式設計 ()

1. 直接下載已編譯好的binary檔 QT binaries for windows,若要安裝其它較高版本 for vs2008,可到 qt-msvc-installer下載。

2. 解壓縮後,在環境變數User Variables加入 QTDIR=C:\Qt-4.4.3 及Path=C:\Qt-4.4.3\bin;.........

3. 安裝 QT for vs2008 addin

4. 在C:\Qt-4.4.3目錄下製作兩個文字檔「configure.cache」、「.qmake.cache」,這兩個檔是build source code產生的
configure.cache

CODE:
  1. -platform
  2. win32-msvc2008
  3. -debug-and-release
  4. -platform win32-msvc2008 -debug-and-release

.qmake.cache

CODE:
  1. QMAKE_QT_VERSION_OVERRIDE = 4
  2. OBJECTS_DIR     = tmp\obj\debug_shared
  3. MOC_DIR         = tmp\moc\debug_shared
  4. RCC_DIR         = tmp\rcc\debug_shared
  5. sql-plugins    += sqlite
  6. styles         += windows plastique cleanlooks motif cde
  7. imageformat-plugins += gif tiff jpeg
  8. CONFIG         += dist-config large-config medium-config minimal-config small-config full-config build_all debug incremental create_prl link_prl depend_includepath QTDIR_build
  9. QT_BUILD_PARTS  = libs tools examples demos docs translations
  10. QMAKESPEC       = C:\Qt-4.4.3\mkspecs\win32-msvc2008
  11. ARCH            = windows
  12. QT_BUILD_TREE   = C:\Qt-4.4.3
  13. QT_SOURCE_TREE  = C:\Qt-4.4.3
  14. QMAKE_MOC       = $$QT_BUILD_TREE\bin\moc.exe
  15. QMAKE_UIC       = $$QT_BUILD_TREE\bin\uic.exe
  16. QMAKE_UIC3      = $$QT_BUILD_TREE\bin\uic3.exe
  17. QMAKE_RCC       = $$QT_BUILD_TREE\bin\rcc.exe
  18. QMAKE_DUMPCPP   = $$QT_BUILD_TREE\bin\dumpcpp.exe
  19. QMAKE_INCDIR_QT = $$QT_BUILD_TREE\include
  20. QMAKE_LIBDIR_QT = $$QT_BUILD_TREE\lib

Tags:

登入webhostingpad ftp 時,顯示「421 Sorry, cleartext sessions are not accepted on this server」
修改 flashfxp 內的選項 Connection Type 為 FTP using Explicit SSL (Auth TLS),再次登入即可。

也可以用 curl 上傳

CODE:
  1. @echo off
  2. SET FILE=%1
  3. IF NOT DEFINED FILE GOTO USAGE
  4. echo "uploading the file %FILE%, please wait..."
  5. curl --progress-bar  -g -k --ftp-ssl -3 -T%FILE% -uuser:passwd ftp://123.111.1.1
  6. EXIT /B 0
  7. :USAGE
  8. ECHO Usage: upload.exe file

Tags:

03 二月, 2010

C# Call Method With String Name

Posted by: asd In: C++| Code Snippet ()

以變數名稱當作函式名稱來呼叫
參考:Call Static Method With a String Name in C#
帶參數的方法參考: 谁能讲解一下c# 中关于MethodBase Invoke方法

CODE:
  1. System.Text.Encoding utf_8 = System.Text.Encoding.UTF8;
  2.  
  3. // This is our Unicode string:
  4. string s_unicode = "abcéabc";
  5.  
  6. // Convert a string to utf-8 bytes.
  7. byte[] utf8Bytes = System.Text.Encoding.UTF8.GetBytes(s_unicode);
  8.  
  9. // Convert utf-8 bytes to a string.
  10. string s_unicode2 = System.Text.Encoding.UTF8.GetString(utf8Bytes);
  11.  
  12. MessageBox.Show(s_unicode2);

reference : C# to convert from utf-8 bytes to string and back

Page 1 of 8812345...Last »