<?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>Kynetx Code</title>
	<atom:link href="http://code.kynetx.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://code.kynetx.com</link>
	<description></description>
	<lastBuildDate>Wed, 10 Mar 2010 18:06:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The new CRUD</title>
		<link>http://code.kynetx.com/2010/03/10/the-new-crud/</link>
		<comments>http://code.kynetx.com/2010/03/10/the-new-crud/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 18:06:10 +0000</pubDate>
		<dc:creator>davem</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.kynetx.com/?p=1485</guid>
		<description><![CDATA[This is the second post in a series of five weekly articles on issues related to Kynetx application development in a server-centric world.
All developers are familiar with the acronym "CRUD" which stands for "create, read, update, and delete." Traditional development projects involve putting in place the components necessary to accomplish these four tasks. You may [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is the second post in a series of five weekly articles on issues related to Kynetx application development in a server-centric world.</em></p>
<p>All developers are familiar with the acronym "CRUD" which stands for <a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete">"create, read, update, and delete."</a> Traditional development projects involve putting in place the components necessary to accomplish these four tasks. You may start with a development framework that makes it easy to get a working system running that accomplishes CRUD. Even I can create a Rails app that does basic CRUD in an afternoon. CRUD applications usually join the ranks of other single-purpose silos of data and functionality in the lonely world of who cares. A few lucky ones break out of their silos through APIs or web services and make friends with other applications, but these apps are just loaning each other their CRUD capability. They are the mayors of the world of who cares.</p>
<p>The Kynetx platform has modified the meaning of CRUD. Instead of create, read, update, and delete we have:</p>
<ul>
<li><em><b>Context:</b></em> intent + location + relationship = omniscience</li>
<li><em><b>Rules:</b></em> creative capacity codified</li>
<li><em><b>User:</b></em> master of all she surveys</li>
<li><em><b>Delivery:</b></em> endpoint ubiquity</li>
</ul>
<p>In order to understand what Craig Burton calls the <a href="http://www.craigburton.com/?p=3030">Tao of KRL</a> you need to grok the new CRUD. In order to understand <a href="http://www.windley.com/archives/2010/03/building_fourth_party_apps_with_kynetx.shtml">4th party applications</a> as described by Phil Windley you need to grok the new CRUD. It's the key. It's the future. </p>
<p>Here's a little bit more to chew on:</p>
<p><em><b>Context</b></em> is what we use to guide our interactions and relationships with individuals. If we are astute we gather context from every credible source available. Context is more than demographics: it's intent, relationships, mood, location (both physical and virtual), history, preferences, and opinions. Context is <em>knowing</em>. Context starts with the simple get-to-know-you questions that you ask when you first meet someone and can be as complex, nuanced, and mature as a 60-year marriage relationship. Kynetx is a powerful platform for gathering context.</p>
<p><em><b>Rules</b></em> determine what we do with that context. Rules define the events that we watch for, the conditions we evaluate, and the actions we take when those events and conditions are met (AKA an event-condition-action, or ECA system). The advantage of Kynetx is the fact that you can listen for a significant number of different events, and that number will increase over time. Events can be things like accessing a web page, meeting a data threshold, initiating a relationship, or walking into a store, among many others. Conditions can be just as varied as events. Actions include things like annotate search results, data integrations, and content aggregations.</p>
<p>The <em><b>User</b></em> is the center of the universe with Kynetx apps. The user decides what apps they want to use, what data they provide. Kynetx apps give the user a new mechanism for controlling their internet experience. In the case of 4th party applications, users are the focus of every other party in the system.</p>
<p><em><b>Delivery</b></em> is accomplished through endpoints. Kynetx is starting with browser-based endpoints, but will move out to other systems. Endpoints live where the user lives. Endpoints listen for events that are written into Kynetx apps and trigger application evaluations.</p>
<p>When developers understand the new CRUD available in the Kynetx platform they are liberated from the old CRUD and can build new, interesting things. Ultimately, Kynetx is a way to program the Internet and any Internet-connected endpoint.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.kynetx.com/2010/03/10/the-new-crud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon Products in KRL: A New Distribution Model</title>
		<link>http://code.kynetx.com/2010/03/05/amazon-products-in-krl-a-new-distribution-model/</link>
		<comments>http://code.kynetx.com/2010/03/05/amazon-products-in-krl-a-new-distribution-model/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 17:50:25 +0000</pubDate>
		<dc:creator>phil</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.kynetx.com/2010/03/05/amazon-products-in-krl-a-new-distribution-model/</guid>
		<description><![CDATA[

The first Web service that Amazon put up, years ago, was the ECommerce API that allowed API access to Amazon's product information.  That API has gone through several name changes and is now called the Product Advertising API.  Thousands of people have used this API to add data about products--and the opportunity to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://apps.kynetx.com/app/a41x96"><img src="http://appresource.s3.amazonaws.com/appdir/a41x96/appimage.jpg" border="0" hspace="3" vspace="0" width="150px" align="right" /></a></p>
<p>
The first Web service that Amazon put up, years ago, was the ECommerce API that allowed API access to Amazon's product information.  That API has gone through several name changes and is now called the <a href="http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/">Product Advertising API</a>.  Thousands of people have used this API to add data about products--and the opportunity to buy them--to their Web sites.
</p>
<p>
That's the problem, of course.  You can use it on your Web site, but you <em>can't conveniently use them in a browser extension to build client-side community apps</em> because your Amazon developer keys would be exposed to the world.  The most recent build of KRL changes that by making the Amazon Product Advertising API (PAA)  available as a library. That means that it's possible to use Kynetx to build client-side applications that use the PAA without exposing your developer tokens.  That opens up a whole host of possible uses for Amazon product information that were difficult to achieve before.
</p>
<p>
Here's a video that shows this at work:
</p>
<p><object width="400" height="240"><param name="movie" value="http://www.youtube.com/v/xXfzs0S5Gz0&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/xXfzs0S5Gz0&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="240"></embed></object></p>
<p>
Of course, to create client-side applications that people will install and use requires more than just <a href="http://www.windley.com/archives/2010/03/building_fourth_party_apps_with_kynetx.shtml">pumping more product at them</a>.  The KRL integration of PAA includes the ability to access all the user-generated reviews, product information, photos, and other product data that would allow a developer to create a first-rate experience that adds real value for people who download and use their apps.
</p>
<p>
KRL makes using PAA easy.  To get started, you simple put your Amazon developer secrets and associate ID in the meta block of your application:
</p>
<pre>
meta {
  key amazon {
    "token"        : "absjj99a9ad9ad8799",
    "secret_key"   : "absjj99a9ad9ad87799absjj99a9ad9ad8799",
    "associate_id" :  "windleyofente-20"
  }
}
</pre>
<p>
These are stored securely in the cloud and not divulged to users of the application.
</p>
<p>
The KRL Amazon library has two primary methods: <a href="http://docs.kynetx.com/krl/report-on-krl/libraries/amazon/#item_search"><code>ItemSearch</code></a> and <a href="http://docs.kynetx.com/krl/report-on-krl/libraries/amazon/itemlookup/"><code>ItemLookup</code></a>.  With <code>ItemSearch</code> the search index is a parameter and additional parameters depend on the particular index.  <code>ItemLookup</code> takes an Amazon product ID (ASIN) as it's primary parameter.  Here's an example:
</p>
<pre>
amazon:item_lookup({"ItemId" : "B00008OE6I",
                "response_group" : "ItemIds" })
</pre>
<p>
The response is returned as JSON so that you can use <a href="http://docs.kynetx.com/krl/report-on-krl/expressions/jsonpath/">JSONPath</a> to pick it apart and use it.  Here's a piece of the response to the previous query:
</p>
<pre>
"Item" : {
            "OfferSummary" : {
               "LowestUsedPrice" : {
                  "Amount" : "3999",
                  "CurrencyCode" : "USD",
                  "FormattedPrice" : "$39.99"
               },
               "TotalRefurbished" : {},
               "TotalUsed" : "8",
               "TotalCollectible" : {},
               "TotalNew" : {}
            },
            "ASIN" : "B00008OE6I"
         }
</pre>
<p>
Here's a video showing a little more about how this is done and giving a working example.
</p>
<p><object style="height: 323px; width: 400px"><param name="movie" value="http://www.youtube.com/v/wv2UAv3Uq9o"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/wv2UAv3Uq9o" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="400" height="323"></object></p>
<p>
You can install the example that we used for the first video or just view the source code <a href="http://apps.kynetx.com/app/a41x96">using the app detail page</a> in the Apps Directory.<br />
Here's the <a href="http://docs.kynetx.com/krl/report-on-krl/libraries/amazon/">documentation for the Amazon library</a>.
</p>
<p>
The Amazon integration with KRL allows Amazon developers to build client-side application that use Amazon product data without exposing the Amazon developer credentials--something that's been hard in the past.  KRL is designed to make using online data like Amazon or <a href="http://www.windley.com/archives/2010/01/using_oauth_to_access_twitter_from_krl.shtml">Twitter</a> easy and quick.  We'll be annnouncing some other major data and service integrations over the next few weeks as we gear up for <a href="http://kynetximpactspring2010.eventbrite.com/">Kynetx Impact</a> in April.  Come join us.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.kynetx.com/2010/03/05/amazon-products-in-krl-a-new-distribution-model/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building Fourth Party Apps with Kynetx</title>
		<link>http://code.kynetx.com/2010/03/03/building-fourth-party-apps-with-kynetx-2/</link>
		<comments>http://code.kynetx.com/2010/03/03/building-fourth-party-apps-with-kynetx-2/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 21:10:47 +0000</pubDate>
		<dc:creator>phil</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.kynetx.com/?p=1459</guid>
		<description><![CDATA[

 Doc Searls  uses the term "sewage pump" (I'm paraphrasing) to describe the modern advertising-based economy.  Modern society has created the most efficient machine imaginable to push stuff at people whether they want it or not. I gave an example in this blog post about Novatel: they're treating Twitter as a way to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/stuckincustoms/314036511/sizes/l/"><img src="http://farm1.static.flickr.com/121/314036511_d488dbcec4_m.jpg" border="0" width="150px" hspace="3" vspace="3" align="right" /></a></p>
<p>
 <a href="http://blogs.law.harvard.edu/doc/">Doc Searls</a>  uses the term "sewage pump" (I'm paraphrasing) to describe the modern advertising-based economy.  Modern society has created the most efficient machine imaginable to push stuff at people whether they want it or not. I gave an example in <a href="http://www.windley.com/archives/2010/02/using_social_media_badly_novatel_as_a_case_study.shtml">this blog post about Novatel</a>: they're treating Twitter as a way to <em>push stuff at me</em> instead of as a place to relate to me.
</p>
<p>
A pump pushing sewage at you is a good metaphor for what's wrong with the marketplace we've constructed in the late 20th century. Doc has built the <a href="http://blogs.law.harvard.edu/vrm/about/">VRM project</a> as a means of exploring better ways of building markets for the 21st century.  Something I hadn't considered until I was going through David Siegel's book <a href="http://www.amazon.com/exec/obidos/ASIN/1591842778/windleyofente-20">Pull</a> is that "pull" is the right metaphor for this new marketplace and it's precisely why Doc's metaphor of a sewage pump rings so true.
</p>
<p><a href="http://www.amazon.com/exec/obidos/ASIN/1591842778/windleyofente-20"><img src="http://images.amazon.com/images/P/1591842778.01.MZZZZZZZ.jpg" border="0" align="right" hspace="5" vspace="5" /></a></p>
<p>
David's book is about the Semantic Web and the use of data standards to enable you to "pull" the information, services, and products to you.  An example from the book that really hit home for me is this: in 2010 if you order a package from Amazon, you have to give an address where it will be delivered.  Wouldn't it be better if instead, you just gave Amazon an identifier and then the package would find you at the place you wanted it to go--even if that's the hotel you're currently staying at? In essence, you pull the package to you with online data. This isn't a pipe dream, but a perfectly reasonable way to think about how the world ought to work--and one that's doable now from a technical standpoint.
</p>
<p>
Doc uses different language to describe this same idea when he talks <a href="http://blogs.law.harvard.edu/vrm/2010/02/25/bowling-a-data-strike/">demand leading supply</a>.  The pump is all about supply leading demand.  The key idea that both Doc and David would agree on here is that "If demand leads supply..., customers need to be the points of integration for their own data."  More on that later.
</p>
<h3>The Four Party System</h3>
<p>
In an effort to further define VRM, <a href="http://blogs.law.harvard.edu/vrm/2009/04/12/vrm-and-the-four-party-system/">Doc has introduced the notion of "fourth-party services."</a>  He says:
</p>
<blockquote class="webquote">
<p>Among numbered parties the best-known one today is the <em>third party</em>. Wikipedia currently defines a <a href="http://en.wikipedia.org/wiki/Third_party">third party</a> this way (at least for the computer industry):</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Third-party_developer">Third-party developer</a>, hardware or software developer not directly tied to the primary product that a consumer is using</li>
<li><a href="http://en.wikipedia.org/wiki/Third-party_software_component">Third-party software component</a>, reusable software component developed to be either freely distributed or sold by an entity other than the original vendor of the development platform</li>
</ul>
<p>In general, a third party works on the vendor's side of the marketplace. However, the vendor is not generally called the "first party" (except in the game business, as Wikipedia says <a href="http://en.wikipedia.org/wiki/Third-party_developer">here</a>). In fact, the most common use of the term "first party" in business is with insurance, where the term <a href="http://www.businessdictionary.com/definition/first-party-insurance.html">refers to the insured</a>. (The insurer is the second party.)</p>
<div class="quoteref">From <A HREF="http://blogs.law.harvard.edu/vrm/2009/04/12/vrm-and-the-four-party-system/">» VRM and the Four Party System ProjectVRM</A><br />Referenced Fri Feb 26 2010 11:04:37 GMT-0700 (MST)</div>
</blockquote>
<p>
So, if third-party services are merchant driven, it stands to reason that the customer-drive services that represent them would be the fourth party.<br />
Here's a picture of these four parties:
</p>
<p><img src="http://photos.windley.com/gallery/d/11969-2/Screen+shot+2010-02-26+at+11_12_35+AM.png" border="0" width="380px" hspace="30" vspace="3" align="center" /></p>
<p>
The little horseshoe magnet looking things are called <a href="http://cyber.law.harvard.edu/projectvrm/Relbutton_Scenarios">rel buttons</a> are meant to represent customers or merchants (left and right in the above diagram) who want to relate to each other.
</p>
<p>
Fourth-party services, be theysimple or sophisticated will act as brokers that work on the user's behalf to manage their interaction with vendors of various products and services.  Without such automated agents, no one would want to take on the work that would be necessary otherwise to manage the dozens of relationships each of us has with vendors.  But with them magic happens.
</p>
<h3>Building 4th Party Apps</h3>
<p>
Doc and David are both thinking about very general solutions to this problem as well they should.  My job, as the CTO for Kynetx, however, is slightly different.  I'm trying to build things for our customers and make them work now.  The Kynetx platform has always been aimed at creating <a href="http://www.windley.com/archives/2009/09/the_forgotten_edge_and_the_purposecentric_web.shtml">client-side Web applications that help users achieve a purpose</a>.  That's a pretty good working definition of "fourth-party" in my book.  The platform is designed to allow developers to use data in context to create interesting Web applications. Moreover, our corporate philosophy has been consistently in favor of respecting user rights to control data.
</p>
<p>
With that backdrop, I've thought long and hard about how Kynetx could be used in service of VRM and--by David's definition--the semantic web.  I'll use this schematic to help explain my latest thinking:
</p>
<p><a href="http://photos.windley.com/gallery/d/11970-1/KNS+and+the+Personal+Data+Store.png"><img src="http://photos.windley.com/gallery/d/11972-1/KNS+and+the+Personal+Data+Store.png" border="0" width="450px" hspace="0" vspace="3" align="center" /></a></p>
<p>
To keep this simple, I'm going to avoid going down every "or they could do..." fork in the tree.  There are lots of them.  Here's the flow:
</p>
<ol>
<li>The user visits a merchant.  This could be online or in person (imagine the app running on their phone and using location in context).   </li>
<li>At the same time any fourth party apps that they've installed (denoted by the fourth-party rel-button) are invoked as long as they are relevant to the current activity.</li>
<li>KNS (the Kynetx Network Service) executes the rules associated with the presented apps.  We're going to presume for sake of this example that those apps need personal data to work on the user's behalf and such access has not been previously granted.</li>
<li>KNS requests the required user information from the personal data store (PDS).  </li>
<li>The user is asked to authorized such access and grants it. </li>
<li>The PDS requests the data from various sources as necessary and returns it to KNS.  Note that as envisioned here, the PDS acts more like a virtual directory than an actual repository, although that's not a strict requirement.</li>
<li>KNS executes any relevant merchant rules (determined by the app, current context, and the data retrieved in step 6) to determine how they want to relate. Merchant rules are denoted by the third-party rel-button in the diagram.  This may be specific offers, discounts, special service levels, etc. I'm calling this "the deal" for lack of a better word.  </li>
<li>Finally the results are presented to the user's client.</li>
</ol>
<p>
A key feature of the scenario shown in the figure is the privacy wall (in red).  That's there to reinforce the fact that in this model the user's data is never given to the merchant.  The merchant's rules act against it, but they never see it.  For fourth-party apps to work, users will need assurance that their data is being treated in a way that respects privacy.  They will also need to trust the agents working on their behalf.
</p>
<p>
A few other points to note:
</p>
<ul>
<li>Kynetx has no access to user data except as authorized by the user.  The user is entirely in control of the experience and what data is used.</li>
<li>The merchant rules could exists in a standard rule format like <a href="http://en.wikipedia.org/wiki/RuleML">RuleML</a> and be stored in any repository so long as they were discoverable. </li>
<li>The same holds for user data.  There's no need for it to be in a single place as long as it's in standard formats, is discoverable, and has a clear, unambiguous meaning.  David calls this same concept the personal data locker and it is central to the whole idea of the semantic web, pull, and VRM.</li>
<li>As envisioned the merchant rules, users data, and user apps are all orthogonal to each other.  This isn't a single application, but a platform where fourth-party apps can be built using whatever user data and merchant rules are available.</li>
<li>Successful fourth-party apps won't just be ways to get offers to customers but manage the relationship between merchants and users in sophisticated ways.  They could, for example store receipts, initiate and mediate support issues, manage returns, and so on.  </li>
<li>In this demo, we're using OAuth to enable user control of the data in the PDS but that's really a stand-in for other more versatile standards that are forthcoming like <a href="http://kantarainitiative.org/confluence/display/uma/Home">UMA</a> and <a href="http://wiki.eclipse.org/R-Card">R-Cards</a>.</li>
<li>The scenario above focuses on one interaction where the app and the merchant rules could conduct a complete, complex negotiation on the user and merchant's behalf. Keep in mind, however, that the key is the relationship and that is bigger than a singleton deal or negotiation and might include support and service functions, ratings, and so on.  Successful fourth-party apps will be seen by users as trusted agents, not merely a way to get a good deal on a single transaction. </li>
</ul>
<p>
A key difference between this model and a traditional ad network is the idea of "pull."  Ads are not being pushed (note that successful pushing requires "tracking" and "targeting" users--niether is being done here).  Rather more holistic information about what I'm calling "deals" is being pulled to the user based on their purpose and intent.
</p>
<p>
I have a working demo of all of this right now that uses a PDS that has access to a user's Amazon wish lists as an example of intent data and Acxiom-held data as an example of personal data--all under user control.  Getting from demo to production is more a legal and business matter, not a technical one.  We're working on that too.  I plan to share this demo and the ideas and techniques behind it at the <a href="http://kynetximpactspring2010.eventbrite.com/">Kynetx Impact conference in April</a> and at <a href="http://iiw10.eventbrite.com/">IIW X in May</a>.
</p>
<p>
The inclusion of intent data in the demo is important because data that signals user intent or purpose is much more useful in creating compelling fourth-party apps than mere facts like gender or household size that leave the app to infer intent.  Guessing will become less necessary because users will have convenient, private means of sharing intent.  In this model, attention gives way to intention just as <a href="http://www.windley.com/archives/2009/09/the_forgotten_edge_and_the_purposecentric_web.shtml">purpose gives way to location</a>.
</p>
<p>Some might complain that there's too much dependence on KNS or that KNS is closed.  That's not technically true: Kynetx is proprietary, not closed.  Still, if that bothers you, give me the standards and we'll use them. We're all about building support for standard data sources and formats into the system.  As I mentioned above, I'm open to supporting rules expressed in RuleML or some other standard format.  And, of course, no one is imagining that KNS would be the only system doing this.  This is just our contribution to making the idea of VRM and fourth-party services real.
</p>
<p>
We invite your participation.  <a href="http://www.kynetx.com/signup">Signup for a free developer account</a>.  <a href="http://kynetximpactspring2010.eventbrite.com/">Register for Impact</a> where you can <a href="http://www.windley.com/archives/2010/02/jon_udell_to_speak_at_spring_kynetx_impact_conference.shtml">listen to Jon Udell's keynote</a> and discuss these ideas with us.  We're happy to listen, resolve issues, and make this work.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.kynetx.com/2010/03/03/building-fourth-party-apps-with-kynetx-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Placers and Appers</title>
		<link>http://code.kynetx.com/2010/03/02/placers-and-appers/</link>
		<comments>http://code.kynetx.com/2010/03/02/placers-and-appers/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 18:39:47 +0000</pubDate>
		<dc:creator>davem</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.kynetx.com/?p=1445</guid>
		<description><![CDATA[This is the first post in a series of five weekly articles on issues related to Kynetx application development in a server-centric world.
Kynetx is on the forefront of creating the app-driven purpose-centric web. As we talk to people about our platform I have discovered that there are two main categories of Internet users:
Category 1: Placers- [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is the first post in a series of five weekly articles on issues related to Kynetx application development in a server-centric world.</em></p>
<p>Kynetx is on the forefront of creating the app-driven purpose-centric web. As we talk to people about our platform I have discovered that there are two main categories of Internet users:</p>
<p>Category 1: Placers- as in users who think about the Internet only as a collection of locations. Placers are firmly rooted in the paradigm of location. You go to an address, you visit a site, etc. They consider web sites analogues to physical stores or your front lawn. Most people are placers because they have only been exposed to server-delivered/browser-consumed web applications, which reinforce placer thinking. You can’t blame a placer for being a placer.</p>
<p>When placers see what can be done with Kynetx applications their initial reaction usually includes two sentiments: the first being, “that’s really cool,” and the second being, “the site owner won’t like it.”</p>
<p>Category 2: Appers- as in users who think about the Internet as a platform for building interesting applications. Appers can separate location from application, and can appreciate the organization of data and functionality from different sources to bring new value. Appers are not averse to trying new apps in their client environments. Ultimately they know they are in control of their experience. Appers are relatively rare, but mobile platforms are converting more people to this kind of thinking, and the markets are recognizing this coming shift. This shift is inexorable on all platforms, including the server-centric web.</p>
<p>When appers see their first Kynetx demo they get very excited and always want to sign up for a developer account on our platform. They frequently make statements where they compare Kynetx favorably to such ideas as sliced bread.</p>
<p>Phil Windley coined what I will call the <a href="http://www.windley.com/archives/2009/09/claiming_my_right_to_a_purposecentric_web_sidewiki.shtml">Apper’s Creed</a>:</p>
<blockquote><p>I claim the right to mash-up, remix, annotate, augment, and otherwise modify Web content for my purposes in my browser using any tool I choose and I extend to everyone else that same privilege.</p></blockquote>
<p>Put in other terms, the Apper's Creed asserts the right to run apps in the browser environment. I believe that more and more people will discover the value that appers enjoy and will make the transition from the placer world.</p>
<p>A very important question for Kynetx application developers is: how do we get placers to begin to make the transition to appers? Another important question: how do our apps get along with location-centric resources and developers on the Internet?</p>
<p>I will explore answers to those two questions in a series of weekly posts. I hope you find them useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.kynetx.com/2010/03/02/placers-and-appers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jon Udell, Author and Innovator, to Headline Kynetx Impact Conference   April 27-28</title>
		<link>http://code.kynetx.com/2010/02/25/jon-udell-author-and-innovator-to-headline-kynetx-impact-conference-april-27-28/</link>
		<comments>http://code.kynetx.com/2010/02/25/jon-udell-author-and-innovator-to-headline-kynetx-impact-conference-april-27-28/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 16:00:43 +0000</pubDate>
		<dc:creator>sog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.kynetx.com/?p=1431</guid>
		<description><![CDATA[-Developer Conference to Show Applications that Span Multiple
Sites, in Support of the New “Client-Side” Web-
February 24, 2010, SALT LAKE CITY
— Jon Udell author, information architect and new media innovator,
will headline the Kynetx Impact Conference in Salt Lake City April
27-28, 2010. Udell will review the Net's original peer-to-peer
architecture, and explore why it matters more than ever.
The [...]]]></description>
			<content:encoded><![CDATA[<p><em>-Developer Conference to Show Applications that Span Multiple<br />
Sites, in Support of the New “Client-Side” Web-</em></p>
<h3>February 24, 2010, SALT LAKE CITY</h3>
<p>— <a href="http://blog.jonudell.net/about/">Jon Udell</a> author, information architect and new media innovator,<br />
will headline the <ins datetime="2010-02-23T08:58" cite="mailto:Kristen%20Knight"><span style="text-decoration: underline"><a href="http://www.kynetximpact.com/">Kynetx Impact Conference</a></span></ins> in Salt Lake City April<br />
27-28, 2010. Udell will review the Net's original peer-to-peer<br />
architecture, and explore why it matters more than ever.</p>
<p>The conference will highlight Kynetx Network Services technology that<br />
supports this movement and will show how these new capabilities have<br />
the potential to re-shape the future of user experience the Web.</p>
<p>The Kynetx platform helps developers create applications that span<br />
multiple URLS and devices in response to user context, giving users<br />
more control of their web experience. Since last year, Kynetx<br />
developers have created more than 900 of these new platform-<br />
independent applications, with many more slated to enter the market<br />
through 2010.</p>
<p>“De-centralization was a core value of the initial Internet, but it’s<br />
an aspect that has largely been lost,” Udell maintains. “The Kynetx<br />
platform helps us bring it back.”</p>
<p>Since 2007, Udell has served as a writer, speaker and presenter for<br />
Microsoft. His calendar syndication service, <a href="http://elmcity.cloudapp.net/">http://elmcity.cloudapp.net</a>, runs on Azure -- Microsoft's new<br />
cloud platform -- and exemplifies the decentralized Web architecture<br />
that he has always championed. From 2002 to 2006 Udell was InfoWorld’s<br />
lead analyst, author of the weekly <a href="http://www.infoworld.com/archives/t.jsp?N=c&amp;V=Strategic%20Developer&amp;F=2002&amp;Y=2006">Strategic Developer</a> column, and <a href="http://weblog.infoworld.com/udell/">blogger-in-chief</a>. His 1999 book, <a href="http://safari.oreilly.com/1565925378">Practical Internet Groupware</a>, helped lay the foundation for what we now call social software.</p>
<p>The conference will also feature presentations from <a href="http://phil.windley.org/">Dr. Phil Windley</a>, Kynetx co-founder, and identity and technology<br />
lexicon expert <a href="http://www.craigburton.com/?page_id=169">Craig<br />
Burton</a>. The cost is just $150 to attend the Kynetx Impact<br />
Conference. The event will offer workshops that teach attendees how to<br />
create new power applications with the proprietary Kynetx rules-based<br />
platform. For more information, visit <a href="http://www.kynetx.com/">www.kynetx.com<br />
</a>.</p>
<h3>About Kynetx</h3>
<p>Founded in 2007, Kynetx is a private company that has developed a<br />
development platform for applications that understand and respond to<br />
user context across any web-enabled device.   Developers and<br />
businesses can use this platform to quickly mash up data, functions<br />
and interface points in order to create the next era of software<br />
services and Internet applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.kynetx.com/2010/02/25/jon-udell-author-and-innovator-to-headline-kynetx-impact-conference-april-27-28/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KNS Platform Outage Report 2/23/2010</title>
		<link>http://code.kynetx.com/2010/02/23/kns-platform-outage-report-2232010/</link>
		<comments>http://code.kynetx.com/2010/02/23/kns-platform-outage-report-2232010/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 01:34:04 +0000</pubDate>
		<dc:creator>qwade</dc:creator>
				<category><![CDATA[IT Operations]]></category>

		<guid isPermaLink="false">http://code.kynetx.com/?p=1416</guid>
		<description><![CDATA[Date: 02/23/2010

Start Time: 1740 MST

Stop Time: 1745 MST

Duration: 00:00:05 (DD:hh:mm)

Severity: Sev1 - Platform Down



Incident Summary:
The KNS platform experienced a service interruption at 1740 MST, which lasted for a five (5) minute period.  This outage was attributed to a memory starvation issue on the master load balancer in the load balancing cluster, which caused a [...]]]></description>
			<content:encoded><![CDATA[<p>Date: 02/23/2010<br />
<br />
Start Time: 1740 MST<br />
<br />
Stop Time: 1745 MST<br />
<br />
Duration: 00:00:05 (DD:hh:mm)<br />
<br />
Severity: Sev1 - Platform Down<br />
</p>
<hr />
<p>
Incident Summary:</p>
<p>The KNS platform experienced a service interruption at 1740 MST, which lasted for a five (5) minute period.  This outage was attributed to a memory starvation issue on the master load balancer in the load balancing cluster, which caused a failover of the cluster. The failover was successful, but took longer than normal (tested) due to the contributing memory issue.</p>
<p>Services Impacted:</p>
<ul>
<li>Evaluation Servers (cs.kobj.net)</li>
<li>Initialization Servers (init.kobj.net)</li>
<li>Callback Serves (log.kobj.net)</li>
</ul>
<p>Root Cause Analysis:</p>
<p>The root cause was identified as a memory starvation issue on lb1.kob.net. The load balancer cluster has been very stable since installation,and there is no reason to suspect that there will be any further service issues.</p>
<p>Recovery Steps:</p>
<p>Once alerted by monitoring and customer reports,  a manual forced failover/failback was performed by the Kynetx IT Operations team. This action restored service and returned control of the cluster to the master, who had recovered from the memory starvation issue. Going forward, the Kynetx IT Operations team will schedule a maintenance window to increase the amount of memory allocated to the load balancer processes. Service was restored in less than five (5) minutes from first alert.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.kynetx.com/2010/02/23/kns-platform-outage-report-2232010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KRL Build 424: Functions and Array Operators</title>
		<link>http://code.kynetx.com/2010/02/08/1409/</link>
		<comments>http://code.kynetx.com/2010/02/08/1409/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 17:03:52 +0000</pubDate>
		<dc:creator>phil</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.kynetx.com/2010/02/08/1409/</guid>
		<description><![CDATA[ 

The latest build of the Kynetx Rule Language (KRL) provides a significant upgrade in capability with the addition of functions.  We've also added some new array operators that take advantage of functions to make using arrays easier.


KRL supports functions as first-class objects in the expression language.  KRL supports only anonymous functions, but [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.kynetx.com"><img style="margin-top: 10px;margin-left:10px" src="http://www.windley.com/images/kynetx_logo_small.png" border="0" hspace="3" vspace="3" align="right" title="Kynetx Logo" alt="Kynetx Logo" width="125px" /></a> </p>
<p>
The latest build of the Kynetx Rule Language (KRL) provides a significant upgrade in capability with the addition of functions.  We've also added some new array operators that take advantage of functions to make using arrays easier.
</p>
<p>
KRL supports functions as first-class objects in the expression language.  KRL supports only anonymous functions, but they can be given names by binding them to a variable in a declaration.  Here's an example:
</p>
<pre>
pre {
  add5 = function(x) {
           x + 5
         };
}
</pre>
<p>
Functions are evaluated statically (e.g. the environment they are defined in, not the environment they are executed in determines the binding of free-variables) and can be recursive.  Here's an example of a recursive function in KRL:
</p>
<pre>
pre {
  fact = function(n) {
            (n &lt;= 0) =&gt; 1
                      | n * fact(n-1)
         }
}
</pre>
<p>
Functions are declared using the keyword <code>function</code> and contain optional declarations followed by a single expression that returns the result of the function when executed.  To see this,<br />
consider the following example which uses Newton's method to calculate square roots (taken from <a href="http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-10.html#%_sec_1.1.8">Section 1.1.8 of Structure and Interpretation of Computer Programs</a>):
</p>
<pre>
sqrt = function(x) {
    average = function(x,y) { (x + y) / 2 };
    good_enough = function(guess, x) {
       v = (guess * guess) - x;
       v &lt; 0.01 &amp;&amp; v &gt; -0.01
    };
    improve = function(guess, x) {
       average(guess, (x / guess))
    }
    sqrt_iter = function(guess, x) {
       good_enough(guess, x) =&gt; guess
                              | sqrt_iter(improve(guess,x), x)
    };
    sqrt_iter(1.0, x)
}
</pre>
<p>
Functions can return functions as values and functions can be passed as the arguments to other functions and operators in KRL.  The following example defined a generalized summation function that sums the numbers from <code>a</code> to <code>b</code> incrementing using <code>inc</code> and applying the function <code>f</code> to each term:
</p>
<pre>
sum = function(f, a, next, b) {
  (a &gt; b) =&gt; 0
           | f(a) + sum(f, next(a), inc, b)
};
inc = function(x) { x + 1 };
cube = function(x) { x * x * x };
sum_cubes = function(a, b) {
  sum(cube, a, inc, b)
}
</pre>
<p>
We could define a function that creates incrementor functions.  When given a number, it returns a function that increments by that value:
</p>
<pre>
inc_generator = function(n) { function(x){ x + n } };
inc = inc_generator(1);
inc_by_2 = inc_generator(2);
inc_by_25 = inc_generator(25);
</pre>
<p>
Being able to write functions adds significant power.  More so with some of the other languages changes we have in mind for the next few months.
</p>
<p>
Weve also added several new array operators in recent builds.  Most notably, array references now work as follows:
</p>
<pre>
a = [1,4,3,6,5];
b = a[1]
</pre>
<p>
This would bind the value 4 to the variable <code>b</code>.  Note that array references only work for arrays of one-dimension, so <code>c[1][2]</code> is not allowed (presuming <code>c</code> is an array of arrays).
</p>
<p>
In addition, there are a number of new <a href="http://docs.kynetx.com/krl/report-on-krl/expressions/#Operators">operators</a> available for arrays.<br />
The following array operators are now available (in addition to <code>length</code> which has been previously available):
</p>
<ul>
<li><code>sort</code> - sorts the array. With no argument, sorting is done in ascending order.  The argument <code>"reverse"</code> causes sorting to happen in descending order.  The argument can also be a function that takes two argument and returns a boolean value which will be used as the comparison function for the sort. </li>
<li><code>filter</code> - filters an array, producing a new array.  The operator takes a function argument that takes a single parameter and returns a boolean value.  The return array contains elements for which the function returns true.   </li>
<li><code>map</code> - modfies an array from mapping a function to each member of the array.  The operator takes a function argument that takes a single parameter and returns any value.  The array returned from <code>map</code> is the result of applying the function to each member of the original array in turn, collecting the results into a new array.</li>
<li><code>head</code> - returns the first element of an array without modifying the array.</li>
<li><code>tail</code> - returns an array that is identical to the orginal array except without the first member.  </li>
</ul>
<p>
You could use these like so:
</p>
<pre>
pre {
  f = function(x) { x &lt; 4 };
  g = function(y) { y * 2 };
  a = [1,4,3,6,5];

  b = a.sort(); // returns [1,3,4,5,6]
  c = a.filter(f); // returns [1,3]
  d = a.head(); // d has the value 1
  e = a.map(g); // e has the value [2,8,6,12,10]
}
</pre>
<p>
Operators are fairly easy to add and handy to have, so if you have ideas for other operators, on arrays, strings, and so on, just let us know.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.kynetx.com/2010/02/08/1409/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KRL Name Space Update</title>
		<link>http://code.kynetx.com/2010/02/04/krl-name-space-update-2/</link>
		<comments>http://code.kynetx.com/2010/02/04/krl-name-space-update-2/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 16:55:44 +0000</pubDate>
		<dc:creator>sog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://code.kynetx.com/?p=1406</guid>
		<description><![CDATA[In anticipation of additional functionality in KNS, it has been decided to require that all predicates must preceded by their name space. As of build 419, non-qualified names in predicate positions (like search_engine_referer()) will be treated as functions and will not work as expected.
From this point forward, you must only use qualified (e.g. namespaced) functions [...]]]></description>
			<content:encoded><![CDATA[<p>In anticipation of additional functionality in KNS, it has been decided to require that all predicates must preceded by their name space. As of build 419, non-qualified names in predicate positions (like search_engine_referer()) will be treated as functions and will not work as expected.</p>
<p>From this point forward, you must only use qualified (e.g. namespaced) functions in predicate positions (like referer:search_engine_referer()). The documentation has been updated to reflect these changes.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.kynetx.com/2010/02/04/krl-name-space-update-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kynetx Developer Program Vision Comes to Life with More Than 800 New Apps</title>
		<link>http://code.kynetx.com/2010/01/22/kynetx-developer-program-vision-comes-to-life-with-more-than-800-new-apps/</link>
		<comments>http://code.kynetx.com/2010/01/22/kynetx-developer-program-vision-comes-to-life-with-more-than-800-new-apps/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 18:43:50 +0000</pubDate>
		<dc:creator>sog</dc:creator>
				<category><![CDATA[Subscribe]]></category>

		<guid isPermaLink="false">http://code.kynetx.com/?p=1393</guid>
		<description><![CDATA[Just a Few Months Old, Kynetx Developer Program Spawning a New Generation of Context-Aware Apps
LEHI, Utah, January 22, 2010--(BUSINESS WIRE)--Kynetx is leading the client-side revolution with its unparalleled development platform and program. At the heart of the platform is a rules-based language that allows developers to build entirely new web experiences that are cross-site, cross-platform [...]]]></description>
			<content:encoded><![CDATA[<p><em>Just a Few Months Old, Kynetx Developer Program Spawning a New Generation of Context-Aware Apps</em></p>
<p>LEHI, Utah, January 22, 2010--(BUSINESS WIRE)--<a href="http://www.kynetx.com">Kynetx</a> is leading the client-side revolution with its unparalleled development platform and program. At the heart of the platform is a rules-based language that allows developers to build entirely new web experiences that are cross-site, cross-platform and respond to context in the user’s environment. By leveraging this unique platform, the Kynetx developer program has already garnered more than 300 developers resulting in over 800 applications.</p>
<p>“Unlike any other platform, Kynetx offers developers the technology to easily resolve data mismatches coming from fractured sources of information. This capability results in a new breed of apps that act as powerful context-aware mash-ups,” says Stephen Fulling, Kynetx co-founder and CEO. “Information is only powerful if it touches you when and where you need it…in context. Kynetx gives developers the tools they need for connecting the dots.”</p>
<p>Richard Miller, a lead developer at FamilyLink.com, used the Kynetx Development platform to create a prototype application with the power to extend FamilyLink’s functionality to sites across the web, including Facebook, Gmail, LinkedIn, and Twitter. In just a few days, he crafted the prototype application that extends the experience of FamilyLink users when looking for relatives, adding relatives or communicating with them beyond the FamilyLink site.</p>
<p>“This is exactly the kind of viral growth and entrepreneurial innovation we were hoping would come out of our Developer Program,” Fulling continued. “Richard read a blog post about us, signed up, and was writing a ground-breaking app in minutes. The Kynetx Developer Program offers unparalleled tools and infrastructure to help unleash developers’ imaginations. Clearly, that’s what Richard Miller has done.”</p>
<p>Kynetx recently increased its “mash-up” capabilities with new Twitter API support. The Kynetx Rules Language now integrates with the Twitter API, using Twitter’s OAuth scheme, giving developers the ability to create Kynetx applications that can easily access Twitter data.</p>
<p>“The Twitter upgrade opens a myriad of possibilities for our Developer Program,” says Dr. Phillip Windley, Kynetx CTO. “Using Kynetx, you can create and deploy an app in minutes that understands and responds to Twitter data on any website or web-enabled device.”</p>
<p>Kynetx also offers semi-annual conferences designed for developers to explore ideas and learn from the experts, face to face. The next Kynetx Impact conference is scheduled for April 27th-28th in Salt Lake City. More information and registration can be found at www.kynetx.com.</p>
<p>To sign up for the Kynetx Developer program go to <a href="http://www.kynetx.com">www.kynetx.com.</a></p>
<p>Demonstration of the Family Link app can be found at <a href="http://richardkmiller.com/860">http://richardkmiller.com/860</a>.</p>
<p><strong>About FamilyLink</strong></p>
<p>FamilyLink provides the platform for the family social experience. Family members can create family-generated content, preserve interactions, add historical content and communicate across Facebook, e-mail, chat and the Web. FamilyLink is a top 100 Web site and has more than 60 million users, 20 million monthly active users and more than 1 million daily active users. FamilyLink has been the top family application on Facebook since 2007. FamilyLink also leverages its content relationships to provide valuable historical family content. Families can search more than 1.2 billion names to find, tag and integrate ancestors. To learn more about FamilyLink go to <a href="http://www.familylink.com">www.familylink.com</a>.</p>
<p><strong>About Kynetx</strong></p>
<p>Founded in 2007, Kynetx is a private company that has developed a proprietary rules-based development platform that is the first infrastructure to support the “purpose-centric” web metaphor that is driving the next era of software services and Internet applications. Kynetx offers a developer program that gives programmers access to technology that helps them create cross-platform, context and user-aware apps that stretch across the web.</p>
<p><strong>Contacts:</strong></p>
<p><em>For Kynetx</em><br />
Snapp Conner PR<br />
Cheryl Snapp Conner, 801-994-9625<br />
cheryl@snappconner.com</p>
<p>or</p>
<p><em>FamilyLink</em><br />
Stephanie Rogers, Steph@familylink.com</p>
]]></content:encoded>
			<wfw:commentRss>http://code.kynetx.com/2010/01/22/kynetx-developer-program-vision-comes-to-life-with-more-than-800-new-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using OAuth to Access Twitter from KRL</title>
		<link>http://code.kynetx.com/2010/01/14/using-oauth-to-access-twitter-from-krl/</link>
		<comments>http://code.kynetx.com/2010/01/14/using-oauth-to-access-twitter-from-krl/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 14:40:53 +0000</pubDate>
		<dc:creator>windley</dc:creator>
				<category><![CDATA[Subscribe]]></category>

		<guid isPermaLink="false">http://code.kynetx.com/?p=1391</guid>
		<description><![CDATA[

The latest build (Build 391) of the Kynetx Rule Language (KRL) includes support for accessing Twitter data intrinsically within the language.  Integrating interesting data with KRL is an important part of what makes the language so useful for building cross-site applications that mash-up data and user interactions.  But what's really interesting about this [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://apps.kynetx.com/app/a16x42"><img style="margin-top: 10px;margin-left:10px" src="http://appresource.s3.amazonaws.com/appdir/a16x42/appimage.jpg" border="0" hspace="3" vspace="3" align="right" title="Kynetx App" alt="Kynetx Logo" width="150px" /></a></p>
<p>
The latest build (Build 391) of the Kynetx Rule Language (KRL) includes support for <a href="http://docs.kynetx.com/krl/report-on-krl/libraries/twitter/">accessing Twitter data intrinsically within the language</a>.  Integrating interesting data with KRL is an important part of what makes the language so useful for building cross-site applications that mash-up data and user interactions.  But what's really interesting about this release is that we're using OAuth to access the Twitter API and have built primitives into the language for dealing with the Twitter OAuth interaction to save developers from doing it.
</p>
<p>
Not only are we making it easy for developers to write apps that use Twitter, but this is also the first time that end users will see significantly different behavior from an app than their friend might.  An app that uses the <a href="http://docs.kynetx.com/krl/report-on-krl/libraries/twitter/">Twitter library</a> will use <em>my Twitter data</em> for me and <em>your Twitter data</em> for you.  Using OAuth, Kynetx apps can now be personalized.
</p>
<p>
Using Twitter data inside a KRL app generally involves two KRL patterns: <b>authorize then use</b> and <b>initialize then populate</b>
</p>
<p>
In the <b>authorize then use</b> pattern, a rule is put in place to check if the app is authorized to take a certain action and, if not, do what is necessary to complete the authorization.  What makes this work is using the rule postlude to ensure that the rest of the rules (which presumably rely on the authorization) don't run.  Here's an example from an <a href="http://apps.kynetx.com/app/a16x42">app I wrote to demonstrate using the the new Twitter library</a>:
</p>
<pre>
rule auth is active {
  select using ".*" setting ()
  if(not twitter:authorized()) then
      twitter:authorize()
        with opacity=1.0 and
             sticky = true

  fired {
     last
  }
}
</pre>
<p>
Notice that this rule only fires if the predicate <code>twitter:authorized()</code> is <em>false</em>.  The action, <code>twitter:authorize()</code>, is what initiates the OAuth ceremony.  The action will pop up a notification in the user's browser that looks like this:
</p>
<p><img src="http://photos.windley.com/gallery/d/11906-1/Screen+shot+2010-01-12+at+2_29_42+PM.png" border="0" hspace="3" vspace="3" align="center" /></p>
<p>
The postlude of the rule (<code>fired {...}</code>) runs the <code>last</code> statement if the rule fires to ensure that nothing else happens.  Of course, if the app is authorized, the rule doesn't fire, the OAuth ceremony is <em>not</em> initiated, the <code>last</code> is never executed, and the remaining rules in the ruleset are evaluated.
</p>
<p>
The <b>initialize then populate</b> pattern is important any time you're working with complex data.  With complex data, you will frequently need to do something for each component of an array.  That's what the <a href="http://www.windley.com/archives/2009/11/kns_build_351_flwr_comes_to_krl.shtml"><code>foreach</code> statement does as part of the rule selector</a>: executes a rule once for each member of an array.
</p>
<p>
The problem is that if we use a <code>foreach</code> to loop over the tweets we get back and use <code>notify</code> to place them on the page, we'll end up with one notification box for each tweet.  Not very pretty.
</p>
<p>
A better solution is to use a rule to place the notification box (the initializer) and another rule to loop over the tweets and place them in the notification box (the populater).
</p>
<p>
Here's the initialization rule:
</p>
<pre>
rule init_tweetdom is active {
  select using ".*" setting ()

  pre {
    init_div = &lt;&lt;
&lt;div id="tweet_list"&gt;
&lt;/div&gt;
&gt;&gt;
  }

  notify("Friends Tweets", init_div)
    with sticky=true and
         opacity = 1.0
</pre>
<p>
This is a pretty simple rule that places an empty notification box on the page.
</p>
<p>
The real work is done by the populating rule:
</p>
<pre>
rule populate_tweetdom is active {
  select using ".*" setting ()
    foreach tweets setting (tweet)
      pre {
        text = tweet.pick("$..text");
        div = "&lt;div style='background-color:#666;margin:2px'&gt;" +
              text +
              "&lt;/div&gt;";
      }
      append("#tweet_list", div)
}
</pre>
<p>
This rule loops over the tweets, grabs data out of them using <code>pick</code>, and <code>append</code>s the result to the <code>div</code> in the notification box.
</p>
<p>
The <code>tweets</code> variable was set in the global block:
</p>
<pre>
tweets =
  twitter:authorized() =&gt; twitter:friends_timeline({"count": 8})
                        | [];
</pre>
<p>
After you've gone through the OAuth ceremony at Twitter, wherever you run this app, you will see a box like this that contains the last eight tweets from your friends timeline on Twitter.  Here's the results for me:
</p>
<p><img src="http://photos.windley.com/gallery/d/11908-1/Screen+shot+2010-01-12+at+3_10_19+PM.png" border="0" hspace="3" vspace="3" align="center" /></p>
<p>
Of course, if you <a href="http://apps.kynetx.com/app/a16x42">run this app</a>, either by card or bookmarket, you'll see the results from <em>your friends timeline</em>.
</p>
<p>
Craig Burton has created a <a href="http://craigburton.com/contextdata/twittertut/twitter_module_tutorial_viewlet_swf.html">nice tutorial</a> about how all this works.  There's some important data in the tutorial about how to get the keys from Twitter for your application.  The <a href="http://docs.kynetx.com/krl/report-on-krl/libraries/twitter/">library is also well documented</a> and the <a href="http://apps.kynetx.com/app/a16x42">source code for the ruleset is available</a>.
</p>
<p>
The ability to personalize apps by appealing to personal data elsewhere on the Web is a huge step forward for KRL. Look for other APIs to be embedded in KRL in the near term and, eventually, more general support for OAuth so that developers can use any OAuth protected data source.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.kynetx.com/2010/01/14/using-oauth-to-access-twitter-from-krl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
