To remove a directory:
# rmdir <name of directory>
The above command does not delete directories with contents in it. Use this command to delete directories with contents:
# rm -rf <name of directory>
To check the difference between 2 text files in Linux:
# diff <name of file 1> <name of file 2> eg: diff file1.txt file2.txt
To see the format of the file
# file <name of the file>
To find a file in a directory tree
# find dir -name <name of the file> -print
Shell input and output commands wbere i want to send an output to file instead of displaying onto the terminal. I use the redirection '>' character:
# <enter the command first, then the redirection> > test.txt
eg: df -l > check_disk.txt
To append the output to a file, simply issue the command again as shown above with another redirection char.
eg: df -l >> check_disk.txt
Thursday, 24 March 2011
Wednesday, 23 March 2011
Processes in Linux
To take a peek of process or to stop them is the same as what we do in windows where we right click on the task bar, click to open up the task manager.
The window will display all the processes currently running in windows. To stop or kill the processes, simply select one of them and click on the 'End Task' button.
So how do i do in Unix? When i display the processes in unix, the terminal will display these information on the window:
PID = process id
TTY = terminal device where process is running
STAT = Process stats
TIME = Amount of CPU time used
COMMAND = Command of the process
To view the detailed report of the process:
# ps ax or # ps u or # ps -ef
To kill a process, simply issue the above command, look for the PID number and issue this command with the number:
# kill <ENTER THE PID_NUMBER>
To freeze or stop a process
# kill -STOP <ENTER THE PID_NUMBER>
To restart a process again
# kill -CONT <ENTER THE PID_NUMBER>
The window will display all the processes currently running in windows. To stop or kill the processes, simply select one of them and click on the 'End Task' button.
So how do i do in Unix? When i display the processes in unix, the terminal will display these information on the window:
PID = process id
TTY = terminal device where process is running
STAT = Process stats
TIME = Amount of CPU time used
COMMAND = Command of the process
To view the detailed report of the process:
# ps ax or # ps u or # ps -ef
To kill a process, simply issue the above command, look for the PID number and issue this command with the number:
# kill <ENTER THE PID_NUMBER>
To freeze or stop a process
# kill -STOP <ENTER THE PID_NUMBER>
To restart a process again
# kill -CONT <ENTER THE PID_NUMBER>
Tuesday, 22 March 2011
Groups in Linux
Sometimes i need to add myself into other groups to access certain files or accessing a software.
Currently this is what i have set up for my linux machine. I prefer to have only 1 initial group. In my opinion, the best way is to have users as the initial group. (This varies for different players or grouping patterns in different environment)
To set myself in the initial group in users:
# usermod -g users chongming
To add myself into other groups:
#gpasswd -a chongming audio
#gpasswd -a chongming video
#gpasswd -a chongming floppy
#gpasswd -a chongming cdrom
#gpasswd -a chongming plugdev
Thats the end to groups in Slackware linux
Currently this is what i have set up for my linux machine. I prefer to have only 1 initial group. In my opinion, the best way is to have users as the initial group. (This varies for different players or grouping patterns in different environment)
To set myself in the initial group in users:
# usermod -g users chongming
To add myself into other groups:
#gpasswd -a chongming audio
#gpasswd -a chongming video
#gpasswd -a chongming floppy
#gpasswd -a chongming cdrom
#gpasswd -a chongming plugdev
Thats the end to groups in Slackware linux
Reading the Tsung Reports
This post is to explain the reading of the Tsung reports generate by the Tsung benchmarking tool as shown in my last post.
Below are the screen shots of the reports which Tsung has generate:
Next these are Tsung reports based in graphical description:
Lastly, these are the explanation of the reports which can give the testers some ideas or guidelines on what was going on during the testing.
Reading the report
Network Throughput
The size received and size sent are measured on the ethernet packets sent or received on each hosts during the test.
The size received and size sent are measured on the ethernet packets sent or received on each hosts during the test.
Counters Statistics
The highest rate is the computation of the average of rate every 10 secs. The highest rate is the maximum value for all these estimations.
The Max value for the counter statistics are refering to the number of simultaneous connected users and simultaneous alive users.
The users_count is the number of users created and finished_user_count is the total number of users who complete the test.
Http Response code
Status-Code =
"100" ; Section 10.1.1: Continue
| "101" ; Section 10.1.2: Switching Protocols
| "200" ; Section 10.2.1: OK
| "201" ; Section 10.2.2: Created
| "202" ; Section 10.2.3: Accepted
| "203" ; Section 10.2.4: Non-Authoritative Information
| "204" ; Section 10.2.5: No Content
| "205" ; Section 10.2.6: Reset Content
| "206" ; Section 10.2.7: Partial Content
| "300" ; Section 10.3.1: Multiple Choices
| "301" ; Section 10.3.2: Moved Permanently
| "302" ; Section 10.3.3: Found
| "303" ; Section 10.3.4: See Other
| "304" ; Section 10.3.5: Not Modified
| "305" ; Section 10.3.6: Use Proxy
| "307" ; Section 10.3.8: Temporary Redirect
| "400" ; Section 10.4.1: Bad Request
| "401" ; Section 10.4.2: Unauthorized
| "402" ; Section 10.4.3: Payment Required
| "403" ; Section 10.4.4: Forbidden
| "404" ; Section 10.4.5: Not Found
| "405" ; Section 10.4.6: Method Not Allowed
| "406" ; Section 10.4.7: Not Acceptable
| "407" ; Section 10.4.8: Proxy Authentication Required
| "408" ; Section 10.4.9: Request Time-out
| "409" ; Section 10.4.10: Conflict
| "410" ; Section 10.4.11: Gone
| "411" ; Section 10.4.12: Length Required
| "412" ; Section 10.4.13: Precondition Failed
| "413" ; Section 10.4.14: Request Entity Too Large
| "414" ; Section 10.4.15: Request-URI Too Large
| "415" ; Section 10.4.16: Unsupported Media Type
| "416" ; Section 10.4.17: Requested range not satisfiable
| "417" ; Section 10.4.18: Expectation Failed
| "500" ; Section 10.5.1: Internal Server Error
| "501" ; Section 10.5.2: Not Implemented
| "502" ; Section 10.5.3: Bad Gateway
| "503" ; Section 10.5.4: Service Unavailable
| "504" ; Section 10.5.5: Gateway Time-out
| "505" ; Section 10.5.6: HTTP Version not supported
| extension-code
Main Statistics
Connect is the duration of the connection establishment
Request is the response time for each requests
Page is Response time for each set of requests (a page is a group of request not separated by a thinktime)
Session is the duration of a user session
Error Connection
Error connection is calculate every 10 secs. Below is an example
Name Highest Rate Total Number
Connect is the duration of the connection establishment
Request is the response time for each requests
Page is Response time for each set of requests (a page is a group of request not separated by a thinktime)
Session is the duration of a user session
Error Connection
Error connection is calculate every 10 secs. Below is an example
Name Highest Rate Total Number
Error connection timeout 2/sec 68
For every 10 sec, tsung will dump all its counters for calculation. Therefore the explanation for Highest rate is throughout the whole session,for 10 secs, maximum of timeout found is 2 per second.
Monday, 21 March 2011
Graham and Dodd, Security Analysis Chap 5: Survey and Approach
This is typically a short chapter discussing about the difference between bonds and stock by the gurus.
They have identified that many investors regard bonds as a safe investment which leds to investor to believe that bonds carry assurance against loss.This line is extracted from the book: Safety depends upon and is measured entirely by the ability of the debtor corporation to meet its obligations
They stated that bonds are not consider to be safe if it does not have these critera:
Good earning power of a company
A business with abundant of assets
A bond bought at a low price works like a common stock due to its coupon payments which act like dividends & the appreciation of bond price to par is the same as a common stock with its value appreciating
A bond bought with at high price, callable or convertible is not consider as safe investment as these may be some of the possibilities that an investor might face:
They have identified that many investors regard bonds as a safe investment which leds to investor to believe that bonds carry assurance against loss.This line is extracted from the book: Safety depends upon and is measured entirely by the ability of the debtor corporation to meet its obligations
They stated that bonds are not consider to be safe if it does not have these critera:
Good earning power of a company
A business with abundant of assets
A bond bought at a low price works like a common stock due to its coupon payments which act like dividends & the appreciation of bond price to par is the same as a common stock with its value appreciating
A bond bought with at high price, callable or convertible is not consider as safe investment as these may be some of the possibilities that an investor might face:
- investor may overpay for the bonds
- the calling of the bonds by the issuer can force the investor to look another investment & put a stop to his recurring income
- lastly, the investor faces reinvestment risk as when his bonds are called, he is force to invest his capital at a lower rate
IDX-Tsunami/Tsung: Benchmark Testing on the App Server
Today i sure list the steps and ways to use the Tsung tool to check how much stress/load the server could take.
I have use Geronimo to test out the effectiveness of tsung. Previously i have tested it out on Jboss to determine the performance of the application while i was working in my last company. The results are marvelous and we did what we could to improve the areas of the application before it goes live.
Below are the steps to use the tsung benchmarking tool.
Start the Geronimo Application Server in Unix
Open up the web browser and type in the url to access the application. eg: http://localhost:8080/TEST/start.jsp
Next enter this command to start up Tsung
# tsung start
To stop Tsung, enter the command below
# tsung stop
In the print screen below, you may have notice that tsung sends notification on the terminal indicating that the tsung recorder is not started. Do not worry about that as the recorder is to records users ways of using the system and Tsung will generate a scenario xml file to stress test the application.
to check the number of users being simulate during testing on the terminal
# tsung status
The figure below is a brief report on its status in testing the application
Next generate the reports for the Geronimo testing
cd into the tsung folder when the data is store
Now lets type the commands to generate the reports from the test
I will list down the reports next time once i have compile all the screenshots ready to be upload into the system.
Hope Tsung helps you to stress test your application.
Friday, 18 March 2011
Installing the WICD software to scan for wireless ip address
WICD is fd and wireless network manager for Linux.
Some features include:
- Ability to connect to wired and wireless networks
- Profiles for each wireless network and wired network
- Many encryption schemes, some of which include WEP/WPA/WPA2
- Compatible with wireless-tools
I'm installing this software in my linux machine. So after installing, i need to start up the Wicd in my machine by opening up a terminal:
# su root
# key in my root password
Start up Wicd by executing this command:
# wicd
However the method above requires me to start up the wicd everytime when i restart my machine. Therefore i chose to edit the rc.d file to start up wicd automatically.
Check your /etc/rc.d directory and make sure rc.wicd is executable
Using vi editor, add in these lines into the file
Some features include:
- Ability to connect to wired and wireless networks
- Profiles for each wireless network and wired network
- Many encryption schemes, some of which include WEP/WPA/WPA2
- Compatible with wireless-tools
I'm installing this software in my linux machine. So after installing, i need to start up the Wicd in my machine by opening up a terminal:
# su root
# key in my root password
Start up Wicd by executing this command:
# wicd
However the method above requires me to start up the wicd everytime when i restart my machine. Therefore i chose to edit the rc.d file to start up wicd automatically.
Check your /etc/rc.d directory and make sure rc.wicd is executable
Using vi editor, add in these lines into the file
if [ -x /etc/rc.d/rc.wicd ]; thenRestart my machine to check if it load wicd automatically
/etc/rc.d/rc.wicd start
fi
Tuesday, 15 March 2011
To sell or not to sell in this bear market.
The date is 15-03-2011. For the past few weeks, negative news keep spewing in affecting the markets day by day.
The first thing that pops in my mind is how much have i lost. I'm an investor following the techniques of value investing. Even i have the fear of losing money, looking at my live watch-list a few hours ago thinking, 'Why i never liquidate my portfolio a few days earlier'.
Closing off the watch-list, i recalled that my goal is long term investing. Due to fear, i have forgotten that i should invest long term when i started to inject my funds into the market.
I opened up my book, Value investing by James Montier. I'm a fan of his articles and his articles can be found here
His works are based on behavioral investing and he has shared some of his ideas and advice in his books.
So for me or even you in this case, and you are using fundamental & value techniques to invest and current looking at the red numbers in your portfolio, FRET NOT!!! You are not alone.
In the James Montier Book again, Value Investing, he included a section on page 209 showing the list of value investors (source from guru focus) performance of stocks bought in the last 12 months for Year 2009 Feb. (My book states the date of published was Feb 2009, so i assume this list of value investors bought their funds between 2008 to 2009).
Even experts are having unrealized negative returns in their portfolio and strongly believe in their visions of long term investing based on their experiences, so why should i, who is not even an expert has to fear about.
So to end this topic, what have i done to ensure that my portfolio is alright and i should be patient? As followers of value investing should understand that value investing and patience goes hand in hand.
- Firstly Chinese govt trying to introduce new regulations to minimize the growth of inflation, their property market.
- Unfavored weather patterns results in low produce which increase the price of commodities.
- Libyan uprising results in the spike of oil price.
- Spanish downgraded 1 notch by Moody on Mar 10 2011
- Earthquake & tsunami in Japan.
- Today news reported about the meltdown of Japanese nuclear reactors and fear of radiation send world markets in red numbers.
The first thing that pops in my mind is how much have i lost. I'm an investor following the techniques of value investing. Even i have the fear of losing money, looking at my live watch-list a few hours ago thinking, 'Why i never liquidate my portfolio a few days earlier'.
Closing off the watch-list, i recalled that my goal is long term investing. Due to fear, i have forgotten that i should invest long term when i started to inject my funds into the market.
I opened up my book, Value investing by James Montier. I'm a fan of his articles and his articles can be found here
His works are based on behavioral investing and he has shared some of his ideas and advice in his books.
In his book (Value Investing) on page 210, he has shared that short term underperformance is often the by-product of a sensible investment process. For instance, if everyone else is trying to guess the next quarter's earnings and you are exploiting a long time frame, you may find yourself staring at the wrong end of a bout of underperformance.He has stated that even on a 3 year horizon, between 20% and 30% of best long term managers were in the bottom decile.
So for me or even you in this case, and you are using fundamental & value techniques to invest and current looking at the red numbers in your portfolio, FRET NOT!!! You are not alone.
In the James Montier Book again, Value Investing, he included a section on page 209 showing the list of value investors (source from guru focus) performance of stocks bought in the last 12 months for Year 2009 Feb. (My book states the date of published was Feb 2009, so i assume this list of value investors bought their funds between 2008 to 2009).
- Bruce Berkowitz: -9%
- Mohnish Prabai: -38%
- Richard Rogriguex: -21%
- Tweedy Browne: -13%
- Jean-Marie Eveillard: -7%
- and a few more which i will not list here
Even experts are having unrealized negative returns in their portfolio and strongly believe in their visions of long term investing based on their experiences, so why should i, who is not even an expert has to fear about.
So to end this topic, what have i done to ensure that my portfolio is alright and i should be patient? As followers of value investing should understand that value investing and patience goes hand in hand.
- I check my analysis, how i derived my estimated value again and checked if the company has any new problems surfacing.
- Ask myself, what caused the market to dive down. Is it the industry problems, world-wide news or company issues?
- Ask myself again, when i start to invest, am i investing for long term or speculate for short term? If long term, why bother about negative news that will temporary affected the market?
Investors should consider trying to adopt the Buddhist approach to time. The past is gone and cannot be change as well as the future is unknown and we must focus on the present. The decision to invest or not should be a function of the current situation, not governed by our prior experiences. Our brains looks to be wired to focus on short term and fear loss. These mental hurdles are the barriers to sensible investment decision in a bear market.
Monday, 14 March 2011
Mouse setup in Linux for slackware
Mouse with wheel setup in Slackware.
The option resolution adjusts the speed of the mouse on the screen. Use the
log in as root
open up the xorg.conf file using vi editior or kwrite
# kwrite /etc/X11/xorg.conf
Inside the file, search for this section "Input Device"
Check for "Mouse0"
Add in these lines into xorg.conf
Section "Input Device"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "IMPS/2"
Option "Device" "/dev/psaux"
Option "Buttons" "5"
Option "ZAxisMapping" "4 5"
Option "Core Pointer"
Option "SendCoreEvents" "true"
ZAxisMapping
defines which of these buttons will be used for the mousewheel.The option resolution adjusts the speed of the mouse on the screen. Use the
log in as root
open up the xorg.conf file using vi editior or kwrite
# kwrite /etc/X11/xorg.conf
Inside the file, search for this section "Input Device"
Check for "Mouse0"
Add in these lines into xorg.conf
Section "Input Device"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "IMPS/2"
Option "Device" "/dev/psaux"
Option "Buttons" "5"
Option "ZAxisMapping" "4 5"
Option "Core Pointer"
Option "SendCoreEvents" "true"
Option "Resolution" "1600"
Restart the X server to load in all the new configurations.
To edit the speed of the mouse pointer on the screen,
open up the command line and use the xset command
The command below is what i have used with good results
# xset m 5 1
To set the xset to default, on the command line type:
# xset m default
Saturday, 12 March 2011
IDX-Tsunami/Tsung The load testing tool
I need a reliable load balancing test tool. Jmeter is available online as a free tool but it seems that it does not provide more in depth test results.
I manage to search online that there is a free load balance tool and i decide to check it out and use it to test it in my Linux machine before i introduce & recommend this tool to test the applications i developed at work.
Here are some of the introductions of Tsung and Tsung can be download from:
http://tsung.erlang-projects.org/
Development of idx-tsunami
Tsunami is developed in Erlang and this is where the power of Tsunami relies. Tsunami is based on the Erlang OTP (Open Transaction Platform) and inherits several characteristics from Erlang:
- Performance: Erlang has been made to support hundred thousands of lightweight processes in a single virtual machine.
- Scalability: Erlang development environment is naturally distributed,promoting the idea of processes location transparency.
- Fault Tolerance: Erlang has been built to develop robust, fault-tolerant systems. As such,wrong answer sent from the server to Tsunami does not make the whole running benchmark crash.
For Tsung to work, i need to install ERLANG or Ericsson language platform in my machine. These are the steps to install the platform
Download this application from:
http://www.erlang.org/download.html
Unzip the folder
# tar -zxvf <erlang folder.tar.gz>
http://www.erlang.org/download.html
Unzip the folder
# tar -zxvf <erlang folder.tar.gz>
Move into the unzip folder
# cd otp_src_R12B-0
# ./configure –prefix=/usr/local/erlang
# make
# make install
Now i shall continue to install the Tsung or idx-tsunami in my system
Download Tsung from:
Select the latest distribution and proceed with the instructions below
Unzip the folder
Configure the tsung and make install
Next install by using:
# make
# make install
Mounting a NTFS partition or drive to Linux
Steps to mount a NTFS drive to SUSE. For SUSE, the driver to access the ntfs in SUSE is already available when SUSE is install on the computer.
List out all the file systems on the hard drive
# df -h
# dmesg
# dmesg |grep hda
Create a directory to allow the ntfs partition to mount into
# mkdir /mnt/win
Mount the ntfs partition to /mnt/win
# mount -t ntfs /dev/sda2 /mnt/win
Check if windows partition is registered.
# cat /etc/fstab
To access the ntfs partition, simply access the directory i created
# cd /mnt/win
For slackware, driver to access the ntfs partition is not installed. For me, i installed the ntfs-3g to help me to mount ntfs partition to linux directory. The ntfs-3g package is available at the SlackBuilds webpage,
After installing, use this command to mount:
# ntfs-3g -o uid=chongming /dev/sdv1 /media/hd
/dev/sdv1 is the drive partition detect by linux system. Use df -h to detect the drives.
List out all the file systems on the hard drive
# df -h
# dmesg
# dmesg |grep hda
Create a directory to allow the ntfs partition to mount into
# mkdir /mnt/win
Mount the ntfs partition to /mnt/win
# mount -t ntfs /dev/sda2 /mnt/win
Check if windows partition is registered.
# cat /etc/fstab
To access the ntfs partition, simply access the directory i created
# cd /mnt/win
For slackware, driver to access the ntfs partition is not installed. For me, i installed the ntfs-3g to help me to mount ntfs partition to linux directory. The ntfs-3g package is available at the SlackBuilds webpage,
After installing, use this command to mount:
# ntfs-3g -o uid=chongming /dev/sdv1 /media/hd
/dev/sdv1 is the drive partition detect by linux system. Use df -h to detect the drives.
Friday, 11 March 2011
Graham and Dodd, Security Analysis Chap 3 & 4: Survey and Approach
In this book, Chapter 3 covers on where to look for information for fundamental investors. His list of sources of information are:
In Chapter 4, they covered on the difference between Investment and Speculation.
Lastly Graham views on Investment Value, Speculative value and Intrinsic value.
For ecxample, a security is selling in the market at $38. $38 is the investment value. Suppose after estimating, the intrinsic value is $25. Therefore $13 will be consider as speculative value. The reason why it is speculative value is because this value is appraise by the general market and every individual investor judgement.
- SEC
- Standard & Poor, Fitch or other statistical agencies
- Federal Trade Commission
- Committee on interstate & Foreign Commerce
- Commercial & Financial Chronicle
- Requests for information directly from the company
- Looking at its registration statements and prospectus
In Chapter 4, they covered on the difference between Investment and Speculation.
- Graham believes that buying securities with the hope of profiting in a short period of time is deemed as speculation.
- A slow growth in value & constant dividends does not mean it is a bad investment
- Graham approach to investing is to hold long periods and focus on dividends for constant income and growth in share price for appreciation which he considers as investment
- Looking towards a quick rise in value & despise dividends can lead to speculation.
- Margin of safety is the most important concept to embrace in investing. One of his views is to reduce the loss of capital.
- Safety of margin is much more easier to estimate and adjust if the company holds tangible assets
- So when to sell? Graham sells when the market price is higher than the intrinsic value. This intrinsic value is the value which Graham estimates from the company financial statements
- The value of the security derived from calculating or estimating does not means that it can be consider as a total safety factor. The industry & business may have certain risk that is unable to use maths or numbers to calculate. Therefore this leads to diversification to reduce the risk.
- Blue chip companies are not consider safe investments all the time. Demand and economy change with time, so does business. If the blue chip business is not able to catch up with the changing times, sooner or later the company will be out of business
Lastly Graham views on Investment Value, Speculative value and Intrinsic value.
For ecxample, a security is selling in the market at $38. $38 is the investment value. Suppose after estimating, the intrinsic value is $25. Therefore $13 will be consider as speculative value. The reason why it is speculative value is because this value is appraise by the general market and every individual investor judgement.
How to write a mysql plan xml file for Geronimo
To create a database pool in Geronimo, i need to write a mysql xml plan for Geronimo. Without this xml file, the pool could not be create. Below are the steps to follow to create the xml file.
Writing this plan is essential to connect to external database. This plan is to be go hand in hand with a file in geronimo repository. The path to the respository:
/home/chongming/geronimo-2.1/repository/org/tranql/tranql-connector-ra/1.3/tranql-connector-ra-1.3.rar
Firstly we need to download the mysql connector from:
Create folder under /home/chongming/geronimo-2.1/respository:
# mkdir mysql/mysql-connector-java/3.1.14-bin
Copy the sql-connector jar file into the directory
# cp mysql-connector-java /home/chongming/geronimo-2.1/respository/mysql/mysql-connector-java/3.1.14-bin
Below is an example of creating a mysql-geronimo-plan.xml file. Edit the file as necessary
In fact what i need to key in under the tags are:
- <config-property-setting name="UserName"> = Username of my database
- <config-property-setting name="Password"> = Password of my database
- <config-property-setting name="Driver"> = The driver for the database
- <config-property-setting name="ConnectionURL"> = The connection url for the apps to database
- <global-jndi-name> = The jndi for the database
========================================================
<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
<dep:moduleId>
<dep:groupId>user</dep:groupId>
<dep:artifactId>jdbcdatasource</dep:artifactId>
<dep:version>2.0</dep:version>
<dep:type>car</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>mysql</dep:groupId>
<dep:artifactId>mysql-connector-java</dep:artifactId>
<dep:version>3.1.14-bin</dep:version>
<dep:type>jar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<resourceadapter>
<outbound-resourceadapter>
<connection-definition>
<connectionfactory-interface>
javax.sql.DataSource
</connectionfactory-interface>
<connectiondefinition-instance>
<name>MusicDS</name>
<config-property-setting name="UserName">
chongming
</config-property-setting>
<config-property-setting name="Password">
password
</config-property-setting>
<config-property-setting name="Driver">
com.mysql.jdbc.Driver
</config-property-setting>
<config-property-setting name="ConnectionURL">
jdbc:mysql://localhost:3306/music
</config-property-setting>
<config-property-setting name="CommitBeforeAutocommit">
false
</config-property-setting>
<config-property-setting name="ExceptionSorterClass">
org.tranql.connector.NoExceptionsAreFatalSorter
</config-property-setting>
<connectionmanager>
<local-transaction/>
<single-pool>
<max-size>10</max-size>
<min-size>0</min-size>
<blocking-timeout-milliseconds>
5000
</blocking-timeout-milliseconds>
<idle-timeout-minutes>
30
</idle-timeout-minutes>
<match-one/>
</single-pool>
</connectionmanager>
<global-jndi-name>
jdbc/MusicDB
</global-jndi-name>
</connectiondefinition-instance>
</connection-definition>
</outbound-resourceadapter>
</resourceadapter>
</connector>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
<dep:moduleId>
<dep:groupId>user</dep:groupId>
<dep:artifactId>jdbcdatasource</dep:artifactId>
<dep:version>2.0</dep:version>
<dep:type>car</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>mysql</dep:groupId>
<dep:artifactId>mysql-connector-java</dep:artifactId>
<dep:version>3.1.14-bin</dep:version>
<dep:type>jar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<resourceadapter>
<outbound-resourceadapter>
<connection-definition>
<connectionfactory-interface>
javax.sql.DataSource
</connectionfactory-interface>
<connectiondefinition-instance>
<name>MusicDS</name>
<config-property-setting name="UserName">
chongming
</config-property-setting>
<config-property-setting name="Password">
password
</config-property-setting>
<config-property-setting name="Driver">
com.mysql.jdbc.Driver
</config-property-setting>
<config-property-setting name="ConnectionURL">
jdbc:mysql://localhost:3306/music
</config-property-setting>
<config-property-setting name="CommitBeforeAutocommit">
false
</config-property-setting>
<config-property-setting name="ExceptionSorterClass">
org.tranql.connector.NoExceptionsAreFatalSorter
</config-property-setting>
<connectionmanager>
<local-transaction/>
<single-pool>
<max-size>10</max-size>
<min-size>0</min-size>
<blocking-timeout-milliseconds>
5000
</blocking-timeout-milliseconds>
<idle-timeout-minutes>
30
</idle-timeout-minutes>
<match-one/>
</single-pool>
</connectionmanager>
<global-jndi-name>
jdbc/MusicDB
</global-jndi-name>
</connectiondefinition-instance>
</connection-definition>
</outbound-resourceadapter>
</resourceadapter>
</connector>
Completing this xml file should able to create the pool once it is deploy into the app server
Thursday, 10 March 2011
Deploying Enterprise Java Beans file
There are actually 3 ways to deploy the Java source files into the server. The 3 ways are:
Start the server and navigate to this address: http://localhost:8080/console
Enter the username and password
On the left handed menu, under Applications, click on Deploy New
At this page, select the appropriate file to be deploy into the server as shown below:
Deploy Using the Command Line Geronimo
For my commands as show above, I copy my .ear file into geronimo home folder. cd into the geronimo home folder and execute this command:
- Deploy using the Web Console
- Deploy Using the Hot Deploy Folder
- Deploy Using the Command Line
Start the server and navigate to this address: http://localhost:8080/console
Enter the username and password
On the left handed menu, under Applications, click on Deploy New
At this page, select the appropriate file to be deploy into the server as shown below:
Click install after selecting the folder and it will displays its status whether if it is deploy successfully or vice versa.
Deploy Using the Hot Deploy Folder Geronimo
- Navigate to the geronimo home directory
- Navigate to the deploy directory
- Copy the EJB file into the deployment folder
- Open the browser and type the localhost and context root address
Deploy Using the Command Line Geronimo
For my commands as show above, I copy my .ear file into geronimo home folder. cd into the geronimo home folder and execute this command:
This should concludes the 3 different ways of deploying Java .war or .ear files into the Geronimo.
Integrating Geronimo with Eclipse
Installing Eclipse
Installing Eclipse require these softwares:
Download the eclipse software.
http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.3.2-200802211800/eclipse-SDK-3.3.2-linux-gtk.tar.gz
Step 2:
Download the Web Tools Platform
http://download.eclipse.org/webtools/downloads/drops/R2.0/R-2.0.1-20070926042742/
Step 3:
Install the Web tools Platform, Data tools platform, Eclipse Modeling Framework and Graphical Editing Framework into the Eclipse home.
Step 4:
Start the eclipse command:
# cd <eclipse_home>
# ./eclipse
Launching Eclipse with Geronimo
1) Define a new server
2) Click on the 'Download additional server adapters
3) Select the appropriate server driver to connect eclipse to Geronimo server. Currently the server adaptor for geronimo 2.1 is still not available for download.
4) Select the server adapter after complete downloading the adapter into eclipse
5) Click on next to set the Username and Password for Geronimo and click finish
After attempting the necessary steps, i should be able to see the Geronimo page on the browser.
My next post show how to deploy web applications into Geronimo.
Installing Eclipse require these softwares:
- JDK 5.0 (J2SE 5.0)
- Eclipse 3.3.1.1 (Eclipse Classic package of Europa distribution), which is platform specific
- Web Tools Platform (WTP) 2.0.1
- Data Tools Platform (DTP) 1.5.1 file:///media/thumbDrive/Entertainment/Music/09-ost-cursed-clock-tower.mp3
- Eclipse Modeling Framework (EMF) 2.3.1
- Graphical Editing Framework (GEF) 3.3.1
Download the eclipse software.
http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.3.2-200802211800/eclipse-SDK-3.3.2-linux-gtk.tar.gz
Step 2:
Download the Web Tools Platform
http://download.eclipse.org/webtools/downloads/drops/R2.0/R-2.0.1-20070926042742/
Step 3:
Install the Web tools Platform, Data tools platform, Eclipse Modeling Framework and Graphical Editing Framework into the Eclipse home.
Step 4:
Start the eclipse command:
# cd <eclipse_home>
# ./eclipse
Launching Eclipse with Geronimo
1) Define a new server
2) Click on the 'Download additional server adapters
3) Select the appropriate server driver to connect eclipse to Geronimo server. Currently the server adaptor for geronimo 2.1 is still not available for download.
4) Select the server adapter after complete downloading the adapter into eclipse
5) Click on next to set the Username and Password for Geronimo and click finish
6) Back to the eclipse, select the Server tab and click on the button to start the server
After attempting the necessary steps, i should be able to see the Geronimo page on the browser.
My next post show how to deploy web applications into Geronimo.
Apache Geronimo - The open source app server for every developers
There are a number of application servers in the market and a few which i can named are weblogic, websphere, tomcat, jboss, etc.
Weblogic, Websphere, TomCat, Jboss 是一些在市场上软件开发人员使用的 Application Servers。I noticed that not many developers are using Geronimo, therefore i decided to check the performance of Geronimo.
我注意到,许多软件开发人员都没有使用Geronimo,所以我决定检查Geronimo的表现和用途。
Geronimo is a server runtime framework that pulls together the best Open Source alternatives to create runtimes that meet the needs of developers and system administrators. So how to use Geronimo and how is it compare to jboss?
Geronimo是一个 App Server 运行时框架, 组在一起最好的开源替代品,以满足运行时创建软件开发人员和系统管理员的需求。因此,如何使用 Geronimo 以及与 JBoss 相比?
The version of Geronimo which i have tested is V2.1 on Linux OS. Let me start with installing Geronimo in Linux.
Geronimo的V2.1版本,我已经测试在 Linux 操作系统(SUSE Linux OS).以下是在Linux上安装Geronimo 的步骤。
Untar the Geronimo folder and place in any directory path.
# tar -zxvf <Geronimo-Compress-Folder>
cd into the Geronimo directory
# cd <Geronimo-Folder>
To start the Geronimo in background, enter these commands:
# cd <Geronimo-Folder>/bin# ./startup.sh
# cd <Geronimo-Folder>
# ./bin/geronimo.sh run
To check if the server is running, type:
- Open up file in <geronimo_folder>/var/config/config-substitutions.properties
- At the line HTTP Port=1982 change to the appropriate port number
- User Names can be created in groups.properties file
- Password are set in users.properties file
- Both files can be found in <geronimo_folder>/var/security
After following the steps above, Geromino should be running in your system.
执行上述步骤后,Geromino可以使用在您的系统。
In my next post, i will document how to use eclipse to start Geronimo.
在我的下一个岗位,我将记录如何使用Eclipse来启动 Geronimo。
In my next post, i will document how to use eclipse to start Geronimo.
在我的下一个岗位,我将记录如何使用Eclipse来启动 Geronimo。
Install Wine to use common Windows Programs
Install wine either from the linux flavour repository or download from wine
After installing, insert the software installation disk.
To start installing"
# wine /<name_of_directory_to_the_executable>/*.exe
After installing, navigate to where the installed file is.
For my case, i installing DreamWeaver. Therefore is will be
# cd /home/chongming/.wine/drive.c/Program Files/Macromedia/Dreamweaver8
Execute the program:
# wine Dreamweaver.exe
To remove the wine contents. simply:
rm -rf ~/wine
After installing, insert the software installation disk.
To start installing"
# wine /<name_of_directory_to_the_executable>/*.exe
After installing, navigate to where the installed file is.
For my case, i installing DreamWeaver. Therefore is will be
# cd /home/chongming/.wine/drive.c/Program Files/Macromedia/Dreamweaver8
Execute the program:
# wine Dreamweaver.exe
To remove the wine contents. simply:
rm -rf ~/wine
Using Price to Sales ratio to value a security
I decided to take CFA mainly because i believe that it can help me to improve my fundamental analysis. Therefore i have been introduce to many mathematical formulas such as P/E ratio, P/S ratio, etc.
P/E ratio is useful if the company is earning profits. If a company P/E is negative, investor can use the P/S ratio (Price to sales ratio) to guage the security value. I have read that sales revenue is not easy to manipulate or distort as EPS and book value, which are significantly affected by accounting conventions.
However i have accidentally found that P/S ratio does not show to be a very good metrics even when the financial statements are not manipulate. It depends on the way how the business is conducted. This is one of my personal experience.
I started an online selling business by creating and program a online shopping cart a few years ago. After a few years, i decided to wind up the online selling business, therefore i decided to sell off all my inventory to get back some of the capital i invested.
So i decided to sell my inventory in discounts。 In the end, my revenue for the past 2 months surge to high volumes. At this point of time, i recorded my revenue once i received the cash in my bank account. I don't keep receivables!!!(this shows i keep an extremely conservative accounting. heehee...)
So lets apply this scenario to a listed company. If the company use this method to increase revenue, buying items at cost price of $10 but sell at $9, is the company growing?
Does this surging of revenue which will lower the P/S ratio alert investors that this is a good buy? I don;t think so.
Anyway ratios are use to gauge and compare. Using it as a buying decision is a wrong move.
我决定采取注册CFA课程,主要是因为我相信它可以帮助我提高我的投资基本分析。因此,我已介绍,如 P/E 比率,P/S 比率等许多数学公式。
P/E 比值是有用的比率要是公司赚取利润。如果一家公司的 P/E 为负,投资者可以使用 P/S 比率 (Price to Sales ratio) 来衡量安全值。我已阅读过,销售收入不容易操纵或歪曲为 EPS 和账面价值,这是显着的会计惯例的影响。
这是我个人的经验之一, 我偶然发现,P/S 比值不显示是一个很好的指标,即使在不能操纵财务报表。这取决于企业是如何进行的方式。
几年前, 我开始通过创建和程序一个在线购物车网上销售业务。经过几年的投入,决定结束我的网上销售业务,因此我决定卖掉我所有的库存,以取回一些我的资本。
所以我决定打折出售库存。结果,收入在2个月上升到高容量。在这个时候,我一旦收到了现金,我立即记录收入进入帐户。 应收账款在我的帐户里是不存在的。
因此,让我申请此方案的上市公司。如果公司使用此方法来增加收入,买10元的按成本,价出售的物品在9美元,公司是在成长吗?公司有在真正的赚钱吗? 这是否会是个好投资?我觉得那不是个好投资。
总之比率来衡量和比较,用 P/S ratio 作为购买决定是一个错误的举动。
P/E ratio is useful if the company is earning profits. If a company P/E is negative, investor can use the P/S ratio (Price to sales ratio) to guage the security value. I have read that sales revenue is not easy to manipulate or distort as EPS and book value, which are significantly affected by accounting conventions.
However i have accidentally found that P/S ratio does not show to be a very good metrics even when the financial statements are not manipulate. It depends on the way how the business is conducted. This is one of my personal experience.
I started an online selling business by creating and program a online shopping cart a few years ago. After a few years, i decided to wind up the online selling business, therefore i decided to sell off all my inventory to get back some of the capital i invested.
So i decided to sell my inventory in discounts。 In the end, my revenue for the past 2 months surge to high volumes. At this point of time, i recorded my revenue once i received the cash in my bank account. I don't keep receivables!!!(this shows i keep an extremely conservative accounting. heehee...)
So lets apply this scenario to a listed company. If the company use this method to increase revenue, buying items at cost price of $10 but sell at $9, is the company growing?
Does this surging of revenue which will lower the P/S ratio alert investors that this is a good buy? I don;t think so.
Anyway ratios are use to gauge and compare. Using it as a buying decision is a wrong move.
我决定采取注册CFA课程,主要是因为我相信它可以帮助我提高我的投资基本分析。因此,我已介绍,如 P/E 比率,P/S 比率等许多数学公式。
P/E 比值是有用的比率要是公司赚取利润。如果一家公司的 P/E 为负,投资者可以使用 P/S 比率 (Price to Sales ratio) 来衡量安全值。我已阅读过,销售收入不容易操纵或歪曲为 EPS 和账面价值,这是显着的会计惯例的影响。
这是我个人的经验之一, 我偶然发现,P/S 比值不显示是一个很好的指标,即使在不能操纵财务报表。这取决于企业是如何进行的方式。
几年前, 我开始通过创建和程序一个在线购物车网上销售业务。经过几年的投入,决定结束我的网上销售业务,因此我决定卖掉我所有的库存,以取回一些我的资本。
所以我决定打折出售库存。结果,收入在2个月上升到高容量。在这个时候,我一旦收到了现金,我立即记录收入进入帐户。 应收账款在我的帐户里是不存在的。
因此,让我申请此方案的上市公司。如果公司使用此方法来增加收入,买10元的按成本,价出售的物品在9美元,公司是在成长吗?公司有在真正的赚钱吗? 这是否会是个好投资?我觉得那不是个好投资。
总之比率来衡量和比较,用 P/S ratio 作为购买决定是一个错误的举动。
Wednesday, 9 March 2011
Setup Java classpath in Linux
For windows, i simply setup the classpath using environment variables.
In linux, i need to manually write in the filepath in ./bashrc(SUSE) or ./bash(slackware)
Use the vi editor to add in the lines
These are some of the classpath i need to set in my linux machine:
export PATH = /home/chongming/jdk1.5/bin:/home/chongming/maven/bin:$PATH
export J2EE_HOME = "/home/chongming/jdk1.5"
export M2_HOME = "/home/chongming/maven"
export CLASSPATH = .:/home/chongming/jdk1.5
After saving the file, open up a terminal and type javac for javato see if the classpath is setup correctly
In linux, i need to manually write in the filepath in ./bashrc(SUSE) or ./bash(slackware)
Use the vi editor to add in the lines
These are some of the classpath i need to set in my linux machine:
export PATH = /home/chongming/jdk1.5/bin:/home/chongming/maven/bin:$PATH
export J2EE_HOME = "/home/chongming/jdk1.5"
export M2_HOME = "/home/chongming/maven"
export CLASSPATH = .:/home/chongming/jdk1.5
After saving the file, open up a terminal and type javac for javato see if the classpath is setup correctly
Video support for slackware linux: Radeon Xpress 1100
I'm using slackware 12.1 and its original configuration could not support the video card. I need to manually install the driver in this case.
Use this to list all hardware in the machine
# lspci
From the results after submitting the above command, use the displayed hardware model number to find the driver online.
The driver can be found at http://ati.amd.com/support/drivers/linux/linux-radeon.html or http://ati.amd/com/support/driver.html
On the website, select Linux ---> Radeon---> Xpress 1300 and d/l the driver.
If the software is not with the website anymore, send me a message and i can send the file to you.
Login as root to install
Type this commanf to list all packages for different distros.
# sh ./ati-driver-installer-8-10-x86.x86-64.run --list pkg
I'm using Slackware so i shall use this command:
# sh ./ati-driverXXX.run --buildpkg Slackware/All
# installpkg <the_file_name_generate _from_buildpkg>
# aticonfig --initial
Restart the X server to see the changes
Use this to list all hardware in the machine
# lspci
From the results after submitting the above command, use the displayed hardware model number to find the driver online.
The driver can be found at http://ati.amd.com/support/drivers/linux/linux-radeon.html or http://ati.amd/com/support/driver.html
On the website, select Linux ---> Radeon---> Xpress 1300 and d/l the driver.
If the software is not with the website anymore, send me a message and i can send the file to you.
Login as root to install
Type this commanf to list all packages for different distros.
# sh ./ati-driver-installer-8-10-x86.x86-64.run --list pkg
I'm using Slackware so i shall use this command:
# sh ./ati-driverXXX.run --buildpkg Slackware/All
# installpkg <the_file_name_generate _from_buildpkg>
# aticonfig --initial
Restart the X server to see the changes
Setup 3D support for Radeon Xpress 1100 for SUSE
Most users use linux on old machines because new OS will always required high hardware requirements.
This setting up of 3D support is for Radeon xpress 1100.
Add in ati repository to yast using the software repository:
http://www2.ati.com/suse/10.3
At root terminal:
# zypper install x11-video-fglrxG01 ati-fglrxG01-kmp 'uname-r | awk -F"-"'{print $NF}''
Check if the 3D is running after the installation
# glxgears
# fgl-glxgears
Stop the X-server by using:
# init 3
Backup the original xorg.conf:
# mv /etc/X11/xorg.conf /etc/X11/xorg.conf-001
Next create the new xorg.conf
# aticonfig --initial --input=/etc/X11/xorg.conf
# sax2 -r -m 0=fglrx
Restart the whole system and it will be in 3D support.
This setting up of 3D support is for Radeon xpress 1100.
Add in ati repository to yast using the software repository:
http://www2.ati.com/suse/10.3
At root terminal:
# zypper install x11-video-fglrxG01 ati-fglrxG01-kmp 'uname-r | awk -F"-"'{print $NF}''
Check if the 3D is running after the installation
# glxgears
# fgl-glxgears
Stop the X-server by using:
# init 3
Backup the original xorg.conf:
# mv /etc/X11/xorg.conf /etc/X11/xorg.conf-001
Next create the new xorg.conf
# aticonfig --initial --input=/etc/X11/xorg.conf
# sax2 -r -m 0=fglrx
Restart the whole system and it will be in 3D support.
Financial Analysis and adverse opinion from auditors for a SGX counter:
Recently there has been an uproar about the presentation of financial statements from some companies listed in SGX.
China HongXing recently has been suspended due to the fact that they have noted irregularities in the cash and bank balances, accounts receivables, accounts payables,and other expenses during the course of their audits.
Frankly speaking, China HongXing is in my pending to buy list based on the facts that by just merely scanning through their past 5 years finance statements, I found that the stock is currently trading below their net asset value. Plus they have lots of liquid cash in their holdings and manage to give out dividends during bad economic times.
Next on 9 Sept 2010, HongXing has published an article stating that it secures an order of about 1 billion RMB in trade fair. The company has also stated it secures a few contracts in the trade fair. It seems that this company is doing very well.
However on Oct 14, the company auditors resign (A Red Flag) followed by on Feb 21 2011, it announce the resignation of the assistant secretary (Another Red Flag).
25 Feb 2011 announced halt and a week later, counter suspended for trading. All these information can be found in SGX, under company announcements section, therefore the figures are accurate at the point of time when i retrieve the statements from SGX website.
This proves to be a wake up call for me. Initially i told myself this counter may be a good buy based on the attractive reasons i have listed above. After trading for so long, i realized that i started to skip to check if the accounts are manipulated before i start to analyze the estimated fair value of the counter.
Therefore i started to analyze the company again to check what are the red flags in the statements. The list below are what i have found out.
Coming to the end of this topic, this suspension really woke me up and I'm glad i realize this mistake which leads me to put more efforts into fundamental analysis to reduce the probability of making errors. However who never make mistakes? Only through errors, i can improve in my analysis.
So to all people who practice fundamental analysis out there. If you do make mistakes here and there, take it as a lesson. Don't give up. A person who never makes mistakes is never consider a season veteran. :)
China HongXing recently has been suspended due to the fact that they have noted irregularities in the cash and bank balances, accounts receivables, accounts payables,and other expenses during the course of their audits.
Frankly speaking, China HongXing is in my pending to buy list based on the facts that by just merely scanning through their past 5 years finance statements, I found that the stock is currently trading below their net asset value. Plus they have lots of liquid cash in their holdings and manage to give out dividends during bad economic times.
Next on 9 Sept 2010, HongXing has published an article stating that it secures an order of about 1 billion RMB in trade fair. The company has also stated it secures a few contracts in the trade fair. It seems that this company is doing very well.
However on Oct 14, the company auditors resign (A Red Flag) followed by on Feb 21 2011, it announce the resignation of the assistant secretary (Another Red Flag).
25 Feb 2011 announced halt and a week later, counter suspended for trading. All these information can be found in SGX, under company announcements section, therefore the figures are accurate at the point of time when i retrieve the statements from SGX website.
This proves to be a wake up call for me. Initially i told myself this counter may be a good buy based on the attractive reasons i have listed above. After trading for so long, i realized that i started to skip to check if the accounts are manipulated before i start to analyze the estimated fair value of the counter.
Therefore i started to analyze the company again to check what are the red flags in the statements. The list below are what i have found out.
- For Year 2008 and 2009, the company has been presenting their non audited annual statements
- Negative free cash flow from year 2005 to 2008 and with a sudden increase of FCF in 2010
- Inventory increase by 20 days in year 2009
- In Yr 2008, statement states a negative CFO. In Yr 2009, it suddenly states a 400% increase
- The sudden increase in their Prepayments, Deposits and Receivables with RMB528,000 in 2006 to RMB278,665 in 2007. A cont increase of 300% in 2008 and suddenly a drop of 90% in 2009. It states that these prepayments are for distributors. I suspect future prepayments are include in 2007 and 2008, which cause 2009 to have less prepayments and increase the CFO
- Furthermore there is no explanation regarding about Prepayments, Deposits and Receivables.
- Based on the past years balance sheet, the accruals in liabilities are increasing every yr except in yr 2009 with a sharp decrease of 40%.
- Suspect that the company is creating of cookie jar reserves in liabilities. The decrease in liability and expense will increase the net profit in the income statement and inflate the CFO.
Coming to the end of this topic, this suspension really woke me up and I'm glad i realize this mistake which leads me to put more efforts into fundamental analysis to reduce the probability of making errors. However who never make mistakes? Only through errors, i can improve in my analysis.
So to all people who practice fundamental analysis out there. If you do make mistakes here and there, take it as a lesson. Don't give up. A person who never makes mistakes is never consider a season veteran. :)
Subscribe to:
Posts (Atom)
Cash flow Forecasting
Why cash forecasting? A cash forecasting model is an essential tool for treasuer to manage working capital. Forecasting preempt treasurer ...
-
I received a question asking me what is the difference between Treasury Centre (TC), In-house bank (IHB) and Shared Services Centre (SSC). ...
-
This post is to explain the reading of the Tsung reports generate by the Tsung benchmarking tool as shown in my last post. Below are the scr...
-
It's been a while updating myself with recent changes to APAC payments landscape since I have moved on to a product management role. I...