Sunday, September 15, 2013

Benefits of learning to code

it teaches...
  • patience
  • persistence
  • precision
    • e.g., asking precise questions, being meticulous with what you write
  • ability to play detective
    • debugging
  • creativity
  • skill in filtering information
    • deciding what's important as you scavenge the web for answers
  • curiosity
    • wondering, why does that work? as you scavenge the web
  • ability to think high level and low level
    • the little details versus the big picture
  • prioritizing
  • focus
  • and once you're at it for a while, when and how to take breaks. how to keep your mind fresh.

Overloading << in C++

This error was pretty annoying in the linking stage as I was compiling my C++:

duplicate symbol __ZlsRNSt3__113basic_ostreamIcNS_11char_traitsIcEEEERK10Notation in:
    CMakeFiles/project1.dir/TwoTagExample.cc.o
    lib_notation_lib.a(Notation.cc.o)

I thought I was following all the rules and even thought maybe I was using a name already defined in some deep C++ library... I mean I was compiling with

clang++ -std=c++11 -stdlib=libc++ -g TwoTagExample.cc Helper.cc Notation.cc

(extra options for things like initializer_list and such).

Apparently I was overloading the << operator wrong. I thought I could put the implementation right in the .h file, but you have to implement it in the associated .cc/.cpp.

Bad Notation.h file:
class Notation {
  static const string GIVEN_DELIM;
  ...
};
ostream& operator<<(ostream& out, const Notation& n) {  // NO.
  return out << n.repr();
}

(The thing is this overloading works fine if you put the class and overloading function in a .cc/.cpp file, which was what I had in this hack of a project initially. But once I moved to a .h – nope.)

Good Notation.h file:
class Notation {
  static const string GIVEN_DELIM;
  ...
};
ostream& operator<<(ostream& out, const Notation& n);  // Yes.

(Good) Corresponding Notation.cc/.cpp file:
#include "Notation.h"

const string Notation::GIVEN_DELIM = "|";
...

ostream& operator<<(ostream& out, const Notation& n) { // Yes.
    return out << n.repr();
}

no one likes uninformative errors... but at least they make you play a good detective game.

Other reasons you might be getting the "duplicate symbol" error: more likely than this, you reused a method or variable name somewhere in the .h (shouldn't be defined twice) or across header files. Or you forgot your header guards (those #ifndef #define things that should be in header files but I left out for brevity here).

Thursday, September 12, 2013

torn

things are tearing at each other, as usual: a fuse lit there, a dreary walk under the moonlight, soft sounds to your ears; music doesn't burn but it does set on fire, in some calm way, sparks bouncing about; occasionally one flies out and stings and the water begins running, but other times it's the soft nothingness that suffocates the air dry of beauty. so you have to make an effort to paint the walls green and the floors flowery colors while you dance about with that silver in your hand, each breath a musical sigh, even the inhaling a rhythm that snaps together deaf colors around you; a spitting mess of walking about alone, crumpling seams – the ground doesn't shake when you play, but you feel the earthquake with each thunderous thought, spontaneity popping out of your fingers and grilled dry napkins left to clean up the mess; we are too much shaped by that tunneling sound of planes overhead and walls pushing in, but you hide in the corner with your book or instrument or pen and paper and express the hell out of that nightmare wound imploding everywhere inside and everywhere invisible too; "don't make thoughts your aim" as you scribble about knowing the paper will vanish just as each musical note vanishes with ...

your breath. my breath. it's all the same, recycled about in the waste of expression – to capture that taste again and feel it yank all the life out of you so you are dead but your work is alive; "to be great is to be misunderstood"; no more boundaries, no more soft light pilfering the darkness, a droplet of thoughts in an ocean; what does it take to boil it all and shoot it up to the sky to rain upon the billions who miss all the beauty here – fireworks

Tuesday, September 10, 2013

Flute piece position to reduce wrist pain

I found that my left wrist had been hurting more and more after holding the flute for a while. It turns out (according to http://www.jennifercluff.com/lineup.htm#align) a good number of professional flute players recommend aligning the flute mouth piece in this manner:

"align the far side of the embouchure hole (the striking edge, where the air splits) with the center of the flute's keys."

In my case, my flute has a little arrow/notch indicating the center of the flute keys (highlighted in yellow here):



This is new to me: my mouth piece used to be tilted farther away from my mouth, making my left wrist strain uncomfortably. I had no idea for so long =/. This way, the wrist doesn't have to bend as much.

(Also I feel like I can hit lower notes better now...)

Keep in my mind, as the article linked above says, that this is recommended for most flute players, but doesn't apply to all; it depends on "the formation of the lips, chin, hands, arms and the level of the player's development."

But it works for me.

chains and mountains

the soft mellow tones of my surroundings, the patient air that seeps into and out my lungs. thankful, absolutely, for the new research opportunity: script deciphering with math. "Write for yourself..." this model of peace and quiet churning out thoughts and meditations of the heart, blithely scrapping away thoughts and melting together ideas that were nothing but electricity to begin with; I wonder what will become of thotdrop, really. so many memories to analyze, to search for meaning through.

command-chaining: a novel idea, applied to human habits: could I pull that off? Map our behaviors statistically and provide patterns that easily let us grow and improve – chaining together thoughts infinitely until our physical limits, the jail bars that we stretch our arms through, imprison higher orders of thought: nope, still trying to escape. a hundred years to reach, hundred years of happiness to continue spreading before the vice (virtue?) of life rains upon the imprisoned; when the jail bars melt, the door opens, the chaining of infinite thoughts becomes possible.

mountains upon mountains of silence: a search for utility, shadows in a land with no light: those mountains should be dug up, or buried, or shredded.
but those mountains are right here, growing with every word.