Menu

AJAX call with GET method and request data

In his article, we are going to look at how to call an endpoint and read the JSON response using AJAX call. Also, we will see how we append and pass URL parameters to that endpoint URL. Below is the code snippet.

var data is a type of object, that holds all the URL parameters that get appended with endpoint URL when AJAX calls the endpoint.

<script>
	function myFunction() {
    var amount = document.getElementById("tuition-amount").value;

    var startDate = document.getElementById("start-date").value;
    var endDate = document.getElementById("end-date").value;

    var data = { startDate:"01/25/2022",
    	endDate:"03/12/2022",
        paymentDate:"01/02/2022",
        campus:"delhi"};

        $.ajax({
  	    type: "GET", 
            url: "https://rashidjorvee/services/latefine.cfm", 
            data: data,
            success: function(response) {
                document.getElementById("late-fine-amount").innerHTML = response.amount;
            },
            dataType: "json"
          })
		}
</script>

ghar se nikle to ho socha bhi hai kidhar jaoge?? | گھر سے نکلے تو ہو سوچا بھی ہے کدھر جاؤگے؟ | घर से निकले तो हो सोचा है किधर जाओगे?

ghar se nikle to ho socha bhi hai kidhar jaoge??
har taraf tez hawayen hai, bikhar jaoge

itna asan nhi hai, lafzon pe bharosha karna
ghar ki dahleez pukaregi jidhar jaoge

sham hote hi simat jayenge sare raste
bahte darya sa, jahan hoge, thahar jaoge

har naye shaer me kuchh raten kadi hoti hai
chhat se diwaren juda hongi to dar jaoge

pehle har cheez nazar ayegi be maeni si
aur phir apne hi nazron se utar jaoge

------------------------------------------------
گھر سے نکلے تو ہو سوچا بھی ہے کدھر جاؤگے؟
ہر طرف تیز ہویں ہے ، بکھر جاؤگے 

اتنا آسان نہی ہے ، لفظوں پی بھروشہ کرنا 
گھر کی دہلیز پکریگی جدھر جاؤگے 

شام ہوتے ہی سمٹ جاینگے سارے راستے 
بہتے دریا سے ، جہاں ہوگے ، ٹھہر جاؤگے 

ہر نے سهر مے کچھ راتیں کدی ہوتی ہے 
چھت سے دیواریں جدا ہونگی تو دار جاؤگے 

پہلے ہر چیز نظر یگی نے ، بے مینی سی 
اور پھر اپنے ہی نظروں سے اتر جاؤگے 

------------------------------------------------
घर से निकले तो हो सोचा है किधर जाओगे?
हर तरफ तेज़ हवाएं है बिखर जाओगे 

इतना आसान नहीं है लफ़्ज़ों पे भरोशा करना
घर की दहलीज़ पुकारेगी, जिधर जाओगे

शाम होते ही सिमट जायेंगे सारे रस्ते 
बहते दरया सा, जहाँ होगे, ठहर जाओगे

हर नए सहर में कुछ रातें कड़ी होती हैं 
छत से दीवारें जुड़ा होंगी तो दर जाओगे 

पहले हर चीज़ नज़र आएगी बे-मानी सी
और फिर अपने ही नज़रों से उतर जाओगे

--@ Nida Fazli

Running Apache Tomcat 8.5 Servlet/JSP Container

Apache Tomcat 8.5 requires a Java Standard Edition Runtime Environment (JRE) version 7 or later.

Running With JRE 7 Or Later


(1) Download and Install a Java SE Runtime Environment (JRE)


(1.1) Download a Java SE Runtime Environment (JRE), release version 7 or later, from       http://www.oracle.com/technetwork/java/javase/downloads/index.html

(1.2) Install the JRE according to the instructions included with the
      release.

      You may also use a full Java Development Kit (JDK) rather than just
      a JRE.


(2) Download and Install Apache Tomcat


(2.1) Download a binary distribution of Tomcat from:


(2.2) Unpack the binary distribution so that it resides in its own
      directory (conventionally named "apache-tomcat-[version]").

      For the purposes of the remainder of this document, the name
      "CATALINA_HOME" is used to refer to the full pathname of that
      directory.

NOTE:  As an alternative to downloading a binary distribution, you can create your own from the Tomcat source code, as described in "BUILDING.txt".  You can either

  a)  Do the full "release" build and find the created distribution in the
      "output/release" directory and then proceed with unpacking as above, or

  b)  Do a simple build and use the "output/build" directory as       "CATALINA_HOME".  Be warned that there are some differences between the contents of the "output/build" directory and a full "release" distribution.

(3) Configure Environment Variables


Tomcat is a Java application and does not use environment variables directly.
Environment variables are used by the Tomcat startup scripts. The scripts use
the environment variables to prepare the command that starts Tomcat.

(3.1) Set CATALINA_HOME (required) and CATALINA_BASE (optional)

The CATALINA_HOME environment variable should be set to the location of the
root directory of the "binary" distribution of Tomcat.

The Tomcat startup scripts have some logic to set this variable
automatically if it is absent, based on the location of the startup script
in *nix and on the current directory in Windows. That logic might not work
in all circumstances, so setting the variable explicitly is recommended.

The CATALINA_BASE environment variable specifies location of the root
directory of the "active configuration" of Tomcat. It is optional. It
defaults to be equal to CATALINA_HOME.

Using distinct values for the CATALINA_HOME and CATALINA_BASE variables is
recommended to simplify further upgrades and maintenance. It is documented
in the "Multiple Tomcat Instances" section below.


(3.2) Set JRE_HOME or JAVA_HOME (required)

These variables are used to specify location of a Java Runtime
Environment or of a Java Development Kit that is used to start Tomcat.

The JRE_HOME variable is used to specify location of a JRE. The JAVA_HOME
variable is used to specify location of a JDK.

Using JAVA_HOME provides access to certain additional startup options that
are not allowed when JRE_HOME is used.

If both JRE_HOME and JAVA_HOME are specified, JRE_HOME is used.

The recommended place to specify these variables is a "setenv" script. See
below.


(3.3) Other variables (optional)

Other environment variables exist, besides the four described above.
See the comments at the top of catalina.bat or catalina.sh scripts for the list and a description of each of them.

One frequently used variable is CATALINA_OPTS. It allows specification of
additional options for the java command that starts Tomcat.

See the Java documentation for the options that affect the Java Runtime Environment.

See the "System Properties" page in the Tomcat Configuration Reference for the system properties that are specific to Tomcat.

A similar variable is JAVA_OPTS. It is used less frequently. It allows specification of options that are used both to start and to stop Tomcat as well as for other commands.

Note: Do not use JAVA_OPTS to specify memory limits. You do not need much memory for a small process that is used to stop Tomcat. Those settings belong to CATALINA_OPTS.

Another frequently used variable is CATALINA_PID (on *nix only). It specifies the location of the file where process id of the forked Tomcat java process will be written. This setting is optional. It will enable the following features:

 *  better protection against duplicate start attempts and
 *  allows forceful termination of Tomcat process when it does not react to
    the standard shutdown command.


(3.4) Using the "setenv" script (optional, recommended)

Apart from CATALINA_HOME and CATALINA_BASE, all environment variables can be specified in the "setenv" script. The script is placed either into CATALINA_BASE/bin or into CATALINA_HOME/bin directory and is named
setenv.bat (on Windows) or setenv.sh (on *nix). The file has to be readable.

By default the setenv script file is absent. If the script file is present both in CATALINA_BASE and in CATALINA_HOME, the one in CATALINA_BASE is preferred.

For example, to configure the JRE_HOME and CATALINA_PID variables you can
create the following script file:

On Windows, %CATALINA_BASE%\bin\setenv.bat:

  set "JRE_HOME=%ProgramFiles%\Java\jre7"
  exit /b 0

On *nix, $CATALINA_BASE/bin/setenv.sh:

  JRE_HOME=/usr/java/latest
  CATALINA_PID="$CATALINA_BASE/tomcat.pid"


The CATALINA_HOME and CATALINA_BASE variables cannot be configured in the setenv script, because they are used to locate that file.

All the environment variables described here and the "setenv" script are used only if you use the standard scripts to launch Tomcat. For example, if you have installed Tomcat as a service on Windows, the service wrapper launches Java directly and does not use the script files.


(4) Start Up Tomcat


(4.1) Tomcat can be started by executing one of the following commands:

  On Windows:

      %CATALINA_HOME%\bin\startup.bat

    or

      %CATALINA_HOME%\bin\catalina.bat start

  On *nix:

      $CATALINA_HOME/bin/startup.sh

    or

      $CATALINA_HOME/bin/catalina.sh start

(4.2) After startup, the default web applications included with Tomcat will be
      available by visiting:


(4.3) Further information about configuring and running Tomcat can be found in
      the documentation included here, as well as on the Tomcat web site:



(5) Shut Down Tomcat


(5.1) Tomcat can be shut down by executing one of the following commands:

  On Windows:

      %CATALINA_HOME%\bin\shutdown.bat

    or

      %CATALINA_HOME%\bin\catalina.bat stop

  On *nix:

      $CATALINA_HOME/bin/shutdown.sh

    or

      $CATALINA_HOME/bin/catalina.sh stop


Advanced Configuration - Multiple Tomcat Instances

In many circumstances, it is desirable to have a single copy of a Tomcat binary distribution shared among multiple users on the same server.  To make this possible, you can set the CATALINA_BASE environment variable to the directory that contains the files for your 'personal' Tomcat instance.

When running with a separate CATALINA_HOME and CATALINA_BASE, the files
and directories are split as following:

In CATALINA_BASE:

 * bin  - Only the following files:

           * setenv.sh (*nix) or setenv.bat (Windows),
           * tomcat-juli.jar

          The setenv scripts were described above. The tomcat-juli library
          is documented in the Logging chapter in the User Guide.

 conf - Server configuration files (including server.xml)

 lib  - Libraries and classes, as explained below

 logs - Log and output files

 webapps - Automatically loaded web applications

 work - Temporary working directories for web applications

 temp - Directory used by the JVM for temporary files (java.io.tmpdir)


In CATALINA_HOME:

 bin  - Startup and shutdown scripts

          The following files will be used only if they are absent in
          CATALINA_BASE/bin:

          setenv.sh (*nix), setenv.bat (Windows), tomcat-juli.jar

 lib  - Libraries and classes, as explained below

 endorsed - Libraries that override standard "Endorsed Standards"
              libraries provided by JRE. See Classloading documentation
              in the User Guide for details.
              This is only supported for Java <= 8.
              By default this "endorsed" directory is absent.

In the default configuration the JAR libraries and classes both in CATALINA_BASE/lib and in CATALINA_HOME/lib will be added to the common
classpath, but the ones in CATALINA_BASE will be added first and thus will be searched first.

The idea is that you may leave the standard Tomcat libraries in CATALINA_HOME/lib and add other ones such as database drivers into
CATALINA_BASE/lib.

In general it is advised to never share libraries between web applications, but put them into WEB-INF/lib directories inside the applications. See Classloading documentation in the User Guide for details.


It might be useful to note that the values of CATALINA_HOME and CATALINA_BASE can be referenced in the XML configuration files processed
by Tomcat as ${catalina.home} and ${catalina.base} respectively.

For example, the standard manager web application can be kept in CATALINA_HOME/webapps/manager and loaded into CATALINA_BASE by using
the following trick:

 * Copy the CATALINA_HOME/webapps/manager/META-INF/context.xml
   file as CATALINA_BASE/conf/Catalina/localhost/manager.xml

 * Add docBase attribute as shown below.

The file will look like the following:

  <?xml version="1.0" encoding="UTF-8"?>  <Context docBase="${catalina.home}/webapps/manager"    antiResourceLocking="false" privileged="true" >    <Valve className="org.apache.catalina.valves.RemoteAddrValve"         allow="127\.0\.0\.1" />  </Context>

See Deployer chapter in User Guide and Context and Host chapters in the Configuration Reference for more information on contexts and web application deployment.

Troubleshooting


There are only really 2 things likely to go wrong during the stand-alone
Tomcat install:

(1) The most common hiccup is when another web server (or any process for that
    matter) has laid claim to port 8080.  This is the default HTTP port that
    Tomcat attempts to bind to at startup.  To change this, open the file:

       $CATALINA_HOME/conf/server.xml

    and search for '8080'.  Change it to a port that isn't in use, and is
    greater than 1024, as ports less than or equal to 1024 require superuser
    access to bind under UNIX.

    Restart Tomcat and you're in business.  Be sure that you replace the "8080"
    in the URL you're using to access Tomcat.  For example, if you change the
    port to 1977, you would request the URL http://localhost:1977/ in your
    browser.

(2) The 'localhost' machine isn't found.  This could happen if you're behind a
    proxy.  If that's the case, make sure the proxy configuration for your
    browser knows that you shouldn't be going through the proxy to access the
    "localhost".

    In Firefox, this is under Tools/Preferences -> Advanced/Network ->
    Connection -> Settings..., and in Internet Explorer it is Tools ->
    Internet Options -> Connections -> LAN Settings.


Optional Components


The following optional components may be included with the Apache Tomcat binary
distribution. If they are not included, you can install them separately.

 1. Apache Tomcat Native library

 2. Apache Commons Daemon service launcher

Both of them are implemented in C language and as such have to be compiled
into binary code. The binary code will be specific for a platform and CPU
architecture and it must match the Java Runtime Environment executables
that will be used to launch Tomcat.

The Windows-specific binary distributions of Apache Tomcat include binary
files for these components. On other platforms you would have to look for
binary versions elsewhere or compile them yourself.

If you are new to Tomcat, do not bother with these components to start with.
If you do use them, do not forget to read their documentation.


Apache Tomcat Native library


It is a library that allows to use the "Apr" variant of HTTP and AJP
protocol connectors in Apache Tomcat. It is built around OpenSSL and Apache
Portable Runtime (APR) libraries. Those are the same libraries as used by
Apache HTTPD Server project.

This feature was especially important in the old days when Java performance
was poor. It is less important nowadays, but it is still used and respected
by many. See Tomcat documentation for more details.

For further reading:

Apache Tomcat documentation


    * Documentation for APR/Native library in the Tomcat User's Guide


    * Documentation for the HTTP and AJP protocol connectors in the Tomcat
      Configuration Reference



 - Apache Tomcat Native project home


 - Other projects

    * OpenSSL


    * Apache Portable Runtime


    * Apache HTTP Server


To disable Apache Tomcat Native library:

 - To disable Apache Tomcat Native library when it is installed, or
 - To remove the warning that is logged during Tomcat startup when the
   library is not installed:

   Edit the "conf/server.xml" file and remove "AprLifecycleListener" from
   it.

The binary file of Apache Tomcat Native library is usually named

  - "tcnative-1.dll" on Windows
  - "libtcnative-1.so" on *nix systems


Apache Commons Daemon


Apache Commons Daemon project provides wrappers that can be used to
install Apache Tomcat as a service on Windows or as a daemon on *nix
systems.

The Windows-specific implementation of Apache Commons Daemon is called
"procrun". The *nix-specific one is called "jsvc".

For further reading:

 - Apache Commons Daemon project


 - Apache Tomcat documentation

    * Installing Apache Tomcat


    * Windows service HOW-TO


The binary files of Apache Commons Daemon in Apache Tomcat distributions
for Windows are named:

  - "tomcat8.exe"
  - "tomcat8w.exe"

These files are renamed copies of "prunsrv.exe" and "prunmgr.exe" from
Apache Commons Daemon distribution. The file names have a meaning: they are used as the service name to register the service in Windows, as well as the
key name to store distinct configuration for this installation of "procrun". If you would like to install several instances of Tomcat 8.5 in parallel, you have to further rename those files, using the same naming scheme.

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

If you are getting error "No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?" while compiling any java application either using Eclipse, NetBeans and any other IDE, the simple meaning of this error is; you are trying to compile your Java program using JRE which is not possible. To compile any Java program we need JDK.

There could be two reasons which causing this error. Will see both the ways to fix this issue.

How to check installed version of Java in your machine.

1. If you don't have JDK installed in your machine/Computer.

  • To resolve this you need to download the latest version of JDK and install it in your machine. 
  • Then setup environment  variable and path. for more check here.


2. If JDK is already installed in your machine but installed JRE path is not setup to JDK path. 

  • Open eclipse
  • Go to Window > Preferences > Java > Installed JREs > and check your installed JREs.
  • There should be a entry available for JDK in installed JRE. In case there is no JDK entry then you have to add path of installed JDK from your machine.

To do this:
  • Go to C drive of your computer and find the directory of JDK in program files. e. g. C:\Program Files\Java\jdk1.8.0_111 
  • Copy this path and add this path in your installed JREs option in your IDE.
inatalled JRE in eclipse
Inatalled JRE in eclipse
  •  Click on Add button from right side of window. A new window will appear, click on standard VM > Next > In JRE home section put the path of installed JDK from program files and click on finish.
JRE defination window
JRE defination window

  • After doing these all JDK will be appear in your installed JREs window. From there you mark/check JDK and apply.
inatalled JRE in eclipse
Inatalled JRE in eclipse

    How to check installed Java version in your machine?

    If you see this error while executing any program or running and debugging maven build then follow the following easy steps, to resolve this issue from eclipse.


    How to check installed Java version in your machine?

    There are two ways to check installed java version in your machine.
    1. Using command prompt
    • Go to start and search for cmd, open command prompt.
    • No need to change the default directory from command prompt, just  copy and paste command "java -version".
    • Hit enter key to run the command.

    Below is the screen shot for more clarification.


    how to check java version
    Java version check

    2. Another simple way to check installed java version in your machine by using java version link.


    Verify version of java installed in your machine
    Verify Java and find out-dated version



    • Click on the Agree and continue button.
    • A popup window will appear, which needs your approval to run java version check application. Simply click on the "Run" button on that popup.
    • Now you will see the Java detail page on your browser. as showing in the below screen shot.

    Java version in your machine
    Java version in your computer

    Ghar nari gawari, chaahe jo kahe | घर नारी गवरी, चाहे जो कहे

    Preetam desh suhawano, jahan basen dildaar 
    Khusro...
    Wahoo desh pe, so tan man deejo waar

    Ghat ke andar baith ke, or kare premi se pyar
    Aise piya pe chupchap, na tan man deejo waar

    Ghar nari gawari, chaahe jo kahe
    Main Nijam se naina laga aaii re

    Khusro rain suhag ki, so jagi pii ke sang
    Tan mora, man piihuu kaa, so dono aik hi rang

    Aisa sundar, aisa chhabeela, duja koi nahin
    Jaisa Baba Farid ka pyara Khwaja Nijamuddin

    Aao sakhyon sab mil baithen, peer nijam ke sang 
    ek pal me jo, nain mila kar, range prem ke rang 

    Ghar nari gawari, chaahe jo kahe
    Main Nijam se naina laga aaii re

    Khusro sagda jug bhar dhunde, nagri nagri jaye
    Tohra piya, tere sang rahat hai, tu kahe ghabraye

    Sohani soorat, mohani moorat,
    Mein to hirday beech samaa aaii re

    Ghar nari gawari, chaahe jo kahe
    Main Nijam se naina laga aaii re

    Maraa tana mazam, aay muddaye, tarze adayam dee
    Manam rindey, kharabaaty, sare bazaar me raqsam

    Ghar nari gawari, chaahe jo kahe
    Main Nijam se naina laga aaii re

    Khusrao Nijam ke bal bal jayye,
    Mein to anmol cheri bita aaii re

    Ghar nari gawari, chaahe jo kahe
    Main Nijam se naina laga aaii re


    --@ Ameer Khusro

    =================================================================

    प्रीतम देश सुहावनो, जहाँ बसें दिलदार 
    खुसरो ...
    वहू देश पे, सो तन मन दीजो वार 

    घाट के अंदर बैठ के, और करे प्रेमी से प्यार 
    ऐसे पिया पे चुपचाप, न तन मन दीजो वार 

    घर नारी गवरी, चाहे जो कहे 
    मैं निजाम से नैना लगा आई रे 

    खुसरो रेन सुहाग की, सो जगी पी के संग 
    तन मोरा, मन पीहू का, सो दोनों एक ही रंग

    घर नारी गवरी, चाहे जो कहे 
    मैं निजाम से नैना लगा आई रे 

    ऐसा सुन्दर, ऐसा छबीला, दूजा कोई नहीं 
    जैसा बाबा फरीद का प्यारा ख्वाजा निजामुद्दीन

    आओ साख्यों सब मिल बैठें, पीर निजाम के संग 
    एक पल में जो, नैन मिला कर, रेंज प्रेम के रंग 

    घर नारी गवरी, चाहे जो कहे 
    मैं निजाम से नैना लगा आई रे 

    खुसरो सगड़ा जग भर ढूंढे, नगरी नगरी जाये 
    तोहरा पिया, तेरे संग रहत है, तू कहे घबराये 

    सोहनी सूरत, मोहनी मूरत,
    में तो ह्रदय बीच समा आई रे 

    घर नारी गवरी, चाहे जो कहे 
    मैं निजाम से नैना लगा आई रे 

    मरा तना मज़म, ए मुद्दई, तर्ज़े अदायम दी 
    मनम रिंदे, ख़राबाटी, सरे बाजार में रअक़्सम 

    खुसरो निजाम के बल बल जाइये,
    में तो अनमोल चेरी बिता आई रे 

    घर नारी गवरी, चाहे जो कहे 
    मैं निजाम से नैना लगा आई रे 

    -- @अमीर खुसरो 

    Israel banned 20 international organizations

    This is outrageous! 20 organizations from worldwide, has just been banned from entering Israel. Israel banned us for our support of the nonviolent boycott, divestment and sanctions (BDS) movement and because we oppose their human rights violations - human rights violations that are committed with US weapons and US military assistance.

    The organizations that have been banned: 

    1. France-Palestine Solidarity Association
    2. BDS France
    3. BDS Italy
    4. The European Coordination of Committees and Associations for Palestine
    5. Friends of Al-Aqsa
    6. Ireland Palestine Solidarity Campaign
    7. The Palestine Committee of Norway
    8. Palestine Solidarity Association of Sweden
    9. Palestine Solidarity Campaign
    10. War on Want
    11. BDS Kampagne
    12. American Friends Service Committee (a Quaker organization)
    13. American Muslims for Palestine
    14. Code Pink
    15. Jewish Voice for Peace
    16. National Students for Justice in Palestine
    17. US Campaign for Palestinian Rights
    18. BDS Chile
    19. BDS South Africa
    20. BDS National Committee


    US tax dollars bankroll the Israeli occupation of Palestine to the tune of $3.8 billion a year and US weapons companies take advantage of Israel’s occupation. While CODEPINK is no longer permitted to travel into the country, Lockheed Martin maintains a subsidiary office and booming industry profiting off of attacks on the Palestinian people. There is a way we can all continue to challenge the militarized occupation of Palestine and to oppose corporate complicity in Palestinian human rights violations.

    In the tradition of the nonviolent BDS movement, we can all get to work urging our cities, universities, pension funds, faith communities, and more to divest from US weapons companies for their profiteering from supplying the tools of warfare to brutal regimes like Israel, Egypt and Saudi Arabia.

    Take the pledge to Divest from the War Machine and join us as we host a Week of Action to #divestfromwar from February 5th to 11th! Be one of the groups around the country holding fun and creative actions to highlight how deeply embedded the war machine is in every aspect of our society. 

    Being a part of this new Israeli blacklist only enhances our dedication to work for justice, equality, and freedom for all people. It speaks to the legitimacy and power of divestment as an effective nonviolent tool for social change and strengthens our resolve to help build the movement.

    Join us to stop weapons companies and their investors from making a killing on killing. Pledge now to #divestfromwar and learn how to get to work in your own community for the Week of Action in February! Pulling money from these merchants of death will help the Palestinian cause and everyone around the world who is suffering from war. Let’s work together to shine a light on those who profit from war and repression!

    In peace and solidarity!

    References: