Cutelyst 0.8.0 – featuring better stats

Cutelyst the Qt Web Framework just got a new release!

With 0.8.0 some important bugs got fixed which will allow for the CMS/Blogger app CMlyst to get a new release soon. Besides bugs being fixed a class to take out stats from the application was created, Cutelyst::Stats matches what Catalyst::Stats does, and produces a similar output:

cutelyst-stats

 

  • There you have a box, and the time which each action took to complete, looking at the /End action it is clear that it took more time but most of the time was due it calling the Grantlee View.
  • On the Request took: …  line there is the 1278.772/s value which means how many requests could be handled within a second, of course that value is for the exact same request and for the single core where it was run.
  • The first line now shows which HTTP method was used, which resource the user wants and where the request came from.

All of that can and should be disabled on production by setting cutelyst.*.debug=false on the [Rules] section of the application ini file (–ini of uWSGI). Yeah this is new too 🙂

Speaking of debugging we now have more information about what user data was sent, if cutelyst.request.debug logging category is enabled you will see:

cutelyst-body A similar output is printed for url query parameters and file uploads.

The HTTP/1.1 support for chunked responses was added, once c->response()->write(…) is called the response headers are send and a chunk is sent to the client, this is new and experimental, but worked without complaints from web browsers.

An easier way to declare action arguments or capture arguments was implemented, :AutoArgs and :AutoCaptureArgs, both are not present in Perl Catalyst because there is no way to introspect methods signature in the language, @_ can provide many things, but with Qt meta information we can see which types of arguments a method has as well as how many arguments:

C_ATTR(some_method, :Local :AutoArgs)
void some_method(Context *c, const QString &year, const QString &month);

That will automatically capture two arguments matching an URL like “/some_method/2014/12”.

Last the Headers class got many fixes and improvements such as striping the fragment due RFC 2616.

As always if you have questions show up in #cutelyst at freenode or send me a mail.

Download 0.8.0 here

Enjoy!

Cutelyst 0.8.0 – featuring better stats

Cutelyst 0.6.0 is released

Cutelyst, the Qt/C++ web framework just got another step into API stabilization.

Since 0.3.0 I’ve been trying to take the most request per second out of it, and because of that I decided to replace most QStrings with QByteArrays, the allocation call is indeed simpler in QByteArray but since most of Qt use QString for strings it started to create a problem rather than solving one. Grantlee didn’t play nice with QByteArray breaking ifequal and in the end some implicit conversions from UTF-8 were triggered.

So on 0.6.0 I’ve replaced all QByteArray usage in favor of QString, and from the benchmarks of hello world the difference is really negligible.

Another big change I actually took today was to change the Headers class that is used on Request and Response, the keys stored there were always in camel-case style and split by dashes, and if you want to get say the User-Agent in a Grantlee template it won’t work as dashes will break the variable name, so now all keys are lower casa and words are separated by underscores. Allowing for {{ ctx.request.headers.user_agent }} in Grantlee templates.

Some changes were also made to make it behave more close to what Catalyst does, and fixed a bunch of bugs from last release.

On my TODO list still need to:
Write a chained dispatcher to allow a more flexible way of dispatching.
Write tutorials, yeah this is boring…
Write QML integration to allow for writing the application logic in QML too!

This last one would allow for something like this:

Application {
    Controller {
        Action {
            attributes: ":Path(hello)"
            onRequest: {
                ctx.response.body = "Hello World!"
            }
        }
    }
}

Download here

Have fun!

Cutelyst 0.6.0 is released

Cutelyst 0.4.0 is out!

This is yet another big step for Cutelyst, this release bring several important fixes to the last version, and stabilizes the API a bit more. So far I have successfully deployed 3 commercial applications build on top of Cutelyst + Grantlee5, and the result is great.

If you don’t know Cutelyst yet it’s a Web Framework allowing you to build web applications using Qt, for more info check (this blog and) our website/wiki which is still work in progress: http://cutelyst.org or join #cutelyst on freenode

This release brings the following improvements:

  • Further speed improvements by simplifying several code paths and improving the dispatcher logic was an overall of 15% speedup
  • Added an API to enable Grantlee template caching which greatly improve speed when using Grantlee templating
  • Improved Query and Body parameters to allow for properly dealing with posts that contains the same field id multiple times

New features:

  • REST API – Since 0.1.0 I was asked about supporting REST, and since I needed it for another project that I got involved the support landed early, the behavior is the same as Catalyst::Action::REST which allows you to easily add a foo_DELETE method which will get automatically called if the request method is DELETE for example.
  • Added a Credential HTTP plugin to handle Basic HTTP (and in future Digest) authentication
  • Added support for Authenticate and ProxyAuthenticate basic parsing on the Headers class
  • Finished Context::uriFor() methods that allows for easily building an URI.
  • Added a method to do a DNS PTR lookup to get the hostname of the client
  • Added a C_PATH to more easily set the matching part of the path (thanks to Dan Vrátil)

Fixes:

  • Fixed a few memory leaks
  • Fixed a crash if the body wasn’t set
  • Fixed uWSGI body buffered device
  • And a lot of other misbehaviors found on post release…

For the next release I hope to be able to port the Catalyst tutorial to the Cutelyst equivalent, and finish a few other API changes.

As before the API is unstable but don’t be afraid of playing with it, most changes will simply require a rebuild of your application.

Have fun! https://gitorious.org/cutelyst/cutelyst/archive/0f28d7da9b04061fe80f7e9cf24a120250a02e02.tar.gz

Cutelyst 0.4.0 is out!

Cutelyst a Qt web framework

Do you recall that “Qt everywhere” branding?

Well that’s one of the things I really like in Qt, being able to deploy everywhere with minimal to zero changes in source code. But sometimes your application needs a web interface some sort of web backend or web admin, and when that happens it breaks that slogan (AFAIK)…

I got in contact with web languages (not HTML) only when at university, ColdFusion and PHP where the first ones, and while PHP was sort of cool because it has a syntax close to C, I never really like it. I’m not a web designer nor know how to do pretty websites, but in today’s world building web apps is inevitable.

So years ago I learned about RubyOnRails, and people where talking all the good stuff about it, it’s was the framework of the hype, although I knew Ruby wasn’t the fastest scripted language my need didn’t demand that, so I got a book, read it cover to cover and happily started my web app, a week latter I got a complex problem with an apparently impossible solution. It seemed that RoR makes easy things stupidly easy and complex things impossible…

The I met Catalyst a Perl framework, got exited again, but I knew nothing about Perl so I read more 3 books and was started to love the language, I still do, but last weekend when trying to resurrect and old Catalyst application I got an error which I had no idea how to fix, on IRC I was told the problem could be that I mixed CPAN packages with distro packages, not very convinced I realized the bigger problem I was actually facing, I’m not fluent in Perl, well no matter how many books you read about a language you only get fluency in it after speaking it almost everyday, this applies to computing languages too of course.

So if 99% of the time (or less now with QML) I’m programming C++ it means that I know a lot more about how to debug it than with Perl, so Cutelyst! Writting web apps in Qt/C++ will be much more efficient to me and hopefully to you too.

I share lots of the Catalyst API and design ideas, tho the implementation is of course completely different. Also for the sake of HTML templating I plan to create a Grantlee View plugin.

You can take a look at the proof of concept:

https://gitorious.org/cutelyst

Have fun.

Cutelyst a Qt web framework

print-manager updates in KDE 4.11

For those who doesn’t know print-manager is a project I started back in 2010 (yes it’s 3 years old now!), but only got included into KDE 4.10 (the current stable release). The reason for that is that since it was meant to replace system-config-printer-kde it needed to provide at least the most used features, and that was only possible as the logic to find a good PPD for a given printer was then exposed through DBus, so we could use that but not it’s GUI.

I’m very pleased to say that my expectation of receiving bug reports of missing features, surprised me by being just one of the few bugs it got (sadly it’s not the easiest to one to fix). The number of bugs was also quite low and it’s acceptance quite positive, which helped me managing fixing most of them then in a short time. Currently there are only 2 standing bugs, and none of them are crashes (all were fixed), one is a missing convenience feature and the other is half fixed but I failed to setup a similar environment to figure out what was happening, but this next version will include some debug info to try to figure that out.

What about new stuff?

So CUPS is not a new project that earns features everyday, actually we fear to have more features removed, that being said print-manager already covers most of it’s functionality. One CUPS feature I didn’t make use in 4.10 was the ability to reprint canceled/completed jobs, this feature also only works if the job is preserved which is something that can be disabled on the server. Of course we only enable the button if the job can do that: p-m-queue-reprint Notice the Reprint button, now there’s something even cooler than that, the last column “From Hostname” is also new, but the coolest part of it was that this was actually a feature request from a KDE 3 (kprint) bug, funny enough I fixed it on the exact same day were it completed 10 years 😀 (I accept cookies…) Next we have a bunch under the hood changed and fixes.

When I first presented the print-manager plasmoid it would have a feature to configure which jobs to show. Having “Active jobs”, “Completed jobs” and “All jobs” ended up becoming an issue, since if the completed job list had like 20 entries the plasmoid was taking several seconds to load, so since the “Active jobs” is always the smallest list I removed the other options to avoid bug reports. Latter Apper gained a plasmoid and I run into the same slowness very quickly, actually a list of 200 updates (which is not uncommon) was taking half a minute to load.

My previous investigations showed the Plasma DataEngines were too slow, in fact I believe it’s the mapping between the DataEngine and QML since plasmaengineexplorer is not _that_ slow. This was a no go for Apper, so I created a hybird C++/QML plasmoid, and quickly I noticed that this would also be the best thing for printer manager. It’s not only is blazing fast now, but also has the important benefit of not keeping four models implementations as the QWidgets dialogs already had them, so now I fix one model and both plasmoid/KCM/print-queue get it. p-m-plasmoid-configIf you have used the 4.10 version you will also notice an important improvement on the above, instead of a weird LineEdit to select which printers the plasmoid will display, now you have a nice checkable list.

Bonus points to Kai Uwe Broulik that added the second icon there (and did some more stuff) which is the full System Settings printers module so you don’t need to open system settings. And yes I’d like to have a different icon for the first option but I failed to find the option (if it even exists) to do that as Plasma uses the plasmoid icon for the first item. The internal library that talks to CUPS also got several improvements and fixes which made it Qt5 safe, due to QHash getting items stored randomly (yes Qt4 says we can’t rely on the order but we know we can :P). To be honest I don’t really know how well this worked with the mess it was… The plasmoid also got several improvements:

  • It’s fully usable from the keyboard now
  • The highlights/states work more reliable
It isn't empty anymore if no printer is configured
It isn’t empty anymore if no printer is configured

You get this if you filter some printers out and they get removed
It detects if CUPS has stopped and show a proper error message
It detects if CUPS has stopped and show a proper error message

And finally the plasmoid full of printers and a few jobs, with the new NIHSwitch, fully draggable and with I/O visual to avoid confusing, done my real world testing and so far nobody got confused:

print-manager plasmoid in KDE SC 4.11
print-manager plasmoid in KDE SC 4.11

Until KDE Frameworks 5 isn’t released (and probably also packaged), the development of print-manager will continue in the next SC 4.x releases, of course the list of TODOs is quite small and if you are willing to give a hand send me an email.

Enjoy.

print-manager updates in KDE 4.11

new Apper updater

Hi,

I’m very glad to be able to be making new posts about stuff I like, though my situation still not finished, we have sent some papers to lawyers at Argentina and since this year booking is too much expensive my wife will only be going there next year. The donations money helped a lot but almost half of it is already gone, we still need to pay the Germany lawyer and if you know BRL vs EUR it doesn’t play  nice 😛 Maybe next year I’ll set another pledgie, and I hope to be able to have payed most of bank debts till next year…

Back to the topic, I’ve already said I was planning a new updater, and now I want to share it with you. I’m so happy about it because it makes the updating use case much easier… come on! Just click the icon (maybe do a quick) and press update 😛 how easier could it be?

Apper 0.8.0 will probably be released next week, tomorrow I’ll try to do the last strings changes, and then I’ll give the translators a week to update the few missing strings, 0.8.1 hopefully will follow by January to fix the new introduced features that certainly broke something.

I’m not entirely happy yet with how it works but it works. I still have to show some KDialogs to review dependencies, agree with not trusted packages… hopefully in near future all of that will be inside the plasmoid.

The old tray icon will be gone with this and more changes (I’ll blog when I handle the release) to move away from the regular tray have been done too.

And really thank you very much for your support, thanks to everyone that cared about me I was able to be at my wife’s birthday 7th, my soon 8th and today mine on the coolest day of the year 12/12/12 😀

Enjoy the screen shots:

Getting Updates
Getting Updates
A rare up to date system
A rare up to date system
The list of updates
The list of updates
Downloading Updates
Downloading Updates

UPDATE – I forgot to put the screen shot when you click and expand an update, to see it’s changelog (still misses some info):

Updates Changelog
Updates Changelog
new Apper updater

Print Manager 0.1.0 Released!

Wow!!

Release soon and release often wasn’t really the case of print-manager, I started this project 2 years ago, and this is the first official release. I’ve been waiting for this moment for so long which I can’t say I’m not super happy!!!

First off I REALLY want to give a BIG THANK YOU to all who contributed to my fund raising campaign, without it, this project would have to wait even more, because without a real printer testing the “Add New Printer” feature is real hard, even tho I don’t have all printer models available out there with a printer I can at least guess what s-c-p (system-config-printer) did.

My new printer and monitor 😀

It’s been a while since my last blog, but the truth is that there is a lot I’m doing under the hood of the applications I develop, for example PackageKit is passing through some real deep changes which will change a lot how Apper talks with it (for the better). I’ve been fixing stuff on upower, libsolid, colord-kde…

This week I read a rather sad news Dolphin 2.1, and I must admit I’ve been through the same feelings, especially when your friends show their fancy new OS(X), and they show everything just works, it might have it’s limitations, but the overall experience shows something that was not just written, I was well thought. So it made me rethink why I don’t gave up on doing this and just surrender for the fancier that could make all my work much easier? Well remembering last Linus talk (the one he express our hard time with NVIDIA), he said that before he started writing linux he used to write all his tools, and that’s pretty much what keeps me going, the tools I write pretty much to myself, if I was happy with the existing ones I wouldn’t write a new one anyway… Being in a OS where (at least for me) everything just works, removes my fun of writing stuff that doesn’t 😉  (which BTW I’m about to start a new one…)

All I have to say is that Dolphin is really one of the best piece of software I have in my PC and that I’ll keep my hope someday he will return bringing another useful tool for us.

Back to the topic, this new release is a very important step to get print-manager in KDE 4.10, I’ve finally added the most important bits missing compared to s-c-p. Comparing to s-c-p-kde it even has some features that weren’t ported from the original s-c-p. Being pratical it means there are a very small list of TODO’s and we really need your help with testing, thanks to Kai Uwe Broulik the user interface received some real nice updates, and some testing. But we really need more, so if you can test the software so we have zero or near zero bugs before 4.10 it would be awesome. If your distro want to pick this version it’s fine too, but surely there are some bugs…

The cool things this release has (compared to my old posts):

  • When automatically adding a printer show actions: “Print test page”, “Configure Printer”, “Install Driver” which are shown on the popup that comes when you plug it into the USB port.
  • KDED module runs on a thread
  • Dialogs now save their size
  • KCM doesn’t show the printer list if you only have one printer.
  • Fixed some authentication bugs

Add Printer Wizard:

  • Renewed UI
  • Improved URL handling (specially for samba shares)
  • PPD chooser calls s-c-p DBus interface to find the best driver
  • Devices listing calls s-c-p DBus interface to group devices that provide different communication protocols

And lots of other fixes…

If you want to help making this tool the best ever, we miss:

  • Patch smb kio to see printer shares to be able to browser them and easily add them
  • Make sure the application works well when we stop/start CUPS
  • Make sure CUPS DBus notifications don’t break (sometimes it simply stops working)
  • Create a QML model to expose the print jobs to the QML plasmoid, since Plasma DataEngines don’t perform well on large lists
  • Integrate with PackageKit (hehe this is fun, I’m a PackageKit guy who did not integrate his own app 😛 ) – easiest one

As you can see the list is really small, so TRY IT!

http://download.kde.org/stable/print-manager/0.1.0/src/print-manager-0.1.0.tar.bz2.mirrorlist

Print Manager 0.1.0 Released!