Planet maemo

Alberto Garcia

I/O bursts with QEMU 2.6

2016-05-24 11:47 UTC  by  Alberto Garcia
0
0

QEMU 2.6 was released a few days ago. One new feature that I have been working on is the new way to configure I/O limits in disk drives to allow bursts and increase the responsiveness of the virtual machine. In this post I’ll try to explain how it works.

Click to read 2370 more words
Categories: English
Philip Van Hoof

My colleague Henk Van Der Laak made a interesting tool that checks your code against the QML coding conventions. It uses the internal parser’s abstract syntax tree of Qt 5.6 and a visitor design.

It has a command line, but being developers ourselves we want an API too of course. Then we can integrate it in our development environments without having to use popen!

So this is how to use that API:

// Parse the code
QQmlJS::Engine engine;
QQmlJS::Lexer lexer(&engine);
QQmlJS::Parser parser(&engine);

QFileInfo info(a_filename);
bool isJavaScript = info.suffix().toLower() == QLatin1String("js");
lexer.setCode(code,  1, !isJavaScript);
bool success = isJavaScript ? parser.parseProgram() : parser.parse();
if (success) {
    // Check the code
    QQmlJS::AST::UiProgram *program = parser.ast();
    CheckingVisitor checkingVisitor(a_filename);
    program->accept(&checkingVisitor);
    foreach (const QString &warning, checkingVisitor.getWarnings()) {
        qWarning() << qPrintable(warning);
    }
}
Categories: controversial
Philip Van Hoof

Item isChild of another Item in QML

2016-05-18 07:30 UTC  by  Philip Van Hoof
0
0

Damned, QML is inconsistent! Things have a content, data or children. And apparently they can all mean the same thing. So how do we know if something is a child of something else?

After a failed stackoverflow search I gave up on copy-paste coding and invented the damn thing myself.

function isChild( a_child, a_parent ) {
	if ( a_parent === null ) {
		return false
	}

	var tmp = ( a_parent.hasOwnProperty("content") ? a_parent.content
		: ( a_parent.hasOwnProperty("children") ? a_parent.children : a_parent.data ) )

	if ( tmp === null || tmp === undefined ) {
		return false
	}

	for (var i = 0; i < tmp.length; ++i) {

		if ( tmp[i] === a_child ) {
			return true
		} else {
			if ( isChild ( a_child, tmp[i] ) ) {
				return true
			}
		}
	}
	return false
}
Categories: condescending
Philip Van Hoof

As we all know has Qt types like QPointerQSharedPointer and we know about its object trees. So when do we use what?

Let’s first go back to school, and remember the difference between composition and aggregation. Most of you probably remember drawings like this?

It thought us when to use composition, and when to use aggregation:

  • Use composition when the user can’t exist without the dependency. For example a Human can’t exist without a Head unless it ceases to be a human. You could also model Arm, Hand, Finger and Leg as aggregates but it might not make sense in your model (for a patient in a hospital perhaps it does?)
  • Use aggregate when the user can exist without the dependency: A car without a passenger is still a car in most models.

This model in the picture will for example tell us that a car’s passenger must have ten fingers.

But what does this have to do with QPointer, QSharedPointer and Qt’s object trees?

First situation is a shared composition. Both Owner1 and Owner2 can’t survive without Shared (composition, filled up diamonds). For this situation you would typically use a QSharedPointer<Shared> at Owner1 and Owner2:

If there is no other owner, then it’s probably better to just use Qt’s object trees and setParent() instead. Note that for example QML’s GC is not very well aware of QSharedPointer, but does seem to understand Qt’s object trees.

Second situation are shared users. User1 and User2 can stay alive when Shared goes away (aggregation, empty diamonds). In this situation you typically use a QPointer<Shared> at User1 and at User2. You want to be aware when Shared goes away. QPointer<Shared>’s isNull() will become true after that happened.

Third situation is a mixed one. In this case you could at Owner use a QSharedPointer<Shared> or a parented raw QObject pointer (using setParent()), but a QPointer<Shared> at User. When Owner goes away and its destructor (due to the parenting) deletes Shared, User can check for it using the previously mentioned isNull check.

Finally if you have a typical object tree, then use QObject’s infrastructure for this.

 

 

Categories: controversial
Jussi Ohenoja

2016-05-03 Meeting Minutes

2016-05-08 13:44 UTC  by  Jussi Ohenoja
0
0

Meeting held 2016-05-03 on FreeNode, channel #maemo-meeting (logs)

Attending: eekkelund, reinob, pichlo, Win7Mac, juiceme, Oksana

Partial:

Absent: peterleinchen, HtheB

Summary of topics (ordered by discussion):

  • Handover meeting for the new Council

(Topic Handover meeting for the new Council):

  • reinob, win7mac and juiceme welcomed the new Council members eekkelund and pichlo.
  • The council considered the weekly meeting day and time, it was decided to keep tuesday as the day and adjust the meeting time to 20:30 CET/CEST.
  • There was some general discussion of IRC as meeting medium and the needed requirements for councillors.
  • The Council voted for new chairman, and eekkelund was chosen by majority vote of 2:3
  • juiceme promised to arrange the Council mailing list change and get cloaks for new councillors.

Action Items:
  • old items:
    • The next GA meeting should be announced soon.
  • new items:
    • Add new Councillors to the mailing list and remove the old. (juiceme)
    • Arrange Council permissions on TMO to new Councillors. (juiceme)
    • Get cloaks for new Councillors. (juiceme)
Categories: council
Philip Van Hoof

Visitor for Klartext

2016-05-02 20:06 UTC  by  Philip Van Hoof
0
0

Felt good about explaining my work last time. For no reason. I guess I’m happy, or I no longer feel PGO’s pressure or something. Having to be politically correct all the times, sucks. Making technically and architecturally good solutions is what drives me.

Today I explained the visitor pattern. We want to parse Klartext in such a way that we can present its structure in a editing component. It’s the same component for which I utilized a LRU last week. We want to visualize significant lines like tool changes, but also make cycles foldable like SciTe does with source code and a whole lot of other stuff that I can’t tell you because of teh secretz. Meanwile these files are, especially when generated using cad-cam software, amazingly huge.

Today I had some success with explaining visitor using the Louvre as that what is “visitable” (the AST) and a Japanese guy who wants to collect state (photos) as a visitor of fine arts. Hoping my good-taste solutions (not my words, it’s how Matthias Hasselmann describes my work at Nokia) will once again yield a certain amount of success.

ps. I made sure that all the politically correcting categories are added to this post. So if you’d have filtered away the condescending and controversial posts from my blog, you could have protected yourself from being in total shock now (because I used the sexually tinted word “sucks”, earlier). Guess you didn’t. Those categories have been in place on my blog’s infrastructure since many years. They are like the Körperwelten (Bodyworlds) exhibitions; you don’t have to visit them.

Categories: condescending
madman2k

Introducing the OGRE fork on GitHub

2016-05-02 14:38 UTC  by  madman2k
0
0

in this post I want to introduce the OGRE fork on github. The goal of the fork is to provide a stable and reliable OGRE 1.x series while at the same time modernizing parts under the hood updates.

Click to read 1522 more words
Categories: News
Philip Van Hoof

Putting an LRU in your code

2016-04-29 21:30 UTC  by  Philip Van Hoof
0
0

For the ones who didn’t find the LRU in Tracker’s code (and for the ones who where lazy).

Click to read 1262 more words
Categories: controversial
Philip Van Hoof

Secretly reusing my own LRU code

2016-04-27 10:55 UTC  by  Philip Van Hoof
0
0

Last week, I secretly reused my own LRU code in the model of the editor of a CNC machine (has truly huge files, needs a statement editor). I rewrote my own code, of course. It’s Qt based, not GLib. Wouldn’t work in original form anyway. But the same principle. Don’t tell Jürg who helped me write that, back then.

Extra points and free beer for people who can find it in Tracker’s code.

Categories: controversial
Jussi Ohenoja

Dear friends and Maemoans, six months and even a bit more has passed and again it is time to elect a new Community Council for us.

The last election finished on Saturday 13th of September 2015.

The schedule of the voting is as follows:

  • Nomination period starts on next Sunday 27th of March 2016 and continues until 10th of April 2016.
  • Election period starts on Sunday 10th of April 2016 and continues until 17th of April 2016.

To get our community to continue strong, we need fresh people with fresh viewpoints to carry on the torch, so please think about volunteering for Maemo Council.

On behalf of the outgoing community council,

Jussi Ohenoja

Categories: council
Jussi Ohenoja

2015-12-01 Meeting Minutes

2016-01-07 11:18 UTC  by  Jussi Ohenoja
0
0

Meeting held 2015-12-01 on FreeNode, channel #maemo-meeting (logs)

Click to read 1226 more words
Categories: news
madman2k

Learning Modern 3D Graphics Programming

2015-12-29 22:26 UTC  by  madman2k
0
0

one of the best resources to learn modern OpenGL and the one which helped me quite a lot is the Book at www.arcsynthesis.org/gltut/ – or lets better say was. Unfortunately the domain expired so the content is no longer reachable.

Luckily the Book was designed as an open source project and the code to generate the website is still available at Bitbucket. Unfortunately this repository does not seem to be actively maintained any more.

Therefore I set out to make the Book to be available again using Github Pages. You can find the results here:

https://paroj.github.io/gltut/

However I did not simply mirror the pages, but also improved it at several places. So what has changed so far?

  • converted mathematical expressions from SVG to inline MathML. This does not only improve readability in browsers, but also fixes broken math symbols when generating the PDF.
  • replace XSLTHL by highlight.js for better syntax highlighting
  • added fork me on github badge to website to visualize that one can easily contribute
  • enabled the Optimization Appendix. While it is not complete, it already provides some useful tips and maybe encourages contributions.
  • updated the Documentation build to work on Linux
  • added instructions how to Build the website/ PDF Docs

hopefully these changes will generate some momentum so this great Book gets extended again. As there were also non-cosmetical changes like the new Chapter I also tagged a 0.3.9 release.

I the process of the above work I found out that there is also a mirror of the original Book at http://alfonse.bitbucket.org/oldtut/. This one is however at the state of the 0.3.8 release, meaning it does not only misses the above changes but also some adjustment happened post 0.3.8 at bitbucket.

Categories: News