Wednesday, December 24, 2014

Moving From Adobe Flex 4.6 to Apache Flex 4.13 with FlexMojos

I was very excited for the handover of the Flex project from Adobe to an Apache project.  After a few years I was finally given permission to move our product from Adobe Flex 4.6 to Apache Flex 4.13.  Here are my notes on the process in the hopes that they help somebody else in the same situation.

For some background our product was compiling using FlexMojos 4.0-RC1 and Adobe Flex version 4.6.  I decided to go with the least moving parts approach, which meant I made the upgrade in two steps.  First I upgraded the FlexMojos version to version 6.0.1 and then I upgraded to FlexMojos 7.0.1 and Apache Flex 4.13.

Up first was the upgrade to FlexMojos 6.0.1.  This version of FlexMojos supports both Adobe and Apache SDK's, but due to difficulties in supporting two different group ids, it uses the com.adobe groupID for all types of artifacts.   I followed details available on FlexMojos 6.0 wiki page and its child page specifically for migrating to FlexMojos 6.

  1. Upgrade to Maven 3.0.5 (required for FM6)
  2. Changed the FlexMojos version property in my parent pom file to 6.0.1
  3. Changed the group id for the FlexMojos plugin from org.sontaype.flexmojos to net.flexmojos.oss
  4. Update the playerglobal dependency 
    1. Group ID = com.adobe.flash.framework
    2. Artifact ID = playerglobal
    3. Remove version that points to Flex SDK
    4. Update classifier tags to version
Once I made these small changes I was up and running with the new improved FlexMojos 6.0.1.  After that I moved on to the bigger task of Apache Flex 4.13.  I downloaded the Apache Flex installer and installed the SDK locally and then used the Apache Flex mavenizer, lots of details on that in the Apache Flex Wiki. I won't go into details, but I basically downloaded the source for the project and build the maven deployer.  Since I wanted to test locally I did modify the deployer slightly so it would just install the artifacts to my local repository first.  Overall it was pretty straightforward.

Next I updated my various pom files for FlexMojos 7.0.1 and Apache Flex 4.13.  Here are the steps:
  1. Update the flexmojo.version property in the root pom to 7.0.1
  2. Update the flex sdk version property in the root pom to 4.13.0.20140701
  3. Updated the old groupID of com.adobe.flex to org.apache.flex for several dependencies.  In my case there were some instances where the old group id was valid because I had some automation libraries that I still don't have artifacts for and also for some exclusions.
  4. Remove the license jar dependency.
  5. Updated the flexframework artifact name to framework and fixed the group id for it to org.apache.flex
  6. Updated the theme dependency so it doesn't have a classifier and instead of the type being css it is now swc.
  7. Updated the theme dependency's group id to org.apache.flex.framework.themes
  8. Updated all the Flex dependencies from the scope of "caching" to "rsl", because there aren't any swz files for Apache Flex libraries
  9. Updated the group id for all automation libraries to org.apache.flex.framework.automation
  10. Remove the "_rb" from the automation artifact names and added a new classifier of ".rb"
All of the above changes got me 99% of the way there and I was able to build the project successfully with Maven, unfortunately I ended up with a runtime problem.

When loading the application in a browser I received the dreaded VerifyError 1053 "invalid override of the removeItem() method.  As it turns out the third party library I was using had a removeItem() method on a class that extended from ListCollectionView AND in the same method was added to Apache Flex 4.10.  

Of course I didn't just take the error message at its face value and spent a few days trying to figure out the problem.  Once I did it was just a matter of downloading the source for the specific version of the third party library, changing the name of the method, rebuilding a "new" version and deploying it to my maven repository.  Of course if I didn't have access to the source I would have been in trouble. After that the application behaved as it did before the upgrade.

Tuesday, October 28, 2014

iCloud Photo Library, Finally!

Back in June while watching the Apple WWDC, I was most excited about the announcement of the new iCloud Photo Library in iOS8.  The most common problems non-technologically savvy iPhone users seem to face are related to photos and this is going to go a long way to fixing those problems.

The 2 Most Common Problems
1. No more room left on the device. 
2. Unable to back up because there is no more available space in iCloud.


To solve the first problem most people will go to Photos and start deleting photos until they free up enough space.  As for the second problem most people don't do anything, because they don't really know what the problem is and as a result their phone isn't backed up anymore.

I think the iCloud Photo Library will resolve both of these issues, well definitely the first, but it will certainly pave the way for the second fix.

The iCloud Photo Library basically stores ALL of your photos and movies on Apple's servers as long as you have enough storage available in your iCloud account.  All your photos will be available from any iOS devices with iOS 8.1, on Windows PC's and in any web browser at iCloud.com. Any changes you make to the photos like edits, favorites or organization will "immediately" be updated in all places.  Now you might say I though this feature already existing with the "My Photo Stream" thing.  It is true that "My Photo Stream" did sync your photos to the cloud, but it had limitations regarding how long the photos stayed on Apple's servers (just 30 days), editing on different devices required the creation of a duplicate copy, there wasn't a way to view the photos on iCloud.com and it didn't include movies. Here is more info from Apple

In short this is going to at least keep everybody's photos and movies in one place without much work from user's.  As an added bonus, you can now choose to save space on your device by having a smaller version of the picture on your device and the device will also delete some of these pictures as you run out of space. Now people can mindlessly take pictures without being concerned about storage on their device.  The only thing holding people back will be the amount of storage they have in their iCloud accounts, but with the new low price of $0.99 a month for 20GB, most people will be good for at least a few years, at which point they can decide to upgrade to more space.  The lack of the Camera Roll from iCloud backups coupled with the extra cloud storage space should get people back on the "backup train".

So I am a big proponent of this and recommend getting on board as soon as possible.  Here are some steps you might want to follow first.
1. Upgrade your iCloud Storage to the 20GB plan.  You are probably already at the 5GB limit, so take the plunge for $.99 a month.  Settings > iCloud > Storage > Change Storage plan
2. Back up your device to iCloud. Now that you have some more iCloud storage space get a fresh backup out there. Settings > iCloud > Backup > Backup Now
3. Upgrade to iOS 8.1.  Go grab a computer with iTunes, plug in your iPhone and upgrade.  No need to worry about freeing up space when doing it with iTunes.
4. Turn on iCloud Photo Library with iMore's Enable iCloud Photo Library Instructions
5. Wait for all of your photos and movies to upload to the cloud

Now enjoy taking pictures again.  The only other recommendation I have at this point is to make sure you go through your photos every once in a while and click on the little Favorite heart for your favorite pictures.  You can then go to the "Favorites" album and quickly see them there.  Manually adding photos to Albums is probably a good idea too although the built in Moments grouping works pretty well.

Thursday, August 28, 2014

Flex UIComponent CallLater Exception Handling

I recently ran into an issue with Flex that took me a while to track down related to callLater() execution and the UIComponent.setFocus() method.

In my case I was executing some functions using callLater() for various reasons, but I also had some event listeners set up that were listening for focus change and also testing to see if components were in focus.  It was a perfect storm for trouble it turns out.

After lots of debugging and scratching my head I started to get an idea of what was going wrong.  If you take a look at the UIComponent.callLaterDispatcher() method you can see the first line of code increments the UIComponentGlobals.callLaterDispatcherCount variable and the same variable is decremented at the end of the method.  I also found reference to this variable in the UIComponent.setFocus() method, where it will postpone setting the focus on the current component if the value of callLaterDispatcherCount is not zero.  If you look at the ASDoc for the callLaterDispatcherCount it states that in order to fix a problem with the ActiveX player the focus is deferred until enterFrame.  So that explains why my focus handler wasn't being notified, because for some reason that counter wasn't zero.

Now back in the UIComponent.callLaterDispatcher() there is an import if statement that tests the UIComponentGlobals.catchCallLaterExceptions variable.  Basically if this is set to false, which it is by default, any errors will not be caught by the callLaterDispatcher() method and the callLaterDispatcherCount will never be decremented.  So as soon as your callLater function throws one error the setFocus will stop working correctly.  Conversely if you have the "catchCallLaterExceptions" set to true any Error in the function being called later will be caught and wrapped inside a dynamic event and dispatched via the SystemManager.

For the short term I fixed the error that was being thrown, which allowed the "callLaterDispatcherCount" to be decremented back to zero.  The other option I am looking at in the long term is setting the UIComponentGlobals.catchCallLaterExceptions variable to true on application initialization so the counter will always get decremented and handling any callLater exceptions at the application level, as laid out in this blog post, Summa - Global Error Handling in Flex  Hopefully this will help people out if they run into a similar problem.

Additional Resources:
Liquid Night - Global Exception Handling in Flex
Doug McCune - How are you doing global exception handling in Flex/Flash/AS3?

Sunday, July 27, 2014

Unlocked iPhone in Iceland Results

In an earlier post I detailed the process I went through to unlock my iPhone 5 in preparation for my trip to Iceland. So I thought it might also be helpful to provide a recap of how it actually went.

Finding a SIM Card

After reading over the great post over at iheartreykjavik.net called To buy or not to buy an Icelandic SIM card, I decided to go with a Simmin card. Upon arriving at the Keflavik airport I immediately went to the Elko electronics store in the main shopping area and asked an employee there if they had Simmin SIM cards, they only had Ericcson brand, which I didn't want because of the coverage outside of Reykjavik. After getting my bags and seeing the signs for the Simmin cards on signs at the baggage claim I stopped by the Duty Free store, which also only had Ericcson. Finally, I took my chances at the 10-11 convenience store in the main lobby of the airport and they had a couple Simmin Nano SIM cards left. I bought the 2000 krona prepaid card, which I vaguely remember coming to 2900 krona. I didn't really care, I was just excited to have found the card at the airport. Here is the packaging.



Installing the SIM Card

I convinced my wife to stop for a couple minutes so I could try to get the SIM card installed and thankfully she obliged. I found a corner of the floor where I could spread out my bag and got to work. The whole package was about the size of the credit card and opened up to reveal the 2000 krona prepaid card, a card with the SIM card and some instructions. The instructions were useless to me because they were only in Icelandic. So I guessed at it and did this:
  1. Removed my AT&T SIM card using a paper clip, because despite having had 5 iPhones in our house, I can't locate a single SIM card removal tool.
  2. Popped the Simmin SIM card out of the packaging.
  3. Placed it carefully in the iPhone 5 SIM card tray (metal side down)
  4. Slid the tray into the phone.
  5. Once it was inserted the phone prompted me for a PIN, which I found by scratching off a spot under the word PIN on the card that had the SIM card attached to it. Next to the PIN on the card is also the PUK number, which I believe is the Icelanding phone number for the SIM card.
  6. After entering the PIN it took a minute or so and the Simmin name appeared in the top left and I was off to the races. The card also has a PUK spot next to

The User Experience

The first stop of our trip was in Reykjavik for breakfast, with plans to drive to the hotel in Vik on the south coast that evening. I used the phone a couple times while in downtown Reykjavik for maps and various social media updates. During the drive it came in handy for a couple good searches and the service never fell to less than a couple circles formerly known as bars. At some point in the drive I got a text message in Icelandic, which I was quick to disregard. I finally made it to a scenic spot a few hours later and attempted to send a text message with little success, which I attributed to lack of signal because it was in the middle of nowhere. However, later on I learned that the phone wasn't receiving any form of data anymore. During the drive I tried to play some songs via the Music app with little luck, it appeared like they were playing, but no sound was coming out. I remained perplexed until I stopped and switched the phone into Airplane mode and tried playing music again with great success. I had found my aha moment!! I am an iTunes Match subscriber and even though I had downloaded a few albums for the trip, the phone was still trying to use the data connection for the songs. Since the music playing had worked earlier in the day I figured out that I had used up all of my prepaid data at that time.

Now that I had some idea about what was happening I went to the Simmin website to try and figure out how much money was left on the prepaid card, but couldn't really figure it out. Instead I just went to the Simmin Top Up Page to add more data, I went with the 1GB mobile month long data plan for 1290 krona. All I needed to do was enter the PUK number from above and enter my credit card information before I was back in business. The rest of the trip I made sure to flip to Airplane mode when playing music to avoid falling into the same trap again. The card worked fine for the rest of the trip.

Funny note, on the second to last day of the trip I ended up translating the Icelandic text I had received on the first day and it translated to "Your credit is down to 100 krona."

Saturday, July 19, 2014

Time Zones and Aperture

I recently took a trip to Iceland and took photos with both my iPhone and DSLR camera.  The iPhone pictures made it into Aperture via My Photo Stream and I imported the DSLR photos manually.

After looking at the timestamp on the photos I saw that all of the iPhone photos have a time stamp of the local time, but the time zone is EDT instead of GMT.  The iPhone seems to know the local time, but for some reason the camera is using the old time zone. For example, one of the photos I took at 7:37 GMT had a timestamp of 7:37 EDT. In order to fix this in Aperture you can use the Batch Change functionality under the Metadata menu.

  1. Select the pictures you want to update
  2. Click Metadata > Batch Change...
  3. In the Time Adjustment radio select Adjust Time Zone
  4. For Camera's Time Zone set it to the time zone where the pictures were taken, in my case Atlantic > Reykjavik
  5. For Actual Time Zone set it to the time zone seen in the timestamp before doing this, in my case America/New York
  6. Click OK to update the photos, this will put the photos in your local time zone with the appropriate time. In the example I gave before the timestamp now says 3:37 EDT.
  7. Click Metadata > Batch Change...
  8. In the Time Adjustment radio select Adjust Time Zone
  9. For Camera's Time Zone set it to the Actual Time Zone from above.
  10. For Actual Time Zone set it to the time zone where you actually took the photo.
  11. Click OK to update the photos, this will correctly adjust the time so the time and timezone are correct.
As for the DSLR, I never updated the clock on it so all the pictures had my native timezone of EDT.  In that case you just have to start at step 7 above and change them from EDT to GMT.

Tuesday, June 24, 2014

Unlocking an AT&T iPhone 5

In preparation for my upcoming trip to Iceland I started to research using my iPhone abroad.  
Apparently there are three ways to go:

  1. Don't do anything and pay high international roaming fees to AT&T.
  2. Change my AT&T billing information to include some sort of international data plan.
  3. Purchase a prepaid SIM card from a carrier in Iceland
The last option seemed the most interesting to me and the prepaid SIM card also gives me a clear idea about how much it will cost me to use my phone in Iceland instead of being surprised when I get back home. However, since I bought my iPhone from AT&T it is not unlocked, which means I can't use it with the SIM card from a different carrier.  The good news is AT&T will let you unlock your iPhone for free if you meet certain restrictions.  Below are the steps I used to unlock my AT&T iPhone 5.



AT&T Unlock Request

The process to request that AT&T unlocks your phone.
  1. Go to the AT&T Unlock Request site
  2. Fill out all the fields
    1. The IMEI number is a unique identifier for the phone that the cell companies use when activating to determine if the phone is stolen or is allowed on different carriers.
    2. You can your iPhone's IMEI number by going to Settings > General > About.  It is towards the bottom of the list.  Also check the phone number on that list too, because it will be the same one you enter on the form.  In my case, I was unlocking my wife's phone and it only worked if the IMEI and Phone Number's matched in the unlock request.  The email and password should match the account owner.
  3. Submit the form.
  4. Check your email and click on the enclosed link to confirm that you want to unlock your iPhone.
  5. After a period of time, in my case it took just a few minutes, you will receive another email from AT&T stating that the unlock request was received. The email means their records now have the IMEI number for that phone as being unlocked.  It also includes instructions for how to actually unlock the phone

Unlocking the iPhone

The process of actually making your phone recognize that it is unlocked.

  1. Take it back to the old school and fire up iTunes.
  2. Plug your iPhone into your computer.
  3. In iTunes go to the Summary page for the iPhone.
  4. Click the "Back Up Now" button to back the iPhone up to your computer.
    1. You may be prompted to transfer app purchases, which you probably want to do.
  5. After the back up completes, click the "Restore iPhone" button up near the top, not the "Restore Backup..." button. This will clear the contents of the iPhone and update the firmware if necessary.
  6. After the phone finishes the restore you should see a message on screen that says, "Congratulations your iPhone has been unlocked."
  7. Click the "Continue" button to set up the iPhone.
  8. At this point you can restore from the backup you just saved.
Now your iPhone should be unlocked and you can insert the SIM card from another carrier and successfully make calls.

Friday, January 24, 2014

My Photo Management History

Floppy Disks

I bought my first digital camera, the Sony Mavica FD-83 back in 1999.  It is laughable now, but this little guy used 3.5" floppy disks, which at maximum image quality would hold 4-6 photos.  At the time it was cutting edge and it really kicked off my love of taking photos. 14 years and almost 50,000 photos later and I have saved practically every single photo I have taken.  Fortunately the specs on my cameras is dramatically improved these days with my iPhone 5 taking photos that wouldn't fit on five of those floppy disks and I can't even imagine how tall the stack of disks I would need for the RAW photos taken by my digital SLR.

Simple Beginnings

Initially managing all of these photos was easy, because I could only carry so many floppy disks around with me.  On my PC I simply created a folder called Pictures and within that folder was a folder with a date and some sort of clever name describing the subject of the photos. For example, 1999-08-07 Misc or 1999-08-08 Rockport Trip.  I even took it a step further and renamed each picture with the name of the people in the photo, which ended up being quite tedious. For example, KeegMike.jpg, KeegMike2.jpg, Keeg.jpg.  I carried on with this methodology for quite a while and it worked out pretty well.  It wasn't always easy to find certain pictures, but at least it was organized.

iLife

I bought my first MacBook in April of 2007, just a few months after my son was born, and immediately fell in love with iPhoto.  Its not that iPhoto was the best of the best out there, but it sure did beat trying to manage photos using Windows Explorer.  I quickly imported all of my photos into my iPhoto Library and at first things were great.  Evenings were spent making albums, photo books and reliving all my old photos again.  However, as time passed and the number of photos in the library grew, the performance of iPhoto started to suffer.  I did my research and found a great little program, iPhoto Library Manager, that would let me split my main library into several smaller libraries.  Logically it seemed best to break the photos up into equal sized libraries, which meant the older/smaller photos would end up containing several years of photos, while the newer/larger photos ended up being divided into individual years.  Once the libraries were separated order was restored to iPhoto and it was once again a joy to work with.

AAA Rating

At the end of 2007 I wanted to create a calendar with the best photos from the year, but after about an hour of trying to find the "best" photos I realized I needed to start using iPhoto's star rating system going forward.  The rating system in iPhoto is very simple, a photo can have between 0 stars (unrated) to 5 stars.  I decided to start small and for the first pass of photos to just use the first 3 stars:
  • 1 star - Bad quality, out of focus, bad lighting, crap, etc...
  • 2 stars - Good photo, worst out of group of similar photos, average
  • 3 stars - Great photos, would share with family or friends, best out of group of similar photos
Once I finished rating all of the pictures for the current year as a 1, 2 or 3, I created a Smart Album with the 3 star photos and culled a little deeper by setting the 4 and 5 star photos. 
  • 4 stars - 3 star photos that really stand out from the rest
  • 5 stars - The very best 3 star photos, with memorable moments or quality
Once I finished rating all of the photos it was much easier to create a calendar because I only had to look through 300 photos rated with 4 or more stars instead of 3,000 unrated photos. From that day forward I have continued a similar rating system every time I import any new photos.  I usually do the first pass 1-3 rating immediately and then once every couple months I will go through the 3 star photos and bump some of them up to 4 or 5.  I created a Smart Album called Unfinalized with two criteria: Rating >= 3 AND Date > {some date}.  Every time I finish going through this album I update {some date} to that date so I remember where I left off last time.

Places to Go

The rating system was working out really well and definitely made finding and sharing good pictures much easier.  I then started wondering if I should take advantage of other iPhoto metadata to make it easier in the future.  So I went back and added both Places and Faces for all of my newly imported photos.  The places part was pretty easy, but the Faces was a real pain in the ass, because there weren't any good keyboard shortcuts and if you had a picture of people in a crowd it would ask you to tag all of the people.  However, once I got the hang of it, having that extra metadata on the photos was huge.

Smart Filters
Now that all the photos were rated, tagged and located, it was really easy to set up a system for processing them after each import.  I created a few Smart albums, that I would go through after each import to make sure I was up to date.

  • Unrated shows all photos with no rating
  • Unplaced shows all photos without a place set on them
  • Unfinalized shows all photos with a 3 rating or better after a specific date.  These are the photos that haven't been given the 4 or 5 start test.  Once I finish going through these I update the date portion of the filter to the current date until next time.
Next time I will talk about my move to Aperture and some adjustments it caused me to make in my rating system....