prog: (monkey)
Larry Wall, creator of Perl, is giving two free-and-open-to-the-public talks in Cambridge next week:

• Harvard, March 31, 5:30pm, Science D

• MIT, April 1, 4:30pm, room 34-101

According to the Boston.pm mailing list, the MIT talk will be on "Ballstic Programming", and the Harvard talk might be the same but nobody is totally sure.

I lean towards the Harvard one coz it's closer to me, but could go to either. Anyone want to join?
prog: (monkey)
I've been using Subversion since 2005 or so, and do not knowingly find it lacking in any particular way.

Should I care about Git? All I know about Git so far is that "everyone" is suddenly using it.
I've completed Project X's logic library to my satisfaction, and have begun to figure out how the UI's gonna work. All my recent game-UI experience has involved working with raw SVG directives, so it's interesting to approach a modern high-level game programming API with that oddball background. Creating sprites by plotting rectangles directly onto the screen is quite familiar. Less so is how they all insist on being pointed to on-disk bitmap image files which they can then paint onto themselves. So I'm going to spend some time in graphics programs generating some artwork, before jumping back into the code. Lots of scanning to do, in this case...

Yes, I think I can get away with entirely 2D graphics for this game. Certainly for the prototype, anyway, and that's all that matters for now. Sadly, even the latest beta of VMWare still can't let Windows take full power of my MacBook's graphics card, so I'm going to have to go back to rebooting into Windows every time I want to do work on X from now on... boo. At least until I get local access to a halfway decent PC, a sub-project that is indeed underway. (Have decided to pass on the rar-rar gaming rig that [livejournal.com profile] mr_choronzon advised me on, for now. Cheaper options have arisen.)



Still moving on August 1, and the traffic of strangers tromping through my apartment is getting a little ridiculous. Especially when they have a less than perfect hit-rate for warning me ahead of time. I accidentally opened my front door into the face of a rental agent as I entered my own apartment this evening, returning from a ten-minute coffee break. Apologies exchanged, and now I've learned that I'm getting at least three separate visits tomorrow!

I've had plenty of these sorts visitors already, over the last couple of weeks, but the rate's getting nuts now. I'm going to straighten the place up some tonight. At first I didn't care if lookers-at found it messy, but I'm quickly wishing that someone please hurry up and find it attractive enough to sign for, so they'll all leave me alone!



I have once again downgraded my cellphone. The normally tolerable Sony Ericsson that I got in 2004 "candy bar" has a loose antenna or something, and all conversations are filled with loud static unless I squeeze very hard and stand very still. So once again I charged up my circa-2001 Nokia something-or-other, which I've kept as a trusty backup ([livejournal.com profile] cthulhia will remember it as the BLAH blah BLAH model), and swapped my SIM into it. I had forgotten what a damn fine phone this is. I'm still on-track to buy an iPhone after its July release, but I'm no longer desperate for one. It's a real relief.
I read a good article in Game Developer last night about building weak AIs (automated opponents) that maximize the fun for the human player. The upshot was a recommendation to rely less on stunting the AI's allowed computation time, or clouding its actions with random variances, and more on having the AI intentionally and subtly providing the player with openings to smack it down.

For example, in a billiards game, a weak-and-dumb AI would just make wild shots. A weak-and-clever AI would calculate precisely the shot necessary to not only barely fail to sink a ball, but also have the cue ball end up in a spot where the human can follow up with an easy shot. It can look quite natural, when done correctly. You wouldn't want to do this on every turn, but you might want it to happen more often if the computer player starts winning. The article's author apparently wrote this very thing for a commercial project.

The article also referenced a chess program for PCs named Fritz, which pioneered this strategy for computer chess AIs. Historically, Chess AIs' difficultly levels are simply a factor of how long they're allowed to analyze the board and thumb through look-ahead positions. At weaker levels, there's a drop-dead timer on their thought process, and when it ends they just make the best move they happened to come across by then - which can often be a transparently terrible move.

Fritz, on the other hand, when set to a gentle difficultly level, plays a strong game but keeps an eye on how well the human is keeping up. If it's falling behind, Fritz will start intentionally making moves that aren't stupid, per se, but definitely leave openings for the human to grab a positional advantage. When (and if!) the human catches on and strikes at the opening, Fritz will resume playing for keeps.

There were other examples specific to Poker (weak players tend to fold when someone else makes a big raise, and so should weak AIs) and even first-person shooters (bad guys that have the "bad luck" to break from cover just as the player's crosshair is panning over them). I really like this.
Other than the localization problems, have well and truly broken ground with Project X and am roaring ahead, test-driven-style. This is the first time I've picked up a new programming language since getting the test-driven religion, and I have never sat more comfortably with the task. Very nice.

One of the first things I learned is that when you're not working with an interpreted language, you don't need to write tests check that return values and internal properties are the right types of things - if they every aren't, the program simply won't compile! So that's something new.

On the downside, I am not working fast enough. I wrote the previous two paragraphs at the end of last weekend, when I was feeling very much on top of things. Then one of my clients delivered a phat project they'd been speccing for months, so I said "Um, yes, money" and picked that up. A couple of days later, Wits & Wagers for XBox was released - an adaptation of a tabletop party game - and I learned that Dungeon Twister has added itself to the queue of tabletop games coming the the 360.

While I am not concerned about any other implementation of this particular game getting stolen from underneath me (it won't), I am worried about the platform getting saturated with adaptations before I can even finish my prototype. Therefore, I resolved to give myself a three-month deadline to finish it, and furthermore to work every day on the project, even if only for an hour sometimes.

That was Wednesday, and so far I have done a crappy job on the follow-through. Maybe I just need a fresh weekend to ramp things up again.

use Antigravity;

Saturday, 10 May 2008 09:49
Man, nothing was bumming me out so much yesterday as learning that Randall "xkcd" Munroe publicly switched his (non-Lisp) programming allegiance from Perl to Python. I read that cartoon when it was new, but I didn't bother rolling over the alt text (I seldom do) until [livejournal.com profile] radtea made reference to it yesterday. Munroe drew the cartoon just a few months after drawing a great one that celebrated Perl (if somewhat backhandedly), so I just thought he was giving equal measure to both languages.

I don't know why I care about stuff like this, but it seems that I do. It's pragmatically meaningless to me; jobs.perl.org continues to have more postings every month than the one before, and the rare times I run into a direct challenge of Perl's authority in my professional life, I have always been able to swat it down easily. (I mean, usually they're something like "So-and-so told me that Perl is just a glue language, and it's outdated even for that. And that it's ugly and unmaintainable! He said we should use PHP instead." Hurr.)

And it's not like I'm against learning new languages. I'm picking up C# for another project, right now. (Yes, there's an overdue post there.) But switching one's home language in a particular work-area, and then flaunting it (while being an in-circles ultra-popular cartoonist), I dunno. Imagine a media personality you enjoy, and who happens to be a Red Sox fan, going onto the Daily Show to renounce the team and put on NY pinstripes while the audience cheers. (Er, also imagine that you grew up in a Boston-area sports-loving house, OK?) I feel like that. It's nothing that affects me directly, but I still feel a loss, somewhere.
Earlier this week I removed Google News from the "News" pull-down on my Safari bookmarks bar. I don't know how long it took for me to notice that visiting that page only made me angry, but I finally did, and so passes the last non-blog-or-bloglike news source I'm willing to visit when bored.



Spent all afternoon into the evening trying to grok localization techniques in Visual C# Express. All the documentation I could find is apparently for the full version of Visual Studio, which includes a command-line program for creating resource files that I apparently lack. Assuming that Microsoft doesn't feel that internationalization is a luxury reserved for people willing to buy the full IDE, I gave up and posted a plea on the MSDN forums. It's crap like this that makes me blargh at non-free development software.



Before that I dropped over $30 at Bob Slate's, and now all my loose paperwork is filed away in new folders, with new staples punched into them as appropriate. That feels good.
Contrary to what Wikipedia implies, Microsoft's new XNA Game Studio 2.0 is a free download. I liked it so much I installed it twice! Actually I installed it once on my purely-virtual VMWare Windows machine, and when it finally got up to the part where it was ready to compile its sample game, it went "Duh, I can't find a 3D card." So I killed that and put it on my Boot Camp partition instead and now it all works. And so apparently I have to boot into Windows to do any work with it, which kind of stinks.

I haven't researched this deeply yet, so maybe I'll still luck out. I hope so, because doing anything in Windows is like feeling my way through a fog, while having left my glasses at home. It isn't (entirely) Windows' fault; I'm just used to how things work on Macs. I grow a new engram every time I hit ctrl - ← to go back a word and end up warping to the previous page, because the ctrl key is actually the command key here in the bizarro world. So for now I'm moving the cursor around by mousing and generally partying like it's 1992.

Anyway, I'm excited, coz XNA 2 supports XBox Live out of the box. You can't actually distribute an XBox Live-using game without Microsoft's OK, but I'm planning on getting that covered so that's fine. It ships with two example games, a basic local-play one and a network game. The former is a port of SpaceWar!, and how can I not totally respect that?
[livejournal.com profile] classicaljunkie volunteered to help clean up my tags, found the LJ page that lets you mass-delete them after sorting by usage, and (with my blessing) nuked all tags I've used only once. This cleared up well over half of my alloted 1,000 tag-slots. So, my new posts have tags again. Aren't you pleased.

• I have a copy of the volity.net webclient alpha mostly running on Brie, my creamy white MacBook. This is very important, not just because Brie's become my primary all-sorts work machine, but because I left volity.net's codebase in a sad state when I last touched it, way out of synch with Subversion. No more of that.

The webclient daemon's regression tests all pass again, as of this evening, and I'm raring to write more tests. Recent work for clients saw me learning to really learn to rock Test::WWW::Mechanize and I am honestly looking forward to writing a mechanized agent that will try to play Tic-Tac-Toe games over the web and report back to me. (I may need to write and install a deterministic TTT bot to complement it.)

I have a goal to launch the damn alpha by April 1, and feel it's entirely realistic. I'll miss it only if I get too distracted by pay-money-work, which isn't impossible, but even in that case I'm gonna get a lot of good work done.

• My consulting business's brand-identity work is down to negotiating business card design, which is just a peewee version of the website's design. I am nearly there! I will be so happy when I can finally announce the business's name and identity loud n proud, though I haven't been exactly keeping it a secret in the meantime. (Have begun renegotiating my open contracts to point at the company, rather than at me personally.)

• Idled in the The Burren with [livejournal.com profile] taskboy3000 this evening to discuss the format of upcoming Gameshelf shoots, the likes of which you have never seen before, at least not on this particular show. Mailed our director about it. He seems really energized about our trying new things, and quite into playing his role through all of it. We are lucky to have him on-board.

Is there a word for when a baby decides that a certain person in a certain setting is a fascinating source of visual data, and so stares and stares? Mr. T. Boy had one of these attached to him tonight, from the next table over. Very amusing.
prog: (khan)
What is pain?

Running out of laptop battery and leaving your power cable at home?

Wrong! Conan, what is pain?

To unwittingly have two HTML elements with the same ID attribute in a single document, to wish to modify one using AJAX-driven JavaScript, to have the other set to not display.

That is pain.
Last night's growling due to happy news: my web-client work is more or less integrated into (my test branch of) the volity.net website, and it works on all browsers I can be bothered to care about, including Opera (yes, I have tested it on my Wii) and both MSIEs. I'm going to push to take it live by month's end.

It's technically not slippage, because my original deadline was Sept. 30. Let us ignore all the boasting about earlier releases I did a month ago.

I do all my JavaScript development on Firefox + Firebug, and Safari generally follows suit without any extra work. It took me an hour or two on Saturday to make it Opera-compatible, figuring out that it didn't like how I was handling cookies. Opera seems to insist that you set the cookie header used for subsequent AJAX calls with the DOM's document.cookie property, and no other way will do. Fine, whatever.

It took all day Sunday to get the MSIEs in line. They are turds and I hate them. Their only redeeming feature in this matter is the surprising fact that both 6 and 7 had the same problems, and I got both to work simultaneously.

The IE problems, each of which took far too long to isolate:

  • IE silently ignores requests to add <tr>s to <table>s via the DOM appendChild method. You must instead add them to a <tbody> which is itself a child of the table. Seriously, what the fuck; who uses <tbody> normally?

  • IE caches the result of each AJAX call, and subsequent calls to that same URL (a very common polling pattern) will result in no request at all being made, but instead a silent return of the old value, so it looks like it made a request. You can get around this by (meaninglessly) adding the current time to the URL's query string, or adding a bogus If-Modified-Since header to the request. (On the plus side, this made me finally add decent logging to my server-side daemon, since I couldn't figure out what was going wrong without it.)

  • For the life of me, I couldn't use any Prototype.js methods to refer to elements that had been added to the DOM tree since the document's original rendering. I finally punted, adding such elements to some global arrays upon creation (with apologetic code comments noting how fucking stupid MSIE is) and just accessing those instead later on.

Working with Microsoft software as a developer makes me so angry. It makes me angrier than thinking about the current American government and its foreign policy, because I usually burn through that in a few minutes. But working with Microsoft means wading around waist-deep in a vat of pure shit for hours. It gives me a hate that can last for days afterwards. I really hope I can minimize exposure to it as the web client project moves forward.
prog: (khan)
And now I am going to go drink until I can say "Microsoft Windows Internet Explorer" without shouting FUCKING in between each word.
We have existing system built on PERL (developed over time) by various developers, with their own unique style.

I'll just bet you do. My translation: We run a horrible writhing nightmare of spaghetti code with no common style standards. Really, it's just that they tout that as a feature that makes it noteworthy.
Research, including asking y'all earlier, has led me to believe that if there is a way to have MSIE 6 and 7 running independently on a single Windows machine, it's almost certainly not worth the tremendous effort involved. Nor is it worth the questionable level of stability that this level of DLL and registry contortion would no doubt leave the machine in.

I will instead take [livejournal.com profile] mr_choronzon's advice and carve out a second, file-based VMWare machine on my Mac, expressly for running 7. This is a sad sacrifice of hard disk space for running a single test-target application, but I really see no other reasonable way.



Had a comment thread a while ago about maintainability versus size in client-code that has to be sent over the wire (most commonly, JavaScript in web pages). Since then I've encountered a happy medium that many perfectly clueful entities employ.

It's apparently SOP for organizations that deal with tremendous amounts of traffic to code in a nice clean fashion with as much whitespace and as many long variable names as you please, but before going into active duty each such piece of code is pseudo-compiled (really, obfuscated) down to an ultra-compact size, making it as small as possible without any loss of meaning. These files are then treated like compiled binaries, even though they're still interpreted scripts: the developers never touch them directly, instead making further changes by editing the long-form scripts and then re-compressing them.
It's been a week since I've had a chance to look at my MSIE XML problems. I can't recall what I found on Google last time, so I look again, and...



Quite. (Also I'm currently the number 2 hit for [msie fuck].)

I am taking [livejournal.com profile] jaq's advice and looking at Sarissa now.
prog: (khan)
Reasons that $not_first_time is not a good variable name:
  • Not the first time for what, exactly? (This isn't helped by the fact that this programmer doesn't believe in using inline comments. Ever.)

  • It's awfully rude to use an inverse boolean like that, where it's false if the thing it tracks is true, and vice versa. not($first_time) reads much better than not($not_first_time), no?

  • I can't get that song from Foreigner out of my head now.

Bonus annoyance: I'm thinking of that one ATHF episode where Karl gets the magic Foreigner belt. Sadly, I think that's hilarious.
Righto, I just sacrificed a couple of hours on the altar of trying to get shit to work in MSIE. On the plus side, I think I can eliminate one of the third-party libraries I've been using; MSIE was barking at it, and I find that I can do the same thing it was doing using Prototype, which the application already depends on.

On the minus side, MSIE's XML API eludes me. Consider this code snippet. Given xml_request, an XMLHttpRequest object:
    alert(xml_request.responseText); // This prints the correct thing.
    var xml_doc = xml_request.responseXML;
    var root_element = xml_doc.documentElement;
    if (root_element) {
        alert("I have a document element. I am a sane browser!");
    }
    else {
        alert("I have no document element. I must be MSIE. Fuck.");
    }


The initial alert() makes me sure that MSIE (as well as any other browser) is in fact reading the XML. I just can't do a damn thing with it after that; every attempt to peek into any DOMmish properties of xml_doc returns null.

xml_doc.firstChild and equivalent statements all fail equally (while succeeding on sane browsers). Wha?



Another good reason to drop the library I am dropping? It contains lines of code like this:

MWJ_ldD[MWJ_ldD.length-1].onreadystatechange = new Function( 'if( MWJ_ldD['+(MWJ_ldD.length-1)+'].readyState == 4 ) { '+oFunct+'(MWJ_ldD['+(MWJ_ldD.length-1)+'].load?MWJ_ldD['+(MWJ_ldD.length-1)+']:MWJ_ldD['+(MWJ_ldD.length-1)+'].responseXML); }' );

Holy hannah. That's no way to make friends.

Scooped.

Wednesday, 29 November 2006 22:08
Look at all the unfinished LJ posts I have here. Oh wait you can't. Um...

Hey! Various things have been conspiring to make me feel loserly lately. For the most part it doesn't work, because I am oblivious, but I do admit to letting myself get pretty stressed out over something unexpected that happened with the Google checkout stuff. My friends, I got scooped. In the best possible way, and with plenty of silver lining, yes. But a scoop is a scoop, still.

Long story short, a Google employee who was working on the same problem saw my stub site of SourceForge and got in touch, letting me have a butcher's at his own code. Yes, it's more feature-complete than mine. In fact, it's more or less all there. After a couple of days of resistance, throughout which [livejournal.com profile] daerr talked sane at me, I've decided to embrace this other fellow's solution. In fact I just now sent him a lengthy letter with a laundry list of some issues I had with it - mostly superficial stuff about Perl/CPAN style, with which he's clearly unfamiliar - and attached a snapshot of all the code and tests I'd written as of Monday night. He sez he'll be happy to give me credit, which is great, but I bend the knee just the same.

If it was some random individual, I very well may have pressed forward with my own solution. But this is going to be Google's Own Blessed Version, so there doesn't seem to be much point in competing. Beyond that, I think they'll do a better job (or at least care more about) maintaining it that I ever would with my module. I appreciate the opportunity to apply my Perl expertise to work with and even coach another smart programmer - in a way, it's like my project blew up into full-blown open-sourciness sooner than I expected.

And, hey, it never hurts to be on good terms with more people inside Google.

But it's still the first time I really got shown up like this with a project, and there is an owie involved.

Hey you coders

Saturday, 25 November 2006 11:58
These questions aren't language-specific; consider the questions as pseudocode. Pretend that the underscores are actually studlyCaps if you'd like.

Also, don't worry about return values of the mutators, which is a separate question.



[Poll #875101]

Volity and sXBL

Thursday, 9 November 2006 02:58
I've been doing a lot of coding since the start of October, in three very different projects for three different customers. It's interesting. I will tell you know about one of them, which the most recent of these and the most interesting to me personally.

I finally got my hands dirty with sXBL last weekend, and after spending the last few evenings mashing at it I feel that I finally have the hang of it. All the magic about shadow trees and binding events and thus and such really took me a while to wrap my head around, but now I'm starting to make some stuff that sings, and I like it.

I am using it to start making that card game library I mentioned earlier The idea is that you, as a Volity game UI creator, will be able to write UI code that reads something like this: "Using this card artwork, draw the player's hand, with these dimensions, here. Draw the opponents' hands here and here, at half-size. Here's where a draw pile goes, and here is where cards are discarded. When this certain event happens please animate a card flying from the pile to the player's hand."

Much of that will be expressed as XML, using a custom tagset we will provide. And you won't have to write one line of Javascript about how to draw a hand, or sort its cards, or how to animate the flying cards. Just say where the things are, note their size and rotation, and mark when animation events should happen, and the library will take care of the rest. You can also add on as much additional SVG and Javascript as your game needs; this is just a programming library, and you use it as such.

I have started to create an importable SVG document that contains the sXBL templates for the handful of core card game objects I am envisioning. Once I've got its whole skeleton sketched out, I'll set something Subversiony up, and turn to the Volity community, whereupon I will lead this new and exciting little sub-project. I don't think I need to wait to do any of the animation, which will be the hardest part. We can work on that together.

May 2015

M T W T F S S
    123
45678910
11121314151617
1819202122 2324
25262728293031

Expand Cut Tags

No cut tags

Most Popular Tags

Style Credit