Android: clean & uninstall & package & start app

February 1st, 2012

In case you were wondering

ant clean && adb uninstall com.example && ant debug install && adb shell am start -a android.intent.action.MAIN -n com.example/.ExampleActivity

add -d for a device or -e for emulator.

Using git-stash with a branch

October 17th, 2011

You’re working on something on master but you want your changes to be transfered to a branch

Do this:

[17:44:40][akadri@kryptonite:~/Projects/myproject]$ git stash save "message"
Saved working directory and index state On master: stash message
HEAD is now at 821a965 commit message

You can list your stash with:

[17:48:09][akadri@kryptonite:~/Projects/myproject]$ git stash list
stash@{0}: On master: stash message

Now you transfer your changes to a new branch of your choosing and checkout that branch with:

[17:51:54][akadri@kryptonite:~/Projects/Wikipedia]$ git stash branch mybranch stash@{0}
Switched to a new branch 'mybranch'

That’s it!

vim tips

June 3rd, 2011

These three lines in ~/.vimrc just changed my life!


let g:netrw_preview = 1
let g:netrw_liststyle = 3
let g:netrw_winsize = 30

and then :Explore works the way it should! Just type “p” to open a file in the preview window and bd or bw to delete a buffer (which doesn’t close the preview window and that’s what I like about it!). Ctrl-W-W to switch between Tree selection and preview window.

:help explore to learn more

The help file is pretty cryptic but it actually helps!

PhoneGap Bada

April 20th, 2011

These past two months I’ve been working on porting the PhoneGap mobile framework to the Samsung Bada platform at Nitobi. The Bada SDK is in C++ and I hadn’t touched C++ in years. It was nice to come back to a compiled language tough after years writing scripting/interpreted languages such as Python/Ruby/PHP or Java.

So far everything is pretty much working except Media and File Handlers. Samsung was kind enough to send me a Wave GT-8500 to test with. Details on how I implemented the thing are available on my nitobi blog.

The source is available on github

It is under MIT License

Check it out and share your thoughts/comments!

Sed: how to delete N lines after a match

October 19th, 2010

sed -e ‘/case R\.id\.maps/{N;N;d;}

deletes two lines

sed -e ‘/case R\.id\.maps/{N;N;N;d;}

deletes three lines

If you know any better way, please share!

Vim Search/Replace/Increment

March 25th, 2010

let’s say you have this in a text file:

item
item
item

and you want to change it to this

ordered_item_1
ordered_item_2
ordered_item_3

You can do this in VIM with the following command:

let i=1|g/item/s//\=”ordered_item_”.i/|let i=i+1

You can do it even more easily using AWK but VIM forever!

Keep a task running

March 5th, 2010

so you’ve got task that you want to run but you need to leave right away and you have to logout.

If you do a “command &” it will certainly run and in the background but if you logout it’ll go away. So how can you keep it running ?
With the “nohup(1)” utility. Preceed your command with nohup and end it with “ampersand &” and it will detach it from the current tty and spits the output to ‘nohup.out” in the current directory.
You can also apply this if you want to run some program and don’t want to daemonize it just yet.

This thing helped me twice in the past few days so I bet it will help you too!

Touchscreen smartphones

January 22nd, 2010

It’s been a while I have not posted anything on this blog. I am going to talk about smartphones and the hype that surrounds them. It looks like their popularity is picking up and everybody seems to want some kind of smartphone and especially the Apple iPhone. Apple iPhone is such a trend that some people confuse every existing touchscreen smartphone for an iPhone. Now what is so special about them ? Why are they so popular ?

A lot of people think simplicity and ease of use is the source of the iPhone’s success. The iPhone does simple things but does them better than anything out there. This might be true and for using it for about a week I can attest of that fact. Bu there are so many things that makes me not want to use this device as an everyday phone:

  1. They lock down everything: Not allowed to install third-party apps not approved by Apple, not allowed to run apps in the background (except Apple’s own apps), not allowed to run different apps at the same time, forces you to use iTunes to manage your music, not even allowed to transfer your contacts from/to your SIM card…
  2. The touch screen: I don’t think it’s natural to not get any feedback when they perform a given action. That is especially true for keyboards. I feel faster with T9 than with Apple iPhone’s onscreen keyboard. I make so many mistakes, It is so frustrating! I hear people get better at it but I don’t want to adapt to it. I think it should adapt to me since it’s supposed to make my life easier!
  3. The hardware is not even that great: They advertise the camera of the iPhone 3GS as supporting video recording. That has been supported in regular phones for years and that is just an example.
  4. So what are they so popular ? Is it really simplicity ? Yes but the real answer is: Marketing/Advertising.
    Apple is very good at that. They are the second biggest technology advertiser just behind Microsoft and ahead of IBM and HP that have three time’s Apple’s annual sales (according to NYT). Their ads are usually targeted and sarcastic. we-do-it-better-than-the-others. They spend hundred millions every year.

    One other reason is design: They are also very good at that. It does not need to have a lot under the hood but it’s got to be shiny! People should look at it and think of how beautiful it looks. “IT” can be anything (Computer, Music Player, Phone…).

    So all in all what is it ? A “gadget”! A “toy” ! I don’t see professional people nor power users switching to this thing in the future. What are the alternatives ? There are a lot !

    Their current market share is high but it’s not growing as much as it used to. I think/hope in the end Apple victims will wake up and switch to something else.

Car-sharing services in Vancouver

April 19th, 2009

En francais plus bas


My story:

So I’ve been living in Vancouver for almost two years now. And from time to time I feel the need of a car. There are things and activities that one can’t do (or with difficulty) without a car: Big grocery shopping, trips to IKEA, trips to the local mountains, trips to Richmond :D
Owning a car when you don’t use it often (less than twice a week) can be very expensive. Not including the loan (if you don’t buy it cash) you have to pay for insurance (which is crazy in British Columbia), maintenance, parking, gas and of course you loose money with the depreciation of the vehicle. When you own a car you tend to consider yourself free but this freedom has a price. Usually car owners pay between $500 to $1000 a month (sometimes more, sometimes less depending on the car).

So for people who live in Vancouver, Canada there as far as I know two alternatives to owning a car:

They are both membership based and you have to pay a small setup-fee to join ($20 for co-op, $25 for Zipcar).

I listed the differences between the two options in the table below.

Zipcar Co-op
Cost to join
  • $25 application fee
  • $55 annual fee on the occasional driving plan. No annual fee on the extra value plans
  • $20 non-refundable registration fee
  • $500 refundable deposit. You get that back when you leave provided that you committed for at least 6 months. A 3% surcharge applies if you pay by credit card.
Joining process Both require a driving history and claims record from ICBC. Zipcar doesn’t require a BC Driver’s License. That means foreign licenses are accepted and depending on the country of origin a notarized English translation of your driving record from that country is required. The Co-op requires holders of foreign licenses to get their BC Driver’s License within a month after joining.
Pricing
  • Hourly rate from: $9.75
  • Daily rate from: $69

The rates depend on the time (weekday, weekend) and on the car you book.

If you are on the extra value plan you get 10% off on each booking.

Extra value plans involve a monthly commitment (50, 75, 125 or $250) and you get as much in driving credit + 10% off on each booking. On some plans you can rollover your credit to the following months.

150 km per day are included in each reservation. additional kilometer charges apply if you go over.

  • Hourly rate (flat rate): $2.50
  • Daily rate (flat rate): $30.00

Depending on your usage you get a monthly fee + kilometer charges

  • High usage (+251 km): $40 monthly fee, 18¢ per km driven
  • Moderate usage (81- 250 km): $15 monthly fee, 28¢ per km driven
  • Low usage (1- 81 km): $6.25 monthly fee, 38¢ per km driven
  • No usage (0 km): No charge

There is no surcharge for bigger vehicles, no surcharge on week-ends and the hourly rate doesn’t apply between 11 PM and 7 AM.

Gas Gas is included for both but Zipcar provides a gas card (only usable at Esso stations). The Co-op reimburses your gas expenses (they deduct gas expenses in your monthly bill)
Parking Parking is included for both and there are usually lots of cars in your neighborhood. For Co-op cars you are allowed to park in stalls that show “only with permit” in the city of Vancouver only
Access to cars An RFID card and gives you access to all the cars in the fleet during your booking. You scan it on the reader located on the windshield and you’re ready to roll. VERY convenient A fob has been recently introduced and unlocks the ignition. So same thing you scan your fob on the reader located on the windshield and it unlocks the driver’s door and the ignition. You still need to get the key from the lockbox at the back though. A lockbox key is provided along with a fob when you join. The cool thing is that if you forget something in the car you can always go back anytime and get it
Booking system
  • Online: Very well designed user interface
  • Mobile: A mobile version of the booking system. Very convenient if you need to extend your reservation
  • Phone: Automated: free. Assisted (with the help of a representative): A surcharge applies
  • Online: Poorly designed user interface
  • Phone
Insurance Insurance is included but you may have to pay a $500 deductible if you are in an at-fault (or no fault determined) accident. You can buy a damage waiver to decrease or eliminate the deductible (waivers are valid for a year). Insurance is included but you may have to pay a $500 deductible if you are in an at-fault accident. You can use your credit card Loss and Damage Waiver insurance to cover that.

The Co-op network now has a non-membership based offer comparable to Zipcar where they charge the car by the hour with a limit of 150 km per day + annual fee. More info here

A Zipcar member can use each and every car in the fleet everywhere Zipcar operates (many cities in the US and London, UK). Very convenient when traveling abroad. Co-op has an agreement with Victoria Car Share (Victoria, BC) and City Car Share (San Francisco, CA).

Zipcar and Co-op both allow you to cross the US-Canada border without any special clearance.

So who is the winner ? Well Zipcar is definitely more expensive than Co-op. I personally am a member of both but I use Co-op more often since it’s cheaper. I like the idea of being able to use cars in other cities and I also use Zipcar for longer periods of time (usually a day).


Pour ceux qui habitent au Québec ou à Paris il y a aussi plusieurs alternatives
- CommunAuto (Montréal/Québec/Gatineau/Sherbrooke)
- Caisse Commune, Carbox, mobizen, Okigo et Connect By Hertz (Paris)

My laser eye surgery experience

March 22nd, 2009

Laser image
48 hours ago I went through laser eye surgery on both of my eyes. Before that, I had never been able to do anything without my glasses. Not been able to see more than 3 feet away. I had tried several times to wear contact lenses on daily basis (I tried all of them including the extreme hydrophilic ones such as Extreme H2O, Acuvue moist, …) and even if I was able to sometimes tolerate them, it wasn’t always easy especially after wearing them for several hours. I work in front of a computer and in confined air-conditioned room all day. My eyes were irregularly too dry. It was nothing chronic but I remember getting allergies every once in a while due to contacts.

Glasses were fine and looked not bad on me but you can’t do much with your glasses on: your vision is very limited to the sides, you can’t watch TV while laying on the couch and first and foremost you can’t practice any sports.

So after a little bit of thinking, researching and talking to all those happy and satisfied people who had it done: I decided to go for it as it would probably relieve me from wearing contacts or glasses for a while. I am only 24 years old and my vision hasn’t significantly changed for the past 3 years. I’ve had the same correction on both eyes (-2.00). Now I am feeling that my left eye is a bit weaker but not by much. I know that my vision is most likely going to change (maybe a lot before I turn 30).
Of course my research got me onto these findings on the bad sides of the laser eye surgery: some terrible side effects such as increased dry eye problems leading to sensations of burning and pain, night vision problems (halos, hazes, stardusts…). Besides my mum, who is an experienced ophthalmologist back in France warned me about the procedure and was totally against it. She would always say: “why all surgeons who actually need vision correction never had the surgery done on themselves?” If you want to scare yourself before you have it done check out this website. It will make you think twice believe me!

A month ago I went to my free consultation at Clearly Lasik and after about an hour and a half I was told that I was a good candidate for all laser eye surgeries and there were three: Regular Lasik (with a blade)/PRK, Wavefront Custom View Lasik (with a blade)/PRK, Intralase Wavefront Custom View Lasik (bladeless) know in Europe as femtoseconds or Z-Lasik IIRC and has been around for the past 5 years or so.

I didn’t want to go cheap because I only have two eyes and they’re precious to me so I decided to take the more expensive one: Intralase Wavefront Custom View Lasik. That included lifetime enhancements (if I ever need to do it again) at the same clinic.

The procedure itself took less than 10 minutes for both eyes and was fairly painless. I remember feeling a slight pain when the surgeon lifted my left eye corneal flap but nothing huge. I remember not being able to see for a few seconds when that laser was reshaping my cornea and I remember smelling a bad odor of burnt hair when the laser was performing. Other than that nothing. When the operation was over, the Surgeon quickly checked my eyes and then sent me home. I remember him and his two technicians talking to me during the procedure but I also remember not saying much other than “OKs” here and there.
That same day, I didn’t do much but keep my eyes closed with protective sunglasses on.

It’s been 48 hours so far and what I am feeling right now is really close to what I used to feel when I had worn contact lenses for a while. Meaning sometimes it would feel nothing and sometimes it would feel pain. I try to keep my sunglasses on even indoors in dark areas because the air contact makes my eyes dryer and brings more pain I feel. I look like Agent Smith (i.e like an idiot) but who cares. My vision is definitely a lot better and I can see almost everything but I don’t know the numbers, I will have to check that next week.

To be honest I don’t know if I have made the right decision, it’s too early to tell anything. The only thing I know is that I caused permanent damage to my eyes as the flap that was created to perform the surgery will never ever heal completely and could be lifted by anybody even years from now. But that’s a sacrifice I am willing to make if it comes with clear vision without glasses/contacts.

Another procedure I could have done is the PRK procedure but I didn’t know much about it except that the healing time was longer and Lasik seemed to be the preferred procedure.
The PRK/Lasek procedures are older procedures that are now being replaced by Lasik. When you talk to most Surgeons they will tell you that the main difference between PRK/Lasek and Lasik is the healing time (a few hours for Lasik as opposed to a few days/weeks for PRK/Lasek). Actually the main difference is that in PRK/Lasek there is no flap creation as they operate directly on your cornea and that’s why it takes longer to recover. So your cornea will stay almost intact (close to what it was before surgery). This is very important because any trauma caused to your eyes will be the same had you done the PRK/Lasek surgery or not. So for athletic people who do a lot of contact sports such as martial arts, kick boxing, football, …PRK/Lasek are better alternatives but think about the healing time and the side effects as well (as they are the same and maybe worse than lasik side effects…).

I actually do a pretty violent martial art called Krav Maga but I didn’t know that PRK was preferred over Lasik for contact sports.
My optometrist said to me yesterday for my 24 hours post-op exam that if she had known that I was doing a martial art she would have told me to go for PRK but I forgot to mention it and she didn’t ask me either. Now I guess I have to give that up for a little while and maybe forever as it represents a lot of risks and I am not willing to lose my eyes yet.