Stat Tracker

Thursday, May 26, 2011

Used Location Services Icon in iPhone Settings

So I had to go to the Apple store last night to replace my broken iPhone. The microphone for calls wasn't working, so they replaced it with a new one. As any good techie would do, I go straight home and restore from a backup. After restoring the backup, some settings still need to be tweaked so I go into the settings app and start tweaking, and I noticed something new. Or at least something I hadn't noticed before.

When you go into Settings > Location Services, it will show you the list of applications which are enabled for Location Services. I have seen that before. But for the first time I noticed that if you used one of those apps in the last 24 hours, it will show a little cursor icon next to the service to indicate the app has used it recently.

Kinda neat eh? I don't know if this is a new feature since the whole privacy debacle a few back and the 4.3.3 update released it or if its always been there, but kinda neat.

Tuesday, May 24, 2011

Passing the Advanced Developer Exam

Update 12/8/2011: I recently completed the Assignment and Essay portions of the process and am happy to report that I passed! I am now a Certified Advanced Developer.

Yesterday I passed the Advanced Developer Exam! There are 2 additional stages to this certification which I have not completed yet. There is a programming assignment and a essay assignment, both of which I am waiting for Salesforce to notify me when the next session is. That being said, the exam portion is pretty tough. If you don't have at least 6 months experience hands on with Apex and Visualforce I wouldn't recommend taking it.

The format is similar to the Developer exam which is a prerequisite before you can take the advanced exam. There are multiple choice questions which also have the tricky "Select 2" or "Select 3" type questions. So the format is nothing new. What is new is the questions. The exam took me 48 minutes, but your allotted 2 hours.

There are lots of questions on Visualforce, Apex, and SOQL. So you need to be very familiar with them. For example, there are questions which will present you a SOQL query and ask you what will result from the code. Another question provided a Visualforce Page and an Apex Class, then asked if it could be used as a Standard Controller, Extension, ETC. So you need to have built lots of different Visualforce Pages and Apex Classes to pass the exam.

Another important piece that is covered in multiple questions is Visualforce Templates and Visualforce Components. You need to know how to use Visualforce Components, especially how to pass variables from a Visualforce Page to a Visualforce Component. There were 3 questions just on Visualforce Components, how to build them, how to pass variables to them, and what type of variables they can accept.

Unit Testing questions are also on the exam. Make sure you know how to write GOOD unit tests. Don't presume test data will be available in your instance for example. Also remember that a Unit Test NEVER commits data to the database. They try to catch you a few times with that asking if at the end of unit test the data is committed.

There are 3 or 4 questions specific to Salesforce environments. You need to know what environments to use for different use cases. For example, Developer Edition should be used for building stand alone managed packages. They will ask you to match up multiple environemnts to the proper use case so be familiar with all the different types and their proper use cases.

There was a few questions around Email Services also. How do you build one and how do you test one will be covered so make sure you've built and deployed a few Email Services to different environments.

There are quite a few tools and deployment questions on the exam. Make sure you know how to deploy changes using the IDE, Migration Tool, and Change Sets. You need to know how to make destructive changes and how the xml files are structured for the Migration Tool. You also need to know all the concepts around how packages and what environments they can be built in.

My best advice is to go through the Developer Guide which can be found here: The guide is a good primer on both the Developer Exam (First 7 chapters only) and the Advanced Developer Exam (Chapters 8 through 15). For the advanced developer exam, if you have experience with, and you review chapters 8 through 15 you will have a good chance at passing the exam.

I'd also reference Jeff Douglas's blog post about the exam. He has some other items that I may have missed above.

Good Luck!

Monday, May 23, 2011

Chicago Bus Radar Demo Video and Updates

I uploaded a demonstration video of a recent release of Chicago Bus Radar.

The demonstration video shows how the application works on both a Desktop and iPad/iPhone.

You can view the demonstration here:

On another note last night I updated the application to show a search radius box and auto-zoom based on the search radius selected. This update allows you to see visibly what the search radius was. Because this application is using a bounding box search pattern, it is a square and not a circle. You can see the latest screenshot below.

The next update I'm mulling is adding click events to the bus's in the data table. This would allow you to click on one of the bus times in the data grid, and on the integrated Google Map the marker would popup information or become highlighted so you can see exactly which stop it is.

Anyway, thanks for reading and please feel free to provide me some feedback on the application via this blog's comments or my twitter feed (@corycowgill).

Note: I introduced a bug if your in a location with 0 buses. The Google Map won't initialize properly and won't display. I'm targeting a fix for tonight 5/23/2011.  Thanks @shobyabdi for finding the bug!

Monday, May 16, 2011

Setting the Email Bounced Alert in Salesforce Via Apex / API

Salesforce has a pretty nice feature called "Bounced Email Alerts" which can be configured using the declaritive setup menu in Salesforce. This allows emails which were bounced when being sent via Salesforce to popup alerts on the Email address field in the standard pages. It's pretty useful, especially if your sending emails via Salesforce.

Take a look at the email alert and prompt below for what it looks like.

And if a user clicks on the alert it gives them some details:

But many users have other 3rd party systems which sends the email. So the question is how do I get the "Bounced Email Alerts" in Salesforce if I'm using another system to send the emails?

The answer is you can use Apex code. It actually very simple but not documented anywhere that I saw. There are two fields on the Contact object which trigger the Email Bounce Alert functionality. They are EmailBouncedDate and EmailBounceReason. If you populate these two fields on a Contact record, the Email Bounce Alert functionality will fire. And vice versa, if you null out those two fields the alerts go away.

These fields are only visible in Apex code. You can't create a workflow rule / field update to do this unfortunately. Luckily, the Apex code is pretty simple. For example, below I added a boolean flag to Contact call "Invalid Email". Whenever I update this field, be it from the UI or a Web Service call from a 3rd party email system, the Bounce Alert functionality fires.

Sample Code to set the Email Bounced Alerts in Apex:

trigger ContactTrigger on Contact (after delete, after insert, after undelete,
after update, before delete, before insert, before update)
        for(Contact contact :
            if(contact.EmailBouncedDate == null && contact.EmailBouncedReason == null && contact.Invalid_Email__c == true)
                contact.EmailBouncedDate =;
                contact.EmailBouncedReason = 'Invalid Email Address Set By User';
            if(contact.Invalid_Email__c == false)
                contact.EmailBouncedDate = null;
                contact.EmailBouncedReason = null;

In conclusion, if you have a 3rd party email system with Salesforce but still want to use the Bounced Email Alert functionality, you can do it if you have Enterprise or Unlimited Editions' of Salesforce.

Monday, May 2, 2011

Chicago Bus Radar - Builing a HTML 5 Application with Geo Location and Third Party API's

Chicago Bus Radar

For the past few weeks during my spare time I've been doing some work with the CTA (Chicago Transit Authority) API. For those who don't live in Chicago, the CTA manages all of Chicago's bus's and trains. About two years ago they upgraded all their bus's with a pretty sweet GPS system, as well as a Website for getting estimated arrival times ( Literally this was life changing for me when it was released. I rely exclusively on CTA for my transportation since I live in the city, and the ability to see bus times in real-time has saved me so much time.

My only problem with the default CTA Website is that its dumb when it comes to being location-aware. If I want to get the bus time for a stop I'm at, I have to either bookmark the exact bus stop into my browser on my iPhone, or I have to text message the CTA with the Stop ID.

The other problem I have is that its not very good for doing comparative analysis of bus stops. For example, I live in between two different sets of bus stops.  Both of these have routes which go downtown. Based on which bus arrives at a stop first, I can take either one to get downtown where I need to go. But I don't have a way to see one view of both the bus stops in the default CTA application.

Fortunately for me, the CTA released an API so that anyone who want to can access all the bus arrival time information. I just had to sign up and the CTA granted me API access. With the API Access I was able to quickly build an application which could do this. It is located at If you don't live in Chicago you won't get any buses naturally, so you can take a look at the screenshot below.

A few of the highlights:

1. HTML 5 GeoLocation functionality for cross platform compliance (iPhone, Android, etc)
2. is the platform which runs the application database and web pages, controller code, etc.
3. CTA API HTTP calls to retrieve the bus estimate arrival times from CTA System.

I'm still working on tweaking it some more, but right now its got 3,000 stops in the system which is about 1/4 of all the routes in Chicago. I still need to cache the rest of the Route's, as well as build an HTML 5 Manifest file for some nice icons on iPhone / Android devices.

I also need to add some filtering capabilities, differentiate colors on the Google Map, and a few more UI tweaks. But the major pieces are all in place at least.

Eventually I'll be posting the code sample somewhere, so if your interested in using to build HTML5 / Geo-Location based application you'll be able to pull the code as a reference.

Stay tuned, and peace out!