<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Solving problems, doing Software.


Software Engineer. 
Software Architecture, Agile  Development, 
Django, Python, jQuery, C etc. 
Open Source enthusiast. 




  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-19787977-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</description><title>Robert Lujo's Homepage</title><generator>Tumblr (3.0; @trebor74hr)</generator><link>http://robert-lujo.com/</link><item><title>Answering questions on Stackoverflow </title><description>&lt;p&gt;The last few days I was answering questions on stackoverflow - mainly related to python and db2. It came out a bit addictive. Now I have 20 answers, raised my reputation to 449 and reached top 10% this week :).&lt;/p&gt;

&lt;p&gt;Check my profile at &lt;a href="http://stackoverflow.com/users/565525/robert-lujo" target="_blank"&gt;http://stackoverflow.com/users/565525/robert-lujo&lt;/a&gt; .&lt;/p&gt;</description><link>http://robert-lujo.com/post/50289382200</link><guid>http://robert-lujo.com/post/50289382200</guid><pubDate>Sun, 12 May 2013 23:25:00 +0200</pubDate></item><item><title>Destructuring assignment / tuple unpack in Python - by examples</title><description>&lt;p&gt;Destructuring assignment (a.k.a. tuple unpack) in Python, seems to be very useful thing. The most basic variant:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&amp;#187;&amp;gt; x,y = 1,2&lt;br/&gt;&amp;#187;&amp;gt; x,y&lt;br/&gt;(1, 2)&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;what is identical to:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&amp;#187;&amp;gt; x, y = [1,2]&lt;br/&gt;&amp;#187;&amp;gt; x, y = (1,2)&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;!-- more --&gt;&lt;/p&gt;
&lt;p&gt;Any iterator would fit, e.g. class impl. __iter__ function (coroutine):&lt;/p&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&amp;#187;&amp;gt; class test(object):&lt;br/&gt;&amp;#8230;     def __iter__(self):&lt;br/&gt;&amp;#8230;         for x in (1,2): yield x&lt;br/&gt;&amp;#187;&amp;gt; a,b = test()&lt;br/&gt;&amp;#187;&amp;gt; a,b&lt;br/&gt;(1, 2)&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;regular function would produce the same result:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&amp;#187;&amp;gt; def test(): &lt;br/&gt;&amp;#8230; for x in (1,2): yield x&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Using destructuring is specially useful when function/method returns more than one result (technically, it returns only one result - tuple):&lt;/p&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&amp;#187;&amp;gt; def f(): return 1,2&lt;br/&gt;&amp;#187;&amp;gt; x,y = f()&lt;br/&gt;&amp;#187;&amp;gt; x,y&lt;br/&gt;(1, 2)&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Although I&amp;#8217;m working with python from the version 2.2., recently I have played around with Clojure and discovered that some advanced desctructuring features that Clojure offers, can be found in python too, e.g.:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&amp;#187;&amp;gt; x,[y,z] = 1,[2,3]&lt;br/&gt;&amp;#187;&amp;gt; x, y, z&lt;br/&gt;(1, 2, 3)&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;more complex example (note that variable &amp;#8220;_&amp;#8221; is 2 times assigned):&lt;/p&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&amp;#187;&amp;gt; x,[y,z,[w,_,t,_]] = 1,[2,3,(4,5,6,7)]&lt;br/&gt;&amp;#187;&amp;gt; x,y,z,w,t,_&lt;br/&gt;(1, 2, 3, 4, 6, 7)&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;What looks very useful is that, destructuring can be used in function&amp;#8217;s argument declaration:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&amp;#187;&amp;gt; def f(a,(b,c)):&lt;br/&gt;&amp;#8230;     print a,b,c&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;This function expects 2 arguments, of which second one must be some iterator type with exactly two members:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&amp;#187;&amp;gt; f(1,(2,3))&lt;br/&gt;1&amp;#160;2 3&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;UPDATE:It seems that python3 deprecates this feature, i.e. this doesn&amp;#8217;t work in python 3.1:&lt;/em&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;def f(a,(b,c)): print a,b,c&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Why? Read  &lt;a href="http://www.python.org/dev/peps/pep-3113/." target="_blank"&gt;http://www.python.org/dev/peps/pep-3113/.&lt;/a&gt; Any alternative? They suggest using function annotations (py3+) &lt;a href="http://www.python.org/dev/peps/pep-3107/." target="_blank"&gt;http://www.python.org/dev/peps/pep-3107/.&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&lt;br/&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Python 3.0+ offers taking rest of tuple into last variable:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&amp;#187;&amp;gt; x,y,*z = 1,2,3,4,5&lt;br/&gt;&amp;#187;&amp;gt; x,y,z&lt;br/&gt;(1, 2, [3, 4, 5])&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;more complex example - having nesting lists (python 3.0+):&lt;/p&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&amp;#187;&amp;gt; x,[y,*z],t,*w = 1,[2,3,4],5,6,7&lt;br/&gt;&amp;#187;&amp;gt; x,y,z,t,w&lt;br/&gt;(1, 2, [3, 4], 5, [6, 7])&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Argument unpacking naturally follows destructuring theme, which can be seen as &amp;#8220;opposite&amp;#8221; operation . Small example:&lt;/p&gt;
&lt;blockquote&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&amp;#187;&amp;gt; def f(a,b): print a,b&lt;br/&gt;&amp;#8230; &lt;br/&gt;&amp;#187;&amp;gt; f(*[1,2])&lt;br/&gt;1&amp;#160;2&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;(Note: the same could be achived with apply function until it was deprecated in python 3+).&lt;br/&gt;&lt;br/&gt;Destructuring is common thing in other languages, e.g. javascript, ruby, php (example &lt;a href="http://artlung.com/blog/2007/02/21/destructured-assignment-in-ruby-php-and-javascript/" target="_blank"&gt;http://artlung.com/blog/2007/02/21/destructured-assignment-in-ruby-php-and-javascript/&lt;/a&gt;).&lt;br/&gt;&lt;br/&gt;It seems that good ideas are constantly being freely &amp;#8220;borrowed&amp;#8221;.&lt;/p&gt;</description><link>http://robert-lujo.com/post/40871820711</link><guid>http://robert-lujo.com/post/40871820711</guid><pubDate>Fri, 18 Jan 2013 23:33:00 +0100</pubDate><category>python</category></item><item><title>permset - utility for *nix permissions mgmt based on patterns - release 0.22</title><description>&lt;p&gt;&lt;div class="post_title"&gt;&lt;a href="https://github.com/trebor74hr/permset" target="_blank"&gt;Permset&lt;/a&gt; is simple standalone utility script to manage *nix permissions on file and directory trees based on patterns. New release 0.22 contains following improvements:&lt;/div&gt;
&lt;div class="post_title"&gt;
&lt;ul&gt;&lt;li&gt;variable substitution for user and group in patterns&lt;/li&gt;
&lt;li&gt;short statistics displayed on the pattern listing&lt;/li&gt;
&lt;li&gt;documentation improvements&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;/p&gt;</description><link>http://robert-lujo.com/post/37971668818</link><guid>http://robert-lujo.com/post/37971668818</guid><pubDate>Sat, 15 Dec 2012 10:02:00 +0100</pubDate><category>python</category><category>linux</category></item><item><title>permset - utility for mgnt of *nix permissions based on patterns</title><description>&lt;p&gt;I had just released 0.20 version of permset.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/trebor74hr/permset" target="_blank"&gt;Permset&lt;/a&gt; is simple standalone utility script to manage *nix permissions on file and directory trees based on patterns.&lt;/p&gt;
&lt;p&gt;Check the example session to get into the idea behind.&lt;/p&gt;</description><link>http://robert-lujo.com/post/37721763756</link><guid>http://robert-lujo.com/post/37721763756</guid><pubDate>Tue, 11 Dec 2012 18:34:00 +0100</pubDate><category>python</category><category>django</category><category>security</category><category>unix</category><category>shell</category></item><item><title>Twitter incremental backup in YAML format - python, HTML get and parse</title><description>&lt;p&gt;I use &lt;a target="_blank" href="http://twitter.com/#!/trebor74hr"&gt;Twitter&lt;/a&gt; primarly as a bookmarking service.&lt;/p&gt;
&lt;p&gt;I know that &lt;a target="_blank" href="http://twitter.com/#!/trebor74hr"&gt;Twitter&lt;/a&gt; is not bookmarking service and there are specialized services for such needs. In my case, using this way started as an experiment, but later I found this way very convenient.&lt;/p&gt;
&lt;p&gt;I wrote a script that enables me to incrementally backup all my tweets in a textual file in YAML format, by parsing HTML Twitter pages. Explanation and the script follows …&lt;/p&gt;
&lt;!-- more --&gt;
&lt;h3&gt;My case&lt;/h3&gt;
&lt;p&gt;So this is my case:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;I read a lot&lt;/li&gt;
&lt;li&gt;Google Reader&lt;/li&gt;
&lt;li&gt;HTC Desire smartphone&lt;/li&gt;
&lt;li&gt;everything I found interesting is sent to &lt;a target="_blank" href="http://twitter.com/#!/trebor74hr"&gt;Twitter&lt;/a&gt; by using Android Peep Twitter application&lt;/li&gt;
&lt;li&gt;tweets are tagged by prefixing keywords with hashes (#)&lt;/li&gt;
&lt;li&gt;tweets are backuped to textual file which is held in my Dropbox folder&lt;/li&gt;
&lt;li&gt;backup should be incremental&lt;/li&gt;
&lt;li&gt;backup should be readable by human and machine - YAML is chosen&lt;/li&gt;
&lt;li&gt;(future) all tweets/bookmarks will be publicly available on my site with advanced browsing feature&lt;/li&gt;
&lt;/ul&gt;&lt;h3&gt;The script&lt;/h3&gt;
&lt;p&gt;Based on the &lt;a target="_blank" href="http://code.activestate.com/recipes/576594/"&gt;script&lt;/a&gt; made by &lt;a target="_blank" href="http://movingtofreedom.org/2009/03/18/python-script-for-backing-up-twitter-statuses/"&gt;Scott Carpenter&lt;/a&gt; I made a &lt;a target="_blank" href="http://code.activestate.com/recipes/577877-twitter-incremental-backup-in-yaml-format-by-html-/"&gt;python script&lt;/a&gt; that doesn’t use Twitter API, but reads &lt;a target="_blank" href="http://twitter.com/#!/trebor74hr"&gt;Twitter&lt;/a&gt; HTML pages, parses them and collect tweets. On the other hand backup file is in YAML file, it is parsed and then only collected tweets that don’t exist in YAML file are written to the top of the file. The script needs &lt;a target="_blank" href="http://www.crummy.com/software/BeautifulSoup/"&gt;BeautifulSoup&lt;/a&gt; HTML parsing package, and &lt;a target="_blank" href="http://pyyaml.org/"&gt;pyyaml&lt;/a&gt; so if you don’t have it yet:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pip install beautifulsoup
pip install pyyaml

&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Example of usage&lt;/h3&gt;
&lt;p&gt;Example of usage:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; dbox twitter-bak trebor74hr twitter-trebor74hr-backup.yaml
Reading &lt;a target="_blank" href="http://twitter.com/trebor74hr,"&gt;&lt;a href="http://twitter.com/trebor74hr," target="_blank"&gt;http://twitter.com/trebor74hr,&lt;/a&gt;&lt;/a&gt; backup in twitter-trebor74hr-backup.yaml
started at 2011-09-24 18:30:13.937000
  1. page - read and parse
      20/ 20 tweets saved/processed. Waiting 2 seconds before fetching next page...
  2. page - read and parse
      40/ 40 tweets saved/processed. Waiting 2 seconds before fetching next page...
  3. page - read and parse
      60/ 60 tweets saved/processed. Waiting 2 seconds before fetching next page...
  4. page - read and parse
      80/ 80 tweets saved/processed. Waiting 2 seconds before fetching next page...
  5. page - read and parse
      89/100 tweets saved/processed. Waiting 2 seconds before fetching next page...
  6. page - read and parse
      No new tweets found, quit iteration ...
89/120 tweets saved in twitter-trebor74hr-backup.yaml

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Try again, no new tweets:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; dbox twitter-bak trebor74hr twitter-trebor74hr-backup.yaml
Reading &lt;a target="_blank" href="http://twitter.com/trebor74hr,"&gt;&lt;a href="http://twitter.com/trebor74hr," target="_blank"&gt;http://twitter.com/trebor74hr,&lt;/a&gt;&lt;/a&gt; backup in twitter-trebor74hr-backup.yaml,
started at 2011-09-24 18:30:49.906000
  1. page - read and parse
     No new tweets found, quit iteration ...
No new tweets found in 20 tweets analysed, file twitter-trebor74hr-backup.yaml

&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;The result&lt;/h3&gt;
&lt;p&gt;The result is in twitter-trebor74hr-backup.yaml:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;- content : "RT @williamtincup RT Don’t Be 'That Guy' as a Manager
            bit.ly/qJL8nx [http://t.co/fxy2IrIe] @greatleadership"
  date_time: "Fri Sep 23 20:17:32 +0000 2011"
  status_id: "117331787797102592"
  url: "http://twitter.com/#!/trebor74hr/status/117331787797102592"

- content : "python.mirocommunity.org [http://t.co/WYu9ygAb] #Python
            #Miro  Community - All Python #Video , All the Time"
  date_time: "Fri Sep 23 20:12:34 +0000 2011"
  status_id: "117330534635540481"
  url: "http://twitter.com/#!/trebor74hr/status/117330534635540481"

...


&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Again, the script is …&lt;/h3&gt;
&lt;p&gt;The script can be found &lt;a target="_blank" href="http://code.activestate.com/recipes/577877-twitter-incremental-backup-in-yaml-format-by-html-/"&gt;here&lt;/a&gt;.&lt;/p&gt;</description><link>http://robert-lujo.com/post/10603896621</link><guid>http://robert-lujo.com/post/10603896621</guid><pubDate>Sat, 24 Sep 2011 19:35:00 +0200</pubDate><category>backup</category><category>python</category><category>twitter</category><category>yaml</category></item><item><title>Mercurial branches - 'named branches' way - prefered way to do it?</title><description>&lt;p&gt;Mercurial provides many ways to do branch based development. I was searchingfor the best in-repo branch solution. I chose named branches &amp;#8230;&lt;/p&gt;
&lt;!-- more --&gt;
&lt;h3&gt;Branching in mercurial&lt;/h3&gt;
&lt;p&gt;Mercurial provides following solutions to branch based development:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
&lt;p&gt;hg tag + hg clone + push/pull&amp;#160;:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;dvcs - isolation done with distinct repositories&lt;/li&gt;
&lt;li&gt;in the &lt;a href="http://hgbook.red-bean.com/read/managing-releases-and-branchy-development.html" target="_blank"&gt;book&lt;/a&gt; it looks like this is most common way to do branch development&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;hg branch , a.k.a. named branches&amp;#160;:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;standard builtin command(s)&lt;/li&gt;
&lt;li&gt;enable in-repo branches&lt;/li&gt;
&lt;li&gt;can be transfered accross the wire&lt;/li&gt;
&lt;li&gt;the subject of this article&lt;/li&gt;
&lt;li&gt;reference &lt;a href="http://mercurial.selenic.com/wiki/NamedBranches" target="_blank"&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;bookmarks extensions&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;hg bookmarks - standard mercurial extension&lt;/li&gt;
&lt;li&gt;needs to be enabled&lt;/li&gt;
&lt;li&gt;transfered if both sides enable extension&lt;/li&gt;
&lt;li&gt;IMHO very similar to named branches but not so elegant&lt;/li&gt;
&lt;li&gt;reference &lt;a href="http://mercurial.selenic.com/wiki/BookmarksExtension#Working_With_Remote_Repositories" target="_blank"&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;anonymous branch&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;hg up -C  + hg ci -m”commit on old revision”&lt;/li&gt;
&lt;li&gt;system similar to named branches, but with no names ;)&lt;/li&gt;
&lt;li&gt;reference &lt;a href="http://mercurial.selenic.com/wiki/BookmarksExtension#Working_With_Remote_Repositories" target="_blank"&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;mq extension&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;extension for management of mutable changesets, that can be used for branch development too, but haven’t yet figured how ;)&lt;/li&gt;
&lt;li&gt;seems a bit complicated for my needs&lt;/li&gt;
&lt;li&gt;reference &lt;a href="http://mercurial.selenic.com/wiki/MqTutorial" target="_blank"&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Between all these options I chose named branches as the best way to do in-repo branches (simple, native, handy, works accross the wire, just works). The basic workflow is explained in next sections.&lt;/p&gt;
&lt;h2&gt;Commands&lt;/h2&gt;
&lt;p&gt;I won’t explain much, I’ll just list operations used in standard workflow of branch development.&lt;/p&gt;
&lt;h3&gt;Create new named branch&lt;/h3&gt;
&lt;p&gt;The command will create new branch named for instance, after feature nr. 91 (such branch should not previously exist). After command finishes, it will switch working copy to newly created branch:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;default&amp;gt; hg branch feat91
&amp;lt;feat91&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;List all created branches&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;gt; hg branches
default
feat91
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;On which branch am I?&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;feat91&amp;gt; hg branch
feat91
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Switch working copy to branch&lt;/h3&gt;
&lt;p&gt;The command will switch working copy (with local changes) to branch feat91:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;default&amp;gt; hg update feat91
&amp;lt;feat91&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(some documentation suggests using -C  option but it works without -C).&lt;/p&gt;
&lt;h3&gt;First push of newly created branch to other repo&lt;/h3&gt;
&lt;p&gt;First push of newly created branch to other repo needs extra option —new-branch:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;gt; hg push --new-branch
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next pushes goes normal (hg push).&lt;/p&gt;
&lt;h3&gt;See incomming changes from feat91 to current&lt;/h3&gt;
&lt;p&gt;How to see incomming changes from feat91 to current - default branch (preview merge):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;default&amp;gt; hg merge -P feat91
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Merge changes from branch feat91 to default&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;default&amp;gt; hg merge feat91
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;check changes and commit:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;default&amp;gt; hg commit -m"merged feat91 -&amp;gt; default"
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Merge changes from default branch to feat91&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;feat91&amp;gt; hg merge feat91
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;check changes and commit:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;feat91&amp;gt; hg commit -m"merged default -&amp;gt; feat91"
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Close a branch&lt;/h2&gt;
&lt;p&gt;There are many ways to &lt;a href="http://mercurial.selenic.com/wiki/PruningDeadBranches" target="_blank"&gt;do it&lt;/a&gt;, but this one I found as the most regular one. Workflow:&lt;/p&gt;
&lt;p&gt;list branches&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;feat91&amp;gt; hg branches
default
feat91
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;close a branch:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;feat91&amp;gt; hg commit --close-branch -m "close feat91"
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The command will just chang status of branch to “closed”, the branch won’t be stripped, and you can come back to it anytime, and if you like you can reactivate it and continue development on it.&lt;/p&gt;
&lt;p&gt;After closing it is advised to switch to an active branch:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;feat91&amp;gt; hg up default
&lt;/code&gt;&lt;span&gt;&lt;br/&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span&gt;Default listing of branches won’t show closed:&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;default&amp;gt;hg branches
default
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But if you like you can list closed too:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;default&amp;gt; hg branches -c
default
feat91 (closed)
&lt;/code&gt;&lt;span&gt;&lt;br/&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span&gt;Like noted before, after closing you can switch to closed branch:&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;default&amp;gt; hg up feat91
&amp;lt;feat91&amp;gt;
&lt;/code&gt;&lt;span&gt;&lt;br/&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span&gt;You can make changes and commit - what will automatically put branch to “reopened” state:&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;feat91&amp;gt; hg ci -m"commit in feat91 after close"
reopening closed branch head 11

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;List branches after reopening:     &amp;lt;&amp;gt; hg branches -c     default     feat91     (inactive)&lt;/p&gt;
&lt;p&gt;and you can close it again:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;feat91&amp;gt; hg ci --close-branch -m"closing feat91 again"

&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;View branches log graphically&lt;/h2&gt;
&lt;p&gt;hg serve won’t show this graphically, but there is extension graphlog which can show this in console. &lt;a href="http://mercurial.selenic.com/wiki/GraphlogExtension" target="_blank"&gt;&lt;a href="http://mercurial.selenic.com/wiki/GraphlogExtension" target="_blank"&gt;http://mercurial.selenic.com/wiki/GraphlogExtension&lt;/a&gt;&lt;/a&gt; Enable it in .hg\hgrc&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[extensions]
hgext.graphlog =
&lt;/code&gt;&lt;span&gt;&lt;br/&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span&gt;and try:&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;default&amp;gt; hg glog
...&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;| o  changeset:   8:4b4d4b76110b
| |  branch:      feat91
| |  user:        trebor74hr
| |  date:        Sat Sep 03 18:47:43 2011 +0200
| |  summary:     new feature in feat91
| |
| o  changeset:   7:8d78dd2d7334
|/|  branch:      feat91
| |  parent:      4:0d29e1ecb689
| |  parent:      6:04ec650ace3c
| |  user:        trebor74hr
| |  date:        Sat Sep 03 18:45:04 2011 +0200
| |  summary:     merged default -&amp;gt; feat91
| |
o |  changeset:   6:04ec650ace3c
|\|  parent:      5:3c4a79f2ac3b
| |  parent:      4:0d29e1ecb689
| |  user:        trebor74hr@gmail.com
| |  date:        Sat Sep 03 18:39:28 2011 +0200
| |  summary:     merged feat91 -&amp;gt; default
| |
o |  changeset:   5:3c4a79f2ac3b
| |  parent:      2:fbc6ab30159e
| |  user:        trebor74hr@gmail.com
| |  date:        Sat Sep 03 18:34:06 2011 +0200
| |  summary:     ovaj ci u default branch-u zelim u feat91 branch prebaciti
| |
| o  changeset:   4:0d29e1ecb689
| |  branch:      feat91
| |  user:        trebor74hr
| |  date:        Sat Sep 03 18:33:54 2011 +0200
| |  summary:     ovo je f1 commit u feat91
| |
| o  changeset:   3:308b5d06a330
|/   branch:      feat91
|    user:        trebor74hr
|    date:        Sat Sep 03 18:29:52 2011 +0200
|    summary:     branch feat91 commit
|
o  changeset:   2:fbc6ab30159e
|  user:        trebor74hr@gmail.com
|  date:        Sat Sep 03 18:28:07 2011 +0200
|  summary:     noc
...

&lt;/code&gt;&lt;span&gt;Other references&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/" target="_blank"&gt;A guide to branching in Mercurial&lt;/a&gt; with comparison to git - a bit obsolete but good&lt;/li&gt;
&lt;li&gt;&lt;a href="http://hgbook.red-bean.com/read/managing-releases-and-branchy-development.html" target="_blank"&gt;Managing releases and branchy development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://mercurial.selenic.com/wiki/BranchingExplained" target="_blank"&gt;Mercurial wiki: BranchingExplained&lt;/a&gt; - with comparision to git, a bit obsolete, doesn’t cover named branches&lt;/li&gt;
&lt;/ul&gt;</description><link>http://robert-lujo.com/post/9968996307</link><guid>http://robert-lujo.com/post/9968996307</guid><pubDate>Thu, 08 Sep 2011 23:33:00 +0200</pubDate><category>mercurial</category><category>vcs</category></item><item><title>How to count characters, bytes and words in Vim</title><description>&lt;p&gt;The article provides some information and tips on the subject: how to count characters, bytes and words in &lt;a target="_blank" href="http://vim.org"&gt;Vim&lt;/a&gt;.&lt;/p&gt;
&lt;!-- more --&gt;
&lt;h3&gt;Vim status line&lt;/h3&gt;
&lt;p&gt;When you do selection in vim in the status line there is information on how many chars/lines are selected:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
&lt;p&gt;when selection is in one line then you can see nr. of chars:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;-- visual --                                    34&lt;br/&gt;&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;when selection goes over several lines then you can see nr. of lines:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;-- visual --                                     2&lt;br/&gt;&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;h3&gt;Get me more information&lt;/h3&gt;
&lt;p&gt;I wanted to get information on &lt;strong&gt;how many chars are selected in selection over several lines&lt;/strong&gt;. When I do selection and press the sequence (normal mode):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;g+(CTRL+G)&lt;/p&gt;
&lt;p&gt;reference :help v_g_CTRL-G&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;that gives me the information:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
&lt;p&gt;when there is no selection:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;col 34 of 60; line 193 of 216; word 927 of 1046; byte 7216 of 8226&lt;br/&gt;&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;when you select something:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;selected 1 of 216 lines; 4 of 1046 words; 45 of 8226 bytes&lt;br/&gt;&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;h3&gt;I want to count something special&lt;/h3&gt;
&lt;p&gt;Vim version 7 - adds option [n] to :s(ubstite) command:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;[n] Report the number of matches, &lt;strong&gt;do not actually substitute&lt;/strong&gt;. The [c]         flag is ignored.  The matches are reported as if ‘report’ is zero.         Useful to |count-items|.&lt;/p&gt;
&lt;p&gt;reference :help s_flags&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This option can produce more power count functions, i.e. you can count number of matches of any regular expression. Examples:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;:%s/.//gn - count all chars&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre&gt;&lt;code&gt;5544 matches on 176 lines&lt;br/&gt;&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;:%s/\S//gn - count non-space chars&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre&gt;&lt;code&gt;4080 matches on 167 lines&lt;br/&gt;&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;:%s/\s//gn - count space chars&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre&gt;&lt;code&gt;1413 on 148 lines&lt;br/&gt;&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h4&gt;Note&lt;/h4&gt;
&lt;p&gt;More information how to count items in vim can be found:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;:help count-items&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There you can find examples to count with &lt;em&gt;:s&lt;/em&gt; command with [n] option, but there are mostly in the form:&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;&lt;code&gt;   :%s/./&amp;amp;/gn&lt;br/&gt;&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;i.e. they use &amp;amp; as replacement char (replace the same). Since option [n] doesn’t replace anything the effect is the same as:&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;&lt;code&gt;   :%s/.//gn&lt;br/&gt;&lt;br/&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;I tested in Vim version 7 and the behaviour is like described.&lt;/p&gt;</description><link>http://robert-lujo.com/post/2659036096</link><guid>http://robert-lujo.com/post/2659036096</guid><pubDate>Sun, 09 Jan 2011 01:06:00 +0100</pubDate><category>vim</category></item><item><title>Go on windows tutorial (#golang)</title><description>&lt;p&gt;Recently I invested some time to learn about new and popular language &lt;a href="http://golang.org/" target="_blank"&gt;Go&lt;/a&gt;. I wanna give a test-drive, and since I have Windows XP and there is no GO official windows Go port, I needed to do some manual work.&lt;/p&gt;
&lt;p&gt;&lt;!-- more --&gt;This is the procedure:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;download go windows port (mingw) from &lt;a href="http://code.google.com/p/gomingw/downloads/detail?name=gowin32_2010-12-22.zip&amp;amp;can=2&amp;amp;q=" target="_blank"&gt;&lt;a href="http://code.google.com/p/gomingw/downloads/detail?name=gowin32_2010-12-22.zip&amp;amp;can=2&amp;amp;q=" target="_blank"&gt;http://code.google.com/p/gomingw/downloads/detail?name=gowin32_2010-12-22.zip&amp;amp;can=2&amp;amp;q=&lt;/a&gt;&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;unzip to some folder. I did this in c:\testing\go,  so I have c:\testing\go\bin\8g.exe&lt;/li&gt;
&lt;li&gt;create batch file set-go.bat and put it in the folder that is in sys path, e.g. c:\windows\system32\set-go.bat:&lt;/li&gt;
&lt;/ul&gt;&lt;blockquote&gt;
&lt;p&gt;    @echo off&lt;/p&gt;
&lt;p&gt;    set GOROOT=c:\testing\go&lt;/p&gt;
&lt;p&gt;    set GOOS=windows&lt;/p&gt;
&lt;p&gt;    set GOARCH=386&lt;/p&gt;
&lt;p&gt;    SET PATH=%GOROOT%\bin;%PATH%&lt;/p&gt;
&lt;p&gt;    echo Set GOROOT=%GOROOT%&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Start GO env. shell:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;start DOS prompt, e.g. start/run/cmd&lt;/li&gt;
&lt;li&gt;call set-go&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Someone could ask why I didn&amp;#8217;t put these vars to global system path (my computer right click, props, env. vars &amp;#8230;). The answer is: I don&amp;#8217;t do things like this, I like having more control over my shell environment. If you want to set it globally - check this &lt;a href="http://www.youtube.com/watch?v=X1VHXwhlDmo" target="_blank"&gt;link&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Now environment is ready, and I can write go programs, compile and run them like this:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;create new file hello.go&lt;/li&gt;
&lt;/ul&gt;&lt;blockquote&gt;
&lt;p&gt;        package main&lt;/p&gt;
&lt;p&gt;        func main() {&lt;/p&gt;
&lt;p&gt;            println(&amp;#8220;Hello world.&amp;#8221;)&lt;/p&gt;
&lt;p&gt;            }&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;&lt;li&gt;go to the folder in your DOS-GO prompt and compile it - output is in hello.8:&lt;/li&gt;
&lt;/ul&gt;&lt;blockquote&gt;
&lt;p&gt;        8g hello.go&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;&lt;li&gt;link it - output is in hello.exe&lt;/li&gt;
&lt;/ul&gt;&lt;blockquote&gt;
&lt;p&gt;        8l -o hello.exe hello.8&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;&lt;li&gt;run it:&lt;/li&gt;
&lt;/ul&gt;&lt;blockquote&gt;
&lt;p&gt;        &amp;gt; hello.exe&lt;/p&gt;
&lt;p&gt;        Hello world.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Additional notes:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Go dev team is developing &lt;a href="http://code.google.com/p/go/wiki/WindowsPort" target="_blank"&gt;official windows port&lt;/a&gt; - so stay tuned&lt;/li&gt;
&lt;li&gt;On &lt;a href="http://stackoverflow.com/questions/1717652/can-go-compiler-be-installed-on-windows" target="_blank"&gt;&lt;a href="http://stackoverflow.com/questions/1717652/can-go-compiler-be-installed-on-windows" target="_blank"&gt;http://stackoverflow.com/questions/1717652/can-go-compiler-be-installed-on-windows&lt;/a&gt;&lt;/a&gt; you can find other useful information and similar tutorial.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Good luck Go-ing!&lt;/p&gt;</description><link>http://robert-lujo.com/post/2601000047</link><guid>http://robert-lujo.com/post/2601000047</guid><pubDate>Wed, 05 Jan 2011 00:15:00 +0100</pubDate><category>golang</category></item><item><title>Tubmlr per-tag RSS feed</title><description>&lt;p&gt;Tubmlr supports tagging. This post is tagged with &amp;#8220;tumblr&amp;#8221;. The page that lists all posts tagged with &amp;#8220;tubmlr&amp;#8221; is:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://trebor74hr.tumblr.com/tagged/tumblr/" target="_blank"&gt;http://trebor74hr.tumblr.com/tagged/tumblr/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Although the page provides RSS feed:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://trebor74hr.tumblr.com/rss" target="_blank"&gt;http://trebor74hr.tumblr.com/rss&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;this is not per-tag feed, &lt;strong&gt;you RSS feed for all posts :(.&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;Solution&lt;/h3&gt;
&lt;p&gt;Hopefully there is solution, RSS feed that provides only posts tagged with tag &amp;#8220;tumblr&amp;#8221; is:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://trebor74hr.tumblr.com/tagged/tumblr/rss" target="_blank"&gt;http://trebor74hr.tumblr.com/tagged/tumblr/rss&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;And it works&amp;#160;!!!&lt;/strong&gt;&lt;/p&gt;</description><link>http://robert-lujo.com/post/1384291995</link><guid>http://robert-lujo.com/post/1384291995</guid><pubDate>Sun, 24 Oct 2010 00:30:00 +0200</pubDate><category>tumblr</category></item></channel></rss>
