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.

Evolution of Business

office-620822_1920

Change is constant and it isn’t surprising to know that it applies in the ever-changing world of technology and business. There was a time when business meant setting up shop at a location convenient to your target audience. Later on, with the introduction of Computers, and the magic of the Internet, we saw the birth of Online based business forums. We saw applications, and websites setup specifically to target the online audience, but the actual offices still worked up to an extent.

Then, with the introduction of portable computers, people were hooked to the online world, preferring to be connected to the internet whenever possible. By carrying laptops, because it helped them stay connected to their work, and it gave the business owners a chance to stay connected with their customers.

Businesses had a huge change as well. From traditional services, on-demand services took precedence. E-commerce sites provided the convenience that travelling long distances to shop did not. You could sit at home, browse online, and buy what you want, and it would be easily delivered to your door-step.

But we didn’t stop there, did we. Technology, and the ever-inquisitive human mind gave us the smart phone, and that is a maze in which we are still stuck in. The smart phone, as addicting as it may be, has given life to various small-time entrepreneurs, be it commercial, or social. Smart Phones meant no more carrying your heavy laptop around, and getting all the benefits and more, at the click on a button.

From connecting friends, to buying that electronic device on a flash sale, to booking a cab or even your flight, everything is now happening in a jiffy, at any time of the day or night. This is the beauty of Mobile Applications. These Applications now rule our day-to-day lives. Right from setting up multiple alarms a day to remind us of many things, to storing our list for grocery shopping later in the day, to reading the news on our way home, and switching on the torch light when there’s no current, Mobile Applications be it for any use, have taken up a big part of our lives, and will continue to do so.

 

Tips to Avoid Stage Fear

     Stage Fear is a common issue that every one of us face at some point in life. It could be during when we do a session or seminar or even when we have a job interview.

    We all talk in our day to day life to another person or a group of people.Then why do we get stage fear when we do a presentation? The answer is because in our daily lives we are being ourselves, we are not self conscious on what we talk with a friend/family. So why let other people bother us? We could suppress our stage fear with few changes to our mind set. I hope the following factors changes yours.

  1. Love your work
  2. Have confidence on yourself
  3. Start with a joke
  4. Acceptance of the worst
  5. Know what you are doing
  6. Just 5 minutes
  7. Be Punctual
  8. Take care of yourself
  9. Use your Imagination

And Last but not the least

  1. Don’t forget to breathe 😛

Love your work

      This is the most important part of avoiding your stage fear. Remember the time you were talking about a movie you just watched and loved or your favourite book? You would be feeling so overwhelmed with passion, that you forget about everything around you. If you could bring out this passion during your presentation. Then voila!!!! you’ll be surprised on how you pulled off a magical perfect speech.

Have confidence in yourself

      Hmmm confidence…. the thing we lack most during a speech, which makes us screw  our presentation. The best way to tackle this is by, encouraging yourself. And hey who can judge you better than yourself !! So boost up your confidence level and say ‘All is well’ 😉

Start with a joke

      People forget the important aspect of life when they are stressed out, LAUGHTER.

laugh

      So throw in a joke when you start a presentation. It would ease your fear and the mood of the audience . And you are up with a kick start to the presentation.

Acceptance of the worst

      Did you know that there is no such thing as a ‘Perfect Presentation’? Weird right? So why do we have to worry over it? Have a prior mindset that there are possibilities of mistakes. Even if you make mistakes, who cares? There’s always a next time. But be bold to accept your mistakes.

Know what you are doing

prepare

      Choose a topic which you are comfortable with, for the presentation. Prepare the content  beforehand( It’s not necessary to be as perfect as ‘Hermoine’ :P, but at least be ‘Harry’ and not ‘Ron’ 😉 , forgive my ‘Harry Potter’ reference ) . Knowing that you have done all your best to prepare will make your nerve calm down a bit.

Just 5 minutes

      Studies show that, the stage fear is at the peak during the first five minutes of the presentation. If you did a good job during this 5 minutes, then nothing can stop you from giving you best presentation ever.  You could go through this 5 minutes by interacting with the audience or starting off with a funny story. But don’t forget that you should never be critical of the audience.

Be Punctual

      Be at the venue at least 15 mins before the presentation, so that you could avoid last minute traffic or you could also socialise with the audience before the speech, you would make some friends and talking with friends never freaks us out right?

Take care of yourself

      Concentrate on keeping yourself fit for the presentation. A healthy body boosts up your confidence rate through the roof. Most importantly, eat a Banana.

banana

      Yeah, you heard me right!. Eat a banana before your presentation. Because eating something nutritious and not too filling will help with the butterflies in your stomach.

Use your imagination

      Remember the person who sat beside you in your kinder garden. The person sitting in the last row could be them or it couldn’t? But hey, if it helps you that someone you know is listening to you, won’t you feel better? So run wild with your imagination,it will help you reduce your fear.

Don’t forget to breathe

Yeah I know it’s silly

              .meditation

      But people when stressed, do forget to breathe. They just want to get the presentation to be over with as soon as possible and so they start reciting the summary they prepared with a fast pace. They think it will help with the stage fear. But actually it makes them worse. Taking deep, long breaths and going slow on the presentation is a much better way of avoiding the stage fear.

 

“The brave man is not he who does not feel afraid, but he who conquers that fear.”

                                                                                                                                   –Nelson Mandela

So as Mandela says, ‘Lets go conquer the fear ‘

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.