<?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>Rohland de Charmoy &#187; javascript</title>
	<atom:link href="http://www.rohland.co.za/index.php/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rohland.co.za</link>
	<description>Pushing buttons...</description>
	<lastBuildDate>Sat, 04 Feb 2012 16:01:55 +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>FogBugz &#8211; Email edge detection</title>
		<link>http://www.rohland.co.za/index.php/2012/02/04/fogbugz-email-edge-detection/</link>
		<comments>http://www.rohland.co.za/index.php/2012/02/04/fogbugz-email-edge-detection/#comments</comments>
		<pubDate>Sat, 04 Feb 2012 15:56:54 +0000</pubDate>
		<dc:creator>Rohland</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[FogBugz]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Outlook]]></category>

		<guid isPermaLink="false">http://www.rohland.co.za/?p=396</guid>
		<description><![CDATA[A while ago I was involved in a project at Clyral where we developed a web based support ticketing system (similar to Zendesk). One of the things we focused on was dealing with the detection of new content in an email conversation. Typically, emails would bounce back and forth between a customer and an agent [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago I was involved in a project at <a href="http://www.clyral.com" target="_blank">Clyral</a> where we developed a web based support ticketing system (similar to <a href="http://www.zendesk.com/" target="_blank">Zendesk</a>). One of the things we focused on was dealing with the detection of new content in an email conversation. Typically, emails would bounce back and forth between a customer and an agent and we wanted to ensure that our web interface wasn’t cluttered with the full email thread for every reply the customer sent in (the original conversation was always included in outbound emails for convenience).</p>
<p>When we looked at implementing the mechanism which would only extract new content from an inbound email, we found it surprising that there was no official standard for demarcating the beginning and end of an email in an email thread. We took a look at a few mail clients and discovered that Microsoft Outlook is capable of dealing with this problem. If you use one of newer versions of Microsoft Outlook, you’ll notice that the client is capable of detecting the boundaries between emails. Take a look at the screenshot below:</p>
<p><a href="http://www.rohland.co.za/wp-content/uploads/2012/02/image.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="http://www.rohland.co.za/wp-content/uploads/2012/02/image_thumb.png" alt="image" width="644" height="393" border="0" /></a></p>
<p>Notice how Outlook has detected the boundaries between each email. Each email has a gradient which assists you to navigate the thread, furthermore, if you hover over a specific email, you can jump to the next/previous email in the thread relatively easily.</p>
<p>While there didn’t seem to be a standard way of achieving this, we managed to get a decent solution in place for our ticketing system. Since we were sending out the emails which customers would reply to, we could standardise the email content such that we could easily detect the boundary when a customer responded. This was not a full proof solution, so in the end, we implemented a heuristic algorithm that could deal with most of the common mail clients out there. Implementing this feature made it infinitely easier to manage conversations with customers. Obviously, we always kept keep the original email as customers would sometimes reply with changes to the original email content (such as answering questions inline).</p>
<p>Last year, we started using <a href="http://www.fogcreek.com/fogbugz/" target="_blank">FogBugz</a> as our general case and project management system. What we discovered was that FogBugz isn’t as smart as the system we developed in terms of dealing with email conversations. Outbound emails would not include the full email conversation and if you don’t use the web interface to respond, the boundary between the new content and email thread isn’t detected at all. This usually leads to a very cluttered case view where you need to scroll over copious amounts of duplicate text.</p>
<p>To deal with this problem, I implemented a very simple JavaScript customisation which scans over the content in a case and hides any email text which is superfluous. You always have the capability to toggle the content if you do need to inspect it. I’ve included the code for the customisation below. We use Microsoft Outlook (and most of our clients do as well), so the solution works well for us. The code simply scans email for the ‘From: ..’ and splits the email there. It’s not rocket science.</p>
<pre class="brush: jscript; title: ; notranslate">$(function(){
    $('.emailBody').each(function(index, element){
        var body = $(element);
        var edgeIndex = body.html().indexOf('&lt;br&gt;\nFrom: ');
        if (edgeIndex == -1){
        	return;
        }
        var mainBody = body.html().substring(0, edgeIndex);
        var quotedBody = body.html().substring(edgeIndex);
        body.html(mainBody);
        body.append('&lt;div class=&quot;showQuote&quot; style=&quot;padding-top:5px&quot;&gt;&lt;a href=&quot;javascript:void(0);&quot; class=&quot;dotted&quot; onclick=&quot;$(this).parent().parent().find(\'.emailThreadBody\').toggle();&quot;&gt;- show quoted text -&lt;/a&gt;&lt;/div&gt;');
        body.append('&lt;div class=&quot;emailThreadBody&quot; style=&quot;display:none;&quot;&gt;&lt;/div&gt;');
        body.find('.emailThreadBody').html(quotedBody);
    });
});
</pre>
<p>Hope this helps. Hopefully, this issue is addressed in the next major version of FogBugz.</p>
<p>Cheers,<br />
Rohland</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rohland.co.za/index.php/2012/02/04/fogbugz-email-edge-detection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validation with confirmations in ASP .NET</title>
		<link>http://www.rohland.co.za/index.php/2007/03/12/validation-with-confirmations-in-asp-net/</link>
		<comments>http://www.rohland.co.za/index.php/2007/03/12/validation-with-confirmations-in-asp-net/#comments</comments>
		<pubDate>Mon, 12 Mar 2007 11:51:27 +0000</pubDate>
		<dc:creator>Rohland</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[asp dotnet]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://www.rohland.co.za/?p=140</guid>
		<description><![CDATA[In his book Designing The Obvious, Robert Hoekman makes a few good points regarding inline validation techniques. Validation is often neglected when building a web application and little or no time is spent improving validation to give the end-user a better experience when using online forms. Validation should not get in the way of people [...]]]></description>
			<content:encoded><![CDATA[<p>In his book <a href="http://www.rhjr.net/dto">Designing The Obvious</a>, Robert Hoekman makes a few good points regarding inline validation techniques. Validation is often neglected when building a web application and little or no time is spent improving validation to give the end-user a better experience when using online forms. Validation should not get in the way of people using your site or web application, it should be seamless. The most effective way to manage validation is to catch errors before they happen. This would seem obvious but many of us out there are guilty are not paying attention to validation. Supplying hints of expected content format or simply confirming to a user that he/she has entered the correct data goes a long way to ensuring that a user feels comfortable using your web application.</p>
<p>I am quickly going to show you how to implement a confirmation &#8216;tick&#8217; using the built in ASP .NET validators in Visual Studio 2005. Assuming that you are using these validators and you expect your clients / users to be using a javascript enabled browser, you can use some simple javascript to implement confirmation ticks every time a user successfuly completes a field.</p>
<p><a href="http://www.rohland.co.za/wp-content/uploads/2009/11/validator_example.jpg"><img class="aligncenter size-full wp-image-141" title="Validation Example" src="http://www.rohland.co.za/wp-content/uploads/2009/11/validator_example.jpg" alt="Validation Example" width="383" height="46" /></a></p>
<p>Using one of the fundamental principals of Ruby on Rails, &#8216;Convention over Configuration&#8217; we need to set the ID of the tick image to the name of the Textbox + &#8216;_ValidatorOk&#8217;. So if our textbox ID is called &#8216;Field_Duration&#8217; then our tick image ID is &#8216;Field_Duration_ValidatorOk&#8217;. We also need to set the display style attribute of the image to &#8216;none&#8217; (style=&#8217;display:none&#8217;) by default so that the tick is hidden until valid data is entered.</p>
<p>We need to fire off some javascript when the onblur event of our textbox is fired. This javascript will fire the ASP .NET Validators which will let us know if the data is valid or not. If the data is valid we can display the tick. To do this, simply add an onblur event to the Textbox.</p>
<p><span style="color: #ff0000;">Example: &lt;asp:Textbox id=&#8221;Field_Duration&#8221; runat=&#8221;server&#8221; Text=&#8221;" onblur=&#8221;FireCustomValidation(this);&#8221; /&gt;</span></p>
<p>Then include the javascript function &#8216;FireCustomValidation&#8217; which will look something like this:</p>
<pre class="brush: jscript; title: ; notranslate">
function FireCustomValidation(fldobj)
{
    if (typeof(Page_ClientValidate) == 'function') {
        var passed = true;
        for (i = 0; i &lt; Page_Validators.length; i++) {
            if (Page_Validators[i].controltovalidate == fldobj.id) {
                ValidatorValidate(Page_Validators[i]);
                if (!Page_Validators[i].isvalid)
                    passed = false;
            }
        }
        if (passed)
            document.getElementById(fldobj.id + 'ValidatorOk').style.display = '';
        else
            document.getElementById(fldobj.id + 'ValidatorOk').style.display = 'none';
   }
}
</pre>
<p>Now, when the user completes and leaves a field, the function above will execute. The function uses the Client API for the ASP .NET validators (<a href="http://msdn2.microsoft.com/en-us/library/aa479045.aspx#aspplusvalid_properties">see here</a>). If Client Side Validation is not supported then the function does nothing. Otherwise it iterates through each validator on the page looking for ones that match the field just completed. When found, their respective validation functions are fired. The &#8216;isvalid&#8217; attribute is then checked, if any of the validators return false then the tick is hidden, if all pass then the tick is shown. You could write some extra code to stop errors occuring if the &#8216;tick&#8217; object does not exist.</p>
<p>You could include this script in a javascript file that is included in your master page. Using this technique, users feel more confident as they complete your webform. There is a lot more you could do with this code, such as highlight the entire table row when an error occurs.</p>
<p>Hope you found this useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rohland.co.za/index.php/2007/03/12/validation-with-confirmations-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

