Designing and animating basic SVG (Part 1)

SVG stands for Scalable Vector Graphics and is used for vector-based graphics in XML format. What stands out the most about SVGs is that every element included in the SVG files can be manipulated in some way and the graphics do not lose their quality upon any sort of manipulation. Furthermore, it is also a W3C recommendation which indicates that a specification is stable, contributes to Web interoperability, and has been reviewed by the W3C Membership, who favour the widespread adoption.

Since I was creating a portfolio website from scratch I decided to learn how to animate SVG and create my own animation using it. This post will be detail of the complete creation process of the animated SVG which will be used the center of of the website on the first page.

As the portfolio will follow a minimalistic design, one way in which it could really pop-up will be through the use of geometrical shapes. Simple shapes used repetitively can create a pattern that is visually appealing and when the patterns are animated they easily grab the attention of the user especially in a minimalistic background.

Hence, I started off with a simple equilateral triangle which then I played around and animated to try and find out how in many ways can it be animated which resulted in the following:

To start off, I had to get the SVG of all the triangles in the correct position:

There are multiple ways of getting an SVG of a digital design you have created. You can use platforms like Adobe Illustrator or Inkscape to create the SVG files by exporting to SVG or you can convert the image files (jpeg, png, tiff) into SVG files online. Since I did not have both Illustrator or Inkscape, I decided to convert the png files of the triangles that I had saved in their original starting positions. After converting I got the following SVG file, one for each triangle:

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" type="text/css" href="main.css">
    <title>Document</title>
</head>
<body>
    <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="300.000000pt" height="225.000000pt" viewBox="0 0 300.000000 225.000000" preserveAspectRatio ="xMidYMid meet">
        <g transform="translate(0.000000,225.000000)scale(0.100000,-0.100000)" fill="#000000" stroke="none">
        <path d="M1295 1170 c-174 -174 -206 -210 -190 -216 87 -34 601 -200 603 -195
        1 3 -44 144 -101 314 l-102 307 -210 -210z m296 -97 c50 -153 94 -283 96 -290
        3 -6 -126 32 -286 85 l-291 97 192 192 c106 106 194 193 195 193 1 0 43 -125
        94 -277z"/>
        </g>
    </svg>

</body>
</html>

From the code above, all that is encapsulated in the element tag <g> is the actual defined vector that will be worked on. As all the triangles had different SVG files and needed to be incorporated into the same SVG section, I copied the details of the tag <g> for each triangle into a single SVG file and gave them an id so that the elements in SVG can be referenced in the CSS file and manipulated.

<g id='triangle_1' transform="translate(0.000000,225.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none">
...
<g id='triangle_2' transform="translate(0.000000,225.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none">
...
<g id='triangle_3' transform="translate(0.000000,225.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none">
...
<g id='triangle_4' transform="translate(0.000000,225.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none">

Adding authentication to an android app using AWS Amplify

AWS Amplify framework is a development framework for rapid web and mobile application development. It was meant for those beginners who might want to dive into the world of Amazon web services but might find it difficult due to its complexity. It has client libraries which give native and javascript support, prebuilt UI components, and a CLI for fast backend configuration and can be easily integrated with iOS, Android, Web, and React Native apps. It allows one to do a range of activities from authentication to creating APIs. 

Before starting this, make sure you have an AWS account first. The first step to creating an android app project with AWS Amplify would be to download the AWS Amplify CLI. You can follow the steps in this link for a more detailed understanding: https://docs.amplify.aws/lib/getting-started/setup?platform=android

As shown in the link, you need to have Node (when I tried to run the first step it only accepted some versions of node, hence you might have to take note of it and change the version), Android Studio ver 3.6 and onwards, Android SDK minimum API level 16. The following command will allow installation of AWS Amplify CLI:

$ npm install -g @aws-amplify/cli

It might take some time for it to install but once it does, you would be good to go for the next step of adding authentication to an android application. To verify that it has been installed correctly just call the amplify command:

$ amplify 

If you see the following on the terminal, you can be assured amplify was installed correctly:

Now that we have the Amplify CLI ready to go, we can start with the authentication part. Firstly, open up android studio and start a new project and go with the default values for the ‘Create Android Project’ section. Make sure to have the minimum API setting set to 16 or above. In my case, I would be using minimum API level 23. 

In the ‘Add an Activity to Mobile’ section choose an empty activity and hit next:

Leave the default settings for configuration of the activity and click ‘Finish’. While Android studio is setting up the new project, go to the root directory of the project and run the following command on terminal:

$ amplify init

You will be prompted with the following:

You can just hit ‘Enter’ for choosing the default setting such as the project name and res directory. After the initial details, you will be asked to set up a new user if you have never done so before. At this just enter ‘Y’ and follow through the details the Amplify CLI will guide you through such as logging into your AWS account and setting up the new user:

After this, the console will prompt you enter the user key details which you have received from AWS Amplify: 

After this, it will initialise the project on cloud and you can proceed with the next step. In this step, you will have to add authentication to the project by running this code:

 $ amplify add auth

So, as seen above they will ask you for basic authentication configuration details, in which I chose phone number to be used for user sign in. After this run the following command to push all the required resources to cloud:

 $ amplify push

This entire process could take up a few minutes so you can leave this alone and start editing the app project in Android Studio. All the following code is also found on the Amplify docs in the link mentioned above so if you need the detailed explanations please do visit it.The first step would be to add in all the required dependencies in the build.gradle file for the app:

//For AWSMobileClient only:
implementation 'com.amazonaws:aws-android-sdk-mobile-client:2.16.+'
//For the drop-in UI also:
implementation 'com.amazonaws:aws-android-sdk-auth-userpools:2.16.+'
implementation 'com.amazonaws:aws-android-sdk-auth-ui:2.16.+'
//For hosted UI also:
implementation 'com.amazonaws:aws-android-sdk-cognitoauth:2.16.+'

 After this, you would have to create the Authentication activity by creating a new empty activity and naming it “AuthenticationActivity”.

The AuthenticationActivity would contain the following code:

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

import com.amazonaws.mobile.client.AWSMobileClient;
import com.amazonaws.mobile.client.Callback;
import com.amazonaws.mobile.client.SignInUIOptions;
import com.amazonaws.mobile.client.UserStateDetails;


public class AuthenticationActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_authentication);

        AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() {
            @Override
            public void onResult(UserStateDetails userStateDetails) {

                switch (userStateDetails.getUserState()){
                    case SIGNED_IN:
                        Log.i("INIT", "Logged in");
                        Intent i = new Intent(AuthenticationActivity.this, MainActivity.class);
                        startActivity(i);
                        break;
                    case SIGNED_OUT:
                        Log.i( "end", "Signed out");
                        signin();
                        break;
                    default:
                        AWSMobileClient.getInstance().signOut();
                        signin();
                        break;
                }
            }

            @Override
            public void onError(Exception e) {
                Log.e("INIT", e.toString());
            }
        });
    }

    private void signin(){
        try {
            AWSMobileClient.getInstance().showSignIn(this, SignInUIOptions.builder().nextActivity(MainActivity.class).build());
        }catch(Exception e){
            Log.e("TAG", e.toString());
        }
    }
}

In the manifest file of the project you will have to make the following changes to let the launcher page be the authentication part:

<activity android:name=".MainActivity" android:label="@string/app_name">
</activity>
<activity android:name=".AuthenticationActivity" android:noHistory="true">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Now build the app and run it on your android device or emulator and you will see the following screen on the device:

Security in Cloud Computing


   As 93% of businesses use the cloud in some form, we must realise that cloud computing has attained the superior role in the ongoing advancements related to today’s technology. Navigation, social media and various other daily activities, all invoke the strength of the cloud in one form or another. Hence, it would only makes sense if the security issues brought up in the cloud computing sector were to be made more prominent as they would cause major problems if they are not properly taken care of.

   Cloud computing has given us many advantages, one of which is allowing businesses and users to optimise capital expenditure through the pay-as-you-grow method. This has allowed the management of data to be more affordable and has given most of the businesses a leg up. It has also optimised internet applications and made it more efficient. Above all, it has given users the ability to store and manage large scale data with ease.

   However, the cloud computing hype has given most of the Cloud service-oriented start-ups and companies a considerably large boost and has also encouraged more businesses to jump onto this bandwagon. As such, many of these types of companies exist today and the growth does not stop there. By 2020, Gartner predicts that the cloud will be as prominent as the internet in the corporate world. However, with such advancements comes the risk of data security in terms of both legal and technical aspects. There have been widespread inconsistencies identified with respect to the approaches taken by various companies regarding cloud security. It has also been brought to attention that some of the preventive measures used by the organisations are ineffective. In the end, regardless of how or why the data breach has occurred, the company could be fined or would have to face criminal charges. However, the loss incurred by the customer of that company would still be more detrimental as the data that was lost or stolen could have been vital.

   There are various methods to ensure the security of the data, one of them being data encryption. However, just encryption alone would not make the data secure. The data centres themselves should be physically secure so that the data is not stolen or lost due to fires or natural disasters. There are other technologies used to secure data such as data masking technology which is used to change the confidential parts of the data as it passes through the information gateway and the data traceability technology which is used to track all information that flows through the information gateways using logs of the data traffic.

   Despite all the security options available, in the first half of 2017 there has been at least five major cloud application and infrastructure data breaches, not including ransomeware and other attack. With this, it seems like the cloud is advancing so fast that the security aspect is unable to catch up with it. Hence, there should be an emphasis on the need of better security for the cloud especially when we know that the cloud is going to be an integral part of the world in the future.

Submitted to CSI Adhyayan October 2017 Issue

Learning in the Digital Age

    We live in a world where most of the essential items around us are digital or are on the verge of turning from analog to digital and in the future we can expect even more similar radical changes to take place. As stated by David Warlick, we are preparing students for a future we cannot clearly describe. Almost all things from jobs to our basic items are trying to accommodate to the rapid changes technology has brought us. However, most educational systems around the world still remain the same.

    During the boom of the industrial era, a greater workforce was needed to keep the economy going. Hence, the schooling system followed and formulated a method to increase the number of workers entering the workforce in the most efficient way. Back then, it would have seemed like the best solution but the world has progressed and now we are in need of people who think independently, critically and creatively. The internet has allowed the showcase of many different forms of intelligence such as abstract, visual, textual, musical and social to name a few. Hence, the world today calls for a better method of learning, a method that can introduce all these forms of intelligence to the new generation and allow them to wield these forms as a tool to shape their future. Therefore, it is necessary to make use of multiple ways of learning such as learning by listening, by doing, by sharing and by making. Despite the diversity that learning allows, our educational system mainly make use of listening which puts the students at a disadvantage when they compete against the future.

    There are many ways to modify schooling and one of the ways is to make use of technology itself to upgrade it. Changes such as online lessons, more applied teaching and more collaborative work should be implemented. However, there are cases where even if the educational system tries to make changes, it gets held back by traditional thoughts. The society itself might oppose to changes in the schooling methods such as the inclusion of laptops during lessons for the fear that it might become more of distraction than a learning tool. However, the newer generations are already subconsciously attracted to technology despite the society’s perceptions of it. They are getting more involved with digital devices, so much that to them it has become second nature and if that is the situation then it becomes an obligation to teach them about the ethical use of technology and how it can also be viewed as one of the most effective ways to gain knowledge. In the end, we have to change our perspective that technology is a tool which can be used to do both good and bad.

    There are both opportunities and threats created by the rising disruptive technologies such as AI (Artificial Intelligence), VR (Virtual Reality) and self- learning cars. They create new jobs and render the old ones useless or unnecessary. Keeping up with such a volatile world would become a tremendous challenge if we do not adopt and integrate the very technologies that caused these changes into our lives and our educational systems. 

Submitted to CSI Xpressions 16-17