Wednesday, August 20, 2014

Doing a setsockopt in Go

Sorry, this is in the wrong blog, but I don't have one for Go/Golang.

Anyway, wanted to do a setsockopt() in Go on a socket I had created. There were a few posts on this, but none that worked too well for me, so here is what I did. Hope others can benefit from it.

Want to thank Rick (Richard Spillane) for his suggestions on introspection in Go.

In my case, I wanted to bind a socket I had created to a particular interface. Here is the code:

func bindToIf(conn net.Conn, interfaceName string) {
        ptrVal := reflect.ValueOf(conn)
        val := reflect.Indirect(ptrVal)
        //next line will get you the net.netFD
        fdmember := val.FieldByName("fd")
        val1 := reflect.Indirect(fdmember)                                   
        netFdPtr := val1.FieldByName("sysfd")                                           
        fd := int(netFdPtr.Int())
        //fd now has the actual fd for the socket
        err := syscall.SetsockoptString(fd, syscall.SOL_SOCKET,
                    syscall.SO_BINDTODEVICE, interfaceName)
        if err != nil {
            log.Fatal(err)
        }
}


I pulled this code out from some other code, so there might be some formatting errors, but this does work with go 1.2.1 on a Linux machine.



Friday, June 27, 2014

Sub-$100 Android phones

There have recently (post Google IO 2014) been a spate of articles about Google announcing a good sub $100 quality Android phone.

I can't quite understand what the big hoopla is about. The Motorola E is a Rs. 7000 (<$120) phone that has all the features Google is promising - 4.5" screen, dual sim, FM radio, external flash support, etc.

I just got 2 for a couple of people. Want a few of those features my Nexus 5!

Great job Motorola!

Saturday, April 19, 2014

What SmartPhones really need

Google has come out with a pretty cool idea with Project Ara, where you can assemble your phone by picking and choosing from various options.

A set of people have also designed some interesting dongles that plug into iPhone/Android phones. But all of these stick out of the device, because of the way sockets are built

What I would really love to see in smartphones, is for a phone to have 3-5 sockets that exist under the phone. Sockets would allow dongles to have a certain height and still fit snugly into the phone. This would allow me as a user to choose multiple dongles, but not have them stick out of the phone/break off easily, but still allow me to customize my phone.

Any takers?

Sunday, March 16, 2014

Arvind Kejriwal - Long Term Impact

Apologies to anyone who comes to this blog because it contains stuff about Android. This article is about Arvind Kejriwal (AK) and politics in India.

I have been tracking AK for some time now - ever since he started the agitation for the Jan Lokpal Bill and have followed him through the process of forming a party, contesting elections in Delhi, becoming Chief Minister, resigning in 49 days and now contesting the Lok Sabha elections of 2014.

As I have mentioned earlier, I have been pretty impressed by AK. His willingness to leave a cushy job in the Revenue Service, struggle against graft and corruption on the streets (without much support), his political savvy, his strong principled anti-corruption stand and very importantly, his clarity of thoughts about what a good government needs to do and his ability to make a lot of that happen - despite the Indian bureaucracy.

This essay is not about that. It is about the huge long term impact that AK can have on politics throughout the developing world (and even the developed world).

Looking at politics both in the US and India, I had pretty much reached the conclusion that politics and elections always need a lot of money. So expecting the industrialists to buy influence by funding elections was the best we could get. At least in India, AK is showing us that people care enough about corruption, that they are willing to fund a party without any expectations of special favors. Also, that a campaign can be run with relatively little money.

This, I believe, is the much bigger impact that AK can have on politics in the developing world. The main thing he needs to do is maintain his momentum and not get crushed by the pressures being applied on him.

Thoughts?

Sunday, October 20, 2013

A depressing article about the dark side of Google

A rather depressing article about how Google is tightening its grip on Android - http://arstechnica.com/gadgets/2013/10/googles-iron-grip-on-android-controlling-open-source-by-any-means-necessary/

Excellent (and disheartening) analysis.

Friday, August 9, 2013

Great Google Reader Alternative

Today is kind of a depressing day. I actually had to pay money for a web application! For those who know me, this goes waaaaay against my grain :-)

Anyway, I used to be a HUGE user of Google Reader. Have been looking for a good replacement. Tried most things that people recommended. Thought I would settle on The Old Reader, but their site is pretty slow (even after a recent move to the US, which they just completed). They also seem to be slow in getting updates on various feeds.

I had been trying Bazqux for some time. Liked the reader a lot, but hated the idea of needing to pay for something on the net :-)

Anyway, have finally caved and paid my dues. The software is excellent. I am happy to recommend is very strongly.

P.S. Actually, BQ is pretty cheap - they let you choose your price - $9-$29 per year. So really, I have no business complaining about the charge at all.


Monday, June 10, 2013

iOS 7 - Apple trying to catch up with Android?


While watching the keynote at the Apple WWDC today, I got a huge feeling of deja vu. A lot of the "new" features were things that were already available in Android. However, now that Apple has them in iOS, I guess they are easier to use/more natural :-)

This article summarizes how iOS 7 is doing what Jelly Bean has been doing for a few months now (some might have come before JB, but I don't remember which):

http://www.droid-life.com/2013/06/10/ios7-vs-android-a-quick-comparison-after-the-wwdc-keynote/

Thoughts?

Saturday, May 18, 2013

4 more months to a new Kindle (eBook reader)!

I have been in love with my Kindle Paperwhite ever since I got it! Now that I have a Moko cover, I am even more in love!

Counting the days to the next version of the Kindle - wonder what cool features it will contain!

I do have my own wishlist. Here it is:
- Want a quicker/faster way of turning off WiFi (don't like needing to go to Setting and then needing to come back)
- Would love to see Amazon adopt Android as a platform for the eBook Kindles too. Will encourage more people to develop apps for it
- I think I wouldn't mind sound an a built-in eBook reader. Even if I don't ever use it, it shows the product off very well :-)
- I would like page turning to be faster (not sure if this is a processor or screen issue)
- Some magical way to increase my reading speed. All that has happened since the Kindle came out, is my reading backlog has grown enormously!

Google Play Services (and how Google just brilliantly scr*wed Amazon, etc.

In Google IO 2013, Google just announced Google Play Services, which is automatically distributes to all phones running Google Play.

What they didn't announce very loudly, is they just scr*wed all the folks who have branched off Android without working with Google. This definitely includes Amazon. It also includes manufacturers who run AOSP without Google Apps (i.e. without Google's blessings).

"How?", you may ask. Well, all apps that use any of these new Google Play Services, won't run on those devices (since they don't have Google Play or any of the Google Play Services). While this is currently a very small percentage of all apps today, that won't be true in another 6 months.

Brilliant move, Google!

Wednesday, May 15, 2013

Google+ Overtakes Facebook!

Ok guys, you heard it here first. Within 12 months, Google+ will have a lot more active users, simply because they will start counting all Android users, Google Play users as Google+ users.....

Facebook, here comes Google+!

Edit (a few hours later): Sorry, I should have given more context. I was just listening to the Google I/O keynote. Google has added Google+ login APIs. While this is similar to FaceBooks ability for people to login to FB and use that ID everywhere, since Google owns Android, they can provide app owners some more benefits - e.g. prompt the user to download an app.... Anyway, soon, it will require some work for Android users to not be on Google+. Given the growth of Android (900M+ users today), there will soon be more Google+ active accounts than active FB accounts (IMHO).


Sunday, January 6, 2013

Privacy Policy for the International Dialer App

Looks like Google wants me to publish a privacy policy with the app I wrote quite some time ago. The app allows you to dial a calling card number automatically when calling international numbers.

Here goes:

This app as it currently stands doesn't send any of your data to any web site (given that I am writing this policy on my blog, you might be able to guess that I don't have a web site to store your information :-) ). So anything that is on your phone, stays on your phone.

As I said in my writeup on the app, happy to ship people sources to the app itself.

Enjoy!

Ambarish

Friday, December 14, 2012

Nexus 4

Just got my Nexus 4 a couple of days ago. I am in love with the device. The screen is beautiful and the speed is awesome!

I got the 16GB version, but think that was actually overkill!

Love the idea of a relatively cheap phone that isn't bound to any stupid carrier. Expect to get onto one of the prepaid plans when I get back from India - pay around $45 per month for effectively unlimited voice, text and data. Expect that I will go with one of the MVNOs, but if TMo get's it's act together might get a plan from them - I do like their customer service (unlike AT&T or Verizon).

Back to my Nexus 4. I have been using it as a wifi-only device right now, because I don't have a micro-SIM that I can use. Will have more of an opinion on the battery life, data speeds when I get to play with that part of things.....

YotaPhone

Just saw a video of the YotaPhone. Had originally been excited about the e-Ink screen, but I think they have done it wrong.

What I have been hoping/waiting for, is for someone to create a phone with a Pixel Qi screen. Haven't actually played with the screen, but like the idea of a screen that can act as either an LCD or an eInk display.


Tuesday, December 4, 2012

Getting the latest version of Android on your device

I just saw a post, which talks about why most people won't ever get the latest version of Android on their phones.

All the observations made are correct. However, when you check out the folks at Cyanogenmod, you see guys supporting all kinds of devices - for free.

Wonder if phone manufacturers should just outsource their device OS support business to Cyanogenmod and let them take care of the porting. Give CM a bunch of free devices and pay them around $10K per major release of Android ported within 1 month of the sources being released....

Tuesday, October 9, 2012

Yikes! What's up with Passbook!

Just read an article about the adoption rate of Passbook!

Don't know if this is another thing that Apple figured out that people hadn't realized they needed or whether it is being adopted by people because Apple created it....

Wow again!