Bjarne Stroustrup at Google NY, July 31st 2007

Tonight, July 31st of 2007 I had the privilege of attending a talk by the man himself, the creator of the C++ language, Bjarne Stroustrup.

He was sharing with us how things are going for the next version of C++0x – The 0x stands for a possible year of this decade where it will be released.

One of the interesting things that happened to me at this meeting was to finally have the honor of meeting Sebastian Delmont, and oh, those 3 geeky Red Hat guys, wonder if they were actually part of Red Hat or just hardcore fans, good thing I was wearing my Ubuntu shirt to represent for the Ubunteros.

As for C++0x, I guess my thoughts aren’t that deep, I honestly don’t care much about C++ at this point in my life, and it seems it’s an old language striving hard to keep the pace with newer features found in new languages. It seems its very hard to reach consensus on the C++ board, and its very hard to accept new features given the language is already too big, its also funny to see that everything that gets hughe (millions of people use it), will always have problems in terms of adapting to new conditions or injecting innovation to itself. Bjarne created the language around 25 years ago, and there are features that only now he’s finally been able to get accepted for this version. C++ however, we must admit is a language that’s heavily used, (but I think by end users, not the software engineering community), on software like Photoshop, Google search engine, and the Mars rovers (these were the examples Bjarnes kept bringing again and again, I would also be proud of course).

For me, I’ll stick to Python, Nasa’s been using it too for quite a while, the same with Google and many other applications, hey, YouTube’s backend runs in python.

Greenpoint, paradise for both Polish and Venezuelan

When we moved out of our ghetto latin neighborhood, my wife told me “You’re going to miss the food”, but today, I discovered one supermarket in Manhattan Ave. here in Greenpoint which has the best of both worlds.

Not only they have all the polish stuff that you can get in this neighborhood (which makes my wife’s life a lot better), but they also have latin food and best of all they have Harina Pan, to make the best arepas a Venezuelan guy could eat.

If you’re a Venezuelan and you’re planning to marry a polish person, get your ass to Greenpoint in Brooklyn, NY.

Python Reference: Binary Operators

Python binary operators are pretty much the same as in any other language, however I notice most programmers tend to waste a lot of memory by creating lots and lots of properties say in DB tables, or Objects and using the wrong datatypes. I think its elegant to use the concept of binary flags, for example, if you have an object that has around 8 or 16 boolean properties, you can store their state in 1 byte or 2 bytes (1 char or 2 char fields), and turn on/off the bits on those fields.

Usually, if you have a binary field, and you want to, turn on bits, toggle bits, and check bits, you do the following.

Suppose “config” is an 8 bit number, and you want to modify this bits individually, say config=4 (0b100) and you want to turn on the rightmost bit to have 0b101 (which is a 5) you could do the following

>>> #Uses the | operator
... def turnBitOn(config, binaryFlag):
...   return config | binaryFlag
... 
>>> config = 4
>>> config = turnBitOn(config,1)
>>> print config
5

If you want to check if a Bit is turned on, just use the “&” operator, if the result is the same as the bit you’re comparing, then its turned on.

>>> def checkBit(config,binaryFlag):
...   return binaryFlag == config & binaryFlag
... 
>>> print checkBit(config,1)
True
>>> print checkBit(config,2) #checks 0b010 in 0b101
False

What if you just want to toggle a bit, no matter what’s in there?
Just use binary XOR, the “^” operator.

>>> def toggleBit(config,binaryFlag):
...   return config ^ binaryFlag
... 
>>> print config
5
>>> config = toggleBit(config,1)
>>> print config
4
>>> config = toggleBit(config,1)
>>> print config
5

And now, the last basic operation would be to turn off a bit. For this, you should do a NAND operation. The Binary Not in python as in most programming languages is the “~” operator. This is how you can use it to turn off bits.

You have to do it in conjunction with the & operator, sort of doing a NAND

>>> 5 & (~1)
4
>>> 5 &~ 1
4

So we could define our turnOffBit function as follows:

>>> def turnOffBit(config,binaryFlag):
...   return config & (~binaryFlag)
... 
>>> print config
5
>>> config = turnOffBit(config,1)
>>> print config
4
>>> config = turnOffBit(config,1)
>>> print config
4

Hope this makes a good reference for those trying to make the most out of their bytes.

Python: How to debug HTTP while using urllib2

...
import urllib
import urllib2


#this is just to prepare a dynamic uri (this is actual code from a system I'm building, sorry)
fileDownloadServiceURL = '%s://%s:%s/%s' % (transport,server,port,pathToController)
postData = {'URI':fileUri} #add more post stuff here
postData = urllib.urlencode(postData) #make sure you encode your post data

#add some custom headers if you need them
headers={"Host": server+':'+port,"Cookie":"JSESSIONID="+sessionId,"User-Agent":"Name of your User-Agent Here"}

#prepare your request, with headers and post data
req = urllib2.Request(fileDownloadServiceURL,postData,headers)


#and this is the magic. Create a HTTPHandler object and put its debug level to 1
httpHandler = urllib2.HTTPHandler()
httpHandler.set_http_debuglevel(1)
        
#Instead of using urllib2.urlopen, create an opener, and pass the HTTPHandler
#and any other handlers... to it.
opener = urllib2.build_opener(httpHandler)

#User your opener to open the Request.
urlHandle = opener.open(req)
 
#you'll end up with a file-like object... which I called urlHandle
...

The ouput will have useful debugging info about the HTTP connection.

connect: (localhost, 8080)
send: u'POST /arcturus-web/fileVariableDownload.service HTTP/1.1rnAccept-Encoding: identityrnContent-Length: 57rnConnection: closernUser-Agent: Temboo Twyla/Arcturus HTTP DownloaderrnHost: localhost:8080rnCookie: JSESSIONID=1b8xl8nozb2irnContent-Type: application/x-www-form-urlencodedrnrn'
send: 'URI=temboo%3A%2F%2Fwww.one.com%2Ffiles.f%2Fmapping1.m.var'
reply: 'HTTP/1.1 200 OKrn'
header: Content-Language: en-US
header: Content-Type: text/html; charset=ISO-8859-1
header: Connection: close
header: Server: Jetty(6.0.2)

What’s Happening in New York with Tech Companies?

I think a lot is happening, and I’d like to point out some people that have finally started writing about all the tech activity of the “Sillicon Alley”, and most important, organizing meet ups and events that can help us network and get the word out there of whatever it is that we’re doing here.

If you’re about to make a release of your new tech product and you’re in the New York City area, maybe you should bump your elbow to these sites:

  • Next NY

    A fun way to connect both socially and professionally with young people who have a stake in future of tech and new media in New York City

  • AlleyInsider.com

    We cover the intersection of the technology, media, and communications industries, with a focus on companies and people making waves in New York. Specifically, we provide news, commentary, and discussion about digital publishing, entertainment, news, music, social networking, mobile, and gaming.

  • NY Tech Meetup

    On the 1st Tuesday each month at 7PM, 6 people get 5 minutes each to demo something cool to New York’s tech community (geeks, investors, entrepreneurs, hackers, etc)

  • That’s it for my list now, please comment to contribute more links and I’ll update with your links.

    Upcoming Movies where New York gets Destroyed

    I AM LEGEND


    Click here for QuickTime Trailer

    Or what I’d call, the Last Man Standing. I saw this trailer in the movie theater last night and really felt like going to see this movie. Being a New York resident its always impressive to see the city you live getting destroyed or changed so much after something that seems world war three or some kind of mankind elimination, specially when the trailer tells you something you often joke about with friends, which is “What would you do if you were the last man on earth?” (I like to put it more if it was me being the last man on earth with other 10 women and it was up to me to populate the earth)

    If you don’t have quicktime, just hit play below to see it right here:

    The misterious trailer right before transformers

    But then I saw another trailer, which I could not get the name of the movie. It was shot with a home video camera, people were at an apartment somewhere in Broadway (Manhattan), they were basically like saying goodbye to a guy that was going to leave to Japan, and if I remember correctly, the lights go out, it feels like an earthquake, the camera goes to the window (it’s night time), and then there’w a HUGHE explosion coming from South Manhattan, people start running out of the apartment, sound goes in and out (the sound gets a lot better in the theater at this point If I remember correctly), then they go out the street, and swarms of people are running from south broadway, and you can see like a bunch of balls of fire falling everywhere, the camera runs, its really scary (I couldn’t help to think how scary it’d be if we were at war, the trailer with that camera made it feel more real), and then a Big metal piece, like the size of car falls on broadway, the camera turns, its the head of the statue of liberty, then I was so amazed I couldn’t tell the name of the movie, but a friend told me they didn’t put it, if somebody knows, please let me know what the name is.

    UPDATE

    So this is why the internet is beautiful, yesterday at lunch I told my friends about this trailer, and they were like, ah sure, whatever, but with the internet you get geeks like you that get excited about these really cool things, that in the end will make billions of dollars (like for example, the same thing happened to me the first time I read about The Matrix and nobody gave a shit when I told them about it, and now its a classic trilogy), so maybe this will be one of those things.

    Thanks to RoRRO, Sebastian and JM for the info. They tell us this misterious trailer is an unwrapped project by J.J. Abrams, people have begun to take their cellphones to record the trailer on the movie theather, and all we have is this misterious website.