764 karma · joined March 28, 2007
So, anyway, I've always wanted to make a roguelike so a couple weeks ago I started this:
http://eki.github.com/jquery.roguelike/
I really need to refactor and start documenting the code soon, but I'm trying to get the basic game play done first. Right now the dungeon is 5 randomly generated floors that can be navigated with the arrow keys (or wasd), but no enemies yet.
(Oh, and the canvas stuff won't work in IE)
+ %terminal.png%"caspian" Exec exec xterm -geometry 80x25+30-28 -T "screen : caspian" -e ssh -t eki@caspian.vying.org screen -x -R
I have menus for local screens as well, with entries like: + %terminal.png%"dorothy" Exec exec xterm -geometry 80x37+30+60 -T "screen : dorothy" -e screen -x -c $HOME/.screenrc-dorothy -R dorothy
I usually create a new screen config for each project that launches shells in the right directories, etc. For example, here's my .screenrc-dorothy: chdir $HOME/projects/dorothy/lib/dorothy
screen -t lib 1 zsh
chdir $HOME/projects/dorothy/test/dorothy
screen -t test 2 zsh
chdir $HOME/projects/dorothy/ext
screen -t ext 3 zsh
chdir $HOME/projects/dorothy
screen -t irb 4 zsh
at irb# eval 'stuff "irb -r dorothy\015"'
chdir $HOME/projects/dorothy
screen -t zsh 0 zsh
hardstatus alwayslastline "%{rk}%H %{gk}%c %{yk}%M%d %{wk}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{wk}%?%+Lw%?"
That gives me shells in the directories I'm likely to be working from, and starts an irb session in another shell.I guess this is only newsworthy if you're not the type to customize your environment to your liking. Well, that and the fact that gnu screen is somewhat difficult to learn and researching it is a pain because "screen" is such a poor, generic name for a project.
I'd love to see this turn into a thread of neat things that can be done with gnu screen.
The code has undergone quite a few transformations now. Frotz uses a lot of static memory -- it's basically setup to run a single zcode program at a time. Which makes sense, of course.
For my library, I wanted to be able to run more than one program (or multiple copies of the same program) at the same time. So, I basically rewrote the core of Frotz. All the memory for a Z-Machine is broken up into structs which are passed around.
There were some fun memory management issues related to running multiple programs. The typical zcode program consists mostly of static memory (lots and lots of strings and code), so that static memory can be shared between programs. I have a test where I load something like 100,000 copies of minizork into memory and the process size "only" jumps to 118MB. Of course, normal code doesn't need that many simultaneous Z-Machine instances so garbage collection keeps memory pretty reasonable.
Last time I worked on dorothy, I setup a demo webapp here:
Which illustrates why I wanted to be able to run multiple programs. The demo runs minizork, dynamic memory is dumped and restored between requests. The hints, exits, and history feature is possible because the server "listens in" on your game and the games others have played.
Lately I've been working on more memory inspection stuff, and now I have to work on some of the unfinished Z-Machine features (I've only implemented the v3 screen model).
The code is on Github:
Honestly, I'm not sure how Rails uses #sum. I'm not sure whether they really need it or not. I suspect not.
I'm not a big fan of a lot of non-standard additions to Ruby. For example, all the #try, or #returning, or even your #andand. I don't consider any of those to have enough intrinsic value to be worth the risk of collisions with someone else's subtly different implementation.
[1,2,3].inject { |s,i| s + i }
Which is presumably why sum doesn't exist.Secondly, it seems like most conflicts like this occur between Rails and some other library. Rails, via ActiveSupport, adds a lot of extensions to core Ruby. I kind of wish it didn't. Framework or general purpose library developers should recognize that their library will likely be combined with many others and avoid conflicts by sticking to what's available in the standard, namespacing their code, etc.
I like Ruby, but I'll readily admit it's not a perfect language. I'm sure someday a better Ruby-like language will come along. Hopefully, it'll be a language with better support for avoiding these kind of conflicts without removing support for open classes. I'm sure it's an interesting technical challenge.
http://www.maxmind.com/app/geolitecity
I haven't verified that claim.
Probably the best book for really learning Ruby is The Ruby Way by Hal Fulton. Hal clearly gets Ruby.
The book is thorough (although possibly a little out of date now), introduces a lot of idiomatic Ruby, and has just the right amount of geeky inside jokes.
I have some experience with this -- my site uses canvas / ExplorerCanvas quite a lot -- ExplorerCanvas is both buggy and extremely slow for any kind of animation. Particularly long running animation (as in games). I wish it wasn't so.
VML may or may not perform well, but it's a different kind of api than canvas. In VML, like SVG, you're intended to draw a bunch of shapes and then manipulate them. To animate a circle crossing the screen, you draw the circle and the move it every tick. The library manages the redraws, etc.
With canvas, you redraw every frame. So, to animate that circle you draw it in a different position every tick.
If you run canvas on top of VML you end up redrawing a lot of extra elements which get reinserted into the dom at every step.
They're just fundamentally different approaches and the impedance mismatch kills ExplorerCanvas's performance. If this has changed recently, btw, I'd love to hear about it!
I'm in the second camp. I'll gladly commit broken code and then fix it later. I don't push broken code, of course, but sometimes it's useful to have a snapshot of the broken code before you start fixing it.
For example, let's say I'm accepting a patch from someone or I found a useful snipit of code on the internet. I integrate the code and it breaks a unit test in some non-obvious way. I like to commit the code as it was from the original source before I start trying to fix it. That way I can quickly revert if my fix attempt is way off base.
Further, I have in my history who / where the code came from and how it was fixed (in a later commit, complete with an easy to get diff).
I'm not saying Eric's best practice is wrong. Some people prefer to only commit good code, some prefer to commit early and often. I don't think either practice is inherently better than the other.
Edit: I realize I didn't really respond to the immutability issue... I don't really have an opinion on that.
However, I'm very happy that those individuals who were identified have faced social repercussions for their behavior. I would not want anything to do with any of those posters. If I were hiring, I wouldn't hire any of them. I would probably boycott any businesses that work with them. If they're free to be jerks, I'm free take my business elsewhere.
Therein lies the more interesting issue. Anonymity. It's hard to exert social pressure on bad behavior if you can't identify the people involved. Do we have a right to be anonymous online? Do the pros outweigh the cons?
I really don't know...
People who have trouble sleeping are, among other things, supposed to establish a routine. Repeating mundane activities (brush teeth, lock doors, turn down thermostat, etc) in the same way every night seems to prime the brain for sleep.
I suspect it doesn't matter what you do before you settle in to work, simply that you establish some "it's time to work now" cues and then take advantage of them.
As a baseline, you should at least restore from your backups occasionally.
It helps that I'm familiar with the data -- so after restoring the backup I expect to see games, messages, forum posts, etc that I've just seen in production.
I do some more thorough automated tests on the backups less frequently. App specific things, like replay games and verify results, etc. This process is more about assuring backward compatibility with the code though.
I think verification should ultimately be somewhat app specific. That said, I'm sure you can find tools to help with verification.
That's the thing with backups, they can fail or become corrupt in many ways. If you don't use them for something on a regular basis or have some regular verification process you may not know what you have until it's too late.
And, of course, I've also seen situations where subtle data corruption in the master database leads to weeks of subtly corrupt backups. By the time the corruption was discovered we faced the choice of rolling back several weeks to the last good backup or fixing the corruption. In the end we had to do a kind of merge -- it was a real pain.
Unfortunately, it's not enough just to have backups. You have to actually verify that they're correct and up-to-date. Verification is easy when your database is small (for example). You can just load it in your development environment occasionally. But, how do you verify your backups if you have hundreds of gigs or even terabytes of data?
As an example, I've seen cases where backups were successful every night... but, they were being run against a slave db and replication had failed. The result: Excellent backups of weeks old data.
Obama gave a beautiful speech today -- no doubt the use of language and delivery are a large part of that, but I find the beauty of his speeches is in the ideas.
Too often politicians fall back on flowery, patriotic language that lacks meaning and substance. Obama's speeches seem, to me, full of purpose and direction. They clearly communicate values, priorities, and objectives.
I'll miss the local sports coverage, box scores, etc. All of this is online, more or less, but it's just not the same.
I'll miss the local news. Our local newspaper plays a valuable role as watchdog. They recently brought down a corrupt mayor, for example. But even the mundane news is useful: road construction, a new restaurant opening, what's playing at the local theatre, etc.
But, I was raised in a home where both my mom and dad read the newspaper everyday. So, I've been reading the newspaper for almost my entire life. Whenever I move, I leave one local newspaper behind and start reading a new one. It gives me a sense of place. A sense of community.
So it's hard for me to imagine a world without newspapers. Sadly, it appears to be inevitable. My local paper recently announced that they'll be cutting home delivery to 3 days per week...
It took me a while to figure out how to "undo" the slide. First I tried clicking the link that triggered the slide, then I tried clicking around the side pane itself, then I looked for links that might close the side pane, then I finally clicked the original page and it slid back into focus.
And, that's the unfortunate problem with cool javascript UI enhancements. Unless they win the javascript lotto and become really popular / prevalent, users often don't know know what to do... Which is a shame.
But, nevertheless, nice effect.
You really need more than one copy in more than one place if you want to be really confident that your data won't be lost.
Is all your data worth the effort? Is it healthy to try to hang on to everything?
It's a shame when people lose stuff for reasons other than neglect, but it happens. Start over or work on something new (and treat it like an opportunity, not a chore).
Also, looking at this list is looks like the quickest path to the top is to develop open source software for other programmers. Perhaps a javascript library or a web framework or software used by github itself.
For someone who loves Merb and had decided to leave Rails behind (as much as possible), I have very mixed feelings about this. If this means Rails will start to feel more like Merb, fantastic! Otherwise?
I have a feeling it'll be a long while before I really know how to feel about this...
It'll be interesting to see how well this merger actually works in practice. It seems like when large companies merge the results are often underwhelming. Can a merger of large open source projects work? Will the different cultures clash?
Way back when, I used Quartus Forth (http://www.quartus.net/products/forth/) to write a few small games for my Palm. Quartus is (was? looks dead...) an onboard Forth compiler -- Forth is a very compact language which is handy when you're writing code with a stylus.
The thing I remember most about it was that the actual coding was probably more fun than that playing the games I wrote. There's a kind of puzzle solving element to learning a stack-based language. I already knew how I'd write such-and-such function in a C-like language, it was all about arranging words in the most succinct, efficient manner possible to create the equivalent function.
I don't think I'd go back to Forth or another stack-based language for a project these days, but I'm glad for the time I spent playing with it.
I don't know if it's really taken off, but a bug tracking tool like ditz could really benefit from this (it can generate an html report based on the bug "database" stored in your git repo).
Check for the existence of methods before adding them. Don't overwrite existing standard lib methods. If you do overwrite one, alias it, call the alias from your replacement which should add something without noticeably changing the original behavior.
If you write unit tests, it shouldn't be too difficult to detect that a library you depend on has changed the behavior of a standard method in an unacceptable way. I've encountered collisions like this, maybe, a handful of times and each time finding and resolving the problem was not difficult.
I've been writing ruby software for several years now, and there are definitely libraries that annoy me (ahem activesupport), but the utility of having open classes has far outweighed any of the negatives. Let's face it, in any programming ecology there are going to be some awful libraries. Bad programmers don't need open classes to do damage.
Partially answering my own question: