<?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>Fri, 03 Feb 2012 19:58:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<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>0</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>
		<item>
		<title>Automatic backups with UDEV</title>
		<link>http://blog.deadlypenguin.com/blog/2009/09/25/automatic-backups-with-udev/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/09/25/automatic-backups-with-udev/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 15:04:04 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=117</guid>
		<description><![CDATA[I recently challenged myself to come up with a way to make udev automatically backup when you plug in a USB harddrive. I did all my testing with a USB stick drive, but since they both show up as block &#8230; <a href="http://blog.deadlypenguin.com/blog/2009/09/25/automatic-backups-with-udev/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently challenged myself to come up with a way to make udev automatically backup when you plug in a USB harddrive.  I did all my testing with a USB stick drive, but since they both show up as block devices to the kernel, it shouldn&#8217;t matter.</p>
<p><strong>UDEV Rules</strong></p>
<p>To start with, we need to set up static naming for the storage device that you want to make into backup disk.  Start by plugging in the disk.  (Now I&#8217;m not using Gnome or KDE so I&#8217;m not sure what their automounter will do.  So, you might have to find a way to exclude it from the automounter.  We need to find out the &#8220;model&#8221; of the drive.  My udev rules are pretty basic, and will work since most people don&#8217;t have more than one the same model of USB drive laying around that they would use.  You can always modify the udev rules to work for you.</p>
<blockquote><p>udevadm info -a -p /sys/block/sdc | grep model</p></blockquote>
<p>Here we are looking at the block device sdc (which is what the kernel named it since we don&#8217;t have any udev rules yet).  This could change depending on how many block devices you currently have.  Now we take this information, and feed it into a udev rule.  I created a file <em>/etc/udev/rules.d/50-backup.rules</em> The name isn&#8217;t really important, however, the number 50- is.  That is the order in which it runs.  We want that number to be less than 90 so that hal doesn&#8217;t run first.  Inside that file, we have the following:</p>
<blockquote><p>KERNEL==&#8221;sd?1&#8243;, SUBSYSTEM==&#8221;block&#8221;, ATTRS{model}==&#8221;MODEL GOES HERE&#8221;, SYMLINK+=&#8221;backup&#8221;, RUN+=&#8221;/usr/local/bin/backup.sh&#8221;</p></blockquote>
<p>Replace &#8220;MODEL GOES HERE&#8221; with the output from the udevadm command</p>
<p><strong>The backup script</strong></p>
<p>Now we udev running our script <em>/usr/local/bin/backup.sh</em> we need to make that script</p>
<blockquote><pre>#!/bin/bash

NOTIFYUSER="pcon"
MAINDIR="/home/pcon/"
BACKUPDIR="/mnt/backup"

su $NOTIFYUSER alt-notify-send backup "Waiting for things to settle" 0
sleep 5

su $NOTIFYUSER alt-notify-send backup "Starting backup" 0
echo "$(date) - Mounting /dev/backup to $BACKUPDIR" &gt; /tmp/backup.log
mount /dev/backup $BACKUPDIR &gt;&gt; /tmp/backup.log 2&gt;&amp;1
echo "$(date) - Staring rsync of $MAINDIR to $BACKUPDIR" &gt;&gt; /tmp/backup.log
rsync -arvuz --inplace --delete $MAINDIR $BACKUPDIR &gt;&gt; /tmp/backup.log 2&gt;&amp;1
echo "$(date) - Mounting /dev/backup to $BACKUPDIR" &gt;&gt; /tmp/backup.log
umount $BACKUPDIR &gt;&gt; /tmp/backup.log 2&gt;&amp;1
su $NOTIFYUSER alt-notify-send backup "Backup completed" 0</pre>
</blockquote>
<p>We have a couple of things to setup here.  First we need to create /mnt/backup as root, and fill out the other variables in the top of the script.  Aslo, if we want notification in gnome, we need to make a notify-send work around.  Put the following in <em>/usr/local/bin/alt-notify-send</em></p>
<blockquote><pre>#!/bin/sh
user=`whoami`
pids=`pgrep -u $user gnome-panel`
title=$1
text=$2
timeout=$3

if [ -z "$title" ]; then
    echo You need to give me a title &gt;&amp;2
    exit 1
fi
if [ -z "$text" ]; then
     text=$title
fi
if [ -z "$timeout" ]; then
     timeout=60000
fi

for pid in $pids; do
    # find DBUS session bus for this session
    DBUS_SESSION_BUS_ADDRESS=`grep -z DBUS_SESSION_BUS_ADDRESS \
    /proc/$pid/environ | sed -e 's/DBUS_SESSION_BUS_ADDRESS=//'`
    # use it
    DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS \
    notify-send -u low -t $timeout "$title" "$text"
done</pre>
</blockquote>
<p>Now chmod +x the two scripts, and everything should be good to go.  You can download the scripts used in this post below:</p>
<ul>
<li><a href="http://deadlypenguin.com/code/udevBackups/50-backup.rules" target="_blank">50-backup.rules</a></li>
<li><a href="http://deadlypenguin.com/code/udevBackups/backup.sh" target="_blank">backup.sh</a></li>
<li><a href="http://deadlypenguin.com/code/udevBackups/alt-notify-send" target="_blank">alt-notify-send</a> (Taken from <a href="http://ubuntuforums.org/showthread.php?p=6889270#post6889270" target="_blank">here</a>)</li>
</ul>
<p><strong> </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/09/25/automatic-backups-with-udev/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>External programs that update screen</title>
		<link>http://blog.deadlypenguin.com/blog/2009/09/18/external-programs-that-update-screen/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/09/18/external-programs-that-update-screen/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 21:12:36 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=111</guid>
		<description><![CDATA[Screen is a great tool, and it allows you do to alot of neat things.  One of my favorites is binding commands to key strokes.  So all you have to do is hit F5 and it will start something in &#8230; <a href="http://blog.deadlypenguin.com/blog/2009/09/18/external-programs-that-update-screen/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Screen is a great tool, and it allows you do to alot of neat things.  One of my favorites is binding commands to key strokes.  So all you have to do is hit F5 and it will start something in the background.  Such as a build command.  The problem is, you either get no output, or you get spam all over your screen.  Well I&#8217;ve finally found a way around that.  The answer lies in ANSI Privacy Messages.</p>
<p>In your .screenrc, make sure you have a place that will show messages.  If you start up screen and you see &#8220;New screen&#8230;&#8221; then you&#8217;ve got this.  Next add your script to your .screenrc</p>
<blockquote><p>bind -k k5 exec /home/pcon/bin/build_script.sh</p></blockquote>
<p>Now everything in your screen is ready to go.  Now, on to build_script.sh</p>
<blockquote><p>#!/bin/bash</p>
<p>echo -n -e &#8220;&#92;033^Starting Build&#92;033&#92;&#92;&#8221;</p>
<p># Do something here</p>
<p>echo -n -e &#8220;&#92;033^Ending Build&#92;033&#92;&#92;&#8221;</p></blockquote>
<p>That&#8217;s it.  Now your screen will display &#8220;Starting Build&#8221; and &#8220;Ending Build&#8221; on your display.  If the stuff in between happens too fast, you may only see your last message.  The key thing is that your message has to start with &#8220;&#92;033^&#8221;  and end with &#8220;&#92;033&#92;&#92;&#8221; otherwise you&#8217;ll loose your cursor.  And you have to have the -e on the echo so that it will interpret the octal codes correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/09/18/external-programs-that-update-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>irssi + mumbles == push notification goodness</title>
		<link>http://blog.deadlypenguin.com/blog/2009/08/31/irssi-mumbles-push-notification-goodness/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/08/31/irssi-mumbles-push-notification-goodness/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 19:12:32 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=106</guid>
		<description><![CDATA[One of the biggest problems with irssi is that if you run it on remote machine, it can be quite hard to get notifications.  For the past couple of years, I&#8217;ve been running a plugin called fnotify that writes notifications &#8230; <a href="http://blog.deadlypenguin.com/blog/2009/08/31/irssi-mumbles-push-notification-goodness/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of the biggest problems with irssi is that if you run it on remote machine, it can be quite hard to get notifications.  For the past couple of years, I&#8217;ve been running a plugin called fnotify that writes notifications to a file, then using another script I read that file and print it out with libnotify.  There are a couple of problems with this:</p>
<ol>
<li>libnotify is ugly</li>
<li>takes up diskspace if you don&#8217;t clear the queue</li>
<li>requires you to either have the script, or remember the ridiculously long command</li>
</ol>
<p>Well, these are things of the past.  Thanks to <a href="http://www.mumbles-project.org" target="_blank">mumbles</a>!</p>
<p>First install mumbles from yum (or source) then install the <a href="http://deadlypenguin.com/code/growlNotify/growlNotify.pl" target="_blank">irssi script</a>.  Make sure you change the <em>growl_server</em> and <em>growl_password</em> then you are good to go.  The script has a dependency on Net::GrowlNotify in perl.</p>
<p>The script uses irssi config variables so you can use /SET growl_server or /SET growl_password to set your growl server/password without having to load/unload the script.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/08/31/irssi-mumbles-push-notification-goodness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DVD player with xsessions</title>
		<link>http://blog.deadlypenguin.com/blog/2009/06/12/dvd-player-with-xsessions/</link>
		<comments>http://blog.deadlypenguin.com/blog/2009/06/12/dvd-player-with-xsessions/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 18:55:15 +0000</pubDate>
		<dc:creator>pcon</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[satellite]]></category>

		<guid isPermaLink="false">http://blog.deadlypenguin.com/blog/?p=87</guid>
		<description><![CDATA[I&#8217;ve come across the need to simply the dvd playing process.  I&#8217;m having to set up a laptop to play a dvd and use a remote presenter control.  Now in the past I&#8217;ve just been in charge of this setup, &#8230; <a href="http://blog.deadlypenguin.com/blog/2009/06/12/dvd-player-with-xsessions/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve come across the need to simply the dvd playing process.  I&#8217;m having to set up a laptop to play a dvd and use a remote presenter control.  Now in the past I&#8217;ve just been in charge of this setup, and haven&#8217;t had to worry about explaining how to start it up for others.  This time, I need to make it as user friendly as possible.  So, I&#8217;ve decided to do this with a couple of bash scripts and a couple of xsessions.<br />
<strong>Goals</strong></p>
<ul>
<li>Generic user with a generic password to hand to the person in charge</li>
<li>Ability to play dvd stored locally.  (Called presentation_dvd)</li>
<li>Ability to play any dvd inserted.</li>
<li>Require no user input except to choose <em>presentation_dvd</em> or <em>dvd</em></li>
</ul>
<p><strong>Preperation</strong></p>
<p>To get ready, we need to do a couple of things</p>
<ul>
<li>Create a presenter user</li>
<li>Install xine and xine-lib-extras-freeworld</li>
<li>Copy our presentation_dvd to an iso<br />
<blockquote><p>dd if=/dev/dvd of=/home/presenter/presentation_dvd.iso</p></blockquote>
</li>
</ul>
<p><strong>Xesssions</strong></p>
<p>Xsessions are what defines your window manager.  It&#8217;s what tells X11 what to run when you say Session-&gt;Gnome or Session-&gt;fluxbox.  These files are stored in <em>/usr/share/xsessions</em>.</p>
<blockquote><p>[Desktop Entry]<br />
Encoding=UTF-8<br />
Name=Presentation_DVD<br />
Comment=Start the presentation DVD<br />
Exec=/usr/local/bin/presentation_dvd<br />
Terminal=False</p>
<p>[Window Manager]<br />
SessionManaged=true</p></blockquote>
<p>This is our file in <em>/usr/share/xesssions/presentation_dvd.desktop</em> We then create one in <em>/usr/share/xesssions/dvd.desktop</em> and replace presentation_dvd with dvd.</p>
<p><strong>The Scripts</strong></p>
<p>Our /usr/local/bin/presentation_dvd looks like this:</p>
<blockquote><p><code>#!bin/bash<br />
amixer set Master playback 100%<br />
xine -f -g --no-splash dvd:/home/presenter/presentation_dvd.iso</code></p></blockquote>
<p>This will turn the volume up to 100% and then start xine on the iso.  To exit, just right click and say exit.  This will take you back to the login screen.</p>
<p>Now to handle any dvd with the <em>/usr/local/bin/dvd</em></p>
<blockquote><p><code>#!/bin/bash<br />
amixer set Master playback 100%<br />
xine -f -g<em> </em>--no-splash dvd://</code></p></blockquote>
<p>And the final touch, make them both executable</p>
<blockquote><p>chmod a+x /usr/local/bin/dvd /usr/local/bin/presentation_dvd</p></blockquote>
<p><em>NOTE:  The xine parameter is dash dash no dash splash.  The font I&#8217;m using doesn&#8217;t render two dashes well</em></p>
<p><em><br />
</em></p>
<p><strong>Usage</strong></p>
<p>From the login menu, choose your presenter user, and then choose the appropriate session at the bottom.  Then type in the password.  Like magic, everything should work.</p>
<p><strong>Potential problems</strong></p>
<p>If you don&#8217;t see your session in the list, you might have a typo in your xsession file</p>
<p>If one of the xine scripts don&#8217;t work, try logging into gnome and running the script from the command-line to see why.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadlypenguin.com/blog/2009/06/12/dvd-player-with-xsessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

