Oatmeal

A digital pillow fort

A quick and dirty intro to the .pbm file format

I’ve been fiddling with writing programs that draw pictures. I started with PostScript for this, but have since moved to writing programs that output in the .pbm format.

My goal here is to write noise to a .pbm file.

A .pbm file is the lowest common denominator among image file formats.

An example of the format,

P1
# comment describing the file 

5 5
1 0 1 0 1
0 1 0 1 0
1 0 1 0 1
0 1 0 1 0
1 0 1 0 1

The first line is a required magic number, the next a comment.

Then comes a blank line, followed by declaration of height and width.

Last but not least is the image data, where 1 is a black pixel and 0 is white/blank.

The most fun part of this exercise comes from a suggestion from crc, the main developer behind RetroForth, and allows for the writing of all the data to the file in one go by using c:puts hook. For more context, see here. For more on hooks, see this excellent blog post from a friend!

'output.pbm file:open-for-writing 'PBM-Target var-n

:c:to-file [ @PBM-Target file:write ] &c:put set-hook ;
:c:to-display &c:put unhook ;

Next I whip out my trusty word that returns a random number within a range.

:n:ranged-random
    (lower,upper-random)
    over - n:inc n:random swap mod + ;

Next comes some housekeeping, defining the width and height the file will be. Of note, I’m not sure if these integers are referencing pixels, printer points, or just like blocks or something…

#100 !w
#100 !h

Last but not least comes the (veggie)meat of the thing: we open a file for writing into, define the body to be written into the file, and then spew it all into the file. Last but not least we display a string to let us know everything is Done.

c:to-file
'P1 s:put nl
'#_sample_pbm_file_made_from_retro s:put nl nl
@h '_ @w n:put s:put n:put nl
@h [ @w [ #0 #1 n:ranged-random n:put '_ s:put ] times nl ] times nl
c:to-display

'Done s:put nl
@PBM-Target file:close

An example .pbm file, converted to png

With this as a basis, I’m excited to start putting together more complicated patterns.

How to make form fillable PDFs with Markdown and LaTeX

Here is a quick guide I pulled together this morning that explains how I use Pandoc to make really simple form fillable PDFs.

Nothing gorgeous, but a useful trick if you are ever in a pinch and need a fillable PDF fast.

Site updates, and some tips for navigating this website

Eagle-eyed folks may have noticed that I made a few wee changes to this website.

The biggest, and most noticeable one is that I’ve filtered out all of the like type posts from appearing on the main feed, from rss, and in the archives. There were waaaaay to many, so filtering them out makes the entire website a lot more navigable. They are not gone, though, and I’ll probably keep sharing like type posts, but now they are something you can opt in or out of. To see em:

Furthermore, and this isn’t actually new, but I feel I may as well point it out again, there is an rss feed specific to any and every tag used on the site! You can find those tag-specific rss feeds on the tag pages under the title that says Tagged SomeTagName,” by clicking the Follow Tag” link. Here is an example of one of those pages, and here is an example of one of those feeds.

As always, you can also search the site, or peruse the massive collection of tags (I should probably prune those down a bit, eh?).

In reply to: On Learning Smalltalk

I feel like it took me a bit longer to fully understand how to work in Smalltalk than it did most languages. The IDE is different than anything I’ve used before, and probably anything you’ve seen as well. You’re not going to be opening myscript.st in your favorite text editor, and then run it from the command line as you would a Python program. It takes a little mental adjustment to start with.

That’s not the warning, however.

The warning is that once you delve into Smalltalk, you might not want to program in anything else ever again. It’s really that good.

I think this is my curse. I touched Smalltalk at a young age, and, ever since, nothing has felt right,” or complete,” in the same way.

Forth is getting close, though, and a lisp or scheme with a tight repl is also pretty wonderful…but Smalltalk defo does you dirty by being so phenomenal. Xcode is a flaming, festering pile of total and complete garbage by comparison. My wish whenever I touch Xcode or Android Studio (which I do daily for work), is that the folks behind such tooling spend just 1 week using a Smalltalk system like Squeak or Pharo to see how much better it could be.

A guy in a big coat, winter hat, and a back pack holds a toddler while standing next to a six year old. They are all looking at a model train set in a window.

Forth, a tool for cultivating community

I watch most of the recordings of the Forth2020’s Zoom chats. A topic that comes up from time to time is how to get more folks interested in Forth — especially younger folks. In my weird little corner of the internet I can say that there are certainly young folks interested in Forth!

I wonder if the issue at play is less one of interest, and more one of cross communication between these communities? From what I’ve gleaned, what I’d call the old guard” of Forth meets up pretty regularly over Zoom, and does a lot of organizing on Facebook. The younger folks I know who are interested in Forth aren’t on Facebook, and, at least speaking for myself here, don’t have time to make a Zoom call — I do watch most of the recordings though.

I think another aspect of Forth not being seen as more viable to many folks is a quirk of history — there is no technical reason that Forth couldn’t be used more widely in spaces other than embedded programming, but, because of its long history and its ease of use in embedded systems, most of the old guard seem to be focused on embedded programming.

In both my career as a programmer, and in my free time, I’ve had very little exposure to embedded programming; I’m interested in it, but struggle to even conceptualize what sort of stuff I’d do in that setting. My background is in web and app development. When I dream-up hobby projects they’re always informed by what I already know how to do — games, web development, and mobile apps…I always want to reach for Forth for these sorts of projects, but, so far, I’ve struggled to find a Forth system that is particularly well suited for these spaces.

Now, I know that I could probably make my own Forth system (part of the beauty of Forth is how approachable it is to implement) that is a bit more suited for these other scenarios…but…I don’t know…so far I haven’t cracked that nut (but I’ve tried).

With this post I’m not looking to necessarily solve” anything, but I’d love to start to explore ways to bridge the gap between Forth’s old guard and the younger enthusiasts like me, looking to do more with Forth. I think the tools to bridge this gap are of two flavors: social, as well as technical. On the technical side I am curious to explore Forth’s Clojure moment” — a way of leveraging packages and tooling from a more widely used language, but taking advantage of Forth’s expressiveness. On the social-side of things I … am a broken record … and always want to return to something like mentorship or apprenticeship, but, as a stepping stone towards that sort of model I wonder about a space that is equally as accessible to both Forth’s old guard as well as younger folks, maybe a forum? A mailing list? A planet, a la Planet Lisp? All of these things may well exist, I just haven’t found em yet. If you have thoughts about any of this, I’d love to chat!

In reply to: The Whippet 137: Please don’t make me fight a fire ant

It’s named after Texan exterminator Tom Rasberry, but you can call it a Raspberry Crazy Ant if you want and no one will notice I bet.

The Raspberry Crazy Ant, for some reason, loves electronics, so it will come and chew through wires and get electrocuted. When an ant dies, it releases an alarm pheromone which makes other ants rush to the scene of the crime,* which in turn causes more to be electrocuted, and if enough of them gather then it can short out electrical systems.

This is not why they’re called crazy ants’ by the way — that’s because they move in a darting, erratic way. But if the tiny shoe fits.

Star Wars, and a year in review

I tried to write a year in review kinda post, but it got wicked melodramatic pretty fast. This year has been a slog…it really fucking sucked.

Rather than reflect on it further, I thought I’d write about something vapid that I’ve been thinking a bit about lately instead: Star Wars.

Despite my best efforts, I’ve always loved Star Wars. As a child I spent hundreds of hours pouring over novels, and comics, and books of schematics. Star Wars was nearly always on my mind. The Star Wars that I fell in love with was pre-Diseny. The Disney stuff is fun, but, I think it is missing a key element that Lucas’ Star Wars always had in spades — blank space.

Lucas’ Star Wars is so full of blank spaces that a whole universe was able to grow into the gaps. The more that Lucas added to Star Wars, the more blank space there was. This is in juxtaposition to Disney’s Star Wars where the goal seems to be to fill every available blank space possible with moar content!


This last year has felt something similar — whereas in the before times I felt like there were blank spaces in my life to grow into, now I feel they are growing smaller and smaller. That possibilities are shrinking.

« Future Page 1 of 205 Past »