- 投資人的一種習性是,對真正便宜的東西視而不見,就像羊群一樣成群移動,而不是自己獨立思考。人多會追求安全感,所以投資人買進某一項資產並不是因為該資產的價值被低估,而是因為「其他人」都在買;賣出資產也不是因為某種基本面的原因,而是因為「其他人」都在賣
- Heuristics (捷思),譬如定錨心理(anchoring)、可得性(availability)、代表性(representativeness),用直覺取代或然率分析和統計分析。短期來看,根據 heuristics 來進行投資的人可以得到很多樂趣;長期來看,根據統計來進行投資的人可以累積很多財富
- Income statement(收益表)是一家公司財務報表的一部分,但可能會誇大收益、少列支出
- 由於 index fund (指數型基金)收費非常低廉,交易佣金也微不足道,所以華爾街常用『為什麼要甘於平庸(average)?』來奚落 index fund。不過,這個問題的答案是,從年復一年的成果來看,index fund 的績效都超越絕大多數的主動型基金,而且成本少很多
- Inflation(通貨膨脹)是今天喪失購買力的過程,錢隨著時間變得越來越不值錢。一般來說,inflation 的原因是,政府用印鈔票來淹沒經濟問題,以此做為解決經濟問題的方法,因此讓百姓的日常生活難以為繼(特別是窮人),使得問題更加惡化
- IPO (Initial Public Offerings) 是股票首次公開上市,更精確的來說, IPO 這個縮寫的意思應該是 Insiders’ Private Oportunity(內部人士私人的機會)、 Imaginary Profits Only (獲利只是想像)、It’s Probably Overprices(價格可能太高)
- 華爾街的 is ,其實都是現在完成進行式的 has been。當分析師說我知道這隻股票會漲(is going up),他的意思是這隻股票 has been going up
- Junk bonds(垃圾債券)是指投資平等不合格的債券,現在已經改名成 high-yield bond(高收益債券),比較好聽但比較不坦率(candid)
- Kitchen-sink(運用洗碗槽策略,巨額沖銷),用來比喻公司把所有壞消息都灌進盈餘季報,好讓未來的數字相較之下比較好看。2008到2009年發生金融危機時,很多公司提前登載將淘汰的業務和員工支出、延後認列收入、提早認列虧損。趁著整體經濟大環境壞消息不斷,順勢將自家壞消息盡數公布。如此一來,投資人不僅沒責怪他們無能、犯錯連連,反而激賞他們誠實。此外,把話消息都丟給2009年,2010年的盈餘相較之下就亮麗多了,因為獲利通常是與前一年的同一季度比較
- 資產流動性(liquidity)停止時,就會發生清盤(liquidation)。因此,投資人必須隨時保持警覺。盡量追求資產流動性的極大化,同時盡量減少資產清盤的必要性
- 華爾街一句最有智慧的俗諺:「liquidity(資產流動性、變現性)只有在你不需要的時候才會出現。」在你一心想持有某個證券時,他當時很好賣;但是當你想賣時,卻賣不掉。小型市場、新興市場的證券尤其如此。
- 心理學家的實驗顯示,人是厭惡損失的(lose-averse),虧損 1 元的痛苦比賺 1 元的喜悅還要強烈兩倍以上
- 一位善於經營管理出了名的人,去處理一家眾所皆知財務狀況不佳的公司,能保持名聲無損的,是那家公司
- 如果一家公司的股價(price)下跌,而公司的價值(value)維持穩定,那麼投資人的安全邊際(margin of safety)就會變大。企業的價值(value)變化緩慢,價格(price)卻會出現爆炸性的變動。因此,股市動盪不穩時,通常安全邊際(margin of safety)會拉大;也就是說,風險最大的時候,正式投資最安全的時刻。懂得善用此一弔詭現象的人,才能充分發揮投資人的潛力。
- 雖然你努力不要在熊市賠錢,最常見的結果反而是在牛市賺不了錢
- 影響你對金錢的態度的因素,往往是錢怎麼來的、你打算怎麼花,而不是你有多少錢。如年終獎金得到的錢,你會買實用的東西;樂透得到的錢,你會拿去揮霍享受
- 動能股(momentum stock)會隨著上漲而日益加速狂飆,無視摩擦力、金融地心引力、牛頓第一運動定律、邏輯和理性。沒有任何理論或經驗可解釋動能的元成因、為何會持續、為何最終會衰退。一旦動能(momentum)停止,動能股也不會減緩,而會以高速去撞牆,把剛好持有的投資人撞得粉身碎骨。
- 共同基金(mutual fund)是一點也不互相(mutual)的基金。他的投資人的確很公平地共同分擔所有風險,不過他的經理人則獨享了所有手續費
- 在投資裡,短視(myopia)這個缺陷是很正常的,幾乎是全面性的普遍現象,唯一的療法只能靠紀律、耐心、自制力,因此絕大多數投資人都深受其苦
- 每當有人試圖以「新經濟」(new economy)說服你冒更大投資風險,請記得一句話:「『新』其實非常舊,甚至可以說是最舊的東西。」
- 英文裡代價最高的四個字是:this time, it’s different
- News 是噪音,也是混亂的聲音,也是投標的價格上下波動的原因,是交易人的命脈,通常也是投資人的禍根
- 經常更新自己投資標的最新消息的投資人,交易頻率會增加兩成,但是平均來說,獲利卻不到不追蹤消息的投資人的一半
- 隨時得知金融市場的最新消息,不等於知道未來即將發生什麼
- 若是消息不靈通、對這個世界缺乏好奇心,不可能成為成功的投資人;不過,聰明的投資人不會日日夜夜、無時無刻在追蹤消息。財經消息就像陽光,適度吸收是必要的,但是過度曝曬很危險,甚至可能致命
- 由於回歸平均值(regression to the mean)的關係,股票和投資經理人在被打入冷宮之前,一定會有一段看似火紅的時期。被預言是 the next Warren Buffet 且長期下來稱得上有 Buffet 影子的人,比例也才不過 0.01%
- 每當看到或聽到某支股票、每個投資經理人或某個金融資產號稱是下一個 Apple、下一個 Warren Buffet,下一個你該做的動作就是把它拋到腦後
- 如果一開始買進價格就過高,未來業績再怎麼亮麗都於事無補
- Overconfidence(過度自信)就是不知道自己無知,在金融市場中,絕對有必要加以克服,但要繳非常多學費
- 某支證券的持有部位高於平均,那就是 overweight (過重)。例如,若 Apple 公司佔 S&P 500 總市值的 3.8%,而有一支基金持有 Apple 3.9%資產,那就是 overweight了
Total Pageviews
2017/08/02
[閱讀筆記] 惡魔財經辭典 (The Devil’s Financial Dictionary) [4/6]
Labels:
Investment,
Reading
2017/08/01
[閱讀筆記] The Black Swan: The Impact of the Highly Improbable (3/3)
- Gaussian(高斯)提出的常態分配 (bell curve) 在現實的世界不太管用,因為若遇到罕見的事件,用常態分配預估的錯誤機率就會越高。罕見事件總是慢慢累積、形成,然後在某個時間點給你一記重擊
- 統計學中使用的平均數、標準差等等,僅適用於certainty world,但是,我們身處uncertainty world
- 小心你所看到的統計數字,它可不科學,其實是詐騙
- 標準差這個數字本身沒有意義,你必須知道數字背後的意義。就像溫度計所顯示的溫度是沒有意義的,你必須要知道溫度與舒適度本身的關聯,如攝氏23~25度是個舒適的天氣,攝氏十度以下就是個令人不舒服的寒冷天氣
- 在真實世界哩,過去的成功,不代表會增加未來成功的機率。如同coin-flip game,每一次丟錢幣的過程都是獨立的,上一次得到正面或反面,跟這次會得到的結果無關
- 當你接觸到財務模型或理論時,你應該關心他的假設前提是什麼,而不是其理論。當他的假設是有問題的,與真實世界背離,這個理論與模型就是無用的了
- 不要誤會你可以衡量未來事件發生的機率
- 錯過一班火車時,只有你曾努力追趕卻沒趕上時,你才會感到痛苦
- 大部分的研究模型,都是根據過去有規律的事件,在預測其未來發生的可能性。但是罕見事件是非規律的,你根本無從預測,例如第一次世界大戰的爆發,你無前例可循;1987年的美股,一天崩跌23%,你也無前例可循
- 我們身處於非線性的世界 (線性的世界只存在你的教室裡、課本中),例如天氣預測模型深受非線性因素的影響,即便你有一個正確的模型 (實際上你一定沒有),只要一個輸入參數有變化,你可能得到完全不同的結論
- 面對黑天鵝,你要保護自己避免受到壞的黑天鵝的攻擊 (多掌握機會去擁抱好的黑天鵝),即便你沒有證據去證明這隻壞的黑天鵝會發生,這就像機場的安全檢查,我們無法確認那些人是恐怖份子,所以就會針對每個人及其行李做金屬探測與X光檢查。
- 當一個事件越罕見,我們就越沒有過去的歷史資料可以參考 (即假設未來的事情會與過去的事件一樣),我們就會越仰賴理論來推敲、預測此罕見事件發生的可能性
- 投資成功之道在於如何避免損失,而非如何獲取利潤
- 書店上充斥的某某某成功致富的書籍,卻看不到『我從破產中學到的教訓』、『人生中應該避免犯的十個錯誤』等之類書名的書籍
- Scenario analysis 與 stress testing 都是根據過去的資料來做預測,其預測結果不具備任何意義
- 記住一點,儘管你的長期收益是賠錢的,你的理專一樣一直在賺錢
- 一些從統計書籍出現的字眼,如linear agression、sharpe ratio、standard deviation等等,你可以直接忽略,這些東西對於罕見事件,毫無助益
- 華爾街的理財顧問們,永遠只有獎勵,無論他的成績如何。正常的資本主義應該是獎勵與懲罰並存,而非只有獎勵
- 因為全球化的關係,國與國之間的經濟網絡更加密切與複雜,這時,你投資的金融商品就應該要選擇簡單與單純的商品,避開複雜的金融商品
- 政府應該禁止銀行販售複雜的金融商品,因為根本沒有人了解其內容,真正能保持理性了解其內容的人更是少之又少
- 龐氏騙局(英語:Ponzi scheme,在華人社會又稱為「非法集資」、「非法吸金」或「種金」、老鼠會)是層壓式推銷方式的一種,參與者要先付一筆錢作為入會代價,而所賺的錢是來自其他新加入的參加者,而非公司本身透過業務所賺的錢。投資者通過不斷吸引新的投資者加入付錢,以支付上線投資者,通常在短時間內獲得回報。但隨著更多人加入,資金流入不足,騙局泡沫爆破時,最下線的投資者便會蒙受金錢損失。
- 前景理論 (Prospect Theory) 有兩大定律:
- 人們在面臨獲得時,往往小心翼翼,不願冒風險;而在面對損失時,人人都變成了冒險家
- 人們對損失和獲得的敏感程度是不同的,損失的痛苦要遠遠大於獲得的快樂
Labels:
Investment,
Reading
2017/07/11
Utilize AgeFileFilter to filter either newer files or files equal to or older
Scenario
I have an requirement to read a specific directory (including subdirectories) to find five days before log files and delete them.
How to do it?
How-To
Add commons-io to your maven dependency:
Here has code snippet:
Reference
[1] https://commons.apache.org/proper/commons-io/javadocs/api-2.4/org/apache/commons/io/filefilter/AgeFileFilter.html
I have an requirement to read a specific directory (including subdirectories) to find five days before log files and delete them.
How to do it?
How-To
Add commons-io to your maven dependency:
1 2 3 4 5 | <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.5</version> </dependency> |
Here has code snippet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | /** * 找出某個日期以前的檔案. * * @param directory 找出某個目錄下的檔案 * @param days 找出數天前 (如 -20) * @param includeSubdir 是否包含子目錄 (true / false) * @return List of File */ public static List<File> getFilesBeforeXDays(File directory, int days, Boolean includeSubdir) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(Calendar.DATE, days); cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.HOUR_OF_DAY, 0); Date date = cal.getTime(); IOFileFilter ageFileFilter = FileFilterUtils.ageFileFilter(date); IOFileFilter subDirFilter = includeSubdir ? FileFilterUtils.trueFileFilter() : FileFilterUtils.falseFileFilter(); Collection<File> fileCollection = org.apache.commons.io.FileUtils.listFiles(directory, ageFileFilter, subDirFilter); if(CollectionUtils.isEmpty(fileCollection)){ log.info("Cannot find any log files before " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS").format(date)); } else{ log.info("Find " + fileCollection.size() + " log file(s)."); } return new ArrayList<File>(fileCollection); } |
Reference
[1] https://commons.apache.org/proper/commons-io/javadocs/api-2.4/org/apache/commons/io/filefilter/AgeFileFilter.html
Labels:
Apache Project,
Java
2017/07/10
How to Clear Code Coverage Highlight in Eclipse
Problem
I am using EclEmma, a free Java code coverage tool for Eclipse, to generate code coverage analysis report. The report looks like:
EclEmma provide source highlighting to show the result of code coverage. If I would like to clear code coverage highlight, how to do it?
How-To
Click "Remove All Sessions" in Coverage tab
I am using EclEmma, a free Java code coverage tool for Eclipse, to generate code coverage analysis report. The report looks like:
EclEmma provide source highlighting to show the result of code coverage. If I would like to clear code coverage highlight, how to do it?
How-To
Click "Remove All Sessions" in Coverage tab
Labels:
Eclipse
2017/07/09
[HttpClient] Fail to Get Response from a Valid URL
Problem
I am using HttpClient Get method to retrieve the response body of the HTTP method, if any.
During the execution, I fail to get response from a valid URL.
The code snippet is as follows:
How-To
In my office, I need to specify proxy server before I connect to various services.
Therefore, the source code will be modified as follows:
Maven dependencies are as follows:
I am using HttpClient Get method to retrieve the response body of the HTTP method, if any.
During the execution, I fail to get response from a valid URL.
The code snippet is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | package albert.practice.http; import java.io.IOException; import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.params.HttpMethodParams; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Charsets; import com.google.common.base.Strings; public class HttpSmsClient { private final static Logger logger = LoggerFactory.getLogger(HttpSmsClient.class); public static String getResponse(String url) throws IOException { String responseString = ""; HttpClient client = new HttpClient(); GetMethod method = new GetMethod(url); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); int statusCode; try { statusCode = client.executeMethod(method); if (HttpStatus.SC_OK == statusCode) { responseString = IOUtils.toString(method.getResponseBodyAsStream(), Charsets.UTF_8); } } catch (IOException e) { throw e; } finally { method.releaseConnection(); } logger.info("responseString = " + responseString); return responseString; } } |
How-To
In my office, I need to specify proxy server before I connect to various services.
Therefore, the source code will be modified as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | package albert.practice.http; import java.io.IOException; import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.params.HttpMethodParams; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Charsets; import com.google.common.base.Strings; public class HttpSmsClient { private final static Logger logger = LoggerFactory.getLogger(HttpSmsClient.class); public static String getResponse(String url, String proxy, String port) throws IOException { String responseString = ""; HttpClient client = new HttpClient(); HostConfiguration hostConfiguration = client.getHostConfiguration(); hostConfiguration.setProxy(proxy, Integer.valueOf(port)); client.setHostConfiguration(hostConfiguration); GetMethod method = new GetMethod(url); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); int statusCode; try { statusCode = client.executeMethod(method); if (HttpStatus.SC_OK == statusCode) { responseString = IOUtils.toString(method.getResponseBodyAsStream(), Charsets.UTF_8); } } catch (IOException e) { throw e; } finally { method.releaseConnection(); } logger.info("responseString = " + responseString); return responseString; } } |
Maven dependencies are as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <dependencies> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.1.7</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-httpclient/commons-httpclient --> <dependency> <groupId>commons-httpclient</groupId> <artifactId>commons-httpclient</artifactId> <version>3.1</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-io/commons-io --> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>20.0</version> </dependency> </dependencies> |
Labels:
Apache Project
2017/07/08
[HttpClient] Warning: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
Problem
I am using HttpClient Get method to retrieve the response body of the HTTP method, if any.
During the execution, the console print this warning message:
The code snippet is as follows:
How-To
This warning message results from Line 38
According to its recommendation, the source code will be modified as bellows:
Maven dependencies are as bellows:
I am using HttpClient Get method to retrieve the response body of the HTTP method, if any.
During the execution, the console print this warning message:
Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
The code snippet is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | package albert.practice.http; import java.io.IOException; import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.params.HttpMethodParams; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Strings; public class HttpSmsClient { private final static Logger logger = LoggerFactory.getLogger(HttpSmsClient.class); public static String getResponse(String url, String proxy, String port) throws IOException { String responseString = ""; HttpClient client = new HttpClient(); if (!Strings.isNullOrEmpty(proxy) && !Strings.isNullOrEmpty(proxy)) { HostConfiguration hostConfiguration = client.getHostConfiguration(); hostConfiguration.setProxy(proxy, Integer.valueOf(port)); client.setHostConfiguration(hostConfiguration); } GetMethod method = new GetMethod(url); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); int statusCode; try { statusCode = client.executeMethod(method); if (HttpStatus.SC_OK == statusCode) { responseString = method.getResponseBodyAsString(); } } catch (IOException e) { throw e; } finally { method.releaseConnection(); } logger.info("responseString = " + responseString); return responseString; } } |
How-To
This warning message results from Line 38
According to its recommendation, the source code will be modified as bellows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | package albert.practice.http; import java.io.IOException; import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.params.HttpMethodParams; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Charsets; import com.google.common.base.Strings; public class HttpSmsClient { private final static Logger logger = LoggerFactory.getLogger(HttpSmsClient.class); public static String getResponse(String url, String proxy, String port) throws IOException { String responseString = ""; HttpClient client = new HttpClient(); if (!Strings.isNullOrEmpty(proxy) && !Strings.isNullOrEmpty(proxy)) { HostConfiguration hostConfiguration = client.getHostConfiguration(); hostConfiguration.setProxy(proxy, Integer.valueOf(port)); client.setHostConfiguration(hostConfiguration); } logger.info("url = " + url); GetMethod method = new GetMethod(url); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); int statusCode; try { statusCode = client.executeMethod(method); logger.info("[getResponse] statusCode = " + statusCode); if (HttpStatus.SC_OK == statusCode) { responseString = IOUtils.toString(method.getResponseBodyAsStream(), Charsets.UTF_8); } } catch (IOException e) { throw e; } finally { method.releaseConnection(); } logger.info("responseString = " + responseString); return responseString; } } |
Maven dependencies are as bellows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | <dependencies> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.1.7</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-httpclient/commons-httpclient --> <dependency> <groupId>commons-httpclient</groupId> <artifactId>commons-httpclient</artifactId> <version>3.1</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-io/commons-io --> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>20.0</version> </dependency> </dependencies> |
Labels:
Apache Project
2017/07/07
[webMethods] How to delete threads in webMethods
Problem
假設在 OpcTest 此 package 中會執行數個 flow services
若希望在 package 被 disable 時,能把這幾個 flow services 的 threads 砍掉,該如何做?
How-To
解決方式如下,共有兩個步驟:
Step 1. 建立一個 Java Service,source code 如下:
Step 2. 將此 Java Service 設定為 shutdown service,如此一來,當 package 被 disable 或 integration server 被 shutdown 時,都會執行此 shutdown service
假設在 OpcTest 此 package 中會執行數個 flow services
若希望在 package 被 disable 時,能把這幾個 flow services 的 threads 砍掉,該如何做?
How-To
解決方式如下,共有兩個步驟:
Step 1. 建立一個 Java Service,source code 如下:
public static final void terminationService(IData pipeline) throws ServiceException { IDataCursor pipelineCursor = pipeline.getCursor(); String threadNameToKill = IDataUtil.getString(pipelineCursor, "threadNameToKill"); pipelineCursor.destroy(); if(threadNameToKill == null) { // Fill in the toppest folder name. // Take the OpcTest package for example, it should be "group1". threadNameToKill = "group1"; } Thread current = Thread.currentThread(); ThreadGroup root = current.getThreadGroup(); while (root.getParent() != null) { root = root.getParent(); } Thread [] threads = new Thread[1000]; int count = root.enumerate(threads, true); for(int i = 0 ; i < count ; i++) { if(threads[i] instanceof ServerThread) { ServerThread temp = (ServerThread) threads[i]; String threadName = temp.getName(); logger( "[ Thread Name ]: " + threadName); if(threadName.contains(threadNameToKill)) { logger( "[ Stopping ]: " + threadName); threads[i].stop(); } } } }
Step 2. 將此 Java Service 設定為 shutdown service,如此一來,當 package 被 disable 或 integration server 被 shutdown 時,都會執行此 shutdown service
Labels:
webMethods
2017/07/06
[webMethods] Service 'group2.test:TestSubscriber' is not operational. To run this service, first recompile the Java source.
Problem
當我在執行 Flow Service 時,出現此錯誤
How-To
會出現此錯誤,是因為 webMethods 沒有 compile 此 Java Service,此時要強迫 webMethods 去 compile Java Service
執行步驟:
Step 1. 打開命令提示字元,變更目錄到 [integration server directory]\instances\default\bin
Step 2. 執行 jcode 來做強迫 compile OpcTest2 此 package 下的所有 Java Services,指令如下 jcode makeall [package name]
Reference
[1] https://docs-old.servicerocket.com/display/WMFAQ/How+to+make+a+Java+service+recompiled+even+if+it+hasnt+been+changed
當我在執行 Flow Service 時,出現此錯誤
1: [ISS.0059.0001W] Interrupted [ISS.0026.9102] Service 'group2.test:TestSubscriber' is not operational.
2: To run this service, first recompile the Java source.
How-To
會出現此錯誤,是因為 webMethods 沒有 compile 此 Java Service,此時要強迫 webMethods 去 compile Java Service
執行步驟:
Step 1. 打開命令提示字元,變更目錄到 [integration server directory]\instances\default\bin
Step 2. 執行 jcode 來做強迫 compile OpcTest2 此 package 下的所有 Java Services,指令如下 jcode makeall [package name]
1: D:\SoftwareAG\IntegrationServer\instances\default\bin>jcode makeall OpcTest2
Reference
[1] https://docs-old.servicerocket.com/display/WMFAQ/How+to+make+a+Java+service+recompiled+even+if+it+hasnt+been+changed
Labels:
webMethods
2017/07/05
[Windows] Utilize netsh Command to configure TCP/IP
Frequently used commands are the following:
Show IP configuration
Configures the interface named 區域連線 with the static IP address 192.168.0.100, the subnet mask of 255.255.255.0, and a default gateway of 192.168.0.254:
Configuures primary and secondary DNS:
Configures static IP address to DHPC:
Clear DNS configuration
Show IP configuration
netsh interface ip show config
Configures the interface named 區域連線 with the static IP address 192.168.0.100, the subnet mask of 255.255.255.0, and a default gateway of 192.168.0.254:
netsh interface ipv4 set address name="區域連線" source=static address=192.168.0.100 mask=255.255.255.0 gateway=192.168.0.254
Configuures primary and secondary DNS:
netsh interface ipv4 add dnsserver "區域連線" address=10.160.1.9 index=1 netsh interface ipv4 add dnsserver "區域連線" address=10.160.128.9 index=2
Configures static IP address to DHPC:
netsh interface ip set address "區域連線" dhcp
Clear DNS configuration
netsh interface ip set dns "區域連線" dhcp
Labels:
MicrosoftWindows
2017/07/04
[webMethods] 打開 Java Services 出現 source not available
Problem
當我將開發好的 package export and import 到另外一台 integration server,另外一外工程師無法看到我開發好的 Java Services,在其 designer 中出現 source not available 的錯誤,但是我卻可以看到,沒有遇到相同的問題
How-To
目前發現有兩個解決方式:
當我將開發好的 package export and import 到另外一台 integration server,另外一外工程師無法看到我開發好的 Java Services,在其 designer 中出現 source not available 的錯誤,但是我卻可以看到,沒有遇到相同的問題
How-To
目前發現有兩個解決方式:
- 由於我的 Java Services 中的程式註解有寫繁體中文,另外一位工程師可能是 Windows 語系設定與我不同的關係,導致在他的電腦中,無法看到 Java Services 的內容,當我將繁體中文的註解改成英文以後,此問題就解決了
- 由於不明原因造成,重開 designer 之後,就可以看到 Java Service 的內容
Labels:
webMethods
Subscribe to:
Posts (Atom)