Entries for month: March 2009

ViewStack objects cause TypeError: Error #1009

Cannot access a property or method of a null object reference.

 

Viewstacks are great for hiding and showing groups of objects. For example you can display a datagrid with all your "Contacts" from an address book. Click on a person's name and display an "edit form" in the second viewstack position with all the contact details ready to edit.

 

The problem is when you try to set the details into the form input fields you get the TypeError #1009.

 

The reason is your viewstack does not create your form when the component is initialized. You have to tell the viewstack to create ALL the objects on initialization.

 

<mx:ViewStack
    width="100%"
    height="100%"
    creationPolicy="all">
        <view:ContactList />
        <view:ContactForm />
    </mx:ViewStack>

 

 

Review of 360 iDev Conference

Overall, I found the conference "just right". As a web developer with zero Mac/iPhone/Cocoa experience, it can be intimidating attending conferences with seasoned programmers talking way over your head and sessions geared exclusively to advanced topics. 360 iDev had a good mix of intermediate and beginner sessions. Most interesting were the cross-over sessions. IPhone development for Flash developers put objective C in terms a web developer could better grasp.

 

Pre-conference Workshop

Two sessions where offered on Sunday as a primer on iPhone development. PhoneGap training focused on using the PhoneGap framework to build applications using web technologies. I did not attend this session, but it sounds like an interesting technology.. The other session focused on the iPhone SDK and Apple developer tools. The first three hours covered iPhone SDK basics including how you submit to the App Store. Most surprising was all the ways you can trip up during the build and submission process. For example, you iPhone application can be rejected because your icon isn't the correct size or format. Joe Pezzillo did 3 Hello Worlds in the second half of the day. In Joe's session we got our hands dirty using XCode and Interface Builder to create Hello World Apps using the UIView, UINavigation and UIWebView. Perfect for us newbies.

 

Some sessions I attended.

iPhone vs Android
Julio Barros lead an interesting discussion and drew upon the audience for opinions on how Android fits into the smart phone landscape. Julio pointed out Android's strengths (Open Source, no app approval process, ability of apps to run in the background) and some weaknesses (potential lack of focus, complaints about the android app store and google's long term commmitment to Android). He summed up his views on Android's future as the OS for a Kindle / Tablet type device or vertical market devices that demand an open OS that developers can control.

 

From Flash to iPhone
Emanuele Cipolloni presented on how a flash developer would move into the objective C world. His examples were very simple yet powerful. How to draw a rectangle in Actionscript and add it to the stage, make it draggable, etc. Each example was compared with how you would code it in XCode. Emanuele then transitioned to a tool his company Barefoot software has developed. It translates Actionscript code into C code. Unfortunately, the software is not available. The audience was a bit disappointed and left unsure why Emanuele showed off a tool that we can't aquire.

 

Prototyping in Fireworks
This might seem like a strange session for an iPhone developer conference and the low turn out would say attendees weren't interested. As a web developer prototyping is extremly important prior to coding, so the topic made a lot of sense for iPhone development. Alan Musselman blew my mind. Every 3 minutes I was say to myself "I didn't know Fireworks could do that". Walked away with a link to http://blog.metaspark.com/ who posted a .png file with all the common iPhone UI components for rapid prototyping in Fireworks. Whoo Hoo! If you find any presentations on prototyping with Fireworks, check them out.

 

Web or SDK Development

This is a real question for web developers interested in iPhone development. Do I have to learn objective C? Are web apps not "real" apps. Chris Allen led the discussion comparing web and sdk (native application) development. A few advantages to SDK development is access to the camera, GPS and other apps on the phone. What I found interesting was the inclusion of iPhone Touch methods in javascript that are available via Safari. Also, using Dash Code you can create a small iPhone App that launches Safari and loads your web site which could be skinned for the iPhone, or any other phone device.

 

Learning the iPhone SDK from the Flash Developer's Perspective
This three hour Handons workshop was lead by James Eberardt. He did a very good job do a line by line comparison between Actionscript 3 and Objective C. Starting with simple if-else, loop and function calls he gradually reviewed more complex tasks like drawing objects in Objective C. James also shared dozens of examples in Objective C. Worthwhile for any flash/flex developer interested learning Objective C. I would recomment. If you are interested in a two day workshop James will be in Los Angeles- April 4 & 5 http://www.richmediainstitute.com

 

Conclusion
If you are not already part of the Mac Developer community and want to find out what iPhone development is all about, 360 iDEV is a great way to get introduced to the world of iPhone development.

 

Adobe ColdFusion 8 Server Monitor Presentation

Ashwin Mathew former member of the Adobe ColdFusion team presented on the ColdFusion Server Monitor at the Bay Area ColdFusion User Group on January 21, 2009. The presentation was done on a Linux OS and therefore Adobe Connect could not record the presentation. I used a video camera and the quality is not that good. I've taken notes from the presentation and included them below. If you want the video or audio, you can download them below.

 

 

Current State of the JVM (Java Virtual Machine)
Since ColdFusion runs on top of Java, the amount of memory used by the Java Virtual Machine is very important to performance. The server monitor displays how much memory the JVM is using and has used in the past. You don't want your JVM usage to max out your server memory. For example, your server has 2 GB of memory and your JVM is using 1.5 GB. That would degrade performance significantly.

 

Monitoring, Profiling, Memory Tracking
On top of the server monitor window are three buttons for the three different levels of server monitoring.

 

Monitoring
This tracks information at the template level. You get information about application errors, overall memory usage, slowest queries, etc. There is only a 1% hit on server performance when monitoring is turned on. This is acceptable for use on a production server.

 

Profiling
This tracks information at the tag level. You get detailed information about individual tags and how they are performing. There is a 3 to 4% hit on server performance when profiling is turned on. Again, acceptable for use on a production server when tuning your application.

 

Memory Tracking
This estimates how much memory your requests and sessions use. There is a 60% to 100% hit on the server when memory tracking is turned on. Do not use on your production server. This will slow your application down and may cause it to crash. NOTE: If you server reboots, it will restart with the same settings at the time of the crash.. You'll want to go into the configuration xml files to turn off memory tracking if you find yourself unable to access the Cold Fusion Administrator.

 

Slowest Active Requests
If you have a slow running request, it will show up on the overview screen. From there you can double-click on that request and see the following details.

 

  • Template Name
  • Type of Request
  • How much memory used
  • How long it's been running
  • All variable scopes (UR, session, application, request, etc) and the values for the variables.

Very powerful. Ashwin stated that this is the only tool he knows that ties together server performance information with the level of detail only seen in debugging tools used in development. Essentially, you jump from server logs to the line in your code along with any parameters involved.

 

What versions of ColdFusion include the Server Monitor?
I thought the server monitor was only included with ColdFusion 8 Enterprise. Ashwin mentioned that the server monitor is for BOTH administrator and developers. It's included with ColdFusion 8 Developer Edition for use when coding your applications. Thank you Ashwin and thank you Adobe!

 

Requests with Errors
From the overview screen you see a list of requests with errors. Double-click on the template path to see more detail. Most importantly WHEN the error last occurred. This can be very helpful for intermittent errors. You may notice a pattern in the errors based on frequency or time of day. This can help you narrow down the cause.

 

Requests that are Slower than N
From the overview screen you see a how many requests are running slower than N seconds. For example, I want to find requests that are slower than 3 seconds and improve the code. Double-clicking shows you a list of the slowest requests. The two tabs are "slowest request" and "slowest request by average. You might have a single request that is very slow, but on average it is fast. You'll want to investigate that one slow request. You can examine the different scope variables (URL, session, form). You also get a list of the ten slowest tags and functions. The slowest request by average lists the size of the most recent request, the average size, the most recent response time, the slowest and fastest response times. These can indicate where your application is slowing down.

 

Requests by Memory Usage
Similar to request that are slower than N. You can set the threshold in KB and how many you want to list. NOTE: You should be careful when modifying how many you want to list. The default is 20, up to 100 would be fine, but beyond that you may see a performance hit. The more items you track, the more processing power is needed.

 

Sessions by Memory Usage
From the overview screen click on sessions by memory usage to get a list of sessions and their size. Double click any sessions to find out the Session id, application name, ip address of the client. If you find a session using a large amount of memory (1/2 a mb) you'll want to investigate. These large sessions will slow your server down.

 

Slowest Queries
You can view the slowest queries and the slowest by average. You can double-click any query to find out the name, calling template, datasource, is it cached, how many times has it been called, when was it last called, average size. This will help you locate slow running queries and identify circumstances that cause your queries to run slowly. A cool feature in this section is the SQL pane. You get a copy of the SQL statement that was executed and you can copy and paste into a SQL Query Tool to review the returned results.

 

Queries by Memory Usage
Similar information as the slowest query report just displaying memory usage information

 

Statistics
This area provides more details on requests, sessions, threads, hit counts, and template cache. I found Ashwin's comment about the "template cache hit ratio" very helpful. He said the higher the template cache hit ratio the better. 100% means your server isn't recreating templates with each request, but using a cached version which improves server performance.

 

Alerts
Alerts provide ways to automatically take action based on how your ColdFusion server is performing. They include the following 4 ways.

 

  1. Unresponsive Server will alert you when your application exceeds a specific number of hung threads or the busy thread time exceeds a specified number of seconds.
  2. Server Slow Server will alert you when the response time exceeds a specified number of seconds.
  3. JVM Memory will alert you when the JVM memory exceeds a specified number of MB. Important if you have limited memory on your server.
  4. Timeouts will alert you went the count exceeds a specified number or the time interval exceed a specified number of seconds.

If any of the events are triggered the server monitor can take one or more of the following actions.

 

  1. Send Email - snapshot will be attached to the email if dump snapshot is enabled.
  2. Dump Snapshot to the hard drive.
  3. Kill threads running longer than specified number of seconds
  4. Reject any new requests
  5. Process a specified CFC
  6. Perform garbage collection (only for JVM Memory Alerts)

You can see a history of all the alerts and the actions they've taken. Snapshots are stored will a lot of detail about the server at the moment the alert was triggered.

 

Settings
Located in the upper right corner is a setting button.

 

  • General
    From this tab set the refresh rate for reports and graphs as well as how often to calculate the average response time. Checking shrink template paths shortens your paths using a "..." followed by the name of the template Hovering over will display the entire path.
  • Filter Settings
    This tab allows you to include or exclude directories. Doing this allows you to focus on specific templates in your application.
  • Profile Filter
    Profile filter allows you to exclude the framework specific code and just monitor your application code.
  • Aliasing
    When running a framework you often point to a single index.cfm page with event parameters. Aliasing allows you to separate each unique "event". Instead of seeing "index.cfm" is slow . You'll know that "index.cfm?event=GenerateBigReport" is slow using the alias you setup.
Powered by Mango Blog. Design and Icons by N.Design Studio
RSS Feeds