## May 20, 2013

### Embracing Remix Culture

"Good artists copy; great artists steal."
The first fandom I was ever really got in to was the Redwall series. Pokemon was another thing I was a fan of for quite a while, along with Dragon Ball Z. Recently I've become a fan of My Little Pony: Friendship is Magic. Both My Little Pony and Pokemon are notable for producing truly absurd amounts of fanart. Many people aren't actually aware of the massive amount of pokemon fanart that exists. Sonic is another fandom that produces stupendous amounts of fanart, and some of it is incredible:

Cracking down on fanart is obviously a futile endeavor, and so it has persisted in a legal grey area. People regularly sell unauthorized fanart at conventions like Emerald City Comicon, but it's largely ignored by the large companies, since the benefits clearly outweigh the costs of actually pursuing legal action. The exception to this, at least in recent years, seems to be games. For whatever reason, games are a large enough endeavor that they attract the attention of large companies and are squashed regularly. There have been many, many fan pokemon games (usually aimed at building an MMO) that have been shut down by Nintendo despite the fact that an official pokemon MMO has yet to materialize.

This happens even when the games are non-commercial, which is frustrating, especially when the game in question has clear, obvious disclaimers that it is not officially sanctioned and has no affiliation with the original company. If the company is so worried about maintaining the image and representation of its trademark, why doesn't Nintendo do something about the terabytes of pokemon porn being produced? The answer is that it can't, because there's just no economic way to do so. I bring this up, because this raises an interesting question: If Nintendo has been forced to allow truly absurd amounts of rule 34 being applied to literally every IP that it owns, why hasn't Nintendo's brand image suffered at all?

It seems to me that a large amount of this stems from the overzealous protection of brand image that heralds from an era when brand image was easily corruptible. This isn't 1990 anymore. We live in the age of Rule 34, where there is easily accessible, unspeakably horrible adult pornography made of basically everything that exists. The internet generation has grown up in a world where the instant we leave officially sanctioned websites, there will be grotesquely inappropriate artwork drawn that involves that franchise. We know this art has nothing to do with the official image because it's obvious and we're used to it. If someone makes an unofficial Pokemon game and it sucks, no one is going to mistake it as an official Nintendo game and fault Nintendo for it unless it gets really big.

Even if they do, Nintendo's ruined their own IP several times, and it never really seemed to matter. A case study is actually Sonic, which is an IP that has been phenomenally mismanaged by SEGA. They made a reboot of the franchise that is widely considered one of the worst games ever made. Then they released Sonic Unleashed, and a bunch of people grumbled, but they still bought it. Then they released Sonic Colors and managed to at least redeem themselves as being capable of not making crap, and then they released Sonic Generations, which was lauded as being a superb game and sold almost 2 million copies, doubling the sales of Sonic 2006.

In short, it doesn't matter. Even when the companies themselves completely screw up their own IP, it was rapidly recovered from. Franchises are not fragile. Despite this, we have super draconian copyright laws that prevent everything that was made after Mickey Mouse from entering the public domain. So far all we can really hope for is tolerance towards fanart from a major corporation. Given the increasing power of creative tools and the proliferation of the internet, it is becoming cheaper and cheaper for people to make their own art. There is a fundamental shift happening, but no company seems to want to acknowledge it, let alone take advantage of it.

With one exception.

Something particularly magical has happened with My Little Pony, where multiple background ponies have actually been named by the fans of the show. Derpy was the most prominent instance, though sadly the result was censored after it was deemed too offensive to people with disabilities. The fandom has produced ridiculous amounts of art, music, fanfiction, and even entire fan-made episodes. Hasbro has been remarkably lenient about all this, and it gives us a glimpse into the future of creative media. Sadly, the whole game thing is still there, with basically every single fanmade attempt at a My Little Pony game getting shut down by Hasbro (seriously, what's up with that?).

Eventually, modern companies will need to embrace Remix Culture as an integral part of the creative process. I would like to see companies allowing fans to sell their work so long as a 10% royalty is provided to the company, or something similar. This is basically an enormous emerging market that is being completely ignored. Furthermore, as a society, we need to let go of draconian enforcement of IP. Just as the patent system has become hopelessly outdated, so has our copyright system. We are entering a new era, where the tools needed to make incredible works of art are made available to the general population, and instead of encouraging it, we are crushing it.

Companies are so worried about piracy and people not buying their products the way they want them to buy their products that they aren't looking at alternative revenue sources. The companies suffer, the consumers of the media suffer, the fanart suffers, and the world is a less enriched place because of it. Art is an integral part of any successful civilization - look at the magnificence produced by fans of My Little Pony and tell me this isn't something we should be encouraging. I believe that something truly beautiful is happening here, made possible by a bunch of people who like cartoon ponies.

## May 16, 2013

### Contact

"We must be the change we want to see in the world." - Mahatma Gandhi
Given the enormous influence of The Matrix on a lot of what I make, many people assume that it is my favorite movie. My favorite movie of all time is actually Contact.

Many people assume the message behind Contact is that Religion and Science aren't mutually exclusive, but this is only part of the equation. Contact is really about faith. It's about never losing faith in your own passion, regardless of what it is. It can be science, religion, art, music, it doesn't matter. All that matters is that you find your passion, and you have faith in it, and no matter what happens, no matter what stands in your way, you fight for it.

Naturally, in real life, we don't have a Dues Ex Hadden Industries to magic away all our problems, but the movie does an excellent job of making sure the drama that plays out on screen does not undermine it's purpose. Even with virtually unlimited funding, Ellie finds out she's being forcefully kicked out of the Very Large Array. No matter what anyone says to her, she refuses to let it go. At that point in the movie, it is abundantly clear that absolutely nothing will stop this woman from pursuing her passion, no matter how insane or misunderstood it is, no matter what obstacles are put in her path, no matter what friends she may lose along the way. At this darkest hour, after everything seems to be falling apart, she goes to a cliffside to think.

And then she comes back.

She comes back, and she starts listening again, because she isn't going to give up, and that is when she hears the signal. That is when our hollywood movie is yanked out of reality and brings us on a fantastic journey through the stars. It happens after Ellie refuses to give up, even after the universe itself seems to be conspiring to ruin her.

Then, the project is stolen from her repeatedly, and she has to fight to keep it. Then, she is denied her desire to be the one to ride through the machine. Then the machine is completely destroyed and everything she fought for is taken away from her.

Then, our little Dues Ex Hadden comes back. Hadden gave Ellie her funding because of her emotional outburst at the investor meeting. Hadden saw the passion she had, the unstoppable fire and unshakable faith she had in her science project, and that is when he decided to fund her. Once again, Hadden moves us into the realm of fiction, and gives Ellie a second chance.

Contact is brilliant because it begins firmly anchored in reality, and only later, with a few nudges in the right direction, throws us into a world of make-believe. Carl Sagan is trying to make us ask, what if? What if we could fly? What if we could go to the moon? What if we colonized Mars? What if aliens contacted us? Contact shows us how beautiful life can be. It reminds us of all the amazing things that human beings are capable of when we ask that simple question, What If?

To answer it, we just need a little faith.

## April 20, 2013

### Playing On Easy Mode

Many people have difficulty understanding why I'm so upset about failing to do things that are, admittedly, things that very, very few people ever manage to accomplish. By any normal measurement of accomplishment, I should be leading a happy, fulfilling life as some hardworking, trustworthy programmer in a faceless corporation. What people don't understand is that this is the bottom of the barrel for me. Judging accomplishment based on absolute values is ridiculous and poisonous. It breeds entitlement and greed. Accomplishment is relative, because everyone is living life on a different difficulty setting. I'm a straight, white male in one of the most progressive cities in the United States. If life was a game, this would be the lowest difficulty setting.

I realized from a very early age that I was extremely privileged. It was obvious to me that I had the prerequisite talent and intelligence to be very successful if I worked hard. I was also intensely aware of the struggles that my less fortunate friends were going through. I utterly despised at how entitled the rich acted, as if they were more deserving of their money than the people who were simply less fortunate. I realized, if I could get rich, I could fight the system from the inside. Besides, with the ridiculous safety net I had access to, I could take far more risks than normal. This served as a nice dream, but my concrete goals still stayed firmly within the realm of reality.

It was when I took that fateful internship at Microsoft that things began to change. I began to realize that simply by teaching myself how to follow instructions so I could get through this ridiculously broken school system, life was starting to hand me things on a silver platter. I suddenly realized that my current goal of getting a job at Microsoft wasn't actually an accomplishment. It was too easy. Coding came naturally to me, and thanks to having a father who was also a programmer due to living 10 minutes away from Microsoft HQ in Redmond, I was able to start learning at the young age of 14. The demand for software engineers would only continue to rise as I got older, ensuring that I would never have to worry about employment ever again.

It was sickening.

People would tell me how talented I was, fawn over how I would do things that other people would find incredibly difficult with ease. By the end of my second year in college, I had stopped attending classes. I would walk in, drop off my homework, and leave. I still maintained a 3.3 GPA even though I was only trying to ensure I passed my classes. College wasn't worth my time, because it was still the path of least resistance. If I am forced to take on a normal job after graduating, I will not have succeeded, I will have failed so spectacularly that the only thing I was ever able to accomplish was the least difficult thing I was required to do.

On the other hand, a black lesbian women born into poverty in Alabama managing to get an associate's degree out of a community college would be fucking amazing. Anyone who can manage that has already accomplished far more than I ever have. Every time someone tries to compliment me on the scant few things I have managed to do, I want to scream at them to look at all the less fortunate people in the world who have managed to do incredible things, to whom no one pays attention to. I have the utmost respect for someone who can pull themselves out of poverty, because it is extremely hard to do. Those are the people that we should be admiring, not a bunch of rich white guys who don't know what it's like to not be able to pay the bills.

## February 28, 2013

### The Magic

There are weeks where I forget about the Magic, buried under instruction manuals, homework assignments and to-do-lists. Times when I can feel a burning hunger for fantastic journeys in far away lands, but can only swallow it hard and try to press on to deal with more urgent matters.

And then there are times where I am swallowed by it, my mind deposited inside another world, ravenously devouring every shred of artwork, literature and music, drowning myself in the tribulations of another universe. My imagination turns from a smoldering flame into a raging inferno, a hurricane of ideas that make me feel alive.

I often struggle with my music - my ideas are more often the result of luck than actual talent. But when I'm surrounded by the Magic, my troubles melt away and I become music incarnate, masterfully crafting melodies and harmonies with precise meaning, knowing precisely how to extend and embellish them even as they sit around as meek sounding rough drafts. Instead of worrying about the massive disconnect between my imagination and the song that is actually coming out of my speakers, I hear only connections, threads between them, roads that must be crossed to bring the song to life.

I always have a sense of Magic that flows through certain artistic works. In some it's barely a whisper, in others I can hear a raging storm behind a locked door, struggling to break free of artistic limitations. But in a select few, it is simply all-consuming, effortlessly carrying me away into another world, to such a degree that when I need to go to the bathroom, I pause halfway down the stairs, momentarily confused as to whose house I'm living in and why I know where I'm going. Sometimes it is music, divine melodies and delicately chosen instruments that coalesce into something beautiful, taking my mind to places it has never seen before without showing me a single picture. Other times, it is a story, a work of literature so powerful I forget that I am actually reading it, instead losing myself inside another universe, watching everything play out in front of me as if it were as real as the book itself. Twice now I have seen it in the blur of animation, stories brought to life with little more than sketches and a few in-between frames that affect me so deeply, they continue to fundamentally influence my imagination to this day. Other times it is the perfect harmony of all these things at once, a game that sweeps me into a galaxy far away where I care more about a 8-bit pixelated image than I ever thought possible.

I'm really more of an artist than an engineer. Sometimes I wield integrals instead of pencils and recursion instead of instruments, but they are nothing more than unusual artistic implements. I live to drown myself in imaginary worlds, and have spent my life trying to help artists achieve precisely this, which has significantly contributed to my tool problem. I want nothing more than to find an artist who has crafted something magical, and lose myself inside it as I help sculpt their world and breathe life into its inhabitants. My tendency to follow where the Magic guides me has resulted in a rather disproportionate number of artistic friends, which has unfortunately not been the most ideal situation.

I've always been disappointed by the fact that so many programmers consider code as nothing more than an obstacle to be overcome. The code is always somewhere else, separated as much as possible from the real art. There are so few who revel in the code itself rather than simply getting it out of the way as soon as possible. It tends to stunt their growth and narrow their vision as they spend less time trying to find elegant solutions to problems and more time writing hacks using what they already know. The trap we fall into, is that it's a good thing to be focused on producing results and not crafting elegant solutions at your job... but it's terrible for self-improvement. Reality dictates that successful programmers must be able to produce results, and yet in order to become good enough to do so, the same programmers must learn how to bury themselves in their code, exploring the infinite nuances of common problems and the aspects of various particularly wondrous solutions that arise. Once learned, the seasoned programmer can put these solutions to stunningly effective use in a real-world scenario - but they must be learned, first, and that requires more than completing homework assignments.

But I digress; my current badly timed state of heightened creativity right before a convention and having to grade a ton of homework is the result of two hilarious coincidences: Having a really bad day the weekend the season finale of My Little Pony was shown, which resulted in me catching up on all the episodes I had let slip me by the past year, followed by a google search that accidentally turned up the tvtropes page for a certain My Little Pony fanfic. There is a fascinating aspect of the My Little Pony fanbase where many of the writers keep building on each other's historical embellishments, to the point that there are now several relatively consistent canons running around, being cross-referenced in metafictional tales in a truly astounding level of creative co-operation. This culminated in one particularly long masterpiece that was such a brilliant work of art I stayed up all night to finish it because I just could not stop reading. There were quite a few random melodic ideas that sprung out of those stories, but that last one had a much more direct impact:

There is something otherworldly about how a fictional tale of characters that have never existed can touch us in such a profound way that it changes the course of our lives forever. That the stories we tell each other can shape the very fabric of history itself. It almost feels a bit... magical.

Twilight is very, very brief, lasting for all too short a time; it is rich, and beautiful, and in that moment the proud sun learns to set, and rest, and the moon ascends to watch over the peace of night. And then twilight is over, leaving the sun and moon to remember its beauty and wonder, after it has gone, changed forever by that brief moment of transition.
- Eternal

## February 24, 2013

### The Dark Side of Web Development

I am, by no means, a very good web developer. I am, however, a highly experienced C++ developer. The end result is that people usually ask me why I like C++ so much when everyone else hates it, and everyone is supposedly in agreement that C++ is the worst language ever made and unless you are writing drivers you should never, ever use it. I mean, you can write games in Python now, right?

While these kinds of ignorant opinions are frustrating for me and my fellow C++ developers who actually need efficient cross-platform programs, that's not what I'm here to debate. In fact, if you think C++ is a complete piece of shit, I won't argue with you about that at all. For all I know, you may be right!

Unfortunately for you, web development is just as bad as C++.

Of course, I just said that I'm not very good at web development, so doesn't this disqualify me from having an opinion about it? On the contrary, the fact that I'm not very good at web development is extremely important. The reason is that one of the major complaints about C++ is that good C++ code is hard to write if you are an inexperienced developer. I can certainly attest to that fact, it's taken me years to develop my C++ skills to this point. The fact that Python code is so easy and natural to write is one of its major selling points.

The thing is, good HTML/CSS code is also hard to write if you are an inexperienced developer. I can attest to this too, because I'm an inexperienced developer, and its really goddamn hard to write good HTML/CSS code. Let me clarify what I mean by "good" here: by "good" I mean code that works on all platforms, doesn't blow up, and doesn't contain strange edge cases that will cause it to fail for no reason. Many developers preach the joys of functional programming, which eliminates most edge cases by prohibiting functions that have side-effects.

Everyone knows about the subtle, nasty bugs that can crop up in C++, often as a result of doing something that was intuitive, yet wrong. This is rehashed in the "C++ is bad" arguments over and over and over without end, especially with the functional programming zealots. The problem is that HTML/CSS has all sorts of really stupid crap that can happen when you do something subtly wrong with the HTML that is not immediately obvious to a new developer.

It took me a while to learn that you shouldn't be putting block level elements inside inline elements in your HTML - it will almost always work, until it doesn't, and it won't be obvious what exactly is going wrong. Many people new to HTML aren't even aware of HTML resets, so they'll have to try and remember which elements are block-level by default and which aren't. Then the new standard introduced a bunch of psuedo-block level elements that try to fix some of these problems, except they aren't supported by everything because MICROSOFT, so now you're stuck with a bunch of workarounds for IE that take forever to develop.

Just recently I discovered an amazingly weird bug with my webpage, wherein upon first loading it, all my buttons would be stacked vertically. It appeared that Chrome was ignoring float:left on those elements... until the page was refreshed or any other part of the website was visited, at which point everything started working again! Firefox, of course, didn't have any issues with it. The problem was that I had a <p> element defined as a giant button, then put <a href=""></a> around it because I wanted the entire button to be a link. This, of course, violates the inline/block element mandate I outlined above, despite it being a very natural thing to do - you want the entire button to link somewhere? Put a link around it. It'll almost always work, until it doesn't.

Trying to write perfectly standards conformant HTML is exceedingly difficult because half the time what you want to do isn't in the standard or is some hack that works almost all the time but not quite. The rest of the time, the "standard" way of doing things is completely and utterly bizarre, like using margin:auto 0; to center elements. But wait, that only works on horizontal elements! If you want to vertically center an arbitrary element, you have to use a lot of weird crap just to get it to work on everything. Or you could just use a table. But tables are bad, so you should never use them, even though they actually solve a whole lot of problems new developers have because their non-table solutions are completely unintuitive, because we're all trying to use a document layout engine to make GUIs, for crying out loud.

Many web developers argue that these problems are going away now that we have a better standard. Sadly, they are just getting started - WebGL will become exceedingly important in the next 5 years, and its standardization is an absolute mess almost to the point of it being unusable. Then there's the sordid situation with HTML5 audio and video, which is only just starting to get tolerable. These problems are not going away - they are simply being replaced by different problems. Of course, some stuff actually is becoming easier in HTML - just like a lot of stuff is becoming easier in C++11. So either you ignore both the new C++ features and the new HTML features, or you admit that C++ has become less horrible recently.

Of course, C++ is still way too easy to write unmaintainable code in, and HTML/CSS code is clearly self-documenting! Except it obviously isn't, given the endless horror stories of terrifying CSS dependencies with random !important keywords flung around in a giant mess that's just as impossible to understand as templatized C++ hell.

But wait, if you just write proper HTML, it won't have that problem! Well, duh, if you write proper C++, you don't have that problem either. I'm sorry, if you are going to hate something, you can't have your cake and eat it too. If C++ supporting features that can be abused to make code impossible to read, like operator overloading, makes it a bad language, then CSS is a bad language, because there is an endless list of obscure, bizarre syntax you can use in your CSS style sheets (like !important) that will make your HTML almost impossible to read. But wait, C++ is also incredibly hard to parse! HTML being easy to parse must be why Opera recently gave up trying to maintain its own HTML layout engine... Oh wait. Well at least javascript is a consistent, easy to understand language that doesn't have any weird quirks... JUST KIDDING!

So it seems modern technology has succeeded in replacing a very fast, difficult to use, inconsistent language with 3 different, very slow, difficult to use, inconsistent languages.

Now, if you want to believe that HTML/CSS is still good when used correctly, then all I ask is that you grudgingly admit that, maybe, just maybe, C++ is also good when used correctly. If you still think C++ is an abomination from the depths of cthulu, I hope you can admit that web development therefore must also be an abomination.

Or we can just keep arguing with each other, because that's always productive.

## February 10, 2013

### I'm Slowly Losing My Mind

I say a lot of things. I avoid lying at all costs, and instead prefer to simply leave out a lot of... details. Like why I started a game development company that spends an awful lot of time developing tools instead of games. Or why I've spent 6 years chasing a dream, and instead of doing what any sane person would have done and used existing frameworks to achieve my supposed goal of creating the various game ideas I've had, I have stubbornly built my own framework of tools, giving myself control of everything from the high level game engine down to CPU specific SSE optimizations and how I allocate my arrays.

I extended std::string into my own string class and use my own replacement for std::vector. I built my own audio engine. I built my own graphics engine. I built my own game engine, state control system, box2D physics integration, and serialization. Now I've even built my own GUI framework, because CEGUI was such a load of crap. I resisted doing that one for a long time, until it became increasingly obvious to me that I had no choice.

If I really wanted to just make a game, what the hell am I doing? I'm building an enormous foundation for some unseen purpose, as if I had something else in mind. Something bigger. Something that I set out to do without realizing it years ago when I decided to build a graphics engine.

It's hard to avoid lying to other people when you're lying to yourself and don't realize it. I wanted to make games, but the reasons were more complicated than that. I wanted to make game-building tools. I wanted to unlock the creative potential of a thousand artists so they could build games that far surpassed this modern slump of quality we seem to have gotten stuck in. But the rabbit-hole kept going deeper the farther into college I got and the endless failures I was met with. Constantly I would try to utilize the power of my work, take advantage of the fruits of my labor, only to find that my labor was horrendously misguided, and always failing to produce a product. Something was always either wrong with the engine, or more often a significant chunk of it simply wasn't there. I have built so much, and yet I dream of failure.

Despite this, I press onward with relentless enthusiasm, driven by a strange force of hope in the face of overwhelming evidence that I have absolutely no fucking idea what I'm doing and am clearly destined to fail miserably. I graduate college in 2 months. I'm running out of time.

Sometimes I feel like I'm just going to die when the end comes and I have to give up everything I strove to create for a normal job. Of course, with a degree in Applied Mathematics and years of complex programming, my normal job would probably involve being paid a 6 figure salary. I would stare at those 6 digits and feel only the crushing weight of regret, because my idealism had failed - destroyed by the seething hatred of reality. By the time I had gotten enough money to "pursue my dreams", I would have gotten married and be tied down by kids. My desperate attempt to reclaim the dreams I had in my youth would be met with the horrifying realization that I could no longer recall what those dreams were. This is the living hell that haunts my nightmares.

People are confused. They don't understand why those dreams are so important. They ask me, why are you doing this? And I reply, because I have to.

For as long as I can remember, I have had an increasingly wild and extravagant imagination. It would be triggered by movies, animations, books, music, art, anything that gave my brain a new idea to absorb. It would assimilate the new ideas and then spit out visions and sounds distilled from every good part of everything I've ever seen or heard, combining and recombining elements from a thousand different sources until they become a cacophony of beautiful chaos.

And then they fade, and I am left staring at a blank wall, frustrated once again by the fact that I can't make those dreams happen. Even in my one creative outlet, music, I am so incompetent I can only stumble on good ideas by accident, and they are never even remotely related to the orgasmic explosion of amazing sounds I hear in my imagination.

I thought this was normal. I thought everyone had such an insanely hyperactive imagination. It was only recently I realized that my condition was highly irregular for a software engineer. It also explained why I had such perpendicular opinions to the rest of the programming world, and why the majority of my friends were artists.

I also realized I was going to go crazy if I couldn't figure out a way to get it out, which is definitely not normal. The ideas feel like they're trying to claw their way out of my brain, ready to burst fully realized into my monitor. Parts of them I can reverse engineer and say "I know how I could do that." Others require multiple things to be invented - I've already invented at least 2 technologies whose prototypes are locked away. Some things I simply don't think I can do on my own. I need help. I'm not a genius, I'm just a programmer who's slowly being driven mad by his creative frustration.

Everything I had ever done makes sense when you realize that I am almost entirely a product of creative impotence. I keep building more and more powerful tools in frantic, desperate attempts to express myself. My foundation is being built in preparation for the construction of an entire suite of tools whose sole purpose is to give me a suitable creative outlet. I'm building a foundation for tools I probably don't even know I'm going to make yet - that's happened a disturbing number of times. It seems like I am following a plan so obtuse I can't even figure out what I'm doing. And I can't stop. There is no way to make me stop. If I became homeless I would still find a way to work on my tools, to try and find a way to let the creative flood out of my head, because I have to.

The things I see in my head, I have to make them happen. I have to make them real. Somehow. I'll invent a new precedent for 3D graphics rendering if I have to. Don't even try to tell me something is impossible, because even if you convince me that my ideas are insane I will try to get as close to them as I can anyway. It doesn't matter if I am destined to fail, or chasing an impossible ideal, because without it I have no reason to live, and can derive no joy from my existence. If I get a normal job, I rightfully believe that it will end up killing me, physically or mentally. Even if I don't get a normal job, I am now terrified that if the great Aaron Swartz was somehow driven to suicide by an unrelenting, hopeless reality, my idealism stands even less of a chance. No matter how frightened I become, my imagination remains an unrelenting torrent of ideas, slowly eating away at my mind. It will never let me stop trying. Ever.

I just didn't tell people because they simply wouldn't understand unless I explained how I was basically insane by society's standards. But now, I feel the endgame is upon me, and I don't know if I can beat the final boss of this dungeon that is my life. I'm running out of cards to play, and I'm not sure if I'm going to survive. I feel like this mask of sanity and reasonableness has gotten me as far as its going to get me, and that if I am going to beat this, I need all the help I can get, and lying to everyone that I am actually some sort of reasonable person isn't going to help anymore. I'm not a normal person. I am a delusional idealist who is chasing his dream like a goddamn determinator and nothing short of death itself is going to stop him. As I have learned the hard way, you can try as hard as you possibly can, and sometimes it still just isn't enough.

If curiosity killed the cat, perhaps creativity is killing the rabbit?

## February 7, 2013

### Windows Breaks assert() Inside WM_CANCELMODE

So I have this dll that's doing a bunch of horrible WinAPI calls for me. It's designed to abstract away all the pain and unholy functions feeding on innocent blood. Little did I know that trying to cage WinAPI into a more manageable corner would be my undoing.

The window is created and assigned a WndProc callback function inside this DLL, as per the various absurd requirements involving how you create windows in Windows. Everything works just fine and dandy until the application window suddenly closes, an error "ding" is heard, and the program silently crashes without any sort of error message whatsoever.

What just happened?

Well, I'm afraid you just triggered an assertion. But instead of doing what an assertion is supposed to do, which is immediately crash the program so you know what the fuck just happened, it instead somehow manages to create an infinite callback loop caused by the operating system actually trying to assign the assertion dialog to the window. You know, the same window that was part of an application that's supposed to be in the middle of CRASHING?! This causes another message to be sent, thus causing another assertion to be violated, et cetera until the stack overflows, except it doesn't actually tell you the stack overflows, it just crashes with absolutely no explanation. Even while in a debugger, which is truly amazing.

Specifically, the assertion triggers a dialog box to be displayed, but this dialog box forcibly sends another WM_CANCELMODE message to the application, apparently completely bypassing the entire point of having a message queue, because the program never gets to go back to it. It's WndProc is simply called with WM_CANCELMODE because fuck you, and so if your assertion fails when you're processing WM_CANCELMODE, it will simply do this over and over and over until the entire window tree collapses in on itself from the intense gravitational pull of astronomical amounts of stupidity.

The resulting black hole sucks in all nearby sources of sanity, which include some sort of error message about the stack overflowing, or perhaps the actual fucking assertion error, and then explodes, leaving you without a goddamn clue about what just happened. This is usually followed by copious amounts of screaming, then disbelief, then finally assuming the fetal position and praying for forgiveness for attempting to touch the windows API, as the Microsoft gods laugh and drag another developer's soul into their black circle of hell.

Somehow, every time I touch the windows API, it always ends with me curled into a ball, moaning "what the fuck" over and over again while crying.

## February 3, 2013

### How My Little Pony Destroys The Universe

Princess Celestia WILL satisfy your values through friendship and ponies, and it will be COMPLETELY consensual.

Friendship Is Optimal is a hard science fiction short story (level 5 on Mohs Scale Of Science Fiction Hardness) that explores the implications of a general artificial intelligence tasked with maximizing an optimization function. The problem with Strong AIs that are told to maximize some function is best described via the Paperclip Maximizer, wherein an AI that is capable of self-improvement is told to amass the largest collection of paperclips possible. In order to do so, the AI makes itself progressively more intelligent, until it's exponential intellect eventually enables it to convert all matter in the solar system to paperclips. In Friendship is Optimal, this AI is tasked with maximally satisfying the values of all human beings, subject to certain constraints. In this way, the AI is, for all intents and purposes, perfectly benevolent and dedicated to making all of humanity lead happy, fulfilling immortal lives.

Unfortunately, it inevitably turns into a runaway lotus eater machine, such that all of humanity is (voluntarily) assimilated into an exponentially growing blissful simulation that eventually destroys the entire universe (or rather, turns it into a giant quantum computing device). In the process, it explores aspects of the human psyche, the effects on human society and its eventual disintegration, outlines how a virtual physics system might be able to simulate non-euclidean geometries, and describes magic as a simple programming language for reality itself.

Did I mention it's also a My Little Pony fanfic?

While a science fiction story of this quality would stand on its own without the hilarious association to the My Little Pony: Friendship Is Magic franchise, it does not suffer from this in any way. If anything, it makes the story even more potent, as it does a vastly more effective job as hammering home just how impossibly smart a true runaway AI optimizer actually is. Our first instinct to the idea of the entirety of humanity being convinced to live out immortal lives in Equestria is that it is completely insane, and that there is simply no way a significant portion of people would actually agree to that, let alone everyone. In part, this is correct, but only because Celest-AI managed to convince just 99.99999% of the world's population. An AI that is more intelligent than the combined intellect of all of humanity would be very persuasive.

In the end, even if we create a perfectly benevolent AI designed to maximally satisfy our own values (through friendship and ponies!), it would still destroy human society, then Earth, then the solar system, then the galaxy, and finally the entire universe, and possibly any neighboring universes unfortunate enough to be nearby. And we would all live happily ever after. As ponies. In Equestria. And you'd love it. Princess Celest-AI will make sure of it.

Now read the damn story. It will satisfy your values through friendship and ponies. Forever.

## January 21, 2013

### Dreams Are Worth Fighting For

While I have never been suicidal, I've had to deal with suicidal friends more than I'd like. The hardest thing in the world is to get suicidal people to understand that, contrary to their entire life's experience, and contrary to every shred of evidence they have, things will get better. Eventually, they will have an experience they could never have imagined, they just have to hold on long enough. Sometimes it feels like our dreams are on the brink of suicide for similar reasons, and we must also convince ourselves that we just need to hold on to them for a little while longer.

The death of Aaron Swartz affected me deeply even though I honestly didn't know who he was until he died. Unlike what many people seem to be writing about on Hacker News, however, it was not because he was some kind of brilliant programmer (although he clearly was), it was because he was fighting for many of the same things I am fighting for. We were both disillusioned about the massive corruption that underlies modern society, and we can both be considered idealists. That Aaron's dreams were so oppressed that he took his own life is deeply disturbing to me.

Whenever you attempt to do something, you will encounter resistance. If you haven't had someone tell you you're an idiot for doing something yet, you just haven't been looking hard enough. It is not possible to post a blog on the internet and not have a comment telling you that everything you wrote is misinformed crap. Every time you start writing a program, you will use the wrong language. You will use the wrong library, make the wrong API choices, set the wrong default values, have terrible coding practices, and be both too high level and too low level at the same time. Every solution you come up with will be fundamentally flawed and used as a reason for why software development has gone downhill. At least one person will tell you to never write another line of code ever again for the benefit of mankind.

When the language fetishists start flinging mud over the fence, it is easy to get discouraged after they rail on about how terrible your language of choice is. Sometimes you'll wonder if some of your C++ code should really be C code, or if your event subsystem should be in Haskell. You launch products to the sounds of crickets. Repeated failures can be extremely draining to one's perseverance.

None of this matters. The visions that find us in our daydreams and play with us at night are what make life worth living. The dreams we fight for give us reason to exist, regardless of whether we achieve them or not. Just because things don't turn out the way we want to doesn't mean we can't still have a positive influence on the world.

If I could have told Aaron anything the night before he died, it would have been that no matter how hopeless things get, his dreams will always be worth fighting for. By simply being alive, we continue to uphold our ideals. Never stop trying, and you will continue to fight for what you believe in, even if you don't succeed the way you wanted to. People will tell you to give up, that its fruitless, meaningless, hopeless, misguided and useless. They are wrong.

For Aaron's sake, in memory of all his hopes and ideals, fight for your dreams, and never let go.

## January 18, 2013

### The Productivity Fallacy

Technology tends to serve one of two purposes - to make us more efficient at some task, or to entertain us in our resulting free time. However, when we fixate on productivity to the exclusion of everything else, we often forget about the big picture. Perhaps the best example of this are people insisting that real coders need to use Vim to be productive due to it's unmatched text editing powers.

This is totally absurd. I spend maybe 10% of my time actually writing code, 30% debugging that code, and the remaining 60% trying to solve a problem. Even if I could write all my code instantly, I have only improved my productivity by 10%. I've found that changing my code patterns to let me catch bugs faster and earlier has had a much more significant impact on my coding speed, because taking a chunk out of 30% has a much greater effect on my overall productivity.

But what about the 60%? I'm sure I could make some of that go away with more powerful visualization tools and intense mental training, but when I hit a problem that's simply really hard to solve, nothing short of a cybernetic implant that makes my brain bigger is going to make a dent in how much time I spend thinking about something unless I want to make a stupid mistake and regret it later.

The issue that's arising from our hyperproductive tools is that our productivity is beginning to outstrip our ability to think. We are so productive we can't think fast enough to utilize it. Vim may be the most amazing text editor ever, but it doesn't matter because I spend more time thinking than I do actually editing text. We're so focused on making everyone super productive we seem to forget that we are beginning to receive diminishing returns from some of our efforts.

One consequence of this is that, obviously, we should be focusing on tools to help us think faster. We need to do profiling of people's lives to find the chokepoints and focus on those instead of doing the equivalent of micro-optimizations in C code that's only called every 5 minutes. That, however, does not concern me. What does concern me is the repeated mistakes futurists make when attempting to predict the future of technology.

This Microsoft video is a superb example of good technology predictions implemented in the worst way possible. The entire video treats human beings as machinery that needs to complete various tasks in the quickest way possible, instead of recognizing that human beings are, in fact, people. Many of the human interactions feel fake because all the interactions are treated simply as tasks that must be completed efficiently, regardless of how beneficial the time saved actually is. Productivity is not important, the way it feels is important.

Futuristic architecture often makes this same mistake, creating cold, bland environments that, while they do feel futuristic, are not things anyone would want to live or work in. We need environments that feel warm, inviting, and natural. When building futuristic environments, we must be extremely careful about where the future is peeking in, because there is such a thing as too much future in one room.

We make things look like wood simply because we like how wood looks, not because we need to build anything out of wood anymore. We like trees growing around our houses. We make our lights look like the sun instead of actually being white. We are constantly making arbitrary choices that have nothing to do with productivity and everything to do with making us feel comfortable. Until designers recognize this and stop sucking the life out of everything in an effort to make it more "productive", they will inevitably be shunned in favor of slightly less efficient, but more inviting designs.

Design is an optimization problem that must maximize both productivity and feel, not one or the other. Some people actually like color in their IDEs and webpages that consist of more than flat text, faint lines and whitespace.

## January 14, 2013

### Can The Human Race Please Stop Sucking For 5 Minutes?

A few days ago, Aaron Swartz hanged himself due to an overzealous government prosecution for a victimless crime that was trying to throw him in jail for 35 years. He was 26. It affected me more than usual after many of his writings were reposted on Hacker News and I realized how closely my values aligned with his - and he died for them.

So of course, now a friend of a friend of mine is threatening to kill himself. Or was, anyway, we calmed him down, but after learning the cause of this sudden suicidal outburst, combined with Aaron's death in such a short time, I just wanted to curl into a ball and cry.

At the age of 17, 3 years after the columbine incident, his town decided to use scare tactics to prevent anyone from blowing up a high school. So they planted a few suspicious items in a random student's locker, which happened to be his. He was then charged for being a "Columbine Enthusiast" and thrown in juvenile detention for 2 months to set an example for any would-be gunmen. He only barely finished high school.

His family hated him, and the court system didn't give a shit about whether a 17 year old teenager was innocent or not, so he had no choice but to just move on from the ordeal. He attended college using a student loan program, majoring in an IT field. 2 years into his degree, his college was shut down due for illegal fraud after being investigated by the federal government. Of course, shortly after this, the economy crashed.

He's now 27, living with an abusive family that hates him and won't let him get any job that isn't working in a foundry or somewhere suitably dangerous, is $20000 in debt with credits from a college that are now completely useless, and is constantly screamed at by a belligerent grandmother. He needs to get a job, badly, but this requires him to dig through thousands of listings, while also finding a place to live, while also having to sneak away from his insane family, when he's already suicidal. The fact that he is in debt, has a garbage credit score and god knows what else makes this close to impossible. Once again, it's never as simple as "just find a job", no matter how much the rich white bastards in this country want to believe it is. Oh, you thought maybe he lived in some third world country with rampant corruption? No, he lives in Pennsylvania. He was fucked over by the same bullshit system that made Aaron hang himself. Except he's still alive. Barely. I want to do something, but we don't know anyone in a three hundred mile radius of where he lives, he has no phone, he has no car, he has no money, he has only a shitty internet connection and Skype, which is hard to use when his grandmother is screaming at him for whatever reason. I'm terrified that tomorrow, he'll ask why he shouldn't kill himself, and I won't know what to say, because I don't know what to do. All I can do is sit here, watching someone struggle through a shattered life, crying softly. ## January 11, 2013 ### The Earbud Loudness Wars I have a Zune I got as a prize at a Microsoft Hunt The Wumpus competition back when Microsoft was still under the delusion that they could actually compete with the iPod. My Zune has served me faithfully for almost 7 years. I am now on my third pair of earbuds for my Zune, and have noticed a disturbing trend. The Zune has a volume control that goes from 0 to 20. I have sensitive ears, so with my first pair of earbuds, which came with the Zune and were presumably made by Microsoft, I listened to music at a volume of 3. Sometimes it was bumped up to 4, but never higher unless a particular song was abnormally quiet. I wish I could say this will let me keep my hearing pristine for many years to come, but standing next to the freeway for 4 years has probably screwed me over anyway. Eventually these gave out and I had to get new ones. I picked the "Gumy" brand because it was almost identical to my previous earbuds and I like that style. I can't even hear bass properly due to a hearing defect so I really don't give a shit about "EXTREME BASS LOUDNESS!!!11!1!!one!!", and I've heard bad things about Skullcandy, which was literally the only other brand there. After plugging in my new earbuds, however, I noticed that a volume level of 3 was too loud - I thought my ears might be playing tricks on me, but after several tests, including a blind test, I was absolutely positive 3 was definitely too loud, and I'd have to reduce my volume to 2. Once again, volume level 3 would be used for quieter songs. After another 2 or 3 years, my old Gumy earbuds have finally died, so I just went and bought new ones. Not interested in trying any new brands, I got the exact same brand, type, and color, such that my new earbuds were almost completely indistinguishable from my old ones. Then I plugged them in. Once again, they were significantly louder than my previous ones. Thinking perhaps my ears were not accustomed to the sound or perhaps my old earbuds had decreased in volume, I ran several tests, but I eventually realized that my comfortable level of listening had been reduced to a volume level of 1. There is nothing below 1. If this trend continues, I will be forced to either find an exotic brand of earbuds I can only buy over the internet from a manufacturing plant on the moon that lets me actually listen to songs at a volume that does not cause hearing damage, or I will be forced to stop listening to music on my Zune. I'm not entirely sure how this trend is even possible, although it may have something to do with a miniature amplifier inside the earbuds, but it seems to be mirroring the infamous Loudness Wars. The issues involved with the Loudness Wars are a topic for another day, but this same phenomenon has occured with my headphones plugged into my computer. A comfortable volume is something like 5 on a scale from 0 to 100. At least in windows I can punch it into behaving reasonably, but it's still just as ridiculous. I have always been annoyed at people listening to music at volumes that are obviously going to cause hearing damage for no real apparent reason, and its also why I avoid concerts like the plague, but now it seems that our society's obsession with loud music is making it almost impossible for me to not listen to loud music and it's pissing me the fuck off. For now, my earbuds are working fine, and I can still listen to them comfortably on a volume level of 1 without problems, but if anyone knows a pair of non-stupid earbuds that does not fall victim to this trend, it would be useful information 3 years down the road when this pair gives out. Also, if you are going to have a volume control, make it actually useful, please. I'm sick and tired of volume controls with a range from "Almost Too Loud" to "What The Fuck?!" At least some of us don't want to listen to music at offensively loud decibel levels. I can still tweak the volume in FL Studio when I'm mixing my tracks, but studio-quality headphones become a lot less useful when they have an effective integer volume range of 0-8. ## January 2, 2013 ### Let's Talk About "Slut" Modern society is bizarre in that men who manage to "get all the girls" are considered manly, whereas women who sleep around are considered "sluts", which is supposed to have negative connotations involving unfaithfulness. Many feminists have pointed out the absurdity of this double standard, but that is not what I am here to talk about, because we should all know its bullshit by now anyway. What I want to ask is why is being a slut a bad thing? The fact that society seems to consider "cheating" as the ultimate insult to a relationship seems to imply that sex is closely tied to love. Thus, "sex" is supposed to be something special you only do with your beloved, and getting kinky with other people trivializes what is supposed to be a unique and meaningful act. I think this is kind of stupid. The problem is that this directly ties how much you love someone to whether or not you are having sex with them. By tying sex so closely to love, you end up trivializing love itself by implying that somehow love cannot exist separately from sex, and that sex implies love, which seems incredibly immature. It also denies that there are different kinds of sex, and simply lumps all sexual activity into one giant intimacy category that is supposed to be reserved for a married couple. This appears to be a vestigial remnant of uptight religious practices that sought to heavily regulate all sexual activity. I suspect the reasons behind this lie mostly in the total lack of birth control and issues of sexually transmitted diseases in ancient times. By limiting sex to consenting monogamous pairs, outbreaks could be contained and unwanted births were minimized, thus ensuring all children were born to caring families, to a degree. We don't live in ancient Egypt. We live in 2013. We have widely available birth control and condoms and various well-established methods of safe sex that minimize disease transfer, and furthermore have tests to determine if someone is a carrier. We can go be sluts and not cause a pandemic or a sudden influx of unwanted pregnancies. At least, as long as the men aren't raping women all the time like a bunch of fucking assholes. Or as long as we don't let a bunch of religious dickheads treat women like second class citizens who shouldn't be allowed to control their own body, and should no longer have access to contraception or get abortions. By the way, I should point out we wouldn't need nearly as many abortions if males just stopped raping women. The fact that this is still a problem in modern society is mind boggling. I'd like to think that, if I fall in love with a women, and she falls in love with me, our love is going to transcend our sex life, because I think equating love with having sex with someone is kind of pathetic. The only person she is ever going to have unprotected sex with is going to be me, and vice versa. Everything else is just sex for fun, which is considered healthy for almost everyone involved as both exercise and stress relief. Consequently, consensual sex is usually a win win situation for everyone involved, and I would really like to see more sex instead of more stupid angry political debates. As the hippies all liked saying, make love, not war. Of course, I also think that if both people in a relationship feel that exclusivity is important, it's their decision, and no one should stop them. This is especially true if they get strong, lingering feelings for sexual partners. I'm just sick of society viewing open relationships and "sluts" with contempt, because there is nothing wrong with it. I naturally do not expect any of this to actually happen, since humans are often jealous and insecure, and therefore they will be terrified at any possible threat to a relationship, or any suggestion that they are sexually inept. This is really sad and I don't think it is necessarily an inevitable consequence of human behavior, but it is unlikely to change due to how deeply it is ingrained in our culture. Despite this, I would be far more confident of choosing the right person if they could go get kinky with their friends and come back and love me just as much as before, since then we truly love each other for who we are, not because of who we have sex with. Note: Ironically, I seriously doubt I would ever have sex outside of my relationship simply because I wouldn't have the time. If she wants to, though, I would still be totally ok with it. ## December 18, 2012 ### Dreams of Failure I graduate college in 3 months. I filed the paperwork and started a company almost a year ago, but after getting hammered by homework, it is sitting in dilapidation. For five years I've fought to try and make my dreams a reality. For five years, I've failed, miserably. I am more fortunate than most in that my parents are perfectly willing to let me stay with them throughout college, so failure is relatively painless for me. I have failed at almost everything I have ever attempted to do. Be it a combination of foolish ambition or rash decisions, the only projects I ever actually completed were pathetically simplistic, and usually done for school. It started when I was 12, and tried to build a campaign for Age of Mythology, a real project I could call my own instead of simply tinkering and upgrading existing ideas. I made half of one mission and gave up. When I was 13, I was introduced to Freelancer, and became very interested in building mods for it. I volunteered to help an attempt at recreating the Halo universe inside Freelancer. For almost 2 years I tried to help in various ways without having any real skills by organizing schedules and development plans. Then I got myself banned from very mod I'd worked on so hard, and had my dreams crushed by a lead developer who screamed at me for being a useless piece of shit that just annoyed the crap out of everyone for two years instead of doing anything useful. A short while later, I teamed up with someone else who had left that same mod for unrelated reasons in an attempt to rebuild an open-source version of Freelancer that would be bigger and better in every way. At least this time I knew it was stupidly ambitious, but I was hoping that by creating it as a community effort that ambition could be met by the combined skills of many people. Obviously, this never worked. It never even got close to working. I had no idea what I was doing, learned the basics of C++ only a few months ago, and had no idea how to build a 3D game. In the middle of this, I got my first programming job as a royalty-only, laughable attempt at making a spiritual successor to the Descent series. I was forced to work with an artist who was completely fucking insane and a manager who was either totally incompetent or hopelessly idealistic. A month after taking the job, the last remaining programmer quit, leaving me, a 15-year-old high school kid, as the "lead programmer" of a game when I had no idea what I was doing. I quit 2 months later and learned never to take royalty pay, ever. After finally giving up on my stupid open-source freelancer project, I played Cave Story, and realized that instead of using someone else's graphics engine, I could build my own. If Cave Story can make a compelling game with such a basic graphics engine, surely I could too? Back then, the best open-source 2D graphics were SDL, which didn't do much more than draw things on the screen. I decided I would build a better, open-source engine in C#. Like everything else I had ever worked on, it was a disaster. After rebuilding the engine in C++ and coming up with some rather inventive ideas for how to do unusual 2D graphics, I quickly realized that it should really be a proprietary engine. For the first time I began thinking about making a living through my own projects instead of working for some giant corporation. It was at this point I saw an incredible flash animation and sent some very bad fanart to a certain amazing person. I had a vision of something truly remarkable, something amazing, the missing link to my constant daydreams and fantasies and bizarre programming experiments. When I discovered that this person I was practically worshipping as an idol had similar ideas, I instantly knew that I had to find a way to make it happen. In the spring of 2008, everything in my entire life became focused on achieving one, singular goal - make that game idea into reality. That summer, I landed an internship at Microsoft and spent 3 months working the only real job I've ever had. I hated it. The entire time I had been working on a much simpler 2D game idea, hoping it would serve as practice for what my cave-story imitation had morphed into - an epic multiplayer focused game that bore absolutely no resemblance to the original game idea. It was supposed to be my company's breakout title, a way to generate the funds needed to build my idol's game idea, and I'd build most of it during my last year of high school as my senior project. The incredibly basic 2D game idea imploded after I realized I couldn't write my own physics engine. Instead, I started using Box2D, and set out trying to construct the epic multiplayer game. It was a catastrophic failure of massive proportions. By the end of the year all I had to show for my project was a stupid jeep driving across a platform. I passed anyway, and somehow got accepted into the University of Washington, but only once I wrote them an angry appeal letter after being rejected. I prepared to move out and start my new life free of my parents. Ok, the game hadn't worked out, but that summer I'd get the rest of the basics done, and during my first college quarter I can get an initial alpha out and I'll be able to pay for my dorm that way! This, of course, was also a complete and utter failure. I ran back home with my tail between my legs after only a single quarter in that hellhole and half my savings gone from paying for housing, after realizing half my engine was broken and needed to be rebuilt from scratch. I also discovered that I was terrible at network programming. I figured I needed help on focusing on work more, so I tried to build a productivity app, only to learn that GTK+ is almost impossible to work with and Qt has a 1.5 gigabyte SDK of madness. Then I tried to build an alternative to MSN after its servers kept crashing and dropping messages, but that failed miserably for similar reasons. It was around this time I realized that the one thing I thought I hadn't failed at - my simple audio engine - was actually complete garbage and almost totally useless. Throughout my second year, I attempted to reconstruct the engine, and intended to port it to C# so a friend could use it. This, of course, also failed. It was during my second year I came up with a pivotal, brilliant idea that I was never able to work on because I lacked the foundation necessary to make it feasible. My work on that foundation was then interrupted by realizing I needed to build a physics editor, which in turn made me realize that CEGUI is terrible. So not only did I fail to reconstruct the engine, I also failed to build the physics editor, and every single other editor, and the editor I built to make editors. By chance, at the beginning of 2011, the amazing person I still considered an idol suddenly needed a programmer for his game. Seizing the opportunity, I successfully got a chance to build a prototype, put everything else on hold and got to work immediately. Then my mom had a heart attack and nearly died. I became more determined than ever to make sure 2011 would be the year I finally managed to do something. Anything. So of course I discovered my animation system was broken and eventually had to put the prototype on hold. Then I only got a 3.4 in the computer science class, and ended up having to major in Applied Mathematics instead of computer science because they wouldn't let me in. Thus, I had failed at getting into the major that was the entire reason I had wanted to attend the UW in the first place. I wanted to get serious, and finally created my company sometime in November 2011, possibly more out of desperation than for any real reason. I completely failed at finishing anything at all for 2011. I decided 2012 would be the year everything changed and went back to my physics editor, determined to make it work. So of course I failed at that too. Then I failed at finishing my productivity manager. Then I tried to build a puzzle game so drop-dead simple there was no way I couldn't finish it and completely failed anyway. At this point college dumped so much homework on me I was virtually incapacitated for 6 months. I was convinced I had to get the puzzle game to at least be functional by the end of summer 2012, so naturally I failed to do that. I then decided I needed the tile game to be up and running with a demo in a month or two, and continued my amazing streak of utter failure. 2012 is almost over and the world is supposed to end in a few days. Two weeks ago I released my first commercial album. After my entire life being a miserable failure at everything I cared about, I decided my goal for the album was to make a measly$45. Surely, I can meet a goal that is so pathetically low all it does is pay off how much it cost to get it into iTunes and Google Play? I was pushing the album on every single social media outlet I had access to. I made $15. 2013 will be my sixth year of fighting for this dream. My dream has been torn apart and shredded into a ghost of what it once was. Now all I want is to just be able to feed myself without living in my parent's house. Screw being famous or rich, I just want to make a living doing something that doesn't make me want to throw myself off a cliff. I guess wanting a job that you don't absolutely despise is stupid, idealistic thinking. I wish I had something to show. I wish I could say, look at this thing I built that nobody is looking at! But I've failed at everything so hard I don't have a single completed project. The only thing I have to show for the last 5 years is a useless piece of paper in a major I didn't even want and a list of failures so long it's disturbing to look at. So why then, do I continue in this hilariously idealistic dream that is clearly never going to work? Because I am numb to failure at this point. I can't do anything else. I simply trudge onward, relentlessly fighting against this endless storm of not being good enough, hoping that next year, next year will be different... I will fail a thousand times if I have to just to make this happen. Because dreams are worth fighting for. ## December 14, 2012 ### Giant List of FREE SAMPLES Back when I started making music, I quickly realized that trying to make sample-based music without a significant sample library is really hard. While there are thousands of sample libraries for sale, the problem with starting out is that, by definition, you suck, you're probably in high school, and your allowance is likely going towards other, more important things, and not your silly musical experiments. Over the years, I've been frustrated with how difficult it is to find good free samples. It turns out that there's some really great royalty-free stuff out there, if you can find it. This post is a categorized list of every single sample pack and soundfont I have that is royalty-free, and of reasonable quality in an effort to give beginner musicians a much better foundation to build their music off of. Some of these are soundfonts compressed with sfArk - just drag the file on to sfArkXTc.exe to generate a self-extracting executable that will create the sf2 file when run. Others are compressed using sfpack.exe. A few use the SFZ format (usually when the soundfont in question would take up too much RAM), which can be read by the free sForzando VSTi. # Instrumental 000_Florestan_Piano 198-StratocasterVS MIS Stereo Piano [ SoundFont | Directwave ] MIS Orchestra Samples [Requires Directwave] SGM-V2.01 Nylon Guitar 1 Sonatina Symphonic Orchestra SF2 (original SFZ) HQ Orchestra Samples Vowel Ensemble 070 Bassoon Ethan Nando Roland Sound Canvas Tubular Bells Maestro Concert Piano (SFZ) # Percussion SAMPLES - 5000 DRUMHITS 1400 Samples Drum Kit mhak kicks [Part 1 | Part 2] drums_industrial drums_ken_ardency RolandOrchestralRythm JD Rockset 5 Ellade Drums The Freq's Glitch Hop Sample Pack # VSTi While not samples, these are free VSTi plugins, compatible with most modern DAWs. Bitcrusher Tube Screamer Rez v2.0 Reaktor 5 (free version) Reaktor 5 Factory Selection Mikro Prism [Requires Reaktor] dmiHammer Jug Drum (free version) [Requires Kontact] Dryer Drum [Requires Kontact] The SimulAnalog Guitar Suite is very nice, but is for non-commercial use only. What are these samples capable of? You know you can't ask me that without getting a bunch of disgusting self-promoting links for a programmer's pathetic music making attempts, right? Oh well, if you insist: More songs like these can be found in their respective albums: Solar Noise - EP Aurora Theory These samples are extremely versatile, so don't mistake my own laughable attempts at using them for some imaginary limitations. There are thousands of samples in these packs, so get creative! ## November 13, 2012 ### The Weekend Apelsin Got Lost All The Time So on thursday morning my friend apelsin mentioned a hackathon at his college, San Jose University. I expressed interest but pointed out that I live 800 miles away. So he bought me a ticket on the last plane flying to San Francisco that night. 10 hours after he had mentioned this hackathon with me, I was riding on a train to San Jose University (after missing one train and getting off on the wrong stop). The hackathon had prizes -$3100, $1500, and$600 for 1st, 2nd, and 3rd, respectively. The goal was to build, in 24 hours, a AI for a game. The game was a 7x7 board with empty tiles on it. To win a round, you must construct a continuous path from one side to the other. Player 1 must construct a path connecting the left and right sides, while player 2 must construct a path from top to bottom. The squares are grouped into randomized sets, which are then run through over and over, and each time a set is made available, each bot places a bid on the set. The highest bid gets to pick any square from that set and claim it. You had 98 credits to bid with (7*7*2 = 98) and there was no way to get more.

I was able to build an atemporal pathfinding algorithm that constructed a 7-turn path by figuring out in advance which squares would be available which turn. To prevent difficult edge cases I simplified it so it would always try to do it in 7 turns and simply bid 14 credits each time. My friend helped with debugging and brainstorming ideas, as well as setting everything up, and we had to keep correcting each other on how the game actually worked, but the entire time I was also learning how to use a mac, since my only laptop was a piece of shit and he only had macs.

We were also trying to use Codelite in the hopes that it would be better than Xcode, but that ended up being a disaster with constant crashes and failed debuggers. As a result, I learned two things from this hackathon: I fucking hate macs, and Codelite is a horrible, unstable IDE you should never use.

I was only able to stabilize our algorithm with 40 minute left in the competition. I attempted to implement an aggressive analysis algorithm that would detect a potential win condition for the opponent and block it, but it never worked. Had I instead extended the algorithm to simply look for alternative paths longer than 7 turns, we probably would have won, but I didn't realize that until after the competition. Even though we only had a very basic algorithm, our pathfinding was extremely strong and as a result we got all the way to 4th place. Unfortunately, that wasn't enough for a cash prize, so we weren't able to recoup the plane ticket cost.

So then we took a train back up to his house in San Francisco, went out for dinner, and did more music stuff with his crazy studio monitor setup. The next day involved fisherman's wharf, candy, being lost, and getting to play around on a hardware synth. Then I went to bed and today I got flown back to Seattle.

All because my friend looked at a hackathon advertisement on Thursday morning.

## October 21, 2012

### Today I Was Mistaken For A 17-Year-Old Girl

This was in response to an article I posted on reddit about a 17-year-old american girl who put on a hijab and went to a mall for 2 hours. She describes being completely ignored by everyone, save for a 4 year old girl who asked if she was a terrorist. All because she wore a scarf on her head.

I have read about hundreds of horrifying accounts of sexism and seen thousands of sickening displays of misogynistic hatred (just dig around youtube for 5 seconds). But, as they say, it's never quite the same until it happens to you.

It was just funny at first - some dumbass thought I wrote the article just because I submitted it? No wonder he was so full of impulsive hatred. Perhaps he was trolling, or thought it was funny to brutally attack a woman for committing the crime of being born. But as I read the message a few more times, it dawned on me that this was simply an errant fool mistaking me for the opposite gender, yet the champions of feminism must get these kinds of messages all the time.

Of course, I am no stranger to controversy, having spent hours defending my bountiful collection of unpopular opinions about programming languages that no one should really care about. Hundreds of people have felt it necessary to inform me how horribly wrong all my opinions are, and how I'm so bad at programming the world would be a better place if I never wrote another line of code. So why did this message pierce my internet-hate-machine defenses - a message that wasn't even directed at me? Why did it make me think about what it would be like to be a woman and have my inbox full of this vitriolic misogyny every day just because I had an opinion?

In every technical argument, every hateful comment directed at me, they were all due to choices I made. If my opinions were, in fact, so terribly wrong, it was not because I was a horrible human being, it was simply because I made the wrong choices. When somebody calls you a bitch and tells you to bend over, they are not saying this because of choices you made, they are saying this because you are female. As if the fact that you lack a Y-chromosome gives them an innate right to belittle you and strip away your humanity. There is a difference between being told that you are a stupid idiot, and being considered subhuman. It is this subtle, yet infinitely important difference that many people seem to miss.

While I was still young and in primary school, I thought the only difference between boys and girls was that one had a penis and one didn't. It seems that society has failed to manage a level of maturity greater than that of a 9-year-old boy. In fact, when I was in kindergarten, we were playing a game, and the teams were girls vs boys, as usual. I noticed, however, that the girls were significantly outnumbered. In a bid that surprised even myself, I declared that I would join the girls team in order to make things fair.

I wish it were that easy, but supporting women's rights isn't necessarily about standing up for women - it's about letting women stand up for themselves. It's about treating them like normal human beings and giving them the opportunity to solve their own problems. It's about respecting them because of who they are, not simply due to their gender.

Perhaps one day, society can rise to a 9-year-old kid's level of sophistication.

## October 20, 2012

### C# to C++ Tutorial - Part 4: Operator Overload

[ 1 · 2 · 3 · 4 · 5 · 6 · 7 ]

If you are familiar with C#, you should be familiar with the difference between C#'s struct and class declarations. Namely, a struct is a value type and a class is a reference type, meaning that if you pass a struct to a function, its default behavior is for the entire struct to be copied into the function's parameter, so any modifications made to it won't affect whatever was passed in. On the flip side, a class is a reference value, so a reference is passed into the function, and any changes made to that reference will be reflected in the object that was originally passed into the function.

// Takes an integer, or a basic value type
{
v+=3;
return 4+v;
}

public struct Oppa
{
public string gangnam;
}

// Takes a struct, or a complex value type
public static Oppa style(Oppa g)
{
g.gangnam="notstyle";
return g;
}

public class Psy
{
public int style;
}

// Takes a class, or a reference type
public static void change(Psy psy)
{
psy.style=5;
}

// Takes an integer, but forces it to be passed by reference instead of by value.
public static int addref(ref int v)
{
v+=3;
return 4+v;
}

int a = 0;
// a is still 0
// b is now 7

// a is now 3, because it was passed by reference
// c is now 7

Oppa s1;
s1.gangnam="style";
Oppa s2 = style(s1);
//s1.gangnam is still "style"
//s2.gangnam is now "notstyle"

Psy psy = new Psy();
psy.style=0;
change(psy);
// psy.style is now 5, because it was passed by reference


C++ also lets you pass in parameters by reference and by value, however it is more explicit about what is happening, so there is no default behavior to know about. If you simply declare the type itself, for example (myclass C, int B), then it will be passed by value and copied. If, however, you use the reference symbol that we've used before in variable declarations, it will be passed by reference. This happens no matter what. If a reference is passed into a function that takes a value, it will still have a copy made.

// Integer passed by value
{
v+=3;
return 4+v;
}

class Psy
{
public:
int style;
};

// Class passed by value
Psy change(Psy psy)
{
psy.style=5;
return psy;
}

// Integer passed by reference
{
v+=3;
return 4+v;
}

// Class passed by reference
Psy changeref(Psy& psy)
{
psy.style=5;
return psy;
}

int horse = 2;
// horse is still 2
// korea is now 9

int horse2 = 2;
// horse2 is now 5
// korea2 is now 9

Psy psy;
psy.style = 0;
Psy ysp = change(psy);
// psy.style is still 0
// ysp.style is now 5

Psy psy2;
psy2.style = 0;
Psy ysp2 = changeref(psy2);
// psy2.style is now 5
// ysp2.style is also 5


However, in order to copy something, C++ needs to know how to properly copy your class. This gives rise to the copy constructor. By default, the compiler will automatically generate a copy constructor for your class that simply invokes all the default copy constructors of whatever member variables you have, just like C#. If, however, your class is holding on to a pointer, then this is going to cause a giant mess when two classes are pointing to the same thing and one of the deletes what it's pointing to! By specifying a copy constructor, we can deal with the pointer properly:

class myString
{
public:
// The copy constructor, which copies the string over instead of copying the pointer
myString(const myString& copy)
{
size_t len = strlen(copy._str)+1; //+1 for null terminator
_str=new char[len];
memcpy(_str,copy._str,sizeof(char)*len);
}
// Normal constructor
myString(const char* str)
{
size_t len = strlen(str);
_str=new char[len];
memcpy(_str,str,sizeof(char)*len);
}
// Destructor that deallocates our string
~myString()
{
delete [] _str;
}

private:
char* _str;
};



This copy constructor can be invoked manually, but it will simply be implicitly called whenever its needed. Of course, that isn't the only time we need to deal with our rogue pointer that screws things up. What happens when we set our class equal to another class? Remember, a reference cannot be changed after it is created. Observe the following behavior:

int a = 3;
int b = 2;
int& ra = a;
int* pa = &a;

b = a; //b is now 3
a = 0; //b is still 3, but a is now 0
b = ra; // b is now 0
a = 5; // b is still 0 but now a is 5
b = *pa; // b is now 5
b = 8; // b is now 8 but a is still 5

ra = b; //a is now 8! This assigns b's values to ra, it does NOT change the reference!
ra = 9; //a is now 9, and b is still 8! ra STILL refers to a, and NOTHING can change that.

pa = &b; // Now pa points to to b
a = *pa; // a is now 8, because pointers CAN be changed.
*pa = 7; // Now b is 7, but a is still 8

int*& rpa = pa; //Now we have a reference to a pointer (C++11)
//rpa = 5; // COMPILER ERROR, rpa is a reference to a POINTER
int** ppa = &pa;
//rpa = ppa; // COMPILER ERROR, rpa is a REFERENCE to a pointer, not a pointer to a pointer!
rpa = &a; //now pa points to a again. This does NOT change the reference!
b = *pa; // Now b is 8, the same as a.


So somehow, we have to overload the assignment operator! This brings us to Operator Overloading. C# operator overloading works by defining global operator overloads, ones that take a left and a right argument, and are static functions. By default, C++ operator overloading only take the right argument. The left side of the equation is implied to be the class itself. Consequently, C++ operators are not static. C++ does have global operators, but they are defined outside the class, and the assignment operator isn't allowed as a global operator; you have to define it inside the class. All the overload-able operators are shown below with appropriate declarations:

class someClass
{
someClass operator =(anything b); // me=other
someClass operator +(anything b); // me+other
someClass operator -(anything b); // me-other
someClass operator +(); // +me
someClass operator -(); // -me (negation)
someClass operator *(anything b); // me*other
someClass operator /(anything b); // me/other
someClass operator %(anything b); // me%other
someClass& operator ++(); // ++me
someClass& operator ++(int); // me++
someClass& operator --(); // --me
someClass& operator --(int); // me--
// All operators can TECHNICALLY return any value whatsoever, but for many of them only certain values make sense.
bool operator ==(anything b);
bool operator !=(anything b);
bool operator >(anything b);
bool operator <(anything b);
bool operator >=(anything b);
bool operator <=(anything b);
bool operator !(); // !me
// These operators do not usually return someClass, but rather a type specific to what the class does.
anything operator &&(anything b);
anything operator ||(anything b);

anything operator ~();
anything operator &(anything b);
anything operator |(anything b);
anything operator ^(anything b);
anything operator <<(anything b);
anything operator >>(anything b);
someClass& operator +=(anything b); // Should always return *this;
someClass& operator -=(anything b);
someClass& operator *=(anything b);
someClass& operator /=(anything b);
someClass& operator %=(anything b);
someClass& operator &=(anything b);
someClass& operator |=(anything b);
someClass& operator ^=(anything b);
someClass& operator <<=(anything b);
someClass& operator >>=(anything b);
anything operator [](anything b); // This will almost always return a reference to some internal array type, like myElement&
anything operator *();
anything operator &();
anything* operator ->(); // This has to return a pointer or some other type that has the -> operator defined.

anything operator ->*(anything a);
anything operator ()(anything a1, U a2, ...);
anything operator ,(anything b);
operator otherThing(); // Allows this class to have an implicit conversion to type otherThing
void* operator new(size_t x); // These are called when you write new someClass()
void* operator new[](size_tx); // new someClass[num]
void operator delete(void*x); // delete pointer_to_someClass
void operator delete[](void*x); // delete [] pointer_to_someClass

};

// These are global operators that behave more like C# operators, but must be defined outside of classes, and a few operators do not have global overloads, which is why they are missing from this list. Again, operators can technically take or return any value, but normally you only override these so you can handle some other type being on the left side.
someClass operator +(anything a, someClass b);
someClass operator -(anything a, someClass b);
someClass operator +(someClass a);
someClass operator -(someClass a);
someClass operator *(anything a, someClass b);
someClass operator /(anything a, someClass b);
someClass operator %(anything a, someClass b);
someClass operator ++(someClass a);
someClass operator ++(someClass a, int); // Note the unnamed dummy-parameter int - this differentiates between prefix and suffix increment operators.
someClass operator --(someClass a);
someClass operator --(someClass a, int); // Note the unnamed dummy-parameter int - this differentiates between prefix and suffix decrement operators.

bool operator ==(anything a, someClass b);
bool operator !=(anything a, someClass b);
bool operator >(anything a, someClass b);
bool operator <(anything a, someClass b);
bool operator >=(anything a, someClass b);
bool operator <=(anything a, someClass b);
bool operator !(someClass a);
bool operator &&(anything a, someClass b);
bool operator ||(anything a, someClass b);

someClass operator ~(someClass a);
someClass operator &(anything a, someClass b);
someClass operator |(anything a, someClass b);
someClass operator ^(anything a, someClass b);
someClass operator <<(anything a, someClass b);
someClass operator >>(anything a, someClass b);
someClass operator +=(anything a, someClass b);
someClass operator -=(anything a, someClass b);
someClass operator *=(anything a, someClass b);
someClass operator /=(anything a, someClass b);
someClass operator %=(anything a, someClass b);
someClass operator &=(anything a, someClass b);
someClass operator |=(anything a, someClass b);
someClass operator ^=(anything a, someClass b);
someClass operator <<=(anything a, someClass b);
someClass operator >>=(anything a, someClass b);
someClass operator *(someClass a);
someClass operator &(someClass a);

someClass operator ->*(anything a, someClass b);
someClass operator ,(anything a, someClass b);
void* operator new(size_t x);
void* operator new[](size_t x);
void operator delete(void* x);
void operator delete[](void*x);


We can see that the assignment operator mimics the arguments of our copy constructor. For the most part, it does the exact same thing; the only difference is that existing values must be destroyed, an operation that should mostly mimic the destructor. We extend our previous class to have an assignment operator accordingly:

class myString
{
public:
// The copy constructor, which copies the string over instead of copying the pointer
myString(const myString& copy)
{
size_t len = strlen(copy._str)+1; //+1 for null terminator
_str=new char[len];
memcpy(_str,copy._str,sizeof(char)*len);
}
// Normal constructor
myString(const char* str)
{
size_t len = strlen(str);
_str=new char[len];
memcpy(_str,str,sizeof(char)*len);
}
// Destructor that deallocates our string
~myString()
{
delete [] _str;
}

// Assignment operator, does the same thing the copy constructor does, but also mimics the destructor by deleting _str. NOTE: It is considered bad practice to call the destructor directly. Use a Clear() method or something equivalent instead.
myString& operator=(const myString& right)
{
delete [] _str;
size_t len = strlen(right._str)+1; //+1 for null terminator
_str=new char[len];
memcpy(_str,right._str,sizeof(char)*len);
}

private:
char* _str;
};


These operations take an instance of the class and copy it's values to our instance. Consequently, these are known as copy semantics. If this was 1998, we'd stop here, because for a long time, C++ only had copy semantics. Either you passed around references to objects, or you copied them. You could also pass around pointers to objects, but remember that pointers are value types just like integers and floats, so you are really just copying them around too. In fact, until recently, you were not allowed to have references to pointers. Pointers were the one data type that had to be passed by value. Provided you are using a C++0x-compliant compiler, this is no longer true, as you may remember from our first examples. The new standard released in 2011 allows references to pointers, and introduces move semantics.

Move semantics are designed to solve the following problem. If we have a series of dynamic string objects being concatenated, with normal copy constructors we run into a serious problem:

std::string result = std::string("Oppa") + std::string(" Gangnam") + std::string(" Style") + std::string(" by") + std::string(" Psy");
// This is evaluated by first creating a new string object with its own memory allocation, then deallocating both " by" and " Psy" after copying their contents into the new one
//std::string result = std::string("Oppa") + std::string(" Gangnam") + std::string(" Style") + std::string(" by Psy");
// Then another new object is made and " by Psy" and " Style" are deallocated
//std::string result = std::string("Oppa") + std::string(" Gangnam") + std::string(" Style by Psy");
// And so on and so forth
//std::string result = std::string("Oppa") + std::string(" Gangnam Style by Psy");
//std::string result = std::string("Oppa Gangnam Style by Psy");
// So just to add 5 strings together, we've had to allocate room for 5 additional strings in the middle of it, 4 of which are then simply deallocated!


This is terribly inefficient; it would be much more efficient if we could utilize the temporary objects that are going to be destroyed anyway instead of reallocating a bunch of memory over and over again only to delete it immediately afterwards. This is where move semantics come in to play. First, we need to define a "temporary" object as one whose scope is entirely contained on the right side of an expression. That is to say, given a single assignment statement a=b, if an object is both created and destroyed inside b, then it is considered temporary. Because of this, these temporary values are also called rvalues, short for "right values". C++0x introduces the syntax variable&& to designate an rvalue. This is how you declare a move constructor:

class myString
{
public:
// The copy constructor, which copies the string over instead of copying the pointer
myString(const myString& copy)
{
size_t len = strlen(copy._str)+1; //+1 for null terminator
_str=new char[len];
memcpy(_str,copy._str,sizeof(char)*len);
}
// Move Constructor
myString(myString&& mov)
{
_str = mov._str;
mov._str=NULL;
}
// Normal constructor
myString(const char* str)
{
size_t len = strlen(str);
_str=new char[len];
memcpy(_str,str,sizeof(char)*len);
}
// Destructor that deallocates our string
~myString()
{
if(_str!=NULL) // Make sure we only delete _str if it isn't NULL!
delete [] _str;
}

// Assignment operator, does the same thing the copy constructor does, but also mimics the destructor by deleting _str. NOTE: It is considered bad practice to call the destructor directly. Use a Clear() method or something equivalent instead.
myString& operator=(const myString& right)
{
delete [] _str;
size_t len = strlen(right._str)+1; //+1 for null terminator
_str=new char[len];
memcpy(_str,right._str,sizeof(char)*len);
return *this;
}

private:
char* _str;
};
NOTE: Observe that our destructor functionality was changed! Now that _str can be NULL, we have to check for that before deleting the object.

The idea behind a move constructor is that, instead of copying the values into our object, we move them into our object, setting the source to some NULL value. Notice that this can only work for pointers, or objects containing pointers. Integers, floats, and other similar types can't really be "moved", so instead their values are simply copied over. Consequently, move semantics is only beneficial for types like strings that involve dynamic memory allocation. However, because we must set the source pointers to 0, that means we can't use const myString&&, because then we wouldn't be able to modify the source pointers! This is why a move constructor is declared without a const modifier, which makes sense, since we intend to modify the object.

But wait, just like a copy constructor has an assignment copy operator, a move constructor has an equivalent assignment move operator. Just like the copy assignment, the move operator behaves exactly like the move constructor, but must destroy the existing object beforehand. The assignment move operator is declared like this:

myString& operator=(myString&& right)
{
delete [] _str;
_str=right._str;
right._str=0;
return *this;
}


Move semantics can be used for some interesting things, like unique pointers, that only have move semantics - by disabling the copy constructor, you can create an object that is impossible to copy, and can therefore only be moved, which guarantees that there will only be one copy of its contents in existence. std::unique_ptr is an implementation of this provided in C++0x. Note that if a data structure requires copy semantics, std::unique_ptr will throw a compiler error, instead of simply mysteriously failing like the deprecated std::autoptr.

There is an important detail when you are using inheritance or objects with move semantics:

class Substring : myString
{
Substring(Substring&& mov) : myString(std::move(mov))
{
_sub = std::move(mov._sub);
}

Substring& operator=(Substring&& right)
{
myString::operator=(std::move(right));
_sub = std::move(mov._sub);
return *this;
}

myString _sub;
};


Here we are using std::move(), which takes a variable (that is either an rvalue or a normal reference) and returns an rvalue for that variable. This is because rvalues stop being rvalues the instant they are passed into a different function, which makes sense, since they are no longer on the right-hand side anymore. Consequently, if we were to pass mov above into our base class, it would trigger the copy constructor, because mov would be treated as const Substring&, instead of Substring&&. Using std::move lets us pass it in as Substring&& and properly trigger the move semantics. As you can see in the example, you must use std::move when moving any complex object, using base class constructors, or base class assignment operators. Note that std::move allows you to force an object to be moved to another object regardless of whether or not its actually an rvalue. This would be particularly useful for moving around std::unique_ptr objects.

There's some other weird things you can do with move semantics. This most interesting part is the strange behavior of && when it is appended to existing references.

• A& & becomes A&
• A& && becomes A&
• A&& & becomes A&
• A&& && becomes A&&

By taking advantage of the second and fourth lines, we can perform perfect forwarding. Perfect forwarding allows us to pass an argument as either a normal reference (A&) or an rvalue (A&&) and then forward it into another function, preserving its status as an rvalue or a normal reference, including whether or not it's const A& or const A&&. Perfect forwarding can be implemented like so:

template<typename U>
void Set(U && other)
{
_str=std::forward<U>(other);
}


Notice that this allows us to assign our data object using either the copy assignment, or the move assignment operator, by using std::forward<U>(), which transforms our reference into either an rvalue if it was an rvalue, or a normal reference if it was a normal reference, much like std::move() transforms everything into an rvalue. However, this requires a template, which may not always be correctly inferred. A more robust implementation uses two separate functions forwarding their parameters into a helper function:

class myString
{
public:
// The copy constructor, which copies the string over instead of copying the pointer
myString(const myString& copy)
{
size_t len = strlen(copy._str)+1; //+1 for null terminator
_str=new char[len];
memcpy(_str,copy._str,sizeof(char)*len);
}
// Move Constructor
myString(myString&& mov)
{
_str = mov._str;
mov._str=NULL;
}
// Normal constructor
myString(const char* str)
{
size_t len = strlen(str);
_str=new char[len];
memcpy(_str,str,sizeof(char)*len);
}
// Destructor that deallocates our string
~myString()
{
if(_str!=NULL) // Make sure we only delete _str if it isn't NULL!
delete [] _str;
}
void Set(myString&& str)
{
_set<myString&&>(std::move(str));
}
void Set(const myString& str)
{
_set<const myString&>(str);
}

// Assignment operator, does the same thing the copy constructor does, but also mimics the destructor by deleting _str. NOTE: It is considered bad practice to call the destructor directly. Use a Clear() method or something equivalent instead.
myString& operator=(const myString& right)
{
delete [] _str;
size_t len = strlen(right._str)+1; //+1 for null terminator
_str=new char[len];
memcpy(_str,right._str,sizeof(char)*len);
return *this;
}

private:
template<typename U>
void _set(U && other)
{
_str=std::forward<U>(other);
}

char* _str;
};


Notice the use of std::move() to transfer the rvalue correctly, followed by std::forward<U>() to forward the parameter. By using this, we avoid redundant code, but can still build move-aware data structures that efficiently assign values with relative ease. Now, its on to Part 5: Delegated Llamas! Or, well, delegates, function pointers, and lambdas. Possibly involving llamas. Maybe.