Negative Space: programming
- 42 Astoundingly Useful Scripts and Automations for the Macintosh
- MacOS uses Perl, Python, AppleScript, and Automator and you can write scripts in all of these. Build a talking alarm. Roll dice. Preflight your social media comments. Play music and create ASCII art. Get your retro on and bring your Macintosh into the world of tomorrow with 42 Astoundingly Useful Scripts and Automations for the Macintosh!
- All roads lead up
- Whatever happened to programming? It became more interesting.
- Converting HTML lists to text on the fly
- Switching to using lists to display code was a compromise between readability and copyability. Now that I’m creating the lists on the fly, it is easy to add features that reduce the side effects of this compromise.
- Declarations: Declaring Objects and Values
-
Use declarations to create ‘template’ objects and values that can be re-used.
- Directives
-
Use directives to control your scene through the POV scripting language’s special commands and functions.
- Doubling down on failure
- What happens when software fails is often not a programming issue. It’s a policy issue, and someone needs to make a decision on what the policy will be. The same is true in politics. Saying that failure is not an option, and ignoring all signs of failure because “failure is not an option”… often ensures it.
- Excerpting partial XHTML using minidom
- You can use xml.dom.minidom to parse partial XHTML as long as you use a few tricks and don’t mind that getElementById doesn’t work.
- Functions
-
POV-Ray contains several built-in mathematical and text functions that you can use to control your scene.
- Hacks
- Articles about programming in Python, Perl, Swift, BASIC, and whatever else I happen to feel like hacking at.
- HotPaw Basic on iOS
-
Looks like there’s a minor renaissance in programming languages on the iPhone and iPad. HotPaw BASIC is one of the first.
- Lists
- The simplest way of passing data in Apple Events is the AEList: it’s a list of values.
- Macros
-
Macros can centralize the writing of similar lines of your POV scene.
- Murky for Mercurial
-
Murky makes a great front-end to Mercurial for personal projects, including not just programming projects, but CSS and HTML. Anything text-oriented and line-based.
- Negative Space Collection
-
The Negative Space Collection was a collection of Perl scripts and Applescripts to make maintaining a web site a little easier on a Macintosh.
- Omni’s Jobs of the Future from 1985
-
What Omni’s popular science writers saw as the jobs of tomorrow thirty years ago.
- Paging Reed Richards: Stay in the Null Zone with Priceline!
-
Hah. I realize that there isn’t a heck of a lot around Pecos, Texas, but I’m still a little curious how a NULL got through both the town and the state field—and who stayed there to give it 2.5 stars?
- POV is Trig
-
If you understand triangles and their functions, you can more easily determine where rotated objects end up. Use trigonometry to calculate lengths when you rotate objects in Persistence of Vision.
- Programming Cron Scripts
- You will probably also find Cron useful for controlling some of these scripts. You might even want to program your own Cron-able Applescripts.
- Records
- An AERecord is kind of like a database row: it contains fields and values; the field names end up getting an arbitrary code when you compile your script.
- Regular Expressions
- Regular Expressions for use with the FB Osax, Perl, and other parts of Unix or the Macintosh.
- Roll a ball down an incline at a constant speed
-
Roll a ball down at a constant speed. How high is it at any point?
- Roll a ball down an incline with acceleration
- Roll a ball down due to gravity. How far across has it gone at any height?
- Rotate a bar and determine its new endpoint
-
Rotate a bar up and how high is it? How far has the leftmost side moved to the right?
- Scripting Persistence of Vision
-
POV’s built-in scripting feature allows you to both simplify your scene creation and make much more complex scenes. Using scripting to make complex and redundant three dimensional objects.
- Styled Text
- Some text can be styled. I have no idea how to extract the style information, but the text is easy, because it is kept separate from the style info.
- Thinking Python: Django cache expiration time
- Django sets the expiration time when data is cached. Sometimes it makes more sense to expire data dynamically based on later changes to the database. Does this mean a change to CacheClass? Not necessarily.
- Time is not fungible for writers
-
Time isn’t fungible for writers; it’s not really fungible for anyone else, either. Time stolen can never be regained, because many of the things that would have been created during that time are lost forever.
- Using Apple Events in Osaxen
- How to decode Apple Events in Applescript scripting additions.
- Using MailShare: How to Queue Files up for AIMS
- Using MailShare, Apple Internet Mail Server, or possibly Eudora Internet Mail Server, to queue up files to go out by Applescript.
- Using the color picker in Inkscape extensions
- It was pretty easy, looking at the built-in extensions, to switch colors from one to another if I wanted to type their values by hand. But using the color parameter type took a bit of sleuthing.
- Write an Inkscape extension: create multiple duplicates
- Once you get past the complete lack of simple real-world examples, it’s pretty easy to make Inkscape extensions. So, here’s a simple real-world example.
More Information
- 42 Astoundingly Useful Scripts and Automations for the Macintosh (ebook)
-
If you have a Macintosh and you want to get your retro on, take a look at 42 Astoundingly Useful Scripts and Automations for the Macintosh. These modern scripts will help you work faster and more reliably, and inspire your own custom scripts for your own workflow. (Jerry Stratton)
- Xcode
-
This is the premiere programming package for Mac OS X, and it comes with every Mac. Xcode allows you to program in Objective C, C, C++, AppleScript, and Java. Groups are working on integrating other languages such as Python, Perl, Ada, and Pascal.