2013年1月31日 星期四

[SQL] SCHEMABINDING


SCHEMABINDING

Binds the view to the schema of the underlying table or tables. When SCHEMABINDING is specified, the base table or tables cannot be modified in a way that would affect the view definition. The view definition itself must first be modified or dropped to remove dependencies on the table that is to be modified. When you use SCHEMABINDING, the select_statement must include the two-part names (schema.object) of tables, views, or user-defined functions that are referenced. All referenced objects must be in the same database.

Views or tables that participate in a view created with the SCHEMABINDING clause cannot be dropped unless that view is dropped or changed so that it no longer has schema binding. Otherwise, the Database Engine raises an error. Also, executing ALTER TABLE statements on tables that participate in views that have schema binding fail when these statements affect the view definition.


很有 C++ const 味道。

2013年1月30日 星期三

《IFRSs》數量折扣之會計處理


未來之折讓原本認列為「資產之減項」,現在得放在「負債」。



這個效果會使原本「資產」增加,但原本「自有資本比率」會降低

((照妖鏡?))

((可用數學式證明))



魂不守舍。雖然之前經常如此,但這也算難得的經驗。

只能提醒平常處多留點心,以防禦性的態度來騎車,股市且看且走,

之前漏看的財務報表電子書,得花心思仔細推敲,二十萬小錢,但也是喵的錢。

今天收到兩張免費電影票,沒有因為難過而放棄權利,這是冷靜吧。

((再看兩次 Z))



繼續看 IFRSs 會弄到什麼東西。毛利率會提升?



放心,我答應你。

我會冷靜的,直到我不能冷靜為止。

2013年1月29日 星期二

推算公司員工流動率?


今天可謂非常難過的一天,原來眼淚是鹹的。



略此不提,剛看到有趣的東西,認股權。或許可以透過認股權放棄比率來推算員工流動率。每次難過的時候都想換一下氣氛,講白點就是換工作,不過現在這工作還不錯,做的也算喜歡。

一○一及一○○年前三季因員工離職而放棄九十九年度給與認股權之比率分別為2.21%及7.48%。於一○一年九月三十日,本公司估計於未來剩餘既得期間因員工離職而放棄認股權之比率為4.97%。

有時候想瘋狂一下,不能冷靜呀寶貝!

那就不要冷靜唄。當然,靠酒精迷惑自己也不會是選項,酒這東西,久未嘗便忘記了什麼味,那味不是什麼好味。但為了避免衰運持續,奔亂的頭腦容易讓自己越來越摔,這不是迷信,而是原本的判斷力被攪亂了。可以瘋狂,但不能被攪亂。


因為 IFRSs 喵的馬上又要來了。

((原則上 IFRSs 會更貼近現實))



行為冷靜。

但心情無法冷靜。



如果沒有A,如果沒有B,如果沒有C,如果沒有如果。

事情都發生了,留著難過的味道也未嘗不是好味道?



為什麼不告訴我,請你別煩我,讓我徹徹底底死了心?

2013年1月28日 星期一

無效率但有效率


在組織龐大的機構裡,盡量讓大家知道你做什麼事。

這是好聽的說法。

難聽的說法是找人幫你畫押,無效率,但出事的時候很有效率

2013年1月27日 星期日

破解肚爛最重要的事


笛卡兒曾發現幾條規則:
  1. 絕不承認任何事物為真,對於我完全不懷疑的事物才視為真理
  2. 必須將每個問題分成若干個簡單的部分來處理;
  3. 思想必須從簡單到複雜;
  4. 我們應該時常進行徹底的檢查,確保沒有遺漏任何東西。


同事跟我報告「我的系統不能動」,千萬不能慌,先弄清楚是什麼因 ((因為很久沒回應)),再來摸清楚推論邏輯 ((若「很久沒回應」,故「系統不能動」)),邏輯上這是不通的。

「很久沒回應」可能有很多問題,但一下就跳到「我的系統不能動」,顯然是有問題的推論,正所謂無罪推定主義,現在我反而要證明「我的系統是無罪的」。為什麼我那麼有信心,敢說我的系統無罪?其實這是一體兩面,證明系統無罪的方法,正巧也能證明系統有罪

總之就是幫忙同事找問題唄。

從自己系統往回找,沒問題。往外層的系統找,果。然。抓。到。了。



喵的,看唄,亂報。絕不承認任何事物為真,對於我完全不懷疑的事物才視為真理。這不是什麼推拖之詞,而是科學家用科學的方法做事情。最近政府正進行許多改革,18%砍到9%外加一大堆但書,這是在幹什麼?因為「公務員福利太好」,所以「經濟不好」?這是哪門子的推論?如果是「公務員福利不公平,無法源依據」,所以「公平調整公務員福利」,這聽起來才像一回事。

算了,被亂賴也不是這一件事而已。

2013年1月26日 星期六

《西遊記》


不做無謂掙扎,打不贏就找救兵。聰明人做聰明事,知所進退,善於整合資源。原以為孫行者是莽漢,並不,他可聰明的咧,唐三藏實在太膿包,獃子跟沙悟淨常得看顧他,這算是團隊合作吧。

((工作也很像喔,盡量把球往外丟,別人招架不住,趕緊再找其他救兵唄,千萬別被其他人困住了。然後,膿包頗多,哈哈))



《One Piece Z Film》

The ocean seen. The begin of the world as well.
The ocean knows. The end of the world as well.

So I invite. To the way to go.
So I lead. To correct the world.

Pain, suffering, and will wrap.
Gently large, wrap me.

The ocean seen. The begin of the world as well.
The ocean knows. The end of the world as well.

Even if I disappear
Guidance of the sea that knows all

Do not be afraid. Because I have you.
Do not be scared. Because I also have a companion.
Must proceed. To the blue destination.

感人的劇情,就做自己想幹的事,斬斷自己的猶豫。



《畫皮》電影。也感人到哭。

2013年1月24日 星期四

馬的做到有點肚爛


馬的做到有點肚爛,

通常是自己招惹自己的

八十多台機器,慢慢 RDP 點進去也是會死人的,過去一直不理,

但機器越來越多,實在是點到有點肚爛。



突然想起 botnet,這不是我要做的事嗎?
A botnet is a collection of internet-connected computers whose security defenses have been breached and control ceded to a 3rd party. Each such compromised device, known as a "bot", is created when a computer is penetrated by software from a malware distribution; otherwise known as malicious software. The controller of a botnet is able to direct the activities of these compromised computers through communication channels formed by standards-based network protocols such as IRC (Internet Relay Chat) and HTTP (Hypertext Transfer Protocol).

所以就簡單寫 ServerDaemon 以及 ClientDaemon,ServerDaemon 就是對下面殭屍發號司令的黨政軍高層,ClientDaemon 負責執行命令就好了。至於溝通管道,用現成的 message queue service 就好了。

目前設計幾個指令:
  • EXEC -- 執行程式
  • FTP -- 下載檔案
  • QUERY -- 查詢電腦狀態

光這樣就很多可以玩的。

例如我要更新設定檔,首先
  1. FTP -- 下載砍 process 的程式
  2. EXEC -- 執行砍 process 的程式,把正在跑的程式關掉,這樣才能重啟重新吃新的設定檔
  3. FTP -- 下載新的設定檔 
  4. EXEC -- 執行剛剛正在跑的程式

((FTP 就是 downloader,這是基本 malware 技能))

((QUERY 是寫方便的))



接下來只要爽爽下指令操作殭屍就行了!!!

幹!!!

肚爛!!!

是可以解決的!!!

2013年1月23日 星期三

[c#] WaitOne in NET Framework 3.5


In NET Framework 3.5:

WaitOne Method
WaitOne Method (Int32)
WaitOne Method (TimeSpan)
WaitOne Method (Int32, Boolean)
WaitOne Method (TimeSpan, Boolean)


WaitOne Method (Int32) or (TimeSpan) 在 NET Framework 2.0 沒有相對應的 method,所以只能用 WaitOne Method (Int32, Boolean) or (TimeSpan, Boolean) 代替,其中 Boolean 用 false 帶入。


喵的,害我 build 不過。

[jdbc] Building the Connection URL


jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]


Example:
  • jdbc:sqlserver://localhost;user=MyUserName;password=*****;
  • jdbc:sqlserver://localhost;integratedSecurity=true;
  • jdbc:sqlserver://localhost;databaseName=AdventureWorks;integratedSecurity=true;
  • jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks;integratedSecurity=true;
  • jdbc:sqlserver://localhost;databaseName=AdventureWorks;integratedSecurity=true;applicationName=MyApp;
  • jdbc:sqlserver://localhost:1433;integratedSecurity=true;<more properties as required>;
  • jdbc:sqlserver://localhost;instanceName=instance1;integratedSecurity=true;<more properties as required>;

2013年1月22日 星期二

不曉得要寫啥


還是寫一點好了。



星期一早上夢到股市狂噴,手中多幾萬塊可以花費。

醒來夢一場。

晚上看來又瘦了,好像行程非常操的樣子,消瘦三五圈。



星期二疲倦,思考倦怠,這一定是某人的陰謀,

故意把事情做糟一點,讓底下的人有事可以做。

整個方向是水平的,你不能進步,但我會拖著你退步,你得自己維持水準。

下午趕緊抓 wireshark 自己來一下。

2013年1月17日 星期四

[LDD3] hello world


Book: Linux Device Drivers, 3ed.

OS: CentOS 6.3 (http://centos.arcticnetwork.ca/6.3/isos/i386/CentOS-6.3-i386-minimal.iso)

Physical Machine: MacBook Air

Virtual Machine: VirtualBox



裝完後,設定 eth0,裝 kernel-devel,裝 make。
整理完環境後,終於可以安心上路了。


這些就照著 LDD 書上寫的照抄。


寫一下 makefile。

接著 make


hello.ko 會被編譯出來。

接著裝上去,再弄下來試試看。為了驗證有裝上去,可以使用 lsmod | more 看是否 hello module 有被裝上去。


都是正常的,舒服。

2013年1月13日 星期日

傻眼了


找了老半天,沒找到好的股票讓我實驗程式正不正確!

哇咧,整個週末就這樣。不。見。了。

《5489》否定的理由


盈餘去年年增率大幅衰退。

記住這個理由,以及反應到圖表的內容。
或者不理他,視為利空出盡買進信號,畢竟其他數據皆屬上乘。

證明。

用錢證明我們的想法。


《3390》這會是目標嗎?也不是

ROE細部邏輯分析:
DateROENet Profit MarginTotal Assets TurnoverEquity Multiplier
2012-090.240.240.71.4
2012-060.260.210.781.54
2012-030.130.150.71.27
2011-120.240.190.951.35
2011-090.260.20.991.36
2011-060.240.180.941.44
2011-030.240.190.941.38
2010-120.160.111.041.43
2010-090.210.141.071.45
2010-060.210.141.011.53
2010-030.170.121.041.36
2009-120.150.140.851.3
2009-090.180.150.851.38
2009-060.130.130.771.32
2009-030.030.040.681.19
2008-120.080.080.751.27
2008-090.080.080.751.29
2008-060.030.040.71.23
2008-030.050.060.681.2
2007-120.110.120.671.31
2007-060.040.050.551.21
2006-120.120.140.711.25
2006-060.130.150.651.28
2005-120.280.20.971.48

財務結構也可以。

流動速動比率也不錯:
DateCurrent RatioRapid Ratio
2012-094.193.8
2012-062.181.95
2012-033.573.19
2011-122.932.64
2011-092.892.55
2011-062.462.11
2011-032.672.28
2010-122.42.09
2010-092.422.14
2010-062.141.88
2010-032.632.3
2009-122.862.48
2009-092.542.19
2009-062.72.33
2009-033.753.36
2008-122.842.48
2008-092.712.36
2008-063.162.71
2008-033.483
2007-122.672.36
2007-063.322.99
2006-1232.76
2006-062.692.39
2005-121.731.57

營業外收入比率不錯低,長期投資比率也不錯低。

營收略微鈍化

盈餘能力不錯:
DateGross Profit MarginOperating Profit MarginNet Profit Margin
2012-090.370.280.24
2012-060.340.240.21
2012-030.30.190.15
2011-120.30.20.19
2011-090.30.210.2
2011-060.310.20.18
2011-030.310.20.19
2010-120.250.160.11
2010-090.250.160.14
2010-060.250.150.14
2010-030.240.150.12
2009-120.280.150.14
2009-090.310.170.15
2009-060.280.120.13
2009-030.17-0.020.04
2008-120.210.060.08
2008-090.220.070.08
2008-060.190.040.04
2008-030.20.060.06
2007-120.270.110.12
2007-060.240.010.05
2006-120.30.130.14
2006-060.370.170.15
2005-120.370.240.2

現金流量部份,也很不錯,
   Date   Operating ActivityInvesting ActivityFinancing ActivityFree Cash FlowCash FlowNet ProfitOperating Minus Net Profit
2012-09165226-55412214122109814323936219786-54560
2012-06146998-3482562511217311279811489632102
2012-0356858-1110662545752463773352423334
2011-12232633-80033-521641526001004362293753258
2011-09108383-56500-5216451883-281179343-70960
2011-0671779-306430411364113697848-26069
2011-0366398-25247041151411515049715901
2010-12150726-38547-259101121798626912877421952
2010-0974052-22118-259105193426024125422-51370
2010-0375611-8644066967669673075644855
2009-1279802-20434-82735936851095104643-24841
2009-0921779-3907-827317872959989724-67945
2008-123141618217-11204496333842945074-13658
2008-09285274683-11204332102200633994-5467
2007-1230861-85237-16849-54376-7122557813-26952
2006-1284502-605655728123937812186049424008
2006-06-61922-4218984954-104111-1915729607-91529

CCC緩步墊高,此外,最近仍向股東拿錢

《3563》營業外太多惹


StocktotalDashboard 剛寫完,當然要實驗一下。

SQL:
select * from stocktotaldashboard
where 1=1
and expected_roe > 0.10
and bad_equity_ratio_percentage < 0.2
and bad_dividend_percentage < 0.2
and bad_current_ratio_percentage < 0.2
and continuous_growth_month_count > 3
order by continuous_growth_month_count desc

((1=1 這是一個 hack))

3563 頗引人注意,但仔細一看業外收入比率有點高

2012-090.41
2012-060.51
2012-030.75
2011-120.09
2011-090.09
2011-060.05
2011-030.29
2010-120.04
2010-090.02

留意一下。此外新上市/櫃公司樣本數不多,尚未經過市場的嚴格考驗,只能說科科了。

((後來看到是官司訴訟,扣掉後營收比去年同期差還要更差))

《Stocktotal》Dashboard


Source Code: GitHub

請翻到 pg_dump.sql,找尋 CREATE TABLE stocktotaldashboard (...)。使用前先執行 init_stocktotaldashboard function,先把 stock_code 填進去,或者填你自己喜歡的股號。接下來執行 update_stocktotaldashboard function,再把資料填進去,這個 function 執行很花時間,還好執行一次就夠了。



Excel 整理:https://docs.google.com/file/d/0BzU93gXbRyB2dW5BWUxId0hxdmc/edit

說明:
  • Expected ROE: 預期報酬率。當股價越來越高,預期報酬率越來越低 ((越高越好))
  • Max Income Date: 營收創新高的最近月份 ((越靠近現在越好))
  • Income Growth: 近期營收仍持續成長月數,成長的定義是「營收3個月平均值 > 營收12個月平均值」 ((越長越好))
  • # Bad Equity Ratio: 自有資本比率偏低 (低於五成) 的次數 ((越少越好))
  • %: 自有資本比率偏低 (低於五成) 的比率 ((越低越好))
  • # Bad Current Ratio: 流動比率偏低 (低於 1) 的次數 ((越少越好))
  • %: 流動比率偏低 (低於 1) 的比率 ((越低越好))
  • # Bad Rapid Ratio: 速動比率偏低 (低於 2) 的次數 ((越少越好))
  • %: 速動比率偏低 (低於 2) 的比率 ((越低越好))
  • # Bad Stock Dividend: 公司發不出股利的次數 ((越少越好))
  • %: 公司發不出股利的比率 ((越低越好))

2013年1月12日 星期六

近一個月營收創新高公司的預期報酬率 Kn


Postgres 的 script 放在 stocktotal / db / postgres / stock_selector / expected_roe_over_latest_max_income.sql

因為加兩個 functions,所以 stocktotal / db / postgres / pg_dump.sql 也要更新一下


以上是 SQL script,以下是 query 結果 (按股號排序)
"1210";0.0605627453033925
"1215";0.0800776004952533
"1507";0.0663508481500958
"1536";0.103687799545484
"1565";0.0511535448465225
"1722";0.0343416735945364
"1788";0.0510050206123058
"1806";-0.0520584916456912
"2013";0.0818022916666667
"2317";0.0665286752828048
"2385";0.0686123616149282
"2412";0.057195418155567
"2505";0.0174775176336624
"2547";0.00721560929724184
"2640";0.0596053286770349
"2913";0.0448573332963362
"3004";0.095688205633275
"3008";0.0368762951546661
"3029";0.0640376930725047
"3045";0.0406168188699766
"3064";-0.0112086480042224
"3115";0.00159786501649073
"3205";0.00456786019328507
"3498";-0.0875314420461447
"3508";0.0412508816188126
"3587";0.0774725891297323
"3662";0.0117171687105931
"3680";0.0399297146177326
"4114";0.0237935868253256
"4123";-0.00576687276900821
"4432";0.0880231559290383
"4703";0.150930603929043
"4801";0.0937325332258138
"4904";0.0459674562753729
"4927";0.169793914973342
"4938";0.069445911631009
"5309";-0.0405454166222402
"5355";0.0434891676145268
"5534";0.157399415495708
"5536";0.050054232201346
"5703";0.0244453153662799
"6177";0.111035056202138
"6245";0.0916793253700497
"8416";0.0820323372290338
"9908";0.0597673801470013
"9911";0.0490525797713844
"9917";0.065048305158048
"9926";0.0496043187180656

按Kn排:
"4927";0.169793914973342
"5534";0.157399415495708
"4703";0.150930603929043
"6177";0.111035056202138
"1536";0.103687799545484
"3004";0.095688205633275
"4801";0.0937325332258138
"6245";0.0916793253700497
"4432";0.0880231559290383
"8416";0.0820323372290338
"2013";0.0818022916666667
"1215";0.0800776004952533
"3587";0.0774725891297323
"4938";0.069445911631009
"2385";0.0686123616149282
"2317";0.0665286752828048
"1507";0.0663508481500958
"9917";0.065048305158048
"3029";0.0640376930725047
"1210";0.0605627453033925
"9908";0.0597673801470013
"2640";0.0596053286770349
"2412";0.057195418155567
"1565";0.0511535448465225
"1788";0.0510050206123058
"5536";0.050054232201346
"9926";0.0496043187180656
"9911";0.0490525797713844
"4904";0.0459674562753729
"2913";0.0448573332963362
"5355";0.0434891676145268
"3508";0.0412508816188126
"3045";0.0406168188699766
"3680";0.0399297146177326
"3008";0.0368762951546661
"1722";0.0343416735945364
"5703";0.0244453153662799
"4114";0.0237935868253256
"2505";0.0174775176336624
"3662";0.0117171687105931
"2547";0.00721560929724184
"3205";0.00456786019328507
"3115";0.00159786501649073
"4123";-0.00576687276900821
"3064";-0.0112086480042224
"5309";-0.0405454166222402
"1806";-0.0520584916456912
"3498";-0.0875314420461447

2013年1月11日 星期五

[sql] 來自近一個月營收創新高之公司


假設我有一個 OperatingIncome table,schema 大概長這樣


CREATE TABLE operatingincome
(
  stock_code text NOT NULL,
  activity_date date NOT NULL,
  income double precision
);

那要怎麼找出「近一個月營收創新高之公司」?



select * from
(
    select A.stock_code, max(B.activity_date) as date
    from
        (
            select stock_code, max(income) as income from OperatingIncome
            group by stock_code
        ) as A,
        OperatingIncome as B
    where
    B.income = A.income and B.stock_code = A.stock_code
    group by A.stock_code
) as C
where C.date = '2012-12-31'


《6245》來自近一個月營收創新高之公司


近一個月營收創歷史新高。五日均量在 500 張以下。

Stocktotal: https://docs.google.com/file/d/0BzU93gXbRyB2Ny1tTXJPSVFHNUE/edit

自有資本比率低於五成。但還是看一下變化。

2013年1月10日 星期四

《12月營收 至少18檔創新高》


Link: http://udn.com/NEWS/STOCK/STO2/7624406.shtml



底下是畫虎爛,盈虧自負。我只是進場看熱鬧的。



3008: 各方數據表現均不錯,但不在買點。高價投資一家非常成功的企業,這是最令人覺得喪氣的悲劇,因為公司雖然賺大錢,你卻繼續賠錢 [Peter Lynch]
((https://docs.google.com/open?id=0BzU93gXbRyB2enQ2SnZmWXZwcms))

1210: 營業外收入比率頗高,需要深入研究。另,也不在買點。
((https://docs.google.com/open?id=0BzU93gXbRyB2TExsUENEak0zTGs))

2524: 營建股。忽略不計。

5904: 資料不齊。怪了。

9917: 感覺不錯,但價格落在不能買也不能賣,也就是觀望的區間。
((https://docs.google.com/open?id=0BzU93gXbRyB2WFlkMG5KYU1YRUE))

9911: 觀察。
((https://docs.google.com/open?id=0BzU93gXbRyB2OV80eVdMNDdFSVE))

3658: 資料量太少。觀察。
((https://docs.google.com/open?id=0BzU93gXbRyB2TzBVTFJPMHpZRGM))

3029: 資料量太少。觀察。懶得出 Stocktotal Report

1565: 這真的很好,但喵的股價有點高,跟 3008 是一樣的悲劇。
((https://docs.google.com/open?id=0BzU93gXbRyB2Vy0zTmV3Ql9tWm8))

1536: 自有資本比率低於五成,失敗。

6245: 自有資本比率低於五成,失敗。

4432: 太年輕,目前還在增資(跟股東要錢),暫且忽略不計。

5309: ROE負的。

1788: 雖然在成長,股利也不斷發送,但仍跟股東不斷要錢,這部分得要看進去。
((https://docs.google.com/open?id=0BzU93gXbRyB2OTY1RVhod01NeEU))

3004: 資料做出來有負的?不碰。自有資本比率低於五成,以外部投資者來說,這是不可棄守的底線。但如果自己背房貸,導致自有資本比率低於五成,倒是會被大家認為是人生勝利組。

3541: 喵的又沒資料,系統該不會要壞掉了吧((羞))

3587: CCC帶來負面訊息,看進去 Days Sales Outstanding 突飛猛進,感覺是要衝業績。價格落在不能買也不能賣,但比較靠近能買的區域。
((https://docs.google.com/open?id=0BzU93gXbRyB2N2o3cmV1bXJpMU0))

2718: 沒資料。大飯店。

《蘿莉塔》

wiki 介紹:
Lolita is a novel by Vladimir Nabokov, written in English and published in 1955 in Paris and 1958 in New York. It was later translated by its Russian-native author into Russian. The novel is notable for its controversial subject: the protagonist and unreliable narrator, middle-aged literature professor Humbert Humbert, is obsessed with the 12-year-old Dolores Haze, with whom he becomes sexually involved after he becomes her stepfather. His private nickname for Dolores is Lolita.

難怪美國出版社不想出版這本書。

因為內容真的太勁爆了,名字的隱喻,情慾的墮落,無論怎麼批評,我們面前彷彿站著耶穌,手裡拿著石頭,卻沒有勇氣向犯人丟石頭。

幻想必須是純潔的?藝術的?私慾的?神聖的?

我們不必馬上選擇,只需細細品味 Vladimir Nabokov 的幻想世界。

((那種滿溢無處宣洩的情慾,還真令人羨慕))

((不論生活處在哪個位置,有喜歡的人,有喜歡你的人,那真的蠻幸福的))

((可惜 Humbert Humbert 愛到社會所不容的蘿莉塔,蘿莉塔最終也不是他的歸屬。愛到把情敵幹掉,實在愛的過火,這也是社會無法允許的事,凡事超過就不好了。但仔細想想,有些傻逼生命只剩情人的殘渣與詛咒,很悲慘,卻也很美好))


但這些終究是想像,認真就輸了,或許這就是文學(嘴砲)的魅力吧?


PS. 持續更新中

(*)(#) 3. The Divine Comedy, Dante Alighieri, 1265–1321 ((神曲))
(#) 6. One Thousand and One Nights, Anonymous, 700–1500
(*) 8. Pride and Prejudice, Jane Austen, 1813
9. Le Pere Goriot, Honore de Balzac, 1835 ((高老頭))
14. The Stranger, Albert Camus, 1942 ((異鄉人))
36. One Hundred Years of Solitude, Gabriel Garcia Marquez, 1967 ((百年孤寂))
43. The Old Man and the Sea, Ernest Hemingway, 1952 ((老人與海))
59. A Madman's Diary, Lu Xun, 1918 ((狂人日記,魯迅))
(#) 67. The Tale of Genji, Murasaki Shikibu, 11th century
69. Lolita, Vladimir Nabokov, 1955 ((蘿莉塔))
70. Nineteen Eighty-Four George, Orwell, 1949 ((一九八四))
81. Blindness, Jose Saramago, 1995 ((盲目))
82. Hamlet, William Shakespeare, 1603
83. King Lear, William Shakespeare, 1608
84. Othello, William Shakespeare, 1609
90. War and Peace, Leo Tolstoy, 1865–1869
91. Anna Karenina, Leo Tolstoy, 1877
92. The Death of Ivan Ilyich, Leo Tolstoy, 1886
(*) 93. Adventures of Huckleberry Finn, Mark Twain, 1884

(*):有看過,內容沒印象,準備重看
(#):看一半或者沒看完,準備重看

2013年1月9日 星期三

嚇死我的毛


今天大事。

新系統上線,平安上線,可喜可賀。



過沒多久,新系統使用者跟我商量,想加一些新功能上去。

啊?

先別說這個,有聽過系統邊界嗎



A → B → C

我是 C,我只能知道 B → C,不可能知道 A → B,

不能老是叫 C 心電感應 A → B 發生什麼事

2013年1月8日 星期二

[aws ec2] 80 port is blocking



Security Group => Inbound => Port range: 80 => Add Rule => Apply Rule Changes

《南方周末》馬英九噤聲


馬英九舔中共老二,怎麼敢出聲?

((那我貼在這邊會怎樣?))

((放心好了,馬英九也舔美國瘦肉精的老二))

2013年1月7日 星期一

[ios] IBOutlet and IBAction


IBAction
Type qualifier used by Interface Builder to synchronize actions. Use this type as the return type of any action methods defined in your project. For examples of how to use this identifier, see “Xcode Integration”.
(Also take a loot at target-action patterns)



IBOutlet
Identifier used to identify a property so Interface Builder can synchronize the display and connection of outlets with Xcode. Insert this identifier immediately before the type in any declarations. For examples, including how to use it with the @property syntax, see “Xcode Integration”.
(The type qualifier IBOutlet is a tag applied to an instance-variable declaration so that the Interface Builder application can recognize the instance variable as an outlet and synchronize the display and connection of it with Xcode.)

[ios] CS 193P iPhone Application Development


Link: http://www.stanford.edu/class/cs193p/cgi-bin/drupal/

抓到了,花點時間看完唄。



喵的好想假結婚騙婚假逃到外太空的外太空。



小旺福-飛向你飛向我 mv

((歌聲有變好聽XD))

2013年1月5日 星期六

MVC pattern



概念上是這樣,實做上可以花點巧思。

例如 Cocoa Framework 是這樣設計的:http://www.stanford.edu/class/cs75n/1_MVC.pdf

看到了嗎?Cocoa Framework 把 UPDATES 這條路切斷,也就是說,model 不與 view 溝通,model 只與 controller 溝通 ((有必要的話)),間接溝通。所謂的間接,就是使用 observer pattern 概念。

((event-driven))

((model 當然可以搞自閉,不斷的讓 controller 來問狀態或資料,例如某些游戲。不管怎樣,model 絕對不能碰到 view 的邏輯!))

雖然圖是這樣畫,但實際照圖 implement 的話,你的 model 就改不完了


Example: stocktotal
  • Model: Postgres database with functions + source module
  • View: amcharts + datatables in portal module / PDF in report module
  • Controller: PHP + Javascript in portal module / JasperReports in report module


現在準備想寫 iOS app。因為當初設計妥當,model 完全不必更動,只需專心研究 iOS 怎麼寫 UI 就可以了。同樣道理,以後想寫 Android app,我也不必更動 model。因為 model 與 view 無關,中間只能靠 controller 溝通!

2013年1月4日 星期五

向宇宙下訂單


一。看完 The 100 Best Books of All Time傻摸。

二。走完一百座台灣高山我們一起唄。

三。捐一億給台灣。好嗎?



一。跟百岳很像,不見得每次爬的山都是百岳,不是百岳的山一樣美麗。

(*)(#) 3. The Divine Comedy, Dante Alighieri, 1265–1321 ((神曲))
(#) 6. One Thousand and One Nights, Anonymous, 700–1500
(*) 8. Pride and Prejudice, Jane Austen, 1813
9. Le Pere Goriot, Honore de Balzac, 1835 ((高老頭))
14. The Stranger, Albert Camus, 1942 ((異鄉人))
36. One Hundred Years of Solitude, Gabriel Garcia Marquez, 1967 ((百年孤寂))
43. The Old Man and the Sea, Ernest Hemingway, 1952 ((老人與海))
59. A Madman's Diary, Lu Xun, 1918 ((狂人日記,魯迅))
(#) 67. The Tale of Genji, Murasaki Shikibu, 11th century
70. Nineteen Eighty-Four George, Orwell, 1949 ((一九八四))
81. Blindness, Jose Saramago, 1995 ((盲目))
82. Hamlet, William Shakespeare, 1603
83. King Lear, William Shakespeare, 1608
84. Othello, William Shakespeare, 1609
90. War and Peace, Leo Tolstoy, 1865–1869
91. Anna Karenina, Leo Tolstoy, 1877
92. The Death of Ivan Ilyich, Leo Tolstoy, 1886
(*) 93. Adventures of Huckleberry Finn, Mark Twain, 1884

(*):有看過,內容沒印象,準備重看
(#):看一半或者沒看完,準備重看

慢慢來


事情多。慢慢來。

[php] mssql


1. Open connection
$this->conn = odbc_connect("Driver={SQL Server};Server=[ServerHost];Database=[InitialDatabase];", [Username], [Password]) or die("Couldn't connect to SQL Server: " . odbc_errormsg()); 

2. Close connection
odbc_close($this->conn); 

3. Query
$query = odbc_exec($this->conn, $sql_cmd) or die("Could not execute query: $sql_cmd");
         
$rv = array();
while(odbc_fetch_row($query)) {
    $record = array(
        'col1' => odbc_result($query, 1),
        'col2' => odbc_result($query, 2),
        'col3' => odbc_result($query, 3),
        'col4' => odbc_result($query, 4),
    );
    $rv[] = $record;
}          
odbc_free_result($query);


2013年1月3日 星期四

[mssql] Create Calendar Table

CREATE TABLE [Calendar]
(
    [CalendarDate] DATETIME
)
DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SET @StartDate = GETDATE()
SET @EndDate = DATEADD(d, 365, @StartDate)
WHILE @StartDate <= @EndDate
    BEGIN
        INSERT INTO [Calendar]
        (
           CalendarDate
        )
        SELECT
            @StartDate
        SET @StartDate = DATEADD(dd, 1, @StartDate)
    END

可將 @StartDate 或是 @EndDate 改成自己想要的範圍。

取最近七天的日期:
select
  CalendarDate
from
  Calendarwhere
  CalendarDate < GETDATE()and
  CalendarDate > DATEADD(d, -7, GETDATE())


2013年1月2日 星期三

[c#] error converting data type datetime to smalldatetime


stackoverflow

SQLServer's datetime datatype is a much smaller range of allowed values than .net datetime datatype. SQLServer's datetime type basically supports the gregorian calendar, so the smallest value you can have is 1/1/1753. In 2008 SQLServer added a datetime2 datatype that supports back to year 1 (there was no year 0). Sounds like you're trying to insert a datetime value that's before 1/1/1753 into a datetime (not datetime2) SQLServer column.

所以就直接檢查 C# DateTime 有沒有超過 MSSQL SMALLDATETIME 上下界,若超過就縮進去,反正這玩意撐個十年就很了不起了。

[ios] tutorial


Programming with Objective-C ((讀完,試寫過小咚咚接上 PostgreSQL,後來卡在 UI 畫面))

Your First iOS App ((讀完,實做過))

Your Second iOS App: Storyboards ((完成,裡面還有很多東西可以玩,但我想這樣就夠了))

View Controller Programming Guide for iOS

iPad and iPhone Application Development (HD) by Paul Hegarty

頓頓


(一)這幾天老找不到摸摸送的圍巾,很急,到公司也翻不著。原來躺在另一個包包裡。



(二) 醬糊。

之前能動的程式碼,現在不能動,喵的還真怪。

Dir,Directory,Folder 三個同義字混用,程式一點也不美麗,但也懶得再改,讓他們大統一。C#特色就是可以快速完成工作,至於程式品質,倒也不必太要求,反正之後還會再改來改去。



(三)原本很期待谷關七雄,教授、品薰、冠宇也很 nice,但好像少了什麼,爬山變複雜了,而不只是單純爬山。很煩,只能靠護膝撐著,為了避免再次受傷,某些地形走的實在很糟糕。上山當然很滿足,下山我也很滿足,就算東卯山不爬,半夜殺回台北,我也很開心,既然山上山下一樣開心,那為什麼要上山?



(四)按照推算,差不多是月初。



(五)特休加彈休只有十六天,還是得省著用。年初事情真的是他媽的好多,以前拔拔會把工作情緒帶回家,惹的麻麻不開心。所以我暗暗發誓,就算工作再鳥,心情再喵的不好,今天也要笑著過。倒是私下偷做的 iOS XCode 弄的我很不爽,喵的,這個 UI 實在是。

需。要。教。學。



(六)(股市)忘記成本價。


2013年1月1日 星期二

白馬三山


  • D1 猿倉(1230m)→白馬尻小屋→大雪渓→岩室跡→白馬岳頂上宿舎→白馬山荘→白馬岳(しろうまだけ・2932.2m・日本百名山)→白馬山荘(泊)
  • D2 白馬山荘→離山→丸山(2768m)→杓子岳(しゃくしだけ・2812m・白馬三山)→鑓ヶ岳(やりがたけ・2903m・白馬三山)→分岐→天狗山荘→分岐→大出原(おおでっぱら)→白馬鑓温泉小屋(泊) 
  • D3 白馬鑓温泉小屋→小日向ノコル→猿倉

2. http://www.yamasanpo.com/hakuba_5.html ((縱走,好像走不到冰河))
  • D1 蓮華温泉~白馬大池
  • D2 白馬大池~小蓮華山~白馬岳
  • D3 白馬岳~杓子岳~鑓ヶ岳~白馬鑓温泉
  • D4 白馬鑓温泉~猿倉

3. 地圖
http://portal.cyberjapan.jp/site/mapuse/index.html?lat=36.767253&lon=137.821718&z=13&did=BAFD200K