CCR vs. Secu

September 21st, 2014 by ggl

Curtea Constituţională a României a declarat neconstituţionale două legi care îngrădesc drepturile fundamentale referitoare la viaţă intimă, familială şi privată şi la secretul corespondenţei, precum şi a libertăţii de exprimare. Securiştii sunt supăraţi că nu mai pot nu mai pot monitoriza legal persoane private care nu au încălcat legea.

Perl class builders

June 23rd, 2014 by ggl

I was more than pelasantly surprised today while benchmarking Moo against Mo, Class::Tiny and Mojo::Base. It turns out the latest version of Moo doesn’t have much of a speed penality when compared to Mo or Mojo::Base. Needless to say it’s two times faster than Class::Tiny. All of this without Class::XSAccessor installed. With it installed it’s on par with Mo, sometimes even faster. If I’d start a new project today I’d probably use either Moo or Mojo::Base.

Rate ct moo mo mb
ct 76799/s -45% -50% -61%
moo 139184/s 81% -10% -29%
mo 154844/s 102% 11% -21%
mb 195491/s 155% 40% 26%

Moo only has features that make sense, such as inheritance, roles plus some safeguards that make sloppy programming a headacke. Some of them are rather annoying, for example fatal warnings, which can be defused by using Moo::Lax. If you want type checking with Moo, there are some documented extensions for that, or you can use Type::Tiny. Moo also provides an easy migration path to Moose and in order to use it you only need to install just about eight non-core dependencies, as opposed to half the CPAN.

Mojo::Base is really minimal, has zero core dependencies and is part of the excellent Mojolicious framework. If you’re already using that you probably don’t need another object builder. The syntax is also Moose-like.

Perl and JSON

May 31st, 2014 by ggl

I like JSON a lot when it comes to seralizing data and REST web services. Perl has very good support for JSON and several libraries to pick from. While selecting the best components for my projects, I have been testing and timing a few Perl modules that produce JSON. These are JSON::PP, which has been in the Perl core since 5.13.9, Mojo::JSON, part of the excellent Mojolicious web framework, JSON::Tiny, a stand-alone adaptation of the latter, JSON::XS, written in C for blazing speed and Cpanel::JSON::XS, a fork of the latter. I also tested JSON:DWIW, an older module also written in C. Let’s see how they perform.

Rate jpp jt mj jdwiw jxs cpjxs
jpp 4437/s -6% -11% -82% -97% -97%
jt 4718/s 6% -5% -81% -97% -97%
mj 4977/s 12% 5% -80% -97% -97%
jdwiw 24917/s 462% 428% 401% -83% -85%
jxs 145479/s 3179% 2983% 2823% 484% -10%
cpjxs 161266/s 3534% 3318% 3140% 547% 11%

If you don’t want to bother, JSON::MaybeXS is a wrapper module that automatically selects the best out of three of them and can also operate like the core JSON, so you only have to change your use statement and leave the rest of your code untouched. JSON::PP, JSON:DWIW and the XS modules are packed with features, while Mojo::JSON and JSON::Tiny are minimalistic libraries and only produce inline compacted JSON suitable for machine consumption.


April 14th, 2014 by ggl

Playing with sharp objects outside evals.

‘And what would humans be without love?’
‘RARE, said Death.”

– Terry Pratchett, Sourcery


April 4th, 2014 by ggl

Avoid it like the plague.


March 11th, 2014 by ggl

Un articol delicios, dar în acelaşi timp foarte trist, despre o restaurare în stil hunedorean.


February 27th, 2014 by ggl

I’ve read a very interesting article on the recent events in Ukraine, Russia and name calling, dictatorship, national bolshevism and differences between the EU and Putin’s rival project, the Eurasian Union. If the revolution in Ukraine was planned by the West, the timing could not have been better as Putin was rather busy with the Winter Olympics in Sochi.


Remember the 1999 Pristina airport incident? This time nobody is going to cut Russia off. Crimea is an important strategic Russian outpost and they will defend their interests in the area.

A 1979 novel called The Island of Crimea and written by Vasily Aksyonov predicts Russia’s occupation of the peninsula in strikingly accurate detail. Of course, it’s all fiction.

February 24th, 2014 by ggl

Iar Isus! Dacă n-ar fi fost el, ce simplu ar fi fost totul: ar fi putut să stea aşa o veşnicie, uitându-se unul la altul, în timp ce ea îşi bea sucul de roşii.
– Eu sunt catolic. Tu ce eşti?
– Eu sunt sora Katiei.

- Andrés Barba, Sora Katiei

Lectură nerecomandată cardiacilor

February 18th, 2014 by ggl

Am descoperit sâmbătă o carte cu texte de Ion Mureşan, probabil anecdote, că povestiri scurte nu pot să le zic pentru că îs cam prea scurte şi mă prăpădesc de râs din cauza lor. Am râs în librărie, am râs pe stradă, în autobuz, în tot felul de contexte sociale în care poţi fi cu uşurinţă luat drept nebun. Dar să lăsăm asta. Cărţii îi spune Oglinda aburită şi n-am să reproduc din ea decât un titlu: „Eminescu” şi priza de la trifazic.

PS: M-am înşelat în privinţa anecdotelor. Pe copertă scrie eseuri conversaţionale.

PPS: Reproduc totuşi un fragment, la cerere:

– Măi, eu te-am întrebat un lucru simplu – l-a întrerupt „Kogălniceanu”: ţi-a spus Crişan să schimbi priza sau nu? E vorba de o priză de 8 lei, nu de o avere!

De cinci ori a pus „Kogălniceanu” întrebarea, de cinci ori „Eminescu” s-a eschivat. Am aflat că era defectă „friteuza”, că şi ea „corentează”, şi robineţii de la bucătărie „corentează”, că o mică piesă a fost înlocuită, că împământarea e insuficientă, dar, dacă primise sau nu ordin să schimbe sau nu priza, nu am aflat. Nu a vrut, în ruptul capului, să spună. Aşa că „Kogălniceanu” (am dedus că ar fi patronul localului sau ceva de genul acesta) a cedat şi a trecut la capitolul „friteuză”:

– Ai reparat potenţionetrul (sau reostatul?) de la friteuză? [...]

Goodbye Linux

February 16th, 2014 by ggl

As the remaining non-systemd major Linux distributions are moving to systemd, I am more likely to refrain from further Linux usage whenever I am making my own decisions.

I am currently using Ubuntu LTS on the desktop. 14.04 would most likely be the last LTS version to use upstart, as Debian is switching to systemd and Ubuntu people have decided to follow upstream.

I would happily use Gentoo if it wasn’t an ever moving target, requring me to compile everything by hand every time. In fact I shall give it a shot anyhow, maybe it does indeed work for me. OpenRC is a good and correct approach to system init because it does not overdo everything like systemd does. I would have preferred runit, but anything else other than systemd is fine. Why? Because systemd is broken by design.

SuSE has been struggling to migrate everything to systemd since version 12.1. Fast forward three years. We are now at 13.1 and there are still problems with it.

So it looks like I am heading towards a BSD desktop after all. On servers I’ve been already running FreeBSD for the last ten years or so.


I am not going to use Gentoo. The install is too tendious and it requires building everything from source, including the base system. By contrast, all the BSDs offer a fully functional and very well integrated base operating system that’s easy to install. With pkgng you also get access to over 20k packages that are rebuilt weekly.

Upstart is sometimes even worse. If you try to disable a service you end up messing with scripts. Override files? You must be kidding me. Whatever happened to symlinks? What I mean is a single symlink for every service, runit style, not multiple symlinks like sysvinit uses. Or a single config file, like rcng uses. At least systemd provides a single command that allows you to enable, disable, start, stop, list services and more. Its switches are long and not always intuitive, but at least it does have builtin help. OpenRC has three of them, yet it’s still a lot better than messing with scripts and override files.