原创 我的友情鏈接

51CTO博客開發

原创 0-1 揹包

問題描述:給定一個載重量爲C的揹包,同時有N個物品,其重量分別爲Wi(1<=j<=n),價值爲Vj(1<=j<=n)。要求:把物品裝入揹包,並使包內物品價值最大。解結構分析:由於每個物品只有一件,同時,還有具體的揹包的最大容量C的限制。通過

原创 我的友情鏈接

51CTO博客開發

原创 啓動AVD時log提示“emulator-X disconnected! Cancelling 'X activity launch'!”

見stackoverflow的一個回答:http://stackoverflow.com/questions/2160454/helloandroidemulator-5554-disconnected-cancelling-com-exa

原创 calledfromwrongthreadexception only the original that created a view hierarchy can touch its views

android.view.viewrootimpl$calledfromwrongthreadexception only the original that created a view hierarchy can touch its v

原创 啓動模擬器後一直顯示“Waiting for HOME ('android.process.acore') to be launched...”

我啓動模擬器之後,控制檯一直顯示Waiting for HOME ('android.process.acore') to be launched...後來發現是因爲device和image文件不匹配的問題。之前的CPU/ABI選是的X86

原创 C++的非靜態成員函數

清楚以下幾點:C++的類的非靜態成員是共享的,即所有相同類的對象共享的是同一份非靜態成員函數。即類的非靜態成員函數是不依賴於對象存在的。的編譯器在處理非靜態成員函數時,會在其參數列表中添加一個this指針,this指針指向的便是具體調用該非

原创 java.lang.RuntimeException:Can‘t create handler inside thread that has not called Looper.prepare()

用handler時,出現這個異常。handler的創建需要在主線程中,當在子線程中創建handler時會報這個錯誤我是在子線程中創建Toast時報錯的參考http://blog.csdn.net/stonecao/article/detai

原创 C++的多態機制

明確以下幾點:多態的實現是依靠虛函數表,程序需要額外的查詢虛函數表的開銷。C++的構造函數中可以調用虛函數,說明虛函數表的產生是在構造函數調用之前。虛函數表的建立是在編譯時(Compile-Time)。看一個例子:#include <ios

原创 Android AVD出現"No system images installed for this target"

新建AVD時出現以下問題:"No system images installed for this target" 無法創建AVD本以爲是映像文件沒有下載安裝,打開SDK manager發現:映像文件已經安裝。這就迷糊了。網上的解決方法主要

原创 C++的數據成員訪問方式

看一個例子:#include <iostream> using namespace std; class A { public: int m1; int m2; int m3; void fun(){cout