Sunday 26 July 2020

Evil Within Human - Unpossible POG | Free HIP-HOP Music | LMMS Experiment




This is the first time I am creating my own music using LMMS Software.
It is a bit awkward to upload music on the internet. I hope it is not
cringey. Enjoy.

Tuesday 14 July 2020

Quickest & Easiest Way To Sort Date Array In Java




Quickest way to sort date-time array in JAVA.



------------------------------------------------
Code :

package tutorials;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Set;
import java.util.TreeSet;

public class SortDateTime {
    public static void main(String[] args) throws ParseException {
        String dateArray[]={
            "2019-01-02 03:05",
            "2019-01-02 03:05",
            "2019-01-02 03:00",
            "2019-01-02 05:00",
            "2019-01-01 15:00",
            "2018-05-05 00:30",
            "2020-04-03 40:00",
            "2020-02-01 59:00"
        };
        SimpleDateFormat f=new SimpleDateFormat("yyyy-MM-dd HH:mm");
       
        Set<Long> s=new TreeSet<Long>();
       
        for(int i=0;i<dateArray.length;i++)
        {
            s.add(f.parse(dateArray[i]).getTime());
        }
       
        for(Long l:s)
        {
            System.out.println(f.format(l));
        }
       
    }
}

------------------------------------------------
Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Blog :-
https://unpossiblepog.blogspot.in/
------------------------------------------------

Hey guys.
In this video, we shall sort date-time array in java in the quickest and easiest way possible.
This technique has one drawback which i shall explain at the ending of this video.
I already created a file and inside it there is a string array which has format of like date-time.
I am recommending you to use netbeans as it provides auto-suggestions.
We are going to need a SimpleDateFormat class.
Import required package.
Then we are using set & treeset with LONG as data-type.
In for loop, we are going to find out the length of array and add each array element in set.
but before that, we are converting date-string  into long number using simpledateformat’s function called getTime().

The SET class already ordered data in ascending order.
Then we are going to use FOR:EACH loop.
and in that, we call each data and again convert long into Date-time format.

As per input and output, 2018 should be at the top.
Also, if date is same but hours and minutes are different, then also those values get sorted.

The only drawback of this technique is that, it skips one element if that same element is already present in array.

Code link & other required links are given in the description.
Don’t forget to like, share and subscribe.
Thanks for watching. 


Sunday 5 July 2020

JAVA Google Calendar API | Part 2 | Display All Events On Browser Using JSP Framework



You can download library from:- https://unpossiblepog.com/research-and-development/GRADLE+JAVA/Google-Gradle-API-In-Java-For-Google-Drive-And-Google-Calendar

Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)
------------------------------------------------


Google Calendar Java Part 1 :-
https://youtu.be/zPsSUEGDfVY

Google Calendar Java Part 1. 5:-
https://youtu.be/0daf87wjLs4

Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Blog :-
https://unpossiblepog.blogspot.in/
------------------------------------------------

Hey guys.
In part 2 of Google Calendar connection with JAVA, we are going to display events from beginning & display them on web browser using JSP framework.
There are two parts that I have made. Links are given in the description. 1st part is mandatory which shows how to connect java with google calendar and display events in terminal.
The second part, which is actually 1.5, is the tutorial on how to create JSP Project using Gradle.
The reason why it is mentioned as 1.5 and not 2 is because it is a separate topic on its own.

And in this part, we are going to merge whatever we made in 1 & 1.5, which reduces redundant steps and also makes this video short.

Form part 1 & 1.5, those two folders were created.

From 1st, we first get all available events by making small changes in code.
As you can see, no future events are available.

Go to our java file, and just add zero in DateTime constructor and that is it.
Now if you re-execute, you will get result starting from first event.
You can make changes in setMaxResults function value to change maximum count of results.

Now from part 1.5, which has JSP enabled, we shall copy some files and folders from part 1.
So go inside Connection folder, go inside  src-> main, copy JAVA and RESOURCES folder and go to JSP, paste them in src -> main folder.
Now, again go to connection folder and copy tokens folder, and paste it in JSP where the build.gradle file is.

Now the copy-pasting is done, now go to connection folder, and open build.gradle file in text-editor, in my case, the sublime text.

Now go to JSP and also open it’s build.gradle in text editor.

We have to cut-paste the Calendar JAVA file inside ORG folder to access package.

Now we have to copy-paste the build gradle requirements from connection’s gradle to JSP’s gradle.
First, for the plugin, use JSP gralde’s syntax.
Then copy-paste that whole paragraph.

Copy-paste the function.

Copy paste the libraries and commands.

Now we are going to run to make sure that build.gradle is correct or not.
Run that IP address in browser’s URL.
It is working.

Now, open servlet in text editor at where we are going to call calendar class.
Notice that we move this quickstart file inside org folder, open that in text editor.

Because it is inside ORG folder, name the package as ORG.
Also notice that servlet has the package called org.gradle.demo which denotes the servet file is inside which folder.

Now import that org package to access CalendarQuickstart.java file.

In CalendarQuickstart file, rename the function from main to getEvents, you can use any new name and return type as string.
What we are going to do is to convert events into string and return them to display them in Servlet.
Make sure to return that string at the ending of function.
Now call that class inside servlet, and create and instance, in my case CQ.
I forgot to append string here.
Notice that the function throws Exception, so we have to call that function in try-catch block.
Copy the output link and call that function.
Lets go to terminal, close previously executed gradle using CTRL+C, and execute the command again.
Now if we click on hello, we shall see all the events.

Required links are given in the description.
Don’t forget to like, share and subscribe.
Thanks for watching.