воскресенье, 26 февраля 2012 г.

Libreoffice is a slow piece of shit

Subj!!! I hate this piece of software. It is fucken slow, when
a) it works with PostgreSQL-based datasource (e.g. as a bibliography source),
b) it works awfully slow with document, in which we store editing history...
The bad news are that there is little alternatives. Maybe the next time I wish to write some big and complex document, I'll try to do it in Google Docs...

вторник, 14 февраля 2012 г.

French symbols without azerty

So, sometimes I have to type some text in French. And I dislike AZERTY layout, it's too unfamiliar. So, what should I do? Right, to use altgr-intl US layout. To do this you just need to set XKB Variant to "altgr-intl" (something like this in hal policy file - /usr/local/etc/hal/fdi/policy/x11-input.fdi on my FreeBSD system):

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
<device>
<match key="info.capabilities" contains="input.keyboard">
<merge key="input.x11_options.XkbModel" type="string"> pc105</merge>
<merge key="input.x11_options.XkbLayout" type="string">us,ru</merge>
<merge key="input.x11_options.XkbOptions" type="string">grp:rwin_toggle,grp_led:scroll</merge>
<merge key="input.x11_options.XkbVariant" type="string">altgr-intl,winkeys</merge>
</match>
</device>
</deviceinfo>


Now, to type something with ^ , like û, you just type RightAlt+6 (^ symbol is there) and press u. To type è - RightAlt+` and e... Big list of shortcuts is here. And if you don't touch right alt this layout behaves just like basic us layout...

понедельник, 6 февраля 2012 г.

Illumian is here...

Today I've tried the first Illumian version. This is illumos-based Nexenta OS. Just a few remarks.
What I liked:
1) VTs finally work in illumos installer, it's good to have a possibility of going to text console and checking installer's log.
2) It seems, the installer can install system on mirror pool. C'est beau.
3) APT... I finally shouldn't learn one more package system and apt is IMHO faster then IPS.
4) It's still Solaris: you have DTrace, ZFS, projects, fair share scheduler...
5) git change number in place of OS version looks cool :)

# uname -a
SunOS oi-test 5.11 4cece89cac3e i86pc i386 i86pc Solaris

What I disliked:
1) Zones don't work:

root@oi-test:~# zoneadm -z myzone install
sh[1]: exec: /usr/lib/brand/ipkg/pkgcreatezone: not found

And Solaris without zones is a very strange thing...
2) /usr/gnu/bin in front of path... How can you use GNU chmod with ZFS ACL?
3) Soft, soft, soft... Where are you?

root@oi-test:~# apt-cache pkgnames |grep postgres

4) apt-clone doesn't work

This is just a first glance on this OS. It is very raw and is still in development. I doubt that calling this release 1.0 was a good idea. It seems, we will have a production-ready OS not sooner then in half of year, but still... I wonder, what Illumos-based OS will be first to reach production quality: OI or Illumian? It seems OI is in better form nowadays, but the fact is that OI team has failed to create a stable release in about 1.5 years.

понедельник, 30 января 2012 г.

php-fpm status polling

Just a brief note...
If you wish to monitor php-fpm pool, it provides status page determined by status_path configuration parameter in pool config file.

pm.status_path = /statusfpm

Status page usually looks like this:

X-Powered-By: PHP/5.3.3-1ubuntu9.7
text/plain
Content-type: text/html

accepted conn: 253745
pool: mhouse
process manager: static
idle processes: 50
active processes: 0
total processes: 50

The problem is that it is not usually accessible by HTTP, and you should usually use web-server to communcate with php-fpm by FastCGI protocol. Now let's imagine that you have 10 php-fpm nodes and one nginx server. It seems justified to get status from each php-fpm node, you should talk directly to php-fpm. And you can use php FCGIClient (big thanks to its author, Pierrick Charron) for this task.
Using this library is straightforward. The only difficulty is to send necessary headers to php-fpm. These headers we can find out with tcpdump, monitoring nginx and php-fpm communications. So, the following script can be used to retrieve distinct php-fpm statistics:

<?php
require('fastcgi.php');

$client = new FCGIClient('192.168.0.1', '9000');
$answer=$client->request(
array(
'GATEWAY_INTERFACE' => 'FastCGI/1.0',
'REQUEST_METHOD' => 'GET',
'SCRIPT_FILENAME' => '/usr/local/nginx/html/statusfpm', //Nginx document root
'SCRIPT_NAME' => '/statusfpm', //our pm.status_path
),''
);
?>


Recieved file can be analyzed further and result may be fed to your monitoring system:

$lines=split("\n",$answer);
//Line 0 (4 - with headers) - Accepted connections
$cnum=strpos($lines[4],':');
$accepted=trim(substr($lines[4],$cnum+1));

//Line 3(7) - idle processes
$cnum=strpos($lines[7],':',1);
$idle=trim(substr($lines[7],$cnum+1));

//Line 4(8) - active processes
$cnum=strpos($lines[8],":");
$active=trim(substr($lines[8],$cnum+1));

//Line 5(9) - total processes
$cnum=strpos($lines[9],":");
$total=trim(substr($lines[9],$cnum+1));



The latest part depends on monitoring system you using. We have some service php functions to interact with zabbix (in particular, slightly modified zabbix_sender function).

пятница, 23 декабря 2011 г.

Ubuntu VZ container and lo interface

If you look at VZ image of Ubuntu 11.04 , you'll see that udev is excluded from startup. It seems to be incorrect, because without udev "net-device-added INTERFACE=lo" event is not emitted and loopback interface remains unconfigured... At least, this behavior appeared after updating this image to 11.10. I don't remember if lo interface was present in original 11.04 image.

четверг, 22 декабря 2011 г.

How can you use PocketBook?

I received a PocketBook 612 reader as New Year present... I haven't seen slower device. It seems that my phone is faster and even my 13-year old computer was faster... I just want to read books. However, when I navigate through pages in a PDF file, this thing starts thinking,,, I can't even scroll through several pages per minute. The screen sometimes shows artifacts (is not cleared completely). The book has 44 dictionaries... It's good. It has even Ukrainian-Russian dictionary and French-English one but not French-Russian... And this device is supposed to be sold in Russia... Cool.
I didn't manage to connect it to my home Wi-Fi WPA2/PSK network with hidden AP.
However, it can pronounce words and read text aloud. But I don't need this, all I need is a reader and a vocabulary. I thought I could get it for about 250$. I was wrong... I wouldn't count this amount of money if the thing worked... But it lags worse than 10-year's old PC.
Possibly I should read books from my phone and don't use such incomprehensible device... It seems the best solution is to return this device to a seller and to buy some cheap netbook or tablet pc...

воскресенье, 4 декабря 2011 г.

One thing I hate in FreeBSD...

One thing I hate in FreeBSD - is the speed of maintainence operations.
To install (or upgrade) one port you have to wait half an hour...
To update system with custom kernel/userland parameters, you should wait several hours... Then you call mergemaster, which asks you a dozen questions about config files (and most of changes doesn't impact on the current system, but just in case there is something important, you have to review them).
Comparing to "do-release-upgrade" on ubuntu, the speed of operation is unberable. And binary updates just don't do everithing you need (e.g. dtrace world, necessary ports options...)