Microsoft Lync for Ubuntu / Linux

If you are Linux user and require to use Microsoft Lync communication you may have small problem. Currently it works only for Windows based systems or eventually for Macs.

So what can Linux user do?
Actually there is quite easy workaround. You can use Pidgin as general IM tool and install additional plugin which will get you connected with Lync users.

Follow the steps below:
  • sudo apt-get install pidgin
  • sudo apt-get install pidgin-sipe (this has specified plugin)
From now on you can add "Office Communicator" account to the Pidgin.

Provide your details (user name, psswd, etc.) and try to connect. It can offer to accept the certificate which is fine to do.

There might be 'READ ERROR' on connection. If so, run command below before starting Pidgin:

export NSS_SSL_CBC_RANDOM_IV=0

pidgin

However it may be annoying to type this extra bit every time you run the IM. In that case you may consider of writing small script to do that for you.

This solution has been tested under Ubuntu distribution but should also work for other cores.

Cheers!

Resolving 'The terminal server has exceeded the maximum number of allowed connections'

When you are working on the remote server using remote desktop connection you may see the error when trying to connect:

"The terminal server has exceeded the maximum number of allowed connections"

The reason behind that is that Windows Server only allows limited number of RDP connections (usually just 2). There are couple of scenarios when this error can occur:
  1. There are already two people connected to the same server.
  2. There are disconnected sessions which from the server view are still active.

But in most cases the first scenario causes the error.

How to get rid of it?
Basically you will need to have an access to that machine from the other machine.
Then you can run command line and view users connected to the specified server. Use the query session command as follows:

query session /server:SERVER_IP_ADDR

It should display information such as session name, user name, id, state, type, etc. The most important is an identifier (ID) - you can reset a session of the given ID:

reset session [ID] /server:SERVER_IP_ADDR

This is it. You should be able to connect to that server.


How to make a column header immovable in JTable

I am not fulltime Swing developer but I have come to this little problem quite lately.  JTable columns headers are movable by default which sometimes can be annoying. Even if you do not want to move them you can do it by accident when for example trying to sort the column data.

Actually solution is pretty simple. Just use a custom table header renderer :)

It can be something like this one:
-----------------------------------------------------------------------------------------------------------------------
public class UnmovableTableHeader extends JTableHeader {

    public UnmovableTableHeader(TableColumnModel model) {
        super(model);
    }

    @Override
    public void setDraggedColumn(TableColumn aColumn) {
        super.setDraggedColumn(null); // it does the trick :)
    }

}
-----------------------------------------------------------------------------------------------------------------------


Then it can be set directly on JTable object. Assuming there is somewhere an instance of JTable called table:

TableColumnModel cm = table.getColumnModel();
UnmovableTableHeader th = new UnmovableTableHeader(cm)
table.setTableHeader(tableHeader);

That's all - columns cannot be dragged but you can still use them (i.e. sorting).