Tuesday, November 25, 2014

A pretty good deal

Playing around with my Amazon affiliate program.....
ASUS Transformer Pad TF103CX-A1-BK 10.1-Inch 16 GB Tablet (Black)

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?