Author Archives: Geek

Lotus Notes – Fix Incorrect Unread Mail Count

If you are using IBM Lotus Notes Mail and the unread message count is wrong, then it may be the ‘views’ are not built properly.

Two possible solutions:

Solution 1

From within the mail file, goto Edit -> Unread Marks -> Scan Unread…

It may prompt you to re-build the views, in which case say Yes.

Solution 2

If you are still having problems, then from within the mail file press Ctrl + Shift + F9 to force a rebuild.

Close and reopen the mail file and the problem will hopefully disappear.

The correct permissions needed on a Linux/Unix system for the /tmp and /var/tmp folders.

The /tmp and /var/tmp directories require different permissions to the other root directories. They need to be readable, writeable and executable by anyone but also need to have the Sticky Bit enabled.

The Sticky Bit means that whilst anyone can write to the directory, only the owner and root and edit or remove a file. This is denoted by the ‘t’ in the permissions string below:

# ls -l /tmp
drwxrwxrwt 21 root root 12288 Aug 09 12:37 /tmp

You can change the permissions using CHMOD with a ‘1’ before the normal all access 777 directory permissions:

# chmod 1777 /tmp
# chmod 1777 /var/tmp

How to upgrade to latest version of Ghostscript on Linux/Unix

For a new project, I need to use the latest verison of Ghostscript (at time of going to pixel, this is v9.21). However the CentOS yum install will only give me version 8.7.

Some Googling gave me some helpful answers, including downloading the latest version from the website and using then building manually. Following the instructions required me open a terminal and type:


Which would give me the error:

-bash: ./configure: No such file or directory

Turns out, I was downloading the latest x64 binary file from the Ghostscript website (which shouldn’t be used in a live, production environment). Actully what I needed was the source files.

So the full instructions to install the latest version of Ghostscript (v9.21) from a terminal session:




make install

You should be able to execute and check the version:

/usr/local/bin/gs -v

Which outputs:

GPL Ghostscript 9.21 (2017-03-16)
Copyright (C) 2017 Artifex Software, Inc.  All rights reserved.


How to find a question mark (?) or other wildcard symbol when searching in Excel

Failed solution:

You use Find & Replace to try and find the question mark (or other symbol like percentage % or asterix *) only to realise that Excel considers it to be a wildcard character (i.e. like a blank tile in scrabble, it can mean absolutely anything) and so every single letter in every cell gets highlighted.

Actual solution:

You need to ‘escape’ the character and to have Excel treat it like a real symbol not a wildcard by placing a ’tilde’ symbol (~) in front. As an example with the question mark, the picture below shows its use:

Excel find and replace wildcard with tilde

Detect Adsense Blocker

You own a website where the income comes from Adsense. But some thoughtless freeloaders are blocking your adverts from appearing when they view your site either from using a blocker or by using the private mode in their browser.

Don’t they realise this is costing you?

Using a script I found that I have modified, detect when Adsense hasn’t loaded and so display a message to the user where the advert would normally appear. This can be customised to display anything – even a fixed advert from another source.

I will go through the code line-by-line, but if you want the finished product then just skip to the end.

1. Create two files.

The first will contain the javascript – I’ve called mine ‘adsense_block_detector.js’.
The second will contain the message to display (this called also have HTML or other code). I’ve called mine ‘message.html’ and inserted some text that says “Please don’t block my adverts”.

2. Within the javascript file, start off by wanting the script to run when the page loads:

window.onload = function() {


3. The script should be delayed by a few seconds (in the example I use 2000ms) to give time for the Adsense to load:

window.onload = function() {
setTimeout(function() {

}, 2000);

4. Get the status of the ins.adsbygoogle code that Google supplies to load the advert:

window.onload = function() {
setTimeout(function() {
var ad = document.querySelector("ins.adsbygoogle");

}, 2000);

5. If no advert has loaded (i.e. due to a blocker) then load the message.html file created above.

window.onload = function() {
setTimeout(function() {
var ad = document.querySelector("ins.adsbygoogle");
if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) { = 'display:block !important';
}, 2000);

Script complete. All you need to do is to call this javascript file and jQuery from the head section of your desired webpage.

<script src=""></script>
<script src="/path/to/file/adsense_blocker_detect.js" type="text/javascript"></script>

Quick guide to setting up a VNC Server on CentOS

Install packages
yum install vnc vnc-server

User configuration
Assuming the user has already been configured on your system and have passwords already set.
For a user to be granted VNC access, they must have a VNC password set.
From within that user’s account (or you can su into it, e.g. su vnc_user), run:
And type in your desired password and confirm.

VNC configuration
Using a text editor, open: /lib/systemd/system/vncserver@.service
Search for and replace with the actual required user name.
(ExecStart=/usr/sbin/runuser -l -c "/usr/bin/vncserver %i"

(ExecStart=/usr/sbin/runuser -l vnc_user -c "/usr/bin/vncserver %i"

Save and exit from the file. Run the following commands:
systemctl daemon-reload
systemctl enable vncserver@:1.service

Test setup
service vncserver@:1 start
service vncserver@:1 stop
If the service starts and stops without any errors, then you are ready to set to load at boot up.

Set to run at bootup
chkconfig vncserver on

Set the window manager
Edit your user’s VNC xstartup file: /home/vnc_user/.vnc/xstartup
Add the following to the bottom of the file:
gnome-session &
Save and close the file.

Add exception to iptables:
Edit /etc/sysconfig/iptables and add the following line:
-A INPUT -m state —state NEW -m tcp -p tcp -m multiport —dports 5901:5903,6001:6003 -j ACCEPT
Exit the file and restart iptables:
service iptables restart

Start the VNCServer:
service vncserver@:1 start

Using your client software, you can now connect via the IP address and display number. e.g.

Bulk Extract Hyperlink from Excel Cells

Alas there is no pre-defined function for extracting a hyperlink from an Excel cell. Therefore the easiest way to accomplish this is to create our own function using a macro.

Within Excel, open up the VBA Macro Interface:
Alt + F11

From the VBA interface, goto the menu and select:
Insert -> Module

On the module screen that opens up, paste in the following text:

Function HyperExtract(content As Range) As String
    On Error Resume Next
    HyperExtract = content.Hyperlinks(1).Address
End Function

Save your spreadsheet (you’ll now need to save it as a *.xlsxm format) and close the VBA screen.


Enable or Disable PHP Functions For One cPanel Account

Enabling certain PHP functions for all users can be a security risk. However, by creating a user specific php.ini file, the risk can be mitigated for that one (hopefully trusted) user who needs a bit more functionality.

Step 1: Find the main copy of the php.ini file – probably located as /usr/lib/php.ini

Step 2: Copy it to the root directory of your user.
cp /usr/lib/php.ini /home//public_html/

Step 3: Edit the new php.ini file and edit the ‘disable_functions’ line to include or remove whichever function you want.

Step 4: Create or edit the .htaccess file in the sites root directory and insert the following:
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/<cPanel user>/public_html/php.ini
<Files php.ini>
order allow,deny
deny from all


Find and Replace Text in WordPress MySQL Database

In absence of using a WordPress plugin to do this task, it is possible to find every instance of a particular text string within your posts and replace them.

Simply login to your PHPMyAdmin page and input this query:

UPDATE wp_posts SET post_content = REPLACE (post_content, 'TEXT TO REPLACE', 'REPLACEMENT TEXT');