Posts

Showing posts from January, 2016

Base 64 encoding and decoding

Encoding and decoding of BASE64 format strings for Apache Tomcat web server.  java -cp /usr/tcServer-6.0/tomcat-6.0.33.B.RELEASE/lib/tcServer.jar:/usr/tcServer-6.0/tomcat-6.0.33.B.RELEASE/bin/tomcat-juli.jar:/usr/tcServer-6.0/tomcat-6.0.33.B.RELEASE/lib/tomcat-coyote.jar com.springsource.tcserver.security.PropertyDecoder -encode / -decode base64 <password>

Windows Services, Diskspace, Scheduled Job and URL monitoring in C#

Windows Services, Diskspace, Scheduled Job and URL monitoring in C#:   XmlDocument doc = new XmlDocument();             doc.Load("../../Services_File.xml");             XmlNodeList nodeList = doc.DocumentElement.SelectNodes("/WindowsServices/ServiceList");             string server = "", services = "";             foreach (XmlNode spcnode in nodeList)             {                 server = spcnode.SelectSingleNode("Server").InnerText;                 services = spcnode.SelectSingleNode("Services").InnerText;                 string[] svcList = services.Split(';');                 foreach(string svc in svcList)                     CheckService(server, svc);                             }             doc.Load("../../DiskSpace_File.xml");             XmlNodeList spaceList = doc.DocumentElement.SelectNodes("/DiskSpace/ServerList");             string serverd = "", disksd = &quo

Some Interview Questions: C#

It is also permissible to declare multiple variables of the same underlying type on a single line of code, as in the following three bool variables bool b1 = true, b2 = false, b3 = b1; All intrinsic data types support what is known as a default constructor. This feature allows you to create a variable using the new keyword, which automatically sets the variable to its default value bool b = new bool();              // Set to false.   int i = new int();                // Set to 0.   double d = new double();          // Set to 0.   DateTime dt = new DateTime();     // Set to 1/1/0001 12:00:00 AM All the data types have been derived from System.Object class.  The value types are the types that have System.ValueType in their chain of inheritance.  Usually types related to numbers will be the value types int is a short hand notation for System.Int32. It is a value type . string is a short hand notation for System.String . It is a reference type When you prefix a str

SOAP request through power shell

$postBody = Get-Content -Raw -Path "E:\body.xml" $url = "https://someservice/service" $currentDate = Get-Date $guid = [guid]::NewGuid() $nameOfCertificate = "<certname>" $headers = @{"SOAPAction" = "<MethodName>"} $currentDate</b:MessageText>" #Get current location $currentLocation = (Get-Location).Path Write-Host "ServerName:$env:COMPUTERNAME" #Set Location where to get the cerificate Set-Location Cert:\LocalMachine\My #Get the certificate to be used $certificate = Get-ChildItem | where {$_.Subject.Contains($nameOfCertificate)} try{     $postBody = $postBody.Replace("9bfcb841-2701-4ba4-ada7-0d44445b2dbe",$guid)             $response = Invoke-WebRequest -Method Post -Uri "$url" -Body $postBody -ContentType 'text/xml' -Headers $headers -Certificate $certificate     $xmlResponse = [xml]$response.Content     } catch [exception] {    echo $_.Exc

VB Scripts for Windows Server Monitoring

Various VB Scripts for Server Monitoring : 1) IIS Status Set colOperatingSystems = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem In colOperatingSystems  OSVer= objOperatingSystem.Caption  If InStr(1,OSVer,"2008") > 0 Then      objFile.WriteLine OSVer      WinSevIISFn()     Else    WinThrIISFn() 'create win 2003 server function   End If  Next Function WinSevIISFn()  IISbatpath   = objFSO.GetParentFolderName(WScript.ScriptFullName) & "\IISState.bat"  objShell.run IISbatpath  WScript.sleep(1000)  webstpath      = objFSO.GetParentFolderName(WScript.ScriptFullName) & "\Websitestate.txt"  Appplstpath    = objFSO.GetParentFolderName(WScript.ScriptFullName) & "\AppPoolsstate.txt"  objIISwebState = objFSO.OpenTextFile(webstpath, ForReading).ReadAll  objIISAppState = objFSO.OpenTextFile(Appplstpath, ForReading).ReadAll  IISWebarrLines = Split

Upload file through SFTP : Command Line

option echo off option batch on option confirm off open sftp://was@10.121.144.78:22/ -privatekey=E:\key.ppk -passphrase="passphrase" lcd E:\ put -nopermissions -nopreservetime *.zip /usr/*.zip exit

VB Script for IIS Health Check

Dim tempstatus Dim spaced Dim usernamea Dim username Dim sFile, dFSO Dim serverstatus Dim userid,tempuserid Dim outmem Dim wql Dim StrQuery Dim Htout Dim Appstatus1 Dim Appstatus2 serverstatus="Normal" userid=0 tempuserid=0 On Error Resume Next Set objNTInfo = CreateObject("WinNTSystemInfo") serverName = lcase(objNTInfo.ComputerName) Set objNTInfo = nothing Htout=Htout+"<table border=1 bgcolor='#000080' width=100%><tr><th align=left>"_              + FormatHeaderColumn("Production ICE Web Heath Check") +"</th></tr></table><table border=1 bgcolor='#000080' width=100%><tr><th align=left>"_              + FormatHeaderColumn("Server-Name") + "</th><th align=left >" +  FormatHeaderColumn("AppPools-Status")_              + "</th><th align=left >" + FormatHeaderColumn("W3wp-Usage&

Disk Space VB Script

VB Script for getting disk space on the servers:  strComputer = "." Dim x x=0 Set fso = CreateObject("Scripting.FileSystemObject") Set listFile = fso.OpenTextFile("list.txt") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.CreateTextFile("rs550mblgw02.htm",8) objFile.WriteLine "<html>" & VbCrLf & "<body id=bdy>" & VbCrLf objFile.WriteLine "<table border=1 width=100%>" & VbCrLf & "<tr> <td colspan=1 align=left bgcolor=#fffff6><b><font face='Calibri' size='3' color='black'> Disk Space Report </fond></b></td> <td colspan=4 align=left bgcolor=#fffff6><b><font face='Calibri' size='3' color='black'> Last Updated  " & Now & " GMT</font></b></td> </tr>"  objFile.WriteLine &

Load HTML table with dynamic columns and Rows using jQuery

Load HTML table with dynamic columns and Rows using jQuery: I have seen so many libraries to load a table with dynamic data. But most of them were demanding the column names for the table structure. But it is also possible to load the table with dynamic columns and dynamic rows with the async data. I have tried the example in MVC. My goal here is to load the table with the data from the API which connects to database and fetch results. The query text, connection string values i am providing dynamically to the application. Like query text is in file and connection string in in java script file. View Page: @model IEnumerable<MvcApplication2.Controllers.Qry> @{     ViewBag.Title = "Home Page"; } <div class="row">                          @foreach (var q in Model)     {                   <div class="col-lg-6 queryclass" id="@Guid.NewGuid()">           <div class="panel panel-default">