Sunday, November 13, 2011
Sunday, October 2, 2011
Tuesday, August 2, 2011
Return Of the Capital than Return on the Capital
1. David Walker explains how US is closer to a scenario as that of Greece in 3 years.
2. See what Bill Gross has got to say about US Job Market (for next 12 months)
** PIMCO is one of the biggest US Bond holder and on July 30th they dumped Bonds for Cash building up close to $53B in cash (Originally $17B). Jobs report and QE2 is going to help rally in capital market further. No worries on long term investment with the capital market, but staying in expensive bond market with US credit rating under downgrade risk does not yield much.
… it is time to start to think about …
Return of the Capital
than
Return on the Capital
Friday, July 29, 2011
Creating a Simple Application using Google App Engine
If hosting your application on the Cloud is your primary goal, then Google App Engine might be a good start. Here we are going to see a simple example of how to run an app on Google App Engine.
Install Google App IDE Plugin for your IDE. (For using Eclipse IDE, go to Eclipse.org download eclipse, and go to code.google.com and find how to get it installed for Eclipse)
Steps are more detailed in : http://code.google.com/appengine/docs/java/gettingstarted/installing.html
After Installing, Create a new Web Application Project
Name your Project, and deselect “Use Google Web Toolkit” unless needed.
This will be the file structure. Under /src/<package Name>/ you will find your Servlet Class source code. (.java file)
Next – lets modify the Servlet.
Open your servlet from src/((package_name))/((Project_name))Servlet.java & modify your servlet.java code to make it perform some work, when called as below which gives the date and current time.
1: package //your package name;
2: import java.io.IOException;
3: import javax.servlet.http.*;
4: import java.io.PrintWriter;
5: import java.text.SimpleDateFormat;
6: import java.util.Date;
7: import java.util.SimpleTimeZone;
8:
9: @SuppressWarnings("serial")
10: public class Conciliation1Servlet extends HttpServlet {
11: public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
12: SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSSSSS");
13: fmt.setTimeZone(new SimpleTimeZone(0,""));
14: resp.setContentType("text/html");
15: PrintWriter out = resp.getWriter();
16: out.println("<html><body><p> Current Time is: " + fmt.format(new Date())+ "</p></body></html>");
17: }
18: }
Open web.xml (usually in war/WEB-INF/lib/web.xml ), and modify as shown
1: <?xml version="1.0" encoding="utf-8"?>
2: <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3: xmlns="http://java.sun.com/xml/ns/javaee"
4: xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
5: xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
6: http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
7: <servlet>
8: <servlet-name> <!-- Give a Name for Servlet--> </servlet-name>
9: <servlet-class> <!-- Package Name --> </servlet-class>
10: </servlet>
11: <servlet-mapping>
12: <servlet-name> <!-- Same name as the Servlet provided above --> </servlet-name>
13: <url-pattern>/dothis </url-pattern><!-- Give the URL pattern, example /* (or) /dothis, always start the url pattern with / -->
14: </servlet-mapping>
15: <welcome-file-list>
16: <welcome-file>index.html</welcome-file>
17: </welcome-file-list>
18: </web-app>
Now Modify index.html under war/WEB-INF/
1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2: <!-- The HTML 4.01 Transitional DOCTYPE declaration-->
3: <!-- above set at the top of the file will set -->
4: <!-- the browser's rendering engine into -->
5: <!-- "Quirks Mode". Replacing this declaration -->
6: <!-- with a "Standards Mode" doctype is supported, -->
7: <!-- but may lead to some differences in layout. -->
8:
9: <html>
10: <head>
11: <meta http-equiv="content-type" content="text/html; charset=UTF-8">
12: <title>Hello App Engine</title>
13: </head>
14:
15: <body>
16: <h1>Hello App Engine!</h1>
17:
18: <table>
19: <tr>
20: <td colspan="2" style="font-weight:bold;">Available Servlets:</td>
21: </tr>
22: <tr>
23: <td><a href="dothis">Current Date</a></td>
24: </tr>
25: </table>
26: </body>
27: </html>
Open and update version number (line 4) if needed in appengine-web.xml from war/WEB-INF/lib
If you have a google app engine setup for your google login id, then create a google application. You will be asked to choose an application_id. Use this application_id in line 3, before you upload it to google app engine for testing.
1: <?xml version="1.0" encoding="utf-8"?>
2: <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
3: <application><!—application id—></application>
4: <version>1</version> <!-- update version number if needed -->
5:
6: <!-- Configure java.util.logging -->
7: <system-properties>
8: <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
9: </system-properties>
10:
11: </appengine-web-app>
Execute the App in Debug Mode
Click on “Current Date” and you will see the current time.
Let us now try to customize it per user (in development server a default user test@example.com gets automatically created with app engine, but when you deploy it to google app engine, you will be asked to be authenticated by Google Sign In Process)
Modify the servlet.java as follows.
1: package //package name;
2: import java.io.IOException;
3: import javax.servlet.http.*;
4: import java.io.PrintWriter;
5: import java.text.SimpleDateFormat;
6: import java.util.Date;
7: import java.util.SimpleTimeZone;
8: import com.google.appengine.api.users.User;
9: import com.google.appengine.api.users.UserService;
10: import com.google.appengine.api.users.UserServiceFactory;
11:
12: @SuppressWarnings("serial")
13: public class Conciliation1Servlet extends HttpServlet {
14: public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
15: SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSSSSS");
16: fmt.setTimeZone(new SimpleTimeZone(0,""));
17:
18: UserService userService = UserServiceFactory.getUserService();
19: User user= userService.getCurrentUser();
20:
21: String navBar;
22: if (user != null)
23: {
24: navBar = "<p> Welcome, " + user.getNickname() + "! You can <a href=\""+ userService.createLogoutURL("/")+ "\"> Sign Out </a>.</p>";
25: } else {
26: navBar = "<p> Welcome! <a href=\""+ userService.createLoginURL("/") + "\"> Sign In or Register </a> to customize </p>";
27: }
28:
29: resp.setContentType("text/html");
30: PrintWriter out = resp.getWriter();
31: out.println("<html><body>");
32: out.println(navBar);
33: out.println("<p> Current Time is: " + fmt.format(new Date())+ "</p>");
34: out.println("</body></html>");
35: }
36: }
Execute the App in Debug Mode
Open the browser and view index.html
Click on Current Date
Now Click on “Sign In or Register”, in development it will take you to a simple console that will allow you to login as "test@example.com” but after you deploy in google app engine, you will be asked to login with your google id.
test@example.com is a default account that’s in development for debugging use, so choose “Log In”
It will take you back to first screen, because we gave a successful login as to take us to root of the site.
Now click on Current Date, lets see what happens now.
We should get this type of a window after it has authenticated you.
-- Thz it , its that’s simple–
Now you have a simple Web Application that is ready to be deployed to - Google App Engine
Steps to Upload your application to the cloud is more detailed on : http://code.google.com/appengine/docs/java/gettingstarted/uploading.html
NOTE: update your application_id in appengine-web.xml to the one in your google application admin console for your google account where you are planning to upload the app to. If this is not the same you might have trouble uploading your application.
Tuesday, July 26, 2011
Getting rid of debt the right way
Sunday, June 19, 2011
Selecting the appropriate JDBC Connection Resource type
javax.sql.DataSource (local transactions only)
javax.sql.XADataSource (global transactions)
An XA transaction, in the most general terms, is a "global transaction" that may span multiple resources. A non-XA transaction always involves just one resource.
An XA transaction involves a coordinating transaction manager, with one or more databases (or other resources, like JMS) all involved in a single global transaction. Non-XA transactions have no transaction coordinator, and a single resource is doing all its transaction work itself (this is sometimes called local transactions).
XA transactions come from the X/Open group specification on distributed, global transactions. JTA includes the X/Open XA spec, in modified form.
Most stuff in the world is non-XA - a Servlet or EJB or plain old JDBC in a Java application talking to a single database. XA gets involved when you want to work with multiple resources - 2 or more databases, a database and a JMS connection, all of those plus maybe a JCA resource - all in a single transaction. In this scenario, you'll have an app server like Websphere or Weblogic or JBoss acting as the Transaction Manager, and your various resources (Oracle, Sybase, IBM MQ JMS, SAP, whatever) acting as transaction resources. Your code can then update/delete/publish/whatever across the many resources. When you say "commit", the results are commited across all of the resources. When you say "rollback", _everything_ is rolled back across all resources.
The Transaction Manager coordinates all of this through a protocol called Two Phase Commit (2PC). This protocol also has to be supported by the individual resources.
In terms of datasources, an XA datasource is a data source that can participate in an XA global transaction. A non-XA datasource generally can't participate in a global transaction (sort of - some people implement what's called a "last participant" optimization that can let you do this for exactly one non-XA item).
For more details - see the JTA pages on java.sun.com. Look at the XAResource and Xid interfaces in JTA. See the X/Open XA Distributed Transaction specification. Do a google source on "Java JTA XA transaction".
Thursday, June 2, 2011
Wednesday, May 11, 2011
A century of transformation that lead to Gold Bubble
1929-1933: Great Depression
Consequence of Great Depression: US Changes its policy towards Gold.
Effect of Gold Policy Changes: Federal Reserve system should have kicked in when the systemic failure occurred during Great Depression, which did not take place. For the Fed reserve to function as expected in future for such failures, US took two steps.
1) Gold Reserve Act of 1934 brought the power for US to accumulate over large share of gold with US Treasury. As one would expect the US pegged more $ for the gold that was held by US citizens, with a 60% increase in price for gold. ($20 gold, was valued at $35). i.e. US Devalued its currency ($) against Gold.
2) Planned on Bretton Woods, NH meet by 44 nations to reach an agreement for future of stable currency standard for the world.
1930 - 1933: Gold standard collapsed under Bretton Woods Agreement
Note: Allied nations were preparing for World War II during this time.
Total Number of Nations: 44 (Allied Nations)
Bretton Woods agreement: Under this agreement , it was a setup of system of rules, institutions and procedures to regulate IMF and International Bank for Reconstruction and Development (IBRD) (Today’s World Bank)
This system started to run effectively after 1944/45.
Each Countries had an obligation: Every country will tie its currency to the US Dollar (with 1% parity) and ability of IMF to bridge temporary imbalance of payments. Where US Dollar becomes the base currency and US will link its $35 to one troy ounce.
1944 - 1969: Stability of Gold against an unstable Currency.
The gold price continued to increase beyond $35 per troy ounce due to demand, which resulted in pressure for US to print more of US$, and was forced to devalue its own currency irrespective of domestic market. To give a sense of what it looked like at that time, the price of gold rose from $35 per troy ounce in 1935 to $41.28 in 1969.
1970's US cost over Vietnam War and Increased domestic spending by Government resulted in high inflation.
US were running balance of payments deficit and trade deficit. In other words, it had to either pay gold, or pay $ to its lenders in order to meet those payment deficits. Till 1970, foreign countries held US Dollar bills and tied their currency to the US Dollar, with confidence on US market and ability to cut its budget and trade deficit.
In 1971, US printed more US Dollars, in order to pay for nation’s military spending and private investments. This was a devaluation of US Dollar by 10%. In other words, now one troy ounce of gold was $41. As per Bretton Woods agreement, countries will have to tie their currency to US Dollar. Since now US has devalued their currency, other countries that tied up to US Dollar also had to devalue their currency. West Germany (prior to 1989/90, Germany was divided as West and East) was the first country to withdraw from Bretton Woods agreement, since it did not want to devalue its currency. The move by West Germany strengthened their economy, and was value of US Dollar dropped by 7.5% against West German Currency (Deutsche Mark). Due to excess of dollars printed by US, and negative trade balance (lenders around the world), many countries started demanding US to meet their promise to pay as per Bretton woods agreement by exchanging gold for the US Paper dollars given back by those countries, they did not want the Dollars. They wanted to dump US Dollars back to US, and exchange for gold in return. Switzerland was followed by France in demanding gold in return of US Dollar Papers. Switzerland next withdrew from Bretton Woods agreement. Soon US Dollar began losing its value against European Currencies. All these events resulted in high inflation and greater spending by the US Government in domestic market, and on Vietnam War. To stop other countries from demanding gold on basis of promise to pay, US President Nixon gave a shock to the entire world by announcing the closure for gold window, where convertibility between US Dollar and Gold came to an End.
After 1971: Bubble begins to build on GOLD
After Nixon’s Shock, US Dollar was not longer tied to gold in direct proportions of closer to 1ounce / $35, but the price was declared to fluctuate based on market demand for gold. Ever since 1900 till 1971, it was mostly the Kingdoms around the world, the Central Banks & IMF which held huge reserve of gold (IMF sells gold when needed at the market price to raise fund for operational cost and other expenditures and welfare of developing / poor nations). Among the Central Banks, US Fed Reserve still holds huge amount of gold / major share of gold in its reserve. This leads to the phenomenon of linking US Economy (major stake holder of gold reserve) to gold price. In summary, market price after 1971 could go any way by supply, demand for gold and stability of global economy, since many central banks have began stacking up more of gold. In reference to the inflation between 1971 and 2011, today’s price of gold is over inflated when in reference to US economy but with globalization and taking different world economies in picture, today's price could be closer to where it is currently in ref. to adjusted global inflation in average, but its still a GOLD BUBBLE long due for burst since 1971.
Wednesday, April 27, 2011
Equinox vs CR-V vs RAV4 2011
2. Honda CR-V 2011 EX-L: The design for Honda CR-V 2011 is set to be revised in 2012. And it had a tough competition while I was selecting it in comparison with RAV4. Me and my wife did luv the style. It was not bold / expressive as Equinox, and it was not just a vehicle like RAV4 from its appearance. EX-L had the navi installed on it, with rear view camera, but it was not appealing bargain against its negative points. The navi dint have good graphics. With Honda I expect more for the price. The exterior look did suggest that there should be something inside better as well (Under the hood). That’s what one might think about this vehicle. But the truth is , I did hate its performance. Honda CRV does come with I-4 Engine in US, and only I-4 that delivers, close to 180 hp, and does not have a V6 engine for any trim level. It has a 5 speed automatic transmission that struggles to understand the torque, and switch gears smoothly. Interior is OK, but not that great until you choose EX-L. But you will need to shell more $ to get EX-L which is not worth the bucks paid for. And switching to EX will leave you with lesser options, and further trimming it down if LX was selected. Good side of Honda CRV is design, and trunk door. Negative points on Honda CRV goes around, engine performance(has a bit of drag), mileage, cargo space.
Thursday, April 21, 2011
Soft but smart
Watch the full episode. See more NOVA.
Saturday, February 5, 2011
InfoQ: Parallel Programming Patterns: Data Parallelism
External Link : InfoQ: Parallel Programming Patterns: Data Parallelism
Friday, January 28, 2011
Monday, January 17, 2011
Finally
I am back from my vacation and other busy schedule… It was a great time up in India. There are great developments around the city of chennai, and huge infrastructure development that’s going on in OMR Road. Here a quick review of one big project that I had a chance to visit on OMR.
XS Real
My review on XS Real : This building is going to be 13 stories tall, and has all the facilities in it.
+ive: (1) Each apartment will have an Individual Unit style to it. (2) Facilities (3) Interior work (4) handover condition (5) location (6) View – if u book one of the top floors. (7) sqft price is same irrespective of which floor you are interested in. (8) generator for backup supply.
-ive: (1) Cost of hand over (for registration + fund etc..) (2) Though there is a reverse osmosis plant still drinking water is available only by purchase. (3) Though the lake is partially full now, the building is just 2000ft away from Muttukadu lake as per the GIS map. Better luck with Tsunami that yet to come some day like in 2004 dec 24th