Tuesday, October 4, 2011

Awesome code syntax highlighting made easy

If you're looking to add any code/language to your Blogger, just follow the instructions made easy by Carter Cole's Blog below. Works like a charm.

Awesome code syntax highlighting made easy

Cloning Objects in Flex

So you wanna Clone? I needed a way to clone for any of my VOs without having to go through every VO and adding a clone method and keeping track of my properties and the ObjectUtil don't seem to work that well either so I came up with this quick little recursive method that is still a work in progress but might help you get the same kind of thing accomplished. All this is possible thanks to org.as3commons.reflect so you'll need to go download the swk for this to work. Word File here ObjectUtils


public static function clone(object:Object):*
{
 if (!object)
  return;

 var desc:XML=describeType(object);
 var typeClass:Class=ClassUtils.forName(desc.@name);
 var result:*=ClassUtils.newInstance(typeClass);


 //loop through children and clone child objects recursively
 var x:int=0;
 if (object is ListCollectionView || object is Array)
 {
  for each (var item:Object in object)
  {
   var newItem:Object=clone(item);
   if (object is Array)
   {
    result[x]=newItem;
   }
   else
   {
    result.addItem(newItem);
   }

   x++;
  }
 }
 else
 {
  for each (var a:XML in desc..accessor)
  {
   var currProp:String=a.@name;
   if (a.@access == "readwrite" && currProp != "uid")
   {
    if (ObjectUtil.isSimple(object[currProp]))
    {
     result[currProp]=object[currProp];
    }
    else
    {
     result[currProp]=clone(object[currProp]);
    }
   }
  }
 }

 return result;
}

Monday, October 3, 2011

Flex 3 Line Charts with Datapoints always displayed

I was tasked today with making the datapoints on a line chart always show up instead of just on hover.  I knew it could be done but nothing seems to be built in for this and you can spend a lot of time searching around to get this to work so I’m going to make it easy for you.

FYI If you use showAllDataTips="true" this will create a mess is not what you’re probably looking for.  So few things to note.  First in your series, you need to use an itemRenderer.  They come will the charting so they should be available for you.

mySeries.setStyle("itemRenderer", new ClassFactory(CircleItemRenderer));

OR


<mx:LineSeries itemRenderer="mx.charts.renderers.CircleItemRenderer"/>

Now if you are specifying your own colors, you need to not only set your strokes and colors but in order to have your colors of your CircleItemRenderers match your strokes, you need to make sure and set the Fill to that same color.


mySeries.setStyle( "fill", myColor);

The last thing to note here is on your chart to set clipContent="false" so that your datapoints or CircleItemRenderers don’t get cut off on the edges.
Hope this helps!

Flash Builder 4.5 Plugin

So after searching the web for a way to use my Spring Source IDE (eclipse) with the new version of Flash Builder 4.5 and not finding a simple download solution, I decided to manually figure out a way to copy all the plugins and files to hack my own version together.  This was mainly because I use so many plugins (flexpmd, maven etc.) and didn’t want to have to reinstall all of them and make the switch and also have to re-import and  reconfigure all my projects.
Well low and behold in my process I realized that Adobe places a utility in the Flashbuilder/utilities folder that installs the plugin into an existing copy of eclipse!  Awesome, so now all I have to do is make a copy of my SDK’s, uninstall my previous version of Flash Builder Plugin, double-click the Adobe Flash Builder 4.5 Plug-in Utility.exe and point it to my SpringSource location.  I’m back up and running with all the new features!  Oh and now my unit tests work for flex libraries!
So basically just download the standalone Flashbuilder 4.5 and then use the utility that comes with it to upgrade your plugin!  There should be some documentation or something for it.  I went to Adobe’s release notes that should tell you this but you get a 404 error.  Not helpful when you’re on a timeline.

Spark Datagrid forgets drag and drop

I was 99% through a complete redesign when I realized today that the Spark Datagrid in 4.5.1 doesn’t have the drag and drop capabilities built in. I noticed all the events pop up in FB 4.5 but the dragEnabled is not there. I figured it was maybe because there was a “new” way of doing it but after a little research I found that it was indeed left out. I’m hoping my client is ok with waiting for it but if not it’s back to halo :(

My Grandfather

Patricio Gutierrez
Coal miner, rancher

Patricio Gutierrez, age 96, passed away at Mt. San Rafael Hospital on Sept. 26, 2011.

He was born June 25, 1925, in Torres to Eulalia (Bustos) and Lorenzo Gutierrez.

He was a coal miner having worked in area mines for 40 years until his retirement.

He raised cattle and loved caring for his horse Annabelle.

Patricio was a member of UMWA Local 9856.

He was preceded in death by parents, Eulalia and Lorenzo Gutierrez, beloved wife Florence O. Gutierrez, daughter Melva Gutierrez, son Joseph Gutierrez, grandson Michael Gutierrez, brother Richard Gutierrez and sister Sarah Romero.

Survivors are son Leonard Gutierrez (Kathy) Gutierrez, Golden, daughter, Sylvia (Joe) Graham, Gainesville, Va. Numerous grandchildren, great grandchildren, nieces, nephews, and other relatives.

Visitation will be Monday from 2 p.m. – 6 p.m. at the Comi Funeral Chapel.

Funeral Mass will celebrated Tuesday, at 10 a.m. Oct. 4, 2011 at Holy Trinity Church.

Internment will follow at the Trinidad Catholic Cemetery.

Arrangements made under the direction of the Comi Funeral Home.