Monthly Archives: January 2013

Reading a String from a File in JavaScript

The code shown below reads the contents of a text file “Test.txt” into a string, and then displays that string in the web browser. To see the code in action, paste it into an .html file and open that file … Continue reading

Posted in Uncategorized | Tagged , , , , | 12 Comments

A Toy SQL Database in JavaScript

The code shown below implements an unfinished, extremely inefficient, buggy, and completely useless SQL database that runs in JavaScript in a web browser. To see it in action, copy the code to an .html file and open that file in … Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment

Simulating an Ant Farm in JavaScript

This code isn’t quite done yet, but it does run, and I figured I’d better put it out there on the Internet before it got lost forever the next time something horrible happens to my hard disk. To use the … Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment

Accessing MariaDB from JavaScript Using Node.js and Node-MariaSQL

1. If you have not already done so, download and install Node.js. Details are given in a previous post. 2. If you have not already done so, download and install Python, which is unfortunately required to run the next step. … Continue reading

Posted in Uncategorized | Tagged , , , , , , | 2 Comments

Running a Hello World Server in JavaScript Using Node.js

JavaScript has traditionally always been a client-side language, but Node.js lets you run JavaScript on the server side as well. You know, in case that turns out to be a good idea. Follow the steps below to run a simple … Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment

Drawing Lines with Bresenham’s Algorithm

The code shown below draws several lines in various colors using Bresenham’s line algorithm. To see the code in action, copy it into an .html file and open that file in a web browser that runs JavaScript. <html> <body> <script … Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment

Rendering 3D Shapes as Wireframes in JavaScript

The code shown below will render several three-dimensional shapes, or “meshes”, in various positions and orientations for the viewpoint of a particular camera. To see the code in action, copy it into an .html file and open that file in … Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment