Convert a SID to String with Java

A security identifier (SID) is an unique identifier, commonly used in Microsoft’s systems. For example, it’s used to identify users within Windows, or, more generally, within an Active Directory.

The SID is a binary value, with a variable length, that can be also be represented as a string. This conversion is implemented by the function called ConvertSidToStringSid, provided by the library Advapi32.dll, available only in Windows.

Hence, if you need to perform this conversion, you can procede with one of these two paths:

  • Use Advapi32 (only in Windows)
  • Rewrite the conversion
Thus, it’s very useful to have that implementation in a particular language (in our case Java), to be used everywhere. I noticed that, after a research in Internet, all the implementations are wrong, despite they work in general. Therefore, I decided to write my own implementation, thoroughly tested to prove you its correctness.

Read more

Exif Remover with exiftool

Hi! Exif data are sometimes considered as “sensitive data”. If you want to share your photo, but you don’t want to give to companies additional information about the location where these photo where taken, or additional information about your equipment, you should remove Exif data. For this reason, I made a simple bash script that removes all Exif entries.

Read more

Network Time Protocol request in C#

I’m writing an application in C# that needs to know if the system time is not fake (only if the network is on). For this reason, I make a class that retrieves the time from a NTP server. The class is written to prevent that the same servers are called too often using a simple circular array. For the data returned by the servers, I invite you to see the RFC-2030.

Read more

ExitWindowsEx in C#

I post you my simple class to shutdown, reboot and logoff Windows using the famous ExitWindowsEx.

Each method is overloaded with another that force the action, in other words, it executes the action without prohibiting Windows to send the WM_QUERYENDSESSION message. In this way the user can’t cancel this action.

Read more

Hide Console Window in C#

I just made a silent application to check how much time my little brother stays on his computer. But, I needed to make an application that doesn’t show any window. Now, I show you my personal solutions to do this for the Console Application Projects and for the Windows Forms Application Projects.

Read more

LAMP Virtual Hosts

In the last post I tell you how you can install LAMP in Ubuntu 11.10. Now I tell you how to configure virtual hosts, in this way you can create a lot of independent sites (also in different domains).

Read more

Install LAMP on Ubuntu

In the last post I tell you how you can install LAMP in Ubuntu 11.10. Now I tell you how to configure virtual hosts, in this way you can create a lot of independent sites (also in different domains).

Read more

VMWare Shared Folder on Ubuntu 11.10

Recently, I’ve installed Ubuntu 11.10 into a virtual machine, using VMware Fusion 4.1.1 on MacOS X. But, after its installation, I’ve found several issues relating to the shared folders. Now, I share with you the steps to resolve these issues.

Read more