Thursday, July 5, 2012

SQL Server: how to search for a table name or a column name or a given stored procedure name

This article demonstrates how the Microsoft SQL Server database can be queried to perform the following tasks:
1. fetch a list of tables.
2. fetch a list of Columns.
3. fetch a list of Stored Procedures
The results can refined further by including other search criteria in the where clause of each query.

--Query to fetch the list of table that match a pattern
select * from information_schema.tables where table_name like '%Employee%'

--Query to fetch the list of Columns (with table info) that match a pattern.
select * from information_schema.columns where column_name like '%EmpId%'

--Query to fetch the list of Stored Procedures that match a pattern.
select ROUTINE_SCHEMA, ROUTINE_NAME, ROUTINE_DEFINITION from INFORMATION_SCHEMA.ROUTINES
where ROUTINE_TYPE='PROCEDURE' and routine_name like '%MyProc%' 
http://cavemansblog.wordpress.com/2009/02/26/sql-how-to-2/

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 here: Calculate_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