Bitbucket or Github?

This week we have to make a final choice of what technology will be used to replace our somewhat big subversion repository (2 Gigs). Huge imports are beginning to be a pain and we’re tired of the .svn folders and not being able to commit if the central server is down. 

As time passed we become more paranoid and started making automated backups of the repo using good old rsync, so we’ve organically saw the need for a distributed option that can let us commit our work even if we’re online. 

The obvious choices are Mercurial on BitBucket or Git on GitHub. 

I’ve tried GitHub with the free account on open repositories, and I’ve tried Mercurial on my own since it feels a lot more home (command wise) if you are an old subversion user. 

If you’ve tried both of these services, I’d love to hear your opinion.

Posted via email from Angel’s posterous

Update: Bitbucket. During the week that I wrote this article Atlassian bought Bitbucket and offered free hosting. Also the tool is a lot more friendly to svn-brainwashed users like myself and our team. Couldn’t be more happy after switching to a distributed version control system.

Android: How to obtain the WiFi’s corresponding NetworkInterface

Let’s say for some odd reason in the world you do need to get the corresponding NetworkInterface object of the Wifi on your android, in my case I needed to have my WiFi device send multicast packets, and I wanted my MulticastSocket to only send packets through the WiFi device (not 3g, or maybe even ethernet). The android API does not provide functionality to know what “NetworkInterface” your WiFi is using.

Here’s a solution proven in tens of different android phones, seems to work 100%.

public static NetworkInterface getWifiNetworkInterface(WifiManager manager) {

Enumeration<NetworkInterface> interfaces = null;
try {
//the WiFi network interface will be one of these.
interfaces = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
return null;

//We’ll use the WiFiManager’s ConnectionInfo IP address and compare it with
//the ips of the enumerated NetworkInterfaces to find the WiFi NetworkInterface.

//Wifi manager gets a ConnectionInfo object that has the ipAdress as an int
//It’s endianness could be different as the one on
//maybe this varies from device to device, the android API has no documentation on this method.
int wifiIP = manager.getConnectionInfo().getIpAddress();

//so I keep the same IP number with the reverse endianness
int reverseWifiIP = Integer.reverseBytes(wifiIP);

while (interfaces.hasMoreElements()) {

NetworkInterface iface = interfaces.nextElement();

//since each interface could have many InetAddresses…
Enumeration<InetAddress> inetAddresses = iface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress nextElement = inetAddresses.nextElement();
int byteArrayToInt = byteArrayToInt(nextElement.getAddress(),0);

//grab that IP in byte[] form and convert it to int, then compare it
//to the IP given by the WifiManager’s ConnectionInfo. We compare
//in both endianness to make sure we get it.
if (byteArrayToInt == wifiIP || byteArrayToInt == reverseWifiIP) {
return iface;

return null;

public static final int byteArrayToInt(byte[] arr, int offset) {
if (arr == null || arr.length – offset < 4)
return -1;

int r0 = (arr[offset] & 0xFF) << 24;
int r1 = (arr[offset + 1] & 0xFF) << 16;
int r2 = (arr[offset + 2] & 0xFF) << 8;
int r3 = arr[offset + 3] & 0xFF;
return r0 + r1 + r2 + r3;

Visions of the Future, No more screens.

Recent conversations about completely unrelated technologies with my friend Alden had me coming back to the blog so I can share with you some of my visions of what I really expect the future to bring one day in terms of technology. Some of these ideas will seem far fetched, but hey, dreaming is free.

I’ll be writing about these visions in posts to come, some of them I think I could even be part of right now to start changing the lives of millions, others I know are completely out of my reach. VCs and Entrepreneurs start taking notes and steal the ideas.

The End of Computer and TV Screens

I want to live in a world where I don’t need a computer screen to use an operating system or watch tv or movies.
I want to live in a world where there’s no limit in screen resolution, where I’ll be only limited by the capacity of my brain to process images.

I think the solutions will be implemented somehow (we’re thinking very high level here) in the following stages:

The Visual Stream will be “projected” first onto my retina, it’ll be part of a pair of sun glasses, or glasses. In the same device there’s also a camera and microphone that exists to read my arms/hands gestures and to interpret voice commands.

Months later they’ll come up with smaller, better technology that can be embedded in contact lenses.

You could achieve this stages, at first using an external device for processing the data, namely your smartphone connects to the Retina Projector Wirelessly. As technology gets better (maybe truly powerful nano-computing happens) all the processing could be done in the the glasses or contact lenses themselves.

Years go by and then it happens the way it should. The user interface and video streams are projected directly into our Brain’s Visual Cortex, all input from you (arms, fingers, facial gestures and maybe even thoughts) is read directly from different sections of the brain.

The applications would be amazing, content could be delivered directly to us, no need for computers or even a workplace. This would kill huge part of the electronics industry and would create a replacing technological field (brain processing units -> BPUs) so we get a better experience year after year.

If you’re currently working with a computer in an office 24/7, you could be doing that laying by a pool with your eyes closed not moving an inch of your body, yet being extremely productive or entertained. How many times I’m extremely busy but I feel bad that I haven’t gone to the gym or for a walk to get a little workout, I wouldn’t have to hold my smartphone and read that tiny ass screen, I could be walking and reading news, a book, or watching tv in a translucent screen the size of the sky if I wanted to.

There is be no IMAX theater screen that can match the size of a screen that’s as big as your imagination.

Stay tuned for more tangible visions on Brain Computer Interaction, and ideas for Smartphone software that we could be building today (had I the resources to do so)