<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Krzysztof Kowalczyk blog</title><link href="http://blog.kowalczyk.info/atom.xml" rel="alternate"></link><id>http://blog.kowalczyk.info/atom.xml</id><updated>2009-11-19T05:46:59Z</updated><entry><title>SumatraPDF 1.0 released</title><link href="http://blog.kowalczyk.info/article/SumatraPDF-10-released.html" rel="alternate"></link><updated>2009-11-19T05:46:59Z</updated><id>tag:blog.kowalczyk.info,2009-11-19:/article/SumatraPDF-10-released.html</id><summary type="html">&lt;p&gt;I&amp;#8217;ve released 1.0 version of Sumatra. Compared to 0.9.4 it has bunch of bug fixes and small improvements. Each of them is too small to single out, but together they improve Sumatra quite a bit.&lt;/p&gt;

&lt;p&gt;This version gets the 1.0 version and officially is out of beta because, well, it&amp;#8217;s time.&lt;/p&gt;

&lt;p&gt;This version has received great many improvements from Simon Bünzli (zeniko) and some more TeXSync support fixes from William Blum so they deserve much credit for this release.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s available &lt;a href="http://blog.kowalczyk.info/software/sumatrapdf/"&gt;here&lt;/a&gt;&lt;/p&gt;</summary></entry><entry><title>Web server in C#</title><link href="http://blog.kowalczyk.info/article/Web-server-in-C.html" rel="alternate"></link><updated>2009-11-04T05:50:13Z</updated><id>tag:blog.kowalczyk.info,2009-11-04:/article/Web-server-in-C.html</id><summary type="html">&lt;p&gt;If you need a simple web server for .NET, &lt;a href="http://www.codeplex.com/webserver"&gt;this&lt;/a&gt; is a solid piece of software.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;ve needed an internal web server for my C# application and re-using someone else&amp;#8217;s code certainly beats writing it from scratch.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s not spelled out on the web page, but it comes in two flavors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;lite, with only http serving core. When you download the code, look for it in branches directory&lt;/li&gt;
&lt;li&gt;standard, which also includes things like templating engine&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When I used added it to my project, I didn&amp;#8217;t know about the lite version, so I added the files manually to the project and removed files I didn&amp;#8217;t need manually. If I were starting from scratch, I would just use lite version.&lt;/p&gt;

&lt;p&gt;So far I&amp;#8217;m happy with the code &amp;#8211; it does exactly what it advertises, saved me a bunch of time I didn&amp;#8217;t spend writing it myself.&lt;/p&gt;

&lt;p&gt;It uses Apache 2.0 license so can be used in commercial software as well.&lt;/p&gt;</summary></entry><entry><title>15minutes for mac updated</title><link href="http://blog.kowalczyk.info/article/15minutes-for-mac-updated.html" rel="alternate"></link><updated>2009-11-01T07:55:47Z</updated><id>tag:blog.kowalczyk.info,2009-11-01:/article/15minutes-for-mac-updated.html</id><summary type="html">&lt;p&gt;I&amp;#8217;ve made two small improvement to my &lt;a href="/software/15minutes/"&gt;15minutes&lt;/a&gt; app for mac that is meant as a simple productivity tool that helps to focus on doing things.&lt;/p&gt;

&lt;p&gt;Improvements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;time display is bigger&lt;/li&gt;
&lt;li&gt;it now has non-awful icon&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also came to a realization that it should really be more unobtrusive app that lives in the menu bar and has even more minimal UI. However, at present I don&amp;#8217;t have the time to do that. 15minutes has been something that I wanted to get done as quickly as possible. It would be ironic if my productivity dropped due to spending a lot of time working on productivity-enhancing application.&lt;/p&gt;</summary></entry><entry><title>It's the little things</title><link href="http://blog.kowalczyk.info/article/Its-the-little-things.html" rel="alternate"></link><updated>2009-10-22T06:56:54Z</updated><id>tag:blog.kowalczyk.info,2009-10-22:/article/Its-the-little-things.html</id><summary type="html">&lt;p&gt;I just installed Visual Studio 2010 Beta 2 and tried it on Sumatra. Unlike Beta 1 it properly converted project file from vs 2008. After playing with it for a few minutes it looks like a worthy upgrade to 2008 which is why it stings even more when a useful functionality is missing.&lt;/p&gt;

&lt;p&gt;Lenovo&amp;#8217;s thinkpads have nice feature of combined TrackPoint and UltraNav that allows easy scrolling in many apps (I think they generate scroll-wheel events). Unfortunately the new, rewritten editor in 2010 doesn&amp;#8217;t seem to support this kind of scrolling and it&amp;#8217;s one of those features that I use very often and became so dependent on it that it&amp;#8217;s hard to use an application that doesn&amp;#8217;t support it.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s me hoping that it was just lack of time in beta 2 cycle and it&amp;#8217;ll be supported in final release, since it would be really painful to use the editor on a ThinkPad laptop without it.&lt;/p&gt;</summary></entry><entry><title>Unicode problem with firstof in appengine/Django</title><link href="http://blog.kowalczyk.info/article/Unicode-problem-with-firstof-in-appengineDjango.html" rel="alternate"></link><updated>2009-10-22T00:30:33Z</updated><id>tag:blog.kowalczyk.info,2009-10-22:/article/Unicode-problem-with-firstof-in-appengineDjango.html</id><summary type="html">&lt;p&gt;I spent a couple of hours tracking and fixing this problem.&lt;/p&gt;

&lt;p&gt;A user reported an error in my &lt;a href="http://blog.kowalczyk.info/software/fofou/"&gt;fofou&lt;/a&gt; forum software for appengine: a forum that had german text in tagline couldn&amp;#8217;t be edited. All appengine told me was this mostly useless error message: &amp;#8220;UnicodeEncodeError: &amp;#8216;ascii&amp;#8217; codec can&amp;#8217;t encode character u&amp;#8217;\xdc&amp;#8217; in position 0: ordinal not in range(128)&amp;#8221; coming from template.render.&lt;/p&gt;

&lt;p&gt;By trial and error I narrowed down the culprit to this part of the template: &amp;#8221;{% firstof forum.tagline &amp;#8220;Tagline.&amp;#8221; %}&amp;#8221;. forum.tagline comes from a datastore, so it&amp;#8217;s unicode. Error message tells me that (for whatever reason) template rendering is trying to convert that unicode string to ascii using ascii codec and (rightfully) failing.&lt;/p&gt;

&lt;p&gt;Using just &amp;#8221;{{ forum.tagline }}&amp;#8221; works so it seems that the problem is limited to firstof statement. The only solution I found was doing the firstof logic in python code and removing firstof from template.&lt;/p&gt;

&lt;p&gt;The bottom line is that firstof is useless if you ever hope to use it with non-ascii strings.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;ve &lt;a href="http://code.google.com/p/googleappengine/issues/detail?id=2303"&gt;opened a bug&lt;/a&gt; for this.&lt;/p&gt;</summary></entry><entry><title>Google Wave as replacement of EverNote</title><link href="http://blog.kowalczyk.info/article/Google-Wave-as-replacement-of-EverNote.html" rel="alternate"></link><updated>2009-10-21T01:50:23Z</updated><id>tag:blog.kowalczyk.info,2009-10-21:/article/Google-Wave-as-replacement-of-EverNote.html</id><summary type="html">&lt;p&gt;EverNote was the best note taking application I found so far. It&amp;#8217;s free and it works on Mac and Windows. Unfortunately the best does not mean it&amp;#8217;s good.&lt;/p&gt;

&lt;p&gt;While EverNote packs a lot of advanced features, like recognizing text in images, the basic functionality is riddled with bugs and unpolished experiences that I encounter on a daily basis. A real shame for software that has been in the market for so long.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;ve been using Google Wave for a few days and it looks like it might be a good note taker. It&amp;#8217;s inherently cross-platform by virtue of running in the browser, it has a pleasent user interface and all the basic text formating functionality that I need.&lt;/p&gt;

&lt;p&gt;It does have its share of bugs, but I&amp;#8217;m more forgiving given that it&amp;#8217;s a preview release and Google is very clear it&amp;#8217;s not a finished product.&lt;/p&gt;</summary></entry><entry><title>We need Visual Ack</title><link href="http://blog.kowalczyk.info/article/We-need-Visual-Ack.html" rel="alternate"></link><updated>2009-09-18T16:51:35Z</updated><id>tag:blog.kowalczyk.info,2009-09-18:/article/We-need-Visual-Ack.html</id><summary type="html">&lt;p&gt;&lt;a href="http://betterthangrep.com/"&gt;ack&lt;/a&gt; is a nifty improvement over grep written in perl. However, it&amp;#8217;s a command-line app and those days dumping results into terminal window isn&amp;#8217;t very inspired.&lt;/p&gt;

&lt;p&gt;What would be nice is a Visual Ack, which would present the results in an easier to digest way i.e. an app with native UI with results in a new window, nicely presented.&lt;/p&gt;

&lt;p&gt;That&amp;#8217;s my lazy web request for today.&lt;/p&gt;</summary></entry><entry><title>Sumatra 0.9.4 release</title><link href="http://blog.kowalczyk.info/article/Sumatra-094-release.html" rel="alternate"></link><updated>2009-07-20T07:07:21Z</updated><id>tag:blog.kowalczyk.info,2009-07-20:/article/Sumatra-094-release.html</id><summary type="html">&lt;p&gt;I&amp;#8217;ve released a new version of &lt;a href="http://blog.kowalczyk.info/software/sumatrapdf/"&gt;SumatraPDF&lt;/a&gt;, my &lt;span class="caps"&gt;PDF&lt;/span&gt; reader for Windows.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s been 9 months since previous release.&lt;/p&gt;

&lt;p&gt;This version mostly improves &lt;span class="caps"&gt;PDF&lt;/span&gt; compatibility (more PDFs can be opened and rendered), fixes lots of bugs reported in the bug tracker and adds UI polish.&lt;/p&gt;

&lt;p&gt;Many improvements in this version were contributed by Simon Bünzli and William Blum.&lt;/p&gt;

&lt;p&gt;The most visible changes are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;improved &lt;span class="caps"&gt;PDF&lt;/span&gt; compatibility (more types of documents can be rendered)&lt;/li&gt;
&lt;li&gt;added settings dialog (contributed by Simon Bünzli)&lt;/li&gt;
&lt;li&gt;improvements in handling unicode&lt;/li&gt;
&lt;li&gt;changed default view from single page to continuous&lt;/li&gt;
&lt;li&gt;SyncTex improvements (contributed by William Blum)&lt;/li&gt;
&lt;li&gt;add option to not remember opened files&lt;/li&gt;
&lt;li&gt;a new icon for documents association (contributed by George Georgiou)&lt;/li&gt;
&lt;li&gt;lots of bugfixes and UI polish&lt;/li&gt;
&lt;/ul&gt;</summary></entry><entry><title>15minutes for mac now available</title><link href="http://blog.kowalczyk.info/article/15minutes-for-mac-now-available.html" rel="alternate"></link><updated>2009-06-23T02:37:12Z</updated><id>tag:blog.kowalczyk.info,2009-06-23:/article/15minutes-for-mac-now-available.html</id><summary type="html">&lt;p&gt;My simple productivity application &lt;a href="http://blog.kowalczyk.info/software/15minutes/"&gt;15minutes&lt;/a&gt; used to only run on Windows. I just finished writing Mac OS X version so a blog post announcing it seems appropriate.&lt;/p&gt;</summary></entry><entry><title>Cocoa and Objective-C reference</title><link href="http://blog.kowalczyk.info/article/Cocoa-and-Objective-C-reference.html" rel="alternate"></link><updated>2009-06-15T03:00:14Z</updated><id>tag:blog.kowalczyk.info,2009-06-15:/article/Cocoa-and-Objective-C-reference.html</id><summary type="html">&lt;p&gt;I&amp;#8217;ve started programming in Cocoa again. I&amp;#8217;m only an advanced beginner in that framework so I often have to look up how to achieve even simple things. To make programming a little bit faster, I started working on a &lt;a href="/articles/cocoa-reference.html"&gt;Cocoa quick reference&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It lists the most frequently used methods and classes in Cocoa, with links to official Apple docs.&lt;/p&gt;

&lt;p&gt;On a side note, I think that existing quick reference guides on the web aren&amp;#8217;t very good. I have a few ideas on how they could be improved and hope to use those ideas in my Cocoa reference.&lt;/p&gt;</summary></entry><entry><title>Shared http caching</title><link href="http://blog.kowalczyk.info/article/Shared-http-caching.html" rel="alternate"></link><updated>2009-06-13T21:27:24Z</updated><id>tag:blog.kowalczyk.info,2009-06-13:/article/Shared-http-caching.html</id><summary type="html">&lt;p&gt;In March I &lt;a href="/article/How-content-based-addressing-can-help-web-perfor.html"&gt;wrote&lt;/a&gt; about an idea for tagging links with their sha1 checksum for better caching in web browser. Now I&amp;#8217;m &lt;a href="http://bouncybouncy.net/ramblings/posts/shared_http_caching/"&gt;not alone&lt;/a&gt;.&lt;/p&gt;</summary></entry><entry><title>Network drives, .net, security and virtualbox</title><link href="http://blog.kowalczyk.info/article/Network-drives-net-security-and-virtualbox.html" rel="alternate"></link><updated>2009-06-05T06:28:28Z</updated><id>tag:blog.kowalczyk.info,2009-06-05:/article/Network-drives-net-security-and-virtualbox.html</id><summary type="html">&lt;p&gt;I have Windows 7 installed on my MacBook under VirtualBox. To keep things simple, I keep my code on mac side, sharing the directory with Windows side.&lt;/p&gt;

&lt;p&gt;Tip #1: VirtualBox 2.2.4 has weak implementation of shared folders. For example, Visual Studio 2008 sees the files on shared drive as write-protected (even though other applications don&amp;#8217;t). Visual Studio 2010 doesn&amp;#8217;t have this problem, but it can&amp;#8217;t finish compilation, complaining it cannot write some intermediary build files to a shared folder. Also, trying to mark shared folder as trustworthy for .NET doesn&amp;#8217;t seem to work (see below).&lt;/p&gt;

&lt;p&gt;Solution: use Mac&amp;#8217;s built-in file sharing instead and shared things out using built-in samba (smb) sharing in System Preferences/Sharing.&lt;/p&gt;

&lt;p&gt;Another problem is that .NET by default doesn&amp;#8217;t trust code on network drives and Visual Studio will tell you that &amp;#8220;The Project Location is Not Trusted&amp;#8221; if you open a project from a network drive. The magic incantation to make a given shared folder (in my case it&amp;#8217;s drive z:) trusted is:&lt;/p&gt;

&lt;p&gt;&lt;pre class="prettyprint"&gt;
caspol -q -machine -addgroup 1.2 -url file://z:/* FullTrust&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;This command has to be executed as Administrator.&lt;/p&gt;

&lt;p&gt;One way to have &lt;code&gt;caspol.exe&lt;/code&gt; available in the &lt;span&gt;&lt;span class="caps"&gt;PATH&lt;/span&gt;&lt;/span&gt; is to start Visual Studio cmd-line (shortcut is installed in Start menu).&lt;/p&gt;</summary></entry><entry><title>Setting unicode rtf text in rich edit control</title><link href="http://blog.kowalczyk.info/article/Setting-unicode-rtf-text-in-rich-edit-control.html" rel="alternate"></link><updated>2009-04-15T06:36:41Z</updated><id>tag:blog.kowalczyk.info,2009-04-15:/article/Setting-unicode-rtf-text-in-rich-edit-control.html</id><summary type="html">&lt;p&gt;Despite being around for thousands of years, win32 &lt;span class="caps"&gt;API&lt;/span&gt; is poorly documented in many areas.&lt;/p&gt;

&lt;p&gt;Today I spent an hour battling a baffling problem with rich edit control.&lt;/p&gt;

&lt;p&gt;I was setting rtf-formatted text using &lt;code&gt;WM_SETTEXT&lt;/code&gt; message.&lt;/p&gt;

&lt;p&gt;In non-unicode build, where text was ansi, it worked and the text showed up nicely formatted.&lt;/p&gt;

&lt;p&gt;In unicode build, however, the text wasn&amp;#8217;t parsed as rtf and showed verbatim.&lt;/p&gt;

&lt;p&gt;An hour of trying various ways to make it work ended with me finding a working work-around: using &lt;code&gt;EM_SETTEXTEX&lt;/code&gt; and utf-8 encoded text with &lt;code&gt;CP_UTF8&lt;/code&gt; code-page. I&amp;#8217;m using &lt;span class="caps"&gt;WTL&lt;/span&gt; so the code ended up being:&lt;/p&gt;

&lt;p&gt;&lt;pre class="prettyprint"&gt;
#ifdef UNICODE
		// Don't know why I have to do this, but SetWindowText() with unicode
		// doesn't work (rtf codes are not being recognized)
		const char *sUtf = WstrToUtf8(s);
		m_statusMsgEdit.SetTextEx((LPCTSTR)sUtf, ST_DEFAULT, CP_UTF8);
#else
		m_statusMsgEdit.SetWindowText(s);
#endif&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class="caps"&gt;MSDN&lt;/span&gt; &lt;a href="http://msdn.microsoft.com/en-us/library/bb774284.aspx"&gt;claims&lt;/a&gt; I could have used code-page 1200 for unicode text, but that didn&amp;#8217;t work either.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s quite possible I&amp;#8217;ve botched something somewhere in my code and this work-around isn&amp;#8217;t needed but I can hardly think of anything. If you ever run into problem like this, the above is one thing to try.&lt;/p&gt;</summary></entry><entry><title>Accessing Mac file shares from Windows 7</title><link href="http://blog.kowalczyk.info/article/Accessing-Mac-file-shares-from-Windows-7.html" rel="alternate"></link><updated>2009-04-11T22:40:54Z</updated><id>tag:blog.kowalczyk.info,2009-04-11:/article/Accessing-Mac-file-shares-from-Windows-7.html</id><summary type="html">&lt;p&gt;Windows 7 beta 7000 can&amp;#8217;t access files shared from Mac through built-in samba file sharing out of the box. It&amp;#8217;s rather infuriating, because XP has no such problem and the error message given by windows when you try to navigate to a folder shared from mac is cryptic and not helpful at all. Turns out the culprit is purely how Windows 7 security is configured by default. Good news is it can be fixed via configuration tweaks as &lt;a href="http://www.pronetworks.org/forums/windows-7-and-mac-os-x-sharing-t104898.html"&gt;described here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In case this post goes away, here&amp;#8217;s what it says:&lt;/p&gt;

&lt;p&gt;Windows 7 will not work with Mac OS X Windows file sharing support by default. If you attempt to access a folder shared from Mac OS X, Vista will display a logon error repeatedly. The problem is that Vista, by default, will only use NTLMv2 for authentication, which is not supported by Mac OS X&amp;#8217;s Windows Sharing service. The other problem is the Minimum Session Security for &lt;span class="caps"&gt;NTVLM&lt;/span&gt; &lt;span class="caps"&gt;SSP&lt;/span&gt; based Clients.&lt;br /&gt;
To get around this:&lt;/p&gt;

&lt;p&gt;1. In Vista, open the Control Panel&lt;br /&gt;
2. Switch to &amp;#8220;Classic&amp;#8221; view&lt;br /&gt;
3. Double-click Administration Tools&lt;br /&gt;
4. Double-click Local Security Policy&lt;br /&gt;
5. Or Secpol.msc&lt;br /&gt;
6. Expand &amp;#8220;Local Policies&amp;#8221; and select &amp;#8220;Security Options&amp;#8221;&lt;br /&gt;
7. Alternate : Type secpol.msc to get editor up then&lt;br /&gt;
8. Locate &amp;#8220;Network Security: &lt;span class="caps"&gt;LAN&lt;/span&gt; Manager Authentication Level&amp;#8221; in the list and double-click it.&lt;br /&gt;
9. Change the setting from &amp;#8220;Send NTMLv2 response only&amp;#8221; to &amp;#8220;Send LM &amp;amp; &lt;span class="caps"&gt;NTLM&lt;/span&gt; &amp;#8211; use NTLMv2 session if negotiated&amp;#8221;&lt;br /&gt;
10. Network Security: Minimum session security for &lt;span class="caps"&gt;NTLM&lt;/span&gt; &lt;span class="caps"&gt;SSP&lt;/span&gt; Based (including secure &lt;span class="caps"&gt;RPC&lt;/span&gt;) Clients&lt;br /&gt;
11. Change the setting from &amp;#8220;require 128 bit&amp;#8221; to unchecked (No Minimum)&lt;br /&gt;
12. Click OK&lt;/p&gt;

&lt;p&gt;the real difference between vista and windows 7 procedure is 10 and 11&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s rather evil for Microsoft to choose defaults that make file sharing not interoperable with latest Mac OS X. It&amp;#8217;s not like they didn&amp;#8217;t test it so it must have been a conscious decision to screw with Mac users.&lt;/p&gt;</summary></entry><entry><title>15minutes - a simple productivity tool</title><link href="http://blog.kowalczyk.info/article/15minutes-a-simple-productivity-tool.html" rel="alternate"></link><updated>2009-04-09T05:48:04Z</updated><id>tag:blog.kowalczyk.info,2009-04-09:/article/15minutes-a-simple-productivity-tool.html</id><summary type="html">&lt;p&gt;&lt;img src="http://blog.kowalczyk.info/static/gfx/15minutes.png" alt="" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blog.kowalczyk.info/software/15minutes/"&gt;15minutes&lt;/a&gt; is a simple productivity tool I wrote.&lt;/p&gt;

&lt;p&gt;One of productivity techniques is &lt;a href="http://www.davecheong.com/2006/07/26/time-boxing-is-an-effective-getting-things-done-strategy/"&gt;time boxing&lt;/a&gt;. &lt;a href="http://www.pomodorotechnique.com/"&gt;Pomodoro technique&lt;/a&gt; is a similar idea.&lt;/p&gt;

&lt;p&gt;Procrastination is avoiding work. To avoid procrastination you just have to start working.&lt;/p&gt;

&lt;p&gt;One reason we avoid work is because the tasks seem big and overwhelming. Time boxing is a mental trick &amp;#8211; instead of thinking about doing the whole task, we focus about working on a task for a fixed, short period of time.&lt;/p&gt;

&lt;p&gt;To implement time boxing you need a timer which will alert you about the end of time boxing period.&lt;/p&gt;

&lt;p&gt;Any timer will do &amp;#8211; a physical timer, iPhone&amp;#8217;s built-in clock etc.&lt;/p&gt;

&lt;p&gt;I wrote a small application to do it, since most of my work is done on a computer. &lt;a href="http://blog.kowalczyk.info/software/15minutes/"&gt;15minutes&lt;/a&gt; is that application.&lt;/p&gt;</summary></entry><entry><title>Recent mupdf work</title><link href="http://blog.kowalczyk.info/article/Recent-mupdf-work.html" rel="alternate"></link><updated>2009-04-06T05:21:28Z</updated><id>tag:blog.kowalczyk.info,2009-04-06:/article/Recent-mupdf-work.html</id><summary type="html">&lt;p&gt;I&amp;#8217;ve been working a little bit on Sumatra and mupdf recently. The result of which are &lt;a href="http://bugs.ghostscript.com/buglist.cgi?bug_status=NEW&amp;amp;bug_status=ASSIGNED&amp;amp;bug_status=REOPENED&amp;amp;email1=kkowalczyk%40gmail.com&amp;amp;emailtype1=exact&amp;amp;emailassigned_to1=1&amp;amp;emailreporter1=1"&gt;9 patches&lt;/a&gt; submitted to mupdf upstream.&lt;/p&gt;</summary></entry><entry><title>Valgrind on mac</title><link href="http://blog.kowalczyk.info/article/Valgrind-on-mac.html" rel="alternate"></link><updated>2009-03-28T04:04:36Z</updated><id>tag:blog.kowalczyk.info,2009-03-28:/article/Valgrind-on-mac.html</id><summary type="html">&lt;p&gt;As of Mar 27 2009 Valgrind doesn&amp;#8217;t officially support mac but a port that is good enough is in progress. You can learn more and monitor the progress by reading &lt;a href="http://blog.mozilla.com/nnethercote/"&gt;Nicholas Nethercote&amp;#8217;s blog&lt;/a&gt; (main person working on Valgrind mac port).&lt;/p&gt;

&lt;p&gt;This post is a summary of how I built Valgrind on Mac (OS X 10.5.6).&lt;/p&gt;

&lt;p&gt;Since this involves compiling, you probably need developer tools. I have both XCode and a healthy does of &lt;a href="http://www.macports.org/"&gt;MacPorts&lt;/a&gt; dev packages installed. I&amp;#8217;m not sure how much you need, but I&amp;#8217;m guessing at least gcc, make, autotools.&lt;/p&gt;

&lt;p&gt;&lt;pre class="prettyprint"&gt;
svn co svn://svn.valgrind.org/valgrind/trunk valgrind
cd valgrind
./autogen.sh
./configure
make
sudo make install&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;So far I&amp;#8217;ve only tried Valgrind on mupdf and it worked, so this is very promising. Valgrind is invaluable tool for C/C++ memory leak detection, detecting memory mismanagement issues and profiling the code.&lt;/p&gt;

&lt;p&gt;An unfortunate deficiency is lack of a &lt;span class="caps"&gt;GUI&lt;/span&gt; for inspecting callgrind results (i.e. &lt;code&gt;kcachegrind&lt;/code&gt; equivalent on mac). Maybe the cheapest way to get that would be to convert callgrind results to shark format so that shark tools can be used. Should be possible &amp;#8211; I believe WebKit&amp;#8217;s JavaScript implementation saves profiling results in shark format, so there is code that could be used as a template for that.&lt;/p&gt;</summary></entry><entry><title>Unladden-swallow - making Python faster</title><link href="http://blog.kowalczyk.info/article/Unladden-swallow-making-Python-faster.html" rel="alternate"></link><updated>2009-03-28T03:02:47Z</updated><id>tag:blog.kowalczyk.info,2009-03-28:/article/Unladden-swallow-making-Python-faster.html</id><summary type="html">&lt;p&gt;When I&amp;#8217;m right, I&amp;#8217;m right. About a year ago &lt;a href="article/Why-Google-should-sponsor-a-faster-Python-VM.html"&gt;I said&lt;/a&gt; that Google should sponsor faster Python VM. And that&amp;#8217;s &lt;a href="http://code.google.com/p/unladen-swallow"&gt;exactly what they did&lt;/a&gt; by having 2 full time engineers &lt;a href="http://code.google.com/p/unladen-swallow/wiki/FAQ"&gt;working on unladden-swallow&lt;/a&gt;, a project to make Python much faster, with full intention to get all their improvements into mainline Python.&lt;/p&gt;

&lt;p&gt;The project looks very promising.&lt;/p&gt;

&lt;p&gt;It also shows that small teams can do great things. 2 people team is as small as it gets and if they manage to achieve their goal, they&amp;#8217;ll make a big difference in many programmer&amp;#8217;s lives.&lt;/p&gt;</summary></entry><entry><title>Interesting mac source code</title><link href="http://blog.kowalczyk.info/article/Interesting-mac-source-code.html" rel="alternate"></link><updated>2009-03-16T03:06:44Z</updated><id>tag:blog.kowalczyk.info,2009-03-16:/article/Interesting-mac-source-code.html</id><summary type="html">&lt;p&gt;Interesting mac sourcecode:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/understudy/"&gt;Understudy&lt;/a&gt; &amp;#8211; &lt;span class="caps"&gt;GPL&lt;/span&gt;, front row plugin that adds support for Hulu, Netflix, YouTube.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://ditchnet.org/httpclient/"&gt;&lt;span class="caps"&gt;HTTP&lt;/span&gt; Client&lt;/a&gt; &amp;#8211; &lt;span class="caps"&gt;BSD&lt;/span&gt;, UI for sending &lt;span class="caps"&gt;HTTP&lt;/span&gt; requests and inspecting &lt;span class="caps"&gt;HTTP&lt;/span&gt; requests/responses&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/macshark/"&gt;MacShark&lt;/a&gt;, network sniffer, nmap, dig, whois etc., New &lt;span class="caps"&gt;BSD&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/eavesdrop/"&gt;Eavesdrop&lt;/a&gt;, GPLv2, network sniffer&lt;/p&gt;

&lt;p&gt;&lt;a href="http://ridiculousfish.com/hexfiend/"&gt;hexfiend&lt;/a&gt;, &lt;span class="caps"&gt;BSD&lt;/span&gt;, hex editor&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/sourcelist/"&gt;iLife 08-like source list&lt;/a&gt;, New &lt;span class="caps"&gt;BSD&lt;/span&gt;, ui widget&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/apphider/"&gt;AppHider&lt;/a&gt; &amp;#8211; moves apps from doc to menubar&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/roaringdiff/"&gt;RoaringDiff&lt;/a&gt; &amp;#8211; graphical diff&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/readernotifier/"&gt;ReaderNotifier&lt;/a&gt; &amp;#8211; shows Google Reader status in menu bar&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/qsb-mac/"&gt;Quick Search Box&lt;/a&gt; &amp;#8211; from Google&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.ragingmenace.com/software/menumeters/"&gt;MenuMeters&lt;/a&gt; &amp;#8211; &lt;span class="caps"&gt;GPL&lt;/span&gt;, shows stuff in menu bar&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.cocoadev.com/index.pl?HTTPFileUploadSample"&gt;Http upload sample&lt;/a&gt;&lt;/p&gt;</summary></entry><entry><title>Silverlight info</title><link href="http://blog.kowalczyk.info/article/Silverlight-info.html" rel="alternate"></link><updated>2009-03-14T23:16:43Z</updated><id>tag:blog.kowalczyk.info,2009-03-14:/article/Silverlight-info.html</id><summary type="html">&lt;p&gt;&lt;a href="http://blogs.msdn.com/jstegman/archive/2008/04/21/dynamic-image-generation-in-silverlight.aspx"&gt;http://blogs.msdn.com/jstegman/archive/2008/04/21/dynamic-image-generation-in-silverlight.aspx&lt;/a&gt; has code to dynamically generate bitmaps in Silverlight.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/fjcore/"&gt;FJCore&lt;/a&gt; &amp;#8211; Jpeg decoder and encoder + resizing, in just C#&lt;/p&gt;</summary></entry><entry><title>Interesting win32 source code</title><link href="http://blog.kowalczyk.info/article/Interesting-win32-source-code.html" rel="alternate"></link><updated>2009-03-14T23:14:12Z</updated><id>tag:blog.kowalczyk.info,2009-03-14:/article/Interesting-win32-source-code.html</id><summary type="html">&lt;p&gt;Interesting win32 source code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/puttycyg/"&gt;puttycyg&lt;/a&gt; &amp;#8211; cygwin terminal, putty modified to also be a cygwin terminal, &lt;span class="caps"&gt;MIT&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/"&gt;putty&lt;/a&gt;, &lt;span class="caps"&gt;MIT&lt;/span&gt;, &lt;a href="http://www.xs4all.nl/~whaa/putty/"&gt;putty Tray&lt;/a&gt;, enhancements to Putty&lt;/li&gt;
&lt;li&gt;&lt;a href="http://fabrice.bellard.free.fr/qemacs/"&gt;qemacs&lt;/a&gt;, &lt;span class="caps"&gt;LGPL&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://wtl.sourceforge.net/"&gt;&lt;span class="caps"&gt;WTL&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.cockos.com/wdl/"&gt;&lt;span class="caps"&gt;WDL&lt;/span&gt;&lt;/a&gt; &amp;#8211; Justin Frankel&amp;#8217;s library for win32 &amp;amp; win32 emulation for mac, &lt;span class="caps"&gt;BSD&lt;/span&gt;-like&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.ntwind.com/software/taskswitchxp/download.html"&gt;TaskSwitchXP&lt;/a&gt; &amp;#8211; &lt;span class="caps"&gt;BSD&lt;/span&gt;-like (?)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/stb-imv/"&gt;stb-img&lt;/a&gt;, &lt;span class="caps"&gt;GPL&lt;/span&gt; with parts in public domain (zlib, png, jpeg decompressors)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/qsniffer/"&gt;qsniffer&lt;/a&gt;, GPLv2, network sniffer in qt, cross-platforms&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/msnwcrec/"&gt;msnwcrec&lt;/a&gt; &amp;#8211; msn webcam recorder, GPLv2&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/orionsniffer/"&gt;orionsniffer&lt;/a&gt;, tcp/ip packet sniffer, GPLv2, uses winpcap&lt;/li&gt;
&lt;li&gt;&lt;a href="http://gynvael.coldwind.pl/?id=130&amp;amp;lang=en"&gt;ansi codes in cmd.exe&lt;/a&gt;, article with source code about patching cmd.exe&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codersnotes.com/sleepy/"&gt;very sleepy&lt;/a&gt;, &lt;span class="caps"&gt;GPL&lt;/span&gt;, simple profiler for windows&lt;/li&gt;
&lt;li&gt;&lt;a href="http://filezilla-project.org/"&gt;FileZill&lt;/a&gt;, &lt;span class="caps"&gt;GPL&lt;/span&gt;, C++&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Debugging/rec-related code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/opendbg/"&gt;opendbg&lt;/a&gt;, GPLv3&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/leaktrap/"&gt;leaktrap&lt;/a&gt;, &lt;span class="caps"&gt;GPL&lt;/span&gt;, gdi/user handle leak tracking and analysis, hooks win32 apis&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/cdbg/"&gt;cdbg&lt;/a&gt;, GPLv3, console user-mode debugger&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/ngdbg/"&gt;ngdbg&lt;/a&gt;, GPLv3, live kernel-mode debugger&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/openrce-snippets/"&gt;openrce-snippets&lt;/a&gt;, &lt;span class="caps"&gt;MIT&lt;/span&gt;, &lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/pefile/"&gt;pefile&lt;/a&gt;, &lt;span class="caps"&gt;MIT&lt;/span&gt;, Python library to work with pe format&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/paimei/"&gt;paimei&lt;/a&gt;, GPLv2, reverse engineering framework in pyton&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.paulsprojects.net/vmachine/vmachine.html"&gt;vmachine&lt;/a&gt;, PC emulator&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Debugging,rec tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.peid.info/"&gt;peid&lt;/a&gt;, unpacker, decryptor of pe files for win, also has process viewer, pe details, disassembler etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;span class="caps"&gt;PDF&lt;/span&gt;-related source code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/openjpeg/"&gt;openjpeg&lt;/a&gt;, New &lt;span class="caps"&gt;BSD&lt;/span&gt;, &lt;span class="caps"&gt;JPEG&lt;/span&gt; 2000 in C&lt;/li&gt;
&lt;/ul&gt;</summary></entry><entry><title>Forcing basic http authentication for HttpWebRequest (in .NET/C#)</title><link href="http://blog.kowalczyk.info/article/Forcing-basic-http-authentication-for-HttpWebReq.html" rel="alternate"></link><updated>2009-03-14T23:12:55Z</updated><id>tag:blog.kowalczyk.info,2009-03-14:/article/Forcing-basic-http-authentication-for-HttpWebReq.html</id><summary type="html">&lt;p&gt;HttpWebRequest is a handy .NET class for doing &lt;span class="caps"&gt;HTTP&lt;/span&gt; requests. It has built-in support for &lt;span class="caps"&gt;HTTP&lt;/span&gt; basic authentication via credentials. However, it doesn&amp;#8217;t work the way I expected: supplying credentials doesn&amp;#8217;t send Authorization &lt;span class="caps"&gt;HTTP&lt;/span&gt; header with the request but only in response to server&amp;#8217;s challenge. It often breaks in real world, where servers might not issue a challenge and simply not authenticate a request.&lt;/p&gt;

&lt;p&gt;Fortunately fixing it by manually adding Authorization &lt;span class="caps"&gt;HTTP&lt;/span&gt; header to the request is simple and this code snippet shows how to do it:&lt;/p&gt;

&lt;p&gt;&lt;pre class="prettyprint"&gt;
public void SetBasicAuthHeader(WebRequest req, String userName, String userPassword)
{
    string authInfo = userName + ":" + userPassword;
    authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
    req.Headers["Authorization"] = "Basic " + authInfo;
}&lt;/pre&gt;&lt;/p&gt;</summary></entry><entry><title>WTL resources</title><link href="http://blog.kowalczyk.info/article/WTL-resources.html" rel="alternate"></link><updated>2009-03-14T22:56:22Z</updated><id>tag:blog.kowalczyk.info,2009-03-14:/article/WTL-resources.html</id><summary type="html">&lt;p&gt;&lt;span class="caps"&gt;WTL&lt;/span&gt; programming resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/"&gt;&lt;span class="caps"&gt;WTL&lt;/span&gt; articles on codeproject.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/wtlthreads.aspx"&gt;Threads for &lt;span class="caps"&gt;WTL&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/wtlinet.aspx"&gt;&lt;span class="caps"&gt;INET&lt;/span&gt; for &lt;span class="caps"&gt;WTL&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/wtl4mfc1.aspx"&gt;&lt;span class="caps"&gt;WTL&lt;/span&gt; for &lt;span class="caps"&gt;MFC&lt;/span&gt;: &lt;span class="caps"&gt;ATL&lt;/span&gt; &lt;span class="caps"&gt;GUI&lt;/span&gt; Classes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/wtl4mfc2.aspx"&gt;&lt;span class="caps"&gt;WTL&lt;/span&gt; for &lt;span class="caps"&gt;MFC&lt;/span&gt;: &lt;span class="caps"&gt;WTL&lt;/span&gt; &lt;span class="caps"&gt;GUI&lt;/span&gt; Base Classes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/wtl4mfc3.aspx"&gt;&lt;span class="caps"&gt;WTL&lt;/span&gt; for &lt;span class="caps"&gt;MFC&lt;/span&gt;: toolbars and status bars&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/wtl4mfc4.aspx"&gt;&lt;span class="caps"&gt;WTL&lt;/span&gt; for &lt;span class="caps"&gt;MFC&lt;/span&gt;: dialogs and controls&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/wtl4mfc5.aspx"&gt;&lt;span class="caps"&gt;WTL&lt;/span&gt; for &lt;span class="caps"&gt;MFC&lt;/span&gt;: advanced dialog ui classes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/wtl4mfc6.aspx"&gt;&lt;span class="caps"&gt;WTL&lt;/span&gt; for &lt;span class="caps"&gt;MFC&lt;/span&gt;: Hosting ActiveX controls&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/wtl4mfc7.aspx"&gt;&lt;span class="caps"&gt;WTL&lt;/span&gt; for &lt;span class="caps"&gt;MFC&lt;/span&gt;: Splitter Windows&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/wtl4mfc8.aspx"&gt;&lt;span class="caps"&gt;WTL&lt;/span&gt; for &lt;span class="caps"&gt;MFC&lt;/span&gt;: Property Sheets and Wizards&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/wtl4mfc9.aspx"&gt;&lt;span class="caps"&gt;WTL&lt;/span&gt; for &lt;span class="caps"&gt;MFC&lt;/span&gt;: &lt;span class="caps"&gt;GDI&lt;/span&gt; Classes, common dialogs and utility classes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/wtl4mfc10.aspx"&gt;&lt;span class="caps"&gt;WTL&lt;/span&gt; for &lt;span class="caps"&gt;MFC&lt;/span&gt;: drag &amp;amp; drop source&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/wtldlgresize.aspx"&gt;Using &lt;span class="caps"&gt;WTL&lt;/span&gt;&amp;#8216;s Built-in Dialog Resizing Class&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/tips.aspx"&gt;10 &lt;span class="caps"&gt;WTL&lt;/span&gt; tips&lt;/a&gt; (window creation size, centering a window, setting min/max size of a window, dialog text and background color, dynamically swap buttons, default font)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/resourcelessdialogtoolkit.aspx"&gt;Creating dialogs at runtime&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/regst.aspx"&gt;Saving window state&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeproject.com/KB/wtl/sizingframework.aspx"&gt;Sizing framework&lt;/a&gt; based on &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc302145.aspx"&gt;WinMgr sizing article&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</summary></entry><entry><title>scdiff update (Windows git/subversion/cvs gui diff previewer)</title><link href="http://blog.kowalczyk.info/article/scdiff-update-Windows-gitsubversioncvs-gui-diff-.html" rel="alternate"></link><updated>2009-03-12T04:40:44Z</updated><id>tag:blog.kowalczyk.info,2009-03-12:/article/scdiff-update-Windows-gitsubversioncvs-gui-diff-.html</id><summary type="html">&lt;p&gt;I&amp;#8217;ve updated my little &lt;a href="/software/scdiff/index.html"&gt;scdiff&lt;/a&gt; program and added git support.&lt;/p&gt;

&lt;p&gt;If you work with git, Subversion or &lt;span class="caps"&gt;CVS&lt;/span&gt; from command line, scdiff is a handy program to preview your changes before committing them.&lt;/p&gt;

&lt;p&gt;It works by creating before/after files in a temporary directory and launching a diff viewer (WinDiff by default, but can be configured) to show the diffs.&lt;/p&gt;

&lt;p&gt;It auto-detects which scm is being used in a given directory, so you launch it by simply typing &lt;code&gt;scdiff&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It requires git/svn/cvs executable be in the path. There still is no decent windows build of git, so I use cygwin to get git.&lt;/p&gt;</summary></entry><entry><title>Parsing s3 log files in python</title><link href="http://blog.kowalczyk.info/article/Parsing-s3-log-files-in-python.html" rel="alternate"></link><updated>2009-03-08T23:54:37Z</updated><id>tag:blog.kowalczyk.info,2009-03-08:/article/Parsing-s3-log-files-in-python.html</id><summary type="html">&lt;p&gt;After we &lt;a href="/article/Compacting-s3-aws-logs.html"&gt;took care of compacting s3 logs&lt;/a&gt;, it&amp;#8217;s time to parse them. s3 log format is &lt;a href="http://docs.amazonwebservices.com/AmazonS3/latest/index.html?LogFormat.html"&gt;well documented&lt;/a&gt; and can be parsed with a simple regular expression.&lt;/p&gt;

&lt;p&gt;It took me some time to craft it, so here it is. You can also view the source &lt;a href="http://code.google.com/p/kjk/source/browse/trunk/scripts/test_parse_s3_log.py"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;pre class="prettyprint"&gt;
#!/usr/bin/env python
import re

s3_line_logpats  = r'(\S+) (\S+) \[(.*?)\] (\S+) (\S+) ' \
           r'(\S+) (\S+) (\S+) "([^"]+)" ' \
           r'(\S+) (\S+) (\S+) (\S+) (\S+) (\S+) ' \
           r'"([^"]+)" "([^"]+)"'

s3_line_logpat = re.compile(s3_line_logpats)

(S3_LOG_BUCKET_OWNER, S3_LOG_BUCKET, S3_LOG_DATETIME, S3_LOG_IP,
S3_LOG_REQUESTOR_ID, S3_LOG_REQUEST_ID, S3_LOG_OPERATION, S3_LOG_KEY,
S3_LOG_HTTP_METHOD_URI_PROTO, S3_LOG_HTTP_STATUS, S3_LOG_S3_ERROR,
S3_LOG_BYTES_SENT, S3_LOG_OBJECT_SIZE, S3_LOG_TOTAL_TIME,
S3_LOG_TURN_AROUND_TIME, S3_LOG_REFERER, S3_LOG_USER_AGENT) = range(17)

s3_names = ("bucket_owner", "bucket", "datetime", "ip", "requestor_id", 
"request_id", "operation", "key", "http_method_uri_proto", "http_status", 
"s3_error", "bytes_sent", "object_size", "total_time", "turn_around_time",
"referer", "user_agent")

def parse_s3_log_line(line):
    match = s3_line_logpat.match(line)
    result = [match.group(1+n) for n in range(17)]
    return result

def dump_parsed_s3_line(parsed):
    for (name, val) in zip(s3_names, parsed):
        print("%s: %s" % (name, val))

def test():
    l = r'607c4573f2972c26aff39f7e56ff0490881a35c19b9bf94072cbab8c3219f948 kjkpub [06/Mar/2009:23:13:28 +0000] 41.221.20.231 65a011a29cdf8ec533ec3d1ccaae921c C46E93FF2E865AC1 REST.GET.OBJECT sumatrapdf/rel/SumatraPDF-0.9.1.zip "GET /sumatrapdf/rel/SumatraPDF-0.9.1.zip HTTP/1.1" 206 - 43457 1003293 697 611 "http://kjkpub.s3.amazonaws.com/sumatrapdf/rel/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"'
    parsed = parse_s3_log_line(l)
    dump_parsed_s3_line(parsed)

if __name__ == "__main__":
    test()&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;This snippet only shows how to break one s3 log line into its components (&lt;code&gt;parse_s3_log_line&lt;/code&gt;). Some work is needed to build upon this for parsing log files and extracting useful information out of them. For doing that, I recommend techniques described in &lt;a href="http://www.dabeaz.com/generators-uk/"&gt;Generator Tricks for Systems Programmers&lt;/a&gt;&lt;/p&gt;</summary></entry></feed>