Browsed by
Category: MS Windows

SonarQube

SonarQube

7 axesSonarQube is an open platform to manage code quality. As such, it covers the 7 axes of code quality.

For some time a technology that is very popular with Java developers, but Microsoft has been working hard with Sonar Source to support it, starting from the release of Visual Studio 2015 for the .NET platform. The result is a great free Code Analysis tool to clarify Technical Debt, but also to show that it is eliminated.

Below a webinar (Dutch) from Delta-N about SonarQube.

SonarQube Dashboard Example

Apache service not starting on Window 10

Apache service not starting on Window 10

Having problems starting the Apache service on Windows 10? Probably port 80 is used by another process.

When you check which process is using port 80 (use Resource Monitor), it probably is the ‘System’ process (PID=4).

Resource Monitor

This means that a process by default installed and started by Windows is using port 80. Big chance that the ‘World Wide Web Publishing Service’ is running. Just stop it and set the Startup Type to ‘Manual’

e World Wide Web Publishing Service

Now try starting the Apache service again. If it is running, the Resource Monitor should now show that the ‘httpd.exe’ process is using port 80.

Resource Monitor

How to disable System service from listening to port 80

How to disable System service from listening to port 80

When you try to run Apache (or any other web server service), it can happen that Windows is not allowing to start it, because port 80 is already in use. To find out which process is using port 80, you can use the Resource Monitor (just run resmon.exe). Open the ‘Network’ tab and open the ‘Listening Ports’ section.

Resource Monitor

Another way to find out is to use ‘netstat -a -n -o | find “:80”‘.

How to solve the problem

If the process is just a ‘normal’ process, you just need to stop the associated service to free port 80. If it’s the System process (PID=4), that is using port 80, then we need to disable http.sys.

There are two ways to disable it:

  1. Go to device manager, select ‘View -> Show hidden devices’, go to ‘Non-plug and Play Driver -> HTTP’ and double click it to disable.
  2. Launch RegEdit, go to ‘HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP‘ and change to value of ‘start‘ to 4.
    After this you need to reboot your computer.

The following values are valid for the ‘start’ property:

0 Boot
1 System
2 Automatic
3 Manual
4 Disabled

 

Automatically check disk for errors the next time the computer is restarted

Automatically check disk for errors the next time the computer is restarted

chkdskIf you want to check your disk for errors you can use chkdsk, but chkdsk doesn’t have an option to schedule the check, so the check is performed on start-up.

With the utility fsutil, it is possible to schedule the check. Run the following command (as administrator), to schedule a check on start-up: fsutil dirty set d:

Reboot the computer after executing this command and the set drive will be checked on start-up.

See what process is using a TCP port

See what process is using a TCP port

In some cases you want to know which process is using a certain TCP port. By running the following command can determine which process is using which port:

[text]

netstat -a -n -o

[/text]

You will see an output like this:

[text highlight=”16″]
Active Connections

Proto Local Address Foreign Address State PID
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4
TCP 0.0.0.0:81 0.0.0.0:0 LISTENING 11464
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 844
TCP 0.0.0.0:443 0.0.0.0:0 LISTENING 2620
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4
TCP 0.0.0.0:554 0.0.0.0:0 LISTENING 5124
TCP 0.0.0.0:902 0.0.0.0:0 LISTENING 3396
TCP 0.0.0.0:912 0.0.0.0:0 LISTENING 3396
TCP 0.0.0.0:2103 0.0.0.0:0 LISTENING 2220
TCP 0.0.0.0:2105 0.0.0.0:0 LISTENING 2220
TCP 0.0.0.0:2107 0.0.0.0:0 LISTENING 2220
TCP 0.0.0.0:2869 0.0.0.0:0 LISTENING 4
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING 10232
TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING 1408
TCP 0.0.0.0:5050 0.0.0.0:0 LISTENING 12904
TCP 0.0.0.0:5357 0.0.0.0:0 LISTENING 4
[/text]

If for example you are looking for the process that is using port 3306, than in this example this would be the process with PID 10232. By using the Windows Task Manager you could find the process using this port.

Another way to find the process would be using the tasklist command:
[text]
tasklist /svc /FI “PID eq 10232″
[/text]

The result of this command tells us that the MySQL daemon is using port 3306:

[text highlight=”3″]
Image Name PID Services
========================= ======== ==============
mysqld.exe 10232 asterix
[/text]

When you do a lot of these port searches, you can always create a script like this:

[text highlight=”8,16”]
@echo off

REM Check arguments
if (%1) == () goto usage

REM Find the process using the given port
set pid=
netstat -a -n -o | findstr %1 > port.txt
for /F “tokens=5” %%a in (port.txt) do set pid=%%a
del port.txt

REM Check if a process was found using the given port
if (%pid%) == () goto notfound

REM Show the process using the given port
tasklist /svc /FI “PID eq %pid%”
goto end

:usage
REM Show usage message
echo.
echo USAGE: %0 [port]
echo.
goto end

:notfound
REM Given port is not in use
echo.
echo Port %1 is not used
echo.
goto end

:end
[/text]

Quickly access the command prompt

Quickly access the command prompt

As a programmer you sometimes need to use the command-line and start some command from a certain directory. This little registry hack show you how you can easily add a menu item to the context menu of Windows Explorer. These are the actions to take:

  1. Start the Registry Editor (regedit)
  2. Add the following key: HKEY_CLASSES_ROOT\Directory\shell\Command.
    Change the (default) value to ‘Command prompt’.
  3. Add the following key: HKEY_CLASSES_ROOT\Directory\shell\Command\command.
    Change the (default) value to ‘cmd.exe /k “cd /d %L”‘

This works for MS Windows Xp and newer versions of MS Window.

Generate XML-file from your internal data

Generate XML-file from your internal data

Are you a .Net programmer and ever wanted to write your internal data to an XML-file without wanting to do the writing yourself? Well here’s some example code which can be useful for you.

First some classes representing the internal data.

[csharp]
using System.Collections.ObjectModel;

namespace XmlSerializer
{
public class DataContainer
{
public JustSomeData Data1;
public Collection Data2;
}
}
[/csharp]
[csharp]
namespace XmlSerializer
{
public class SomeMoreData
{
public long Id;
public string Name;
public int Age;
}
}
[/csharp]

The internal data will be written to a XML-file using the XmlSerializer. The following code shows a method which will initialize the internal data and will write this data to a XML-file.

[csharp highlight=”41,42-51″]
private void ShowXmlSerialization()
{
#region Init

// Main data
var dataContainer = new DataContainer();
dataContainer.Data2 = new Collection<SomeMoreData>();

#endregion Init

#region Generate some data

// Just some data
var justSomeData = new JustSomeData()
{
Id = 1,
Code = "Demo",
Description = "Just some demo data"
};

// Add it to the main data
dataContainer.Data1 = justSomeData;

// Some more data
dataContainer.Data2.Clear();
for (int i = 1; i <= 5; i++)
{
var someMoreData = new SomeMoreData();

someMoreData.Id = i;
someMoreData.Name = string.Format("Name {0}", i);
someMoreData.Age = i * 3 + i * 10;

dataContainer.Data2.Add(someMoreData);
}

#endregion Generate some data

#region Serialize

// Serialize the data
var serializer = new System.Xml.Serialization.XmlSerializer(dataContainer.GetType());

#endregion Serialize

#region Write to file

// Write it to file
var filename = "JustSomeData.xml";
Stream writer = new FileStream(filename, FileMode.Create);
serializer.Serialize(writer, dataContainer);

#endregion Write to file
}
[/csharp]

The generated XML-file will look like:

[xml]
<?xml version="1.0"?>
<DataContainer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Data1>
<Id>1</Id>
<Code>Demo</Code>
<Description>Just some demo data</Description>
</Data1>
<Data2>
<SomeMoreData>
<Id>1</Id>
<Name>Name 1</Name>
<Age>13</Age>
</SomeMoreData>
<SomeMoreData>
<Id>2</Id>
<Name>Name 2</Name>
<Age>26</Age>
</SomeMoreData>
<SomeMoreData>
<Id>3</Id>
<Name>Name 3</Name>
<Age>39</Age>
</SomeMoreData>
<SomeMoreData>
<Id>4</Id>
<Name>Name 4</Name>
<Age>52</Age>
</SomeMoreData>
<SomeMoreData>
<Id>5</Id>
<Name>Name 5</Name>
<Age>65</Age>
</SomeMoreData>
</Data2>
</DataContainer>
[/xml]

Microsoft lanceert Security Essentials 2.1

Microsoft lanceert Security Essentials 2.1

Microsoft heeft een nieuwe versie van de gratis virusscanner Security Essentials gelanceerd. De grootste verandering lijkt dat er geen specifiek besturingssysteem installatiebestand meer gekozen moet worden. Voorheen moesten gebruikers aangeven of ze Windows XP, Vista of Windows 7 gebruikten. Het enige dat gebruikers nu nog moeten kiezen is een 32- of 64-bit installatiebestand.

Wie Security Essentials al gebruikt, krijgt de nieuwe versie nog niet aangeboden. Wie over op Security Essentials 2.1.1116.0 wil, zal daarom het installatiebestand zelf moeten downloaden. Onlangs bleek uit onderzoek dat Security Essentials de meest gebruikte virusscanner ter wereld is.

 

Via: Security.nl

Windows 7 snelstart balk instellen

Windows 7 snelstart balk instellen

In Windows 7 is het niet meer standaard mogelijk om de snelstart balk in te stellen. Dit betekend niet dat deze er niet meer is. Met de volgende stappen is deze eenvoudig weer te gebruiken:

  1. Klik met rechter muisknop op de taakbalk
  2. Kies in het werkbalk menu voor nieuwe werkbalk
  3. Kies in het dan volgende scherm de map: %SystemDrive%\Users\%username%\AppData\Roaming\Microsoft\Internet Explorer\

De snelstart balk wordt nu getoond in de taakbalk. Door de taakbalk los te koppelen (rechter muisknop / taakbalk losmaken) kun je de snelstart balk verplaatsen. Met rechter muisknop klikken op de snelstart balk geeft de mogelijkheid om de tekst labels en titel bij de balk uit of aan te zetten.