<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Charlie J Smotherman</title>
    <description>The latest articles on DEV Community by Charlie J Smotherman (@cjsmocjsmo).</description>
    <link>https://dev.to/cjsmocjsmo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F313555%2Fcf43c146-9418-4812-b209-0253586daa65.png</url>
      <title>DEV Community: Charlie J Smotherman</title>
      <link>https://dev.to/cjsmocjsmo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cjsmocjsmo"/>
    <language>en</language>
    <item>
      <title>Why We Should Stop Using JavaScript According to Douglas Crockford (Inventor of JSON)</title>
      <dc:creator>Charlie J Smotherman</dc:creator>
      <pubDate>Thu, 01 Jun 2023 17:07:03 +0000</pubDate>
      <link>https://dev.to/cjsmocjsmo/why-we-should-stop-using-javascript-according-to-douglas-crockford-inventor-of-json-2dod</link>
      <guid>https://dev.to/cjsmocjsmo/why-we-should-stop-using-javascript-according-to-douglas-crockford-inventor-of-json-2dod</guid>
      <description>&lt;p&gt;I saw this today and thought I would throw it out there and see what folks had to say&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtu.be/lc5Np9OqDHU"&gt;Why We Should Stop Using JavaScript According to Douglas Crockford (Inventor of JSON)&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Help Ukraine</title>
      <dc:creator>Charlie J Smotherman</dc:creator>
      <pubDate>Sun, 27 Feb 2022 18:45:59 +0000</pubDate>
      <link>https://dev.to/cjsmocjsmo/help-ukraine-2267</link>
      <guid>https://dev.to/cjsmocjsmo/help-ukraine-2267</guid>
      <description>&lt;p&gt;Hey everyone I just came across this and thought I would share.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/rameerez/embargoed"&gt;Embargoed&lt;/a&gt; it's a wordpress/rail plugin that blocks all traffic from Russia and displays a pro-Ukraine message.  I'm going to be adding something similar to my custom sites&lt;/p&gt;

&lt;p&gt;Happy Coding&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Testing Web Server</title>
      <dc:creator>Charlie J Smotherman</dc:creator>
      <pubDate>Mon, 09 Aug 2021 21:45:17 +0000</pubDate>
      <link>https://dev.to/cjsmocjsmo/testing-web-server-4l6m</link>
      <guid>https://dev.to/cjsmocjsmo/testing-web-server-4l6m</guid>
      <description>&lt;p&gt;I have recently been exploring Flutter for some of my front end projects.  One way that I deploy my apps is on a Raspberry Pi using docker, docker-compose and the Apache2 web server.  I like this approach because I can test my app in the container and throw the container away when I'm done.&lt;/p&gt;

&lt;p&gt;When you run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flutter build web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you get a nice bundle that you can deploy on a web server with a file structure such as this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--atvOkIwi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/8879432/128769161-a93fed27-2795-4d72-867e-a581c9847fc3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--atvOkIwi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/8879432/128769161-a93fed27-2795-4d72-867e-a581c9847fc3.png" alt="filelist"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For any project that exposes an &lt;code&gt;index.html&lt;/code&gt; file this technique can be used.&lt;/p&gt;

&lt;p&gt;Next we need to add a &lt;code&gt;docker-compose.yaml&lt;/code&gt; and a &lt;code&gt;Dockerfile&lt;/code&gt; to our project folder like such&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--K1KXFe1G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/8879432/128770388-73634d47-be26-4270-8a52-0cba0a20e1ed.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--K1KXFe1G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/8879432/128770388-73634d47-be26-4270-8a52-0cba0a20e1ed.png" alt="filelist2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In our &lt;code&gt;Dockerfile&lt;/code&gt; we will need to add this code&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uU4N4YdY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/8879432/128771246-8f51e7b7-24ba-4eab-9f01-ce0fcf02ef96.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uU4N4YdY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/8879432/128771246-8f51e7b7-24ba-4eab-9f01-ce0fcf02ef96.png" alt="dockerfile"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above will copy all you files to the &lt;code&gt;/usr/local/apache2/htdocs/&lt;/code&gt; folder so Apache2 can serve them up.&lt;/p&gt;

&lt;p&gt;At this point you could build the image and use it but you would have to manually setup our volumes.  I'm lazy and I like using docker-compose so I let compose set everything up for me.  Add this to &lt;code&gt;docker-compose.yaml&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QTWH48AI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/8879432/128772332-883a294e-5eac-4607-8414-929c183b794e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QTWH48AI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/8879432/128772332-883a294e-5eac-4607-8414-929c183b794e.png" alt="docker-compose"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now inside the mytestserver folder run&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker-compose up -d --build&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;and let docker do it's thing.  When docker is finished point your browser to &lt;/p&gt;

&lt;p&gt;&lt;code&gt;http://192.168.xxx.xxx:7777/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and your new project should appear.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;There are a myriad of other ways to deploy your project for testing but I like using a little Raspberry Pi.  It's a way of getting a project up on real hardware to see how it behaves.&lt;/p&gt;

&lt;p&gt;I started using the Apache web server when the LAMP stack first came out, so me and Apache have a long history together.  It's a battle hardened, tough as nails web server that just runs and runs and runs and runs.  &lt;/p&gt;

&lt;p&gt;2 files, 12 lines of code, 1 command, deployed for testing&lt;/p&gt;

&lt;p&gt;Happy Coding&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Python Web Frameworks, but not Flask or FastApi</title>
      <dc:creator>Charlie J Smotherman</dc:creator>
      <pubDate>Sat, 31 Jul 2021 02:07:19 +0000</pubDate>
      <link>https://dev.to/cjsmocjsmo/python-web-frameworks-but-not-flask-or-fastapi-25li</link>
      <guid>https://dev.to/cjsmocjsmo/python-web-frameworks-but-not-flask-or-fastapi-25li</guid>
      <description>&lt;p&gt;After reading yet another Flask/FastApi article I decided to shed light on some other python web frameworks.  I have nothing against Flash/FastApi, I'm sure they are great pieces of software, however there are other solutions out there that are in some cases much more mature. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://www.zope.org"&gt;Zope&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Zope is a free and open source web application server written in the object-oriented programming language Python. Since its release in 1998, Zope continues to grow into many distinct applications, frameworks, libraries and tools. The World of Zope highlights the most important components.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://twistedmatrix.com/trac/"&gt;Twisted&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Twisted is an event-driven networking engine written in Python and licensed under the open source ​MIT license. It supports CPython 3.5+ and PyPy3.  Learn more about ​writing servers, ​writing clients and the ​core networking libraries , including support for SSL, UDP, scheduled events, unit testing infrastructure, and much more&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://www.tornadoweb.org/en/stable/"&gt;Tornado&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. By using non-blocking network I/O, Tornado can scale to tens of thousands of open connections, making it ideal for long polling, WebSockets, and other applications that require a long-lived connection to each user.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://hackr.io/blog/python-frameworks"&gt;AIOHTTP&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Asynchronous framework AIOHTTP is a Python framework that relies heavily on Python 3.5+ features, such as async &amp;amp; awaits. The Python framework makes use of Python’s asyncio library, and is hence an asynchronous framework. In addition to being a server web framework, AIOHTTP can also serve as a client framework. It provides a request object and router to enable the redirection of queries to functions developed to handle the same.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://bottlepy.org/docs/dev/"&gt;Bottle&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Bottle is a fast, simple and lightweight WSGI micro web-framework for Python. It is distributed as a single file module and has no dependencies other than the Python Standard Library.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://cherrypy.github.io"&gt;Cherrypy&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;CherryPy allows developers to build web applications in much the same way they would build any other object-oriented Python program. This results in smaller source code developed in less time.  CherryPy is now more than ten years old and it is has proven to be very fast and stable. It is being used in production by many sites, from the simplest to the most demanding.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://www.pylonsproject.org"&gt;Pylons&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;The Pylons Project is composed of a disparate group of project leaders with experience going back to the very start of Python web frameworks.&lt;br&gt;
Collectively, we have experience and humility gained by making (and surviving) every stupid decision that could be imagined. We aim to bring fresh ideas to classic web development problems.&lt;br&gt;
Rather than focusing on a single web framework, the Pylons Project develops a collection of related technologies. The first package from the Pylons Project was the Pyramid web framework.&lt;br&gt;
Other packages have been added to the collection over time, including higher-level components and applications. The project has become an ecosystem of well-tested, well-documented components which interoperate easily.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="http://web2py.com"&gt;WEB2PY&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications. Written and programmable in Python (version 3 and 2.7).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://www.djangoproject.com"&gt;Django&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://falconframework.org"&gt;Falcon&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Type – Microframework Aimed at rapidly building web APIs, Falcon is another widely used Python framework. Unlike other Python frameworks that require loading a lot of dependencies for building HTTP APIs, Falcon allows developers to build a cleaner design that enables HTTP and REST architectures.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://github.com/priestc/giotto"&gt;Giotto&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Giotto is a python web framework. It encourages a functional style where model, view and controller code is strongly decoupled.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://github.com/pyGrowler/Growler"&gt;Growler&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Growler is a web framework built atop asyncio, the asynchronous library described in PEP 3156 and added to the standard library in python 3.4. It takes a cue from the Connect &amp;amp; Express frameworks in the nodejs ecosystem, using a single application object and series of middleware to process HTTP requests. The custom chain of middleware provides an easy way to implement complex applications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://github.com/hugapi/hug"&gt;Hug&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Hug aims to make developing Python driven APIs as simple as possible, but no simpler. As a result, it drastically simplifies Python API development.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://www.turbogears.org"&gt;TurboGears&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;TurboGears 2 is built on top of the experience of several next generation web frameworks including TurboGears 1 (of course), Django, and Rails. All of these frameworks had limitations that frustrated us, and TG2 was built as an answer to that frustration.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href=""&gt;Sanic&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Sanic is a Python 3.7+ web server and web framework that's written to go fast. It allows the usage of the async/await syntax added in Python 3.5, which makes your code non-blocking and speedy. Sanic is also ASGI compliant, so you can deploy it with an alternative ASGI webserver.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;As you can see there is no shortage of python web frameworks to choose from for you next project.  Flask and FastApi are good pieces of software but there is SO much more the python ecosystem has to offer.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Wolfram Mathmatica ML Models Whaaaaat?</title>
      <dc:creator>Charlie J Smotherman</dc:creator>
      <pubDate>Sat, 06 Feb 2021 23:42:40 +0000</pubDate>
      <link>https://dev.to/cjsmocjsmo/wolfram-mathmatica-ml-models-whaaaaat-4055</link>
      <guid>https://dev.to/cjsmocjsmo/wolfram-mathmatica-ml-models-whaaaaat-4055</guid>
      <description>&lt;p&gt;Did you know you can make machine learning models with Wolfram Mathmatica which is bundled into the full version of RaspberryOS (raspbian)?  Well you can.&lt;/p&gt;

&lt;p&gt;To give you some background I have been implementing a security camera system using &lt;a href="https://github.com/jeffbass/imagenode"&gt;imagenode&lt;/a&gt;, &lt;a href="https://github.com/jeffbass/imagehub"&gt;imagehub&lt;/a&gt;, and &lt;a href="https://github.com/jeffbass/imagezmq"&gt;imagezmq&lt;/a&gt; developed by &lt;a href="https://github.com/jeffbass"&gt;Jeff Bass&lt;/a&gt; which in my humble opinion is just awesome.  Jeff has written a very good installation guide so go have a look.  &lt;/p&gt;

&lt;p&gt;Once you have the nodes and the hub setup what you get is a detailed activity log on both the nodes and hub that is easy to parse and is rotated daily.  Another feature is that the image folders are rotated daily also. And that's it the Desktop app or Web front end is on you. I chose the web frontend and developed a quick and dirty page using &lt;a href="https://svelte.dev"&gt;Svelte&lt;/a&gt; to show the last 25 pics along with some activity stats.&lt;/p&gt;

&lt;p&gt;Now this setup does a wonderful job of detecting motion and responding to events.  I have one monitoring my drive way and garage door but what I needed was a way to tell if the garage door was open or closed.  I looked at pre-built models that google offers but found them lacking and would need to be retrained.&lt;/p&gt;

&lt;p&gt;So while sifting through the mountains of Machine Learning tutorials out there I decided to take a break.  I have recently started using the RPI 4 as my primary desktop so I decided to take a break and mess with this Wolfram Mathmatica.  I have seen it bundled with the RPI for years but never messed with it.  I noticed their project page and found this &lt;a href="https://projects.raspberrypi.org/en/projects/c3-wolfram-facial-recognition"&gt;Facial recognition&lt;/a&gt; how to.  Whaaaaaat is is really that easy.  Just so happens I already had about 500 photos of garage door opened and closed.  So I separated them into different folders and followed the tutorial.  About an hour later it spit out a model that I can put up on imagehub to classify images.  But how to do that?&lt;/p&gt;

&lt;p&gt;Wolfram provides &lt;a href="https://reference.wolfram.com/language/WolframClientForPython/docpages/install.html"&gt;python bindings&lt;/a&gt; to the Wolfram engine,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip3 install wolframclient
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;so running your new model on your RPI is really easy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from wolframclient.evaluation import WolframLanguageSession
from wolframclient.language import wl

session = WolframLanguageSession('/usr/bin/wolfram')
gdstatus = wl.Import("/path/to/model.wls)
status = ""
    for gdpic in gdpiclist:
        picimport = wl.Import("/path/to/pic/to/classify.jpg")
        status = session.evaluate(gdstatus(picimport))
session.terminate()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;As this is not the most optimal option to machine learning it is an easy, low install way of creating trivial machine learning models.  Everything you need is already installed except for one package that is pip installable.  I hope this helps someone.&lt;/p&gt;

&lt;p&gt;Best Regards&lt;br&gt;
Charlie&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
