Processing and Racket

racket logoLately, I’ve been teaching myself the Racket programming language. It has a very interesting combination of tools, training-wheels-mode, and rocket-ship-mode. Originally built as a teaching programming language, it has significantly outgrown its pedagogical roots and is now a very robust applications language. I’m even developing a business project in it as we speak!

But it is a little rough around the edges. While it has a lot to make it a very easy language to learn, it is ultimately meant for computer scientists, those in training and those in working. There is an underlying feeling to everything that “this easy thing will eventually get harder.” As I see more and more inside the Racket community itself, I know that that is not their intention, and that they hope to be able to bring the joy of programming to everyone, regardless of their background.

processing banner

A tool that has brought the joy of programming to everyone has been Processing. Processing, in a round-about way, brought a lot of features of the Racket[1] environment to Java. There are some very, very clear parallels between the DrRacket programming environment and the Processing editor. If this was unintentional, then it at least clearly indicates the superiority of the form as a pedagogical tool, as two independent environments have both evolved the same feature. If it was intentional, then there are ways in presentation in which Processing has grown past Racket that I think could be brought back to Racket-land.

Racket and Processing

At a very high level, you can see the similarities between the DrRacket editor and the Processing editor. I have intentionally made the code samples different for each, as they represent more of the canonical methodology for each language[2].

A checkboard. Left: DrRacket. Right: Processing
A checkboard. Left: DrRacket. Right: Processing

As an artist with a very strong background in computer science, there are things about Racket that appeal to me that Processing will never be able to do[3]. There are things about Processing that are very awesome and very nice that Racket could do, if someone with a very strong background in computer science took the time to make it so.

Where Racket succeeds over Lisp and Scheme, and where Processing–and thus Java–succeeds over all, is that enough is provided for you to not require you to learn the more advanced language features to get good results. Racket calls it “batteries included”, and it is, I believe, the most important concept that Processing borrows from Racket. Beginners don’t want to learn about “public static void mains”; to this day I still don’t know why that garbage is so necessary.

My hope is to try to bring some of the batteries of Processing back to Racket. The potential is there for Racket to be every bit as popular with artists as Processing is, today. The things that it lacks in comparison to Processing are relatively trivial to develop, in relation to the things that Processing lacks in comparison to Racket. By bringing artists into the much more powerful environment of the Racket programming language, once they have mastered the fundamentals of programming with the training-wheels mode, Racket can be molded by artists, for artists, to let people think and program in ways that the programmer-artist chooses, not in ways that the original language designer chose for them. If there are two groups of people that I know hate being told how to think more than anyone, it’s artists and programmers.

I’d like to hear from the Hive76 readership, especially those who have experience with Processing (though all are welcome to comment), about what you like and don’t like about Processing, about programming, about art, about putting code down in text files, etc. This certainly applies to the Arduino crowd, as well, as Arduino is based on Processing. In the meantime, I have a few thoughts on where the work could begin.

Make the website prettier

First impressions are important, and most programming language websites are prettier than Racket’s. I would more readily crib from Ruby than from Processing here. Ruby’s website is very clean and concise, very inviting and pleasing. Everyone cares about taste, especially artists.

Racket’s website is built in Racket, with a sub-language called Scribble, specifically designed for building documents and documentation. It’s an excellent language, but its default styling is kind of ugly. Restyling the site is a low-hanging fruit that could bring in more people, if only because they don’t jump ship prematurely.

ugly

Make more dynamic examples for beginners

The Racket documentation has its heart in the right place, but ultimately feels like its drawing examples are just pat examples. The drawings aren’t very interesting and its not immediately obvious how one gets to more interesting things. See this page for an example. It’s easy to draw a smiley face in Racket, it’s much harder to draw a good looking smiley face. And before it becomes apparent, the documentation dives too quickly into the computer science topics thereafter. In contrast, Processing starts off with examples that are extremely visually compelling. As people are visual creatures by nature, this seems the superior methodology. Note that the Processing example is the introductory page to the documentation–one click off of the front page–whereas the Racket example is several pages into the documentation–two clicks and several screenfuls of scrolling off of the front page. Much more compelling examples in Racket are much more deeply hidden.

pat

 

Finally, make more artistic things with Racket

The Processing website is built around showcasing what people have done with Processing. While Racket’s package system can be considered the same thing, to a degree (and it is already in the process of getting better), it is again not as visually compelling. Racket needs an elevator pitch, a high level view that shows the answer to “what will you do with Racket?”.

what

 

Footnotes:

[1] Historical Note: Racket has been around since 1994, when it was originally called PLT Scheme. They figured they lost more people being immediately associated with Scheme and Lisp than they gained, so in 2010 they changed the name to underscore the fact that there is so much more to Racket than the name “Scheme” implies. Suffice to say, for beginners it doesn’t matter, other than knowing that their is history to the project and it isn’t going away anytime soon.

[2] There are problems in both examples; both are overly simplistic and both would not scale well for large applications. But the gist of the difference is there, Racket is about functions that define what we want to happen, Processing (because it is based on Java) is about instructions. The differences to the non computer scientist are difficult to explain, so for now you will just have to take my word for it that the former is a generalization of the latter and is therefore more robust and open for greater expressiveness.

[3] For the computer scientists reading, succinctly: macros. You either know what I mean or you don’t, this is not the place to get into a technical description of macros. For the non-computer scientists, the best analogy I can make is magic. Magic isn’t real in our world, but I can think of nothing that comes closer to resembling it than the massive productivity gains that macros can afford, once mastered. But neither is mastery of macros in Racket required to do great work. Processing is what happens to languages like Java that do not have macros. In Racket, something like Processing would stay a part of Racket and not be a separate project.

Getting Raspberry Pi to control your 3D Printer

We got some Raspberry Pis and began jumping through some tutorials. Adafruit has a particularly thorough and easy to follow series. We’ve had good luck with the Raspbian Wheezy distro and it works just like familiar Ubuntu since it’s based on Debian. Remember to run:
sudo apt-get update
sudo apt-get upgrade

upon first launch. That will make things a lot easier since the release is rather old by now.

I got some time to explore the Raspbian distro.

RaspberryPi-jmil

After seeing all of my efforts, Morfin couldn’t wait to give it a shot.

RaspberryPi-Morfin

Eventually we got my favorite light-weight print controller github.com/kliment/printrun running an active 3D print. It really was incredible to have a $40 computer connected to the interwebs and sending gcode with a full GUI over python->USB-serial. It’s a bit too slow for computational slicing, but would probably be GREAT for a bot-farm. Note that you should also use pianobar instead of full-blown pithos for pandora audio. Note that the audio worked great after we ran the apt-get upgrades mentioned above.

RaspberryPi-Desktop

And remember to grab our desktop background! It’s only 1.2 MB.

ShopBot as a 3D Printer: controlled by a RepRap RAMBo

suggested by Kliment via IRC (/ht), the way to have a heavy toolhead moving about in 3D with high speed AND precision is to modify a ShopBot instead of a Rostock. Recall, the Darwin suffered this design challenge which led to the Mendel.

With RAMBo bypassing the stock motherboard we can drive the ShopBot to scary speeds (10x faster in XY and 100x faster in Z.). Precision should also be ~10x better than belt-driven motion, but needs more fine tuning.

and did i mention it was freaking awesome?

My ShopBot RAMBo Marlin firmware branch is available via GitHub (of course). Follow along in the GitHub log to understand our process.

Thanks to ShopBot and Ultimachine for all your help and schematics!!

Render your next Logo Design

Blender, the awesome open-source do-everything model/rig/render/animate program continues to be an important part of my toolkit. The Artist Community is definitely a huge bonus. So check out this excellent tutorial over at BlenderGuru.com

So…I put Sean’s Harrow through it’s paces, and here are some of my newest desktop backgrounds.

First you get the basic render down. I use 32-bit color with OpenEXR file format, saving z-buffer info too, just, you know, in case you need it later. You should get something like this… kind of flat when viewed on a crappy computer screen, but i assure you there is a ton of color info there for fine tuning later.

Image0010-straight-away

With all that extra color depth, you can easily fine tune the contrast, like so.

Image0010-improved-contrast

Then you need to come up with the shadow version… Andrew Price from BlenderGuru does this in a new Scene. I like the stark contrast… when you look carefully the sharp edges tell you that you are looking at a perspective view.

Image0010-shadow-only

Put it all together, and you get a softly-back-lit Logo. WIN!

0010

DIY Music Night at Hive76

Making things to make music.
Making things to make music.

On Thursday April 25, our series of events for Philly Tech Week continues as we open our doors for DIY Music Night (5pm-???). If you’re into music, making music, or making things that make music, you won’t want to miss it! If you’ve been to the space before, you’ll know that we run on a steady diet of tunes. And on Thursday, we’ll have all our audio and music-centric projects out in what is sure to be the loudest night of PTW. Come by and see the space, make some amplified noise, hang out, or share your own projects.

We’ll have guitars, amps, synthesizers, sequencers, speakers, fuzzboxes, tremolo pedals, signal generators, oscillators, speakers, drum machines, pickups, karaoke machines and probably alot more – all made at Hive76.

Plus we’ll have a handful of contact microphones to give away! We’ll help you turn anything into an amplified electric instrument in 10 minutes flat.

PTW Open Hack Event 4/24

Arduino SynthCome one, come fifteen or so!

On Wednesday, April 24, Hive76 will be transforming our typical Wednesday open house into a special Tech Week Open Hack!

Over the years, we’ve managed to accumulate a plethora of electronic detritus, as one might expect from a hackerspace. We’d love to invite you to come to our space and help us clean it put the junk to good use! We’ll have some microcontrollers on hand and several members around to help you along your way. The idea is to split attendees out into workgroups that will concentrate on designing and building objects from parts we have available for you at the space! Wanna throw together a bot that responds to table tapping? How about something that plays like a musical instrument? Dig making LEDs respond to external stimuli? Just wanna learn how some of these things might be possible? Slightly annoyed with how often I ask questions in my posts? 😉

—Please bring a laptop along if you have one available. Some programming experience is a plus, but definitely not necessary.—

Wednesday 4/24 5pm – 10
Gratis and Libre (free)

Hive76, suite 519 915
Spring Garden St
Philadelphia PA 19123

RSVP by commenting below.

***ALSO: If you haven’t been to Hive76 and want to see what we’re about, stop by on Monday April 8th for our Monthly Monday Microcontroller Madness (7-10PM) or on any (other) Wednesday night for our weekly open houses (7-11PM)***

Illustrator to OpenSCAD to 3D printing

For Philly Tech Week, I will be showing visitors how to take a shape from Adobe Illustrator into the popular open source CAD program OpenSCAD and make a 3D model suitable for 3D printing.

Draw in Illustrator, extruded in OpenSCAD
Draw in Illustrator, extruded in OpenSCAD

I’m sure you know Illustrator. It’s the most successful vector drawing program <clarkson>in the world.</clarkson> OpenSCAD is less well known. It is best described as coding for objects. You make a solid with the function cube() and cut a cylinder() out of it with the difference() function, etc. But sometimes you want a more organic or complicated shape to start with. That’s where artist JK Keller stepped in and made a script that automates some of the process for you. What you need for this workshop:

There may not be time to print everyone’s design, but you should go home with something 3D printed.

Monday 4/22 5pm – 10
Gratis and Libre (free)

Hive76, suite 519
915 Spring Garden St
Philadelphia PA 19123

RSVP by commenting below.

Fighting Robot Night at Hive76!

On Tuesday April 23, Hive76 will be hosting Fighting Robot Night as part of our week-long celebration of Philly Tech Week. We will have four miniature remote-controlled robots designed to battle one another in a table-top arena. All are welcome and all are invited!

Show up Tuesday and sign up for a spot to drive and fight, or just hang out and watch the destruction. Ask questions, check out our space and get your robot rocks off. This will also be a preview of an upcoming fighting robot class to be offered at Hive in which participants will build machines similar to those featured at Fighting Robot Night (TBA, check back soon!).

In the meantime, here’s some old Battlebots videos to get you excited.

Guitar Stuff at Hive

031713150944

Last year, I purchased a 1970 Telecaster copy for $120 from Elderly Instruments. The frets were no good and much of the hardware was corroded, so it seemed like a good instrument to hone my repair skills on.

The first thing I did was take it to Hive and bounced ideas around with some folks. One thing I really love is that no matter what kind of project or idea you’ve got, there’s at least one or two people at an open house who have some expertise to share. Continue reading “Guitar Stuff at Hive”

Kthxbye!

kthxbye
kthxbye

 

Well everyone, so long, and thanks for all the fission reactors. I’ve moved to Alexandria, VA, to be with m’lady, plan our wedding, start a doggy dating website with some folks, and maybe spread the joy of hackerspaces a little further south. Step 1) figure out the joy of hackerspaces.

It’s a bittersweet change, as I am really going to miss Hive76 and her amazing people. You all taught me a lot and I will forever hold it all in my heart with great appreciation.

I’m not disappearing completely. You will still receive the occasional displeasure of reading some new, overly-verbose, trying-too-hard rambling from me on the listserv and in this blog. I plan on visiting on occasion as well. But regardless, here are a few of those things that I learned thanks to Hive76:

  • Everything is permitted. There is an avenue for doing just about anything. Don’t let the fact that you’ve never done something before prevent you from doing it now. Don’t ask permission to do it, either. People ask permission to do things in a lot of different ways. They stall the doing by looking for a job in what they want to do, waiting for an employer to give them permission. They research the “best” way to do something, asking questions of everyone around them, never actually just giving it a try. Someone will show up in your life with a need for help and you can help them by just saying, “I bet I can do that”, without knowing for sure if it is so. You win some, you lose some, hence it is a bet, but you always learn something, and that’s almost as good as winning.
  • Anything is possible. If you put your mind to it you’re capable of just about anything. Things you could never imagine will happen if you just try. Like having a piece of art put into a museum. Or meeting a legend of technology. Or just plain making the block clean for a change. “Luck is what happens when preparation meets opportunity”. A place like Hive can help you always be prepared for the opportunities that inevitably come our way.
  • It’s okay to do stupid things. Actually, it’s even preferable. We are too serious on most occasions. Having a habit of doing things just to see them done–things that have no inherent value of their own, beyond any spectacle they may bring–is pretty much the only way new discoveries are made; certainly the important ones. Without time for play, there is no art. Without art, there is no culture. Without culture, there is no language, no nation, no city, no people.
  • Don’t ever let anyone tell you what is right. Not a boss. Not a friend. Not your parents. Not a single person. You have to decide, and you have to get good at deciding, because half of the people out there are wrong and it’s on you to figure which half. Depending on what it is, more than half of everyone is wrong. There aren’t many places where less than half of everyone is wrong. So get good at deciding what is wrong and then trying new things to try not to be wrong. But absolutely, most importantly, respect everyone else’s path to figuring out how not to be wrong, because if you try to tell them you’re right, you’re probably wrong.

I’m stopping at 4 because it’s not wrong to stop at 4 and I’m also tired of typing for the day. Don’t forget to check out Hive76’s Open Houses on Wednesdays at 7pm. I understand they have an opening for memberships now.