Archive for the 'programming' Category

StackOverflow Friend’s List

I use stack overflow quite a bit in my day-to-day. Here is my profile widget:


profile for livingtech at Stack Overflow, Q&A for professional and enthusiast programmers

The official word (well anyway, the official meta thread) says that Stack Overflow will never support a friend’s list, so I decided I should just start collecting a list of my friends and/or people I follow who also have accounts there. This post will likely get updated as I add or (heaven forbid!) remove folks. It would be really cool (as usual, I think this several times a year) to have a single place to maintain my list of friends, a meta-social-networking site that connects all the other social networking sites into one thing. Obviously Stack Overflow isn’t really meant to be a social network… but it is a network, and I would like to keep tabs on my friends there on occasion. Now I can just come to this page/post.


profile for Insyte on Stack Exchange, a network of free, community-driven Q&A sites
Ben B

profile for Zachstronaut at Stack Overflow, Q&A for professional and enthusiast programmers
Zach Johnson, @zacharyjohnson

profile for slembcke at Stack Overflow, Q&A for professional and enthusiast programmers
Scott Lembcke wrote chipmunk.
@slembcke, github

profile for Whit at Stack Overflow, Q&A for professional and enthusiast programmers
Whitaker Trebella wrote Polymer &
Pivvot! (github, @wtrebella)

profile for nimblegorilla at Stack Overflow, Q&A for professional and enthusiast programmers
Nate Yourchuck


Please know that if you are reading this, and use StackOverflow (or any of the StackExchange sites), and aren’t represented here, it’s likely because I couldn’t find you on there, or just plain didn’t (yet) think to look for you. Feel free to message me or comment here, and I’ll add you forthwith!

How am I making the world a better place?

OK, so this started as an “I’m an indie game developer!” post, and morphed into the title you see above. Mainly because I discovered Gittip, and it’s one of those ideas that grabbed me instantly and wouldn’t let me stop thinking about it.

Gittip is essentially a recurring tip jar for folks on github. (And it sounds like they are ambitious, and want it to be for more than that, but at least for now, it seems like you have to have a github account to sign up — even to tip someone, so that’ll need to change eventually.) Anyway, you sign up/in and tell it who you want to tip on a weekly basis and how much, then it lumps all their tips together in one anonymous donation every Friday.

I’m in the process of setting up an LLC for my business. I quit my dayjob just over a week ago, and I’m going to be making apps (mostly games!!!), about 50% of the time ones that I design, and the other half of the time for other projects I think are awesome.

The point is, I’ve been thinking a lot about monetization, and how I want to be charging people for my apps. Freemium is the buzzword of the year, but it’s got a lot of different incarnations, some of which leave everyone sane with a bad taste in their mouthes. Other incarnations are a lot closer to the shareware model, only you give away the whole app, hoping that enough people want to pay you to make it worth your while. I like that idea, it really sits well with me ideologically, but I’m not certain I’m making games that have a wide enough appeal that the one to three percent of people who tend to pay for games like that would eventually pay all my bills.

If only gittip were somehow a viable payment option for apps!

I really think a model like gittip is how the non-physical-goods-based-economy should work! Or anyway it’s one payment model that has been missing: recurring anonymous microtransactions. Plus it’s combining that with philanthropy, but I really think that’s just marketing for the payment model, same as it is for kickstarter. Effective marketing, don’t get me wrong, especially because it’s marketing you WANT to hear, but marketing nonetheless. (I should probably explain that further, but I’m lazy… maybe in a future post.)

When you sign up, it doesn’t distinguish between folks who want to give or get tips, so you’re presented with a profile screen that asks you to fill in the blank: “I’m making the world a better place by… ________” My initial thought was “well, I’m not YET!”, but then I settled on “…making games nobody else has bothered making.” For now at least, I’m certain that’s true. Wish me luck!

ActionChess for the iPhone

It’s been a long uphill struggle, but ActionChess should be appearing in iTunes or in the app store on your device anytime now. I wrote about this over at chesstris.com, but I’ve already submitted the first update.

It’s weird, but now that it’s been approved, I almost feel more nervous about it than I did before it was approved, while I was waiting for it to get approved. I have no idea what’s going to happen. I definitely want to get puzzle mode in there sometime in the near future, along with a new game mode that I’ve been thinking a lot about in the last week or so. I have so many game mode ideas that I don’t know when I’ll find time to implement them all.

I have plans to get together with a new friend and iPhone developer on tuesday, and we’re probably going to collaborate on another game in the near-ish future also. We’re thinking about doing some kind of match-3 game, and in prep for that, I’ve made a list of all the ones I know about already on the iPhone. Let me know if you see any missing from this list (there have to be more, I’m sure of it).

Match 3 games I have or have some experience with:

  • ChocChocPop – florence’s favorite (adds powerups)
  • Gem Spinner (add “shape constraints”, background “clearing”, rotation)
  • Mix-A-Dot (adds color mixing)
  • Gemmed (adds cool “critter” mechanism and different piece types)
  • Puzzle Quest (adds RPG elements)
  • Jewel Quest II (added background “clearing”)
  • Bejewled II (played original Bejeweled, haven’t played the iPhone version)
  • Aurora Feint (like Tetris Attack)
  • Crazy Sushi (uses the Yoshi’s Cookie “slide a row” game mechanic)
  • Trism (trianges!)
  • ScribBall / CrayonBall (adds gravity, not sure if these should count)
  • Pinch ‘n Pop (also stretching the definition, but it is sort of a match-3)
  • Quadrix (“slide a row” not so much match-3 as making various shapes.)

…and the ones I haven’t (yet) played:

  • Chain3 (no movement constraints — apparently this has been out since app store launch)
  • Samurai Puzzle Battle (Puzzle Quest knockoff?)
  • Smiles (on my wishlist)
  • Diamond Twister
  • Popcorn!
  • Campaign Trail
  • Chocolate Shop Frenzy
  • Sliders (also uses “slide a row” game mechanic)
  • Slida (also uses “slide a row” game mechanic)
  • Gemlogic
  • Gems
  • Big Booty
  • Bling: Touch Fever
  • Glyph (looks to be a lot like Jewel Quest)

anyway, check out ActionChess if you have an iPhone, when you get a chance!

Quick “what’s up” and howdy doody

First of all, I just posted a couple of mini-reviews over at my game dev blog about match-3 puzzle games for the iPhone. I’m loathe to link to it, because I’m going to be moving the URL for that blog in the really near future. (OK, well, probably not until next month, but soon anyway.) The idea is to put everything on my new super-secret game development domain, abstractpuzzle.com. This will probably happen shortly after I’ve already launched ActionChess for the iPhone (I’m finally making chesstris!), and slightly before I’ve re-branded Go-Tetris! as ActionGo.

I flip-flop over whether the new names should have colons in them. ActionGo versus Action:Go, and ActionChess versus Action:Chess. I think I like the colon separation slightly more just because of how it looks visually.

no k2 in the WP theme directory…

I went to the theme directory tonight with the sole purpose and intention of voting on the one theme I’ve been more than happy installing (K2, duh) and it wasn’t there! I assume this is because they’re working hard on 1.0, trying to get that out before they add K2 to the throng of themes already up for grabs. (They’re on RC7 now, I think.) Anway, I hope it’s that, and not that there’s some feuding or some other BS reason K2 isn’t listed.

Anyway, then I ended up following some links, and poking around in the K2 google code pages, and remembered that I’d started a thread asking for a particular feature for K2 back in February. I hadn’t visited the issue page in all that time, but there had been some responses, including a developer who said if I made a patch for the feature I was requesting, he’d see that it went in.

So tonight I made a patch. This officially marks the first time I’ve actually contributed (code) to an open source project. I suppose I’ve helped plenty of people on support forums and things before, but if this code makes it in, I’ll be… a geek hero or something.

how to show an excerpt from the first post in a category in wordpress

For ReadComics.org I wanted to show the latest Book Club entry in the sidebar. For those of you who are not familiar with the way WordPress does its posts, it uses some funky wrapper functions to access (and sometimes print) the entries in your blog. The main wrapper function, and the one that controls most of the stuff on the page is called the_loop().

This might be getting too detailed… You probably just want to know how to do what I did. There’s a lot more details on wordpress.org about using multiple loops on one page, but basically, the technique I used was to specify a new loop by using one of its internal functions called WP_Query directly.

WP_Query() takes an argument that tells it to just get the latest post from the book-club category. That looked like this: <?php $bc_query = new WP_Query('category_name=book-club&showposts=1'); ?> This uses category slug (“book-club” in my case), which you can find by editing your category.

So then you can use the standard functions like the_title() and the_excerpt() in a while loop. So the whole thing looks like this:


<li><h2>Next Comic Book Book Club</h2>
<!-- Get the last post in the book-club category. -->
<?php $bc_query = new WP_Query('category_name=book-club&showposts=1'); ?>
<?php while ($bc_query->have_posts()) : $bc_query->the_post(); ?>
<a href="<?php the_permalink(); ?>" alt="Read more about the next book club meeting." title="Read more about the next book club meeting."><?php the_excerpt(); ?></a>
<?php endwhile;?>
</li>

…and yes, I know the_excerpt() creates paragraph tags, and anchor tags around paragraph tags probably doesn’t validate. Oh well.

Why Postel’s Law is awesome

Caveat: Web standards are good. Everyone knows this. Without standards we’d have anarchy, or anyway we’d be stuck in the late 90s, trying to implement as many versions of our webpages as there are browsers. In my opinion, this does not at all mean that Postel’s law is wrong.

Be conservative in what you send, liberal in what you accept.

Lets start by taking a step back. What made the internet into the thing it is today? What makes it so appealing for so many people, all over the world? I’m willing to venture some of these things had something to do with it: free content, diversity of content, breadth or scope of content, and ease of access to that content. The internet is SO amazing because it is so diverse, and so immense, and so incredibly huge.

Sure, technology is cool. I personally find all the latest trends in programming to be really cool. But the technology that runs the internet is just one very narrow slice of content. It’s no lie: Content is king.

Now why is the internet so huge? How come there is so much content? Well, the answer to that is Postel’s law. Or rather, the answer to that is that early browser developers adopted Postel’s law. Because they made it easy enough to put stuff on the internet that pretty much anybody can do it. And they did do it! And that’s why the internet is so fucking awesome!

Can you imagine how much more frustrating web content creation would be if you saw errors every time you fucked up some html? Yes, for those of us who are web development professionals, it can occasionally be frustrating when the browser doesn’t tell you what you’re doing wrong… but this is an argument for better debugging tools, not for stricter html. I mean, do you really think debugging should be turned on by default? Hell fucking no!!! I know I laugh whenever I see backend error messages on a webpage. Fucking amateurs!

So IMHO it’s only fitting that each new version of a browser, or each new version of a web standard brings with it new pains and frustrations for those of us in the web development profession. After all, it’s our job to make sure this stuff works… We get paid the big bucks for those pixel perfect designs!

But if the browser developers are doing their jobs right (and damn straight the standards people better be doing their jobs right), content creation should only ever get easier. After all, it’s what makes the interweb such an amazingly awesome thing.

F1 Website Challenge

A few months ago, Chris linked me to Sierra Bravo’s F1 Overnight Website Challenge. It’s somewhere between a grownup lock-in, a charity event, and work. The premise is that you (as a developer) sign up to help out a bunch of non-profits spruce up their websites in 24 hours. I thought it sounded like fun, and signed up. I also conned a bunch of my co-workers into doing it too, so we’ve got a team that’s worked together before, and should be able to actually pull something together in the alloted timeframe.

Chris isn’t local anymore, so he won’t be there (too bad, really), but there are a surprising number of other people I’ve worked with who are also doing the event. I’m looking forward to seeing (and competing against) approximately eighty other web developers all at once.

I’ll have my camera with me, and definitely intend to do some flickr uploading while I’m there. (Or if the network is bad, after it’s over.)

Wish me luck!

BigText.org

I spent a bit of time (probably too little) one afternoon this week searching for a website that created ascii versions of text. Instead, I found a command line utility called FIGlet, and approximately 4 hours of dev time later, (including 3 hours after about 11:30pm last night), BigText.org was born onto the internets.

Feedback is welcome/desired. I’m especially curious whether anyone can break it, as obviously security is a concern.

UPDATE: There are many other web-based figlet servers out there. I’m glad I didn’t notice them until now. I probably would have given up.

Typography in Code: A Field Guide to Whitespace, Part 1

We all know what we like and what we don’t like when it comes to whitespace in programming. I can only speak for myself, but here are some elements to consider.

One of the universally accepted natures of code is to indent where appropriate, and this first installment of Typography in Code: A Field Guide to Whitespace will focus on the various incarnations of the all-important topic of (queue thundering god voice) indentation.

Topic: Tabs versus Spaces

This primordial, often invisible question is at the heart of the indentation beast. Like good and evil, right and wrong, vim and emacs — tabs and spaces are diametric opposites, warring factions facing one another across a never-ending epoch in which all our text files are smoking battlefields. One kicker is that both sides use ninja assassins. YOU CANNOT SEE THEM COMING, until… that is… you find them lurking in your legacy code, buried at the beginnings of lines near the ends of your files, like trip mines in long forgotten functions.

This is when you spend hours constructing that one perfect regex to rid your code of the enemy once and for all. (Also, unless, of course, you are one of those odd ducks who likes to see their whitespace characters. I respect you, even if you are crazy.)

Where I fall on this fence: My heart titters for tabs. But I didn’t always believe in them! I admit it, I was once an indentation swing state. But here’s why tabs are king for indenting: Tabs are like using semantic markup. We all (mostly) want code to all indent the same width (no matter what that width is), and a single tab character means that width. You can even change this width (tab stop) with a single command in any decent editor. This alone should be enough for the triumph of tabs over spaces.

Topic: How wide?

Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3. (Linus Torvalds, From Documentation/CodingStyle of Linux, via wikipedia)

This is a trickier beast. I believe in the power of four. It’s more legible (discernible) than two, especially across dozens of lines, and eight is just too wide a gap. With a tabstop of eight, you only get ten indentations before you’re out of 80 column width entirely! This is as opinionated as I get, since four just looks right to me, and I can’t really cite any good reasons for it. Just take it from me: you’re an IDIOT if you prefer anything else.

Yea, and the number of spaces to equal one tab shall be four. No less, and no more. The number shall not be three, and the number shall not be five. Fuck that the number shall definitely not be odd. The number shall not be two, and the number shall not be eight. The number shall be four.

Truthfully, I don’t care what your tabstop is set to, as long as these things are true:

  1. I can set my tabstop to something different and the code doesn’t look all fucked up. This means, yes, tabs.
  2. Never use a combination of tabs and spaces. (Fuck you, default dreamweaver settings.)
  3. Tabs should never be used anywhere but at the beginnings of lines. (This violates #1, but is also a really bad practice for other reasons that maybe I’ll get into in a later article.)
  4. Consistency, consistency, consistency. (WTF BSD, WTF!?)

Extra Credit: Read (and care about) the wikipedia article on Indent Style.

Next topic: How many line breaks look the best: Between Function Definitions, In Functions, Around Comments, and more!