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
if [ -x /etc/rc.d/rc.wicd ]; then
/etc/rc.d/rc.wicd start
fi
Restart my machine to check if it load wicd automatically

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.
  • 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
I checked my analysis again to see if i can uncovered anything i have missed, and calculated that right now my portfolio is down by -12.9%.
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?
Lastly as what James Montier has mention on page 127:

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.
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:
  1. Performance: Erlang has been made to support hundred thousands of lightweight processes in a single virtual machine.
  2. Scalability: Erlang development environment is naturally distributed,promoting the idea of processes location transparency.
  3. 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>

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.

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:
  • 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.

  1. Graham believes that buying securities with the hope of profiting in a short period of time is deemed as speculation.
  2. A slow growth in value & constant dividends does not mean it is a bad investment
  3. 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
  4. Looking towards a quick rise in value & despise dividends can lead to speculation.
  5. Margin of safety is the most important concept to embrace in investing. One of his views is to reduce the loss of capital.
  6. Safety of margin is much more easier to estimate and adjust if the company holds tangible assets
  7. 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
  8. 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.
  9. 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>

 Completing this xml file should able to create the pool once it is deploy into the app server

Cash flow Forecasting

Why cash forecasting? A cash forecasting model is an essential tool for treasuer to manage working capital. Forecasting preempt treasurer ...