<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Deadlypenguin</title>
	<atom:link href="http://blog.deadlypenguin.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.deadlypenguin.com/blog</link>
	<description>My notes and rants about tech things</description>
	<lastBuildDate>Thu, 17 May 2012 08:41:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Salesforce and soapUI &#8211; Using the default query method</title>
		<link>http://blog.deadlypenguin.com/blog/2012/04/13/salesforce-and-soapui-using-the-default-query-method/</link>
		<comments>http://blog.deadlypenguin.com/blog/2012/04/13/salesforce-and-soapui-using-the-default-query-method/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 13:40:14 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[developement]]></category>
		<category><![CDATA[salesforce]]></category>
		<category><![CDATA[apex]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[web-service]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=194</guid>
		<description><![CDATA[In a previous post I discussed how to test Salesforce webservices with soapUI.  In this post I will show how to use the &#8220;default&#8221; methods inside the enterprise WSDL. Logging In First we need to login to Salesforce and get &#8230; <a href="http://blog.deadlypenguin.com/blog/2012/04/13/salesforce-and-soapui-using-the-default-query-method/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In a <a title="Salesforce and soapUI – Testing WebServices directly" href="http://blog.deadlypenguin.com/blog/2012/02/03/salesforce-and-soapui/">previous post</a> I discussed how to test Salesforce webservices with <a title="soapUI" href="http://www.soapui.org/">soapUI</a>.  In this post I will show how to use the &#8220;default&#8221; methods inside the enterprise WSDL.</p>
<h2>Logging In</h2>
<p>First we need to login to Salesforce and get our session Id.  Under the SoapBinding list, expand <em>login</em> and choose <em>Show Request Editor</em>.  After opening the request editor we need to remove the extra headers we don’t need, and fill in our username and password.</p>
<p><img class="alignnone" title="Logging In" src="https://lh6.googleusercontent.com/-R29KCCqYEDQ/TywQsXvIXdI/AAAAAAAAAG4/D5JD7CA1KTg/s610/login.png" alt="Logging In" width="610" height="494" /></p>
<p>Then press the “play” button to send the request</p>
<p><img class="alignnone" title="Login Play" src="https://lh6.googleusercontent.com/-T13axXQ9790/TywQsQrsAGI/AAAAAAAAAG8/lQuLGKF2gds/s610/login_play.png" alt="Login Play" width="610" height="494" /></p>
<p>Now in the resulting XML we can pull out our session Id</p>
<p><img class="alignnone" title="SessionId" src="https://lh3.googleusercontent.com/-aQCnHIFCRXs/TywuEBL22uI/AAAAAAAAAHY/W2yuikOcu7k/s805/sessionId.png" alt="SessionId" width="805" height="280" /></p>
<p>And we can pull out our server Url</p>
<p><img class="alignnone" title="Server Url" src="https://lh3.googleusercontent.com/-o62pnMGFGb8/T4gpKWoJ06I/AAAAAAAAAI4/48DrE0iUW9U/s802/serverurl.png" alt="Server Url" width="802" height="224" /></p>
<h2>Adding the new endpoint</h2>
<p>If we create a new query request and remove the unneeded headers and insert our session Id and run the request you get the following error:</p>
<blockquote><p>UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService</p></blockquote>
<p>To fix this issue we need to add a new end point to our SOAP request.  Using the server Url obtained during login we can add it to our request</p>
<p><img class="alignnone" title="New end point" src="https://lh3.googleusercontent.com/-BWIsC21z4CM/T4gpKdOB_MI/AAAAAAAAAIw/oWLzcqEp_CA/s718/addNewEndpoint.png" alt="New end point" width="718" height="250" /></p>
<p>And now we can rerun our new request with the correct endpoint</p>
<p><img class="alignnone" title="Full request" src="https://lh6.googleusercontent.com/-djqem3lG3QM/T4gpKdIw0_I/AAAAAAAAAI0/f-Zk7E50O-o/s723/queryRequest.png" alt="Full request" width="723" height="248" /></p>
<h2>Conclusion</h2>
<p>Unlike custom webservices which include the Salesforce endpoint as part of the WSDL the standard Salesforce enterprise WSDL only has the test or login url included.  Because of this, we need to use the returned server url to set our end point.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2012/04/13/salesforce-and-soapui-using-the-default-query-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reducing Salesforce SOQL queries by using static variables</title>
		<link>http://blog.deadlypenguin.com/blog/2012/04/04/reducing-salesforce-soql-queries-by-using-static-variables/</link>
		<comments>http://blog.deadlypenguin.com/blog/2012/04/04/reducing-salesforce-soql-queries-by-using-static-variables/#comments</comments>
		<pubDate>Wed, 04 Apr 2012 15:21:06 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[developement]]></category>
		<category><![CDATA[salesforce]]></category>
		<category><![CDATA[apex]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[SOQL]]></category>
		<category><![CDATA[trigger]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=189</guid>
		<description><![CDATA[The more moving pieces you have with triggers and classes the more you want to reduce the number of SOQL queries. One way to do this is to have Utility classes that do a lot of the heavy lifting. The &#8230; <a href="http://blog.deadlypenguin.com/blog/2012/04/04/reducing-salesforce-soql-queries-by-using-static-variables/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The more moving pieces you have with triggers and classes the more you want to reduce the number of SOQL queries. One way to do this is to have Utility classes that do a lot of the heavy lifting. The problem with this is that you don&#8217;t want to call a utility method that does a query every time, because if you call it from different triggers you&#8217;ll end up with multiple calls.  This is where overloading static variables can come in.</p>
<h2>The Problem</h2>
<p>Lets say you have a trigger on a Contact that needs information from our mostly static MyObject__c and then the Contact trigger then updates a Case.  The Case trigger also need information from the MyObject__c.  Normally this would require two SOQL queries even if it was in a utility class.  We can use some of the built-in functionality in Apex to overload a static variable.</p>
<h2>The Class</h2>
<p>MyObjectUtils.cls<br />
<script type="text/javascript" src="https://gist.github.com/2301934.js?file=myObjectUtils.java"></script>  </p>
<h2>The Implementation</h2>
<p>In the trigger where we want to use the MyObject instance we can do the following<script type="text/javascript" src="https://gist.github.com/2301934.js?file=CaseTrigger.java"></script><br />
Now, the next time the map or list are used in the same execution we will have it &#8220;cached&#8221; and will not have to make an additional query.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2012/04/04/reducing-salesforce-soql-queries-by-using-static-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Classifying Triggers in Salesforce</title>
		<link>http://blog.deadlypenguin.com/blog/2012/02/13/classifying-triggers-in-salesforce/</link>
		<comments>http://blog.deadlypenguin.com/blog/2012/02/13/classifying-triggers-in-salesforce/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 22:39:45 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[developement]]></category>
		<category><![CDATA[salesforce]]></category>
		<category><![CDATA[apex]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[trigger]]></category>
		<category><![CDATA[triggers]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=182</guid>
		<description><![CDATA[Anyone that has ever had multiple triggers on objects in Salesforce knows that it can be very painful to manage them.  Because of the way Salesforce chooses to run the triggers your code can be run in a non-deterministic order. &#8230; <a href="http://blog.deadlypenguin.com/blog/2012/02/13/classifying-triggers-in-salesforce/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Anyone that has ever had multiple triggers on objects in Salesforce knows that it can be very painful to manage them.  Because of the way Salesforce chooses to run the triggers your code can be run in a non-deterministic order.  In addition to this, having to sort through multiple files to find the one piece of code you are looking to update can be painful.</p>
<p>To combat this, you can take your triggers and condense them down into a single trigger and a single class.  Inside this class you would have a method containing each of your individual triggers.</p>
<h2>Preface</h2>
<p>In the examples below we will be creating a trigger on the MyObject__c to do awesomness.  In the example we do not cover the case of undelete.</p>
<h2>The Trigger</h2>
<p>The trigger is quite simple, all it does is call the a static method of the class with the correct parameters.</p>
<p><em>MyObject.trigger</em><br />
<script type="text/javascript" src="https://gist.github.com/1481545.js?file=MyObject_Trigger.java"></script>  </p>
<h2>The Class</h2>
<p>This is where the meat of the functionality exists.  The constructor sets up the maps and lists as well as the booleans.  Inside your <em>doAwesomeness</em> method you can check to the booleans <em>isUpdate, isDelete, isInsert</em> to make your routing determination.  If you do not want the method to run, just return out of it and the execution will stop. <em>MyObjectTrigger.cls</em><script type="text/javascript" src="https://gist.github.com/1481545.js?file=MyObjectTrigger.java"></script></p>
<h2>Conclusion</h2>
<p>We&#8217;ve been using this method for almost a year now and it works really well.  If you need data to persist between methods this way works wonderfully.   Just create a global variable and set it up in your constructor.  This will save you SOQL calls and if done correctly could save you DML operations</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2012/02/13/classifying-triggers-in-salesforce/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Vim and Salesforce development</title>
		<link>http://blog.deadlypenguin.com/blog/2012/02/09/vim-and-salesforce-development/</link>
		<comments>http://blog.deadlypenguin.com/blog/2012/02/09/vim-and-salesforce-development/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 17:04:32 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[developement]]></category>
		<category><![CDATA[salesforce]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=176</guid>
		<description><![CDATA[Since I switched over to using vim as my primary mode of Salesforce development, I&#8217;ve been asked several times how I&#8217;ve configured vim.  Well, it&#8217;s about time I show the man behind the curtain.  My primary vim config file is &#8230; <a href="http://blog.deadlypenguin.com/blog/2012/02/09/vim-and-salesforce-development/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Since I switched over to using vim as my primary mode of Salesforce development, I&#8217;ve been asked several times how I&#8217;ve configured vim.  Well, it&#8217;s about time I show the man behind the curtain.  My primary vim config file is quite large now, but I&#8217;ve condensed it down to the parts that I think are most pertinent to Salesforce development.</p>
<h2>Highlighting</h2>
<p>Now vim is great for editing but where I think it shines the most is in highlighting.  I&#8217;ve taken the standard java vim file and have modified it for use with the Apex language.  To use it, download the <a title="Apex vim file" href="https://github.com/solenopsis/Solenopsis/blob/master/config/apex.vim" target="_blank">apex.vim</a> file and place it in your syntax directory for vim.</p>
<h3>Local</h3>
<p>To make it work for just your user you can place the file in ~/.vim/syntax/ but you will need to also symlink (or copy) the html.vim file into that directory.</p>
<pre>ln -s /usr/share/vim/vim73/syntax/html.vim ~/.vim/syntax/html.vim</pre>
<h3>Global</h3>
<p>To make it work for all users on the system you can just place the file into your global syntax directory.  For fedora and probably most unix systems it is /usr/share/vim/vim73/syntax/</p>
<h2>.vimrc</h2>
<p>Now that we&#8217;ve got highlighting installed, lets get vim to use it.  First we need to create our backup and swap directories.  We do this to keep extra files out of our Salesforce directory so that we don&#8217;t try to deploy them (or commit them to our repo).</p>
<pre>mkdir ~/.bak ~/.swp</pre>
<p>Now we can add / replace the following options into our .vimrc file</p>
<p><script src="https://gist.github.com/1780982.js?file=.vimrc"></script></p>
<p>You might need to edit the values for tabstop, shiftwidth and softtabstop for your coding standards but 4 is what we use.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2012/02/09/vim-and-salesforce-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Salesforce and soapUI &#8211; Testing WebServices directly</title>
		<link>http://blog.deadlypenguin.com/blog/2012/02/03/salesforce-and-soapui/</link>
		<comments>http://blog.deadlypenguin.com/blog/2012/02/03/salesforce-and-soapui/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 19:17:21 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[developement]]></category>
		<category><![CDATA[salesforce]]></category>
		<category><![CDATA[apex]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[web-service]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=152</guid>
		<description><![CDATA[In a previous post I talked about writing webservices for Salesforce. In this post I&#8217;ll discuss how to test your webservice with soapUI without having to write any additional code. Getting soapUI You will need to install the Open Source version &#8230; <a href="http://blog.deadlypenguin.com/blog/2012/02/03/salesforce-and-soapui/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In a <a title="Creating Web-services in Salesforce" href="http://blog.deadlypenguin.com/blog/2012/01/06/creating-web-services-in-salesforce/" target="_blank">previous post</a> I talked about writing webservices for Salesforce. In this post I&#8217;ll discuss how to test your webservice with <a title="soapUI" href="http://www.soapui.org/" target="_blank">soapUI</a> without having to write any additional code.</p>
<h2>Getting soapUI</h2>
<p>You will need to install the Open Source version of soapUI from their <a title="soapUI - Sourceforget" href="http://sourceforge.net/projects/soapui/files/soapui/" target="_blank">sourceforge</a>.  Go ahead, I&#8217;ll wait&#8230;.</p>
<h2>Getting the WSDLs</h2>
<p>Now that you have soapUI installed we need to download our WSDLs.  You&#8217;ll need the <em>Enterprise WSDL</em> which can be found at Setup-Develop-API.  And you&#8217;ll need the WSDL for your webservice which can be found at Setup-Develop-Apex Classes, then find your class and click the WSDL link next to it.  I suggest downloading them into a WSDL folder just for organization.</p>
<h2>Setting up soapUI</h2>
<p>Now that we&#8217;ve got all of our parts we need to create a new soapUI project.  If you are testing multiple webservices I suggest you only create one soapUI project and import the additional webservices into it.  This will make updating the enterprise WSDL easier, and will make your life less stressful.</p>
<p>Right-click on <em>Projects</em> and select <em>New soapUI Project</em> and fill out the form with your information.  Your intial WSDL should be the enterprise WSDL.  You will at the very least want to have <em>Create Requests</em> checked.  You can choose the other later if you want to.</p>
<p><img class="alignnone" title="New soapUI Project" src="https://lh4.googleusercontent.com/-w8vYgTDlFMw/TywL-_Vg15I/AAAAAAAAAF0/PNw4sqa7yzs/s665/Screenshot-New%2520soapUI%2520Project.png" alt="" width="665" height="294" /></p>
<p>After creating the new project you will see a section called SoapBinding with several methods below it.  These are standard Salesforce methods that are provided by the Salesforce Enterprise WSDL. Let&#8217;s ignore these for right now, and import our webservice.  To add a new WSDL right-click on the project name, <em>Salesforce</em> in our case, and select <em>Add WSDL</em>.</p>
<p><img class="alignnone" title="Add WSDL" src="https://lh5.googleusercontent.com/-ARi6ODpq4Bk/TywN3uuux5I/AAAAAAAAAGI/lEFpAluO-5A/s422/addWSDL.png" alt="" width="422" height="171" /></p>
<p>Then we want to choose our webservices WSDL</p>
<p><img class="alignnone" title="Add WSDL" src="https://lh5.googleusercontent.com/--8N1DnX2ysQ/TywO5HBYCOI/AAAAAAAAAGg/T9UFaKYAq7U/s564/Screenshot-Add%2520WSDL.png" alt="" width="564" height="270" /></p>
<h2>Using soapUI</h2>
<p>Now that we are all setup, let&#8217;s test our webservice.  First we need to login to Salesforce and get our session Id.  Under the SoapBinding list, expand <em>login</em> and choose <em>Show Request Editor</em>.  After opening the request editor we need to remove the extra headers we don&#8217;t need, and fill in our username and password.</p>
<p><img class="alignnone" title="Login" src="https://lh6.googleusercontent.com/-R29KCCqYEDQ/TywQsXvIXdI/AAAAAAAAAG4/D5JD7CA1KTg/s610/login.png" alt="" width="610" height="494" /></p>
<p>Then press the &#8220;play&#8221; button to send the request</p>
<p><img class="alignnone" title="Login" src="https://lh6.googleusercontent.com/-T13axXQ9790/TywQsQrsAGI/AAAAAAAAAG8/lQuLGKF2gds/s610/login_play.png" alt="" width="610" height="494" /></p>
<p>Now in the resulting XML we can pull out our session Id</p>
<p><img class="alignnone" title="Session Id" src="https://lh3.googleusercontent.com/-aQCnHIFCRXs/TywuEBL22uI/AAAAAAAAAHY/W2yuikOcu7k/s805/sessionId.png" alt="" width="805" height="280" /></p>
<p>Copy the session Id and we will use it to make a request to our webservice.  In the example below I am calling the search method on my CaseAPI.  Again, we can remove almost all of the header out of the request.  The only section we need to leave is the <em>SessionHeader</em> and <em>SessionId</em>.</p>
<p><img class="alignnone" title="Request with session Id" src="https://lh3.googleusercontent.com/-qj4e6JJqupY/TywwpPm-5qI/AAAAAAAAAH0/myRYjDyL8vc/s599/request_sessionid.png" alt="" width="599" height="501" /></p>
<p>Then fill in the request to your webservice.  This will all depend on how yours is designed.  In the webservice call below, we pass in two context objects.  One takes in an <em>ssoName</em> and the other takes in a <em>searchString</em>.  Then as before click the &#8220;play&#8221; button and you&#8217;ll get your response back.</p>
<h2>Conclusion</h2>
<p>SoapUI is a great tool to help test webservices out.  You can use it to build up tests, but that&#8217;s another post.  I use it all of the time to verify that Salesforce is returning the correct data from my webservice instead of trying to write against the webservice and trying to determine if my client is messing up.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2012/02/03/salesforce-and-soapui/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Creating Web-services in Salesforce</title>
		<link>http://blog.deadlypenguin.com/blog/2012/01/06/creating-web-services-in-salesforce/</link>
		<comments>http://blog.deadlypenguin.com/blog/2012/01/06/creating-web-services-in-salesforce/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 21:47:50 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[developement]]></category>
		<category><![CDATA[salesforce]]></category>
		<category><![CDATA[apex]]></category>
		<category><![CDATA[web-service]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=144</guid>
		<description><![CDATA[Preface At my current job, we have several external systems that interact with Salesforce, and they do so through web-services. This document will cover what I have learned in regards to web-services, caveats with them and common pitfalls. Overview The goal &#8230; <a href="http://blog.deadlypenguin.com/blog/2012/01/06/creating-web-services-in-salesforce/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h1 id="Preface">Preface</h1>
<p>At my current job, we have several external systems that interact with Salesforce, and they do so through web-services. This document will cover what I have learned in regards to web-services, caveats with them and common pitfalls.</p>
<h1 id="Overview">Overview</h1>
<p>The goal of our web-services is to provide a single point of entry for each <em>major</em> object represented in Salesforce.  A <em>major</em> object would be Account, Case, Case Comment etc.  The reason this is differentiated is that for instance, Case Groups would under the AccountAPI since they are a <em>minor</em> object.  Each web-service consists of two parts.  First the actual <strong>web-service class</strong> which holds the exterally facing methods and from which the WSDL is generated.  The second part is that of the <strong>util class</strong> which holds all of the logic and is reusable.</p>
<h2 id="Webservice_class">Web-service class</h2>
<h3 id="APIUtils">APIUtils</h3>
<p>This class contains several static variables, exceptions and most importantly the classes that are returned from the web-service</p>
<h4 id="Static_Variables">Static Variables</h4>
<p>The static variables listed here are used to set the returnCode in the resulting return class.  This helps to keep return codes consistent with what is expected by the calling app</p>
<h4 id="Exceptions">Exceptions</h4>
<p>There are two types of base exceptions in APIUtils</p>
<h5 id="InvalidException">InvalidException</h5>
<p>This is used for things that are passed into the web-service that are considered invalid.  For example an invalid username passed in, or if the account does not match the requesting contact.</p>
<h5 id="UnknownException">UnknownException</h5>
<p>This is used when the requested object cannot be found.  For example if the case 123456 was requested and was not found then this would be a<em>UnknownCaseException</em></p>
<h4 id="Generic_Contexts">Generic Contexts</h4>
<p>For most web-services, they will contain their own Context classes.  But there are some context classes that are common and reusable.  The primary one being the ContactContext.  The ContactContext is often passed into the method to determine access level.</p>
<h4 id="Returned_Classes">Returned Classes</h4>
<p>These are abstraction classes usually representative of a Salesforce object.</p>
<ul>
<li>Each field to be returned must be of type WebService</li>
<li>Each class should have Integer returnCode and String message to be passed back to the caller.</li>
<li>If the method is to return a List&lt;Object&gt; a wrapper class of APIObjects should contain returnCode, message and a List of Objects.  [Example below]</li>
<li>Each class should have a constructor to aid in creation.  This will save time in the long run and will make writing tests 1000 times easier</li>
</ul>
<p><em>Note:</em> You could probably throw exceptions out to the calling service instead of setting a returnCode.  I think that setting the returnCode instead of throwing an exception makes it easier for integration since the integrator does not need to know the exceptions.<br />
<script src="https://gist.github.com/1481536.js?file=APIUtils.java"></script></p>
<h3 id="ObjectAPI">ObjectAPI</h3>
<p>This class should be written primarily as a wrapper class for the Object&#8217;s util class</p>
<h4 id="Specific_Contexts">Specific Contexts</h4>
<p>If contexts are needed and they will only be used by this API, then they should be included directly in the API file</p>
<ul>
<li>Each field must be of type WebService</li>
<li>Each class should have a constructor to aid in creation</li>
<li>Do not assume that variables in contexts will be set</li>
</ul>
<h4 id="Methods">Methods</h4>
<p>Each method should be disparate function of work and contain minimal logic.  These methods should call the required Util methods, transform data, catch exceptions and set returnCode/messages</p>
<ul>
<li>Method must be of type WebService</li>
<li>Method must be static</li>
<li>Method should return an APIObject</li>
<li>Method should set the returnCode and the message of the APIObject</li>
<li>All calls should be in a try-catch block so that no exceptions are leaked</li>
</ul>
<p><script src="https://gist.github.com/1481536.js?file=MyObjectAPI.java"></script></p>
<h3 id="ObjectUtils">ObjectUtils</h3>
<p>This class should have the majority of the logic.  The methods in this class should follow the idea of Samurai Programming.  Samurai Programming means the method should &#8220;return successful or not at all.&#8221;  This means instead of returning null if an error happens (if the method should return something ie getCase) then the method should throw an exception.</p>
<ul>
<li>Most methods will be static</li>
<li>Methods should throw an exception if the parameters are set incorrectly</li>
<li>SOQL queries that are single lines should have their exceptions caught, reported then throw the appropriate exception.  For example if we are selecting a single Case using Case c = [ select ... ] then we should catch the exception in case the query fails, and then thrown an UnknownCaseException.</li>
</ul>
<p><script src="https://gist.github.com/1481536.js?file=MyObjectUtils.java"></script></p>
<h2 id="Caveats">Caveats</h2>
<ul>
<li>Declaring a class as <em>virtual</em> and then <em>implementing</em> that class to try to have global variables that all classes get do not work.  The fields will not show up in the generated WSDL</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2012/01/06/creating-web-services-in-salesforce/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Supplemental Wallpaper Deadline Approaching</title>
		<link>http://blog.deadlypenguin.com/blog/2011/07/21/supplemental-wallpaper-deadline-approaching/</link>
		<comments>http://blog.deadlypenguin.com/blog/2011/07/21/supplemental-wallpaper-deadline-approaching/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 15:59:38 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[fedora]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=140</guid>
		<description><![CDATA[The supplement wallpaper deadline is approaching soon! As I mentioned in my previous post, we&#8217;re looking for more wallpaper contributions to go into the next release of Fedora.  If you were saving your best work for last, or were saying &#8230; <a href="http://blog.deadlypenguin.com/blog/2011/07/21/supplemental-wallpaper-deadline-approaching/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://blog.deadlypenguin.com/blog/2011/06/20/fedora-16-supplemental-wallpapers/" target="_self">supplement wallpaper</a> deadline is approaching soon!</p>
<p>As I mentioned in my previous post, we&#8217;re looking for more wallpaper contributions to go into the next release of Fedora.  If you were saving your best work for last, or were saying &#8220;I&#8217;ll get to it soon&#8221; well now is the time.  The deadline for the wallpaper submissions is fast approaching, and August 9th will be here before you realize it.  So, take a look at my <a href="http://blog.deadlypenguin.com/blog/2011/06/20/fedora-16-supplemental-wallpapers/" target="_self">previous post</a> for a refresher and lets see what&#8217;cha got!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2011/07/21/supplemental-wallpaper-deadline-approaching/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fedora 16 Supplemental Wallpapers</title>
		<link>http://blog.deadlypenguin.com/blog/2011/06/20/fedora-16-supplemental-wallpapers/</link>
		<comments>http://blog.deadlypenguin.com/blog/2011/06/20/fedora-16-supplemental-wallpapers/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 20:51:50 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[fedora]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=134</guid>
		<description><![CDATA[I&#8217;ve taken up the charge to be the so called &#8220;Supplemental Wallpaper Wrangler.&#8221; With that being said, I want to put call out to everyone to submit supplemental wallpapers for our next release. What are supplemental wallpapers? In addition to &#8230; <a href="http://blog.deadlypenguin.com/blog/2011/06/20/fedora-16-supplemental-wallpapers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve taken up the charge to be the so called &#8220;Supplemental Wallpaper Wrangler.&#8221;  With that being said, I want to put call out to everyone to submit supplemental wallpapers for our next release.</p>
<p><strong>What are supplemental wallpapers?</strong></p>
<p>In addition to the standard wallpaper that the design team is working hard to design and finalize, we want to include some addition wallpapers for people to choose from.  We will still ship with the default GNOME upstream supplemental wallpapers but, we want to include some more from our community.</p>
<p><strong>What we need</strong></p>
<p>In order to us the image for the supplemental wallpapers we need some basic information</p>
<ul>
<li>URL of the image (ie. “where it’s at”)</li>
<li>Title of the work in question</li>
<li>Name of the author (their real name is preferable, but a nickname with a link to the profile on the page the image is from works as well)</li>
<li>Contact information for the author, email if possible</li>
<li>URL of the source page that the image was originally from</li>
<li>The license of the photo (has to be compatible with the Fedora requirements)</li>
</ul>
<p>In addition to this, what the image is of is important (see the <a href="https://fedoraproject.org/wiki/F16_Artwork/Submissions/Supplemental_Wallpapers#Subject_matter:" target="_self">wiki</a> for the full requirements)</p>
<ul>
<li>Must not contain brand names or trademarks of any kind</li>
<li>Must not contain material that is inappropriate, offensive, indecent, obscene, hateful, tortuous, defamatory, slanderous or libelous</li>
<li>No religious, political, or nationalist imagery (including flags)</li>
<li>No images of hats, particularly fedoras. (This is a matter of respect for our primary sponsor, Red Hat, Inc., and is not negotiable. Of course, passive appearance of hats, such as those upon heads in a crowd, may be allowed.)</li>
<li>No version numbers. End users might prefer to continue to use an older theme, or use the latest theme in their older version of Fedora. To enable that choice, do not use any version numbers within the Fedora artwork.</li>
<li>No text. Text should not be used in the backgrounds because the artwork is intended for a global audience and to be reused by derivative distributions.</li>
<li>Should not contain images of people (contemporary, historical, or fictional)</li>
<li>Should not contain images of pets, or captive or mistreated animals</li>
</ul>
<p><strong>How to submit</strong></p>
<p>So, got that perfect image in mind for a supplemental wallpaper?  Great!  If the image meets all of the <a href="https://fedoraproject.org/wiki/F16_Artwork/Submissions/Supplemental_Wallpapers#Subject_matter:" target="_self">requirements</a> then all you need to do is add it to the <a href="https://fedoraproject.org/wiki/F16_Artwork/Submissions/Supplemental_Wallpapers#Submissions" target="_self">submissions section</a> of the wiki and wait.  We will take submissions until 23:59 UTC on August 9th 2011 following that the design team will vote for the top 15 and they will be packaged up and included in the Fedora 16 release.</p>
<p>If you have any questions feel free to email me (pcon AT fedoraproject DOT org) or contact me (pcon) in #fedora-design on freenode</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2011/06/20/fedora-16-supplemental-wallpapers/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using meld with git diff</title>
		<link>http://blog.deadlypenguin.com/blog/2011/05/03/using-meld-with-git-diff/</link>
		<comments>http://blog.deadlypenguin.com/blog/2011/05/03/using-meld-with-git-diff/#comments</comments>
		<pubDate>Tue, 03 May 2011 18:21:35 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=127</guid>
		<description><![CDATA[This is test <a href="http://blog.deadlypenguin.com/blog/2011/05/03/using-meld-with-git-diff/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of the things I&#8217;ve found myself doing more of is merging in code for other people.  Most of this are changes/additions/deletions to XML files.  And one thing that is really annoying to do is doing these by hand.  Well, fortunately there is a great tool for helping with this.  it&#8217;s called <a href="http://meld.sourceforge.net/" target="_self">Meld</a>.  To get it to play nicely with git we have to do one small thing.  Create a bash script called &#8220;git-meld&#8221; and put in your bin directory</p>
<blockquote><p>#!/bin/bash<br />
meld &#8220;$2&#8243; &#8220;$5&#8243;</p></blockquote>
<p>Then make it executable with chmod.  Now add the following to your ~/.gitconfig file</p>
<blockquote><p>[diff]<br />
external = git-meld</p></blockquote>
<p>This will now run meld whenever you do a git diff.  You can easily see diffs and apply diffs with it now.  If you click the arrow in the blue/green box it will move that chunk of code over.  If you diff multiple files, meld will run with each one of the files, so just quit out of meld and it will relaunch with the next file.</p>
<p><a href="http://meld.sourceforge.net/meld_file1.png"><img src="http://meld.sourceforge.net/meld_file1.png" alt="" width="550px" height="408px" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2011/05/03/using-meld-with-git-diff/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Syncing saved games between Windows / Mac / Linux with Dropbox</title>
		<link>http://blog.deadlypenguin.com/blog/2010/05/20/syncing-saved-games-between-windows-mac-linux-with-dropbox/</link>
		<comments>http://blog.deadlypenguin.com/blog/2010/05/20/syncing-saved-games-between-windows-mac-linux-with-dropbox/#comments</comments>
		<pubDate>Thu, 20 May 2010 17:46:58 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[gaming]]></category>
		<category><![CDATA[dropbox]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=124</guid>
		<description><![CDATA[So with steam coming out on the Mac and with the Humble Indie Bundle working on all three, there is a problem with keeping all of your saves in sync. Not any more. This is all thanks to dropbox. What &#8230; <a href="http://blog.deadlypenguin.com/blog/2010/05/20/syncing-saved-games-between-windows-mac-linux-with-dropbox/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So with steam coming out on the Mac and with the Humble Indie Bundle working on all three, there is a problem with keeping all of your saves in sync. Not any more. This is all thanks to dropbox.</p>
<p><strong>What is dropbox?</strong><br />
Dropbox is a cross-platform application / website that keeps files in sync and gives you 2Gb of storage space for free.  If you&#8217;re not a dropbox user already, you can sign up <a href="https://www.dropbox.com/referrals/NTIxMjU2Njk" target="_blank">here</a>.</p>
<p><strong>Initial setup</strong></p>
<p>The initial setup is the tricky part.  Fortunately you only need to install something (other than dropbox) on one system and only if you&#8217;re running Windows XP.</p>
<p><strong>Windows XP</strong></p>
<p>You&#8217;ll need to install <a href="http://www.microsoft.com/technet/sysinternals/FileAndDisk/junction.mspx" target="_self">junction</a> to make the symlinks in Windows XP.  In Vista and later you can use mklink</p>
<p><strong>Linux / OSX</strong></p>
<p>You&#8217;ll use the ln command</p>
<p>After you have installed your game you will need to move your save game directory into your dropbox and then link to it.  For this example, I&#8217;ll be using Civ 4.  In the examples below, I&#8217;m assuming you&#8217;ve already moved your files into Dropbox/games/</p>
<p><strong>Windows</strong></p>
<blockquote><p>junction &#8220;C:\Documents and Settings\User\My Documents\My Games\Sid Meier&#8217;s Civilization IV\replay&#8221; C:\Documents and Settings\User\My Documents\My Dropbox\games\civ4&#8243;</p></blockquote>
<p><strong>OSX / Linux</strong></p>
<blockquote><p>ln -s ~/Documents/Sid\ Meier\&#8217;s\ Civilzation\ IV/replay ~/My\ Dropbox/games/civ4</p></blockquote>
<p><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2010/05/20/syncing-saved-games-between-windows-mac-linux-with-dropbox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

