Total Pageviews

2014/07/29

四項成功選股原則

筆記一下漫步華爾街一書提到的四項成功選股原則:

  • 只購買至少維持五年盈餘成長超過平均的股票

  • 不購買股價高於合理價值的股票
    • 透過本益比來判斷,目前價格是否超過其價值。作者不斷強調,只要買進本益比低,就算成長未實現且盈餘下跌,損失也有限;但是如果預測成真,就可以賺錢,藉此增加勝算
  • 購買有故事題材的股票
    • 如iPhone概念股、雲端概念股等等
  • 盡可能減少進出
    • 頻繁進出股市者,平均來說獲利率都偏低,但是記得要汰弱留強。
    • 投資普通股票和債券的持有期越長,風險就越低,但是你得有耐性忍受過程中,投資價值逐年波動的情形

2014/07/27

2014/07 Travel

石碇千島湖


石碇雲海國小


基隆八斗子忘憂谷

基隆八斗子忘憂谷

2014/07/11

[iReport] How to format text style in text field

Requirement
The first row in this report, the report name will be appended "總預算\n" before report name. And "總預算" should be bold font. 


Solution
Step 1. Set Text Field Expression

Step 2. Set properties Markup = styled for this text field.

Reference



[iReport] How to apply conditional formatting to your text fields

Requirement
In iReport, I wish to apply different formats to my text fields based on different conditions. For instance, when "融資項目別"== "特別預算" then the font should be bold font.

Solution
You can apply "Conditional Styles" to fulfill this requirement.
Step1. Add new Style

Step2. Add new Conditional Style

Step3. Edit Condition Expression

Step4. Set Bold attribute to be true

Step5. Select text fields and apply this style

Step6. Test


Reference
[1] http://community.jaspersoft.com/wiki/how-apply-conditional-formatting-your-text-fields

2014/07/08

ORA-30926: unable to get a stable set of rows in the source tables when Merging tables

Problem
When I executed the merge SQL statement in my web application
MERGE INTO FMS434FB T1 USING
  (SELECT ACCYR AS ACCYR,
          MONTH AS MONTH,
          ASP AS ASP,
          AMT7,
          AMT9,
          AMT7+AMT9 AS ACC_AMT9
   FROM FMS434FB
   WHERE ACCYR||MONTH = :LAST_YYY_MM) T2 ON(T1.ACCYR||T1.MONTH = :YYY_MM
   AND T1.ASP=T2.ASP) WHEN MATCHED THEN
UPDATE
SET T1.AMT7 = T2.ACC_AMT9

It throw this exception
1:  Caused by: java.sql.SQLException: ORA-30926: unable to get a stable set of rows in the source tables when Merging tables  
2:       at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447) ~[oracle.jdbc-11.2.0.4-java-6.jar:11.2.0.3.0]  
3:       at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396) ~[oracle.jdbc-11.2.0.4-java-6.jar:11.2.0.3.0]  
4:       at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951) ~[oracle.jdbc-11.2.0.4-java-6.jar:11.2.0.3.0]  
5:       at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513) ~[oracle.jdbc-11.2.0.4-java-6.jar:11.2.0.3.0]  
6:       at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227) ~[oracle.jdbc-11.2.0.4-java-6.jar:11.2.0.3.0]  
7:       at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531) ~[oracle.jdbc-11.2.0.4-java-6.jar:11.2.0.3.0]  


Root Cause
ORA-30926 results from the using statement has duplicate data.
Therefore, as I execute this part of SQL statement
SELECT ACCYR AS ACCYR,
       MONTH AS MONTH,
                ASP AS ASP,
                AMT7,
                AMT9,
                AMT7+AMT9 AS ACC_AMT9
FROM FMS434FB
WHERE ACCYR||MONTH = :LAST_YYY_MM
It really has duplicated data !



2014/07/06

本益比的計算

漫步華爾街的作者提到:
選擇低本益比的股票比較好,如果成長實現,將帶來加倍利潤;若成長失敗,損失也有限

本益比計算公式如下

本益比=股價/EPS,所以股價=本益比 * EPS

先到網站上查詢最近五年的最高與最低本益比,算出最高本益比平均最低本益比平均以及平均本益比

再從網站上查詢最近四季的EPS總和

再推算出,當本益比是多少的時候,股價應該落在哪邊

例如本檔股票目前本益比是13.77

若按照目前的本益比,大致落在低本益比此區間,目前股價是27.95,可搭配K線來看進場時機

雖然分析工具很多,但是還是回歸漫步華爾街作者所說的,你無法預測未來成長與盈餘、你也無法有100%可以賺錢的分析工具、你只能降低失敗機率,這樣才能提升你賺錢的機率,故作者建議選擇低本益比的股票,勝算較高

參考資料
[1] http://www.cmoney.tw/finance/f00041.aspx?m=3&s=2034
[2] http://jsjustweb.jihsun.com.tw/z/zc/zca/zca_2034.djhtm
[3] http://www.cnyes.com/twstock/profile/2034.htm

2014/07/01

net.sf.jasperreports.engine.JRException: org.xml.sax.SAXParseException; Premature end of file.

Problem
When I try to build my project, it show this error message
1:  [ERROR] Could not compile fms435r1.jrxml because org.xml.sax.SAXParseException; Premature end of file.  
2:  net.sf.jasperreports.engine.JRException: org.xml.sax.SAXParseException; Premature end of file.  
3:       at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:247)  
4:       at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:230)  
5:       at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:218)  
6:       at net.sf.jasperreports.engine.JasperCompileManager.compileToStream(JasperCompileManager.java:191)  
7:       at net.sf.jasperreports.engine.JasperCompileManager.compileReportToStream(JasperCompileManager.java:471)  
8:       at com.alexnederlof.jasperreport.CompileTask.call(CompileTask.java:65)  
9:       at com.alexnederlof.jasperreport.CompileTask.call(CompileTask.java:28)  
10:       at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)  
11:       at java.util.concurrent.FutureTask.run(FutureTask.java:166)  
12:       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
13:       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
14:       at java.lang.Thread.run(Thread.java:724)  

As I try to open this jrxml file via iReport Designer, it show the same error message


Root Cause
As I change iReport mode from Designer to XML, I figure out the root cause. This jrxml file had broken for unknown reason, it's an empty jrxml file so it cannot be compiled correctly.

THerefore, I need to revert this file to server version by svn client, and do it again.