2013-10-28

Hgext.markdown for Windows

Python eggs

Main problem with this extension on Windows OS was external dependency Markdown and unlike on Ubuntu you cannot execute apt-get python-markdown in your shell. TortoiseHG has bundled python and you cannot simply add egg inside dist-packages. I look at source and find out, that original way for Windows user was uncomment and edit line sys.path.append("c:/python27/Lib/site-packages/markdown-2.2.0-py2.7.egg") but nothing was in documentation about it.

So I decide to rewrite this mechanism in fallback style: first we try to load markdown package and if failed, lookup using path from config (python can transparently lookup files in zip archives):
try:
    from markdown import Markdown 

except ImportError:
    dir = os.path.dirname(os.path.realpath(__file__))
    md = ui.config("web", "markdown.egg", "Markdown-2.3.1")
    ui.debug("Markdown not found search for egg in local dir %s for %s.zip\n" % (dir, md))
    sys.path.append(os.path.join(dir, "%s.zip\%s" % (md, md)))
    try:
        from markdown import Markdown
    except ImportError:
        ui.error("Unable to locate markdown in path %s" % sys.path)
global Markdown


this is final version corrected by Chris Eldredge. Now you can download markdown package and put it in extension folder.

Relative paths

Rendering comparison
BitBucket vs hgext.markdown

Second big improvement is relative paths in markdown files. We massively use crossreferences in the docs we store in our repository, and quickly find out some problems with relative links in which used parent (..) directory and hash (#). I fixed this and update demo page with picture and relative navigation. Unfortunately BitBucket incorrectly render this markdown because of the bug.

Preview

Also now you can navigate to preview of uncommited files with one click in menu. Not a big deal but usability improvement.

Summary

Chris already merged this patches to his repo. So if you want to see beautiful doc instead of raw markdown, even on Windows it is good time to install or update extension.

2013-10-20

Как я патчил Jetty

Постановка задачи

Freeswitch умеет при помощи mod_curl забирать с определенного урла диалпланы и пользователей. Это очень чуствительная информация, поэтому очень захотелось ограничить доступ к служебным урлам только с localhost.

2013-10-19

Дерзкая саламандра

trollface.jpg
Что, раскладка
не переключается?
Обновился на Saucy Salamander. С Maverick Meerkat это самый скучный релиз, обновилось 2000 пакетов, но абсолютно ничего нового. Обновили линзы, которые у меня отключены, интерфейс наутилуса, которому я предпочитаю mc.

Даже на LOR-е какой-то скучный забег без огонка, без задора. Уже какой день, а даже нет десяти страниц. Традиционно, уже который релиз подряд, ломают переключало раскладки. На космодроме выяснил, что можно забиндить переключение на ctrl+space.

Пока больше проблем не заметил. Итог: смысла обновляться нет, спокойно можно ждать Trusty Tahr LTS.

P.S. Interpid Ibex 08.10 -  был моим вторым релизом убунты. Так вот Ibex подвид Tahr, или наоборот, или вообще одно и то же. Короче, Шаттлворт мог бы быть чуточку по-оригинальнее.

2013-10-17

IntelliJ IDEA on Ubuntu productivity guide

IDEA from JetBrains is the first choice tool for me since our team migrated to it year and a half ago and there no way back to Eclipse or NetBeans. Everyting is perfect except one flow which turns into major for experienced user: shortcuts tailored for Windows developers and on Ubuntu it turns into hell: lock screens, tty changes, crazy window movement, e.c. for almost all shortcuts. There many keymaps available in IDEA (gnome, kde), but not for Unity. The last drop was master-class from one of developer. So I decided to retrofit Ubuntu: single IDE experience for me more important then single OS experience (especially concider usage of multiple different OSes).

Following recommendations are for Ubuntu 12.04 LTS. Shortcuts and tools may change. I will update this post whenever I configure new shortcut.

CCSM

Fist of all you should install compizconfig-settings-manager, most of customizations could be done in this tool. Launch ccsm.

Find Unity menu turn Hide launcher - autohide (mouse experience), then disable Key to execute command (alt + f2) and Key to show HUD (alt) - both annoying.

Next open Grid menu and disable both Put left and Put right it will free (control+win+arrow) which we will remap later.

At General options disable Toggle window shaded (frees settings shortcut).

At Move window menu disable Initiate window move (alt+f7 or find usages).

Open Desktop wall and remap next bindings: Move within wall from control+alt+arrow to contol+super+arrow, Move with window within wall from control+alt+shift+arrow to control+shift+super+arrow. It will free source code and tab navigation.

Keyboard layout

Locate keyboard layout in system preferences. Find Miscellaneous compatibility and turn on Special keys handled in server. It will turn off virtual terminal change with control+alt+f*, you can remap it in. Frees ctrl+alt+f12.

Keyboard

In system preferences open keyboard (why we need two different dialogs). At Launchers bind launch terminal to alt+f2. At System tab bind Lock screen to super+L (oh, you can finally autoformat code now).

Terminal

Open terminal (alt+f2 now), open Keyboard shortcuts in Edit menu and turn off Enable the menu access key and Enable the menu shortcut key (no more mess with base midnight commander shortcuts). At Profile preferences turn on Unlimited scrolling.

To be continued

Any more ideas?





2013-10-12

Код с драконами, перцептивная слепота и синдром утёнка

Here be Dragons

Я искренне верю, что все люди по-умолчанию разумны, по крайней мере вокруг меня, откровенные идиоты мне встречались крайне редко, а про вредителей я только слышал рассказы. Возможно, это некое проявление эффекта Даннинга-Крюгера.

Когда я вижу какой-то вотзефак в коде, дикое решение, выбор технологии, вотэва - я уверен, что человек выбрал лучшее решение на тот момент. Даже если в итоге получился дичайший монстр, который, как памятник, служит предостережением будущим поколениям. Этому может быть три причины.