www.crystaltech.com Sucks!
Finding my dignity!
That said, I have decided to rise above all my crying opponents and share the secrets of my success.(see the above photo montage.) I do this only because I know that I will always command greatness, and no doubt rise to the challenges that come from my unworthy opponents.
May the games begin!
Learning EXT JS with Coldfusion 8 and JSON Conversions
I have just recently started to learn the EXT JS Library. (www.extjs.com).
If you intend on using Coldfusion 8 with EXT JS you will find that changing a query set over to EXT JS JSON will be highly useful. I have found that doing this server side is far easier and faster than using EXT JS Readers to transform the data on the client side. A well written cfc will cost between 3-10 ms on the server side. The EXT JS readers are considerably slower and significantly more difficult to implement.
Because of web blog restrictions I had to change script to _script. You will need to change this back before you test the sample code.
========== Here is the HTML PAGE:================
<head>
<title>combo_Server</title>
<!--- Get all needed ext libraries files --->
<link rel="stylesheet" type="text/css" href="../../lib3/extjs/resources/css/ext-all.css">
<_script src="lib/extjs/adapter/ext/ext-base.js"></script>
<_script src="lib/extjs/ext-all-debug.js"></script>
<_script src="combo_server2.js"></script>
</head>
<body>
</body>
</html>
============= combo_server2.js =================
/*!
* Ext JS Library 3.0.0
* Copyright(c) 2006-2009 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
*/
Ext.onReady(function(){
//This is our JSON record set which defines what kind of data will be present in the JSON passed back from our component.
var users = Ext.data.Record.create([
{name:'ID',type:'int'},
{name:'GENRE_NAME',type:'string'},
{name:'SORT_ORDER',type:'string'}
])
// create the Data Store
var store = new Ext.data.JsonStore({
root:'ROWS',
url:'Chapter3Example.cfc',
remoteSort:true,
baseParams:{method: 'getGenres',returnFormat: 'JSON',start: '1',limit: '50'},
fields:users,
listeners: {
load:{fn: testStore},
loadexception: {fn: loadFailedReport}
}
});
// trigger the data store load
store.load();
//Display the combobox in a form panel
new Ext.FormPanel({
url: 'movie-form-submit.cfm',
renderTo: document.body,
frame: true,
title: 'Movie Information Form',
width: 250,
items: [{
xtype: 'combo',
name: 'genre',
fieldLabel: 'Movie Genres:',
mode: 'local',
store: store,
displayField:'GENRE_NAME',
valueField: 'ID',
width: 130,
triggerAction: 'all',
emptyText: 'Select a state...'
}]
});
//This function will be called on a succesful load, it can be used for debugging or perform on load events.
function testStore(st,recs,opts){
console.info('Store count = ', store.getCount());
}
function loadFailedReport() {
console.log(arguments);
console.info("Response Text?"+response.responseText);
console.log("dgStore Message \n"+proxy+"\n"+store+"\n"+response+"\n"+e.message);
}
});//onReady
================= The CFC to simulate the Data query set: Chapter3Example.cfc
==================
<cfcomponent output="false">
<cffunction name="getGenres" access="remote" output="false" returntype="any" returnformat="json">
<cfargument name="id" type="numeric" required="false" />
<cfset var output = "" />
<cfset var q = "" />
<cftry>
<cfscript>
q = QueryNew("id,genre_name,sort_order");
QueryAddRow(q,3);
QuerySetCell(q,"id",1,1);
QuerySetCell(q,"genre_name","Comedy",1);
QuerySetCell(q,"sort_order",0,1);
QuerySetCell(q,"id",2,2);
QuerySetCell(q,"genre_name","Drama",2);
QuerySetCell(q,"sort_order",1,2);
QuerySetCell(q,"id",3,3);
QuerySetCell(q,"genre_name","Mystery",3);
QuerySetCell(q,"sort_order",2,3);
//format the query for ExtJS json
compObj = CreateObject("component", "CF_EXTJS");
extjs_jsonVar = compObj.qry2json(q);
</cfscript>
<cfcatch type="database">
<cfset q="Data Set Creation Error.">
</cfcatch>
</cftry>
<cfreturn extjs_jsonVar />
</cffunction>
</cfcomponent>
=================== CFC to convert a Coldfusion query set to an EXT JS json response. ===========
<cfcomponent>
<cffunction name="qry2json" access="public" returntype="any">
<cfargument name="querySet" type="query" required="yes">
<cfargument name="startRow" type="numeric" default="1" required="No">
<cfargument name="numberOfRows" type="numeric" default="50" required="No">
<cfset thisQueryName = arguments.querySet>
<cfset endRow = arguments.startRow + (arguments.numberOfRows-1)>
<cfset i = 1>
<cfset thisColumnList = querySet.columnList><!---get a list of all the column names from the query--->
<cfloop query="querySet" startrow="#arguments.startRow#" endrow="#variables.endRow#"><!---loop through each row in the record set--->
<cfset stcUsers = StructNew()><!---create an empty struct (clears for each loop)--->
<cfloop index="columnName" list="#thisColumnList#" delimiters=","><!---populate the struct with the data in the row--->
<cfset "stcUsers.#columnName#" = evaluate("querySet."&columnName)>
</cfloop>
<cfset arrUsers[i] = stcUsers><!---load the row data stuct into an array--->
<cfset i = i + 1><!---increment the array counter--->
</cfloop>
<!--- Format the JSON for EXT JS --->
<cfset stcReturn = {rows=arrUsers,dataset=querySet.RecordCount, startRow = Arguments.startRow, endRow=numberOfRows }>
<cfreturn stcReturn>
</cffunction>
</cfcomponent>
I apologize that I don't have more time to explain all the details, but I assure if you take a little time to recreate this working example, you will start to see the simplicity (and speed) of this solution.
Take care! Steven Benjamin
My First iPhone App
A little more blog surfing and I came across a blog that appeared to have figured it all out. That blog was on http://sanchit-tricks.blogspot.com/ which appears to have stolen the hard work of Vinod Ponmanadiyil who in my opinion deserved the bulk of the credit. Following Vinod's instructions and downloading the amazingly useful apps he recommends, I was able to install my killer slider app on my own iphone without a provisioning profile.
Also: if you are looking for some good xCode or Objective-C Videos at a really good price ($5.00) - Check out Mike Clark (I took my Ruby on Rails Class from Mike Clark and Dave Thomas) at pragmatic.tv
I am attending Stanford University ...sort of
NetFlix NFLX
That said, I am thinking that I like Netflix for fundamental reasons. With the economy on the ropes, people are looking to cut back on expenses yet they still want their nightly relaxation and entertainment. Netflix offers an excellent selection of CD's at a very affordable rate. Combined that with their newly revamped SilverStream movie delivery system over the internet and in my opinion you have a company positioned to do very well in this economy. According to the NY Times, Netflix surpassed ten million customers last February.
Netflix should be reporting quarterly earning in the next 28 days. So how can I profit from this and what if I am wrong. If I buy the stock I take on a risk of loss from the moment that I buy it. And if the projected earning are already priced in,(you know; buy the sizzle, sell the steak) then the stock will go down and I will loose money. And given that NFLX is already close to the 52 week high of $44.42 what is my potential upside?
To summarize, Now that NFLX has pulled back to the 20 day moving average and is still in a bullish stage, I think NTFX will rise to the low 40's again within the next 4 weeks. Once again,I could be wrong. So here is my play: I am going to SELL the NFLX MAY 40 Puts. I will make $420 for each contract that I sell (1 contract is 100 shares), But I will be obligated to purchase NFLX stock at the price of $40.00/share between now and the 3rd Friday of May.) This actually gives me some downside protection. At the current price of 39.68 I will have downside protection of $3.88 (almost 10% downside protection) This means that I will break even if I am forced to by the stock at 40 but it is trading at 35.80. Anything above that and I am still making a profit. Anything below that and I take a loss. From a purely statistical approach, there is a 38.58% chance that NTFX will fall below my break even during that time. My bet is that once you consider the fundamentals of this company, I am thinking that number should fall to the 25% area.
What if I am wrong? Well that is not so bad, I get NFLX stock on the cheap. (not as cheap as if I had waited and bought it in mid May, but still cheaper than today.) and since they are a profitable company, I will simpley become an Investor for a while and wait for the stock to move back up to a profitable position for me.
Finally, What if I am really really wrong. What if Bernie Madoff rented 2 million CD's and he doesn't plan to give them back. If NetFlix was to fall to zero, I would lose $3,580.00 for each contract I sold. So I am going to buy May, 30 Puts. That way if disaster hits NFLX, I would only loose $695.00 per contract. Of course I wouldn't make as much money ($420.00 - $115.00) I would make $305.00 per a contract just as long as NFLX closes above 40.00 on May 15th. 2009
One last thing to keep in mind, these are American options and I could close my positions at any time by purchasing back what I sold and selling what I bought. I frequently do this when I have hit 75% of my profit target.

