1. What it means to be a man

    April 29, 2012 by Gabriel

    Fuck The Game.

    I am serious. For those of you who have not heard about the book The Game by Neil Strauss, it is a book about teaching men how to become a pick up artist, to seduce women and to bed them through a series of techniques and street ‘exercises’. It is, in my opinion, the single most misguided and damaging piece of literature a guy can read.

    The book advocates treating women like objects – with quotes like “a low opinion of the opposite sex is a prerequisite for sarging”.

    And peacocking, where you wear something outlandish or garish (such as a shiny red spandex shirt) to social outings to stand out from the rest of the males – much like how a peacock will spread it’s colorful feathers to stand out. It also teaches you how to become the Alpha Male Of the Group (AMOG) by trying too hard to become the center of attention, talking loudly and basically acting like a chump. All these in the name of bedding women.

    What deluded, misguided advice. The book is so wrong that reading it in my free time during reservist made my eyes water. The people in my life, who I saw apply this advice from this book, all turned from nice, sincere guys into dysfunctional, pathetic and slightly creepy guys. So, if any of you are reading this, stop. Just stop.

    Now that I’ve gotten that out of the way.. let’s explore what does it mean to be a man.

    Most people think that the opposite of “man” is “woman”, that the more macho one is, the more “manly” he is. This includes engaging in traditionally “manly” activities such as playing rugby or football, joining the army, binge drinking, smoking, fighting or street racing.

    You cannot do a guy greater hurt than to call him “feminine” or “ah gua/ a sissy”. We feel that masculinity is defined by what we do, rather than who we are. This fundamental male biological drive, an obsolete remnant from our prehistoric past, is what books like The Game feeds on. It tries to indoctrine an entire generation of guys that “masculinity” can be acquired as easily as picking up the newspaper in the supermarket – speak with a deeper voice when speaking to the opposite sex, “neg” or put down the Alpha Male in the group, treat women like objects, don’t act like a girl, don’t let women push you around, sleep with lots of women and etc..

    Masculinity and being a man is much more than that.

    The opposite of “man” is “boy”, not “woman”. And this is what books like The Game turn you into. Boys. To become a man, is not about doing what women don’t do, or to dominate women.

    It is to do what boys lack the will or maturity to do. It is about taking responsibility for your own life, to live like a responsible and independent adult, to stop taking money from your parents, to learn how to care for and provide for another human being other than yourself, to know with clarity which direction your life is heading, and to have the courage and conviction to pursue it.

    It is to be firm and say no to destructive and dangerous behavior, such as drink driving, street racing, fighting/ rioting, smoking, taking drugs, no matter how cool or “manly” they are.

    It is about taking charge of your finances, finally learning what the word “delayed gratification” means, and saving up to buy your first car, to get married or to downpay for your first house.

    It is about learning to respect and treat women as equals, considering the fact that your mother and the mother of your children in the future are all women. It is about letting your guard down to love someone whole heartedly, knowing that you risk getting your heart broken, but take the risk knowingly anyway. To commit to building a future with someone, and seeing that person in your life 40 years into the future, rather than still looking for one-night stands with questionable women.

    Lastly, it is also about being able to weather adversity, whether it is a failed business venture, losing your job, going bankrupt or getting into an accident – and still not lose the ability to dream. To become a rock and a pillar of strength for the people you love when everything comes crumbling down, and not lose faith yourself. To look your partner in the eye through her tears, wipe them away, and say,

    “Things will get better, we will do this together.” in a soft voice, with conviction.

    To promise yourself that you can live on bread and plain water, that you can go hungry, but your parents, wife and children cannot. And that you would sacrifice anything, including your own happiness and freedom, to give them a good life.

    This is what being a man is about, and this is what distinguishes a “man” from a “boy”.


  2. Reflecting on the past year

    March 29, 2012 by Gabriel

    It’s amazing how much things can change in one year.

    We entered the tech industry for the very first time exactly one year ago. I remember feeling scared shitless as I sank in over 4 months of salary and all of my savings into our first business together, quitting my job and knocking on doors to canvass for deals.

    I did not know any programming except for some HTML and MS-DOS tinkering I did back in secondary school. You never realized you had an insane talent for design.

    We never intended to start a software/ web consultancy, it was just to be something to be done on the side. But before long, we started having more business than we could handle. Our first app is on the way, and we are making more money than we thought possible in this industry, doing something we love.

    I can’t describe this amount of happiness and bliss that I feel now. I feel like this is what I’ve been searching for all along.

    I realize that I am actually a very simple person inside. The three things I want in life  -

    1. Not having to look at the prices in the menu when I order food.

    2. Not having to wake to an alarm clock

    3. Doing what I love, and making a good living from it.

    I am living my dream life right now, enjoying the three things above. I get to spend time with people I love. I am grateful.

    What is the point of driving a posh car and wearing a Rolex, when I had to budget for even a McDonalds meal, be at a certain place at a certain time, 7 days a week, doing something for which my heart has already died?

    At the age of 21 years old, I lost everything I had. At the age of 23, I made it back in spades and more.


  3. Game Development and Engineering

    March 12, 2012 by Gabriel

    Game development is a very broad topic that covers almost the full swath of Computer Science disciplines – graphics, audio, networking, software design, algorithms and many more. It took me quite a while to get comfortable with Objective-C, and now starting to look at things like OpenGL, OpenAL and other lower-level APIs that interface almost directly with the hardware.. they really freak me out.

    As I love physics-based games, I also had to learn to work with a physics engine (thank god I didn’t have to write one myself), Box2D, which honestly is a fantastic piece of work. Box2D is an open-source physics engine that is extremely powerful, and it powers many famous games such as Angry Birds. It’s only downside? It is written in C++, which means mixing Objective-C code together with C++ code, and the need to learn a whole new language. C++ isn’t the most newbie-friendly language around.

    Also, I find myself opening a ton of Wikipedia tabs, from the physics of acceleration, circular motion, elasticity, rate of displacement and others just so I can design my game. As a Science-Faculty student who took Physics and A Maths in JC, I’m getting my comeuppance now for flipping the bird to all my tutorials. Life works in funny ways. (Yes, Mr Stanley Ong and Miss Tan you can stop your sniggering now.)

    That being said, the journey so far has been exhilarating, and I’ve learnt so much along the way. I love the development process, and being able to render code to graphics to game is seriously gratifying.

    Angry Birds Mystery Solved

    So I was trying to implement a physics collision element similar to Angry Birds, where the birds would destroy the pigs and the blocks by smashing into them. Some way into my coding, I ran into a snag.

    I wanted my bullet to destroy the enemies, and when all the enemies are dead, the level should end. Also, the bullet should be able to destroy the blocks that the enemies are hiding behind. Sounded simple enough, but it’s actually much more complex than that.

    Solution 1:

    I could simply implement a collision model that when, bullet touches bad guy, bad guy dies. The problem is that it would make the game too hard, because it would require direct hits on all targets. Just imagine in Angry Birds, the only way for you to kill the pigs would be to hit them directly. Impossible, as some targets would be shielded behind targets and be impossible to hit.

    Very well, on to the next solution.

    Solution 2:

    The second way I thought of is to implement a collision model for the enemies. Which means if they hit the ground, a block/shield or the bullet itself, they die. Similar to Angry Birds where falling blocks, flying blocks, or even hitting the ground at high speed would be fatal. So I tried implementing this solution.

    Code, compile, run application in simulator. All my pigs burst into flames, made a loud “AWWGG” simultaneously and died. Restarted the app, same thing happened again. What the fuck was happening?

    Turns out that, because the pigs all spawn TOUCHING at least one of the blocks, ground, whatever, it registered as a hit, and they died. So, I reluctantly opened up the online Box2D user manual and started trawling through all the horrible C++ code. And I found the way -

    Solution 3:

    What I tried to do instead, was to determine the strength of a collision, and destroy an enemy based on a minimum strength, regardless of death by gravity, collision with a block or the bullet.

    To do this, I had to create a contact listener with Box2D (yeah RTFM, it helps). A contact listener is a C++ object in Box2D that registers when a fixture collides with another fixture, and it will call methods on that object to let us know when two objects begin touching and stop touching. So here goes, hope it helps anyone who is also stuck on the same problem:

    Contact Listener

    MyContactListener::MyContactListener() : contacts()
    {
    }
    
    MyContactListener::~MyContactListener()
    {
    }
    
    void MyContactListener::BeginContact(b2Contact* contact)
    {
    }
    
    void MyContactListener::EndContact(b2Contact* contact)
    {
    }
    
    void MyContactListener::PreSolve(b2Contact* contact,
                                     const b2Manifold* oldManifold)
    {
    }
    
    void MyContactListener::PostSolve(b2Contact* contact,
                                      const b2ContactImpulse* impulse)
    {
        bool isAPig = contact->GetFixtureA()->GetUserData() != NULL;
        bool isBPig = contact->GetFixtureB()->GetUserData() != NULL;
        if (isAPig || isPig)
        {
            // Check if the body should break/ get destroyed.
            int32 count = contact->GetManifold()->pointCount;
    
            float32 maxImpulse = 0.0f;
            for (int32 i = 0; i < count; ++i)
            {
                maxImpulse = b2Max(maxImpulse, impulse->normalImpulses[i]);
            }
    
            if (maxImpulse > 1.5f) // Play around with threshold for destroy
            {
    
                if (isAPig)
                    contacts.insert(contact->GetFixtureA()->GetBody());
                if (isBPig)
                    contacts.insert(contact->GetFixtureB()->GetBody());
            }
        }
    }

  4. Random iPhone Ramblings and First iOS game

    March 7, 2012 by Gabriel

    First iPhone Game!

    Created my first iPhone game, been working on it on and off the last two days in my free time. Just a silly whack a mole style game to get a feel for game development in iOS. Will churn out a few more small games of different genres over the next few days to get a feel for the framework, then I will aim to create a large/ complex game  (2 – 3 months of manhours) to publish on the app store.

    (I realize I suck at my own game.. I scored only 4/10!)

    Things Learnt at Night Class

    Learnt something useful from the Stanford University Computer Science online video classes about returning cookies to people that captures the essence of a program, which they return back to us and we evaluate.

    We could use self.programStack to return the program stack. However, that is a bad idea because of two reasons:

    1. self.programStack is internal state, and we don’t want to be handing out our internal state from objects to a public method. This is very bad because someone can use introspection, find out we’re using NSMutableArray, put things inside and blow us out of the water.

    2. The second reason is about semantics. What we want is the programStack at that moment, kind of like a snap shot. And not as things are being added on to the array.

    The above two problems can be solved with a method called copy.

    By returning [self.programStack copy];

    We return a copy, which is basically a snap shot, and people cannot muck around with it, even if they do introspection, because it is immutable. Volia!

    Basic Data Persistence in iOS

    Also been working with basic data persistence on iOS, the embedded SQLITE3 relational database and Core Data in iOS, and building a RESTful (Representational State Transfer) backend web server with object mapping for apps . Interesting stuff. My SQL / relational database skills are getting damn rusty. Maybe I’m too used to working with ORM in Rails.

    Will aim to finish all freelance client work by this weekend, so I can have the whole weekend to tinker with software and game development in iOS.

    A snippet of sqlite3 code for my iOS application.

    - (void)viewDidLoad

    {

    [super viewDidLoad];

    // Do any additional setup after loading the view, typically from a nib.

    sqlite3 *database;

    if (sqlite3_open([[self dataFilePath] UTF8String], &database) != SQLITE_OK) {

    sqlite3_close(database);

    NSAssert(0, @”Failed to open database”);

    }

    NSString *createSQL = @”CREATE TABLE IF NOT EXISTS FIELDS (ROW INTEGER PRIMARY KEY, FIELD_DATA TEXT);”;

    char *errorMsg;

    if (sqlite3_exec (database, [createSQL UTF8String], NULL, NULL, &errorMsg) !=SQLITE_OK) {

    sqlite3_close(database);

    NSAssert(0, @”Error creating table: %s”, errorMsg);

    }

    NSString *query = @”SELECT ROW, FIELD_DATA FROM FIELDS ORDER BY ROW”;

    sqlite3_stmt *statement;

    if (sqlite3_prepare_v2(database, [query UTF8String], -1, &statement, nil) == SQLITE_OK) {

    while (sqlite3_step(statement) == SQLITE_ROW) {

    int row = sqlite3_column_int(statement, 0);

    char *rowData = (char *)sqlite3_column_text(statement, 1);

    NSString *fieldName = [[NSString alloc] initWithFormat:@”field%d”, row];

    NSString *fieldValue = [[NSString alloc] initWithUTF8String:rowData];

    UITextField *field = [self valueForKey:fieldName];

    field.text = fieldValue;

    }

    sqlite3_finalize(statement);

    }

    sqlite3_close(database);


  5. The Pursuit of ‘Happyness’

    March 7, 2012 by Gabriel

    “When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down ‘happy’. They told me I didn’t understand the assignment, and I told them they didn’t understand life.”  - John Lennon

    Time flies.

    I am now 23 going onto 24 – and feeling old. I spent a large part of my youth chasing money and wealth – or at least the illusion of wealth.

    For as long as I can recall since my younger years, I have been obsessed about making money. Maybe it was because I felt I had a point to prove because I couldn’t go to university. Maybe it was because of knowing what it is like to be poor growing up, and resolving not to feel poor again. Maybe I had a chip on my shoulder, and wanted to feel respected. Whatever the reason, I spent the good part of my youth not doing things normal teenagers do like having fun, partying or socializing. I spent all my time thinking about how to make more money.

    I always felt that the only path to happiness is making lots and lots of money. Only when I was swimming in $100 bills and lived in a house that was the size of a mansion and driving a Ferrari, then I will be happy. That is why I blindly chased society’s toxification of wealth: “Wealth” is a Ferrari, chartered jets, exotic trips, $600 meals, a mansion at Sentosa Cove, and watches that cost more than some people’s entire year’s paycheck.

    Ask a hundred people what wealth means to them, and you will hear a hundred different answers. Mine was symbolized by a Ferrari, for another it may be a penthouse in the middle of town. However, I think to most, “wealth” is instinctively defined by a luxury and lavish lifestyle. Society has conditioned us to believe that wealth is an absolute construct perfected by material possessions.

    However, I see things differently now. The happiest moments in my life were when I felt true wealth. And guess what? It wasn’t the day I bought my first Rolex. It wasn’t the day I saw my first five-figured paycheck or bought a BMW. Wealth is not authored by material possessions, money or “stuff”, but our family, relationships, health and freedom. This is where we find true wealth, and happiness.

    I am grateful to have my family, and my partner, who are always there for me.

    I am grateful to be healthy. I know, a weird thing to say at such a young age. But barely half a year ago, I survived from a severe form of gastroenteritis that caused me to be bedridden and lose more than 11 kg of my body mass in a month. I would constantly think to myself as I was lying on my bed, “I would give anything to feel healthy again, all the money in my bank account, anything.”

    And finally, I am grateful to have the most simplest of human pleasures – freedom. Or choice. Freedom to live how I want to live, where and when. Freedom from bosses, alarm clocks, and the pressures of money. Freedom to passionately pursue dreams. Freedom from the drudgery of doing things I hate. The liberty to live my life as I please.

    I vividly remember the days when I was younger. I thought I was wealthy and wanted to flaunt it. Unfortunately, that fantasy was miles from the reality. Yet, I tried. I bought branded watches, designer accessories, diamond jewelry and drove a sleek black BMW Z4. I also harbored dreams of opening a bar. Until a disastrous decision interrupted my orgasmic vision. Within a month, over 90% of my “wealth” evaporated. I had to part with almost all of the above possessions.

    Ironically, in my attempt to look wealthy, real wealth slid further away. With no job, no business, no income and a small sum of money left, I couldn’t support my lifestyle anymore, nor the wealthy lifestyle I envisioned for someone rich. I wasn’t rich at all.

    In popular culture, I was a master illusionist of wealth, what people call “30K millionaires”.

    If you haven’t heard that phrase yet, it characterizes someone who maintains an image of a millionaire, yet has no net worth. These folks aren’t hard to find. We drive continental cars like BMWs, with custom chrome rims, we wear fancy designer clothes and French accessories, and congregate in the VIP section of the club ordering bottle service, of course. We act like dashing debutantes with an extraordinary A-game, but behind all the flash, we are struggling magicians of the wealth game.

    The problem with looking wealthy versus being wealthy is that the former is easy, while the latter is not. Easy credit and monthly financing options (0% downpayment!) are tempting conduits to help one purchase the illusion of wealth. Society has led us to believe that wealth can be bought at a mall or at a car dealership.

    “Faux wealth” is the illusion of wealth without having it. It believes society’s definition of wealth. It’s not realizing the pursuit of “faux wealth” does something terribly destructive: It destroys real wealth.

    As the chasm between real and faux wealth increases, misery creeps in. Like a Chinese finger cuff, the more I tried to look rich, the tighter the grip of poorness became.

    I remember the times when I was late on payments, and I would check my window every half hour, for fear that my car would no longer be there. I remember having to choose between eating dinner or pumping petrol for the 2.5l gas guzzler. My relationships grew increasingly strained as my stress reached boiling point. It was kind of a relief when the end came.

    Today, I try to live within my means. I no longer aspire to live in Sentosa Cove or to drive a Ferrari. If it happens one day, good. But if not, that’s fine too. I no longer chase material possessions, but real wealth. I believe now that happiness is a state, a journey, and not a destination. I no longer believe that I have to have a gazillion dollars before I can start living life and be happy.

    I may not be making as much as before, but I am infinitely happier. I enjoy and am constantly intellectually stimulated by my work. I pay my bills on time now. I have a loving family and partner to come home to.

    For the first time in a long time, I feel at peace, recharged, and looking forward to the future.