<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4061740313877866897</id><updated>2012-01-25T17:20:55.636+11:00</updated><category term='apex'/><category term='Offline'/><category term='javascript'/><category term='debugging'/><category term='stack exchange'/><category term='quirks'/><category term='bug'/><category term='501'/><category term='Chatter Desktop'/><category term='Boids Screensaver'/><category term='field sets'/><category term='salesforce'/><category term='Tutorials'/><category term='stack overflow'/><category term='HTML 5'/><category term='aggregate functions'/><category term='C++'/><category term='batch apex'/><category term='lookup relationships'/><category term='social enterprise'/><category term='css'/><category term='401'/><category term='About Me'/><category term='google charts'/><category term='eclipse'/><category term='Chatter'/><category term='timezones'/><category term='test methods'/><category term='rerender'/><category term='Coding'/><category term='Manifest File'/><category term='soql'/><category term='pdf generation'/><category term='301'/><category term='java'/><category term='Mandelbrot Set'/><category term='deployment'/><category term='Adobe AIR'/><category term='screensaver'/><category term='Advanced Administrator'/><category term='Haikuware'/><category term='visualforce'/><category term='201'/><category term='haiku'/><category term='Maths'/><category term='certification'/><category term='Movember'/><category term='mac'/><category term='HTML'/><category term='Buddhabrot'/><title type='text'>Force.com Development Tips &amp; Other Snippetsby Matt Lacey</title><subtitle type='html'>Hints and tips for Salesforce Apex and VisualForce developers, targeted at helping resolve niggling problems as opposed to teaching the basics.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.laceysnr.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>50</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-4421452693287842744</id><published>2012-01-17T10:00:00.000+11:00</published><updated>2012-01-17T10:00:04.313+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='301'/><category scheme='http://www.blogger.com/atom/ns#' term='certification'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><category scheme='http://www.blogger.com/atom/ns#' term='201'/><category scheme='http://www.blogger.com/atom/ns#' term='Advanced Administrator'/><title type='text'>Three Oh One: Advanced Administrator Thoughts</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;Last Friday afternoon I undertook the Salesforce Advanced Administrator Certification exam (a.k.a. the 301) — I was reasonably comfortable going in, though did wonder what boundaries of my knowledge it would push. Having done other exams in the last two months, I'm very much in the mind set required and that's a definite help, this exam took me the least time of all those I've tackled so far.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Advanced Administrator builds on top of the Certified Administrator exam, testing in finer detail your knowledge of things like platform security, and how features related to that work, for example the Role Hierarchy. What surprised me about this exam was that involved a reasonable number of questions regarding the force.com platform, for instance, what components may or not belong to the platform and what Visualforce does and doesn't offer. Clearly the thinking here is that an Administrator should know what development-heavy customisations to the platform involve and impact, even if they can not create and maintain those customisations themselves, but it surprised me mainly because there seemed to be more questions on such topics in this exam than there were in the Certified Developer (401) exam.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;It's hard to offer any other advice other then the comments I've made, you simply need to know the areas outlined in the study guide. One thing I do in the exam (which doesn't help you pass but does let you get some idea of how you may have done) is to use the scratch paper to create 3 columns, one labelled with a tick, one with "?" and the last with "??!". I then write down a tally mark for each question, the first column are those I know I've got right (or I'm at least &amp;nbsp;99% sure and would be surprised if I had wrong), the second those I'm pretty sure I've got right but I'm not entirely confident, and then the last column is for those where I genuinely have no idea (luckily these are rare, I think I had 2 in this exam). For all the questions in the latter two columns, I check the box saying "mark for review" and those are the ones I pay special attention to on my second pass through. This time, just before I hit submit I worked out that 72% of the questions were in my first column, and I think 24% were in the second so unless I was wildly out (and I'm pretty strict with myself!) I stood a good chance of passing. Like I said, this doesn't increase your chances, but does give you a rough idea of how well you might have done.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Remember, always read the questions carefully (there sometimes something in the question which will tell you the correct answer), and think about what answer may entail before reading the options presented: there's nearly always something designed to make you second guess yourself and it pays to have already considered what the correct answer(s) will be.&lt;br /&gt;&lt;br /&gt;Lastly, too all of those taking the exams, good luck!&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-4421452693287842744?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/4421452693287842744/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2012/01/three-oh-one-advanced-administrator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4421452693287842744'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4421452693287842744'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2012/01/three-oh-one-advanced-administrator.html' title='Three Oh One: Advanced Administrator Thoughts'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-332205856563394550</id><published>2012-01-06T19:07:00.000+11:00</published><updated>2012-01-25T10:23:47.093+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='stack exchange'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='stack overflow'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><title type='text'>Salesforce Stack Exchange Proposal</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;&lt;a href="http://area51.stackexchange.com/proposals/37589/salesforce"&gt;I've just created a proposal over at area51.stackexchange.com to create a Salesforce stack exchange site&lt;/a&gt;, targetted at both developers and administrators who work with the force.com platform. I also started a discussion to explain my reasoning, which I'm including here too to help get some more exposure for it.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Salesforce, and Force.com in general, are attracting increasing numbers of users all the time, and therefore more and more administrators and developers are cutting their teeth on the platform, adding to the numbers who have been using it for many years already.&amp;nbsp;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Due to the nature of the platform, development can range from configuration (declarative development) which requires no code to be written, through to custom&amp;nbsp;web services, pages, object-oriented code and database triggers.&amp;nbsp;Nearly all complex solutions require a mixture of the two styles, and even working out where the line between can be part of the challenge. Because of the two distinct areas of development I believe a salesforce exchange site would be beneficial for many people because the questions don't really fit in at &lt;a href="http://stackoverflow.com/"&gt;stackoverflow.com&lt;/a&gt; every time.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;For instance, today I answered this question:&lt;/div&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;div style="text-align: justify;"&gt;&lt;a href="http://stackoverflow.com/questions/8754706/regarding-not-logged-in-user-in-customer-portal-site/8754742#8754742"&gt;I have a requirement to get the list of users who have not login in customer portal site at all.&lt;br /&gt;Any Suggesstions..??&lt;/a&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;This could relate to code, but if the requirement is just that a report is needed then no code is needed, making it a bad fit for the site but not leaving the asker anywhere sensible to turn. Personally I find the stack exchange format easier to deal with than regular forums, they're cleaner, neater and generally make it much easier to find the information you need. Ryan Huff (who already responded on Twitter) agrees:&lt;/div&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;a href="https://twitter.com/cirruscg/status/155193892222930945" target="_blank"&gt;cirruscg: @LaceySnr I like it. I like the stack format better than the dev forums. #salesforce #askforce&lt;/a&gt;&lt;/blockquote&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;So &lt;a href="http://area51.stackexchange.com/proposals/37589/salesforce" target="_blank"&gt;please lend a little support&lt;/a&gt;, and let's see if we can get this thing live!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://area51.stackexchange.com/proposals/37589/salesforce?referrer=4-k5FqV679TWbBGLxdLUKg2" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="Stack Exchange Q&amp;amp;A site proposal: Salesforce" src="http://area51.stackexchange.com/ads/proposal/37589.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-332205856563394550?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/332205856563394550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2012/01/salesforce-stack-exhcange-proposal.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/332205856563394550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/332205856563394550'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2012/01/salesforce-stack-exhcange-proposal.html' title='Salesforce Stack Exchange Proposal'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-2627446529469568830</id><published>2012-01-05T13:30:00.000+11:00</published><updated>2012-01-08T16:52:03.483+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='haiku'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='social enterprise'/><category scheme='http://www.blogger.com/atom/ns#' term='About Me'/><title type='text'>Some Of My Thoughts For The New Year: Some Warm Fuzzies</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;Yesterday I had the pleasure of meeting &lt;a href="http://www.twitter.com/bachovski" target="_blank"&gt;@bachovski&lt;/a&gt;&amp;nbsp;over lunch, and naturally, both of us being &lt;a href="http://force.com/"&gt;force.com&lt;/a&gt; developers, our discussions revolved heavily around the platform; what particularly&amp;nbsp;intrigued me was that our opinions of the platform, and developing for it, were very similar.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;My programming adventures started when I was around 5 years old, writing procedures in &lt;a href="http://en.wikipedia.org/wiki/Atari_LOGO" target="_blank"&gt;Atari&amp;nbsp;LOGO&lt;/a&gt;&amp;nbsp;on my father's Atari 800 and I was instantly hooked. My dad was a programmer for a considerable part of his career (in the mystical era of punch cards which still holds a particular fascination for me) and he then started teaching me to use BASIC on the Atari 1024 STE*. From there it was a natural progression through QBASIC, VisualBasic and onwards. Shortly prior to attending university I began to teach myself C++, and while there I continued this along side the JAVA lectures that formed part of our syllabus. Once I started working in the real world™ I found myself using C, and today I'll still tell you that it's my favourite language - I particularly enjoy the simultaneous simplicity and power it offers the developer (as well as the ease which with you can shoot yourself in the foot of course).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;If you ask me these days what my favourite platform is, then the simple answer is that it is force.com. Developing in the cloud is worlds apart from developing for small handheld devices, it still amuses me to think of the difference between the two areas I've worked (and do) work in. When I&amp;nbsp;initially&amp;nbsp;started working on the platform it was as a contractor, and specifically I wanted to be on a contract because I wasn't sure of what I wanted to do, but over two years down the line I'm still here and enjoying it more than ever. It may sound surprising (coming from a developer at least) but it's actually refreshing to be able to do a good proportion of work without a single line of code. Not having to worry about servers, database setup or even maintenance are just the icing (frosting for some of you!) on the cake, and we're talking about some thick icing here. Being a true cloud platform means the speed of development is unrivalled, you can spin up a new developer edition org in a matter of seconds and have a prototype cut in no time — and this is one of the many things Boris and I discussed. Once you've learned the specifics regarding apex and Visualforce (and that's not hard) then it all just flows naturally, and it all just works.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;The current focus on the social enterprise is a breath of fresh air, and although he has his detractors, &lt;a href="http://en.wikipedia.org/wiki/Marc_Benioff" target="_blank"&gt;Marc Benioff&lt;/a&gt; is likely the leading visionary in the tech industry at this time; Salesforce is forging a path in a new direction, and the frontier is advanced with each new release which makes for a very exciting ride. Sure, it probably sounds like I've drunk the kool aid, but I'm genuinely enjoying what I do and the technology I work with (with the possible exception of using Eclipse, because as far as I'm concerned JAVA is not &amp;nbsp;the right choice for any desktop application).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;2012 is shaping up to be a very interesting year in many respects from my point of view:&amp;nbsp;&lt;a href="http://haiku-os.org/" target="_blank"&gt;Haiku&lt;/a&gt; is marching ever onwards and can only benefit from the shift to the SaaS model, The &lt;a href="http://www.raspberrypi.org/" target="_blank"&gt;Raspberry Pi&lt;/a&gt; looks promising as a means of bringing computer science back into the class room (I can't wait to get a couple of boards), and the power of the community is getting ever stronger thanks to sites such as &lt;a href="http://www.stackoverflow.com/" target="_blank"&gt;stackoverflow&lt;/a&gt;&amp;nbsp;and its sisters. Particularly close to my heart is the local games development community, the Australian talent has endured some heavy blows in recent years but they're fighting back with vigour. Highly-skilled,&amp;nbsp;independent&amp;nbsp;studios are springing up &lt;a href="http://pachinkopictures.com/" target="_blank"&gt;left&lt;/a&gt;, &lt;a href="http://www.electricmammoth.com/" target="_blank"&gt;right&lt;/a&gt; and &lt;a href="http://www.playsidestudios.com/" target="_blank"&gt;centre&lt;/a&gt; alongside some of the &lt;a href="http://www.thevoxelagents.com/" target="_blank"&gt;more&lt;/a&gt; &lt;a href="http://tinmangames.com.au/blog/" target="_blank"&gt;established&lt;/a&gt; companies, and with both &lt;a href="http://igdamelbourne.org/" target="_blank"&gt;IGDAM&lt;/a&gt; and the &lt;a href="http://gdaa.com.au/" target="_blank"&gt;GDAA&lt;/a&gt; watching out for them I hope they all enjoy a&amp;nbsp;prosperous and successful year.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;i&gt;*I still hold a strong fondness for Atari (the original company) and those two machines in particular; they're both fully functional and I still love to get lost in Star Raiders on the rare occasions I am at my parent's house. If you've never played it, you should.&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-2627446529469568830?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/2627446529469568830/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2012/01/some-of-my-thoughts-for-new-year-some.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2627446529469568830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2627446529469568830'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2012/01/some-of-my-thoughts-for-new-year-some.html' title='Some Of My Thoughts For The New Year: Some Warm Fuzzies'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-2474526977328126777</id><published>2012-01-03T15:11:00.000+11:00</published><updated>2012-01-03T15:18:05.377+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='quirks'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='lookup relationships'/><category scheme='http://www.blogger.com/atom/ns#' term='debugging'/><title type='text'>Where'd My Value Go? Or: What the.....</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;I've just spent a few hours baffled, before the holiday break I could create events against a particular person account (setting the Related To field) without issue; today, every time I saved the event the field would end up blank. Yes there are triggers on event, but no, they were not the cause — I checked this by putting some debug statements in the first line of the trigger, when using this particular record as the target then &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;WhatId&lt;/span&gt;&amp;nbsp;(the API name for the field) would be &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;null&lt;/span&gt;.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Having checked everything I could think of (I'd even gone as far as to check the Setup Audit Trail but to no avail), I called my colleague, explained what was happening and he also drew a blank. While on the phone it dawned on me that I was using the suggested item from the recently used drop down list to populate the field, shown in the screen shot below.&lt;/div&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-8mwbW0o5t1M/TwJ9kCA2-QI/AAAAAAAAAj4/tGZatmGd_uI/s1600/Screen+shot+2012-01-03+at+14.58.21.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-8mwbW0o5t1M/TwJ9kCA2-QI/AAAAAAAAAj4/tGZatmGd_uI/s1600/Screen+shot+2012-01-03+at+14.58.21.png" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;The Recently Used Items Drop Down&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;On an impulse I decided to use that to auto-complete the name, but then clicked on our friend the magnifying glass to open the lookup window proper, and selected the matched account presented there. This time when I saved the record, it saved correctly! Thinking this might have updated some cache somewhere I subsequently tried to the drop down again, but still it failed me.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;I've not dug through the javascript to see how the auto-populate works, but at least for the div you click on (the blue highlighted box in the screenshot) there is no difference for a working entry as opposed to a non-working entry. Sounds like a job for the Salesforce Investigation Squad™*.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Conclusion: if choosing something from a drop down recently used items list doesn't work, try using the actual lookup, though I suspect this could easily be related to the fact that this field is somewhat special in that it can lookup to objects of different types. It's the first time I've ever come across this problem, and it wouldn't surprise me if it was also the last, but if this helps anybody then it was worth me writing it up.&lt;/div&gt;&lt;br /&gt;&lt;i&gt;* I might have just made this team up, but it has a nice ring to it.&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-2474526977328126777?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/2474526977328126777/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2012/01/whered-my-value-go-or-what.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2474526977328126777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2474526977328126777'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2012/01/whered-my-value-go-or-what.html' title='Where&apos;d My Value Go? Or: What the.....'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-8mwbW0o5t1M/TwJ9kCA2-QI/AAAAAAAAAj4/tGZatmGd_uI/s72-c/Screen+shot+2012-01-03+at+14.58.21.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-1714527726151875479</id><published>2012-01-03T13:45:00.000+11:00</published><updated>2012-01-03T13:45:02.563+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='501'/><category scheme='http://www.blogger.com/atom/ns#' term='certification'/><title type='text'>Coping With Demand: 501 Certification Assignment Registration Update</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;Quick post to share the good news. As many people will undoubtedly know, the registration window for the Advanced Developer Certification Assignment opened at the end of last month and filled up within a matter of hours. Obviously this is disappointing for those unable to obtain a place as they've have already invested in the Certification process by taking the&amp;nbsp;multiple-choice exam. I'm pleased to report that &lt;a href="http://www.linkedin.com/groupAnswers?viewQuestionAndAnswers=&amp;amp;discussionID=86216082&amp;amp;gid=151420&amp;amp;commentID=63110512&amp;amp;trk=view_disc&amp;amp;ut=377prbleJs6R41" target="_blank"&gt;Salesforce's Nina Marinova has just posted on LinkedIn to say that the next registration will open this month&lt;/a&gt;:&lt;/div&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;Due to high demand, we will open registration for the next programming assignment window on January 30th, 2012. Candidates who have successfully completed the Force.com Advanced Developer multiple- choice exam and are current on their Force.com Developer Winter ’12 release exam will be invited to register for the assignment window at that time.&lt;br /&gt;Assignments will be distributed in May 2012, and participating candidates will be given a month to submit their solutions. Candidates should plan to allocate a minimum of 20 hours to complete the assignment. Additional information will be available when we open registration.&lt;/blockquote&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;This is great news as many people raised concern when the places available filled so quickly — especially difficult if you live in a different time zone to the eastern coast of the US. So mark the date in your diaries, people, or better yet set a reminder for yourself in your Salesforce.com org!&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-1714527726151875479?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/1714527726151875479/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2012/01/coping-with-demand-501-certification.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/1714527726151875479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/1714527726151875479'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2012/01/coping-with-demand-501-certification.html' title='Coping With Demand: 501 Certification Assignment Registration Update'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-1027335929498633694</id><published>2011-12-16T14:25:00.001+11:00</published><updated>2011-12-22T17:24:34.312+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='soql'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><title type='text'>Keeping It Clean: Easy Conditional Where Clause</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;First things first, a disclaimer: this is clearly not the most efficient way of doing this in terms of the query execution, however, it is a nice way to keep your code neat and compact whilst negating the need for dynamic SOQL. Dynamic SOQL is a fantastic tool, but it's always a tad ugly and I always seem to forget to query a field, which of course, the compiler can't warn you about.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;So say you want to add a conditional to your where clause, but in some circumstances you won't want to use it — for instance if you specify &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;null&lt;/span&gt; then you don't care whether a field matches your condition, you want the records regardless. A nice easy way to do this, is to simply use a ternary and making use of SOQL's &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;LIKE&lt;/span&gt; keyword. Of course, we're talking about text fields and string filters.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Instead of having two queries in your code (one with the filter, one without) and instead of having to build dynamic SOQL, you can just do something like this:&lt;/div&gt;&lt;br /&gt;&lt;div class="p1"&gt;&lt;blockquote class="tr_bq"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="s1"&gt;... AND&lt;/span&gt;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;SomeField&amp;nbsp;&lt;span class="s1"&gt;like&lt;/span&gt; : (strSomeFilter == &lt;span class="s2"&gt;''&lt;/span&gt; ? &lt;span class="s2"&gt;'%%'&lt;/span&gt; : strSomeFilter)&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Simple, clean, and&amp;nbsp;(in this programmer's opinion at least)&amp;nbsp;effective. Some people have their own preferences in these scenarios, and I'm always of the opinion that there are many valid solutions to a problem. Leave a comment if you do have a strong opinion on this method, or if you have a technique for doing something similar, let's share the brain wealth!&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-1027335929498633694?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/1027335929498633694/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/12/keeping-it-clean-easy-conditional-where.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/1027335929498633694'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/1027335929498633694'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/12/keeping-it-clean-easy-conditional-where.html' title='Keeping It Clean: Easy Conditional Where Clause'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-4532267391785258702</id><published>2011-12-16T11:22:00.002+11:00</published><updated>2011-12-20T10:44:35.169+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rerender'/><category scheme='http://www.blogger.com/atom/ns#' term='quirks'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='bug'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Beware Bad Markup, When You Least Expect It!</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;Yesterday I deployed a very basic Visualforce page for a client, which I'd tested and worked fine in the sandbox. Once I'd finished deploying it I did the thing to do and I tested it again, only this time, the results were not so pretty: Something, somehow, was causing the re-rendered &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:outputPanel&amp;gt;&lt;/span&gt; to appear twice on the page, but only after I clicked an action button &lt;i&gt;a second time&lt;/i&gt;.&amp;nbsp;What's more, the reason I hadn't seen this originally is that I'd tested using Firefox in the sandbox, and then Chrome in production — on &amp;nbsp;whim I tried another WebKit based browser, Safari, and found the issue&amp;nbsp;occurred&amp;nbsp;there as well. Around this point it was pushing on for 7pm, and with nothing but three short words running through my head (the first started with our friend "W" for "WHAT") I decided that it was best left until morning, especially since the page wasn't yet available to anybody.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;This morning I registered a minty-fresh developer org, and set about reproducing the issue. Simply recreating the functionality didn't seem to do the trick, so I copied the Visualforce markup from the original page and then proceeded to strip it back until I had something very simple that still showed the problem, the entire page content is below.&lt;/div&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:page controller="LaceyController" showHeader="false" sidebar="false" cache="false" standardStylesheets="false"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;apex:form &amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:outputPanel id="thePanel"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;&amp;lt;apex:messages/&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:outputLabel for="theCheckBox" value="Toggle this...." /&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:inputCheckBox id="theCheckBox" selected="false" value="{!barryTheBool}" /&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:commandLink styleClass="button clear" action="{!FireInTheHole}" rerender="thePanel" value=" FIRE!"/&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:outputPanel&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/apex:form&amp;gt;&lt;br /&gt;&amp;lt;/apex:page&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;For the sake of completeness, this is the associated controller:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;public with sharing class LaceyController&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; public boolean barryTheBool {get; set;}&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; &amp;nbsp; public LaceyController()&lt;br /&gt;&amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; barryTheBool = false;&lt;br /&gt;&amp;nbsp; &amp;nbsp; }&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; &amp;nbsp; public Pagereference FireInTheHole()&lt;br /&gt;&amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Barry the bool is now ' + barryTheBool));&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return null;&lt;br /&gt;&amp;nbsp; &amp;nbsp; }&lt;br /&gt;}&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;And this series of screenshots show what the various stages of the 'bug' look like:&lt;br /&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Nwex8dJHOBY/TuqJC641blI/AAAAAAAAAjI/7FBtGG5NPp0/s1600/Screen+shot+2011-12-16+at+10.54.58.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="244" src="http://4.bp.blogspot.com/-Nwex8dJHOBY/TuqJC641blI/AAAAAAAAAjI/7FBtGG5NPp0/s320/Screen+shot+2011-12-16+at+10.54.58.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Fig 1. The initial state of the page&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-avaeA8rqxdI/TuqJDkXA-zI/AAAAAAAAAjM/jT-NdKqbilw/s1600/Screen+shot+2011-12-16+at+10.55.06.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="244" src="http://2.bp.blogspot.com/-avaeA8rqxdI/TuqJDkXA-zI/AAAAAAAAAjM/jT-NdKqbilw/s320/Screen+shot+2011-12-16+at+10.55.06.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Fig 2. The message displayed having checked the box and clicked the 'FIRE!' link&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Yhhml8BVLQs/TuqJEZ_c4yI/AAAAAAAAAjU/0Ncc5qJiNT8/s1600/Screen+shot+2011-12-16+at+10.55.19.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="244" src="http://4.bp.blogspot.com/-Yhhml8BVLQs/TuqJEZ_c4yI/AAAAAAAAAjU/0Ncc5qJiNT8/s320/Screen+shot+2011-12-16+at+10.55.19.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Fig 3. The view after clicking the 'FIRE!' link a second time&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-CsFeGKVzJhI/TuqJE7-fN5I/AAAAAAAAAjY/_dSTBYXHUU8/s1600/Screen+shot+2011-12-16+at+10.55.25.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="244" src="http://4.bp.blogspot.com/-CsFeGKVzJhI/TuqJE7-fN5I/AAAAAAAAAjY/_dSTBYXHUU8/s320/Screen+shot+2011-12-16+at+10.55.25.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Fig 4. The page after unchecking the second checkbox, and clicking the second 'FIRE!' link&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;As you can see, the behaviour is rather bizarre to say the least. The reason I've disabled the standard stylesheets is because the page is to be exposed via sites, and &lt;a href="https://funkytest-developer-edition.ap1.force.com/test" target="_blank"&gt;if you want to see this in action it's available right here&lt;/a&gt;. Through a quick trial and error process and making use of the earlier clue (i.e. this only happened on the second and subsequent re-renders) I deduced that reming the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&amp;nbsp;tags from around the &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:pageMessages/&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt; tag resolved the issue. Huh? Similarly, swapping &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:pageMessages/&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt; for &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:messages/&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt; also fixed the problem (in this case, since styling is not required the latter is the one to use, but I didn't author the original page). &amp;nbsp;Since the markup was clearly the cause of the problem, I took the generated source for the page and pasted into &lt;a href="http://validator.w3.org/check" target="_blank"&gt;w3.org's handy validator&lt;/a&gt;&amp;nbsp;which flagged a few errors and warnings, one of which (the seemingly important one in this scenario) is below.&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-8jcExnI0Lww/TuqLHKZ2HuI/AAAAAAAAAjo/hcnz7TM1icw/s1600/Screen+shot+2011-12-16+at+11.04.01.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-8jcExnI0Lww/TuqLHKZ2HuI/AAAAAAAAAjo/hcnz7TM1icw/s640/Screen+shot+2011-12-16+at+11.04.01.png" width="640" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Fig 5. Some of the output from w3.org's validator&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;A block-level element, the &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt; tags in this case, can not be contained in an inline element, and guess what? The &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:outputPanel&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt; by default is implemented via &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt; tags, and a &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt; is an inline element — mystery solved! Well, no, not really.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;The easy fixes here are to remove the paragraph element, specify&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;layout="block"&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&amp;nbsp;inside the &amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:outputPanel&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&amp;nbsp;opening tag,&amp;nbsp;&lt;/span&gt;or as mentioned,&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;just replace&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:pageMessages&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&amp;nbsp; with&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:messages&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;. The mystery still remains because the last option still has the paragraph tags, and they're still contained within the&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&amp;nbsp;from the&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:outputPanel&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;, so there's clearly something else at play here. However, the page now works and that's my immediate concern, so it's time to hang up my investigating hat for the day and carry on writing code.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;b&gt;Update (17/12/2011)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;An anonymous commenter has filled in the rest of the details, for the sake of those viewing this article on the main page (i.e. with comments hidden) I'm adding it here for completeness. Thank you to whoever you are!&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;To answer you question, and are two different implementations: the former renders &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:messages/&amp;gt;&lt;/span&gt; as ul/li elements and the latter a table of messages. In fact &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:pageMessages/&amp;gt;&lt;/span&gt;'s table is wrapped in a div. A div, when used inside a p tag, will actually close the p tag. So, what's happening here is that when the re-rendered response is applied to the DOM, the p tag is closed and everything after the message div is moved outside of the "thePanel" span. Subsequent re-render responses only replace the "thePanel" element which, again, doesn't contain the label and input element and the elements are applied to as mentioned. The label and input elements are re-added, not replaced.&lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-4532267391785258702?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/4532267391785258702/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/12/beware-bad-markup-when-you-least-expect.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4532267391785258702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4532267391785258702'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/12/beware-bad-markup-when-you-least-expect.html' title='Beware Bad Markup, When You Least Expect It!'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-Nwex8dJHOBY/TuqJC641blI/AAAAAAAAAjI/7FBtGG5NPp0/s72-c/Screen+shot+2011-12-16+at+10.54.58.png' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-2316618969334955081</id><published>2011-12-14T16:24:00.000+11:00</published><updated>2011-12-17T12:24:23.353+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='501'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='certification'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>Five Oh One Part One: The Advanced Developer Certification Exam</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;A few hours ago I sat down to take the first part of the Salesforce Advanced Developer Certification, that part being a multiple choice test in a similar style to those used for the Certified Administrator and Certified Developer tests — and here are a few of my thoughts pertaining to it.&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;/div&gt;&lt;ul style="text-align: left;"&gt;&lt;li style="text-align: justify;"&gt;For me (being a day to day developer) this was the easiest of the three exams I've passed so far, that said, you need to be a developer with force.com experience — being a C++ guru is not going to help you here. If you've just completed the Certified Developer exam and have never written code, &lt;i&gt;do not&lt;/i&gt; jump straight into this, you will fail, hard.&lt;/li&gt;&lt;/ul&gt;&lt;ul style="text-align: left;"&gt;&lt;li style="text-align: justify;"&gt;Make sure you understand the order of execution when records are being updated, i.e. when triggers fire in relation to workflows, assignment rules etc. and make sure you know what valid markup looks like for Visualforce pages, components and email templates.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;ul style="text-align: left;"&gt;&lt;li style="text-align: justify;"&gt;There are many best practices associated with working on the force.com platform, ranging from deployment techniques to working in a development team, many of these are detailed in the developer guide and you'd be wise to learn about them regardless of the exam.&lt;/li&gt;&lt;/ul&gt;&lt;ul style="text-align: left;"&gt;&lt;li style="text-align: justify;"&gt;Email services are tested, as are web-services, including when and where they can be used.&lt;/li&gt;&lt;/ul&gt;&lt;ul style="text-align: left;"&gt;&lt;li style="text-align: justify;"&gt;Learn about the various &lt;a href="http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_classes_annotation_isTest.htm|StartTopic=Content%2Fapex_classes_annotation_isTest.htm|SkinName=webhelp" target="_blank"&gt;Apex class annotations&lt;/a&gt;, you'll need to know what each of them does and what intricacies may relate to their usage.&lt;/li&gt;&lt;/ul&gt;&lt;ul style="text-align: left;"&gt;&lt;/ul&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;&lt;i&gt;Long story short: If you're an experience developer who's been working on the platform for a while and you have the Developer Certification under your belt, chances are you won't struggle here.&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;I'd still like feedback on what I got right and what I got wrong, though I have heard that you do get this upon completion of the full 501 course; in each of the exams I've sat so far there have been a couple of questions where I'd really like to know if I got them right.&amp;nbsp;Next up is the assignment portion of the certification, and I can't wait to get stuck in!&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;For more help on getting your head around what's involved, &lt;a href="http://limitexception.herod.net/?p=26" target="_blank"&gt;Steven Herod has just posted a blog article &lt;/a&gt;(only ten minutes ago) which details exercises you can do to put into practice much of the knowledge you'll need for the 501.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;Update&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;i&gt;It has been announced on Linkedin that registrations for the second part of the Advanced Developer Certification will open on the 21st of December, with the work being handed out to candidates towards the end of January 2012.&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-2316618969334955081?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/2316618969334955081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/12/five-oh-one-part-one-advanced-developer.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2316618969334955081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2316618969334955081'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/12/five-oh-one-part-one-advanced-developer.html' title='Five Oh One Part One: The Advanced Developer Certification Exam'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-2413020637763842808</id><published>2011-12-08T16:37:00.001+11:00</published><updated>2011-12-19T14:50:25.371+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='test methods'/><category scheme='http://www.blogger.com/atom/ns#' term='quirks'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><title type='text'>Previous load of class failed: What?</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;I've just been trying to load a Visualforce page, and every time I did I got the the error "&lt;span class="Apple-style-span"&gt;Previous load of class failed: xxx&lt;b&gt;"&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;. I tried my usual technique of inserting and removing a space in the page controller source so that Eclipse would let me save it again, but that didn't fix it. Then I tried 'Run All Tests' knowing that forces recompilation of everything, still no good.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Going back to looking at the code I noticed my one of my test methods was calling a method on the class with a parameter, when I'd actually just removed that particular overloaded version of the method; somehow this wasn't generating an error on save! I have no idea how or why, but by adding in another intentional error (I passed in two parameters) the compiler then started to report the first one. So if you get this issue but can't see why, write some invalid code in the controller in question and see if that turfs it up.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-2413020637763842808?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/2413020637763842808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/12/previous-load-of-class-failed-what.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2413020637763842808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2413020637763842808'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/12/previous-load-of-class-failed-what.html' title='Previous load of class failed: What?'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-1967376591462775770</id><published>2011-12-07T11:05:00.001+11:00</published><updated>2012-01-04T14:10:55.562+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='501'/><category scheme='http://www.blogger.com/atom/ns#' term='certification'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><category scheme='http://www.blogger.com/atom/ns#' term='401'/><category scheme='http://www.blogger.com/atom/ns#' term='201'/><title type='text'>Force.com Certification — My Experience So Far...</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;There is a group of us at Quattro who have been working almost exclusively on the Force.com platform for around two years now, though until recently none of us have even considered certification. Our reputation as a company would appears to be enough to win work, but we've decided to push on and actually test ourselves by going on something of a certification drive.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Personally, around three quarters of my work in the last two years has been direct development, i.e. writing Apex and Visualforce classes and pages, as well as performing integrations via webservices etc.. I've done a good share of consulting, system design and configuration too, but typically I've not had to do any full-on administration, so I figured the first stop on my tour through the land of certification should be tackling the Salesforce Certifed Administrator exam.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;I did do some reading on what was required by the exam, and found a few sources online for sample questions (&lt;a href="http://www.proprofs.com/quiz-school/search.php?search=salesforce+201" target="_blank"&gt;one good source is proprofs.com&lt;/a&gt;) to get an idea of the style of the questions — this in particular is key as the questions are written in a somewhat peculiar fashion.&amp;nbsp; They stop a little shy of being trick questions, but they do require very careful reading to deduce exactly what is being asked. I won't post any particular examples but on more than a few occasions I've read a 'choose two out of four answers' question, and thought that three (or even all four) of the options fit the bill. When this happens &lt;i&gt;read the question again&lt;/i&gt;; I guarantee there will a key word or phrase, which will immediately rule out two of the answers if you know your stuff.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Areas I specifically read up on were those where I knew I was lacking knowledge and for me the most of obvious of these was reports, doing so served me well — I passed the exam just over two weeks ago and was pretty pleased to know that I have picked up on various administration details and complexities to a sufficient degree while cutting code. If you know you're a little light on approval processes, or workflows, or any other area, it goes without saying that you should concentrate on those.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The next destination on the tour was to test the knowledge I've picked up of the declarative side of Force.com development, the world of "clicks not code". I &lt;i&gt;love&lt;/i&gt; writing code. I started coding well over twenty years ago which means I've been doing it for three quarters of my life so far, and I'm not about to stop any time soon despite actively working to expand my skills in developer coaching and management. The Force.com platform forces you to think differently though, and it's one of the reasons I love it — I've lost count of the number of times where my initial thought has been "I could do that in a trigger", before realising that a couple of formula fields will do the same job. This line in the sand is largely what the Certified Developer exam is about: any developer worth their salt could solve any problem they need to with code on the platform, but, quite rightly in my opinion, Salesforce want to ensure you also know &lt;i&gt;when not to write code&lt;/i&gt;. The takeaway from my rambling should be that just because you're an apex and Visualforce demon, don't expect that to be enough to pass this exam, in fact it's barely even relevant.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The biggest criticism I have of the certification tests, and it's one I've seen brought forth by others in Linked in groups and on the Dreamforce chatter feeds, is the complete lack of feedback provided. When you finish the exams all you will see is a pass or a fail: no mark, no indication of areas you need to brush up on, nadda. I understand why this is the case, Salesforce need to protect the content of these exams and ensure they remain valid tests, but even though I've passed both of mine so far, I still came out wanting to know what the answers were to certain questions. Of course you could research these later, but trying to remember the exact details after going through sixty questions is pretty tricky.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Next up is the first part of the Advanced Developer Certification which I'm due to sit in little over a week, I'm intrigued to see how that goes and will definitely write another load of babble for your consideration. &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-1967376591462775770?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/1967376591462775770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/12/forcecom-certification-my-experience-so.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/1967376591462775770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/1967376591462775770'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/12/forcecom-certification-my-experience-so.html' title='Force.com Certification — My Experience So Far...'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-8472818213461492569</id><published>2011-11-30T19:38:00.001+11:00</published><updated>2011-11-30T20:17:58.866+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='quirks'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>Curious Logic — A VisualForce Function Oddity</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Today's quirk is something I've stumbled into a few times, and although I recognise it as soon as I see it these days, it still puts a smile on my face.&lt;br /&gt;&lt;br /&gt;There's a few VisualForce functions, which on the face of it, return a boolean value — one of these happens to be &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;CONTAINS()&lt;/span&gt;, and it's explained in the documentation to do just that:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-xJoiaWHlrv4/TtXsPR9ahtI/AAAAAAAAAjA/dgCpz9qc_9c/s1600/Screen+shot+2011-11-30+at+19.40.39.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="99" src="http://3.bp.blogspot.com/-xJoiaWHlrv4/TtXsPR9ahtI/AAAAAAAAAjA/dgCpz9qc_9c/s640/Screen+shot+2011-11-30+at+19.40.39.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;See? Right there:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&amp;nbsp;returns TRUE if the first argument contains the second argument. If not, returns FALSE.&lt;/blockquote&gt;&lt;br /&gt;I've quoted that in addition to the screenshot just to make sure it's nice and clear. So, what is the point that I have as of yet failed to get to? Well here it is: If you simply use this function inside of a &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;rendered=""&lt;/span&gt; attribute, &lt;i&gt;it won't work. &lt;/i&gt;Example:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:variable var="v" value="" rendered="{!CONTAINS(myStrVar, 'boris')}"&amp;gt;&lt;br /&gt;&amp;nbsp; Hello, World!&lt;br /&gt;&amp;lt;/apex:variable&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Regardless of the contents of &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;myStrVar&lt;/span&gt;, the text "Hello, World!" will always find it's way onto the screen. There is a simple fix for this, and it is this that I find most amusing, because all you have to do is wrap it in an &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;IF()&lt;/span&gt; function, returning either true or false as shown below.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:variable var="v" value="" rendered="{!IF(CONTAINS(myStrVar, 'boris'), true, false)}"&amp;gt;&lt;br /&gt;&amp;nbsp; Hello, World!&lt;br /&gt;&amp;lt;/apex:variable&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Written like this, the code will work as expected. I'm sure there must be a reason for this behaviour, and I'm sure someone would love to explain it with a serious face, but frankly I'd prefer not to know the details and just keep the switch in the "more magic" position.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-8472818213461492569?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/8472818213461492569/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/11/curious-logic-visualforce-function.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/8472818213461492569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/8472818213461492569'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/11/curious-logic-visualforce-function.html' title='Curious Logic — A VisualForce Function Oddity'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-xJoiaWHlrv4/TtXsPR9ahtI/AAAAAAAAAjA/dgCpz9qc_9c/s72-c/Screen+shot+2011-11-30+at+19.40.39.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-7851227608902505198</id><published>2011-11-21T12:21:00.001+11:00</published><updated>2011-11-21T12:30:40.352+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='deployment'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><title type='text'>An Annoyance Fixed? Deployments and Scheduled Jobs</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Nearly every time I've had to deploy code to certain production orgs I've done so with a feeling of dread, purely because I've had to go in there and disable the scheduled Apex Jobs before doing anything and then afterwards, I need to set them up again. This is a definite pain point as you need to be sure to set everything up correctly, and as I learned recently the system won't even warn you if you set up one job twice, even specifying the same time on each setup!&lt;br /&gt;&lt;br /&gt;I've just performed a deployment to an org which has 7 batch jobs that I usually have to stop —&amp;nbsp;this time I did a bit of research first and noticed in the API docs that there's a 'Paused' status which can be applied to such jobs. I thought that maybe I could set the jobs to have this status through some ad hoc code, but before getting around to that I hit the button to validate the deployment. You know what? I got a green light, &lt;i&gt;without disabling or stopping any of these jobs&lt;/i&gt;. I've looked through the notes for Winter '12 and couldn't see anything regarding this, but have Salesforce made a change to allow deployments while jobs are scheduled? It seems that way, and I truly hope that I'm correct in this assumption!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-7851227608902505198?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/7851227608902505198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/11/annoyance-fixed.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/7851227608902505198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/7851227608902505198'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/11/annoyance-fixed.html' title='An Annoyance Fixed? Deployments and Scheduled Jobs'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-3684586242481167716</id><published>2011-10-19T13:26:00.000+11:00</published><updated>2011-10-19T13:27:02.749+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Movember'/><title type='text'>A Worthy Moment Off-Topic: Movember</title><content type='html'>Depending on where you are in the world you may or you may not have heard of the greatness that is Movember. For those who haven't, it is summed up best by the guys who run &lt;a href="http://au.movember.com"&gt;Movember&lt;/a&gt; themselves:&lt;br/&gt;&lt;br/&gt;&lt;blockquote&gt;&lt;b&gt;WHAT IS MOVEMBER?&lt;/b&gt;&lt;p&gt;Movember (the month formerly known as November) is a moustache growing charity event held during November each year that raises funds and awareness for men's health.&lt;/p&gt;&lt;p&gt;At the start of Movember guys register with a clean shaven face. The Movember participants, known as Mo Bros, have the remainder of the month to grow and groom their Mo, raising money along the way to benefit men's health - specifically prostate cancer and depression in men. &lt;/p&gt;&lt;p&gt;Funds are committed to our men’s health partners - the Prostate Cancer Foundation of Australia, beyondblue: the national depression initiative and the Movember Foundation. Together, the three channels work to ensure that Movember funds are supporting a broad range of innovative, world class programs in the fields of research, education, support, and awareness.&lt;/p&gt;&lt;/blockquote&gt;&lt;br/&gt;&lt;p&gt;As is plain to see, it is a very worth cause and this is my third year running of taking part — &lt;a href="http://mobro.co/LaceySnr"&gt;please consider visiting my MoSpace and donating some money&lt;/a&gt; to help out.&lt;/p&gt;&lt;p&gt;Thank you — regular programming shall resume shortly!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-3684586242481167716?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/3684586242481167716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/10/worthy-moment-off-topic-movember.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3684586242481167716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3684586242481167716'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/10/worthy-moment-off-topic-movember.html' title='A Worthy Moment Off-Topic: Movember'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-6800004067372539771</id><published>2011-10-11T11:48:00.001+11:00</published><updated>2011-10-11T11:48:52.845+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rerender'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>Using Rerender to Render — One Solution for Headaches</title><content type='html'>It's a regular&amp;nbsp;occurrence&amp;nbsp;to have an &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:outputPanel&amp;gt;&lt;/span&gt; or similar element in a Visualforce page, where you want to toggle visibility of said element according to some variable. Something that's caught both myself and fellow teammates out on a few such occasions is finding that it just won't appear again after being removed from the screen, when the page code looks analogous like the following.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:outputPanel id="thePanel" rendered="{!bRenderThePanel}"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;!-- Content --&amp;gt;&lt;br /&gt;&amp;lt;/apex:outputPanel&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;apex:commandButton action="{!DoSomeCalcs}" rerender="thePanel" value="FIRE!"/&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;In this example, the action &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;DoSomeCalcs&lt;/span&gt; is implemented such that it will toggle the value of the variable &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;bRenderThePanel&lt;/span&gt; and so the result should be that the panel is alternately displayed and hidden with each click of the button. Woe is the developer, as this is not the case. Chances are you'll find yourself confused as to why it just won't reappear (or appear in the first place).&lt;br /&gt;&lt;br /&gt;Essentially re-rendering a specified panel (or other component) that is not currently displayed will fail, and the solution is to wrap it with a component that is always present, using that as the target for the re-render. Thus our example becomes:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:outputPanel id="thePanelWrapper"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;apex:outputPanel rendered="{!bRenderThePanel}"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;!-- Content --&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;lt;/apex:outputPanel&amp;gt;&lt;br /&gt;&amp;lt;/apex:outputPanel&amp;gt;&lt;/br&gt;&lt;br/&gt;&amp;lt;apex:commandButton action="{!DoSomeCalcs}" rerender="thePanelWrapper" value="FIRE!"/&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;What does seem strange to me is that Salesforce have specifically ensured that you can access DOM elements within an &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:outputPanel&amp;gt;&lt;/span&gt; when it's not displayed, as indicated by the documentation for the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;layout&lt;/span&gt; attribute, it seems odd that this functionality does not carry over for the element itself when it's being used as a re-render target.&lt;br/&gt;&lt;br/&gt;&lt;blockquote&gt;The layout style for the panel. Possible values include "block" (which generates an HTML div tag), "inline" (which generates an HTML span tag), and "none" (which does not generate an HTML tag). If not specified, this value defaults to "none". However, if layout is set to "none", for each child element with the rendered attribute set to "false", the outputPanel generates a span tag, with the ID of each child, and a style attribute set to "display:none". Thus, while the content is not visible, JavaScript can still access the elements through the DOM ID.&lt;/blockquote&gt;&lt;br/&gt;Happy coding!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-6800004067372539771?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/6800004067372539771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/10/using-rerender-to-render-one-solution.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/6800004067372539771'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/6800004067372539771'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/10/using-rerender-to-render-one-solution.html' title='Using Rerender to Render — One Solution for Headaches'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-2188206798649646499</id><published>2011-09-05T10:34:00.000+10:00</published><updated>2011-09-05T10:34:50.270+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>Formatting That Date — One Solution to "apex:outputtext is not in a valid format"</title><content type='html'>So you want to put a date on a page, you know about using the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;value="{0,date,short}"&lt;/span&gt; &lt;a href="http://download.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html"&gt;Java style syntax&lt;/a&gt;, and you know to put your field into an &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:param&lt;/span&gt; (don't panic if you don't, the code is below), but when you try and use a &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;datetime&lt;/span&gt; field you get this rather infuriating error:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Save error: The value attribute on &amp;lt;apex:outputText&amp;gt; is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.&lt;/blockquote&gt;&lt;br /&gt;The easiest way to fix this is to make use of the built in VisualForce functions &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;DATEVALUE()&lt;/span&gt; and &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;DATETIMEVALUE()&lt;/span&gt; as&amp;nbsp;necessary&amp;nbsp;and you should be sorted.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:outputText value="{0,date,dd/MM/yyyy}"&amp;gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;apex:param value="{!DATEVALUE(m_dtimSomeVar)}"/&amp;gt;&lt;br/&gt;&amp;lt;/apex:outputText&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-2188206798649646499?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/2188206798649646499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/09/formatting-that-date-one-solution-to.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2188206798649646499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2188206798649646499'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/09/formatting-that-date-one-solution-to.html' title='Formatting That Date — One Solution to &quot;apex:outputtext is not in a valid format&quot;'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-3620352505691921310</id><published>2011-09-02T12:26:00.000+10:00</published><updated>2011-09-05T09:26:27.238+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>$Page — Getting the URL of a Sites Page</title><content type='html'>Nothing revolutionary here, just something I needed to find quickly and didn't appear to be obviously apparent, of course it's in the documentation etc., I just figured I'd share it too so that the answer is even easier to find.&lt;br /&gt;&lt;br /&gt;Scenario: You're exposing some VisualForce pages over sites, and in one of those pages you want to link to another.&lt;br /&gt;&lt;br /&gt;Solution: My first reaction was to use &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ApexPages.currentPage()&lt;/span&gt; in the controller to grab the current URL which I could then modify, but that's not the correct (or simple) approach! All you need is to utilise one of &amp;nbsp;the VisualForce Global Variables: &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;$Page&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;{!$Page.PageName}&lt;br /&gt;&amp;lt;!-- For Example --&amp;gt;&lt;br /&gt;&amp;lt;a href="{!$Page.Page2}"&amp;gt;Link to Page 2&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="p1"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="p1"&gt;Too easy!&lt;/div&gt;&lt;div class="p1"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-3620352505691921310?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/3620352505691921310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/09/page-getting-url-of-sites-page.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3620352505691921310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3620352505691921310'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/09/page-getting-url-of-sites-page.html' title='$Page — Getting the URL of a Sites Page'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-6060142007440353238</id><published>2011-08-18T11:50:00.000+10:00</published><updated>2011-08-18T11:50:51.545+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>Referencing Components in JavaScript — When $Component Comes Up Blank</title><content type='html'>Today's most is more of a heads up, just to maybe help people who encounter a problem I've come across more than a few times during my Visualforce escapades. As you probably know, if you want to reference a Visualforce apex element from JavaScript you have to use the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;$Component&lt;/span&gt; notation:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!-- Markup --&amp;gt;&lt;br /&gt;&amp;lt;apex:inputField id="MyInputField" value='{!SomeControllerMember}'/&amp;gt;&lt;br /&gt;...&lt;br /&gt;// JavaScript&lt;br /&gt;var myElement = document.getElementById('{!$Component.MyInputField}');&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;On many an occasion I've found this to simply not work for me, when I view the source of the generated page the ID will be missing, i.e. my script will read &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;document.getElementById('')&lt;/span&gt;. This has been quite a source of considerable frustration at times and the &lt;a href="http://www.salesforce.com/us/developer/docs/pages/Content/pages_access.htm"&gt;documentation here&lt;/a&gt;&amp;nbsp;doesn't really hint at the solution; what it does do is have a link to&amp;nbsp;&lt;a href="http://www.salesforce.com/us/developer/docs/pages/Content/pages_access.htm"&gt;Best Practices for Accessing Component IDs&lt;/a&gt;, and therein lies the magical answer.&lt;br /&gt;&lt;br /&gt;I urge you to go and read this page, but here is the vital part:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="line-height: 1.25em; background-color: white; font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 12px;"&gt;The&amp;nbsp;&lt;samp class="codeph apex_page" style="color: black; font-family: 'Courier New', Courier, monospace; font-size: 13px;"&gt;$Component&lt;/samp&gt;&amp;nbsp;global variable simplifies references and reduces some of the dependency on the overall page structure. For example, to access a data table with&amp;nbsp;&lt;samp class="codeph apex_page" style="color: black; font-family: 'Courier New', Courier, monospace; font-size: 13px;"&gt;id=&lt;span class="string" style="color: #004600;"&gt;"tableID"&lt;/span&gt;&lt;/samp&gt;&amp;nbsp;contained in a page block with&amp;nbsp;&lt;samp class="codeph apex_page" style="color: black; font-family: 'Courier New', Courier, monospace; font-size: 13px;"&gt;id=&lt;span class="string" style="color: #004600;"&gt;"blockID"&lt;/span&gt;&lt;/samp&gt;, use the following expression:&lt;samp class="codeph apex_page" style="color: black; font-family: 'Courier New', Courier, monospace; font-size: 13px;"&gt;$Component.blockID.tableID&lt;/samp&gt;.&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;That's really all there is to it, you must drill down through the IDs of all the containers, mystery solved.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-6060142007440353238?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/6060142007440353238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/08/referencing-components-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/6060142007440353238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/6060142007440353238'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/08/referencing-components-in.html' title='Referencing Components in JavaScript — When $Component Comes Up Blank'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-5313429827132914458</id><published>2011-08-05T17:08:00.000+10:00</published><updated>2011-08-05T17:08:53.040+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Offline'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Manifest File'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML 5'/><title type='text'>HTML 5 Experiments... Adventures in JavaScript</title><content type='html'>I've just been playing around doing a little R&amp;amp;D to look into the possibility of creating an HTML 5&amp;nbsp;application, with local storage and offline capabilities, being served up by Salesforce. It's taken me a little over two hours to get to the point where I can view a list of contacts on my phone from Salesforce, put the phone into flight mode, load the page again and retrieve the list from local storage. Obviously the first step was to grab myself a shiny new Developer Edition org, and then I chose the easy route of enabling sites so I could host the intended pages&amp;nbsp;publicly&amp;nbsp;to avoid login hassles etc..&lt;br /&gt;&lt;br /&gt;I'm not going to throw down everything here, but essentially I expose data through a Visualforce page serving up JSON — I should look into the REST API, but that's fun for another day:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:page controller="QQueryRunner" action="{!Init}" sidebar="false" showHeader="false" cache="false" contentType="text/javascript"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;{!mp_strJSON}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/apex:page&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;That data gets pulled using jQuery's &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;getJSON()&lt;/span&gt; method and then processed and displayed, the script also uses local storage to save the data, though you have to do this a record and a field at a time using the basic setup (or use your own&amp;nbsp;serialising). In its base form HTML 5 local storage uses key-value pairs, so I took the quick route for now:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;for(contact in data.contacts)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var c = data.contacts[contact];&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;localStorage["contact" + contact + "firstName"] = c.firstName;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// etc. :)&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Using this and a similar loading mechanism I could pull the contacts from Salesforce, store them and then recall them again from the local storage area; the next step was that for offline I had to include a manifest file... I'm sure I've not set it up 100% right yet (haven't delved too deep into the network section which should be used for the data source), but hey, it works and that'll do for me on a Friday afternoon. Getting the manifest file into the page required me to break from the norm and include &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;html&amp;gt;&lt;/span&gt; tags myself so that I could specify the manifest file to use:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:page controller="QVFC_AppHome" standardStylesheets="false" sidebar="false" showHeader="false" contentType="text/html" cache="true"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:outputText escape="false" value="{!"&amp;lt;!DOCTYPE html&amp;gt;"}"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;html manifest="/OfflineAppCache"&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;But what about the manifest itself? It's simply another publicly available Visualforce page hosted on the site, but with a specific content type as you can see below. The bare-bones manifest lists which files form the site and thus need to be saved by the browser to render the site offline.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:page contentType="text/cache-manifest" showHeader="false" sidebar="false" cache="false"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;CACHE MANIFEST&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;/OfflineTest/AppHome&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;/OfflineTest/Query&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;/{!$Resource.JQuery}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/apex:page&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Clearly just throwing these snippets into a few files isn't going to get you a working application, but it does give you the core building blocks to hook together, feel free to post any questions in the comments!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-5313429827132914458?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/5313429827132914458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/08/html-5-experiments-adventures-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/5313429827132914458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/5313429827132914458'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/08/html-5-experiments-adventures-in.html' title='HTML 5 Experiments... Adventures in JavaScript'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-3912727318047853680</id><published>2011-07-26T16:22:00.000+10:00</published><updated>2011-07-26T16:22:37.731+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>Escaping the Page Messages - Run Away! Inconsistency Alert!</title><content type='html'>One of my main problems with the force.com platform is the inconsistencies I come across while working with it, they tend to be rare but they also tend to come out of left field and suck up a few hours when you're trying to do something relatively trivial. Recently I wanted to put a link into a message displayed on a VisualForce page using our friend, &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:pageMessages/&amp;gt;&lt;/span&gt;*. To achieve this is easy enough, you can simply include HTML markup in the message you add in code, and then set the escape attribute to false on the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:pageMessages/&amp;gt;&lt;/span&gt; tag:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;// Code:&lt;br /&gt;ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'This is an info message with a &amp;lt;a href="http://www.google.com/"&amp;gt;link to google&amp;lt;/a&amp;gt;.'));&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!-- Page: --&amp;gt;&lt;br /&gt;&amp;lt;apex:pagemessages escape="false"&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;I &amp;nbsp;soon noticed that sometimes the link appeared correctly, and other times the HTML was escaped and so you'd just see the markup in the message rather than a link — it took me a short while to notice a difference between the two scenarios, they were both using the same action and the same line of code to add the message to the page so it didn't appear to make any sense. After some head scratching I finally noticed that in the case where the link did work, I had one message with &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Severity.ERROR&lt;/span&gt; and then one which has &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Severity.INFO&lt;/span&gt;&amp;nbsp;and the link, as per the code snippet above; in the case where the link wasn't working I had two &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Severity.INFO&lt;/span&gt; messages.&lt;br /&gt;&lt;br /&gt;My conclusion? There's a bug within VisualForce whereby the use of two messages of the same type will cause the escape attribute to be overridden, meaning the HTML is always escaped. I could be wrong, but I wrote a quick page to test this idea and it appears to confirm my thinking, the screenshots below demonstrate the issue perfectly:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-jfHmY2OG2ew/Ti5b_JZIGoI/AAAAAAAAAew/H4rEaoVUAAI/s1600/Screen+shot+2011-07-26+at+2.06.59+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="102" src="http://2.bp.blogspot.com/-jfHmY2OG2ew/Ti5b_JZIGoI/AAAAAAAAAew/H4rEaoVUAAI/s320/Screen+shot+2011-07-26+at+2.06.59+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-9Qls9pxY9Xc/Ti5b_fhJoJI/AAAAAAAAAe0/GsIBwLEF9OM/s1600/Screen+shot+2011-07-26+at+2.07.06+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="79" src="http://2.bp.blogspot.com/-9Qls9pxY9Xc/Ti5b_fhJoJI/AAAAAAAAAe0/GsIBwLEF9OM/s320/Screen+shot+2011-07-26+at+2.07.06+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Eymgv3xhB6E/Ti5b_2u5rKI/AAAAAAAAAe4/v8vNi6j5tPM/s1600/Screen+shot+2011-07-26+at+2.07.13+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="128" src="http://4.bp.blogspot.com/-Eymgv3xhB6E/Ti5b_2u5rKI/AAAAAAAAAe4/v8vNi6j5tPM/s320/Screen+shot+2011-07-26+at+2.07.13+PM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;At this point I don't have a solution to the issue, but hopefully if you're encountering this problem it'll help provide some insight into what's going on.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;*On a side note, if you use &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:messages/&amp;gt;&lt;/span&gt; you'll find your messages are displayed without formatting, if you use &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:pageMessages/&amp;gt;&lt;/span&gt; then they use the default Salesforce styling and look much nicer.&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-3912727318047853680?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/3912727318047853680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/07/escaping-page-messages-run-away.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3912727318047853680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3912727318047853680'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/07/escaping-page-messages-run-away.html' title='Escaping the Page Messages - Run Away! Inconsistency Alert!'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-jfHmY2OG2ew/Ti5b_JZIGoI/AAAAAAAAAew/H4rEaoVUAAI/s72-c/Screen+shot+2011-07-26+at+2.06.59+PM.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-8869322976330936671</id><published>2011-06-27T15:05:00.020+10:00</published><updated>2011-06-27T15:12:36.311+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>apex:repeat and apex:variable, Pain With apex:selectRadio, actionSupport and onchange</title><content type='html'>Having just wasted a morning trying to figure out why some code wasn't working, I thought it'd be a good time for a blog post so that others may avoid the same trap. As may be derived from the title, this concerns the use of &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:variable&lt;/span&gt; and&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; apex:repeat&lt;/span&gt;, and more specifically, their use along side &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:selectRadio&lt;/span&gt; and pals.&lt;br /&gt;&lt;br /&gt;In our controller we had a class, and originally we used a list of instances of this class on our page, each one receiving the input from from an &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:selectRadio&lt;/span&gt; tag element (queue contrived code example):&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;// Controller&lt;br /&gt;class CThing&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; public string strValue {get; set;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public list&amp;lt;CThing&amp;gt; liThings {get; set;}&lt;br /&gt;&lt;br /&gt;ControllerConstructor()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; liThings = new list&amp;lt;CThing&amp;gt;{new CThing(), new CThing(), newCThing()};&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// VF Page&lt;br /&gt;&amp;lt;apex:repeat var="c" value="{!liThings}"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;apex:selectRadio value="{!c.strValue}"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:selectOptions value="{!liOptionsFromTheController}"/&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:actionSupport action="{!DoSomething}" event="onchange"/&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/apex:selectRadio&amp;gt;&lt;br /&gt;&amp;lt;/apex:repeat&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Now this all functioned as desired, running through the list of &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;CThing&lt;/span&gt; instances in the controller in the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;DoSomething&lt;/span&gt; action we could read all the values fine and dandy and everybody lived happily ever after. Then one of our developers adapted this code for another scenario, where we wanted to only display one &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;CThing&lt;/span&gt; at a time; they chose the obvious route of replacing the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:repeat&lt;/span&gt; with an &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:variable&lt;/span&gt; and made a bunch of other changes also, and it was a long time before we noticed that we were no longer receiving input in the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;strValue&lt;/span&gt; field of our &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;CThing&lt;/span&gt; instances. Considering many of the changes focused around JQuery additions and all manner of other quirky bits I started pulling the changes out to see what the cause might be — eventually I discovered it was the use of &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:variable&lt;/span&gt;. Maybe I've not read enough documentation (though what I have read doesn't suggest that we should have encountered this problem) but it would appear that our problem was caused by replacing the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:repeat&lt;/span&gt;&amp;nbsp;element with the aforementioned&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:variable&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:variable var="c" value="{!oTheSingleInstance}"&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;The outcome of this was that when you changed the option in the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:selectRadio&lt;/span&gt; list, the setters and getters on the controller would fire, the page would refresh as normal (even status panels worked as they should if we used those) but the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;DoSomething&lt;/span&gt; action would &lt;i&gt;&lt;b&gt;not&lt;/b&gt;&lt;/i&gt; be invoked. As is often the case with Salesforce quirks I have no idea why this behaves differently, I'm sure there is an architectural reason or similar but if I&amp;nbsp;actually&amp;nbsp;had enough time to investigate all of these things in detail it'd&amp;nbsp;probably&amp;nbsp;mean that I am unemployed; therefore we'll skip the in-depth discussion, and as is my wont, jump to the quick fix and put it in a&amp;nbsp;separate&amp;nbsp;paragraph so it's easy to spot.&lt;br /&gt;&lt;br /&gt;Use a list of instances in the controller, use &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:repeat&lt;/span&gt;, and just put one item in the list. Couldn't be simpler.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-8869322976330936671?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/8869322976330936671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/06/apexrepeat-and-apexvariable-pain-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/8869322976330936671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/8869322976330936671'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/06/apexrepeat-and-apexvariable-pain-with.html' title='apex:repeat and apex:variable, Pain With apex:selectRadio, actionSupport and onchange'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-1027162556687799080</id><published>2011-06-10T10:39:00.000+10:00</published><updated>2011-06-10T10:39:22.201+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><title type='text'>How to Nuke Your Code, AKA How to Delete from Production</title><content type='html'>Ok it's been a while since my last post, and this isn't a particularly code-centric update but here we go: As many people will have realised already, deleting code from a production instance of Salesforce is not always the easiest thing to do. The way to do it is to remove the files from your project in Eclispe / Force.com IDE and deploy the &lt;i&gt;src&lt;/i&gt;&amp;nbsp;&lt;i&gt;folder&lt;/i&gt;&amp;nbsp;to the production org, this then gives you the chance to delete the files from there.&lt;br /&gt;&lt;br /&gt;Today I was trying to remove a custom Visualforce controller and the system flat out refused because the page still existed. The catch? I couldn't see the page in the list of pages to delete it first, neither did it have the checkbox for deleting it in the deployment dialog. In the end I found a solution (which is why I'm writing a post) and that turned out to be not to deploy from the sandbox at all, but from an entirely&amp;nbsp;separate&amp;nbsp;developer org.&amp;nbsp;Clearly this developer org didn't have any of the files in our production environment so I was able to choose everything for deletion and blew it all away.&lt;br /&gt;&lt;br /&gt;Hope this helps somebody somewhere!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-1027162556687799080?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/1027162556687799080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/06/how-to-nuke-your-code-aka-how-to-delete.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/1027162556687799080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/1027162556687799080'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/06/how-to-nuke-your-code-aka-how-to-delete.html' title='How to Nuke Your Code, AKA How to Delete from Production'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-2582986698795902915</id><published>2011-05-05T12:06:00.002+10:00</published><updated>2011-08-10T09:51:34.794+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Styling &lt;apex:selectOptions&gt; - Stack 'em Vertically</title><content type='html'>&lt;i&gt;Since writing this, &lt;a href="http://www.blogger.com/profile/12161659787184632869"&gt;Tish&lt;/a&gt; pointed out in a comment that vertical stacking of these buttons is available through a parameter on the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:selectRadio&amp;gt;&lt;/span&gt; tag. See &lt;a href="http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_selectRadio.htm"&gt;the documentation&lt;/a&gt; here, specifically you want to specify the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;layout&lt;/span&gt; attribute to be &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"pageDirection"&lt;/span&gt;.&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Original Post:&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;For some reason that I just can't fathom, when you use an &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:selectOptions&amp;gt;&lt;/span&gt; tag inside of an &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:selectList&amp;gt;&lt;/span&gt; or similar, the options get built out into a table(!), with each option occupying it's own table cell, all in one table row. This really isn't that handy for those cases where say, I don't know, you want the options in a vertical list maybe?&lt;br /&gt;&lt;br /&gt;To me it seems that this is often more desirable than having them horizontally laid out side by side, but somebody within Salesforce obviously though different. You may think it can be solved by using an &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:repeat&amp;gt;&lt;/span&gt; inside of the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:selectList&amp;gt;&lt;/span&gt; and using &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:selectOption&amp;gt;&lt;/span&gt; (not the lack of a plural here) to generate each one&amp;nbsp;individually, &amp;nbsp;encased in a &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;, &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;li&amp;gt;&lt;/span&gt; or what have you — you'll soon discover however that the Visualforce validation parser that runs when you save your page will inform you that the options must be an immediate child of the parent list. Nuts.&lt;br /&gt;&lt;br /&gt;The way I solved this problem is by wrapping the list in a &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;div&amp;gt;&lt;/span&gt; and using some CSS to force the table cells to use "&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;display: block&lt;/span&gt;" which then prevents them from displaying on the same line; I don't believe this is particularly elegant as that's not what tables are for (and no I'm not a CSS purist who believes that spending a day screwing about with CSS is better than just using a table to lay something out in 2 minutes — in the real world people need things done quickly and the chances of requiring a totally different style are quite minimal in Visualforce pages).&lt;br /&gt;&lt;br /&gt;Example page markup:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;div class="questionContent"&amp;gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;apex:selectRadio value="{!q.strSelectedAnswer}"&amp;gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;apex:selectOptions value="{!q.liAnswers}"/&amp;gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;apex:actionSupport event="onchange" action="{!SaveProgress}" status="SaveStatus" rerender="SaveStatus"/&amp;gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;/apex:selectRadio&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;and, of course, the CSS:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;.question table tr td&lt;br /&gt;{&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;display: block;&lt;br /&gt;}&lt;/span&gt;&lt;/blockquote&gt;&lt;i&gt;Random&amp;nbsp;side note: I do in fact use tabs for all my indenting (set to four spaces), but for the sake of space saving in examples etc. I don't bother to make sure they're always that size in this blog. Plus it's a bit of a pain to do in blogger (or so it seems).&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-2582986698795902915?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/2582986698795902915/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/05/styling-stack-em-vertically.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2582986698795902915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2582986698795902915'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/05/styling-stack-em-vertically.html' title='Styling &amp;lt;apex:selectOptions&amp;gt; - Stack &apos;em Vertically'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-4162811428059368122</id><published>2011-05-02T12:01:00.001+10:00</published><updated>2011-05-02T12:02:25.508+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>apex:ActionStatus - Making It Work</title><content type='html'>Just a quick snippet today! All too often I add an &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:actionStatus&amp;gt;&lt;/span&gt; tag to a page and find that it doesn't actually work. The quick solution in most of these cases? Make sure it's also specified in the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;rerender&lt;/span&gt; attribute of the tag that's firing the action:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:actionStatus id="SaveStatus"&amp;gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;apex:facet name="start"&amp;gt;Saving...&amp;lt;/apex:facet&amp;gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;apex:facet name="stop"&amp;gt;&amp;lt;/apex:facet&amp;gt;&lt;br /&gt;&amp;lt;/apex:actionStatus&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:actionSupport event="onchange" action="{!SaveProgress}" status="SaveStatus" rerender="SaveStatus"/&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-4162811428059368122?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/4162811428059368122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/05/apexactionstatus-making-it-work.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4162811428059368122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4162811428059368122'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/05/apexactionstatus-making-it-work.html' title='apex:ActionStatus - Making It Work'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-4722281853813234603</id><published>2011-04-28T10:37:00.000+10:00</published><updated>2011-04-28T10:37:24.506+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>#define for Visualforce - One way to help debug pages</title><content type='html'>Coming from a C background (it's still my favourite language for coding in) I'm used to the idea of having &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#define&lt;/span&gt; statements at the top of my source files so that I can quickly switch on and off different areas of functionality quickly and easily; for those unfamiliar with C and it's derivatives they essentially work like constant variables but actually modify the code before compilation (by the C preprocessor). For example I might have&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#define DEBUG_TEST (1)&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;at the top, then around multiple blocks of code I want to toggle I use something like the following&amp;nbsp;(In C, 0 is false and any other value equates to true):&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;if (DEBUG_TEST)&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;{&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;// code to enable or disable&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;}&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;So I can toggle multiple pieces of code simply by changing the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;(1)&lt;/span&gt; for a &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;(0)&lt;/span&gt;. I wanted to make use of this idea in a Visualforce page recently, allowing me to toggle the rendering and disabling of various components with just one change at the top. I figured &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:variable&lt;/span&gt; would come in handy and just wrapped my page as so:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:variable var="debug" value="true:"&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!-- page stuff--&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/apex:variable&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;However, when I tried to use this value in a statement it told me that it was a text value and thus couldn't be used in a boolean operation (I was trying to do &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;disabled="{!debug}"&lt;/span&gt;), I had a go at doing &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;value="{!true}"&lt;/span&gt; but that also didn't work, so the solution I came up with?&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:variable var="debug" value="{!IF(true, true, false)}"&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Works like a charm and now I can simply toggle the first &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;true&lt;/span&gt; to switch on/off a whole bunch of functionality in the page — there might be a more direct way of setting a variable to &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;true&lt;/span&gt; or &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;false&lt;/span&gt; but this was the first one I found that worked and so my investigations stopped there!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-4722281853813234603?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/4722281853813234603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/04/define-for-visualforce-one-way-to-help.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4722281853813234603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4722281853813234603'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/04/define-for-visualforce-one-way-to-help.html' title='#define for Visualforce - One way to help debug pages'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-3361609591445952423</id><published>2011-04-21T13:12:00.000+10:00</published><updated>2011-04-21T13:12:01.481+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Chatter Desktop'/><category scheme='http://www.blogger.com/atom/ns#' term='mac'/><category scheme='http://www.blogger.com/atom/ns#' term='Chatter'/><title type='text'>When Chatter Desktop Goes Bad - Blank Window. AKA. More Chatter Hackery</title><content type='html'>Once again the Chatter desktop client (on my Mac) decided it wouldn't like to work properly; unlike before &lt;a href="http://www.laceysnr.com/2011/02/chatter-desktop-wheres-window-its-not.html"&gt;when it was managing to display a 100% transparent window&lt;/a&gt;&amp;nbsp;this time it actually displayed a window but with the minor inconvenience of that window &lt;b&gt;having no content whatsoever.&lt;/b&gt;&amp;nbsp;Useful eh?&lt;br /&gt;&lt;br /&gt;Thinking along the lines of the last fix, I once again delved into the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;desktop-app.xml&lt;/span&gt; file contained within the Chatter application bundle. On my machine the file is located in this directory (easily accessible from Terminal, in Finder you need to right click on the bundle file and choose to show the contents):&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;/Applications/salesforce.com/Chatter Desktop.app/Contents/Resources&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The fix is again simple, locate this line:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;!--&amp;lt;visible&amp;gt;&amp;lt;/visible&amp;gt;--&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Remove the comment and set the value to true:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;visible&amp;gt;true&amp;lt;/true&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Save the file, relaunch Chatter and you should be golden.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-3361609591445952423?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/3361609591445952423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/04/when-chatter-desktop-goes-bad-blank.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3361609591445952423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3361609591445952423'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/04/when-chatter-desktop-goes-bad-blank.html' title='When Chatter Desktop Goes Bad - Blank Window. AKA. More Chatter Hackery'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-8572922586342391824</id><published>2011-04-14T15:15:00.000+10:00</published><updated>2011-04-14T15:15:36.960+10:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='test methods'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><title type='text'>RecordTypes in Test Methods... I don't get this one</title><content type='html'>&lt;i&gt;&lt;b&gt;Disclaimer&lt;/b&gt;: This particular issue may easily have been caused by validation rules, workflow or something that I just didn't see - I don't have time for a full investigation right now and I'm posting this just in case it helps someone somewhere from beating their head against a wall as I've been doing!&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;I've been trying to hammer out some test coverage as quickly as possible for a small piece of work and just lost an hour due to some weird issue around record types, namely trying to insert a contact record for testing with a specific record type. I was selecting the record type from the database, then setting it on the contact as follows:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sContact.RecordType = sRT;&lt;br /&gt;update sContact;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Seems simple enough, didn't produce any warnings or errors (at least ones that were visible in an hour of trying to get this working) but the contact still had the wrong record type when I subsequently queried the database. The fix? This:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sContact.RecordTypeId = sRT.Id;&lt;br /&gt;update sContact;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;At this point I genuinely don't understand why this works if the former example does not produce an error; When I get the chance I shall endeavour to find out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-8572922586342391824?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/8572922586342391824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/04/recordtypes-in-test-methods-i-dont-get.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/8572922586342391824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/8572922586342391824'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/04/recordtypes-in-test-methods-i-dont-get.html' title='RecordTypes in Test Methods... I don&apos;t get this one'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-6117162793009971989</id><published>2011-03-03T09:20:00.000+11:00</published><updated>2011-03-03T09:20:46.755+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='field sets'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>Field Sets and Custom Styles - Saving Time And Adding Value</title><content type='html'>Last week I needed to work on a VisualForce Page which dumped a bunch of contact and related account data on screen, and one of our guys suggested it might be a good place to try out the new field sets (part of the latest release).&lt;br /&gt;&lt;br /&gt;Field sets allow for end-user customisation of your custom pages, you tell the page to render the field set, the user can control which fields are in the set – they're simple, effective and save a helluva lot of development time whilst providing a more flexible solution; everybody wins. &lt;a href="http://blog.sforce.com/sforce/2011/02/using-field-sets-in-spring-11.html"&gt;The Salesforce blog has an example of how to use sets&lt;/a&gt;, I won't duplicate what they say here but they do assume that you'll be inserting the fields in a regularly styled VisualForce page using the classic&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:pageBlock&amp;gt;,&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:pageBlockSection&amp;gt;,&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:pageBlockSectionItem&amp;gt; &lt;/span&gt;hierarchy for rendering.&lt;br /&gt;&lt;br /&gt;We needed to customise our page quite heavily and as such I needed to be able to get the labels for the fields&amp;nbsp;separately&amp;nbsp;to the field values, and I found you could do this using the field array attached to each object (e.g. &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;{!$ObjectType.Account.Fields[f].label}&lt;/span&gt;). The following code loops over the Product Interest field set which has been defined on Account, rendering the label and an input or output field (depending on a public controller member variable) in a standard HTML table.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:repeat value="{!$ObjectType.Account.FieldSets.Product_Interest}" var="f"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;td class="left"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:outputText styleClass="bold" value="{!$ObjectType.Account.Fields[f].label}"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;td class="right"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:inputField styleClass="vfInputField" value="{!Contact.Account[f]}" rendered="{!NOT(bReadOnly)}"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:outputField styleClass="vfInputField" value="{!Contact.Account[f]}" rendered="{!bReadOnly}"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/apex:repeat&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;Easy to code, easy to configure and ultimately more flexible – this is what the force.com platform does best!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-6117162793009971989?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/6117162793009971989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/03/field-sets-and-custom-styles-saving.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/6117162793009971989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/6117162793009971989'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/03/field-sets-and-custom-styles-saving.html' title='Field Sets and Custom Styles - Saving Time And Adding Value'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-9087340664316224759</id><published>2011-02-24T18:17:00.003+11:00</published><updated>2011-02-25T08:18:31.398+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='timezones'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><title type='text'>Time Zones Hurt My Brain - One Way To Get The Time Offset</title><content type='html'>Today I needed (or at least I thought I did until I found out I didn't) to find out the difference in hours between the current user's time zone and GMT. A quick bit of searching around the internet didn't reveal anything spectacular; I found one method which involved pulling a describe on the timezone picklist and matching up the country part of it which you can get from &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;System.userInfo()&lt;/span&gt;, it didn't seem ideal and involved quite a lot of code.&lt;br /&gt;&lt;br /&gt;I realise there are various methods for getting times/dates in GMT and the local timezone and thought about how I could leverage something there to get the difference, after some fiddling and testing I came up with this:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;string strOffset = System.now().format('Z');&lt;br /&gt;string strOffsetHours = strOffset.substring(0,3);&lt;br /&gt;&lt;br /&gt;if(strOffsetHours.startsWith('+'))&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;strOffsetHours = strOffsetHours.substring(1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;integer iMinutes = 100 * integer.valueOf(strOffset.substring(3));&lt;br /&gt;double dOffset = double.valueOf(strOffsetHours + '.' + ((iMinutes) / 60));&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;It may seem a bit OTT but some time zones do have a half-hour or 45 minute offset in them, also the test for the + is because salesforce regards a string such as "+10" as an invalid number. Obviously the result of this code is a double representing the number of hours your are away from GMT, e.g. for where I am I get back 11.0, ergo I am eleventy hours ahead.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-9087340664316224759?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/9087340664316224759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/02/time-zones-hurt-my-brain-one-way-to-get.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/9087340664316224759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/9087340664316224759'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/02/time-zones-hurt-my-brain-one-way-to-get.html' title='Time Zones Hurt My Brain - One Way To Get The Time Offset'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-7563227931633010042</id><published>2011-02-22T10:34:00.000+11:00</published><updated>2011-02-22T10:34:08.182+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Chatter Desktop'/><category scheme='http://www.blogger.com/atom/ns#' term='Adobe AIR'/><category scheme='http://www.blogger.com/atom/ns#' term='Chatter'/><title type='text'>Chatter Desktop – Where's The Window? It's Not Showing!</title><content type='html'>More than once I've installed Chatter Desktop on my Mac and found that when I start it the window is nowhere to be seen! What's interesting is that if you fire up Exposé you'll find that you can hover the mouse where the window should be and see a big blue rectangle; this rectangle is usually a highlight around the window and this led me to think that maybe the window was transparent.&lt;br /&gt;&lt;br /&gt;I ran to the googles but couldn't find anything useful so instead decided to check out the application bundle and see if there might be something in there – it turns out my hunch was correct, and so here is the solution to a tedious problem. You need to edit a file in the bundle, typically it will be found in the directory &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;/Applications/salesforce.com/Chatter Desktop.app/Contents/Resources/META-INF/AIR&lt;/b&gt;&lt;/span&gt; and the file is called &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;application.xml&lt;/b&gt;&lt;/span&gt;. You can either navigate there via Terminal.app or you can navigate to &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;/Applications/salesforce.com&lt;/span&gt;&lt;/b&gt; and right-click on Chatter Desktop and choose "&lt;i&gt;Show Package Contents&lt;/i&gt;".&lt;br /&gt;&lt;br /&gt;Once you've got the file open you need to find this line:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;transparent&amp;gt;true&amp;lt;/transparent&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;and simply change it to&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;transparent&amp;gt;false&amp;lt;/transparent&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Save the file, start up Chatter Desktop et voilà, thar she blows.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Note&lt;/i&gt;: You will need administrator access to be able to edit the file as it's not in your user path, either install Chatter Desktop to your home folder rather than &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;/Applications&lt;/b&gt;&lt;/span&gt; or &lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;su&lt;/span&gt;&lt;/b&gt; to root in the terminal as I did and edit the file there (you'll need to setup a root password on your Mac to do this, if you don't understand what that means you probably shouldn't do it!).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-7563227931633010042?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/7563227931633010042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/02/chatter-desktop-wheres-window-its-not.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/7563227931633010042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/7563227931633010042'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/02/chatter-desktop-wheres-window-its-not.html' title='Chatter Desktop – Where&apos;s The Window? It&apos;s Not Showing!'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-4033153326367590187</id><published>2011-01-25T10:21:00.000+11:00</published><updated>2011-01-25T10:21:50.933+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>Forcing Internet Explorer to Download A Visualforce Page - WTF</title><content type='html'>Second post in two days – fastest updates ever for this blog. Anyway, sometimes you want to use Visualforce to return a file to a user, be it an excel file or outlook calendar item for example. You've probably gotten as far as specifying the content type in the page tag and then some bright spark has fired up that most cursed of browsers, Internet Explorer. They'll soon be telling you that Internet explorer is refusing to download the file you're creating – the solution to this annoyance (at least it was the solution for us and a few others I've seen online)? Specify &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cache="true"&lt;/span&gt; in the page tag too. &lt;br /&gt;&lt;br /&gt;That's it. I have no idea why IE should need this and I'm not about to spend the time looking into it because frankly I like to spend as little time as possible dealing with IE and it's various&amp;nbsp;idiosyncrasies.&amp;nbsp;Just for the sake of an example, here's the full page tag we're now using in our Visualforce page:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:page controller="QVFC_CalandarCreate" action="{!init}" contenttype="text/calendar#Calander.vcs" cache="true"&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-4033153326367590187?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/4033153326367590187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/01/forcing-internet-explorer-to-download.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4033153326367590187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4033153326367590187'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/01/forcing-internet-explorer-to-download.html' title='Forcing Internet Explorer to Download A Visualforce Page - WTF'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-7043918339620989733</id><published>2011-01-24T13:25:00.001+11:00</published><updated>2011-01-24T13:25:37.315+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='soql'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><title type='text'>Aggregate SOQl, When SUM (and friends!) Return Null</title><content type='html'>A quick snippet for those using aggregate SOQL queries: be aware that using &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;SUM&lt;/span&gt; on a field which may be null in some of the included records will return null as the value – I'm aware this is a simple issue but this post might save somebody somewhere two minutes of head scratching.&lt;br /&gt;&lt;br /&gt;For instance, if we have an Object (&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Object__c&lt;/span&gt;) with a number field called &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Score__c&lt;/span&gt; and we have 3 records with the values of 2, 4 and null in that field and run this query:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;select SUM(Score__c)Score from Object__c&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;and then use &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ar.get('Score')&lt;/span&gt;&amp;nbsp;(where &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ar&lt;/span&gt; is an aggregate result, &lt;a href="http://www.laceysnr.com/2010/05/aggregate-soql-handy-stuff.html"&gt;see my post on Aggregate SOQL&lt;/a&gt;) we'll be given &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;null&lt;/span&gt; as the sum, and chances are this isn't the desired result. Simply make sure that null values aren't included in the total by adding a where clause to the query as below, et voilà! – we'd then get back 6 as our sum.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;select SUM(Score__c)Score from Object__c where Score__c != null&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-7043918339620989733?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/7043918339620989733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2011/01/aggregate-soql-when-sum-and-friends.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/7043918339620989733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/7043918339620989733'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2011/01/aggregate-soql-when-sum-and-friends.html' title='Aggregate SOQl, When SUM (and friends!) Return Null'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-5364335253328933901</id><published>2010-12-01T09:12:00.000+11:00</published><updated>2010-12-01T09:17:49.435+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='batch apex'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><category scheme='http://www.blogger.com/atom/ns#' term='pdf generation'/><category scheme='http://www.blogger.com/atom/ns#' term='google charts'/><title type='text'>Using Images (e.g. Google Charts) in Visualforce PDFs</title><content type='html'>Recently one of my colleagues was attempting to save a PDF version of a page which included Google chart images (for those that don't know the mighty G have a chart API where you can send data and get a nice image back), but when the generated PDF was viewed the images were always missing.&lt;br /&gt;&lt;br /&gt;We thought at first it may simply be a case of the images not loading quickly enough and the renderer not bothering to wait for them, but then after a bit more googling we eventually discovered the solution and frankly I was astounded that the penny hadn't dropped earlier.&lt;br /&gt;&lt;br /&gt;Anytime when you want to make a callout from apex code you have to ensure that you have the end point specified in the Remote Site Settings (Setup -&amp;gt; Administration Setup -&amp;gt; Security Controls -&amp;gt; Remote Site Settings), otherwise the callout is blocked. Of course when displaying a Visualforce page to a user containing an image it's their browser making the request, when the PDF renderer it is code on the org making the request and as such gets denied access if you've not expressly allowed it.&lt;br /&gt;&lt;br /&gt;A side note regarding callouts: for some reason when writing batch apex code be aware that although you get a fresh set of governor limits for each invocation of the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;execute&lt;/span&gt; method, the one limit that appears to be different to the standard environment is the number of callouts allowed - you're only allowed to make one each time meaning you'll want to run the class with the optional batch size parameter set to 1.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-5364335253328933901?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/5364335253328933901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/12/using-images-eg-google-charts-in.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/5364335253328933901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/5364335253328933901'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/12/using-images-eg-google-charts-in.html' title='Using Images (e.g. Google Charts) in Visualforce PDFs'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-3250540646089590975</id><published>2010-11-26T15:11:00.000+11:00</published><updated>2010-12-01T09:17:49.437+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>Phantom Date Picker</title><content type='html'>After the latest release I'm often seeing a phantom date picker with screwy styling when I create a new VF page that doesn't use any typical page blocks etc. (I'm not entirely sure what causes it's appearance as I've not used any standard UI components in a while) - if you see this and you're not using standard components you can hide it again by specifying&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;standardStylesheets="false"&lt;/span&gt; in your &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:page&lt;/span&gt; tag.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-3250540646089590975?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/3250540646089590975/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/11/phantom-date-picker.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3250540646089590975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3250540646089590975'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/11/phantom-date-picker.html' title='Phantom Date Picker'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-4395596735679410350</id><published>2010-11-04T10:47:00.000+11:00</published><updated>2010-12-01T09:17:49.437+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>apex:actionFunction and apex:param - Or How to Pass Values from Javascript to an Apex Controller</title><content type='html'>Just a quickie, because I've been beating my head against a wall for a couple of hours over this and no amount of Googling could help me find the answer.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Scenario&lt;/i&gt;: I want to pass values back to a Visualforce controller without having to resort to hidden input fields and using the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;{!$Component.&amp;lt;&amp;lt;fieldid&amp;gt;&amp;gt;}&lt;/span&gt; notation because that's only evaluated when the page is generated and so doesn't lend itself well to dynamic setups.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;The problem&lt;/i&gt;: All of the solutions I was able to find involved using an &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:actionFunction&lt;/span&gt; with nested &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;apex:param&lt;/span&gt; tags (e.g. see &lt;a href="http://forums.sforce.com/t5/Visualforce-Development/Passing-values-from-Javascript-to-Controller/m-p/154910/highlight/true"&gt;here&lt;/a&gt; and &lt;a href="http://blog.sforce.com/sforce/2009/10/passing-javascript-values-to-apex-controller.html"&gt;here&lt;/a&gt;), which is fine except that whenever I tried this the generated javascript function never had any parameters, i.e. &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;doStuff() {...}&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:actionFunction name="doStuff" action="{!myAction}"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:param name="x" value="x" assignTo="{!m_x}"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/apex:actionFunction&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;i&gt;Solution&lt;/i&gt;: You must specify a rerender attribute in the apex:actionFunction tag! Without this the generated function does take any parameters, but as soon as you put it in then it does - even if you just leave it empty, i.e. the below code will generate &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;doStuff(x) {...}&lt;/span&gt; Go figure :)&lt;br /&gt;&lt;blockquote&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:actionFunction name="doStuff" action="{!myAction}" rerender=""&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;apex:param name="x" value="x" assignTo="{!m_x}"/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;/apex:actionFunction&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-4395596735679410350?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/4395596735679410350/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/11/apexactionfunction-and-apexparam-or-how.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4395596735679410350'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4395596735679410350'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/11/apexactionfunction-and-apexparam-or-how.html' title='apex:actionFunction and apex:param - Or How to Pass Values from Javascript to an Apex Controller'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-5678272536140860642</id><published>2010-10-24T11:54:00.000+11:00</published><updated>2010-12-01T09:14:05.757+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mandelbrot Set'/><category scheme='http://www.blogger.com/atom/ns#' term='Buddhabrot'/><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><title type='text'>Attack of the Buddahbrot</title><content type='html'>A few months ago I purchased a fantastic book from a dusty local bookshop almost purely on the basis of it's fascinating name:&amp;nbsp;&lt;a href="http://www.amazon.com/Magic-Machine-Handbook-Computer-Sorcery/dp/0716721449/ref=sr_1_1?ie=UTF8&amp;amp;qid=1287878319&amp;amp;sr=8-1"&gt;The Magic Machine - A Handbook of Computer Sorcery&lt;/a&gt;;&amp;nbsp;indeed, I have the hardback edition but I do like the somewhat retro cover of the paperback on Amazon.&lt;br /&gt;&lt;br /&gt;In case you were too lazy to click the above link then allow me to present the description as detailed on the Amazon store page:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, helvetica, sans-serif; font-size: small;"&gt;This is the second collection of A. K. Dewdney's popular "Computer Recreations" columns, drawn from "Scientific American". The author discusses some of today's hottest topics including chaos, computer viruses, and artificial landscapes. The computer recreations described here range from purely entertaining brain teasers to more practical computer applications of scientific thought. 26 programs are included that require only moderate programming skills. There are Mathemagical movies, a miniature universe, puzzles, wordplay, and simple programs that produce striking effects. Dewdney's clear directions allow homecomputer owners to sit at the computer and try each one of them.&lt;/span&gt;&lt;/blockquote&gt;"Today's hottest topics" being interesting computer based topics from around the mid to late 80s - but nevertheless I found the book enthralling, I couldn't stop reading it. I think the reason for this is that these were the hot topics when I was growing up and starting to cut my programming teeth with BASIC on the Atari ST. I vividly remember seeing the Mandelbrot set for the first time on TV and soon obtained a program on a magazine cover disk that allowed me to explore it for myself.&lt;br /&gt;&lt;br /&gt;The first chapter of Dewdney's book describes the set and how it's generated and without hesitation I put the book down, fired up XCode and had it drawing on my screen about thirty minutes later (having faffed about SDL sorted for easy hassle free&amp;nbsp;frame buffer&amp;nbsp;access and keyboard input - I've still not got around to sitting down properly with Cocoa Programming for Mac OS X to learn the Apple way of doing it). I played around with the program a bit, making it cycle the colour palette giving a particularly trippy effect, and then it dawned on me to compile it as a 64-bit application so as to obtain even greater magnification. For some reason I found it particularly amusing to keep zooming until I'd maxed out the resolution of a 64-bit floating point variable, as you start to run out of bits to work with the display gets progressively blockier as you'd expect, and then you zoom back out to see just how far in you've gone.&lt;br /&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_LHvSUi1x6b8/TMN5qT5K0wI/AAAAAAAAAcY/eTvQLnrPIVs/s1600/mandelbrot.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="207" src="http://3.bp.blogspot.com/_LHvSUi1x6b8/TMN5qT5K0wI/AAAAAAAAAcY/eTvQLnrPIVs/s320/mandelbrot.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;A screenshot of my set render running, this isn't the whole set, rather one of the self-similar &amp;nbsp;shapes visible when you zoom in on certain areas of the set.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Following the recent passing of Benoît Mandelbrot I was snooping around again and suddenly stumbled across the Buddahbrot. This is a way of visualising the inner workings of the set - a recursive complex-number calculation where a series of complex numbers are tested one after the other. Essentially after n-iterations points tested will either lie within the set, or they'll have gone AWOL and made for the moon. In the traditional renderings of the set the black portions actually represent numbers which lie within the set, the coloured areas representing the points which have escaped, and the colour chosen indicates how quickly they escaped.&lt;br /&gt;&lt;br /&gt;Dewdney's book has a section where he describes a tour on the Mandelbus, an imaginary bus on the complex plane which starts at a given point and follows the path of the calculation of that point. It is in fact this bus' route that is rendered when generating the Buddahbrot. For every point determined to lie within the set, it's calculation is repeated and for each position it visits we chalk up another hit in the output array. I played around with settings and colours, and decided that I wanted to see an even bigger view of the Buddahbrot I was rendering. Unfortunately 'zooming in' does not work as it does with the typical Mandelbrot rendering; Since the points can and do move about wildly during calculations what you see in your window will result on points outside of it, so the only real way to get in closed is to render a larger image. Last night I generated two 4800x3200 pixel images (dumped out as raw image data at the end of the render process) which I then imported into GIMP to scale and save for the web - the raw data being standard 32-bit ARGB data clocked in at just shy of 60 megabytes. Despite scaling my output data so that contrast was stretched fully across the available range in an attempt to get good output, I didn't reckon on such a skewed distribution of values. The vast majority (99% at a guess) of pixels ended up with colour values in the 0-16 range, so a few curve tweaks really brought out the best of the detail albeit with the associated detail loss. You can see the (cropped and scaled) result below. Moving forward I'll modify the contrast stretch to use a histogram&amp;nbsp;equalisation&amp;nbsp;as in simply scaling by the maximum values I clearly lost a huge amount of colour resolution for most of the image.&lt;br /&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_LHvSUi1x6b8/TMN9lB_grQI/AAAAAAAAAcc/i_LYd-ffHT4/s1600/renderforweb.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/_LHvSUi1x6b8/TMN9lB_grQI/AAAAAAAAAcc/i_LYd-ffHT4/s320/renderforweb.jpg" width="305" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;JPEG of the first rendered image, click for big! Even in this scaled down image you can see some of the intricate detail.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;I pretty much a large part of the day in awe of various renderings, 1200x800 pixel images were quite quick to create, and watching them draw was also interesting; I currently have a black/purple ankle which I can't walk on so the day was well spent exercising my imagination/brain instead of my body. The large render took a little over 90 minutes to complete, using 131,072 (yes, I like powers of two) iterations for the red channel, 262,144 for the green and twice as many again for the blue channel. I modified the colour curves in GIMP but it was these different iteration values which account for the distinct different-coloured features. Also I used &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;rand()&lt;/span&gt; to determine which points to iterate (varying the probability of rejection for each colour channel) and this is what causes the non-symmetrical nature of the image. Next up I intend to make an even larger render to see more detail, but that will have to wait until I can sit at a table - maxing out the CPU for an hour and a half was bad enough with the machine on my lap while I did other things!&lt;br /&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_LHvSUi1x6b8/TMOA5jeKxgI/AAAAAAAAAcg/nn0lmY1SkCs/s1600/renderforweb2.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="187" src="http://1.bp.blogspot.com/_LHvSUi1x6b8/TMOA5jeKxgI/AAAAAAAAAcg/nn0lmY1SkCs/s320/renderforweb2.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;JPEG of part of the second render at 100%, hopefully modifying my colour scaling will result in a less 'noisy' image, but that's only a guess on my part at the moment - I'm pretty sure it'll also require an increased number of iterations.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;style type="text/css"&gt;p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px ProggySmall; color: #1630df}&lt;/style&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-5678272536140860642?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/5678272536140860642/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/10/attack-of-buddahbrot.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/5678272536140860642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/5678272536140860642'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/10/attack-of-buddahbrot.html' title='Attack of the Buddahbrot'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_LHvSUi1x6b8/TMN5qT5K0wI/AAAAAAAAAcY/eTvQLnrPIVs/s72-c/mandelbrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-3649713436986067423</id><published>2010-09-09T12:58:00.000+10:00</published><updated>2010-12-01T09:17:49.438+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>Displaying Number Fields as Integers on Visualforce Pages</title><content type='html'>It always bugs me that when displaying number fields on a Visualforce page it's rendered as a decimal, I know all numbers in the database are decimal, and I know why they use that even if you choose zero decimal places for the field, but it's still irksome. Often I've used classes which mimic the object and used f&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ield__c.intValue()&lt;/span&gt; to assign the value to an integer member of the class, then displayed that class. This is a bit of a pain and also excessive and it finally occurred to me to check what functions are available in Visualforce pages for manipulating the merge fields.&lt;br /&gt;&lt;br /&gt;Lo and behold, there is a &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;FLOOR()&lt;/span&gt; function! Really should have guessed this sooner, but there you go. So to display a nice integer on the page simply do:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;{!FLOOR(myobj.number_field__c)}&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Job done.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-3649713436986067423?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/3649713436986067423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/09/displaying-number-fields-as-integers-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3649713436986067423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3649713436986067423'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/09/displaying-number-fields-as-integers-on.html' title='Displaying Number Fields as Integers on Visualforce Pages'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-2373676865788706403</id><published>2010-08-06T15:51:00.001+10:00</published><updated>2010-12-01T09:17:49.439+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='soql'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><title type='text'>SOQL Paging Data from the Database - Avoiding The 10,000 record limit</title><content type='html'>In some work I'm doing at the moment we're exposing quite a lot of data via web services and we were pretty confident that we'd never have to worry about any of the governor limits. However, the number of records grew and grew and eventually we slammed into the 10,000 row limit on a query. So how to get this data back? Using queryMore won't work since the calls in are unrelated, so some kind of "select everything from this point onwards" is needed along with a "limit x".&lt;br /&gt;&lt;br /&gt;At first I thought why not just sort by id and then use where id &amp;gt; previous, but upon doing some research with the mighty google found out that you can't use the &amp;gt; and &amp;lt; operators with id fields. While reading about that I stumbled across a great work around (I forget where I read it, if I remember I'll link to it) - you can just create a formula field (of string type) on the object which takes the id as it's value. Voila, you can then use the &amp;gt; and &amp;lt; operators!&lt;br /&gt;&lt;br /&gt;All that remains is to limit the query to some number, if the number of rows returned is the same as the limit then I make the assumption that there is more to come and return the id of the last record in the web service response. The client then knows to make another call, passes that id and I simply run the same query with where IDFormula__c &amp;gt; IDprevious. For the case where the call is made with no id, the empty string ('') comes first when using &amp;gt; so presents no issues.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-2373676865788706403?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/2373676865788706403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/08/soql-paging-data-from-database-avoiding.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2373676865788706403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2373676865788706403'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/08/soql-paging-data-from-database-avoiding.html' title='SOQL Paging Data from the Database - Avoiding The 10,000 record limit'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-6561989107387492305</id><published>2010-07-27T13:31:00.002+10:00</published><updated>2010-12-01T09:17:49.440+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>Head Banger</title><content type='html'>Last night I spent around half an hour trying to work out why my constructor wasn't running in a Visualforce controller class. The code was your regular stuff, looking like this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;public with sharing class MyController&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;boolean&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;mp_bMemberVar&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{get; set;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public void MyController()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// stuff&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public void Init()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// etc..&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Can you spot the problem? Somehow in my haste I'd included the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;void&lt;/span&gt; keyword in there... so my constructor wasn't a constructor at all and as such, not being called when I expected it to. A warning on save would have been nice!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-6561989107387492305?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/6561989107387492305/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/07/head-banger.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/6561989107387492305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/6561989107387492305'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/07/head-banger.html' title='Head Banger'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-2706033873173992373</id><published>2010-06-04T21:46:00.001+10:00</published><updated>2010-12-01T09:17:49.443+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Haikuware'/><category scheme='http://www.blogger.com/atom/ns#' term='haiku'/><category scheme='http://www.blogger.com/atom/ns#' term='Boids Screensaver'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><title type='text'>Updated Boids!</title><content type='html'>I've just updated by Boids screensaver on Haikuware, you can&amp;nbsp;&lt;a href="http://www.haikuware.com/directory/view-details/utilities/screensavers/boids-screensaver"&gt;grab it here&lt;/a&gt;&amp;nbsp;- let me know what you think. A few points to note:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;It only supports 32, 16 and 15 bit colour modes, and I've only tested 32 myself. This is because I'm using a BDirectWindow and haven't goten around to writing the other drawing routines yet!&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;When you have long trails with lots of boids you can see some rendering errors, this is because there's no depth testing or sorting going on, I did some experiments with alpha blending and found that reading back from the buffer killed performance, must research some kind of double buffering&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: center;"&gt;The obligatory screenshot:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_LHvSUi1x6b8/TAjnU7gbwSI/AAAAAAAAAcI/SgoARO9tZuw/s1600/boids.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="250" src="http://1.bp.blogspot.com/_LHvSUi1x6b8/TAjnU7gbwSI/AAAAAAAAAcI/SgoARO9tZuw/s400/boids.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Maybe at some point I'll add alternative colours and more, who knows?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-2706033873173992373?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/2706033873173992373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/06/updated-boids.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2706033873173992373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/2706033873173992373'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/06/updated-boids.html' title='Updated Boids!'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_LHvSUi1x6b8/TAjnU7gbwSI/AAAAAAAAAcI/SgoARO9tZuw/s72-c/boids.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-3354531464889314182</id><published>2010-05-31T23:56:00.005+10:00</published><updated>2010-12-01T09:17:49.444+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='soql'/><category scheme='http://www.blogger.com/atom/ns#' term='aggregate functions'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><title type='text'>Aggregate SOQL, Handy Stuff</title><content type='html'>As most people are aware, one of the big features included in the API 18.0 release for Salesforce was aggregate functions for SOQL queries. Essentially these boil down to those functions that most people are used to having in SQL, i.e. you can do things like count a number of rows which fulfill a particular criteria, or sum the fields of rows. They come along with the very handy &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;GROUP BY&lt;/span&gt; clause which allows you to roll up your data rather nicely.&lt;br /&gt;&lt;br /&gt;So for example, if I have a &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Transaction__c&lt;/span&gt; object which includes information such as a customer's ID (&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Cust_ID__c&lt;/span&gt;) and an amount paid (let's go wild and call it &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Amount__c&lt;/span&gt;), we could find the total spent for each customer by using &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;SUM&lt;/span&gt; on the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Amount__c&lt;/span&gt; field and group the results according to the customer IDs.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;select Cust_ID__c, SUM(Amount__c) from Transaction__c group by Cust_ID__c&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Something to note here is that you have to group by all fields which aren't used in an aggregate function, so maybe if a customer could have multiple accounts and there was another field &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Account_Number__c&lt;/span&gt; which we'd want to select also, we'd have to group by the customer ID and then account number field.&lt;br /&gt;&lt;br /&gt;A major difference between queries which use aggregate functions and those that don't is that while a regular query returns records of the type queried (i.e. grabbing fields from Opportunity will return a list of Opportunity objects), aggregate queries return collections of &lt;i&gt;AggregateResult&lt;/i&gt; objects. This means that you can't put results into a collection of &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Transaction__c&lt;/span&gt; objects for example, but apart from that the only real difference is that you can't simply grab field values using the .&lt;i&gt;fieldname&lt;/i&gt; notation. Instead you have to use &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;.get()&lt;/span&gt; passing the field name as a string.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;for(AggregateResult ar : listResults)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mapCustIDToTotal.put(ar.get('Cust_ID__c'), ar.get('expr0'));&lt;br /&gt;}&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The ugly looking &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;'expr0'&lt;/span&gt; simply means expression 0, meaning the 0th expression in the query which in this case happens to also be the only one, the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;SUM&lt;/span&gt; of the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Amount__c&lt;/span&gt; field; if we had another field called &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Refunded__c&lt;/span&gt; which we also used with &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;SUM&lt;/span&gt; immediately after the amount then that would be referred to by&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;'expr1'&lt;/span&gt;. Using names for the fields as you can do with any other query makes this all a little neater.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;double dTotalForAll = 0;&lt;br /&gt;&lt;br /&gt;for(AggregateResult ar : [select Cust_ID__c, SUM(Amount__c) TotalAmount&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;from Transaction__c group by Cust_ID__c])&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dTotalForAll += ar.get('TotalAmount');&lt;br /&gt;}&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Obviously this is a slightly contrived example but hopefully you get the picture!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-3354531464889314182?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/3354531464889314182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/05/aggregate-soql-handy-stuff.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3354531464889314182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3354531464889314182'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/05/aggregate-soql-handy-stuff.html' title='Aggregate SOQL, Handy Stuff'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-6375693148246921319</id><published>2010-05-27T10:12:00.000+10:00</published><updated>2010-12-01T09:17:49.445+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='haiku'/><category scheme='http://www.blogger.com/atom/ns#' term='Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>Call To Arms - Haiku Application Developers Required!</title><content type='html'>This is just a quick post for those people who aren't necessarily programmers, but would like to learn and help out a good cause in the process. Haiku (&lt;a href="http://www.haiku-os.org/"&gt;www.haiku-os.org&lt;/a&gt;) is a fantastic and very promising operating system in need of native applications.&lt;br /&gt;&lt;br /&gt;If you'd like to to learn how to program and use an incredibly well crafted C++ API then look no further than&amp;nbsp;&lt;a href="http://www.haiku-os.org/blog/darkwyrm"&gt;Darkwyrm's Blog&lt;/a&gt;&amp;nbsp;on the Haiku website, he has a tutorial series underway - beginning with C++ fundamentals and moving onto Haiku application development (starting at Lesson 14). This is a great chance to learn new skills and help out in a community where every extra helping hand goes a long way.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-6375693148246921319?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/6375693148246921319/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/05/call-to-arms-haiku-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/6375693148246921319'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/6375693148246921319'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/05/call-to-arms-haiku-application.html' title='Call To Arms - Haiku Application Developers Required!'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-4956676758693286890</id><published>2010-05-10T12:52:00.002+10:00</published><updated>2010-12-01T09:17:49.446+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><title type='text'>Remembering References</title><content type='html'>This should be common knowledge for any Apex developer but it can be easy to forget at times and may be confusing to those new to the platform (especially if you're not from a Java background). When you create a variable using a primitive type, for example the Integer type, that variable represents the Integer; when you create an instance of a class using &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;new&lt;/span&gt; your variable stores a reference to the object.&lt;br /&gt;&lt;br /&gt;This can come in very handy when dealing with maps and other collections:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;public class MyClass&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public Integer m_iVal {get; set;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public MyClass(Integer iVal)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;m_iVal = iVal;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;Map&lt;/span&gt;&lt;integer, myclass=""&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; myMap = new Map&lt;/span&gt;&lt;integer, myclass=""&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;();&lt;br /&gt;&lt;br /&gt;// put some objects in the map&lt;br /&gt;myMap.put(0, new MyClass(3));&lt;br /&gt;myMap.put(1, new MyClass(6));&lt;/span&gt; &lt;br /&gt;&lt;/integer,&gt;&lt;/integer,&gt;&lt;/blockquote&gt;Now we can use get to retrieve the reference to the object, and then we can use that reference to modify the object:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;MyClass valueOne = myMap.get(1);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;valueOne.m_iVal = 9;&lt;/span&gt;&lt;/blockquote&gt;Now if you looked at the value stored in m&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;yMap.get(1).m_iVal&lt;/span&gt; you would find that it's 9. Of course, Strings are immutable (you can not change them) and so act like other primitive types, i.e. if this was a map of Strings or Integers then when you use &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;.get()&lt;/span&gt; you actually get a copy of the object in the map, not a reference, so changing it will not affect the object stored in the map.&lt;br /&gt;&lt;br /&gt;You can even put your object reference into another collection and then modify it from there - which can be very handy in triggers when you need to create a custom way of looking up objects being passed to the trigger by some other field.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-4956676758693286890?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/4956676758693286890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/05/remembering-references.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4956676758693286890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4956676758693286890'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/05/remembering-references.html' title='Remembering References'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-8312137750895590997</id><published>2010-04-21T14:04:00.001+10:00</published><updated>2010-12-01T09:17:49.447+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><category scheme='http://www.blogger.com/atom/ns#' term='mac'/><title type='text'>Take Me Home -or- How to Make Home and End Work in Eclipse on the Mac</title><content type='html'>I do all of my Salesforce Apex development using Eclipse on a Mac. This is fine except for the Home and End keys on the external keyboard that I use - yes I know there are short cuts on the Mac to move to the end of the line, select to the end of the line etc. but that doesn't stop me from hitting either Home or End from time to time, the result being instant profanity as the screen jumps to the top or bottom of the current file.&lt;br /&gt;&lt;br /&gt;I couldn't find a solution for a while but finally today I ran across a blog called &lt;a href="http://www.rojotek.com/blog"&gt;Rob@Rojotek&lt;/a&gt; which &lt;a href="http://www.rojotek.com/blog/2009/06/12/making-the-home-and-end-keys-work-in-eclipse-34-on-apple-mac-osx/"&gt;has the solution right here&lt;/a&gt;. I would post the solution here directly but I don't believe in stealing other people's ideas and/or content, however what I will put here is a quote from the post which I found most amusing and very true:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;h3&gt;"After doing this, expect your anger at eclipse on Mac to decrease to much more manageable levels."&lt;/h3&gt;&lt;/blockquote&gt;&lt;br /&gt;My anger levels have dropped already.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-8312137750895590997?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/8312137750895590997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/04/take-me-home-or-how-to-make-home-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/8312137750895590997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/8312137750895590997'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/04/take-me-home-or-how-to-make-home-and.html' title='Take Me Home -or- How to Make Home and End Work in Eclipse on the Mac'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-4042477960115043677</id><published>2010-04-15T11:44:00.001+10:00</published><updated>2010-12-01T09:17:49.448+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='visualforce'/><title type='text'>Multi-Selection VisualForce selectLists</title><content type='html'>A fellow dev was having an issue with these, he was getting a strange error when trying to submit a form which included two such lists about not being able to save the values to the controller variables specified.&lt;br /&gt;&lt;br /&gt;It turned out the problem was that in the controller he had a member variable defined as follows:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;String m_strArray [] {get; set;}&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;And that was what he was using "m_strArray" for the value parameter of the selectList. The problem is that the select list doesn't create a string array, it simply writes to the one specified - so in this case it didn't have one to write to. The problem was simply solved by creating the array instance in the constructor for the controller:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;m_strArray = new String[]{};&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-4042477960115043677?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/4042477960115043677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/04/multi-selection-visualforce-selectlists.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4042477960115043677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4042477960115043677'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/04/multi-selection-visualforce-selectlists.html' title='Multi-Selection VisualForce selectLists'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-31897613470050153</id><published>2010-04-14T17:28:00.000+10:00</published><updated>2010-12-01T09:17:49.449+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><title type='text'>On Test Methods</title><content type='html'>I hate the test methods that need to be written in Salesforce. I can vaguely see how they're a good thing but to me they're nothing but a pain in the butt - the more error checking you put in your code the harder it is to get coverage, so if you do something like:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;MyObject__c obj = new MyObject__c();&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;obj.Name = 'obj';&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;try&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;insert obj;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;catch(Exception e)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// add an error message to the page&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;}&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;you're going to have a hard time to cover whatever code you put in the catch block. Granted an exception should probably never be thrown in 99% of these situations, but for those of us who write defensive code the coverage requirement can just seem like a twisted punishment for being careful.&lt;br /&gt;&lt;br /&gt;When it comes to callouts things are no better. I usually create a private boolean called &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;m_bIsTest&lt;/span&gt; &amp;nbsp;which the test method can set to true (as it's in the same class) then use &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;m_bIsTest&lt;/span&gt; to tell me if I need to fake the callout; I'm writing extra code which bypasses functionality just for the sake of these test classes. With careful coding this will never be an issue but it does strike me as an odd situation - who watches the watchmen?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-31897613470050153?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/31897613470050153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/04/on-test-methods.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/31897613470050153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/31897613470050153'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/04/on-test-methods.html' title='On Test Methods'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-3275905261960518437</id><published>2010-03-30T10:42:00.001+11:00</published><updated>2010-12-01T09:17:49.450+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><title type='text'>String Splitting</title><content type='html'>Another quick Apex heads up, if you have a string which contains pipe delimited values (e.g. &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;'hello|world'&lt;/span&gt;) then if you want to grab the parts using the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;.split()&lt;/span&gt; string method you need to doubly escape the pipe as it's a special character (OR) for regex:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;string strHello = 'hello|world';&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;list&amp;lt;string&amp;gt; liParts = strHello.split('\\|');&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;If you just use &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;'|'&lt;/span&gt; you'll find &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;split()&lt;/span&gt; returns a list of every character, not very useful in this situation! The reason you need to doubly escape it is because it needs to be escaped for the regex, i.e. &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;'\|'&lt;/span&gt; but the backslash itself needs to be escaped, so &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;'\\|'&lt;/span&gt; results in &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;'\|'&lt;/span&gt; being used as the regex for the operation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-3275905261960518437?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/3275905261960518437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/03/string-splitting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3275905261960518437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/3275905261960518437'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/03/string-splitting.html' title='String Splitting'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-4044923890720234974</id><published>2010-03-24T13:33:00.004+11:00</published><updated>2010-12-01T09:17:49.451+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salesforce'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='apex'/><category scheme='http://www.blogger.com/atom/ns#' term='debugging'/><title type='text'>Easier to Spot Debug Output in Apex</title><content type='html'>I often find that the standard:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;system.debug('blah');&lt;/span&gt;&lt;/blockquote&gt;in Apex can be difficult to spot in the logs. To make it easier just have a function that takes a string and shoves a few new lines around it automagically:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;public void EasyDebug(string strOut)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;System.Debug('\n\n\n' + strOut + '\n\n\n');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;}&lt;/span&gt;&lt;/blockquote&gt;It just saves you the hassle of writing &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;\n&lt;/span&gt; all the time which does my nut when I change between keyboards (laptop &amp;amp; MS natural keybuck) as I forever hit the wrong keys, and you can always spice it up with a row of &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;*****&lt;/span&gt;'s or something for that extra pop factor. Of course, you'll realise that this only takes a string, so what if you want to debug any time of object? Just use &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;''+&lt;/span&gt; to convert it using the same routines &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;System.Debug()&lt;/span&gt; uses:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;list&amp;lt;string&amp;gt;&lt;string&gt;&lt;string&gt; liStrings = new list&amp;lt;string&amp;gt;&lt;string&gt;&lt;string&gt;{'hello,', 'world!'};&lt;/string&gt;&lt;/string&gt;&lt;/string&gt;&lt;/string&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;EasyDebug('' + liStrings);&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-4044923890720234974?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/4044923890720234974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/03/easier-to-spot-debug-output-in-apex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4044923890720234974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/4044923890720234974'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/03/easier-to-spot-debug-output-in-apex.html' title='Easier to Spot Debug Output in Apex'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-8398576475089586785</id><published>2010-03-19T16:53:00.001+11:00</published><updated>2010-12-01T09:17:49.452+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='haiku'/><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><category scheme='http://www.blogger.com/atom/ns#' term='screensaver'/><title type='text'>Boids Screensaver</title><content type='html'>&lt;a href="http://www.haikuware.com/directory/view-details/utilities/screensavers/boids-screensaver"&gt;I updated this on www.haikuware.com last week&lt;/a&gt;, added a couple of config options and think I maybe have found a bug in Haiku too... For some reason when the settings view is first initialised if you drag a slider all the way to the left extreme it doesn't fire off a message to say so, so if you want the minimum trail length / num boids you have to move the slider thinger and release before moving it again all the way left.&lt;br /&gt;&lt;br /&gt;Preview still doesn't work - pretty sure that's just me not using the right screen coordinates or something - will check it out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-8398576475089586785?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/8398576475089586785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/03/boids-screensaver.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/8398576475089586785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/8398576475089586785'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/03/boids-screensaver.html' title='Boids Screensaver'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-1911175996544899936</id><published>2010-03-13T22:37:00.001+11:00</published><updated>2010-03-30T11:17:05.387+11:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='haiku'/><title type='text'>It's Alive!</title><content type='html'>I will post a follup to my previous post when I get around to it. Screensaver is sitll a WIP and once I've fixed a crash I'll upload a new version to haikuware.com.&lt;br /&gt;&lt;br /&gt;All I want to say now is how astounded I am at this point in time. It seems like yesterday that I was playing with a first demo of the App Server, with fake window decorations moving around a plain grey 'window'.&lt;br /&gt;&lt;br /&gt;Now I've just updated my native Haiku install, I'm using a modern browser (lacking fluff features but it does what I need - renders web pages) over a wireless connection and it's flying. Happy days indeed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-1911175996544899936?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/1911175996544899936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/03/its-alive.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/1911175996544899936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/1911175996544899936'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/03/its-alive.html' title='It&apos;s Alive!'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4061740313877866897.post-8155371338324025138</id><published>2010-03-07T17:31:00.000+11:00</published><updated>2010-03-07T17:33:41.711+11:00</updated><title type='text'>Hello, World!</title><content type='html'>I signed up for a blog account - I don't intend to write much but I'm planning to start poking around with Haiku development and thought it'd be a good idea to be able to make notes somewhere that others can read should they need/want to.&lt;br /&gt;&lt;br /&gt;Today I've been playing around inside Haiku and started work on a screensaver... it doesn't draw anything yet because I can't seem to get direct drawing working, but when I do I'll be sure to post how I got it working because it's been annoying me all day.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4061740313877866897-8155371338324025138?l=www.laceysnr.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.laceysnr.com/feeds/8155371338324025138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.laceysnr.com/2010/03/hello-world.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/8155371338324025138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4061740313877866897/posts/default/8155371338324025138'/><link rel='alternate' type='text/html' href='http://www.laceysnr.com/2010/03/hello-world.html' title='Hello, World!'/><author><name>Matt Lacey</name><uri>https://profiles.google.com/111827922894049648255</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-taxx-xJfKIg/AAAAAAAAAAI/AAAAAAAAAmI/cHpkkobvg54/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry></feed>
