<?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>TECKpert &#187; Coding Tips</title>
	<atom:link href="http://www.teckpert.com/category/coding-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.teckpert.com</link>
	<description>Your web and software development experts</description>
	<lastBuildDate>Thu, 02 Sep 2010 22:33:42 +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>DOM manipulation with PHP, the ultimate page scraper?</title>
		<link>http://www.teckpert.com/php/dom-manipulation-with-php-the-ultimate-page-scraper/</link>
		<comments>http://www.teckpert.com/php/dom-manipulation-with-php-the-ultimate-page-scraper/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 13:21:10 +0000</pubDate>
		<dc:creator>Andres</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Coding Tips]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[dom manipulation]]></category>
		<category><![CDATA[domdocument]]></category>
		<category><![CDATA[html scrapping]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[regular expression]]></category>
		<category><![CDATA[xPath]]></category>
		<category><![CDATA[xQuery]]></category>
		<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://www.teckpert.com/?p=395</guid>
		<description><![CDATA[These days we hear a good deal about DOM manipulation with JavaScript but some little known technologies ( for now - they're quickly gaining ground ) are xPath, xQuery &#038; XSLT.
Fellow developers will know that historically we've had to rely on a number of regular expressions to scrape a page and while this can most often be fast, it's sometimes horrendous to read and edit as a TINY mis-write can effectively render the Regular Expression useless. That's not to say it's not useful when the hierarchy is small and simple but in today's world of web 2.0 designs they're often not.]]></description>
			<content:encoded><![CDATA[<p>These days we hear a good deal about DOM manipulation with JavaScript but some little known technologies ( for now &#8211; they&#8217;re quickly gaining ground ) are xPath, xQuery &amp; XSLT.</p>
<p>Fellow developers will know that historically we&#8217;ve had to rely on a number of regular expressions to scrape a page and while this can most often be fast, it&#8217;s sometimes horrendous to read and edit as a TINY mis-write can effectively render the Regular Expression useless. That&#8217;s not to say it&#8217;s not useful when the hierarchy is small and simple but in today&#8217;s world of web 2.0 designs they&#8217;re often not.</p>
<p><strong>What is page scraping?</strong></p>
<p>Page scraping is a method that allows you to pull information from a web page, so that the data can be manipulated inside your own script. In your script, you can connect to another URL and request a page, just like a browser would do it.  Once you make the request, the web server will send back the page you asked for and your script can manipulate the data and extract specific information.</p>
<p><strong>What exactly does the DomDocument Object do?</strong></p>
<p>If you&#8217;re not familiar with the DOM model than the following explanation probably isn&#8217;t going to make much sense as there really isn&#8217;t too much to say besides, DomDocument transform&#8217;s an HTML page into a tree-model of elements.  JavaScript does this upon load and is the entire point to the language: Dom Manipulation.  I find a visual representation often helps to understand the tree model so here is a simplified version of the aforementioned model present in DOM:</p>
<p style="text-align: center; "><img class="size-medium wp-image-426 aligncenter" title="dom" src="http://www.teckpert.com/wp-content/uploads/2009/12/dom-300x251.jpg" alt="dom" width="300" height="251" /></p>
<p>The above is a representation of the following HTML:</p>
<pre class="brush:html">&lt;div&gt;
    &lt;ul&gt;
        &lt;li&gt;
            &lt;a href="#"&gt;URL&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;
            &lt;a href="#"&gt;&lt;img src="#" /&gt;&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;
            &lt;a href="#"&gt;URL&lt;/a&gt;
        &lt;/li&gt;
    &lt;ul&gt;
&lt;/div&gt;</pre>
<p><strong>Sidenote</strong>: If your development background is based on the more traditional languages this will look familiar to you as resembles the Binary Tree, how ever, DOM supports a limitless number of children per node.</p>
<p>Through the DomDocument object we are given to the ability to traverse the nodes, create them, and remove them as we see fit. However sometimes traversing the levels of DOM solely through the methods provided to us by the object is cumbersome and altogether impractical given the depth of the information that we sometimes need. Enter xPath; it is to XML compliant mark up languages what SQL is to databases, a query language. The entire breadth of xPath is outside the scope of this particular post but is covered in depth <a href="http://en.wikipedia.org/wiki/XPath_2.0" target="_blank">here</a>. If you&#8217;re familiar with jQuery or any other JavaScript framework which supports CSS style selectors this&#8217;ll be easy for you.</p>
<p><strong>How to use xPath with DomDocument</strong></p>
<p>We&#8217;ll start off with something basic as an introduction, we&#8217;ll scrape the &#8220;Why us&#8221; section of TECKpert&#8217;&#8217;s homepage.</p>
<pre class="brush:php">&lt;?php

// Define our URL &amp; Start Dom Document
$url = 'http://www.teckpert.com';
$doc = new DOMDocument;

// Load the html into our object
$doc-&gt;loadHTMLFile($url);

// Alternatively this works too
$html = file_get_contents($url);
$doc-&gt;loadHTML($html);

// Now that we've created our dom object proper
// call the xPath object
$xPath = new DOMXPath( $doc );

// Query TECKpert's dom for the 'why us' section
$results = $xPath-&gt;query('//div[@class="why_us"]');

echo $results-&gt;item(0)-&gt;textContent;</pre>
<p>Simple to use right? There will be more to come on the onset of technologies associates with XML traversing and it&#8217;s related query languages.</p>
<p><strong>Note on this article</strong><br />
There exists the possibility of violating copyright laws using techniques outlined in this article if you misuse data you scrape. Please scrape responsibly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teckpert.com/php/dom-manipulation-with-php-the-ultimate-page-scraper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Development: Your own Plugins Part II</title>
		<link>http://www.teckpert.com/blog/jquery-development-your-own-plugins-part-2/</link>
		<comments>http://www.teckpert.com/blog/jquery-development-your-own-plugins-part-2/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 23:26:16 +0000</pubDate>
		<dc:creator>Andres</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Coding Tips]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery plugin]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.teckpert.com/?p=356</guid>
		<description><![CDATA[Extending on my previous post jQuery development: Your own plugins, we now have to take a look into a more complex plugin as well as making greater use of both JavaScript's built in Regular Expression objects and jQuery provided functionality.]]></description>
			<content:encoded><![CDATA[<p>Extending on my previous post <a href="http://www.teckpert.com/blog/jquery-development-your-own-plugins/" target="_blank">jQuery development: Your own plugins</a><a href="http://www.teckpert.com/blog/jquery-development-your-own-plugins/"></a>, we now have to take a look into a more complex plugin as well as making greater use of both JavaScript&#8217;s built in <a href="http://en.wikipedia.org/wiki/Regular_expression" target="_blank">Regular Expression</a> objects and jQuery provided functionality.</p>
<p>For the purposes of this post, I&#8217;ll be extending on the previous plugin to readily handle more video services: Dailymotion, Megavideo &amp; Vimeo as well as the already supported YouTube. Also, we&#8217;ll be adding an option to leave the link but make the video pop up in a modal box using ColorBox.</p>
<p><strong>Okay enough intro&#8230;let&#8217;s code!</strong></p>
<p>First, we&#8217;re going to start off with the basic structure of every jQuery plugin:</p>
<pre class="brush:js">(function($){
    $.fn.videa = function(){
    }
})(jQuery)</pre>
<p><strong>Note:</strong> We use this format for the purpose of ease and using the familiar $ variable, however we can just do this.</p>
<pre class="brush:js">jQuery.fn.videa = function(){
   //How ever, within here we can only use the jQuery object,
   // $ is undefined.
}</pre>
<p>First we&#8217;re going to need the embed code for each service. This is readily<br />
available on their websites as well as the format for their actual flv&#8217;s.<br />
I&#8217;ve already done this below.</p>
<p><strong>Note:</strong> I&#8217;ve made use of JSON. If you don&#8217;t know about this, read up <a href="http://en.wikipedia.org/wiki/JSON" target="_blank">here</a>.</p>
<pre class="brush:js">(function($){

    $.fn.videa= function(){

        var supportedSites = {
            'youtube' : '&lt;object width="560" height="340"&gt;&lt;param name="movie" value="[URL]&amp;hl=en&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="[URL]&amp;hl=en&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"&gt;&lt;/embed&gt;&lt;/object&gt;',
            'dailymotion': '&lt;object width="480" height="275"&gt;&lt;param name="movie" value="[URL]"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;/param&gt;&lt;embed src="[URL]" type="application/x-shockwave-flash" width="480" height="275" allowfullscreen="true" allowscriptaccess="always"&gt;&lt;/object&gt;',
            'megavideo': '&lt;object width="640" height="467"&gt;&lt;param name="movie" value="[URL]"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;embed src="[URL]" type="application/x-shockwave-flash" allowfullscreen="true" width="640" height="467"&gt;&lt;/embed&gt;&lt;/object&gt;',
            'vimeo'    : '&lt;object width="400" height="225"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="[URL]" /&gt;&lt;embed src="[URL]" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"&gt;&lt;/embed&gt;&lt;/object&gt;'
        }

        var handle = {
            'youtube'    : ['watch?v=', 'v/'],
            'dailymotion': [/.*dailymotion.*\/video\/(.*?)_.*/, 'http://dailymotion.com/swf/$1'],
            'megavideo'  : ['?v=', 'v/'],
            'vimeo'      : [/.*vimeo.*\/(.*[0-9])/, 'http://vimeo.com/moogaloop.swf?clip_id=$1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1']
        }</pre>
<p>Next, we&#8217;ll need to make use of each utility; this is something that will be used in nearly <strong>ALL </strong>your plugins. The reason why is because you want the plugin to affect more than one HTML element.</p>
<pre class="brush:js">(function($){
    $.fn.videa= function(){
        // We're of course assuming the aforementioned json is here
        // ommited for the purposes of readability
      this.each(function(){
      })
})(jQuery)</pre>
<p>Now, for our purposes we don&#8217;t actually need to instantiate a jQuery object per &lt;a&gt; element &#8211; yet. All we need is the href and class attributes which are easily available via JavaScript&#8217;s native <a href="https://developer.mozilla.org/En/DOM/Element.getAttribute" target="_blank">getAttribute</a> function.</p>
<pre class="brush:js">(function($){
    $.fn.videa= function(){
        // We're of course assuming the aforementioned json is here
        // ommited for the purposes of readability
      this.each(function(){
           var href    = this.getAttribute('href');
           var aClass  = this.getAttribute('class');
           var key     = href.match(/(http:\/\/www\.|http:\/\/|www\.|)(.*?)\.(\.com|\.*)/)[2];

          // we now have the base such as 'youtube' and 'vimeo' in key
          // check if we support it
          if( supportedSites[key] )
          {
          }
      })
})(jQuery)</pre>
<p><strong>Now I&#8217;ll explain the regex </strong></p>
<p><strong><em>The first bit:</em></strong></p>
<p>This matches the http protocol with or without the www or just the www</p>
<ul>
<li> &#8216;(http:\/\/www\.|http:\/\/|www\.|)&#8217;</li>
</ul>
<p><strong><em>The second bit:</em></strong><br />
Simply grabs everything AFTER the http://www.</p>
<ul>
<li>&#8216;(.*?)&#8217;</li>
</ul>
<p><strong><em>The third bit:</em></strong></p>
<p>This matches against any .com or .* extension</p>
<ul>
<li>&#8216;\.(\.com|\.*)&#8217;</li>
</ul>
<p>The rest is rather straight forward and can be explained in code comments.</p>
<pre class="brush:js">// Check if the site is supported
if( supportedSites[key] )
            {
               // Construct properly url to the flv
               if( href.indexOf('http://www.') == -1 )
                        href = 'http://www.' + href.replace('www.', '');

                // Check if we want a modal box
                if( aClass.indexOf('modal') &gt; -1 )
                {
                    // Bind to the click and fire off colorbox
                    $(this).click(function(){
                        $.fn.colorbox({
                            html: supportedSites[key].replace(/\[URL\]/ig, href.replace(handle[key][0], handle[key][1])) ,
                            open:true
                        });
                                return false;
                     })
                }else{
                    // We don't want a modal box so just do the html
                    $(this).before(supportedSites[key].replace(/\[URL\]/ig, href.replace(handle[key][0], handle[key][1]))).remove();
                }</pre>
<p><strong>Note:</strong> jQuery is a jackhammer, sometimes all we have is nails.</p>
<p>That&#8217;s the plugin broken down into the important sections. The end result is as expected. Everything which has a videa class is converted. The modal class is optional (it creates a link that opens a modal box with your video).</p>
<p>As for plugin development, once you understand  <a href="https://developer.mozilla.org/en/DOM" target="_blank">DOM </a>and the <a href="http://docs.jquery.com/Main_Page" target="_blank">entire jQuery API</a>, you can pretty much make anything you can come up with. JavaScript support is strong and growing.</p>
<p><span style="text-decoration: underline;"><strong>The Entire plugin below:</strong></span></p>
<pre class="brush:js">(function($){

    $.fn.embeddedables = function(){

        var supportedSites = {
            'youtube' : '&lt;object width="560" height="340"&gt;&lt;param name="movie" value="[URL]&amp;hl=en&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="[URL]&amp;hl=en&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"&gt;&lt;/embed&gt;&lt;/object&gt;',
            'dailymotion': '&lt;object width="480" height="275"&gt;&lt;param name="movie" value="[URL]"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;/param&gt;&lt;embed src="[URL]" type="application/x-shockwave-flash" width="480" height="275" allowfullscreen="true" allowscriptaccess="always"&gt;&lt;/object&gt;',
            'megavideo': '&lt;object width="640" height="467"&gt;&lt;param name="movie" value="[URL]"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;embed src="[URL]" type="application/x-shockwave-flash" allowfullscreen="true" width="640" height="467"&gt;&lt;/embed&gt;&lt;/object&gt;',
            'vimeo'    : '&lt;object width="400" height="225"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="[URL]" /&gt;&lt;embed src="[URL]" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"&gt;&lt;/embed&gt;&lt;/object&gt;'
        }

        var handle = {
            'youtube'    : ['watch?v=', 'v/'],
            'dailymotion': [/.*dailymotion.*\/video\/(.*?)_.*/, 'http://dailymotion.com/swf/$1'],
            'megavideo'  : ['?v=', 'v/'],
            'vimeo'      : [/.*vimeo.*\/(.*[0-9])/, 'http://vimeo.com/moogaloop.swf?clip_id=$1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1']
        }

        // Looad in this element for all a tags
        this.each(function(){

            var href   = this.getAttribute('href');
            var aClass = this.getAttribute('class');
            var key = href.match(/(http:\/\/www\.|http:\/\/|www\.|)(.*?)\.(\.com|\.*)/)[2];

            if( supportedSites[key] )
            {
               if( href.indexOf('http://www.') == -1 )
                        href = 'http://www.' + href.replace('www.', '');

                if( aClass.indexOf('modal') &gt; -1 )
                {
                    $(this).click(function(){
                        $.fn.colorbox({
                            html: supportedSites[key].replace(/\[URL\]/ig, href.replace(handle[key][0], handle[key][1])) ,
                            open:true
                        });
                                return false;
                     })
                }else{
                    $(this).before(supportedSites[key].replace(/\[URL\]/ig, href.replace(handle[key][0], handle[key][1]))).remove();
                }
            }

        });

    }

})(jQuery)</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.teckpert.com/blog/jquery-development-your-own-plugins-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TECKpert&#8217;s Tips: Using Google Base with .NET for Real Estate</title>
		<link>http://www.teckpert.com/real-estate-on-the-web/tips-googlebase-for-real-estate/</link>
		<comments>http://www.teckpert.com/real-estate-on-the-web/tips-googlebase-for-real-estate/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 15:41:03 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Coding Tips]]></category>
		<category><![CDATA[GoogleBase]]></category>
		<category><![CDATA[Real Estate]]></category>
		<category><![CDATA[.net for real estate]]></category>
		<category><![CDATA[agents]]></category>
		<category><![CDATA[google base]]></category>
		<category><![CDATA[google base for wordpress]]></category>
		<category><![CDATA[google base real estate api]]></category>
		<category><![CDATA[google base real estate feed]]></category>
		<category><![CDATA[google base real estate listings]]></category>
		<category><![CDATA[real estate]]></category>
		<category><![CDATA[wordpress idx]]></category>

		<guid isPermaLink="false">http://www.teckpert.com/?p=363</guid>
		<description><![CDATA[Adding listings to Google Base Real Estate is simple and completely free. Today I’ll show how to, using the Google Base .net library, add listings to Google Base and then search for those listings.]]></description>
			<content:encoded><![CDATA[<p>Adding listings to Google Base Real Estate is simple and completely free. Today I’ll show how to, using the Google Base .NET library, add listings to Google Base and then search for those listings. The library can be downloaded at <a href="http://code.google.com/apis/gdata/client-cs.html">http://code.google.com/apis/gdata/client-cs.html</a>.</p>
<p>First import the following classes from the Google Base Client library.</p>
<pre class="brush:csharp">using Google.GData.Client;

using Google.GData.GoogleBase;</pre>
<p>To insert items, you need to be authenticated. Specify your Google Base account name and password to GBaseService as follows. You can use your Gmail account but you have to first sign into Google Base to activate the account.</p>
<pre class="brush:csharp">GBaseService service = new GBaseService("Application Name", developerKey);

service.setUserCredentials("username", "password"); </pre>
<p>The next step is to create the GBaseEntry you would like to insert.</p>
<pre class="brush:csharp">GBaseEntry entry = new GBaseEntry();

entry.Title.Text = "My Title";

entry.Content.Content = description;</pre>
<p>It is important to set the ItemType to &#8220;Housing&#8221;.</p>
<pre class="brush:csharp">entry.GBaseAttributes.ItemType = "Housing"; </pre>
<p>Now set the other attributes. To see a list of all the Google Base attributes go to <a href="http://base.google.com/support/bin/answer.py?hl=en&amp;answer=78170">http://base.google.com/support/bin/answer.py?hl=en&amp;answer=78170</a>.</p>
<pre class="brush:csharp">FloatUnit unit = new FloatUnit(price, "usd");

entry.GBaseAttributes.Price = unit;

entry.GBaseAttributes.AddTextAttribute("feature", feature);

entry.GBaseAttributes.AddImageLink(imgLink);

entry.GBaseAttributes.AddTextAttribute("property_type", propertyType);

entry.GBaseAttributes.AddTextAttribute("listing_type", listType);

entry.GBaseAttributes.AddTextAttribute("listing_status", listStatus);

FloatUnit sunit = new FloatUnit(sqft, "square ft.");

entry.GBaseAttributes.AddFloatUnitAttribute("square_feet", sunit);

entry.GBaseAttributes.AddFloatAttribute("bathrooms", baths);

entry.GBaseAttributes.AddIntAttribute("bedrooms", beds);

entry.GBaseAttributes.Location = "Address, City, State xxxxx USA ";

entry.GBaseAttributes.AddTextAttribute("mls_listing_id", listingID);

entry.GBaseAttributes.AddTextAttribute("broker", listBroker);

entry.GBaseAttributes.AddTextAttribute("agent", listAgent); </pre>
<p>Finally, insert this GBaseEntry object into the Items feed.</p>
<pre class="brush:csharp"> GBaseEntry ent = service.Insert(GBaseUriFactory.Default.ItemsFeedUri, entry); </pre>
<p>The method <code>service.Insert</code> returns the item you just inserted. The Google Base server assigns pre-computed attributes for your entry such as the creation date and time, the author, and most importantly, the identifier (or URL) of the new entry. The entry may take a few hours to publish so it may not be searchable immediately.</p>
<p>Now you can search for your listings on Google Base by connecting to a snippets feed URL and then interpreting the resulting atom feed. This can be done programmatically by creating a GBaseService object and executing a query on it.</p>
<pre class="brush:csharp">GBaseService service = new GBaseService("Application Name", developerKey);

GBaseQuery query = new GBaseQuery(GBaseUriFactory.Default.SnippetsFeedUri); </pre>
<p>The following query will get single family homes for sale within a 5 mile radius of San Francisco CA.</p>
<pre class="brush:csharp">query.GoogleBaseQuery = @"[item type:housing] [listing type:for sale] [property_type:single] [location:@""San Francisco, CA, USA"" + 5mi]";</pre>
<p>You can also set the sort by and order, number of results, and search start index.</p>
<pre class="brush:csharp">query.NumberToRetrieve = 20;

query.StartIndex = 0;

query.AscendingOrder = true;

query.OrderBy = "price(float USD)";</pre>
<p>Lastly, execute the query and save the atom feed into a readable xml format. This can be parsed and displayed on a web page.</p>
<pre class="brush:csharp">XmlTextReader reader = new XmlTextReader(query.Uri.AbsoluteUri);

XmlDocument doc = new XmlDocument();

doc.Load(reader); </pre>
<p>Pretty simple right? Now you can have your listings searchable on Google along with your website.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teckpert.com/real-estate-on-the-web/tips-googlebase-for-real-estate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery development: Your own plugins</title>
		<link>http://www.teckpert.com/blog/jquery-development-your-own-plugins/</link>
		<comments>http://www.teckpert.com/blog/jquery-development-your-own-plugins/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 17:32:19 +0000</pubDate>
		<dc:creator>Andres</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Coding Tips]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery developer]]></category>
		<category><![CDATA[jquery plugin]]></category>
		<category><![CDATA[jquery plugins howto]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.teckpert.com/?p=283</guid>
		<description><![CDATA[Often there is a need for functionality that goes above jQuery's core set of methods, there are a host of plugins which can be used to attain this functionality. Such as ColorBox when a modal box is needed or jFlow for a basic gallery. However, sometimes these plugins cannot preform exactly the way we need them to without attacking the plugin's source and in the end causing a fair bit of frustration, confusion, and a plugin that not only doesn't do what you want but doesn't do anything. ]]></description>
			<content:encoded><![CDATA[<p>Often there is a need for functionality that goes above jQuery&#8217;s core set of methods, there are a host of plugins which can be used to attain this functionality. Such as ColorBox when a modal box is needed or jFlow for a basic gallery. However, sometimes these plugins cannot perform exactly the way we need them to without attacking the plugin&#8217;s source and in the end causing a fair bit of frustration, confusion, and a plugin that not only doesn&#8217;t do what you want but doesn&#8217;t do <em>anything. </em></p>
<p>Solution?  <strong>Develop your own plugin </strong></p>
<p>The benefits of this course are:</p>
<ol></ol>
<ul>
<li>Extreme familiarization with the code base ( You wrote it! )</li>
<li>Makes for identifying the area where bugs are coming from a fair bit easier</li>
<li>You don&#8217;t have to worry about licencing, you wrote it, it&#8217;s yours.</li>
</ul>
<ol></ol>
<p>The above being said, I suppose it&#8217;s about time to get on to exactly <em>how </em> one goes about developing their own plugin and it&#8217;s assuming familiarization with their core and some basic JavaScript it can be done rather easily. For the purpose of this blog post we&#8217;ll be doing a plugin that transforms every YouTube link into a nice embedded video.</p>
<p>First, we start off with a basic structure which is necessary to eliminate the possibility of Namespace conflicts ( libraries aside from jQuery make use of the dollar sign $ )</p>
<pre class="brush:js">(function($){

})(jQuery)</pre>
<p>Now we must define our function, with jQuery however we&#8217;ll be making use of closures or anonymous functions and than assign it to a variable. This is how:</p>
<pre class="brush:js">(function($){
    $.fn.youtubualize = function(){

    }
})(jQuery)</pre>
<p>Now we get to the fun bits! jQuery feeds us a copy of itself ( available though the this supervariable )  ready to be manipulated, seeing as we&#8217;ll most likely have more than 1 link we&#8217;ll make use of jQuery&#8217;s <a href="http://docs.jquery.com/Utilities/jQuery.each" target="_blank">each</a> utility to cycle through all the links.</p>
<pre class="brush:js">(function($){
     $.fn.youtubualize = function(){

        this.each(function(){

        });
    }
})(jQuery)</pre>
<p>Now we must be away that within the callback we&#8217;re providing to the each utility <strong>this </strong>is only a string representing the YouTube link so we need to use jQuery&#8217;s CSS selectors to single out the element and modify it accordingly, this will be the most verbose part</p>
<pre class="brush:js">(function($){
     $.fn.youtubualize = function(){

        this.each(function(){
            var url    = String(this);
            var flvURL = url.replace('watch?v=','v/');
            $('a[href="'+ url +'"]')
                .before('&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"\
 width="560" height="340"\
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;\
 &lt;param name="allowFullScreen" value="true" /&gt;\
 &lt;param name="allowscriptaccess" value="always" /&gt;\
 &lt;param name="src" value="'+ flvURL +'&amp;amp;hl=en&amp;amp;fs=1&amp;amp;" /&gt;\
 &lt;param name="allowfullscreen" value="true" /&gt;\
 &lt;embed type="application/x-shockwave-flash" width="560" height="340" src="'+ flvURL +'&amp;amp;hl=en&amp;amp;fs=1&amp;amp;" allowscriptaccess="always" allowfullscreen="true"&gt;&lt;/embed&gt;\
 &lt;/object&gt;')
                .remove();
        });
    }
})(jQuery)</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.teckpert.com/blog/jquery-development-your-own-plugins/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
