A challenge!
30 minutes ago, I got this comment on my Ruboto on Acid post:
LSD makes letters on a computer screen look as if they’re dancing around and have a mind of their own. It’s also entirely impossible to think logically enough to code while on it. I recommend you buy some acid and see how it’s nothing like this at all. ;)
And here is my answer. :)
#!/usr/bin/env ruby
require 'rubyonacid/factories/example'
require 'tk'
#This factory will be in charge of all drawing coordinates, colors, etc.
f = RubyOnAcid::ExampleFactory.new
#A skip factory, in charge of randomly resetting the meta factory.
resetter = RubyOnAcid::SkipFactory.new(:odds => 0.99)
#The window to draw to.
canvas = TkCanvas.new(:width => 400, :height => 400)
canvas.pack
#The line objects we create will be stored here.
shapes = []
letters = "woah, trippy, dude!".split(//)
#Create a thread to update the window while it's displayed.
Thread.abort_on_exception = true
Thread.new do
loop do
#Get red, green, and blue values for a color from the factory.
#Format is #RRGGBB in hexadecimal (like HTML).
color = sprintf("#%02x%02x%02x",
f.get(:red, :max => 254).to_i,
f.get(:green, :max => 254).to_i,
f.get(:blue, :max => 254).to_i
)
#Create and store a line of the chosen color.
#Get width and locations of the endpoints from the factory.
shapes << TkcText.new(
canvas,
f.get(:x1, :max => 400),
f.get(:y1, :max => 400),
:text => f.choose(:text, letters),
:font => TkFont.new(
:size => f.get(:size, :min => 1, :max => 72).to_i,
),
:fill => color
)
#If the resetter returns true, tell the ExampleFactory to reassign
#its source factories to different keys.
f.reset_assignments if resetter.boolean(:reset)
#Delete the oldest line if we have accumulated too many.
shapes.shift.delete if shapes.length > letters.length
end
end
#Display the window.
canvas.mainloop
MP3 conversions of Ruby conference videos...
I’ve got a sizable commute, so I’ve taken to downloading conference videos and converting to MP3 to play in the car. Most work reasonably well as speech-only, I’m finding. In hopes of helping others, I’m posting them here.
Many thanks to Confreaks, the conference organizers, and to the generous speakers, who released their speeches under a Creative Commons license. In accordance with the license of the original videos, these MP3s are also released under a Creative Commons Attribution-ShareAlike license.
Download MP3 conversions of Confreaks conference videos here.
You can automatically download the lot with wget if you have it installed:
wget --recursive --no-parent --accept mp3,ogg,MP3,OGG http://jay.mcgavren.com/files/conference_mp3s
Conversions were done with ffmpeg. Here’s the script I used:
#!/bin/sh for filename; do ffmpeg -i "${filename}" -acodec libmp3lame -ab 96k -ac 2 -ar 44100 "${filename}.mp3" done
My chief complaint was wild variation in volume levels; I haven’t blown a speaker yet but loud noises have made me jump sometimes. I’ve processed all these with “mp3gain” (which I thought was only available as a Windows GUI app but have since learned has a Linux command-line version) in an effort to correct this, but I make no guarantees there won’t be sudden jumps or drops in volume.
Many tweaks are still possible, and I will look into them if there’s demand:
- Remove the periods of silence on each track (where Confreaks originally showed sponsor logos).
- Convert remaining videos (these were hand-picked).
- Lower-bitrate versions for the space-conscious.
- See if The Levelator produces better results than mp3gain.
- ID3 tags with speakers, titles, and other metadata.
- An actual podcast feed.
Enjoy, and leave a comment with the improvements you’d like to see!
Read more...Legal fallout...
Uh, oh, I may have exposed myself to significant legal liability. I haven’t included a section like this in the license for any of my software releases…
Read more...You acknowledge that this software is not designed, licensed or intended for use in the design, construction, operation or maintenance of any nuclear facility.
–License agreement for a java.net library
Ruboto On Acid...
After dissecting the demos that come with Ruboto 0.2 and figuring out how to upload a library and runner script to an Android emulator (hint: “$ adb push . /sdcard/jruby/subdirname”), it only took an hour or so to create a working Ruby On Acid demo. And what worked on the emulator immediately worked when uploaded to the phone.
Read more...This reads like science fiction:
Read more...So to turn on GPS for the first time, go outside and find a direct line of sight to the sky (you only need to do this the very first time). Then on your phone, press > Settings > Location & security.
–Motorola Droid Tips and Tricks manual