tag:blogger.com,1999:blog-205895652024-03-12T20:06:11.234-05:00CroftSoft UpdateUpdate announcements from <a href="https://www.CroftSoft.com/">CroftSoft Inc</a>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.comBlogger94125tag:blogger.com,1999:blog-20589565.post-71676915613982294202024-03-08T19:17:00.002-06:002024-03-08T19:21:50.863-06:00Programming Rust<p style="text-align: justify;">It took me a few months but I finally finished reading the O'Reilly book <a href="https://www.oreilly.com/library/view/programming-rust-2nd/9781492052586/" target="_blank">Programming Rust</a> Second Edition (2e) authored by Blandy, Orendorff, and Tindall. I see now that there is also a "Revised 2nd Edition" which "Covers Rust 2021 Edition" meaning <a href="https://doc.rust-lang.org/edition-guide/rust-2021/index.html" target="_blank">Rust 1.56</a> or later. The edition I read "Covers Rust 1.50" so it is probably not much different.<br /></p><div style="text-align: justify;">I started recommending this book even before I finished reading it. If you could only read one Rust book, this would be it. Since you can read more than one Rust book, I would start with <a href="https://croftsoft.blogspot.com/2022/07/the-rust-book.html" target="_blank">The Rust Book</a> and then read "Programming Rust" sometime before you pick up <a href="https://croftsoft.blogspot.com/2023/06/beginning-rust.html" target="_blank">Rust for Rustaceans</a>.</div><p style="text-align: justify;">The cover subtitle is "Fast, Safe Systems Development" and the book does appear to be written for those already familiar with systems programming. I was grateful to the authors that some of the more advanced concepts expressed in their example code included diagrams to accompany the in-depth explanations. This might be the intermediate-level Rust book that you were looking for.</p><p style="text-align: justify;">This 700+ page book is big but O'Reilly has published
bigger. The Fourth Edition of O'Reilly's "Java in a Nutshell" was
almost one thousand pages. In a <a href="https://www.croftsoft.com/library/books/java/" target="_blank">review</a> that I wrote many years ago, I
joked that "over the years this 'in a nutshell' book has expanded to
fill the size of a coconut".</p><p style="text-align: justify;">The
physical bulk of "Programming Rust" is such that it can be less
comfortable to handle while reading. For the next edition, my advice to
the authors is that they split the book into two volumes when they add
content. I can see that the authors have already arranged the chapters
such that the more esoteric material comes later which could work well
for a second volume.</p><p style="text-align: justify;">My next read might be the recently published PacktPub book <a href="https://www.packtpub.com/product/asynchronous-programming-in-rust/9781805128137" target="_blank">Asynchronous Programming in Rust</a> by Carl Fredrik Samson. The quality of PacktPub books can be hit-or-miss but this looks like a good one. I am also eagerly anticipating a wave of new Rust books, hopefully including a Third Edition of "Programming Rust", when the <a href="https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html" target="_blank">2024 Edition</a> of the Rust programming language is released later this year.</p><p style="text-align: justify;"> </p><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="BLOG_video_class" height="266" src="https://www.youtube.com/embed/xVYSvkogoUM" width="320" youtube-src-id="xVYSvkogoUM"></iframe></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-52787105882777917272024-01-10T19:40:00.004-06:002024-01-10T19:43:42.454-06:00Advent of Spin 2023<p style="text-align: justify;">Recently I participated in the <a href="https://github.com/fermyon/advent-of-spin" target="_blank">Advent of Spin 2023</a>, an annual holiday-themed coding challenge hosted by <a href="https://www.fermyon.com/" target="_blank">Fermyon</a>. I wrote <a href="https://www.croftsoft.com/people/david/research/rust-wasm/" target="_blank">Rust code</a>, compiled it to WebAssembly (Wasm), and then deployed the code as Function-as-a-Service (FaaS) serverless components running in the Fermyon Cloud. The source code is available from my GitHub repository <a href="https://github.com/david-wallace-croft/advent-of-spin" target="_blank">advent-of-spin</a>.<br /></p><p style="text-align: justify;">Yesterday I presented a <a href="https://www.croftsoft.com/people/david/research/rust-wasm/drum-slides-2024-01-09-b.pdf" target="_blank">slideshow</a> to the <a href="http://dallasrust.org" target="_blank">Dallas Rust User Meetup</a> (DRUM) in which I described my solutions to the coding challenges. This was in preparation for my being the guest speaker today on the YouTube show <a href="https://www.youtube.com/live/-m3ZZrBgtRw?si=zFJT--yuznF5L_pp" target="_blank">Fermyon Cloud Office Hours</a>. My thanks to the DRUM Members (DRUMMers) for their attention and feedback and my thanks to the employees of Fermyon for running this event.</p><div> </div><div class="separator" style="clear: both; text-align: center;"><a href="https://commons.wikimedia.org/wiki/File:Santa_Claus_and_Little_Bo_Peep_Met_DP884631.jpg" target="_blank"><img border="0" data-original-height="599" data-original-width="512" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2qimNNe6sWkQKZya_SX6mz7ZKuPNCH6TM_MoYT_D87iPV8E5UNbQzv9xp5mN71Ba-ZhRsWhCX-DyitljHRs7-naqNbIXgvFc3EEl8nhg3bGFyOJwzZfeqtSWOasIeBvTefAsOB8luxDQ_ncqpBKZUoZo07Io8RTxDZ6OBaG6Kvzcdgzq1uUSNSw/s320/santa-claus.jpg" width="274" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-74908713280881453472023-12-01T16:11:00.013-06:002023-12-01T16:37:00.366-06:00Rust in the Cloud<p style="text-align: justify;">For
the frontend, I have had some <a href="https://croftsoft.blogspot.com/2023/10/dioxus-prototype.html" target="_blank">good success</a> recently using the
Rust-based user interface framework <a href="https://dioxuslabs.com/" target="_blank">Dioxus</a> to create web applications.
Now I am exploring using Rust on the backend with serverless cloud
technologies such as <a href="https://www.fermyon.com/spin" target="_blank">Fermyon Spin</a> and <a href="https://www.cargo-lambda.info/" target="_blank">Cargo-Lambda</a>. You can check out
what I have so far in my new GitHub repositories <a href="https://github.com/david-wallace-croft/spin-prototype" target="_blank">spin-prototype</a> and <a href="https://github.com/david-wallace-croft/cargo-lambda-prototype" target="_blank">cargo-lambda-prototype</a>.</p><p style="text-align: justify;">Yesterday when I tuned in to watch the livestream of the Amazon Web Services (AWS) re:Invent 2023 conference keynote by the Chief Technology Officer (CTO) of Amazon.com Dr. Werner Vogels, I suspected I might hear something about Rust because the AWS Software Development Kit (SDK) for Rust had just transitioned from Developer Preview to <a href="https://aws.amazon.com/blogs/developer/announcing-general-availability-of-the-aws-sdk-for-rust/" target="_blank">General Availability</a> a couple of days before. To my delight, Dr. Vogels made the case for switching from Java to Rust in the cloud for reasons of cost and sustainability. You can watch his presentation on this topic at the <a href="https://youtu.be/UTRBVPvzt9w?si=LJP5Iw6ohyB5bDfD&t=3597" target="_blank">one hour mark</a> in the YouTube video recording.</p><p style="text-align: justify;"><br /></p><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="BLOG_video_class" height="266" src="https://www.youtube.com/embed/UTRBVPvzt9w" width="320" youtube-src-id="UTRBVPvzt9w"></iframe></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-26916611625864376912023-10-20T08:27:00.000-05:002023-10-20T08:27:06.935-05:00Dioxus Prototype<p style="text-align: justify;">Previously I made web application prototypes using the Rust-based front-end frameworks <a href="https://croftsoft.blogspot.com/2022/08/sycamore-prototype.html" target="_blank">Sycamore</a> and <a href="https://croftsoft.blogspot.com/2022/07/rust-websockets-and-yew.html" target="_blank">Yew</a>. With the recent release of <a href="https://dioxuslabs.com/" target="_blank">Dioxus</a> version 0.4, I updated my <a href="https://github.com/david-wallace-croft/dioxus-prototype" target="_blank">Dioxus Prototype</a>. It demonstrates capabilities such as <a href="https://www.persentia.com/animation" target="_blank">animation</a>, <a href="https://www.persentia.com/retirement" target="_blank">form inputs</a>, and <a href="https://croftsoft.blogspot.com/2023/09/rust-dioxus-project-setup.html" target="_blank">static prerendering</a>.<br /><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://www.persentia.com/" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="681" data-original-width="598" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsCe5rlV_ox50PbwavKwAA2R5rirJza2KbfDePBemfHLy0Ymw3Vzk3zivKO69faE6g85SR32eYwBW4hxddQ1chtUeh18MFMI2L2SsAwwndMoln_CbCaBJl6Zhu5ZbNVKnHWHMY_KgIOoXsc0fcqHqpN9Uc0hp207hVgPz0R6cHcVbrfbED13t3HA/s320/dioxus-prototype-2023-10-20-a.png" width="281" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-5427022157277099882023-09-23T17:58:00.005-05:002023-09-23T18:03:19.126-05:00Rust-Dioxus Project Setup<p style="text-align: justify;">Previously I used Angular to make Single Page Application (SPA) websites in the TypeScript programming language. I then used the Angular tool <a href="https://scully.io/" target="_blank">Scully</a> to statically prerender the SPA webpages for Search Engine Optimization (SEO) and to be able to distribute the website code from a Content Delivery Network (CDN) instead of a web server. When I switched over to the Rust programming language <a href="https://croftsoft.blogspot.com/2022/07/rust-and-webassembly.html" target="_blank">last year</a>, I needed to learn new ways of doing things.</p><p style="text-align: justify;">After a lengthy quest in which I explored a number of nascent <a href="https://croftsoft.blogspot.com/2022/08/sycamore-prototype.html" target="_blank">Rust-based SPA libraries</a>, I have finally figured out how to make this work which I have documented with step-by-step instructions in my new tutorial <a href="https://www.croftsoft.com/library/tutorials/rust-dioxus-project-setup/" target="_blank">Rust-Dioxus Project Setup</a>. A few months ago I became the Organizer of the <a href="https://www.meetup.com/dallasrust/" target="_blank">Dallas Rust User Meetup</a> (DRUM) so I have created a website for that group that provides an <a href="https://dallasrust.github.io/colophon" target="_blank">online example</a> of the techniques described in the tutorial. I will be updating the tutorial over the next few months as my understanding of <a href="https://dioxuslabs.com/" target="_blank">Dioxus</a> improves in the process of converting my old websites.</p><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://www.croftsoft.com/library/tutorials/rust-dioxus-project-setup/" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="270" data-original-width="377" height="229" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqSBaiEbQQbOaEjxdm6ifzVxtbp_XC3MDzcXfE8z6f_gKYbtyZdyGq2lbB5jrO0-OZlmR99XPihqLP4xRfXKzpjWx5yvLz0lVv-3J6OYxlz31ZChyMStymgArAEouZUErOY2Kx0tuPLtLQGTKaogxuPDA1Vb2i_blXRjwRXEJfYnP3AVxA1Rlx0Q/s320/rust-dioxus-project-setup-2023-09-23-a.png" width="320" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-84762429000343394482023-08-28T21:33:00.003-05:002023-08-28T21:33:25.960-05:00Rust Podcast Duos<p>I updated my list of <a href="https://www.croftsoft.com/library/links/#rust-podcasts" target="_blank">Rust Podcasts</a> with two new entries:<br /></p><ul style="text-align: left;"><li><a href="https://feeds.transistor.fm/the-rust-workshop-podcast" target="_blank">Rust Workshop</a><br /></li><li><a href="https://wayofthecrab.com/" target="_blank">Way of the Crab</a></li></ul><p>I have listened to all eleven episodes so far of "Way of the Crab" and just started "Rust Workshop". Both of these podcasts feature a co-host duo but each podcast has its own distinct personality.</p><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://commons.wikimedia.org/wiki/File:Two_Crabs_MET_DP877032.jpg" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="240" data-original-width="230" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheW3_BKAQdL0-Be3o-ekSWHErHFGNOS1m4MpaMWgx_Fl8k4HYUpm9m29W9BzV7FQk5uV86ptDhQ5qPNeCogir13xoyAuPMGWlbDExTX5paoZsEcMAtSrBCVqbOsGmzX4fvlP1PaEd260P_t2NP29y0aR__BWRZbavF8jZB_qdggocuJ6naFHgLiw/s1600/230px-Two_Crabs_MET_DP877032.jpg" width="230" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-25251849316582239912023-07-23T14:18:00.003-05:002023-08-28T21:38:47.926-05:00Rust Mars<p style="text-align: justify;">I am currently working on converting to the Rust programming language yet another Java applet that I originally wrote a couple of decades ago. <a href="https://www.gamespawn.com/arcade/mars/" target="_blank">Mars</a> is a tank combat game which provides a demonstration of the use of my <a href="https://docs.rs/com-croftsoft-core/0.14.0/com_croftsoft_core/ai/astar/index.html" target="_blank">Rust-based implementation</a> of the A* algorithm. Although you cannot control one of the tanks yet, you can toggle on options to visualize how each tank is using the A* algorithm for pathfinding.<br /></p><p style="text-align: justify;">I was struggling with a memory leak in Mars until a member of the <a href="https://www.meetup.com/DallasRust/" target="_blank">Dallas Rust Meetup</a> mentioned that the wee_alloc dependency that I was using for memory allocation with WebAssembly (Wasm) was <a href="https://github.com/rustwasm/wee_alloc/issues/106" target="_blank">known to have this issue</a>. I removed wee_alloc and the problem immediately disappeared. I have since updated my <a href="https://www.croftsoft.com/library/tutorials/rust-webpack-project-setup/" target="_blank">Rust-webpack Project Setup</a> tutorial to no longer include wee_alloc in the setup instructions.</p><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://www.gamespawn.com/arcade/mars/" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img alt="" data-original-height="670" data-original-width="639" height="400" src="https://blogger.googleusercontent.com/img/a/AVvXsEg1FEm5fYjs34swfmX-PKZU90EUKHguuUIMiqHakMMnvVAWw55M3b-IOE5S2EK4WWCzlZztSAW6lR1_-2HA4nRM4L_swHEsUhVtDhe3Tr5_Gcsh0lf75I3XZFemANeWfmq6lo8xR_MkQSFLY-CymWjnfg_zaSUR6UCI82mn0UyrmafBDVbZZu8nfw=w381-h400" width="381" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-13605229445067857462023-06-12T21:14:00.002-05:002023-06-12T21:14:55.790-05:00Beginning Rust<p style="text-align: justify;">Tonight I finished reading <a href="https://link.springer.com/book/10.1007/978-1-4842-7208-4" target="_blank">Beginning Rust: Get Started with Rust 2021 Edition (2e)</a> by Carlo Milanesi. I found some detailed explanations for difficult concepts in this book
that I had not come across elsewhere including <a href="https://croftsoft.blogspot.com/2022/07/the-rust-book.html" target="_blank">The Rust Book</a>. I also appreciated that the book teaches the formal terminology for the various language features. </p><p style="text-align: justify;">I started reading "Beginning Rust" in parallel with another Rust book for beginners by a different author. Whereas the other book teaches Rust to the reader by guiding them through example applications, this book focuses strictly on the language as demonstrated with code snippets. I think the latter approach permitted the author of "Beginning Rust" to do a better job of putting the topics in prerequisite order.</p><p style="text-align: justify;">Before "Beginning Rust", I also finished reading <a href="https://nostarch.com/rust-rustaceans" target="_blank">Rust for Rustaceans</a> but I will have to read that one again in a year or two before I can review it properly as it was too advanced for me. I think "Beginning Rust" is a better immediate follow-on to "The Rust Book". I might look at <a href="https://marabos.nl/atomics/" target="_blank">Rust Atomics and Locks</a> by Mara Bos next.<br /><br /></p><p style="text-align: justify;"></p><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="BLOG_video_class" height="266" src="https://www.youtube.com/embed/T4E8LSCFHu8" width="320" youtube-src-id="T4E8LSCFHu8"></iframe></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-43394885286401550152023-01-14T08:54:00.001-06:002023-01-14T08:54:25.533-06:00Rust Life<p style="text-align: justify;">I implemented <a href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life" target="_blank">Conway's Game of Life</a> in the Rust programming language and compiled it to WebAssembly (Wasm) so that it <a href="https://www.gamespawn.com/arcade/life/" target="_blank">runs in a webpage</a>. I initialized the project directory using the steps from <a href="https://croftsoft.blogspot.com/2022/11/using-rust-webpack-template.html" target="_blank">Rust-webpack Project Setup</a> checklist and re-used <a href="https://github.com/david-wallace-croft/com-croftsoft-app-life" target="_blank">code</a> from my animated interactive <a href="https://croftsoft.blogspot.com/2022/12/rust-evolve.html" target="_blank">Evolve</a> simulation.</p><br><div class="separator" style="clear: both; text-align: center;"><a href="https://www.gamespawn.com/arcade/life/" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="667" data-original-width="639" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjY8Zkx-rNvxB8gTmfo_Iyu6vtUnYYaOY-YRwRIlG06_pvTa0a7rOmGwWjsbsEs8Uirw1iA0s_xt7KcfVRZSySf8S_YXl2HixjJv7Jz8GOBzf_c1xnWurPj8x5XumIKFA2XoqHLcVLXSBpfBg1rVcs1WGpaYRYfthmUqxfkn63G9SGhjzvCpqI/s320/croftsoft-life-v0.2.0-2023-01-14-a.png" width="307" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-90044774606039535182023-01-02T22:39:00.009-06:002023-01-02T22:43:37.512-06:00Rust-webpack Project Setup<p style="text-align: justify;">As part of capturing my lessons learned from converting <a href="https://croftsoft.blogspot.com/2022/12/rust-evolve.html" target="_blank">CroftSoft Evolve</a> from a Java applet to a Rust-WebAssembly application, I started writing a <a href="https://www.croftsoft.com/library/tutorials/rust-webpack-project-setup/" target="_blank">Rust-webpack Project Setup</a> tutorial checklist. There is enough there now to get the "Hello, World!" example code running that I created for my now obsolete <a href="https://croftsoft.blogspot.com/2022/11/using-rust-webpack-template.html" target="_blank">rust-webpack-template</a> tutorial.</p>
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://www.croftsoft.com/library/tutorials/rust-webpack-project-setup/" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="151" data-original-width="203" height="151" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHwOhX70f060Of58nFnx0qVVRL12T92-MJ3-coQne4RIvT1qL00XihY_xGvwZr2KxzWhvAgB2FDUxsqBBtoJIrYiQheQesmEZul2RlfE3V-Yi_TY6x3KdntjWmyKZjfo7E99WTLjeTLRqiQ5nRHwZnW_Y2ZcbtIBginsH8lCDap5LmHDXN3ag/s1600/starter-code.png" width="203" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-86640820241754260102022-12-21T22:21:00.005-06:002022-12-21T22:25:31.771-06:00Rust Evolve<p style="text-align: justify;">Two decades ago, I wrote the book <a href="https://www.croftsoft.com/library/books/ajgp/" target="_blank">Advanced Java Game Programming</a> which taught readers how to make animated 2D games that would run in a webpage. Now I am learning how to do that using <a href="https://www.croftsoft.com/people/david/research/rust-wasm/" target="_blank">Rust and WebAssembly</a>. <a href="https://www.gamespawn.com/arcade/evolve/" target="_blank">Evolve</a> is an animated interactive evolutionary algorithm simulation that you can play with that I recently converted from Java to Rust. The <a href="https://www.croftsoft.com/library/code/" target="_blank">code</a> is available from my <a href="https://github.com/david-wallace-croft/com-croftsoft-app-evolve" target="_blank">open source repository</a>.</p><br/><div class="separator" style="clear: both; text-align: center;"><a href="https://www.gamespawn.com/arcade/evolve/" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="638" data-original-width="609" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiJjIztes_ZVb8pNoYbxfD6hdi0WLBjbYeRn204huvQktsDehajdgyZqKNWhlPvsaOfVX_wuj_uIo8J0vHjPw7CRiaodMTYrgSiNKJDif4O9x1mQ1fYeEt5zd59jDWZ9tgz4hAmS9CtMJr8yp2oiHWhFtcTxl6UaUuRloWK38yLTR1Svr921g/s320/evolve-v0.3.0-2022-12-21-a.png" width="305" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-78939727866310470462022-11-24T19:00:00.001-06:002022-11-24T19:01:00.753-06:00Using the rust-webpack-template<p style="text-align: justify;"><a href="https://www.croftsoft.com/library/tutorials/rust-webpack-template/" target="_blank">Using the rust-webpack-template</a> is a checklist that I made for setting up projects that use <a href="https://croftsoft.blogspot.com/2022/07/rust-and-webassembly.html" target="_blank">Rust and WebAssembly</a> instead of JavaScript to dynamically create webpage content. Since <a href="https://github.com/rustwasm/rust-webpack-template" target="_blank">rust-webpack-template</a> has not been updated for a few years, the checklist includes steps for dealing with outdated dependencies. It also includes starter code and an extensive list of related links.<br /></p><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://www.croftsoft.com/library/tutorials/rust-webpack-template/" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="151" data-original-width="203" height="151" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjX7I0v2O3A27UynGo44X02c6mlOvN8LKJX-wpgzcSQSv6EqbKJOTxbdjfq6_6LVEoLW09D-Gplgj4aPQWJJGF1ywwuYI0wStbfpJxPdvYbcgBjwiw23zckdIit_02vFAEYBX6wtQ19X3cUOYuPyzONcXf00CUvS0Fmc4Hmt3AlK1eUyKq42J8/s1600/starter-code.png" width="203" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-32607180182064709902022-10-03T08:00:00.011-05:002022-10-03T19:24:36.114-05:00Into ZAMs<p style="text-align: justify;">Previously I wrote about using <a href="http://croftsoft.blogspot.com/2022/08/zero-arguments-methods.html" target="_blank">Zero Arguments Methods</a> (ZAMs) as a work-around for the Rust programming language not yet supporting <a href="https://internals.rust-lang.org/t/pre-rfc-named-arguments/16413" target="_blank">named arguments</a>. Here I show how an <a href="https://doc.rust-lang.org/rust-by-example/conversion/from_into.html" target="_blank">Into trait</a> implementation can be used as a ZAM. I start from a conventional unnamed arguments function that I gradually convert into an Into ZAM.<br /></p>
<p style="text-align: justify;">Start with an output structure for your calculation:</p>
<code><pre>pub struct RotationMatrix {
pub rows: [[f64; 3]; 3],
}</pre></code>
<p style="text-align: justify;">
Make an associated function that takes in a number of unnamed arguments, performs the calculations, and then returns the result as the output structure.
</p>
<pre><code>let rotation_matrix: RotationMatrix
= RotationMatrix::from_degrees(-45.0, 90.0, 135.0);</code></pre>
<p style="text-align: justify;">Next, to support named arguments, modify your associated function to accept an input structure as the sole argument:</p>
<code><pre>pub struct RotationDegrees {
pub x: f64,
pub y: f64,
pub z: f64,
}
let rotation_matrix: RotationMatrix
= RotationMatrix::from_degrees(
RotationDegrees {
x: -45.0,
y: 90.0,
z: 135.0,
});</pre></code>
<p style="text-align: justify;">
To make a ZAM, you could move the calculation code from an associated function on the output structure to a method on the input structure:</p>
<code><pre>let rotation_degrees = RotationDegrees {
x: -45.0,
y: 90.0,
z: 135.0,
};
let rotation_matrix: RotationMatrix
= rotation_degrees.to_rotation_matrix();</pre></code>
<p style="text-align: justify;">Instead, however, move the calculation code to a <a href="https://doc.rust-lang.org/std/convert/trait.From.html" target="_blank">From trait</a> implementation:</p>
<code><pre>impl From<RotationDegrees> for RotationMatrix {
fn from(rotation_degrees: RotationDegrees) -> Self {
// [...]
}
}
let rotation_matrix: RotationMatrix
= RotationMatrix::from(rotation_degrees);</pre></code>
<p style="text-align: justify;">Implementing the From trait automatically implements the <a href="https://doc.rust-lang.org/std/convert/trait.Into.html" target="_blank">Into trait</a> which now serves as your ZAM:</p><p>
<code></code></p><pre><code>let rotation_matrix: RotationMatrix
= rotation_degrees.into();</code></pre>
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://commons.wikimedia.org/wiki/File:Rotations.png" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="180" data-original-width="320" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUvvjBRVNwjqFnZkEIe37KzgJJDRDEvyroEPOSFmlLN8N2HYVDSk_GnpQjY5MyYK6pga5c2gFk7LLj_BrpqcO2PQWNTUQG7Dkz9YQBcyOnYO7_N0_B-HxKHEEAxo9IHADBKyU8XEHGcf9oRRtaE7s1JrmJ05MtEUiv6Jf8uLbdwZCaOUN4PlU/s1600/320px-Rotations.png" width="320" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-24669116378981242212022-09-17T17:24:00.000-05:002022-09-17T17:24:01.348-05:00Rust Podcast List<p style="text-align: justify;"><a href="http://croftsoft.blogspot.com/2022/08/rust-podcasts.html" target="_blank">Previously</a> I wrote about how I have been enjoying listening to Rust programming language podcasts. Since then, I have discovered three more Rust podcasts for a total of six. Today I updated my list of all Rust podcasts on the <a href="https://www.croftsoft.com/library/links/#rust-podcasts" target="_blank">CroftSoft Links</a> webpage.<br /><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://commons.wikimedia.org/wiki/File:Very_rusty_chain_in_rain_4.jpg" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="214" data-original-width="320" height="214" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-0L4uXS__cNblmos1A-CxOgDxbGBK96gDd9WbWHea95a7Ev8a85TaWfv_yzt7AzJBlY1wKvUVv-by43ak26vImgTasjilv6EJB1czqTgxGFrZBc-VI9TiyWbsgMg_b7jr9Gpfmgx0VNyI8M4PjIpvlJ-gDamrVx6m8SGy32BvffT5emfDy3M/s1600/Very_rusty_chain_in_rain_4.jpg" width="320" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-25484181092518466832022-08-13T19:36:00.009-05:002022-08-13T19:43:13.428-05:00Sycamore Prototype<p style="text-align: justify;">Today I launched a new open source project, the <a href="https://github.com/david-wallace-croft/sycamore-prototype" target="_blank">CroftSoft Sycamore Prototype</a>. This is a conversion of one of my old Angular-based <a href="https://css-tricks.com/snippets/css/complete-guide-grid/" target="_blank">CSS Grid Layout</a> demonstrations to the Rust-based front-end framework <a href="https://github.com/sycamore-rs/sycamore" target="_blank">Sycamore</a>. My <a href="https://www.croftsoft.com/portfolio/" target="_blank">portfolio page</a> has a link to a demonstration of the in-progress prototype.</p><p style="text-align: justify;">Previously I was focusing on the <a href="https://crate-trends.vercel.app/yew+seed+sycamore+dioxus" target="_blank">far more popular</a> Yew framework but according to this <a href="https://arctic-hen7.github.io/perseus/en-US/comparisons" target="_blank">comparisons webpage</a> on the <a href="https://arctic-hen7.github.io/perseus/en-US/" target="_blank">Perseus</a> website, Yew does not support static site generation (SSG) and server side rendering (SSR). Perseus appears to be a framework layered on top of Sycamore which does support SSG and SSR. Besides Sycamore / Perseus, another framework that I am considering is <a href="https://dioxuslabs.com/" target="_blank">Dioxus</a>.<br /><br /></p><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="BLOG_video_class" height="266" src="https://www.youtube.com/embed/KmqExCoR69g" width="320" youtube-src-id="KmqExCoR69g"></iframe></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-69374081832999481012022-08-13T09:48:00.001-05:002022-08-13T10:04:40.624-05:00Rust Project Setup<div style="text-align: justify;">I started a new tutorial webpage providing a <a href="https://www.croftsoft.com/library/tutorials/rust-project-setup/" target="_blank">Rust Project Setup</a> checklist. In addition to project directory creation and customization, it includes preliminary development steps such as tool installation. I am going to be adding to this over time as I use it.</div><div style="text-align: justify;"> </div><div style="text-align: justify;"><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="BLOG_video_class" height="266" src="https://www.youtube.com/embed/dfl8Xt8W09A" width="320" youtube-src-id="dfl8Xt8W09A"></iframe></div><br /></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-9214251875883600342022-08-12T20:34:00.002-05:002022-08-12T20:34:32.169-05:00Rust Podcasts<p style="text-align: justify;">I have enjoyed listening to the Rust programming language podcast <a href="https://rustacean-station.org/" target="_blank">Rustacean Station</a>. I like this podcast because it is not always the same host speaking. Now that I am all caught up with all eighty-eight episodes published to date, I searched for a different Rust podcast to listen to while I wait for the next episode to come out.</p><p style="text-align: justify;">Fortunately one of the more recent episodes of Rustacean Station is an interview with the former host of the now defunct podcast <a href="https://newrustacean.com/" target="_blank">New Rustacean</a> with one hundred and three episodes available. I listened to the first episode tonight and it sounds like I am in for a high quality experience. I have also sampled the start of the first of nine episodes of the podcast <a href="https://rustgamedev.com/" target="_blank">Rust Game Dev</a>.<br /><br /></p><p style="text-align: justify;"></p><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="BLOG_video_class" height="266" src="https://www.youtube.com/embed/cE0wfjsybIQ" width="320" youtube-src-id="cE0wfjsybIQ"></iframe></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-12977944403340153942022-08-05T07:52:00.004-05:002022-08-05T08:05:11.792-05:00Zero Arguments Methods<p style="text-align: justify;">In my book <a href="http://www.croftsoft.com/library/books/ajgp/" target="_blank">Advanced Java Game Programming</a>, I have a sidebar recommending named notation as a work-around for the Java programming language not supporting <a href="https://en.wikipedia.org/wiki/Named_parameter" target="_blank">named arguments</a>. Here is the example from the book as converted to the Rust programming language:</p><p style="text-align: justify;"><span style="font-family: courier;">let game_data = SerializableGameData::new(</span><br /><span style="font-family: courier;"> 10, // health</span><br /><span style="font-family: courier;"> 99, // wealth</span><br /><span style="font-family: courier;"> 18); // wisdom<br /></span></p><p style="text-align: justify;">There is a <a href="https://internals.rust-lang.org/t/pre-rfc-named-arguments/16413" target="_blank">proposal</a> to bring named arguments to Rust but until this proposal is adopted I have started using a new work-around which I am calling "zero arguments methods". Here is a static function to be converted:</p><p><span style="font-family: courier;">pub fn periodic_savings_needed(</span><br /><span style="font-family: courier;"> f: f64,</span><br /><span style="font-family: courier;"> r: f64,</span><br /><span style="font-family: courier;"> t: f64,</span><br /><span style="font-family: courier;">) -> f64 {<br /> f * r / ((1.0 + r).powf(t) - 1.0)<br />}<br /></span></p><p>Here is the equivalent using a zero arguments method:</p><p><span style="font-family: courier;">#[derive(Clone, Copy, Debug)]<br />pub struct PeriodicSavingsNeeded {<br /> pub future_value: f64,<br /> pub interest_rate: f64,<br /> pub time_periods: f64,<br />}<br /><br />impl PeriodicSavingsNeeded {<br /> pub fn calculate(&self) -> f64 {<br /> let f = self.future_value;<br /> let r = self.interest_rate;<br /> let t = self.time_periods;<br /> f * r / ((1.0 + r).powf(t) - 1.0)<br /> }<br />}</span></p><p>Here is how the zero arguments method can be called:</p><p><span style="font-family: courier;">let calculated_value = PeriodicSavingsNeeded {<br /> future_value: 1_000_000.0,</span><br /><span style="font-family: courier;"> interest_rate: 0.12,</span><br /><span style="font-family: courier;"> time_periods: 10.0,</span><br /><span style="font-family: courier;">}.calculate();</span></p><p><span style="font-family: courier;"> </span></p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://commons.wikimedia.org/wiki/File:Adam_Naming_the_Animals_-_Google_Art_Project.jpg" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="345" data-original-width="256" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOV146AWEw_ohtMhqYQRmuwkbylsdPXkCXg8R1N6LBqh9v3Jtdw2CyKfr-5YIJhBnv_CNicMJXtvql92Fp1OkHm94ktLkDszaCC4OkB4sObhcckhBSCznaK7zmPrrvM-ipA-AcLk9jF8zda_Pw6299uQUjRiQTFYlKDir_SQS4mOnovqJRHy8/s320/Adam_Naming_the_Animals_-_Google_Art_Project.jpg" width="237" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-41359286341709968902022-07-30T17:42:00.000-05:002022-07-30T17:42:23.104-05:00First Published Crate<p style="text-align: justify;">Today I <a href="https://doc.rust-lang.org/cargo/reference/publishing.html" target="_blank">published</a> my first <a href="https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html" target="_blank">Rust crate</a> to <a href="http://crates.io">crates.io</a>. Crate <a href="https://crates.io/crates/com-croftsoft-core" target="_blank">com-croftsoft-core</a> is an adaption to Rust of the Java-based <a href="http://www.croftsoft.com/library/code/" target="_blank">CroftSoft Core Library</a>. After publishing this crate, I was able to use it as a dependency in my Yew-based <a href="https://github.com/david-wallace-croft/retirement-calculator" target="_blank">retirement calculator</a>.<br /></p><p style="text-align: justify;">The crate only has a single financial calculation function and a few constants right now. I hope to eventually expand it to include most of the code from the CroftSoft Core Library. Converting my old Java code library is another way for me to learn the Rust programming language.<br /><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="http://www.croftsoft.com/library/code/" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="311" data-original-width="356" height="280" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixRjZ8AgUj7AQ-am4rTBf6rV4SBDduqOHmUMZTfOrLoM03HWFO9AGR7IUt_zch5mlO0LRb0hzM2MwtQARLuckGmLt4mAk0FHhY2vGPLJgVQO8S__9suMvFaYSKDfdnt1IM7T_zWjv-LTnxs0XhSMw1mkdg5sZ3G-veVV4uujPrEEQVA-yfxd4/s320/CroftSoftLogo2.jpg" width="320" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-16250271764177619542022-07-24T12:51:00.004-05:002022-07-24T15:05:56.857-05:00Rust, WebSockets, and Yew<div style="text-align: justify;">Almost two decades ago when I wrote my book <a href="http://www.croftsoft.com/library/books/ajgp/" target="_blank">Advanced Java Game Programming</a>, I ended it with three chapters on the subject of multiplayer network communications over <a href="https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" target="_blank">Hypertext Transfer Protocol</a> (HTTP). The final chapter demonstrated a browser-based chat <a href="https://en.wikipedia.org/wiki/Java_applet" target="_blank">applet</a> in which 2D characters would move about in response to player clicks on the screen. I described how to use what I called "HTTP Pulling", now known as <a href="https://en.wikipedia.org/wiki/Push_technology#Long_polling" target="_blank">HTTP Long Polling</a>, to receive messages from the server through the firewall.<br /></div><div style="text-align: justify;"><br /></div><div style="text-align: justify;">The modern replacement for HTTP Long Polling is <a href="https://ably.com/blog/websockets-vs-long-polling" target="_blank">WebSockets</a> which is now supported in <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API#browser_compatibility" target="_blank">all major browsers</a>. <a href="http://croftsoft.blogspot.com/2022/07/retirement-calculator.html" target="_blank">Last weekend</a> I was able to write my first browser-based application in the <a href="https://www.rust-lang.org/" target="_blank">Rust</a> programming language by using the Rust-based front-end framework <a href="https://yew.rs/" target="_blank">Yew</a>. Today I was pleased to be able to successfully implement a browser-based chat application using WebSockets and Yew by following the instructions in the online tutorial <a href="https://blog.devgenius.io/lets-build-a-websockets-project-with-rust-and-yew-0-19-60720367399f" target="_blank">Let’s Build a WebSockets Project With Rust and Yew 0.19</a> by <a href="https://github.com/jtordgeman" target="_blank">Johnny Tordgeman</a>.</div><div><p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-pprQBH-6HKpraYogC3inIGbq6B8RxAXCKH98wMWBuAW_yGz3TyTIQ4UEHZ0yytCxIEQlLw_jM1Kt69ES0UNubbId5W_EfkIt5NWK1T5oFx9cl9StLA4BPyhEYeiGVo1pCTwJ4s9nV4pJJ9qnB9aduveqaz-ZroGRcaNklw15-WNy66607TA/s627/chat-websocket-yew-2022-07-24-a.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="444" data-original-width="627" height="227" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-pprQBH-6HKpraYogC3inIGbq6B8RxAXCKH98wMWBuAW_yGz3TyTIQ4UEHZ0yytCxIEQlLw_jM1Kt69ES0UNubbId5W_EfkIt5NWK1T5oFx9cl9StLA4BPyhEYeiGVo1pCTwJ4s9nV4pJJ9qnB9aduveqaz-ZroGRcaNklw15-WNy66607TA/s320/chat-websocket-yew-2022-07-24-a.png" width="320" /></a></div><br /></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-17986324181290888642022-07-17T18:26:00.002-05:002022-07-17T18:27:09.190-05:00The Rust Book<p style="text-align: justify;">Tonight I finished reading <a href="https://nostarch.com/Rust2018" target="_blank">The Rust Programming Language</a>, informally known as "The Rust Book", by Steve Klabnik and Carol Nichols with contributions from the Rust Community. The print copy published by <a href="https://nostarch.com/search/rust" target="_blank">No Starch Press</a> covers the 2018 Edition of Rust. There is also a <a href="https://doc.rust-lang.org/stable/book/" target="_blank">free online version</a> which is updated continuously. <br /></p><p style="text-align: justify;">I had started reading the Rust book last year and made it three-quarters of the way through. This year I restarted from the beginning so I could refresh on the fundamentals. It helped me understand a couple of Rust game programming books that I was reading simultaneously.</p><p style="text-align: justify;">The book is well written with many code examples which are described in detail. The authors ease the readers into the subject but then rapidly advance to more complicated topics in later chapters. I assume that this is because they wanted to cover the entire programming language in just over five hundred pages.<br /></p><p style="text-align: justify;">I searched the Web to see if there is a second edition of the book coming out that covers the 2021 Edition of the Rust programming language. Apparently <a href="https://www.reddit.com/r/rust/comments/q93uej/are_there_plans_for_the_book_2021_edition/" target="_blank">there is not</a> so I might start reading the online version for the updates and to review the material. To help take me to the next level, I ordered from the same publisher <a href="https://nostarch.com/rust-rustaceans" target="_blank">Rust for Rustaceans: Idiomatic Programming for Experienced Developers</a> by <a href="https://nostarch.com/blog/jon-gjengset-talks-rust" target="_blank">Jon Gjengset</a>.<br /><br /></p><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="BLOG_video_class" height="266" src="https://www.youtube.com/embed/a9SzQClrOeI" width="320" youtube-src-id="a9SzQClrOeI"></iframe></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-50385588542053628202022-07-16T22:40:00.009-05:002022-07-16T22:47:11.754-05:00Retirement Calculator<p style="text-align: justify;">Back in 1999 when the stock market was doing well, I wrote a browser-based <a href="https://sourceforge.net/p/croftsoft/code/HEAD/tree/trunk/apps/src/com/croftsoft/apps/retirement/RetirementServlet.java" target="_blank">retirement calculator</a> application using the <a href="https://en.wikipedia.org/wiki/Jakarta_Servlet" target="_blank">Java Servlet</a> framework. Since a Java Servlet renders the Hypertext Markup Language (HTML) server-side, the application stopped working when I stopped using the Java application server. Since the application does not fetch or store data using a back-end server, I could have re-written the calculator as a JavaScript-based application and simply hosted it on a website fronted by a <a href="https://aws.amazon.com/cloudfront/" target="_blank">Content Delivery Network</a> (CDN).</p><p style="text-align: justify;">Now in 2022 when the stock market is not doing so well, I converted the application to my new favorite programming language <a href="https://www.rust-lang.org/" target="_blank">Rust</a> using the front-end framework <a href="https://yew.rs/" target="_blank">Yew</a>. Yew compiles the Rust code to <a href="https://webassembly.org/" target="_blank">WebAssembly</a> (Wasm) which then runs in the browser just like JavaScript. You can view the <a href="https://github.com/david-wallace-croft/retirement-calculator" target="_blank">converted source code</a> and play with an online demonstration hosted on one of my websites deployed using Amazon Web Services (AWS) <a href="https://aws.amazon.com/amplify/hosting/" target="_blank">Amplify Hosting</a>.</p><p style="text-align: justify;"> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://github.com/david-wallace-croft/retirement-calculator" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="366" data-original-width="579" height="202" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWlYjUsB6DOP8b__NfwQT2lBLPY9b20TD8uVWMwqjGWp_kdJjHSkRKY7p9nb7LZlVeEXHDortqth1myboUfc1CUYbwnzYdeSSSznDew3jUFkYEGQ4IMPGFFXv0uDqf6Cqdo-IxpJ6HpaOyqmalc3N6jBObfNQGVWXSdyRR6T47Kdcq5ly3ZPQ/s320/retirement-calculator-2022-07-16.png" width="320" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-33688115267325192412022-07-10T12:09:00.003-05:002022-07-10T12:14:50.398-05:00Rust and WebAssembly<p style="text-align: justify;">My <a href="https://en.wikipedia.org/wiki/New_Year%27s_resolution" target="_blank">New Year's resolution</a> this year was to learn the new <a href="https://en.wikipedia.org/wiki/Rust_(programming_language)" target="_blank">Rust programming language</a>. I wrote a <a href="https://en.wikipedia.org/wiki/%22Hello,_World!%22_program" target="_blank">Hello, World! program</a> in Rust many years ago and started reading <a href="https://doc.rust-lang.org/book/" target="_blank">the Rust book</a> last year but now I am really getting into it. You can follow my efforts on my new <a href="https://github.com/david-wallace-croft" target="_blank">GitHub account</a>.</p><p style="text-align: justify;">My older <a href="http://www.croftsoft.com/library/code/" target="_blank">open source Java code</a> is hosted on <a href="https://sourceforge.net/projects/croftsoft/" target="_blank">SourceForge.net</a>. Many of my applications are <a href="http://www.croftsoft.com/library/books/ajgp/" target="_blank">Java game applets</a>. Now that <a href="https://en.wikipedia.org/wiki/Java_applet#Embedding_into_a_web_page" target="_blank">Web browsers no longer support applets</a>, I am exploring <a href="https://en.wikipedia.org/wiki/WebAssembly" target="_blank">WebAssembly</a> which can run both in browsers and in <a href="https://thenewstack.io/using-web-assembly-written-in-rust-on-the-server-side/" target="_blank">servers</a>.</p><p style="text-align: justify;">Today I was able to deploy a game that runs in the browser by following the instructions in the book <a href="https://www.packtpub.com/product/game-development-with-rust-and-webassembly/9781801070973" target="_blank">Game Development with Rust & WebAssembly</a> by Eric Smith. I wrote the code in Rust, compiled it to WebAssembly, and then wrapped it in a thin layer of JavaScript so that it can run in a webpage. You can play the game online at my <a href="https://www.gamespawn.com/arcade/" target="_blank">GameSpawn</a> website.<br /><br /></p><p style="text-align: justify;"></p><div class="separator" style="clear: both; text-align: center;"><a href="https://www.gamespawn.com/arcade/" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="481" data-original-width="758" height="203" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwAFvBodZbLGzcaPPu-Mer4adQqzh_3bR4rEranG9uf17W409t7eK-SwRfk5blAxpEmtb58W0vwxp8lh_ZGTgwu8Lyv4yB0Yl0lHaUV3an3qWD72z1uT4bo90_vVbhn5IGbeuSr6p9NE1xpOK2lI29aMqhDCXiJ-QBqSPOekRB2Kjq_lpa7f4/s320/walk-the-dog-2022-07-10-a.png" width="320" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-6764647171124402042022-06-26T08:46:00.011-05:002022-06-26T09:15:55.272-05:00Specialist Pools<p style="text-align: justify;">If a software development team gets to be too large, you might be able to refactor a <a href="https://www.geeksforgeeks.org/monolithic-vs-microservices-architecture/" target="_blank">monolithic application into microservices</a>. You can then split the team into smaller teams, each dedicated to its own microservice. Within the smaller team, you can have specialists, each focused on a different technology such as front-end, back-end, automated testing, or <a href="https://en.wikipedia.org/wiki/DevSecOps" target="_blank">DevSecOps</a>. </p><p style="text-align: justify;">If you instead decide to keep the larger team dedicated to a single codebase, you might be able to split the team into Specialist Pools. Each pool of specialists is focused on a single technology and each has its own Specialist Lead. Since not all feature development <a href="https://en.wikipedia.org/wiki/User_story" target="_blank">stories</a> require work in all technologies, members of the specialist pool can be assigned as needed where needed.</p><p style="text-align: justify;">At regular <a href="https://www.scaledagileframework.com/program-increment/" target="_blank">increments</a> of some number of months, one member of each pool can be rotated to another pool. This permits the developer to get breadth across the technologies while at the same time conserving the depth of knowledge within the remaining members of the pool. If more than one developer from a pool is volunteering to rotate, the one who has been in the pool the longest might be given preference.<br /><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://commons.wikimedia.org/wiki/File:NH_52909_-_typing_pool,_Navy_Department,_Washington_DC.jpg" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="229" data-original-width="256" height="229" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhANKAZk_FsO6GvXgpn6v_hSZ3L-YXOk__ZFYfvx_VMf5asGr-KEWf56LLevtMwl4d5mdIa2RhE-TSYT5FFa4rNI6bAF0k6KH1NNrUkP2aNaGgQ2yKH4CgYnRX_eF-nIHnpSAZ0EOY6Ds5x4uYVPf8SYl84LQpTEmt8VwoXomkZYVoIrMe2yJs/s1600/NH_52909_-_typing_pool,_Navy_Department,_Washington_DC.jpg" width="256" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0tag:blogger.com,1999:blog-20589565.post-5494701216802152682021-12-19T11:09:00.003-06:002022-07-10T12:45:12.633-05:00Babel Tower Programming<p style="text-align: justify;">In the ancient story of the <a href="https://en.wikipedia.org/wiki/Tower_of_Babel" target="_blank">Tower of Babel</a>, all of Humanity is unified in a common language. They begin to construct a great tower which, in <a href="https://en.wikipedia.org/wiki/Tower_of_Babel#Comparable_myths" target="_blank">some variations of the story from other civilizations</a>, might save them from possible extinction from another <a href="https://en.wikipedia.org/wiki/Flood_myth" target="_blank">Divine Flood</a> sent by an angry God. Construction of the tower is abandoned when God disrupts the ability of Humanity to communicate by dividing their shared language into many.<br /></p><p style="text-align: justify;">Babel Tower Programming is what I call a form of <a href="https://searchsoftwarequality.techtarget.com/definition/polyglot-programming" target="_blank">Polyglot Programming</a> in which the use of multiple computer programming languages impedes rather than promotes progress. An example might be using one programming language for front-end development and a separate for the back-end when the same language could be used for both. One sign that you are experiencing the impedance of Babel Tower Programming is when software developers are choosing their feature development tasks based primarily on which programming language will be used.<br /></p><p style="text-align: justify;">The solution, which I call the <a href="https://en.wikipedia.org/wiki/Enmerkar_and_the_Lord_of_Aratta" target="_blank">Incantation of Nudimmud</a>, is to adopt a policy which requires that any new software features be developed in a common programming language. Legacy code developed in the abandoned programming languages can be gradually phased out using techniques such as the <a href="https://docs.microsoft.com/en-us/azure/architecture/patterns/strangler-fig" target="_blank">Strangler Fig Pattern</a>. As Babel Tower Programming is a form of <a href="https://en.wikipedia.org/wiki/Technical_debt" target="_blank">Technical Debt</a>, the decision to move to a single language usually requires some <a href="https://xkcd.com/1205/" target="_blank">cost analysis</a> and both bottom-up and top-down support. <br /></p><p style="text-align: justify;"> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://en.wikipedia.org/wiki/File:Confusion_of_Tongues.png" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" data-original-height="597" data-original-width="515" height="320" src="https://blogger.googleusercontent.com/img/a/AVvXsEiXPEl0MlP90v-fRVfu-KoUFfgxZVm8Iq-7oVFrvl_4R83lOkqW4q785qywoo-c6xkijRbKr50zS_sRZb4nIquLx-3RRBuf92JVCzZZY_4C3hSNQ0Pxlu62iQtdT6-CQNkhfbhe2uMXecMvn5ElP5Y9d5STIXCBZtj6k_iDg2AEDxSibXJU9uM=s320" width="276" /></a></div><div class="blogger-post-footer"><div class='adsense' style='text-align:center; padding: 0px 3px 0.5em 3px;'>
<script type="text/javascript"><!--
google_ad_client="ca-pub-5318035910586039";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="A8DDA0";
google_color_bg="EBFFED";
google_color_link="0000CC";
google_color_url="008000";
google_color_text="6D6D6D";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div>David Wallace Crofthttp://www.blogger.com/profile/09977171768879170784noreply@blogger.com0