Yet another blog
Category Archives: Uncategorized
I had a scenario where i have a VF page which saves records into a custom object. And i was having the controller code in a try catch block to capture the exceptions and was using the getmessage to display the error messages.
But this all the time spit out a lot of ugly stuff along with the error message
” Upsert Failed : First exception on row 0: first error;
FIELD_CUSTOM_VALIDATION_EXCEPTION Quantity cannot be empty
All i wanted to show was that Quantity cannot be empty. thats exactly what the end user only wanted to know and all that crap of Upsert failed doesnt make any sense at all.
I had thought of capturing the error message in a string and split it with FIELD_CUSTOM_VALIDATION_EXCEPTION. then displaying the second item in the list to show the error message.
All this seem to be too complicated for this. Indeed there is something very simple to do this.
All you got to do is to add
in your VF page. this will capture all your validation errors and diplay it.
If you are getting this error on trying to install any application
error 14007:The requested lookup key was not found in any active activation context
To sort this problem out you just need to run these 2 commands
Hope this helps all those who encountered this problem
XML Sitemap Generator for WordPress is a wonderful sitemap generator for wordpress platform. In one of sites when i posted the sitemap in google webmaster, i got an error saying
Paths don’t match
We’ve detected that you submitted your Sitemap using a URL path that includes the www prefix (for instance, http://www.example.com/sitemap.xml). However, the URLs listed inside your Sitemap don’t use the www prefix (for instance, http://example.com/myfile.htm).
This really was annoying coz, the blog was part of another site which is not on wordpress but the sitemap generated had www prefixed and google had index over 700 pages of it. I was sure there was something in the settings that would make it add www.
Here is how i sorted it out
- Login to admin terminal (www.sitename.com/blog/wp-admin)
- click on settings on the menu on the left.
- Click on general
- Change the WordPress address (URL) and Blog address (URL) to include www
- Save changes
This should create the sitemap to include www prefixed to the url.
Dont forget to manually rebuild the sitemap
Click on xml-sitemap under settings
Click on rebuild the sitemap link to manually rebuild the sitemap
If you changed something on your server or blog, you should rebuild the sitemap manually.
Verify if your sitemap now has www prefixed.
Hope this helps
Dont forget to post your comments
If you were to change your website to a new domain or changed the location of an existing file, and you have your url indexed by search engines. If the pages are redirected you could end up loosing a lot of traffic by users getting the 404 error.
This method is search engine friendly and is the easiest way around.
Just add the following code to your .htaccess file placed in your old site.
Redirect 301 /olddirectory/oldfile.html http://yoursite.com/newdirectory/newfile.html
redirect 301 (the instruction that the page has moved)
/old/old.htm (the original folder path and file name)
http://www.yoursite.com/newdirectory/newdirectory/newfile.html (new path and file name)
Test immediately after implementing 301 redirects. If you find anything wrong, remove the redirect immediately.
Replace () is used to replaces all occurrences of a specified string value with another string value.
REPLACE ( string_expression , string_pattern , string_replacement )
Where string_expression is the string to be searched , string_pattern is the substring that needs to be searched and string_replacement is the string which will replace the string_pattern
The output would be godwasgreat. It searched for the string “is” within the string “godisgreat” and replaced the occurance of “is” with “was”.
The output would be godwasgreatwas.