Showing posts with label code/book. Show all posts
Showing posts with label code/book. Show all posts

Saturday, January 19, 2008

code/book 1.5: Out in the Open

For the most part, Dashwar has been released. I made a post on the Weewar forums announcing my widget earlier this week, hoping to get some input from someone other than myself. I had planned on giving it a broader release, submitting it to various download sites and widget repositories, but there are a few bugs I need to squash and features I need to tweak before I feel it's ready. For now, I'll consider it in beta.

Not that it isn't useful as is. Case in point, I found myself dropping in to Dashboard this week to check the progress on a few games, and lo and behold, my account type had changed from Basic to Pro. Turns out that, Alex, one of the guys at Weewar liked the widget enough to deem it fit for compensation, to the tune of three free months of Pro status. Very nice gesture, if not a bit counterproductive. How does he expect me to work on Weewar when I only have three months to squeeze all the usefulness out of my Pro account?

Here's the website and the release for interested parties. Enjoy.

Monday, January 7, 2008

code/book 1.4: Do Notice

Growl support has been added to Dashwar, and with that, the last of my feature list has been implemented. It took a bit of work , getting the framework to load from the plugin, but it was a trivial affair afterwards.

The only thing left now is a little cleanup and some error checking and, dare I say, I'll have a version 1.0.

Tuesday, January 1, 2008

code/book 1.3: Fire and (Don't) Forget

Happy New Year! Time for an update.

Dashwar can now displays a status item in the menu bar whenever you have a waiting game. The title changes to the number of waiting games you have. When no games need your attention, the status item goes away.

Getting the icon to display took awhile. Widgets aren't self-contained applications. As such, when you try to get the resource path programmatically, it ends up looking inside DashboardClient, the program that runs widgets. The widget plugin, which contains all the Cocoa stuff I'm doing for the status item (different from the Javascript of the rest of the widget), is its own bundle. This means it has its own folder that contains its own resources, mainly the image I wanted to use for the menu icon. Luckily, finding the bundle for the plugin, and subsequently the resource folder for that bundle in code wasn't too hard.

Another problem arose when sending data from Javascript to Objective-C. Conversion from basic Javascript types to Cocoa types should happen automatically, and for the most part, it is. Strings change to instances of NSString and numbers to NSNumber, but arrays, which should become NSArray objects remain WebScriptObject instances, the type for not-so-basic objects passed from Javascript. Of course, instead of trying to figure out why they weren't passing correctly, I decided to just send it one object at a time. I've wasted enough time trying to fix this kind of problem in other projects to know when to let go.

I had to provide a preference for displaying the status item, but that was only a minor headache. I'm quickly closing in on the end of my feature list, and I can't remember the last time that's happened.

Thursday, December 27, 2007

code/book 1.2: Expanding On It

Update time.

You can now hit a button to reveal a list of players for each game. The current player is marked in bold, and defeated players are marked in gray. Plus, the expanding is nice and animated, thanks to Dashcode's AppleAnimator.

This part took longer than I expected, as most of my work on the widget this week has been towards this feature, mostly, due to rewriting.

Also, I had to redo my handling of updates to prevent the widget from resetting the view. I guess it was about half and half between this and including more game info, work-wise.

Anyway, here's a new pic.

Saturday, December 22, 2007

code/book 1.1: Great For the Confidence

It's nice to finish working on a project, to put it away for the day with a sense of accomplishment instead of one of frustration. These past three days, I've come away from working on Dashwar content in the notion that I had implemented all I desired. It's such a contrast from working on my other, bigger projects, where most days are ended due to a general feeling of fatigue, a hope that a good night's sleep and a bit of distance will present a bit of clarity or insight into the unyielding, ever-growing issues of the day.

It's strange, though. Regardless of  how I leave, whether in victory or defeat, I still feel the same yearning to get back to work. Instead of a thirst for revenge, a need to prove my domination over all that is code, I come back to Dashwar with an eagerness birthed from a sense of exploration. I've done this much so far, what else am I capable of?

Anyway, here's what great, new heights I've reached. Pretty modest, but I'm still pretty happy with my first efforts in JavaScript:
  • Get User Info - The first thing I did was display the username, account type and score for the user.  Once I muddled my way through relearning how the DOM works (remember: firstChild), implementing the display was cake. Even displaying the profile image was easy.
  • Display Games - Using the Headquarters XML file, I was able to get a list of all current games. I was able to make a scrollable list of games quickly, save for a view display problems. It seems that with all these elements with dynamically calculated dimensions, trying to refresh the scroll area when it isn't displayed isn't of much use (read: refresh when you show the front of the widget). Finding out why the thumb for the scrollbar wasn't showing up was most of my yesterday.
  • Show Waiting Games - With a hit of F12 and a quick glance, I can see where my next turns need to be taken. Waiting games are highlighted in yellow and display the handy message icon that Weewar.com uses.
There are a few other, minor details (clicking a game name takes you to it, clicking your username brings up your profile, etc.), but the main points are there. Like I've said, I'm eager to get back to work on Dashwar, so I'll wrap this up with a little visual preview of the fruits of my labors.

Friday, December 21, 2007

code/book 1.0: Dashwar

In an effort to fill the void that my blog has become, I've decided to actively seek out topics for exposition, not so much to express my opinions, but to sort of cogitate by exposure, exploring my thoughts by revealing them to the public. Since I do little else in my free time than code and game, I guess it follows that I'd want to ruminate on one of those two subjects.

As such, I've decided to take a stab at chronicling my attempts at programming. Maybe articulating my experiences will help reveal solutions to persisting problems. Perhaps reader comments on my endeavors will help to motivate me in completing my projects. I don't know; I just want to put this Blogger account to use for a change.

So here it is.

code/book 1.0: Dashwar

Whenever I get the chance (and whenever my turn is up), I like to get in a few rounds of Weewar with friends. The problem is, I've yet to find a way to efficiently keep me informed of my martial obligations. pyWeeStatus freezes up on occasion, and I've yet to get WeeHQ to work for me. Now, I'm sure a quick email correspondence between me and one of the developers of these utilities would fix the problem, but that's just too easy.

With the release of Dashcode, I've been meaning to try my hand at making a widget. I've done web development before, but very little of it involved JavaScript. Learning a new language seemed a bit daunting, but somewhat necessary, what will the advent of AJAX and all.

Taking my need for a notification system for Weewar and my desire for a little JavaScript education, I've decided to make Dashwar, a Weewar Dashboard widget. As it stands, I have a few expectation for the final product.

  • Show Games Needing Your Attention - This is, of course, my main goal. At the very least, I have to see which games are waiting on me.

  • Show Game Details - If a games is not wanting on me, it would be nice to see who the game is waiting on (so I can yell at them), as well as who's playing and who's been knocked out in my absence.

  • Growl Notifications - I've been meaning to learn about using Growl, and this seems like a good project to test the waters with. After all, activating Dashboard takes some forethought. I'd like the computer to tell me to play without being asked.

Hopefully this is the start of something interesting. At the very least, I'll get a few posts out of it.