phim xxx

indian girls

Little debugging helper

Just wanted to share this code with you:

#ifndef DBGHELPER_H
#include <QString>
#ifndef QT_NO_DEBUG
#    define DEBUG_FUNC_NAME DbgHelper dbgHelper(Q_FUNC_INFO);
#else
#    define DEBUG_FUNC_NAME
#endif
 
class DbgHelper {
public:
    DbgHelper(const QString &t);
    ~DbgHelper();
private:
    QString txt;
    static int indent;
    static int colorIndex;
    int myColor;
};
#endif
#include "dbghelper.h"
#ifdef DBGHELPER_USES_PRINTF
#include <stdio.h>
#else
#include <QtDebug>
#endif
 
int DbgHelper::indent = 0;
int DbgHelper::colorIndex = 0;
 
 
static void DbgHelper_output(int color, int indent, 
                             const QString &prefix, const QString &funcName) {
  QString text = QString(4*indent, ' ')+QString(prefix+" "+funcName);
  if(color>=0){
    text.prepend("\x1b[3"+QString::number(1+color)+"m");
    text.append("\x1b[39m");
  }
#ifndef DBGHELPER_USES_PRINTF
  qDebug() << text;
#else
  fprintf(stderr, "%s\n", qPrintable(text));
#endif
}
 
DbgHelper::DbgHelper(const QString &t) {
    txt = t;
#ifdef NO_COLOR
    myColor=-1;
#else
    myColor = colorIndex;
    colorIndex = (colorIndex+1) % 7;
#endif
    DbgHelper_output(myColor, indent, "BEGIN", txt);
    ++indent;
}
 
DbgHelper::~DbgHelper() {
    --indent;
    DbgHelper_output(myColor, indent, "END", txt);
}

Now you can do this:

#include "dbghelper.h"
#include <QtDebug>
 
class Cls {
public:
  Cls(){
    DEBUG_FUNC_NAME
  }
  ~Cls() {
    DEBUG_FUNC_NAME
  }
  void method(const QString &str) {
    DEBUG_FUNC_NAME
    int x = anotherMethod();
  }
  int anotherMethod() {
    DEBUG_FUNC_NAME
    qDebug() << "Regular output";
    return 7;
  }
};
 
int main(){
 Cls c;
 c.method("foobar");
 return 0;
}

And obtain a nice colorful (where ANSI escape sequences are supported) output:

BEGIN Cls::Cls()
END Cls::Cls()
BEGIN void Cls::method(const QString&)
    BEGIN int Cls::anotherMethod()
Regular output
    END int Cls::anotherMethod()
END void Cls::method(const QString&)
BEGIN Cls::~Cls()
END Cls::~Cls()

If you want, you can extend it to take argument values as well or print the file and line numbers where a particular method is defined.

What do you think? Do you have your own macros or classes that help you with debugging?

Qt DevDays 2009

Are you going to Troll… eeem…. Qt Soft… hmm… Qt by Nok…. aaaahaa! Qt Developer Days?

I strongly suggest you do so, if you have such oportunity. Although the Early Bird registration for Munich is already closed (meaning a higher fee to pay to attend the conference) but it’s still open for San Francisco, so start registering! The conference is worth attending even at full price, so don’t hesitate – get your wallets (or better yet your bosses wallet) out!

This year we have three parallel tracks – Technical, Qt in Use and Education. All are looking very interesting. If you’re an engineer it’s most probably you’d want to see most of the technical sessions and they are looking quite good. My favourites are probably going to be Optimizing Performance in Qt Applications, The Next Generation Qt Item Views, QWidget in Depth, Special FX with Qt Graphics View and Animation Framework: A Step Toward Modern UIs. It’s hard to see them all and there are other great sessions as well.

If you’re still programming using Visual Studio, (K|Q)Develop or Eclipse, you’ll probably want to see sessions about Qt Creator and let yourself be introduced into the world of magic in software development.

Take your boss with you too (especially if you don’t use Qt at work yet) – let him/her attend the Qt in Use sessions. See how others make Qt part of their success – maybe your company can benefit from the technology as well? Even if you are already using Qt, maybe there is some place for improvement and (catchphrase for your boss comming!) reduction of expenses.

If you have academic background, it’s important that you attend the Qt in Education sessions, especially see Knut and Juergen talk about implementing Qt in universities and teaching materials available.

And don’t forget the parts that let you integrate with the community – coctail party, dinner, games and lots of chatting with Qt users from all over the world, Trolls included (they don’t bite, at least not intentionally).

If you’re “just” a Qt (or KDE) user, consider attending as well, it’s great fun and you can meet people responsible for the software you use everyday. Fact or crap?

We’ll be there (in Munich), will you? Share your opinions on past conferences and the upcoming ones. What are the best sessions in your opinion?

Peak productivity

Well, this is something that describes me perfectly…
PhD Comic strip

Ok, time to stop distracting myself and get back to work…

Cheers!

QwwSmtpClient released

I decided to release QwwSmtpClient I blogged about two months ago.

The sources are available for download: qwwsmtpclient.

Next to do is the “QNetworkAccessManager-like” API for easier handling…

If you have any comments about the library, feel free to leave them under this post. Any feedback is appreciated, especially that I didn’t have a chance to test the library in practice.

Open Enrollment Qt training in Poland

ARISE, a company I’m cooperating with, is organizing a certified Qt training in Poland. The course will be held on 4-8th May in Warsaw, Poland. It is basically dedicated for Polish speaking people but it may be conducted in English or a separate English course may be organized.

Participants will learn Qt basics and advanced topics of their choice. An incomplete list of subjects includes graphics and animation, WebKit, networking and multithreading. The training is based on the latest release of Qt – 4.5 and takes a form of lectures and workshops. After the training, participants will receive Qt Software certificates and training materials. The number of places available is limited so register early.

I will be the person giving the training, so I hope to meet you in Warsaw in May.

Details (in Polish) are available on the Arise Open Enrollment training web page. For more information and registration please send an email to arise@arise.pl or fill the registration form available under the mentioned link.

A less detailed English description of the training is also available.

QwwSmtpClient

It’s often good to improve your mood by “doing something nice for yourself” which in my case often means “implement something interesting even if it’s currently completely useless for you but provides a challenge for your brain”.

As some time ago I felt really bad, I did follow that advice and implemented a class for Qt to handle SMTP connections. Only yesterday I noticed J-P Nurmi has implemented a library to handle the IRC protocol which means the family of protocols supported by plain Qt is now at least HTTP, FTP (both internally via QHttp and QFtp), IRC (via LibIrcClient-Qt) and SMTP (QwwSmtpClient). I have plans to also implement POP3 as it’s very simple but I’m waiting for the next wave of bad mood to do it.

So… what does QwwSmtpClient do? It mimics QHttp, so it’s command-based which means you have to issue a few commands and monitor their result to be able to do something useful. I know that sucks a bit, but I wanted to have a similar architecture to QHttp and the next step is to implement a wrapper around the class to provide an interface similar to QNetworkAccessManager which should be quite easy and should not require bad mood to do it.

QwwSmtpClient currently supports:

  • plain connections to SMTP (port 25 by default),
  • SSL connections to SMTP (port 465 by default),
  • TLS connections (STARTTLS command after a plaintext connection),
  • Authentication via PLAIN or LOGIN methods,
  • sending mail using low-level commands (MAIL, RCPT, DATA),
  • HELO or EHLO conversations.

The library is not yet foul-proof nor very idiot-proof but it works allowing one to send mails directly from within Qt applications. I’ll release the code to the public soon.

Here is a small example:

#include <QApplication>
#include <QStringList>
#include "qwwsmtpclient.h"
 
int main(int argc, char **argv){
    QApplication app(argc, argv);
    QwwSmtpClient client;
    // ignore certificate errors as suggested by ssl socket docs:
    app.connect(&client, SIGNAL(sslErrors(const QList &)), 
                &client, SLOT(ignoreSslErrors())); 
    // start plain-text connection:
    client.connectToHost("mail.example.com");
    // start encryption handshake:
    client.startTls();
    // when that's done authenticate yourself to the server:
    client.authenticate("user", "pass", QwwSmtpClient::AuthLogin);
    // send an email:
    client.sendMail("sender@example.com", "receiver@example.com", 
                           "From:    sender@example.com\r\n"
                           "To:      receiver@example.com\r\n"
                           "Subject: testing QwwSmtpClient\r\n"
                           "\r\n" // blank line to denote end of headers
                           "Does it work?");
    // disconnect afterwards:
    client.disconnectFromHost();
    // quit when you're done:
    app.connect(&client, SIGNAL(disconnected()), &app, SLOT(quit()));
    return app.exec();
}

“There and back again”

Well… here I am again :) And again trying hard to resurrect this blog. I hope this time it’ll be with success. I started by pimping the looks of the site, maybe it helps me motivate myself to write here whenever I have something to say. And believe me, I do as lot has happened since my last post here.

Furthermore, I’m going to integrate all my bits of personal web activity with the blog – my bibliography, library of code snippets, etc.

Stay tuned!

Comeback (again)…

I haven’t blogged for ages… As my excuse I can say that much has happened during that time in my life but the time has come to start blogging again and share my fresh ideas, so expect me to write something now and then. And if I don’t then bug me about it until I do.

wwWidgets 0.8 released

Two days ago I released version 0.8 of my Qt4 widget set called wwWidgets. The release is Qt 4.2-Qt4.4 compatible and consists of over 20 different widgets. The main focus was put on making the set compilable on all major platforms. The set also contains a Qt Designer plugin that makes it possible to use the widgets directly from Designer.

Visit http://www.wysota.eu.org/wwwidgets to find out more. Any feedback is greatly appreciated.

Multipage Qt container widgets problem solved

In relation to what I wrote earlier I am happy to say that it seems that finally the problem of UIC not being able to handle custom container widgets has been solved – at least partially.

I’ve been playing with Qt 4.4 Technical Preview and I noticed that finally the issue of being unable to create correct Designer forms with multipage widgets has a solution.

In your domXml() method of the custom widget plugin you need to inform UIC about the name of the method your class uses to add pages to itself. The solution is limited as it expects the name of a method taking a pointer to QWidget only, but at least that will render containers usable.

To have a working container widget plugin you need to make sure domXml() returns something like the following:


  
    QwwNavigationBar
    QWidget
    addWidget
  

This informs UIC that QwwNavigationBar is a widget derived from QWidget that uses QwwNavigationBar::addWidget() for adding pages.

xnxx indian