Given by Dan Wilson - DataCurl
Very broad overview of reasons we write bad code. Generally , every reason we are rushing day in and out to push our code for the build. Kind of seemed like a principle yelling at us for running in the halls.
Some very broad ideas:
- Change Boolean evaluations into functions
- Try never to nest conditionals even thou they may be easier to develop at first, someone else doesnt need to go through the same process you did just to make a small change
- Its not always about writing less lines of code, sometimes its better to write larger functions then smaller ifelse so others can read the true function of the conditional or loop easier
- Put evaluations at the top in silents and configurations so someone can easily modify setups.
Broad elementary discussions on the advantages of commenting
Since we are using SVN, why would we comment out large blocks of code, use small comments with revsions stated to make files easily readable by others
Save money on kb being sent:
- Use upper level styles and less lower level duplication of styles
- Put those styles stored externally and loaded into the browser only once on the site
Example: use the
over | with classes for header areas Stop Code: put conditionals that stop the rest of the page from processing at the top to save kbs and time for others reading
Elementary overview of why descriptive naming is import and why common naming is bad
Strong final emphasis on using var scoping to prevent var leaking.
OK, Had to do it.. Left that other one... Wow, horrible. Be explicit Example: <cfset aThing = false> <cfloop query="blah"> <cfif something IS true> <cfset aThing = true> </cfif> <cfif NOT aThing> sfsdf </cfif> Use this instead.. <cfif aThing IS true> asdsas </cfif> Inline classes with lots of code, like <td class="rowBody"> Should be set in CSS to avoid extra bandwidth usage.. More text means more noise.. Rule 1: Be clear, or be clearer.. So, if something is shorter doesn't mean its better. Start with things that get you out of the file vs all the positive statements.. If you don't meet the conditions, get out of the file.. Look at <cfontent type="text/plain" reset="yes"> to control whitespace... Example was outputting xml content inline without worry about including whitespace at top of file... Mixing in <cfscript> just to "feel" more programmy, stop doing it... Harder to debug and more lines of code overall.. Stop naming variables like objX, give them names that people can follow if they need to go through code later (including yourself) Similarly name queries with meaningful names, so it makes it easier to debug.
"Once upon a time, if you wanted to develop applications in ColdFusion, you had to pay for any third party tools you needed - and you rarely got the source code. Things have changed! These days there are free and open source options right across the board to help you get your job done faster, cheaper and with more confidence. Find out how the burgeoning open source community can help you - and, perhaps, how you can help the open source community in return!"
~~~ Open Source can be better quality than Proprietary - Apache, Linux, because they have so many eyes on the code.
~~~ Key is the copyright license. ~~~ So far this is a talk more about the concepts of Open Source... he's just starting into CF specifics. ~~~ CF Exchange - mostly paid. Why is CF so small? - Historically PHP/Linux were OS from the start - have that mindset. - CF was originally Windows and Proprietary, that continued. Now? Frameworks changed that - Fusebox, ModelGlue etc. RIAForge - is almost all CF (720)
Applications in CF? BlogCFC Mango Blog Only forum: Galleon Mura /FarCry- CMS Tools: CFEclipse http://www.carehart.org/cf411/#tools
CFML Engines: Smith Project (CF6) Open Blue Dragon (Cf7 - but moving up) Railo (Cf9+extensions)
4CFF: For ColdFusion Foundation - http://4cff.org - just started... rolling out soon.
Social Coding: SVN GIT codesion unfuddle assembla github : This apparently is the best of the lot.
I'm alive... We'll see how this goes from there... Section 508.. Wow, serious? ADA?? http://www.ada.gov/adastd94.pdf (Who is this person?) Accessibility: Development of Information Systems flexible enough to Accommodate the needs of the broadest range of users, regardless of age or disability... God, this is so boring so far... Accessibilty constraints in Javascript... Worthless to us...

Leesberg has rednecks! In the Downtown Saloon you can smoke, strip, and play any kind of music: Country OR western!
More of an introduction, but we'll see if there are any useful nuggets.. <cfmap> example to start off... CF9 - New tag cfmediaplayer CF8 - cfwindow ColdFusion uses extjs behind the scenes. <cfajaximport tags="cfmediaplayer"> href="javascript:ColdFusion.Window.show('my_window')">link</a> Then use <cfwindow name="my_window" otherAttributes> OR href="javascript:ColdFusion.Mediaplayer.stopPlay("companyVideo");">Video</a> Guy talks really fast. Interesting, but I think I may wait on any other stuff until after the conference when more detailed info is available on this talk.
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.
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/
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.
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
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:
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.
"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>
|