Unlink your reading

The web is packed with  information and the more curious we are the more we spend time consuming this information. This is not a bad thing of course, but sometimes this can interfere with our productivity even if we try to control it. You start reading an interesting blog post that you accidentally found on your favorite social network, but this post is filled with links, a LOT of links. Before you know it you have 10 tabs open and now you have to catch up on reading these 10 articles which themselves link to other interesting ones. That’s how you can waste a full day, by just reading stuff instead of making stuff.

I have been thinking about this recently and I think the key to gain control over the time that we spend reading stuff on the internet is to ignore those links.

In this spirit, I have quickly put together a Chrome Extension that removes the links from a webpage after it loads. I called it: Unlink and you can download it here!

Not sure if there is already an easier way to accomplish that or if an extension already exists for that, I have done some research with a couple of keywords but nothing really came out. Also, I have never written a Chrome Extension before so this was the perfect occasion to try my hand at it.

My first use of Unlink is going to be for reading what a typical day for a pampered Google engineer looks like. You can either do the same thing or you can also drop a comment below :)

Solving the Eclipse hanging issue

This is an issue that I encounter very often when programming with ADT on Eclipse.

In short, there seems to be a couple tasks that are waiting for another task to complete which is blocked. It doesn’t matter how many times you restart Eclipse or restart your computer, Eclipse will still be in this situation, preventing any work to happen.

After doing some research on Stack Overflow, I figured there were 2 effective solutions to this problem and 1 other solution that is less optimal:

Launch Eclipse with the clean flag

eclipse -clean

This is what should be tried first. After running this command, Eclipse will open in a special cleaning mode which should cancel all those hanging tasks.

Create a new workspace

Another way to solve this problem is to recreate your workspace from scratch.

Delete the .metadata folder in your workspace

Finally, and this is the less preferable solution, you could remove the .metadata folder all together in your workspace (note: this is a hidden folder).

Keeping this as a memo to my self in case I encounter this again, as well as to help anyone facing the same problem.

Taking the time

Recently I moved from Paris to San Francisco, where I work for Lookout, and one of the first challenges that I had to face on my arrival was to find a place to live. If you don’t know it yet, finding a place in the Bay Area (and in San Francisco in particular) is very difficult due to the sky high rents, so instead of looking to rent a place downtown, I decided to widen my research a little bit to either the East Bay or the Peninsula.

The East Bay presents a couple advantages like being substantially cheaper than any other region in the Bay Area and a fast commute to San Francisco thanks the BART connection, but it also suffers from insecurity (specially in Oakland) and downtown Berkeley has too much of a campus feeling to it. So I knew rapidly that the Peninsula would be more appropriate for me, and the first place that I visited there was Menlo Park. As my first impression of the city was good and as the apartment itself was well located and also had a lot of space, I decided to call Menlo Park home.

Of course, during that period, a lot of people were asking me whether I found a place yet and when they knew that I decided to live in Menlo Park, their reaction was always the same and could be summarized as: What the hell are you going to do in Menlo Park, it’s very far from San Francisco and you’ll spend most of your time commuting! My response? I don’t care since I will be seated.

Exactly. Everyday, I spent nearly 2h in the train and I enjoy every second of it as it allows me to take my time. Taking the time, is the simplest thing that we can’t seem to be able to do anymore in this ultra-connected world. Nowadays we are so connected to everything that we are always busy doing a lot of things even when we don’t want to. It’s like we are living in constant interruption and being constantly interrupted prevents you from feeling the pleasure of enjoying one activity at a time.

So thanks to my new commute, I can now take my time to:

- Read. I am not talking about reading my Twitter feed or unrelated blog posts, but about quality reading.

- Close my eyes and relax. Yes just that, I just try to focus on my breathing and listen to the environment that surrounds me.

- Reflect on the course of my life. It is very important to take a step back from your everyday life and think about what’s going well, what’s not going so well and what actions you can take to improve it.

Finally, I found that Menlo Park is a great place where you could not only enjoy the nature but also have  all the commodities close enough and that’s just the icing on the cake.

How about you? Do you have the occasion to unplug from everything during your day or do you live in constant interruption?

The 10 commandments for happiness and success

Life is too short to be wasted, we all know that. Yet, most people live a default life, forcing themselves to think they are happy even though they are not. Why? Because, we let the society dictates how our lives should be lived and what success and happiness should be like. Things like money and prestige are given too much importance to the detriment of focusing on what is really essential to us: living a life in line with our inner values, accomplishing valuable things.

If I had to give an advice to anyone starting a life (my future child for example), these are the 10 commandments I would strongly encourage him/her to follow:

1/ Don’t compare yourself to others.

From the day we enter school, we are stimulated by the spirit of competition through grading, forgetting that the primary purpose of education is to learn. Parents want their children to be the first, or to be better than X because they want to be proud when meeting X parents at the school door. So we grow up with this mentality of wanting to be better  than others, instead of wanting to become a better version of ourselves.

2/ Only surround yourself with brilliant and positive people.

Negative and mediocre people are everywhere and their influence on you can be devastating. You might be a positive person, but if you let yourself listen to pessimism all the time, you might end up the same one day. Thus, the best way to avoid any negativity get to you, is to eliminate these gloomy people from your life. Of course, if you care about them, then you owe it to yourself to transmit your positive attitude to them.

3/ Don’t be afraid to fail, failure is the best thing that could happen to you.

In the eyes of  society, failing is the worst thing that could happen to you. Personal fact: I failed once, very hard. It could have had disastrous effects on my life, but instead, it made me much much stronger, not just twice as strong but in proportions you cannot start to imagine. The truth is that failure builds character, it makes you think about what went wrong and what you can change in your life to never ever be in that situation again. It is so easy to content yourself in a status quo, when things seem to be going well for you . Failure challenges that. If planes are as safe as they are today, it is because they have failed in many situations in the past. Similarly, if you look at all the great men and women in history, you will find that they have all encountered a severe failure at some point in their life. So don’t be afraid to try things and fail.

4/ Find your vocation and have pleasure doing it.

Everyday, I hear stories about people studying or working in a field they have no interest in at all. Most of the time, it is the result of the pressure exercised by their parents to choose a path that they thought was prestigious in the eyes of society. They wanted to be able to say: My daughter is a Doctor or My son is a lawyer. On a more general note, we are living in a world where appearances are all that matter, so we keep doing things we don’t like to be able to appear more successful in the eyes of our friends and family. Does it make us happy? I doubt it. When somebody asks you what do you do for a living, their intention is always implicitly or even explicitly to figure out whether you are doing something prestigious or not. How about just asking this very simple question: « Do you like doing what you do?« . This is the only thing that matters, because the only way to achieve something substantial in life, is through real passion.

5/ Be careful when listening to people.

Pretty much, similar to the previous point. People like to give advices based on their own experience, but their own experience will likely be different than yours, so don’t always listen to them and follow your own instinct instead.

6/ Be generous, share when you can.

There are many proven researches that demonstrate a direct correlation between generosity and happiness. The basic idea is that by helping others we are shifting our focus off of ourselves which makes us less vulnerable to our critical inner voice, by seeing the positive impact of our actions on someone else. This is a good article to read on the subject.

7/ Stay healthy, eat healthily, exercise and balance your life.

This is a no-brainer. It is in your best interest to stay healthy, in order to be able to accomplish more of your goals in the best possible conditions. Although, there are certain things we can’t control in life, it is obvious that we can avoid plenty of diseases by keeping good eating habits and by exercising regularly.

8/ Don’t be afraid to disappoint anyone.

Because if they love you, they won’t be. Some people are more fragile than others and tend to go through mental breakdown when facing adversity or any kind of pressure. Sometimes this is due to the fear of disappointing someone they care about in case of failure. Failure is good as stated above, and someone who cares about you will never blame you for trying. Similarly, don’t be afraid to disappoint your parents by choosing your own path.

9/ Don’t watch TV and don’t follow the media too much.

Their job is to frighten you, that’s how they make money. Besides, their second job is to manipulate you and distract you from real problems. If you don’t know them already, the 10 media manipulation strategy by Noam Chomsky is always a good read.

10/ Have strong values and stick to them, no matter what.

These are the values that will make you happy in life and be successful. Society values money and  social status. Let’s change those rules and let’s teach our children new values based on happiness.

Share this post if you agree. Debate if you disagree.

Programming, the myth and reality

Most of us have watched a hacker movie, at least once.  I have personally watched a fair amount of those: War game, Takedown,  Hackers, Swordfish, The social network, Pirates of the Silicon Valley to name a few.

These movies are so exciting to watch, even for the general public who doesn’t give a pineapple about computers. Of course, excitement easily comes from fiction rather than reality. So, not only are these movies all fictional (some of them less  than others though) but to some extent they all include a good dose of spurious stereotypes. The most recurring one, is that programmers or hackers spend most of their time ragingly hitting on their keyboard,  like if writing code was a second nature to them and everything is supposed to flow quickly and then the magic happens…

The truth is that if you randomly walk in a cubicle of any tech company, you will more likely see people starring cluelessly at their screens scratching their heads rather than typing on their keyboards.  If you want to see it from your own eyes, there is an excellent documentary that I wholeheartedly recommend you to watch, it’s called: Code Rush.  In this documentary, a team of journalists followed the Netscape Communications on their adventure to release the source code of their navigator, best known as Mozilla.

It was released under the Creative Common licence so you can watch it for free from the Internet Archive.  Do it,  I’ll wait.

Two things about the documentary:

  • You can read Steve Jobs former phone number written on a whiteboard (I don’t remember when exactly but I guarantee you it’s there. Well, almost… only 2 digits were missing!).

  • These guys were under extreme heavy pressure. I mean it.

To picture the amount of pressure that was floating around, you can read Jamie Zawinsky‘s diary. Or, if you don’t have time, here are some interesting excerpts:

Marc wants me to be done with the Unix client in time for SGI to ship it along with Irix 5.3. That means that it has to be rock solid in, like, less than two months. I’ve got so little of the code written that I don’t even have a sense yet of whether that’s even remotely possible; it’s all over the floor. We’ve got bits and pieces, but I don’t see the big picture. It’d be really easy to let him bully me into agreeing, but I don’t want to miss; the stakes are too high this time, too many people are watching us for us to be able to screw up at all…

I slept at work again last night; two and a half hours curled up in a quilt underneath my desk, from 11am to 1:30pm or so.

I just got home; the last time I was asleep was, let’s see, 39 hours ago.

I’ve had a sore throat and a cough for about a week now, but I haven’t done anything about it, because I don’t have time.

My hands have been really been hurting lately; I hope all this typing hasn’t finally blown out my wrists. If I can’t type, my life is over. My right hand especially is flaking out – the last knuckle of the middle two fingers ache, as if they’re badly bruised.

We’re doomed. We’ve finally announced a public beta to the net, and there are loads of bugs, and they’re hard bugs, sucky, hardware-dependent ones. Some of our private beta testers crash at startup on some SunOS 4.1.3 systems, and I’ve got what seems like an identical system here and it doesn’t crash. And scrolling text doesn’t work with the OpenWindows X server, though it works fine elsewhere. And the cache is still fucked. We’re doomed. Fuck fuck fuck fuck fuck fuck fuck. Doomed doomed doomed doomed doomed. I’m tempted to just stay home tomorrow. I’m so fucking burnt. Existence is suffering.

I’ve spent most of the day so stressed out that my skull is rattling from the pressure of my teeth grinding together. I feel like I have finally exceeded my stress limits and am about blow a gasket. But I can’t go home, because if I do, the world will end, right? I’m trying to work, but every few minutes I have to stop typing and make fists so tightly that my whole body shakes.

I’ve just noticed that there’s still purple ink on the inside of my right wrist spelling the word VOID: the hand-stamp from a concert that I went to last week. I left work, went to the show, and came back to work immediately afterwards. I’ve been here since.

You get the idea.

But what is more interesting is that if you dig enough into the Internet Archive, you will find some uncut video footage.  They are goldmine because you will be able to watch some discussions between the documentary crew and the engineers.  The most interesting one (to the point of this article) shows an engineer by the name of Don Milton, debugging the Mac version of Netscape. It’s funny to see how he was absolutely clueless about why that bug was happening.

He wasn’t even sure about the context in which that bug could be reproduced and thus couldn’t even start thinking about the solution. You can see him starring at his screen for a couple of minutes, touching his nose and you can constantly read the expression on his face saying: I have no idea what’s going on here…

So if the idea of spending countless hours solving challenging problems is not appealing to you, and  if you are more interested into impressing your girl friend with some crazy typing skills, then the HackerTyper has got your back. Joke aside,  I guess the purpose of this article is to encourage the right people to join the IT industry (I am looking at you, ladies!) by encouraging you to focus on what Software Engineering is really like (solving problems) rather than believing in the typical/common nerds stereotypes broadly instrumentalized  in the film industry.

I did it

Yes, I have actually crossed the finish line of the half-marathon of Paris, despite my knee injury. I am so happy and proud of myself and I’d like to take the occasion to thank again all of you who donated to VML and who supported my participation in the race at the same time. I talked at the end of the race to some families affected by lysosomal diseases and they were extremely relieved by all the donations raised by runners like me. Proud of you, guys!

Finishing this race was quite an achievement to me and I would like to take the time to relate that story properly somewhere during this week as I don’t want to forget this moment!

So stay tuned!

My first bib

Ladies and gentlemans, we made it, we raised 350 euros for the charity Vaincre Les Maladies Lysosomales. Thanks to you and other donators supporting other runners this charity has raised a total of 17 000 euros. This is an incredible achievement for them as they are not used to be put under spotlight given that lysosomal diseases are very rare and less popular than other diseases like cancers.

So first, I would like to thank each one of you who donated to  VML-ASSO and making it possible for me to get this bib:

semi-marathon paris dossard

This is a green bib, which means that my goal is to run the distance in 2 hours.  To be honest, it was very optimistic of me to think that I could run this distance in 2 hours, I just hope to finish the race.

Which brings me to the last point of this article, less than two months ago I started feeling some pain in my right knee and as a result I had to reduce my training volume drastically. If it wasn’t for your support It would have been easier for me to just let this go. So thank you again!

Finally, if you want to follow me throughout the run you can go on this site and search for my bib number: 43984.

Running in the snow

This morning I wake up to this:

I had mixed feelings, on one hand I found the view beautiful but on the other hand I thought that I’d miss my traditional weekly long run session. After a breakfast (watching Lance Armstrong’s interview with Oprah), I started thinking about whether or not I should do that run. I started searching on Twitter for the hashtag #courir (french word for running) and found lot of not so motivating tweet about people heading back to bed after seeing all that snow falling. Then I remembered that I had a half-marathon to run in no less than 41 days and figured I should give a try to running in the snow (yeah,call me noob if you want, I have never done that before).

How it went?

(tracked with a Garmin FR 360 – Review coming soon)

Wonderfully! First of all, it wasn’t possible to slip on the ground as the snow was still very solid at that time. Also, as you can see I was running at a very very slow pace (avg 65% of my maximum heat rate). Of course it was mostly voluntary as I planned to do a long slow distance run. But obviously, there was additional friction.

Other than that I found the following advantages to running in the snow:

  • You have the freedom to run almost anywhere you want (less cars, almost no bicycles at all…).

  • Your legs work harder than usual so it helps strengthen your muscles more than usual.

  • It teaches you how to stabilize yourself when running.

And finally, you will benefice from stunning views during your workout:

The above pictures were taken in The Bois de Boulogne (west side of Paris), you can notice the frozen lac on the last picture. Here is also a small sequence from my workout:

Anyways, I now feel that nothing (not even snow) can get in the way of my half-marathon preparation, I am really committed to run it under 1h50 (which is quite challenging given my current level).

As a final note, I would like to thank each one of you who already donated to the charity I am supporting (a charity that fights against Lysosomal Storage Disease) which covers many rare genetic diseases), it really means a lot to me and it gives me the courage to step outside,whatever the climatic conditions are!

For those of you who don’t know what I am talking about, the only way for me to run the half-marathon of Paris is to collect some amount of money for a charity. This page explains it all! If  you are willing to donate to the charity, remember that if you live in France you can deduce 60% of that donation off your taxes. Otherwise, you can read more about Lysosomal Diseases and understand why it’s important to donate even the smallest amount to the charity.

My favorite books in 2012

I read a lot. But not much the kind of books that everyone reads like novels, I mostly read books that have some connexion with programming, entrepreneurship and creativity.

You can find in my bookshelf the following books:

  •  Books about personal development, like: How to be more productive? How to be happier? How to control your emotions? How to unleash your creativity?

  •  High level books about my discipline that I read to grow up as a better software engineer (or as I like to call myself, as a better craftsman).

  •  Technical books related to the technologies and tools that I use everyday.

My addiction to reading has become worse since I bought an iPad, which combined to the Kindle application makes my reading experience a blast! Although, to be honest with you I miss how books smell sometimes –  Yeah, I am that weird dude who smells books at the library, and you know what? It turns out that I am not the only one.

Anyway, now that 2012 is over, I wanted to take a step back to look at my  last year’s favorite books. The goal is not only to keep track of what I read, but also to keep track of what I don’t read (Yes I often buy many books at the same time and often forget to read them after a while).

Coders At Work This book offers a collection of interviews with very famous developers (and sometimes even legends), to name a few:  Jamie Zawinski, Douglas Crockford, Ken ThompsonJoshua Bloch and even Donal Knuth in person! Each interview is very rich both in terms of length (above 30 pages) and content. Indeed, the author, asks very interesting questions about their what brought them to programming, their programming style, the tools they use, the most difficult bug they had to solve as well as other questions that depend on who the interviewee is. So far, I have been reading 50% of that book  and I have learned a lot.

Effective Java – Second Edition  I bought this book when I started using Java professionally (when I started Android development during my internship 2 years ago) and I urge you to do the same if you haven’t  read it yet. It is written by Josh Bloch the guy who designed many Java features: generics and collections for example. This book covers topics like: patterns to object creation, generics or concurrency. The best  way to master a language is to read its specification, but this book might be a good replacement to it.

The architecture of Open Source Applications I bought this one after a colleague recommended it. It’s a collection of reflections on different Open Source projects. A non exhaustive list of these projects  include: Asterisk, Bash, Eclipse,  LLVM and Mercurial) written by the authors of those projects themselves. The premise of this book is, as quoted from the introduction, that  Building architecture and software  architecture have a lot it common, but there is one crucial difference. While architects study thousands of buildings in their training and during their careers, most software developers only ever get to know a  handful of large programs as well. And more often that not, thsoe ar eprograms they wrote themselves. They never get to see the great programs of history, or read critiques of those programs design written by  experienced practitioners. As a result, they repeat one another’s mistakes rather than building on one another’s successes. I couldn’t agree more. It is really valuable to be able to read some thoughts shared by  the authors of the most important open source projects out there, who have been putting so much effort on their design!

The Algorithm Design MANUAL  Every serious software engineer should keep handy a serious manual about algorithms and data structures.  I hesitated a lot between buying this one or buying the very  famous Introduction to Algorithms from MIT press. I finally went for this one because it provides both practical and theoretical insights on most of algorithm topics. The killer feature of this book, is also its  war stories which tell you how algorithm problems arise in the real world. Highly recommended.

Effective Programming More Than Writing Code  CodingHorror is one of the most popular blog written by a programmer for fellow programmers. It is also one of my favorites, given how much quality Jeff    Atwood (also the father of StackOverflow)  put into each blog post. When I saw that he wrote a book and that he was only selling it for 2.99$, I ran on my wallet and pullet out my credit card to buy it. Of course  I don’t regret that decision as the book covers a lot of topics dear to my software programmer’s, engineer’s, craftsman’s (pick the term you wish) heart: How to get shit done, how to hire good programmers, how  to test your code, how to design with your users in mind, working remotely etc.  The format of the book itself makes each section very easy to read as each chapter is only 2-3 pages long max.

REWORK This is an excellent book written by DHH (the original creator of Ruby On Rails) and Jason Fried on how business should be done differently than what it is right now. It is a highly  opinionated book that basically breaks all the current business norms. For instance: planning is guessing, don’t hide your idea from your competitors, don’t kill yourself at work, avoid meetings etc. It is very  easy to read as each story is a page or so long only.

Rails AntiPatterns  Yes while I am doing Android development at the moment, I have also been doing a lot of server side programming with RoR. One of the things I noticed when I was  doing it, is that it’s  very easy to come up with a messy codebase. This is the book I have read to improve my skills back then. Have you heard of: Fat Models? Spaghetti SQL? Fat Controller? Bloatted Sessions? Well, these are all anti-patterns covered by the book along many others.

Smashing Android UI OMG! Yes, OMG! I just love this book. I wasn’t aware of it, until I saw it while I was at Droidcon UK and reading it has made me a way better Android developer and even more than that… a way better application designer. The first chapters dive into what’s make an application great and how to think in terms of User Centric Design. Once you have read that, you already start feeling  different, you just start caring about things you have never cared about before when designing an application. Right after, it goes into explaining Android to the readers who are not familiar with it and then it explains how to execute any design requirement using Android. Worth a very serious read even if you think you already know Android enough. Trust me, this book will fill the just 5% gaps that you need to go from good to awesome.

The App & Mobile Case Study Book I bought this book at the San Francisco Museum of Modern Art. It was supposed to contain a list of mobile apps case studies (for iOS though but anyway). I have to say, I was a little disappointed as the case studies where not very constructive. Each case study is composed of 4 sections: The brief, the challenge, the solution and the results.It might sound good but it actually isn’t due to how super short each section is.  Sometimes it’s mostly advertisement in my opinion. The only positive thing about this book is that you get to see a lot of app screens that could inspire you. Also, the book itself (not the content) is high quality and it smells good (I smell it every night before heading to bed. I’m kidding of course…). By the way, did you know that TASCHEN (the editor of this book) published a 15 000$ book about Muhammad Ali once? I am not kidding (Although it appears to be selling at 6000$ now).

Outliers: The Story of Success  Always wondered why are some people highly successful where others are just above average? Malcom Gladwell, in this book discusses the factors that contribute to high level of successes. Ever heard of the 10 000 hour rule, by which some people agree is the minimum amount of time needed to be an expert on anything? Well, this is where it comes from. Of course, I have always  been interested in this topic as I explained earlier on a blog post (beware it stinks cheese as it’s written in french) and I enjoyed this reading a lot.

I was blind but now I see  Let me save you some time by cutting the crap and by telling you what this book is really about. In this book, James Altucher, bitches about life. He has obviously gone through a  lot of drama in his life, so he wrote a book to share his opinions on what life is really about and how not to fall into some traps (like buying a house, going to college, being stuck at a job you don’t like etc.).  A  good read overall. Just wear your critical thinking hat while reading it.

Endurance: Shackleton’s incredible voyage This is the story of Sir Ernest Henry Shackleton who was leading a ship named Endurance during an expedition that turned into a disaster. The ship became  trapped in pack ice and was slowly crushed before the shore parties could be landed. But thanks to Shackleton good leadership, there was no loss of life during this expedition. I am still going through the very  first pages of this book so I can’t tell you more about it now.

The How of Happiness: A New Approach to Getting The Life You Want  I bought this book after reading an interesting quote from the book on Eric Larchevêque’s blog Find a happy  person, and you will    find a project. And honestly, I think, this is by far the most serious book about happiness that you can find out there. The reason why it’s serious is because every  statement is backed by some scientific  evidences. The author, Sonja Lyubomirsky who holds a PhD in psychology, starts by explaining why some of us are born more disposed to be happy or depressed and in  that case describes some daily activities  that one could accomplish to feel better and happier.

La Théorie de L’information This is a french novel that relates the digital revolution that started in France 30 years ago with the creation of the Minitel and then describes the chain of events that happened  up until now. This book is half fiction and half real. Why?  Because, this is based on a real story but the characters are fictional to some degrees. Actually, the hero of the book, Pascal Ertanger, is said to be  the  fictional representation of Xavier Niel the founder of Iliad/Free. By the way, this is the book that sits on my bedside table right now. So far entertaining and full of information about things that happened before I was born (and even things that happened the day I was born like the launch of a Pink Minitel Service by Xavier N… Pascal Ertanger, hmm).

Steve Job’s biography. Should I say more?

Of course this is what I have been reading (or started reading) in 2012. There are other programming books that I have been reading before and that I highly recommend like: Code Complete (specially if you just started as a professional developer), Design Patterns Head First or The Well Grounded Rubyist (if you want to start learning Ruby – I have of course other programming language books but this one is just excellent that I just decided to mention it). There are also entrepreneurship books that I recommend like Once You Are Lucky Twice You Are Good that talks about the PayPal Mafia or Founders At Work (an equivalent to Coders At Work for entrepreneurs).

So now that a new year has started, I need to start looking for other books. There are probably some good classics that I am planning to buy real soon like the Structure and Interpretation of Computer Programs (who everybody agrees on being one the most important books that any serious developer should read) and I might also buy some books from Martin Fowler. Besides that, what books do you recommend me reading? What books have you read the last year or so? What books are you going to read this year?

Please share your list and cross link it here!!

Drop that embarrassing USB cable when you develop on Android

Are you an Android developer or an Android Hacker? If yes, you certainly use ADB (Android Debug Bridge) to do various things like:

  • Start a shell on the target device.

  • Install/Uninstall some packages.

  • Monitor the state of the device (memory used, cpu used etc.)

  • Push/Pull some files to/from the target device.

One thing I have noticed is that most developers connect their device to their computer using a USB cable and that sucks because:

  • It is not ergonomic.

  • It is ugly.

  • You probably need that cable to plug your device to an electric outlet while you are at work.

  • You may not have a USB cable at all!

Anyway, for those of you who want to connect to your device wirelessly using ADB, I have some good news for you: it is possible and it is easy.

First, let’s talk about how ADB works and then let’s dig into that very straightforward solution (or if you are busy just jump to the second paragraph).

How does ADB work?

ADB is a tool that includes three components:

  • A client: It runs on your development machine. This is where you will be issuing your commands.

  • A daemon: It is a background process hosted by the target device.

  • A server :  It basically acts as a Proxy between the client and the daemon. By the way, the server runs as a background process on your machine.

As you can guess, there is a two way communication going on between the server and the daemon. That communication happens over a medium which can be of two sorts: USB or TCP. Aha, you get it know? If we want to connect to our device wirelessly then we just have to switch the transport mode from USB to TCP. Let’s do that!

The solution: Switching ADB transport mode from USB to TCPIP

  1. Before switching to TCP, we’ll need to grab the IP address of the device. To do that, we can either go to the phone settings or use the command line tool netcfg

    adb shell netcfg

  2. Once you are in possession of the device’s IP address (let’s say it’s: 192.168.1.25), you can switch to TCP mode by doing: 

    adb tcpip
     One thing to remember is that you can only choose a port number within the range of [5555...5585] (the reason being that ADB Server only works with these ports). So for instance you could do: 
    adb tcpip 5555

  3. Stop ADB Server (we’ll restart it later by issuing any ADB command): 

    adb kill-server

  4. Set ADBHOST to your IP address: 

    ADBHOST=192.168.1.25 adb devices

  5. Make sure your device is connected

the last part of the last command should print the device that you are trying to connect to.

What to do if you don’t have a USB cable from the begining?

If you don’t have a USB cable at first, then you need to root your device first then run the following command on your device: 

setprop service.adb.tcp.port 5555

Then you need to stop/restart the adb daemon: 

stop adbd
 
start adbd

How to switch back to USB transport mode? 

adb usb

But there is one caveat

This only works since Android 4.0 (ICS). If you have to develop/hack on other Android versions then you need to root that device (in order to use ADB in unsecure mode).

That’s all folks, I hope that you are now hacking Over The Air :)