Saturday, June 16, 2012

Calculation of Intrinsic Value

I have created an excel sheet that could be usefull when calculating Intrinsic values of stocks.
All you have to do is open the excel sheet, and fill in the red numbers in the excel sheet, which you can find on the links next to each box.
Excel will then automatically calculate the intrinsic value of the stock you are analyzing.
If you want to change the ticker, open a hyperlink in a box next to a red number, and change the ticker in the web address.
For example, if you are looking at http://finance.yahoo.com/q/ks?s=PEP+Key+Statistics and you would like to see the data of Coca Cola co. instead of Pepsico, change the ticker from PEP (which is the ticker of Pepsico) to KO (which is the ticker of Coca Cola).
The link to visit then becomes: http://finance.yahoo.com/q/ks?s=KO+Key+Statistics for example.
Method number one is a very simplistic model, which calculates a price target for the next 5 years based on historical valuations, the last 4 quarters results and future growth.
Method number 2 is more advanced, and takes into account Free cash flow, net cash position and future growth.
This method discounts the future values at a discount rate of 9% per year, which is the return you can expect over the long run in the stock market (7% price appreciation per year + 2% dividend yield per year).
To open the excel sheet, please click hereCalculate_Intrinsic_Value
Please be aware that calculating an intrinsic value is not an exact science. It is based on subjective estimates.
The best thing you can do is to use methods used by the biggest value investors in the world, such as Warren buffet, Joel Greenblatt, Monish Pabrai and the likes…

Thursday, June 14, 2012

How to Set Timezone on WebSphere Application Server

It’s actually quite easy, but a little tricky. This is how i do it,
1. Start the administrative console.
2. In the topology tree, expand Servers and click Application Servers.
3. Click the name of the application server for which you want to set the time zone.
4. On the application server page, click Process Definition.
Process Definition
5. On the Process Definition page, click Java Virtual Machine.
6. On the Java Virtual Machine page, click Custom Properties.
7. On the Custom Properties page, click New.
8. Specify user.timezone in the Name field and timezone in the Value field, where timezone is the supported value for your time zone.
9. Click Apply.
10. Save the configuration
In this example, i’m setting my timezone as Asia/Jakarta
user.timezone=Asia/Jakarta
Timezone Success http://edwin.baculsoft.com/2011/08/how-to-set-timezone-on-websphere-application-server/

Wednesday, June 13, 2012

What does Disposition (Non Open Market) at $0 per share. MEAN?? I see this when insiders trade in a company?

It means that an insider is disposing of (disposition) some stock in a private transaction (non open market) at a price of zero. What this usually means in plain (er) English is that the person is giving away stock, possibly as a gift or a donation. These types of transactions can also show up as "acquisitions" if the insider is receiving stock for some reason.

http://sg.answers.yahoo.com/question/index?qid=20071117221632AA6cSSz

Monday, June 11, 2012

Build failed question - maven - jre or jdk problem

You could try updating the JDK Eclipse is using, as follows:
Add and set the JRE in Window->Preferences...->Java->Installed JREs:
JRE type: Standard VM JRE Name: jdk1.6.0_18
JRE home directory: C:\Program Files (x86)\Java\jdk1.6.0_18
If this is not the case, it's possible that the brackets and spaces in the JAVA_HOME path are causing issues. Try copying your JDK to a different location and updating your JAVA_HOME.

http://stackoverflow.com/questions/2222560/build-failed-question-maven-jre-or-jdk-problem

What's the key difference between HTML 4 and HTML 5?

HTML5 has several goals which differentiate it from HTML4.

The primary one is consistent, defined error handling. As you know, HTML purposely supports 'tag soup', or the ability to write malformed code and have it corrected into a valid document. The problem is that the rules for doing this aren't written down anywhere. When a new browser vendor wants to enter the market, they just have to test malformed documents in various browsers (especially IE) and reverse-engineer their error handling. If they don't, then many pages won't display correctly (estimates place roughly 90% of pages on the net as being at least somewhat malformed).

So, HTML5 is attempting to discover and codify this error handling, so that browser developers can all standardize and greatly reduce the time and money required to display things consistently. As well, long in the future after HTML has died as a document format, historians may still want to read our documents, and having a completely defined parsing algorithm will greatly aid this.

The secondary goal of HTML5 is to develop the ability of the browser to be an application platform, via HTML, CSS, and Javascript. Many elements have been added directly to the language that are currently (in HTML4) Flash or JS-based hacks, such as <canvas>, <video>, and <audio>. Useful things such as Local Storage (a js-accessible browser-builtin sql database, for storing information beyond what cookies can hold), new input types such as date for which the browser can expose easy user interface (so that we don't have to use our js-based calendar date-pickers), and browser-supported form validation will make developing web applications much simpler for the developers, and make them much faster for the users (since many things will be supported natively, rather than hacked in via javascript).

There are many other smaller efforts taking place in HTML5, such as better-defined semantic roles for existing elements (<strong> and <em> now actually mean something different, and even <b> and <i> have vague semantics that should work well when parsing legacy documents) and adding new elements with useful semantics - <article>, <section>, <header>, <aside>, and <nav> should replace the majority of <div>s used on a web page, making your pages a bit more semantic, but more importantly, easier to read. No more painful scanning to see just what that random </div> is closing - instead you'll have an obvious </header>, or </article>, making the structure of your document much more intuitive.


http://stackoverflow.com/questions/134727/whats-the-key-difference-between-html-4-and-html-5

Where exactly the Singleton Pattern is used in real application?

Typically singletons are used for global configuration. The simplest example would be LogManager - there's a static LogManager.getLogManager() method, and a single global instance is used.
In fact this isn't a "true" singleton as you can derive your own class from LogManager and create extra instances that way - but it's typically used as a singleton.
Another example would be java.lang.Runtime - from the docs:
Every Java application has a single instance of class Runtime that allows the application to interface with the environment in which the application is running. The current runtime can be obtained from the getRuntime method.
That's pretty much the definition of a singleton :)
Now the singleton pattern is mostly frowned upon these days - it introduces tight coupling, and makes things which use the singleton harder to test, as you can't easily mock out that component. If you can get away without it, so much the better. Inject your dependencies where possible instead.

http://stackoverflow.com/questions/3192095/where-exactly-the-singleton-pattern-is-used-in-real-application

Friday, June 8, 2012

difference between stored procedures and user defined functions

A function always returns a value, and can not perform DML statements (INSERT/UPDATE/DELETE).
A stored procedure can not return a value - you need to use an OUT parameter - and can run DML statements.

Advantage of Using a Function vs a Stored Procedure?


Aside from the comparison above, they are equal. But given the comparison, depending on what you need to do it's likely you will use a stored procedure more often than you will a function.

http://stackoverflow.com/questions/2039936/difference-between-stored-procedures-and-user-defined-functions

Testing Private Methods in Java

I’ve been writing a lot of Java lately, and a lot of tests. We always write tests, right? Alas, no cool record-and-playback stuff like FlexMonkey or FoneMonkey, just plain old JUnit 4 tests with plently of Hamcrest goodness.
Suddenly, I realized that I really needed to test some private methods. So, a quick google for “testing private methods java” brings up a good article by Bill Venners. He lists all possible options to test private methods:
  1. Don’t test private methods
  2. Give the methods package access
  3. Use a nested test class
  4. Use reflection
Basically, the only real one is #4, use reflection. Bill didn’t give me the exact code I needed, so lots of googling later I realized that the world is filled with opinionated people (like me), and boy do they love to talk about #1. I just wanted some code, not a lecture, so I had to write my own code. Here is that code for anyone else that just wants to test private methods.
Imagine you have a class MyClass and it has a private method, myMethod(). Sorta like this:
public class MyClass {
    private String myMethod(String s) {
        return s;
    }
}
Then you could use reflection to invoke the method like this:
MyClass myClass = new MyClass();
Method method = MyClass.class.getDeclaredMethod("myMethod", String.class);
method.setAccessible(true);
String output = (String) method.invoke(myClass, "some input");
The real magic is setAccessible(true) which allows the private method to be called outside the class. And shazam, I can now test all my private methods. I was really hoping JUnit 4 would provide some additional facilities specifically for testing private methods, but not luck.

http://saturnboy.com/2010/11/testing-private-methods-in-java/

How do you unit test private methods?

You generally don't unit test private methods directly. Since they are private, consider them an implementation detail. Nobody is ever going to call one of them and expect it to work a particular way.
You should instead test your public interface. If the methods that call your private methods are working as you expect, you then assume by extension that your private methods are working correctly.

http://programmers.stackexchange.com/questions/100959/how-do-you-unit-test-private-methods

Thursday, June 7, 2012

What is the difference between an ordered and a sorted collection?

An ordered collection means that the elements of the collection have a specific order. The order is independent of the value. A List is an example.
sorted collection means that not only does the collection have order, but the order depends on the value of the element. A SortedSet is an example.
In contrast, a collection without any order can maintain the elements in any order. A Set is an example.

Wednesday, June 6, 2012

Difference between JSP include directive and JSP include action

  • <%@ include file=”filename” %> is the JSP include directive.
    At JSP page translation time, the content of the file given in the include directive is ‘pasted’ as it is, in the place where the JSP include directive is used. Then the source JSP page is converted into a java servlet class. The included file can be a static resource or a JSP page. Generally JSP include directive is used to include header banners and footers. The JSP compilation procedure is that, the source JSP page gets compiled only if that page has changed. If there is a change in the included JSP file, the source JSP file will not be compiled and therefore the modification will not get reflected in the output.
  • is the JSP include action element.
    The jsp:include action element is like a function call. At runtime, the included file will be ‘executed’ and the result content will be included with the soure JSP page. When the included JSP page is called, both the request and response objects are passed as parameters. If there is a need to pass additional parameters, then jsp:param element can be used. If the resource is static, its content is inserted into the calling JSP file, since there is no processing needed.
http://javapapers.com/jsp/difference-between-jsp-include-directive-and-jsp-include-action/

difference between jsp forward and redirect

  • redirect sets the response status to 302, and the new url in a Location header, and sends the response to the browser. Then the browser, according to the http specification, makes another request to the new url
  • forward happens entirely on the server. The servlet container just forwards the same request to the target url, without the browser knowing about that. Hence you can use the same request attributes and the same request parameters when handling the new url. And the browser won't know the url has changed (because it has happened entirely on the server)
     
http://stackoverflow.com/questions/6068891/difference-between-jsp-forward-and-redirect

Sunday, June 3, 2012

What is the difference between a process and a thread

Process:
  • An executing instance of a program is called a process.
  • Some operating systems use the term ‘task‘ to refer to a program that is being executed.
  • A process is always stored in the main memory also termed as the primary memory or random access memory.
  • Therefore, a process is termed as an active entity. It disappears if the machine is rebooted.
  • Several process may be associated with a same program.
  • On a multiprocessor system, multiple processes can be executed in parallel.
  • On a uni-processor system, though true parallelism is not achieved, a process scheduling algorithm is applied and the processor is scheduled to execute each process one at a time yielding an illusion of concurrency.
  • Example: Executing multiple instances of the ‘Calculator’ program. Each of the instances are termed as a process.
Thread:
  • A thread is a subset of the process.
  • It is termed as a ‘lightweight process’, since it is similar to a real process but executes within the context of a process and shares the same resources allotted to the process by the kernel (See kquest.co.cc/2010/03/operating-system for more info on the term ‘kernel’).
  • Usually, a process has only one thread of control ? one set of machine instructions executing at a time.
  • A process may also be made up of multiple threads of execution that execute instructions concurrently.
  • Multiple threads of control can exploit the true parallelism possible on multiprocessor systems.
  • On a uni-processor system, a thread scheduling algorithm is applied and the processor is scheduled to run each thread one at a time.
  • All the threads running within a process share the same address space, file descriptor, stack and other process related attributes.
  • Since the threads of a process share the same memory, synchronizing the access to the shared data withing the process gains unprecedented importance.
I borrowed the above info from the Knowledge Quest! blog available at:http://kquest.co.cc/2010/03/program-process-task-thread/