peg-trees and you

Posted by s.f. on June 11, 2009

Recently at work, I needed to parse ugly data files from an ancient classified-ads database that a predecessor devoted an entire Ruby application to. While painstakingly building regexes, I remembered looking at Treetop a few months ago.

Treetop is a Ruby library for writing Parsing expression grammars. PEGs are another way of constructing grammars and could be thought of as super-regexes: they don’t allow left-lookup or ambiguity in the parse tree, making them not so useful for natural language but killer for computer languages. Around 40 lines of code and 7 rules took the place of what the original author devoted dedicated tempfiles and regex arrow code to.

That being said, PEGs are conceptually harder to get grips on, and Treetop’s documentation is not entirely clear on some hangups you might find. Most of which you can solve using the excellent mailing list, but I know I wished during the past few days that I could get it summed up for me.
Continue reading…

live a live (a-go-go)

Posted by s.f. on May 17, 2009

I’m flattered that the previous article has been showing up in a few blogs and forums. Interestingly, it’s being used as an insight for newbies into VO:OT’s movement schema, and in one case an entertaining dismissal of the non-explanatory bits as “hardcore religious twinstick nonsense” :D

I’m still planning on adapting my Saturn sticks, as an opportunity to improve my hardware-hacking skills by building a Universal PCB adapter. Progress and pics on this to follow as things are developed.

As can be seen in the sidebar, I’ve acquired both an Xbox 360 and a Live account, and have been well pleased by the VO:OT 5.66 port. While using the 360 pad has crippled my quick-step reflexes(for now), it’s forced me to use more long-range characters that I haven’t made a habit of playing. This in turn has exposed some longstanding bad habits in my play style: repeated side-to-forward Watari dashing and constant rushdown attempts. It helps that there’s a lot of good Japanese players hanging around, and willing to school you without trash-talking or ragequitting.

So in spite of my noting of VOOT’s design dependency on sticks, don’t let that stop you from joining in! If you’ve ever played any Virtual On game and come away pleased, or if you’re looking for a grueling-yet-rewarding learning curve, this is an excellent time to start. The VO community is breathing again and it’s always a good day to SELECT YOUR VIRTUAROID and GET READY.

Two Sticks of Fury 7

Posted by s.f. on March 13, 2009

The upcoming re-release of Cyber Troopers: Virtual On Oratorio Tangram(lovingly abbreviated as “VOOT”) has begun a revitalizing of a long-dormant community.
However, the unique control system for Oratorio Tangram(or OraTan for the short-short abbreviation) may not be ported over and I wanted to explain exactly how two digital sticks are the very heart and soul of Virtual On.
Continue reading…

reeses or tabasco?

Posted by s.f. on December 29, 2008

Everybody’s talking about it. Couple of days in jail, whole town changes, etc.

There are two camps over this currently: the Rails side(”Whoo! Chocolate in my peanut-butter! Less magic and plugins that don’t explode randomly between versions!”), and the Merb side(”DHH is going to defenestrate us all! They won’t taste great! These books from the tech section are out-of-date six months earlier than usual!”

I’m mostly in the Rails camp(due to work), with a little of the Merb camp. It would be nice to keep them existing as separate frameworks, if only because of the other elephant in the room: the Rails-branding(read: money) and need to provide splashdown points for decamping Java webapp programmers. However, the Merb team seems to think this won’t be an issue, so I’ll reserve judgment for when the behemoth finally appears.

In any case, the fact that DHH and the Rails team are willing to adopt formal APIs, clearly define module boundaries, and leave monkey-patching behind is a welcome sign.

a huge beanie is approaching fast 1

Posted by s.f. on November 25, 2008

In Rails, one form helper(well, besides a broken date_select) stands alone as cruel, sadistic, and impossible-to-please with just a simple hash. That form helper’s name: option_groups_from_collection_for_select.

It’s so painful that most people would re-implement it, rather than fall victim to its NoMethodError wails. But that’s not the path for us. When you’re using something like Base Without Table to clean up your email contact forms, you don’t have time to mess around with o_g_f_c_f_s’ hunger for has_many. That’s when you pull out OpenStruct, and cleave the beast in twain.
Continue reading…

tl; dr

Posted by s.f. on November 23, 2008

Echo-chamber-driven Internet Drama on the rise in the Ruby community. Again.

Giles Bowkett:
original, followup, self-flagellation

_why’s sum-up and thoughts.

Zed’s response to _why’s mention.

_why fires back.

Can we skip this and go straight to the Yo Momma Fight? Loser gets Force-chucked into experts-exchange.com!

in honor of comrade petrov

Posted by s.f. on September 26, 2008

As Charlie Stross has noted Stanislav Petrov bent the rules and prevented a nuclear exchange at the nadir of the Cold War 25 years ago today. He ended up losing his job and pension over it, and still doesn’t consider himself a hero.


Two years ago, I was eagerly awaiting DEFCON to have fun destroying the world with other people online. After viewing a gameplay sample on YouTube, I idly clicked on a related-video, which happened to be the attack scene from Threads. I followed that up with a chaser of a music video using a Yo La Tengo cover of Sun Ra’s “Nuclear War”.
I got maybe three hours of sleep that night, and had shivering nightmares during all three of them. I haven’t played DEFCON or even looked at it since.


I’ve never been sure if it was revulsion over what it would actually be like, or repressed childhood memories from listening to adults in the early eighties. But along with Charlie and the rest, I’m raising a glass to Comrade Petrov. How about you?

the latest flash game site

Posted by s.f. on September 17, 2008

WAR Defense

It’s got a nice “lobby room” soundtrack playing, a slick “killer robot arm” that simulates tracking on the reader, menus about the latest weapons and events in the game and–
oh, wait: it’s a serious website, intended to fill “the coming need of defenses against autonomous military robots”.

The most tantalizing parts are the “Tools” and “Services” menus, which “require authorization with your key card for access”. Yes, that ubiquitous keycard we all carry, savior of heroes like Solid Snake and..wait, what?

Ooh, I see. Started by a teenage dot-com billionaire, responsible for such amazing innovative sites such as “tracking your own personal timeline”, “environmentally-green plumbers”, and the “post over IP protocol”(enabling one to send snailmail..over the INTERNET).
Truly another excellent addition to the pantheon.

(Found via El Reg, of course)

Builder, indentation, and namespaces

Posted by s.f. on September 04, 2008

Builder is a neat piece of kit but, like most sane libraries, wasn’t designed around the brain-damage that is Business-dialect XML(chock full of custom namespaces and tags devoted solely to attributes).

Builder’s docs seem to imply that a namespaced tag always needs to be in block form:

xml.bqcm :UselessMetadata {|n| n<< "flue"}

or

xml.bqcm :UselessMetadata do xml.text!("flue") end

But you’ll end up with wonky indenting because Builder is sensibly expecting that you should take care of the whitespace yourself when using this form:

<bqcm:UselessMetadata>
flue
</bqcm:UselessMetadata>

The clean way to do it is giving the symbol as the first argument:

xml.bqcm(:UselessMetadata, "flue")

which provides:

<bqcm:UselessMetadata>flue</bqcm:UselessMetadata>

EDIT(2:18pm)
“But what if I have attributes AND a simple text value?”
Just make sure the attributes are sent in an explicit hash as the second parameter:

xml.bqcm(:UselessMetadata, {:QuestionableAttribute=>"chimney"}, "flue")

“I still want to send my text like I was doing, and I want proper indenting NOW NOW NOW”
Fair enough:


xml.bqcm :UselessMetadata do
xml.__send__ :_indent
xml.text!("flue")
xml.__send__ :_newline
end

Oh, for hell’s sake

Posted by s.f. on July 02, 2008

I don’t care if you’re a small-time European publisher. It is the year 2008, I hereby decree the following trends of Windows PC games(specifically, demos and installers)to be idiotic:

1. Requiring an Administrator to install. I’m in no hurry to upgrade to Vista, but it rightly points out that There Is No Excuse for requiring root privileges to create a new folder and stick a few settings into the registry. I don’t care if the “amazing” installer software cost you a pretty penny, or if you absolutely need DRM somehow on a demo package. It took me maybe a night or two to learn how to use WiX. Now you have a Microsoft-approved installer that will absolutely do the right thing if you can manage to enter a few XML values correctly.

2. Not publishing CRCs or MD5s of the complete file. Considering all the hoops to jump through, “custom download managers”, and lack of BitTorrent on the big sites, it’s really really easy to get a corrupted file, and the only way to confirm is..download it again from somewhere else.

3. Repackaging installers — I’m looking at you, Manifesto and GamersHell, specifically. Relating to #2, now I don’t even know if you repackaged the developer-provided installer correctly if your funky add-on throws out “MainGame.lib corrupted. Abort/Retry/Ignore?” (and I’m not kidding, have we traveled back to DOS days?).

Someone is probably thinking “just use a torrent hub”. Unfortunately, I’ve had a hankering for checking out obscure space-sims like Starshatter or Space Interceptor, and no torrent sites(in Space Interceptor’s case, not even the original publisher) are keeping the files around.

Not that I complain too much about a corrupted download from Gamershell keeping me from enjoying the majesty of Tarr Chronicles. But I still haven’t found a working demo for Sector 13, and I’ve actually been looking forward to that one.