Java notes from chatGpt: How to create Apache Ant-Ivy project?

 How to create Apache Ant-Ivy project?

Apache Ant is a Java-based build tool that is commonly used for building and deploying Java applications. Ivy is a dependency management tool that can be used with Ant to manage project dependencies.


Here is a brief tutorial on how to use Apache Ant with Ivy:


1. Install Apache Ant and Ivy: Download and install the latest versions of Apache Ant and Ivy from their respective websites.


2. Create an Ant build file: Create a build.xml file in your project directory and add the necessary tasks for building your project. This file will define the build process for your project.


3. Set up Ivy: Create an ivysettings.xml file in your project directory and configure it to use the repositories where your project dependencies are stored. You can also define the dependency versions and configurations that you want to use.


4. Define dependencies in build.xml: In your build.xml file, use the ivy:resolve task to download and resolve your project dependencies. You can also use the ivy:cachepath task to create a classpath for your project based on the resolved dependencies.


5. Use dependencies in your project: Once the dependencies are resolved, you can use them in your project by adding them to your classpath or referencing them in your code.


Here's an example build.xml file that uses Ivy to resolve dependencies:


```

<project name="myproject" default="compile">

 

  <target name="resolve-dependencies">

    <ivy:resolve/>

    <ivy:report todir='ivy-reports'/>

  </target>


  <target name="compile" depends="resolve-dependencies">

    <javac srcdir="src" destdir="bin">

      <classpath>

        <ivy:cachepath pathid="compile.path"/>

      </classpath>

    </javac>

  </target>

 

</project>

```


This build.xml file defines two targets - "resolve-dependencies" and "compile". The resolve-dependencies target uses Ivy to resolve dependencies and generate a report, while the compile target uses the resolved dependencies to compile the project code.


This is just a basic example of how to use Apache Ant with Ivy. There are many other features and configurations that you can use to customize your build process. For more information, you can refer to the official documentation for Apache Ant and Ivy.


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

How to create ivysettings.xml & use in build.xml file?

To create an ivysettings.xml file and use it in your Ant Ivy project, follow these steps:


1. Create ivysettings.xml file: Create a new file named "ivysettings.xml" in the root directory of your Ant project. This file will contain the configuration settings for Ivy.


2. Add settings to ivysettings.xml: Open the ivysettings.xml file and add the settings you want to use for your project. For example, you can specify the locations of your repository servers, the credentials to access them, and any other configurations you want to use. Here's an example of a simple ivysettings.xml file:


```

<ivysettings>

  <settings defaultResolver="main" />

  <credentials host="myrepo.com" realm="My Repository Realm"

     username="myuser" password="mypassword"/>

  <resolvers>

    <ibiblio name="main" root="http://myrepo.com/repo/" m2compatible="true"/>

  </resolvers>

</ivysettings>

```


This example defines a default resolver named "main" that uses an Ivy repository located at "http://myrepo.com/repo/". It also sets up credentials for accessing the repository.


3. Add ivysettings.xml to build.xml: Open your build.xml file and add a reference to the ivysettings.xml file by using the "ivy:settings" task. Here's an example:


```

<project name="myproject" default="resolve">

  <target name="resolve">

    <ivy:settings file="ivysettings.xml"/>

    <ivy:retrieve pattern="lib/[artifact]-[revision].[ext]"/>

    <ivy:resolve/>

  </target>

</project>

```


This example defines a target named "resolve" that uses the ivy:settings task to reference the ivysettings.xml file. It also uses the ivy:retrieve and ivy:resolve tasks to retrieve dependencies and resolve them.


4. Run the build: Save your build.xml file and ivysettings.xml file, and then run the build using the "ant" command. Ivy will use the settings defined in ivysettings.xml to retrieve and resolve your project dependencies.


That's it! You now know how to create an ivysettings.xml file and use it in your Ant Ivy project to manage dependencies.

Ubuntu 22.03 Notes: Keyboard Shortcut to Switch between multiple moniters

 Super + P

Above combination in keyboard will do the work

Note: Super key in keyboard is (normally what we call as Windows button in keyboard)

Ubuntu 22.04 -Virtual Box Notes

 Uninstall Virtual Box 6.1 From Ubuntu

sudo apt-get remove --purge virtualbox-6*
Then run auto-clean command.
--------------------------------------------
Reinstalling Virtual Box 7.0 in Ubuntu
sudo vim /etc/apt/sources.list
Add this to the file
deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian jammy contrib
Add signature using command
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg
Install Virtual box 7.0 latest version using command
sudo apt-get update
sudo apt-get install virtualbox-7.0
======================================
Download respective extension pack from link https://www.virtualbox.org/wiki/Downloads
Open VirtualBox->File->Tools->Extension Pack Manager
Remove Old extension pack  if there
Install->Browse current extension pack & Install

Ubuntu terminal command to switch to any drive

 cd /media/<user_name>/<drive_name>;

Change Ubuntu 22.04 LTS desktop background to pure black

 gsettings set org.gnome.desktop.background picture-uri "";

gsettings set org.gnome.desktop.background picture-uri-dark '';

gsettings reset org.gnome.desktop.background color-shading-type;

gsettings set org.gnome.desktop.background primary-color '#000000';

Notes: Install hplip in Ubuntu 22.04 along with plugin

 Commands are as follows:

sudo apt update && sudo apt upgrade -y;

sudo apt install software-properties-common apt-transport-https -y;

sudo add-apt-repository ppa:kelebek333/hplip -y;

sudo apt-get update;

sudo apt-get install hplip hplip-gui -y;


===

Next you need to install respective plugins

Check the version of hplip using command: dpkg -l hplip

Then, download corresponding plugin file & .asc file that matches with version from link https://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/

Then in terminal, type: hp-plugin

Then follow the GUI screen to install plugin.

Notes: Ubuntu-Libreoffice: Uninstall default Libreoffice provided with Ubuntu & install of your own

 Default Libreoffice that come with ubuntu don't have full version, like it don't have Libreoffice base. So one may need to uninstall default version & install full version of their own.

Terminal command to uninstall Libreoffice completely is as follows:

sudo apt-get update;sudo apt update

sudo apt-get -y remove --purge libreoffice* libexttextcat-data* && sudo apt-get -y autoremove

--

Terminal command to install Libreoffice full version after that is as follows

sudo add-apt-repository ppa:libreoffice

sudo apt install libreoffice

--

Verify installed version

libreoffice --version

Regarding site Free Browser Tool (https://free-browser-tools.mohitkrgupta.dev) (discussion with google search AI)

Various discussions with Google Search AI regarding site  Free Browser Tool are as below: site free-browser-tools.mohitkrgupta.dev what doe...