Friday, July 28, 2023

Upload and download artifact from Nexus using curl

 Upload and download artifact from Nexus using curl

 

  To upload:
  curl -X POST "http://localhost:8081/service/rest/v1/components?repository=devopsrepo1" -H "accept: application/json" -H "Content-Type: multipart/form-data" -H "Authorization: Basic YWRtaW46QmFhS3VtYmk1Iw==" -F "raw.directory=devops" -F "raw.asset1=@C:\Users\Devyan\Downloads\commons-lang3-3.12.0-bin.zip;type=application/x-zip-compressed" -F "raw.asset1.filename=commons-lang3-3.12.0-bin.zip"
 
   curl -X POST "http://localhost:8081/service/rest/v1/components?repository=devopsrepo1" -H "accept: application/json" -H "Content-Type: multipart/form-data" -H "Authorization: Basic YWRtaW46QmFhS3VtYmk1Iw==" -F "raw.directory=devops" -F "raw.asset1=@C:\Users\Devyan\Downloads\commons-lang3-3.12.0-bin.zip;type=application/x-zip-compressed" -F "raw.asset1.filename=reportium-java-2.2.9.jar"
 
  To Download:
 
  curl -O --output-dir C:\Users\Devyan\Downloads http://localhost:8081/repository/devopsrepo1/devops/commons-lang3-3.12.0-bin.zip
  curl -O --output-dir C:\Users\Devyan\Downloads http://localhost:8081/repository/devopsrepo1/devops/reportium-java-2.2.9.jar
  

Tuesday, May 23, 2023

pyscript program to display csv data to html table

 

 To install httpserver: pip install httpserver

 

To Run  web server:  python3 -m http.server

 

Open http://0.0.0.0:8000/

 

python3 -m webbrowser http://0.0.0.0:8000/

 

It will open default index html page.

 

 <html>
    <head>
      <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
      <script defer src="https://pyscript.net/alpha/pyscript.js"></script>
      <style>
        table {
          border-collapse: collapse;
          width: 100%;
        }
       
        th, td {
          text-align: left;
          padding: 8px;
        }
       
        tr:nth-child(even) {background-color: #f2f2f2;}
      </style>
    <py-env>
        - pandas
        - paths:
          - ./reportint.csv
          - ./reporttest.csv
      </py-env>
   
    </head>
  <body>
    <h1><b>Application overview TEST:</b></h1><br><br>
    <py-script>
      import pandas as pd
      column_names=["DATE","USER",'

COMMENT']
      a = pd.read_csv("reportint.csv",names=column_names)
      a.to_html("Table.htm")
      html_file = a.to_html()
      print(a.to_html())
     
    </py-script>
    <br><h2><b>Application overview INT:</b></h2><br>
    <py-script>
      import pandas as pd
      column_names=["DATE","USER",'COMMENT']
      a = pd.read_csv("reporttest.csv",names=column_names)
      a.to_html("Table.htm")
      html_file = a.to_html()
      print(a.to_html())
           
    </py-script>
  </body>
</html>
 

Wednesday, April 12, 2023

Find absolute path using java

 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="java.io.*" %>    
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/app/util/ContextMenuCheck.js"></script>
<meta charset="ISO-8859-1">
<title>Absolute Path</title>
</head>
<body>
Absolute Path is:<%= getServletContext().getRealPath("/js/app/util/ContextMenuCheck.js") %>
</body>
</html>