<?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>Pearl Tech &#187; Miscellaneous</title>
	<atom:link href="http://blog.pearltechnology.com/category/miscellaneous/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pearltechnology.com</link>
	<description></description>
	<lastBuildDate>Thu, 05 Jan 2012 14:47:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JQGrid and a getRowData issue</title>
		<link>http://blog.pearltechnology.com/jqgrid-and-a-getrowdata-issue/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/jqgrid-and-a-getrowdata-issue/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 16:24:46 +0000</pubDate>
		<dc:creator>Chad Ferguson</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=1278</guid>
		<description><![CDATA[Recent work for a client has involved a large amount of work with the excellent Jquery plugin JQGrid. Per the clients requirements I needed to fire an event on row select that would execute another event that is stored in the object. Part of the JQGrid api is a function that allows you to retrieve [...]]]></description>
			<content:encoded><![CDATA[<p>Recent work for a client has involved a large amount of work with the excellent <a href="http://jquery.com/">Jquery</a> plugin <a href="http://www.trirand.com/blog/">JQGrid</a>. Per the clients requirements I needed to fire an event on row select that would execute another event that is stored in the object. Part of the JQGrid api is a function that allows you to retrieve the data associated with a row and do what you please with it.<br />
<code><br />
$(gridid).jqGrid('getRowData', rowid);<br />
</code><br />
Unfortunately this only returns the data that was actually being displayed by the grid and any other undisplayed objects are not returned. Since I had a complex object that would not be displayed in the grid but was needed for actions in the grid I had to find a way to retrieve the entire object that was used to populate the row. Another option is too use the the grid params and retrieve that data object.<br />
<code><br />
$(gridid).jqGrid('getGridParam', 'data');<br />
</code><br />
However, I quickly discovered that method only works with local data. So to solve my problem I had to leverage a nice Jquery function known as <a href="http://api.jquery.com/jQuery.data/">.Data()</a>. With this function I could store my grid data and associate it to the grid. Then using the the rowid of the selected row I could quickly find the full object that was used to create the row. So to do this I first had to assign the data, which is done via the jqgrid event &#8216;LoadComplete&#8217;. Then in my select row event I can retrieve that data and find my row object.<br />
<code><br />
function jqGridLoadComplete(data, gridid) {<br />
    $('#' + gridid).data("jqData", data.Rows);<br />
}<br />
function onJQRowSelect(rowid, status, callback, gridid) {<br />
    var alldata = $('#' + gridid).data("jqData");<br />
    var data = alldata[rowid - 1];<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/jqgrid-and-a-getrowdata-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improve Website Performance by Using a Single Background Image for Your Whole Website</title>
		<link>http://blog.pearltechnology.com/a-single-background-image-for-your-whole-website/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/a-single-background-image-for-your-whole-website/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 13:38:15 +0000</pubDate>
		<dc:creator>Geer</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Background Image]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=1249</guid>
		<description><![CDATA[How to improve performance of your website by using a single background image...]]></description>
			<content:encoded><![CDATA[<p>Have you ever tried to learn or borrow design ideas from other good websites?  I have.  I happened to see an idea of using one background image for all background images that are needed for the entire website.  I thought it was a very clever idea, so wrote this post to share it.</p>
<p>Basically, you would integrate and organize all little background images that your website needs into one &#8220;big&#8221; (won&#8217;t be too big anyway) image file, like the one shown below.</p>
<p><img class="size-full wp-image-1251 aligncenter" title="Combined Background Image" src="http://blog.pearltechnology.com/wp-content/uploads/2011/11/background.png" alt="Combined Background Image" width="47" height="82" /><br />
It has got some corner images for cornered boxes and a few icons.  All images are combined into this one image file while each one of them is laid out nicely.  Well, it’s nice to look at and organize them that way, but how you can use them?  Suppose you want to use the contact icon in front of some text.  Normally, you could do something like:</p>
<pre name="code" language="XML">
<span style="background:url(images/background.png) no-repeat; padding-left:20px;">Contact Name</span>
</pre>
<p><img class="aligncenter size-full wp-image-1252" title="bg1" src="http://blog.pearltechnology.com/wp-content/uploads/2011/11/bg1.JPG" alt="bg1" width="153" height="39" /></p>
<p>However, with the combined image, it won’t show the background image as expected.</p>
<p>To make it work, you just need to do something like:</p>
<pre name="code" language="XML">
<span style="background:url(images/background.png) no-repeat -25px 0px; padding-left:20px;">Contact Name</span>
</pre>
<p><img class="aligncenter size-full wp-image-1254" title="bg2" src="http://blog.pearltechnology.com/wp-content/uploads/2011/11/bg2.JPG" alt="bg2" width="126" height="32" /></p>
<p>As you can see, it’s fairly easy – you just need to set the position of the background image instead of using the default position, so that only the appropriate background image shows up and rest of the image remains hidden.</p>
<p>Why are you doing this?  I don’t claim that I fully understand the purpose behind this idea, but here is one reason that I can think of: performance.</p>
<p>When you view a web page, everything you see on the screen needs to be downloaded, and each download is initiated by an HTTP request.  The more files you download, the more HTTP requests are needed, and the more load is put on the web server to handle these requests.  Usually, the time spent on processing an HTTP request is much less than the time spent on downloading, but if the file size is small, the processing time for the request will take a big portion of the whole processing time.  In the other words, it will be more efficient to send one request and download a big size file than to send a bunch of requests to download smaller files.  Although it still takes little time for the web server to process a request, it could use a noticeable amount of resources of the web server to handle them, if there are thousands of people hitting your web server.  Also, a web server can only process a certain number of requests at the same time.  If there are 50 background images that are used on most of the pages on your website, the web browser will probably need to send that many requests to download each one of them separately, unless they are already cached by the web browser.  So, if you can combine those 50 files and let the browser only request and download it once, you allow your web server to run more efficiently.  Previously, the web server has to process 50 requests to get those background images to the web browser, but now it only needs to process 1 request, and get the same content to the web browser.  Make sense?</p>
<p>There may be other practical reasons for this idea.  Please share your input below if you find any. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/a-single-background-image-for-your-whole-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Info &#8211; What&#8217;s needed and What&#8217;s not?</title>
		<link>http://blog.pearltechnology.com/project-info-whats-needed-and-whats-not/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/project-info-whats-needed-and-whats-not/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 18:20:43 +0000</pubDate>
		<dc:creator>StaceyC</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=1208</guid>
		<description><![CDATA[ As the saying goes, you get what you ask for, and deciding what information is important to get from the team is one of the most important and challenging things for a Project Manager.  Most of the time team members are going to give you no more information than exactly what you are asking them [...]]]></description>
			<content:encoded><![CDATA[<p> As the saying goes, you get what you ask for, and deciding what information is important to get from the team is one of the most important and challenging things for a Project Manager.  Most of the time team members are going to give you no more information than exactly what you are asking them for.  One very important factor is determining what information you really want, and then phrasing the questions so that you will actually get useful information.  For example, if you ask a team member working on a task “How is it going? How are you doing on this task?” – you will most likely get a response like this “I am about 60% done with that or I <em>should </em>be done with that by next Friday”.  What is this information actually telling you?  In my opinion, a whole lot of nothing.  When did they start the task?  What was the original duration on the task?  Are they working full time on this task and this task only?  Maybe a better way to phrase the question to the team member would be…  “When do you expect to be done with the task, on what day?”  The point here is to actually get a date from the team member that they are committing to. </p>
<p>This now leads to inputting this information into the software that you are using to manage your project.  How important is it to understand the software application that you are using to manage your projects?  Not understanding what the software does or how it works can result in giving false information and dates to Sponsors, Stakeholders, and Team Members.  Most software applications have many advanced settings that people do not even know exist.  It is extremely important to figure out how you want to track information in the schedule and set it up correctly before beginning the project.  If you are going to be tracking duration then make sure that the settings are set on fixed duration, or if you are going to be tracking effort worked of the resource then make sure that the settings are set on fixed work, etc.  Trouble will definitely start to arise if these settings are not being used appropriately since this is how the dates are calculated in the software.  This now leads to a lot of other very important questions: 1) Are the calendars in your project set up correctly with all of the holidays and time off?  2) What type of constraints will be used in the plan?  3) Do you understand how these constraints are affecting your project and critical path?  4) How will you be defining critical activities and using critical paths in the plan?  5) Are you using a baseline to be able to show variance and slippage on tasks in the plan?  6) Do you have multiple views set up to fit the needs of the different audiences that will be viewing the plan?  7)  How often will you be updating status on the plan?  <img src='http://blog.pearltechnology.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> How often will you be changing the Data Date in the plan?</p>
<p>As a Project Manager you are managing time, cost, and scope/quality.  Managing any of these without an accurate schedule is very difficult and probably inaccurate.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/project-info-whats-needed-and-whats-not/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a custom pipeline component for Biztalk 2010 server (Part 1)</title>
		<link>http://blog.pearltechnology.com/creating-a-custom-pipeline-component-for-biztalk-2010-server-part-1/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/creating-a-custom-pipeline-component-for-biztalk-2010-server-part-1/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 13:34:35 +0000</pubDate>
		<dc:creator>HassanW</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=1190</guid>
		<description><![CDATA[This tutorial will show how to create a custom pipeline component for Biztalk server 2010. The pipeline component will be called "PeopleReader". The pipeline task is simple; it is going to consume an xml file on the receive port from a specified location, and then write a modified file to another location.The tutorial is going to cover all aspects of the custom pipeline coding, adding to orchestration, setting up ports, and debugging.]]></description>
			<content:encoded><![CDATA[<p><span style="color: black; font-size: 14pt; text-decoration: underline;"><strong>Custom Pipeline Component in C#:<br />
</strong></span></p>
<p><span style="color:black">Introduction<br />
</span></p>
<p><span style="color:black">This tutorial will show how to create a custom pipeline component for Biztalk server 2010. The pipeline component will be called &#8220;PeopleReader&#8221;. The pipeline task is simple; it is going to consume an xml file on the receive port from a specified location, and then write a modified file to another location.<br />
</span></p>
<p><span style="color:black">The xml content before passing through BizTalk:<br />
</span></p>
<p><span style="font-family:Courier New">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;ISO-8859-1&#8243;?&gt;<br />
</span></p>
<p><span style="font-family:Courier New">&lt;People&gt;<br />
</span></p>
<p style="margin-left: 36pt"><span style="font-family:Courier New">&lt;FirstName&gt;Peter&lt;/FirstName&gt;<br />
</span></p>
<p style="margin-left: 36pt"><span style="font-family:Courier New">&lt;LastName&gt;Decosta&lt;/LastName&gt;<br />
</span></p>
<p><span style="font-family:Courier New">&lt;/People&gt;<br />
</span></p>
<p><span style="color:black; font-size:12pt">The final xml file after passing through Biztalk :<br />
</span></p>
<p><span style="font-family:Courier New">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;ISO-8859-1&#8243;?&gt;<br />
</span></p>
<p><span style="font-family:Courier New">&lt;People&gt;<br />
</span></p>
<p style="margin-left: 36pt"><span style="font-family:Courier New">&lt;FirstName&gt;your_First_Name&lt;/FirstName&gt;<br />
</span></p>
<p style="margin-left: 36pt"><span style="font-family:Courier New">&lt;LastName&gt;your_Last_Name&lt;/LastName&gt;<br />
</span></p>
<p><span style="font-family:Courier New">&lt;/People&gt;<br />
</span></p>
<p><span style="color:black">The tutorial is going to cover all aspects of the custom pipeline coding, adding to orchestration, setting up ports, and debugging.<br />
</span></p>
<ol>
<li><span style="color:black">Creating C# project:<br />
</span></li>
</ol>
<p><span style="color:black">Open VS 2010 as administrator then go to &#8220;<strong>New Project</strong>&#8220;, then under Visual C# select Windows then class library, and name it People Reader (fig.1).<br />
</span></p>
<p><img src="http://blog.pearltechnology.com/wp-content/uploads/2011/04/042211_1324_Creatingacu11.png" alt="" /><span style="color:black; font-size:12pt"><br />
</span></p>
<p style="text-align: justify"><span style="color:black; font-size:12pt"><strong>Fig. 1</strong> creating the PeopleReader Class for the Custom Pipeline component<br />
</span></p>
<p style="text-align: justify">1.2 Adding references</p>
<p style="text-align: justify">The first step after the project is created is to add a reference to the BizTalk pipeline. In order to accomplish that, go to solution explorer; right click <strong>&#8220;references &#8220;</strong>then select <strong>&#8220;Add&#8221;</strong>.  On the Add Reference Dialog box select the <strong>&#8220;Browse&#8221;</strong> tab then go to your Biztalk server 2010  installation directory, in the case of this tutorial it&#8217;s <strong>&#8220;C:\Program Files (x86)\Microsoft BizTalk Server 2010&#8243;</strong> then select the reference <strong>&#8220;Microsoft.BizTalk.Pipeline.dll&#8221; </strong>then hit the &#8220;OK&#8221; button (fig2). Then right Click on <strong>&#8220;Class1.cs&#8221;</strong> then <strong>&#8220;rename&#8221;</strong>. Call the file &#8220;<strong>PeopleReader.cs&#8221;. </strong>Next Step is to add the namespaces necessary for this project and these are the following:</p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">using</span> System;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">using</span> System.Xml;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">using</span> System.IO;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">using</span> System.Collections;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">using</span> System.Text;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:green">//Biztalk stuff</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">using</span> Microsoft.BizTalk.Message.Interop;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">using</span> Microsoft.BizTalk.Component.Interop;<br />
</span></p>
<p><img src="http://blog.pearltechnology.com/wp-content/uploads/2011/04/042211_1324_Creatingacu21.png" alt="" />Fig.2 Adding a reference to <strong>&#8220;Microsoft.BizTalk.Pipeline.dll&#8221;.<br />
</strong></p>
<p style="text-align: justify">In order to build a custom Pipeline class, our Peoplereader class need to inherit from four interfaces which are in no specific order: IComponent, IcomponentUI,IpersistPropertyBag and IbaseComponent.</p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">Public</span><br />
<span style="color:blue">class</span><br />
<span style="color:#2b91af">PeopleReader</span>: <span style="color:#2b91af">IbaseComponent</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> ,<span style="color:#2b91af">IcomponentUI</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> ,<span style="color:#2b91af">IpersistPropertyBag</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> ,<span style="color:#2b91af">IcomponentUI</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p style="text-align: justify">Since this is a small project all the code can be in one file, however, in case the pipeline required heavy coding, I would recommend declaring the people reader class as partial, then separating the code to different files each inheriting from a different Interface, that will greatly facilitate readability, and scalability since multiple developer could be working on different parts of the Custom Pipeline.</p>
<p style="text-align: justify">Our next step is to declare that this class is going to a Pipeline component we do that by adding the following:[<span style="color:#2b91af">ComponentCategory</span>(<span style="color:#2b91af">CategoryTypes</span>.CATID_PipelineComponent)]  above the class declaration. Then we define where in the pipeline this component will go, by adding [<span style="color:#2b91af">ComponentCategory</span>(<span style="color:#2b91af">CategoryTypes</span>.CATID_Decoder)] which means that the component can only be added in the decoder stage of a receive pipeline. Last we need to create a &#8220;GUID&#8221; since it&#8217;s required for use in COM interop. To generate a new &#8220;GUID&#8221; go to the Tools Menu, then select the &#8220;Create GUID&#8221; Option, select GUID format 6 then hit copy (fig. 3). Paste the new GUID in [System.Runtime.InteropServices.<span style="color:#2b91af">Guid</span>(<span style="color:#a31515">"0D212B7D-F3E9-418B-92BA-9FBC36CF2948"</span>)] right above the class declaration.</p>
<p style="text-align: justify">
<p style="text-align: justify"><img src="http://blog.pearltechnology.com/wp-content/uploads/2011/04/042211_1324_Creatingacu31.png" alt="" /><span style="font-family:Consolas; font-size:9pt"><br />
</span></p>
<p>Fig.3 Creating a new GUID</p>
<ol>
<li>
<div style="text-align: justify">Defining public properties</div>
<p style="text-align: justify">
</li>
</ol>
<p style="text-align: justify">After adding the GUID, we declare two private member strings (m_FirstName, m_LastName) along with their (get, set) properties.  Those properties will allow the user to modify the content of &lt;FirstName&gt; and &lt;LastName&gt; Tags by exposing the properties to the pipeline designer at design time.</p>
<p style="text-align: justify">Your code should look like this at this point</p>
<p style="text-align: justify">
<p><span style="font-family:Consolas; font-size:9pt"> [<span style="color:#2b91af">ComponentCategory</span>(<span style="color:#2b91af">CategoryTypes</span>.CATID_PipelineComponent)]<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> [<span style="color:#2b91af">ComponentCategory</span>(<span style="color:#2b91af">CategoryTypes</span>.CATID_Decoder)]<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> [System.Runtime.InteropServices.<span style="color:#2b91af">Guid</span>(<span style="color:#a31515">"0D212B7D-F3E9-418B-92BA-9FBC36CF2948"</span>)]<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">public</span><br />
<span style="color:blue">partial</span><br />
<span style="color:blue">class</span><br />
<span style="color:#2b91af">PeopleReader</span>: <span style="color:#2b91af">IBaseComponent</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> ,<span style="color:#2b91af">IcomponentUI</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> ,<span style="color:#2b91af">IpersistPropertyBag</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> ,<span style="color:#2b91af">IcomponentUI</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">private</span><br />
<span style="color:blue">string</span> m_FirstName;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">private</span><br />
<span style="color:blue">string</span> m_LastName;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">public</span><br />
<span style="color:blue">string</span> FirstName<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">get</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">return</span> m_FirstName;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">set</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> m_FirstName = <span style="color:blue">value</span>;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">public</span><br />
<span style="color:blue">string</span> LastName<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">get</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">return</span> m_LastName;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">set</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> m_LastName = <span style="color:blue">value</span>;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p>1.4 Defining the IBaseComponent Members</p>
<p style="text-align: justify">Next we will define the IBaseComponent members. For ease of readability we create a new region then define the properties Description, Name, and version which represent the description for the Pipeline component we are creating, the Name as it will be seen in the BizTalk project and the version number.</p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue"> #region</span> IBaseComponent members<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">public</span><br />
<span style="color:blue">string</span> Description<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">get</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">return</span><br />
<span style="color:#a31515">&#8220;Pipeline component to Read XML with Peoples Name&#8221;</span>;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">public</span><br />
<span style="color:blue">string</span> Name<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">get</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">return</span><br />
<span style="color:#a31515">&#8220;PeopleReader Test Pipeline&#8221;</span>;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">public</span><br />
<span style="color:blue">string</span> Version<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">get</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">return</span><br />
<span style="color:#a31515">&#8220;1.0.0.0&#8243;</span>;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="color:blue; font-family:Consolas; font-size:9pt"> #endregion<br />
</span></p>
<ol>
<li>Defining the IComponentUI Members</li>
</ol>
<p style="text-align: justify">Next up is the IcomponentUI interface members, which contains the icon that will show up in Biztalk toolbox for pipeline and a validate method. We are going to define the icon to be the default system icon, and as far as validation we are not going to add any validation at this stage.</p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">#region</span> IcomponentUI members<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">public</span><br />
<span style="color:#2b91af">IntPtr</span> Icon<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">get</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">return</span><br />
<span style="color:blue">new</span> System.<span style="color:#2b91af">IntPtr</span>();<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">public</span><br />
<span style="color:#2b91af">Ienumerator</span> Validate(<span style="color:blue">object</span> projectSystem)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">return</span><br />
<span style="color:blue">null</span>;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue"> #endregion</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p>1.6 Defining the IPersistPropertyBag Members</p>
<p>IPersistPropertyBag Has 4 methods: GetClassID, InitNew, Load and Save</p>
<p>GetClassID: return a unique ID (the GUID we defined earlier) that represents the component</p>
<p>InitNew: used to establish structures (data, caching..) used by other IPersistPropertyBag methods, we are going to leave it blank for this tutorial</p>
<p>Load: used to load the properties values (in this case the value the user enters at design time)</p>
<p>Save: same as load but used to save the values.</p>
<p>In the code below I used two helper functions ReadPropertyBag and WritePropertyBag that are called from within the Load and Save methods.</p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue"> #region</span> IPersistPropertyBag members<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">public</span><br />
<span style="color:blue">void</span> GetClassID(<span style="color:blue">out</span><br />
<span style="color:#2b91af">Guid</span> classID)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> classID = <span style="color:blue">new</span><br />
<span style="color:#2b91af">Guid</span>(<span style="color:#a31515">&#8220;0D212B7D-F3E9-418B-92BA-9FBC36CF2948&#8243;</span>);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">public</span><br />
<span style="color:blue">void</span> InitNew()<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">public</span><br />
<span style="color:blue">void</span> Load(<span style="color:#2b91af">IPropertyBag</span> propertyBag, <span style="color:#2b91af">Int32</span> errorLog)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">string</span> val = (<span style="color:blue">string</span>)ReadPropertyBag(propertyBag, <span style="color:#a31515">&#8220;FirstName&#8221;</span>);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">if</span> (val != <span style="color:blue">null</span>)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> m_FirstName = val;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">else</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> m_FirstName = <span style="color:#a31515">&#8220;N/A&#8221;</span>;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> val = (<span style="color:blue">string</span>)ReadPropertyBag(propertyBag, <span style="color:#a31515">&#8220;LastName&#8221;</span>);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">if</span> (val != <span style="color:blue">null</span>)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> m_LastName = val;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">else</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> m_LastName = <span style="color:#a31515">&#8220;N/A&#8221;</span>;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">public</span><br />
<span style="color:blue">void</span> Save(<span style="color:#2b91af">IPropertyBag</span> propertyBag, <span style="color:blue">bool</span> clearDirty, <span style="color:blue">bool</span> saveAllProperties)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">object</span> val = (<span style="color:blue">object</span>)m_FirstName;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> WritePropertyBag(propertyBag,<span style="color:#a31515">&#8220;FirstName&#8221;</span>,val);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> val=(<span style="color:blue">object</span>)m_LastName;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> WritePropertyBag(propertyBag,<span style="color:#a31515">&#8220;LastName&#8221;</span>,val);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">private</span><br />
<span style="color:blue">static</span><br />
<span style="color:blue">object</span> ReadPropertyBag(<span style="color:#2b91af">IPropertyBag</span> propertyBag, <span style="color:blue">string</span> propertyName)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">object</span> val = <span style="color:blue">null</span>;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">try</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> propertyBag.Read(propertyName, <span style="color:blue">out</span> val, 0);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">catch</span> (<span style="color:#2b91af">ArgumentException</span>)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">return</span> val;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">catch</span> (<span style="color:#2b91af">Exception</span> ex)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">throw</span><br />
<span style="color:blue">new</span><br />
<span style="color:#2b91af">ApplicationException</span>(<span style="color:#a31515">&#8220;Error reading propertybag: &#8220;</span> + ex.Message);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">return</span> val;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">private</span><br />
<span style="color:blue">static</span><br />
<span style="color:blue">void</span> WritePropertyBag(<span style="color:#2b91af">IPropertyBag</span> propertyBag, <span style="color:blue">string</span> propertyName, <span style="color:blue">object</span> val)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">try</span><br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> propertyBag.Write(propertyName, <span style="color:blue">ref</span> val);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">catch</span> (<span style="color:#2b91af">Exception</span> ex)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">throw</span><br />
<span style="color:blue">new</span><br />
<span style="color:#2b91af">ApplicationException</span>(<span style="color:#a31515">&#8220;Error Writing propertybag: &#8220;</span> + ex.Message);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="color:blue; font-family:Consolas; font-size:9pt"> #endregion<br />
</span></p>
<p style="text-align: justify">1.7 Defining IComponent Members</p>
<p style="text-align: justify">Finally the most important Interface of the custom pipeline Icomponent which has one method Execute. BizTalk calls the execute method to process the message, and then passes the context of the message and the message.</p>
<p><span style="font-family:Consolas; font-size:9pt"><span style="color:blue">#region</span> Icomponent members<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">public</span><br />
<span style="color:#2b91af">IbaseMessage</span> Execute(<span style="color:#2b91af">IpipelineContext</span> pContext, <span style="color:#2b91af">IbaseMessage</span> pInMsg)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:#2b91af">IbaseMessagePart</span> bodyPart = pInMsg.BodyPart;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:#2b91af">StringBuilder</span> outputMessageText = <span style="color:blue">null</span>;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">if</span> (bodyPart != <span style="color:blue">null</span>)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:#2b91af">Stream</span> originalStream = bodyPart.GetOriginalDataStream();<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">if</span> (originalStream != <span style="color:blue">null</span>)<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> {<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:#2b91af">XmlDocument</span> xdoc = <span style="color:blue">new</span><br />
<span style="color:#2b91af">XmlDocument</span>();<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> xdoc.Load(originalStream);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:#2b91af">XmlElement</span> root = xdoc.DocumentElement;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:#2b91af">XmlNodeList</span> firstName = xdoc.GetElementsByTagName(<span style="color:#a31515">&#8220;FirstName&#8221;</span>);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:#2b91af">XmlNodeList</span> lastName = xdoc.GetElementsByTagName(<span style="color:#a31515">&#8220;LastName&#8221;</span>);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> outputMessageText = <span style="color:blue">new</span><br />
<span style="color:#2b91af">StringBuilder</span>();<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> outputMessageText.Append(<span style="color:#a31515">&#8220;&lt;?xml version=\&#8221;1.0\&#8221;<br />
</span></span></p>
<p style="margin-left: 72pt"><span style="font-family:Consolas; font-size:9pt"><span style="color:#a31515">encoding=\&#8221;ISO-8859-1\&#8221;?&gt;&#8221;</span>);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> outputMessageText.Append(<span style="color:#a31515">&#8220;&lt;&#8221;</span> + root.Name + <span style="color:#a31515">&#8220;&gt;&#8221;</span>);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> outputMessageText.Append(<span style="color:#a31515">&#8220;&lt;&#8221;</span> + firstName[0].Name + <span style="color:#a31515">&#8220;&gt;&#8221;</span><br />
</span></p>
<p style="margin-left: 72pt"><span style="font-family:Consolas; font-size:9pt"> + <span style="color:blue">this</span>.m_FirstName + <span style="color:#a31515">&#8220;&lt;/&#8221;</span> + firstName[0].Name + <span style="color:#a31515">&#8220;&gt;&#8221;</span>);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> outputMessageText.Append(<span style="color:#a31515">&#8220;&lt;&#8221;</span> + lastName[0].Name + <span style="color:#a31515">&#8220;&gt;&#8221;</span><br />
</span></p>
<p style="margin-left: 36pt"><span style="font-family:Consolas; font-size:9pt"> + <span style="color:blue">this</span>.m_LastName  + <span style="color:#a31515">&#8220;&lt;/&#8221;</span> + lastName[0].Name + <span style="color:#a31515">&#8220;&gt;&#8221;</span>);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> outputMessageText.Append(<span style="color:#a31515">&#8220;&lt;/&#8221;</span> + root.Name + <span style="color:#a31515">&#8220;&gt;&#8221;</span>);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">byte</span>[] outBytes =<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> System.Text.<span style="color:#2b91af">Encoding</span>.ASCII.GetBytes(outputMessageText.ToString());<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:#2b91af">MemoryStream</span> memStream = <span style="color:blue">new</span><br />
<span style="color:#2b91af">MemoryStream</span>();<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> memStream.Write(outBytes, 0, outBytes.Length);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> memStream.Position = 0;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> bodyPart.Data = memStream;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> pContext.ResourceTracker.AddResource(memStream);<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"><br />
<span style="color:blue">return</span> pInMsg;<br />
</span></p>
<p><span style="font-family:Consolas; font-size:9pt"> }<br />
</span></p>
<p><span style="color:blue; font-family:Consolas; font-size:9pt"> #endregion<br />
</span></p>
<p style="text-align: justify">
<p style="text-align: justify">1.8 Compilation and strong key creation for Assembly</p>
<p style="text-align: justify">Finally we can compile the code and check that the solution build succeeded. Next step though is to assign a key to the assembly.</p>
<p style="text-align: justify">Start the &#8220;Visual Studio&#8221; command prompt (fig 1.4). Make sure it&#8217;s not the windows command prompt!!!</p>
<p style="text-align: justify"><img src="http://blog.pearltechnology.com/wp-content/uploads/2011/04/042211_1324_Creatingacu41.png" alt="" /><span style="font-size:12pt"><br />
</span></p>
<p style="text-align: justify">Fig.1.4 starting the VS command Prompt</p>
<p style="text-align: justify">Go to the directory where your solution is, to do that type CD\ + whatever_your_directory_is  in our case it&#8217;s CD\ Users\yourusername\Documents\Visual Studio 2010\Projects then hit enter. For the simplicity I am going to create a key under C:\temp (fig. 5)</p>
<p style="text-align: justify"><img src="http://blog.pearltechnology.com/wp-content/uploads/2011/04/042211_1324_Creatingacu51.png" alt="" /><span style="font-size:12pt"><br />
</span></p>
<p style="text-align: justify">Fig. 5 creating a strong key</p>
<p style="text-align: justify">After the key is created go to solution explorer, then right click on your project and select properties. Select the signing tab then check the &#8220;sign assembly&#8221; check box, and from the drop down menu select browse, then navigate to where you create your strong key (fig. 6).</p>
<p style="text-align: justify"><img src="http://blog.pearltechnology.com/wp-content/uploads/2011/04/042211_1324_Creatingacu61.png" alt="" /><span style="font-size:12pt"><br />
</span></p>
<p style="text-align: justify">Fig. 6 attaching the strong key to the assembly</p>
<p style="text-align: justify">
<p style="text-align: justify">Then compile again!</p>
<p style="text-align: justify"><span style="font-size:12pt"><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/creating-a-custom-pipeline-component-for-biztalk-2010-server-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting out of a bind &#8212; with bindings</title>
		<link>http://blog.pearltechnology.com/getting-out-of-a-bind-with-bindings/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/getting-out-of-a-bind-with-bindings/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 12:12:52 +0000</pubDate>
		<dc:creator>RobB</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Bindings]]></category>
		<category><![CDATA[Converters]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=1152</guid>
		<description><![CDATA[Converters in WPF are quite possibly the most useful tool that I&#8217;ve used in the relatively short time I&#8217;ve spent developing WPF applications.  They give the ability to format data, style controls, and more, based on the value supplied from a binding.  And it doesn&#8217;t even have to be a binding to a data source.  [...]]]></description>
			<content:encoded><![CDATA[<p>Converters in WPF are quite possibly the most useful tool that I&#8217;ve used in the relatively short time I&#8217;ve spent developing WPF applications.  They give the ability to format data, style controls, and more, based on the value supplied from a binding.  And it doesn&#8217;t even have to be a binding to a data source.  You can bind to a property of another control on the page.  Lets take a look at a couple of examples.</p>
<p><span style="text-decoration: underline;">Setting a property based on a data value:</span></p>
<p>In this example, we have a label on a form that will display a dollar amount from our data source.  If the dollar amount is negative we want the label&#8217;s background to be red, and green if the value is positive.  To do this, we simply create a converter class in our code behind page.  This will use the numeric value and return a Brush object which we will use in our label&#8217;s Background property.  Here&#8217;s the code for the converter:</p>
<p style="text-align: center;"><img class="size-large wp-image-1153 aligncenter" title="cellbackgroundconverter" src="http://blog.pearltechnology.com/wp-content/uploads/2011/04/cellbackgroundconverter-1024x312.jpg" alt="cellbackgroundconverter" width="1024" height="312" /></p>
<p>We then have to create a simple reference to our converter class in our ResourceDictionary in the Window.Resources section of our XAML:</p>
<p><img class="alignnone size-full wp-image-1154" title="converterdefinition" src="http://blog.pearltechnology.com/wp-content/uploads/2011/04/converterdefinition.JPG" alt="converterdefinition" width="397" height="30" /></p>
<p>So far so good.  Now all we have to do is bind the label&#8217;s background property to the converter and data value.  Notice that we have to bind both the label&#8217;s content (text) and background to the Amount value from our data context.  We also can set the ContentStringFormat property to automatically format the value as currency:</p>
<p style="text-align: center;"><img class="size-full wp-image-1155 aligncenter" title="labelwithconverterbinding" src="http://blog.pearltechnology.com/wp-content/uploads/2011/04/labelwithconverterbinding.JPG" alt="labelwithconverterbinding" width="709" height="39" /></p>
<p><span style="text-decoration: underline;">Setting a property based on another control&#8217;s property:</span></p>
<p>This method is useful when there isn&#8217;t a data field to bind to, but there is a need to conditionally set a control&#8217;s property.  Let&#8217;s assume we need to set a button control&#8217;s IsEnabled property based on a check box&#8217;s IsChecked property:</p>
<p style="text-align: center;"><img class="size-full wp-image-1158 aligncenter" title="bindingtocontrolproperties" src="http://blog.pearltechnology.com/wp-content/uploads/2011/04/bindingtocontrolproperties1.JPG" alt="bindingtocontrolproperties" width="754" height="144" /></p>
<p>As you can see, we&#8217;ve bound the IsEnabled property of the buttons to the IsChecked property of  the check box by specifying the ElementName (control&#8217;s name) and Path (control&#8217;s property).  We also bound the Content property of the button to the same IsChecked property using the same method, to show the current state of the button (which the framework automatically converts from a boolean to a string).  The best part about this method?  No code behind!  Here&#8217;s the result:</p>
<p style="text-align: center;"><img class="size-full wp-image-1159 aligncenter" title="bindingtocontrolpropertiesresult" src="http://blog.pearltechnology.com/wp-content/uploads/2011/04/bindingtocontrolpropertiesresult.JPG" alt="bindingtocontrolpropertiesresult" width="115" height="101" /></p>
<p style="text-align: left;">This is a very simple overview of the power of converters and bindings, and how they can be used to help you do more than just display the data on your page.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/getting-out-of-a-bind-with-bindings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Entity Relationship Diagram in Visio</title>
		<link>http://blog.pearltechnology.com/creating-entity-relationship-diagram-in-visio/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/creating-entity-relationship-diagram-in-visio/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 20:23:18 +0000</pubDate>
		<dc:creator>Geer</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[ER Diagram]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Visio]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=1074</guid>
		<description><![CDATA[This article shows you how to use Visio to create database diagram (or ER diagram) for databases such as Access, PostgreSQL, MySQL...]]></description>
			<content:encoded><![CDATA[<p>It is a common task for a developer to build an Entity Relationship (ER) Diagram for an existing database.  If you are dealing with an MS SQL Server, this can be done easily within SQL Server Management Studio, but what if you are given a database in MS Access, PostgreSQL, or MySQL.  There are tools (such as ModelRight) to help you with this, but if you have got MS Visio Professional Edition, you have another option.</p>
<p>Since Visio 2003, a new feature, Reverse Engineer, has been made available in its Professional edition (and Premium edition in Visio 2010).  This feature allows you to connect to an existing database, extract database schema, and create an ER Diagram automatically.  You can also lay things out in the way that you want, and catch changes made to the database.</p>
<p>The key here is to create a connection to your database.  It does not have to be a Microsoft database.  Most likely, if there is an ODBC Data Source defined on your computer, you can connect to your database in Visio and generate the diagram.  In the rest of this article, I will show you how to generate an ER Diagram for an existing Access Database using Visio 2010 Professional Edition.  The process would be similar for connecting to other types of databases.</p>
<ol>
<li>Make sure you have an ODBC Data Source defined for MS Access Database.  Usually, you do not have to do this for Access Database.  It should have been created when Office or Visio is installed.  For other types of databases, you may need to first install an ODBC Driver which is often available from your database provider.</li>
<li>Start Visio, and choose <strong>Database Model Diagram</strong> Template under <strong>Software and Database</strong> Template Category.  It is important to choose the right template, or you will not see the feature we want to use.<img class="aligncenter size-full wp-image-1076" title="ChooseTemplate" src="http://blog.pearltechnology.com/wp-content/uploads/2011/03/ChooseTemplate.JPG" alt="ChooseTemplate" width="500" height="263" /></li>
<li>Once the file is created, you will see two new things that you normally do not see.  The <strong>Tables and Views</strong> window in the <strong>Task Pane</strong>, and the <strong>Database Tab </strong>in the Ribbon area.  Please note that you will not see them, if you did not choose the right template in step #2.<img class="aligncenter size-full wp-image-1079" title="NewThings" src="http://blog.pearltechnology.com/wp-content/uploads/2011/03/NewThings.JPG" alt="NewThings" width="500" height="396" /></li>
<li>Click on the <strong>Reverse Engineer</strong> button under the <strong>Database Tab</strong> to start the <strong>Reverse Engineer Wizard</strong>.<img class="aligncenter size-full wp-image-1083" title="ReverseEngineerWizard" src="http://blog.pearltechnology.com/wp-content/uploads/2011/03/ReverseEngineerWizard.JPG" alt="ReverseEngineerWizard" width="500" height="317" /></li>
<li>Select <strong>Microsoft Access</strong> in the <strong>Installed Visio drivers</strong> drop down list, and choose <strong>MS Access Database</strong> as the data source. (If you are connecting to another type of database, you may have to choose ODBC Generic Driver in this step.)<img class="aligncenter size-full wp-image-1084" title="SelectDataSource" src="http://blog.pearltechnology.com/wp-content/uploads/2011/03/SelectDataSource.JPG" alt="SelectDataSource" width="500" height="329" /></li>
<li>Then you will be asked for user credential.  Leave them blank if the database is not password protected. (This step may look different, if you are connecting to another type of database, but the wizard should lead you through the data source setup in a similar way.)  Select your Access Database file and click OK to continue.<img class="aligncenter size-full wp-image-1082" title="PickFile" src="http://blog.pearltechnology.com/wp-content/uploads/2011/03/PickFile.JPG" alt="PickFile" width="411" height="428" /></li>
<li>You will be given the chance to select types of objects you want to pull from your database.  Do all that and then click Next to continue.<img class="aligncenter size-full wp-image-1080" title="ObjectOptions" src="http://blog.pearltechnology.com/wp-content/uploads/2011/03/ObjectOptions.JPG" alt="ObjectOptions" width="500" height="329" /><img class="aligncenter size-full wp-image-1085" title="Tables" src="http://blog.pearltechnology.com/wp-content/uploads/2011/03/Tables.JPG" alt="Tables" width="500" height="329" /><img class="aligncenter size-full wp-image-1081" title="OtherOptions" src="http://blog.pearltechnology.com/wp-content/uploads/2011/03/OtherOptions.JPG" alt="OtherOptions" width="500" height="329" /></li>
<li>After everything is set, click Finish to close the wizard window.<img class="aligncenter size-full wp-image-1077" title="Confirmation" src="http://blog.pearltechnology.com/wp-content/uploads/2011/03/Confirmation.JPG" alt="Confirmation" width="500" height="329" /></li>
<li>Visio will then connect to your database, and pull desired information back.  Tables and Views will be placed in the <strong>Task Pane</strong>, and shapes and connections will be drawn on the current page (if you chose to do so in step #7).<img class="aligncenter size-full wp-image-1078" title="Diagram" src="http://blog.pearltechnology.com/wp-content/uploads/2011/03/Diagram.JPG" alt="Diagram" width="500" height="430" /></li>
<li>You can drag the entities around on the page without breaking the relationships, and click the Refresh button under the Database tab to get changes from the database.  During the update, new Tables or Views will be added to the <strong>Task Pane</strong>, changes may be applied to the diagram, and everything else should be kept unchanged.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/creating-entity-relationship-diagram-in-visio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chrome Extensions</title>
		<link>http://blog.pearltechnology.com/chrome-extensions/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/chrome-extensions/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 13:42:54 +0000</pubDate>
		<dc:creator>BJ</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[chrome extensions]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[lorem ipsum generator]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=1108</guid>
		<description><![CDATA[Discovering any tool, extension, shortcut etc that helps make your life easier is always a good thing. While testing an application, I had two tabs open in Chrome. Refreshing each tab individually after updating the application is not a big deal, but having to constantly do it gets annoying. So, after searching I found a [...]]]></description>
			<content:encoded><![CDATA[<p>Discovering any tool, extension, shortcut etc that helps make your life easier is always a good thing. While testing an application, I had two tabs open in Chrome. Refreshing each tab individually after updating the application is not a big deal, but having to constantly do it gets annoying. So, after searching I found a Chrome extension that will refresh all open tabs. All extensions can be found in the <a href="https://chrome.google.com/webstore" target="_blank">Chrome Web Store</a>. The web store has many, many extensions that are grouped by different categories, themes, collections and can be searched as well.</p>
<p>A few other handy extensions besides &#8220;Reload All Tabs&#8221; are: JavaScript Beautifer, jQuery API browser, and Lorem Ipsum Generator.</p>
<p>The JavaScript Beautifier extension will &#8220;beautify&#8221; a long, hard to read JavaScript file that looks like this:</p>
<p>if(typeof deconcept==&#8221;undefined&#8221;){var deconcept=new Object();}if(typeof deconcept.util==&#8221;undefined&#8221;){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil==&#8221;undefined&#8221;){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:&#8221;detectflash&#8221;;this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);  &#8230;</p>
<p>and make it look like this:</p>
<p><img class="alignleft size-full wp-image-1128" title="JS-Beautifier" src="http://blog.pearltechnology.com/wp-content/uploads/2011/03/JS-Beautifier1.png" alt="JS-Beautifier" width="600" height="500" /></p>
<p>For anyone that likes jQuery, the jQuery API browser will also come in handy. It provides a quick search through the API documentation. Simply type in what you want to search for and you&#8217;ll receive your results.</p>
<p><img class="alignleft size-full wp-image-1126" title="jQueryAPI" src="http://blog.pearltechnology.com/wp-content/uploads/2011/03/jQueryAPI1.png" alt="jQueryAPI" width="679" height="331" /></p>
<p>A lot of times while testing an application you&#8217;ll need some generic text to populate text fields. The Lorem Ipsum Generator will provide you with random &#8220;Lorem Ipsum&#8221; text. You can specify how many paragraphs and words per paragraph you would like.</p>
<p><img class="alignleft size-full wp-image-1137" title="LoremIpsumGenerator" src="http://blog.pearltechnology.com/wp-content/uploads/2011/03/LoremIpsumGenerator.png" alt="LoremIpsumGenerator" width="600" height="155" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/chrome-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to select unique data in asynchronous SQL queries</title>
		<link>http://blog.pearltechnology.com/how-to-select-unique-data-in-asynchronous-sql-queries/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/how-to-select-unique-data-in-asynchronous-sql-queries/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 13:01:05 +0000</pubDate>
		<dc:creator>Geer</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Asynchronous SQL Query]]></category>
		<category><![CDATA[Unique]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=1097</guid>
		<description><![CDATA[In this article, it talks about how to query data asynchronously and make sure the same record will only be selected once.]]></description>
			<content:encoded><![CDATA[<p>Before I move on, I should make my subject clear.  I am not talking about the DISTINCT in a regular SQL SELECT statement.  What I am trying to achieve is to fetch data repeatedly and asynchronously and make sure the same record will only be pulled once.</p>
<p>Think about the case where customers are continuously sending orders to you, and you are batch-processing these orders.  (Batch-processing would generally increase the processing efficiency in cases like this.)  The orders are stored in a SQL Server Database, and there is a service written to repeatedly pull order records back from the database for processing.</p>
<p>In synchronous operation, there is no problem.  The service could select all unprocessed orders from the database, process them, mark them as processed in the database, and repeat the same process over and over again.  The same order will only be processed once, and no order will be missed.</p>
<p>However, in asynchronous operation (or multi-threading), there may be a problem.  When one thread picks up some unprocessed orders from the database, it is not guaranteed that they are not being processed on another thread.</p>
<p>Well, you could let the service pick up the orders and then mark them as being processed, so other threads won’t pick them up again.  However, unless you can select and mark them at the same time, other threads can still squeeze in the small time interval between after you select them and before you mark them in the database.</p>
<p>Can we select and mark the orders at the same time?  Yes, we can use the OUTPUT statement in an SQL UPDATE and SQL transactions to achieve this.  Basically, we mark (update) orders and then select the ones we just marked (updated) within a single SQL transaction.  Here is a demonstration.</p>
<pre name="code" language="SQL">
CREATE TABLE [dbo].[Orders](
	[OrderId] [int] NOT NULL,
	[State] [varchar](50) NOT NULL
) ON [PRIMARY]

GO

INSERT INTO [TestDb].[dbo].[Orders] ([OrderId], [State])
     VALUES (1, 'Waiting for processing')
INSERT INTO [TestDb].[dbo].[Orders] ([OrderId], [State])
     VALUES (2, 'Waiting for processing')
INSERT INTO [TestDb].[dbo].[Orders] ([OrderId], [State])
     VALUES (3, 'Waiting for processing')
GO

UPDATE Orders
SET [State] = 'In processing'
OUTPUT inserted.*
WHERE [State] = 'Waiting for processing'
</pre>
<p>In the SQL statements above, we defined a simple table to store orders, and insert some order records.  In the UPDATE statement, we marked all orders in “waiting for processing” state as “In processing”, and output (return) the orders we just updated.  The keyword “inserted” is somewhat confusing, because we are not inserting new records.  To me, “updated” would make more sense.  Anyway, the result of the UPDATE SQL statement should look like:</p>
<p><code><br />
OrderId	State<br />
-------- --------<br />
1		In processing<br />
2		In processing<br />
3		In processing<br />
</code><br />
In real practice, we should put the UPDATE statement in a SQL transaction, no matter whether it is handled in a Stored Procedure or in the application layer.  By doing this, each order will only be picked up once, no matter how many threads are querying the database using the same SQL statement at the same time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/how-to-select-unique-data-in-asynchronous-sql-queries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spotting inefficiencies in Microsoft Access projects</title>
		<link>http://blog.pearltechnology.com/spotting-inefficiencies-in-microsoft-access-projects/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/spotting-inefficiencies-in-microsoft-access-projects/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 14:09:14 +0000</pubDate>
		<dc:creator>BrianW</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=1069</guid>
		<description><![CDATA[ Most businesses use Microsoft Office products as a cheap and simple solution to
    meet everyday business needs. Typically, what begins as a simple way to store
    and process data,  becomes a time-consuming, error-prone  process that is difficult
    to manage and maintain. Fortunately, we has extensive experience in
    automating, streamlining and extending these processes.
 Businesses who fall [...]]]></description>
			<content:encoded><![CDATA[<p> Most businesses use Microsoft Office products as a cheap and simple solution to<br />
    meet everyday business needs. Typically, what begins as a simple way to store<br />
    and process data,  becomes a time-consuming, error-prone  process that is difficult<br />
    to manage and maintain. Fortunately, we has extensive experience in<br />
    automating, streamlining and extending these processes.</p>
<p> Businesses who fall into the above category generally don’t realize how powerful<br />
    MS Access really is. They may use Excel to format data, import that data into Access<br />
    and then use that data to update, query and report on. The following are almost standard<br />
    practice in small and large businesses:</p>
<p>  • Use Excel to format data<br />
  • Use multiple (manual) steps to maintain an excel spreadsheet<br />
  • Use multiple (manual) steps to update an Access table<br />
  • Combine data stored in multiple spreadsheets or tabs<br />
  • Create reports manually<br />
  • Create files (exported) manually<br />
  • Get data from a database (sql)<br />
  • Use multiple Access databases. (can typically use 1)</p>
<p> Pearl Technology has extensive experience with automation, streamlining and enhancing<br />
    these points. Examples:</p>
<p>  • Create data entry screens<br />
  • Create forms to automate most manual processes<br />
  • Create backup files/tables<br />
  • Create log files to track changes<br />
  • Link to external data, tables, files…<br />
  • Validate input data<br />
  • Set up auditing queries<br />
  • Create reports<br />
  • Create export queries (to excel, flat files..)</p>
<p> These are all good selling points for MS office product users.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/spotting-inefficiencies-in-microsoft-access-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exploring a new role&#8230;</title>
		<link>http://blog.pearltechnology.com/exploring-a-new-role/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://blog.pearltechnology.com/exploring-a-new-role/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 21:47:45 +0000</pubDate>
		<dc:creator>EmilyH</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.pearltechnology.com/?p=1027</guid>
		<description><![CDATA[As a fairly new project manager I am in the process of getting reacquainted with my team in a completely different capacity. It is interesting to see the differences in culture transitioning from a marketing role working mostly with sales professionals to working with a team of application developers. Sales executives are notoriously extroverted in [...]]]></description>
			<content:encoded><![CDATA[<p>As a fairly new project manager I am in the process of getting reacquainted with my team in a completely different capacity. It is interesting to see the differences in culture transitioning from a marketing role working mostly with sales professionals to working with a team of application developers. Sales executives are notoriously extroverted in nature while often application developers tend to be a bit more reserved. I am used to fighting for a chance to talk in meetings and working to get my point across while now I have opportunity to speak at length. Challenges notwithstanding, I am thoroughly enjoying my new role. I have had the opportunity to see a completely different side of our business in the delivery of our service and interact on a new level with our customers. Managing our development projects has a whole new set of challenges and has already proven to be an exciting ride!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pearltechnology.com/exploring-a-new-role/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

