Monday, August 27, 2018

Where is that server?

I was tying to find the geo location of a few DNS IPs that we use for our proxy server today, and stumbled upon these two sites: https://tools.keycdn.com/geo and https://ipstack.com

So just out of curiosity I decided to check some Indian (and India related) sites and their geo locations. The most surprising one for me was Paytm and Flipkart. While the later seem to be hosted in India, Paytm seem to be hosted on AWS in Singapore. Of the banks: the HDFC seem to be at odds to use Cloudflare hosting from USA. With GOI (hopefully soon) enacting the DEPA (Data Empowerment and Protection Architecture), many of these sites would need to move with in India, this includes some which I am directly associated with. Also despite what some Chinese mobile companies want you to believe that their user data is stored only in India / Singapore (which may be true), their IP address location seem to indicate a different story. One more fun: google.co.in points to a server in USA.

Here are more:



























Sunday, August 26, 2018

A quick trip to my alma mater: Pune University

I had a quick visit to my alma mater the PU (now SPPU). I had been visiting the campus after quite a long gap, and more so I was going in monsoon time. A time when the campus is lush green and as always pleasant than the rest of city. So I was surprised to find that the British era main building has been mostly renovated and looked great again.


And one who has been in PU for even a short graduation course cannot forget the great old tree - the place where multiple generation of students relaxed, studied, chilled and romanced. I always make it a point to walk though this tree every time I visit the PU campus. The tree is getting old, a branch was completely rotten, but it still stands still as a magnificent caretaker of numerous seekers of knowledge who folk to this Oxford of the east. 






Saturday, August 25, 2018

Odd tech trials #1

I use a lot of tech. And more often that not, I use them in ways that a typical user may not really use the tech. Nor it is the way tech companies design their products to be used. Here are some odd experiments I am currently running:

1) Using a Windows desktop PC with out a mouse. I have almost a decade old machine, of which internals have been upgraded over time. About 5 years ago (around the time Windows 8 was released), I had also bought a touch screen monitor, but seldom use the "touch" part of it. Few weeks ago, I decided to give up on my old wired mouse and keyboard in leu of a wireless keyboard I had got for an iPad (but which I found no use of). Now, I didn't have wireless mouse, so I decided to just rely on using the touch screen. So far the experiment has been going great. But these days, I use my desktop PC a lot less as I am away from home most of the time. (PS: this post is being written on my desktop PC).

2) Using an Android phone without Google account. I have been using Oppo A3s as my secondary phone for a while now. A week ago, however, I was getting increasingly upset over the way Google was tracking my movements. Yes, I could shutoff the tracking options, but then I decided to nuke the phone and use it without any Google account. But without a Google account on the phone there is no way to download apps from the Play Store. Being an Oppo phone, however, there was a "Oppo Store" where you could install most of the popular apps on the "Play Store", and the Oppo store didn't need you to setup an account or anything, but it indicated that it would constantly send "usage information" to "improve user experience". Something I have ZERO interest in, and of-course something that raises my inner eyebrows. So I nuked the phone again and set it up with out anything, disabling and removing everything possible to the bare minimum. But I needed two apps (one a popular messaging app and another an apartment security app) - for both of these I found a trusted source to get the APK and side load them on to the phone. As of now things are going fine. I don't recommend people doing this, but one can pretty much have a locked down phone (android), if one really wants it that way.

3) Using an Android phone just to take photos. I had been reviewing the so called phone called "Kodak Ektra". Now even though you can make phone calls using this "phone", it is very much a camera in all ergonomics sense. I tried to use it as my secondary phone but I just couldn't. So next I nuked this phone and removed all the apps (including phone and messages) except the camera app, the Google Photos app and Snapseed. Now I have a "smart camera" - that has only one function : take photos, on device editing (using the fantastic Snapseed), and backup to Google Photos over a Wi-Fi connection. Coming to think of it sounds pretty cool. I am just wondering, why have companies not yet come up with camera products that would offer this very limited and focused function: take photos, offer on device editing, and backup on cloud storage. I definitely think there is a sizeable marker for this device - and I already have a neat prototype of this ;)

Friday, August 24, 2018

Playing with OpenCV : dynamic magnification



I have been playing around with OpenCV (https://docs.opencv.org/3.3.0/index.html) on Android quite a bit these days. While I am using OpenCV for image processing and image recognition work (using caffe bridge), I wanted to implement a UX scenario with dynamic magnification when a user is interacting with an image. An example of this UX is seen below:



You can see this kind of UX on iOS when trying to select a text. This is the equivalent for selecting a part of the image. After trying out a bit, I figured we could do with some simple lines of code as follows:

  Mat img = ...; // the source image is read into this Mat
 int sz = .. ; // size of zoomed area in pixels
 int sf = 2 ;  // the scale factor
 int scaledFactor = sz * sf; // this would be the total width of the zoomed area            
  int mxX =  mnX + scaledFactor;
 int mxY =  mnY + scaledFactor;

 // the centre of the circle depicting the zoom
 Point circleCenter = new Point((mxX-mnX)/2, (mxY-mnY)/2);

 // the source rectangle 
 Rect rect = new Rect(mnHX, mnHY, sz, sz);
 // the scaled rectangle 
 Rect scaledRect = new Rect(mnX, mnY, scaledFactor, scaledFactor);
 Mat roiFrame = new Mat(img, rect);  // get the are of interest to magnify 
 Mat scaledFrame = new Mat(roiFrame.rows()*sf, roiFrame.cols()*sf, img.type());
 Mat circleMask = new Mat(roiFrame.rows()*sf, roiFrame.cols()*sf, img.type());
 // create a circular mask 
 rectangle(circleMask, new Point(0, 0), new Point(scaledFactor, scaledFactor), BLACK, -1);
 circle(circleMask, circleCenter, sz, WHITE, -1);
 // zoom the rectangular area
 resize(roiFrame, scaledFrame, new Size(), sf, sf, INTER_LINEAR);
 // now copy the zoomed area into the source image applying the circular mask 
 scaledFrame.copyTo(img.submat(scaledRect), circleMask);
 // indicative circle
 circle(img, new Point((mxX+mnX)/2, (mxY+mnY)/2), sz, GREEN, 1);

 // cleanup ..
 roiFrame.release();
 scaledFrame.release();
 circleMask.release();

The above code is essentially a fast way to get a source rectangular area on the screen where a user is interacting, scale that area to a factor as needed, then apply a circular mask to give an effect of magnifying glass, then copy this back on to the source image so that it overlays to give a smooth UX with dynamic magnification when selecting a portion of the image.