Friday, October 10, 2014

Solution for fillData->clip->clipRect.isEmpty() in Qt

After long time I'm going to write another blog post.  This is regarding the Qt and it will detail a solution for the problem of fillData->clip->clipRect.isEmpty(). I got this problem as below cage while trying to create a 'title block' for the engineering drawing. 

Sample title block (copy rights)
I created a QPrintPreviewDialog which previews engineering drawings generated by the application. I draw rectangle to represent title block which consists details of the drawing. At some points length of the detail higher than the space of the rectangle. Then I got below run-time error.

ASSERT: "!fillData->clip->clipRect.isEmpty()" in file painting/qpaintengine_raster.cpp, line 4435

The simple answer is you are going to write the text in the rectangle which is not have enough space to show your content.

You can do following things.
1. Increase the size of Rectangle.
2. Decrease the font size.
3. Or use Qt.TextElideMode

enum Qt::TextElideMode

This enum specifies where the ellipsis should appear when displaying texts that don't fit:

Qt::ElideLeft0The ellipsis should appear at the beginning of the text.
Qt::ElideRight1The ellipsis should appear at the end of the text.
Qt::ElideMiddle2The ellipsis should appear in the middle of the text.
Qt::ElideNone3Ellipsis should NOT appear in the text.

Tuesday, May 6, 2014

ASSERT: "uint(i) < uint(size())" in file bla.. bla.., line bla.. in Qt

Hope you know these days I'm trying Qt\C++. Today I spent lot of my valuable time for solve the error mentioned in the title (ASSERT: "uint(i) < uint(size())" in file bla.. bla.., line bla..). It is run time error and I tried lot to find what was happening. At that time I have no knowledge about the 'Q_ASSERT' also.

A one bug hidden inside below code. Can you find it?

for (int row = 0; row < heights().count(); ++row)
            for (int col = 0; col < ampererates().count(); ++col)
                QModelIndex index = item_model->index(row,col,QModelIndex());
                no_of_components = item_model->data(index).toString();

                    height = heights().at(row);
                    ampererates =;


I know it is very difficult to found a bug without the whole story. But I'm writing this post to anyone who got the same problem as a beginner like me and detail about my thinking pattern.

As a first step I put qDebug() s intermediate of the lines. And I found the bug in below line.
ampererates =; 

Then I thought what type of error it was. It mentioned something about sizes. Sizes?? something about arrays or List..?? Then I thought if there is no error in count() of the same list. Why it was informing error like out of bound?
for (int col = 0; col < ampererates().count(); ++col) Working fine.
ampererates =; ++col) Not working

Variable ampererates is QString. And ampererates() is QStringList. Ohh.. Shit.. I missed the brackets. Solution founded. I was trying to read a char from QString instead of read string from QStringList. There is no guarantee that index position is valid.

Then I checked what .at() doing in different classes. As mentioned in there class references.

const QChar QString::at ( int position ) const

Returns the character at the given index position in the string.
The position must be a valid index position in the string (i.e., 0 <= position < size()).

const T & QList::at ( int i ) const

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).
This function is very fast (constant time).

QStringList inhereted from QList.

OK. Thinks this is help somebody to solve same issue. I'm going to learn further what 'Q_ASSERT' do.

Thanks for reading. Have a nice day.

Wednesday, November 20, 2013

d-pointer in Qt

My dear friends, How are you? Nice to see you after such a long time.  Nowadays I'm slightly moving to the Qt and hope to publish posts about it.   So let's move to the post.  Actually This is warm-up post ;)

D-pointer or opaque pointer  technique can be called as a design pattern.  According to the Wikipedia this technique same as Bridge pattern and sometimes  referred to as handle classes, the Pimpl idiom, Compiler firewall idiom or Cheshire Cat.

With d-pointer programmers gain some advantages.

1. Can be created simple interfaces.
2. Hide the implementation details of an interface from ordinary clients.
3. Provide binary code compatibility with different versions of a shared library.

You can implement d-pointer as this.


// MyClass.h

class MyClass
    // implementation methods
    class MyClassPrivate *d;

// MyClass.cpp
class MyClassPrivate
    int x;

: d(*new MyClassPrivate)

    delete d;


Wednesday, October 26, 2011

How to identify frequent patterns from FP tree

Before reading this post it is valuable for reading my previous post about FP tree. In that post I mentioned how to draw a FP tree using a given database table. If you already know how to draw a FP tree it's OK.

Wednesday, June 29, 2011

FP tree example (How to identify frequent patterns using FP tree algorithm)

FP tree algorithm, which use to identify frequent patterns in the area of Data Mining. I'm sure! after this tutorial you can draw a FP tree and to identify frequent patterns from that tree you have to read my next post, How to identify frequent patterns from FP tree.

Suppose you got a question as follows:

Question :Find all frequent itemsets or frequent patterns in the following database using FP-growth algorithm. Take minimum support as 30%.
Table 1 - Snapshot of the Database

Wednesday, May 4, 2011

Sociodynamic position based on Synergy and Antagonism

I got a question in Project Management as below. I have to spend lot of time to find a proper solution. So I think it is better to put my solution here.

Question : What are the categories of individuals based on Synergy and Antagonism? As a project manager how will you response to those different types of individuals to make your IT project successful?

In “Managing sensitive projects: a lateral approach” By Olivier d'. Herbemont, Bruno C├ęsar, Tom Curtin, Pascal Etcheber , a book related to the Project Management, describes different levels of synergy and antagonism. By representing the synergy in x axis and antagonism in y axis can create a grid and on top of that categories of individuals or sociodynamic position of individuals exists as shown in below figure. The sociodynamic position of an individual in a project is not fixed and can vary depending on time or their understanding of the project.

Then I’m going to describe what are they and as a project manager how I manage those guys.

Saturday, April 2, 2011

Steganography and Related Fields

The general idea of hiding some information in digital content has a wider class of applications that go beyond steganography. The techniques involved in such applicationsare collectively referred to as information hiding.

History of Steganography


The first recorded uses of steganography can be traced back to 440 BC when Herodotus mentions two examples of steganography in The Histories of Herodotus.[2] Demaratus sent a warning about a forthcoming attack to Greece by writing it directly on the wooden backing of a wax tablet before applying its beeswax surface.Wax tablets were in common use then as reusable writing surfaces, sometimes used for shorthand.

Another ancient example is that of Histiaeus, who shaved the head of his most trusted slave and tattooed a message on it. After his hair had grown the message was hidden. The purpose was to instigate a revolt against the Persians.

Tuesday, March 29, 2011

Conclusion (Conclude Introduction to Autonomic Computing)

By reading this paper you can gain the knowledge about Autonomic Computing. I detailed it under the following sub topics.

 1.0 Introduction
 2.0 Why need Autonomic?
 3.0 Major Researches 
           3.1 Research projects in Autonomic computing.
           3.2 University research projects in autonomic computing
4.0 Four basic elements of autonomic computing
           4.4 self-protecting
           AutonomicComputing Vs Current Computing
5.0 Autonomic computing architecture
6.0. Autonomic computing today
           6.1. Initiatives of autonomic computing 
           6.2. Benefits
           6.3. Applications
7.0 What happen if does not have autonomic in the future?
8.0 Autonomic Computing Research Issues and Challenges
9.0 Future direction of Autonomic computing
10.0 Conclusion

10.0 Conclusion

In this paper, we introduced the autonomic computing paradigm, which is inspired by biological systems such as the autonomic human nervous system, and enables the development of self-managing computing systems and applications. The systems use autonomic strategies and algorithms to handle complexity and uncertainties with minimum human intervention.

Several research efforts focused on enabling the autonomic properties address four main areas: self-healing, self-protection, self-configuration, and self-optimization. Projects in both industry and academia, have addressed autonomic behaviors at all levels, from the hardware level to software systems and applications. At the hardware level, systems may be dynamically upgradable, while at the operating system level, active operating system code may be replaced dynamically. Efforts have also focused on autonomic middle-ware, programming systems and run-time. At the application level, self optimizing databases and web servers dynamically reconfigure to adapt service performance.

However, achieving overall autonomic behaviors remains an open and significant challenge, which will be accomplished through a combination of process changes, skills evolution, new technologies and architecture, and open industry standards.


Thanks to researchers who are researches about autonomic computing.


[1] Autonomic Computing: An Overview_ Manish Parashar and Salim Hariri
[2]Autonomous Computing Systems by Neil Joseph Steiner
[7]P. Horn, Autonomic Computing: IBM’s Perspective on the State of Information Technology, IBM Corporation (October 15, 2001); available at
[9]Research Challenges in Autonomic Computing by Jeff Kephart IBM Research
High Performance Distributed Computing Laboratory, University of Arizona
The Applied Software Systems Laboratory, Rutgers, The State University of New Jersey
[11]Evaluation issues in Autonomic Computing, Julie A. McCann, Markus Huebscher
Department Of Computing, Imperial College London
[12]The Vision of Autonomic Computing, Jeffrey O. Kephart, David M. Chess,IBM Thomas J.Watson Research Center
[13]Learning Procedures for Autonomic Computing by Tessa Lau, Daniel Oblinger, Lawrence Bergman, and Vittorio Castelli
[14]The dawning of the autonomic computing era
by A. G. Ganek ,T. A. Corbi

By K.H.L.R. Perera

Next Chapter

Future directions of Autonomic computing

By reading this paper you can gain the knowledge about Autonomic Computing. I detailed it under the following sub topics.

 1.0 Introduction
 2.0 Why need Autonomic?
 3.0 Major Researches 
           3.1 Research projects in Autonomic computing.
           3.2 University research projects in autonomic computing
4.0 Four basic elements of autonomic computing
           4.4 self-protecting
           AutonomicComputing Vs Current Computing
5.0 Autonomic computing architecture
6.0. Autonomic computing today
           6.1. Initiatives of autonomic computing 
           6.2. Benefits
           6.3. Applications
7.0 What happen if does not have autonomic in the future?
8.0 Autonomic Computing Research Issues and Challenges
9.0 Future direction of Autonomic computing
10.0 Conclusion

9.0 Future direction of Autonomic computing

Realistically, 100 percent autonomic systems will be very difficult to build and will require significant exploration of new technologies and innovations. That’s why researches view this as a Grand Challenge for the entire IT industry. People will need to make progress along two tracks:
First, making individual system components autonomic and achieving autonomic behavior at the level of global enterprise IT systems.

That second track may prove to be extremely challenging. Unless each component in a system can share information with every other part and contribute to some overall system awareness and regulation, the goal of autonomic computing will not really be reached. So one huge technical challenge entails figuring how to create this “global” system awareness and management. Or to put it another way, how do we optimize the entire stack of computing layers as a whole? It’s not something we currently know how to do.

We know there are also many interim challenges: how to create the proper “adaptive algorithms”—sets of rules that can take previous system experience and use that information to improve the rules or how to balance what these algorithms “remember” with what they ignore. We humans tend to be very good at the latter—we call it “forgetting”—and at times it can be a good thing: we can retain only significant information and not be distracted by extraneous data.

Still another problem to solve: how to design an architecture for autonomic systems that provides consistent interfaces and points of control while allowing for a heterogeneous environment. We could go on, as the list of problems is actually quite long, but it is not so daunting as to render autonomic computing another dream of science fiction. In fact, we’re beginning to make progress in key areas.

Many established fields of scientific study will contribute to autonomic computing.
What we’ve learned in artificial intelligence, control theory, complex adaptive systems and catastrophe theory, as well as some of the early work done in cybernetics, will give us a variety of approaches to explore. Current research projects at laboratories and universities include self-evolving systems that can monitor themselves and adjust to some changes, “cellular” chips capable of recovering from failures to keep long-term applications running, heterogeneous workload management that can balance and adjust workloads of many applications over various servers, and traditional control theory applied to the realm of computer science, to name just a few.

The following list is a select number of recommendations and observations that have come to light during the research and writing of this book. These recommendations are not in any specific order—rather they are a list of thoughts, suggestions, and recommendations that may make autonomic computing more functional.

Develop autonomic tools and technologies on top of existing standards.
Develop autonomic-based systems using multivendor approaches.
Develop metrics to assess the relative strengths and weakness of different approaches. Provide mature software development methodologies and tools for autonomic-based systems.
Develop sophisticated yet easy-to-use autonomic environments to include support for design, test, maintenance, and visualization of autonomic-oriented systems.
Develop libraries of interaction protocols designed for specific autonomic behavior interactions.

Develop the ability for autonomics to collectively evolve languages and protocols specific to the application domain and the autonomics involved.
Work toward autonomic-enabled semantic Web services.
Develop tools for effective sharing and negotiation strategies.
Develop computational models of norms and social structure.Develop sophisticated organizational views of autonomic systems.
Advance the state of the art in the theory and practice of negotiation strategies.Develop an enhanced understanding of autonomic society dynamics. Advance the state of the art in the theory and practice of argumentation strategies.
  • Develop autonomic-based eScience systems for the scientific community.
  • Develop techniques for allowing users to specify their preference and desired outcome of negotiation in complex environments.
  • Develop techniques to enable autonomic to identify, create, and dissolve coalitions in multiautonomic negotiation and argumentation contexts.
  • Develop techniques for autonomic personalization.
  • Develop distributed learning mechanisms.
  • Develop techniques to enable automatic runtime reconfiguration and redesign of autonomic systems.Develop techniques for testing the reliability of autonomics. 
  • Undertake research on methods for ensuring security and verifiability of autonomic systems. 
  • Develop and implement trust and reputation mechanisms.Engage in related-research standardization activities (e.g., UDDI, WDL, WSFL, XLANG, OMG, CORBA, and other widely used industrial-strength open standards).
  • Build autonomic prototypes spanning organizational boundaries (potentially conflicting). 
  • Encourage early adopters of autonomic technology, especially those who take some risk. Provide incentives.
  • Develop a catalog of early adopter case studies, both successful and unsuccessful.  
  • Provide analysis and publish reasons for success and failure cases.
  • Identify and publish best practices for autonomic-oriented development and deployment.Support open standardization efforts.
Related Posts Plugin for WordPress, Blogger...