Saturday, April 30, 2016

What is TensorFlow?


TensorFlow™ is an open source software library for numerical computation using data flow graphs. Nodes in the graph represent mathematical operations, while the graph edges represent the multidimensional data arrays (tensors) communicated between them. 

The flexible architecture allows you to deploy computation to one or more CPUs or GPUs in a desktop, server, or mobile device with a single API. TensorFlow was originally developed by researchers and engineers working on the Google Brain Team within Google's Machine Intelligence research organization for the purposes of conducting machine learning and deep neural networks research, but the system is general enough to be applicable in a wide variety of other domains as well.

references:
https://www.tensorflow.org/

Machine Learning Google Products


Google Cloud Machine Learning provides modern machine learning services, with pre-trained models and a platform to generate one's own tailored models. Google's neural net-based ML platform has better training performance and increased accuracy compared to other large scale deep learning systems.  Major Google applications use Cloud Machine Learning, including Photos (image search), the Google app (voice search), Translate, and Inbox (Smart Reply). 

Google Cloud Machine Learning Platform makes it easy for developer to build accurate, large scale machine learning models in a short amount of time. It is a portable, fully managed and integrated with other Google Cloud Data platform products such as Google Cloud Storage or Google BigQuery so you can easily train your models.

Google Cloud Vision API enables app to understand the content of an image by encapsulating powerful machine learning models in an easy to use REST API. It quickly classifies images into thousands of categories (e.g., "sailboat", "Eiffel Tower"), detects individual objects and faces within images, and finds and reads printed words contained within images.

Google Cloud Speech API enables app to convert audio to text by applying neural network models in an easy to use API. The API recognizes over 80 languages and variants, to support your global user base. You can transcribe the text of users dictating to an application’s microphone or enable command-and-control through voice among many other use cases.

references:
https://cloud.google.com/products/machine-learning/?utm_source=newsletter&utm_medium=email&utm_campaign=2016-April-GCP-newsletter-en

Connect Android to TV: Wireless Few options


 There’s little to beat the wow factor associated with beaming video straight from a tablet a TV. The good thing about Android is that there’s more than one way to do it. Miracast is a wireless standard that creates an ad-hoc network between two devices, typically your tablet and a set-top box which supports Miracast.

        An increasing number of TVs support Miracast without the need for extra hardware. Miracast uses H.264 for video transmission, which means efficient compression and decent, full HD picture quality. Better yet, Miracast supports Digital Rights Management (DRM), which means services such as iPlayer and YouTube can be streamed to a TV. Not all services work, though – see Playing Back Video below. Android devices running Android 4.2 support Miracast.

            An alternative is Google’s Chromecast. This inexpensive £30 ‘dongle’ plugs into a spare HDMI port on your TV and connects to your wireless network. Chromecast support is burgeoning, which means content from services such as iPlayer, Netflix, BT Sport and others can be played with the Chromecast dongle doing all the legwork instead of your tablet, and that’s good news for battery life.

                As of July 2014, it’s possible to use Chromecast to mirror the display on your Android device, allowing you to hit play on a tablet and have (non DRM-protected) video start playing on your TV. The same goes for anything the screen can display, including apps, games and photos.

references:
http://www.pcadvisor.co.uk/how-to/google-android/how-connect-android-tv-summary-3533870/

What is MHL?

MHL is an innovative technology that fundamentally changes the way we work and play. Transform your smartphone into a home theater system and stream your favorite TV channels, movies, and home videos in high-definition. Experience the music you love with immersive surround sound. Play mobile games on the big screen, while charging your phone or even using it as a controller.

Some of the features are:

PLUG & PLAY
Power up while you level up with MHL! Play your mobile games on the big screen with no lag, while charging your phone at the same time. MHL makes gaming experiences more interactive and fun by transforming your mobile device into a game console or controller. The next stage of mobile gaming has arrived. MHL — wired for power and performance.

FAST CHARGING
MHL is a wired solution where your TV can charge your mobile device up to 40W . So what’s with the wire? Current wireless approaches consume a lot of power and can cause noticeable lag. MHL is the missing link. It’s time to worry less about your battery draining and more about the game at hand.

HIGH RESOLUTION
When it comes to visual entertainment, details make all the difference in the world. High resolution video turns dreams into reality. MHL currently supports up to 8K video resolution, allowing you to see your content the way it was meant to be seen.

IMMERSIVE AUDIO
Do you have music on your smartphone that you want to share with friends? Sometimes hearing is believing. MHL delivers enhanced audio through its support of Dolby® Atmos and DTS:X™. Get lost in the sounds you love with MHL.


REMOTE CONTROL
Mobile entertainment shouldn’t be a chore. It’s time to kick back and relax! Once your smartphone or tablet is connected with MHL, use your TV remote to navigate your favorite apps, games, music, videos, and photos on the big screen.

NO LAG
Don’t let a bad connection slow you down. Lag can ruin even the best game. MHL offers a zero-lag, seamless connection from mobile devices to TVs. At MHL, connectivity is our universal language.


references:

iOS how pass Context Data between Objective C and C code in networking

In the below example, the NetworkRequester is a class which is in Objective C needs to pass in the CTX information 
in the initiateRequest method, the makeRequest function passes the self references as the context data. 

Now in the makeRequest method, using the CFStreamClientContext CTX = { 1, ctxData, NULL, NULL, NULL };
it sets the context data to the stream so that when readCallBack( called back, the data will be present. 

@implementation NetworkRequester

@synthesize requestListener;

-(void) initiateRequest
{
    testFinished = 0;
    NSLog(@"Makign network request call");
    makeRequest("http://s3.amazonaws.com/test/samplefiles/est_4mb.txt",(__bridge void *)(self));
}

int makeRequest(const char *requestURL, void* ctxData)
{
    NSLog(@"totalRead starting make request %ld",(long)totalRead);
    CFReadStreamRef readStream;
    CFHTTPMessageRef request;
    CFStreamClientContext CTX = { 1, ctxData, NULL, NULL, NULL };
    
    NSString* requestURLString = [ [ NSString alloc ] initWithCString:requestURL ];
    NSURL *url = [ NSURL URLWithString: requestURLString ];
    
    CFStringRef requestMessage = CFSTR("");
    
    request = CFHTTPMessageCreateRequest(kCFAllocatorDefault, CFSTR("GET"),
                                         (__bridge CFURLRef) url, kCFHTTPVersion1_1);
    if (!request) {
        return -1;
    }
    CFHTTPMessageSetBody(request, (CFDataRef) requestMessage);
    readStream = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, request);
    
    CFRelease(request);
    
    if (!readStream) {
        return -1;
    }
    
    if (!CFReadStreamSetClient(readStream, kCFStreamEventOpenCompleted |
                               kCFStreamEventHasBytesAvailable |
                               kCFStreamEventEndEncountered |
                               kCFStreamEventErrorOccurred,
                               readCallBack, &CTX))
    {
        CFRelease(readStream);
        return -1;
    }




void readCallBack(
                  CFReadStreamRef stream,
                  CFStreamEventType eventType,
                  void *clientCallBackInfo)
{
    UInt8 buffer[204800];
    CFIndex bytes_recvd = 0;
    NetworkRequester* requester = (__bridge NetworkRequester*)clientCallBackInfo;
    

NOW 



references:

What is CDN?

The Wikipedia entry for CDN states: “A content delivery network or content distribution network (CDN) is a large distributed system of servers deployed in multiple data centers across the Internet. The goal of a CDN is to serve content to end-users with high availability and high performance. CDNs serve a large fraction of the Internet content today, including web objects (text, graphics and scripts), downloadable objects (media files, software, documents), applications (e-commerce, portals), live streaming media, on-demand streaming media, and social networks.”

Additional hops mean more time to render data from a request on the user’s browser. The speed of delivery is also constrained by the slowest network in the chain. The solution is a CDN that places servers around the world and, depending on where the end user is located, serves the user with data from the closest or most appropriate server. CDNs reduce the number of hops needed to handle a request. The difference is shown in the following figures.

CDNs focus on improving performance of web page delivery. CDNs like the Akamai CDN support progressive downloads, which optimizes delivery of digital assets such as web page images. CDN nodes and servers are deployed in multiple locations around the globe over multiple Internet backbones. These nodes cooperate with each other to satisfy data requests by end users, transparently moving content to optimize the delivery process. The larger the size and scale of a CDN’s Edge Network deployments, the better the CDN.



references:

Android - animation in Image View

The goal was to create an animation effect of fading one image and then other appear. Below code and settings could do this.

ImageView view = (ImageView) findViewById(R.id.slide_show_image_view);
    if (view != null) {
        Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade);
        view.startAnimation(animation);
        imgView.setImageBitmap(bitmapCache);

    }

This required the anim file like this below 
  
    "1.0" encoding="utf-8"?
    "http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
    
   
android:fromAlpha="0"
android:toAlpha="1"
android:duration="2000"
   
    
   
android:startOffset="8000"
android:fromAlpha="1"
android:toAlpha="0"
android:duration="2000"
   
    
    

It is important to keep the animation durations right so that it gives good efect. 

references: