Wednesday, March 18, 2020

Canvas Paint

Here is another small JS project that I built quite a few years ago.  It was basically just an exploration of the canvas tag, which was somewhat new at the time.  I called it "Canvas Paint".  It allows you to draw on the canvas.  You can change the color and width of the brush by changing the numbers in the boxes and clicking either "Set Color" or "Set Width".

Wednesday, March 11, 2020

Life Game

Previously I posted about a game (really a simulation) that I made several years ago.  I called it the Fish Game.  A few years later I made another very similar simulation that I called "Life Game".

It is similar, but quite a bit more complex, and I think somewhat better written code.  In this version there are three life forms; fish, bugs, and plants.  The fish eat the bugs.  The bugs eat the plants.  The plants gain energy each frame as if they are getting energy from the sun.  Each life form has a fairly large set of properties.  These are copied to the individual life forms as they are created.

Tuesday, March 3, 2020

Custom Thumbnails for Magento 2 Products

I recently migrated a site from Magento 1 to Magento 2.  The product image thumbnails work differently in Magento 2.  In Magento 2 they use a JS library called Fotorama.  It has several options that can be modified in the view.xml if you have a custom theme setup.  However, none of the thumbnail options match the way that the thumbnails work in Magento 1, and my client wanted them to look more like the old version.


Friday, February 28, 2020

Fish Game

Many years ago, probably about twelve to fifteen, I was working on building a custom e-commerce system using Adobe Coldfusion.  I was a young developer and so were the rest of the developers I worked with.  Non of us were really qualified to build such a complex system, but we didn't know that, so we did it anyway.  It ended up working fine for the customers we had.  I'm sure I would not be happy with most of the code if I saw it today.


Wednesday, February 26, 2020

Playing Local Network Media on a Chromecast with Python

I have several Chromecast devices in my house.  Recently I was playing around with the Python module pychromecast.  It has given me a much better understanding of what the Chromecast does.  The module allows you to find devices on your network and play videos or other media on the device.

Tuesday, April 30, 2019

Using Brave

For a few weeks now I have been using the Brave browser.  It is based on Chromium, so switching from Chrome was a quick adjustment since I have been using Chrome for years.  Brave includes an ad blocking system that blocks what they call "very intrusive ads" and most attempts to track users across sites.  They have also setup a system using BAT currency that allows you to directly pay content providers that you visit.  I have also setup my site as a content provider so I can receive tokens.


Browser




The browser was created by Brendan Eich, the creator of Javascript.  The browser has worked well so far.  It updates automatically similarly to the way Chrome does.  They have a system for syncing bookmarks between your devices.  You also have a wallet built in for your BAT tokens.  I am using it on a Mac, and my Android phone.



Tuesday, April 17, 2018

Using The Coldfusion XMLValidate Function To Validate User Content

Sometimes you want to allow a limited set of HTML tags in user generated content.  This can be done with the XMLValidate function in Coldfusion as long as the content is valid XHTML.

Several years ago I read an article about escaping form values posted by Ben Nadel on his site www.bennadel.com. Some discussion came up in the comments about allowing a limited set of html tags for paragraphs, bold text, and so on.  I had a need to do this for forum comments on a site that I was working on. This site was written in Coldfusion so I was looking at some of the same options mentioned in Ben's article. I ended up doing something a little different though.

We were using TinyMCE for the forum comments. TinyMCE produces XHTML code so I was able to use Coldfusion's abilities to handle XML to accomplish this task. Using the XMLValidate function and an XML schema that was modified to accept a small list of tags and attributes the comments were correctly limited. Here is the relevant portion of the code.  Below is an explanation of how it works. 


Canvas Paint

Here is another small JS project that I built quite a few years ago.  It was basically just an exploration of the canvas tag, which was some...