原创 EPIGRAMS IN PROGRAMMING

1. One man's constant is another man's variable. 2. Functions delay binding; data structures induce binding. Moral: St

原创 A Note On Practice And Persistence

來自 《Learn Python The Hard Way》 While you are studying programming, I’m studying how to play guitar. I practice it ever

原创 sublime text 安裝插件的方法

雖然很簡單,還是記錄下來。 ST2有很多不錯的插件,特別是發佈在Github上的 例如https://github.com/revolunet/su

原创 typedef 函數指針的用法

在網上搜索函數指針,看到一個例子。開始沒看懂,想放棄,可是轉念一想,這個用法遲早要弄懂的,現在多花點時間看懂它,好過以後碰到了要再花一倍時間來弄懂它。其實很多時候都是這樣,如果每次到難一點的內容,總想着下次我再來解決它,那就永遠也學不

原创 有關程序的50個至理名言

1. "There are two ways of constructing a software design. One way is to make it so simple that there are obviously no

原创 gdb常用命令

調用gdb編譯需要在cc後面加 -g參數再加-o; 那麼可以使用下面這些命令方便地使程序一直執行到swap()的入口: until 13 until swap until swapflaw.c:13 until swapfl

原创 makefile demo

CC = g++ CFLAGS += -Wall -fPIC CFLAGS += $(OPTFLAGS) SRCS += $(wildcard ./src/*.cpp) HEADERS += $(wildcard ./

原创 C 語言開發

__FILE__ __LINE__ #ifndef ... #define ... #endif 多用結構體,有時候方便 註釋格式–固定的 time_t 這裏的’t’ 指的是type

原创 Longest Common Prefix --leetcode

思路一 思路:先查找最短的字符串,賦值給ret,然後從第一個字符串開始兩兩比較,比較ret與字符串數組裏的公共字串。返回最後結果。 代碼: class Solution: # @param {string[]} strs

原创 Regular Expression Matching--leetcode

解法一 思路: 寫的第一個版本,知道是動態規劃,但是不夠簡潔,因爲動態方程 根本就沒有寫明白!!!!有點暴力的意思,其中還用到了剪枝操作 代碼: class Solution: # @param {string} s

原创 Longest Palindromic Substring--leetcode

我的解法v1: 思路:查找字符串中aa或者aba類似的字符字串,然後開始往兩邊拓展 代碼: class Solution: # @param {string} s # @return {string} def

原创 String to Integer (atoi) -- leetcode

天了嚕,條件真多 大體題意: The function first discards as many whitespace characters as necessary until the first non-whitespace

原创 AppleScript開機自動登錄ChinaUnicom

用Automator裏的AppleScript編寫的應用程序,其中主要是一行代碼,主要作用是,用root權限執行一個腳本,腳本可以自動檢測斷網並進行重新連接! on run {input, parameters} do shel

原创 4th Median of Two Sorted Arrays -- leetcode

我的解法 思路:比較列表nums1中間和nums2中間的數,如果第一個列表小於第二個列表,那麼不可能包含中間數的一串子序列總共有兩串,nums1中間數前面的一串和nums2中間數後面的一串,比較長短,刪除比較短的那一串(每次刪掉其中一串

原创 lz77算法 例子

摘自 https://en.wikipedia.org/wiki/LZ77_and_LZ78 Example[edit] The calculation of the LZ77-based factorization of the