Dec 30, 2011

New UrukDroid 1.6 RC7 is available

Have updated my tablet to UrukDroid 1.6 RC7 - if no problems are found, this will become the
final release.

I upgraded and didn't experience any problems so far.

Dec 28, 2011

Compiling Qt 4.8.0 on OpenIndiana 151

Procedure:

  • download Qt 4.8.0
  • Set Path to include the compiler  ( /opt/SUNWspro/bin ) 
  • adjust the compiler settings to include the X11 libraries and include
    qt-everywhere-opensource-src-4.8.0/mkspecs/solaris-cc/qmake.conf
    QMAKE_INCDIR_X11    = /usr/X11/include                                         
    QMAKE_LIBDIR_X11    = /usr/X11/lib
    QMAKE_INCDIR_OPENGL = /usr/X11/include
    QMAKE_LIBDIR_OPENGL = /usr/X11/lib
  • configure:
    CC=/opt/SUNWspro/bin/cc CXX=/opt/SUNWspro/bin/CC CXXFLAGS="-library=stlport4" LDFLAGS="-library=stlport4" ./configure --prefix=/tools/qt/4.8.0 -opensource
  • gmake
  • qfiledialog.cpp:886 needed the code from the else part of the preprocessor
  • helloconcurrent.cpp failed to compile ( it is from the examples )
    had to do some tricking with the including of qfuture.h and the
    path to src/corelib/concurrent/qfuture.h from include/QtCore/qfuture.h
    I remove QFuture from helloconcurrent.cpp and the whole compile succeede, with some adjustments before.


Dec 27, 2011

Upgrade 1.6RC6 of UrukDroid for Archos Tablet available

The next RC of UrukDroid 1.6 is available. -> UrukDroid 1.6RC6 .

Download and installation were no problems. With RC5 the battery usage seems to be faster.
The short minutes I've upgraded  ( copy archive to /data/UrukUpdate ) didn't
show any problems.

Dec 22, 2011

Yesterday, I upgraded my Archos InternetTablet 10.1 from UrukDroid 1.6RC4
to
UrukDroid 1.6RC5

Did a backup before and installed it. After the installation the automatic
reboot ran in a loop.
I had to do a hard reset, but afterwards the system booted without problems. 

Dec 21, 2011

reduce system usage of firefox by Add-On ToManyTabs

Today I have read in the Book DTrace about an investigation about the
CPU usage of the firefox  browser.
There was the hint about the Plugin ToManyTabs, which allows to move
open tabs to different rows, which act like closed tabs and the
CPU usage drops.

There is a small row in the header where you can switch between different
groups.
When you select an item it is moved to the open tabs and removed from the
group, but you can drag&drop it back to the row.

Dec 20, 2011

VirtualBox 4.1.8 update on OpenIndiana 151

VirtualBox has released a new version 4.1.8 for Solaris. 

Install on OpenIndiana was without problems, but still need LD_NODIRECT=1
for starting, otherwise VirtualBox fails or the Manager doesn't find the
virtual machines.


Dec 16, 2011

code-analyzer in Oracle Solaris Studio 12.3

Oracle has release Solaris Studio 12.3 .
The suite has a new tool called code-analyzer.

It can do static code analyze by adding a compile directive -xanalyze=code.

I've used it for a project, but failed at first, because I had also to give the option on the linking step, but afterwards the executeable get a directory
called <executeablename>.analyze and here is a screenshot.


I had to mask a lot of code, because it's proprietary.
But the tool finds errors, although the code is running since years on different operating systems.


Something strange happend to my Crossbow Network

I'm using the virtual network Crossbow on my OpenIndiana, to route the
traffice between Windows XP in VirtualBox, a Zone and the outer world by
using a virtual network switch.

It worked till Wednesday, but after shut down and starting on Thursday
XP could not connect anymore????.

The Zone can connect and can be pinged from the host, XP not????.

Now I've change to use NAT in VirtualBox and changed in Windows XP the
network to DHCP and the connection itself works but not over the virtual
network.

Have to investigate sometime later why this happened.

Update:
Found the problem in my own former post.

The problem seems that the mac adresse didn't match between VirtualBox
and the setting of the vnic as shown be dladm show-vnic

root@solewer:~# dladm show-vnic
LINK         OVER         SPEED  MACADDRESS        MACADDRTYPE         VID
vnic1        vswitch1     0      2:8:20:55:9e:bf   random              0
vnicvsop0    vswitch1     0      2:8:20:7b:84:43   random              0
vnicsuse1    vswitch1     0      2:8:20:b3:bf:c1   random              0
vnicwinxp2   vswitch1     0      2:8:20:17:e7:c8   random              0

Dec 12, 2011

log4cplus && SysLogAppender

I'm a little experimenting with logging frameworks for C++.
log4cplus is a nice one.

Now I'm doing the first test on OpenIndiana.

The ConfigureAndWatchThread does it's job.
When the app runs and afterwards the config file is copied into the
target directory, the logging starts.

But now I've configured the SysLogAppender:


log4cplus.appender.syslog=log4cplus::SysLogAppender
log4cplus.appender.syslog.ident=WARN
log4cplus.appender.syslog.facility=local0
log4cplus.appender.syslog.layout=log4cplus::PatternLayout
log4cplus.appender.syslog.layout.ConversionPattern=[%d{%d %m %Y %H:%M:%S}] [%t] %-5p %c{2} %%%x%% - %m [%l]%n

And when running the app with the corresponding setting publishes
the message into the configured syslog file:


Dec 12 16:37:44 solewer WARN: [ID 702911 local0.crit] [12 12 2011 15:37:44] [1] FATAL root %% - start of app  [src/main.cpp:36]
Dec 12 16:37:46 solewer WARN: [ID 702911 local0.crit] [12 12 2011 15:37:46] [1] FATAL root %% - finish of app [src/main.cpp:41]

A nice feature to report hard errors to a central logging facility with nearly
no effort.

compiling log4cplus with SunStudio 12.3 beta on OpenIndiana

I experimented with log4cplus on Windows and MinGW, which is an
exquisite suite for compiling on Windows.

Today I attempted to compile the library on my OpenIndiana 151 box.

The compilation with the GCC 4.6.1 was no problem.
The next attempt was to compile with the SunStudio Compiler 12.3 beta, which
is now called Oracle Solaris Studio ( found the former name better, because
the compiler suite is also available for linux which has nothing to do with
solaris ).

The compilation by configure does not continue without problems.
First the PTHREAD was not found -> changed path, so that SUNWspro
was found first and set CC=cc & CXX=CC
Configure was not a problem now, but compiling or to be exact the linking
didn't succeed.


CC: Warning: -xarch=amd64 is deprecated, use -m64 to create 64-bit programs
CC: -library=Cstd cannot be used with -library=stlport4

Therefore I had to manually edit libtool and remove the option -library=Cstd
and also the linking was fine.

Compiled for 32 and 64 bit.

Dec 11, 2011

log4cplus -> dynamic configuration of log during runtime

Today I testetd around with the log4cplus documented here.

I used a simple configuration by properties like:

log4cplus::PropertyConfigurator::doConfigure( logFileName );    

but now I found another possible config by a thread watcher:

log4cplus::ConfigureAndWatchThread watcher( logFileName.c_str(), 5*1000 );

This one checks every 5 seconds the configuration file and updateds the logging
framework.

So by changing the properties, the logging of the running process can be configured.
I've teste this with MinGW on Windows.

log4cplus on Windows with MinGW

Today I tried the log4cplus Framework. Log4cplus is under the Apache License V2.0. 
This one should be more usefull for commercial projects. The last time I wrote about log4cpp.
This framework is under the LGPL licencse. I've found somewhere, that it should be possible to
use in commercial products, but with some restrictions, about only dynamically linked, hint where to
get the source, allowing the customer to change the lib, ....

I've not red the Apache License in detail, because for me it's just an attempt to use it for some testing
and learning a little C++.

log4cplus can be configured and built simple be an MinGW environment on Windows.

For running an app, the DLL of log4cplus must be found on the PATH.

A property file can look like:
log4cplus.rootCategory=ERROR, rootAppender
log4cplus.logger.Names=DEBUG, A1, A2

log4cplus.additivity.Names=false


log4cplus.appender.rootAppender=log4cplus::ConsoleAppender
log4cplus.appender.rootAppender.layout=log4cplus::PatternLayout
log4cplus.appender.rootAppender.layout.ConversionPattern=%d{%m/%d/%y %H:%M:%S} [%t] %-5p %c{2} %%%x%% - %m [%l]%n

log4cplus.appender.A1=log4cplus::RollingFileAppender
log4cplus.appender.A1.File=A1.log
log4cplus.appender.A1.MaxFileSize=1MB
log4cplus.appender.A1.MaxBackupIndex=2
log4cplus.appender.A1.layout=log4cplus::SimpleLayout
log4cplus.appender.A1.layout.ContextPrinting=enabled
log4cplus.appender.A1.layout.DateFormat=ISO8601

log4cplus.appender.A2=log4cplus::ConsoleAppender
log4cplus.appender.A2.layout=log4cplus::PatternLayout
log4cplus.appender.A2.layout.ConversionPattern=[%d{%d %m %Y %H:%M:%S} [%t] %-5p %c{2} %%%x%% - %m [%l]%n

The main module :

#include <log4cplus/configurator.h>
...
    std::string logFileName = "log4cplus.prop";
    log4cplus::PropertyConfigurator::doConfigure( logFileName );   
    cout << "Hello World" << endl;

Initializing the logger:

    Names::Names() :firstName(""), lastName(""), log(log4cplus::Logger::getInstance("Names"))
    {
        LOG4CPLUS_INFO( log, "Default Constructor" );
    }

Using in a complex format:

        LOG4CPLUS_INFO( log, "FirstName " <<
                     this->firstName
                                         << "; LastName "
                     << this->lastName );

Example of output:

[11 12 2011 15:50:41] [4624] INFO  Names %% - FirstName a; LastName b [Names.cpp:46]
[11 12 2011 15:50:41] [4624] INFO  Names %% - Combined name <a b> [Names.cpp:54]


Update: A follow up describes how to allow configuration changes of the logging for a running
process.

Dec 8, 2011

log4cpp Usage

The last time I compiled log4cpp on Windows with MinGW.

Now I got the following to work:
Names.hpp

#ifndef NAMES_HPP
#define    NAMES_HPP

#include <log4cpp/Category.hh>

namespace names {
  

    class Names
    {
    public:
        Names();
        Names(const Names& orig);
        virtual ~Names();
        void getNames();
        std::string myNames();
    private:
        std::string firstName;
        std::string lastName;
        log4cpp::Category& logger;
    };
}
#endif    /* NAMES_HPP */

using in Names.cpp as:
 


Names::Names(....) :logger(log4cpp::Category::getInstance("Names")
{
}

string Names::myNames()
    {
        std::stringstream combinedName;

        combinedName << this->firstName << " " << this->lastName;
        logger.info("Combined name <%s>", combinedName.str().c_str());
        return combinedName.str();
    }

and in the Main-Method:
int main(int argc, char** argv)
{
    std::string logFileName = "log4cpp.prop";
    try
    {
        log4cpp::PropertyConfigurator::configure(logFileName );
    }
    catch( log4cpp::ConfigureFailure e)
    {
        cerr << "Log4cpp Error: " << e.what() << endl;
    }

where the property configuration is:

log4j.rootCategory=DEBUG, rootAppender
log4j.category.Names=DEBUG, A2
log4j.additivity.Names=false
log4j.category.sub2=INFO
log4j.category.sub1.sub2=ERROR, A2

log4j.appender.rootAppender=org.apache.log4j.ConsoleAppender
log4j.appender.rootAppender.layout=org.apache.log4j.BasicLayout

log4j.appender.A1=org.apache.log4j.FileAppender
log4j.appender.A1.fileName=A1.log
log4j.appender.A1.layout=org.apache.log4j.BasicLayout

log4j.appender.A2=org.apache.log4j.ConsoleAppender
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=[%d{ISO8601}] [%c/%p] %m %n


and a sample output looks like:
[2011-12-08 14:55:00,182] [Names/INFO] Default Constructor
[2011-12-08 15:14:10,542] [Names/INFO] FirstName a; LastName b

For linking with MinGW, I had to add the following lib -lws2_32




Dec 5, 2011

log4cpp compile on Windows with MinGW and Usage in NetBeans 7.1RC1

Just for testting, I attempted to use NetBeans 7.1RC1 on Windows with MinGW-Compiler.

I installed to MinGW installer, which was getting everything from the Web.

In NetBeans the Compiler must be configured by adding the MinGw/bin Path as base directroy.


Creating a new project still fails, because I had also to add
C:\MinGW\msys\1.0\bin to the PATH envrionment to find mkdir, which is used in
the makefiles of a C++ Project in NetBeans, otherwise the build fails.

log4cpp can be downloaded starting from here.

Starting a bash and using configure --prefix=/c/sdk/log4cpp/1.0 started the configure and
afterwards a make attempted to compile the source, but there are some problems.

I found the solution by a nice guy Zih Jun on his blog.

After some modifications in the log4cpp source, it could be compiled, although there was
a problem with dirname in the configure step.

After doing a make install all necessary things were copied.

In the Project-Options of NetBeans, I added the include path.


But the code completion just showed some files.



The reason therefore ist, that NetBeans doesn't recognise  header files with the extension .hh which
log4cpp is using.

Adding hh to the extensions showed all headers.



Now the real learing starts, how to use log4cpp.