Wednesday, November 20, 2013

Salesforce Apex: An unexpected error occurred

I got this when I defined a for loop as follows:

for (i=0; i<collection.size(); i++)

The fix is to correct the definition as follows:

for (integer i=0; i<collection.size(); i++)

Saturday, November 16, 2013

Epson Status Monitor disappears after installing Windows 8.1

Problem

After installing Windows 8.1, the Epson Status Monitor disappeared. Selecting Printer Preferences would bring up the unhelpful generic Windows info.

The Epson Status Monitor is a rather antiquated piece of software that is still used with the latest Stylus range of printers. Without it, you can't check ink levels or get detailed information about printer errors.



Solution


  1. Open Devices and Printers
  2. Right-click the printer and select Printer Properties
  3. Click the Change Properties button
  4. Select the Advanced Tab
  5. In the Driver dropdown, change the selection to use the correct driver. In my case, I had to switch from "Epson ESC/P Standard 3 V4 Class Driver" to "EPSON NX130 Series".


Friday, August 16, 2013

Disabling windows profile quota

Windows profile quota can be a real pain as it prevents you logging off until you have reduced your profile size. This can be incredibly inconvenient if you're in a hurry for something.

Go to the link below for some options to get around this problem.

http://realfixes.blogspot.com/2010/03/you-have-exceeded-your-profile-storage.html

Thursday, July 4, 2013

Salesforce Classic (Mobile) metadata not updating

Problem


App metadata is out of date and won't update, even if a full Refresh All Data update is done

Possible Cause


Subtle data corruption

Resolution


Perform an erase and reload as per instructions in KB5282

This KB describes serious corruption, but my experience is that the steps described solve this problem even if there is no visibly corrupted data.

Tuesday, June 25, 2013

Eclipse's Navigate | Open Resource menu option missing

The Eclipse "Open Resource" dialog is great but I tend to forget the keyboard shortcut (Ctrl-Shift-R), and I rely on the existence of the Open Resource menu option to remind me. However this menu option is often missing from my current project perspective.

These are the steps to add the Open Resource menu option to the current perspective:
  1. Window | Customize Perspective...
  2. Command Group Availability tab - check "Resource Navigation"
  3. Menu Visibility tab - check "Open Resource..." if it's not already checked
  4. OK

Tuesday, June 18, 2013

Salesforce "invalid query locator" error

Symptom


Inline apex soql query returns "QueryException: invalid query locator" error. However executing the soql directly does not present this error.

A Possible Cause


Apex appears to have a limit on the number of child records that can be returned from a soql query. At time of writing this limit is 999 records. AFAIK this limit is undocumented.

Solution


Separate any subqueries out into one or more separate queries.

Example


The following apex returns one myParent record and all associated child records for the myChild1, myChild2 & myChild3 objects.

myParent__c p=[select id, (select id from myChild1__r), (select id from myChild2__r), (select id from myChild3__r) from myParent__c limit 1];

If the total number of child records >= 1000 then you will get the "invalid query locator" error.

Let's say myChild3__c has a large number of records. Then the solution would be as follows:

myParent__c p=[select id, (select id from myChild1__r), (select id from myChild2__r) from myParent__c limit 1];


myChild3__c[] c3s=[select id from myChild3__c where myParent__c=:myParent__c.Id];

Tuesday, May 14, 2013

Salesforce Summer 13 - things I've noticed

Automated Apex Test Execution

The code at http://developer.force.com/cookbook/recipe/automated-unit-test-execution now produces different results.

In my case, the number of results has nearly tripled. Interestingly, the number of failed tests increased. This code shouldn't have excluded any failed tests, so it seems to me that there is a bug fix in Summer 13 for the ApexTestResult object. This means the outputs of this code prior to Summer 13 probably aren't trustworthy.

Developer Console - now slower than ever

I have to work with older versions of IE a lot (don't get me started). Prior to Summer 13, Developer Console was pretty slow but usable. Now I get a lot of hanging and the slow script dialog.

Sunday, April 28, 2013

Fixing Wi-fi on HP laptop after upgrading to Windows 8

Symptoms

Charms | Settings | Network displays "Wi-Fi (Off)" with no option to turn it on

Charms | Settings | Change PC Settings | Wireless displays Wi-Fi as off and greyed so unable to turn on

Start | Type "View Network Connections" | Select Settings | Select View Network Connections displays   the Wi-Fi adapter as being "Not connected" with a Red X symbol



What worked for me

After spending ages updating software, reinstalling drivers and generally mucking around, the following finally worked for me.

Restart, press F10 to get to BIOS and reset all settings to System Defaults.

For me it's the menu on the far right. Don't forget to save the settings.

What's the cause?

Airplane mode as introduced in Windows 8 appears to screw up the ability to control Wi-Fi via the hardware button. Luckily it fixes itself when the BIOS is reset.

Wednesday, April 10, 2013

Profile unavailable in Force.com Class/Page security

Problem: when you try to add a profile to class/page security, the profile isn't available
Cause: the profile already has access to the class or page. Job already done!

Thursday, April 4, 2013

Force.com IDE - report deployment

Problem

Deploying reports using Save to Server in Eclipse appears to work ok, but the report is not updated.

Solution


Use Deploy to Server instead. This will report deployment errors, whereas Save to Server doesn't.

It appears they use different logic behind the scenes!

Sunday, March 31, 2013

Missing templates and other stuff from Visual Studio 2012?

You probably installed it as non-administrator. Rerun the installation as administrator, and repair.

Friday, February 1, 2013

Force.com IDE connect timeout

Symptom

Using the Eclipse Force.com IDE and unable to connect to Salesforce with error message "connect: timeout"

Possible Cause

Very out of date Force.com IDE

I discovered this problem when attempting to use Eclipse on a PC that had not been used for this purpose for over a year.

There have been two recent required Force.com IDE project updates - Spring 12 and Winter 13.

It appears that if a project is out of date by more than one required update then a project update dialog won't appear prompting the user to update their projects. This results in error messages when trying to connect to Salesforce because the projects are out of date.

Resolution

Update the Force.com IDE (Help | Check for Updates, then follow instructions).

Once the Force.com IDE has been updated, the user will then be prompted to update projects to Winter 13, after which this error should go away.