Javascript Art Is In The URL

[Alexander Reben] makes tech art, and now he’s encouraging you to do the same — within a URL. The gimmick? Making the code small enough to fit the data portion of a link. And to help with that, he has set up a webpage that uncompresses and wraps code from the URL and inserts it into the HTML on the fly. His site essentially applies or un-applies all the tricks of JS minification in the URL, and turns that into content.

So, for instance,https://4QR.xyz/c/?eJzzSM3JyVcIzy_KSVEEABxJBD4 uncompresses to a webpage that says “Hello World!”. But the fun really starts when you start coding up “art” in Javascript or HTML5. There are a few examples up in the gallery right now, but [Alexander] wants you to contribute your own. The banner is from this link.

Something strikes us as fishy about passing JS code opaquely in links, but since the URL decodes on [Alexander]’s server, we don’t see the XSS attack just yet. If you can find the security problem with this setup, or better yet if you write up a nice animation, let us know in the comments.

Chess AI, Old School

People have been interested in chess-playing computers before there were any chess-playing computers. In a 1950 paper, [Claude Shannon] defined two major chess-playing strategies. Apparently, practical chess programs still use the techniques he outlined. If you’ve ever wondered how to make a computer play chess [FreeCodeCamp] has an interesting post that walks you through building a chess engine step-by-step.

The code is in JavaScript, but the approach struck us as old school. However, it is interesting to watch the evolution of code as you go from random moves, to slightly smarter strategy, to deeper searching. Because it is in JavaScript, you can follow along in your browser and find out when the program gets smart enough to beat you. The final version is even on GitHub.

Continue reading “Chess AI, Old School”

SDR And Node.js Remote-Controlled Monster Drift

Most old-school remote controlled cars broadcast their controls on 27 MHz. Some software-defined radio (SDR) units will go that low. The rest, as we hardware folks like to say, is a simple matter of coding.

So kudos to [watson] for actually doing the coding. His monster drift project starts with the basics — sine and cosine waves of the right frequency — and combines them in just the right durations to spit out to an SDR, in this case a HackRF. Watch the smile on his face as he hits the enter key and the car pulls off an epic office-table 180 (video embedded below).

Continue reading “SDR And Node.js Remote-Controlled Monster Drift”

Browsing Forth

Forth has a strong following among embedded developers. There are a couple of reasons for that. Almost any computer can run Forth, even very small CPUs that would be a poor candidate for running programs written in C, much less host a full-blown development environment. At its core, Forth is very simple. Parse a word, look the word up in a dictionary. The dictionary either points to some machine language code or some more Forth words. Arguments and other things are generally carried on a stack. A lot of higher-level Forth constructs can be expressed in Forth, so if your Forth system reaches a certain level of maturity, it can suddenly become very powerful if you have enough memory to absorb those definitions.

If you want to experiment with Forth, you probably want to start learning it on a PC. There are several you can install, including gForth (the GNU offering). But sometimes that’s a barrier to have to install some complex software just to kick the tires on a system.

We have all kinds of other applications running in browsers now, why not Forth? After all, the system is simple enough that writing Forth in Javascript should be easy as pie. [Brendanator] did just that and even enhanced Forth to allow interoperability with Javascript. The code is on GitHub, but the real interesting part is that you can open a Web browser and use Forth.

Continue reading “Browsing Forth”

Open-Source Parametric CAD In Your Browser

Until recently, computer-aided design (CAD) software was really only used by engineering companies who could afford to pay thousands of dollars a year per license. The available software, while very powerful, had a very high learning curve and took a lot of training and experience to master. But, with the rise of hobbyist 3D printing, a number of much more simple CAD programs became available.

While these programs certainly helped makers get into 3D modeling, most had serious limitations. Only a few have been truly open-source, and even fewer have been both open-source and parametric. Parametric CAD allows you to create 3D models based on a series of parameters, such as defining a cube by its origin and dimensions. This is in contrast to sculpting style 3D modeling software, which is controlled much more visually. The benefit of parametric modeling is that parameters can be changed later, and the model can be updated on the fly. Features can also be defined mathematically, so that they change in relation to each other.

While still in its infancy, JS.Sketcher is seeking to fill that niche. It is 100% open-source, runs in your browser using only JavaScript, and is fully parametric (with both constraints and editable dimensions). At this time, available features are still pretty limited and simple. You can: extrude/cut, revolve, shell, and do boolean operations with solids. More advanced features aren’t available yet, but hopefully will be added in the future.

Continue reading “Open-Source Parametric CAD In Your Browser”

Web Matrix Control Proves Power Of ESP8266

LED matrix projects are all over the place, but this one is interesting for its simplicity: it’s an LED matrix that is driven straight from an ESP8266 board. [Ray] put it together as a quick project for his students to teach the basics of LED programming.

It’s built using a WS2812 LED matrix board he designed himself and his own ESPToy ESP8266 dev board. But the gist of the hardware is simply an ESP8266 and some WS2812’s. Where this gets interesting is with the user interaction side of things. The ESP makes WiFi and web serving easy, and [Ray] has build a simple HTTP GET API into the firmware. This is a great combination for the web dashboard and JavaScript-based animation programs [Ray] is demonstrating in the video below.

Just get on the same network and load up the module’s WiFi address for a graphical representation of the 5×7 LED matrix. Pick a color, turn pixels on or off, or choose a predefined pattern and send it to the hardware. This is a powerful way to get use input and with this as a guide it’s fast to set up for pretty much an application you can think of. Just work your way through the documents he put together for the workshop (Zip file link), including all of the code and the slides he used to run the workshop.

Continue reading “Web Matrix Control Proves Power Of ESP8266”

Running LISP On An ESP8266

LISP is a polarizing language. Either you love it or you hate it. But we’ll put aside our personal preferences to bring you a good hack. In this case a LISP environment running on an ESP8266. [Dmitry] is on the “love it” side of the fence — he’s been waiting for an excuse to code up a LISP interpreter for a while, and he found one in the ESP8266.

there-is-always-a-way-2Actually, [Dmitry] is running LISP inside JavaScript, which is itself presumably coded up in C, before it’s assembled to run on an ESP8266. (It’s turtles all the way down!) This means that he can piggy-back on JavaScript’s garbage collection and console handling and so on. After picking a suitably small LISP implementation (actually a Scheme dialect for those of you who know the difference), he went to work.

One weekend bled into the next, but he got the system running, connected to the network, and had LEDs blinking! In the end, he even managed to squeeze in some optimization for memory’s sake. Pretty cool, and because it takes advantage of an already complete system, it can even be made pretty useful. Not bad for a few weekends’ work!

And finally, if Lots of Irritating Silly Parentheses is your idea of a good time, but the wealth of computing resources available on an ESP8266 seem overkill, have a look at Microlisp, running on an AVR. Or go to the opposite extreme, and run a LISP OS on a Raspberry Pi. Whatever you do, don’t forget to close your parentheses! (We’re told that’s a traditional LISPer farewell.)