Wednesday, March 18, 2009

TED Talk - Why we should play

If you are stuck up or just need an excuse to play around watch this video:


Maybe I should show this video to my boss when he looks at me funny for doing cart wheels or skipping down the hall. But it is sure fun :). I know you can't play / goof off all of the time but I find that people are way too damn serious all the time. It is like most people think they should be conservative and not goof off once they leave high school and/or college give me a break. Especially in this day and age we should all laugh at stuff and goof off. Ok enough of my personal philosophy :).

Back to work..

Labels: , ,

Wednesday, April 30, 2008

Cool Little Code Snippet...

At my work an email sometimes gets sent out asking us to spot the defect.  I like these emails as it is usually with code / bugs that I have no f'ing experience and I can learn something that is a nice little trick.  So enough rambling here is some code that basically has the same bug.


Note: This is a technical post so if you don't care about this geeky crap just stop reading now :).


Disclaimer: I wrote the below code in blogger so it might not compile but the part that is interesting is technically correct.



<codesnippet>  

#include
using namespace std;
int main() {
char * c;
char * junkVar;
  const char * f00;
  junkVar = new char('a');
  f00 = junkVar + 1; 
  c = junkVar + 2;
  if(foo - c >= sizeof(int)) {
    cout << "inside of if-statement" << endl;
  } else {
    cout << "hit else statement instead" << endl;  
}
  return 0;
}

</codesnippet>

So, where is the bug?  How will this code execute if it was ran?  If you look at the code you will notice that "foo - c" should have a difference of -1 since "c" is one higher than "foo".  However, sizeof returns an unsigned integer and the compiler will cast the subtraction operation to an unsigned value as well.  What does that mean?  It means -1 becomes FFFFFFFF which is way bigger than "sizeof(int)" and the if condition would be correct.  Pretty cool, eh?  How would you fix this?  Well just cast the return value of sizeof to something signed like say..int.


There are a few security implications of this code.  Mainly if you could make this happen the pre-conditions of the code executed in the if-statement might not be correct and all sorts of weird issues could crop up.


Alright, back to work...


Labels: , ,

Thursday, January 31, 2008

Why Starbucks Loses in My Book

Why does Starbucks lose? It isn't because they don't make as good of coffee or that they have sanitized out the whole coffee house experience. If it isn't for any of the reasons why do they lose? Well I am going to show you...


and

Now how cool is that? The barista at my favorite coffee haunt did these when my girl and I went in earlier this week. I have never seen this before and I thought I would share it. We didn't see anyone else at the coffee shop with these, although I doubt we are the first people to ever receive something like this. However, it is times like these that even though this place is a bit expensive it seems worth it.

There is a good marketing message in this. It is something other well known people have said time and time again. Which is make your customers feel special/unique (at least part of the time) and the experience of where you go does matter. So, if you are in business keep that in mind? How can you draw a face in your customers coffee cup so they will feel special?

Labels: , ,