--- /dev/null
+Return-Path: <patricktotzke@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id AC568431FAF\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Oct 2012 09:58:58 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.7\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.7 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, FREEMAIL_REPLY=2.499, RCVD_IN_DNSWL_LOW=-0.7]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id ALU8TD6-Lb9y for <notmuch@notmuchmail.org>;\r
+ Sat, 13 Oct 2012 09:58:57 -0700 (PDT)\r
+Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com\r
+ [209.85.212.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 120C1431FAE\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Oct 2012 09:58:56 -0700 (PDT)\r
+Received: by mail-wi0-f179.google.com with SMTP id hq7so474734wib.2\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Oct 2012 09:58:54 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=content-type:mime-version:content-disposition:from:user-agent:to\r
+ :references:in-reply-to:message-id:subject:date;\r
+ bh=8JtzhEy/zL//eJsxSac+ZULSPhwHzhHgqdikRBckbBE=;\r
+ b=zsJbFd9AWA4L5uU2tz9nwCS0RZZ/4kIityrY36ubAPba4TOrryuSwp6vBjkGihThRo\r
+ lPFkLwULUwxm1mNfoSi4MGqeQjytaHkdyCL4l0nm34PbBn0oq1u16e6mdsscw1gXYrBX\r
+ utO96MC2X8sgNxPRnYcoUZDbjYkXngSlAhSAR6RYlgw+K187DCYLf1hiSGmALoOErOQJ\r
+ 4JOTfmEGmJ8MMIO93vqsodoO5NGH1BkSqVnGzf8iDH4eqzr7pQ/+0wddbL9RV1YTMWnF\r
+ AsIuG+1OtyPL1arv1xgsQnoFiOSEQ6CEFxJT0HYy+9yG2gCQr8HLRsSMJ5KnwyNAeJwr\r
+ c8tQ==\r
+Received: by 10.216.227.133 with SMTP id d5mr4665672weq.194.1350147534338;\r
+ Sat, 13 Oct 2012 09:58:54 -0700 (PDT)\r
+Received: from localhost (cpc6-sgyl27-2-0-cust46.sgyl.cable.virginmedia.com.\r
+ [82.32.140.47])\r
+ by mx.google.com with ESMTPS id dm3sm4558286wib.3.2012.10.13.09.58.52\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sat, 13 Oct 2012 09:58:53 -0700 (PDT)\r
+Content-Type: multipart/signed; protocol="application/pgp-signature";\r
+ micalg="pgp-sha1"; boundary="===============3247913046672548219=="\r
+MIME-Version: 1.0\r
+Content-Disposition: inline\r
+From: Patrick Totzke <patricktotzke@gmail.com>\r
+User-Agent: alot/0.3.3+\r
+To: Suvayu Ali <fatkasuvayu+linux@gmail.com>, notmuch@notmuchmail.org\r
+References: <20120924082646.GA10577@kuru.dyndns-at-home.com>\r
+ <20120925104457.12264.30350@megatron>\r
+ <20121008093429.GC4534@kuru.dyndns-at-home.com>\r
+In-Reply-To: <20121008093429.GC4534@kuru.dyndns-at-home.com>\r
+Message-ID: <20121013165851.29671.29869@brick.lan>\r
+Subject: Re: nbook: a notmuch based address book written in python\r
+Date: Sat, 13 Oct 2012 17:58:51 +0100\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 13 Oct 2012 16:58:58 -0000\r
+\r
+--===============3247913046672548219==\r
+Content-Type: text/plain; charset="utf-8"\r
+MIME-Version: 1.0\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+Quoting Suvayu Ali (2012-10-08 10:34:29)\r
+> Hi Patrick,\r
+> =\r
+\r
+> Sorry for the very late reply; I got distracted with some personal\r
+> matters.\r
+> =\r
+\r
+> On Tue, Sep 25, 2012 at 11:44:57AM +0100, Patrick Totzke wrote:\r
+> > Hey Suvayu, welcome to notmuch!\r
+> > =\r
+\r
+> > I hope you are aware that there are already a few search based abook to=\r
+ols\r
+> > around for notmuch (listed in the wiki, albeit hidden in the emacs docs=\r
+):\r
+> > http://notmuchmail.org/emacstips/#index14h2\r
+> > I personally use nottoomuch-addresses.sh, which apparently does some ad=\r
+vanced\r
+> > caching voodoo for speed.\r
+> > =\r
+\r
+> =\r
+\r
+> I wasn't aware of either of them, thanks for pointing them out. I'll\r
+> take a look for inspiration and ideas.\r
+> =\r
+\r
+> > But to your tool; practice test:\r
+> > I wasn't able to use wildcards or simply prefixes of names. This is ess=\r
+ential\r
+> > if you want to use it for tabcompleting contacts in a MUA.\r
+> =\r
+\r
+> Since the idea was inspired by the completion on the Gmail web\r
+> interface, I already do a partial search so wildcards should not be\r
+> necessary.\r
+\r
+Not sure what you mean here: If I compose a mail using gmails web interface\r
+and type a prefix of someone's name I will get this contect as a suggestion.\r
+My point was that using your tool, I did not get a contact suggested\r
+for all prefixes.\r
+\r
+> > The time lookups take seems to depend on how many matches there are:\r
+> > =\r
+\r
+> > -------------------------------\r
+> > time nbook Suvayu\r
+> > 1 unique email addresses found for `Suvayu'\r
+> > fatkasuvayu+linux@gmail.com Suvayu Ali\r
+> > =\r
+\r
+> > nbook Suvayu 0.04s user 0.01s system 95% cpu 0.050 total\r
+> > -------------------------------\r
+> > time nbook Justus\r
+> > ...\r
+> > =\r
+\r
+> > nbook Justus 0.21s user 0.07s system 11% cpu 2.484 total\r
+> > -------------------------------\r
+> =\r
+\r
+> Yes, I noticed this too when I searched for the more common names. Not\r
+> sure how to get around this though.\r
+\r
+I think this is a conceptual problem with your algorithm:\r
+You look up *all* messages and add a name to your result-list\r
+if it matches. This means you go through some condidate\r
+as often as you index contains mails from/to him.\r
+What one really wants is to ask the database to do something like\r
+ "SELECT name,email from RECIPIENTS_OR_SENDER"\r
+where RECIPIENTS_OR_SENDER is some imaginary list that stores\r
+a set of contacts.\r
+\r
+Bottom line: One would have to change the layout of the underlying\r
+database (not likely) or do regularly update some cache\r
+and only work on that. This is what some of the mentioned tools do if i'm n=\r
+ot mistaken.\r
+\r
+> > And If I look for my own name, this takes over a minute,\r
+> > eventually dying. This could be an issue with libnotmuch though.\r
+> > Possibly, your algorithm takes very long and then reads from an initial=\r
+ly\r
+> > opened Database object again, which was invalidated by concurrent write=\r
+s of other processes..\r
+> > =\r
+\r
+> > -------------------------------\r
+> > [~] time nbook Patrick =\r
+\r
+> > =\r
+\r
+> > Error opening /home/pazz/mail/gmail/[Google Mail].All Mail/cur/13306822=\r
+70_0.12958.megatron,U=3D8766,FMD5=3D66ff6a8bc18a8a3ac4b311daa93d358a:2,S: T=\r
+oo many open files\r
+> > Traceback (most recent call last):\r
+> > File "/home/pazz/bin/nbook", line 167, in <module>\r
+> > File "/home/pazz/bin/nbook", line 71, in __init__\r
+> > File "/home/pazz/.local/lib/python2.7/site-packages/notmuch/message.p=\r
+y", line 233, in get_header\r
+> > notmuch.errors.NullPointerError\r
+> > Error in sys.excepthook:\r
+> > Traceback (most recent call last):\r
+> > File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 6=\r
+6, in apport_excepthook\r
+> > ImportError: No module named fileutils\r
+> > =\r
+\r
+> > Original exception was:\r
+> > Traceback (most recent call last):\r
+> > File "/home/pazz/bin/nbook", line 167, in <module>\r
+> > File "/home/pazz/bin/nbook", line 71, in __init__\r
+> > File "/home/pazz/.local/lib/python2.7/site-packages/notmuch/message.p=\r
+y", line 233, in get_header\r
+> > notmuch.errors.NullPointerError\r
+> > nbook Patrick 3.20s user 5.47s system 12% cpu 1:11.65 total\r
+> > ------------------------------------\r
+> > =\r
+\r
+> =\r
+\r
+> Yes someone else pointed this out too. Again I'm not sure how to\r
+> proceed here. I had a quick look at this last week and it seemed to me\r
+> the limitation comes from within the python bindings for notmuch. Do\r
+> you have any ideas?\r
+\r
+As mentioned before, I think you invalidate the Database object concurrently\r
+while your long-running algorithm goes through all messages.\r
+Xapian doesn't handle concurrent access to the index like a normal=E2=84=A2=\r
+ database would.\r
+This means you are notified by this error that some changes were detected.\r
+Maybe the error message should be more telling here though. Teythoon?\r
+\r
+> > Anyway, have fun hacking notmuch! If you are looking for a related proj=\r
+ect to bring in your python skills\r
+> > I could think of one or two :D\r
+> =\r
+\r
+> That would be wonderful. To give you my background, I'm a graduate\r
+> student in physics and I have to do a lot of C/C++ and python\r
+> programming for my research. Contributing to FOSS projects seems like a\r
+> wonderful way to learn to collaborate and clean programming (we\r
+> physicists tend to be sloppy programmers :-p).\r
+\r
+https://github.com/teythoon/afew\r
+https://github.com/pazz/alot\r
+http://excess.org/urwid/\r
+\r
+I'm sure patches will be welcome to any of the above :)\r
+Best,\r
+/p\r
+\r
+--===============3247913046672548219==\r
+MIME-Version: 1.0\r
+Content-Transfer-Encoding: 7bit\r
+Content-Description: signature\r
+Content-Type: application/pgp-signature; name="signature.asc"; charset="us-ascii"\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.11 (GNU/Linux)\r
+\r
+iEYEABECAAYFAlB5ncsACgkQlDQDZ9fWxaofuwCbBIrFTCAEoimDW+oZLkLIOp5+\r
+hFsAnjPfXjLw2idZX33ykZMrhQ5KXSp/\r
+=1H/w\r
+-----END PGP SIGNATURE-----\r
+\r
+--===============3247913046672548219==--\r