tag:blogger.com,1999:blog-20341261672689523382024-02-21T10:36:34.052-05:00Robert MuthNew YorkAnonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.comBlogger20125tag:blogger.com,1999:blog-2034126167268952338.post-74680736279537284462018-12-16T10:27:00.002-05:002018-12-16T10:28:43.968-05:00Refactoring Large Functions<h2 dir="ltr" style="line-height: 1.38; margin-bottom: 4pt; margin-top: 18pt;">
<a href="http://robert.muth.org/refactoring-large-functions.html">http://robert.muth.org/refactoring-large-functions.html</a></h2>
Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-61687374412193700742018-07-27T15:10:00.003-04:002018-07-27T15:10:44.388-04:00WebWhorld<br />
A limited re-implementation of <a href="http://whorld.org/"> Chris Korda's Whorld</a> with compatibility to "whp" - patches.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK8ktRxGNewGx95IrPsjxt6o27DdPS_cQIF-Zb7MhqWu2Zn7vFXEc0TCfppmhWCtlafsAArLhfyiSdqY3paACn0kq71RqV4noLYh-tb0lV_0jtSUjRf2-Cv5QJg-C6bv7Nolp4E9USLAZV/s1600/frontpage.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="350" data-original-width="640" height="175" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK8ktRxGNewGx95IrPsjxt6o27DdPS_cQIF-Zb7MhqWu2Zn7vFXEc0TCfppmhWCtlafsAArLhfyiSdqY3paACn0kq71RqV4noLYh-tb0lV_0jtSUjRf2-Cv5QJg-C6bv7Nolp4E9USLAZV/s320/frontpage.jpg" width="320" /></a></div>
<br />
Starting Points:<br />
<br />
<a href="http://art.muth.org/whorld.html#patch=Cross">http://art.muth.org/whorld.html#patch=Cross</a><br />
<a href="http://art.muth.org/whorld.html#patch=LotusLight">http://art.muth.org/whorld.html#patch=LotusLight</a><br />
<a href="http://art.muth.org/whorld.html#patch=LwPinwheelFabColor">http://art.muth.org/whorld.html#patch=LwPinwheelFabColor</a><br />
<br />
<br />
<br />
Source code at: https://github.com/robertmuth<br />
<br />
More Screen Art at: http://muth.org/Art<br />
<br />
<br />
<br />
<br />
Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-48547485558978295642017-09-24T22:53:00.001-04:002017-09-24T22:53:27.953-04:00Divergence FreeA WebGL project inspired by the simulation of fluids.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg40dIRKoQA06VVEcgJPo_SlDryJF3F12LqxT802DeBYFoISSpc8r00eqrsICjEs-zXWBD5n3qdrSKkvHGU-KBOkwX6NVyz7jZQpeXkzP9ZHKQ73Qt5rKS7SGxpiLufPoLGRcSGmIwtC_DA/s1600/Screenshot+from+2017-09-24+22-48-14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="648" data-original-width="1600" height="257" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg40dIRKoQA06VVEcgJPo_SlDryJF3F12LqxT802DeBYFoISSpc8r00eqrsICjEs-zXWBD5n3qdrSKkvHGU-KBOkwX6NVyz7jZQpeXkzP9ZHKQ73Qt5rKS7SGxpiLufPoLGRcSGmIwtC_DA/s640/Screenshot+from+2017-09-24+22-48-14.png" width="640" /></a></div>
<br />
<a href="https://draft.blogger.com/goog_640653500"><br /></a>
<a href="http://art.muth.org/divergencefree.html">http://art.muth.org/divergencefree.html</a><br />
<br />
<br />
<h4>
Variants</h4>
<br />
<div>
<div>
<span style="white-space: pre;"> </span><a href="http://art.muth.org/divergencefree.html#AnimatedLarge">http://art.muth.org/divergencefree.html#AnimatedLarge</a></div>
<div>
<span style="white-space: pre;"> </span><a href="http://art.muth.org/divergencefree.html#BlueLarge">http://art.muth.org/divergencefree.html#BlueLarge</a></div>
<div>
<span style="white-space: pre;"> </span><a href="http://art.muth.org/divergencefree.html#GreenHuge">http://art.muth.org/divergencefree.html#GreenHuge</a></div>
<div>
<span style="white-space: pre;"> </span><a href="http://art.muth.org/divergencefree.html#RedMedium">http://art.muth.org/divergencefree.html#RedMedium</a></div>
<div>
<span style="white-space: pre;"> </span><a href="http://art.muth.org/divergencefree.html#RedMediumDense">http://art.muth.org/divergencefree.html#RedMediumDense</a></div>
<div>
<span style="white-space: pre;"> </span><a href="http://art.muth.org/divergencefree.html#BlackLarge">http://art.muth.org/divergencefree.html#BlackLarge</a></div>
</div>
Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-45336948453823363232017-08-12T20:16:00.004-04:002017-08-12T20:18:52.014-04:00MöbiusGears for the Web open sourced with new modes<br />
Two years ago I released MöbiusGears for WegGL - cf. <a href="http://robertmuth.blogspot.com/2015/11/pixel-city-in-webgl.html">blog post</a>.<br />
I recently decided to port the project to the <a href="https://github.com/ChronosTeam/ChronosGL">ChronosGL 3D Framework</a>,<br />
add a few more modes and release the code on <a href="https://github.com/robertmuth/MoebiusGears">github</a>.<br />
It is now possible to<br />
<br />
<ul>
<li><a href="http://art.muth.org/moebius_gears.html#StandardTwist">add a twisting motion</a></li>
<li><a href="http://art.muth.org/moebius_gears.html#RedShadow">have shadows</a></li>
<li><a href="http://art.muth.org/moebius_gears.html#RedWireFrame">show wireframes</a></li>
</ul>
<br />
<br />
<hr />
<span style="font-family: "arial" , "helvetica" , sans-serif;">If you enjoy this piece you might also enjoy my other pieces at <a href="http://art.muth.org/"><b>art.muth.org</b></a> or similar animation done by others at <a href="http://www.arscalculanda.com/"><b>www.arscalculanda.com</b></a>.</span><br />
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-11578125398729369162017-04-16T21:51:00.000-04:002017-04-18T23:43:13.896-04:00PixelCity for the Web open sourced with new modes<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">A year and a half ago I released PixelCity for <a href="http://webglreport.com/"><b>WegGL</b></a> - cf. <a href="http://robertmuth.blogspot.com/2015/11/pixel-city-in-webgl.html"><b>blog post</b></a>.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">I recently decided to add a few more modes and release the code on <a href="https://github.com/robertmuth/WebPixelCity" style="font-weight: bold;">github</a>.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">Beside the original <a href="http://art.muth.org/pixelcity.html#OuterHigh"><b>night mode</b></a> variations, there is now a <a href="http://art.muth.org/pixelcity.html#WireFrameBlue"><b>wireframe mode</b></a>:</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhU-jgPg6ol_08QnQJzKn-6ro2-lY-0frgwBBTDQhDnHL1tJbPPZs9BnysievvjUkNoqwqeq4R9KEIs3-PpuvbnObiDVi70xEswncsH119r6wv-TxFp-AMtqHzg86dcp-CxAjz3OXnqWciQ/s1600/Screenshot+from+2017-04-16+21-40-39.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><img border="0" height="261" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhU-jgPg6ol_08QnQJzKn-6ro2-lY-0frgwBBTDQhDnHL1tJbPPZs9BnysievvjUkNoqwqeq4R9KEIs3-PpuvbnObiDVi70xEswncsH119r6wv-TxFp-AMtqHzg86dcp-CxAjz3OXnqWciQ/s320/Screenshot+from+2017-04-16+21-40-39.png" width="320" /></span></a></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> and <a href="http://art.muth.org/pixelcity.html#DayLight"><b>day mode</b></a>:</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJCkaQ7KZIMTjurB3FS3_KfTkNwAAlFK1lI5MBfS_qm6IUz5DPSW2Rq0-QEXDsiER7qTV3fqKWcet762bvV9QKf2VziAXqYXudoDBAHLU0M312_f0oIG5B1W9LZRNbGGpl6UQmmOhrUzY4/s1600/Screenshot+from+2017-04-16+21-42-13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><img border="0" height="210" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJCkaQ7KZIMTjurB3FS3_KfTkNwAAlFK1lI5MBfS_qm6IUz5DPSW2Rq0-QEXDsiER7qTV3fqKWcet762bvV9QKf2VziAXqYXudoDBAHLU0M312_f0oIG5B1W9LZRNbGGpl6UQmmOhrUzY4/s320/Screenshot+from+2017-04-16+21-42-13.png" width="320" /></span></a></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Shadows for the day mode are sort of working but needs some more work.</span><br />
<br />
<hr />
<span style="font-family: "arial" , "helvetica" , sans-serif;">If you enjoy this piece you might also enjoy my other pieces at <a href="http://art.muth.org/"><b>art.muth.org</b></a> or similar animation done by others at <a href="http://www.arscalculanda.com/"><b>www.arscalculanda.com</b></a>.</span><br />
<br />Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-83979457944078878012016-10-28T14:50:00.000-04:002016-10-28T14:50:48.730-04:00PyZwaver - a Python3 library for Z-Wave I have been playing with Z-Wave based home automation for a long time but always missed<br />
having an easy to hack pure Python library so I finally wrote one myself:<br />
<br />
<a href="https://github.com/robertmuth/PyZwaver">https://github.com/robertmuth/PyZwaver</a>Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-8401893378491378922016-04-24T18:40:00.000-04:002016-04-24T18:40:17.490-04:00Port of Helios screensaver to WebGL<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Helios is another port of Terry Welsh's awesome <a href="http://www.reallyslick.com/screensavers/">screensavers.</a></span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipIpOah2545hns42xNm3enNXcQaD6QFp-SutP4eJzmJ6416ZLFe3v5khcp_6zNCVgJBpbB2RRYkRVKPmXUgM6-nNgTYz-GdxedAS0tnffHK2pYaFnFdMzdDwRpt3SBydDTX9PeOS8bgvHT/s1600/snapshot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="248" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipIpOah2545hns42xNm3enNXcQaD6QFp-SutP4eJzmJ6416ZLFe3v5khcp_6zNCVgJBpbB2RRYkRVKPmXUgM6-nNgTYz-GdxedAS0tnffHK2pYaFnFdMzdDwRpt3SBydDTX9PeOS8bgvHT/s320/snapshot.png" width="320" /></a></div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">It is best enjoyed on a recent version of Chrome and a reasonably powerful machine.</span><br />
<br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><a href="http://art.muth.org/helios.html#Standard">Standard Demo</a></span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> Variants: </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><a href="http://art.muth.org/helios.html#NoSurfaces">No Surfaces</a> (works well on less powerful machines)</span><br />
<a href="http://art.muth.org/helios.html#CloseUp">Close Up</a><br />
<a href="http://art.muth.org/helios.html#CrazyCamera">Crazy Camer</a>Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-66389490893146498852016-03-30T08:35:00.000-04:002016-03-30T11:22:25.813-04:00Microcosm<span style="font-family: "arial" , "helvetica" , sans-serif;">My latest project, Microcosm, took a little longer but it has been worth it.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWDwgLskZxnH_Zl3w23IpvBlO0HCabXSkoen7R8ocq5mDHXNnrnSr6mTKXmQsgv8xqtlZUsKcK5Tz5E3j14QFESaTZrhn1VILuvMtkyip-xO7gL5IIrBztFXbX4UDPKOFF63FCudogYKQg/s1600/screenshot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><img border="0" height="277" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWDwgLskZxnH_Zl3w23IpvBlO0HCabXSkoen7R8ocq5mDHXNnrnSr6mTKXmQsgv8xqtlZUsKcK5Tz5E3j14QFESaTZrhn1VILuvMtkyip-xO7gL5IIrBztFXbX4UDPKOFF63FCudogYKQg/s320/screenshot.png" width="320" /></span></a></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Microcosm is a port of <a href="http://www.reallyslick.com/screensavers/">Terry Welsh's awesome screensave with the same name</a></span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">I<span style="font-family: "arial" , "helvetica" , sans-serif;">t</span> is best enjoyed on a recent version of Chrome and a reasonably powerful machine.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">If necessary, you can adjust the detail-setting in the config screen to make it work on weaker machines including many mobile devices.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">The config screen also has many additional customization options worth exploring.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <a href="http://art.muth.org/microcosm.html">Microcosm Demo</a></span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> Variants:</span><span style="font-family: "arial" , "helvetica" , sans-serif;"> </span><br />
<br />
<ul>
<li><a href="http://art.muth.org/microcosm.html#Cylinder" style="font-family: Arial, Helvetica, sans-serif;">Cylinder</a></li>
<li><a href="http://art.muth.org/microcosm.html#TorusBox" style="font-family: Arial, Helvetica, sans-serif;">TorusBox</a></li>
<li><a href="https://www.blogger.com/%C2%A0http://art.muth.org/microcosm.html#KnotAndTorus" style="font-family: Arial, Helvetica, sans-serif;">KnotAndTorus</a></li>
<li><a href="http://art.muth.org/microcosm.html#SimpleKaleidoscope" style="font-family: Arial, Helvetica, sans-serif;">SimpleKaleidoscope</a></li>
<li><a href="http://art.muth.org/microcosm.html#ComplexKaleidoscope" style="font-family: Arial, Helvetica, sans-serif;">ComplexKaleidoscope</a></li>
</ul>
Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-28399984846723439942016-01-11T08:50:00.001-05:002016-01-11T08:50:28.928-05:00SmoothLife in WebGLYet another WebGL project: a port of Stephan Rafler's <a href="http://sourceforge.net/projects/smoothlife/">Smooth Life</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg85cROJw6agqDWAfkyGw2H-IkSBIs1NMD3g9AjR8ZSsXx2g5y6xeLlE7mQ5sEC2cNvhYwQcQNwdamoRea7rfyOzgKpABpAE3P9BbESIVrsxOBhnX7RNuMtnqcr13rQqS7UbiZ2KzvOWCax/s1600/screenshot_005.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="159" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg85cROJw6agqDWAfkyGw2H-IkSBIs1NMD3g9AjR8ZSsXx2g5y6xeLlE7mQ5sEC2cNvhYwQcQNwdamoRea7rfyOzgKpABpAE3P9BbESIVrsxOBhnX7RNuMtnqcr13rQqS7UbiZ2KzvOWCax/s320/screenshot_005.png" width="320" /></a></div>
<br />
<br />
The GPU is used for acceleration rather than 3D effects and is required to support float textures as framebuffers.<br />
<br />
Try it out here<br />
<a href="http://art.muth.org/smoothlife.html">http://art.muth.org/smoothlife.html</a><br />
<br />
<br />
Several variants are accessible from the Config Screen - press "C" to enter it.<br />
If you discover an interesting customization please send it to us.<br />
<br />
===<br />
Caveats:<br />
This currently only works on Chrome and following parameters are hardcoded:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">time step mode: 2 "f = g + dt*(f-g)"</span><br />
<span style="font-family: Courier New, Courier, monospace;">dt: 0.1</span><br />
<span style="font-family: Courier New, Courier, monospace;">sigtype: 1.0 "hard"</span><br />
<span style="font-family: Courier New, Courier, monospace;">mixtype: 0.0 "hard"</span><br />
<span style="font-family: Courier New, Courier, monospace;">sigmode: 2.0 "sigmoid_mix"</span><br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-9434761528615099082015-11-20T10:56:00.001-05:002015-11-20T10:56:47.516-05:00Pixel City in WebGL <div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "arial" , "helvetica" , sans-serif;">I just finished another 3D project: a</span><span style="font-family: "arial" , "helvetica" , sans-serif;"> clone of </span><a href="http://www.shamusyoung.com/twentysidedtale/?p=2940" style="font-family: Arial, Helvetica, sans-serif;">Shamus Young's Pixel City</a>.</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmOTCSRWzvDrtnn-XwENp4AXvAISt57JtzlyU7kksOX3bqbtWpL2fpmmjYxq8TiT3v3VnGs7OYVHVEvF6tVBRBLz3lLIeH4Y_z7CylO02hnZsZIAOY7pRZnK15Uz64YZwxUC5MVPMzPH5O/s1600/pixelcity.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="210" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmOTCSRWzvDrtnn-XwENp4AXvAISt57JtzlyU7kksOX3bqbtWpL2fpmmjYxq8TiT3v3VnGs7OYVHVEvF6tVBRBLz3lLIeH4Y_z7CylO02hnZsZIAOY7pRZnK15Uz64YZwxUC5MVPMzPH5O/s320/pixelcity.jpg" width="320" /></a></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span><span style="font-family: "arial" , "helvetica" , sans-serif;">It is written in <a href="https://www.dartlang.org/">Dart </a>and uses Raymond Hulha's excellent <a href="https://github.com/rhulha/ChronosGL">ChronosGL library</a>.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">Try it out at <a href="http://art.muth.org/pixelcity.html">http://art.muth.org/pixelcity.html</a></span><br />
Note: due to a bug in (the way I use) Dart this does not appear to be working on Firefox currently, so use Chrome for now.<br />
<br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">Several variants are accessible from the Config Screen - press "C" to enter it.</span>Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-74992562553617254862015-08-11T09:13:00.003-04:002015-08-11T09:13:43.974-04:00Moebius Gears in WebGLMy first steps in 3D programming with Dart and WebGL:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfOgQ7VhoMOMpN-MwjzlrH4xsU3G5PokUYHHx9NU1WM9XBZji6lbRafWgMytYmZUvzIIM1aNmT4J5YKZdonWXlcNP45OIdMPUKWvXK6Cte8NhYX6xTtyYyhvogVkScDxbNHWiWxYISrIRP/s1600/MyScreenshot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfOgQ7VhoMOMpN-MwjzlrH4xsU3G5PokUYHHx9NU1WM9XBZji6lbRafWgMytYmZUvzIIM1aNmT4J5YKZdonWXlcNP45OIdMPUKWvXK6Cte8NhYX6xTtyYyhvogVkScDxbNHWiWxYISrIRP/s320/MyScreenshot.png" width="320" /></a></div>
<br />
Try it out yourself at:<br />
<a href="http://muth.org/Art/moebius_gears.html">http://muth.org/Art/moebius_gears.html</a>Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-76583812605365532202015-05-24T09:47:00.001-04:002015-05-24T09:49:39.561-04:00WebGL Version of Conway's Game of Life and VariationsAnother installment of my exploration into Google's Dart language.<br />
This time playing with WebGL producing yet another implementation of Conway's Game of Life.<br />
<br />
<br />
<a href="http://muth.org/Art/life.html">http://muth.org/Art/life.html</a><br />
<br />
<br />
It should work on most browsers and systems including mobile devices.Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-37909800072858000072015-05-06T01:35:00.000-04:002015-05-06T01:37:21.308-04:00Web-port of xscreensaver's Substrate Recently I started using Google's Dart language for web development projects.<br />
Not being a fan of JavaScript, Dart has made such projects fun again.<br />
As a warm-up I have ported my favorite xscreensaver, Substrate, to the web.<br />
You can try it out here:<br />
<br />
<a href="http://muth.org/Art/substrate.html"> http://muth.org/Art/substrate.html</a><br />
<br />
<br />
It should work on most browsers and systems including mobile devices.<br />
<br />Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-16364412595325145212013-07-16T21:30:00.001-04:002013-07-21T17:43:38.107-04:00Android For Absolute Beginners 2: The KeyboardThis is the second installment of my series on Android basics.
<p>
The first installment can be found at:
<a href="http://robertmuth.blogspot.com/2013/07/android-for-absolute-beginners-1-home.html">http://robertmuth.blogspot.com/2013/07/android-for-absolute-beginners-1-home.html</a>
</p>
This part discusses the Android keyboard.
<hr />
<div style="clear:both;"></div>
<h1>The Android Keyboard</h1>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0xOzGhTglASrDfk3e94CmrLQcs4kp3_9bdueyzFN_47_LmW_Gb_MTZycb-Jn8CFlIu8Mt_pnuw1gMqGd_XKPgjTvry74o5X_MAd6bTHD-TWn-KlHfJ0DhHTXtr0UdjYk-oA3yGLpwP7Uy/s1600/keyboard_l.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0xOzGhTglASrDfk3e94CmrLQcs4kp3_9bdueyzFN_47_LmW_Gb_MTZycb-Jn8CFlIu8Mt_pnuw1gMqGd_XKPgjTvry74o5X_MAd6bTHD-TWn-KlHfJ0DhHTXtr0UdjYk-oA3yGLpwP7Uy/s400/keyboard_l.png" /></a></div>
<p>
Tapping on a <b>text input</b> field will bring up the keyboard.
</p>
<p>
Usually, you will type a few characters and then hit the blue <b>enter key</b> (here labeled "Go")
to accept the input. This will also make the keyboard disappear.
</p>
<p>
You can also press the <b>back button</b>.
This will make the keyboard disappear <b>without</b> accepting the input, that means
the content of text input field will remain as it was before.
</p>
<p>
Note: In the picture we have turned the device from the usual <b>portrait mode</b> to <b>landscape mode</b>.
(You can switch modes by simply tilting the phone.)
This will make the keyboard keys bigger at the expense of showing less of the actual app.
If the keys are still too small for you, use a stylus to tap on the keys.
</p>
<div style="clear:both;"></div>
<h1>The Keyboard in Detail</h1>
<div class="separator" style="clear: both; text-align: right;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ8sgvhYX3LxynJtwvNj6Us5avuwdQvBNw500fgSJf_kAut_SIK1a26ndu7IMk02UzDed_48K4ydEriYB8tlzgPABf8EacaFHy6_brJPeho6cdG-A7PHsxgeBZe_1jU7CSFneJcZOUyjJc/s1600/keyboard_l.annnotated.png" imageanchor="1" style="clear: all; float: right; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ8sgvhYX3LxynJtwvNj6Us5avuwdQvBNw500fgSJf_kAut_SIK1a26ndu7IMk02UzDed_48K4ydEriYB8tlzgPABf8EacaFHy6_brJPeho6cdG-A7PHsxgeBZe_1jU7CSFneJcZOUyjJc/s400/keyboard_l.annnotated.png" /></a></div>
<dl>
<dt>Cursor</dt>
<dd>marks the place where the next keyboard character will be inserted</dd>
<dt>Clear</dt>
<dd>tapping here will clear all the text</dd>
<dt>Suggestions</dt>
<dd>Many apps will start showing suggestion after you type a few characters. Tapping on a suggestions
will accept it as input and remove the keyboard from the screen</dd>
<dt>Backspace</dt>
<dd>erases the last character</dd>
<dt>Enter</dt>
<dd>accepts the text entered so far as input and remove the keyboard from the screen</dd>
<dt>More Keys</dt>
<dd>make other keys visible, e.g. numbers, capital letters, etc.</dd>
</dl>
<div style="clear:both;"></div>
<h1>Different Flavors of Enter Keys</h1>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTQGf7weLXg_r7vJJymAst43KfZUibRIGPep1aEDU4G2vzUJvXdEB233xn9mC-u8pBBjD_m6emK6RSMtfVlipQvekCbAUdjXnAoi3kQzDUYpxOgYgYtQaMg0V0mafDW4jauiLQ6UZ6leMy/s1600/keyboard_enter_all.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTQGf7weLXg_r7vJJymAst43KfZUibRIGPep1aEDU4G2vzUJvXdEB233xn9mC-u8pBBjD_m6emK6RSMtfVlipQvekCbAUdjXnAoi3kQzDUYpxOgYgYtQaMg0V0mafDW4jauiLQ6UZ6leMy/s400/keyboard_enter_all.png" /></a></div>
<p>
Depending on the circumstances, the keyboard may look slightly different.
The picture shows the bottom row of 4 different incarnations of the Android keyboard.
The main difference lies with the <b>enter key</b> which varies in color and labeling.
</p>
<p>
If the <b>enter key</b> is blue, like in first three incarnations, the keyboard will disappear after pressing
the <b>enter key</b>. Usually, the corresponding text input field consists of just a single line.
</p>
<p>
If the text input field has several lines, the keyboard will look like the last incarnation.
Pressing the <b>enter key</b> will not make the keyboard disappear but force a line break
in the text input field.
</p>
<div style="clear:both;"></div>
<h1>Characters with Accents</h1>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOIeMtYGK8NaOmT7BOEKlZGUT_3lMK19q9sNvainPJGd3eb8-jw_w_3lJrEQD0CqRaMXMji004e1YeLX5OtwrdQCjp-K6-rIRSz-HChz6G5ix7BBZ-wecpb7iv38OWq5rJEObIjALw9Gwv/s1600/keyboard_l_dia.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOIeMtYGK8NaOmT7BOEKlZGUT_3lMK19q9sNvainPJGd3eb8-jw_w_3lJrEQD0CqRaMXMji004e1YeLX5OtwrdQCjp-K6-rIRSz-HChz6G5ix7BBZ-wecpb7iv38OWq5rJEObIjALw9Gwv/s400/keyboard_l_dia.png" /></a></div>
Suppose you want to type an <b>á</b> or an <b>ä</b>.
Simply tap the base character, <b>a</b> in this case, for a second or so.
A menu like the one shown in the picture will pop up.
Slide your finger to the desired character and let go.
<div style="clear:both;"></div>
<h1>Dictation: Voice Input</h1>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit8sYunqE0uIfabiupXMHBRzsp2FPcyQ_Fc-uMtkUnSjf2qaQaHCUF-GXaJbD5INS0vx_01I6twEQphojgCwg1lM30DxFxbMC7H3sylc3RGxzwajYCXezOhu6DH0WnG2ZrATxwG0ePdmKP/s1600/keyboard.micro.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit8sYunqE0uIfabiupXMHBRzsp2FPcyQ_Fc-uMtkUnSjf2qaQaHCUF-GXaJbD5INS0vx_01I6twEQphojgCwg1lM30DxFxbMC7H3sylc3RGxzwajYCXezOhu6DH0WnG2ZrATxwG0ePdmKP/s320/keyboard.micro.png" /></a></div>
Often you can sidestep entering text altogether:
Whenever Android shows you a microphone icon,
you can dictate rather than type.
Make sure you are in a reasonably quiet place. Think about what you want
to dictate then take a breath and press the microphone key.
When the device signals you speak, do so.
The voice recognition on Android is actually quite good, so give this a try.
Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-13759650899894497092013-07-14T14:23:00.000-04:002013-07-19T21:18:31.478-04:00Android For Absolute Beginners 1: The Home ScreenThis set of posts originated in afternoons spent with my mom trying to teach her the basics of a Nexus 7 tablet.
My mom had not used a computer in a decade and had no prior experience with smartphones or tablets.
The goal was to get her comfortable searching and browsing, reading and writing emails.
<br/>
The initial setup and home screen configuration of the tablet was assumed to be done by an "expert", aka me.
<br />
These notes are a reminder for her and whoever might find them useful.
<p>
Caveat: Android devices come in a bewildering variety of phones and tablets devices.
We focus on Nexus 7 running Android version 4.1 ("Jelly Bean").
So the information might not immediately apply to your device.
</p>
<hr />
<div style="clear:both;"></div>
<h1>The Home Screen</h1>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixruauvWo0oH3-SGR5Le0Zm5OnA9ozm-mpMVJUMy-wskXE8jviQtfP-DCEApGWhCzCEnshAaUl5h0Ir54JGpINccLGcSzP4OVW_5M2K_YZprkt-P1yz07fFSpWOeUfsqwBSY8XWHiVI9ri/s1600/home_all_small.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixruauvWo0oH3-SGR5Le0Zm5OnA9ozm-mpMVJUMy-wskXE8jviQtfP-DCEApGWhCzCEnshAaUl5h0Ir54JGpINccLGcSzP4OVW_5M2K_YZprkt-P1yz07fFSpWOeUfsqwBSY8XWHiVI9ri/s400/home_all_small.png" /></a></div>
<br />
The <b>home screen</b> is where you end up when you turn on the device.
The picture above shows the home screen for three different devices: A Galaxy Nexus phone, and Nexus 7 tablet, and a Galaxy s2 phone.
The home screen is organized in three different areas:
<ul>
<li> a very narrow row at the top with status information </li>
<li> the big area in the middle that shows the <b>icons</b> and <b>widgets</b></li>
<li> A small row at the bottom with several buttons that stay around pretty much all the time</li>
</ul>
We cover these areas in order of importance using the <b>home screen</b> at left as our example.
<div style="clear:both;"></div>
<h1>Bottom: Button Row</h1>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVhreoTEhm6XYIr5jGapFRFtg3GmA5u0-Qik6g82-gJMmlARAzmAGNf-d51nyQm5sDZEcaYke6emnZF41JAVE-LxKSmkc2jHGKf4ZJRENQnaf2IF5ij_DFRq097uw1_MADN42wrv3zeUn1/s1600/home_galaxys.3.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVhreoTEhm6XYIr5jGapFRFtg3GmA5u0-Qik6g82-gJMmlARAzmAGNf-d51nyQm5sDZEcaYke6emnZF41JAVE-LxKSmkc2jHGKf4ZJRENQnaf2IF5ij_DFRq097uw1_MADN42wrv3zeUn1/s320/home_galaxys.3.png" /></a></div>
Depending on the device or app that it is currently running there can
be any number of buttons here but only two of them really matter.
<br />
The <b>home button</b> is the most important one. It will always get you back to the <b>home screen</b> no matter where you are.
<br />
The <b>back button</b> is almost as important. It will get you back to the previous screen or remove any other thing that may have popped
up on the display. If you press the <b>back button</b> often enough it should get you all the way back to the <b>home screen</b> as well.
<br />
<div style="clear:both;"></div>
<h1>Top: Status Row</h1>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicdkLrD_GdV4jMJSkV9ulsNom-Zcj3fTKxVuxrTW97Y8CEiFunGQvwe4zegOOjmYdaVma4bW2FKjwApMZZXdHhJR4yo2yZw35uiNp6sDzMPylFs9JY8YWaT4zLo-NyLv6j3lqcpv5VKB7N/s1600/home_galaxys.1.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicdkLrD_GdV4jMJSkV9ulsNom-Zcj3fTKxVuxrTW97Y8CEiFunGQvwe4zegOOjmYdaVma4bW2FKjwApMZZXdHhJR4yo2yZw35uiNp6sDzMPylFs9JY8YWaT4zLo-NyLv6j3lqcpv5VKB7N/s320/home_galaxys.1.png" /></a></div>
The <b>status row</b> contains important information about your device.
<p>
The <b>notification area</b> on the left may be populated with tiny icons representing bits of information like "a new email has arrived".
In the beginning it is ok to ignore those.
</p>
On the right side are several indicators. The most common are:
<dl>
<dt>Wifi Signal</dt>
<dd>This applies primarily to tablets. If you do not have bars here you will not be able to use many of the features of the phone.</dd>
<dt>Phone Signal</dt>
<dd>This applies mostly to phones. If you have no <b>bars</b> here, you cannot make phone calls.</dd>
<dt>Battery Status</dt>
<dd>This gives you an idea of how much battery charge is still available.
A white flash-like symbol in the middle of the battery icon indicates that the device is being charged.
</dd>
<dt>Current time</dt>
<dd>Local time your area.</dd>
</dl>
Note: additional options, including one for clearing the <b>notification area</b> become visible when you swipe downward on the
<b>status row</b>.
<div style="clear:both;"></div>
<h1>Middle: Icon and Widget Area</h1>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIxYPMZR4C5tzyxBxS7XMCYYZGpzr8s1gXW3pZgI6hbx3ceH_e1HU_iT36HWZd9ruTqLbrqGEhb3MVKgo-bSl_kfSRixEBIgDYKpFxrNYmdmlw4jGHYK4Dx-ECs82wh2BUhuFsrzhUbajD/s1600/home_galaxys.app.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIxYPMZR4C5tzyxBxS7XMCYYZGpzr8s1gXW3pZgI6hbx3ceH_e1HU_iT36HWZd9ruTqLbrqGEhb3MVKgo-bSl_kfSRixEBIgDYKpFxrNYmdmlw4jGHYK4Dx-ECs82wh2BUhuFsrzhUbajD/s400/home_galaxys.app.png" /></a></div>
Apps are what make smart phones and tablets so versatile. They allow you to browse the web, compose email, etc..
<br />
The <b>icon and widget area</b> shows <b>icons</b> for some of the apps on the phone.
You can start ("launch") an App by tapping on its <b>icon</b>. This will usually lead to the display of a new screen hiding the home screen
underneath it. But you can always get back to the <b>home screen</b> by pressing the <b>home button</b>, or the <b>back button</b>.
<p>
<b>Widgets</b> are a special kind of app. They allow access to some or all of the functionality of an app without having to launch it first.
They typically employ much bigger icons.
</p>
<div style="clear:both;"></div>
<h1>Some not so Basic Stuff </h1>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiTfWOEkq51YuYA7nxVBADg-uChxe4-_r17MZ9efFYfYDDkbhxvM53TOcBT__AKHCVg2IwwgIRJVDreIcjdIhIWPv-gqV9m10wA-bLhuB_Dm_7Xz7DlErtiF_hG_twbH3y8saxxhVUeIBt/s1600/home_galaxys.more.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiTfWOEkq51YuYA7nxVBADg-uChxe4-_r17MZ9efFYfYDDkbhxvM53TOcBT__AKHCVg2IwwgIRJVDreIcjdIhIWPv-gqV9m10wA-bLhuB_Dm_7Xz7DlErtiF_hG_twbH3y8saxxhVUeIBt/s400/home_galaxys.more.png" /></a></div>
<p>
Over time is possible that you will accumulate more apps on your device than will fit
on the <b>home screen</b>. Two mechanisms exist to deal with this situation:
the <b>app browser</b> and <b>additional home screens</b>.
</p>
<p>
The <b>app browser</b> lets you browse and launch all the apps and widget which are installed on your phone.
</p>
<p>
<b>Additional home screens</b> can be found to the left and right of the main <b>home screen</b>, organized
in a row of homescreens.
Only one of them visible at a time and you can go to the neighboring ones by swiping left or right.
<br />
Remember: pressing the <b>home button</b> will always get you back to the <b>main home screen</b>.
</p>
Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-33278607091914512762013-02-14T08:49:00.003-05:002013-02-14T08:49:47.896-05:00MAME on the ARM powered Samsung Chromebook<a href="http://www.amazon.com/gp/product/B009LL9VDG/ref=as_li_qf_sp_asin_il?ie=UTF8&camp=1789&creative=9325&creativeASIN=B009LL9VDG&linkCode=as2&tag=appicenter-20">
<img border="0" src="http://4.bp.blogspot.com/z4Yw-Ld6aEUlGsehj5sCkM4nzw1y8wye0c6Q26UzPO9p1Y0Wjgk_Uw_Eolx3bPUUUyEn=w215" /> </a><br />
<a href="http://www.amazon.com/gp/product/B009LL9VDG/ref=as_li_qf_sp_asin_il?ie=UTF8&camp=1789&creative=9325&creativeASIN=B009LL9VDG&linkCode=as2&tag=appicenter-20"></a>Starting with Chrome version 25, the Samsung Chromebooks with ARM processors are supporting <a href="https://developers.google.com/native-client/">Native Client</a>. To take advantage of this new platform developers have to update their apps and include an ARM binary.
Not many have done that.<br />
To show the potential of the new platform I have added ARM support for my <a href="https://chrome.google.com/webstore/detail/xaos/oieknifjfpdliicehiaedkaiegbfiipk">XaoS</a>
and
<a href="https://chrome.google.com/webstore/detail/robby-roto-and-friends-vi/kcfbijoldkenmemnbbkjnpdhnijgahck">Mame</a> apps.<br />
Mame seems to be still a challenge for the machine - performance-wise, but is playable. <br />
<br />
To check your chrome version use this URL <a href="chrome://help/"> chrome://help</a><br />
and, if necessary, switch your Chromebook to the beta or dev channel to get a more recent<br />
version of Chrome.<br />
<br />Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-91173795828506482092012-11-18T01:19:00.000-05:002012-11-18T23:39:44.040-05:00Update of the Native Client MAME Port I finally got around to update the Native Client MAME port in the Chrome Webstore.<br />
The update features two new ROMs (Looping and Super Tank) which were generously<br />
made available by Reinhard Stompe.<br />
All ROMs can be conveniently selected from that start page.<br />
<br />
If you are using Chome -- and you should -- you can install MAME from this link:<br />
<br />
<a href="https://chrome.google.com/webstore/detail/kcfbijoldkenmemnbbkjnpdhnijgahck/"><b style="background-color: white;">MAME in the Chrome Webstore</b></a><br />
<br />
<h4>
Details:</h4>
<ul>
<li>The port is based on MAME version 0.147u2. </li>
<li>In order to keep its size reasonable and because of performance concerns many of the more recent CPUs together with the ROMs using them are not supported.</li>
<li>This still leaves the number of supported ROMs at over 17000.</li>
<li>Thanks to cleanup in the upstream code base the port was vastly simpler than the original one described <a href="https://developers.google.com/native-client/community/porting/MAME">here</a>. </li>
<li>Patches will be posted here shortly.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHrr0jL0Z4tkyoQp2LkiBkkR5IibF7qac9171c2rVFK064fIWDFfFoIuzU2e0hF37pBoBaUe9RC3iq1pJBKk-q4ZkAfTpfczRegzq8xNrly1vjRBA375SxqbMy1gEZSBYH3Js9ij6uY52O/s1600/looping.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHrr0jL0Z4tkyoQp2LkiBkkR5IibF7qac9171c2rVFK064fIWDFfFoIuzU2e0hF37pBoBaUe9RC3iq1pJBKk-q4ZkAfTpfczRegzq8xNrly1vjRBA375SxqbMy1gEZSBYH3Js9ij6uY52O/s1600/looping.png" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQBBnYYfhoF2VOTEZyGDiVaD_bu3zJ2LC2Erbs6pa3yXQoOsaU5pq42WBdzOJntT3P1omVVQB8OrAZawLlZ2RmqREp0vIEXTrdLhr3amUm7ghcdBcnSj4q1Xu5IwT2Aars-aLoqV2Yiym6/s1600/supertnk.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQBBnYYfhoF2VOTEZyGDiVaD_bu3zJ2LC2Erbs6pa3yXQoOsaU5pq42WBdzOJntT3P1omVVQB8OrAZawLlZ2RmqREp0vIEXTrdLhr3amUm7ghcdBcnSj4q1Xu5IwT2Aars-aLoqV2Yiym6/s1600/supertnk.png" /></a></div>
Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-21412601861911291002012-09-01T13:03:00.000-04:002012-09-01T13:04:00.970-04:00Moving my opensource projects to code.google.comI have begun the process of moving all my opensource projects to code.google.com.<br />
Since I am also taking the opportunity to clean up and update the projects, this will<br />
undoubtedly take a while.<br />
<br />
The first project to move over is Hocuspocus, a simple webserver for remote controlling<br />
Linux machine, which I run on most of my systems.<br />
<br />
<br />
The website lives here:<br />
<a href="http://muth.org/Robert/Hocuspocus/">http://muth.org/Robert/Hocuspocus/</a><br />
<br />
<br />
The code can found here:<br />
<a href="http://code.google.com/p/hocuspocus/">http://code.google.com/p/hocuspocus/</a><br />
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-14575782393068156652012-08-03T11:39:00.000-04:002014-04-19T01:01:00.922-04:00Better Bash Scripting in 15 Minutes<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4WS1liJgqTIeqd4xZGp5NWgVaQcOYrg-ExvFw2r6G4ASUe03UYQXJe08Q7qN6rVJFuYmAzaty5D5hGrEkC2zhKkzLf3wxkgDGaGJrz3zkeYzztmn9C4KVRl0bX7CBBYYf1G9JGxxPHvqJ/s1600/blank_computer_screen.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4WS1liJgqTIeqd4xZGp5NWgVaQcOYrg-ExvFw2r6G4ASUe03UYQXJe08Q7qN6rVJFuYmAzaty5D5hGrEkC2zhKkzLf3wxkgDGaGJrz3zkeYzztmn9C4KVRl0bX7CBBYYf1G9JGxxPHvqJ/s200/blank_computer_screen.png" height="125" width="200" /></a></div>
<br />
<span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;">The tips and tricks below originally appeared as one of Google's "T</span></span><span style="background-color: white; font-family: Arial, Helvetica, sans-serif;">esting on the Toilet" (TOTT) episodes. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This is a revised and augmented version.</span><br />
<br />
<br />
<br />
<h2>
</h2>
<h2>
Safer Scripting</h2>
<div>
<b id="internal-source-marker_0.37467313767410815" style="background-color: white; font-weight: normal;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">I start every bash script with the following prolog:</span></b><br />
<blockquote class="tr_bq">
<span style="background-color: white; font-family: 'Courier New', Courier, monospace;">#!/bin/bash</span><br />
<span style="background-color: white; font-family: 'Courier New', Courier, monospace;">set -o nounset</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">set -o errexit</span></blockquote>
<span style="font-family: Arial;"><span style="font-size: 15px; white-space: pre-wrap;">This will take care of two very common errors:</span></span><br />
<ol>
<li><span style="background-color: white; font-family: Arial; font-size: 15px; white-space: pre-wrap;">Referencing undefined variables (which default to "") </span></li>
<li><span style="background-color: white; font-family: Arial; font-size: 15px; white-space: pre-wrap;">Ignoring failing commands</span></li>
</ol>
<span style="background-color: white; font-family: Arial; font-size: 15px; white-space: pre-wrap;">The two settings also have shorthands (“-u” and “-e”) but the longer versions are more readable.</span><br />
<span style="font-family: Arial;"><span style="font-size: 15px; white-space: pre-wrap;"><br /></span></span><span style="background-color: white; font-family: Arial; font-size: 15px; white-space: pre-wrap;">If a failing command is to be tolerated use this idiom:</span><br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">if ! <possible failing command> ; then<br /> echo "failure ignored"<br /> fi</span></blockquote>
<div>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
</blockquote>
</blockquote>
<span style="background-color: white; font-family: Arial; font-size: 15px; white-space: pre-wrap;">Note that some Linux commands have options which as a side-effect suppress some failures, e.g.</span><br />
<span style="background-color: white; font-family: Arial; font-size: 15px; white-space: pre-wrap;">“</span><span style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 15px; white-space: pre-wrap;">mkdir -p</span><span style="background-color: white; font-family: Arial; font-size: 15px; white-space: pre-wrap;">” and “</span><span style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 15px; white-space: pre-wrap;">rm -f</span><span style="background-color: white; font-family: Arial; font-size: 15px; white-space: pre-wrap;">”.</span><br />
<span style="font-family: Arial;"><span style="font-size: 15px; white-space: pre-wrap;"><br /></span></span>
<span style="font-family: Arial;"><span style="font-size: 15px; white-space: pre-wrap;">Also note, that the “errexit” mode, while </span></span><span style="background-color: white; font-size: 15px; white-space: pre-wrap;"><span style="font-family: Arial;">a valuable first line of defense</span></span><span style="background-color: white; font-family: Arial; font-size: 15px; white-space: pre-wrap;">, does not catch all failures, i.e. under certain circumstances failing commands will go undetected.</span><br />
<span style="font-family: Arial;"><span style="font-size: 15px; white-space: pre-wrap;">(For more info, have a look at </span></span><a href="https://groups.google.com/forum/?fromgroups#!topic/gnu.bash.bug/-9ySnEo1WrQ" style="font-family: Arial; font-size: 15px; white-space: pre-wrap;">this thread</a>.)<br />
<br />
<i>A reader suggested the additional use of "set -o pipefail"</i><br />
<h2>
Functions</h2>
Bash lets you define functions which behave like other commands -- use them liberally; it will give your bash scripts a much needed boost in readability:<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">ExtractBashComments() {<br /> egrep "^#"<br />}<span style="background-color: white;"> </span></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">cat myscript.sh | ExtractBashComments | wc<span style="background-color: white;"> </span></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">comments=$(ExtractBashComments < myscript.sh)</span></blockquote>
<br />
Some more instructive examples:<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">SumLines() { # iterating over stdin - similar to awk <br /> local sum=0<br /> local line=””<br /> while read line ; do<br /> sum=$((${sum} + ${line}))<br /> done<br /> echo ${sum}<br />}</span><span style="background-color: white;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">SumLines < data_one_number_per_line.txt</span><span style="background-color: white;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">log() { # classic logger <br /> local prefix="[$(date +%Y/%m/%d\ %H:%M:%S)]: "<br /> echo "${prefix} $@" >&2<br />}</span><span style="background-color: white;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">log "INFO" "a message"</span></blockquote>
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span>
Try moving all bash code into functions leaving <span style="background-color: white;">only global variable/constant definitions and a call to “main” at the top-level.</span><br />
<h2>
</h2>
<h2>
Variable Annotations </h2>
Bash allows for a limited form of variable annotations. The most important ones are:<br />
<ul>
<li><span style="background-color: white;"><span style="font-family: 'Courier New', Courier, monospace;">local</span> (for local variables inside a function)</span></li>
<li><span style="background-color: white;"><span style="font-family: 'Courier New', Courier, monospace;">readonly</span> (for read-only variables)</span></li>
</ul>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"># a useful idiom: DEFAULT_VAL can be overwritten<br /># with an environment variable of the same name<br />readonly DEFAULT_VAL=${DEFAULT_VAL:-7}</span><span style="background-color: white;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">myfunc() {<br /> # initialize a local variable with the global default<br /> local some_var=${DEFAULT_VAL}<br /> ...<br />}</span></blockquote>
Note that it is possible to make a variable <span style="background-color: white;">read-only that wasn't before:</span><br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">x=5<br />x=6<br />readonly x<br />x=7 # failure</span></blockquote>
<br />
<span style="background-color: white;">Strive to annotate almost all variables in a bash script with either local or readonly.</span><br />
<span style="background-color: white;"><br /></span>
<span style="background-color: white;"></span><br />
<h2>
Favor <span style="font-family: 'Courier New', Courier, monospace;">$() </span>over backticks (<span style="font-family: 'Courier New', Courier, monospace;">`</span>)</h2>
Backticks are hard to read and in some fonts easily confused with single quotes.<br />
<span style="font-family: 'Courier New', Courier, monospace;">$()</span>also permits nesting without the quoting headaches.<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;"># both commands below print out: A-B-C-D<br />echo "A-`echo B-\`echo C-\\\`echo D\\\`\``"<br />echo "A-$(echo B-$(echo C-$(echo D)))"</span></blockquote>
<br />
<h2>
Favor <span style="font-family: 'Courier New', Courier, monospace;">[[]]</span> (double brackets) over <span style="font-family: 'Courier New', Courier, monospace;">[]</span> </h2>
<span style="font-family: 'Courier New', Courier, monospace;">[[]]</span> avoids problems like unexpected pathname expansion, offers some syntactical improvements,<br />
and adds new functionality:<br />
<br />
<b>Operator </b> <b> Meaning</b><br />
<span style="font-family: 'Courier New', Courier, monospace;">|| </span> logical or (double brackets only)<br />
<span style="font-family: 'Courier New', Courier, monospace;">&& </span> logical and (double brackets only)<br />
<span style="font-family: 'Courier New', Courier, monospace;">< </span> string comparison (no escaping necessary within double brackets)<br />
<span style="font-family: 'Courier New', Courier, monospace;">-lt </span> numerical comparison<br />
<span style="font-family: 'Courier New', Courier, monospace;">= </span> string matching with globbing<br />
<span style="font-family: 'Courier New', Courier, monospace;">== </span> string matching with globbing (double brackets only, see below)<br />
<span style="font-family: 'Courier New', Courier, monospace;">=~ </span> string matching with regular expressions (double brackets only , see below)<br />
<span style="font-family: 'Courier New', Courier, monospace;">-n </span> string is non-empty<span style="background-color: white;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;">-z </span> string is empty<br />
<span style="font-family: 'Courier New', Courier, monospace;">-eq</span> numerical equality<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">-ne</span> numerical inequality<br />
<br />
<b>single bracket</b><br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">[ "${name}" \> "a" -o ${name} \< "m" ]</span></blockquote>
<br />
<b>double brackets</b><br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"> [[ "${name}" > "a" && "${name}" < "m" ]]</span></blockquote>
<br />
<h2>
Regular Expressions/Globbing</h2>
<br />
These new capabilities within double brackets are best illustrated via examples:<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">t="abc123"<br />[[ "$t" == abc* ]] # true (globbing)<br />[[ "$t" == "abc*" ]] # false (literal matching)<br />[[ "$t" =~ [abc]+[123]+ ]] # true (regular expression)<br />[[ "$t" =~ "abc*" ]] # false (literal matching)</span></blockquote>
<span style="background-color: white;">Note, that starting with bash version 3.2 the regular or globbing expression</span><br />
must not be quoted. If your expression contains whitespace you can store it in a variable:<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">r="a b+"<br />[[ "a bbb" =~ $r ]] # true<br /> </span></blockquote>
</div>
<div>
Globbing based string matching is also available via the case statement:<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">case $t in<br />abc*) <i> <action></i> ;;<br />esac</span></blockquote>
<br />
<h2>
String Manipulation</h2>
Bash has a number of (underappreciated) ways to manipulate strings.<br />
<br />
<b>Basics</b><br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">f="path1/path2/file.ext" </span> </blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">len="${#f}" # = 20 (string length)</span> </blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;"># slicing: ${<var>:<start>} or ${<var>:<start>:<length>}<br />slice1="${f:6}" # = "path2/file.ext"<br />slice2="${f:6:5}" # = "path2"<br />slice3="${f: -8}" # = "file.ext"(Note: space before "-")<br />pos=6<br />len=5<br />slice4="${f:${pos}:${len}}" # = "path2"</span></blockquote>
<br />
<span style="background-color: white;"><b>Substitution (with globbing)</b></span><br />
<blockquote class="tr_bq">
<span style="background-color: white;"><span style="font-family: 'Courier New', Courier, monospace;">f="path1/path2/file.ext" </span></span><span style="background-color: white;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">single_subst="${f/path?/x}" # = "x/path2/file.ext"<br />global_subst="${f//path?/x}" # = "x/x/file.ext"</span><span style="background-color: white;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"># string splitting<br />readonly DIR_SEP="/"<br />array=(${f//${DIR_SEP}/ })<br />second_dir="${array[1]}" # = path2</span></blockquote>
</div>
<div>
<br /></div>
<div>
<b>Deletion at beginning/end (with globbing)</b></div>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">f="path1/path2/file.ext"</span><span style="background-color: white;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"><span style="background-color: white;"># deletion at string beginning </span><span style="background-color: white;">extension="${f#*.}" # = "ext"</span></span><span style="background-color: white;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"># greedy deletion at string beginning<br />filename="${f##*/}" # = "file.ext"</span><span style="background-color: white;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"># deletion at string end<br />dirname="${f%/*}" # = "path1/path2"</span><span style="background-color: white;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"># greedy deletion at end<br />root="${f%%/*}" # = "path1"</span></blockquote>
<div>
<br />
<h2>
Avoiding Temporary Files</h2>
Some commands expect filenames as parameters so straightforward pipelining does not work.<br />
This is where <span style="font-family: 'Courier New', Courier, monospace;"><()</span> operator comes in handy as it takes a command and transforms it into something<br />
which can be used as a filename:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"># download and diff two webpages<br />diff <(wget -O - url1) <(wget -O - url2)</span></blockquote>
Also useful are "here documents" which allow arbitrary multi-line string to be passed<br />
in on stdin. The two occurrences of 'MARKER' brackets the document.<br />
'MARKER' can be any text.<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"># DELIMITER is an arbitrary string<br />command << MARKER<br />...<br />${var}<br />$(cmd)<br />...<br />MARKER</span></blockquote>
<br />
If parameter substitution is undesirable simply put quotes around the first occurrence of MARKER:<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">command << 'MARKER'<br />...<br />no substitution is happening here.<br /> $ (dollar sign) is passed through verbatim.<br /> ...<br />MARKER</span></blockquote>
<br />
<h2>
Built-In Variables</h2>
<h4>
For reference</h4>
$0 name of the script<br />
$<i>n</i> positional parameters to script/function<br />
$$ <span class="Apple-tab-span" style="white-space: pre;"> </span>PID of the script<br />
$!<span class="Apple-tab-span" style="white-space: pre;"> </span>PID of the last command executed (and run in the background)<br />
$?<span class="Apple-tab-span" style="white-space: pre;"> </span>exit status of the last command (${PIPESTATUS} for pipelined commands)<br />
$#<span class="Apple-tab-span" style="white-space: pre;"> </span>number of parameters to script/function<br />
$@ all parameters to script/function (sees arguments as separate word)<br />
$* all parameters to script/function (sees arguments as single word)<br />
<h4>
Note</h4>
$* is <b>rarely</b> the right choice.<br />
$@ handles empty parameter list and white-space within parameters correctly<br />
$@ should usually be quoted like so "$@"<br />
<br />
<h2>
Debugging</h2>
To perform a syntax check/dry run of your bash script run:<br />
<br />
bash -n myscript.sh<br />
<br />
To produce a trace of every command executed run:<br />
<br />
bash -v myscripts.sh<br />
<br />
To produce a trace of the expanded command use:<br />
<br />
bash -x myscript.sh<br />
<br />
-v and -x can also be made permanent by adding<br />
set -o verbose and set -o xtrace to the script prolog.<br />
This might be useful if the script is run on a remote machine, e.g.<br />
a build-bot and you are logging the output for remote inspection.<br />
<br />
<h2>
<span style="background-color: white;">Signs you should not be using a bash script</span></h2>
<ul>
<li><span style="background-color: white;">your script is longer than a few hundred lines of code</span></li>
<li><span style="background-color: white;">you need data structures beyond simple arrays</span></li>
<li><span style="background-color: white;">you have a hard time working around quoting issues</span></li>
<li><span style="background-color: white;">you do a lot of string manipulation</span></li>
<li><span style="background-color: white;">you do not have much need for invoking other programs or pipe-lining them</span></li>
<li><span style="background-color: white;">you worry about performance</span></li>
</ul>
<div>
Instead consider scripting languages like Python or Ruby.<br />
<br /></div>
<h2>
References</h2>
<ul>
<li>Advanced Bash-Scripting Guide: <a href="http://tldp.org/LDP/abs/html/" style="background-color: white;">http://tldp.org/LDP/abs/html/</a></li>
<li><a href="http://www.gnu.org/software/bash/manual/bashref.html">Bash Reference Manual</a></li>
</ul>
<div>
<span style="font-size: x-small;"><br /></span></div>
<div>
<span style="font-size: x-small;">Thanks to Peter Brinkmann and Kim Hazelwood for their feedback on drafts of this post.</span></div>
<br />
<br />
<br />
<br />
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0tag:blogger.com,1999:blog-2034126167268952338.post-1894772384988205862012-07-31T10:12:00.003-04:002012-11-18T01:21:52.706-05:00XaoS Port to Native Client<br />
<div style="clear: both;">
</div>
<div style="float: left; margin-bottom: 1em; margin-right: 1em;">
<img height="125" src="https://lh5.googleusercontent.com/FnR7iCrP7qIGbBWI3NpMxtuukzYCz0TKvdWg8xxLlpQtx_EZGJcXhLA3Qf5DQjZ7CN5-LjRiBw=s640-h400-e365" width="200" /></div>
A proof-of-concept port of XaoS, a real-time fractal zoomer, to Native Client is now available in the <a href="https://chrome.google.com/webstore/detail/oieknifjfpdliicehiaedkaiegbfiipk">Chrome Web Store</a><span style="background-color: white;">. </span><span style="background-color: white;">The (slightly dated) case-study describing the details of the port can be found </span><span style="background-color: white;"><a href="https://developers.google.com/native-client/community/porting/xaos">here</a>, but in case of doubt it is best to consult the actual source code and patches in the</span><span style="background-color: white;"> </span><span style="background-color: white;"><a href="http://code.google.com/p/naclports/source/browse/trunk/src/examples/graphics/xaos/">naclports repository</a>. The port should compile fine with recent versions of both the gcc based "NaCl" and the clang based "PNaCl" toolchain.</span><br />
<div style="clear: both;">
</div>
<hr />
<div style="float: right; margin-bottom: 1em; margin-left: 1em;">
<img height="125" src="https://lh4.googleusercontent.com/pIuB4tcs_6jD18i0r6bPttdDtYAEee6WZU3_y-HPKFWxOdiLWCKO4QJHPrMfuYLymHzdD4BB_w=s640-h400-e365" width="200" /></div>
<br />
Work is underway for an update to Robby Roto and the underlying Mame engine which can likewise be found in the <a href="https://chrome.google.com/webstore/detail/kcfbijoldkenmemnbbkjnpdhnijgahck">Chrome Web Store</a>. Stay tuned!Anonymoushttp://www.blogger.com/profile/11666926524494407622noreply@blogger.com0