Translate

Archive for April, 2009

Swine Flu FML

Monday, April 27th, 2009

Today, I took my kid to a pig farm near Mexico City, I think I let him get a little too close to the animals, FML

But more seriously, leave a comment if you think the whole Swine Flu is total BS to keep once again the world in fear and have them worry about stuff that doesn’t really matter.

Just check the price of oil today (dropping), and the prices of small pharmaceutical companies on the stock market (some doubling today)

World Domination BS… don’t fall for it.

Who benefits from Swine Flu

  • The US tourism industry by keeping millions of dollars from going to mexico. Just one airplane going to Cancun from say Florida, will take about 300 passengers. In average each passenger will spend at least about $1,000. That’s $300k a pop. I’d imagine there’s at least 10 flights a day going to Cancun from several destinations in the US. That’s $3MM that stay in the US or go somewhere else. Now multiply this by the number of touristic destinations in Mexico plus flights that come from other countries. Their economy must be bleeding tens of millions a day because of this.
  • Companies that use pork derived products, now they can get pork for a lot cheaper. Think McDonalds, Wendy’s, Burguer King, Super market chains. Buy low, sell high
  • 3M has had to step up their mask production to keep up with the demand coming from CVS, Walgreens, Rite Aid, etc.
  • Pharmaceutical companies related to vaccine R&D

In the meantime, I see nothing but a pattern of destructive media against mexico, first it was the Drug lord wars, then Swine Flu, and more recently an Earth Quake (I totally believe the US must have weapons to produce earthquakes, it’s the perfect attack, you can blame it on mother nature)

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Festo – Bionic Penguins, Air Penguins, Bionic Tripods, Fin Ray, Interactive Wall, 3d printing, Molecubes,

Monday, April 20th, 2009

The Festo Bionic Learning Network.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Legalization: Yes We Can

Monday, April 20th, 2009

Repost if you can. This ad is the first TV Ad ever to be run nationwide in Pro of Marijuana legalization. It started today, 4/20 “four twenty” a date that matches the pot-iconic number. It’s time it’s legalized, it’s not like they’re not smoking, you might as well tax it, create jobs, export it and explode a billion dollar industry. If America does it, the rest of the world will follow, and damn it, it’ll be cool as hell.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

How to make a Quick & Dirty HexViewer – Updated

Monday, April 20th, 2009

After I received comments from ispak on Flickr I made a few fixes.

ispak pointed out that it was a bad idea reading one byte at the time, also I had a gay ass try/catch that didn’t catch any exception :p

So now I read 16 byte chunks, and I also take care of the file ending. The previous version used to print the file ending with a bunch of null bytes. Now it stops reading at the end, and formats the output accordingly.

Here’s the new source:

//HexViewer.java
import java.io.*;

public final class HexViewer {
    public final static void printFile(String filePath) {
        try {
            File f = new File(filePath);
            BufferedInputStream bis =
                new BufferedInputStream(new FileInputStream(f));

            byte[] chunk = null;
            int readStatus = 0;
            while (true) {
                chunk = new byte[16];
                readStatus = bis.read(chunk, 0, 16);
                char[] line = new char[16];

                if (readStatus == -1)
                    break;

                for (byte i=0; i < readStatus; i++) {
                    int readByte = (chunk[i] < 0) ? (-1 * (int) chunk[i]) : chunk[i];
                    String paddingZero = (readByte < 16) ? "0" : "";
                    System.out.print(paddingZero + Integer.toHexString(readByte).toUpperCase() + " ");
                    line[i] = (readByte >= 33 && readByte <= 126) ? (char) readByte : '.';
                }

                //We add some padding to print the text line right below the one above.
                String padding = new String();
                if (readStatus < 16) {
                    for (byte i=0; i < 16-readStatus; i++) {
                        padding += "   ";
                    }
                }

                System.out.println(padding + new String(line));
            }
        } catch (Exception e1) { e1.printStackTrace(); }
    }

    public final static void main(String[] args) {
        if (args.length == 0)
            return;

        printFile(args[0]);
    }
}

HexViewer - r2

And see how it now handles file endings when the file size is not a multiple of 16 :p

Picture 2

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Things I found to be different in London

Saturday, April 18th, 2009

I had the opportunity to break away from work for a week and visit one of the most important cities on my I-Have-To-Go-Here list, London.

I found many similarities between London life and New York life, but as I went outside every day I tried to put together a small list of things that I found curious from the perspective of a 4 year old New Yorker.

CCTV, CCTV, CCTV! From the moment you step foot in the city there’s a very clear message put into your head. CCTV!, Big brother’s watching!. The scare tactic seems to work, all my friends seemed to tell me, don’t do this, don’t do that, they’re watching. I personally think it’s more of a deterrent than anything. Nobody can possibly be watching so many cameras, they are probably used for “forensic” purposes.

Pound Currency design FAIL. I understand having different widths for blind people, but they made them way too wide to fit on a wallet. Also they don’t have their denomination shown on all 4 corners, for the tourist, if you insert bills backwards you have to take them out to see how much each bill is, slowing cashier lines with tourists.

DSC00102

They just don’t fit on my “American Sized” wallet. I guess you have to either have a bigger wallet, or fold them twice. Notice how you can’t tell what bills are what (If you’re a noob with the currency of course), no numbers on all corners.

One thing I loved though on the 10 pound bill, freaking Charles Darwin is in it!

Now see the mighty dollar (Euros have the numbers on all 4 corner) how good the “user experience” is (at least for the non blind)

DSC00104

London.Underground = NewYork.Subway;
London.Subway = NewYork.UnderPass

What the New Yorker calls the “Subway”, the Londoneer calls the “Underground”. Whoever designed the Logo of their system was a genius, it’s a very versatile logo. Now, here comes a weird thing, Waht we New Yorkers call an “Underpass” The Londoneer calls “Subway”. This little detail had me J-Walking a couple of big avenues with all my luggage right after I came out of the “Underground” , and I couldn’t find for the life of me a pedestrian area to cross, and I kept thinking that some parts of the city weren’t that pedestrian-friendly… Me and other tourists just had gotten out of what we call “Subway” when we saw a sign for the “Subway” again we didn’t use it and we J-Walked it baby. Then it was easy to cross big avenues. In london Underpass = Subway.

DSC00299

Nokia > iPhone
Most people have Nokia phones there. Didn’t see a single iphone among my friends. Saw an Android though

The underground has no exits, only ways out.
The undeground has no "Exits", only Ways out

When you cross the street they always make you waste time on this buffer zone, many of the times lots of pedestrians end up waiting in the middle. Maybe its a combination of making car traffic flow faster, and also to help tourists remember cars are coming the other way.

DSC00043

It seems that the city is a very democratic place and that it has lots of issues, during the 6 days I was there I saw protests from very different groups. It also seems that there’s this love for Rollerblading like nowhere else, saw big crowds of Rollerbladers (wearing funny customs some times) in several occasions. Not sure if they were also protesting.

DSC00073

DSC00128

DSC00342

Maybe I’m just used to it, but I think the water in New York tastes 1000 times better than the water in London. There’s something in the London water after you swallow, it never seems to quench my thirst, it has to be extremely cold for it to feel the same way, and it was my experience that everywhere that I went I had to ask for a lot of ice. It must be an european thing (my wife doesn’t drink iced water either, nor does her family, they can even drink room temperature beer, yuck) drinking water at its natural temperature, maybe it’s part of the energy culture in America that we don’t give a crap to spend energy in cooling water?

Overall, I loved the experience, the night life seems very much alive and real. Heard some stories of pickpocketing and of areas that I shouldn’t dare visit and this made me think that it may be a city a little more dangerous than New York.

Maybe it’s the week dollar, I don’t know, but everything felt to me that it was double or triple the price than in New York. I only spent money on food, transportation and internet connectivity, other than that I don’t think it was worth it for someone who comes from New York to do any shopping over there and I certainly didn’t spend a “p” on anything outside my most basic needs.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

How to make your own Quick & Dirty Hex File Viewer in Java

Saturday, April 18th, 2009

Update: You might want to read this new version of the code instead. Thanks ispak

I was playing with a hex editor recently and then I thought it would be pretty easy to make a program to output what you see on a text editor. Here’s a quick & dirty Hex Visor I wrote in like 5 minutes with Java. It shows 15 bytes per line, and on the right side it prints all the visible characters of the ascii table, the non-visible ones are replaced with “.”

Enjoy:

//HexViewer.java
import java.io.*;

public final class HexViewer {
    public final static void printFile(String filePath) {
        File f;
        try {
            f = new File(filePath);
        } catch (Exception e) {
            return;
        }

        try {

            FileInputStream fis = new FileInputStream(f);
            while (fis.available() > 0) {
                char[] line = new char[16];
                for (int i=0; i < 16; i++) {
                    int readByte = fis.read();
                    String paddingZero = (readByte < 16) ? "0" : "";
                    System.out.print(paddingZero + Integer.toHexString(readByte) + " ");
                    line[i] = (readByte >= 33 && readByte <= 126) ? (char) readByte : '.';
                }
                System.out.println(new String(line));
            }
        } catch (Exception e1) { e1.printStackTrace(); }
    }

    public final static void main(String[] args) {
        if (args.length == 0)
            return;

        printFile(args[0]);
    }
}

Usage:

java HexViewer &lt;path to file> | less
java HexViewer Desktop/Puppet.wmv | less

30 26 b2 75 8e 66 cf 11 a6 d9 00 aa 00 62 ce 6c 0&.u.f.......b.l
74 14 00 00 00 00 00 00 07 00 00 00 01 02 a1 dc t...............
ab 8c 47 a9 cf 11 8e e4 00 c0 0c 20 53 65 68 00 ..G.........Seh.
00 00 00 00 00 00 f4 10 68 f9 49 76 2e 43 b5 9f ........h.Iv.C..
09 0a 2d 19 45 7c 32 3a 24 00 00 00 00 00 70 ee ..-.E|2:$.....p.
14 06 fb da c7 01 28 01 00 00 00 00 00 00 00 8c ......(.........
bb 53 00 00 00 00 10 88 dd 52 00 00 00 00 b8 0b .S.......R......
00 00 00 00 00 00 02 00 00 00 40 1f 00 00 40 1f ..........@...@.
00 00 90 50 02 00 b5 03 bf 5f 2e a9 cf 11 8e e3 ...P....._......
00 c0 0c 20 53 65 61 10 00 00 00 00 00 00 11 d2 ....Sea.........
d3 ab ba a9 cf 11 8e e6 00 c0 0c 20 53 65 06 00 ............Se..
33 10 00 00 a9 46 43 7c e0 ef fc 4b b2 29 39 3e 3....FC|...K.)9>
de 41 5c 85 27 00 00 00 00 00 00 00 01 00 0c 65 .A\.'..........e
00 6e 00 2d 00 61 00 75 00 00 00 5d 8b f1 26 84 .n.-.a.u...]..&.
45 ec 47 9f 5f 0e 65 1f 04 52 c9 1a 00 00 00 00 E.G._.e..R......
00 00 00 02 01 ea cb f8 c5 af 5b 77 48 84 67 aa ..........[wH.g.
8c 44 fa 4c ca 62 01 00 00 00 00 00 00 06 00 00 .D.L.b..........
00 01 00 0c 00 02 00 02 00 00 00 49 00 73 00 56 ...........I.s.V
00 42 00 52 00 00 00 00 00 00 00 01 00 34 00 00 .B.R.........4..
00 06 00 00 00 44 00 65 00 76 00 69 00 63 00 65 .....D.e.v.i.c.e
00 43 00 6f 00 6e 00 66 00 6f 00 72 00 6d 00 61 .C.o.n.f.o.r.m.a
00 6e 00 63 00 65 00 54 00 65 00 6d 00 70 00 6c .n.c.e.T.e.m.p.l
00 61 00 74 00 65 00 00 00 4c 00 31 00 00 00 00 .a.t.e...L.1....
00 02 00 0c 00 02 00 02 00 00 00 49 00 73 00 56 ...........I.s.V
00 42 00 52 00 00 00 01 00 00 00 02 00 34 00 00 .B.R.........4..
00 0c 00 00 00 44 00 65 00 76 00 69 00 63 00 65 .....D.e.v.i.c.e
00 43 00 6f 00 6e 00 66 00 6f 00 72 00 6d 00 61 .C.o.n.f.o.r.m.a
00 6e 00 63 00 65 00 54 00 65 00 6d 00 70 00 6c .n.c.e.T.e.m.p.l
00 61 00 74 00 65 00 00 00 4d 00 50 00 40 00 4d .a.t.e...M.P.@.M
00 4c 00 00 00 00 00 01 00 2e 00 03 00 04 00 00 .L..............
00 57 00 4d 00 2f 00 57 00 4d 00 41 00 44 00 52 .W.M./.W.M.A.D.R
00 43 00 50 00 65 00 61 00 6b 00 52 00 65 00 66 .C.P.e.a.k.R.e.f
00 65 00 72 00 65 00 6e 00 63 00 65 00 00 00 a7 .e.r.e.n.c.e....
3f 00 00 00 00 01 00 34 00 03 00 04 00 00 00 57 ?......4.......W
00 4d 00 2f 00 57 00 4d 00 41 00 44 00 52 00 43 .M./.W.M.A.D.R.C
00 41 00 76 00 65 00 72 00 61 00 67 00 65 00 52 .A.v.e.r.a.g.e.R
00 65 00 66 00 65 00 72 00 65 00 6e 00 63 00 65 .e.f.e.r.e.n.c.e
00 00 00 b0 06 00 00 74 d4 06 18 df ca 09 45 a4 .......t......E.
ba 9a ab cb 96 aa e8 a4 0d 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

This how it looks on a full blown hex editor like HexEdit:
Same file on HexEdit

The Code of HexViewer.java on emacs:
HexViewer.java on emacs

Screenshot of the output:
HexViewer in action

Homework
Hack the code so that it ouputs the first column shown on the HexEdit screenshot. That column represents the byte position of each row. It’s basically a counter incremented 16 units at the time, and shown in Hex.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Thoughts during my first hours in London

Saturday, April 11th, 2009

I’ve finally taken a week off from work, and I decided to go to one of the must-visit cities on my list while my wife does her Indian journey with her sister. I’m in London, and I must say I’m not that thrilled yet (I haven’t seen anything so far), maybe it’s cause I’m alone, maybe it’s the weather, maybe I’m tired, or maybe I’m too cheap for the freaking prices so far in this city. Here are some of the thoughts I’ve had so far during the trip:

  • American Airlines for the first time had really good food during the flight. Also the movies on demand rocked, I could watch Valkyrie and Yes Man.
  • As we started to descend I realized I would not see the sun again during the whole vacation. Anywhere from 10,000 meters to like 100mts from the ground there were layers and layeres of clouds and fog.
  • Subway cars are tiny
  • DSC00041

  • The subway system is a piece of cake
  • Every thing is twice as expensive as in New York, and it pisses me off
  • There’s a never ending drizzle
  • At first I thought the whole place would sound like I was in a harry potter movie, so far I’ve only heard Polish, German, Portuguese, Italian, and very little English with British Accent
  • Everything reminds me of my wife, traveling with her is 10 times more fun than traveling alone
  • It’s been only a few hours, hopefully I’ll get used in a couple of days on how crossing the street works, even though there’s signs in most places “Look right!” “Look Left”, I still have to think hard to figure out where cars are coming from on some streets. It’s all so crazy, they should switch.
  • DSC00043

  • I forgot my power adapter
  • Everything is too expensive, 20 pounds for the internet connection on the hotel is not good at all, that’s like $30 usd. In 2 days I’d pay my monthly ISP with that amount of money back home
  • I still think the US is the best fucking country in the world, no matter how much people hate it, I find everything in america so convenient it’s hard to change it for any other country, at least for me

Update
In the afternoon after I walked more then I got more excited after I went to a few landmarks like the London Eye, Big Ben, Buckingham Palace, and Picadilli Circus (below). I finally got some sleep, but I still feel that I’ve some jetlag on me, so I’ll take more of this sunday to sleep it off, that’s what vacation is for, resting.
Me at Picadilli Circus

The conclusion of the first day, most things in this country are backwards. I’ll try to make a list of them, it’s not only the driving. The bread toaster this morning was backwards, you’d get the bread down by pulling a lever up… wtf.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Inside a Google Data Center

Thursday, April 9th, 2009

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Geek T-Shirt Collection #14 – FrostWire

Saturday, April 4th, 2009

This is the official FrostWire T-Shirt. I contribute to this open source project to keep my java skills up to date. We had a lot of these t-shirt printed to gather donations for the project. Thanks to the people that support us there’s only a few left (only M size) so Get your T-Shirt and support FrostWire.

What is FrostWire (According to Wikipedia)
FrostWire is a peer-to-peer file sharing program for the Gnutella and BitTorrent protocols. FrostWire is written in Java, and is a fork of LimeWire, another popular Gnutella client. Released under the GNU General Public License, FrostWire is free software.

See the Next T-Shirt
See the Previous T-Shirt

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Mac OSX Terminal too slow to open?

Friday, April 3rd, 2009

Try this:

rm ~/.fonts.cache-1

Open a new Terminal, it should open pretty fast after that.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)


  • Categories

  • 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