Archive for July, 2007

Bjarne Stroustrup at Google NY, July 31st 2007

Tuesday, 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.

Bible should come with a disclaimer

Tuesday, July 31st, 2007

Mirroring a post that I saw today at digg.com…

Absolutely true, it should come with that big sticker on the front.

Nueva franela Ubuntu

Tuesday, July 31st, 2007

Acaba de llegar mi nueva franela con el logo de Ubuntu. Puedes hacer franelas como estas en spreadshirt.com

Greenpoint, paradise for both Polish and Venezuelan

Sunday, July 29th, 2007

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

Saturday, July 28th, 2007

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

Friday, July 27th, 2007
...
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)

Joost T-Shirt

Friday, July 27th, 2007

Today my precious wife gave me this cool Joost T-Shirt. Neat.

What’s Happening in New York with Tech Companies?

Sunday, July 22nd, 2007

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.

    The Mysterious Trailer of J.J. Abrams. Monster Movie? 1-18-08 (at MyBloop.com)

    Friday, July 20th, 2007

    MyBloop.com – Upload unlimited files for free

    Now that I see the trailer, I remember seeing the “Bad Robot” thingie at the beginning, and thinking… hmm, isn’t that the production company of Lost? and indeed it is.

    Thanks again to RoRRO, Sebastian and JM.

    You can get this trailer from Apple at a higher definition here on Quicktime Format

    Upcoming Movies where New York gets Destroyed

    Thursday, July 19th, 2007

    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.




  • Categories

  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • February 2014
  • January 2014
  • December 2013
  • November 2013
  • October 2013
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • October 2009
  • September 2009
  • July 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2007
  • March 2007
  • February 2007
  • January 2007
  • December 2006
  • November 2006
  • October 2006
  • September 2006
  • August 2006
  • July 2006
  • June 2006
  • May 2006
  • April 2006
  • March 2006
  • February 2006
  • January 2006
  • December 2005
  • November 2005
  • October 2005
  • September 2005
  • August 2005
  • July 2005
  • June 2005
  • May 2005
  • April 2005
  • March 2005
  • February 2005
  • January 2005
  • December 2004
  • November 2004
  • October 2004