Saturday, May 16, 2009

Monopoly - US Economy 2009

Disclaimer: I am far from being even the novice in Economics & hence all the statements made on this blog entry are completely personal. The entry is merely a feeble attempt to verbalize the non-sense we all are reading & watching about in the news these days - Yr. 2009. I humbly seek your indulgence & pls. take this entry with a pinch or pint of salt.
Recently, I had an interesting chat with my friend Arun. He was was talking about how Rats camera went down. Here is the chat I had with my friend:

(10:42:49 AM) Arun:Rats cam closed,they owe canon and nikon 40 million $ and the store is shutdown
(10:43:28 AM) Ajay: wow! hence the ridiculous prices :D
(10:44:39 AM) Arun: canon lost almost about 25 million, nikon and others lost the rest, they went to bankrupt
(10:46:27 AM) Ajay: all these business models seem driven by only thing.. wishful thinking.. the demand will always grow, the consumers will always pay.. the market will always have a lot credit!!!
(10:48:52 AM) Ajay: just look at all these companies growing growing..growing.. globing globing globing.. under the assumption that monopolizing the market is the only way to b successful
(10:49:12 AM) Ajay: now they r all obese tearing at the seams and wondering why people r not buying
(10:50:02 AM) Ajay: the rate at which the stores/supply grew was never backed up by the purchasing power/jobs/income..
(10:50:11 AM) Arun: more over i don't understand one thing. they borrow money to buy merchandise then they sell them and then don't they return money back to the investors
(10:50:16 AM) Ajay: how can u assume demand?
(10:50:35 AM) Ajay: thats credit
(10:50:42 AM) Arun: i am talking about past 10-20 years they made money; spreading themselves too thin, where did all that money go

The main theme of this post begins here...

(10:51:13 AM) Ajay: yeah.. but its like the way i played monopoly
(10:52:18 AM) Ajay: i borrowed like anything.. bought all the places and put expensive buildings on them... now every time the player landed there.. i got a huge sum of money.. nobody could play w/ me.. and even the computer gave up..
(10:52:42 AM) Ajay: in real life.. people can stop going around.. and then the owner ends up owing a lot of money
(10:53:18 AM) Ajay: that dumb monopoly version makes the assumption that players continue to play and the game is over if they all quit
(10:53:40 AM) Ajay: not the later part, that now I owe a ton of money w/o any players and i must play until i pay off
(10:53:57 AM) Ajay: all these folks.. or the deluded capitalist play this stupid monopoly, the real one.. is the yr 2008-09 outcome
(10:54:33 AM) Ajay: i think the analogy is impeccable
(10:55:02 AM) Arun: you are brilliant
(10:55:15 AM) Ajay: :)

(10:56:36 AM) Ajay: its weird that businessmen make this mistake.
(10:57:45 AM) Ajay: there is a simple understanding.. how big can u grow? What is determining ur growth?
(10:58:01 AM) Ajay: I guess now we might appreciate why Apple likes its profitability than % market share .. Apple has a ton of money and less headache!
(11:10:37 AM) Arun: makes sense
(11:10:55 AM) Ajay: just imagine.. to the least, by cutting some cost Apple can boost the sales
(11:11:18 AM) Ajay: now imagine they launch new ipods, iphone.. diff. colors, diff features.. they can further invest in adds for more mac sales, these opportunities r still viable and they don't have to sweat it yet
(11:12:23 AM) Ajay: M$ on the other hand ...

(11:18:25 AM)
Ajay: companies like Rats ... r stupid
(11:20:02 AM)
Ajay: "According to the bankruptcy filing, the company's profits in film processing were hurt by the shift to digital photography." [r]
(11:20:25 AM) Ajay: *hurt by the shift to digital photography* that explains a lot why Rats went down.
(11:20:49 AM) Arun: the shift happened 5 years ago
(11:21:03 AM) Ajay: and these guys were in business since 1918 .. but they had no idea how the industry will evolve??
(11:21:38 AM) Ajay: no connections w/ canon or nikon to realize what will happen??
(11:22:10 AM) Ajay: i think Chapter 11 is like "Here's ur sign!!"
(11:22:44 AM) Ajay: but i seem to go back to the obesity crisis and these companies
(11:23:12 AM) Ajay: don't call me fat.. i need special provisions.. u cannot discriminate.. all the plain BS
(11:23:35 AM) Ajay: if u r fat.. u r fat.. deal w/ it!! if u r making losses.. then deal w/ it!!
(11:23:55 AM) Ajay: close down shops... 800 of them, make it 400
(11:24:18 AM) Ajay: adds, new bigger places w/ lot of hands on training, invite great photographers for review
(11:24:48 AM) Ajay: 1/1 meetings between Experts & Amateurs, reduce the stupid workforce and inventory
(11:25:11 AM) Arun: also they have to offer something additional to compete with online stores
(11:25:12 AM) Ajay: 1/2 the stuff is made from china and completely useless
(11:25:21 AM) Ajay: precisely!!!competitive prices, offer training, consultation, open discussion
(11:25:57 AM) Arun: event contests
(11:25:59 AM) Ajay: make a community out of the photographers
(11:26:02 AM) Ajay: yep
(11:29:36 AM) Ajay: "Forget about learning anything, u can buy everything!!" - US motto of this decade??

(11:30:25 AM)
Ajay: its like the early industry founders believed in Legos, the only game they ever played
(11:31:16 AM) Ajay: same blocks, same colors, mass produced - everything everywhere!!! food, services, language, vehicles, furniture, name it!!
(11:32:03 AM) Arun: things will break down and i think we will see a lot of smaller stores soon
(11:33:00 AM) Ajay: It might be a bit to outrageous to hope that this economic crash could bring about a cultural revolution
(11:33:18 AM) Ajay: bb

r: Sorry I don;t have the reference to this article.

Saturday, May 9, 2009

HelloWorld - Ajax, Struts

This is a simple HelloWorld example for Ajax & Struts. In this example, I have a rudimentary Ajax call to the server side Struts Action class.

JavaScript:

<SCRIPT language="javascript">
var xmlHttp;
function greet(name) {
xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
alert("Critical Browser Error: Pls. close the browser & try again!");
return false;
}
// struts action call
var url = "sayHello.do";
url = url + "?name=" + name.value;
url = url + "&sid=" + Math.random();
xmlHttp.onreadystatechange = stateChanged;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}

function stateChanged() {

if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
var strutsResp = xmlHttp.responseText;
document.getElementById("strutsResp").innerHTML = strutsResp;
} else {
alert("Critical Browser Error: Pls. close the browser & try again!");
}
}
}

function GetXmlHttpObject() {
var xmlHttp = null;
try {
xmlHttp = new XMLHttpRequest();
} catch (e) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
</SCRIPT>


HTML Form:

<form><!-- onchange='greet(this);'-->
<p><LABEL for="name">Name: <input type="text" name="name"
size="10" id="name" onchange='greet(this);'/></LABEL>
<input type="button" id="ok" value="OK"/>
</p>
</form>


Struts Config:

<!--Note: the response is fully cooked - no mapping required! -->
<action-mappings>
<action path="/sayHello" type="com.aj.helloajax.actions.SayHelloAction">
</action>
</action-mappings>


Struts Action Class:

public class SayHelloAction extends Action {

public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {

String name = (String)request.getParameter("name");
response.setContentType("text/html");
PrintWriter out = response.getWriter();

out.print("<h2>Hello "+name+" !!</h2>");
out.flush();
response.flushBuffer();
//Note: the response is fully cooked - no mapping required!
return null;
}
}