This fragment is about to be reported (you'll remain on this page):

You can enter a comment to clarify the mistake if you would like to:

Posts tagged “in English” RSS20

CentOS cheatsheet

My notepad of CentOS administrative commands & resources.

CentOS cheatsheet

Hierarchy

/ecc/init.d/SVCStartup service scripts; equivalent to FreeBSD's /etc/rc.d/ and /usr/local/rc.d/.
/etc/nginxnginx config files
/var/lib/mysqlMySQL databases; equivalent to FreeBSD's /var/db/mysql/.

Package management

yumInstall & upgrade available packages
rpmList and remove installed packages

«…»

No comments yet | Read rest of this entry »

Windows administrator's cheatsheet

Talks about the notable gpedit.msc and secpol.msc applets.

Windows administrator's cheatsheet

Disabling sercurity warnings for downloaded programs

Windows XP starting with SP2 or somewhere around has acquired this annoying habit of showing the user the following probpt each time he tries to open an .exe file that he has downloaded from the Internet (surprisingly this works not only for Internet Explorer but any other browser as well):

You can disable this behaviour by running (Windows key + R) shgpedit.msc and navigating to the following group of settings:

  • English: User Configuration → Administrative Templates → Attachment Manager
  • Russian: Конфигурация пользователей → Административные шаблоны → Компоненты Windows → Диспетчер вложений

«…»

No comments yet | Read rest of this entry »

MySQL: utf8_general_ci vs utf8_unicode_ci

Simple explanation of the two character set/collation differences.

MySQL: utf8_general_ci vs utf8_unicode_ci

I have always been curious about the two collations MySQL tables have: utf8_unicode_ci and utf8_general_ci – both seem to be working with Unicode but what's the exact difference?

Today I have finally decided to look for exact answer and found it as the first result in Google on MySQL forums:

You can check and compare sort orders provided by these two collations here:

utf8_general_ci is a very simple collation. What it does – it just

  • removes all accents
  • then converts to upper case

and uses the code of this sort of «base letter» result letter to compare.

For example, these Latin letters: ÀÁÅåāă (and all other Latin letters «a» with any accents and in any cases) are all compared as equal to «A».

utf8_unicode_ci uses the default Unicode collation element table (DUCET).

The main differences are:

  1. utf8_unicode_ci supports so called expansions and ligatures, for example: German letter ß (U+00DF LETTER SHARP S) is sorted near «ss» Letter Œ (U+0152 LATIN CAPITAL LIGATURE OE) is sorted near «OE». utf8_general_ci does not support expansions/ligatures, it sorts all these letters as single characters, and sometimes in a wrong order.
  2. utf8_unicode_ci is *generally* more accurate for all scripts. For example, on Cyrillic block: utf8_unicode_ci is fine for all these languages: Russian, Bulgarian, Belarusian, Macedonian, Serbian, and Ukrainian. While utf8_general_ci is fine only for Russian and Bulgarian subset of Cyrillic. Extra letters used in Belarusian, Macedonian, Serbian, and Ukrainian are sorted not well.

The disadvantage of utf8_unicode_ci is that it is a little bit slower than utf8_general_ci.

So when you need better sorting order – use utf8_unicode_ci, and when you utterly interested in performance – use utf8_general_ci.

In other words, utf8_unicode_ci is more Unicode than the general collation. Looks like even when Unicode is promoted as a de-facto string standard these days native Latin guys tend to leave some unappealing languages overboard to make things somehow more fast and tad more complicated. Or the other way around?

In the end I have decided to always use utf8_unicode_ci in my projects – not only because I'm a native Russian and deal with Cyrillic symbols a lot but mostly because Unicode is meant to be universal encoding so it should work as its name suggests – universally. For all.

No comments yet | Show this entry »

PHP PDO: General error: 2031

PHP PDO: General error: 2031

This is a quick note on the following PDO error from PHP:

This has happened on my MySQL database query. In a nutshell, the name suggests (ok, not the name) that there's a problem with your value bindings. In my case I have created a nested SQL but forgot to copy its values to the main query.

If you're still unsure check this comment in the PHP docs.

No comments yet | Show this entry »

DBNinja for localhost

DBNinja for localhost

DBNinja is a fine piece of software for administrating more than one host. That said, it's very convenient above that as well – though a habit of having phpMyAdmin (or now phpPgAdmin too) is strong and it is simply amazing how hardcore its interface is in reality, even with some slap-on-top AJAX in the recent releases.

Like I said, DBNinja is a good product but for me it had two shortcomings:

  1. Not allowing empty passwords – «empty» in its notion means «unsaved» which makes DBNinja prompt for it on each session. For localhost/root this means I have to click on OK without actually entering anything every time I start a new session.
  2. No autologin – phpMyAdmin conveniently has config auth value which makes it open the database view right away when you navigate to its home page.

After a bit of digging I have solved both problems the solution of which I now present to anyone else who's interested:

  1. Empty passwords: in js\somecode.js find this: noPasswd=n.passwd?!1:!0 and replace with this: noPasswd=0/*n.passwd?!1:!0*/ – this will make it assume that every host you have on the Hosts tab has a stored password – in other words DBNinja will no more prompt you for a password even if it's unfilled.
  2. Autologin: go to index.php and:
    1. Find init() function in the JavaScript block and put the following line before others there:
      document.getElementById('sbmt').click();
    2. Find Username and Password inputs about 10 lines below and edit their xmlvalue="" attribute so that they now match your DBNinja's account credentials.

That's all to it. Hope it helps!

Has 3 comments | Show this entry »

ImapExport

A little tool to export the entire IMAP folder to a set of EML files.

ImapExport

When moving to my new mail server I wanted to keep all existing messages. I had IMAP access to the old mailbox so I made this small program to export all messages into a set of raw .eml files.

Features

  • supports SSL connection
  • exports any IMAP folder, not just INBOX
  • supports custom file name pattern that may include message sender, charset, date, flags, recipient and others
    • to see full list of variables connect to the server, click on the green plus button and select Set output file name pattern
    • if file with the same name existed new file will be suffixed with (2), (3), etc. similar to the way Explorer acts when renaming multiple files
  • can skip messages prior to a certain date – useful when creating regular backups
    • if Save settings on exit is checked this date can be automatically set to now after completing each export
  • can show/export individual message(s) by their number
    • to do this connect to the server, click on the green plus button and select Show message by its index
  • can remember connection and other settings on exit
    • if you wish to save all but Password fields check Save settings on exit, close the program, open ImapExport.ini, and clear the part after = symbol of Password=... line and then open ImapExport again – from now on Password will be remembered blank
    • last connected IMAP folder is remembered but if you wish to always select INBOX (or another folder that’s first in your mailbox) do the same as above but for DefaultFolder=... line
  • press Esc to close the program

Download

«…»

Has 3 comments | Read rest of this entry »

Cyrus & SASL – «No Mechanism Available»

Cyrus & SASL – «No Mechanism Available»

This one has been troubling me since my very first setup of the Postfix/Cyrus mail host. Due to some reason both Postfix and Cyrus would refuse to let me in when using LOGIN or PLAIN auth mechanisms («mechs» in SASL terms).

What I did to finally solve this was this:

  1. Stopped Postfix (shpostfix stop) and Cyrus (sh/usr/local/etc/rc.d/imapd stop).
  2. Removed all 3 ports: cyrus-sasl2, cyrus-imapd22 and postfix-current with shmake deinstall clean.
  3. Installed them again in this order:
    1. security/cyrus-sasl2 – with options AUTHDAEMOND, LOGIN, PLAIN, CRAM, DIGEST, OTP, NTLM
    2. mail/cyrus-imapd22 – with no options
    3. mail/postfix-current – with no options PCRE, SASL2, TLS
  4. Configured per-application SASL settings:
    1. For Postfix they reside in /usr/local/lib/sasl2/smtpd.conf and contain this:
    1. Cyrus doesn’t look like reading them from anywhere except its own config (/usr/local/etc/imapd.conf) where they’re prefixed with sasl_. See the full config below.
  1. Started Postfix (shpostfix start) and Cyrus (sh/usr/local/etc/rc.d/imapd start) – before the latter make sure /usr/local/cyrus/bin has rwx perms for others as port installed tends to reset them.

«…»

No comments yet | Read rest of this entry »

Multidomain mail system with Postfix & Cyrus

Multidomain mail system with Postfix & Cyrus

After more than a year since the first time i had to setup my own mail host at i-forge.net I came across the need to do so again – but for another domain. In this guide I will explain how one can setup virtual domain system on FreeBSD 8 using Postfix and Cyrus 2.2.

I assume that you have already set up a working mail host that successfully handles incoming and outgoing messages for a single domain. If not, you can start from here.

Postfix

Let’s begin with the easiest part. In Postfix, there are at least 3 ways to set up a multidomain e-mail server; we’ll use an advanced virtual domain system that, however, is very easy to configure. In the docs this is called «Postfix virtual MAILBOX example: separate domains, non-UNIX accounts».

«…»

Has 4 comments | Read rest of this entry »