(Untitled)

It’s not about exercising the courage to smile at the pretty girl; it’s about smiling at everyone.

Letter to Me

There is so much potential in the world. If you constantly demonstrate this fact to yourself, you will be forever happy. By realizing that anything we can “know” is founded on belief, which is itself subjective – in the sense that it varies from person to person – then you realize that there is no monopoly on righteousness, ever. All you can ever hope to do is be as happy as possible in the moment. Combine this idea with the realization that everything is in motion, and you come to understand that any interpretation of righteousness has to be fluid or it won’t work, in the practical sense. So knowing you need to have some sense of whats right and wrong in order to be happy (e.g. killing a police officer will likely make you unhappy for many reasons), and also knowing that everything is in motion, it’s possible to understand that a lot of the corner cases for what we hold to be true, need to be constantly revaluated. That’s where boundaries come in. Your boundaries are no more defined than anyone else, so explore yours and respect others! That’s the key. Then you see that the cynic’s perspective is bogus. Everyone has the potential to be as “bad” or “good” as they choose. It’s not zero sum! With that information, life is fantastic, because in the long run, people are, inclined to pursue happiness. So smile at everyone and feel connected, because it’s freaking awesome.

I don’t even care that this is probably the most obscure thing I’ve written in a while, I need to get his off my chest. I’ve been incredibly happy, and it’s because of this. I feel connected and part of something, along with everyone else that wants to be happy. It’s like a super exclusive club that let’s everyone in. We’re pursuing the most valuable thing in the world, without any focus on money, and we’re making exponential progress.

I can’t stop beaming.

(Untitled)

Is it egotistical to think that I could potentially break free from the ego? This idea has been on my mind since my mom – if any of you know her, you’ll understand why this bugs me so much – told me I had to “get over my ego”, as I calmly and quietly allowed her to berate me over some nonsense.

Personal vs. Impersonal Relationships

There seems to be this implicit direct relation of a relationship’s quality and the closeness of the people involved, where the latter is measured through properties like the total amount of one-to-one interaction between people, the degree to which people are genetically related, or the actual amount of physical closeness (i.e. proximity) the people involved share.

I’m starting to think this assumption isn’t as true as I once thought. 

For example, one of my favorite sets of musicians is Edward Sharpe and the Magnetic Zeros. Besides the fact that I think their music is pure bottled joy, their live performances have never left me less than hypnotized. What’s so awesome about their shows is the genuineness they embody. There’s no scripted dialog, stupid routine, or cheesy “We love you, New York”; there’s just the moving image of happy people, doing their thing with a crowd you’d think they (Ed Sharpe, et al.) knew personally.

And that’s where I think the key concept lies; that’s where the idea of “the personal” breaks down completely. Because as a member of that crowd, I actually feel like I know these people personally, even if it is just for that night, and who is to say that’s not a legitimate connection.

Alex Ebert (the lead of Ed Sharpe) couldn’t remember my name if he wanted to, just due to the sheer massive number of people he meets at every show. In such situations I’ve discovered that you have to make a choice: either (1) know that the relationship between you and the band isn’t personal, and therefore can only mean so much; or (2) throw out the need for personal-ness as a required criteria, and allow yourself to feel the full force of the moment’s potential happiness.

Obviously this idea goes beyond Edward Sharpe or even music, but for me it’s so tightly couple to them, and especially Alex Ebert, because I’ve personally (in the traditional sense) met him twice, and although I know he couldn’t possibly remember those experiences with me specifically, the times I’ve spent with him and his band are some of the happiest memories I have.

Knowing someone’s name or spending a lot of time with a person are strict formalities that need not exist for an encounter to be emotionally fruitful.

I’ve spent more time singing and dancing with Ed Sharpe than I have with nearly ¾ of people I’d consider to be in my personal circle! AND WHO CARES! I don’t need my personal relationships to be anything they’re not, nor do I need Ed Sharpe to act any differently. The paradigm should fit reality, not the other way around!

All of that being said, I think this also sheds some light onto the entire celebrity complex that people, including myself, seem to be so fascinated with. Taking the above concept as a given: I don’t think it’s really that much of a privilege to be on either side of the celebrity relationship. If you can get past the boundaries that “the personal” imposes, then either side can enjoy the moment at equal intensity.

Also, while it’s practical for me to talk about how I (as a member of the crowd) feel about the performers, the idea of how performers see the crowd can be equally as interesting. I imagine this concept of a high quality, impersonal relationship is old news to people like Alex Ebert, his band mates, or any other genuine performer. They experience strong, short lasting, bonds to people they’ve just met much more frequently than we do, and perhaps even more frequently than they experience personal relationships, quality or otherwise. However, given that, such a perspective might shed some light on why some other performs can be such douchebags on stage.

While the potential for quality relationship is there, a lot of the time the crowd abuses their partner, the performer, demanding played out music, throwing things on stage, and doing generally anything to feed the confused hedonistic urge for a good time in a situation they’ve already predefined as impersonal. In cases like these, the crowd becomes its own beast, acting as if the performer is like some sort of credited vending machine taking a little too long to dispense their made selection; shaking the thing is near instinctual.

I think its because of this that one of my other favorite performers acts like such a dick on stage, yet remains to be so awe inspiring. Neil Young once told a fellow performer who was nervous before a gig to, “Show them no respect.” After experiencing Neil’s own lack of respect for the 4th or 5th time in person, I began to loose faith in my idol. Could such a prolific song writer, who’s work always carried the themes of compassion and togetherness, really hate people that much? Was he just another phony? I don’t think so. I think Neil just plays it like he sees it, and in the moment, the crowd – which is usually much larger than those at Edward Sharpe shows, and thus innately more unruly – can be just as much a factory of disconnect as it can be pool of mutual happiness. In that case, Neil looks at it (the crowd), recognizes it as an individual in itself, flips it off when it shows him no respect, and does what he came to do – play music.

Regardless, recognizing the true nature of one's involvement in “the whole” of things gives you a wholesome perspective on how to act. Allowing myself to let go of all the restrictions I’ve been indoctrinated with over the years has let me enjoy experiences with a new level of intensity; on the flip side, such a perspective has also let me forgive the mob-mentalitied crowd, as they know not what they do; and lastly, this outlook has given me an understanding of those who react to the mob rather than the individuals its comprised of; it’s only natural.

So, the obvious conclusion to this little rant? Ed Sharpe should cover a Neil Young song. I’d give a few suggestions, but I’d probably end up listing the discography, so surprise me.

Alex Ebert and I

Quick Note to Self

There are certain things you wish to do in life that are difficult, as they require persistent forfeit of short term pleasure in exchange for long term accomplishment. There are also other things you wish to avoid; things that (supposedly) yield short term pleasure, but at the expense of long term suffering.

In order to make progress in either of these endeavors, you need focus, and the only way to gain focus is by practice.

Anything can count as practice; as long as you stay focused on a specific goal and try – however painstakingly – to accomplish that goal, you will make progress in honing the skill of true focus.

By definition, the most low level form of this practice is meditation. To sit and attempt to stay focused on a single, simple, point of interest (e.g. the breath) you progressively learn to focus on a single idea of your own choosing, and at the same time, you learn how to effectively recognize and deal with distractions.

This is what you’ve forgotten. This is what you need to remember.

-Me

Thailand Notes (Part 4)

In hindsight, I still haven’t found the proper way for how to express this idea just yet, but you got to start somewhere…

Competition and Self Reflection

When you’re submersed in a population you’re familiar with, it’s easy to recognize so called “mistakes” other people make because it’s easy to see yourself in other people. What I’m learning is that when the opposite occurs – in other words, when you’re submersed in a population that completely clashes with your sense of normalcy – it’s really difficult to connect, and thus you’re alone with yourself.

In the former case (New York, for me) I can turn behaving righteously into sort of a game, and the competition of it makes it easier for me to feel content and good. Observing other people doing things with inevitable negative outcomes makes it easier for me to not repeat such behavior in my own life. Conversely, watching people I admire, pushes me to do more with my life.

But in the latter case, I’m left alone with myself (metaphorically speaking), and mistakes go unrecognized because of my ego and lack of setting. Aspirations are also harder to grasp for similar reasons.

Both cases leave me lost in my thoughts, and I end up getting caught up in these cycles of hate and angst due to my lack of regiment or comfort. Combine this with the lack of close relationships given the setting and you find yourself with no one to call you out of your own darkness.

The conclusion: when left alone with myself it’s easy to catch the self-conscious cabin fever; it’s something I’ve got to work on.

Thailand Notes (Part 3)

Slight backstory: since the music festival I went to in early June, I haven’t been drinking, making me sober for about a month and two weeks since the writing of this post. Since then, the decision has been both highly difficult to stick to and increasingly interesting to contemplate, especially as I make it further than I ever thought I would. By the time I got to Thailand, multiplied by all the other self-reflection I was doing, drinking became the topic of choice for a car ride brain-dump, which is what I’m posting here.

I should also note that I’ve added to this opinion since I wrote the following short essay, but in an effort to stay honest to the title of these posts, I’m only going to fix grammatical errors, and not change the content.

Drinking

The reason I’m not drinking is because most of the time it’s destrctive and only ever considered fun due to its (usually) being attached to situations that would be fun even without alcohol. In light of that realization, I think the cravings I’ve been having to drink are somewhat illusory, based on this false mental-image of past goodtimes being the result of drinking; in hindsight, such moments were probably fun because of their social/active setting.

As of late though, I’ve started to think that the so called “responsible” style of drinking could be potentially neutral, but even so, I still think my abstinence is a good chance to do some positive influence for the people that I hang out with, as well as a way to allow myself to focus on doing bigger and better things with my time and subsequently my life.

Perhaps if I gauge it honestly and frequently, I’ll discover that the opportune time to drink (for me) will never come.

Here are some of the situations I’ve thought about:

Concerts:

Fun either way. I’ve already trained myself to listen and love music using nothing more than my sober senses and rad dance moves.

Backyard Conversation:

More of a habit than an enhancement. If anything, I think that attaching drinking to those countless number of nights ended up justifying a very lazy and unstimulating activity. Should my friends, family, and I not have had drinking to make it acceptable, I’m pretty sure those opportunities would’ve been taken advantage of in much more interesting ways.

Parties:

Can be fun either way, but honestly they tend to be better when there’s no inhibition (i.e. when drinking). More often than not though, (certain) parties follow a pretty predictably path of drinking games and redundant conversation. Bars are even worse. In these cases drinking is not necessary, and is often just an excuse to keep the uninspired, cyclical wait-till-weekend-get-fucked-up lifestyle going. However, in fresh party scenarios (e.g. ones with new people and activities) I think it can be good to make yourself less reserved around strangers and turn what would otherwise be a cautious self-conscious night into a blast. However, like concerts, I think this skill could absolutely be developed to work without alcohol; perhaps, it could even be improved since the latter is an active pursuit, whereas drinking is sort of passive, and thus has a biological ceiling (i.e. tolerance). In the end I still think parties lack the justification necessary to make me think of my own alcohol use as reasonable.

Grief:

Prolongs acceptance.

Tradition:

Still bad, but the benefits of keeping the community together by following tradition may outweigh the negatives. For example, not taking a shot of Johnny Walker during hunting season might be disrespectful and thus ruin the cohesion of the club for a moment.

Taste Appreciation:

Not too bad in moderation, but a very slippery slope when your trying to NOT make excuses to drink in the former settings. I’ve also found it really hard to guage the difference between a craving and a passion, in this context.

Thailand Notes (Part 2)

Everything Is Linked To Everything. That’s karma and I believe in it, but that doesn’t mean that every action has a significant correlation to every other subsequent action. Wishing something might happen and actually having that something happen may in fact have some (whatever little) correlation, but that doesn’t mean - all other conditions the same - if you didn’t wish for it to happen, that result wouldn’t occur anyway. There could be a much more correlated action tied to that reaction, and the degree to which two things are related is the way we define practical cause and effect.

It’s by this magnitude of correlation between actions that we gauge the world. The definition doesn’t support the pseudo-scientific and often emotional misinterpreting of small correlation as significant reasoning behind an effect. 

Believing in karma doesn't absolve you from looking at reality as granularly and critically as possible. Further more, by the same logic, believing that good begets good and bad begets bad doesn’t mean you can help an old lady cross the road and expect to win the lottery. Good and bad are subjective and can only be applied to a cause-and-effect analysis after the metrics have been collected. In other words, if you measure all the correlations between a set of actions and then observe that two are related, it’s only then that you can deicde wether or not they’re good or bad, and at that point your arguing opinion. It’s irrelevant.

The concept of karma is a call for reason, and I’m seeing it being interpreted as exactly the opposite.

Thailand Notes (Intro & Part 1)

Intro

So while in Thailand, I did a lot of self-reflection; went through a lot of experiences that tested my endurance, both physically and mentally; and also spent a lot of time traveling in the car. Combined, these things lead to a lot of brain-dumps which – thanks to my Uncle Frank for his graduation-gifted iPad – I was able to write down. I think they might interest some people, plus I’d like to refine their grammar and structure, as well store the ideas somewhere more persistent than the iPad’s local hard drive. So, plan-to-be: I’m going to go through each of these notes one by one and post them on this blog.

Part 1 - Untitled

You begin to realize that it’s your mind which makes things persist. Bad feelings, urges, and cravings on the experiential level are more often than not momentary pangs of vibration. Our mind takes these pangs as signals to start thinking about something, which then usually leads to an obsessive cycle of want.

For example, I want to leave, I want a beer, I want a burger, I want this turbulence to stop. If you take the time to observe the mind this becomes more and more apparent, and it’s this realization that allows one’s self to be liberated from said cycles (and thus their painful side effects). Note, I’m talking from a practical perspective; in other words, you’re not going to be able to lift a 10 ton boulder by noting and not reacting to the persistent pain in your arms and body as you try, but you may be able to stop that wrenching fear of “x”, etc.

As you develop this skill to recognize true sensation without reacting to it, suffering dissipates. But, at some point you might think you’ve eradicated all of it and then happen to go through a rought day. This is NOT significant of a failure in you or the practice, but merely a sensation you have not yet come accross and therefore have not reconditioned yourself to. The same can happen in the opposite direction as well: an unexpected happiness is always going to be short lived and ultimately distracting if you don’t pay attention to the sensations that are supposedly generating (or more realistically, are associated with) that happiness.

Once it’s gone, unless you’re honest with yourself about what you were actually feeling, it’s very easy to become sad at the idea that you can’t get that feeling back or frustrated in an effort trying to.

Consistency in practice is also important because it ensures conditionings don’t reform to sensations that have already been noticed, redefined, or eradicated.

Another thing…

The brain tends to implement this predictive caching scheme, assuming if a sensation has been felt at one point in time, unless it is responded to, the sensation will probably still be there in the next moment, so it’s safe to assume you don’t have to observe for it again. This is what was once normal for me. However, if you make an effort to actively and continuously query for sensation, you get a more precise (and often more accurate) view of what’s actually going on – a finer self-resolution, if you will – which in the long run gives you a clearer view of truth and thus the way out of suffering via the above practice.

This has been especially practical for me when dealing with fear. Turbulence hits, my heart jumps, but I immediately reevaluate myself afterword, with an effort only to keep my mind still, and I go back to normal, neutral, receptive me. Before being observant I would’ve played through many different scenarios of how the plane would crash soon and I would die in a horrifying fall, in the end making myself extremely stressed and anxious for no reason. Now I circumvent that infinite (and pointless) escalation cycle and just continue on with my life. Or at least, I try to.  

Perhaps the Poor Are Better Suited for Progressing Toward Enlightenment

Just a small braindump: I was just thinking that if the route out suffering is to become both objectively aware of sensation and simultaneously to eradicate conditioning, then the people who are less able to respond to the most primal conditioning (e.g. hunger, thirst, etc.) have a more natural inclination to not react to their cravings. Whereas in The States, our my cravings tend to be for more abstract things (e.g., ice cream, video games, kinky sex, etc.) most of which I can (and am often encouraged by my surroundings) to satisfy.

Evangelizing Truth

Let’s say, hypothetically, a person becomes enlightened to the true nature of the universe and such an understanding frees said person from all forms suffering. This person is no longer blindly conditioned to respond to craving or aversion, and they have a comprehensive knowledge of human experience at it’s lowest level. They understand pure balance, live life in consistent peace, and see beauty everywhere they go.

Fantastic. This is the type of enlightenment that I’ve heard wise people lecture about and that my experience in life, however limited, has lead me to believe is obtainable for myself and others. I also believe that unveiling the above described truth isn’t really that complicated of an endeavor, although it does take a lot of hard work, namely though the practice of introspection and meditation. Whether or not the practice is the enlightenment or enlightenment is itself a discrete state, doesn’t matter, for the sake of this thought

If you take the above as an axiom, you can go one step further and say that there are people who currently live in this state of enlightenment (or at least close to it). It’s also safe to say that, given the amount of people teaching it, for one reason or another, enlightened people tend to try and help others in search of truth find a path toward it.

O.k., so the above is the setup to the latest conversation I’ve had with myself. There’s a line I recently read about how the Buddha universally and timelessly defined morality. Quoting William Hart, quoting S.N. Goenka, quoting Siddhartha Gotama,

Any action that harms others, that disturbs their peace and harmony, is a sinful action, an unwholesome action. Any action that helps others, that contributes to their peace and harmony, is a pious action, a wholesome action.

I think this makes sense because if you give a static definition of righteousness, you often get burned in the margins. For example, if you say it is always wrong to lie, situations where the truth would do more damage than good get ignored in favor of the majority of conceivable situations; the lack of malleability to static definitions of morality makes them break down over time, whereas the above encapsulates the compassion that morality is based on. One could argue that dynamic definitions have the potential to get stuck in never ending recursions (e.g., following the chain of causality down into infinity, wondering whether each subsequent consequence of your initial action is wholesome), but I think wise experienced people tend to be able to know when to stop interpreting the chain of events as purely the fault of their action.

Anyway, I digress; the point is if enlightened people are operating on the above definition of righteousness, and such people simultaneously know that sudden, drastic change is more liable to confuse and frighten people than it is to awaken them to truth, then it follows that enlightened people are more likely to take a subtle, even devious route toward evangelizing truth and the path to it. Now obviously this can be dangerous given that people have the tendency to taint truth with their subjectivity, but pure truth is not owned by anyone, nor can it be tainted. Point being, people can’t monopolize truth, and if offered a path to anywhere but truth, experience will prove that path ill-directed.  

This realization is pretty straightforward (if you accept the axioms), but it’s the consequence of such a reality that I think is really interesting. Think about the number of dogmatic religious leaders that could really be secular truth advocates catering to a particularly conservative audience.* That’s not to say that spiritualism and truth have to be mutually exclusive, but a lot of people seem to be stubbornly partisan when it comes to the two topics, which makes it that much harder to convey the importance of each from one camp to the other. I’m not sure how much evidence there is to support this, but then again, I’m only proposing it as a possibility; it’s just a thought…

*This might be contradictory to popular belief when it comes to religions and the churches that (supposedly) propagate their messages, but in my experience, a lot of the church leaders I’ve met tend to gloss over the hard controversial topics, instead focusing on the more secularly supported lessons taught in bible’s stories.

(Untitled)

Whenever I see a persons eyes moving to follow the words on a teleprompter, whatever they’re saying immediately looses all credibility in my mind.

Osama

Being a brand designer and a marketer I have somewhat of a cynical and skeptical perspective on the validity of how large organizations are personified, both through their own efforts and the media – the U.S. government, definitely being on that list. It’s not so much that I think there’s always an intentional disconnect made between reality and how these organizations present themselves, but when a system becomes large enough, trying to pin it down with simple definitions or elegant equations just becomes plain difficult; keeping track of all the variables at play is just too hard to do, at least when described at such high levels of abstraction. What angers me is that news organizations often try to do it anyway, in complete disregard for the complexity of the problem, and often just for the sensationalist effect doing so produces. 

Which brings me to the recent news of Osama Bin Laden’s death…

Now, I’m going to catch a lot of flack for this, and I welcome all of it as long as it’s critical and articulate. I’m not trying to say that this opinion is righteous or even valid, but it’s what’s on my mind and I feel the need to express it.

What I’m not going to do is comment on the political nature of this event, nor am I going to give an opinion on it’s supposed effectiveness in making our country more or less safe. I have no depth of knowledge regarding either of those topics, and I would venture to say that most people not directly involved in national defense are on the same level of awareness as I am, given the largely superficial information we’ve been permitted to consume as citizens. My opinion is less rooted in the specific circumstance of Bin Laden’s death and more in regard to the underlying morality of the situation. So, here it goes…

Given what we’ve been told about Osama Bin Laden and his intentions for the United States, it’s undoubtedly a good thing that he no longer has the power to bring his misguided ideas to life; but is it really a parade worthy event that a man has been killed! Have we really become that disconnected from the reality of what is going on to realize that we’ve exhausted all other options and are at our last resort – the need to dehumanize our soldiers by asking them to do the most unspeakable acts imaginable to other humans, while simultaneously risking their lives for said disprivilage!

I’m a New Yorker. I have family that live in Manhattan, Queens, and Brooklyn. You could see smoke from my town’s high school the day The Twin Towers fell, and I have friends whose families were directly effected (although, admittedly mine was luckily spared such grief). I am not trying to say the acts that Osama was directly responsible for weren’t horrendous. All I’m saying is that this man was obviously confused and, as a last resort to secure the safety of our people, it was decided that he had to be killed or at least put away. Now that that deed is done, I want to turn away from a very dark chapter of our past in remorse for all the hard work and intense pain people had to go through in order to make this happen. What I don’t want to do is go to a party wearing an american flag as a cape. Osama being killed does not make me smile. It does not make me happy. And to be completely honest it does not make me feel any safer in the long run.

The questions of how to make our world safer, mutually hospitable, and ultimately peaceful in the long run are still being quietly ignored in favor of a much cruder, inefficient, short term solution: violent war. I don’t know of any better solution, that’s true, and I’m not saying that finding one will be any easier than the most difficult problems of history. But to pretend like the brute force methods we currently employ are ever, even in their brief moments of veiled effectiveness, elegant, commendable, or at all capable of provoking happiness, even indirectly, is a lie and a dissonance I won’t foster.

I’m still sick thinking about what must go on in the countries our soldiers occupy and I’m still sad for what happened in our own country those near 10 years ago.

Osama being alive or dead doesn’t change that.

Defining the Utility of Design

I recently went through some of my old work and reread a piece I wrote on my past influences in graphic design. The piece in its entirety was slightly arbitrary, having needed to meet certain requirements put forth by a professor, but the introduction I wrote for it seemed more modular than the entire piece and might be of interest to some other people. I also wanted to have it somewhere public where I could reference it in other work. It’s reproduced below: 

Design is an elusive activity to define. It carries the ambiguity and beauty of art while simultaneously exists for a very discrete purpose: to convey information. However, I've often wondered if one of these traits held more importance than the other? For a long time I didn’t know, but now after having reflected on my past work and influences, the answer has become slightly clearer. I can’t recall anything that has ever been designed without intent. For every project I’ve undertaken or observed in my life, it seems there can be found at some point a person saying, “I should design this, because…”  What follows this clause can either be one of two types of reasons: the selfish, saying “I should design this, because it will be fun and self gratifying”; and the selfless, “I should design this, because I want to impact other people in some way.”  

Applying this hypothesis in practical terms splits the repository of the world’s created works into two clearly unique halves: that which was designed without the intent of conveying a message and that which was designed with the intent to convey a message. The former is simply art for arts sake, which we all do constantly in life, wether we identify as artists or not. But it is the latter reason  – designing messages – that is the more conversationally relevant, because conveying a message requires both a speaker and a listener, and it is thus a social activity. I would argue that such an activity is the only type worth talking about, as any other topic which isn't social in some respect is completely internal to the speaker and thus of no use to anyone else; in other words, there are no people in the world that would benefit from such a lecture since it is by definition only of importance to the speaker.

Taking a step back and looking at the consequence of such an argument, we can return to my original question — which is more important, the aesthetic or function of a design. At this point, I can safely say that it is the function of a design that is more important, at least when talking about design that is trying to convey a message. And as I said earlier, design that is trying to convey a message is the only worth talking about, so it will be the only type of work discussed in this essay!

Custom Tastypie Nested (Model) Resources For Dealing with Django ORM Relations

Background

So I spent 6pm Saturday night, till 9:30am Sunday morning in a hackathon where I worked on, you guessed it, tastypie; specifically, on work concerning an open source project I’m involved with, Concert.

Long story short, Concert had an issue. It’s a very javascript heavy app, which handles a lot of state information client-side. Because of this, we’re using a MVC-like javascript framework called Backbone.js, which abstracts away a lot of the interaction between our server-side django app and the client-side code.  

Traditionally, django apps end up being their own flavored instances of the Model/View/Controller paradigm, but there’s an issue with such an approach when you’re dealing with the situation described above; state-manipulating client side code and state-manipulating server side code have no enforced methods of communication when said communication is handled by django views - at least not out of the box. Luckily, this exact situation is perfectly handled if we choose to stick to a RESTful style architecture, which is where tasty-pie comes into play.

(*Note: there’s nothing saying that you can’t implement a RESTfully compliant interface using plain django views - i.e., implementing RESTful interfaces on a per case basis for all the django model classes your app has - but this has to be all done manually for each class instance, and there’s nothing forcing you to stick to the standard’s definition. It’s also, in my opinion, a waste of time when there are so many comprehensive options out there - e.g., django-tastypie, django-piston, etc.)


The Problem

The specific issue we ran into when getting tastypie to work was how to deal with many-to-many model relationships RESTfully and intelligently (blog post).

Say you’ve got a couple of related models that look like this:

and say we’ve got two tastypie resources that map to each model.

Out of the box, tastypie will give you a handful of URLs and all the basic CRUD operations you’d expect.

A url like this “/api/audiosegment/<optional_primary_key>" can be sent POST, PUT, GET, and DELETE requests, each of which does exactly what it’s supposed to: create, update, retrieve, and remove states (objects), respectively. So let’s say we send a PUT request to ”/api/tag/1" with the intention of updating what’s in the segments attribute of the already instantiated tag with primary key 1.

The PUT request itself is going to have to contain, as an argument, the new state of tag #1; it’s going to send a name, creator, collection, and a new list of segments, including all the segments previously contained by that tag and the new one.

Where this becomes an issue for us is when we try to determine what a specific request is doing, in detail. During the time the request is made, dealt with, and responded to, all any component of our app knows is that a model is being updated - whether or not a relation was was added, removed, (or any combination) from our model instance is a mystery (e.g., whether or not a segment was added or removed from Tag #1 is unknown).  Not usually a big deal, unless you have actions that are dependent on knowing such information, like if you have an notification system that informs users when audio segments get tagged.  Not knowing when relationships are being generated means not having anywhere for our notification methods to hook into.


The Solution 

The way I went around solving this was by cooking up my own recipe for nested resources.  The tastypie documentation mentions them here (Tastypie Cookbook), but the specifics are left kind of vague, which is why I’m writing this.  Perhaps I ended up reinventing the wheel, but at the time I couldn’t find anything already out there that was (significantly) helpful.

What I wanted (and got) was the ability to hit resource urls that looked something like this:

/api/<nested_name>/<nested_primary_key>/<resource_name>/<resource_pk>

or in terms of my project:

/api/audio_segment/1/tag/

POSTing to the above resource URL creates a tag, and then relates it to the specified audio_segment.  This gives me a hook for my notification creation methods, and solves all my headaches.

I also ended up implementing a slightly less RESTful shortcut which allowed you to POST to /api/audio_segment/1/tag/1/ with no data.  This would expect for both resources to already exist and then simply create the relation between the two.

DELETE works in a similar way.

GET and PUT were left unimplemented since in those cases you could just manipulate the non-nested resources and deal with them as you wish.

The code is generic, so you can include it and have your nested resources inherit from it.

It’s all GPL, as it’s being released under the original project’s name. You can look at the in use version here: GitHub.

I should mention that this isn’t perfectly RESTful. If I were to implement a purely RESTful solution it would mean creating custom resources for each model-relation itself (e.g., have a resource URI that looked like this: /api/audiosegment_tag_relation/), but for the limited number of use cases I need to meet, this is a little easier, and as far as I’m concerned, it’s probably still useful information to have in the public domain.  

Some might argue that by veering away from the RESTful model in my solution I’m actually moving back to the ad hoc approach which I argued against when discussing plain django views, but I disagree.  With standalone django views, you’d have to opt into following a standard method of communication, whereas with this implementation, you have to opt out; in the end it keeps me as a developer a little more honest.

A slightly more reusable version of the code is embedded bellow.  Another issue, which isn’t so impossible, and is more of a modularity concern than a dead-in-the-water problem, is the fact that my implementation only works for one nested resource per regular resource.  It’s feasible to consider an edition which allowed for unlimited nested resources, but that’s not necessary for Concert right now.  Maybe in the future…

Technology-Nature Dynamic

So, I was hesitant on posting this, thinking it might be too arbitrary or not well enough articulated, but since I’m treating these articles as a set of journal entries more so than traditional blog posts, I’m going to go with it…

Lately, I’ve been thinking a lot about mindfulness, and the practice of such has been my routine for the past couple of weeks. It’s helped me tremendously, in terms of overcoming my addictions (mainly, food) and just seeing the world in a clearer light.

However, as I write this I’m two Red Bull’s, a couple slices of pizza into a Hackathon, and I’m so consumed by code and shitty foodstuffs, that I had to take a big step back to remember to pay attention.

Code is a big part of my life, being a developer and all, yet at the same time, code is tremendously abstract and innately disconnected from the paradigms of reality.

Guess I’ll just have to get used to that…

Revolutionizing Education

So there have been countless observations made about the failures of the current school system. Whether it be grading brackets crippling student motivation, homogonized material simultaneously boring and intimidating kids, or structured curriculum snuffing out creativity, the problem has been articulated over and over again. What hasn’t been talked about so much is the solution, and today I believe I’ve found it; not thought of it myself, but literally found it:

The idea, for those who didn’t watch the video, is that you break all the topics of traditional schooling into short (12min) incremental lectures. The student can then browse these lectures learning at their own pace and progressing in their own direction. Think math is sweet? Take it as far as you can, as quickly (or slowly) as you desire. Why not learn algebra and calculus in direct succession, and then move on to social studies? In Khan’s system, teachers become moderators instead of monarchs, assisting with questions and providing only the most minimal structure necessary to keep kids learning.

Now, I haven’t checked out the Khan website yet, so I don’t know exactly what Khan’s longterm motivations are, but I’m too excited to care; I think it’s better if I just rant and empty my brain (that is why I started this blog - as an outlet for my mind’s rants) even if I do end up proposing an identical mission to what he’s already got planned.  

How awesome would it be if instead of saying, “there’s going to be a test Tuesday”, a teacher mandated that a student had to take a minimum of X tests a year and cover a minimum of Y topics. The student progress at their own pace, and there’s no check points - move as fast or slow as you desire! And if someone doesn’t pass a test, there’s no reason to move on. Have the student stay on that topic until they master it.

What you end up doing is changing school from having smart kids and dumb kids, to a school where there is a threshold for how long it takes to make smart kids. Instead of graduating a D student after 4 years, you graduate an A student after 6-7 years. Even if it takes 10 years, the alternative (what is in practice now) isn’t really graduation at all; if the student isn’t educated, then moving on doesn’t make sense.

And you can’t say a kid is too dumb to get a topic either, because theres no reason why lessons can’t be as granular as possible. If you don’t get algebra, then there’s a reason for it - a lack of understanding in some core concept that algebra builds upon - so go and attack that reason head on with a lesson that addresses the sub-topic. The student wouldn’t be holding anyone else back, so who cares!?

First Post

The entire reason for my starting this blog was because I kept having ideas and pseudo-epiphanies about different topics – e.g., programming, philosophy, etc. -  would write them down in my phone or on my white board, only to have them disappear into the oblivion, after time. So the obvious solution: start a blog. But once I had the thing set up, it took a while (today) until I had another rush of that special kind of brain activity that might constitute a post. Anyway, I’m leaving this here as a starting point and somewhat of an explanation (mostly for myself) about why I’m doing this.