Friday 8 April 2016

Kill a process in windows

There are occasions when normal means of stopping or undeleting a service cannot be done because of the "..cannot accept control messages at this time". I have previously showed away how to forcefully stop and delete such a service with the sc.exe program. But now even that didn´t work and the program was not shown as a running process.

I did however find the .exe program using the following command:

tasklist

It lists all running processes and services together with their process id (PID). By using the following command I could make sure the process is killed in its entirety:

taskkill /pid <processid> /f

The process will be killed and you could continue what you where doing.

Friday 15 January 2016

Setup a local FTP Server on Windows 8

In one of my projects - for testing purposes - I needed to setup a local FTP server in my development environment to run locally so I could test FTP commands to send files somewhere. The best video I found how to do this was this one:


To try to send files to this FTP Server using built-in ftp commands of Windows 8.1 I did this:

1. Open a command windows in administrator mode
2. Type

open <ipadress> /* connects to ftp-server */
<enter credentials>

dir <lists files> /* lists all files on ftp-server */

send <filename> /* To upload file to ftp-server */

Friday 20 November 2015

Cannot edit sourcefiles in Visual Studio - Solution

I just upgraded to Visual Studio 2015 Enterprise from Visual Studio 2013 on my Windows 8.1 Surface Pro 3 machine. When trying to fix that VS2015 should always open up as administrator by using the "troubleshoot compatibility" context option on devenv.exe and then raise permissions I suddenly found myself with the compiler error option when starting ANY of my IIS applications. 

I had to both uninstall VS2015 and then restore a previous system restore point to be able to get my applications to work again but I was struck with another odd thing. I couldn´t edit my source code. The solution was to clear the Resharper cache and restart Visual Studio. 


Friday 25 September 2015

Jquery: Prevent doubleclicks on button

A simple way in Jquery to prevent a button to be clicked more than once but still allow it to proceed to server-side handling is to add the following Jquery function:

  var clicked = false;
  // Disable saveÅterfört button when clicked once  
     $("#ctl00_Main_btnSaveAterfort").click(function () {
       if (clicked === false) {
         clicked = true;
         $('#ctl00_Main_btnSaveAterfort').trigger('click');
         $(this).attr('disabled', true);
       }
     });

Wednesday 17 June 2015

How to recover from a single user mode database

If the SQL Server database you are working with are set to single user mode, it accepts only one active connection. You might not be able to access the database at all.


1. First you must ensure that there are no other active connections to the database. You could find out by running this SQL:

select d.name, d.dbid, spid, login_time, nt_domain, nt_username, loginame
  from sysprocesses p inner join sysdatabases d on p.dbid = d.dbid
 where d.name = 'dbname'
go

2. Then use the spid and kill that connection with

kill <spid>

3. Lastly, you could set the database to multiuser with this command:

ALTER DATABASE <database name>
SET MULTI_USER;

Wednesday 6 May 2015

Windows 8.1 - Error Connecting to VPN

Error 850: The Extensible Authentication Protocol type required for authentication


When replacing my old work computer to the Surface Pro 3 I had to setup my VPN connections from scratch again. After following my usual instructions I still couldn´t connect but received the above error message.

The solution turned out to be to check the "Microsoft CHAP Version 2..." in the properties of the VPN connection as detailed in this more detailed post.


Wednesday 15 April 2015

Windows uptime and last boot date

In my work I sometimes encounter problems that are related to servers having been rebooted without my knowledge. To find out when a windows machine was last rebooted, you have several options to choose from. The quickest way to find out how long the server has been running since last reboot is to go to the task manager. 

On a Windows 2008 machine you find the uptime since last reboot in the performance tab:


In Windows 8 it looks a little bit different but could be found at the same place:



This works well if it happened recently but say you would like to know the exact date when the windows machine was rebooted, you could take help from Systeminfo:

systeminfo | find /i "Boot Time"
Example: