Posts

Showing posts from November, 2009

google job

雖然這輩子沒機會,但還是看一下一流公司的SE水準好了xD   期許自己不久的某一天可以達到XD Software Engineer - Mountain View This position is based in Mountain View, CA. The area: Software Engineering Google's software engineers develop the next-generation technologies for which we've become world-renowned. In addition to revolutionizing search technology, we use our world-class programming skills to innovate in a number of other areas as well. Our projects include working on advanced information-retrieval algorithms, massive scalability and storage solutions, and large-scale applications that enrich the user experience. We also work extensively on networking systems, advertising systems and complex transaction systems in consumer applications. The role: Software Engineer Software Engineers have a passion for solving complex and interesting problems. Google is much more than search, and our mission has much greater scope. To handle information at the scale of the web requires ideas from just about every area of computer

[network] memcached

memcached 狠常聽到的一個玩意,從  wiki   得知它是一使用32bit的循環冗餘檢察(CRC-32)計算key-value,並將資料分散在各台主機上的一個分散式系統。這樣講有看沒懂... 僅知道  1. in-memory  2. key-value google查了後覺得較滿意的解釋是 當client端連到遠端server時, 若該server架有memcached service, 則在連上memcached後, memcached會給予它一個key, 用來map到它所需要存取的objects. 而這些objects其實是存在後端數台主機裡頭, clients借由key可以馬上知道object在哪裡! (唉  還是要白話點我才看得懂Orz...) 更白點就是在memory存一張巨大的hashtable, client藉由將key做hash就可以得知它需要的data存在哪台主機。 不過wiki上的範例真是簡潔扼要 = = function get_foo (int userid) { result = db_select("SELECT * FROM users WHERE userid = ?", userid); return result; } 加上memcached的快取機制後: function get_foo (int userid) { result = memcached_fetch("userrow:" + userid); if (!result) { result = db_select("SELECT * FROM users WHERE userid = ?", userid); memcached_add("userrow:" + userid, result); } return result; } 剩下的隨機記錄一下 1) Opensource, 是BSD license 2) 由於安全性較差,通常掛在防火牆內 3) wikipedia, LiveJournal, Digg, Youtube, Facebook 都有使用此技術 4) 再更新的時候, 為了解決cac

[English] Words about reading

1. paperback 2. Movie tie-in       a book or frequently a trade paperback or hardcover that has a direct relationship to a specific film. Usually the cover of the book is the photography of the movie's stars, and the slogans that indicating directly to the specific movie. 3. dust jacket / dust wrapper / dust cover      the dust jacket of a book is a detachable outer cover, that is often made of paper and printed with texts and illustrations. 4. I couldn't put it down / read it cover to cover 5. whodunit       a novel, a  film or a play which is about a murder but it doesn't tell you who the murder is until the end. 6. chic lit      a novel which is specifically used to denote a women's fiction. In which it often addresses the issues about the modern women often humorously and lightheartedly. 7. encyclopedia 8. yearbook      published by the graduate class in high school or college, containing the photographs of the class members and commemorating school activities 9.  

發佈軟體要注意的事情

1.GPL 2.即便不是GPL, 也需要附上所使用到的Opensource License.txt 3.考慮使用NSIS發佈 4.注意redistribution 及 商業用途的問題 5. windbg

[python] tuple to list, unicode的處理

1)在使用 *args時需要加入其他參數, 發現他是tuple type, 可是tuple無任何method, 所以需要將其轉為list, 再轉回 tuple a = ('abc', 334, 21.21) b = list(a) b.append('glob') a2=tuple(b) 2) python 的 default encoding 是 unicode (記得是2.4以後統一的規格) 這裡 有詳細的介紹. unicode 可以算是其他編碼互換的中間碼, 其格式是 上面說得很清楚, 有分成4 digits 或 8digits的unicode, 缺項補 0 The \u escape sequence is used to denote Unicode codes. This is somewhat like the traditional C-style \xNN to insert binary values. However, a glance at the Unicode table shows values with up to 6 digits. These cannot be represented conveniently by \xNN, so \u was invented. For Unicode values up to (and including) 4 digits, use the 4-digit version: \uNNNN Note that you must include all 4 digits, using leading 0's as needed. For Unicode values longer than 4 digits, use the 8-digit version: \UNNNNNNNN Note that you must include all 8 digits, using leading 0's as needed. 一般其他 encoding-format 轉 unicode的方式 afterencoded_str = unicode(preencoded_str, format) 若要知道欲轉換的字串是哪種編碼可以使用 univer

股票評價(Stock Valuation) - 股利折現模型

Image
這邊討論的是股價(普通股)的評價,包括股利折現模型、成長機會模型與本益比模型。 1. 股利折現模型( The Dividend Discount Model, DDM ) 股票的現金流可以分為兩個部分:股利的收入及股價的變動 先來定義 Pt:第t期的每股股價 Dt:第t期的每股股利 Rs:股利折現率(或稱為股東的必要報酬率) 當下的股票現值P0 =  D1/(1+Rs)  + P1/(1+Rs) ... (1) 一年後的股票現值 P1 = D2/(1+Rs) + P2/(1+Rs) ... (2) 將(1)代入(2)可得  P0 = D1/(1+Rs) + D2/[(1+Rs) ^2] + P2/[(1+Rs)^2] 可推得 P0 = D1/(1+Rs) + D2/[(1+Rs) ^2] + D3/[(1+Rs)^3] + ... =   SIGMA(t=1, infinite)  D1/[(1+Rs)^t] 常見的股利折現模型有三種, a. 零成長型(Zero Growth) , 即D1=D2=D3=...    利用等比級數公式, a0=D1/(1+Rs), r= 1/(1+Rs)  =>  p0 = D1/Rs      [*這跟永續年金的結果相同] b. 固定成長(Constant Growth) , 即股利按固定比率g成長, D2=D1*(1+g), ...    => P0 = D1/(Rs-g)    b.1這個模型又稱為戈登模型(Gordon Model)或股利成長模型(dividend growth model)         因為這個模型提供我們很好的直覺:         b.1.1 當公司宣布年底股利增加, D1上升, P0上升 b.1.2 當公司盈餘成長, g上升, P0上升         b.1.3 當資本或風險提升,Rs上升, P0下降    b.2固定成長型的資本利得率=股利成長率, g = (P0-P1)/P0 c. 超成長型(Supernormal or Nonconstant Growth) , 即一開始公司有高成長率,幾年後才回到一般成長。 EX. yahoo公司預期未來四年有高度成長25%, 之後皆以8%穩定成長, 其折現率20%. 今發行4塊股利: 這邊P0需分為兩個部分, 一為超成長部分及穩定成長部分.

[python] murmur

這篇應該算是抱怨文吧。 開始使用 twisted 寫 network programming 應該有兩個月了,網路論壇裡大家都認為他很強大一定要學一下,但沒想到為了它我這幾個月熬了好幾次夜,常常被裡頭的東西搞得莫名其妙。 首先從參考文件講起... 他的API 說明文件有夠鳥,寫的不知所云(應該是說,twisted作者有他自己的命名,beginner又無法從名稱了解他到底要沖煞小....  這也跟它是even-driven有關係吧)  常翻箱到櫃才能找到你要的東西... 既然網路文件無效,那就買本書來看吧!?  O'Reilly 是有出一本twisted的書,但那本不提也罷,沒什麼內容,不過還是最好手邊要有一本(因為它可是唯一一本twisted的書 /囧\) 還有就是那個mailing lists 討論群的東西倒是值得去看看。 結論是什麼? 結論就是,想要學好twisted嗎?  很抱歉沒有捷徑(還是有啦,找個懂的人來教你...或是幫你寫XD) 快把API & O'Reilly 的書啃就對了。 有人說看BT source codes對學twisted有用啦,可是... 前提是你本來就懂twisted(這不是廢話嗎= =+) 最後的一句話:對於twisted,懂得人不看書也懂,不懂的人看完書也還是不懂....  mud

[財務管理] 利率與債券

這邊主要是講解利率(Inernet rate)與債券(Bonds)的觀念. 首先, 了解利率要先了解兩種關係 資金供給者 = landor = Savor = Investor 資金需求者 = Borrower = Firm 利率的構成要素有六: 1. 實質利率 (real internet rate, r*)     即不考慮物價影響(通貨膨脹)的利率. 主要由消費的時間偏好(對消費者而言, 延後消費可得較高利息)及實質資產(借錢的人借錢從事生產, 希望借越多利息越低)所決定。 2. 通貨膨脹溢酬 (Inflation Premium, IP)    指存款人因物價上漲導致未來購買能力下降所要求的補償。    ex. 存100塊,  利率r* = 10%, 一年後可得 110.          若IP=15%, 則一年後只剩下 110/(1+15%) = 95.65<100  比原來還少, 此時存款人會要求補償, 稱為溢酬Premium, 就是要貼錢啦。 所以, 考慮通貨膨脹溢酬而決定的借貸利率, 稱為名目利率(Normal Interest Rate, R) R = r* + IP. (這是比較粗略的算法, 精確的名目利率稱為費雪方程, (1+R) = (1+r*)(1+IP), I don't know why...) 3. 違約風險溢酬 (Default Risk Premium, DP)   借錢的人無法按時償還本金或利息, 都稱為違約(default). 4. 流動 性風險溢酬 (Liquidity Premium, LP)   存款者對於流動性差的標地要求補貼, 就稱為LP.  流動性就是指變現的能力. 5. 到期日風險溢酬 (Maturity Premium)   存款到期日越長, 經濟狀況越難估測, 投資風險就越大. 6. 稅賦溢酬 (Taxability  Premium, TP) 綜合六項, 名目利率(Normal Interest Rate)  R = r* + IP + DP + LP + MP + TP 至於債券Bonds, 債券就是資金需求者(債務人, 債券發行者)給資金的提供者(債權人, 債券提供者)在資本市場上發行的有價證券(Security). 像是公司發行的,稱為公司債(Corporate Bonds). 政府發

[python] 不錯的玩意, pickle與 shelve

最近在python裡頭做 xml 與 dictionary 的格式轉換,又需要讀/寫入 database,真的搞的我暈頭轉向又不好維護。 今天看到一本好書 core python programming   提到關於 file i/o, 原來python 有些 persistent storage modules就是專門處理這些問題,像是pickle與marshal。 主要是介紹pickle, 因為marshal的差別在於marshal僅支援簡單的types(number, sequence, mapping...) 這邊說錯了,marshal主要是處理序列化的對象(serialized object), 特別是python的 pseudo-compiled code, 即 .pyc. 而一般支援 persistence module in python 主要是指pickle跟shelve 至於什麼叫做 object serialization, 就是將複雜的物件轉為binary type或 text 物件的過程,為的是希望能夠透明性的儲存 python object 而不失去其身分或類型等訊息。 Pickle 可將python data type轉為bytes streams(使用dumps()),亦可從重新組回原data types(使用loads()),例如 >>> import pickle >>> x = {'name':'glob', 'info':(27, 'single', 'student')} >>> xp = pickle.dumps(x) >>> y = pickle.loads(xp) >>> y {'info': (27, 'single', 'student'), 'name': 'glob'} *亦可以用 dump(x, f)   f為file descriptor 寫入file中。 shelve 則是使用anydbm(一種DBM)來進行pickles

新開張囉

我覺得每次在 bbs 寫讀書心得太累了 以後改在這裡發布好了!!! 假又~