EragonJ – A humble navigator

About EragonJ | About this blog

Archive for December, 2009

[EatMe] 食我部落

leave a comment

EatMe.Tw
和Ijs….等共十個人一起合作的工作室網站,
身為技術部的一員,要實作功能的感覺真的只能說,
很妙。

Written by EragonJ

December 18th, 2009 at 9:49 am

Posted in Eatme

Tagged with , ,

[PKU]1503 Integer_Inquiry

leave a comment

我寫到快殺人了…

其實這題我一直都寫好了,但是就一直WA,最該死的就是我不知道問題在哪…也看了很多討論,但是就不知道錯在哪,有心的幫幫我一下吧..


PKU的測試位置(要帳號)

Written by EragonJ

December 11th, 2009 at 1:05 pm

Posted in ACM

Tagged with , , ,

[WordPress] Coding Standards

leave a comment

這裡面的Coding Standards講到很多以前看到還蠻重要的東西,

像是下面這個做法可以避免”==”寫成”=”所產生的BUG,算是還蠻好用的。


if('abc' == $var) ...

另外還有一個也還重要的就是

Self-explanatory flag values for function arguments

這幾個點大家可以看一下,其他的就比較偏個人的習慣了。

Source

Written by EragonJ

December 9th, 2009 at 3:24 pm

Posted in Notes

Tagged with , ,

[JS] Image preload

leave a comment

The way a browser normally works, images are loaded only after an HTTP request is sent for them, either passively via an tag or actively through a method call.

所以這就是為什麼圖片都會有Delay抓不到的情況…因為他通常是被觸發時才會自動去抓src的圖。可是如果真的是這樣的話,那就要想個辦法來避免這個問題。不過該怎麼辦咧?

The simplest way to preload an image is to instantiate a new Image() object in JavaScript and pass it the URL of the image you want preloaded , and load it simultaneously to the page with the onLoad() event handler:

哦酷哦,直覺上的想法就是要讓頁面load完時就先onload 一個function,這樣就可以把執行時間提前,因此只要寫個function包起來讓onload去讀就可以了。

DEMO CODE:

Source

Written by EragonJ

December 8th, 2009 at 2:44 am

Posted in Javascript

Tagged with , , ,

[ZeroJudge]p018 Polynomial coefficients

leave a comment

就是多項式係數計算的簡化版,因為X1 , X2 …. Xn 就只是個變數,不會有像
高中數學那樣,還要考慮因為次方而多產生的係數,算是蠻簡單的,只是這邊
用到Recursive的Factorial計算,他有故意限定是 (0<K,N<13),所以用
long long int 去算就可以了,沒有太多困難。

Written by EragonJ

December 4th, 2009 at 6:52 pm

Posted in ACM

Tagged with ,