Friday, April 17, 2009

Loves me some red line

So I just got a job, which makes this blog title outdated compared to my situation.  That said, this will be my last post on here.

So one of the interesting things about my new job is that I'm learning to use a mac, and some associated stuff like Textmate.  Altogether, it has been a welcome change.  Textmate is great.  The UI is great.  The unix stuff underneath is great.   It's nice for programming, and I can use proprietary formats, etc.  Fantastic.  I'll be buying one ASAP.

A while ago, I had a post about Paul Graham's essay about Cambridge being a great place for startups and smart people.  (This was before he moved YCombinator out west.)  He talks about it being in the air.  How we have high quality eavesdropping here.  I actually received proof of that my second day here.

I was in the terminal, and I wanted to open an html file with firefox.  And I typed  "fi (tab)"  Nope.  No tab completion for firefox... Okay.  So then how about "firefox index.html"...?  Nope.  No good.  Then, I typed "open index.html"  I haven't touched a mac terminal before 2 days ago, and at the time, I chalked it up to a guess.  Then I remembered.  I was on the red line a few months ago.  Two college kids were talking about the "open" command, and I overheard them.  In this case, I consciously absorbed what they said, but I wonder how many things I'm learning in the background....

Well, as I said, this is the last entry on here.  My github account isn't going anywhere, and I'll probably link to my new blog on there.  

Over and out.

Wednesday, March 25, 2009

There is nothing wrong with your television

I've been watching episodes of Outer Limits on hulu lately. I just got through the new(in color) episodes that were posted, and contemplated watching some of the old black and white ones. But, then I noticed something. The new episodes are around 44.5 minutes. The old ones are around 51.5 minutes. Comparing a few other old shows to modern ones shows the same tendancy. Basically, it seems that, for either half-hour or full-hour shows, people ended up having twice as many commercials in there.

Interestingly, I can watch either one now, and I will watch about the same amount of commercials, maybe slightly longer for the slightly longer show. Either way, it's somewhere around 2.5 minutes for a 44.5 minute show. 2.5 minutes. If it was 15.5 minutes, I could most likely find a torrent and put up with some of that hassle. 2.5 minutes is hard to beat though when you include all of the hassle that can come with that.

Overall, watching Outer Limits on hulu does not have the same effect. First of all, it's anytime you want, instead of at 2AM when you're already a little tired and in "what was that?!" mode. Second of all, they don't control the horizontal, or the vertical. The can't expand one single image to crystal clarity. When I watch, I change tabs (especially during those agonizing 2.5 minutes). This feels less like being defeated by the show's intro than actually changing the tv channel. I am controlling what I see, and I can skip the intro, because it's just creepy. And suprisingly, the actually show is almost not creepy at all when you cut out the intro.

The first statement though, "There is nothing wrong with your television." That one's interesting, and raises a few questions. Why do I have to watch 6 times as many commercials on it than on hulu? Why are there so many channels, and so little quality?

Often, what media you consume can be a defining feature. In high school, this was simple. There was one kid I was friends with almost strictly due to him watching the Simpsons every Sunday. Comedy Central was only in some lucky areas, so in the early days of South Park, those kids got to be so much cooler than everyone else.

What now? Well, everything pop sucks, and everything not pop is... well, most of it sucks too. I'm not sure how to abstract this problem, but to characterize it, here's something that happened recently. Someone asked me "what music do you like?" My mind is completely blown by the scale of that question. The last three albums I acquired were the following. Mediafriend- "I don't feel like this is happening", Oasis(an American folk band)- "Oasis", and Anamanaguchi- "Dawn Metropolis."

The first album I bought from a guy at the Somerville Fluff Festival. He was selling a cassette decks mounted on cigar boxes with switches to control the the playback speed of the tape. The CD cost "$5 or whatever." Oasis is a band from the early 70's that Pandora recommended, after listening to lots of annoying stuff. The album was being sold on a website from 2001(and it shows), but the links to buy it were all dead. After an hour of google searching, I found a blog that linked to a download on megaupload or something. The third, is a chiptune band that my friend recommended.

So what do I say? I like weird stuff? I like things that take serendipity to find? I don't know.

Despite not having to watch commercials, it seems to take more energy than before to define, or at least describe myself through media that I appreciate.

Thursday, March 19, 2009

WRDD and FRDD

In his rails class, Matt Knox mentioned a development ideology that may have only been used by accident before. He called it WRDD (web request driven development), in the style of TDD or BDD. Basically, you run an unfinished site live, and make the pages as people find their 404s. Taken further, this idea could be extended into FRDD, or feature request driven development, where the site has no original intention.

Of course he was joking, but I'm wondering if there isn't some merit to it, at least as an exercise in speedy iterations. It makes me think. Basically you have three things to worry about. The first two are the things you need, content, and a place where the content goes. Third, you need a way for users to communicate with you about what they want.

This might be an actual good case for firef.ly. They can communicate where things should be, it doesn't get in the way, and you can have on record who said things when.

I can't see it working too well for commercial purposes, but hobbyists and students might get some benefit out of working this way. A contest or class organized around this could be quite interesting.

A web-design version of pig anyone?

Monday, March 9, 2009

Platoon for NES


http://vgmaps.com/Atlas/NES/Platoon-Stage1.png

Wow. This is really reassuring. I thought that sucking at Platoon when I was 7 had something to do with me being stupid or a terrible soldier or something. Turns out that, just as I remember it, everything DOES look exactly alike, and there's no reason that I should have known what to do. I guess the best that I can hope for is that the designers were trying to make some commentary about the Vietnam war being unwinnable.

I really enjoy that I'm old enough to be crotchety about video games now. Why, in my day, we had games that made no sense, where you died constantly. And we LOVED it! Our controllers had cords! Personalized avatars? Ha! Two choices: red guy or blue guy. Both 7 orders of magnitude more bad ass than you'll ever be. Memory cardsjavascript:void(0)? A memory card is writing down your password on your mom's recipe book, and hoping to god you remember which ones are 1's and which ones are l's when you put it in next time. Or you start the game over. And god help you if that game is Willow.

Hard Stuff in Ruby- Part 6: Method Missing

What is method_missing? It's a way of enabling your code to figure out what to do when a method is called that isn't defined.

Under normal conditions, this will throw a NoMethodError:

"a string".some_method

Throw this in:

String.class_eval "def method_missing(methId); puts methId; end;"

Now "a string".some_method returns "some_method".

Sweet. How is this useful? It might be irresponsible to throw one of these in everywhere you can, because everything could inexplicably without some error handling. Nonetheless, basically, you get a nice system for handling some big chunks of the unknown.

One of the areas where I'd thought it might be useful is with a DSL for music. Say you're handling an arbitrary amount of accidentals with a note. g.b makes sense. So you define a .b method for notes. Okay. What about double b? g.b.b should be fine. Looks a bit odd. g.b(2), that is awkward, and it might be best to reserve a numerical param for other data such as octave, chord type, etc. An options hash would do the trick, but it could look a little more natural to a musician if it was g.bb, right? THAT is what method_missing can do for you. Interpret the number of flat symbols and pass that off to the function that does the work. Neat

Okay. So that's it for the Hard Stuff in Ruby list. I don't think that this series demonstrates or necessarily provokes brilliance, but I hadn't seen a list of hard topics, with just basic explanations anywhere else. The docs can be incomplete, and most blogs usually focus on more "interesting" (inaccessible to mortals) applications of different topics. There are some exceptions, but a good deal of what I've seen.

Getting over the hump is crucial though. It's the difference between either understanding someone's presentation (or blog) or not.

Till next time


Hard stuff list:
-Metaprogramming
-Blocks
-Lambdas
-eval methods
-bindings
-Singleton
-Method Missing

Sunday, March 8, 2009

Hard Stuff in Ruby- Part 5: Singletons

Okay. There is some weird stuff with this one.

The simplest application is that you can use it to overwrite class behavior on a specific object.

def instance_of_object.method
end

What else? It might look like this:
class << instance_of_object
def method
end
end


This has been described as an essential technique for metaprogramming, but the low hanging fruit is very basic. If you want an object that doesn't necessarily tow the line according to it's class, use one of these.



Hard stuff list:
-Metaprogramming
-Blocks
-Lambdas
-eval methods
-bindings
-Singleton
-Method Missing

Hard Stuff in Ruby- Part 4: Bindings and eval

Bindings and eval are advanced topics. For starters, get into irb (or rails console), and try a basic eval statement:

eval "t = 'lksjafsdn'"

same exact result as just typing:

t = 'lksjafsdn'

But there is one main difference in function. You can also pass in a binding object as a second parameter. What is a "binding?" It's the context where the code is evaluated, so you can still access variables in those contexts. So you can pass around a context, return it from a function, etc.

Okay, so what else can you do with a binding? You can change it. Let's say that you are trying to see inside of an object that you created. Just use cb(Object,class,etc.) So now your inside the object, and instead of saying "self.method_name", you can just say "method_name". So naturally, just typing "self" returns the object that you are demon possessing. Freaky.

You can keep changing the bindings, but if you leave your main context without saving it somehow, there's no way back.
or is there...
Whoops. Just kidding. Here we go: cb(TOPLEVEL_BINDING)

Either way, this is still worth checking out. It gives a few other interesting options for dealing with this kind of stuff:
http://github.com/mattknox/repl/tree/master


If you want a good reference for basics on bindings, here's a good one

http://onestepback.org/index.cgi/Tech/Ruby/RubyBindings.rdoc/style/print


Okay, so you have a lot of specific ways to evaluate in particular contexts. Sweet. Anything else?

Glad you asked. Here you go. We covered basics of eval, but there's also class_eval, module_eval, and instance_eval.

They all act pretty much as expected. Conceptually, you can now stowaway in an object without changing your binding. The following are equivalent:

MyClass.class_eval "some code"
and
cb(MyClass)
eval "some code"



Hard stuff list:
-Metaprogramming
-Blocks
-Lambdas
-eval methods
-bindings
-Singleton
-Method Missing

Monday, February 23, 2009

People Who I Know For A Fact Are Left-Handed

Obama
My Freshman Roommate Brian
Link
Gannondorf

Edit: Apparently, Link isn't left-handed in the Twilight Princess Wii game, because 6/7 of people would have a hard time with that.

So here's a new list of my guesses of who that might have pissed off, and why.

Obama- probably doesn't have too much time for games. But, if he DOES want to unwind by visualizing himself as a left-handed hero who has the ultimate responsibility of saving the world from the forces of evil though, then he... actually, nevermind.

My Freshman Roommate Brian- He manages to play guitar(hero and regular) just fine, so can probably manage to swing a wiimote with his right hand. As far as I know, he was more of a RTS guy anyways though, so it probably doesn't matter.

Link?- If he was to somehow play as himself in his own game, then he would be watching himself do things the opposite of how he would want to do them sort of. So picture yourself trying to throw something with your non-dominant hand. Now picture yourself watching a movie of it. Now picture watching yourself die because you suck at throwing with your other hand. Yeah, this one's legit. He'd be way pissed.

Gannondorf?- If he played Twilight Princess, he might be happy to suck at it because he would see his nemesis die more often. But it might be more fun if he could steer him directly into death. This one is a toss up.

Me- I'm not left-handed, but this is just another case of me thinking that I have a grip on the world, and I'm so very wrong. I thought I had my facts straight. Oh well.

Wednesday, February 4, 2009

nil blank empty

Good to keep in mind. blank? (Added by rails active support) applies to nil and empty strings. False.blank? also evaluates to true... not idiomatically reasonable though, so I might not use that one.

irb(main):015:0> false.blank?
=> true
irb(main):006:0> "".blank?
=> true
irb(main):007:0> "".nil?
=> false
irb(main):008:0> "".empty?
=> true
irb(main):009:0> nil.blank?
=> true
irb(main):010:0> nil.nil?
=> true
irb(main):011:0> nil.empty?
NoMethodError: undefined method `empty?' for nil:NilClass
from (irb):11
from :0

Sunday, February 1, 2009

Superbowl Halftime Show

Bruce Springsteen has a wizard playing saxophone for him.

Awesome

Thursday, January 22, 2009

Memcached warning

Apparently, even though it appears to take a string as a first argument, it must convert it to a symbol, because it won't take strings with a space in them. Unexpected and odd. Throws this error:
ArgumentError: illegal character in key

Thursday, January 15, 2009

Matz Translations

A couple of months of personal posts/nothing and then bam. Three straight days of posts about ruby stuff. That keeps the translation on git hub busy.

Sweet. And in other news. I'm back on the leader board for current streaks on calendar about nothing.

Woot.

Tuesday, January 13, 2009

Merb/Rails Merge Talk by Foy Savas

Foy Savas gave a talk today at the boston.rb meeting about the upcoming merger. I was taking notes in my igoogle blogger gadget, but after his talk, and before I saved the draft, the page refreshed and I lost what I was doing. Here is my sparse recollection of what he said.

Right now, they are still ironing stuff out. A lot of stuff. The progress is here: http://github.com/wycats/rails/tree/master

He described his background as being a Rails developer, then a Merb developer, and now he's becoming a Rails developer again.

If you're using Rails, keep using Rails, if you're using Merb, keep using Merb.

Rails will benefit from some modularity that is present in Merb. Foy compared Rails to Lego, and Merb to Duplo. The stack will be easier to take apart and substitute one part for another. The defaults seem like they will favor some of the Rails stuff, but a lot of that will be replaced or heavily worked over. In any case, Everyone will have more options.

A Merb "slice" might be called a Ruby "engine".

The new router will be sexy. Other things I can't remember will be sexy.

There will be a new ORM which I think he called Active ORM.

His book, The Merb Way, is still going to come out. And he's already anticipating a sequel. He didn't get into specifics of what had to change due to the merger.

Foy asks: "What will Merb mean in the future? Agnosticism and Modularity." So apparently it will apply to concepts rather than actual software?

In any case, he said that by RubyConf... or was it RailsConf... he would have something more definitive to discuss.

There is a lot that is still up in the air with the merger, and Foy made it clear that he has a predilection to push back releases.

Also, apparently, Foy lives in the South end, and likes it quite well. He pretty much called it the Merb of Boston, due to it's awesomeness and the fact that "the tracks don't go there." Rails, tracks... get it?!

In a related note, Foy did not announce any plans by the merger team to make the South End T accessible.

Friday, January 9, 2009

FFVI- J Style

So it's about my 29th time through FFVI. I've been pretty much in love with this game since I first saw it. I've made attempts at playing it in Japanese before, but it's usually been more frustrating than fun.

This time is a little different. I don't exactly glide through it or anything, but I'm having a much easier time with the reading. Part of it is a little private rails app that I made to keep track of my Japanese in the context of the script from FFVI (among other texts). I'm thinking of releasing some version of it soon, but till I put it out there, it's mine.

Anyways, I've noticed a couple of things about FFVI in Japanese that I don't think are handled the same way in the English translation. Some of this might be my own bias. Japanese is my second language, and I don't know if there has been research done on this or not. But when I read something in my second language, it somehow seems more important. Maybe because it takes more effort? I'm not sure, and I don't really want to throw in too much arm chair psychology here, but...

In any case, there are two main ways that I see the game being different. First, the characters seem more vibrant in the Japanese version. Edward is a little more pervy. Sabin is more of a meat-head. Terra is a lot girlier. Part of because of what can go in the Japanese version. ie. An old woman saying that Edward tried to get with everything from children to her. That wouldn't fly in America. I don't think that American players would like Terra coming across as weak either. That aside though, there are some ways where it seems like the Japanese can be more expressive with less text. All it takes is a little final particle, and it automatically portrays a particular type of character. In English, it might take a few more sentences with more subtle word choices to give the same effect. The real key here is that these final particles alone are not only telling of emotion or personality, but that they can appear nearly irrespective of topic or to some extent, complexity of the idea presented.

I've noticed this in other Japanese games too. Watts in Secret of Mana comes off as a little gruffer. All it takes is a little "zo" at the end of a sentence or two.

The second big difference is that FFVI seems a bit more self referential in Japanese. At the end of the imp's description of how to use Gau's Leap/Rage skill, it says something like "back to the game." And I think that there was a point or two earlier on too that let me know I was playing a game. It's not old guy muppet style "at these prices!?" distracting, but it did catch me off guard as I didn't remember getting that feeling in the English version.