Wednesday, July 28, 2010

Make Your Model Promiscuous



Hmmm...,
This was an odd presentation on how using a MVC (Model View Controller) approach makes translating, moving and maintaining code simple.

Sadly - not one of the demos worked!


Look at www.boyzoid.com for working demos later this week.


How to read a stack trace

Longer stacks are generally longer running..

Use multiple stack traces to view "motion" over time.

(Native Method)
When java hands things off to C and allowing native system to handle things..
Example: java.net.SocietInputStream.socketRead0 (Native Method)
May say "runnable" but JVM doesn't really know, because its handed things off to the system to handle..

jrpp

Threads that start with this are all jrun worker threads.
EX: "jrpp-1234"

When jrun talks to the web server it uses jrpp.
Ex: jrun.servlet.jrpp.JRunProxyService.createRunnable or jrun.servlet.jrpp.JRunProxyService.accept (missed that part)


CfmServlet.service is the ColdFusion service

_factor indicates a decision point (like cfif, cfcase etc..)

macromedia.jdbc.base.BaseStatement = SQL Server JDBC driver

TDSRequest - Way to communicate with db. (Wire protocol for SQL Server)

99% of time when its the SQL Server, its because there's not a good index on the table, and a full table scan needs to be performed.

If we see a lot of coldfusion.runtime near the top of the stack, its probably that the CPU is busy, vs there being an I/O issue.

SeeFusion Demo:
http://demo.seefusion.net:8999/

You can look at sample stack traces from there..


Recognizing Stack Elements

Look for "runnable" threads to find busy processes..

Jrun.* - Jrun
Ignore: jrun.servliet.jrpp.ProxyEndpoint.readyFully
Suspect: jrun.servliet.jrpp.JrppOutputStream$SpillStream.write

Coldfusion.*
Functions: coldfusion.runtime.CfJspPage.*
Tags: coldfusion.sql.tagText.sql.QueryTag

Probably Innocent Java
java.util.*
java.lang.*

Suspicious Java
java.net.*
java.io.*

Your Code!
cfApplication2ecfm726408707.runPage(D:\Websites\blah.cfm\Application.cfm:577)


If the error contains 'bin' its very possible that its the JVM that's taken a dump.

More info will be posted tonight on http://www.darylb.net/

Cache Me If You Can

Great presentation on the concepts and practicalities of caching, (not really on specific code)

Download full thing here:

http://tinyurl.com/cacheme


Some key points.

Caching is Important. Very Important:














We might want to look at SQUID or VARNISH caching (httpd caching in front of servers)
Consider lighttpd for image serving. Remove the load from CF boxes

Consider the "Small Increment graph" - this is key. By even putting caching at levels of seconds or minutes, you can achieve dramatic decreases in server strain.
















Try Cheating!

Put all local info in cookie or similar, and serve that to the user to give the impression of instantaneous updates, but only do the work later when you have resources available.



Lunch etc..

Rather good lunch of Chinese food and great desserts..

Chatted with a few people and exchanged some business cards.

We spotted Charlie Aerhart before his ColdFusion Builder presentation and introduced ourselves (or at least wanted to let him know we were from Surfline and thanks for the help he gave us before.)

Nothing really specifically relevant being talked about during this time, so we're kind of taking a break, checking emails etc..
Although ColdFusion builder does look pretty cool. Basically an eclipse style IDE for ColdFusion. Charlie says it works with Linux and under CF8.

Before lunch we caught up with the Fusion Analytics "booth" and saw some stuff on that. Basically, it's an analytics program that works hand in hand with Fusion Reactor to analyze all the data that comes back. They claim Fusion Reactor takes up no more than 1% of the processor to run and it does look pretty amazing, when joined with Fusion Analytics. Its a per-instance license, but we may want to seriously consider it. There's a 10-day free trial. We should get everything lined up time-wise and try it out, so we can get the most out of the demo.

The upcoming 2:45-3:45 time slot has two presentations that I want to go to "Cache me if you can", given by the same presenter that introduced the ehcache stuff earlier at the keynote as well as "Advanced T-SQL", which I'd like to go to because I'm kind of the de facto DB guy, and should probably be up to speed on things like that... I may end up going to the cache one, though... Decisions, decisions..

-Shea

RAILO



Can't afford CF9? (7k PER SERVER) - Railo is free.


I just spoke to the Railo guys. It seems like this thing will do exactly what we want, (and more) with absolutely (they promise) no migration problems at all.

In addition there are some additional tags in RailoCF - notably an expanded and more capable caching system (kinda like our idea a while back) of having a switchable file/db/mem/cloud destination for cached information.

I think it's worth trying it on one server and see what happens. Apparently the installer will guide you through a migration from CF8/9 to Railo and requires no changes at all to the site codebase. They also suggest that for a fraction of the cash we save on a license, we spend it on their consulting services to get us up to speed fast and efficiently.

More info:



CF and HTML 5 - Shea

HMTL5: The cool, the really cool, and the "huh?"

Supported in major browsers.
IE 9 pledges support for HTML5 features.

New nodes in doc outline, to allow use of <h1><h2> etc tags in the doc outline in unique nodes.

<header> elemeent - can be used at page top OR at the head of a block of content <article> for example.
Similar with <footer> element.
<hgroup>

Sectioning elements
<section> - generic section of thematically consistent content, may not make sense on its own.

<article> - Represents an assembly of content that can be self-contained and reusable - makes sense on its own.

<nav>

<aside>

<time> - ISO Format 
attributes:
datetime, pubdate
Ex: <time datetime="1776-07-04">July 04, 1776</time>


HTML 5 Shiv (Shim)
Avail on Google docs

Be sure to use css to style elements as block (display:block) for support by other browsers.

<figure> - illustrative piece of content, images or even code snippets..

<script> no need for type or language spec, just use <script>

FORMS

placeholder attribute of <input> types.  Like value, but in newer browsers, it will erase as you click on it.

Other attributes..
type=""
search
tel
url
email
date
month
week
time
datetime-local
iPhone keyboard will be sensitive to the type of input you're using.. tel shows a number pad, url shows more URL specific keypad, etc..

Modernizr
http://modernizr.com

CSS3 Properties
HTML5 Properties
Adds support for HTML5 elements


<video>
IE 9 has announced support

<video src="myvideo.ogv" width="320" height="240" autobuffer>

</video>
autobuffer, or autoplay etc..

Can use a <source> element, which can be multiple options for different browser supports.

<video src="myvideo.ogv" width="320" height="240" autobuffer>
<source src="pr6.mp4" type="video/mp4">
<source src="pr6.webm" type="video/webm">
<source src="pr6.ogv" type="video/ogg">
</video>

Need server to specify correct mime types for this to work ok..

In html5 video is part of the DOM.  Can be styled and manipulated.  Has its own javascript API.

http://videojs.com/


<mark> - Do nothing more than mark up a piece of content that wasn't originally intended to be marked up.
Makes things a bit more symantically relevant, vs using some irrelevant span tag..

GeoLocation (navigator.geolocation)
All browsers must ask for permission first.

Coldfusion One Liners


"So a CF programmer walks into a bar...."





















http://www.samfarmer.com/

UNDOCUMENTED: LOOPING OVER FILES:

cfloop file="somefile.txt" index="theline"
cfoutput #theline# /cfoutput
/cfloop



CF9: Cfdocument can convert MS doc <- > PDF

Build Structures in a line:

<cfset variables.mystructure="{AL="Alabama",DC="District of Columbia"}>


QUICK WAY TO DO MODULUS: (this will change alternate lines for example)
<cfif currentrow % 2>class="alt"</cfif>