Tuesday, July 27, 2010

Wow... Scotch and Chocolate?

  I can't imagine what this tastes like...
  http://perks.urbandaddy.com/national/bonbonbar.html

Friday, July 16, 2010

Learn one real concept a day will make you smarter than yesterday.

    This is really a specific thing I'm writing about here, not the idea behind the title above. Get ready, this is a real C++ treat, so Faith and anyone else who doesn't understand this stuff, stop here.

    Straight out of Effective STL (Scott Meyers) comes a tip that I and most of you out there already know... its pretty obvious:
        Remember to delete the pointers you put into any container.
        Example:
  std::vector vOfMarketableOrders;
  // ... fill with a bunch orders you will use right here and right now, dynamically allocated
  // done
  And Mr. Meyers goes on to describe a nice templated function within a struct called DeleteObject, which will be used in conjunction with for_each to delete everything afterwords. I'd say this is pretty obvious to most C++ programmers who actually have a job with C++, so here's the kicker:

  Never create a container of auto_ptrs.

  Basically, auto_ptrs are a wrapper for pointers which aims "transfer ownership" of pointers between auto_ptrs. So if you use a list, vector, map of auto_ptrs, you could easily lose the address of some dynamically acquired memory with the use of an algorithm. One particular algorithm he brings up is quicksort, which uses a pivot element to sort, which is a temporary copy within the quicksort implementation. So, due to the destructive nature of an auto_ptr, you will lose the memory address somewhere with this.

Thursday, July 15, 2010

Bond 23... Never say never?

   I'm a big fan of the James Bond stuff. It's not a much of a secret about me, but it's also not like I buy double plated 007 cuff links, however I'm deeply saddened that there are many reports that Bond 23 (http://www.imdb.com/title/tt1074638/) will never surface (http://www.imdb.com/title/tt1074638/news?start=21). It was due out this year or next year. It was then delayed to 2014 (If we ever get there) ! Now it seems MGM (http://www.mgm.com/, not to be confused with MGM Resorts), the company behind the movies is in some deep financial turmoil and will never post this movie.

Thursday, July 8, 2010

Little did you know about Multiple Inheritance and Virtual Pointers in C++

This is a geeky nerdy post.


   First of all, kudos to Mr. asadullah.ansari for posting this far reaching demonstration of the virtual pointer and how it works in C++. In fact it such a good way to demo the vptr and vtable, I had to post it here too.


  Hint for most of us out there unfamilar with the following:
    
typedef void (*Fun)(void);


  This is a typedef which means, Fun is a pointer to a function whose return type is void and takes in no arguments.


  i.e.
     void FooBarFunc( ) { std::cout << "Row faster!!!" << std::endl;  return; }
     void (*PointerToFunctionVariable)(void) = FooBarFunc;
     std::cout << "We're going white water rafting..." << std::endl;
     PointerToFunctionVariable();


   output:
        We're going white water rafting...
        Row faster!!!


http://www.dreamincode.net/forums/topic/45816-detail-about-how-vptr-and-virtual-table-works/


  Keep in mind, example 11 is the best. It demonstrates that with Multiple Inheritance brings multiple vptrs to separate vtables.

Wednesday, July 7, 2010

My own personal Thanksgiving.

   Twenty Five on the Seventh of the Seventh, Twenty Ten. Turning 25 five means nothing to me.

   In fact, 25 years old and counting means so nothing to me, I'm going to write a blog entry about it. Despite the fact that the degree to which my English writing skills have deteriorated is exactly inverse to my c++ and python skills have refined... I'm going to try to write something meaningful here, hoping to put a little save a little sunshine into my life backpack for darker days ahead.

   I enjoy a really great life. I have both my parents to thank for that. In fact, if it wasn't for how great my Mom and Dad are... there would be no blog entry at all. Thanks to them I'm educated and healthy. Part of my core motivation for writing this is hoping that people who read this try to imagine what I see. I'm addressing all of you, my friends, former friends, acquaintances, and strangers.

  I want all of you to stop and think... we've been through many milestones together and apart. All these milestones have been celebrated more or less the same with music and consumables. Each of these milestones could have not existed if it wasn't for health. It's the single most important asset anyone has and it is to be protected at all costs. Anyone who intentionally or unintentionally hurts your health, either physically or mentally, is your enemy and should be considered dangerous; this may even include yourself and close friends and family. In my eyes, there are no exceptions.
  So I'm thankful to my parents for my health today, they've taken good care of me by providing excellent food throughout my life and encouraging a healthy lifestyle which focuses on being responsible with money and education.

  I'm also very thankful for my education. I realize that without, I wouldn't have the opportunity to try more advanced things in life.

  But most importantly, I've very thankful to them for they're courage and successful efforts at providing me something that only a lucky few have, a stable and health household which included two loving parents who loved and cared for me without exception.
  I've done some stupid and insane things in the last five years, which has put them through some crazy and insane stress, but not once have I ever heard them castrate me by calling me stupid or dumb. They've never put my down for my failed attempts at whatever it might have been, instead they supported me and bailed me out. Those bailouts provided me security to go and try more stupid and insane things... but I've calmed down a lot.
   They never gave me flak for not getting the best grades.
   They've never ridiculed me for the deceitful tattooed girls I've dated.
   They've never shown me the door because I smelled of vodka, although it was threaten.
   They've never told me go stick my head in the sand somewhere because I crashed a car... again; they even PAID for my speeding tickets.
   They never criticized me for wasting their money on plenty of things I minimally or never used even though they knew I was just over excited or something for nothing. 
   They even got me another laptop when it was stolen in high school, despite their warnings. 
   They didn't even say a word when I invited a ex-girlfriend/friend/girl from Pennsylvania to stay in our guest room for 8 months.

  Some might call this spoilage and honestly it's only spoilage to those whose parents aren't as capable of providing level of love and care to their children. It's not spoilage because I never once blatantly claimed these things as a right to have, I've always acknowledge these items as gifts and privileges; so I like to think I repaid them by being responsible, rational, respectful and successful in return.
  

Thursday, July 1, 2010

A barber shop shave everyday...

  I've always wanted a hot lather machine, or at least wanted to get one as a gift for my Dad. I've had this idea for over a year now and never approached it. Instead I bought two electric razors which I'll comment on later.

  After reviewing a few products on Amazon.com, I've got this summary:

At under $10 we have the gimmick HGL1 which has some really bad reviews:
Cheap: Conair HGL1

This one under $10 as well gets slightly better reviews: (HGL11)
Probably a gimmick: HGL11

Then we jump up to $80-$100:
Not a gimmick: Conair HLM10
Not a gimmick: Conair HLM11
These two get the best reviews but at nine to ten times the price.

Then theres the king... at almost $250
Actual Lather King Machine


I'll most likely go with the HLM10 because it seems like a product that will perform for what you paid.
Conair HLM10