4/28/2008

details of inheritance in Java

Everyone knows everything is object in Java. sometime if you inherit or create an object, you must keep the general contracts, else you may make bugs. equals(), hashCode(), clone(), finalize(). those are non-final methods, we will discuss below.
  1. Override equals() method is simple, but it will also make mistakes, the best solution is don't override it possibly. if you must override it must keep the below conditions.
    • Reflexive : for all x, x.equals(x) must true.
    • Symmetric : for all x, y, if x.equals(y) is true, then y.equals(x) is true.
    • Transitive : for all x, y, z, if x.equals(y) and y.equals(z) are true, then x.equals(z) is true.
    • Consistent : for all x, y, x.equals(y) == y.equals(x) is forever true.
    • Non nullity : x.equals(null) is false at all time.
  2. hashCode() be override coincide with equals(). if you don't do that, you violate the constracts and can't work normally with HashMap, HashSet, HashTable... If and only if x.equals(y) is true, then x.hashCode() must equal y.hashCode(). sample code: Map m = new HashMap(); m.put(new MyObject("hihi"), "lui"); m.get(new MyObject("hihi")); Usually you believe "m.get(new MyObject("hihi"))" will return the String "lui", but it also return null. it's because the two MyObject is the same in our opinion, but is not the same in program, it has different hashCode, so, for the same object must has the same hashCode.
  3. clone() method is like create a object, you must know clone() is not deep copy, so, it may share member data in two objects, but it isn't you want. So, one solution is don't support clone() method, others is make clone() as like as copy constructor in C++.

4/27/2008

Android

The Android platform is a software stack for mobile devices including an operating system, middleware and key applications. Developers can create applications for the platform using the Android SDK. Applications are written using the Java programming language and run on Dalvik, a custom virtual machine designed for embedded use which runs on top of a Linux kernel.

android documentation

The core Android APIs will be available on every Android phone, but there are a few APIs which have special concerns: the "optional" APIs.

These APIs are "optional" for two reasons. First, they're optional in the sense that you don't need to use them. For example, you can't write an application without using the Activity and Intent APIs, but your application may not need to know where the user is, and so you may not need the Location-Based Services API. In this sense, the LBS API is optional where the Activity API is not.


  1. Location-Based Services
  2. Media APIs
  3. 3D Graphics with OpenGL
  4. Low-Level Hardware Access

Google APIs and Services in Android
  1. MapView
  2. P2P Services Using XMPP

4/24/2008

PageRank

google這麼好用大多是因為它準確率高
也就是PageRank這個方法

簡單講就是每個網頁都有自己的分數 網頁本身的每一個link都會將自己的分數影響別的網頁
所以網頁的排名就是自身的分數加上所有別人link到本網頁的分數
被link越多rank越高 被高rank的網頁link到rank升更快

一般一個新網頁出來 google大約兩個內會找到 然後建index
然後每隔一段時間更新一次

所以它的方法主要分兩個部份  一內容分析 二link分析

內容分析
google會看meta title來了解這是一個大概甚麼網頁 會看keyword的density  會看keyword在甚麼tag中 字型大小 顏色... 還有很多很多
所以說並不是keyword多就高分 google也一直修改它的判分方法 方向是以人為主
使用者想看到甚麼資料 所以meta tag或字型大小為0的內容影響極少

link分析
主要是每個網頁都有個PR值 值越高越重要 被PR值高的網頁連結到 本身增加的分數
就比較多 想法是認為PR值高的網頁認為你的網頁有用 就像被大人物推薦一樣
但是 這樣網頁管理者就會想瘋狂的相互連結來增加rank
google當然沒這麼笨
一個網址的向外連結會將分數share 一個PR值高的網頁只有一個link連結網頁A
和有100個link其中只有一個link連結網頁A是有差別的

以上都是對google的初步了解
google單單在07年 一年中更新了四百多次
現在的計算考慮到甚麼程式已經不知道了

4/22/2008

世界末日

回到家發現我的巧克力冰琪淋在冰箱裡溶掉了

幹 好傷心喔

溶掉的冰琪淋要怎麼吃呀

google了一下知道冰箱不冷很有可能是電風扇被冰住了

放電打開讓它掉冰就可了

可是 冰箱沒電我冰琪淋溶得更快呀

幹幹幹

4/20/2008

研究 moiton planning 的人

國外motion planning的幾位大人物

Jean-Claude Latombe
Mark Oversmars
Steven M. LaValle
Thierry Fraichard
James Kuffner

motion planning的問題目前可以走的方向大概有:
robot path planning --- environment
           multi-goal
           multi-robot
           visibility
           path quality
humaniod animation --- kinematic (inverse, forward)
           controller
           behavior planning
           composition motion
navigation
manipulation
collision detection

很明顯的 我比較知道第一二個領域 第三四五還不是很熟

4/19/2008

SBL 第五戰

幹 這場太high了
兩隊一直反超前 大家的三分球像不好錢的
公主鼎也進一顆
陳世念這個裕辣三分球100%
台啤輸了也好
這樣明天還有得看

終生學習

小時候大家都會說 讀大學讀完大學生活就很好了
過了沒多久就改為讀完碩士生活就很好了
電影據裡都會演某某某國外讀完回來就是某公司的高層。。。

這些都是長輩們的幻想

越往上爬越發現腳步停不下來
因為你就變成一部發動機 發動後可以一直往前走 只要你不停下來多遠都能走到
一旦停下來就再也不會移動了

不管在公司在學校或其他地方
一旦失去動力就會變得庸碌 只有不斷的進步 就會找到人生的意義