I Believe That The Education And Entertainment Should Be Available For People Who Deserve It.
Sunday, 2 August 2020
Google Calendar API Tutorial #3 | Delete Events | Get Event IDs | 2020
Download VENDOR Folder (Only for PHP version 7.2+): https://unpossiblepog.com/research-and-development/php/Vendor-Folder-For-Google-Sheet-Drive-Calendar-With-PHP-Version-7.2-And-Onward
PHP Google Calendar Delete EVENTS.
Google Calendar PHP Connection:-
https://youtu.be/Q-498CAa1xE
Google Update Alert :-
https://youtu.be/5COjnEc4d9E
Delete event Code Link:-
https://developers.google.com/calendar/v3/reference/events/delete
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 tutorial, we shall delete google event using PHP code.
For that, you must first connect PHP with google calendar which are shown in those tutorials.
Both of those links are given in the description.
Now, if you are able to display or add events, you can continue watching further.
I gave a link in the description for a code for deleting event.
In that function, first argument is calendar ID and second is event id.
To find calendar ID, follow my steps.
You will find calendar ID here, which I am already using in code.
Now, we can get the event ID in two ways.
1, while adding a new event. And 2nd by getting events list from LOOPS.
1st, I shall comment the loop code, and add the event.
Here, use getID function.
Lets run the code.
We do get the ID, but ignore the “slash N”, which I accidentally printed in code.
You can store that ID in database or session or anywhere for later use.
Comment that ADD-EVENT code.
Now we shall just copy that in our code directly.
Now we use that provided code.
And use calendar ID and event ID.
As you can see, the event was added by the code is here.
If we refresh, it will be vanished as you can see.
However what if you don’t have event ID, so for that, enable the DISPLAY EVENT code.
& use that delete function here.
Lets create some events manually.
Notice that the third event is from different calendar which will not be delete as it belongs to different calendar.
Now they are vanished like a magic.
Code link & other required links are given in the description.
Don’t forget to like, share and subscribe.
Thanks for watching.
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.
Sunday, 14 June 2020
Gradle JSP Quick Setup Tutorial | JAVA & Groovy Language | Web Application
Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)
------------------------------------------------
Official Gradle JSP Guidelines:-
https://guides.gradle.org/building-java-web-applications/
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, I shall create JSP application using gradle in the quickest way possible.
There are plenty of tutorials available on internet for installing gradle and java, so we shall skip that part.
There is an official document from gradle to setup JSP. That link is given in the description.
There are requirements that you should have.
Configuring basic JSP doesn’t require more than 5 minutes.
And we are using groovy as a build.
First instruction is to create folder structure like this.
Open the file system or my computer, I already created a TUTORIAL folder, go inside it and start to create new folders.
Now come to home folder, which is webdemo, and create a new file “build.gradle”.
Click on GROOVY tab if kotlin is selected by default.
Next, open webdemo folder in terminal or command prompt.
Even though the gradle version is greater than 4.10, don’t use that wrapper.
type the same command as they provided.
It will create some files and folders inside webdemo.
Now, create more folder as they told you, and create HelloServlet.java file inside that folder.
There are the number which indicates what is the purpose of that code.
Now come back to webapp folder and create two new files, index.html and response.jsp.
Copy paste the code in index.html.
copy paste the code in response.jsp.
Now, copy this id and paste it in plug in.
After that, go to terminal and type the command they provided.
It will provide a URL. Copy that and paste it in browser.
If you click on hello, the GET method is called.
Force refresh it.
To access JSP, type name and click on button.
So, that is it. The core JSP is ready.
Required links are given in the description.
Don’t forget to like, share and subscribe.
Thanks for watching.
Monday, 8 June 2020
Java Google Calendar API | Linux Terminal & Gradle Groovy | Display Events | Fix redirect_uri_mismatch
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 :)
------------------------------------------------
Official Google Developer page for google calendar JAVA API:-
https://developers.google.com/calendar/quickstart/java
Google Console page:-
https://console.cloud.google.com/
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, I shall make a connection between Google calendar and JAVA using gradle and display events in terminal or Command prompt.
Following operation requires Linux as it provides more flexibility for performing tasks.
Output can later be used in any framework like Spring, JSP, hibernate etc.
Lets go to google and search “google calendar quickstart java” go to developers.google.com link.
Requirements :
1. Google account with google calendar enabled.
2. Linux OS (debian family). I am using LUBUNTU. install linux in vmware or virtualbox if you don’t have LINUX as BOOT OS.
3. JAVA JDK version 1.8 or grater.
4. Then, gradle version greater than or equals to 2.3.
For people who doesn’t know what is gradle, in simple words, it is a build-tool which has 2 types, Groovy and Kotlin. And both of them can use any language Syntax for its script.
Kotlin is mostly used for android development and has file extension of .gradle.kts but groovy is mostly is used for webserver and with extension .gradle.
We are going to use groovy build and JAVA.
Then lets go to calendar.google.com and create an event. The red line is the current time so make the event after that line.
Now open file system. Create a folder in home with any name in my case “GoogleCalendar”.
Open that folder in terminal.
I already installed Java and gradle but still, show you the commands to install them.
Sometimes, you get older version of gradle, so you can upgrade it by using this command.
Then click on enable Google Calender API button.
Select Web server, now, type same url as I showed you. make sure that C in callback is capital.
Click on CREATE.
Download configuration.
Remember that file can be renamed if same file name already exists.
Now, in our newly created folder, create another folder with name CALLBACK. C capital.
Now in terminal, go inside callback folder using cd command.
Check if you have installed java and gradle correctly with required version.
Now, type the command they provided.
Type 1. To select Groovy.
For second question, don’t type anything, press enter directly.
Now if you check folder, some folders & files were automatically created.
Now paste the second command, which will create more folder in your project.
As per instructions, copy-paste credentials.json file from downloaded folder to this path.
Make sure to rename as credentials.json if name is different.
Next instruction is to copy-paste the gradle code in build.gradle file.
After that we have to create a java file at location as they told us.
Paste the code in it.
Here, remove “_READONLY” if you also want to change calendar events in future.
Now lets run the command “gradle run”.
It shall directly open the link in browser, but there is an error called “redirect_uri_mismatch”.
So to solve that, first cancel process by pressing ctrl+c in terminal.
Go to google console.
Left-top-menu, APIs & Services, and select credentials.
As you can see, the top Client Id is what we created on 7th of june, click on it, add URI, make sure to make same configuration as I do.
If you see in java code, the port number is 8888. So change that port in configuration.
Also, go to main callback folder and inside tokens folder, delete the file.
Lets clear the terminal and rerun the command.
It automatically opens the link in browser and you can see this page.
Select your google account, click on advanced, go to quickstart unsafe, Allow.
You will see this message.
Now if you see it in terminal, you will see the upcoming event that we created at the beginning.
Lets rename it to verify. You can also create multiple events that will not be a problem for program to execute.
Now you can close terminal, and rename the folder.
Now open the renamed folder in terminal with same command and there will not be any problem in future.
In next tutorial, I shall show you how to get all events and display them on browser using JSP framework through gradle.
Required links are given in the description.
Don’t forget to like, share and subscribe.
Thanks for watching.
Monday, 1 June 2020
JAVA Tutorial | Easiest Way To Get List Of Dates Between Two Dates
Code :-
import java.text.SimpleDateFormat;
import java.util.*;
public class DateList {
public static void main(String[] args) throws Exception {
String from="2020-01-01";
String to="2020-05-30";
Date d_from = new SimpleDateFormat("yyyy-MM-dd").parse(from);
Date d_to = new SimpleDateFormat("yyyy-MM-dd").parse(to);
//System.out.println(d_from.getTime());
long t1=d_from.getTime();
long t2=d_to.getTime();
SimpleDateFormat f=new SimpleDateFormat("yyyy-MM-dd");
if(t1<t2)
{
//1 = 1000
for(long i=t1;i<=t2;i+=86400000)
{
System.out.println(f.format(i));
}
}
}
}
------------------------------------------------
Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)
------------------------------------------------
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, I shall show you the easiest way to get list of dates between two dates in JAVA.
Here I am using netbeans IDE and the date format as year-month and date.
I shall be converting string to date by using date and SimpleDateFormat classes.
With netbeans, you will be assisted to import required packages and handle exceptions.
However, I shall manually handle exception by throwing it in main function line.
Main strategy is to convert date into milliseconds.
Now using LONG as data type is important because the milliseconds are large numbers.
First thing I shall do is to verify if from-date is lesser than to-date by applying if statement.
Now, I shall use for loop, a variable start with from-date and stop at to-date.
In for loop, I shall add 1 day in milliseconds.
One day is 86400 second.
However, 1 second equals to 1000 milliseconds, so add more three zeros.
Let check the output.
Now, the only thing left is to convert milliseconds to date.
For that, SimpleDateFormat variable is required.
Use format function with 1 argument of milliseconds.
The JAVA code handles even a leap as you can see, 29 days in February. 2020 which is the worst year.
The code link is given in the description.
Don’t forget to like, share and subscribe.
Thanks for watching.
Subscribe to:
Posts (Atom)