Bubble sorting with Perl

#!/usr/bin/perl use strict; use Data::Dumper; sub swap{      @_[ 0, 1 ] = @_[ 1, 0 ]; } sub bsort{      my (@a) = @_;      for my $j (0 .. $#a){            for my $i (0 .. $#a – 1 – $j ){         … Read more

Listing IIS Application Pool Memory usage in PowerShell

Open Powershell as an Administrator on the web server, then run: $apmem= gwmi -ComputerName localhost -NS ‘root\WebAdministration’ -class ‘WorkerProcess’ | select PSComputerName, AppPoolName,ProcessId , @{n=’RAM’;e={ [math]::round((Get-Process -Id $_.ProcessId -ComputerName $_.PSComputerName).WorkingSet / 1Mb) }} | sort RAM -Descending | ft -AutoSize echo $apmem You should see something like: PS C:\Windows\system32> C:\scripts\appool.ps1 PSComputerName AppPoolName ProcessId RAM ————– … Read more

How to troubleshoot memory issues when executing remote Powershell queries

If you are receiving “Processing data for a remote command failed with the following error message: The WSMan provider” message from the PS Queries (e.g. on the Nagios) All you have to do is log on the target computer, and run powershell with Administrator Rights. Then you can increase Powershell memory with below commands You can … Read more

best editor for golang

I was looking for a good (and free) GoLang IDE. Then I found fully opensource LITEIDE. It supports code completion and syntax highlighting. Also has a debugger which running in background. You can download it from below link: http://code.google.com/p/golangide/

How to connect Oracle DB with PowerShell

# Load the ODP assembly [Reflection.Assembly]::LoadFile(“C:\oracle\11.2.0\client_2\odp.net\bin\4\Oracle.DataAccess.dll”)|Out-Null # #vars&cons $stations =@{ “424”=”Istanbul”; “421”=”İzmir” } $dbuser=”user” $dbpasswd=”password” connect to Oracle $constr = ” User Id=$dbuser; Password=$dbpasswd; Data Source=CITIES ” $conn= New-Object Oracle.DataAccess.Client.OracleConnection($constr) $conn.Open() Create a datareader for a SQL statement $sql=”select stationid from CITIES.SWITCHPARAMETER where switchid = ‘2’ ” $command = New-Object Oracle.DataAccess.Client.OracleCommand( $sql,$conn) $reader=$command.ExecuteReader() Write out … Read more