Sunday, 27 November 2016

Demonetization effect



Hello Everyone,

 I am sure everyone is aware of the meaning of the word 'Demonetization'. In short, it means 500 and 1000 Rupee notes will not be valid anymore.  Although there are some arrangements done by our Government like exchanging our old notes from any bank, withdrawal from our nearest petrol pump or Big Bazaar by swiping our debit card etc.

It needs a huge courage to make such decisions like this. I personally like this stand of our PM. Some are opposing while most of us are cheering for the decision taken by our PM on 8th November 2016. I seriously, don't know whether the inconvenience faced by many of us will be paid off or not. But I am happy to see that at least we have made an attempt. You never know, it might work also.

 Well, I was in Patiala when this news came out. I was there for my convocation and was happy to know about it. I had three notes of 500 with me and the best part was, banks were closed on 9th and 10th of November. I couldn't exchange my old notes. I had to come back to Delhi. I didn't have any idea,  how I'll manage all this. 

I was lucky enough to get a cab for Delhi where I could pay either by card or old notes. Soon after this news spread, people started searching for alternatives like Paytm, OlaMoney, etc to manage their daily expenses.

To be honest, I didn't have to stand in queues either for exchanging or withdrawal. I am thankful to my sister and friends for this, as they provided enough cash to me. But I can feel the inconvenience faced by others while standing in the queue. Everyone is going through a hard time for cash. But I feel a bit more for working class people for the simple reason that they don't get time for this in their office hours. On weekends, when they get time, the banks remain closed. 

Yesterday, I was surprised to see that I can use my Paytm even for a cup of tea which costs Rs. 10/-. I am relying on Paytm and Uber these days. I can see the vision of our PM behind this. The best part of the denomination, which I can see is to diminish the effects of "Fake Currency" which is present in a good amount in our country. 


I am happy to see that people are supporting our PM. They are not reacting. There was  no news of burning the ATMs or any accidental incident near any bank. At least I didn't hear any such news. I guess most of us is happy with the decision. While on the other hand, some are opposing too. I don't want to comment. They might have a valid reason.




Sunday, 20 November 2016

Firebase Introduction



Hello Friends,  
I spoke a lot about Android in my blogs so far. So today, I thought let’s pick something other than android. I am going to write about Firebase. I guess everyone is familiar with the basics of Firebase. If not, let me introduce firebase to you guys.
What is Firebase ?  
Firebase is a technology that permits you to make web applications with no server-side programming. It helps to make the development process quicker and easier. Also, we don't have to stress over-provisioning servers or building REST APIs with just a little bit of configuration. We can give Firebase a chance to take every necessary step such as storing data, verifying users, and implementing access rules.
It supports the web, iOS, OS X, and Android clients. Applications using Firebase can just use and control data, without having to think about how data would be stored, and synchronized across various examples of the application in real time. There is no need to write server side code, or to deploy a complex server framework to get an app started with Firebase.

Why Firebase ?
It is a versatile backend with a lot of good uses.
  • It cuts down development time and avoids messing with servers and data storage.
  • It is Scalable. If you want your application to scale well, you can trust that Firebase will handle all your data without missing a single step.
  • It provides cloud service, so there isn't any setup involved.
  • Data is stored as native JSON, so what you store is what you see.
  • Data is safe because Firebase requires 2048-bit SSL encryption for all data transfers.
  • Data is reflected and backed up to multiple secure locations, so there are minimal chances of data loss.
  • It integrates nicely with frameworks like Angular JS. So it's very useful and allows you to create an app in a very short time.

     Some of it's critical advantages includes,
    • Realtime update without using GCM.
    • Can start for free (only need to start paying once we hit 50 connections)
    • Built-in support for authentication services like Facebook, Google, and Twitter
    I'll continue this discussion in my coming blogs. If you find any difficulty in understanding this or wanna more clarification regarding any specific point. Feel free to write it down in the comment section. Enjoy the day !

 

Sunday, 13 November 2016

CountDown Timer in Android




A countdown timer is a device which is designed to count down to a particular event. They range in design from simple mechanical devices like those used in the kitchen to electronic versions designed to be downloaded and installed on a desktop. Numerous websites also use a countdown timer to mark the days, hours, minutes, and seconds until a major event, and some websites also generate countdown timer codes for installation on personal websites.

I am going to share the logic of designing a countdown timer in Android. Designing the countdown timer is not so difficult. The below code will create a countdown timer for 5 minutes.


void TimerStart(long remainingTime) {
CountDownTimer myTimer= new CountDownTimer(300000, 1000) {
// adjust the milli seconds here
public void onTick(long millisUntilFinished) {
text1.setText(""+String.format(FORMAT,
TimeUnit.MILLISECONDS.toHours(millisUntilFinished),
TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) - TimeUnit.HOURS.toMinutes(
TimeUnit.MILLISECONDS.toHours(millisUntilFinished)),
TimeUnit.MILLISECONDS.toSeconds(millisUntilFinished) - TimeUnit.MINUTES.toSeconds(
TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished)))); }
public void onFinish() {
text1.setText("done!"); } };
myTimer.start();
}



But if I closed my app after using it for 30 seconds and reopen it after 2 minutes, it will start it’s countdown from 5 minutes. Ideally, it should subtract the time elapsed since I reopen the app. How to handle this ?? Well, Don’t worry !...I have a solution.


Let's take an example of running the countdown Timer for 24 hours.

Step 1 :  Calculate the timerEndTime(in milliseconds), i.e when the timer is going  to stop. You can do this by adding 86400000(number of milliseconds in 24 hours)  to the starting time of the countdownTimer.

Step 2 : Calculate the currentTime(in milliseconds)   i.e when you open the      application. You can do this by using the method called,    Calendar.getInstance().getTimeInMillis() 

Step 3 : Calculate the remaining time to the countdown timer by
             (timerEndTime – currentTime)

Step 4: Pass this value to the countDownTimer method
i.e TimerStart(timerEndTime - currentTime)

You are Done !!! 

Please comment below if you face any problem in the implementation of the above-discussed steps. 

Sunday, 6 November 2016

Use of Local History in Android Studio


As we all know, Android Studio is widely used tool for the development of any android application along with Eclipse. I personally use Android Studio and never used Eclipse. So I don’t know whether the feature which I am going to tell you today is available with Eclipse too or not.

More often we write code, make some changes(depending upon the situations) then build again in order to update the changes that we made. We then close the project and we are done. Let’s assume we have made some 100 of changes at different time slots and rebuilt the project after each change. We have closed the android studio as well. Now, after a week or so if reopen the same project. Can we track all the changes that were made in the project at different point of time?

Okay let me explain....say, I started my project on 1st October at 10:00 AM and it was running perfectly. I added some new lines of code at 11:00 AM and rebuilded the project it was also running perfectly. I repeated the same action at each hour. Finally at 8:00 PM I closed the project along with android studio. I repeated same work flow For the next 20 days.

Assume that I didnt backup my project. Can I switch my project to the same state as it was on 15th October at 02:00 PM ?? Well, the answer is Yes we can. It’s because of a feature included in the android studio called “Local History”.

In order to use this feature , select your activity file which you wanna roll back to any perticular date or time. Right click to the selected activity. Select “Local History”----->”Show History” from the context menu. You can see all the saved states on the left side and current state of your project on the righ side. It will also show the total number of changes that were made from that point till the date with the line number. Just click on the “>>” symbol to undo all those changes to your current project. you are done !! Enjoy the day !!

It actually helped me a lot so thought of sharing this with you all.....!!
Have a good day !!