Apache cannot serve files with unicode filenames

I've had a problem with my Apache setup where it couldn't serve images with unicode characters in file names:

 <a href="http://www.boku.ru/img/проверка.jpg">http://www.boku.ru/img/проверка.jpg</a> (really missing right now; just an example)

SCP client (WinSCP) clearly showed files were present, other files from the same folder could be accessed but those with cyrillic characters were returning 404.

Using Wireshark, I determined my browser sends urlencoded text (B0%D0…) instead of bare unicode, but that was, apparently, like it should be.

Studying Apache logs, I've found it complain about missing files, re-encoded in \x notation (\xb0\xd0…). For a while I thought this suggested a problem, but in the end it was unrelated and probably correct behavior.

Turns out, WinSCP does not use UTF-8 by default. Instead it sends file names to server in the local PC encoding, Win-1251 in my case. Looking through WinSCP everything seemed alright because it reads filenames back in the same encoding. But from the server point of view (as seen through SSH for example) those were not Russian characters but some Krakozyabry.

In other words, there really was no проверка.jpg.

To recongifure WinSCP, open Site manager, press Edit, Advanced, "UTF-8 encoding for file names: On", then reconnect. You'll have to rename all affected files.

A lost game

A move many debaters try to pull off is setting up a lost game. It works like this:

“Punishing those who download books is unfair. They just take what was lying in the open. That’s a basic human right.”
“Yes they can reshare. You can’t punish for that either. They haven’t signed a contract promising not to do so. They are free to do as they wish.”
“Eh, okay. But surely, as a writer, I’ll just pen a contract by which anyone who buys and then shares is to be held responsible for all the millions of dollars of damages?”
“No, we cannot do this because that’s immoral. That’s basically enslaving him.”
“But then how do we protect the writers?”
“I don’t know? You want copyright, you think of something.”

Or like this:

“The government has no right to ban Freedom Hosting! They didn’t host CP, they hosted everything, that was just their business model: no restrictions.”
“Providers cannot be ordered to ban sites. That’s censorship!”
“People must be allowed to remain anonymous on the internet.”
“So you want to fight CP? We cannot ban the site, cannot ban the hoster and cannot find out who the owner is. I guess you have to sit and wait until the owner reveals itself, FBI! Know that I rooted for you.”

Negotiations don’t work like this. Either you don’t support the idea at all, or you see a point in it and then by the rules of discussion you must protect its interests to the extent you see it as important. In other words, if you agree you agree. No one is ever convinced by “I’d love to clean the room mom, but there’s a reason I can’t”.

That’s not how you should do it. There are several sides to the story and it’s okay to take one as long as you’re honest.
“I want there be a certain amount of uncontrollable freedom in the internet because total control is unhealthy for any society”. Absolutely.

See how the reaction changed? That’s because that was the truth. That was the idea that moved you, not the layers of justifications built around to make it “consistent”. And what moved one person may move another. You wouldn’t want to be held responsible for simply providing a hosting? Neither would I. It just feels wrong that one can go to jail for typing on the keyboard? Does so to me. You don’t want to be made to buy books, you want to buy books you liked? I can relate to that.

WordPress not remembering name or email for anonymous commenters

Someone reported that WordPress at boku.ru hasn’t been remembering the name and email which you enter in comments. I vaguely remembered this working before. After some investigation, turns out it was W3 Total Cache plugin which uses comment_cookie_lifetime filter to drop standard WordPress cookie lifetime from half a year to 30 minutes. And since my site runs as GMT, this was eaten by the 4-hour time difference.

W3 Total Cache did that because for cookie-less visitors it serves fast static version of the page (which can not be tailored for each visitor and have their name pre-entered, the way names are handled now). As long as you have posted a comment, you receive a cookie and WordPress serves you slower, dynamic version of the page. So the longer the cookie lifetime is, the longer you’re going to be served dynamic pages (but the longer your settings are going to be preserved).

This setting can be changed at “Performance > Page Cache > Advanced > Comment cookie lifetime”.

If you’ve stumbled upon this post while solving a related problem, here’s some additional pointers:
1. WordPress stores commenter name/email/url in cookies:
comment_author_*
comment_author_email_*
comment_author_url_*

An example of how querying for these values should look like is in /wp-includes/comment-template.php/comments_template()

2. Your comment form is generated either by this, or by customization hook in your theme’s comments.php.

3. To debug cookies, add print_r($_COOKIES); to your theme’s header.php, don’t forget to remove it later. Use Wireshark or your browser’s request sniffer to track what’s being sent.

Всегда занят

Invisible – бесполезный режим в мессенджерах, поскольку всё, что он делает – это пытается забанить человека под благовидным предлогом, не портя с ним отношения, и длится это ровно до первого раза, когда вы спалитесь, ответив из инвиза.
Ну, конечно, есть умельцы, которые из принципа постоянно в инвизе, и это правильно, поскольку создаёт основания для plausible deniality, но тогда они вообще не пользуются статусом, получается.
Гораздо убедительней было бы “‘Занят/нет на месте’ для этого человека”. Во-первых, даже если вы заняты, вы можете отвлечься и ответить, когда захотите. Во-вторых, существует тысяча причин иметь такой статус постоянно (например, вы выставили его на мобильнике, т.к. оттуда общаться неудобно).

Чтобы действительно познакомиться с товаром перед покупкой, нужно искать в гугле “[товар] отстой”, “[товар] глючит”, “[товар] не покупайте”. А чтобы проверить, нельзя ли в программе случайно спалить свои личные данные, нужно погуглить “[программа] расшарить данные”. У вас и у этих людей дополняющие друг друга цели: вы хотите исключить любую лазейку, а они – какую-нибудь найти.

Просто праздник какой-то

По словам собеседника агентства, бывший заместитель министра здравоохранения Ростовской области Василий Кравченко 11 ноября выслушал приговор, после чего пропал. «Его не смогли взять под стражу», — пояснил представитель суда. — lenta.ru

Гарри Поттер и дело о нелегальных закупках.

Не знаю, что у них там происходит, но американский официальный перевод манги и ранобе регулярно кошмарен. Некоторые книги сразу ужасны, как Триган. Spice and Wolf сначала был очень неплохим, а потом то ли переводчику надоело, то ли он перестал разбираться в сюжете, но всё стало как обычно:

(Пример)

The inn was also a tavern and it was late enough into the night that their orders of wine were fulfilled by a yawning innkeeper.
Lawrence had expected that either Kiemann or Eve would come calling, but there was no news from either of them. He sipped wine out of sheer nervous energy, but his worry was so much effort in vain.
By contrast, Holo got Col quite drunk, as usual.
Once she was able to confirm that the intoxicated boy was asleep, she would move back to her own bed. Holo insisted that if she did not get him drunk, he would sleep on the floor.
Lawrence was not sure if she was doing him any favors or not. Her methods were extreme; that much was certain.
“Now then, this will finish off our day nicely.”
Given that he had made a fool of himself twice that day, Lawrence had gone to fetch more wine from downstairs, though he knew it did not constitute an apology.
Holo seemed to expect as much, but Lawrence could tell that she was a bit disappointed at his meek obedience. She even seemed annoyed at his ordering of the last bottle, as she felt it excessive.
Usually she would make a dissatisfied face upon encountering the end of the evening’s drinking, but now, if anything, she seemed relieved.
Her ability to be so thoroughly dishonest about her own desires was a cunning, wolfish thing indeed.
And yet Holo was still Holo.
“Ah well, for my part I only wish you’d bring your whimpering to an end.” She tried to pull her tail out from under Col’s head at the corner of the bed and tool the bottle from Lawrence’s hand, a nasty smile on her face.
She was being so childish that it seemed likely she would enjoy his silence even more than a clumsy retort.

Понятно, о чём я говорю? В русабе если ошибаются, так хоть сразу видно, что бред. А здесь попадают в какую-то ужасную зловещую долину, где воздух мёртвый и смысл отсутствует напрочь. Представьте, что это диктант, и ответьте на вопросы: что произошло в отрывке? Из какой-такой “нервной энергии” Лоренс пил вино? Какой effort был при этом in vain? Почему Кол спал бы на полу, если его не напоить? И так далее.Какие favors делала или не делала Холо этим Лоренсу? Методы чего были у неё extreme? К чему эта фраза про finish our day nicely? Почему из-за того, что Лоренс дважды опозорился, ему нужно было сходить принести больше вина, и каким образом это связано с извинениями? Почему Холо была рада, когда выпивка закончилась? При чём тут dishonest about desires, чего тогда кто из них на самом деле хотел? Почему неискренность – волчья черта? При чём тут что Холо – это всё-таки Холо? Откуда вылезло про whimpering Лоренса и как оно связано с происходящим? Откуда ещё одна бутылка, выпивка же уже закончилась? Каким образом то, что Холо выглядела по-детски дурашливой, значит, что молчание в ответ ей бы понравилось больше ответной дурашливости?

Во всём этом просто нет абсолютно никакого смысла. Но поскольку предложения подчиняются общей теме, то кажется, что вроде бы что-то читаешь, хотя 90% текста от тебя ускользают. Создаётся впечатление, что ничего не происходит, что мир книги мёртвый, в нём нет деталей, нет постоянного движения от событий к последствиям, только время от времени проплывают обломки сюжета, по которым можно судить, что под слоями краски, в замазанной глубине что-то изменилось.

Ecce Holo
Слева: оригинал, справа: английский перевод.

We need to go deeper

Существуют фанфики по HPMOR. Это неудивительно, поскольку HPMOR сам размером с 3-4 тома оригинального Поттера и в несколько раз динамичней.
Но существуют фанфики по этим фанфикам.

Фанфики по фанфикам по фанфику по Поттеру.

Genshiken Nidaime

Это же Геншикен! Это же правда настоящий Геншикен! А я и не верил по первым сериям. Какой же он замечательный!

(картинки)













Геншикен, глупый, что ты делаешь? Иди домой, ты пьян.

История жизни

Моему блогу уже под восемь лет. Иногда я листаю старые записи и не узнаю себя – значит, это было очень давно. Иногда я теряюсь в месяцах и сезонах – осень, до неё лето, до того была весна, потом зима, опять осень, опять лето, опять зима – когда это было? Той зимой или этой? Неужели два года прошло? Ведь это было только что.
Я беру листок и рисую линию, или открываю файл и отмечаю самые важные моменты:
* Осень 2010 – перевёл такую-то книгу.
* Сентябрь 2011 – такие-то перемены в жизни.
* Январь 2012 – волновался о том-то.
И понемногу мне становится проще, поскольку я вижу, что все эти годы были не пустыми.

Хорошо бы как-то устроить, чтобы в одном блоге показывались и общие, и личные посты, и фотографии в соответствующих местах, чтобы получался альбом для листания. А также чаще записывать чувства на будущее, хотя сложно разговаривать с самим собой – всё звучит лишним. И чтобы можно было отметить посты и сделать линеечку, как я делаю вручную.
В принципе, всё это можно сделать из вордпресса, но ему немного недостаёт подзамочности постов – чтобы личное бывало личным, а бывало совсем личным. И нужен плагин, который фотографии будет автоматически в поток вставлять по эксифу.