Android 8- Oreo!

milk-2006449_960_720

Oreo – Not just for your Taste buds anymore!

There has been a lot of hoopla for iOS 11 and the launch of iPhone 8 and iPhone X, and amidst all that, it almost feels like Oreo has drowned in a glass of milk! (Pun Intended). Well, we shall revive that for you in this article specifically for Android 8 – Oreo!

Android phones are the ones commonly used by most people around the world, and almost all the phones in the market. This has given a boost to App developers from all over to create innovative android Apps, and release them to the market.

“Powers, and Beyond” is how they are pitching the new version, and with the looks of it, it does seem pretty cool! With great features for users and developers alike, lets now have a quick look at some of our favourite additions that are a part of this yummy new release – Oreo!

Oreo is going to make your device twice as fast as it was. How? Well, they have increased the boot speed, making it 2 times faster, so as soon as you have powered up your mobile, you really don’t have to twiddle your thumbs.

Another issue most of us face is that of background processes that not only eat our internet, but also our battery. Well, worry not – Oreo is going to help minimize background activity of the Apps you don’t even use! Stealth Power, we say!

Notification Dots – something that iPhone users will be familiar with is now on Android. You will get a small notification on top of any App that will have one for you. It could be a new e-mail or a message on WhatsApp.

Another exciting new feature is that Google is now going to help you control the notification setup for each App individually. You can Snooze notifications for any App individually, instead of placing your mobile on silent!

Finally, we have super helpful Autofill API’s, while it has always been there due to third party Apps, it’s now been made easier by adding platform support to it.

We then have Adaptive Icons for Developers, this is enable cool and funky icons for all Apps they develop.

And at last, the most fun feature of all – an Addition of over 60 new Emojis! Yay!

So, while there were a few more additions, these are some of our picks. Let us know your favourite updates in the new release!

iOS 11 is here!

iOS 11 is here!

iOS 11 is here, and in its wake, its left a lot of cheers and excitement! While it was released yesterday for previous versions of the iPhone, the newbies iPhone 8 and iPhone X were out commercially on September 22 and November 3 worldwide (there’s still some speculation on the Worldwide part), and we couldn’t help but talk about a few features that we really liked!

If you are an iPhone user, then we’re sure you would have looked up this data already, but we’re sharing it nonetheless. iOS 11 will be available on the trio of new iPhones and be compatible with the following models of iPhone, iPad and iPod. The iPhone’s it supports are: 5s, 6, 6 Plus, 6s, 6s Plus, SE, 7, 7 Plus, 8, 8 Plus, X. It is also changing the way iPads are used, they are compatible with 5th generation (2017); Mini 2, 3 and 4; all Air models and all Pro Models. For the iPod Touch, it is available for the 6th generation (2015). If you own an iPhone 5 and iPhone 5c you will not be able to get iOS 11. And unfortunately, Apple is also dropping support for the 2012 iPad 4.

As you can see, it was pretty gracious of Apple to support most of its iPhone models, and iPads. So, even if you don’t want to spend all that money buying the expensive iPhone 8 and X, you can still experience the goodies they are providing with iOS 11.

So, in this article, we wanted to graze upon some of the new fun aspects that are a part of this release, and so, we will be talking about the Face ID and the Animoji in an upcoming article. For now, let us begin by talking about the awesome all new Command Centre amongst others.

The previous command centre was not worth all its trouble, or annoyance mainly because of the few options it provided. Well, with this one, it does not take up half the screen, but the entire screen and has a lot more options. You get the music control centre on the same screen, and to magnify any option, all you have to do is a long press and voila! Another great addition was the idea of making the options visible on this screen editable. So, you get to decide the options you want displayed on the Command Centre.

Screen Record! Move out of the way Screenshots, we have the all new standout Scree Record on iOS 11. When you want to share something and an image just won’t do, just send across a screen record and get the job done. This is one feature that we feel will be included on upcoming Android releases.

Finally, we wrap up this article by talking about the ‘Do Not Disturb While Driving’ function. This is one has both an upside and a downside. That is probably because of the way it gets activated. When your device detects a constant speed in which it is travelling in, this setting is automatically turned on, making your phone go to Silent mode automatically. If you are driving, well and good, you will not get distracted, but if you are a passenger, well there are a lot of chances for you to miss your calls!

These are a few options we found exciting for our day to day lives, there are so many more. If you find some other feature to be fun and exciting, let us know too!

Remembering the iOS 11 Launch

Remembering the iOS 11 LaunchApple launched its two new iPhones more than a few weeks ago, but they are still the talk of the town, more so because they’ve still caught everyone’s fascination. Be it the price, the look, or the new features, people simply cannot stop talking about it!

They’ve worked pretty hard at modernising these two entries, making them bigger and better, so much so that when one looks back at the first iPhone, or say even your iPhone 5, you are amazed by how far it has come. From wireless charging, to cash transactions simply done, these phones are pretty amazing!

So, for those of you who missed the launch, or just want to get back to seeing what exactly was done, or introduced, here is a quick insight.

The biggest introduction was probably the Face ID, which led to memes and appreciation alike! While it is available only for iPhone X, it is beautifully connected to Apple Pay as well, which is an amazing concept on its own.

The devices come in 2 colours, the quintessential Grey and the fancy Silver and of course, the gorgeous Gold! Another new addition is the use of the Charging Mat. While the technology is not new, as it was already thought of by the Genius Tesla, it was great of Apple to bring this tech back in a big way, because versions of this was already in the market. The mat charges the Apple Watch, iPhone and the AirPods – AirPower indeed! The iPhone 8 is said to have the highest quality video capture ever in a smartphone, with a brand-new chip called the A11 Bionic.

Now that we’re done with the iPhone, let’s get onto the next big fish of the Launch, the Apple Watch. This series uses an eSIM, instead of a normal SIM card and jut for the sake of fun, the Apple Watch gets new colour bands and watch face styles. The other new features or additions include a phone answering feature, WeChat support, a new processor, and Siri alert! Well, that is kinda awesome for a watch! It’s already gone on sale on the 22nd of September in 26 countries with the date for India not yet fixed.

Then came the introduction of Apple TV 4K, and it is touted to create a revolution in the world of TV’s!

Xamarin – An Introduction

 

Xamarin - An IntroductionThis Cross-Platform development tool is slowly capturing everyone’s attention and rightly so. Made for cross platform/ hybrid developers, Xamarin solves the issue of separate coding languages and UI paradigms to a great extent. With a common programming language like C# for developing apps for iOS, Android and Windows, this technology comes with its own set of elements that make the job easier for developers. In addition to all of this, Xamarin forms takes care of interface design for all three platforms. Let’s have a slightly deeper look into Xamarin’s main parts.

The main element of Xamarin is the coding language it endorses, C#.  This is an obvious advantage. Using a code base in one language improves code efficiency as well as improves dev time. Another major advantage is using familiar syntax and sophisticated features like Generics, LINQ and the Parallel Task Library.

Next in line is the Mono .NET framework. For those of you who are not sure what a Mono platform is, here is the textbook definition – Mono is a software platform designed to allow developers to easily create cross platform applications part of the .NET Foundation. Sponsored by Microsoft, Mono is an open source implementation of Microsoft’s .NET Framework based on the ECMA standards for C# and the Common Language Runtime.

Then comes the important element – The Compiler. This works differently for different platforms. As far as iOS and Android goes, the unused classes are stripped off during linking to reduce the App size. So, apart from that part, here is how it works differently. For iOS, C# is ahead-of-time (AOT) compiled to ARM assembly language. But there are limitations for iOS, as Apple does not allow runtime code generation on iOS.

For Android, C# is compiled to Intermediate Language and packaged with a combination of Mono VM and JIT. The application runs side-by-side with Java/ART (Android runtime) and interacts with the native types through JNI.

Alternatively, it becomes easier for Windows Apps to be used for iOS and Android platforms if Xamarin’s guidance is followed. For Windows, C# is compiled to IL and executed by the built-in runtime, and does not require Xamarin tools.

Xamarin is a wide field, with various nitty gritties that will help enhance cross platform development. While this article just touches upon the tip of the iceberg, we will delve more into Xamarin in the future.

 

Swift and Objective C

Swift and Objective CSwift has swiftly taken over our lives (Pun intended!). The fact that one does not have to go through the ordeal that is Objective C has got many people rejoicing. So much so, that according to a Stack Overflow survey, “77.6% developers around the globe preferred Swift over Objective C for iOS app development”.

With the introduction of OS X, Apple gave us a lot of new additions, with an all new Swift, the latter aiming to make developers lives easier. With the praise and love Swift is getting from so many quarters, one cannot help but wonder how it can almost overthrow Objective C which has been around since 1983! Well, we are going to talk about the positives of Swift, and some of the ways in which it is touted to be better/easier than Objective C.

Similar to newbies and industry bigshots like C#, C++, Java, Javascript and Python, Swift is very easy to read, and learn as it is similar to the English language, without any of the bulky syntax. It is easier to code as it employs string interpolation without needing any placeholder or token.

A major overhead while developing using Objective C was maintaining two files – one for interface and one for implementation. Though they are practically the same code, the developer is forced to make changes in both files. This is not the case with Swift, as there’s just one file, so easier to start and finish!

Next comes the issue of Pointers. While many C languages inclusive of objective C use Pointers, they are a security overhead, and also troublesome when one is trying to find bugs in the code. But Swift does not allow nil value, so when your code reaches a nil value, it automatically crashes, making it easy for the developer to locate bugs, giving a very clean code.

Finally, there is the case of easier compilation and memory management. Swift is built with the Low Level Virtual Machine (LLVM), a compiler that’s used by languages like Scala, Ruby, Python, C# and Go. The LLVM is faster and smarter than previous C compilers, so more workload is transferred from the programmer to Xcode and the compiler. When  it comes to Memory Management, Swift supports ARC across all APIs, and this stability means less time programmers have to spend focusing on memory management, as “memory leaks” will become obsolete.

Performance: Hybrid Apps Vs Native Apps

code-2620118_640

“While 79 percent of consumers would retry a mobile app only once or twice if it failed to work the first time, only 16 percent would give it more than two attempts. Poor mobile app experience is likely to discourage users from using an app again.” – Source

This is obviously true, mainly because it is something that we do too. With options available for so many On Demand services in the Mobile App world, customer satisfaction is everything. A customer wants things done in a jiffy, plus it has to be convenient too, and if your App is not giving them that, they move onto another App for a same/similar service.

As you know, an App can be Native and Cross-Platform (Hybrid), and while there are main fundamental differences between both, we will here, in this article discuss about the Performance of both Apps.

We have met businessmen and App developers who bat for both teams, we will lay out their reasons, and find out why they are happy with their Native or Hybrid Apps, performance wise.

As you may know, a Native App is one that is designed specifically for one type of Operating System – iOS, Android (We shall consider the majorly used Mobile OS for argument sake). While iOS uses Objective C and C as its programming language, Android uses Java.

With no grey areas, Native Apps are strictly for one type of phone(s), thereby making people hoping to cover one market release specific to their phones. Now, this is understandable, but when the common App players come into the frame, they have reasons to choose Native Apps too, and the main obvious reason they tell is Performance.

Agreed, an App is dependent on various features, be it Setting the location On, or opening the Camera or saving an image. When done on a Native App, these things are seamlessly done because the code does not have to go look for any requests anywhere. Everything is set up as soon as the App is installed. This seamless behaviour plus the beautiful co-ordination this App has with the rest of the Apps in the mobile phone result in an extremely satisfying user experience, which has always been the goal.

On the flipside, Hybrid App enthusiasts believe that these issues are things of the past. With newer, better and more advanced smartphones coming up in the market, the Hybrid App developers are breathing a sigh of relief. The new age mobile devices come with processors and accompanying hardware that are sometimes even better than Computers. So, they believe that the mere processing speed that the device will deliver will take care of any performance lapse a Hybrid App might give. They say that with clean, and efficient code, there might be no difference between both!

All of us have our opinions, and we know you might have one too! While arguments are a waste of time, we love discussions! So, please feel free to drop in a comment on what you feel, and let’s get started!

Apps for Business

freelancer-763730_640

Mobile Applications are easy, and provide a convenience that nothing else does. They help us get a lot of jobs done without moving an inch. And as humans are creatures of convenience, the world of Mobile apps comes with a tagline – The more, the merrier.

This concept is something that will help you, as a business owner to understand the market, improve your sales, to build a brand value, as well and increase your client base. But, as any smart business owner, you will have your doubts. There are innumerable apps available at the play store, and some even providing the same services that you are, so how do you make yours stand out? Well, we’ll take care of that.

First, let us tell you why you need a mobile App. Earlier, when people commuted, they either spoke to one another, or read a book. Now, they just browse the internet on their mobile phones. Now this could mean using the browser, but more than that, it could be listening to music on a mobile App, texting a friend through a mobile App, buying a pair of shoes, booking a cab from the bus stop to their doorstep, filling in their to-do list and even looking up a recipe for dinner – all on a mobile app!

This level of usage means, that almost every idea has a client base in the online world. So, as a business owner, you can improve your clientele without an expensive marketing gimmick, by providing the option of a mobile App.

A mobile app will ensure your presence in the customers minds when they want a service or product that they may require. It will make you more approachable, easily available, hence the more probable option to do business with. And if we go by statistics, then Enterprise mobile apps and services revenue is labelled to hit $430 million by 2021!

Squash Apps has been providing business owners with a custom made Mobile App to suit their business strategy, long term plan, as well as their client base. So, get in touch with us if you are looking to take your business to the next level, and be assured that your end product will not be one in many, but unique, and useful, for both your business as well as the customer.

AngularJs SEO with Prerender.io

Built a beautiful, snappy, user-friendly website using AngularJS, and now you want more users to start browsing it. But, AngularJS which fully embraces the asynchronous model creates problems for Google’s crawlers and this is how the google indexes an angularJs sites:

Angular Seo

Obviously, this is not what you want your users to view. Now what do we do?

What to do?

Thought a lot 🙄 but still no success???? 🙁

Nevermind 🙂 , here’s how to get your site to the top of the search results.

Lets start  by setting up your prerender server :

1.git clone https://github.com/prerender/prerender.git. Then cd Prerender, to go to the directory
2. npm install Instal module dependencies
3. node server.js Run the service (available nohup node server.js & so that it runs in the background)

Client Side: Follow Google’s Javascript crawling protocol with hashbang

For reference, the full protocol is here.

Google’s Javascript crawling protocol is meant for websites that render using Javascript or need to wait on AJAX calls to complete. If you follow Google’s protocol, Google will send a request to your server with a modified url so that you can return the static HTML version of the page rendered by prerender server. Here’s how:

If you use urls with #

Nothing after the hash in the url gets sent to your server. Since Javascript frameworks originally used the # as a routing mechanism, that’s the main reason why Google created this protocol.

Change your urls to #! instead of just using #.

angular.module('exampleApp').config([  
    '$locationProvider',
    function($locationProvider) {
        $locationProvider.hashPrefix('!');
    }
]);

Google looks for #! urls and then takes everything after the #! and adds it as a query parameter called _escaped_fragment_. That way, Google effectively fixes the problem of everything after the hash not being sent to your server.

Google finds urls like this:

http://www.example.com/#!/product/123

Google sends a request to your server like this:

http://www.example.com/?_escaped_fragment_=/product/123

, intercept the request on the nginx server like this (imagine the prerender server resides on port 3000 whereas your backend server on port 4000) :

server {
 listen 80;
 server_name www.example.com example.com;
 location ~* / {
   set $prerender 0;
   if ($http_user_agent ~* "baiduspider|
       twitterbot|facebookexternalhit|
       rogerbot|linkedinbot|embedly|
       quora link preview|showyoubot|
       outbrain|pinterest|slackbot") {
   set $prerender 1;
 }
 if ($args ~ "_escaped_fragment_") {
   set $prerender 1;
 }
 if ($uri ~ "\.(js|css|xml|less|png|jpg
     |jpeg|gif|pdf|doc|txt|ico|rss|zip|
     mp3|rar|exe|wmv|doc|avi|ppt|mpg|
     mpeg|tif|wav|mov|psd|ai|xls|mp4|m4a|
     swf|dat|dmg|iso|flv|m4v|torrent)") {
   set $prerender 0;
 }
 if ($prerender = 1) {
  rewrite .*/$scheme://$host$request_uri?break;
  proxy_pass http://localhost:3000;
 }
 if ($prerender = 0) {
   proxy_pass http://localhost:4000;
 }
}

Thats it!

SEO issue solved

Now you’re well on your way to lots of new users, courtesy of the search engines! Good luck  😉

NodeJs Essentials: How to restart your nodeJs server programmatically in the event of a failure

You are excited about your new found love for NodeJs and you start creating an application. You have some REST apis wired up and you are all set to change the world! But for some reason, you have some unhandled error in your code and your nodeJs server crashes! Now you got to restart it to make sure it stays up. Ever crossed this scenario? If so, this is for you.

To demonstrate this, let’s look at the below scenario


http.createServer(function (request, response) {
console.log('Ready to accept request');
response.writeHead(200, {
'Content-Type': 'text/plain',
'Access-Control-Allow-Origin' : '*'
});
response.end('Hello World\n');
}).listen(1337);

This is a very simple http server that sends ‘Hello World’ as a response to the requester. To run this program,

  • Save the code above to a file (e.g. hello-world.js)
  • Go to terminal and locate the file. Run node hello-world.js
  • Access ‘http://localhost:1337’ to see the response on your browser/REST client like below
    NodeJs hello world http server

What a happy world!

Your nodeJs program worked!

Now all is fine, until there is an error in your code and your app crashes! Lets simulate this by the below code. Notice, how I am trying to access a property of variable ‘i’ which is not defined.

var http = require('http');
http.createServer(function (request, response) {
console.log('Ready to accept request');
// This line below is going to break your server!
var j = i.someProperty;
response.writeHead(200, {
'Content-Type': 'text/plain',
'Access-Control-Allow-Origin' : '*'
});
response.end('Hello World\n');
}).listen(1337);

Run this code, and hit the http://localhost:1337 url and you will see that the server fails with the below message.

ReferenceError: n is not defined
at Server. (/Users/srijithradhakrishnan/Desktop/httpServer.js:5:17)
at emitTwo (events.js:106:13)
at Server.emit (events.js:191:7)
at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:543:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:105:23)

So, how do we recover from a failure like this and keep the server running? For this, we could use the cluster module from nodeJs. Here is how it could be used.


var http = require('http');
var cluster = require('cluster');
// The master's job to spawn workers initially and when they die
if (cluster.isMaster) {
// Get the number of processor cores
var cpuCount = require('os').cpus().length;

// Create a worker for each CPU
for (var i = 0; i < cpuCount; i += 1) { cluster.fork(); } // When a worker exits, fork a new one cluster.on('exit', function(worker) { console.log('Worker %d died', worker.id); cluster.fork(); }); } else if (cluster.isWorker) { // The real work here for the worker http.createServer(function (request, response) { console.log('Ready to accept request'); // This will cause the server to crash var i = n.start; response.writeHead(200, { 'Content-Type': 'text/plain', 'Access-Control-Allow-Origin' : '*' }); response.end('Hello World\n'); }).listen(1337); // Exit the process when there is an uncaught exception console.log('Worker %d running!', cluster.worker.id); process.on('uncaughtException', function() { console.log('Handled the exception here'); process.exit(1); }); }

  • Now, run the code.
  • See that the master has spawned as many workers are there are cores in your cpu. So if you have a four code CPU, you should see 4 workers spawned!
  • hit the 'hello world' api, you would see that one of the workers died but was respawned again by the master.

Thus your nodeJs server can live on for eternity!

(ok that was too much, but you get the point!)

Overview of Amazon Lambda

Before we start with amazon lambda, what all things do we need to do in the production env to run our service.
1) We setup a machine ( say a VM), with certain configurations like os, ram, space etc.
2) You setup a server there.
3) You deploy your app.
4) You start the server.

Now your application is live and ready to serve requests, but what happens when the number of requests increase from few hundred to thousands per seconds, you server begins to blow up!!!!!.
What do you do next? Yes!!!, Scale!!!!.
You will probably repeat all the above steps again to maybe start a new server. Then configure a load Balancer to route the requests to the servers.
This is really painful.

Amazon Lambda can take care of lot of things which I mentioned above.

So, what is Amazon Lambda?
Amazon Lambda is a service which runs your code that you upload to the AWS Lambda infrastructure. AWS lambda infrastructure takes care of everything, managing servers, OS maintenance, Scaling, logging etc.

When does your code run?
Amazon lambda runs your code in response to
1) events that occur at different event sources, e.g adding or deleting object in S3 or some change in DynamoDB.
2) http requests.

What languages does it support?
Node.js, Java, Python.

So as I mentioned above the lambda function is run in response to events (like adding, deleting updating etc) that occur in various event sources (Amazon s3, Amazon DynamoDB) etc. So the event based execution can be done using the Push or the Pull model.
Pull Model: Amazon lambda (your code) polls the event source(e.g S3) to check for the occurrence of the event. So the association of the lambda function (your code) to the event source is maintained at the Lambda side
Push Model: The event source has the information about the lambda function, and calls the function when the event occurs.

Using https: You can also invoke your lambda code using the https request. When you send an HTTPS request to the API endpoint, the Amazon API Gateway service invokes the corresponding Lambda function. see http://aws.amazon.com/api-gateway/

We will basically talk about writing lambda in Node.js.
Basic Components of Lambda:
Handler function: This function is the starting point of your lambda function. In node you make this function available to the lambda infrastructure using the typical exports keyword.

e.g:
exports.myHandler = function(event, context, callback) {
...
}

Parameters in the handler function:
1) event: using this parameter event data is passed to the handler e.g S3 may pass the object added in bucket for processing.
2) context: using this parameter you get the information about the timeout for your lambda, the log streams associated with your lambda etc.
3) callback: this is optional and used to send information to the caller. It has the typical callback format: callback( <error>, <success object>).

Following is a image showing the triggering of lambda expression on image upload in S3, and then resizing the image and storing it in other S3 bucket:
lambda_image_thumbnail_creation
image describing the workflow is taken from AWS Documentation

This is the basics of Amazon lambda. To get started with your first lambda function visit http://docs.aws.amazon.com/lambda/latest/dg/getting-started.html.