tag:zhtw.posthaven.com,2013:/posts Aleksej Lebedev's blog 2017-02-02T18:43:04Z Aleksej Lebedev tag:zhtw.posthaven.com,2013:Post/1090034 2016-09-14T13:41:25Z 2016-11-21T15:53:01Z Chez Scheme binaries for FreeBSD and DragonFly

Just built a recent ChezScheme for FreeBSD 10.1 and DragonFly 4.6. I'll probably make proper packages for it later, but for until then here are the binaries:

FreeBSD: chz-4.9.1_fb.tar.bz2

DragonFly: chz-4.9.1_df.tar.bz2

Or if you want to build it yourself, here are the boot images:

FreeBSD:

DragonFly:

In order to use them just unpack the appropriate version (or all of them) to boot subdirectory.

    FreeBSD version can be built from the original sources. DragonFly version however requires a few patches, but you can fetch it from my fork on github. (I created a pull request, but it was not accepted yet.)

    Have fun!


    UPD: I started working on FreeBSD port for ChezScheme, you can follow me on github. It doesn't work yet -- I just started. Also I submitted a pkgsrc package, but right now it can only be built for Linux and there is an issues with DESTDIR support. Hopefully I'll fix it soon.
    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/1035856 2016-04-18T09:54:59Z 2017-02-02T18:43:04Z B. Stroustrup about C++

    My long-term (continuous for at least 25 years) hobby is history, and I spent significant time in university and later studying philosophy. This has given me a rather conscious view of where my intellectual sympathies lie and why. Among the long-standing schools of thought, I feel most at home with the empiricists rather than with the idealists - the mysticists I just can't appreciate. This is, I tent to prefer Aristotle to Plato, Hume to Descartes, and shake my head sadly over Pascal. I find comprehensive "systems" like those of Plate and Kant fascinating, yet fundamentally unsatisfying in that they appear to me dangerously remote from everyday experiences and the essential peculiarities of individuals.

    I find Kierkegaard's almost fanatical concern for the individual and keen psychological insights much more appealing than the grandiose schemes and concern for humanity in the abstract of Hegel or Marx. Respect for groups that doesn't include respect for individuals of those groups isn't respect at all. My C++ design decisions have their roots in my dislike for forcing people to do things in some particular way. In history, some of the worst disasters have been caused by idealists trying to force people into "doing what is good for them." Such idealism not only leads to suffering among its innocent victims, but also to delusion and corruption of the idealists applying the force. I also find idealists prone to ignore experience and experiment that inconveniently clashes with dogma or theory. Where ideals clash and sometimes even when pundits seem to agree, I prefer to provide support that gives the programmer a choice.

    Bjarne Stroustrup, "The Design and Evolution of C++"

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/1021556 2016-03-29T14:27:16Z 2016-03-29T14:31:55Z On code style guide

    When I write code I follow a very relaxed style guide. The ultimate principle is that every word in your program must serve a purpose. Even consistency is not considered a good thing if it doesn't make code more readable or safe.

    1. Comments are not (always) good.

    Quite the opposite. The very necessity to write comments means that there is something
    wrong with the code (or the language). Don't write comments, write code. If an algorithm is unclear, rewrite it.
    If it's too large, decompose it. If it's unclear what a function does, come up with a better name.
    If there is a constraint that function parameters need to meet, write this constraint in the language you're using.
    As a last resort, write a comment, but remember: your compiler won't read it.

    2. Program should be const-correct, but you don't have to use const whenever an object is constant.

    If a function parameter points to a constant, it make sense to use const, but it is OK to leave the pointer itself non-const even if it's not modified inside the function: it doesn't really make code more safe, but adds one (useless) word to your program.

    If a function argument points to a constant, but it is a simple utility function used only inside one compilation unit, it is OK to omit const. Especially if you would have to write two functions (constant and non-constant) with the same semantics otherwise. You will easily fix this once you really need two separate functions.

    3. Inconsistent but right is better than consistent and wrong.

    People tend to prefer following a meaningless rule to changing it even if it's clear to everyone that the rule is no longer relevant. This results in ugly code that everyone is afraid to change, because "who knows why it was written like that? I don't believe it was for nothing. The author knew better." and so on.

    For new languages it's not that bad, but for languages like C or C++ it's overwhelming how much of so called conventional wisdom there is, that's been irrelevant for decades but still used by programmers of big companies all over the world.

    4. There is nothing more valuable than common sense.

    You are allowed (and encouraged) to ignore the rule if you see that it's not applicable to your problem. But remember, you are responsible for the code you write. If you don't really know why the rule is there, you shouldn't just ignore it, better be safe than sorry. Having said that, I think it's better if you do find out why and decide whether it applicable or not, don't use this "better be safe than sorry" as an excuse for replicating meaningless garbage.

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/992433 2016-02-13T11:22:25Z 2016-02-13T16:15:26Z Why I so often come to realize I hate C++ and still use it

    It will be a story.

    Yesterday at work I submitted a little patch for review. It was a simple improvement: I removed std::vector of pairs that was manually sorted right after construction and accessed via std::lower_bound, with a boost::containers::flatmap. It's simple, you got the idea, right?

    The diff was extremely simple and obvious, but there was a teeny-tine drawback: the original vector stored not standard pairs, but custom structures. And there was a perfect reason for it: these pairs were substitution rules. The definition looked like that: struct Rule { std::string source; std::string destination; }. (OK, it was full of ugly prefixes, because as any other company we have a lot of bullshit in our code style guide, but essentially it was the same.)

    Anyway, my colleague looked at this diff and first thing he saw was not the replacement std::vector => boost::containers::flatmap, but the fact that I removed this Rule structure. So he immediately commented: "What was wrong with the original structure?"

    I have to admit, I answered very quickly and without hesitation. I wrote something like this: hey, just look below, I replaced vector with flatmap, that's why there is no more Rule, but std::pair instead.

    But later I realized that I was being like this PHP-guy who can give a "perfect explanation" why the string "00-00-0000" is parsed to 1st of January 1979 (or whatever it was, I don't remember the joke exactly). The point is that my brain is so damaged by C++ that it took me whole day to understand that his question is perfectly valid, while my answer is total BS.

    There is no reason whatsoever why I can't (or shouldn't) store our original Rule structure inside boost flatmap! Any explanation is just another way of saying: yeah, sorry, it's C++, you can't do anything with it.

    But if you consider yourself a hacker, you don't give up on problems, you try to solve them. And it doesn't matter if the problem ain't worth shit, you can't sleep well unless you find a way.

    Well, in this case it was not hard at all. As Woody Allen once said, be original, but when you have to steal, steal from the best. Lots of good people (not those OOP-brain-washed fuckers) who came to C++ by mistake or are forced to use it because that's where the money is, already write generic code for ages. Look at boost::geometry. The authors don't make assumptions about how you store your geometries. They don't imply you store point as boost::geometry::point or whatever. No, you are free, as you should be, to choose yourself what you think the best structure for you geometries is.

    So, the solution is simple: just rewrite half of STL to make it work with concept "pair". Allow users to define their own access methods as specializations for std::pair_traits... blah-blah-blah. You got it.

    If you don't feel pity for me already, you will once you know I actually couldn't sleep well that night.

    And then, I actually started to write code that would solve this problem (you still remember what the problem was, right?).

    I wrote something like "namespace std { template<typename Key, Value> pair_traits { const Key &first_get..." and said to myself: oh my God!!! Really? Is that what I think how beautiful code should look like?

    So, my personal problem with C++ is that I know it quite well and I probably can find solution to any problem and feel happy about it like a child, but in the end the code will be so fucking ugly, that I will never be proud of it. The best I will be able to say is "look how well I know C++" to people who want to hire me. But with friends, I will always be saying: C++ is crap, the best language is Z-talk, which I'm developing (for how many years now?), just wait a bit.

    Yeah, sad story.

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/757124 2014-10-18T16:35:43Z 2015-09-09T08:58:42Z New pkgsrc packages for Mac OS X Yosemite

    (UPD: there is a newer version of the pkgin repo, based on pkgsrc-2015Q2. See my post in Russian blog.)


    I started to build packages for Mac OS X Yosemite from pkgsrc-2014Q3.

    As always, to bootstrap pkgin package manager run:

    curl http://umc8.ru/~a/packages/Darwin-14.0.0/current/pkg.tar.bz2 | bzip2 -dc | sudo tar -C /usr -xf -

    See details in my old post.

    Just to remind you, these are built with clang for x86_64.

    See also: Pkgsrc binary packages for Mac OS X by Jonathan Perkin
    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/747784 2014-09-28T15:30:15Z 2014-09-28T15:44:46Z Megatools are in pkgsrc-wip

    I hope you know what mega.co.nz is, if you don't I recommend to have a look.

    In short, it's a secure cloud service with end-to-end encryption.

    Well, anyway, megatools is a set of utilities to access your files at mega.co.nz via command line interface. I tried to build it on my Mac this morning and it was surprisingly easy. And what is the next thing to do if you see something opensource and good? Right, you add it to pkgsrc!

    Unfortunately, I am not an pkgsrc commiter, so I was able to add megatools to pkgsrc-wip only. But that's still a success.

    If you don't know what pkgsrc is, look at docs.

    If you don't want to know what pkgsrc is, but still want to try megatools, you can install pkgin and use my binary repo. See how to do it in one line of shell code. After installing pkgin, you can get megatools (as well as tons of other useful software) by running:

    pkgin install megatools

    Have fun! And don't forget to tell me if anything goes wrong!


    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/679979 2014-04-21T19:59:35Z 2016-08-02T08:55:38Z Common Lisp-style macros in Racket

    Today I put myself together and read a couple of sections of Racket documentation. Now I finally know how to implement Common Lisp-style macros in Racket. I'm still not 100% sure it will work exactly as expected but common cases work right.

    Here it is:

    (define-syntax define-macro
      (syntax-rules ()
       ((_ name fn)
        (define-syntax (name stx)
          (datum->syntax stx (apply fn (cdr (syntax->datum stx))))))))

    (define-macro mac
      (lambda (sig . body)
        (cond ((symbol? sig) `(define-macro ,sig ,@body))
              ((pair? sig)   `(define-macro ,(car sig) (lambda ,(cdr sig) ,@body)))
              (else           (error "wrong use of mac")))))

    This will give you macro-defining macro mac as in Paul Graham's Arc, except that I defined it in a Scheme way. You will easily figure out how to use it from this example:

    (mac (with var exp . body)
        `((lambda (,var) ,@body) ,exp))

    (with a 2 (+ a  4)) ; => 6

    UPD: In case you want to write a macro that makes use of a function defined in the same file this will not work. But it can easily be fixed by defining this function with define-with-syntax as described here.
    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/670253 2014-03-31T20:08:19Z 2014-03-31T21:28:57Z Binary pkgsrc packages for FreeBSD-10.0
    I started to build packages from pkgsrc on my FreeBSD machine.

    If you want to try, run:

    fetch -q -o - http://umc8.ru/~a/packages/FreeBSD-10.0/current/pkg.tar.bz2 | bzip2 -dc | sudo tar -C /usr -xf -

    This fetches and extracts the minimal distribution of pkgin.

    After that you'll have to add /usr/pkg/sbin and /usr/pkg/bin to your path to be able to run pkgin.

    If you don't know how to use pkgin, you will probably want to have a look at the docs.

    If you're happy with pkgin, I'm glad that I could help.

    If not, please tell me why. Then run sudo rm -r /usr/pkg /usr/pkg-current and continue living with FreeBSD's pkgng.

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/667366 2014-03-25T08:12:54Z 2014-03-25T08:16:10Z Ripple daemon in pkgsrc wip

    Just added rippled (Ripple peer-to-peer network daemon) to pkgsrc wipRipple is a peer-to-peer payment system created by Ripple Labs Inc.

    Here is how you can install it on Mac OS X. First, you need to bootstrap pkgin, see my previous post.

    And then run: pkgin update && pkgin install rippled

    If you're not using Mac OS X, you can still build it yourself using pkgsrc.

    If you're not using pkgsrc, you're missing out ;-).

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/666809 2014-03-23T09:14:05Z 2014-05-14T17:04:32Z Binary pkgsrc packages for Mac OS X Maverics (Darwin 13.1.0)

    As I already wrote, I build pkgsrc packages for Mac OS X. Some time ago I update to Darwin 13.1.0.

    To use the new repository, you need to change the path in /usr/pkg/etc/pkgin/repositories.conf to http://umc8.ru/~a/packages/Darwin-13.1.0/current/All

    If you want to install everything from scratch run the following:

    curl http://umc8.ru/~a/packages/Darwin-13.1.0/current/pkg.tar.bz2 | bzip2 -dc | sudo tar -C /usr -xf -

    Again, you need to add /usr/pkg/sbin and /usr/pkg/bin to your path. That can be done by putting these paths to /etc/paths.d/90-pkgsrc-current or by adding the line PATH=$PATH:/usr/pkg/sbin:/usr/pkg/bin to .profile in your home directory.

    To those who want to know more about pkgin, look at the pkgin official web page.

    If you have any questions, ask here or send me an email.

    P. S. If you want to try pkgin but afraid that it will be difficult to remove it, please notice that I configured it so that everything can be removed with just this one command: rm -rf /usr/pkg /usr/pkg-current

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/640694 2014-01-11T10:41:00Z 2014-01-11T10:52:01Z Thoughts about z-talk

    Decided to write down some ideas about z-talk.

    The language

    Z-talk is, of course, a lisp. It's lisp-1. It will support traditional CL-style macros as well as first-class continuations. It will be much like PG's Arc and Clojure but differ in that it will not compile for JVM and will not use Racket (mzscheme) which will make it very lightweight much like Scheme48. But it will differ from Scheme48 in that it will support CL-style macros and will not require any top-level declarations that are inspected in compile time. It will support automatic compilation and storing byte-code cache much like in Python.

    Implementation

    I've been back and forth on the question of what to implement z-talk in and now I think C++ (mostly plain C) will do just fine. Another option that is very attractive is to use PreScheme compiler... You know what? I just changed my mind back again. PreScheme is very small, easy to use and seems much more powerful than C++ or C. OK, back to PreScheme! Stick to it!

    Anyway z-talk will compile to byte-code. Compilation unit is one expression (not one file). Conses, vectors and strings are mutable. But I'm thinking about making variable bindings to be fixed forever. This might greatly simplify the implementation of environment structures and allow inlining procedures. Users will be advised to use mutable boxes (or cells, whatever the name) to modify lexically bound values. But I'm still not sure about that.

    Data representation

    Values in z-talk are ether immediate or non-immediate. Immediate values are represented by single machine word exactly as in Chicken scheme. But there are fewer types of them in z-talk: fixnums, characters and nil. Nil is of its own type and is not a symbol. There is however symbol nil bound to nil value. Lists are terminated by nil. No boolean type. Nil is false, any other value is true.

    Non-immediate values are pointers to the objects stored in blocks. There is a separate list of blocks for each object type. Blocks are aligned so that it is easy to find the beginning of a block by dropping the last few bits in a pointer to an object. This is to avoid storing the type tags in every object. Type tag is stored in the header of each block instead.

    Small objects of fixed size are stored just like that. Memory is allocated from a singly-linked lists of free cells.

    Objects of variable size are stored differently. Vectors are referenced by descriptors very much like in STL vectors in C++. Descriptors are stored the same way as any other small fixed-sized objects. Strings are much like vectors. Symbols are unique in that all equal symbols are just pointers to the same location. Still haven't decided what is the best layout scheme for symbols but here is one important constraint: it must be easy to look them up by the representation. So they must be arranged in some kind of hash.


    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/638596 2014-01-06T21:03:23Z 2014-01-06T21:03:24Z Louie S03E13 Russian subtitles

    Just finished translating english subtitles for Louie series, season 3, episode 13.

    Here it is:


    ru: Только что закончил переводить субтитры для сериала Луи, сезон 3, серия 13.

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/632915 2013-12-20T18:51:28Z 2013-12-29T16:23:10Z WJF 9 Day 2

    Day 2 has passed. It turned out that I missed a lot on day 1 because I got to bed early. There were juggling games, cambat and round 1 of juggling jukebox. Fortunately, yesterday all this continued. I even attended combat master class.

    Well, here is what happened yesterday. I missed Beginning 3 Balls workshop by Frank Chilese and came to Jason Garfield's 5-7 balls master class. Here is Jason explaining something.

    I was at 3 ball cascade masterclass a day before that. It was interesting but that one was acutally usefull.

    I was standing in the group who learned 5 balls, on my left are those learning 6 balls and in front are those learning 7 balls.

    I was pretty much the worst juggler at the event. Well, except maybe some parents. But they were not really into juggling at all. Although most of them attended beginner's master classes anyway.

    After that there were juniors' and advanced competitions. Here is the scene:

    A couple of photos from the juggling games. Vladik doing 5 balls 5 up 360 inside the chicken box:

    Jonah trying to do the same with rings. (Turned out then that nobody could manage to do it in this box.)

    And that's a short video from the combat training by Joe Showers.

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/632377 2013-12-19T14:10:03Z 2013-12-19T14:12:19Z WJF 9 Day 1

    I started to write this when it was 5am in Vegas. Still can't get used to the local time.

    Anyway, yesterday was day 1 of WJF 9. Apparently not all the jugglers arrived yesterday because I still haven't seen Vova Galchenko, Olga Kay, Doug Sayers and many others. Don't know may be they all registered when I took a break to grab a bite.

    And also I fell asleep at 7pm yesterday. I set the alarm clock not to miss the evenings juggling games, but when it ringed I just automatically turned it off and slept until 4 am. Really hope that it won't happen today.

    Anyway I met Mark from Scotland who's at the WJF event first time and Stieve from Las Vegas who missed only one WJF event. You probably already know Stieve from his How to juggle 5 ball cascade video.

    Almost everyone who were at the gym practiced for all the time they were there. It was at least 7 hours with small breaks. No wander they all are so good!

    I didn't take many pictures yesterday but I recorded a short video of an impromptu combat battle.

    And that's a picture from Jason's 3 balls cascade master class.

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/631942 2013-12-18T16:18:10Z 2013-12-18T17:03:27Z WJF 9 Day 0

    Today is day 1 of WJF 9 — 9th World Juggling Federation convention.

    But I'll tell you about yesterday's unofficial beginning, lets call it day 0.

    Those who arrived yesterday or earlier (me) had a chance to register, get to know each other and have an evening juggling session.

    Here is a couple of photos I took yesyerday.

    And a couple of videos. Here is Jason trying to do a 5 balls 3 up 360 — 5 up 360 connection.

    And Vladik juggling 9 balls.

    Today is the official beginning. There is going to be much more people. I hope I'll take more pictures.


    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/630307 2013-12-14T11:42:55Z 2014-03-23T09:14:58Z Binary pkgsrc packages for Mac OS X Maverics (Darwin 13.0.0)

    Pkgsrc is a great packaging framework, originally developed for NetBSD.

    It's too much hassle to build binary packages from sources everywhere you install pkgsrc. There is pkgin that solves the problem. But unfortunately pkgsrc team doesn't build binaries for Mac, so there is no official repository. Some people, like  Jonathan Perkin, build the packages and publish them.

    The Jonathan's binaries are built for old Mac OS (which is good) but they are built for i386. Sometimes you need a library that you want to use for development, in that case you need a 64-bit ABI support.

    Recently I built a few packages for current pkgsrc with 64-bit ABI and decided to publish them too. Here it is.

    To install pkgin utility (that is very much like apt-get on debian based linux distros) all you need to do is run:

    curl http://umc8.ru/~a/packages/Darwin-13.0.0/current/pkg.tar.gz | gzip -dc | sudo tar -C /usr -xf -

    What this does is it fetches pkg.tar.gz tarball and unpacks it's content to /usr. That is one directory pkg-current and a symlink pkg that points to pkg-current.

    After you extracted the tarball, you need to add /usr/pkg/sbin and /usr/pkg/bin to your path. That can be done by putting this paths to /etc/paths.d/90-pkgsrc-current or by adding PATH=$PATH:/usr/pkg/sbin:/usr/pkg/bin to .profile in your home directory.

    I build everything on Maverics (OS X 10.9), so you need to upgrade if you're still using an older version (Maverics is free by the way).

    Try it and tell me if anything is wrong. For now there is not much in the repo. There will be more as they're built.

    Almost forgot! Here are some pkgin basics:

    pkgin update # (re)fetch packages index

    pkgin search zsh # look for something zsh-alike in repository

    pkgin install mercurial # install mercurial control version system

    How to remove everthing that pkgin installed? I configured pkgsrc so that it installs everything under /usr/pkg-current even packages' meta info and pkgin db. So 

    sudo rm -rf /usr/pkg-current /usr/pkg

    is enough to kill the whole thing.

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/603436 2013-09-22T21:16:17Z 2013-12-14T10:58:12Z Second of two First Aid classes

    On Saturday we've been to the second of two First Aid classes conducted by Ilya Zabelin and Alexander Mostov.

    This time it was even more interesting and fun.

     The photos are from the practice. Half of us played injured, others played, well, themselves. After each session Ilyia and Sasha explained what was wrong and what was right.


    Here we're at a “night club” where some drunks injured others (also drunk). The one with the light is Sasha Mostov playing a junkie.

    Everything was great. And again, very practical and usefull.


    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/602672 2013-09-19T09:35:10Z 2013-10-08T17:30:16Z First Aid course Last saturday I’ve been to the first of two First Aid classes that is conducted by professional First Air instructors Ilya and Alexander. Actually Ilya now works at Yandex but still does First Aid as a hobby. Alexander is an instructor at EFR, Red Cross and Moscow Rescue Service. 

    Here are a few photos from the class.

    Alexander & Ilya.

    Tanya learns to do chest compressions.

    Everyone tried to move an injured but then gave up :-).

    That was a full day class. 8 hours with one 45 minutes break and 5 minutes break every 2 hours. Very interesting.Very practical.
    Looking forward to the next class next Saturday.]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/600281 2013-09-09T19:22:59Z 2013-10-08T17:29:38Z Juggling in Senegal!

    Just received a letter from our friend Alain who we got to know via www.couchsurfing.org! He's in Senegal now teaching juggling to the natives! He-he!

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/590264 2013-07-23T14:34:57Z 2014-10-30T17:12:58Z Rvalue reference in C++11

    Everything I'm gonna say is probably well known or at least it should be. However, when I encountered this, I was very surprised. Enough to be willing to write a post about it.

    Look at that piece of code:

    template<class T> void append(vector<T> &v, const T &x) { v.push_back(x); }

    template <class T> void append(vector<T> &v, T &&x) { v.push_back(move(x)); }

    vector<string> v;

    string s = "a magic string";

    append(v, s);

    What do you think s will be after append(v, s)? Well, there is no surprise here yet, it's "a magic string".

    But if we change the code so that append would add x to a global vector:
    vector<string> v;
    template<class T> void append(const T &x) { v.push_back(x); }
    template <class T> void append(T &&x) { v.push_back(move(x)); }
    Then a magical thing will happen. In this case type T in the expression append(s) will be deduced as the rvalue reference to string, not const reference to string. So s will be no longer valid after the call to append(s).

    If you want to be sure, that s is moved only when you write move(s), or when you call append with a temporary, you must write another version of append, that doesn't do anything except calls append(const T &): 

    template<class T> void append(T &s) { append<const T &>(s); }

    The more I learn about C++11, the more I love it!

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/584084 2013-06-14T13:20:29Z 2013-10-08T17:26:25Z The best scene in Up in the Air movie
    I like the scene where Ryan talks to Jim about real estate. 

                                                                     JIM

               We all need a place to call our
               own. This is America. This is what
               we were promised.
                             
                              RYAN
               That's a nice touch.
                             
                              JIM
               What?
                             
                              RYAN
               That bit at the end about
               promise... I like it.
                             
                             
                              JIM
               (a little embarrassed)
               Thanks.
                              (leading)
               So, you still renting that one-
               bedroom?
                             
                              RYAN
               No. I gave it up.
                             
                              JIM
                              (SURPRISED)
               So, you own now?
                             
                              RYAN
               No.
                             
                              JIM
               But you're looking?
                             
                              RYAN
               No, not really.
                             
                              JIM
               So, you're just good.
                              RYAN
               I'm good.
                              JIM
               Well, it's good.
    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/583549 2013-06-10T19:58:25Z 2013-10-08T17:26:16Z Public bicycles in Moscow

    A couple of weeks  ago the first public bike rental service started in Moscow. Tried it. Well, not just tried, we (me and Tanya) are using it twice a week now to get to Chinese classes.

    To rent a bike you need to register at http://velobike.ru/, pay a fixed fee for a day, a week, a month or full season. After that you receive a card number and a pin, that you enter at the terminal to get a bike:

    All in all it's a good thing to have a public bike rental service in a city. But I have to say, these bike we have now are quite crappy. When you ride it all the parts are wiggling and jiggling. The bikes are heavy. This is especially bad because we don't have any cycling infrastructure at all here in Moscow, so quite often you have to carry the bike instead of riding it :-).

    Anyway, it's just the beginning. I hope we'll see more bikes soon. I want tandems! I want Moscow to look more like Hangzhou!

    By the way, that's how rental bikes look in Hangzhou:

    Hm... when I was writing that, I actually had in mind another photo, but when I found it, I realised that these are not public bikes. Well, let's see the photo anyway.

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/581763 2013-05-29T20:40:24Z 2013-10-08T17:25:56Z Mandarinposter.com Just recently received three posters that I ordered about two months ago. Two copies with 1500 most frequently used characters and one with chinese radicals. Nice! I just love what these people are doing. The posters are so cool!


    They sent them within two rigid tubes and included stickers as well as red blackboard markers to write on the posters. Everything is nicely packed.


    I put the one with radicals on the wall like that:

    Another one on the radiator:

    Within a few hours after I twitted about it, one of these guys contacted me and kindly asked whether they can put my photos on their website. Now you can see a photo of me in their gallery: http://mandarinposter.com/gallery

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/577323 2013-05-04T20:36:14Z 2014-05-14T17:05:22Z A little about me

    Well, my name is Aleksej Lebedev and I was born in Kazakhstan, which doesn't actually mean anything.

    When I was 3 my parents moved to Russia (it was all USSR then) to the small town of Murom where I grew up. After finishing school I went to Moscow and studied at Moscow Aviation Institute for 5 years and a half.

    Then I worked at different companies while teaching at MAI at the same time. In 2007 I received an offer from some people in the university to go to Malaysia to work there as a lecturer. At that point I already met my future wife in MAI campus (she was a student). I went to Malaysia and after couple of months she came there too. In order to get her visa we got married at the embassy of Russia in Kuala Lumpur.

    In 2008 I got back to Moscow. In Malaysia I had a lot of free time and I got used to that very much. So when I returned to Moscow, I didn't apply for any real job. Istead I got involved into teaching at the university much more. But I didn't like the living on campus so in 2011 when I got chance to go to Malaysia once more I used that chance. But since there was no real plan (for me and my wife) to move there permanently and because she found a great job in Moscow at a big IT company just before I went to Kuala Lumpur, there was no way I could stay there for long time. So in July of 2012 I returned to Moscow again. But now I decided to find a regular job in IT. A friend from university advised me to apply to Yandex. I did and since that time on I work there.

    Well, what else? I like unicycling and, since recently, juggling as well. Except that, I'm interested in computers, programming languages, theory of computation and so on but who cares :-)?

    Let's see some photos of me and my family.

    Here is my wife Tanya. Melakka, 2008.


    Here are, from let to right, my sister, her daughter and my mom in Putrajaya, Malaysia, 2012.


    That's the place where I lived in Malaysia, it's about 40 km south from Kuala Lumpur. On the photo: my nephews, my sister and my mom.


    That's my dad at home in Murom in 2007.


    And last but not least, me :-). Cameron Highlands, Malaysia, 2012.

    About me on about.me.

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/577315 2013-05-04T19:25:32Z 2013-10-08T17:25:01Z Let's see how video upload works

    Yey, it works! This is Hong Kong btw.

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/577314 2013-05-04T19:04:18Z 2014-01-26T19:04:39Z Let's see how it works :-)

    I recently noticed blah-blah-blah. But then I realized that blah-blah-blah. And now it's blah-blah-blah. So from now on I blah-blah-blah.


    (This is actually the first post to posthaven. All the earlier posts are imported from posterous.)

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/646306 2012-04-04T19:59:00Z 2014-01-26T20:30:20Z <content type="html"> <![CDATA[<div class="posthaven-post-body"><p>Einstein pompously declared, "God does not play dice." Niels Bohr's response was sharp: "Einstein," Bohr scolded, "don't tell God what to do." Both physicists were pretty close to being atheists; it would seem unlikely that either of them contemplated a deity sitting on a cloud trying to roll a seven.<br></p><p>L. Susskind</p></div>]]> </content> <author> <name>Aleksej Lebedev</name> </author> <category scheme="http://zhtw.posthaven.com/tags/all" term="susskind" label="Susskind"/> </entry> <entry> <id>tag:zhtw.posthaven.com,2013:Post/646282</id> <published>2012-02-15T18:23:00Z</published> <updated>2014-01-26T19:42:50Z</updated> <link rel="alternate" type="text/html" href="http://zhtw.posthaven.com/ive-never-seen-so-many-bureaucratic-terms-in-one-paragraph"/> <title>I've never seen so many bureaucratic terms in one paragraph

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/646276 2012-02-11T00:50:00Z 2014-01-26T19:31:44Z Libunistring in pkgsrc-wip

    Added libunistring to pkgsrc-wip in preparation to packaging guile-2.

    http://pkgsrc.se/wip/libunistring

    ]]>
    Aleksej Lebedev
    tag:zhtw.posthaven.com,2013:Post/646275 2012-02-02T17:47:00Z 2014-01-26T19:29:59Z Programmer Dvorak for DragonflyBSD Console

    I'm using Programmer Dvorak keyboard layout. There is no kbd-file for it in dragonflybsd by default. So I cooked it by myself. Here it is if anyone is interested:

    ]]>
    Aleksej Lebedev