Posts

How to use KUDU to check Azure App Service OS version

Kudu is the engine behind git deployments in Azure Web Site and it can also run outside of Azure. Please click here for more details.

Kudu can be used to find out an Azure App Service's OS version and all of other details like other environmental details etc. and here are the steps to check the OS system of you App Service;
Login to Azure Portal with you credentials, and find your App Service.Find the publishUrl of your App Service, it should be something like this;your-app-name.scm.azurewebsites.net:443Now simply go to this url; https://your-app-name.scm.azurewebsites.netIn the Environment page, under System info, you will find the details for your system, including your Azure App Service's OS version. Hope it helps.


How to: Cleanup IIS Log Files

If you have got a Windows Web Server, it is possible that IIS is enabled to generate the IIS Log files and over the years this could cause some disk space problems.

In order to clear up the disk space; one good option is cleaning up the old IIS log files automatically by using a Windows Scheduler Task and a Powershell script.

For this solution; all credit goes to Bob McCoy, this has helped me and my Client, hope it will help you, too.

Step 1: Copy/Create Script

Copy the following script to a place where your privileged user can get to it. Since it's going to be run by the task scheduler, you don't want it somewhere where users can modify it to accomplish their nefarious purposes.

# Script to be run weekly by task scheduler to cleanup IIS log files
# greater than 30 days old.
$start = (get-date).AddDays(-30)
cd c:\inetpub\logs\logfiles\w3svc1
Get-ChildItem | where {$PSItem.LastWriteTime -lt $start} | Remove-Item

If you are running PowerShell v2, replace $PSItem with $_.

Step 2: S…

Umbraco Notifications - Save and Send For Approval Process

Image
In Umbraco you can give different permissions to the different Umbraco users and some of these users might have rights to only create or update content nodes but not to publish them. In this case; you might need your Umbraco system to send notification e-mails to the Umbraco users who can then publish the content nodes.

To do this; you can write your own custom code by creating some event handlers or you can use built-in Umbraco notification functionality.

For the second built-in option first login to Umbraco as admin and go to User's section and update the permissions as shown below;



Once you are done with the user permissions, subscribe your Umbraco users to the content nodes, simply login to Umbraco with those users and find the content node, right click on it and select the following option;



After this you need to make changes in the web.config file of your Umbraco project. For my case I am using my test gmail account for sending e-mails. In order to use your gmail account as …

MS SQL Server - Finding Running Server Processes and Killing the Processes which are Currently in a Blocked State

It is sometimes needed to see the running server processes and if necessary kill the ones who are in a blocked state. In order to do that you can use the following T-SQL scripts;

This will return you the active processes and simply using the session_id value, you can kill the processes.

SELECT sqltext.TEXT,             req.session_id,             req.status,             req.command,             req.cpu_time,             req.total_elapsed_time FROMsys.dm_exec_requests req CROSSAPPLYsys.dm_exec_sql_text(sql_handle)AS sqltext

KILL [session_id] GO

Also you can run the following script and check the BlkBy field for the SPIDs that are blocking other processes and then you can kill them.
EXECsp_who2 GO
KILL 53 GO
Once you run the "KILL" command, you can run the following command to check the results again;
EXECsp_who2 GO

Kali Linux - Verifying Integrity and Authenticity of Kali Linux .iso Image On Windows Machine

Image
When you decide to install Kali Linux to your computer, you first need to go to the official website and decide which image to download. While this page is TLS-protected, the actual download link points to an unencrypted URL that offers no protection against potential man-in-the-middle attacks. As a result; you must verify your Linux image.

In order to do that;

First copy the sha256sum value of the image that you're downloading to somewhere safe. Download the imageOpen Windows PowerShellType this command and hit enter get-filehash FILEPATHIt will take a little while for Powershell to return the Algorithm, Hash and Path details of your file.Check the Hash value with the sha256sum  value of your image. If they don't match, this could be security risk, otherwise you can install your Kali Linux. Happy coding.


How to use JQuery Ajax Methods for Async ASP.NET MVC Action Methods

Making repeatedly calls to async methods can be a nightmare. In this case, it makes sense to use 2 ajax methods, instead of one.

Here is a simple solution to overcome this problem. See that ajaxcallsis emptied after the success response for the first ajax call and then the second ajax method is used to make one single call to the async action method.

Hope it helps.


View:

@section Scripts{ <scripttype="text/javascript">
var smartDebitObject = new Object(); smartDebitObject.MembershipNumber = $("#MembershipNumber").val(); smartDebitObject.ProfileId = $("#ProfileId").val(); smartDebitObject.FirstName = $("#FirstName").val(); smartDebitObject.LastName = $("#LastName").val(); smartDebitObject.AddressLine1 = $("#AddressLine1").val(); smartDebitObject.Postcode = $("#Postcode").val(); smartDebitObject.Town = $("#Town").val(); smartDebitObject.FrequencyType = $("#FrequencyType").val(); var request = JSON.string…

Briefly Stateless and Stateful Design in Programming

Stateless programming is related to the mathematical notion of a function, which when called with the same arguments, always return the same result. This is a key concept of the functional programming paradigm.

In other words;
Stateless means there is no memory of the past. Every transaction is performed as if it was being done for the very first time.

Stateful means there is memory of the past. Previous transactions are remembered and may affect the current transaction.

RESTful we services are by design stateless, so is ASP.NET MVC.

Stateless: //The state is derived by what is passed into the function function int addOne(int number) { return number + 1; } Stateful: //The state is maintained by the function private int _number = 0; //initially zero function int addOne() { _number++; return _number; }