Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active April 3, 2020 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenwebb/83a84a36531417b7fcad8e078deb9daa to your computer and use it in GitHub Desktop.
Save kenwebb/83a84a36531417b7fcad8e078deb9daa to your computer and use it in GitHub Desktop.
19 Corvids (Raven) - XML can be Virus-like
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Fri Apr 03 2020 13:51:28 GMT-0400 (Eastern Daylight Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: 19 Corvids (Raven) - XML can be Virus-like
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: 83a84a36531417b7fcad8e078deb9daa
Keywords:
My Notes
--------
March 30, 2020
A biological virus and an XML string are similar in several ways.
In this workbook, I will explore this concept in the context of the Xholon project, which makes extensive use of XML.
In both cases, there's an active form and an inactive form.
In order to become active, the inactive form needs to be acted on by something active.
- biology:
- XML: an XML parser + Xholon node.append() -> a JavaScript Object
- an XML string cannot do either of these two things on its own
- JSON: JSON.parse() -> JavaScript Object
TODO
- specify three functions in Haskell (Hindley-Milner) notation; something like this:
inactive2active :: String -> ActiveObject
Example of a RNA string: (G, U, A, and C)
var rnaStr = 'UGACUUUACCAGUA';
xh.root().rna = rnaStr;
Example of an XML string:
var xmlStr = '<One><Two/><Three/><Four/></One>';
xh.root().append(xmlStr);
Example of an JSON string:
var jsonStr = '{"One": {"Two": null} }';
xh.root().testing = JSON.parse(jsonStr);
// OR
var jsonStr = '{"One": ["Two", "Three", "Four"] }';
References
----------
() https://en.wikipedia.org/wiki/Severe_acute_respiratory_syndrome_coronavirus_2
() https://en.wikipedia.org/wiki/Positive-sense_single-stranded_RNA_virus
() https://en.wikipedia.org/wiki/Coronavirus
() https://en.wikipedia.org/wiki/Virus
When not inside an infected cell or in the process of infecting a cell, viruses exist in the form of independent particles, or virions
Viral populations do not grow through cell division, because they are acellular. Instead, they use the machinery and metabolism of a host cell to produce multiple copies of themselves, and they assemble in the cell.
Their life cycle differs greatly between species, but there are six basic stages in their life cycle:
() https://en.wikipedia.org/wiki/Viral_replication
Viruses multiply only in living cells. The host cell must provide the energy and synthetic machinery and the low molecular-weight precursors for the synthesis of viral proteins and nucleic acids.
() https://en.wikipedia.org/wiki/Computer_virus
() https://en.wikipedia.org/wiki/RNA
() http://127.0.0.1:8888/wb/editwb.html?app=Convert+between+XML+and+JSON%2FJS&src=lstr
) https://gist.github.com/kenwebb/c33263ca3399e32d902b2903f2e3cff5
in this new workbook, I explore libraries that convert between XML and JSON/JS
]]></Notes>
<_-.XholonClass>
<!-- domain objects -->
<PhysicalSystem/>
<Block/>
<Brick/>
<!-- quantities -->
<Height superClass="Quantity"/>
</_-.XholonClass>
<xholonClassDetails>
<Block>
<port name="height" connector="Height"/>
</Block>
</xholonClassDetails>
<PhysicalSystem>
<Block>
<Height>0.1 m</Height>
</Block>
<Brick multiplicity="2"/>
</PhysicalSystem>
<Blockbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var a = 123;
var b = 456;
var c = a * b;
if (console) {
console.log(c);
}
//# sourceURL=Blockbehavior.js
]]></Blockbehavior>
<Heightbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var myHeight, testing;
var beh = {
postConfigure: function() {
testing = Math.floor(Math.random() * 10);
myHeight = this.cnode.parent();
},
act: function() {
myHeight.println(this.toString());
},
toString: function() {
return "testing:" + testing;
}
}
//# sourceURL=Heightbehavior.js
]]></Heightbehavior>
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
$wnd.xh.Brickbehavior = function Brickbehavior() {}
$wnd.xh.Brickbehavior.prototype.postConfigure = function() {
this.brick = this.cnode.parent();
this.iam = " red brick";
};
$wnd.xh.Brickbehavior.prototype.act = function() {
this.brick.println("I am a" + this.iam);
};
//# sourceURL=Brickbehavior.js
]]></Brickbehavior>
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
console.log("I'm another brick behavior");
]]></Brickbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Block</title>
<rect id="PhysicalSystem/Block" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Height</title>
<rect id="PhysicalSystem/Block/Height" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</g>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment