<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1930213017396645687</id><updated>2012-03-20T02:03:49.525-06:00</updated><category term='facebook'/><category term='google maps'/><category term='truism'/><category term='defaction'/><category term='errorstack'/><category term='statcounter'/><category term='YQL'/><category term='firebug'/><category term='brightkite'/><category term='events'/><category term='linkedin'/><category term='edoism'/><category term='seo'/><category term='crud'/><category term='webhooks'/><category term='jquery'/><category term='iphone'/><category term='kynetx'/><category term='annotation'/><category term='css'/><category term='geolocation'/><category term='push'/><category term='aculis'/><category term='XPath'/><category term='twilio'/><category term='online identity'/><category term='twitter'/><category term='bigohoo'/><category term='oauth'/><category term='social media'/><category term='blogger template'/><category term='webapp'/><category term='JSON'/><category term='widget'/><category term='foursquare'/><category term='safari'/><title type='text'>edoism</title><subtitle type='html'>truism of ed orcutt</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://edoism.orcutt.org/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1930213017396645687/posts/default/-/safari'/><link rel='alternate' type='text/html' href='http://edoism.orcutt.org/search/label/safari'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ed Orcutt</name><uri>http://www.blogger.com/profile/01072069799127687951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_tXU2PrpKxHU/SuDD5YwomTI/AAAAAAAAAII/hCrRNUZWOto/S220/edo_transjpg.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1930213017396645687.post-6280183698947686146</id><published>2011-10-10T16:29:00.001-06:00</published><updated>2011-10-11T16:55:27.153-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='crud'/><category scheme='http://www.blogger.com/atom/ns#' term='kynetx'/><category scheme='http://www.blogger.com/atom/ns#' term='safari'/><title type='text'>KRL Safari: KRUD Redux - Kynetx CRUD with Persistent Variables</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-M78XHP61V9c/TRDz9tCmcpI/AAAAAAAAAPk/b2tHMk1vjHc/s1600/krl_safari_border.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="102" src="http://4.bp.blogspot.com/-M78XHP61V9c/TRDz9tCmcpI/AAAAAAAAAPk/b2tHMk1vjHc/s200/krl_safari_border.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;Recent updates to the Kynetx platform related to &lt;a href="http://docs.kynetx.com/docs/Literals#"&gt;Hash expressions&lt;/a&gt; has given me the opportunity to revisit &lt;a href="http://edoism.orcutt.org/2011/02/krl-safari-krud-kynetx-crud-with.html"&gt;my previous post&lt;/a&gt;. If your WebApp has modest requirements for storage of data it is worthwhile considering the use of &lt;a href="http://docs.kynetx.com/docs/Persistent_Variables"&gt;Persistent Variables&lt;/a&gt;. To demonstrate the salient principles of using persistent variables as a datastore, a simple Kynetx WebApp addressbook is provided.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a class="big_button" href="http://ktest.heroku.com/a169x426"&gt;View Demo Online&lt;/a&gt; &lt;a class="big_button" href="https://gist.github.com/1276723"&gt;Download Source Code&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The addressbook application stores the name, email and phone number of each person. The addressbook data is stored in a single persistant variable as key/value pairs. With the persons name used as the key:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: javascript"&gt;"SomeName" : {&lt;br /&gt;    "Name"  : "SomeName",&lt;br /&gt;    "Email" : "SomeEmail",&lt;br /&gt;    "Phone" : "SomePhone"&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Since there is a lot of to wade through, so let me point out that parts specifically related to reading, writing and remove entries in the addressbook. In order to read all of the entries in the addressbook the following ruleset is used:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: javascript"&gt;foreach ent:KRUDaddresss.keys() setting (addressKey)&lt;br /&gt;pre {&lt;br /&gt;  email = ent:KRUDaddresss{[addressKey, "Email"]};&lt;br /&gt;  phone = ent:KRUDaddresss{[addressKey, "Phone"]};&lt;br /&gt;  addressRow = &amp;amp;lt;&amp;amp;lt;&lt;br /&gt;      &lt;br /&gt;          #{addressKey}&lt;br /&gt;          #{email}&lt;br /&gt;          #{phone}&lt;br /&gt;          &lt;a class="KRUDaction" href="javascript:void(0);"&gt;Remove&lt;/a&gt;&lt;br /&gt;      &lt;br /&gt;  &amp;gt;&amp;gt;;&lt;br /&gt;}&lt;br /&gt;{&lt;br /&gt;  append('#panelAddressList .DataTable tbody', addressRow);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;New entries for the addressbook are entered via a standard HTML form. With a &lt;a href="http://docs.kynetx.com/docs/Watch"&gt;watch()&lt;/a&gt; placed on the submit the following rule captures the entry from the form, builds a new entry and adds it to the persistent variable:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: javascript"&gt;select when submit "#formAddressAdd"&lt;br /&gt;pre {&lt;br /&gt;  formName  = event:param("formName");&lt;br /&gt;  formEmail = event:param("formEmail");&lt;br /&gt;  formPhone = event:param("formPhone");&lt;br /&gt;  formHash = {&lt;br /&gt;      "Name"  : formName,&lt;br /&gt;      "Email" : formEmail,&lt;br /&gt;      "Phone" : formPhone&lt;br /&gt;  };&lt;br /&gt;&lt;br /&gt;  KRUDaddresss = ent:KRUDaddresss || {};&lt;br /&gt;}&lt;br /&gt;{ noop(); }&lt;br /&gt;fired {&lt;br /&gt;  set ent:KRUDaddresss{[formName]} formHash;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Entries are removed from the addressbook by calling the following rule with an entries name as the event parameter:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: javascript"&gt;pre {&lt;br /&gt;  keyName = event:param("keyName");&lt;br /&gt;}&lt;br /&gt;{ noop(); }&lt;br /&gt;fired {&lt;br /&gt;  clear ent:KRUDaddresss{keyName};&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You can play with the &lt;a href="http://ktest.heroku.com/a169x426"&gt;online demo&lt;/a&gt; to see the end results. And you can &lt;a href="https://gist.github.com/1276723"&gt;get the source code&lt;/a&gt; for the whole WebApp on GitHub. Heads up, there's a lot of code in the WebApp related to the GUI, that's why I wanted to call out the salient CRUD elements above. Enjoy!&lt;br /&gt;&lt;br /&gt;&lt;b&gt;11 Oct 2011:&lt;/b&gt; Revised code for adding new addressbook entries to use the new expression syntax for &lt;a href="http://docs.kynetx.com/docs/Persistent_Variables#Persistent_Hashes"&gt;Persistent Hashes&lt;/a&gt;. When these new expressions are used you avoid loading, binding and transferring the entire hash.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a class="big_button" href="http://ktest.heroku.com/a169x426"&gt;View Demo Online&lt;/a&gt; &lt;a class="big_button" href="https://gist.github.com/1276723"&gt;Download Source Code&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1930213017396645687-6280183698947686146?l=edoism.orcutt.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edoism.orcutt.org/feeds/6280183698947686146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://edoism.orcutt.org/2011/10/krl-safari-krud-redux-kynetx-crud-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1930213017396645687/posts/default/6280183698947686146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1930213017396645687/posts/default/6280183698947686146'/><link rel='alternate' type='text/html' href='http://edoism.orcutt.org/2011/10/krl-safari-krud-redux-kynetx-crud-with.html' title='KRL Safari: KRUD Redux - Kynetx CRUD with Persistent Variables'/><author><name>Ed Orcutt</name><uri>http://www.blogger.com/profile/01072069799127687951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_tXU2PrpKxHU/SuDD5YwomTI/AAAAAAAAAII/hCrRNUZWOto/S220/edo_transjpg.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-M78XHP61V9c/TRDz9tCmcpI/AAAAAAAAAPk/b2tHMk1vjHc/s72-c/krl_safari_border.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1930213017396645687.post-907152792230902650</id><published>2011-02-04T10:25:00.000-07:00</published><updated>2011-02-04T10:25:37.569-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='crud'/><category scheme='http://www.blogger.com/atom/ns#' term='kynetx'/><category scheme='http://www.blogger.com/atom/ns#' term='safari'/><title type='text'>KRL Safari: KRUD - Kynetx CRUD with Persistant Variables</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tXU2PrpKxHU/TRDz9tCmcpI/AAAAAAAAAPk/C2jMx5O-0IY/s1600/krl_safari_border.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="164" src="http://3.bp.blogspot.com/_tXU2PrpKxHU/TRDz9tCmcpI/AAAAAAAAAPk/C2jMx5O-0IY/s320/krl_safari_border.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;Got KRUD? In this KRL safari we will be using persistance variables as a database. While most web developers have written code to access a database, most Kynetx applications retrieve their data via RESTful web services. But there are times when a persistant data store is needed. Building a one off web service to host the data is certainly an option, but if the storage needs are moderate you can simply use a persistant variable. After all 2 million bytes of data can be stored in a persistant variable!&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;To keep the focus on the mechanics a simple data structure is used to demonstrate KRL CRUD ... an array of strings which will be used to implement a tag cloud. The &lt;a href="http://www.lobosllc.com/demo/krud/"&gt;demo &lt;/a&gt;provides a web interface to see all of the strings in the tag cloud, add new tags and delete tags. To permit the &lt;a href="http://www.lobosllc.com/demo/krud/"&gt;demo &lt;/a&gt;to be accessible to a broad audience, it has been distributed using a &lt;a href="http://docs.kynetx.com/docs/Distribute"&gt;site tag&lt;/a&gt;. Just &lt;a href="http://www.lobosllc.com/demo/krud/"&gt;visit the demo page &lt;/a&gt;to see all of the current tags which have been entered by all who have used the application. You can add a new tag by entering text into the form, then click the Add button. To delete a existing tag simply click on the text of the tag.&lt;br /&gt;&lt;br /&gt;While the KRL code has comments thoughout, it should be emphasized that application persistent variables accessed in the rule &lt;a href="http://docs.kynetx.com/docs/Prelude"&gt;prelude&lt;/a&gt;:&lt;br /&gt;&lt;pre class="brush: javascript"&gt;TagCloud = app:TagCloud;&lt;/pre&gt;And the updated persistent variable are saved in the &lt;a href="http://docs.kynetx.com/docs/Postlude"&gt;postlude&lt;/a&gt;:&lt;br /&gt;&lt;pre class="brush: javascript"&gt;set app:TagCloud TagCloud;&lt;/pre&gt;Adding a new value to the persistent variable is performed using the &lt;a href="http://docs.kynetx.com/docs/Sets#Union_.28A_.E2.88.AA_B.29"&gt;union operator&lt;/a&gt;:&lt;br /&gt;&lt;pre class="brush: javascript"&gt;newCloud = TagCloud.union(cleanTag);&lt;/pre&gt;Removing a value from the persistent variable is done using the &lt;a href="http://docs.kynetx.com/docs/Sets#difference_.28A_.5C_B.29"&gt;difference operator&lt;/a&gt;:&lt;br /&gt;&lt;pre class="brush: javascript"&gt;newCloud = TagCloud.difference(tagText);&lt;/pre&gt;To see the implementation using a complex data structure take a look at Kynetx App A Day 28 &lt;a href="http://kynetxappaday.wordpress.com/2010/12/29/day-28-updating-users-list-when-user-joins-app/"&gt;Updating User's List When User Joins App&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;script src="https://gist.github.com/810516.js?file=KRUD"&gt;&lt;/script&gt;&lt;br /&gt;Hey! Where's the U in KRUD? Multiple choice response:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Left as an exercise for the reader&lt;/li&gt;&lt;li&gt;Updated was not needed for demo&lt;/li&gt;&lt;li&gt;I'm lazy :)&lt;/li&gt;&lt;/ol&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1930213017396645687-907152792230902650?l=edoism.orcutt.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edoism.orcutt.org/feeds/907152792230902650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://edoism.orcutt.org/2011/02/krl-safari-krud-kynetx-crud-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1930213017396645687/posts/default/907152792230902650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1930213017396645687/posts/default/907152792230902650'/><link rel='alternate' type='text/html' href='http://edoism.orcutt.org/2011/02/krl-safari-krud-kynetx-crud-with.html' title='KRL Safari: KRUD - Kynetx CRUD with Persistant Variables'/><author><name>Ed Orcutt</name><uri>http://www.blogger.com/profile/01072069799127687951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_tXU2PrpKxHU/SuDD5YwomTI/AAAAAAAAAII/hCrRNUZWOto/S220/edo_transjpg.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_tXU2PrpKxHU/TRDz9tCmcpI/AAAAAAAAAPk/C2jMx5O-0IY/s72-c/krl_safari_border.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1930213017396645687.post-1609978044949296180</id><published>2010-12-22T10:15:00.000-07:00</published><updated>2010-12-22T10:15:49.025-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='kynetx'/><category scheme='http://www.blogger.com/atom/ns#' term='safari'/><title type='text'>KRL Scope Safari: Application Variables</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tXU2PrpKxHU/TRDz9tCmcpI/AAAAAAAAAPk/C2jMx5O-0IY/s1600/krl_safari_border.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="164" src="http://3.bp.blogspot.com/_tXU2PrpKxHU/TRDz9tCmcpI/AAAAAAAAAPk/C2jMx5O-0IY/s320/krl_safari_border.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;The safari continues with a tour of &lt;a href="http://docs.kynetx.com/docs/Persistent_Variables"&gt;persistent application variables&lt;/a&gt;. This is the second article in the series to chronicle the investigation of scope and extent of persistent variables in the Kynetx KRL platform. In the &lt;a href="http://edoism.orcutt.org/2010/12/krl-scope-safari-entity-variables.html"&gt;first KRL Scope Safari &lt;/a&gt;we explored persistent Entity Variables. Application variables in KRL are used to record persistent data within a &lt;a href="http://docs.kynetx.com/docs/Ruleset"&gt;ruleset&lt;/a&gt;. The value of an application variable is retained between execution of the ruleset. So far application variables seem to be the same as entity variables. The difference is that application variables are shared across all sessions of the ruleset. They are not restrained to a single browser session. A truly &lt;i&gt;global&lt;/i&gt; application variable!&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;Note: For another perspective on KRL persistent variables I would highly recommend the &lt;i&gt;Kynetx App A Day &lt;/i&gt;article &lt;a href="http://kynetxappaday.wordpress.com/2010/12/18/day-12-persistant-variables/"&gt;Day 12 - Persistent Variables&lt;/a&gt; by &lt;a href="http://geek.michaelgrace.org/"&gt;Michael Grace&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;We need some &lt;a href="https://gist.github.com/751134"&gt;KRL code for this safari&lt;/a&gt;! Starting with the KRL from the last safari we replace all occurrences of &lt;i&gt;ent:safari_entity &lt;/i&gt;with &lt;i&gt;app:safari_app&lt;/i&gt;. There are three rules in the demo application. The first rule, &lt;i&gt;Safari_Initialize &lt;/i&gt;displays a growl notification which includes a title, the current value of the application variable and two html forms which permit the application variable to mutated and cleared. The second rule, &lt;i&gt;Safari_Respond_Submit &lt;/i&gt;processes the form submission to mutate (change) the application variable. The last rule, &lt;i&gt;Safari_Respond_Clear &lt;/i&gt;processes the form submission to clear the application variable.&lt;br /&gt;&lt;br /&gt;The value of the application variable can be accessed inside prelude expressions. In the prelude section of &lt;i&gt;Safari_Initalize &lt;/i&gt;the value of safari_app is accessed. Application variables are mutated in the postlude section of a rule. In the postlude section of &lt;i&gt;Safari_Respond_Submit &lt;/i&gt;the value of the application variable safari_app is set to the value of newValue. And in the postlude section of &lt;i&gt;Safari_Respond_Clear &lt;/i&gt;the application variable safari_app is cleared.&lt;br /&gt;&lt;br /&gt;It's demo time! You can follow along with the demo by running the application in two separate browsers at &lt;a href="http://kynetx.aculis.net/safari/app.html"&gt;http://kynetx.aculis.net/safari/app.html &lt;/a&gt;The screen shots below are taking from Mozilla Firefox and Google Chrome. Starting in Firefox, the very first time the Kynetx ruleset is run the application variable does not exist, so it's value is set to "Just Born!". Note: Your mileage may vary since the application variable will retain it's value from the last user.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_tXU2PrpKxHU/TRGKFXTxVkI/AAAAAAAAAPo/Shw30VK6rDo/s1600/01_safari_app_firefox_start.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="110" src="http://1.bp.blogspot.com/_tXU2PrpKxHU/TRGKFXTxVkI/AAAAAAAAAPo/Shw30VK6rDo/s320/01_safari_app_firefox_start.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;The value of the application variable can be changed by entering a new value into the text field.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_tXU2PrpKxHU/TRGKJgFaPsI/AAAAAAAAAPs/0jENkKdZj4k/s1600/02_safari_app_firefox_entertext.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="107" src="http://2.bp.blogspot.com/_tXU2PrpKxHU/TRGKJgFaPsI/AAAAAAAAAPs/0jENkKdZj4k/s320/02_safari_app_firefox_entertext.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;After the Mutate button is clicked the current value of the application variable is set.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tXU2PrpKxHU/TRGKdg1B2eI/AAAAAAAAAPw/LOOzQxImnUY/s1600/03_safari_app_firefox_newcurrent.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="107" src="http://3.bp.blogspot.com/_tXU2PrpKxHU/TRGKdg1B2eI/AAAAAAAAAPw/LOOzQxImnUY/s320/03_safari_app_firefox_newcurrent.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Switching over to the Google Chrome browser, when the Kynetx ruleset fires the value of the application variable is the same as it was in Firefox. &lt;b&gt;This is our proof &lt;/b&gt;that the application variable is accessible to all running sessions of the ruleset.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_tXU2PrpKxHU/TRGKmOdCMWI/AAAAAAAAAP0/57KRhS8HEkE/s1600/04_safari_app_chrome_start.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="108" src="http://2.bp.blogspot.com/_tXU2PrpKxHU/TRGKmOdCMWI/AAAAAAAAAP0/57KRhS8HEkE/s320/04_safari_app_chrome_start.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Still in Chrome a new value is entered into the text field.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_tXU2PrpKxHU/TRGKsse-WVI/AAAAAAAAAP4/snN6Cv1pJ_Y/s1600/05_safari_app_chrome_entertext.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="108" src="http://4.bp.blogspot.com/_tXU2PrpKxHU/TRGKsse-WVI/AAAAAAAAAP4/snN6Cv1pJ_Y/s320/05_safari_app_chrome_entertext.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;After clicking the Mutate button the current value is updated.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_tXU2PrpKxHU/TRGKzelTh6I/AAAAAAAAAP8/YU5SU5-rQM8/s1600/06_safari_app_chrome_newcurrent.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="108" src="http://1.bp.blogspot.com/_tXU2PrpKxHU/TRGKzelTh6I/AAAAAAAAAP8/YU5SU5-rQM8/s320/06_safari_app_chrome_newcurrent.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Back to the Firefox browser, the page is reloaded and we can see that updated value of the application variable is the same as it was in Chrome.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_tXU2PrpKxHU/TRGK8BMwmEI/AAAAAAAAAQA/l4CNurtp11M/s1600/07_safari_app_firefox_reload.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="107" src="http://4.bp.blogspot.com/_tXU2PrpKxHU/TRGK8BMwmEI/AAAAAAAAAQA/l4CNurtp11M/s320/07_safari_app_firefox_reload.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;Clicking the Clear button will destory the application variable.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tXU2PrpKxHU/TRGLCEOExSI/AAAAAAAAAQE/azshiQSVqFE/s1600/08_safari_app_firefox_clear.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="107" src="http://3.bp.blogspot.com/_tXU2PrpKxHU/TRGLCEOExSI/AAAAAAAAAQE/azshiQSVqFE/s320/08_safari_app_firefox_clear.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Finally we reload the page in Chrome after it has been cleared.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_tXU2PrpKxHU/TRGLHC0qWOI/AAAAAAAAAQI/iVJUa3_DRuQ/s1600/09_safari_app_chrome_allclear.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="108" src="http://1.bp.blogspot.com/_tXU2PrpKxHU/TRGLHC0qWOI/AAAAAAAAAQI/iVJUa3_DRuQ/s320/09_safari_app_chrome_allclear.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;In the next KRL Scope Safari we will add Modules to the adventure! Will we be able to share an persistent application variable between to different rulesets by using the same module? Stay Tuned!&lt;br /&gt;&lt;br /&gt;&lt;script src="https://gist.github.com/751134.js?file=KRL_Scope_Safari_Application_Variables.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1930213017396645687-1609978044949296180?l=edoism.orcutt.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edoism.orcutt.org/feeds/1609978044949296180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://edoism.orcutt.org/2010/12/krl-scope-safari-application-variables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1930213017396645687/posts/default/1609978044949296180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1930213017396645687/posts/default/1609978044949296180'/><link rel='alternate' type='text/html' href='http://edoism.orcutt.org/2010/12/krl-scope-safari-application-variables.html' title='KRL Scope Safari: Application Variables'/><author><name>Ed Orcutt</name><uri>http://www.blogger.com/profile/01072069799127687951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_tXU2PrpKxHU/SuDD5YwomTI/AAAAAAAAAII/hCrRNUZWOto/S220/edo_transjpg.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_tXU2PrpKxHU/TRDz9tCmcpI/AAAAAAAAAPk/C2jMx5O-0IY/s72-c/krl_safari_border.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1930213017396645687.post-7880597813640487780</id><published>2010-12-21T12:12:00.000-07:00</published><updated>2010-12-21T12:12:54.275-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='kynetx'/><category scheme='http://www.blogger.com/atom/ns#' term='safari'/><title type='text'>KRL Scope Safari: Entity Variables</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tXU2PrpKxHU/TRDz9tCmcpI/AAAAAAAAAPk/C2jMx5O-0IY/s1600/krl_safari_border.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="165" src="http://3.bp.blogspot.com/_tXU2PrpKxHU/TRDz9tCmcpI/AAAAAAAAAPk/C2jMx5O-0IY/s320/krl_safari_border.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;This KRL Safari will investigate the scope and extent of &lt;a href="http://docs.kynetx.com/docs/Persistent_Variables"&gt;persistent variables &lt;/a&gt;on the Kynetx KRL platform. We begin the expedition with the most familiar type of persistent variable, the Entity variable. Entity variables in KRL are used to record persistent data within a &lt;a href="http://docs.kynetx.com/docs/Ruleset"&gt;ruleset&lt;/a&gt;. The value of an entity variable is retained between executions of the ruleset. It is important to note that the scope of an entity variable is directly associated with your browser session.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;Note: For another perspective on KRL persistent variables I would highly recommend the &lt;i&gt;Kynetx App A Day &lt;/i&gt;article &lt;a href="http://kynetxappaday.wordpress.com/2010/12/18/day-12-persistant-variables/"&gt;Day 12 - Persistent Variables&lt;/a&gt; by &lt;a href="http://geek.michaelgrace.org/"&gt;Michael Grace&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Since the definitive authority is code, here is a &lt;a href="https://gist.github.com/749097"&gt;KRL ruleset&lt;/a&gt;! There are three rules in this demo application. The first rule, &lt;i&gt;Safari_Initialize &lt;/i&gt;displays a growl notification which includes a title, the current value of the entity variable and two html forms which enable the entity variable to mutated and cleared. The second rule, &lt;i&gt;Safari_Respond_Submit &lt;/i&gt;processes the form submission to mutate (change) the entity variable. The last rule, &lt;i&gt;Safari_Respond_Clear &lt;/i&gt;processes the form submission to clear the entity variable.&lt;br /&gt;&lt;br /&gt;The value of the entity variable can be accessed inside of a prelude expression. In the prelude section of &lt;i&gt;Safari_Initalize &lt;/i&gt;the value of safari_entity is accessed. Entity variables can be mutated in the postlude section of a rule. In the postlude section of &lt;i&gt;Safari_Respond_Submit &lt;/i&gt;the value of the entity variable safari_entity is set to the value of newValue. And in the postlude section of &lt;i&gt;Safari_Respond_Clear &lt;/i&gt;the entity variable safari_entity is cleared.&lt;br /&gt;&lt;br /&gt;Now it's time to start the safari demo of persistent entity variables. You can follow along with the demo in another browser window by visiting &lt;a href="http://kynetx.aculis.net/safari/entity.html"&gt;http://kynetx.aculis.net/safari/entity.html&lt;/a&gt;. When this Kynetx ruleset is run for the first time the entity variable does not exist, and so it is set to the value "Just Born!".&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tXU2PrpKxHU/TQ_WcYgtRoI/AAAAAAAAAPQ/F73KZXlma9c/s1600/01_safari_entity_start.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="107" src="http://3.bp.blogspot.com/_tXU2PrpKxHU/TQ_WcYgtRoI/AAAAAAAAAPQ/F73KZXlma9c/s320/01_safari_entity_start.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The value of the entity variable can be changed by entering a new value into the text field.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tXU2PrpKxHU/TQ_WmsTsWVI/AAAAAAAAAPU/xtp1oK-315w/s1600/02_safari_entity_enternew.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="107" src="http://3.bp.blogspot.com/_tXU2PrpKxHU/TQ_WmsTsWVI/AAAAAAAAAPU/xtp1oK-315w/s320/02_safari_entity_enternew.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;After the Mutate button is clicked the current value of the entity variable is updated.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tXU2PrpKxHU/TQ_Wu2GoDhI/AAAAAAAAAPY/-1Xx4D4_vnY/s1600/03_safari_entity_newcurrent.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="107" src="http://3.bp.blogspot.com/_tXU2PrpKxHU/TQ_Wu2GoDhI/AAAAAAAAAPY/-1Xx4D4_vnY/s320/03_safari_entity_newcurrent.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;When the browser window is reload or a new window is opened the current value of the entity variable remains the same.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_tXU2PrpKxHU/TQ_W58FRB3I/AAAAAAAAAPc/vXOUHwd3ajE/s1600/04_safari_entity_reloadcurrent.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="107" src="http://1.bp.blogspot.com/_tXU2PrpKxHU/TQ_W58FRB3I/AAAAAAAAAPc/vXOUHwd3ajE/s320/04_safari_entity_reloadcurrent.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Clicking the Clear button will destory the entity variable.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tXU2PrpKxHU/TQ_XEpHbttI/AAAAAAAAAPg/XsPjD-OiyQM/s1600/05_safari_entity_clear.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="107" src="http://3.bp.blogspot.com/_tXU2PrpKxHU/TQ_XEpHbttI/AAAAAAAAAPg/XsPjD-OiyQM/s320/05_safari_entity_clear.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Then when the browser window is reloaded, or a new window is opened, we are back at the beginning of this demo.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tXU2PrpKxHU/TQ_WcYgtRoI/AAAAAAAAAPQ/F73KZXlma9c/s1600/01_safari_entity_start.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="107" src="http://3.bp.blogspot.com/_tXU2PrpKxHU/TQ_WcYgtRoI/AAAAAAAAAPQ/F73KZXlma9c/s320/01_safari_entity_start.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;An extremely important point to note is that entity variables are tied to your browser session in much the same way as browser cookies. You can see this for yourself by running this demo in two separate browsers (e.g. Firefox &amp;amp; Chrome) or by running the demo on two separate computers. Simply running the demo in two separate Firefox windows on the same computer is not the same since the session is the same.&lt;br /&gt;&lt;br /&gt;The Scope Safari continues next time when we look at the scope of Application persistent variables on the Kynetx platform.&lt;br /&gt;&lt;br /&gt;&lt;script src="https://gist.github.com/749097.js?file=KRL_Scope_Safari_Entity_Variables.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1930213017396645687-7880597813640487780?l=edoism.orcutt.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edoism.orcutt.org/feeds/7880597813640487780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://edoism.orcutt.org/2010/12/krl-scope-safari-entity-variables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1930213017396645687/posts/default/7880597813640487780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1930213017396645687/posts/default/7880597813640487780'/><link rel='alternate' type='text/html' href='http://edoism.orcutt.org/2010/12/krl-scope-safari-entity-variables.html' title='KRL Scope Safari: Entity Variables'/><author><name>Ed Orcutt</name><uri>http://www.blogger.com/profile/01072069799127687951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_tXU2PrpKxHU/SuDD5YwomTI/AAAAAAAAAII/hCrRNUZWOto/S220/edo_transjpg.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_tXU2PrpKxHU/TRDz9tCmcpI/AAAAAAAAAPk/C2jMx5O-0IY/s72-c/krl_safari_border.png' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
