Friday, October 21, 2016

Windows Update Error 8024402C

1. Go to Administrative Tools/Services and find the Windows Update service. Stop it.
2. Go to C:\Windows\ and rename the SoftwareDistribution folder to something like SoftwareDistribution.old
3. Restart the Windows Update service.
4. Click the Check for Updates button on the Windows Update screen.
5. Windows will perform the check - it may take some time, so leave it running. Eventually it will successfully complete.
6. You can then delete the SoftwareSistribution.old folder.


Saturday, October 15, 2016

bash history with timestamps

This is definitely something useful!
How to attach timestamps to the history of the bash commands?
Simple:  just set (in the way you like to have your time format) the bash variable HISTTIMEFORMAT

For example to have the format: day/month/year - hours:minutes:seconds" type this:

export HISTTIMEFORMAT="%d/%m/%y - %H:%M:%S: "

and then just run history

That's it!


Thursday, October 13, 2016

"Server is either down or too busy to respond" with AppStatusCheck

If you got this problem (and your server IS up and running!) it means you haven't set the correct JDBC driver in your AppStatusCheck.tra file.

The path to the JDBC driver (for example ojdbc6.jar) must be set in the property


That's it!

Tuesday, October 11, 2016

What every programmer / computer scientist should know about X

Here are some useful references for Programmers/Computer Scientists.

What every programmer / computer scientist should know about X where X is:

  • Memory: What Every Programmer Should Know About Memory by Ulrich Drepper (2007) Recommended by Scott Meyers. Links: pdf, pdf
  • Floating point: What Every Computer Scientist Should Know About Floating-Point Arithmetic by David Goldberg (1991).  Recommended by John Farrier at CppCon 2015. Links: pdf, pdf,
More to come... ;)

Monday, September 26, 2016

Linux: VMWare tools problem: "host software version may not be compatible with the upgrader"

If you run vmware-tools-upgrader-64 to install/upgrade your VMWare tools on your VM and you get the error:

Starting Tools Upgrader
RpcIn: Registering callback 'reset'
RpcIn: Registering callback 'ping'
RpcIn: Registering callback 'Capabilities_Register'
RpcIn: Registering callback ''
RpcIn: Registering callback 'upgrader.cancel'
HgfsChannelGuest_Init: app tools-upgrader rpc = 0 rpc cb = 0.
HgfsChannelInitServer: Initialize Hgfs server.
HgfsChannelInitChannel: Init channel return 1.
HgfsChannelGuestBdInit: guest initialized.
RpcIn: Registering callback 'f'
Upgrader: To VMX: tools.capability.hgfs_server tools-upgrader 1
Rpci: Sending request='tools.capability.hgfs_server tools-upgrader 1'
Rpci: Sent request='tools.capability.hgfs_server tools-upgrader 1', reply='', len=0, status=1
Upgrader: To VMX: upgrader.setGuestFileRoot /tmp/vmware-root/296113e0/
Rpci: Sending request='upgrader.setGuestFileRoot /tmp/vmware-root/296113e0/'
Rpci: Sent request='upgrader.setGuestFileRoot /tmp/vmware-root/296113e0/', reply='Failed', len=6, status=1
RPC greeting failed: Host software version may not be compatible with the Upgrader.
Setting temp directory root failed.
Upgrader failed initialization.
Upgrader: To VMX: tools.capability.hgfs_server tools-upgrader 0
Rpci: Sending request='tools.capability.hgfs_server tools-upgrader 0'
Rpci: Sent request='tools.capability.hgfs_server tools-upgrader 0', reply='', len=0, status=1
RpcIn: Unregistering callback 'f'
HgfsChannelGuest_Exit: app tools-upgrader rpc = 0 rpc cb = 0 chn = 7F42C8489060.
HgfsChannelExitServer: Teardown Hgfs server.
HgfsChannelExitChannel: Exit channel returns.

it means you need to do some extra work to install the VMWareTools ;)

The solution is to unpack manually the tar file and run the installer:

tar xvf VMwareTools-10.0.10-4301679.tar.gz # actual version could be different

cd  vmware-tools-distrib

run (as ROOT) the command



Tuesday, July 26, 2016

Oracle-XE Configuration failes.

I installed today Oracle XE on SUSE 11 and I got this error during configuration:

Database Configuration failed. Look into /u01/app/oracle/product/11.2.0/xe/config/log for details

In the files in /u01/app/oracle/product/11.2.0/xe/config/log

there were these errors:

ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)('

The problem was on my machine the hostname was not pingeable.


Add your current hostname (output of echo $HOSTNAME) to your /etc/hosts file

For example if your hostname is linuxbox :    linuxbox

Then you can re-run the oracle configuration:

/etc/init.d/oracle-xe configure


The Most Difficult Program to Compute? Meet the Ackermann function

The Most Difficult Program to Compute?
Meet the Ackermann function. Fascinating subject :)

 A(x,y)={y+1   if x=0; A(x-1,1)   if y=0; A(x-1,A(x,y-1))   otherwise.

 by Computerphile 


Saturday, July 16, 2016

How to change bash prompt to red when you are root

To change your bash shell prompt to red when you became root,  do the following:

  • login as root
  • vi ~/.bashrc
  • add the this line:  export PS1='\[\e[31m\][root]\[\e[0m\] \W\$'
 That's it!

Monday, July 11, 2016

Useful resources for code Optimization (C/C++/Assembly)

Here some references I find useful when it comes to code optimizations in C++

  • A case for strlen (32 bit only!) :  Just to start with a basic example! 

Tuesday, July 5, 2016

Wednesday, June 22, 2016

How to delete a Windows Service

To delete a windows Service there is a practical and easy command.
 Open a command prompt and digit the command:

sc delete ServiceName

ServiceName  is the name you see when you open the property tab of a service in Windows.


If  "sc delete ServiceName" does not succeed it means you don't have enough privileges to execute this command. In this case open the command prompt as administrator and retry.

Monday, June 6, 2016

Add a new line to a file (ANT)

How do you append lines in ANT?

Two basic things to know:

  • echo task
  • The ant property ${line.separator}

        <echo message="First line. ${line.separator}" file="test_file.txt"/>
        <echo message="Second line ! ${line.separator}" file="test_file.txt" append="true"/>

Notice the "append" attribute on the second echo!

That's all!


Friday, May 27, 2016

Meet Plan9

An interesting look into Plan9. I hope the surviving projects will be successful someday.
A series on the Plan9 fundamentals:

Wednesday, May 25, 2016

R and Matlab

Looking for a comparison between R and Matlab I found this reference.
It is good and free so I like to recommend it!

Friday, April 29, 2016

Bash: How to change recursively owner and group of files and dirs

Sometimes comes in hand to change recursively the owner and group for files in a directory. How to do this in bash?

With this command:

find /starting/path -user "original_owner"  -exec chown someuser:somegroup {} +
You can omit ":somegroup" if you don't want to change the group of the files/folder
For example to change from root to foo of foogroup in the folder /var/lol  use the command:

find /var/lol -user "root"  -exec chown foo:foogroup {} +
NOTE: You must be root to change the ownership of a root-owned file! 

Thursday, April 14, 2016

SSH and login prompt

If you log via SSH and you get a prompt showing only the bash version it means that .bashrc wasn't sourced. SSH sources .bash_profile not .bashrc.
To solve this problem,  create/update .bash_profile with the   following content :

if [ -f ~/.bashrc ]; then
  . ~/.bashrc
 This is the way to go for docker too :)


Tuesday, March 15, 2016

When startx from terminal does not work...

If startx from your terminal does not work, try  
sudo start lightdm
sudo service lightdm start 


Sunday, March 6, 2016

Google Test in Visual Studio

This post is for those who just need "a refresh" of the steps required to set google test with Visual Studio. If you are a newbie, please refer the excellent references at the bottom of this post.

Some simple actions will allow you to use the popular Google Test Framework in Visual Studio.
In a summary you will need to perform these steps:

1) Download the latest version of google test
2) Open and Compile in Visual Studio the TWO Visual Studio solutions you'll find in googletest/msvc: gtest.sln (static libraries) and gtest-md.sln (dynamic libraries)
NOTE: Before open gtest.sln and gtest-md.sln remember to unlock these files (right click and unblock).
3) Neglect the warnings in Visual Studio and
With the DEBUG  configuration  Build -> Build Solution
With the Release configuration : Build -> Build Solution

These steps will create the gtest libraries in msvc/gtest/Debug  msvc/gtest/Release.


NOTE the extra "d" in the Debug libraries (e.g. gtestd.lib vs gtest.lib)

4) To create a test project to support an existing project of yours you'll need to make the following changes in your test project:
  • Be sure your Runtime Library is the same in BOTH project AND it is consistent with the google test libraries you are using: e.g. if you compiled gtest.sln YOU need to set a multi-thread runtime environment : /MT and /MTd , for release and debug solution, respectively.  This is set in General Properties -> C/C++ -> Code Generation. Distinguish between Release and Debug
  • In  General Properties set correctly Include Directories and Libraries Directories
  • In  General Properties -> Linker -> Input-> Additional Dependencies  add the previously generated google test libraries at point 3. Distinguish between Release and Debug.
  •  Make your test project dependent on your NON-test project. Select your test project from the solution explorer. Right Click -> Build Dependencies -> Project Dependencies : Your NON-Test project should be listed among the available projects.

That's it.

You have some linker errors like "Linker error LNK2038: mismatch detected for 'RuntimeLibrary'..."
Be sure that:
  • Runtime Libraries match between your TEST and NON-Test projects
  • The gtest library you are linking is consistent with the runtime Library you chose:  /MT  and /MTd require gtest_main.lib/gtest_maind.lib (static libraries) and  gtest.lib/gtestd.lib (static libraries) while /MD and /MDd require gtest.lib /gtestd.lib (dynamic versions) and gtest_main-md.lib / gtest_main-mdd.lib (dynamic versions).


Saturday, March 5, 2016

How to compile C/C++ programs from command line with Visual Studio

On the subject "compiling from command line with Visual Studio" the Microsoft's page is pretty well done, with some hello world examples for the typical cases (C, C++, .NET etc):

Short version:

Run the command (this will basically open the cmd.exe and the correct environment variables):

Start -> Visual Studio 2015 ->  Visual Studio Tools -> Developer Command Prompt for VS2015

Move to the directory where your C file is located and run the command:

cl <your_C_file>

if you want to compile a C++ program instead:

cl /EHsc <your_C++_file>

That's it.

On the Microsoft's page, you can find many more options.

Saturday, February 27, 2016

How to increase delay time for BIOS for VMWare Guest OS

To increase the BIOS delay time of your guest OS, open the folder containing your VMWare image (on Windows it should be on C:\Data\Virtual Machines\<YOUR_IMAGE_NAME).

Open with Notepad++ the file with extension .vmx  and modify or edit the setting

bios.bootDelay = "5000"

The delay is in milliseconds and the maximum value you can set is 10000 (10 seconds).

Alternatively if you put the line:
bios.forceSetupOnce = "FALSE"

You will get always the BIOS settings. So no crazy fast F2 typing required! This is useful for one-time changes (typically to change the boot sequence).

Another interesting link is this one, that explains how to increase the disk space on the guest os using gparted.


Tuesday, February 16, 2016

Restart ORACLE without using sqlplus

In Linux (as root):

To obtain help on the command:

/etc/init.d/oracle-xe help

Usage: ./oracle-xe {start|stop|restart|force-reload|configure|status|enable|disable}

To restart:

/etc/init.d/oracle-xe restart

Tuesday, February 9, 2016

Execute a script with sqlplus

To execute a sql-script with sqlplus just insert your this command:
(replace  : username, password, connection_string, /path/to/script)
echo exit | sqlplus username/password@connection_string@/path/to/script

Monday, February 8, 2016

How to check the exit code of a command (on Linux and Windows)

To check the exit code of an application on Linux and Windows is very easy.

In a Linux' bash, you need to issue the command: 

echo "$?"

echo "$?" will return the exit code of the previous command (please note that also an empty line counts as a command!)

In a Windows' command prompt:

echo %errorlevel%

Sunday, February 7, 2016

Qt5 Hello World on CentOS from command line with gcc

Install the libraries (I assume you have already installed gcc 4.8.x & friends on your system):
The Qt5 (pronounced as cute-five) base components

sudo yum install qt5-qtbase* 
sudo yum install mesa-libGL-devel -y
Create your project's folder: 
>>mkdir hello_world_qt
>>cd hello_world_qt 
Write hello word C++ file:
>> vi hello_world_qt.cpp
with content: 
#include <QtWidgets/QApplication>
#include <QtWidgets/QPushButton>
int main(int argc, char **argv)
 QApplication app (argc, argv);
 QPushButton button ("Hello world !");;
 return app.exec();
then make a qt project with qmake:
>>qmake-qt5 -project
edit the *new* file by adding the line QT += widgets before TEMPLATE. The final file will look similar to this:
# Automatically generated by qmake (3.0) Sun Feb 7 15:13:47 2016

QT += widgets

TARGET = hello2

# Input
SOURCES += hello_world_qt.cpp
Now generate the Makefile with qmake:
>>qmake-qt5 -makefile
Finally, you can compile your program:
and run it!
NOTE: I ended up with this solution because I got the errors below (missing libraries) 

/home/eddie/QT_HOME/hello_world_qt/hello_world_qt.cpp:20: undefined reference to `QApplication::QApplication(int&, char**, int)'
/home/eddie/QT_HOME/hello_world_qt/hello_world_qt.cpp:22: undefined reference to `QPushButton::QPushButton(QString const&, QWidget*)'
/home/eddie/QT_HOME/hello_world_qt/hello_world_qt.cpp:23: undefined reference to `QWidget::show()'
/home/eddie/QT_HOME/hello_world_qt/hello_world_qt.cpp:25: undefined reference to `QApplication::exec()'
/home/eddie/QT_HOME/hello_world_qt/hello_world_qt.cpp:22: undefined reference to `QPushButton::~QPushButton()'
/home/eddie/QT_HOME/hello_world_qt/hello_world_qt.cpp:25: undefined reference to `QApplication::~QApplication()'
/home/eddie/QT_HOME/hello_world_qt/hello_world_qt.cpp:25: undefined reference to `QApplication::~QApplication()'
/home/eddie/QT_HOME/hello_world_qt/hello_world_qt.cpp:22: undefined reference to `QPushButton::~QPushButton()'
/home/eddie/QT_HOME/hello_world_qt/hello_world_qt.cpp:22: undefined reference to `QPushButton::~QPushButton()'
collect2: error: ld returned 1 exit status 
Sources for this post:

Monday, January 11, 2016

A note on Autoboxing for arrays in Java

There is no autoboxing for primitive type arrays!

    int[] arr={1, 5, 7, 0, 4, 5, 10, 11, 40};
cannot become *automatically*

Integer[] arr2 = arr;

You need to loop!

    int[] arr={1, 5, 7, 0, 4, 5, 10, 11, 40};
    Integer[] arr2 = new Integer[arr.length];
    for (int i=0; i < arr.length; i++)