Nov 13

This shameless post is a simple attempt to stir up some news about Flash Player being released on the iPhone. I haven’t seen any formal announcements on the situation. With Apple’s recent announcment of 3rd party applications coming in February (SDK), could this possible put more control in Adobe’s hand for releasing Flash Player 9 on the iPhone?

Please!!!

“Cause I’m ain’t too proud to beg!”

Honestly though, Flash Player not on the iPhone might be better for my health in the long run…my brain goes CRAZY thinking about all the new possibilities it would open for me…

Apr 05

On the newly redesigned Flex.org site, there is now a link for “Flex for .NET Developers”. After clicking the link, you’ll quickly see some information on WebOrb & Fluorine and a couple links to some quick little tutorials I had written a while ago to getting up and going with Flex + .NET. I’m happy to see Adobe making an effort with those of us that combine Flex and .NET technologies.

I think it’s important to remember that these technologies can and do play nice and I’m excited to see this sub-group of the community continue to grow! Thanks!

Mar 16

I finally got around to posting the pictures from our trip to Haiti. It was an awesome experience but heart-breaking at the same time. We worked on building new classrooms for a school (the school has 500 students, and is a man’s house that he made into a church/school….amazing!)

Anyway, a truly life changing trip that really helps to put into perspective how Blessed we all are!

Haiti Pics on Picasa

Feb 09

I just wanted to let everyone know that next week, Thursday night, my wife and I will be leaving for Haiti and be gone Feb 16-25. We’re really excited and this weekend we’ll be packing and finalizing all the supplies we’ll be taking. If anyone is interested in knowing a little more, here is the website of the group we’ll be going with:

http://www.partnerswithhaiti.org

We’ll be working on a roof for an orphanage and working on other buildings in the village of AFCA. We’ll be staying at a church outside of Port-Au-Prince called Nazon. There is a video, sort of long (maybe 10-15 minutes) about the project going on and specifically the area we’ll be working. In the video, they talk about the Bethany project. It’s a school in the AFCA village. This is the school that we sponsor Michael and Kentia (two children Stacy met on her first trip to Haiti a couple years ago) to attend. On this trip, I’ll get to meet them both!

http://www.partnerswithhaiti.org/afca_video.htm

Any thoughts and prayers for us and the people of Haiti would be more than appreciated.

- Sam

Jan 09

Fluorine has been updated to Alpha release v16. Big news in this release is that it adds support for Flex's RemoteObject! A special thanks to TheSilentGroup for a great release! Possibly my favorite part of the new release and using RemoteObject is that ServiceCapture now parses my AMF3 correctly! Yippee!

In order to update my projects (As created from my this post), I've followed the following steps and everything seems to work great.

1) Create a services-config.xml in the root of your Flex application. It should look like this:

XML:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <services-config>
  3.     <services>
  4.         <service id="remoting-service"
  5.                  class="flex.messaging.services.RemotingService"
  6.                  messageTypes="flex.messaging.messages.RemotingMessage">
  7.             <destination id="fluorine">
  8.                 <channels>
  9.                     <channel ref="my-amf"/>
  10.                 </channels>
  11.                 <properties>
  12.                     <source>*</source>
  13.                 </properties>
  14.             </destination>
  15.         </service>
  16.     </services>
  17.  
  18.     <channels>
  19.         <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
  20.             <endpoint uri="http://{server.name}:{server.port}/{context.root}/Gateway.aspx" class="flex.messaging.endpoints.AMFEndpoint"/>
  21.         </channel-definition>
  22.     </channels>
  23. </services-config>

2) In your Flex Project Properties -> Flex Compiler -> Additional Compiler Arguments add the following

XML:
  1. -services "services-config.xml"

3) Create your RemoteObject services as follows:

XML:
  1. <mx:RemoteObject id="yourServiceName"
  2.         destination="fluorine"
  3.         endpoint="{gateway}"
  4.         source="com.yourdomain.service.yourServiceName"
  5.         showBusyCursor="true"/>

4) Copy the new "com.TheSilentGroup.Fluorine.dll" file from the new Fluorine release into your .NET Application's bin directory.

Good luck and enjoy....and again, thanks SilentGroup for the fantastic product, Fluorine!

Nov 29

Truth be told, the theater has been done for a couple months now, but I've finally gotten around to organizing my pictures (Google Picasa comes Highly recommended) and getting them uploaded (again Google Picasa Web Albums). I thought about trying to use Flickr, especially with all the Flex Mash-ups people have been doing with it, but Picasa was just too easy to pass up. Maybe they'll release some APIs (or maybe they already have) that will help Picasa gain momentum since I love it for organizing my photos.

I've posted two different albums, one is a album with descriptions of the finished theater and the other is lots of Before & After pics (and some in progress) of the theater that can take you on a trip of our past two years.

So without further ado: My Picasa Web Albums

Nov 17

Background Information:
I've inherited an application that stores many Dates and Times. The software is used by people all over the world who manually enter Dates & Times from worksheets into the software. The information is stored in a SQL Database and all dates and times are stored without any Timezone information and represent all different timezones. Dates from different timezones aren't compared or mixed, so when a report is generated form the database, its assumed the report and its dates and times are relevant to the client.

Many different applications hook into this system and I don't have the luxury of changing anything other than my Flex application to make it match the rest of the system.

My Goal:
My Flex application should allow a user to enter a Date and Time, which I store into a Date Type. For example:
"11/16/2006 03:00:00 PM" would be entered by a user in Eastern Standard Time (GMT-5).
"11/16/2006 03:00:00 PM" would be entered by a user in Pacific Standard Time (GMT-8).
"11/16/2006 03:00:00 PM" would be entered by a user in Moscow (GMT+3).

Each of those Dates would be saved in my database as: "11/16/2006 03:00:00 "

My Problem:
AMF3 no longer supports a Timezone Offset. See "AMF3 Specification" at OSFlash.org. I currently can take a Date & Time from my Database -> Backend (.NET in this case) > Gateway (Fluorine in this case) -> AMF3 and in reverse from AMF3 -> Gateway -> Backend -> Database without the Date or Time being modified in any way and without any Timezone information.

The problem is, Flex assumes the AMF3 information is in UTC(GMT). So as soon AMF3 is deserialzed into Flex, the Flex Date is modified to the client's local timezone offset.

What I want is all three of the dates above to show up in Flex, regardless of the client timezone, as "11/16/2006 03:00:00 PM" and I don't want to have to manually display the UTC Date all over my Flex application in order to do this. This would include if the Date is a member in a ValueObject.

My Solution (Work in Progress):
Everytime a Date is brought into Flex, I call a function:

Actionscript:
  1. public static function getUTCDate(myDate:Date):Date
  2. {
  3.     return new Date(myDate.fullYearUTC, myDate.monthUTC, myDate.dateUTC, myDate.hoursUTC, myDate.minutesUTC, myDate.secondsUTC, myDate.millisecondsUTC);
  4. }

which is called as

Actionscript:
  1. flexDate = DateUtil.getUTCDate(flexDate);

Everytime a Date is sent from Flex, I call a function:

Actionscript:
  1. public static function sendUTCDate(myDate:Date):Date
  2. {
  3.     var sDate:Date = new Date(Date.UTC(myDate.fullYear, myDate.month, myDate.date, myDate.hours, myDate.minutes, myDate.seconds, myDate.milliseconds));
  4.     return sDate;
  5. }

which is called as

Actionscript:
  1. flexDate = DateUtil.sendUTCDate(flexDate);

My Wish
Something that would make this automatic for me. Either a way to tell the AMF3 Date Deserialization to be saved as a Local Date, or some way to not make me call manually call these functions every time a Date is deserialized or serialized.

Many Thanks to Anyone with Any Ideas!

Nov 14

Due to an existing implementation of the application I'm working on and problems transferring Dates from Fluorine (.NET Remoting Gateway) to Flex, I decided to store and pass all my Dates as Strings. At first, this seemed like a reasonable and easy to implement change. As time has gone on, more and more problems seem to arise. I'm sure the best thing to do would be to find a way to use Date-typed Dates, but I've figured out and thought I'd share some workarounds/hacks in case anyone else is trying to/forced to use Strings as Dates.

1) Binding my dates to a DataGrid column:
In order to have my dates display in the form mm/dd/yyyy, I do the following:
Call a labelFunction named "dateLabel" which then calls a static function from my Util package "formatDateDisplay"

XML:
  1. <mx:DataGridColumn ... labelFunction="dateLabel" .../>

Actionscript:
  1. private function dateLabel(item:Object, column:DataGridColumn):String
  2. {
  3.     return Utils.formatDateDisplay(item[column.dataField]);
  4. }

Actionscript:
  1. //This is found in my Utils Package
  2. public static function formatDateDisplay(date:String):String
  3. {
  4.     // This removes any time data that is appened onto my Date String
  5.     return date.substr(0, date.search(' '));
  6. }

2) My DataGrid Columns should be able to be sorted by Date rather than by String Comparison
Call a sortCompareFunction named "dateMyDatePropertyCompare" which then calls a static function from my Utils package "dateFromStringSortCompare"

XML:
  1. <mx:DataGridColumn ... sortCompareFunction="dateMyDatePropertyCompare"/>

Actionscript:
  1. private function dateMyDatePropertyCompare(obj1:Object, obj2:Object):int
  2. {
  3.     return Utils.dateFromStringSortCompare(obj1.myDateProperty, obj2.myDateProperty);
  4. }

Actionscript:
  1. public static function dateFromStringSortCompare(obj1:String, obj2:String):int
  2. {
  3.     var date1:Date = (obj1 == '' || obj1 == null) ? null : new Date(obj1);
  4.     var date2:Date = (obj2 == '' || obj2 == null) ? null : new Date(obj2);
  5.    
  6.     if (date1 <date2)
  7.         return -1;
  8.     else if (date1> date2)
  9.         return 1;
  10.     else
  11.         return 0;
  12. }

3) Binding my String-Date to a DateField
You can not bind a String to a DateField selectedDate property, so it must be cast into a Date Type. The only way I've found to make this Bind is to do the following:

XML:
  1. selectedDate="{(model.myDateProperty == null || model.myDateProperty == '') ? null : new Date(model.myDateProperty)}"

and to save the DateField value to a String:

Actionscript:
  1. obj.myDateProperty= myDateField.selectedDate.toDateString();

My hope is that one of the following happens from this post:

- Someone can save some time and use something I've written here
- I'll learn a much cleaner way to do this and I'll follow this up with a "I can't believe i was doing that, now I'm doing this...post"

Comments are welcome and hoped for as always....

Oct 20

Months ago, Aral Balkan blogged about Service Capture not working with Flex Help and also gave a possible solution. (link) His solution was to uncheck 'Modify IE Settings on Application Start/Stop". Unfortunately for me, I didn't want to uncheck that setting. I like that when I start Service Capture, it automatically sets up the proxy on open browser windows. Luckily, IE6 proxys traffic for "localhost" but doesn't for 127.0.0.1. Flex Help is initially setup to run from 127.0.0.1, hence, missing Service Capture. Therefore, going into Flex Builder -> Preferences -> Help -> Help Server and making the Host Name: "localhost" and the Server Port: "57266" allowed me to leave 'Modify IE Settings on Application Start/Stop" checked and still use Flex Help. I was happy...

Fast Forward to yesterday, when I decided to upgrade to IE 7. Oh No! My Flex Help is gone again...wassup with that?! Well it turns out, IE 7 no longer proxys "localhost" nor "127.0.0.1". So whats a fella to do? Hack! For some reason, "localhost." (notice the period) is proxy'ed. Changing the Host Name in Flex Help Server to "localhost.", a quick restart of Flex Builder, and all is well in my world once again!

Hope this helps someone!

Oct 18

After my last tutorial/post about using WebOrb, I began using Fluorine. Recently a request was made for a tutorial, so here goes...

Using Service Capture , an ABSOLUTELY fantastic tool and Fluorine with AMF3, still seems to be a problem. Also, I wanted to try and use the RemoteObject tag with my solution to make using .NET a little less coupled. Well, it turns out; Fluorine still seems to work great with AMF0, the remoting format from Flash 8. This led me to Renaun’s RemoteObjectAMF0 which easily plugs into a Cairngorm ServiceLocator. So there's the pieces, now to put together the puzzle.

Renauns's RemoteObject also works with AMF3. The reason I've been using AMF0 is that AMF3 + Fluorine doesn't seem to display correctly in Service Capture. Possibly after I'm done developing my current project, I'll switch this to AMF3 and see if any problems occur. You simply need to change the the line in RemotingConnection.as:

objectEncoding = ObjectEncoding.AMF0;
to:
objectEncoding = ObjectEncoding.AMF3;

First you will need the following for this tutorial: Visual Studio 2005, Adobe Flex Builder 2.0, Renaun’s RemoteObjectAMF0 (link), and Cairngorm (link), and Fluorine.

Open Visual Studio and Create a New Web Service: File -> New -> Website -> Empty Web Site.
Create a new C# Class: File -> New -> File -> Class -> Name the class EmployeeService.cs. You may be prompted about placing the cs file in the App_Code Folder, choose Yes.

A file EmployeeService.cs will be created in the App_Code Folder. Open EmployeeService.cs. Enter the following code.

C#:
  1. using System;
  2. using System.Web;
  3.  
  4. using net.shrefler.vo;
  5.  
  6. namespace net.shrefler.service
  7. {
  8.     public class EmployeeService
  9.     {
  10.         public EmployeeService()
  11.         {
  12.         }
  13.  
  14.         public EmployeeVO[] getEmployees()
  15.         {
  16.             EmployeeVO[] emps = new EmployeeVO[2];
  17.             EmployeeVO emp = new EmployeeVO();
  18.            
  19.             emp.firstName = "Sam";
  20.             emp.lastName = "Shrefler";
  21.             emps[0] = emp;
  22.             emp = new EmployeeVO();
  23.             emp.firstName = "Your";
  24.             emp.lastName = "Name";
  25.             emps[1] = emp;
  26.  
  27.             return emps;
  28.         }
  29.     }
  30. }

Create a new C# Class: File -> New -> File -> Class -> Name the class EmployeeVO.cs. You may be prompted about placing the cs file in the App_Code Folder, choose Yes.

A file EmployeeVO.cs will be created in the App_Code Folder. Open EmployeeVO.cs. Enter the following code.

C#:
  1. using System;
  2. using System.Web;
  3.  
  4. namespace net.shrefler.vo
  5. {
  6.     public class EmployeeVO
  7.     {
  8.         public string firstName;
  9.         public string lastName;
  10.  
  11.         public EmployeeVO()
  12.         {
  13.         }
  14.     }
  15. }

Next we'll need to add Fluorine to our application. Add a "Bin" Folder to your Web Site. Right-Click on Bin and go to "Add Existing Item." Browse to where you downloaded Fluorine and add "com.TheSilentGroup.Fluorine.dll". Right click the root folder of your website and go "Add Reference". Click the Browse tab, and add the "com.TheSilentGroup.Fluorine.dll" in your Bin folder.

Open web.config and add the following code.

XML:
  1. <configSections>
  2.   <section name="classMappings" type="com.TheSilentGroup.Fluorine.Configuration.CustomTagHandler, com.TheSilentGroup.Fluorine"/>
  3. </configSections>
  4.  
  5. <classMappings>
  6.   <classMapping>
  7.     <type>net.shrefler.vo.EmployeeVO</type>
  8.     <customClass>net.shrefler.vo.EmployeeVO</customClass>
  9.   </classMapping>
  10. </classMappings>
  11.  
  12. <system.web>
  13.   <httpModules>
  14.       <add name="FluorineGateway" type="com.TheSilentGroup.Fluorine.FluorineGateway,com.TheSilentGroup.Fluorine" />
  15.   </httpModules>
  16. </system.web>

Next, create an empty Gateway.aspx file in the root of your website.

Finally, Rather than describing all the flex code: I decided to just use the Source View. So here is the flex code: (link)

I hope this helps everyone as much as I hope it will help me. As always, comments are appreciated. Good Luck!