| "d-a-i" sequences explained |
[Jul. 5th, 2009|12:54 pm] |
Well,
the promised
explanations.
The screenshot
shows work-log.el
debugging session. The "a-a-i-i-d" patchwork you see there is a work
log model (more on this below). A work log is a sequence of dates,
active entries, and inactive entries (the latter include comments);
see example
here.
In short: resolved tasks == inactive, pending ones == active, that's it.
Now. `work-log-hide-inactive' function (`C-c C-h') lets user
concentrate on open tasks, making inactive "noise" invisible.
The first implementation of the hiding function did hide resolved
tasks but also left some dates with no entries at all hanging
void. Like this:
2009-07-03
http://lib/it/processMMS: update scenarios' table
2009-07-02
2009-07-01
import `recsep' to CVS
Note the "hanging" 2009-07-02.
Okay. Let's omit the boring details (head scratching, pencil
sketching, and a couple of "aha!" moments) and goto right to
the way I debugged the damn function...
Here the simplified model of a work log suffice: a "d-a-i"
sequence -- sequence of ['d', 'a', 'i', '-'] characters, where
'd' represents date, 'a' -- active entry, and 'i' --
inactive. Hyphen ('-') is either empty line or the continuation of
previous entry (a task entry in real log can consist of several
lines).
All we need to do is change a bit the hiding function (substitute
regexps, replace `forward-line' with `forward-char', and show the
"hidden" regions in inverted color instead of actually hiding them)
and run it on a bunch of dai-sequences.
Testing input is easy to generate:
import Data.List (permutations)
main = putStrLn $ concatMap (\(x,y) -> x++y) (xs `zip` repeat "-")
where xs = concat $ permutations ["a", "a", "i", "i", "d"]
Given "i-d-a-d-i-d-a-i-" we get:
i-d-a-d-i-d-a-i-
Do you see a hanging date? The hidden (black) region in the middle
should cover preceding date ('d-') but it does not.
Well, you got the idea. Once the testing routine was established, it was easy
to fix the bug.
i-d-a-d-i-d-a-i-
Q.E.D.
* * *
Yes, and while you're here, I'd like to recommend this post:
Benefits
of automated functional testing (was: Why unit testing is a waste of
time)
Have fun! |
|
|
| word of the day |
[Jul. 4th, 2009|10:03 am] |
$ dict braino
2 definitions found
From The Free On-line Dictionary of Computing (4 April 2009) [foldoc]:
thinko
braino
/thing'koh/ (Or "braino", by analogy with "typo") A
momentary, correctable glitch in mental processing,
especially one involving recall of information learned by
rote; a bubble in the stream of consciousness.
See also brain fart. Compare mouso.
[Jargon File]
(1996-04-20)
From The Jargon File (version 4.4.7, 29 Dec 2003) [jargon]:
braino
/bray'no/, n.
Syn. for thinko. See also brain fart.
|
|
|
| все профессии нужны |
[Jun. 22nd, 2009|01:13 pm] |
Очень не хватает опыта работы в службе знакомств.
Передо мной выложен ряд из 7 почти неотличимых чёрных носков. Нужно
разбить их на пары. |
|
|
| Конкурс |
[May. 22nd, 2009|12:19 am] |
А вот кто напишет кратчайший выниматор списка гиков из
предыдущего
поста?
Условия:
1) Скрипт читает из stdin (точнее — из команды
`wget -q -O - http://vorotylo.livejournal.com/61461.html').
2) Если используете пайпы — ставьте по одному пробелу с каждой
стороны.
Вот так: ` | '.
3) Один человек может предлагать любое количество вариантов.
В `High Scores' записывается кратчайший.
4) Subject: <количество символов>
Ответ обрамляйте <pre>...</pre>
5) Комментарии пока что скринятся.
| High scores: |
| 1. | lionet | |
33 |
| 2. | xrgtn | | 33 |
| 3. | xrgtn + vvv | | 35 |
| 4. | palm_mute | | 39 |
| 5. | maard | | 41 |
| 6. | vvv | |
43 |
| 7. | nponeccop | | 46 |
| 8. | adept | | 53 |
Upd: Наконец-то запостили
input, который высадил все скрипты, кроме моего. Спасибо! :)
Upd-2: Новый стрёмный input лечится скриптом на 47 символов:
grep o= | grep -Eo '>\+?\w+ \w+<' | tr -d '<+>'
Upd-3: А ещё ведь надо исправлять entries вида `Имя Фамилия':
... | sed -r 's/^(Олег|Виктория) (\w+)/\2 \1/'
Резюме: Да, нелегкое это дело, встречи организовывать.  |
|
|
| Доклад по ФП и типам: регистрация участников |
[May. 21st, 2009|05:32 pm] |
Если ты "тип", желающий попасть в список, оставь комментарий в формате:
Фамилия Имя
Сформированный список уйдёт на КПП. Соответственно, чтобы попасть на пир духа, потребуется паспорт.
Удачи!
(После того, как пост выполнит своё предназначение, его сожрёт Козёл Фрэнк.)
* * *
Upd: Алё, мы ищем таланты!
Upd-2: Я наврал, и ничего Фрэнк жрать не будет. |
|
|
| Worthy Python |
[May. 16th, 2009|11:01 pm] |
|
To: self
Do not abandon Python. The language and its library
are full of good programming style samples to follow (and borrow). |
|
|
| мода |
[May. 13th, 2009|08:35 pm] |
|
Все дамы поголовно носят красноватые приталенные кожанки. Трындец какой-то.
Окей, это я для красного словца. На самом деле таких найдётся две в радиусе ста метров. Получается ..
$ python -c 'from math import pi; print 2/(pi*0.01*0.01)'
6366.19772368
.. Шесть тыщ women in red на квадратный километр города Киева!
PS: "Торговые площади торгового центра Квадрат." Геометрический нонсенс. |
|
|
| Announcing `work-log' |
[May. 2nd, 2009|11:34 pm] |
All of you played Doom. Some of you know that it was programmed by
John Carmack. Few of you might be aware of .plan files he posted even
before the term `blog' was invented. And I find the format used in
those files to be clean, minimalistic, and fitting my own
issue-tracking habbits.
The
format is simple:
* entry was completed on that day
+ entry was completed on a later day
- entry was decided against on a later day
2009-05-02
advertise work-log.el
2009-04-09
+ hack "log-mode": start with implementing `C-x 4 a' (change-log-mode)
+ fix jabber-el's "Idle" status
2008-12-24
+ kill the bad guys
- save the world
the princess?
Whichever log format is used, log file will grow with time. In
three months I had a long file with unfinished tasks being scattered
and tiresome to find. I wanted to make them visually distinguishable
from completed/rejected. ( Thus work-log.el was born. ) |
|
|
| 12.04 |
[Apr. 12th, 2009|04:59 pm] |
Младшой перетащил из-под шведской стенки мат, поставил вертикально в кровати. Мат с обратной стороны оказался чёрным.
Нарисовал на нём мелом звёзды. Нацепил на себя пластмассовые доспехи и наушники Beyerdynamic.
Сегодня ведь День Космонавтиков.
* * *
PS: Праздничная еда — Kosmostars.
PPS: Праздничная музыка — David Bowie, Space Oddity.
(Фильм — ``Космическая одиссея 2001 года'', есснно.) |
|
|
| wanted |
[Mar. 11th, 2009|11:19 pm] |
A Linux box with sshd (web-accessible; served at port 443, not
22) and httpd. This can be a virtual machine. I don't want any
noisy/heating/space-taking hardware at home.
I would use it to synchronize my LOG file.
* * *
* There should be a good way of adding storage to my WRT54GL.
* Are there any online services? |
|
|
| REFACTORME |
[Mar. 4th, 2009|06:49 pm] |
def _otherParty(n=0):
"""Return function that converts input fields [and state] to
other party number/URL.
The conversion function will return at most `n' characters;
0 stands for infinity (default).
"""
def conv(fs, *_):
if _channel(fs, ['VOICE']):
if n: return fs[29][:n]
else: return fs[29]
if _channel(fs, ['WAP', 'WEB']):
if n: return _cropURL(fs[26][:n])
else: return _cropURL(fs[26])
if n: return fs[26][:n]
else: return fs[26]
return conv
What are your refactoring ideas?
(I'm not fond of these "if n: / else:" sections...) |
|
|
| coding dojo anyone? |
[Mar. 2nd, 2009|11:37 pm] |
|
Только что прочитал пост Магнуса,
случайно наткнувшегося на пост Марка,
который предлагал Гарри
затеять coding dojo.
И подумал, что это очень интересно.
* * *
16. Все члены Додзё должны воздерживаться
от сплетен, пренебрежительных и унижающих замечаний о других школах
и стилях боевых искусств.
[src]
(Не забыть: перестать обсерать язык Java и Windows ось.)
/me произносит Осс в направлении центра зала и садится
лицом к стене с закрытыми глазами и опущеной головой.
* * *
PS: А две недели назад парижане функционалили...
PPS: Привожу ссылку на Магнуса. (Накликать Марка и Гарри предоставляется заинтересованному читателю.) |
|
|
| hackathon/sprint ideas |
[Feb. 28th, 2009|11:44 pm] |
|
На сегодняшней встрече LtU-Kiev опять всплыла идея хакатона. Ограничение по времени... да, это основная проблема. Но идея настолько интересна, что я бы даже попробовал. Думаю, могу один выходной в месяц у семьи уворовывать -- чтобы с утра и до вечера. Но даже и три часа посидел бы, просто из спортивного интересу "а что получится?"..
Предложений, что похачить, было несколько, и я их тут запишу, пока помню:
* * *
PS: Проверил, xmonad совсем маленький, хоть и статически слинкован:
vvv@scratchy:~$ du -sh /usr/bin/xmonad .xmonad/xmonad-i386-linux
936K /usr/bin/xmonad
1.7M .xmonad/xmonad-i386-linux
Из чего там у тебя, Антон, 24 MB получалось? |
|
|
| ltu-kiev |
[Feb. 22nd, 2009|01:26 am] |
|
Для информирования единочаятелей...
Сегодня у нас произошла первая встреча функциональных программистов и им сочувствующих. Убедились, что город — большая деревня, попугали друг друга достижениями, порисовали кораблики... Мозговой пульс столицы бился у зоопарка. Вполне такое замечательное место.
На следующем субботнике (когда де он произойдёт) будем кино смотреть. Приходите!
[емейл-лист] |
|
|
| navigation |
| [ |
viewing |
| |
most recent entries |
] |
| [ |
go |
| |
earlier |
] |
| |
|
|