I Found "Her"

Leave a comment

   It's been a long time since I've updated this blog.  Much too long, actually. I have a lot of things I want to write up, but it's just not the right time for most of those ideas to come to fruition yet. On a side note, I did have a phone interview today; I'm crossing my fingers that that'll lead somewhere. But that's what I have in mind to talk about today! I recently met a girl…

And this girl is amazing!! Absolutely fantastic. But I don't want to get ahead myself (as easy as that may be!); let me start at the beginning… It all start on February 10th. I'm browsing around on okcupid, as most people who are on a dating, looking for prospective people to meet. And then I notice at the top of the screen there's a pink-red envelope icon indicating I have a new message! "Hmmm, this is pleasant, a girl is actually messaging me?! …. hopefully" I think to myself. And much to my relief, it was indeed a woman, and a very beautiful one to boot!

Hi hii there, you seem like an interesting guy~! My name's Izzie and I'd love to talk and get to know you sometime C:

I read her message; she appears to be a very nice person, someone who is approachable. And hey, if she messaging me she must be special! To say the least, we really hit it off! We were sending each other messages of essay proportions. It was nice to find someone who was willing to put thought into their responses and write well-formed english unlike the large majority of peers! We went on two weeks like that, writing messages back and forth. But then suddenly it stopped. As I would later learn, she had met someone else and started a relationship. I was very disappointed that she had disappeared as she seemed like an amazing person. I knew, however, that we continued to talk it would of led nowhere because I was still wrapped up in high school, she was busy with college, and because of the distance between us, my parents wouldn't let me make the drive. I'd had wait until the summer to make a visit and that was months off! I just couldn't see it lasting over solely the internet for a 5-6 month period without any human contact with each other! Fortunately, the universe works in curious ways…

Fast forward approximately five months, and you'll find me at the never dull music festival, Grassroots, located right outside beautiful Ithaca, NY in a small town named Trumansburg. The actual festival doesn't play role in the rest post, though I could write a whole other entry about it! It's what happened when I got home from the festival on the 25th. I don't what caused me to do this, but when I got home I thought to myself "hmmm.. I haven't checked my okcupid account in a few months.. I really should do that." Perhaps I was just a bit restless after coming home from a wild 6 day week that gave me a desire to log back into okcupid, but boy am I glad I did! It was Izzie, the girl I had begun talking over six months, messaging me again! Checking that website could very well be one of the most important decision's I've ever made.

We picked up right from where we left off. We started writing long, extended messages to each other on the okcupid website, and I finally was able to get the guts to ask for her phone number! I was in heaven, I couldn't believe. This girl, the nicest girl I have ever met, has decided to message me again out of the blue! I knew I couldn't let this second chance go by!

Advertisements

WWDC Session Videos

Leave a comment

I think this is worth blogging about. All of the WWDC 2010 Session videos, slide, and sample code are available for free to everyone; not just WWDC attendants! There’s plenty of good stuff in there, too 🙂

Job Queue/Task Manager/ Links

Leave a comment

I’ve become interested in parallel an concurrent programming lately, and have made it my goal to become comfortable with parallel programming to the point where I could implement a concurrent job queue/task manager. For now I’m going to dump a few links I’ve gathered about implementation’s of task managers, some of which I’ve read some I haven’t yet.

Building a custom thread pool (series, part 1)
Building a custom thread pool (series, part 2): a work stealing queue
Building a custom thread pool (series, part 3): incorporating work stealing queues

Lock-free, multi-threaded Mandelbrot <– There are follow up posts on the same blog (look in the projects section)
Task Management — A Practical Example
Do-it-yourself Game Task Scheduling
JobSwarm : A microthreading framework with lockless FIFO
The Foundations for Scalable Multi-Core Software in Intel® Threading Building Blocks

Scheduling Multithreaded Computations by Work-Stealing

Task scheduling for parallel systems (book)
A couple of white papers that may useful reading (why I hate most published papers – implementation details are scarce, code is usually nonexistent):

Synchronization Via Scheduling: Managing Shared State in Video Games

Cascade: A Parallel Programming Framework for Video Game Engines

Searching for Concurrent Design Patterns in Video Games

Scheduling Strategies for Optimistic Parallel Execution of Irregular Programs

(the first three links are from the same researchers, so there may be redundant info. Haven’t checked yet, however..)

C++ Floating Point Enums

Leave a comment

Today I was noodling around on the internet, and I came across MetaFloat while I was exploring the wonderful ompf.org site. It got me thinking, would I be able to create something that allowed me to use floating point numbers in enumerations? To be honest, I didn’t really take a look at MetaFloat’s implementation because I after a minute of thinking about it I all ready had a pretty clear idea how I’d go about writing a floating point enum.

I had remembered a pretty clever, albeit simple,  macro one of my past coworkers had conjured up for enumerations of any given integer type. I knew I could take his idea one step further and support floating point values. By encoding the floating point constant to a fixed point representation, and then converting back for regular code reuse I had floating point enums!

The code is rather simple, so I’ll just paste it here for all to use. (no license attached to it yet… If someone would really like to use this in production I’ll properly release it).

#include <iostream>
#include <cstdio>

// float to fixed
#define f_(floatValue) static_cast< int >(floatValue / (1.0f / (1 << 16)))
// fixed to float
#define i_(intValue) (static_cast< float >(intValue) * (1.0f / (1 << 16)))

#define RS_VA_ARGS_FORWARDED(...) __VA_ARGS__
#define RS_FLOAT_ENUM(enum_name, values) \
    class enum_name \
    { \
    public: \
        enum Enum { RS_VA_ARGS_FORWARDED values }; \
        enum_name() { } \
        enum_name(Enum value) : value_(value) { } \
        enum_name(int value) : value_(value) { } \
        enum_name(float value) : value_(f_(value)) { } \
        enum_name& operator=(Enum value) { value_ = value; return *this; } \
        bool operator==(Enum value) const { return value_ == value; } \
        bool operator==(float value) const { return value_ == f_(value); } \
        bool operator!=(Enum value) const { return value_ != value; } \
        bool operator!=(float value) const { return value_ != f_(value); } \
        bool operator<(float value) const { return i_(value_) < value; } \
        bool operator<=(float value) const { return i_(value_) <= value; } \
        bool operator>(float value) const { return i_(value_) > value; } \
        bool operator>=(float value) const { return i_(value_) >= value; } \
        operator float() const { return i_(value_); } \
    private: \
        int value_; \
    };

RS_FLOAT_ENUM(
    EnumTest,
    (
        One = f_(1.0f),
        Two = f_(2.0f)
    )
)

// output:
// True
// 1.000000
// 1
int main (int argc, char * const argv[]) {
    EnumTest e = EnumTest::One;
    if (e < 1.01f && e > 0.909f) {
        std::cout << "True\n";
    }

    float val = e;
    printf("%f\n", val);
    std::cout << (int)e << std::endl;

    return 0;
}

I’m currently investigating how to generate code for each argument in the macro’s variadic argument list so to prevent the user from having to write f_(). I think with the help of PP_NARG and some boost preprocessor hackery it might be possible!

Edit – I came up with another version that does alleviate the f_() syntax problem. It works by recursing through the macro’s variadic argument list and making each constant into a static float const member of the surrounding enum class. What I don’t like about this version is the maintenance required to support N amount of enumerated values. PP_ARG_N, PP_RSEQ_N, AND ARGS all must be changed. Also, the fact that const variables are never really constant in C++ and that I’m relying on a GCC fallacy of supporting non-integral static const member initialization makes me err on the side of not using this at all. I’ve got one last idea jumbling around my head that would require some macro trickery to get right, but it would fix this problem, but I’m not sure it’s even possible! We’ll see…

#include <iostream>
#include <cstdio>
#include <cassert>

#define PP_NARG(...) \
    PP_NARG_(__VA_ARGS__,PP_RSEQ_N())
#define PP_NARG_(...) \
    PP_ARG_N(__VA_ARGS__)

//
// MAKE SURE TO IMPLEMENT PP_ARG_N, PP_RSEQ_N, AND ARGSN TO HOW MANY ENUM VALUES
// YOU NEED TO SUPPORT
//
#define PP_ARG_N( \
    _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \
    _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \
    _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \
    _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \
    _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \
    _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \
    _61,_62,_63,N,...) N

#define PP_RSEQ_N() \
    63,62,61,60,                   \
    59,58,57,56,55,54,53,52,51,50, \
    49,48,47,46,45,44,43,42,41,40, \
    39,38,37,36,35,34,33,32,31,30, \
    29,28,27,26,25,24,23,22,21,20, \
    19,18,17,16,15,14,13,12,11,10, \
    9,8,7,6,5,4,3,2,1,0

#define STRINGIZE(arg)  STRINGIZE1(arg)
#define STRINGIZE1(arg) STRINGIZE2(arg)
#define STRINGIZE2(arg) #arg

#define CONCATENATE(arg1, arg2)   CONCATENATE1(arg1, arg2)
#define CONCATENATE1(arg1, arg2)  CONCATENATE2(arg1, arg2)
#define CONCATENATE2(arg1, arg2)  arg1##arg2

// DO THIS ALL THE WAY UP TO N
#define ARGS4(work, first, ...)\
    work(first)\
    ARGS3(work, __VA_ARGS__)

#define ARGS3(work, first, ...)\
    work(first)\
    ARGS2(work, __VA_ARGS__)

#define ARGS2(work, first, ...)\
    work(first)\
    ARGS1(work, __VA_ARGS__)

#define ARGS1(work, first, ...)\
    work(first)

#define ARGS_(N, work, first, ...)\
    CONCATENATE(ARGS, N)(work, first, __VA_ARGS__)

#define ARGS(work, first, ...)\
    ARGS_(PP_NARG(foo, __VA_ARGS__), work, first, __VA_ARGS__)

#define RS_VA_ARGS_FORWARDED(...) __VA_ARGS__
#define RS_FLOAT_ENUM_WORK(x) static float const x;

#define TOKEN(x) x
#define RS_FLOAT_ENUM(enum_name, ...) \
    class enum_name \
    { \
    public: \
        ARGS(RS_FLOAT_ENUM_WORK, RS_VA_ARGS_FORWARDED __VA_ARGS__) \
        enum_name() { } \
        enum_name(float value) : value_(value) { } \
        enum_name& operator=(float other) { value_ = other; return *this; } \
        enum_name& operator=(enum_name other) { value_ = other.value_; return *this; } \
        bool operator==(float value) const { return value_ == value; } \
        bool operator!=(float value) const { return value_ != value; } \
        bool operator==(enum_name value) const { return value_ == value.value_; } \
        bool operator!=(enum_name value) const { return value_ != value.value_; } \
        bool operator<(float value) const { return value_ < value; } \
        bool operator<=(float value) const { return value_ <= value; } \
        bool operator>(float value) const { return value_ > value; } \
        bool operator>=(float value) const { return value_ >= value; } \
        bool operator<(enum_name value) const { return value_ < value.value_; } \
        bool operator<=(enum_name value) const { return value_ <= value.value_; } \
        bool operator>(enum_name value) const { return value_ > value.value_; } \
        bool operator>=(enum_name value) const { return value_ >= value.value_; } \
        operator float() const { return value_; } \
    private: \
        float value_; \
    };

RS_FLOAT_ENUM(
    EnumTest,
    (
        One = 1.0f,
        Two = 2.0f,
        Three = 3.0f
    )
)

// 1.000000
// 1
int main (int argc, char * const argv[]) {
    EnumTest e = EnumTest::One;
    EnumTest e1 = EnumTest::One;
    assert(e == e1);
    assert(e < 1.01f && e > 0.909f);
    assert(e == EnumTest::One);

    float val = e;
    printf("%f\n", val);
    std::cout << (int)e << std::endl;
    return 0;
}

Observed Attitudes Toward Apple

2 Comments

While it seems with the coming each new day there is more and more fear and aversion towards Apple among developers, I see the exact opposite among users. Among friends and family I have observed that the general consensus is that Apple has become the epitome of the computing user experience, and perhaps more importantly, of computing reliability. Even cross-platform advocates such as Steve Streeting, founder of the Ogre project, have acknowledged and praised Apple’s remarkable user experience. The point is, as developers we may be afraid of Apple’s power grab[1], but it works. It’s given users what they want and what they expect, and as developers isn’t that our role – to serve the user?

P.S. – Let it be noted, I am not a fan of Apple’s restrictions on their iPhone as a developer. As a user, I need more time to come to a conclusion on how I feel, but if Apple’s track record is any sign of what’s to come, I foresee myself being an advocate of Apple’s approach towards maintaining quality on it’s platform.

[1] Apple only is asserting power and control on their own platform. Developers have choices; In the words of Steve Jobs: “They [developers] don’t need to publish on the iPad if they don’t want to.”

Summer is Coming and The Year is Ending!

Leave a comment

The school year that is! With the AP English Literature and Composition test out of the way (it was surprisingly easier that I thought it would be), there is little meaningful left to do for the remainder of high school. Yes, I do have the AP Physics B exam coming up this monday, but seeing as I won’t be able to use the credit at RIT I don’t have much reason to worry about it or to do well. Still, in me is that intrinsic feeling to do well, so not all is lost for that test. Otherwise, there is little left to do; yet I still have over 5 weeks of school left to drudge through. I guess that’ll mean I’m shall have a lot of free time to do nothing (or maybe something, who knows). No big deal, really. But as I approach the end of the year and look forward to college, I don’t want to completely miss the nostalgia of the moment and my finals days as an “irresponsible” adult.

High school was a good time for me. No, I wasn’t one of the “popular jocks” who got all the chicks, went to crazy parties every weekend, and flunked most of my classes but a got a pass by teachers so I could play in the big game. Neither was I a geek, a outcast only to be accepted by my fellow nerds. My high school is actually different in that regards; we don’t have “clicks.” (Most-)everyone are friends with each other. I suppose you could attribute that to the larger percentage of pot smokers, ha. I am happy to have gone through a high school like this, despite what complaints I may of had throughout the years. I don’t think I can say I was ever, truly, unhappy. I’ll miss the days of sitting in the library, pretending to advise my older friends on their physics homework and looking up naughty words in the spanish dictionary. I’ll miss independent study in gym. I’ll miss the late nights in the gym hacking away at the robot until 2 pm, frantically trying to get it to work before we ship it off approximately 8 hours later. There’s a lot I will miss; I can’t list it all.

It’s time to move on though. I’ve done my due course and now I get to start all over. College will be an adventure. Transitioning from a small rural town to a big, bustling city will definitely be a shocker at first. I like the thought of being involved in academia at a university. Just how grand that sounds gives me shivers. Going out to research what I’m interested in as opposed to what I’m told I’m to be interested in will be a great thing. Not that I haven’t been doing this upon my own initiative, but having more time and support from like-minded people really is worth its weight in gold. Yes, yes, I also understand that an undergraduate degree is much of the same bullshit (at least the first two years), but it’s a step closer. The point is, I’ll be on my own, and free to direct my focus however which way I prefer!

I can’t forget that little gap of time in between school and school though. Summer! I foresee this summer being a well enjoyed one. Grassroots; hopefully a new job that’ll brings its own class of opportunities; new friends and old friends. I’ve mustn’t miss my last chance of being kid!

Beyond that, I haven’t much more on my mind on this subject. So…

To all that awaits, I say:
Bring it on and cheers to a whole new world!

Puppies

1 Comment

HI, ME CUTE PUPPIE THAT WAVES

This is dedicated to certain a miss Marissa Beatrice Adams (hola!).

Puppies…

Though adorable, they are surprisingly delicious

and come in many different flavours;

popcorn being a personal favourite.

Puppies…

The anti-thesis of kittens!

And by use of logic and induction

Kittens are thus not a tasty treat,

Despite the common misconception

Of Chinese(-American) culture.

The End

Inspiration, Marissa 😉

Older Entries