March 31, 2010

Code-related lulz

The first is the only conceivable improvement I could think of for my baby, vim. The second is the source code for ed.

Both from this reddit thread.

Paul the lil' misogynist

The longer I'm away from home, the more I forget about where I come from. I'm on Spring Break now, and usually when I'm home I spend some time digging around the house for archiving material. During my last Spring Break I put some kiddie pictures on Facebook that was met with much enthusiasm from my family. This time, I have a video.

My school had a tradition of putting 4th graders in little skits, and I was in one called Sammy Carducci's Guide to Women. (based, as I just found out, on a terrible-looking novel for middle schoolers).

The director of these shows recorded them, and gave to me a DVD he'd made as a graduation gift.

The second half of the scene is below (the first half is out of focus, you need to wait a few seconds on what I've embedded below). Lord, what a strange thing to look back on.





Highlights are at 2:13 (I make some really amazing, kind of demonic throat sound), and the freak out at 3:10.

Transcript of the scene after the jump...

----
Unrelated, but cool links I found this morning: a concise prediction I agree with on where computers are headed (differentiating between 'people' computers and 'geek' computers).

Bullet points on why smart people fail to be successful. While the choice of words is muddy, I found a lot of his points resonated with me. Arguably the best thing I learned at Brown was the hard experience of occasionally failing, which was absolutely necessary to (stealing his jargon) 'leave the sandbox.'

Finally, having front-end web dev skills went from being able to navigate awful w3schools tutorials into a proper science of its own. Even if you know CSS and basic Javascript, there's pitfall after pitfall in the trenches of the real world. I found this list of requirements for new hires to be a good primer on what are contemporary considerations.

March 23, 2010

Books, Books, the Musical Fruit

A lot of big-time, 'real' bloggers are writing about their 10 most influential books. I'll present mine here, stealing some terminology: this is my 'gut list,' not my 'I've thought about this for a long time' list:


Don Quijote (Cervantes)

'Misfit' entertainment is on the rise: Napoleon Dynamite, Eagle vs. Shark, and pretty much everything starring Michael Cera are examples of movies where we celebrate and flesh out the weirdos, oddballs, and losers of society into something a little higher. This 'not-like-the-others' quality is all over my list.

None of them hold a candle to Don Quijote, however. He embodies that cute Akira Kurosawa line: "In a mad world, only the mad are sane." While you the reader know he's off his rocker, and that you're "better off," you sort of envy him. He's happy as a clam! He's living the adventure! You can almost always open up to a random point in either of the two volumes to see Quijote having a good time, and Sancho being completely lovable.

I feel like my connection with this book is like a lot of religious people's with their Holy Text: I haven't read every word of it, and its been so long since I read it that I'm probably just taking what I want to remember out of it. I'm sure my many memories are easily amended and disproven by someone who's really studied it. But it left enough of a mark on me to bring my dog-eared, notes-in-the-margin copy everywhere I go.


Short Stories (Jorge Luis Borges)


My former Spanish teacher quipped that Borges probably wasn't the most read Spanish author, but the most reread. You can see why: his short fiction is jam-packed with beautiful imagery, contradiction, love and meaning. They're Everlasting Gobstoppers.


The White Tiger (Aravind Adiga)

A recent addition, I just finished this about a month ago and absolutely loved it. Murder is one of the most interesting themes in fiction, especially how we can make someone else killable. The character's progression/descent into murder in a modern capitalist society is entertaining and evocative.

March 22, 2010

Games

Made two demo videos, for my Independent Study making games. The first was our collaborative effort, a Hungry Hungry Hippos-type game called Penguins:



The second was a Tetris Attack knockoff I call FlipTile, which I did on my own just for kicks one weekend. I hope to take it far, but time! TIME!!!



I rather enjoy Android dev, and game dev in particular. Maybe I can pursue this?

After working on these videos, I'm tired of hearing my own voice. I need to make another one of these tonight, chances are I'll use an accent.

Finally, I might dedicate a future post to the Fail that is iMovie. Apple recovered the computer market in the early 2000's with OS X, and one of the major plugs was the package that was later packaged as iLife. iMovie used to be a major perk of migrating, but since they branched the two to iMovie (free) and iMovie HD (which they now sell!), the free one is full of bugs and anti-features.

March 21, 2010

On Jazz, popularity

Another not-very-hackery article on Hacker News caught my attention. Dyske Suematsu (in 2003) gives a few reasons to why we don't hear jazz on Top-40 radio stations, making claims like "our ears are getting lazier."

I'm taking a computer science class called Solving Hard Problems, but reading the article and the epic comment thread that ensued reminds me that our Hard Problems are really bollocks: our problems are at least solvable. Even if they aren't, they're well defined enough to know when we've solved them.

Try answering "Why isn't Jazz popular?" and all you can do is approximate. Social scientists have much more courage than I do.

To paraphrase Valentine Coverly from Arcadia, "We know better what's happening between two electrons or in the inside of a star than whether or not it'll rain on our picnic next Sunday." Valentine spoke of knowing about the really big and really small, but that chaos theory prevents us from knowing anything in between (things that, you know, matter).

(to break visual tedium, enjoy the pictures from my high school production of Arcadia, which I directed as a senior for our annual student-directed show. Do they still do them?)

I told you that to tell you this: I'll give some reasons why I believe we don't hear more jazz all around us, but I understand the limitations of my arguments, and that they're specific to me.

Chloe, Valentine, Hannah, Bernard, and Augustus
Chloe, Valentine, Hannah, Bernard, and Gus

March 17, 2010

On how knowledge turns to Snobbery

I used to read A List Apart religiously, back when I was a lamer-than-lame "web developer.*" I've slacked off on reading it because I haven't touched much web dev recently, but it's still an amazing online magazine, an example of well-published content on the web.

One of their articles is on the "Cold War" between Flash and HTML5 proponents, reignited by the iPad lacking Flash support. He describes the pointlessness of the fighting effectively, and it generalizes to programming language fanboy-ism:


The problem with rallying behind a technology is that it traps us within the confines of its constraints. We easily shift "don’t know" and "not sure" into "can’t" and "won’t." Creativity is dictated by programming languages. How sad.

Technologies aren’t inherently bad or good. They’re only appropriate or inappropriate for certain circumstances. They’re a means to an end, not solutions within themselves. Each one is powerful in its own right to accomplish a certain goal. The responsibility to use an appropriate technology lies with the one who made the choice. Unfortunately, we’ve misinterpreted irresponsible development as inadequate technology.


I usually avoid using Java, but this doesn't mean that I hate it, and I'll never state that it is simply bad. I simply usually note that it's not the best tool for me to use on whatever job I happen to be avoiding it for (and I don't always avoid it; rarely but sometimes it's the best tool for job).

I referred to this in the post on my vim use: flame wars on personal choices of technology are pointless.

My favorite part of the above passage is the line We easily shift "don’t know" and "not sure" into "can’t" and "won’t." Usually, that's what's happening in a flame war; the opponent of language X doesn't know X or even familiar with the paradigm, but trashes it because they're perfectly fine without it. (The logic being: I know programming. I don't know X. X is not real programming). I get this a lot from people not versed in functional or declarative languages should I start talking about one.

Similarly, even if you know about and just know better than to use X (many functional kids like me on C++, Java), flaming is unconstructive, and these "smarter people" somehow forget a basic fact: great software is written in these languages. Many people are plenty effective in these languages. So let them have it.

Last semester I was a real language snob. I still have strong opinions, and treat language choice like the director of a play treats casting (its the most important part). But hating on a language "just because" is like looking at an actor and saying there is no role he/she is fit to play, which only shows you're limited knowledge of plays and lack of imagination for new ones.
----
* = When I say web developer, I mean it in the lamest sense possible. About 3 years ago, when I first started programming on my own, the motivation was to make sweet websites. Unfortunately, I wasn't much of a programmer. I'll take the snippet on "web programmer" from evolution of a Python Programmer to demonstrate the kind of code I wrote for an old theatre board website (since destroyed):


#Web designer
def factorial(x):
    #-------------------------------------------------
    #--- Code snippet from The Math Vault ---
    #--- Calculate factorial (C) Arthur Smith 1999 ---
    #-------------------------------------------------
    result = str(1)
    i = 1 #Thanks Adam
    while i <= x:
        #result = result * i #It's faster to use *=
        #result = str(result * result + i)
            #result = int(result *= i) #??????
        result str(int(result) * i)
        #result = int(str(result) * i)
        i = i + 1
    return result
print factorial(6)



(shudder...) So glad those days are behind me. Also see evolution of a Haskell programmer ^_^.

March 16, 2010

A fun twist on Queues from Stacks

There's too, too much to write about, but I'm going to make a little diversion known, because it blew my mind. I have to give credit where its due: this comes to us from the peerless Matt Wilde (cs dept.,facebook).

The problem is this: our friend Josh was given some screening questions to qualify for a programming interview (to make sure he wasn't one of those programmers who couldn't program), and one of the questions was "Recall that the Stack ADT contains push(E), pop(), ... Implement a Queue using a Stack."

Now, this interview question is very common, if you disallow what was almost certainly an error in the problem phrasing; usually it's "Implement a Queue given Stacks" or "If you had a library that produced Stacks, how would you implement a Queue?" (answer at the end, for those who don't know and/or don't want to figure it out.)

But the problem was unclear: using a Stack? Only a single instance? Is it even possible? The common solution to the common problem uses two stacks. Mr. Wilde came up with the following solution, which does in fact use only one instance of a stack: use the program's call stack, along with recursion, to keep track of intermediate values. Shown algorithmically (in Ruby, since it looks the most like pseudocode):


 def enqueue(element)
     @stack.push element
 end

 def dequeue
     if @stack.size == 1
         return @stack.pop
     elsif @stack.size > 1
         tmp = @stack.pop
         value = self.dequeue
         @stack.push tmp
         return value
     else
         raise EmptyStackException
     end
 end



Amazing! Here's the standard solution with two stacks:


 def enqueue(element)
     @first.push element
 end

 def dequeue
     if not @second.empty
         return @second.pop
     elsif @first.empty
         raise EmptyStackException
     else
         while not @first.empty
             @second.push @first.pop
         end
         return @second.pop
     end
 end



The intuition in this case is that you use one stack for enqueueing and another for dequeueing. When the dequeue stack becomes empty, you remove all elements from the enqueue stack into the dequeue stack. This puts the enqueued elements in the dequeue stack in reverse order, meaning you can pop them in the order they were inserted in.

This gives you constant-time performance on most enqueues and dequeues, with an occasional O(n) for when the dequeue stack runs out.

March 11, 2010

Good Music

I've been hitting some hard times this last year, namely aftershocks of my sister's illness, as well as personal/relationship troubles which may or may not be related. It isn't the purpose of this blog to delve into them, I'd rather share the better parts of my life, and part of that is the music that helps lift one out of the blues.

Two pieces I discovered in the interim time period that are simply phenomenal recordings:

Christian McBride
Night Train - from the album Gettin' To It
A solo bass performance (Jazz).
Christian McBride - Gettin' to It - Night Train

Michael Cleveland and Flamekeeper
Jerusalem Ridge - from the album Leavin' Town
A fiddle and mandolin duet (Bluegrass).
Michael Cleveland and Flamekeeper - Leavin' Town - Jerusalem Ridge

A few notes:

  • I'm providing links to the iTunes store. Obviously I can't stop you from downloading them illegally, but I recommend you purchase them. At 99 cents, it's not much, and these are both living musicians trying to make a living today in genres that aren't very popular. These guys are clearly doing it for love of music. Also, the YouTube versions of these songs are generally terrible, if applicable.

    If you must 'try before you buy,' iTunes gives you a 30 second preview. Alternatively, if you buy them and hate them, (and you're a friend of mine) I can give you two bucks back.

  • Listen to them loud. They're both string pieces, and ideally you'll listen to the loud enough to hear after-pluck resonances (in one of them, you can even hear the artist breathing). You won't regret it ^_^

  • As with most (strangely, not all) music, you'll get more out of it if you listen purposefully. Clear your mind, hit play, and let it sink to you


Naturally, I also love the music of my brother Robert Meier. He's the bassist on two albums by very talented composers he went to school with, give it a look ^_^.

March 8, 2010

Comix, miscellanous

This weekend I treated myself and bought the first Deluxe Set of Y: The Last Man (issues 1-10, I had the second set before by a happy accident). It's really a marvelous comic, and suggest people take a look at it.

My friend Lyn has a comic of her own, which I also greatly enjoy. I keep petitioning for the inclusion of another character, and maybe one day my calls will be met.

Last summer I tried to get a comic going. I considered posting the 1.5 pages I completed. It was going to be based in the world of the Catlevania: SOTN tribute I thought about writing. I may get back to it, in the meantime, here's the basic 'standing sprite' I drew, both the complete (enlarged, sorry for the blur) version, and the to-scale evolution using Derek Yu's Pixel Art guide:



An animated gif showing my sprite evolving!
Finally, I can't stop watching this (make sure you full-screen it):



The song is great, if only because it channels chip music. But the animation! Made with real wood blocks using old-school stop motion? It inspires me to create.

March 7, 2010

TeX, Culture.

On the old (lost) blog I had a long post as to why I used LaTeX instead of Word, even for non-mathematical documents. I'll surely re-post it sometime (I have the source somewhere...), but in the meantime, this little comparison beautifully demonstrates the aesthetic advantages. It also links to this essay, which very articulately describes many of the other advantages.

---

On Hacker News someone linked to a very non-hacker article, namely, an author of the gaming site Kotaku is very displeased with many things Japan. It's a moderately epic rant, I only made it until about halfway down before I had to be somewhere else.

It's interesting in the way I find very crying babies interesting*.


* = Crying babies, to me, are hilarious and very interesting. It's a display of emotion we 'grow out of' (read: learn to hide) and almost never see again. Do you see how hard babies cry? Heave in their chests, deliberately take in as much air as they can for the express purpose of yelling louder? And then they do it again! You never see grown-ups do anything like it.

I think the poor guy needs a) to come home for a few months (depressurize), and b) stay there for at least a few years, since he seems so far gone in his bitterness to give it a fair shake again. Many of his gripes arise from social issues regarding his differences (vegetarianism, his unfortunate allergy to alcohol), particularly in a professional social setting.

Bad news though: that's true most everywhere. In many corporate dinners in this country, being a vegetarian gets you all sorts of weird looks (going to a steakhouse and ordering a salad?). While his distinguishing features are obviously more acceptable here (tautological, since he's writing from a US perspective), I hesitate to believe our businesspeople are paragons of tolerance (just think of all the ways to blow a professional interview. Most have nothing to do with substance).

This isn't to say his article is completely baseless; I would likely agree with the part on smoking. At the very least, parts of it are entertaining, the segment on 'mistress bars' had me laughing out loud and got me wanting to get into theatre again (this kind of human-interaction 'market failure' is what makes life worth living).

But many of his points, namely the cultural artifacts (music, comedy) are so bad they merit further discussion. First off, when is it ever a good idea to criticize how 'smart' popular media is, and derive cultural judgment on it? Especially when you're from here?



Complaining about comedy being all about 'catch phrases' ignores too many lame catchphrases that got too trendy here. I've heard "I'm Rick James, bitch!" way too many times to ever find it funny.

Speaking more broadly, other cultures find other things funny (this is the basis of the Bumblebee Man character on The Simpsons). This shouldn't be surprising, since (by definition) other cultures live differently than you do. So complaining that a stand-up comic doesn't want to joke about masturbation (like they do here) tells us more about you (expecting to find things funny to you, somewhere else) than it does strengthen your argument.

Add this to the contradictions ("the stereotyping" is a gripe of his, after saying he hates people fitting an "everybody's uncle" stereotype, among others) and punitive tone (he digs a lot on an ex-girlfriend he had there) make this another Rick Santelli rant: entertaining, angry, and wrong. Like the Santelli rant, you only hope (but know otherwise) that people are smart enough to not believe it.

(usual disclaimer: I'm not arguing for moral relativism, or universal acceptance of all cultures. There are many legitimate issues that can and should be soberly addressed. The Kotaku author makes very few of them, and makes them poorly.)

Edit: The comments refer to the last five paragraphs ("Can Videogames Make Us Better People?") as the "real" article. I would recommend reading it. My commentary is the same: the rules he complains about exist here too, you just don't see them as starkly since you're from here.

March 2, 2010

My brother and I

I just finished two major works of code and a midterm, but why not share some graphics love?

This is an image I drew to replace my Facebook photo (the old one celebrated Celebrity Doppelganger Week):



And this one continues in the tradition of memes (starring my brother Robert in Guatemala):

March 1, 2010

YEEEAAAAAAH

I love memes, but haven't produced any of my own. In light of this awful, awful late night coding, as well as the newest episode of Burn Notice, here's a quickie: